String (String globString) { StringBuilder result = new StringBuilder(); Glob glob = new Glob(globString); try { Method m = glob.getClass().getDeclaredMethod("convertGlobToRegEx", String.class, List.class, StringBuilder.class); m.setAccessible(true); m.invoke(glob, globString, new ArrayList<>(), result); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { throw new RuntimeException(e); } return result.toString(); }