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
Branches
Tags
No related merge requests found
Pipeline #85161 passed
......@@ -10,10 +10,10 @@ package org.sablecc.sablecc;
import java.util.*;
import java.util.Vector;
final class Symbol implements Comparable
final class Symbol implements Comparable<Symbol>
{
private static Vector terminals;
private static Vector nonterminals;
private static Vector<Symbol> terminals;
private static Vector<Symbol> nonterminals;
private static TreeMap<String, Symbol> names;
private static boolean modified_ = true;
......@@ -57,8 +57,8 @@ final class Symbol implements Comparable
public static void reinit()
{
terminals = new Vector();
nonterminals = new Vector();
terminals = new Vector<>();
nonterminals = new Vector<>();
names = new TreeMap<>();
modified_ = true;
symbols_ = null;
......@@ -134,10 +134,8 @@ final class Symbol implements Comparable
}
@Override
public int compareTo(Object object)
public int compareTo(Symbol symbol)
{
Symbol symbol = (Symbol) object;
if(terminal ^ symbol.terminal)
{
if(terminal)
......
......@@ -21,7 +21,7 @@ final class SymbolSet implements Cloneable
private void computeArray()
{
Vector symbols = new Vector(0);
Vector<Symbol> symbols = new Vector<>(0);
int[] elements = terminals.elements();
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