[NETBEANS-817] Preventing exceptions when opening project: #552
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.
-accepting duplicate ClassPath entries with module-infos
-filtering out options that don't match the validated source level
Fixing two problems with the given project - with JDK 10 platform, the sources ClassPath in ModuleClassPaths.ModuleInfoClassPathImplementation has a duplicated entry, leading to having the module-info.java twice in the list of files to which the listener should be added, leading to the reported exception. Proposed fix is to use LinkedHashSet to avoid the duplication. Having duplicated entries in the CP may not be nice, but I suspect it is not reasonable to try to force a constraint that the entries must not be duplicated.
With platform <JDK 10/9, there are multiple problems, but the biggest one is that there are additional compiler options, like --add-reads (auto-injected to make tests work?), but the source level is downgraded below 9, where these options are not allowed and crash with an exception. The proposed (partial) fix is to filter the 9-specific options out when the validated source level < 9.
Any ideas/opinions?