public String inferModuleName(Location location) { try { Method inferModuleName = Jvm.getMethod(JavaFileManager.class, "inferModuleName", Location.class); return (String) inferModuleName.invoke(fileManager, location); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
public Location getLocationForModule(Location location, JavaFileObject fo) { try { Method getLocationForModule = Jvm.getMethod(JavaFileManager.class, "getLocationForModule", Location.class, JavaFileObject.class); return (Location) getLocationForModule.invoke(fileManager, location, fo); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
public Location getLocationForModule(Location location, String moduleName) { try { Method getLocationForModule = Jvm.getMethod(JavaFileManager.class, "getLocationForModule", Location.class, String.class); return (Location) getLocationForModule.invoke(fileManager, location, moduleName); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
public <S> ServiceLoader<S> getServiceLoader(Location location, Class<S> service) { try { Method getServiceLoader = Jvm.getMethod(JavaFileManager.class, "getServiceLoader", Location.class, Class.class); return (ServiceLoader<S>) getServiceLoader.invoke(fileManager, location, service); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
public Location getLocationForModule(Location location, String moduleName) { try { Method getLocationForModule = Jvm.getMethod(JavaFileManager.class, "getLocationForModule", Location.class, String.class); return (Location) getLocationForModule.invoke(fileManager, location, moduleName); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
public <S> ServiceLoader<S> getServiceLoader(Location location, Class<S> service) { try { Method getServiceLoader = Jvm.getMethod(JavaFileManager.class, "getServiceLoader", Location.class, Class.class); return (ServiceLoader<S>) getServiceLoader.invoke(fileManager, location, service); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
public Iterable<Set<Location>> listLocationsForModules(Location location) { try { Method listLocationsForModules = Jvm.getMethod(JavaFileManager.class, "listLocationsForModules", Location.class); return (Iterable<Set<Location>>) listLocationsForModules.invoke(fileManager, location); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
public Iterable<Set<Location>> listLocationsForModules(Location location) { try { Method listLocationsForModules = Jvm.getMethod(JavaFileManager.class, "listLocationsForModules", Location.class); return (Iterable<Set<Location>>) listLocationsForModules.invoke(fileManager, location); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
public boolean contains(Location location, FileObject fo) { try { Method contains = Jvm.getMethod(JavaFileManager.class, "contains", Location.class, JavaFileObject.class); return (Boolean) contains.invoke(fileManager, location, fo); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } } }
public Location getLocationForModule(Location location, JavaFileObject fo) { try { Method getLocationForModule = Jvm.getMethod(JavaFileManager.class, "getLocationForModule", Location.class, JavaFileObject.class); return (Location) getLocationForModule.invoke(fileManager, location, fo); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
public String inferModuleName(Location location) { try { Method inferModuleName = Jvm.getMethod(JavaFileManager.class, "inferModuleName", Location.class); return (String) inferModuleName.invoke(fileManager, location); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
public boolean contains(Location location, FileObject fo) { try { Method contains = Jvm.getMethod(JavaFileManager.class, "contains", Location.class, JavaFileObject.class); return (Boolean) contains.invoke(fileManager, location, fo); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } } }
@Override public void clean(final ByteBuffer buffer) { try { final Method cleanerMethod; cleanerMethod = DirectBuffer.class. getDeclaredMethod("cleaner"); Jvm.setAccessible(cleanerMethod); final Object cleaner = cleanerMethod.invoke(buffer); final String cleanerClassname = Jvm.isJava9Plus() ? JDK9_CLEANER_CLASS_NAME : JDK8_CLEANER_CLASS_NAME; final Method cleanMethod = Jvm.getMethod(Class.forName(cleanerClassname), "clean"); cleanMethod.invoke(cleaner); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | ClassNotFoundException e) { LOGGER.warn("Failed to clean buffer", e); } }
@Override public void clean(final ByteBuffer buffer) { try { final Method cleanerMethod; cleanerMethod = DirectBuffer.class. getDeclaredMethod("cleaner"); Jvm.setAccessible(cleanerMethod); final Object cleaner = cleanerMethod.invoke(buffer); final String cleanerClassname = Jvm.isJava9Plus() ? JDK9_CLEANER_CLASS_NAME : JDK8_CLEANER_CLASS_NAME; final Method cleanMethod = Jvm.getMethod(Class.forName(cleanerClassname), "clean"); cleanMethod.invoke(cleaner); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | ClassNotFoundException e) { LOGGER.warn("Failed to clean buffer", e); } }