Bladeren bron

Made the bytecode run unit throw errors instead of eating them

Jared 5 jaren geleden
bovenliggende
commit
82257b2a71
No account linked to committer's email address

+ 8
- 11
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/JavaBytecodeRunUnit.java Bestand weergeven

@@ -22,10 +22,11 @@ import java.io.File;
22 22
 import java.io.FileOutputStream;
23 23
 import java.io.IOException;
24 24
 import java.lang.reflect.InvocationTargetException;
25
-import java.lang.reflect.Method;
26
-import java.util.*;
27
-import java.util.logging.Level;
28
-import java.util.logging.Logger;
25
+import java.util.ArrayList;
26
+import java.util.Collections;
27
+import java.util.HashMap;
28
+import java.util.List;
29
+import java.util.Map;
29 30
 
30 31
 /**
31 32
  * @author Hoofdgebruiker
@@ -57,15 +58,15 @@ public class JavaBytecodeRunUnit {
57 58
 		}
58 59
 	}
59 60
 
60
-	public void run() {
61
+	public void run() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
61 62
 		run(Collections.emptyMap(), this.getClass().getClassLoader());
62 63
 	}
63 64
 
64
-	public void run(Map<FunctionParameter, Object> arguments) {
65
+	public void run(Map<FunctionParameter, Object> arguments) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
65 66
 		run(arguments, this.getClass().getClassLoader());
66 67
 	}
67 68
 
68
-	public void run(Map<FunctionParameter, Object> arguments, ClassLoader parentClassLoader) {
69
+	public void run(Map<FunctionParameter, Object> arguments, ClassLoader parentClassLoader) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
69 70
 		writeScripts();
70 71
 
71 72
 		ScriptClassLoader classLoader = new ScriptClassLoader(parentClassLoader);
@@ -78,14 +79,10 @@ public class JavaBytecodeRunUnit {
78 79
 
79 80
 			argumentsArray[i] = arguments.get(parameter);
80 81
 		}
81
-		try {
82 82
 			Class[] classes = new Class[scriptParameters.size()];
83 83
 			for (int i = 0; i < classes.length; i++)
84 84
 				classes[i] = loadClass(classLoader, scriptParameterInfo.get(i).typeDescriptor);
85 85
 			classLoader.loadClass("Scripts").getMethod("run", classes).invoke(null, argumentsArray);
86
-		} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException | IllegalAccessException | SecurityException | IllegalArgumentException ex) {
87
-			Logger.getLogger(JavaBytecodeRunUnit.class.getName()).log(Level.SEVERE, null, ex);
88
-		}
89 86
 	}
90 87
 
91 88
 	public void dump(File directory) {

Laden…
Annuleren
Opslaan