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

Use generics in Symbol and related classes

parent 4aa1448e
No related branches found
No related tags found
No related merge requests found
Pipeline #85161 passed
...@@ -10,10 +10,10 @@ package org.sablecc.sablecc; ...@@ -10,10 +10,10 @@ package org.sablecc.sablecc;
import java.util.*; import java.util.*;
import java.util.Vector; import java.util.Vector;
final class Symbol implements Comparable final class Symbol implements Comparable<Symbol>
{ {
private static Vector terminals; private static Vector<Symbol> terminals;
private static Vector nonterminals; private static Vector<Symbol> nonterminals;
private static TreeMap<String, Symbol> names; private static TreeMap<String, Symbol> names;
private static boolean modified_ = true; private static boolean modified_ = true;
...@@ -57,8 +57,8 @@ final class Symbol implements Comparable ...@@ -57,8 +57,8 @@ final class Symbol implements Comparable
public static void reinit() public static void reinit()
{ {
terminals = new Vector(); terminals = new Vector<>();
nonterminals = new Vector(); nonterminals = new Vector<>();
names = new TreeMap<>(); names = new TreeMap<>();
modified_ = true; modified_ = true;
symbols_ = null; symbols_ = null;
...@@ -134,10 +134,8 @@ final class Symbol implements Comparable ...@@ -134,10 +134,8 @@ final class Symbol implements Comparable
} }
@Override @Override
public int compareTo(Object object) public int compareTo(Symbol symbol)
{ {
Symbol symbol = (Symbol) object;
if(terminal ^ symbol.terminal) if(terminal ^ symbol.terminal)
{ {
if(terminal) if(terminal)
......
...@@ -21,7 +21,7 @@ final class SymbolSet implements Cloneable ...@@ -21,7 +21,7 @@ final class SymbolSet implements Cloneable
private void computeArray() private void computeArray()
{ {
Vector symbols = new Vector(0); Vector<Symbol> symbols = new Vector<>(0);
int[] elements = terminals.elements(); int[] elements = terminals.elements();
for(int i = 0; i < elements.length; i++) for(int i = 0; i < elements.length; i++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment