Skip to content

Commit abf3741

Browse files
kleinjdavexparker
authored andcommitted
Fix JDK9 compilation issue, use parser.ast.Module instead of Module
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.
1 parent 8a420d6 commit abf3741

14 files changed

Lines changed: 42 additions & 42 deletions

prism/src/parser/PrismParser.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static class ExpressionPair { public Expression expr1 = null; public Expression
375375
int typeCount = 0;
376376
Token typeDupe = null;
377377
Declaration global;
378-
Module m = null;
378+
parser.ast.Module m = null;
379379
RenamedModule rm = null;
380380
RewardStruct rs = null;
381381
Expression init = null;
@@ -1027,15 +1027,15 @@ static class ExpressionPair { public Expression expr1 = null; public Expression
10271027

10281028
// Module
10291029
static final public
1030-
Module Module() throws ParseException {ExpressionIdent name = null;
1030+
parser.ast.Module Module() throws ParseException {ExpressionIdent name = null;
10311031
Declaration var = null;
10321032
Expression invar;
10331033
Command comm = null;
1034-
Module module = null;
1034+
parser.ast.Module module = null;
10351035
Token begin = null;
10361036
begin = jj_consume_token(MODULE);
10371037
name = IdentifierExpression();
1038-
module = new Module(name.getName());
1038+
module = new parser.ast.Module(name.getName());
10391039
label_6:
10401040
while (true) {
10411041
switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {

prism/src/parser/PrismParser.jj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ ModulesFile ModulesFile() throws PrismLangException :
535535
int typeCount = 0;
536536
Token typeDupe = null;
537537
Declaration global;
538-
Module m = null;
538+
parser.ast.Module m = null;
539539
RenamedModule rm = null;
540540
RewardStruct rs = null;
541541
Expression init = null;
@@ -791,17 +791,17 @@ DeclarationType DeclarationVarType() :
791791

792792
// Module
793793

794-
Module Module() :
794+
parser.ast.Module Module() :
795795
{
796796
ExpressionIdent name = null;
797797
Declaration var = null;
798798
Expression invar;
799799
Command comm = null;
800-
Module module = null;
800+
parser.ast.Module module = null;
801801
Token begin = null;
802802
}
803803
{
804-
begin = <MODULE> name = IdentifierExpression() { module = new Module(name.getName()); }
804+
begin = <MODULE> name = IdentifierExpression() { module = new parser.ast.Module(name.getName()); }
805805
( var = Declaration() { module.addDeclaration(var); } )*
806806
( <INVARIANT> invar = Expression(false, false) <ENDINVARIANT> { module.setInvariant(invar); } )?
807807
( comm = Command() { module.addCommand(comm); } )*

prism/src/parser/VarList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public VarList(ModulesFile modulesFile) throws PrismLangException
6666
this();
6767

6868
int i, j, n, n2;
69-
Module module;
69+
parser.ast.Module module;
7070
Declaration decl;
7171

7272
// First add all globals to the list

prism/src/parser/visitor/ASTTraverse.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ public Object visit(DeclarationIntUnbounded e) throws PrismLangException
196196
}
197197
public void visitPost(DeclarationIntUnbounded e) throws PrismLangException { defaultVisitPost(e); }
198198
// -----------------------------------------------------------------------------------
199-
public void visitPre(Module e) throws PrismLangException { defaultVisitPre(e); }
200-
public Object visit(Module e) throws PrismLangException
199+
public void visitPre(parser.ast.Module e) throws PrismLangException { defaultVisitPre(e); }
200+
public Object visit(parser.ast.Module e) throws PrismLangException
201201
{
202202
// Note: a few classes override this method (e.g. SemanticCheck)
203203
// so take care to update those versions if changing this method
@@ -216,7 +216,7 @@ public Object visit(Module e) throws PrismLangException
216216
visitPost(e);
217217
return null;
218218
}
219-
public void visitPost(Module e) throws PrismLangException { defaultVisitPost(e); }
219+
public void visitPost(parser.ast.Module e) throws PrismLangException { defaultVisitPost(e); }
220220
// -----------------------------------------------------------------------------------
221221
public void visitPre(Command e) throws PrismLangException { defaultVisitPre(e); }
222222
public Object visit(Command e) throws PrismLangException

prism/src/parser/visitor/ASTTraverseModify.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public Object visit(ModulesFile e) throws PrismLangException
5555
}
5656
n = e.getNumModules();
5757
for (i = 0; i < n; i++) {
58-
if (e.getModule(i) != null) e.setModule(i, (Module)(e.getModule(i).accept(this)));
58+
if (e.getModule(i) != null) e.setModule(i, (parser.ast.Module)(e.getModule(i).accept(this)));
5959
}
6060
n = e.getNumSystemDefns();
6161
for (i = 0; i < n; i++) {
@@ -211,8 +211,8 @@ public Object visit(DeclarationIntUnbounded e) throws PrismLangException
211211
}
212212
public void visitPost(DeclarationIntUnbounded e) throws PrismLangException { defaultVisitPost(e); }
213213
// -----------------------------------------------------------------------------------
214-
public void visitPre(Module e) throws PrismLangException { defaultVisitPre(e); }
215-
public Object visit(Module e) throws PrismLangException
214+
public void visitPre(parser.ast.Module e) throws PrismLangException { defaultVisitPre(e); }
215+
public Object visit(parser.ast.Module e) throws PrismLangException
216216
{
217217
visitPre(e);
218218
int i, n;
@@ -229,7 +229,7 @@ public Object visit(Module e) throws PrismLangException
229229
visitPost(e);
230230
return e;
231231
}
232-
public void visitPost(Module e) throws PrismLangException { defaultVisitPost(e); }
232+
public void visitPost(parser.ast.Module e) throws PrismLangException { defaultVisitPost(e); }
233233
// -----------------------------------------------------------------------------------
234234
public void visitPre(Command e) throws PrismLangException { defaultVisitPre(e); }
235235
public Object visit(Command e) throws PrismLangException

prism/src/parser/visitor/ASTVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public interface ASTVisitor
4444
public Object visit(DeclarationArray e) throws PrismLangException;
4545
public Object visit(DeclarationClock e) throws PrismLangException;
4646
public Object visit(DeclarationIntUnbounded e) throws PrismLangException;
47-
public Object visit(Module e) throws PrismLangException;
47+
public Object visit(parser.ast.Module e) throws PrismLangException;
4848
public Object visit(Command e) throws PrismLangException;
4949
public Object visit(Updates e) throws PrismLangException;
5050
public Object visit(Update e) throws PrismLangException;

prism/src/parser/visitor/ModulesFileSemanticCheck.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public ModulesFileSemanticCheck(ModulesFile modulesFile)
5454
public void visitPost(ModulesFile e) throws PrismLangException
5555
{
5656
int i, j, n, n2;
57-
Module m;
57+
parser.ast.Module m;
5858
Vector<String> v;
5959

6060
// Check for use of init...endinit _and_ var initial values
@@ -174,13 +174,13 @@ public void visitPost(DeclarationClock e) throws PrismLangException
174174
}
175175
}
176176

177-
public void visitPre(Module e) throws PrismLangException
177+
public void visitPre(parser.ast.Module e) throws PrismLangException
178178
{
179179
// Register the fact we are entering a module
180180
//inModule = e;
181181
}
182182

183-
public Object visit(Module e) throws PrismLangException
183+
public Object visit(parser.ast.Module e) throws PrismLangException
184184
{
185185
// Override this so we can keep track of when we are in an invariant
186186
visitPre(e);
@@ -201,7 +201,7 @@ public Object visit(Module e) throws PrismLangException
201201
return null;
202202
}
203203

204-
public void visitPost(Module e) throws PrismLangException
204+
public void visitPost(parser.ast.Module e) throws PrismLangException
205205
{
206206
// Register the fact we are leaving a module
207207
//inModule = null;
@@ -230,7 +230,7 @@ public void visitPost(Update e) throws PrismLangException
230230
int i, n;
231231
String s, var;
232232
Command c;
233-
Module m;
233+
parser.ast.Module m;
234234
boolean isLocal, isGlobal;
235235

236236
// Register the fact we are leaving an update

prism/src/parser/visitor/Rename.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void visitPost(Declaration e) throws PrismLangException
6767
}
6868
}
6969

70-
public void visitPost(Module e) throws PrismLangException
70+
public void visitPost(parser.ast.Module e) throws PrismLangException
7171
{
7272
// New name for module is specied in RenamedModule
7373
e.setName(rm.getName());

prism/src/prism/ExplicitModel2MTBDD.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public Model buildModel(explicit.Model modelExpl, List<State> statesList, Module
128128
this.modulesFile = modulesFile;
129129
} else {
130130
this.modulesFile = modulesFile = new ModulesFile();
131-
Module m = new Module("M");
131+
parser.ast.Module m = new parser.ast.Module("M");
132132
Declaration d = new Declaration("x", new DeclarationInt(Expression.Int(0), Expression.Int(numStates - 1)));
133133
d.setStart(Expression.Int(0));
134134
m.addDeclaration(d);

prism/src/prism/Modules2MTBDD.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ else if (sys instanceof SystemReference) {
902902
private SystemDDs translateSystemModule(SystemModule sys, int[] synchMin) throws PrismException
903903
{
904904
SystemDDs sysDDs;
905-
Module module;
905+
parser.ast.Module module;
906906
String synch;
907907
int i, m;
908908

@@ -1366,7 +1366,7 @@ else if (compDDs2.max > compDDs1.max) {
13661366
// translate a single module to a dd
13671367
// for a given synchronizing action ("" = none)
13681368

1369-
private ComponentDDs translateModule(int m, Module module, String synch, int synchMin) throws PrismException
1369+
private ComponentDDs translateModule(int m, parser.ast.Module module, String synch, int synchMin) throws PrismException
13701370
{
13711371
ComponentDDs compDDs;
13721372
JDDNode guardDDs[], upDDs[], tmp;

0 commit comments

Comments
 (0)