Skip to content
Snippets Groups Projects
Commit 0d8c93cc authored by dgelessus's avatar dgelessus
Browse files

Fix remaining javac warnings

parent e2c0465e
Branches
Tags
No related merge requests found
Pipeline #86731 passed
...@@ -46,7 +46,7 @@ public class ConstructNFA extends DepthFirstAdapter ...@@ -46,7 +46,7 @@ public class ConstructNFA extends DepthFirstAdapter
@Override @Override
public void outATokens(ATokens node) public void outATokens(ATokens node)
{ {
ATokenDef[] tokenDefs = (ATokenDef[]) node.getTokenDefs().toArray(new ATokenDef[0]); PTokenDef[] tokenDefs = node.getTokenDefs().toArray(new PTokenDef[0]);
for(int i = tokenDefs.length - 1; i >= 0 ; i--) for(int i = tokenDefs.length - 1; i >= 0 ; i--)
{ {
...@@ -101,7 +101,7 @@ public class ConstructNFA extends DepthFirstAdapter ...@@ -101,7 +101,7 @@ public class ConstructNFA extends DepthFirstAdapter
final AStateList node = (AStateList)stateList; final AStateList node = (AStateList)stateList;
Set<String> set = new TreeSet<>(); Set<String> set = new TreeSet<>();
AStateListTail[] stateListTails = (AStateListTail[]) node.getStateLists().toArray(new AStateListTail[0]); AStateListTail[] stateListTails = node.getStateLists().toArray(new AStateListTail[0]);
for(int i = stateListTails.length - 1; i >= 0 ; i--) for(int i = stateListTails.length - 1; i >= 0 ; i--)
{ {
...@@ -116,7 +116,7 @@ public class ConstructNFA extends DepthFirstAdapter ...@@ -116,7 +116,7 @@ public class ConstructNFA extends DepthFirstAdapter
@Override @Override
public void outARegExp(ARegExp node) public void outARegExp(ARegExp node)
{ {
AConcat[] concats = (AConcat[]) node.getConcats().toArray(new AConcat[0]); PConcat[] concats = node.getConcats().toArray(new PConcat[0]);
NFA result = null; NFA result = null;
if(concats.length > 1) if(concats.length > 1)
...@@ -152,7 +152,7 @@ public class ConstructNFA extends DepthFirstAdapter ...@@ -152,7 +152,7 @@ public class ConstructNFA extends DepthFirstAdapter
@Override @Override
public void outAConcat(AConcat node) public void outAConcat(AConcat node)
{ {
AUnExp[] unExps = (AUnExp[]) node.getUnExps().toArray(new AUnExp[0]); PUnExp[] unExps = node.getUnExps().toArray(new PUnExp[0]);
if(unExps.length == 0) if(unExps.length == 0)
{ {
......
...@@ -34,10 +34,9 @@ public class ConstructParserGenerationDatas extends DepthFirstAdapter ...@@ -34,10 +34,9 @@ public class ConstructParserGenerationDatas extends DepthFirstAdapter
public void caseAProd(AProd node) public void caseAProd(AProd node)
{ {
currentProd = ids.names.get(node); currentProd = ids.names.get(node);
AAlt[] alts = (AAlt[])node.getAlts().toArray(new AAlt[0]); for(PAlt alt : node.getAlts())
for(int i=0; i<alts.length; i++)
{ {
alts[i].apply(this); alt.apply(this);
} }
} }
...@@ -47,10 +46,9 @@ public class ConstructParserGenerationDatas extends DepthFirstAdapter ...@@ -47,10 +46,9 @@ public class ConstructParserGenerationDatas extends DepthFirstAdapter
currentAlt = Grammar.addProduction(currentProd, ids.names.get(node)); currentAlt = Grammar.addProduction(currentProd, ids.names.get(node));
alts.put(ids.names.get(node), node); alts.put(ids.names.get(node), node);
AElem[] temp = (AElem[])node.getElems().toArray(new AElem[0]); for(PElem elem : node.getElems())
for(int i = 0; i < temp.length; i++)
{ {
temp[i].apply(this); elem.apply(this);
} }
} }
......
...@@ -387,6 +387,6 @@ public class IntSet ...@@ -387,6 +387,6 @@ public class IntSet
public int[] elements() public int[] elements()
{ {
return (int[]) elements/*.clone()*/; return elements/*.clone()*/;
} }
} }
...@@ -24,8 +24,12 @@ final class LR1Collection ...@@ -24,8 +24,12 @@ final class LR1Collection
// Initialize lookaheads to nothing, propagation to nothing // Initialize lookaheads to nothing, propagation to nothing
LR0ItemSet[] sets = collection.sets(); LR0ItemSet[] sets = collection.sets();
lookaheads = (TreeMap<LR0Item, SymbolSet>[])new TreeMap<?, ?>[sets.length]; @SuppressWarnings("unchecked")
propagation = (TreeMap<LR0Item, Vector<LR0ItemAndSetPair>>[])new TreeMap<?, ?>[sets.length]; final TreeMap<LR0Item, SymbolSet>[] lookaheadsTemp = (TreeMap<LR0Item, SymbolSet>[])new TreeMap<?, ?>[sets.length];
lookaheads = lookaheadsTemp;
@SuppressWarnings("unchecked")
final TreeMap<LR0Item, Vector<LR0ItemAndSetPair>>[] propagationTemp = (TreeMap<LR0Item, Vector<LR0ItemAndSetPair>>[])new TreeMap<?, ?>[sets.length];
propagation = propagationTemp;
for(int i = 0; i < sets.length; i++) for(int i = 0; i < sets.length; i++)
{ {
......
...@@ -75,11 +75,11 @@ final class Symbol implements Comparable<Symbol> ...@@ -75,11 +75,11 @@ final class Symbol implements Comparable<Symbol>
{ {
if(terminal) if(terminal)
{ {
return (Symbol) terminals.elementAt(index); return terminals.elementAt(index);
} }
else else
{ {
return (Symbol) nonterminals.elementAt(index); return nonterminals.elementAt(index);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment