Add support for Annotation Processors in the Javac Extension#3686
Add support for Annotation Processors in the Javac Extension#3686PiIsRational wants to merge 18 commits intoKeYProject:mainfrom
Conversation
key.ui/src/main/java/de/uka/ilkd/key/gui/plugins/javac/JavaCompilerCheckFacade.java
Outdated
Show resolved
Hide resolved
…figuration" This reverts commit 74af1d7.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3686 +/- ##
============================================
+ Coverage 47.99% 50.34% +2.35%
+ Complexity 16045 15902 -143
============================================
Files 1683 1597 -86
Lines 96053 91028 -5025
Branches 15390 14555 -835
============================================
- Hits 46097 45825 -272
+ Misses 44683 39989 -4694
+ Partials 5273 5214 -59 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
One solution to the
|
Externalize Javac into separate Java process for setting JMS directives
key.ui/src/main/java/de/uka/ilkd/key/gui/plugins/javac/JavaCompilerCheckFacade.java
Outdated
Show resolved
Hide resolved
WolframPfeifer
left a comment
There was a problem hiding this comment.
Thanks for this PR, which will allow running Checker Framework checkers (e.g. for Nullness of Ownership) from the KeY GUI directly.
Also, thanks to @wadoon for the initial draft of the external checker, and @PiIsRational for polishing.
I have a few minor complaints about the use of var. When these are fixed, the PR would be ready from my point of view. Also, there is code smell in the unit test (check without assert), but we could also keep it like that.
key.ui/src/main/java/de/uka/ilkd/key/gui/plugins/javac/JavaCompilerCheckFacade.java
Outdated
Show resolved
Hide resolved
key.ui/src/main/java/de/uka/ilkd/key/gui/plugins/javac/JavaCompilerCheckFacade.java
Outdated
Show resolved
Hide resolved
key.ui/src/main/java/de/uka/ilkd/key/gui/plugins/javac/JavaCompilerCheckFacade.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| @Test | ||
| void compileExternal() throws ExecutionException, InterruptedException { |
There was a problem hiding this comment.
In my opinion, it is a bit of a code smell to have a test without any asserts (was already the case for the original test of this class). However, this can still count as some kind of smoke test, so I do not let it block the merge ...
| * @return future providing the list of diagnostics | ||
| */ | ||
| public static @NonNull CompletableFuture<List<PositionedIssueString>> check( | ||
| ProblemInitializer.ProblemInitializerListener listener, |
There was a problem hiding this comment.
Why is the listener needed here? It seems to only be used to generate an error message for a corner case (a system without a Java compiler). Would it make sense to therefore remove it?
Changes
Extended the Javac Extension to be able to load annotation processors, while the java code is getting checked
in KeY. This includes creating settings for the Javac Extension, to be able to set the checkers.
Also, the there are changes to the run step of the gradle script
to add (add-export and add-opens) directives to the java runtime such that annotations processors can access the internal java compiler data structures.
This is required to be done by hand when using KeY as a jar and would require the following (or similar) command:
java \ --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ --add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \ -jar key-2.12.4-dev-exe.jarType of pull request
Ensuring quality
Additional information and contact(s)
@WolframPfeifer is involved in this pull request.
The contributions within this pull request are licensed under GPLv2 (only) for inclusion in KeY.