|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
| package edu.rice.cs.drjava.model.repl.newjvm; |
|
38 |
| |
|
39 |
| import java.lang.reflect.*; |
|
40 |
| import java.util.*; |
|
41 |
| import java.io.*; |
|
42 |
| |
|
43 |
| import java.rmi.*; |
|
44 |
| |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| |
|
49 |
| import edu.rice.cs.util.OutputStreamRedirector; |
|
50 |
| import edu.rice.cs.util.InputStreamRedirector; |
|
51 |
| import edu.rice.cs.util.UnexpectedException; |
|
52 |
| import edu.rice.cs.util.classloader.ClassFileError; |
|
53 |
| import edu.rice.cs.util.newjvm.*; |
|
54 |
| import edu.rice.cs.plt.collect.CollectUtil; |
|
55 |
| import edu.rice.cs.plt.iter.IterUtil; |
|
56 |
| import edu.rice.cs.plt.reflect.ReflectUtil; |
|
57 |
| import edu.rice.cs.plt.tuple.Option; |
|
58 |
| import edu.rice.cs.plt.tuple.OptionVisitor; |
|
59 |
| import edu.rice.cs.plt.tuple.Pair; |
|
60 |
| import edu.rice.cs.plt.text.TextUtil; |
|
61 |
| |
|
62 |
| import edu.rice.cs.drjava.platform.PlatformFactory; |
|
63 |
| import edu.rice.cs.drjava.model.junit.JUnitModelCallback; |
|
64 |
| import edu.rice.cs.drjava.model.junit.JUnitTestManager; |
|
65 |
| import edu.rice.cs.drjava.model.junit.JUnitError; |
|
66 |
| import edu.rice.cs.drjava.model.repl.InteractionsPaneOptions; |
|
67 |
| |
|
68 |
| import edu.rice.cs.dynamicjava.Options; |
|
69 |
| import edu.rice.cs.dynamicjava.interpreter.*; |
|
70 |
| import edu.rice.cs.dynamicjava.symbol.*; |
|
71 |
| import edu.rice.cs.dynamicjava.symbol.type.Type; |
|
72 |
| |
|
73 |
| |
|
74 |
| import javax.swing.JDialog; |
|
75 |
| |
|
76 |
| import static edu.rice.cs.plt.debug.DebugUtil.debug; |
|
77 |
| import static edu.rice.cs.plt.debug.DebugUtil.error; |
|
78 |
| |
|
79 |
| |
|
80 |
| |
|
81 |
| |
|
82 |
| |
|
83 |
| |
|
84 |
| |
|
85 |
| |
|
86 |
| |
|
87 |
| public class InterpreterJVM extends AbstractSlaveJVM implements InterpreterJVMRemoteI, JUnitModelCallback { |
|
88 |
| |
|
89 |
| |
|
90 |
| public static final InterpreterJVM ONLY = new InterpreterJVM(); |
|
91 |
| |
|
92 |
| |
|
93 |
| |
|
94 |
| |
|
95 |
| private final InteractionsPaneOptions _interpreterOptions; |
|
96 |
| private volatile Pair<String, Interpreter> _activeInterpreter; |
|
97 |
| private final Interpreter _defaultInterpreter; |
|
98 |
| private final Map<String, Interpreter> _interpreters; |
|
99 |
| private final Set<Interpreter> _busyInterpreters; |
|
100 |
| |
|
101 |
| |
|
102 |
| |
|
103 |
| private final ClassPathManager _classPathManager; |
|
104 |
| private final ClassLoader _interpreterLoader; |
|
105 |
| |
|
106 |
| |
|
107 |
| private final Object _stateLock = new Object(); |
|
108 |
| |
|
109 |
| |
|
110 |
| private final JUnitTestManager _junitTestManager; |
|
111 |
| |
|
112 |
| |
|
113 |
| private volatile MainJVMRemoteI _mainJVM; |
|
114 |
| |
|
115 |
| |
|
116 |
180
| private InterpreterJVM() {
|
|
117 |
180
| super("Reset Interactions Thread", "Poll DrJava Thread");
|
|
118 |
| |
|
119 |
180
| _classPathManager = new ClassPathManager(ReflectUtil.SYSTEM_CLASS_PATH);
|
|
120 |
180
| _interpreterLoader = _classPathManager.makeClassLoader(null);
|
|
121 |
180
| _junitTestManager = new JUnitTestManager(this, _classPathManager);
|
|
122 |
| |
|
123 |
| |
|
124 |
180
| Thread.currentThread().setContextClassLoader(_interpreterLoader);
|
|
125 |
| |
|
126 |
| |
|
127 |
180
| _interpreterOptions = new InteractionsPaneOptions();
|
|
128 |
180
| _defaultInterpreter = new Interpreter(_interpreterOptions, _interpreterLoader);
|
|
129 |
180
| _interpreters = new HashMap<String,Interpreter>();
|
|
130 |
180
| _busyInterpreters = new HashSet<Interpreter>();
|
|
131 |
| |
|
132 |
180
| _activeInterpreter = Pair.make("", _defaultInterpreter);
|
|
133 |
| } |
|
134 |
| |
|
135 |
| |
|
136 |
| |
|
137 |
180
| protected void handleStart(MasterRemote mainJVM) {
|
|
138 |
| |
|
139 |
180
| _mainJVM = (MainJVMRemoteI) mainJVM;
|
|
140 |
| |
|
141 |
| |
|
142 |
180
| System.setIn(new InputStreamRedirector() {
|
|
143 |
1
| protected String _getInput() {
|
|
144 |
1
| try { return _mainJVM.getConsoleInput(); }
|
|
145 |
| catch(RemoteException re) { |
|
146 |
0
| error.log(re);
|
|
147 |
0
| throw new UnexpectedException("Main JVM can't be reached for input.\n" + re);
|
|
148 |
| } |
|
149 |
| } |
|
150 |
| }); |
|
151 |
| |
|
152 |
| |
|
153 |
180
| System.setOut(new PrintStream(new OutputStreamRedirector() {
|
|
154 |
9
| public void print(String s) {
|
|
155 |
9
| try { _mainJVM.systemOutPrint(s); }
|
|
156 |
| catch (RemoteException re) { |
|
157 |
0
| error.log(re);
|
|
158 |
0
| throw new UnexpectedException("Main JVM can't be reached for output.\n" + re);
|
|
159 |
| } |
|
160 |
| } |
|
161 |
| })); |
|
162 |
| |
|
163 |
| |
|
164 |
180
| System.setErr(new PrintStream(new OutputStreamRedirector() {
|
|
165 |
2
| public void print(String s) {
|
|
166 |
2
| try { _mainJVM.systemErrPrint(s); }
|
|
167 |
| catch (RemoteException re) { |
|
168 |
0
| error.log(re);
|
|
169 |
0
| throw new UnexpectedException("Main JVM can't be reached for output.\n" + re);
|
|
170 |
| } |
|
171 |
| } |
|
172 |
| })); |
|
173 |
| |
|
174 |
| |
|
175 |
| |
|
176 |
| |
|
177 |
| |
|
178 |
180
| if (PlatformFactory.ONLY.isWindowsPlatform()) {
|
|
179 |
0
| JDialog d = new JDialog();
|
|
180 |
0
| d.setSize(0,0);
|
|
181 |
0
| d.setVisible(true);
|
|
182 |
0
| d.setVisible(false);
|
|
183 |
| } |
|
184 |
| |
|
185 |
| } |
|
186 |
| |
|
187 |
| |
|
188 |
3
| private Interpreter getInterpreter(String name) {
|
|
189 |
3
| synchronized(_interpreters) {return _interpreters.get(name); }
|
|
190 |
| } |
|
191 |
2
| private boolean isInterpreterName(String name) {
|
|
192 |
2
| synchronized(_interpreters) {return _interpreters.containsKey(name); }
|
|
193 |
| } |
|
194 |
2
| private Interpreter putInterpreter(String name, Interpreter i) {
|
|
195 |
2
| synchronized(_interpreters) { return _interpreters.put(name, i); }
|
|
196 |
| } |
|
197 |
| |
|
198 |
0
| public void removeInterpreter(String name) {
|
|
199 |
0
| synchronized(_interpreters) { _interpreters.remove(name); }
|
|
200 |
| } |
|
201 |
| |
|
202 |
| |
|
203 |
53
| private boolean addBusyInterpreter(Interpreter i) {
|
|
204 |
53
| synchronized(_busyInterpreters) { return _busyInterpreters.add(i); }
|
|
205 |
| } |
|
206 |
| |
|
207 |
52
| private boolean removeBusyInterpreter(Interpreter i) {
|
|
208 |
52
| synchronized(_busyInterpreters) { return _busyInterpreters.remove(i); }
|
|
209 |
| } |
|
210 |
| |
|
211 |
28
| private boolean isBusyInterpreter(Interpreter i) {
|
|
212 |
28
| synchronized(_busyInterpreters) { return _busyInterpreters.contains(i); }
|
|
213 |
| } |
|
214 |
| |
|
215 |
| |
|
216 |
| |
|
217 |
| |
|
218 |
| |
|
219 |
| |
|
220 |
54
| public InterpretResult interpret(String s) { return interpret(s, _activeInterpreter.second()); }
|
|
221 |
| |
|
222 |
| |
|
223 |
| |
|
224 |
| |
|
225 |
| |
|
226 |
| |
|
227 |
| |
|
228 |
0
| public InterpretResult interpret(String s, String name) {
|
|
229 |
0
| Interpreter i = getInterpreter(name);
|
|
230 |
0
| if (i == null) {
|
|
231 |
0
| throw new IllegalArgumentException("Interpreter '" + name + "' does not exist.");
|
|
232 |
| } |
|
233 |
0
| return interpret(s, i);
|
|
234 |
| } |
|
235 |
| |
|
236 |
54
| private InterpretResult interpret(String input, Interpreter interpreter) {
|
|
237 |
54
| debug.logStart("Interpret " + input);
|
|
238 |
| |
|
239 |
53
| boolean available = addBusyInterpreter(interpreter);
|
|
240 |
0
| if (! available) { debug.logEnd(); return InterpretResult.busy(); }
|
|
241 |
| |
|
242 |
| |
|
243 |
53
| Thread.currentThread().setContextClassLoader(_interpreterLoader);
|
|
244 |
| |
|
245 |
53
| Option<Object> result = null;
|
|
246 |
53
| try { result = interpreter.interpret(input); }
|
|
247 |
9
| catch (InterpreterException e) { debug.logEnd(); return InterpretResult.exception(e); }
|
|
248 |
0
| catch (Throwable e) { debug.logEnd(); return InterpretResult.unexpectedException(e); }
|
|
249 |
52
| finally { removeBusyInterpreter(interpreter); }
|
|
250 |
| |
|
251 |
43
| return result.apply(new OptionVisitor<Object, InterpretResult>() {
|
|
252 |
14
| public InterpretResult forNone() { return InterpretResult.noValue(); }
|
|
253 |
29
| public InterpretResult forSome(Object obj) {
|
|
254 |
5
| if (obj instanceof String) { debug.logEnd(); return InterpretResult.stringValue((String) obj); }
|
|
255 |
0
| else if (obj instanceof Character) { debug.logEnd(); return InterpretResult.charValue((Character) obj); }
|
|
256 |
23
| else if (obj instanceof Number) { debug.logEnd(); return InterpretResult.numberValue((Number) obj); }
|
|
257 |
0
| else if (obj instanceof Boolean) { debug.logEnd(); return InterpretResult.booleanValue((Boolean) obj); }
|
|
258 |
| else { |
|
259 |
1
| try {
|
|
260 |
1
| String resultString = TextUtil.toString(obj);
|
|
261 |
0
| String resultTypeStr = null;
|
|
262 |
0
| if (obj!=null) {
|
|
263 |
0
| Class<?> c = obj.getClass();
|
|
264 |
0
| resultTypeStr = getClassName(c);
|
|
265 |
| } |
|
266 |
0
| debug.logEnd();
|
|
267 |
0
| return InterpretResult.objectValue(resultString,resultTypeStr);
|
|
268 |
| } |
|
269 |
| catch (Throwable t) { |
|
270 |
| |
|
271 |
1
| debug.logEnd();
|
|
272 |
1
| return InterpretResult.exception(new EvaluatorException(t));
|
|
273 |
| } |
|
274 |
| } |
|
275 |
| } |
|
276 |
| }); |
|
277 |
| } |
|
278 |
| |
|
279 |
| |
|
280 |
| |
|
281 |
| |
|
282 |
| |
|
283 |
| |
|
284 |
| |
|
285 |
| |
|
286 |
| |
|
287 |
| |
|
288 |
0
| public Object[] getVariableValue(String var) {
|
|
289 |
0
| Pair<Object,String>[] arr = getVariable(var);
|
|
290 |
0
| if (arr.length == 0) return new Object[0];
|
|
291 |
0
| else return new Object[] { arr[0].first() };
|
|
292 |
| } |
|
293 |
| |
|
294 |
| |
|
295 |
| |
|
296 |
| |
|
297 |
| |
|
298 |
| |
|
299 |
0
| @SuppressWarnings("unchecked")
|
|
300 |
| public Pair<Object,String>[] getVariable(String var) { |
|
301 |
0
| synchronized(_stateLock) {
|
|
302 |
0
| InterpretResult ir = interpret(var);
|
|
303 |
0
| return ir.apply(new InterpretResult.Visitor<Pair<Object,String>[]>() {
|
|
304 |
0
| public Pair<Object,String>[] fail() { return new Pair[0]; }
|
|
305 |
0
| public Pair<Object,String>[] value(Object val) {
|
|
306 |
0
| return new Pair[] { new Pair<Object,String>(val, getClassName(val.getClass())) };
|
|
307 |
| } |
|
308 |
0
| public Pair<Object,String>[] forNoValue() { return fail(); }
|
|
309 |
0
| public Pair<Object,String>[] forStringValue(String val) { return value(val); }
|
|
310 |
0
| public Pair<Object,String>[] forCharValue(Character val) { return value(val); }
|
|
311 |
0
| public Pair<Object,String>[] forNumberValue(Number val) { return value(val); }
|
|
312 |
0
| public Pair<Object,String>[] forBooleanValue(Boolean val) { return value(val); }
|
|
313 |
0
| public Pair<Object,String>[] forObjectValue(String valString, String objTypeString) {
|
|
314 |
0
| return new Pair[] { new Pair<Object,String>(valString, objTypeString) }; }
|
|
315 |
0
| public Pair<Object,String>[] forException(String message) { return fail(); }
|
|
316 |
0
| public Pair<Object,String>[] forEvalException(String message, StackTraceElement[] stackTrace) { return fail(); }
|
|
317 |
0
| public Pair<Object,String>[] forUnexpectedException(Throwable t) { return fail(); }
|
|
318 |
0
| public Pair<Object,String>[] forBusy() { return fail(); }
|
|
319 |
| }); |
|
320 |
| } |
|
321 |
| } |
|
322 |
| |
|
323 |
| |
|
324 |
| |
|
325 |
| |
|
326 |
| |
|
327 |
| |
|
328 |
0
| public Pair<String,String> getVariableToString(String var) {
|
|
329 |
0
| synchronized(_stateLock) {
|
|
330 |
| |
|
331 |
0
| Pair<Object,String>[] val = getVariable(var);
|
|
332 |
0
| if (val.length == 0) { return new Pair<String,String>(null,null); }
|
|
333 |
| else { |
|
334 |
0
| Object o = val[0].first();
|
|
335 |
0
| try { return new Pair<String,String>(TextUtil.toString(o),val[0].second()); }
|
|
336 |
0
| catch (Throwable t) { return new Pair<String,String>("<error in toString()>",""); }
|
|
337 |
| } |
|
338 |
| } |
|
339 |
| } |
|
340 |
| |
|
341 |
| |
|
342 |
| |
|
343 |
0
| public static String getClassName(Class<?> c) {
|
|
344 |
0
| StringBuilder sb = new StringBuilder();
|
|
345 |
0
| boolean isArray = c.isArray();
|
|
346 |
0
| while(c.isArray()) {
|
|
347 |
0
| sb.append("[]");
|
|
348 |
0
| c = c.getComponentType();
|
|
349 |
| } |
|
350 |
| |
|
351 |
0
| if (!isArray) {
|
|
352 |
| |
|
353 |
0
| if (c.equals(Byte.class)) { return "byte"+sb.toString()+" or "+c.getSimpleName()+sb.toString(); }
|
|
354 |
0
| if (c.equals(Short.class)) { return "short"+sb.toString()+" or "+c.getSimpleName()+sb.toString(); }
|
|
355 |
0
| if (c.equals(Integer.class)) { return "int"+sb.toString()+" or "+c.getSimpleName()+sb.toString(); }
|
|
356 |
0
| if (c.equals(Long.class)) { return "long"+sb.toString()+" or "+c.getSimpleName()+sb.toString(); }
|
|
357 |
0
| if (c.equals(Float.class)) { return "float"+sb.toString()+" or "+c.getSimpleName()+sb.toString(); }
|
|
358 |
0
| if (c.equals(Double.class)) { return "double"+sb.toString()+" or "+c.getSimpleName()+sb.toString(); }
|
|
359 |
0
| if (c.equals(Boolean.class)) { return "boolean"+sb.toString()+" or "+c.getSimpleName()+sb.toString(); }
|
|
360 |
0
| if (c.equals(Character.class)) { return "char"+sb.toString()+" or "+c.getSimpleName()+sb.toString(); }
|
|
361 |
0
| else return c.getName()+sb.toString();
|
|
362 |
| } |
|
363 |
| else { |
|
364 |
| |
|
365 |
0
| return c.getName()+sb.toString();
|
|
366 |
| } |
|
367 |
| } |
|
368 |
| |
|
369 |
| |
|
370 |
| |
|
371 |
| |
|
372 |
| |
|
373 |
2
| public void addInterpreter(String name) {
|
|
374 |
2
| synchronized(_stateLock) {
|
|
375 |
2
| if (isInterpreterName(name)) {
|
|
376 |
0
| throw new IllegalArgumentException("'" + name + "' is not a unique interpreter name");
|
|
377 |
| } |
|
378 |
2
| Interpreter i = new Interpreter(_interpreterOptions, _interpreterLoader);
|
|
379 |
2
| putInterpreter(name, i);
|
|
380 |
| } |
|
381 |
| } |
|
382 |
| |
|
383 |
| |
|
384 |
| |
|
385 |
| |
|
386 |
| |
|
387 |
| |
|
388 |
| |
|
389 |
| |
|
390 |
| |
|
391 |
| |
|
392 |
| |
|
393 |
| |
|
394 |
| |
|
395 |
| |
|
396 |
| |
|
397 |
0
| public void addInterpreter(String name, Object thisVal, Class<?> thisClass, Object[] localVars,
|
|
398 |
| String[] localVarNames, Class<?>[] localVarClasses) { |
|
399 |
0
| synchronized(_stateLock) {
|
|
400 |
0
| debug.logValues(new String[]{ "name", "thisVal", "thisClass", "localVars", "localVarNames",
|
|
401 |
| "localVarClasses" }, name, thisVal, thisClass, localVars, localVarNames, localVarClasses); |
|
402 |
0
| if (isInterpreterName(name)) {
|
|
403 |
0
| throw new IllegalArgumentException("'" + name + "' is not a unique interpreter name");
|
|
404 |
| } |
|
405 |
0
| if (localVars.length != localVarNames.length || localVars.length != localVarClasses.length) {
|
|
406 |
0
| throw new IllegalArgumentException("Local variable arrays are inconsistent");
|
|
407 |
| } |
|
408 |
| |
|
409 |
| |
|
410 |
| |
|
411 |
0
| Package pkg = thisClass.getPackage();
|
|
412 |
0
| DJClass c = SymbolUtil.wrapClass(thisClass);
|
|
413 |
0
| List<LocalVariable> vars = new LinkedList<LocalVariable>();
|
|
414 |
0
| for (int i = 0; i < localVars.length; i++) {
|
|
415 |
0
| if (localVarClasses[i] == null) {
|
|
416 |
0
| try { localVarClasses[i] = (Class<?>) localVars[i].getClass().getField("TYPE").get(null); }
|
|
417 |
0
| catch (IllegalAccessException e) { throw new IllegalArgumentException(e); }
|
|
418 |
0
| catch (NoSuchFieldException e) { throw new IllegalArgumentException(e); }
|
|
419 |
| } |
|
420 |
0
| Type varT = SymbolUtil.typeOfGeneralClass(localVarClasses[i], _interpreterOptions.typeSystem());
|
|
421 |
0
| vars.add(new LocalVariable(localVarNames[i], varT, false));
|
|
422 |
| } |
|
423 |
| |
|
424 |
0
| TypeContext ctx = new ImportContext(_interpreterLoader, _interpreterOptions);
|
|
425 |
0
| if (pkg != null) { ctx = ctx.setPackage(pkg.getName()); }
|
|
426 |
0
| ctx = new ClassSignatureContext(ctx, c, _interpreterLoader);
|
|
427 |
0
| ctx = new ClassContext(ctx, c);
|
|
428 |
0
| ctx = new DebugMethodContext(ctx, thisVal == null);
|
|
429 |
0
| ctx = new LocalContext(ctx, vars);
|
|
430 |
| |
|
431 |
0
| RuntimeBindings bindings = RuntimeBindings.EMPTY;
|
|
432 |
0
| if (thisVal != null) { bindings = new RuntimeBindings(bindings, c, thisVal); }
|
|
433 |
0
| bindings = new RuntimeBindings(bindings, vars, IterUtil.asIterable(localVars));
|
|
434 |
| |
|
435 |
0
| Interpreter i = new Interpreter(_interpreterOptions, ctx, bindings);
|
|
436 |
| |
|
437 |
0
| putInterpreter(name, i);
|
|
438 |
| } |
|
439 |
| } |
|
440 |
| |
|
441 |
| |
|
442 |
| private static class DebugMethodContext extends DelegatingContext { |
|
443 |
| private final boolean _isStatic; |
|
444 |
0
| public DebugMethodContext(TypeContext next, boolean isStatic) { super(next); _isStatic = isStatic; }
|
|
445 |
0
| protected TypeContext duplicate(TypeContext next) { return new DebugMethodContext(next, _isStatic); }
|
|
446 |
0
| @Override public DJClass getThis() { return _isStatic ? null : super.getThis(); }
|
|
447 |
0
| @Override public DJClass getThis(String className) { return _isStatic ? null : super.getThis(className); }
|
|
448 |
0
| @Override public Type getReturnType() { return null; }
|
|
449 |
0
| @Override public Iterable<Type> getDeclaredThrownTypes() { return IterUtil.empty(); }
|
|
450 |
| } |
|
451 |
| |
|
452 |
| |
|
453 |
| |
|
454 |
| |
|
455 |
| |
|
456 |
| |
|
457 |
| |
|
458 |
| |
|
459 |
| |
|
460 |
| |
|
461 |
| |
|
462 |
| |
|
463 |
| |
|
464 |
| |
|
465 |
3
| public Pair<Boolean, Boolean> setActiveInterpreter(String name) {
|
|
466 |
3
| synchronized(_stateLock) {
|
|
467 |
3
| Interpreter i = getInterpreter(name);
|
|
468 |
1
| if (i == null) { throw new IllegalArgumentException("Interpreter '" + name + "' does not exist."); }
|
|
469 |
2
| boolean changed = (i != _activeInterpreter.second());
|
|
470 |
2
| _activeInterpreter = Pair.make(name, i);
|
|
471 |
2
| return Pair.make(changed, isBusyInterpreter(i));
|
|
472 |
| } |
|
473 |
| } |
|
474 |
| |
|
475 |
| |
|
476 |
| |
|
477 |
| |
|
478 |
26
| public Pair<Boolean, Boolean> setToDefaultInterpreter() {
|
|
479 |
26
| synchronized(_stateLock) {
|
|
480 |
26
| boolean changed = (_defaultInterpreter != _activeInterpreter.second());
|
|
481 |
26
| _activeInterpreter = Pair.make("", _defaultInterpreter);
|
|
482 |
26
| return Pair.make(changed, isBusyInterpreter(_defaultInterpreter));
|
|
483 |
| } |
|
484 |
| } |
|
485 |
| |
|
486 |
| |
|
487 |
180
| public void setEnforceAllAccess(boolean enforce) {
|
|
488 |
180
| synchronized(_stateLock) {
|
|
489 |
180
| _interpreterOptions.setEnforceAllAccess(enforce);
|
|
490 |
| } |
|
491 |
| } |
|
492 |
| |
|
493 |
| |
|
494 |
180
| public void setEnforcePrivateAccess(boolean enforce) {
|
|
495 |
180
| synchronized(_stateLock) {
|
|
496 |
180
| _interpreterOptions.setEnforcePrivateAccess(enforce);
|
|
497 |
| } |
|
498 |
| } |
|
499 |
| |
|
500 |
| |
|
501 |
180
| public void setRequireSemicolon(boolean require) {
|
|
502 |
180
| synchronized(_stateLock) {
|
|
503 |
180
| _interpreterOptions.setRequireSemicolon(require);
|
|
504 |
| } |
|
505 |
| } |
|
506 |
| |
|
507 |
| |
|
508 |
180
| public void setRequireVariableType(boolean require) {
|
|
509 |
180
| synchronized(_stateLock) {
|
|
510 |
180
| _interpreterOptions.setRequireVariableType(require);
|
|
511 |
| } |
|
512 |
| } |
|
513 |
| |
|
514 |
| |
|
515 |
| |
|
516 |
| |
|
517 |
| |
|
518 |
| |
|
519 |
| |
|
520 |
| |
|
521 |
18
| public List<String> findTestClasses(List<String> classNames, List<File> files) throws RemoteException {
|
|
522 |
18
| return _junitTestManager.findTestClasses(classNames, files);
|
|
523 |
| } |
|
524 |
| |
|
525 |
| |
|
526 |
| |
|
527 |
| |
|
528 |
| |
|
529 |
16
| public boolean runTestSuite() throws RemoteException { return _junitTestManager.runTestSuite(); }
|
|
530 |
| |
|
531 |
| |
|
532 |
| |
|
533 |
| |
|
534 |
| |
|
535 |
| |
|
536 |
0
| public void nonTestCase(boolean isTestAll, boolean didCompileFail) {
|
|
537 |
0
| try { _mainJVM.nonTestCase(isTestAll, didCompileFail); }
|
|
538 |
0
| catch (RemoteException re) { error.log(re); }
|
|
539 |
| } |
|
540 |
| |
|
541 |
| |
|
542 |
| |
|
543 |
| |
|
544 |
| |
|
545 |
0
| public void classFileError(ClassFileError e) {
|
|
546 |
0
| try { _mainJVM.classFileError(e); }
|
|
547 |
0
| catch (RemoteException re) { error.log(re); }
|
|
548 |
| } |
|
549 |
| |
|
550 |
| |
|
551 |
| |
|
552 |
| |
|
553 |
| |
|
554 |
16
| public void testSuiteStarted(int numTests) {
|
|
555 |
16
| try { _mainJVM.testSuiteStarted(numTests); }
|
|
556 |
0
| catch (RemoteException re) { error.log(re); }
|
|
557 |
| } |
|
558 |
| |
|
559 |
| |
|
560 |
| |
|
561 |
| |
|
562 |
| |
|
563 |
25
| public void testStarted(String testName) {
|
|
564 |
25
| try { _mainJVM.testStarted(testName); }
|
|
565 |
0
| catch (RemoteException re) { error.log(re); }
|
|
566 |
| } |
|
567 |
| |
|
568 |
| |
|
569 |
| |
|
570 |
| |
|
571 |
| |
|
572 |
| |
|
573 |
24
| public void testEnded(String testName, boolean wasSuccessful, boolean causedError) {
|
|
574 |
24
| try { _mainJVM.testEnded(testName, wasSuccessful, causedError); }
|
|
575 |
0
| catch (RemoteException re) { error.log(re); }
|
|
576 |
| } |
|
577 |
| |
|
578 |
| |
|
579 |
| |
|
580 |
| |
|
581 |
| |
|
582 |
15
| public void testSuiteEnded(JUnitError[] errors) {
|
|
583 |
15
| try { _mainJVM.testSuiteEnded(errors); }
|
|
584 |
0
| catch (RemoteException re) { error.log(re); }
|
|
585 |
| } |
|
586 |
| |
|
587 |
| |
|
588 |
| |
|
589 |
| |
|
590 |
| |
|
591 |
| |
|
592 |
4
| public File getFileForClassName(String className) {
|
|
593 |
4
| try { return _mainJVM.getFileForClassName(className); }
|
|
594 |
0
| catch (RemoteException re) { error.log(re); return null; }
|
|
595 |
| } |
|
596 |
| |
|
597 |
0
| public void junitJVMReady() { }
|
|
598 |
| |
|
599 |
| |
|
600 |
2
| public void addExtraClassPath(File f) { _classPathManager.addExtraCP(f); }
|
|
601 |
0
| public void addProjectClassPath(File f) { _classPathManager.addProjectCP(f); }
|
|
602 |
25
| public void addBuildDirectoryClassPath(File f) { _classPathManager.addBuildDirectoryCP(f); }
|
|
603 |
182
| public void addProjectFilesClassPath(File f) { _classPathManager.addProjectFilesCP(f); }
|
|
604 |
223
| public void addExternalFilesClassPath(File f) { _classPathManager.addExternalFilesCP(f); }
|
|
605 |
0
| public Iterable<File> getClassPath() {
|
|
606 |
| |
|
607 |
0
| return IterUtil.snapshot(_classPathManager.getClassPath());
|
|
608 |
| } |
|
609 |
| |
|
610 |
| } |