-proceedOnError option (like ECJ) ?
Mickael Istria
mistria at redhat.com
Mon Nov 25 12:41:40 UTC 2024
Hi again,
I actually managed to get something working decently enough a few hours
ago, overriding the Gen.
Intestesting parts are:
* setting should-stop.ifError=GENERATE
https://github.com/eclipse-jdtls/eclipse-jdt-core-incubator/blob/be1321f92e37952923d61a37b69ce95f7f0a08ec/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/JavacUtils.java#L103
* Overriding condition for genCode to ignore errors and process anyway:
https://github.com/eclipse-jdtls/eclipse-jdt-core-incubator/blob/be1321f92e37952923d61a37b69ce95f7f0a08ec/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/JavacCompiler.java#L179
* Overriding TransType to avoid a very probable compiler NPE when types
mismatch in the file being compiled:
https://github.com/eclipse-jdtls/eclipse-jdt-core-incubator/blob/be1321f92e37952923d61a37b69ce95f7f0a08ec/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/ProceedOnErrorTransTypes.java#L35
* Overriding Gen to capture usual errors during visitXXX and just generate
code for `throw new RuntimeException` in such case:
https://github.com/eclipse-jdtls/eclipse-jdt-core-incubator/blob/dom-with-javac/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/ProceedOnErrorGen.java
This is far from being bullet-proof, but it's not really meant to. It does
already deliver a lot of value in the story of "hotswapping when code still
has errors without crashing debug session" which is our unique target here.
I don't think we'll be trying to push such feature further into
OpenJDK/Javac, but would welcome anyone to try it. If anyone is willing to
contribute to this code, or to reuse it in some way, feel free to join the
discussions at
https://github.com/eclipse-jdtls/eclipse-jdt-core-incubator/discussions .
Cheers and thanks!
Mickael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20241125/b34e0b4b/attachment.htm>
More information about the compiler-dev
mailing list