kindlich před 6 roky
rodič
revize
222c198437
No known key found for this signature in database

+ 0
- 28
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/JavaBytecodeRunUnit.java Zobrazit soubor

@@ -142,27 +142,13 @@ public class JavaBytecodeRunUnit {
142 142
 
143 143
 	public class ScriptClassLoader extends ClassLoader {
144 144
 		private final Map<String, Class> customClasses = new HashMap<>();
145
-		private final ClassLoader parent;
146 145
 
147 146
 		public ScriptClassLoader(ClassLoader parent) {
148 147
 			super(parent);
149
-			this.parent = parent;
150 148
 		}
151 149
 
152 150
 		@Override
153 151
 		public Class<?> loadClass(String name) throws ClassNotFoundException {
154
-			//System.out.println("LoadClass " + name);
155
-
156
-			if (findLoadedClassMethod != null) {
157
-				try {
158
-					Class<?> clazz = (Class<?>) findLoadedClassMethod.invoke(this.parent, name);
159
-					if (clazz != null)
160
-						return clazz;
161
-				} catch (IllegalAccessException | InvocationTargetException e) {
162
-					e.printStackTrace();
163
-				}
164
-			}
165
-
166 152
 			if (customClasses.containsKey(name))
167 153
 				return customClasses.get(name);
168 154
 			if (classes.containsKey(name)) {
@@ -175,20 +161,6 @@ public class JavaBytecodeRunUnit {
175 161
 	}
176 162
 
177 163
 
178
-	static {
179
-		Method method;
180
-		try {
181
-			method = ClassLoader.class.getDeclaredMethod("findLoadedClass", String.class);
182
-			method.setAccessible(true);
183
-		} catch (NoSuchMethodException e) {
184
-			e.printStackTrace();
185
-			method = null;
186
-		}
187
-		findLoadedClassMethod = method;
188
-	}
189
-
190
-	private static final Method findLoadedClassMethod;
191
-
192 164
 	private static Class<?> loadClass(ClassLoader classLoader, String descriptor) throws ClassNotFoundException {
193 165
 		switch (descriptor) {
194 166
 			case "Z": return boolean.class;

Loading…
Zrušit
Uložit