Skip to content

Comments

Fix JDK9 compilation issue, use parser.ast.Module instead of Module#18

Merged
davexparker merged 1 commit intoprismmodelchecker:masterfrom
kleinj:jdk9
Aug 30, 2017
Merged

Fix JDK9 compilation issue, use parser.ast.Module instead of Module#18
davexparker merged 1 commit intoprismmodelchecker:masterfrom
kleinj:jdk9

Conversation

@kleinj
Copy link
Member

@kleinj kleinj commented Aug 22, 2017

In the upcoming Java 9, there is a java.lang.Module class which is imported automatically due to the java.lang package. This clashes with PRISM's parser.ast.Module class, leading to numerous compilation errors, as the compiler can not disambiguate between the two.

The attached fix resolves this by explicitly writing parser.ast.Module instead of Module, where required.

Question: Do we want to resolve it like this or do we rename parser.ast.Module to something that does not clash? I don't really have a preference.

With this fix, PRISM compiles on Java 9 (tested on Linux), with some warnings. Test suite passes.

In Java 9, there is a new system class java.lang.Module that is implicitly imported
everywhere and which clashes with the parser.ast.Module class, resulting in
compilation errors, as javac is not able to disambiguate between the two
automatically.

We are therefore more specific when referencing the PRISM parser's 'Module' class,
by using the full 'parser.ast.Module' name.
@davexparker
Copy link
Member

Yes, I think rewriting the references is the best solution. I don't have Java 9 to hand, but all works fine on Java 8. Will merge.

@davexparker davexparker merged commit abf3741 into prismmodelchecker:master Aug 30, 2017
@merkste
Copy link
Contributor

merkste commented Mar 9, 2018

Hi, I ran into the same issue in PR #66 . Problem is, that generic imports of the form import ast.*do not override java.lang.Module. Bot explicit imports likeimport ast.parser.Module do. Hence, the generic solution seems to be to avoid .* imports and use the explicit form instead.

Maybe we want to create a new PR for just this import issue?

@kleinj kleinj deleted the jdk9 branch July 27, 2018 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants