8044867: Fix raw and unchecked lint warnings in sun.tools.*

Reviewed-by: darcy
This commit is contained in:
Neil Toda 2014-07-31 17:01:24 -07:00
parent e03cc0d3c2
commit 8c6d88b327
71 changed files with 286 additions and 280 deletions

View File

@ -238,7 +238,7 @@ class Assembler implements Constants {
// if a local variable table is generated
if ((field != null) && env.debug_vars()) {
@SuppressWarnings("unchecked")
Vector<MemberDefinition> v = (Vector<MemberDefinition>)field.getArguments();
Vector<MemberDefinition> v = field.getArguments();
if (v != null) {
for (Enumeration<MemberDefinition> e = v.elements() ; e.hasMoreElements() ;) {
MemberDefinition f = e.nextElement();
@ -386,7 +386,7 @@ class Assembler implements Constants {
if ((field != null) && field.getArguments() != null) {
int sum = 0;
@SuppressWarnings("unchecked")
Vector<MemberDefinition> v = (Vector<MemberDefinition>)field.getArguments();
Vector<MemberDefinition> v = field.getArguments();
for (Enumeration<MemberDefinition> e = v.elements(); e.hasMoreElements(); ) {
MemberDefinition f = e.nextElement();
sum += f.getType().stackSize();
@ -858,7 +858,7 @@ public void GenJCov(Environment env) {
if ((field != null) && (field.getArguments() != null)) {
int reg = 0;
@SuppressWarnings("unchecked")
Vector<MemberDefinition> v = (Vector<MemberDefinition>)field.getArguments();
Vector<MemberDefinition> v = field.getArguments();
for (Enumeration<MemberDefinition> e = v.elements(); e.hasMoreElements(); ) {
MemberDefinition f = e.nextElement();
locals[reg] = f;
@ -875,7 +875,7 @@ public void GenJCov(Environment env) {
if ((field != null) && (field.getArguments() != null)) {
int reg = 0;
@SuppressWarnings("unchecked")
Vector<MemberDefinition> v = (Vector<MemberDefinition>)field.getArguments();
Vector<MemberDefinition> v = field.getArguments();
for (Enumeration<MemberDefinition> e = v.elements(); e.hasMoreElements(); ) {
MemberDefinition f = e.nextElement();
locals[reg] = f;

View File

@ -42,7 +42,7 @@ import java.io.DataOutputStream;
*/
public final
class ConstantPool implements RuntimeConstants {
Hashtable<Object,ConstantPoolData> hash = new Hashtable<>(101);
Hashtable<Object, ConstantPoolData> hash = new Hashtable<>(101);
/**
* Find an entry, may return 0

View File

@ -39,9 +39,9 @@ public final
class SwitchData {
int minValue, maxValue;
Label defaultLabel = new Label();
Hashtable<Integer,Label> tab = new Hashtable<>();
Hashtable<Integer, Label> tab = new Hashtable<>();
// JCOV
Hashtable<Integer,Long> whereCaseTab = null;
Hashtable<Integer, Long> whereCaseTab = null;
// end JCOV
/**
@ -92,13 +92,13 @@ class SwitchData {
// JCOV
public void initTableCase() {
whereCaseTab = new Hashtable<Integer,Long>();
whereCaseTab = new Hashtable<Integer, Long>();
}
public void addTableCase(int index, long where) {
if (whereCaseTab != null)
whereCaseTab.put(Integer.valueOf(index), Long.valueOf(where));
}
// this puts String key into Hashtable<Integer,Long>
// this puts String key into Hashtable<Integer, Long>
@SuppressWarnings("unchecked")
public void addTableDefault(long where) {
if (whereCaseTab != null)
@ -123,7 +123,7 @@ class SwitchDataEnumeration implements Enumeration<Integer> {
* hash table will be an Integer, with the value being a label. The
* enumeration returns the keys in sorted order.
*/
SwitchDataEnumeration(Hashtable<Integer,Label> tab) {
SwitchDataEnumeration(Hashtable<Integer, Label> tab) {
table = new Integer[tab.size()];
int i = 0;
for (Enumeration<Integer> e = tab.keys() ; e.hasMoreElements() ; ) {

View File

@ -43,7 +43,7 @@ public final
class BinaryClass extends ClassDefinition implements Constants {
BinaryConstantPool cpool;
BinaryAttribute atts;
Vector dependencies;
Vector<ClassDeclaration> dependencies;
private boolean haveLoadedNested = false;
/**
@ -51,7 +51,7 @@ class BinaryClass extends ClassDefinition implements Constants {
*/
public BinaryClass(Object source, ClassDeclaration declaration, int modifiers,
ClassDeclaration superClass, ClassDeclaration interfaces[],
Vector dependencies) {
Vector<ClassDeclaration> dependencies) {
super(source, 0, declaration, modifiers, null, null);
this.dependencies = dependencies;
this.superClass = superClass;
@ -134,7 +134,7 @@ class BinaryClass extends ClassDefinition implements Constants {
BinaryConstantPool cpool = new BinaryConstantPool(in);
// The dependencies of this class
Vector dependencies = cpool.getDependencies(env);
Vector<ClassDeclaration> dependencies = cpool.getDependencies(env);
// Read modifiers
int classMod = in.readUnsignedShort() & ACCM_CLASS; // JVM 4.1 ClassFile.access_flags
@ -500,7 +500,7 @@ class BinaryClass extends ClassDefinition implements Constants {
/**
* Get the dependencies
*/
public Enumeration getDependencies() {
public Enumeration<ClassDeclaration> getDependencies() {
return dependencies.elements();
}

View File

@ -222,8 +222,8 @@ class BinaryConstantPool implements Constants {
* Get a list of dependencies, ie: all the classes referenced in this
* constant pool.
*/
public Vector getDependencies(Environment env) {
Vector v = new Vector();
public Vector<ClassDeclaration> getDependencies(Environment env) {
Vector<ClassDeclaration> v = new Vector<>();
for (int i = 1 ; i < cpool.length ; i++) {
switch(types[i]) {
case CONSTANT_CLASS:
@ -234,8 +234,9 @@ class BinaryConstantPool implements Constants {
return v;
}
Hashtable indexHashObject, indexHashAscii;
Vector MoreStuff;
Hashtable<Object, Integer> indexHashObject;
Hashtable<Object, Integer> indexHashAscii;
Vector<String> MoreStuff;
/**
* Find the index of an Object in the constant pool
@ -243,7 +244,7 @@ class BinaryConstantPool implements Constants {
public int indexObject(Object obj, Environment env) {
if (indexHashObject == null)
createIndexHash(env);
Integer result = (Integer)indexHashObject.get(obj);
Integer result = indexHashObject.get(obj);
if (result == null)
throw new IndexOutOfBoundsException("Cannot find object " + obj + " of type " +
obj.getClass() + " in constant pool");
@ -257,9 +258,9 @@ class BinaryConstantPool implements Constants {
public int indexString(String string, Environment env) {
if (indexHashObject == null)
createIndexHash(env);
Integer result = (Integer)indexHashAscii.get(string);
Integer result = indexHashAscii.get(string);
if (result == null) {
if (MoreStuff == null) MoreStuff = new Vector();
if (MoreStuff == null) MoreStuff = new Vector<>();
result = cpool.length + MoreStuff.size();
MoreStuff.addElement(string);
indexHashAscii.put(string, result);
@ -273,8 +274,8 @@ class BinaryConstantPool implements Constants {
*/
public void createIndexHash(Environment env) {
indexHashObject = new Hashtable();
indexHashAscii = new Hashtable();
indexHashObject = new Hashtable<>();
indexHashAscii = new Hashtable<>();
for (int i = 1; i < cpool.length; i++) {
if (types[i] == CONSTANT_UTF8) {
indexHashAscii.put(cpool[i], i);
@ -342,7 +343,7 @@ class BinaryConstantPool implements Constants {
}
}
for (int i = cpool.length; i < length; i++) {
String string = (String)(MoreStuff.elementAt(i - cpool.length));
String string = MoreStuff.elementAt(i - cpool.length);
out.writeByte(CONSTANT_UTF8);
out.writeUTF(string);
}

View File

@ -82,9 +82,9 @@ class BinaryMember extends MemberDefinition {
/**
* Get arguments
*/
public Vector getArguments() {
public Vector<MemberDefinition> getArguments() {
if (isConstructor() && (getClassDefinition().getSuperClass() == null)) {
Vector v = new Vector();
Vector<MemberDefinition> v = new Vector<>();
v.addElement(new LocalMember(0, getClassDefinition(), 0,
getClassDefinition().getType(), idThis));
return v;

View File

@ -64,14 +64,14 @@ class ClassDefinition implements Constants {
protected boolean nestError;
protected UplevelReference references;
protected boolean referencesFrozen;
private Hashtable fieldHash = new Hashtable(31);
private Hashtable<Identifier, MemberDefinition> fieldHash = new Hashtable<>(31);
private int abstr;
// Table of local and anonymous classes whose internal names are constructed
// using the current class as a prefix. This is part of a fix for
// bugid 4054523 and 4030421. See also 'Environment.getClassDefinition'
// and 'BatchEnvironment.makeClassDefinition'. Allocated on demand.
private Hashtable localClasses = null;
private Hashtable<String, ClassDefinition> localClasses = null;
private final int LOCAL_CLASSES_SIZE = 31;
// The immediately surrounding context in which the class appears.
@ -378,7 +378,7 @@ class ClassDefinition implements Constants {
return firstMember;
}
public final MemberDefinition getFirstMatch(Identifier name) {
return (MemberDefinition)fieldHash.get(name);
return fieldHash.get(name);
}
/**
@ -519,9 +519,9 @@ class ClassDefinition implements Constants {
// We check for any abstract methods inherited or declared
// by this class.
Iterator methods = getMethods();
Iterator<MemberDefinition> methods = getMethods();
while (methods.hasNext()) {
MemberDefinition method = (MemberDefinition) methods.next();
MemberDefinition method = methods.next();
if (method.isAbstract()) {
return true;
@ -623,12 +623,11 @@ class ClassDefinition implements Constants {
// general can return methods which are not visible to the
// current package. We need to make sure that these do not
// prevent this class from being implemented.
Iterator otherMethods = intDef.getMethods();
Iterator<MemberDefinition> otherMethods = intDef.getMethods();
while (otherMethods.hasNext()) {
// Get one of the methods from intDef...
MemberDefinition method =
(MemberDefinition) otherMethods.next();
MemberDefinition method = otherMethods.next();
Identifier name = method.getName();
Type type = method.getType();
@ -996,14 +995,14 @@ class ClassDefinition implements Constants {
MemberDefinition tentative = null;
// A list of other methods which may be maximally specific too.
List candidateList = null;
List<MemberDefinition> candidateList = null;
// Get all the methods inherited by this class which
// have the name `methodName'.
Iterator methods = allMethods.lookupName(methodName);
Iterator<MemberDefinition> methods = allMethods.lookupName(methodName);
while (methods.hasNext()) {
MemberDefinition method = (MemberDefinition)methods.next();
MemberDefinition method = methods.next();
// See if this method is applicable.
if (!env.isApplicable(method, argumentTypes)) {
@ -1046,7 +1045,7 @@ class ClassDefinition implements Constants {
// list of other candidates.
if (!env.isMoreSpecific(tentative,method)) {
if (candidateList == null) {
candidateList = new ArrayList();
candidateList = new ArrayList<>();
}
candidateList.add(method);
}
@ -1057,9 +1056,9 @@ class ClassDefinition implements Constants {
if (tentative != null && candidateList != null) {
// Find out if our `tentative' match is a uniquely
// maximally specific.
Iterator candidates = candidateList.iterator();
Iterator<MemberDefinition> candidates = candidateList.iterator();
while (candidates.hasNext()) {
MemberDefinition method = (MemberDefinition)candidates.next();
MemberDefinition method = candidates.next();
if (!env.isMoreSpecific(tentative, method)) {
throw new AmbiguousMember(tentative, method);
}
@ -1186,13 +1185,13 @@ class ClassDefinition implements Constants {
// methods so that we can correctly detect that this class is
// indeed abstract and so that we can give somewhat comprehensible
// error messages.
private List permanentlyAbstractMethods = new ArrayList();
private List<MemberDefinition> permanentlyAbstractMethods = new ArrayList<>();
/**
* This method returns an Iterator of all abstract methods
* in our superclasses which we are unable to implement.
*/
protected Iterator getPermanentlyAbstractMethods() {
protected Iterator<MemberDefinition> getPermanentlyAbstractMethods() {
// This method can only be called after collectInheritedMethods.
if (allMethods == null) {
throw new CompilerError("isPermanentlyAbstract() called early");
@ -1239,10 +1238,10 @@ class ClassDefinition implements Constants {
try {
ClassDefinition pClass = parent.getClassDefinition(env);
Iterator methods = pClass.getMethods(env);
Iterator<MemberDefinition> methods = pClass.getMethods(env);
while (methods.hasNext()) {
MemberDefinition method =
(MemberDefinition) methods.next();
methods.next();
// Private methods are not inherited.
//
@ -1522,7 +1521,7 @@ class ClassDefinition implements Constants {
// Make sure that we add all unimplementable methods from our
// superclass to our list of unimplementable methods.
ClassDefinition sc = scDecl.getClassDefinition();
Iterator supIter = sc.getPermanentlyAbstractMethods();
Iterator<MemberDefinition> supIter = sc.getPermanentlyAbstractMethods();
while (supIter.hasNext()) {
permanentlyAbstractMethods.add(supIter.next());
}
@ -1587,7 +1586,7 @@ class ClassDefinition implements Constants {
* Get an Iterator of all methods which could be accessed in an
* instance of this class.
*/
public Iterator getMethods(Environment env) {
public Iterator<MemberDefinition> getMethods(Environment env) {
if (allMethods == null) {
collectInheritedMethods(env);
}
@ -1599,7 +1598,7 @@ class ClassDefinition implements Constants {
* instance of this class. Throw a compiler error if we haven't
* generated this information yet.
*/
public Iterator getMethods() {
public Iterator<MemberDefinition> getMethods() {
if (allMethods == null) {
throw new CompilerError("getMethods: too early");
}
@ -1636,7 +1635,7 @@ class ClassDefinition implements Constants {
* affect our compilation.
*/
protected void addMirandaMethods(Environment env,
Iterator mirandas) {
Iterator<MemberDefinition> mirandas) {
// do nothing.
}
@ -1921,11 +1920,11 @@ class ClassDefinition implements Constants {
// insert this at the front, because of initialization order
field.nextMember = firstMember;
firstMember = field;
field.nextMatch = (MemberDefinition)fieldHash.get(field.name);
field.nextMatch = fieldHash.get(field.name);
} else {
lastMember.nextMember = field;
lastMember = field;
field.nextMatch = (MemberDefinition)fieldHash.get(field.name);
field.nextMatch = fieldHash.get(field.name);
}
fieldHash.put(field.name, field);
}
@ -2013,13 +2012,13 @@ class ClassDefinition implements Constants {
if (localClasses == null) {
return null;
} else {
return (ClassDefinition)localClasses.get(name);
return localClasses.get(name);
}
}
public void addLocalClass(ClassDefinition c, String name) {
if (localClasses == null) {
localClasses = new Hashtable(LOCAL_CLASSES_SIZE);
localClasses = new Hashtable<>(LOCAL_CLASSES_SIZE);
}
localClasses.put(name, c);
}

View File

@ -233,11 +233,11 @@ class ClassPath {
/**
* Returns list of files given a package name and extension.
*/
public Enumeration getFiles(String pkg, String ext) {
Hashtable files = new Hashtable();
public Enumeration<ClassFile> getFiles(String pkg, String ext) {
Hashtable<String, ClassFile> files = new Hashtable<>();
for (int i = path.length; --i >= 0; ) {
if (path[i].zip != null) {
Enumeration e = path[i].zip.entries();
Enumeration<? extends ZipEntry> e = path[i].zip.entries();
while (e.hasMoreElements()) {
ZipEntry entry = (ZipEntry)e.nextElement();
String name = entry.getName();
@ -287,9 +287,9 @@ class ClassPathEntry {
File dir;
ZipFile zip;
Hashtable subdirs = new Hashtable(29); // cache of sub-directory listings
Hashtable<String, String[]> subdirs = new Hashtable<>(29); // cache of sub-directory listings:
String[] getFiles(String subdir) {
String files[] = (String[]) subdirs.get(subdir);
String files[] = subdirs.get(subdir);
if (files == null) {
// search the directory, exactly once
File sd = new File(dir.getPath(), subdir);

View File

@ -58,7 +58,7 @@ class Identifier implements Constants {
/**
* The hashtable of identifiers
*/
static Hashtable hash = new Hashtable(3001, 0.5f);
static Hashtable<String, Identifier> hash = new Hashtable<>(3001, 0.5f);
/**
* The name of the identifier
@ -115,7 +115,7 @@ class Identifier implements Constants {
*/
public static synchronized Identifier lookup(String s) {
//System.out.println("lookup(" + s + ")");
Identifier id = (Identifier)hash.get(s);
Identifier id = hash.get(s);
if (id == null) {
hash.put(s, id = new Identifier(s));
}

View File

@ -67,20 +67,20 @@ class Imports implements Constants {
/**
* The imported classes, including memoized imports from packages.
*/
Hashtable classes = new Hashtable();
Hashtable<Identifier, Identifier> classes = new Hashtable<>();
/**
* The imported package identifiers. This will not contain duplicate
* imports for the same package. It will also not contain the
* current package.
*/
Vector packages = new Vector();
Vector<IdentifierToken> packages = new Vector<>();
/**
* The (originally) imported classes.
* A vector of IdentifierToken.
*/
Vector singles = new Vector();
Vector<IdentifierToken> singles = new Vector<>();
/**
* Are the import names checked yet?
@ -134,9 +134,9 @@ class Imports implements Constants {
// }
// }
Vector resolvedPackages = new Vector();
for (Enumeration e = packages.elements() ; e.hasMoreElements() ;) {
IdentifierToken t = (IdentifierToken)e.nextElement();
Vector<IdentifierToken> resolvedPackages = new Vector<>();
for (Enumeration<IdentifierToken> e = packages.elements() ; e.hasMoreElements() ;) {
IdentifierToken t = e.nextElement();
Identifier nm = t.getName();
long where = t.getWhere();
@ -175,8 +175,8 @@ class Imports implements Constants {
}
packages = resolvedPackages;
for (Enumeration e = singles.elements() ; e.hasMoreElements() ;) {
IdentifierToken t = (IdentifierToken)e.nextElement();
for (Enumeration<IdentifierToken> e = singles.elements() ; e.hasMoreElements() ;) {
IdentifierToken t = e.nextElement();
Identifier nm = t.getName();
long where = t.getWhere();
Identifier pkg = nm.getQualifier();
@ -191,7 +191,7 @@ class Imports implements Constants {
Identifier snm = nm.getFlatName().getName();
// make sure it isn't already imported explicitly
Identifier className = (Identifier)classes.get(snm);
Identifier className = classes.get(snm);
if (className != null) {
Identifier f1 = Identifier.lookup(className.getQualifier(),
className.getFlatName());
@ -280,7 +280,7 @@ class Imports implements Constants {
}
// Check if it was imported before
Identifier className = (Identifier)classes.get(nm);
Identifier className = classes.get(nm);
if (className != null) {
if (tracing) env.dtExit("Imports.resolve: PREVIOUSLY IMPORTED " + nm);
return className;
@ -303,9 +303,9 @@ class Imports implements Constants {
} else {
// If it isn't in the current package, try to find it in
// our import-on-demands.
Enumeration e = packages.elements();
Enumeration<IdentifierToken> e = packages.elements();
while (e.hasMoreElements()) {
IdentifierToken t = (IdentifierToken)e.nextElement();
IdentifierToken t = e.nextElement();
id = Identifier.lookup(t.getName(), nm);
if (importable(id, env)) {
@ -386,7 +386,7 @@ class Imports implements Constants {
if (nm.isQualified())
return nm;
Identifier className = (Identifier)classes.get(nm);
Identifier className = classes.get(nm);
if (className != null) {
return className;
}
@ -425,7 +425,7 @@ class Imports implements Constants {
// added to the list, ignore it.
final int size = packages.size();
for (int i = 0; i < size; i++) {
if (name == ((IdentifierToken)packages.elementAt(i)).getName()) {
if (name == (packages.elementAt(i)).getName()) {
return;
}
}
@ -464,7 +464,7 @@ class Imports implements Constants {
* Return an unmodifiable list of IdentifierToken representing
* packages specified as imports.
*/
public List getImportedPackages() {
public List<IdentifierToken> getImportedPackages() {
return Collections.unmodifiableList(packages);
}
@ -472,7 +472,7 @@ class Imports implements Constants {
* Return an unmodifiable list of IdentifierToken representing
* classes specified as imports.
*/
public List getImportedClasses() {
public List<IdentifierToken> getImportedClasses() {
return Collections.unmodifiableList(singles);
}

View File

@ -103,7 +103,7 @@ class MemberDefinition implements Constants {
* uniqueness of proxy objects. See the makeProxyMember method
* defined below.
*/
static private Map proxyCache;
static private Map<String,MemberDefinition> proxyCache;
/**
* Create a member which is externally the same as `field' but
@ -126,12 +126,12 @@ class MemberDefinition implements Constants {
Environment env) {
if (proxyCache == null) {
proxyCache = new HashMap();
proxyCache = new HashMap<>();
}
String key = field.toString() + "@" + classDef.toString();
// System.out.println("Key is : " + key);
MemberDefinition proxy = (MemberDefinition)proxyCache.get(key);
MemberDefinition proxy = proxyCache.get(key);
if (proxy != null)
return proxy;
@ -217,8 +217,8 @@ class MemberDefinition implements Constants {
/**
* Get arguments (a vector of LocalMember)
*/
public Vector getArguments() {
return isMethod() ? new Vector() : null;
public Vector<MemberDefinition> getArguments() {
return isMethod() ? new Vector<>() : null;
}
/**

View File

@ -46,7 +46,7 @@ class MethodSet {
* A Map containing Lists of MemberDefinitions. The Lists
* contain methods which share the same name.
*/
private final Map lookupMap;
private final Map<Identifier,List<MemberDefinition>> lookupMap;
/**
* The number of methods stored in the MethodSet.
@ -63,7 +63,7 @@ class MethodSet {
*/
public MethodSet() {
frozen = false;
lookupMap = new HashMap();
lookupMap = new HashMap<>();
count = 0;
}
@ -89,12 +89,12 @@ class MethodSet {
Identifier name = method.getName();
// Get a List containing all methods of this name.
List methodList = (List) lookupMap.get(name);
List<MemberDefinition> methodList = lookupMap.get(name);
if (methodList == null) {
// There is no method with this name already.
// Create a List, and insert it into the hash.
methodList = new ArrayList();
methodList = new ArrayList<>();
lookupMap.put(name, methodList);
}
@ -102,7 +102,7 @@ class MethodSet {
// been added to the MethodSet.
int size = methodList.size();
for (int i = 0; i < size; i++) {
if (((MemberDefinition) methodList.get(i))
if ((methodList.get(i))
.getType().equalArguments(method.getType())) {
throw new CompilerError("duplicate addition");
}
@ -128,12 +128,12 @@ class MethodSet {
Identifier name = method.getName();
// Get a List containing all methods of this name.
List methodList = (List) lookupMap.get(name);
List<MemberDefinition> methodList = lookupMap.get(name);
if (methodList == null) {
// There is no method with this name already.
// Create a List, and insert it into the hash.
methodList = new ArrayList();
methodList = new ArrayList<>();
lookupMap.put(name, methodList);
}
@ -141,7 +141,7 @@ class MethodSet {
// `method'.
int size = methodList.size();
for (int i = 0; i < size; i++) {
if (((MemberDefinition) methodList.get(i))
if ((methodList.get(i))
.getType().equalArguments(method.getType())) {
methodList.set(i, method);
return;
@ -160,11 +160,11 @@ class MethodSet {
public MemberDefinition lookupSig(Identifier name, Type type) {
// Go through all methods of the same name and see if any
// have the right signature.
Iterator matches = lookupName(name);
Iterator<MemberDefinition> matches = lookupName(name);
MemberDefinition candidate;
while (matches.hasNext()) {
candidate = (MemberDefinition) matches.next();
candidate = matches.next();
if (candidate.getType().equalArguments(type)) {
return candidate;
}
@ -178,10 +178,10 @@ class MethodSet {
* Returns an Iterator of all methods contained in the
* MethodSet which have a given name.
*/
public Iterator lookupName(Identifier name) {
public Iterator<MemberDefinition> lookupName(Identifier name) {
// Find the List containing all methods of this name, and
// return that List's Iterator.
List methodList = (List) lookupMap.get(name);
List<MemberDefinition> methodList = lookupMap.get(name);
if (methodList == null) {
// If there is no method of this name, return a bogus, empty
// Iterator.
@ -193,22 +193,21 @@ class MethodSet {
/**
* Returns an Iterator of all methods in the MethodSet
*/
public Iterator iterator() {
public Iterator<MemberDefinition> iterator() {
//----------------------------------------------------------
// The inner class MethodIterator is used to create our
// Iterator of all methods in the MethodSet.
class MethodIterator implements Iterator {
Iterator hashIter = lookupMap.values().iterator();
Iterator listIter = Collections.emptyIterator();
class MethodIterator implements Iterator<MemberDefinition> {
Iterator<List<MemberDefinition>> hashIter = lookupMap.values().iterator();
Iterator<MemberDefinition> listIter = Collections.emptyIterator();
public boolean hasNext() {
if (listIter.hasNext()) {
return true;
} else {
if (hashIter.hasNext()) {
listIter = ((List) hashIter.next())
.iterator();
listIter = hashIter.next().iterator();
// The following should be always true.
if (listIter.hasNext()) {
@ -224,7 +223,7 @@ class MethodSet {
return false;
}
public Object next() {
public MemberDefinition next() {
return listIter.next();
}
@ -262,7 +261,7 @@ class MethodSet {
public String toString() {
int len = size();
StringBuilder sb = new StringBuilder();
Iterator all = iterator();
Iterator<MemberDefinition> all = iterator();
sb.append("{");
while (all.hasNext()) {

View File

@ -144,11 +144,11 @@ class Package {
return null;
}
public Enumeration getSourceFiles() {
public Enumeration<ClassFile> getSourceFiles() {
return sourcePath.getFiles(pkg, ".java");
}
public Enumeration getBinaryFiles() {
public Enumeration<ClassFile> getBinaryFiles() {
return binaryPath.getFiles(pkg, ".class");
}

View File

@ -392,8 +392,8 @@ class Parser extends Scanner implements ParserActions, Constants {
if (superName == null) {
env.error(type.getWhere(), "type.expected");
}
Vector ext = new Vector(1);
Vector impl = new Vector(0);
Vector<IdentifierToken> ext = new Vector<>(1);
Vector<IdentifierToken> impl = new Vector<>(0);
ext.addElement(new IdentifierToken(idNull));
if (token == IMPLEMENTS || token == EXTENDS) {
env.error(pos, "anonymous.extends");
@ -1682,7 +1682,7 @@ class Parser extends Scanner implements ParserActions, Constants {
// Parse and ignore throws clause
IdentifierToken exp[] = null;
if (token == THROWS) {
Vector v = new Vector();
Vector<IdentifierToken> v = new Vector<>();
scan();
v.addElement(parseName(false));
while (token == COMMA) {
@ -1890,8 +1890,8 @@ class Parser extends Scanner implements ParserActions, Constants {
long p = pos;
expect(IDENT);
Vector ext = new Vector();
Vector impl = new Vector();
Vector<IdentifierToken> ext = new Vector<>();
Vector<IdentifierToken> impl = new Vector<>();
parseInheritance(ext, impl);
ClassDefinition tmp = parseClassBody(nm, mod, ctx, doc, ext, impl, p);
@ -1901,7 +1901,7 @@ class Parser extends Scanner implements ParserActions, Constants {
return tmp;
}
protected void parseInheritance(Vector ext, Vector impl) throws SyntaxError, IOException {
protected void parseInheritance(Vector<IdentifierToken> ext, Vector<IdentifierToken> impl) throws SyntaxError, IOException {
// Parse extends clause
if (token == EXTENDS) {
scan();
@ -1929,23 +1929,23 @@ class Parser extends Scanner implements ParserActions, Constants {
*/
protected ClassDefinition parseClassBody(IdentifierToken nm, int mod,
int ctx, String doc,
Vector ext, Vector impl, long p
Vector<IdentifierToken> ext, Vector<IdentifierToken> impl, long p
) throws SyntaxError, IOException {
// Decide which is the super class
IdentifierToken sup = null;
if ((mod & M_INTERFACE) != 0) {
if (impl.size() > 0) {
env.error(((IdentifierToken)impl.elementAt(0)).getWhere(),
env.error(impl.elementAt(0).getWhere(),
"intf.impl.intf");
}
impl = ext;
} else {
if (ext.size() > 0) {
if (ext.size() > 1) {
env.error(((IdentifierToken)ext.elementAt(1)).getWhere(),
env.error(ext.elementAt(1).getWhere(),
"multiple.inherit");
}
sup = (IdentifierToken)ext.elementAt(0);
sup = ext.elementAt(0);
}
}

View File

@ -57,7 +57,7 @@ class Type implements Constants {
/**
* This hashtable is used to cache types
*/
private static final Hashtable typeHash = new Hashtable(231);
private static final Hashtable<String, Type> typeHash = new Hashtable<>(231);
/**
* The TypeCode of this type. The value of this field is one
@ -169,7 +169,7 @@ class Type implements Constants {
*/
public static synchronized Type tArray(Type elem) {
String sig = new String(SIG_ARRAY + elem.getTypeSignature());
Type t = (Type)typeHash.get(sig);
Type t = typeHash.get(sig);
if (t == null) {
t = new ArrayType(sig, elem);
}
@ -213,7 +213,7 @@ class Type implements Constants {
new String(SIG_CLASS +
className.toString().replace('.', SIGC_PACKAGE) +
SIG_ENDCLASS);
Type t = (Type)typeHash.get(sig);
Type t = typeHash.get(sig);
if (t == null) {
t = new ClassType(sig, className);
}
@ -283,7 +283,7 @@ class Type implements Constants {
sb.append(returnType.getTypeSignature());
String sig = sb.toString();
Type t = (Type)typeHash.get(sig);
Type t = typeHash.get(sig);
if (t == null) {
t = new MethodType(sig, returnType, argTypes);
}
@ -309,7 +309,7 @@ class Type implements Constants {
* @exception CompilerError invalid type signature.
*/
public static synchronized Type tType(String sig) {
Type t = (Type)typeHash.get(sig);
Type t = typeHash.get(sig);
if (t != null) {
return t;
}

View File

@ -61,17 +61,17 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
/**
* A hashtable of resource contexts.
*/
Hashtable packages = new Hashtable(31);
Hashtable<Identifier, Package> packages = new Hashtable<>(31);
/**
* The classes, in order of appearance.
*/
Vector classesOrdered = new Vector();
Vector<ClassDeclaration> classesOrdered = new Vector<>();
/**
* The classes, keyed by ClassDeclaration.
*/
Hashtable classes = new Hashtable(351);
Hashtable<Type, ClassDeclaration> classes = new Hashtable<>(351);
/**
* flags
@ -106,7 +106,7 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
/**
* A list of files containing deprecation warnings.
*/
Vector deprecationFiles = new Vector();
Vector<Object> deprecationFiles = new Vector<>();
/**
* writes out error messages
@ -271,7 +271,7 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
* Return an enumeration of all the currently defined classes
* in order of appearance to getClassDeclaration().
*/
public Enumeration getClasses() {
public Enumeration<ClassDeclaration> getClasses() {
return classesOrdered.elements();
}
@ -280,7 +280,7 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
* check in Imports#resolve(). These are the current packages for
* all classes being compiled as of the first call to isExemptPackage.
*/
private Set exemptPackages;
private Set<Identifier> exemptPackages;
/**
* Tells whether an Identifier refers to a package which should be
@ -317,11 +317,11 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
// will be exempt from the "exists" check in
// sun.tools.java.Imports#resolve().
exemptPackages = new HashSet(101);
exemptPackages = new HashSet<>(101);
// Add all of the current packages and their prefixes to our set.
for (Enumeration e = getClasses(); e.hasMoreElements(); ) {
ClassDeclaration c = (ClassDeclaration) e.nextElement();
for (Enumeration<ClassDeclaration> e = getClasses(); e.hasMoreElements(); ) {
ClassDeclaration c = e.nextElement();
if (c.getStatus() == CS_PARSED) {
SourceClass def = (SourceClass) c.getClassDefinition();
if (def.isLocal())
@ -389,7 +389,7 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
}
public ClassDeclaration getClassDeclaration(Type t) {
ClassDeclaration c = (ClassDeclaration)classes.get(t);
ClassDeclaration c = classes.get(t);
if (c == null) {
classes.put(t, c = new ClassDeclaration(t.getClassName()));
classesOrdered.addElement(c);
@ -407,7 +407,7 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
}
Type t = Type.tClass(nm);
try {
ClassDeclaration c = (ClassDeclaration)classes.get(t);
ClassDeclaration c = classes.get(t);
return (c != null) ? c.getName().equals(nm) :
getPackage(nm.getQualifier()).classExists(nm.getName());
} catch (IOException e) {
@ -448,7 +448,7 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
* Get the package path for a package
*/
public Package getPackage(Identifier pkg) throws IOException {
Package p = (Package)packages.get(pkg);
Package p = packages.get(pkg);
if (p == null) {
packages.put(pkg, p = new Package(sourcePath, binaryPath, pkg));
}
@ -527,10 +527,10 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
// (Fix for 4107960).
//
// The dependency code was previously in BatchParser.java.
Enumeration e = p.classes.elements();
Enumeration<SourceClass> e = p.classes.elements();
// first will not be an inner class.
ClassDefinition first = (ClassDefinition) e.nextElement();
ClassDefinition first = e.nextElement();
if (first.isInnerClass()) {
throw new CompilerError("BatchEnvironment, first is inner");
}
@ -538,7 +538,7 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
ClassDefinition current = first;
ClassDefinition next;
while (e.hasMoreElements()) {
next = (ClassDefinition) e.nextElement();
next = e.nextElement();
// Don't chain in inner classes.
if (next.isInnerClass()) {
continue;
@ -607,7 +607,7 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
/**
* Load a binary class
*/
boolean needsCompilation(Hashtable check, ClassDeclaration c) {
boolean needsCompilation(Hashtable<ClassDeclaration, ClassDeclaration> check, ClassDeclaration c) {
switch (c.getStatus()) {
case CS_UNDEFINED:
@ -621,8 +621,8 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
check.put(c, c);
BinaryClass bin = (BinaryClass)c.getClassDefinition();
for (Enumeration e = bin.getDependencies() ; e.hasMoreElements() ;) {
ClassDeclaration dep = (ClassDeclaration)e.nextElement();
for (Enumeration<ClassDeclaration> e = bin.getDependencies() ; e.hasMoreElements() ;) {
ClassDeclaration dep = e.nextElement();
if (needsCompilation(check, dep)) {
// It must be source, dependencies need compilation
c.setDefinition(bin, CS_SOURCE);
@ -829,11 +829,11 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
case CS_UNDECIDED: {
if (tracing) dtEvent("loadDefinition: STATUS IS UNDECIDED");
Hashtable tab = new Hashtable();
Hashtable<ClassDeclaration, ClassDeclaration> tab = new Hashtable<>();
if (!needsCompilation(tab, c)) {
// All undecided classes that this class depends on must be binary
for (Enumeration e = tab.keys() ; e.hasMoreElements() ; ) {
ClassDeclaration dep = (ClassDeclaration)e.nextElement();
for (Enumeration<ClassDeclaration> e = tab.keys() ; e.hasMoreElements() ; ) {
ClassDeclaration dep = e.nextElement();
if (dep.getStatus() == CS_UNDECIDED) {
// must be binary, dependencies need compilation
dep.setDefinition(dep.getClassDefinition(), CS_BINARY);
@ -1015,9 +1015,17 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
return sourceClass;
}
/*
* makeMemberDefinition method is left with rawtypes and with lint messages suppressed.
* The addition of Generics to com.sun.tools.* has uncovered an inconsistency
* in usage though tools still work correctly as long as this function is allowed to
* function as is.
*/
/**
* Create a new field.
*/
@SuppressWarnings({"rawtypes","unchecked"})
public MemberDefinition makeMemberDefinition(Environment origEnv, long where,
ClassDefinition clazz,
String doc, int modifiers,

View File

@ -56,7 +56,7 @@ class BatchParser extends Parser {
/**
* The classes defined in this file
*/
protected Vector classes;
protected Vector<SourceClass> classes;
/**
@ -76,7 +76,7 @@ class BatchParser extends Parser {
super(env, in);
imports = new Imports(env);
classes = new Vector();
classes = new Vector<>();
toplevelEnv = imports.newEnvironment(env);
}

View File

@ -38,7 +38,7 @@ import sun.tools.asm.Assembler;
*/
@Deprecated
final
class CompilerMember implements Comparable {
class CompilerMember implements Comparable<Object> {
MemberDefinition field;
Assembler asm;
Object value;

View File

@ -212,7 +212,7 @@ class Main implements Constants {
//end JCOV
int flags = F_WARNINGS | F_DEBUG_LINES | F_DEBUG_SOURCE;
long tm = System.currentTimeMillis();
Vector v = new Vector();
Vector<String> v = new Vector<>();
boolean nowrite = false;
String props = null;
String encoding = null;
@ -500,8 +500,8 @@ class Main implements Constants {
try {
// Parse all input files
for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
File file = new File((String)e.nextElement());
for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) {
File file = new File(e.nextElement());
try {
env.parseFile(new ClassFile(file));
} catch (FileNotFoundException ee) {
@ -512,8 +512,8 @@ class Main implements Constants {
// Do a post-read check on all newly-parsed classes,
// after they have all been read.
for (Enumeration e = env.getClasses() ; e.hasMoreElements() ; ) {
ClassDeclaration c = (ClassDeclaration)e.nextElement();
for (Enumeration<ClassDeclaration> e = env.getClasses() ; e.hasMoreElements() ; ) {
ClassDeclaration c = e.nextElement();
if (c.getStatus() == CS_PARSED) {
if (c.getClassDefinition().isLocal())
continue;
@ -531,8 +531,8 @@ class Main implements Constants {
do {
done = true;
env.flushErrors();
for (Enumeration e = env.getClasses() ; e.hasMoreElements() ; ) {
ClassDeclaration c = (ClassDeclaration)e.nextElement();
for (Enumeration<ClassDeclaration> e = env.getClasses() ; e.hasMoreElements() ; ) {
ClassDeclaration c = e.nextElement();
SourceClass src;
switch (c.getStatus()) {

View File

@ -70,7 +70,7 @@ class SourceClass extends ClassDefinition {
/**
* The list of class dependencies
*/
Hashtable deps = new Hashtable(11);
Hashtable<ClassDeclaration, ClassDeclaration> deps = new Hashtable<>(11);
/**
* The field used to represent "this" in all of my code.
@ -357,7 +357,7 @@ class SourceClass extends ClassDefinition {
f.addModifiers(M_ABSTRACT);
}
}
Vector arguments = f.getArguments();
Vector<MemberDefinition> arguments = f.getArguments();
if (arguments != null) {
// arguments can be null if this is an implicit abstract method
int argumentLength = arguments.size();
@ -921,9 +921,9 @@ class SourceClass extends ClassDefinition {
// Tell the user which methods force this class to be abstract.
// First list all of the "unimplementable" abstract methods.
Iterator iter = getPermanentlyAbstractMethods();
Iterator<MemberDefinition> iter = getPermanentlyAbstractMethods();
while (iter.hasNext()) {
MemberDefinition method = (MemberDefinition) iter.next();
MemberDefinition method = iter.next();
// We couldn't override this method even if we
// wanted to. Try to make the error message
// as non-confusing as possible.
@ -937,7 +937,7 @@ class SourceClass extends ClassDefinition {
while (iter.hasNext()) {
// For each method, check if it is abstract. If it is,
// output an appropriate error message.
MemberDefinition method = (MemberDefinition) iter.next();
MemberDefinition method = iter.next();
if (method.isAbstract()) {
env.error(where, "abstract.class",
getClassDeclaration(), method,
@ -1163,11 +1163,10 @@ class SourceClass extends ClassDefinition {
* sun/tools/java/ClassDeclaration.java
*/
protected void addMirandaMethods(Environment env,
Iterator mirandas) {
Iterator<MemberDefinition> mirandas) {
while(mirandas.hasNext()) {
MemberDefinition method =
(MemberDefinition)mirandas.next();
MemberDefinition method = mirandas.next();
addMember(method);
@ -2040,7 +2039,7 @@ class SourceClass extends ClassDefinition {
* is used to stop two compilations from saving the
* same class.
*/
private static Vector active = new Vector();
private static Vector<Object> active = new Vector<>();
/**
* Compile this class
@ -2082,9 +2081,9 @@ class SourceClass extends ClassDefinition {
protected void compileClass(Environment env, OutputStream out)
throws IOException, ClassNotFound {
Vector variables = new Vector();
Vector methods = new Vector();
Vector innerClasses = new Vector();
Vector<CompilerMember> variables = new Vector<>();
Vector<CompilerMember> methods = new Vector<>();
Vector<ClassDefinition> innerClasses = new Vector<>();
CompilerMember init = new CompilerMember(new MemberDefinition(getWhere(), this, M_STATIC, Type.tMethod(Type.tVoid), idClassInit, null, null), new Assembler());
Context ctx = new Context((Context)null, init.field);
@ -2243,8 +2242,8 @@ class SourceClass extends ClassDefinition {
methods.setElementAt(ordered_methods[i], i);
// Optimize Code and Collect method constants
for (Enumeration e = methods.elements() ; e.hasMoreElements() ; ) {
CompilerMember f = (CompilerMember)e.nextElement();
for (Enumeration<CompilerMember> e = methods.elements() ; e.hasMoreElements() ; ) {
CompilerMember f = e.nextElement();
try {
f.asm.optimize(env);
f.asm.collect(env, f.field, tab);
@ -2262,8 +2261,8 @@ class SourceClass extends ClassDefinition {
}
// Collect field constants
for (Enumeration e = variables.elements() ; e.hasMoreElements() ; ) {
CompilerMember f = (CompilerMember)e.nextElement();
for (Enumeration<CompilerMember> e = variables.elements() ; e.hasMoreElements() ; ) {
CompilerMember f = e.nextElement();
tab.put(f.name);
tab.put(f.sig);
@ -2274,9 +2273,9 @@ class SourceClass extends ClassDefinition {
}
// Collect inner class constants
for (Enumeration e = innerClasses.elements();
for (Enumeration<ClassDefinition> e = innerClasses.elements();
e.hasMoreElements() ; ) {
ClassDefinition inner = (ClassDefinition)e.nextElement();
ClassDefinition inner = e.nextElement();
tab.put(inner.getClassDeclaration());
// If the inner class is local, we do not need to add its
@ -2368,8 +2367,8 @@ class SourceClass extends ClassDefinition {
DataOutputStream databuf = new DataOutputStream(buf);
data.writeShort(variables.size());
for (Enumeration e = variables.elements() ; e.hasMoreElements() ; ) {
CompilerMember f = (CompilerMember)e.nextElement();
for (Enumeration<CompilerMember> e = variables.elements() ; e.hasMoreElements() ; ) {
CompilerMember f = e.nextElement();
Object val = f.field.getInitialValue();
data.writeShort(f.field.getModifiers() & MM_FIELD);
@ -2400,8 +2399,8 @@ class SourceClass extends ClassDefinition {
// write methods
data.writeShort(methods.size());
for (Enumeration e = methods.elements() ; e.hasMoreElements() ; ) {
CompilerMember f = (CompilerMember)e.nextElement();
for (Enumeration<CompilerMember> e = methods.elements() ; e.hasMoreElements() ; ) {
CompilerMember f = e.nextElement();
int xmods = f.field.getModifiers() & MM_METHOD;
// Transform floating point modifiers. M_STRICTFP
@ -2530,7 +2529,7 @@ class SourceClass extends ClassDefinition {
data.writeShort(tab.index("InnerClasses"));
data.writeInt(2 + 2*4*innerClasses.size());
data.writeShort(innerClasses.size());
for (Enumeration e = innerClasses.elements() ;
for (Enumeration<ClassDefinition> e = innerClasses.elements() ;
e.hasMoreElements() ; ) {
// For each inner class name transformation, we have a record
// with the following fields:
@ -2549,7 +2548,7 @@ class SourceClass extends ClassDefinition {
// See also the initInnerClasses() method in BinaryClass.java.
// Generate inner_class_info_index.
ClassDefinition inner = (ClassDefinition)e.nextElement();
ClassDefinition inner = e.nextElement();
data.writeShort(tab.index(inner.getClassDeclaration()));
// Generate outer_class_info_index.
@ -2662,8 +2661,8 @@ class SourceClass extends ClassDefinition {
// where className1 is the name of the class we are in, and
// classname2 is the name of the class className1
// is dependent on.
for(Enumeration e = deps.elements(); e.hasMoreElements(); ) {
ClassDeclaration data = (ClassDeclaration) e.nextElement();
for(Enumeration<ClassDeclaration> e = deps.elements(); e.hasMoreElements(); ) {
ClassDeclaration data = e.nextElement();
// Mangle name of class dependend on.
String depName =
Type.mangleInnerType(data.getName()).toString();

View File

@ -46,7 +46,7 @@ class SourceMember extends MemberDefinition implements Constants {
/**
* The argument names (if it is a method)
*/
Vector args;
Vector<MemberDefinition> args;
// set to the MemberDefinition in the interface if we have this field because
// it has been forced on us
@ -64,7 +64,7 @@ class SourceMember extends MemberDefinition implements Constants {
static final int INLINED = 4;
static final int ERROR = 5;
public Vector getArguments() {
public Vector<MemberDefinition> getArguments() {
return args;
}
@ -74,7 +74,7 @@ class SourceMember extends MemberDefinition implements Constants {
*/
public SourceMember(long where, ClassDefinition clazz,
String doc, int modifiers, Type type,
Identifier name, Vector argNames,
Identifier name, Vector<MemberDefinition> argNames,
IdentifierToken exp[], Node value) {
super(where, clazz, modifiers, type, name, exp, value);
this.documentation = doc;
@ -86,17 +86,17 @@ class SourceMember extends MemberDefinition implements Constants {
}
}
void createArgumentFields(Vector argNames) {
void createArgumentFields(Vector<MemberDefinition> argNames) {
// Create a list of arguments
if (isMethod()) {
args = new Vector();
args = new Vector<>();
if (isConstructor() || !(isStatic() || isInitializer())) {
args.addElement(((SourceClass)clazz).getThisArgument());
}
if (argNames != null) {
Enumeration e = argNames.elements();
Enumeration<MemberDefinition> e = argNames.elements();
Type argTypes[] = getType().getArgumentTypes();
for (int i = 0 ; i < argTypes.length ; i++) {
Object x = e.nextElement();
@ -359,7 +359,7 @@ class SourceMember extends MemberDefinition implements Constants {
getExceptions(env);
if (isMethod()) {
Vector argNames = args; args = null;
Vector<MemberDefinition> argNames = args; args = null;
createArgumentFields(argNames);
// Add outer instance argument for constructors.
if (isConstructor()) {
@ -523,7 +523,7 @@ class SourceMember extends MemberDefinition implements Constants {
// initialize vset, indication that each of the arguments
// to the function has a value
for (Enumeration e = args.elements(); e.hasMoreElements();){
for (Enumeration<MemberDefinition> e = args.elements(); e.hasMoreElements();){
LocalMember f = (LocalMember)e.nextElement();
vset.addVar(ctx.declare(env, f));
}
@ -549,7 +549,7 @@ class SourceMember extends MemberDefinition implements Constants {
//System.out.println("VSET = " + vset);
ClassDeclaration exp[] = getExceptions(env);
int htsize = (exp.length > 3) ? 17 : 7;
Hashtable thrown = new Hashtable(htsize);
Hashtable<Object, Object> thrown = new Hashtable<>(htsize);
vset = s.checkMethod(env, ctx, vset, thrown);
@ -558,7 +558,7 @@ class SourceMember extends MemberDefinition implements Constants {
ClassDeclaration ignore2 =
env.getClassDeclaration(idJavaLangRuntimeException);
for (Enumeration e = thrown.keys(); e.hasMoreElements();) {
for (Enumeration<Object> e = thrown.keys(); e.hasMoreElements();) {
ClassDeclaration c = (ClassDeclaration)e.nextElement();
ClassDefinition def = c.getClassDefinition(env);
if (def.subClassOf(env, ignore1)
@ -606,7 +606,7 @@ class SourceMember extends MemberDefinition implements Constants {
}
}
} else {
Hashtable thrown = new Hashtable(3); // small & throw-away
Hashtable<Object, Object> thrown = new Hashtable<>(3); // small & throw-away
Expression val = (Expression)getValue();
vset = val.checkInitializer(env, ctx, vset,
@ -636,7 +636,7 @@ class SourceMember extends MemberDefinition implements Constants {
ClassDeclaration ignore2 =
env.getClassDeclaration(idJavaLangRuntimeException);
for (Enumeration e = thrown.keys(); e.hasMoreElements(); ) {
for (Enumeration<Object> e = thrown.keys(); e.hasMoreElements(); ) {
ClassDeclaration c = (ClassDeclaration)e.nextElement();
ClassDefinition def = c.getClassDefinition(env);
@ -707,7 +707,7 @@ class SourceMember extends MemberDefinition implements Constants {
if ((!isNative()) && (!isAbstract())) {
Statement s = (Statement)getValue();
Context ctx = new Context((Context)null, this);
for (Enumeration e = args.elements() ; e.hasMoreElements() ;) {
for (Enumeration<MemberDefinition> e = args.elements() ; e.hasMoreElements() ;) {
LocalMember local = (LocalMember)e.nextElement();
ctx.declare(env, local);
}
@ -812,7 +812,7 @@ class SourceMember extends MemberDefinition implements Constants {
Context ctx = new Context((Context)null, this);
Statement s = (Statement)getValue();
for (Enumeration e = args.elements() ; e.hasMoreElements() ; ) {
for (Enumeration<MemberDefinition> e = args.elements() ; e.hasMoreElements() ; ) {
LocalMember f = (LocalMember)e.nextElement();
ctx.declare(env, f);
//ctx.declare(env, (LocalMember)e.nextElement());

View File

@ -54,7 +54,7 @@ class AndExpression extends BinaryLogicalExpression {
* either the left or right hand side is false
*/
public void checkCondition(Environment env, Context ctx, Vset vset,
Hashtable exp, ConditionVars cvars) {
Hashtable<Object, Object> exp, ConditionVars cvars) {
// Find out when the left side is true/false
left.checkCondition(env, ctx, vset, exp, cvars);
left = convert(env, ctx, Type.tBoolean, left);

View File

@ -62,7 +62,7 @@ class ArrayAccessExpression extends UnaryExpression {
/**
* Check expression type
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = right.checkValue(env, ctx, vset, exp);
if (index == null) {
env.error(where, "array.index.required");
@ -83,7 +83,7 @@ class ArrayAccessExpression extends UnaryExpression {
}
public Vset checkAmbigName(Environment env, Context ctx,
Vset vset, Hashtable exp,
Vset vset, Hashtable<Object, Object> exp,
UnaryExpression loc) {
if (index == null) {
vset = right.checkAmbigName(env, ctx, vset, exp, this);
@ -109,7 +109,7 @@ class ArrayAccessExpression extends UnaryExpression {
* Check the array if it appears on the LHS of an assignment
*/
public Vset checkLHS(Environment env, Context ctx,
Vset vset, Hashtable exp) {
Vset vset, Hashtable<Object, Object> exp) {
return checkValue(env, ctx, vset, exp);
}
@ -117,7 +117,7 @@ class ArrayAccessExpression extends UnaryExpression {
* Check the array if it appears on the LHS of an op= expression
*/
public Vset checkAssignOp(Environment env, Context ctx,
Vset vset, Hashtable exp, Expression outside) {
Vset vset, Hashtable<Object, Object> exp, Expression outside) {
return checkValue(env, ctx, vset, exp);
}

View File

@ -47,11 +47,11 @@ class ArrayExpression extends NaryExpression {
/**
* Check expression type
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
env.error(where, "invalid.array.expr");
return vset;
}
public Vset checkInitializer(Environment env, Context ctx, Vset vset, Type t, Hashtable exp) {
public Vset checkInitializer(Environment env, Context ctx, Vset vset, Type t, Hashtable<Object, Object> exp) {
if (!t.isType(TC_ARRAY)) {
if (!t.isType(TC_ERROR)) {
env.error(where, "invalid.array.init", t);

View File

@ -50,7 +50,7 @@ class AssignExpression extends BinaryAssignExpression {
/**
* Check an assignment expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
if (left instanceof IdentifierExpression) {
// we don't want to mark an identifier as having a value
// until having evaluated the right-hand side

View File

@ -149,7 +149,7 @@ class AssignOpExpression extends BinaryAssignExpression {
/**
* Check an assignment expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = left.checkAssignOp(env, ctx, vset, exp, this);
vset = right.checkValue(env, ctx, vset, exp);
int tm = left.type.getTypeMask() | right.type.getTypeMask();

View File

@ -67,7 +67,7 @@ class BinaryAssignExpression extends BinaryExpression {
/**
* Check void expression
*/
public Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object,Object> exp) {
return checkValue(env, ctx, vset, exp);
}

View File

@ -64,7 +64,7 @@ class BinaryExpression extends UnaryExpression {
/**
* Check a binary expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = left.checkValue(env, ctx, vset, exp);
vset = right.checkValue(env, ctx, vset, exp);

View File

@ -46,7 +46,7 @@ class BinaryLogicalExpression extends BinaryExpression {
* Check a binary expression
*/
public Vset checkValue(Environment env, Context ctx,
Vset vset, Hashtable exp) {
Vset vset, Hashtable<Object, Object> exp) {
ConditionVars cvars = new ConditionVars();
// evaluate the logical expression, determining which variables are
// set if the resulting value is true or false
@ -61,7 +61,7 @@ class BinaryLogicalExpression extends BinaryExpression {
*/
abstract
public void checkCondition(Environment env, Context ctx, Vset vset,
Hashtable exp, ConditionVars cvars);
Hashtable<Object, Object> exp, ConditionVars cvars);
/**

View File

@ -86,7 +86,7 @@ class BooleanExpression extends ConstantExpression {
*/
public void checkCondition(Environment env, Context ctx,
Vset vset, Hashtable exp, ConditionVars cvars) {
Vset vset, Hashtable<Object, Object> exp, ConditionVars cvars) {
if (value) {
cvars.vsFalse = Vset.DEAD_END;
cvars.vsTrue = vset;

View File

@ -51,7 +51,7 @@ class BreakStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
reach(env, vset);
checkLabel(env, ctx);
CheckContext destctx = (CheckContext)new CheckContext(ctx, this).getBreakContext(lbl);

View File

@ -49,7 +49,7 @@ class CaseStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
if (expr != null) {
expr.checkValue(env, ctx, vset, exp);
expr = convert(env, ctx, Type.tInt, expr);

View File

@ -48,7 +48,7 @@ class CastExpression extends BinaryExpression {
/**
* Check the expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
type = left.toType(env, ctx);
vset = right.checkValue(env, ctx, vset, exp);

View File

@ -67,7 +67,7 @@ class CatchStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = reach(env, vset);
ctx = new Context(ctx, this);
Type type = texpr.toType(env, ctx);

View File

@ -46,7 +46,7 @@ class CommaExpression extends BinaryExpression {
/**
* Check void expression
*/
public Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = left.check(env, ctx, vset, exp);
vset = right.check(env, ctx, vset, exp);
return vset;

View File

@ -70,7 +70,7 @@ class CompoundStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env, ctx);
if (args.length > 0) {
vset = reach(env, vset);

View File

@ -64,7 +64,7 @@ class ConditionalExpression extends BinaryExpression {
/**
* Check the expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
ConditionVars cvars = cond.checkCondition(env, ctx, vset, exp);
vset = left.checkValue(env, ctx, cvars.vsTrue, exp).join(
right.checkValue(env, ctx, cvars.vsFalse, exp) );
@ -107,7 +107,7 @@ class ConditionalExpression extends BinaryExpression {
return vset;
}
public Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = cond.checkValue(env, ctx, vset, exp);
cond = convert(env, ctx, Type.tBoolean, cond);
return left.check(env, ctx, vset.copy(), exp).join(right.check(env, ctx, vset, exp));

View File

@ -52,7 +52,7 @@ class ContinueStatement extends Statement {
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env, ctx);
reach(env, vset);
// A new context is established here because the 'continue' statement

View File

@ -47,7 +47,7 @@ class ConvertExpression extends UnaryExpression {
/**
* Check the value
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
return right.checkValue(env, ctx, vset, exp);
}

View File

@ -55,11 +55,11 @@ class DeclarationStatement extends Statement {
* Check statement
* Report an error unless the call is checkBlockStatement.
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
env.error(where, "invalid.decl");
return checkBlockStatement(env, ctx, vset, exp);
}
Vset checkBlockStatement(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset checkBlockStatement(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
if (labels != null) {
env.error(where, "declaration.with.label", labels[0]);
}

View File

@ -53,7 +53,7 @@ class DoStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env,ctx);
CheckContext newctx = new CheckContext(ctx, this);
// remember what was unassigned on entry

View File

@ -49,7 +49,7 @@ class ExprExpression extends UnaryExpression {
* Check a condition. We must pass it on to our unparenthesised form.
*/
public void checkCondition(Environment env, Context ctx, Vset vset,
Hashtable exp, ConditionVars cvars) {
Hashtable<Object, Object> exp, ConditionVars cvars) {
right.checkCondition(env, ctx, vset, exp, cvars);
type = right.type;
}
@ -60,7 +60,7 @@ class ExprExpression extends UnaryExpression {
* (Part of fix for 4090372)
*/
public Vset checkAssignOp(Environment env, Context ctx,
Vset vset, Hashtable exp, Expression outside) {
Vset vset, Hashtable<Object, Object> exp, Expression outside) {
vset = right.checkAssignOp(env, ctx, vset, exp, outside);
type = right.type;
return vset;
@ -80,7 +80,7 @@ class ExprExpression extends UnaryExpression {
// going to clammer for this one.
//
// public Vset checkLHS(Environment env, Context ctx,
// Vset vset, Hashtable exp) {
// Vset vset, Hashtable<Object, Object> exp) {
// vset = right.check(env, ctx, vset, exp);
// type = right.type;
// return vset;

View File

@ -192,18 +192,18 @@ class Expression extends Node {
/**
* Check an expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
return vset;
}
public Vset checkInitializer(Environment env, Context ctx, Vset vset, Type t, Hashtable exp) {
public Vset checkInitializer(Environment env, Context ctx, Vset vset, Type t, Hashtable<Object, Object> exp) {
return checkValue(env, ctx, vset, exp);
}
public Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
throw new CompilerError("check failed");
}
public Vset checkLHS(Environment env, Context ctx,
Vset vset, Hashtable exp) {
Vset vset, Hashtable<Object, Object> exp) {
env.error(where, "invalid.lhs.assignment");
type = Type.tError;
return vset;
@ -243,7 +243,7 @@ class Expression extends Node {
}
public Vset checkAssignOp(Environment env, Context ctx,
Vset vset, Hashtable exp, Expression outside) {
Vset vset, Hashtable<Object, Object> exp, Expression outside) {
if (outside instanceof IncDecExpression)
env.error(where, "invalid.arg", opNames[outside.op]);
else
@ -266,7 +266,7 @@ class Expression extends Node {
* and act appropriately to verify the full package name.
* @arg loc the expression containing the ambiguous expression
*/
public Vset checkAmbigName(Environment env, Context ctx, Vset vset, Hashtable exp,
public Vset checkAmbigName(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp,
UnaryExpression loc) {
return checkValue(env, ctx, vset, exp);
}
@ -277,7 +277,7 @@ class Expression extends Node {
* the condition is false.
*/
public ConditionVars checkCondition(Environment env, Context ctx,
Vset vset, Hashtable exp) {
Vset vset, Hashtable<Object, Object> exp) {
ConditionVars cvars = new ConditionVars();
checkCondition(env, ctx, vset, exp, cvars);
return cvars;
@ -295,7 +295,7 @@ class Expression extends Node {
*/
public void checkCondition(Environment env, Context ctx,
Vset vset, Hashtable exp, ConditionVars cvars) {
Vset vset, Hashtable<Object, Object> exp, ConditionVars cvars) {
cvars.vsTrue = cvars.vsFalse = checkValue(env, ctx, vset, exp);
// unshare side effects:
cvars.vsFalse = cvars.vsFalse.copy();

View File

@ -50,7 +50,7 @@ class ExpressionStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env, ctx);
return expr.check(env, ctx, reach(env, vset), exp);
}

View File

@ -219,7 +219,7 @@ class FieldExpression extends UnaryExpression {
*/
public Vset checkAmbigName(Environment env, Context ctx,
Vset vset, Hashtable exp,
Vset vset, Hashtable<Object, Object> exp,
UnaryExpression loc) {
if (id == idThis || id == idClass) {
loc = null; // this cannot be a type or package
@ -232,7 +232,7 @@ class FieldExpression extends UnaryExpression {
*/
public Vset checkValue(Environment env, Context ctx,
Vset vset, Hashtable exp) {
Vset vset, Hashtable<Object, Object> exp) {
vset = checkCommon(env, ctx, vset, exp, null, false);
if (id == idSuper && type != Type.tError) {
// "super" is not allowed in this context.
@ -416,7 +416,7 @@ class FieldExpression extends UnaryExpression {
*/
private Vset checkCommon(Environment env, Context ctx,
Vset vset, Hashtable exp,
Vset vset, Hashtable<Object, Object> exp,
UnaryExpression loc, boolean isLHS) {
// Handle class literal, e.g., 'x.class'.
@ -850,7 +850,7 @@ class FieldExpression extends UnaryExpression {
* Finish checking it.
*/
private Vset checkInnerClass(Environment env, Context ctx,
Vset vset, Hashtable exp,
Vset vset, Hashtable<Object, Object> exp,
UnaryExpression loc) {
ClassDefinition inner = field.getInnerClass();
type = inner.getType();
@ -903,7 +903,7 @@ class FieldExpression extends UnaryExpression {
* Check the expression if it appears on the LHS of an assignment
*/
public Vset checkLHS(Environment env, Context ctx,
Vset vset, Hashtable exp) {
Vset vset, Hashtable<Object, Object> exp) {
boolean hadField = (field != null);
//checkValue(env, ctx, vset, exp);
@ -945,7 +945,7 @@ class FieldExpression extends UnaryExpression {
* Check the expression if it appears on the LHS of an op= expression
*/
public Vset checkAssignOp(Environment env, Context ctx,
Vset vset, Hashtable exp, Expression outside) {
Vset vset, Hashtable<Object, Object> exp, Expression outside) {
//checkValue(env, ctx, vset, exp);
checkCommon(env, ctx, vset, exp, null, true);

View File

@ -68,9 +68,9 @@ class FinallyStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = reach(env, vset);
Hashtable newexp = new Hashtable();
Hashtable<Object, Object> newexp = new Hashtable<>();
// Handle the proposed 'try (init) { stmts } finally { stmts }' syntax.
// This feature has not been adopted, and support is presently disabled.
@ -182,7 +182,7 @@ class FinallyStatement extends Statement {
// generated by the body into exp.
if (finallyCanFinish) {
// Add newexp's back into exp; cf. ThrowStatement.check().
for (Enumeration e = newexp.keys() ; e.hasMoreElements() ; ) {
for (Enumeration<?> e = newexp.keys() ; e.hasMoreElements() ; ) {
Object def = e.nextElement();
exp.put(def, newexp.get(def));
}

View File

@ -57,7 +57,7 @@ class ForStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env, ctx);
vset = reach(env, vset);
Context initctx = new Context(ctx, this);

View File

@ -231,7 +231,7 @@ class IdentifierExpression extends Expression {
/**
* Check expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
if (field != null) {
// An internally pre-set field, such as an argument copying
// an uplevel value. Do not re-check it.
@ -250,7 +250,7 @@ class IdentifierExpression extends Expression {
* Check the expression if it appears on the LHS of an assignment
*/
public Vset checkLHS(Environment env, Context ctx,
Vset vset, Hashtable exp) {
Vset vset, Hashtable<Object, Object> exp) {
if (!bind(env, ctx))
return vset;
vset = assign(env, ctx, vset);
@ -263,7 +263,7 @@ class IdentifierExpression extends Expression {
* Check the expression if it appears on the LHS of an op= expression
*/
public Vset checkAssignOp(Environment env, Context ctx,
Vset vset, Hashtable exp, Expression outside) {
Vset vset, Hashtable<Object, Object> exp, Expression outside) {
if (!bind(env, ctx))
return vset;
vset = assign(env, ctx, get(env, ctx, vset));
@ -293,7 +293,7 @@ class IdentifierExpression extends Expression {
/**
* Check if the present name is part of a scoping prefix.
*/
public Vset checkAmbigName(Environment env, Context ctx, Vset vset, Hashtable exp,
public Vset checkAmbigName(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp,
UnaryExpression loc) {
try {
if (ctx.getField(env, id) != null) {
@ -474,4 +474,4 @@ class IdentifierExpression extends Expression {
implementation.print(out);
}
}
}
}

View File

@ -55,7 +55,7 @@ class IfStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env, ctx);
CheckContext newctx = new CheckContext(ctx, this);
// Vset vsExtra = vset.copy(); // See comment below.

View File

@ -49,7 +49,7 @@ class IncDecExpression extends UnaryExpression {
/**
* Check an increment or decrement expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = right.checkAssignOp(env, ctx, vset, exp, this);
if (right.type.inMask(TM_NUMBER)) {
type = right.type;
@ -66,7 +66,7 @@ class IncDecExpression extends UnaryExpression {
/**
* Check void expression
*/
public Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
return checkValue(env, ctx, vset, exp);
}

View File

@ -48,7 +48,7 @@ class InstanceOfExpression extends BinaryExpression {
/**
* Check the expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = left.checkValue(env, ctx, vset, exp);
right = new TypeExpression(right.where, right.toType(env, ctx));

View File

@ -46,7 +46,7 @@ class LengthExpression extends UnaryExpression {
/**
* Select the type of the expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = right.checkValue(env, ctx, vset, exp);
if (!right.type.isType(TC_ARRAY)) {
env.error(where, "invalid.length", right.type);

View File

@ -163,7 +163,7 @@ class LocalMember extends MemberDefinition {
* May inline copies of all the arguments of the given method.
*/
static public LocalMember[] copyArguments(Context ctx, MemberDefinition field) {
Vector v = field.getArguments();
Vector<MemberDefinition> v = field.getArguments();
LocalMember res[] = new LocalMember[v.size()];
v.copyInto(res);
for (int i = 0; i < res.length; i++) {

View File

@ -78,7 +78,7 @@ class MethodExpression extends NaryExpression {
/**
* Check expression type
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
ClassDeclaration c = null;
boolean isArray = false;
boolean staticRef = false;
@ -587,7 +587,7 @@ class MethodExpression extends NaryExpression {
/**
* Check void expression
*/
public Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
return checkValue(env, ctx, vset, exp);
}

View File

@ -55,7 +55,7 @@ class NewArrayExpression extends NaryExpression {
/**
* Check
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
type = right.toType(env, ctx);
boolean flag = (init != null); // flag says that dims are forbidden

View File

@ -83,7 +83,7 @@ class NewInstanceExpression extends NaryExpression {
/**
* Check expression type
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
// What type?
ClassDefinition def = null;
@ -366,7 +366,7 @@ class NewInstanceExpression extends NaryExpression {
/**
* Check void expression
*/
public Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
return checkValue(env, ctx, vset, exp);
}

View File

@ -65,7 +65,7 @@ class NotExpression extends UnaryExpression {
*/
public void checkCondition(Environment env, Context ctx, Vset vset,
Hashtable exp, ConditionVars cvars) {
Hashtable<Object, Object> exp, ConditionVars cvars) {
right.checkCondition(env, ctx, vset, exp, cvars);
right = convert(env, ctx, Type.tBoolean, right);
// swap true and false

View File

@ -54,7 +54,7 @@ class OrExpression extends BinaryLogicalExpression {
* both the left or right hand side are false
*/
public void checkCondition(Environment env, Context ctx, Vset vset,
Hashtable exp, ConditionVars cvars) {
Hashtable<Object, Object> exp, ConditionVars cvars) {
// Find out when the left side is true/false
left.checkCondition(env, ctx, vset, exp, cvars);
left = convert(env, ctx, Type.tBoolean, left);

View File

@ -51,7 +51,7 @@ class ReturnStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env, ctx);
vset = reach(env, vset);
if (expr != null) {

View File

@ -100,7 +100,7 @@ class Statement extends Node {
/**
* Check a statement
*/
public Vset checkMethod(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkMethod(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
// Set up ctx.getReturnContext() for the sake of ReturnStatement.check().
CheckContext mctx = new CheckContext(ctx, new Statement(METHOD, 0));
ctx = mctx;
@ -130,7 +130,7 @@ class Statement extends Node {
return vset;
}
Vset checkDeclaration(Environment env, Context ctx, Vset vset, int mod, Type t, Hashtable exp) {
Vset checkDeclaration(Environment env, Context ctx, Vset vset, int mod, Type t, Hashtable<Object, Object> exp) {
throw new CompilerError("checkDeclaration");
}
@ -164,12 +164,12 @@ class Statement extends Node {
}
}
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
throw new CompilerError("check");
}
/** This is called in contexts where declarations are valid. */
Vset checkBlockStatement(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset checkBlockStatement(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
return check(env, ctx, vset, exp);
}

View File

@ -61,7 +61,7 @@ class SuperExpression extends ThisExpression {
/**
* Check expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = checkCommon(env, ctx, vset, exp);
if (type != Type.tError) {
// "super" is not allowed in this context:
@ -74,13 +74,13 @@ class SuperExpression extends ThisExpression {
* Check if the present name is part of a scoping prefix.
*/
public Vset checkAmbigName(Environment env, Context ctx,
Vset vset, Hashtable exp,
Vset vset, Hashtable<Object, Object> exp,
UnaryExpression loc) {
return checkCommon(env, ctx, vset, exp);
}
/** Common code for checkValue and checkAmbigName */
private Vset checkCommon(Environment env, Context ctx, Vset vset, Hashtable exp) {
private Vset checkCommon(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
ClassDeclaration superClass = ctx.field.getClassDefinition().getSuperClass();
if (superClass == null) {
env.error(where, "undef.var", idSuper);

View File

@ -54,7 +54,7 @@ class SwitchStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env, ctx);
CheckContext newctx = new CheckContext(ctx, this);
vset = expr.checkValue(env, newctx, reach(env, vset), exp);
@ -62,7 +62,7 @@ class SwitchStatement extends Statement {
expr = convert(env, newctx, Type.tInt, expr);
Hashtable tab = new Hashtable();
Hashtable<Expression, Statement> tab = new Hashtable<>();
boolean hasDefault = false;
// Note that vs is reset to vset.copy() on every case label.
// If the first substatement is not a case label, it is unreached.

View File

@ -56,7 +56,7 @@ class SynchronizedStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env, ctx);
CheckContext newctx = new CheckContext(ctx, this);
vset = reach(env, vset);

View File

@ -87,7 +87,7 @@ class ThisExpression extends Expression {
/**
* Check expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
if (ctx.field.isStatic()) {
env.error(where, "undef.var", opNames[op]);
type = Type.tError;

View File

@ -50,7 +50,7 @@ class ThrowStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env, ctx);
try {
vset = reach(env, vset);

View File

@ -57,11 +57,11 @@ class TryStatement extends Statement {
/**
* Check statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env, ctx);
try {
vset = reach(env, vset);
Hashtable newexp = new Hashtable();
Hashtable<Object, Object> newexp = new Hashtable<>();
CheckContext newctx = new CheckContext(ctx, this);
// Check 'try' block. A variable is DA (DU) before the try
@ -131,7 +131,7 @@ class TryStatement extends Statement {
// Make sure the exception is actually throw in that part of the code
boolean ok = false;
for (Enumeration e = newexp.keys() ; e.hasMoreElements() ; ) {
for (Enumeration<?> e = newexp.keys() ; e.hasMoreElements() ; ) {
ClassDeclaration c = (ClassDeclaration)e.nextElement();
if (def.superClassOf(env, c) || def.subClassOf(env, c)) {
ok = true;
@ -149,7 +149,7 @@ class TryStatement extends Statement {
}
// Only carry over exceptions that are not caught
for (Enumeration e = newexp.keys() ; e.hasMoreElements() ; ) {
for (Enumeration<?> e = newexp.keys() ; e.hasMoreElements() ; ) {
ClassDeclaration c = (ClassDeclaration)e.nextElement();
ClassDefinition def = c.getClassDefinition(env);
boolean add = true;

View File

@ -53,13 +53,13 @@ class TypeExpression extends Expression {
/**
* Check an expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
env.error(where, "invalid.term");
type = Type.tError;
return vset;
}
public Vset checkAmbigName(Environment env, Context ctx, Vset vset, Hashtable exp,
public Vset checkAmbigName(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp,
UnaryExpression loc) {
return vset;
}

View File

@ -69,7 +69,7 @@ class UnaryExpression extends Expression {
/**
* Check a unary expression
*/
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable exp) {
public Vset checkValue(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
vset = right.checkValue(env, ctx, vset, exp);
int tm = right.type.getTypeMask();

View File

@ -57,7 +57,7 @@ class VarDeclarationStatement extends Statement {
/**
* Check statement
*/
Vset checkDeclaration(Environment env, Context ctx, Vset vset, int mod, Type t, Hashtable exp) {
Vset checkDeclaration(Environment env, Context ctx, Vset vset, int mod, Type t, Hashtable<Object, Object> exp) {
if (labels != null) {
env.error(where, "declaration.with.label", labels[0]);
}

View File

@ -53,7 +53,7 @@ class WhileStatement extends Statement {
/**
* Check a while statement
*/
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
Vset check(Environment env, Context ctx, Vset vset, Hashtable<Object, Object> exp) {
checkLabel(env, ctx);
CheckContext newctx = new CheckContext(ctx, this);
// remember what was unassigned on entry

View File

@ -54,7 +54,7 @@ public class CommandLine {
public static String[] parse(String[] args)
throws IOException
{
ArrayList newArgs = new ArrayList(args.length);
ArrayList<String> newArgs = new ArrayList<>(args.length);
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.length() > 1 && arg.charAt(0) == '@') {
@ -68,10 +68,10 @@ public class CommandLine {
newArgs.add(arg);
}
}
return (String[])newArgs.toArray(new String[newArgs.size()]);
return newArgs.toArray(new String[newArgs.size()]);
}
private static void loadCmdFile(String name, List args)
private static void loadCmdFile(String name, List<String> args)
throws IOException
{
Reader r = new BufferedReader(new FileReader(name));