-
Notifications
You must be signed in to change notification settings - Fork 42
Add support for Annotation Processors in the Javac Extension #3686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PiIsRational
wants to merge
21
commits into
KeYProject:main
Choose a base branch
from
PiIsRational:javac-extension
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ef77b66
extend the javac extension
PiIsRational 2a5ca56
updated the code and text to be clearer
PiIsRational 74af1d7
save proof independent settings, that are not used by the configuration
PiIsRational 0ae4244
few changes
PiIsRational 1931fe9
Merge branch 'main' into javac-extension
PiIsRational 0f710eb
fix mistakes introduced by the merge
PiIsRational d84fb9f
Revert "save proof independent settings, that are not used by the con…
PiIsRational 7ca2241
un-revert the name of the Javac Settings
PiIsRational ba35a99
update the javaCompilerCheckFacade interface and fix tests
PiIsRational 7a1658c
change the help messages in the settings provider
PiIsRational 4c5f41e
make compiler errors acessible from the gui
PiIsRational 0f42201
wip: Javac in separate process
wadoon 622a300
finish implementing the external java checks
PiIsRational 285af93
Merge branch 'main' into javac-extension
wadoon f89754d
replace HashMap with a TreeMap
PiIsRational 7c4df33
minor fixups and comments
PiIsRational 495123b
replace unclear var declarations
PiIsRational 3f01c36
run spotless
PiIsRational 8357972
simplify the javac check facade
PiIsRational a1b3580
run spotless
PiIsRational 73d9619
Merge branch 'main' into javac-extension
WolframPfeifer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,15 +52,17 @@ public class JavaCompilerCheckFacade { | |
| * | ||
| * @param listener the {@link ProblemInitializer.ProblemInitializerListener} to be informed | ||
| * about any issues found in the target Java program | ||
| * @param bootClassPath the {@link File} referring to the path containing the core Java classes | ||
| * @param classPath the {@link List} of {@link File}s referring to the directory that make up | ||
| * @param bootClassPath the {@link Path} referring to the path containing the core Java classes | ||
| * @param classPath the {@link List} of {@link Path}s referring to the directory that make up | ||
| * the target Java programs classpath | ||
| * @param javaPath the {@link String} with the path to the source of the target Java program | ||
| * @param javaPath the {@link Path} to the source of the target Java program | ||
| * @param processors the {@link List} of {@link String}s referring to the annotation processors to be run | ||
| * @return future providing the list of diagnostics | ||
| */ | ||
| public static @NonNull CompletableFuture<List<PositionedIssueString>> check( | ||
| ProblemInitializer.ProblemInitializerListener listener, | ||
|
||
| Path bootClassPath, List<Path> classPath, Path javaPath) { | ||
| Path bootClassPath, List<Path> classPath, Path javaPath, | ||
| List<String> processors) { | ||
PiIsRational marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (Boolean.getBoolean("KEY_JAVAC_DISABLE")) { | ||
| LOGGER.info("Javac check is disabled by system property -PKEY_JAVAC_DISABLE"); | ||
| return CompletableFuture.completedFuture(Collections.emptyList()); | ||
|
|
@@ -86,6 +88,7 @@ public class JavaCompilerCheckFacade { | |
|
|
||
| // gather configured bootstrap classpath and regular classpath | ||
| List<String> options = new ArrayList<>(); | ||
|
|
||
| if (bootClassPath != null) { | ||
| options.add("-Xbootclasspath"); | ||
| options.add(bootClassPath.toAbsolutePath().toString()); | ||
|
|
@@ -97,6 +100,12 @@ public class JavaCompilerCheckFacade { | |
| .map(Objects::toString) | ||
| .collect(Collectors.joining(":"))); | ||
| } | ||
|
|
||
| if (processors != null && !processors.isEmpty()) { | ||
| options.add("-processor"); | ||
| options.add(processors.stream().collect(Collectors.joining(","))); | ||
| } | ||
|
|
||
| ArrayList<Path> files = new ArrayList<>(); | ||
| if (Files.isDirectory(javaPath)) { | ||
| try (var s = Files.walk(javaPath)) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
key.ui/src/main/java/de/uka/ilkd/key/gui/plugins/javac/JavacSettings.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| /* This file is part of KeY - https://key-project.org | ||
| * KeY is licensed under the GNU General Public License Version 2 | ||
| * SPDX-License-Identifier: GPL-2.0-only */ | ||
| package de.uka.ilkd.key.gui.plugins.javac; | ||
| import java.lang.Boolean; | ||
|
|
||
| import de.uka.ilkd.key.settings.AbstractPropertiesSettings; | ||
|
|
||
| /** | ||
| * Settings for the javac extention. | ||
| * | ||
| * @author Daniel Grévent | ||
| */ | ||
| public class JavacSettings extends AbstractPropertiesSettings { | ||
|
|
||
| /** | ||
| * The name of the category in the settings. | ||
| */ | ||
| public static final String CATEGORY = "Javac Extension"; | ||
|
|
||
| /** | ||
| * Config key for {@link #useProcessors}. | ||
| */ | ||
| private static final String KEY_USE_PROCESSORS = "useProcessors"; | ||
|
|
||
| /** | ||
| * Config key for {@link #processors}. | ||
| */ | ||
| private static final String KEY_PROCESSORS = "processors"; | ||
|
|
||
| /** | ||
| * Config key for {@link #classPaths}. | ||
| */ | ||
| private static final String KEY_CLASS_PATHS = "classPaths"; | ||
|
|
||
| /** | ||
| * The type annotation processors to be run. | ||
| */ | ||
| private final PropertyEntry<Boolean> useProcessors = | ||
| createBooleanProperty(KEY_USE_PROCESSORS, false); | ||
|
|
||
| /** | ||
| * The type annotation processors to be run. | ||
| */ | ||
| private final PropertyEntry<String> processors = | ||
| createStringProperty(KEY_PROCESSORS, ""); | ||
|
|
||
| /** | ||
| * Additional class paths, needed for example by annotation processors | ||
| */ | ||
| private final PropertyEntry<String> classPaths = | ||
| createStringProperty(KEY_CLASS_PATHS, ""); | ||
|
|
||
| public JavacSettings() { | ||
| super(CATEGORY); | ||
| } | ||
|
|
||
| /** | ||
| * @param useProcessors if the annotation processors should be run | ||
| */ | ||
| public void setUseProcessors(boolean useProcessors) { | ||
| this.useProcessors.set(useProcessors); | ||
| } | ||
|
|
||
| /** | ||
| * @param processor the annotation processors to run | ||
| */ | ||
| public void setProcessors(String processor) { | ||
| this.processors.set(processor); | ||
| } | ||
|
|
||
| /** | ||
| * @param paths the additional class paths | ||
| */ | ||
| public void setClassPaths(String paths) { | ||
| this.classPaths.set(paths); | ||
| } | ||
|
|
||
| /** | ||
| * @return true iff the annotation processors should be used | ||
| */ | ||
| public boolean getUseProcessors() { | ||
| return useProcessors.get(); | ||
| } | ||
|
|
||
| /** | ||
| * @return the annotation processors separated by newlines | ||
| */ | ||
| public String getProcessors() { | ||
| return processors.get(); | ||
| } | ||
|
|
||
| /** | ||
| * @return the additional class paths separated by newlines | ||
| */ | ||
| public String getClassPaths() { | ||
| return classPaths.get(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.