int3/doppio — pull request #219 by angrave (2013-05-23 18:10:44+00:00)
Title: Eclipse compiler support (shell OK but RangeError: Invalid array length logging.coffee)

Initial support for Eclipse JDT Compiler (standalone works but browser command is broken).

The setup script downloads the compiler to vendor/jars/ecj.jar, so the following is now possible -

./doppio -Djdt.compiler.useSingleThread -jar vendor/jars/ecj.jar -1.6 classes/demo/Fib.java

Strangely the ecj command in Chrome fails, despite the System property being set:

ecj: (args, cb) ->
jvm.set_classpath '/home/doppio/vendor/classes/', './'
class_name = 'org/eclipse/jdt/internal/compiler/batch/Main'
class_args = args
rs = new runtime.RuntimeState(stdout, user_input, bs_cl)
# HACK -D args unsupported by the console. (Also system_properties are not re-initialized)
jvm.system_properties['jdt.compiler.useSingleThread'] = ''
jvm.run_class(rs, class_name, class_args, -> controller.reprompt())
jvm.run_class rs, 'classes/util/Javac', args, ->
# HACK: remove any classes that just got compiled from the class cache
for c in args when c.match /\.java$/
bs_cl.remove_class(util.int_classname(c.slice(0,-5)))
return null # no reprompt, because we handle it ourselves

doppio> ecj
Causes the following error (See Chrome's Javascript Console)

Internal JVM Error: RangeError: Invalid array length logging.coffee:41
RangeError: Invalid array length
at Method.root.Method.Method.take_params (http://localhost:8000/src/methods.js:293:27)
at Method.root.Method.Method.setup_stack (http://localhost:8000/src/methods.js:403:21)
at http://localhost:8000/src/jvm.js:125:36
at http://localhost:8000/src/runtime.js:572:11
at handleMessage (http://localhost:8000/browser/node.js:90:18) logging.coffee:41

(reproduced in both dev and release builds)
-Lawrence