< prev index next >
modules/fxml/src/main/java/com/sun/javafx/fxml/ModuleHelper.java
Print this page
rev 9717 : 8151320: Remove unnecessary addReads from JavaFX
@@ -32,12 +32,10 @@
import java.security.PrivilegedAction;
import sun.reflect.misc.MethodUtil;
public class ModuleHelper {
private static final Method getModuleMethod;
- private static final Method addReadsMethod;
- private static final Method addExportsMethod;
private static final Method getResourceAsStreamMethod;
private static final boolean verbose;
static {
@@ -46,30 +44,22 @@
if (verbose) {
System.err.println("" + ModuleHelper.class.getName() + " : <clinit>");
}
Method mGetModule = null;
- Method mAddReads = null;
- Method mAddExports = null;
Method mGetResourceAsStream = null;
try {
mGetModule = Class.class.getMethod("getModule");
Class<?> moduleClass = mGetModule.getReturnType();
- mAddReads = moduleClass.getMethod("addReads", moduleClass);
- mAddExports = moduleClass.getMethod("addExports", String.class, moduleClass);
mGetResourceAsStream = moduleClass.getMethod("getResourceAsStream", String.class);
} catch (NoSuchMethodException e) {
// ignore
}
getModuleMethod = mGetModule;
- addReadsMethod = mAddReads;
- addExportsMethod = mAddExports;
getResourceAsStreamMethod = mGetResourceAsStream;
if (verbose) {
System.err.println("getModuleMethod = " + getModuleMethod);
- System.err.println("addReadsMethod = " + addReadsMethod);
- System.err.println("addExportsMethod = " + addExportsMethod);
System.err.println("getResourceAsStreamMethod = " + getResourceAsStreamMethod);
}
}
public static Object getModule(Class clazz) {
@@ -81,30 +71,11 @@
}
}
return null;
}
- public static void addReads(Object thisModule, Object targetModule) {
- if (addReadsMethod != null) {
- try {
- addReadsMethod.invoke(thisModule, targetModule);
- } catch (IllegalAccessException | InvocationTargetException ex) {
- throw new RuntimeException(ex);
- }
- }
- }
-
- public static void addExports(Object thisModule, String packageName, Object targetModule) {
- if (addExportsMethod != null) {
- try {
- addExportsMethod.invoke(thisModule, packageName, targetModule);
- } catch (IllegalAccessException | InvocationTargetException ex) {
- throw new RuntimeException(ex);
- }
- }
- }
-
+ // FIXME: JIGSAW -- remove this method if not needed
public static InputStream getResourceAsStream(Object thisModule, String name) {
if (getResourceAsStreamMethod != null) {
try {
return (InputStream)getResourceAsStreamMethod.invoke(thisModule, name);
} catch (IllegalAccessException | InvocationTargetException ex) {
< prev index next >