eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.98k stars 1.19k forks source link

Implement new Java debugger evaluator based on new NTLR 4 parser #7742

Closed vinokurig closed 5 years ago

vinokurig commented 6 years ago

Current java debugger evaluator uses NTLR 3 parser based on Java 5 grammar. Need to implement evaluator based on Listener class generated by NTLR 4.

While parsing expression NTLR calls methods on Listener on each logical step. The main idea is to have a value storage that will be updated on listener. The result object has to be updated according to logical steps called in the listener using the value storage.

Listener initialization:

CharStream stream = CharStreams.fromString("i + getsmth()");

Java8Lexer lexer = new Java8Lexer(stream);
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
Java8Parser parser = new Java8Parser(tokenStream);
ParseTreeWalker walker = new ParseTreeWalker();

walker.walk(new Java8BaseListener(), parser.expression());

When listener invokes new variable initialization need to initialize it in the virtual machine:

ClassType ct = (ClassType) vm.classesByName("java.lang.String").get(0);
Method m = ct.concreteMethodByName("<init>", "()V");
ThreadReference t = vm.allThreads().get(3);

ObjectReference ob = ct.newInstance(t, m, Collections.emptyList(), 0);

Current parser location: https://github.com/eclipse/che-lib/tree/master/antlr-java5-grammar

RanjithRV commented 6 years ago

@vinokurig @tolusha Can we change the team on this issue to one of the existing one please.

che-bot commented 5 years ago

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.