Add support for Annotation Processors in the Javac Extension#3686
Add support for Annotation Processors in the Javac Extension#3686PiIsRational wants to merge 16 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.98% 50.34% +2.35%
+ Complexity 16045 15902 -143
============================================
Files 1683 1597 -86
Lines 96046 91024 -5022
Branches 15388 14553 -835
============================================
- Hits 46091 45823 -268
+ Misses 44683 39988 -4695
+ Partials 5272 5213 -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.
| */ | ||
| public static void main(String[] args) { | ||
| try (var input = new InputStreamReader(System.in)) { | ||
| var params = Configuration.load(CharStreams.fromReader(input)); |
There was a problem hiding this comment.
We have the policy that the var keyword can be used in the code as long as the type is obvious (for example, when calling a constructor), otherwise it would decrease readability of the code. In this case, it is not in my opinion. Can you please make the type here explicit?
| var settings = new JavacSettings(); | ||
| settings.readSettings(params); | ||
|
|
||
| var result = check(null, |
There was a problem hiding this comment.
Same as above: Make the type explicit for better readability please.
|
|
||
| // the KeY logging messages from `process` (currently not used) | ||
| var logs = Streams.toString(process.getInputStream()); | ||
| var messages = Configuration.load(CharStreams.fromStream(process.getErrorStream())); |
| } | ||
|
|
||
| @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 ...
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.