提交 06434b40 编写于 作者: S smarks

8022479: clean up warnings from sun.tools.asm

Reviewed-by: lancea, darcy
上级 0b856a33
/* /*
* Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -91,9 +91,9 @@ class Assembler implements Constants { ...@@ -91,9 +91,9 @@ class Assembler implements Constants {
add(new Instruction(where, opc, flagNoCovered)); add(new Instruction(where, opc, flagNoCovered));
} }
static Vector SourceClassList = new Vector(); static Vector<String> SourceClassList = new Vector<>();
static Vector TmpCovTable = new Vector(); static Vector<String> TmpCovTable = new Vector<>();
static int[] JcovClassCountArray = new int[CT_LAST_KIND + 1]; static int[] JcovClassCountArray = new int[CT_LAST_KIND + 1];
...@@ -177,8 +177,8 @@ class Assembler implements Constants { ...@@ -177,8 +177,8 @@ class Assembler implements Constants {
case opc_lookupswitch: { case opc_lookupswitch: {
SwitchData sw = (SwitchData)inst.value; SwitchData sw = (SwitchData)inst.value;
optimize(env, sw.defaultLabel); optimize(env, sw.defaultLabel);
for (Enumeration e = sw.tab.elements() ; e.hasMoreElements();) { for (Enumeration<Label> e = sw.tab.elements() ; e.hasMoreElements();) {
optimize(env, (Label)e.nextElement()); optimize(env, e.nextElement());
} }
return; return;
} }
...@@ -186,8 +186,8 @@ class Assembler implements Constants { ...@@ -186,8 +186,8 @@ class Assembler implements Constants {
case opc_try: { case opc_try: {
TryData td = (TryData)inst.value; TryData td = (TryData)inst.value;
td.getEndLabel().pc = NEEDED; td.getEndLabel().pc = NEEDED;
for (Enumeration e = td.catches.elements() ; e.hasMoreElements();) { for (Enumeration<CatchData> e = td.catches.elements() ; e.hasMoreElements();) {
CatchData cd = (CatchData)e.nextElement(); CatchData cd = e.nextElement();
optimize(env, cd.getLabel()); optimize(env, cd.getLabel());
} }
break; break;
...@@ -237,9 +237,11 @@ class Assembler implements Constants { ...@@ -237,9 +237,11 @@ class Assembler implements Constants {
// Collect constants for arguments only // Collect constants for arguments only
// if a local variable table is generated // if a local variable table is generated
if ((field != null) && env.debug_vars()) { if ((field != null) && env.debug_vars()) {
if (field.getArguments() != null) { @SuppressWarnings("unchecked")
for (Enumeration e = field.getArguments().elements() ; e.hasMoreElements() ;) { Vector<MemberDefinition> v = (Vector<MemberDefinition>)field.getArguments();
MemberDefinition f = (MemberDefinition)e.nextElement(); if (v != null) {
for (Enumeration<MemberDefinition> e = v.elements() ; e.hasMoreElements() ;) {
MemberDefinition f = e.nextElement();
tab.put(f.getName().toString()); tab.put(f.getName().toString());
tab.put(f.getType().getTypeSignature()); tab.put(f.getType().getTypeSignature());
} }
...@@ -355,16 +357,16 @@ class Assembler implements Constants { ...@@ -355,16 +357,16 @@ class Assembler implements Constants {
case opc_lookupswitch: { case opc_lookupswitch: {
SwitchData sw = (SwitchData)inst.value; SwitchData sw = (SwitchData)inst.value;
balance(sw.defaultLabel, depth); balance(sw.defaultLabel, depth);
for (Enumeration e = sw.tab.elements() ; e.hasMoreElements();) { for (Enumeration<Label> e = sw.tab.elements() ; e.hasMoreElements();) {
balance((Label)e.nextElement(), depth); balance(e.nextElement(), depth);
} }
return; return;
} }
case opc_try: { case opc_try: {
TryData td = (TryData)inst.value; TryData td = (TryData)inst.value;
for (Enumeration e = td.catches.elements() ; e.hasMoreElements();) { for (Enumeration<CatchData> e = td.catches.elements() ; e.hasMoreElements();) {
CatchData cd = (CatchData)e.nextElement(); CatchData cd = e.nextElement();
balance(cd.getLabel(), depth + 1); balance(cd.getLabel(), depth + 1);
} }
break; break;
...@@ -383,9 +385,10 @@ class Assembler implements Constants { ...@@ -383,9 +385,10 @@ class Assembler implements Constants {
if ((field != null) && field.getArguments() != null) { if ((field != null) && field.getArguments() != null) {
int sum = 0; int sum = 0;
Vector v = field.getArguments(); @SuppressWarnings("unchecked")
for (Enumeration e = v.elements(); e.hasMoreElements(); ) { Vector<MemberDefinition> v = (Vector<MemberDefinition>)field.getArguments();
MemberDefinition f = ((MemberDefinition)e.nextElement()); for (Enumeration<MemberDefinition> e = v.elements(); e.hasMoreElements(); ) {
MemberDefinition f = e.nextElement();
sum += f.getType().stackSize(); sum += f.getType().stackSize();
} }
maxvar = sum; maxvar = sum;
...@@ -441,8 +444,8 @@ class Assembler implements Constants { ...@@ -441,8 +444,8 @@ class Assembler implements Constants {
if (inst.opc == opc_try) { if (inst.opc == opc_try) {
TryData td = (TryData)inst.value; TryData td = (TryData)inst.value;
writeExceptions(env, out, tab, inst.next, td.getEndLabel()); writeExceptions(env, out, tab, inst.next, td.getEndLabel());
for (Enumeration e = td.catches.elements() ; e.hasMoreElements();) { for (Enumeration<CatchData> e = td.catches.elements() ; e.hasMoreElements();) {
CatchData cd = (CatchData)e.nextElement(); CatchData cd = e.nextElement();
//System.out.println("EXCEPTION: " + env.getSource() + ", pc=" + inst.pc + ", end=" + td.getEndLabel().pc + ", hdl=" + cd.getLabel().pc + ", tp=" + cd.getType()); //System.out.println("EXCEPTION: " + env.getSource() + ", pc=" + inst.pc + ", end=" + td.getEndLabel().pc + ", hdl=" + cd.getLabel().pc + ", tp=" + cd.getType());
out.writeShort(inst.pc); out.writeShort(inst.pc);
out.writeShort(td.getEndLabel().pc); out.writeShort(td.getEndLabel().pc);
...@@ -463,11 +466,12 @@ class Assembler implements Constants { ...@@ -463,11 +466,12 @@ class Assembler implements Constants {
* Write the coverage table * Write the coverage table
*/ */
public void writeCoverageTable(Environment env, ClassDefinition c, DataOutputStream out, ConstantPool tab, long whereField) throws IOException { public void writeCoverageTable(Environment env, ClassDefinition c, DataOutputStream out, ConstantPool tab, long whereField) throws IOException {
Vector TableLot = new Vector(); /* Coverage table */ Vector<Cover> TableLot = new Vector<>(); /* Coverage table */
boolean begseg = false; boolean begseg = false;
boolean begmeth = false; boolean begmeth = false;
@SuppressWarnings("deprecation")
long whereClass = ((SourceClass)c).getWhere(); long whereClass = ((SourceClass)c).getWhere();
Vector whereTry = new Vector(); Vector<Long> whereTry = new Vector<>();
int numberTry = 0; int numberTry = 0;
int count = 0; int count = 0;
...@@ -484,8 +488,8 @@ class Assembler implements Constants { ...@@ -484,8 +488,8 @@ class Assembler implements Constants {
} }
if (!begseg && !inst.flagNoCovered ) { if (!begseg && !inst.flagNoCovered ) {
boolean findTry = false; boolean findTry = false;
for (Enumeration e = whereTry.elements(); e.hasMoreElements();) { for (Enumeration<Long> e = whereTry.elements(); e.hasMoreElements();) {
if ( ((Long)(e.nextElement())).longValue() == inst.where) { if (e.nextElement().longValue() == inst.where) {
findTry = true; findTry = true;
break; break;
} }
...@@ -546,7 +550,7 @@ class Assembler implements Constants { ...@@ -546,7 +550,7 @@ class Assembler implements Constants {
} }
case opc_try: { case opc_try: {
whereTry.addElement(new Long(inst.where)); whereTry.addElement(Long.valueOf(inst.where));
begseg = false; begseg = false;
break; break;
} }
...@@ -569,8 +573,8 @@ class Assembler implements Constants { ...@@ -569,8 +573,8 @@ class Assembler implements Constants {
} }
case opc_lookupswitch: { case opc_lookupswitch: {
SwitchData sw = (SwitchData)inst.value; SwitchData sw = (SwitchData)inst.value;
for (Enumeration e = sw.sortedKeys(); e.hasMoreElements() ; ) { for (Enumeration<Integer> e = sw.sortedKeys(); e.hasMoreElements() ; ) {
Integer v = (Integer)e.nextElement(); Integer v = e.nextElement();
TableLot.addElement(new Cover(CT_CASE, sw.whereCase(v), inst.pc)); TableLot.addElement(new Cover(CT_CASE, sw.whereCase(v), inst.pc));
count++; count++;
} }
...@@ -591,7 +595,7 @@ class Assembler implements Constants { ...@@ -591,7 +595,7 @@ class Assembler implements Constants {
out.writeShort(count); out.writeShort(count);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
Lot = (Cover)TableLot.elementAt(i); Lot = TableLot.elementAt(i);
ln = (Lot.Addr >> WHEREOFFSETBITS); ln = (Lot.Addr >> WHEREOFFSETBITS);
pos = (Lot.Addr << (64 - WHEREOFFSETBITS)) >> (64 - WHEREOFFSETBITS); pos = (Lot.Addr << (64 - WHEREOFFSETBITS)) >> (64 - WHEREOFFSETBITS);
out.writeShort(Lot.NumCommand); out.writeShort(Lot.NumCommand);
...@@ -646,6 +650,7 @@ private String createClassJcovElement(Environment env, ClassDefinition c) { ...@@ -646,6 +650,7 @@ private String createClassJcovElement(Environment env, ClassDefinition c) {
*/ */
public void GenVecJCov(Environment env, ClassDefinition c, long Time) { public void GenVecJCov(Environment env, ClassDefinition c, long Time) {
@SuppressWarnings("deprecation")
String SourceFile = ((SourceClass)c).getAbsoluteName(); String SourceFile = ((SourceClass)c).getAbsoluteName();
TmpCovTable.addElement(createClassJcovElement(env, c)); TmpCovTable.addElement(createClassJcovElement(env, c));
...@@ -667,6 +672,7 @@ public void GenVecJCov(Environment env, ClassDefinition c, long Time) { ...@@ -667,6 +672,7 @@ public void GenVecJCov(Environment env, ClassDefinition c, long Time) {
* generate file of coverage data * generate file of coverage data
*/ */
@SuppressWarnings("deprecation") // for JCovd.readLine() calls
public void GenJCov(Environment env) { public void GenJCov(Environment env) {
try { try {
...@@ -686,14 +692,14 @@ public void GenJCov(Environment env) { ...@@ -686,14 +692,14 @@ public void GenJCov(Environment env) {
while((CurrLine = JCovd.readLine()) != null ) { while((CurrLine = JCovd.readLine()) != null ) {
if ( CurrLine.startsWith(JcovClassLine) ) { if ( CurrLine.startsWith(JcovClassLine) ) {
first = true; first = true;
for(Enumeration e = SourceClassList.elements(); e.hasMoreElements();) { for(Enumeration<String> e = SourceClassList.elements(); e.hasMoreElements();) {
String clsName = CurrLine.substring(JcovClassLine.length()); String clsName = CurrLine.substring(JcovClassLine.length());
int idx = clsName.indexOf(' '); int idx = clsName.indexOf(' ');
if (idx != -1) { if (idx != -1) {
clsName = clsName.substring(0, idx); clsName = clsName.substring(0, idx);
} }
Class = (String)e.nextElement(); Class = e.nextElement();
if ( Class.compareTo(clsName) == 0) { if ( Class.compareTo(clsName) == 0) {
first = false; first = false;
break; break;
...@@ -708,7 +714,7 @@ public void GenJCov(Environment env) { ...@@ -708,7 +714,7 @@ public void GenJCov(Environment env) {
} }
PrintStream CovFile = new PrintStream(new DataOutputStream(new FileOutputStream(outFile))); PrintStream CovFile = new PrintStream(new DataOutputStream(new FileOutputStream(outFile)));
CovFile.println(JcovMagicLine); CovFile.println(JcovMagicLine);
for(Enumeration e = TmpCovTable.elements(); e.hasMoreElements();) { for(Enumeration<String> e = TmpCovTable.elements(); e.hasMoreElements();) {
CovFile.println(e.nextElement()); CovFile.println(e.nextElement());
} }
CovFile.close(); CovFile.close();
...@@ -821,16 +827,16 @@ public void GenJCov(Environment env) { ...@@ -821,16 +827,16 @@ public void GenJCov(Environment env) {
case opc_lookupswitch: { case opc_lookupswitch: {
SwitchData sw = (SwitchData)inst.value; SwitchData sw = (SwitchData)inst.value;
flowFields(env, sw.defaultLabel, locals); flowFields(env, sw.defaultLabel, locals);
for (Enumeration e = sw.tab.elements() ; e.hasMoreElements();) { for (Enumeration<Label> e = sw.tab.elements() ; e.hasMoreElements();) {
flowFields(env, (Label)e.nextElement(), locals); flowFields(env, e.nextElement(), locals);
} }
return; return;
} }
case opc_try: { case opc_try: {
Vector catches = ((TryData)inst.value).catches; Vector<CatchData> catches = ((TryData)inst.value).catches;
for (Enumeration e = catches.elements(); e.hasMoreElements();) { for (Enumeration<CatchData> e = catches.elements(); e.hasMoreElements();) {
CatchData cd = (CatchData)e.nextElement(); CatchData cd = e.nextElement();
flowFields(env, cd.getLabel(), locals); flowFields(env, cd.getLabel(), locals);
} }
break; break;
...@@ -851,9 +857,10 @@ public void GenJCov(Environment env) { ...@@ -851,9 +857,10 @@ public void GenJCov(Environment env) {
// Initialize arguments // Initialize arguments
if ((field != null) && (field.getArguments() != null)) { if ((field != null) && (field.getArguments() != null)) {
int reg = 0; int reg = 0;
Vector v = field.getArguments(); @SuppressWarnings("unchecked")
for (Enumeration e = v.elements(); e.hasMoreElements(); ) { Vector<MemberDefinition> v = (Vector<MemberDefinition>)field.getArguments();
MemberDefinition f = ((MemberDefinition)e.nextElement()); for (Enumeration<MemberDefinition> e = v.elements(); e.hasMoreElements(); ) {
MemberDefinition f = e.nextElement();
locals[reg] = f; locals[reg] = f;
reg += f.getType().stackSize(); reg += f.getType().stackSize();
} }
...@@ -867,9 +874,10 @@ public void GenJCov(Environment env) { ...@@ -867,9 +874,10 @@ public void GenJCov(Environment env) {
locals[i] = null; locals[i] = null;
if ((field != null) && (field.getArguments() != null)) { if ((field != null) && (field.getArguments() != null)) {
int reg = 0; int reg = 0;
Vector v = field.getArguments(); @SuppressWarnings("unchecked")
for (Enumeration e = v.elements(); e.hasMoreElements(); ) { Vector<MemberDefinition> v = (Vector<MemberDefinition>)field.getArguments();
MemberDefinition f = ((MemberDefinition)e.nextElement()); for (Enumeration<MemberDefinition> e = v.elements(); e.hasMoreElements(); ) {
MemberDefinition f = e.nextElement();
locals[reg] = f; locals[reg] = f;
lvtab.define(f, reg, 0, maxpc); lvtab.define(f, reg, 0, maxpc);
reg += f.getType().stackSize(); reg += f.getType().stackSize();
......
/* /*
* Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -42,20 +42,20 @@ import java.io.DataOutputStream; ...@@ -42,20 +42,20 @@ import java.io.DataOutputStream;
*/ */
public final public final
class ConstantPool implements RuntimeConstants { class ConstantPool implements RuntimeConstants {
Hashtable hash = new Hashtable(101); Hashtable<Object,ConstantPoolData> hash = new Hashtable<>(101);
/** /**
* Find an entry, may return 0 * Find an entry, may return 0
*/ */
public int index(Object obj) { public int index(Object obj) {
return ((ConstantPoolData)hash.get(obj)).index; return hash.get(obj).index;
} }
/** /**
* Add an entry * Add an entry
*/ */
public void put(Object obj) { public void put(Object obj) {
ConstantPoolData data = (ConstantPoolData)hash.get(obj); ConstantPoolData data = hash.get(obj);
if (data == null) { if (data == null) {
if (obj instanceof String) { if (obj instanceof String) {
data = new StringConstantData(this, (String)obj); data = new StringConstantData(this, (String)obj);
...@@ -87,8 +87,8 @@ class ConstantPool implements RuntimeConstants { ...@@ -87,8 +87,8 @@ class ConstantPool implements RuntimeConstants {
// Make a list of all the constant pool items // Make a list of all the constant pool items
for (int n = 0 ; n < 5 ; n++) { for (int n = 0 ; n < 5 ; n++) {
int first = count; int first = count;
for (Enumeration e = hash.elements() ; e.hasMoreElements() ;) { for (Enumeration<ConstantPoolData> e = hash.elements() ; e.hasMoreElements() ;) {
ConstantPoolData data = (ConstantPoolData)e.nextElement(); ConstantPoolData data = e.nextElement();
if (data.order() == n) { if (data.order() == n) {
keys[count] = sortKey(data); keys[count] = sortKey(data);
list[count++] = data; list[count++] = data;
......
/* /*
* Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -274,9 +274,9 @@ class Instruction implements Constants { ...@@ -274,9 +274,9 @@ class Instruction implements Constants {
case opc_lookupswitch: { case opc_lookupswitch: {
SwitchData sw = (SwitchData)value; SwitchData sw = (SwitchData)value;
sw.defaultLabel = sw.defaultLabel.getDestination(); sw.defaultLabel = sw.defaultLabel.getDestination();
for (Enumeration e = sw.tab.keys() ; e.hasMoreElements() ; ) { for (Enumeration<Integer> e = sw.tab.keys() ; e.hasMoreElements() ; ) {
Integer k = (Integer)e.nextElement(); Integer k = e.nextElement();
Label lbl = (Label)sw.tab.get(k); Label lbl = sw.tab.get(k);
sw.tab.put(k, lbl.getDestination()); sw.tab.put(k, lbl.getDestination());
} }
...@@ -389,8 +389,8 @@ class Instruction implements Constants { ...@@ -389,8 +389,8 @@ class Instruction implements Constants {
return; return;
case opc_try: case opc_try:
for (Enumeration e = ((TryData)value).catches.elements() ; e.hasMoreElements() ;) { for (Enumeration<CatchData> e = ((TryData)value).catches.elements() ; e.hasMoreElements() ;) {
CatchData cd = (CatchData)e.nextElement(); CatchData cd = e.nextElement();
if (cd.getType() != null) { if (cd.getType() != null) {
tab.put(cd.getType()); tab.put(cd.getType());
} }
...@@ -641,6 +641,7 @@ class Instruction implements Constants { ...@@ -641,6 +641,7 @@ class Instruction implements Constants {
/** /**
* Generate code * Generate code
*/ */
@SuppressWarnings("fallthrough")
void write(DataOutputStream out, ConstantPool tab) throws IOException { void write(DataOutputStream out, ConstantPool tab) throws IOException {
switch (opc) { switch (opc) {
case opc_try: case opc_label: case opc_dead: case opc_try: case opc_label: case opc_dead:
...@@ -770,8 +771,8 @@ class Instruction implements Constants { ...@@ -770,8 +771,8 @@ class Instruction implements Constants {
} }
out.writeInt(sw.defaultLabel.pc - pc); out.writeInt(sw.defaultLabel.pc - pc);
out.writeInt(sw.tab.size()); out.writeInt(sw.tab.size());
for (Enumeration e = sw.sortedKeys(); e.hasMoreElements() ; ) { for (Enumeration<Integer> e = sw.sortedKeys(); e.hasMoreElements() ; ) {
Integer v = (Integer)e.nextElement(); Integer v = e.nextElement();
out.writeInt(v.intValue()); out.writeInt(v.intValue());
out.writeInt(sw.get(v).pc - pc); out.writeInt(sw.get(v).pc - pc);
} }
......
/* /*
* Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -39,23 +39,23 @@ public final ...@@ -39,23 +39,23 @@ public final
class SwitchData { class SwitchData {
int minValue, maxValue; int minValue, maxValue;
Label defaultLabel = new Label(); Label defaultLabel = new Label();
Hashtable tab = new Hashtable(); Hashtable<Integer,Label> tab = new Hashtable<>();
// JCOV // JCOV
Hashtable whereCaseTab = null; Hashtable<Integer,Long> whereCaseTab = null;
// end JCOV // end JCOV
/** /**
* Get a label * Get a label
*/ */
public Label get(int n) { public Label get(int n) {
return (Label)tab.get(new Integer(n)); return tab.get(n);
} }
/** /**
* Get a label * Get a label
*/ */
public Label get(Integer n) { public Label get(Integer n) {
return (Label)tab.get(n); return tab.get(n);
} }
/** /**
...@@ -73,7 +73,7 @@ class SwitchData { ...@@ -73,7 +73,7 @@ class SwitchData {
maxValue = n; maxValue = n;
} }
} }
tab.put(new Integer(n), lbl); tab.put(Integer.valueOf(n), lbl);
} }
/** /**
...@@ -86,33 +86,35 @@ class SwitchData { ...@@ -86,33 +86,35 @@ class SwitchData {
/** /**
* Return the keys of this enumaration sorted in ascending order * Return the keys of this enumaration sorted in ascending order
*/ */
public synchronized Enumeration sortedKeys() { public synchronized Enumeration<Integer> sortedKeys() {
return new SwitchDataEnumeration(tab); return new SwitchDataEnumeration(tab);
} }
// JCOV // JCOV
public void initTableCase() { public void initTableCase() {
whereCaseTab = new Hashtable(); whereCaseTab = new Hashtable<Integer,Long>();
} }
public void addTableCase(int index, long where) { public void addTableCase(int index, long where) {
if (whereCaseTab != null) if (whereCaseTab != null)
whereCaseTab.put(new Integer(index), new Long(where)); whereCaseTab.put(Integer.valueOf(index), Long.valueOf(where));
} }
// this puts String key into Hashtable<Integer,Long>
@SuppressWarnings("unchecked")
public void addTableDefault(long where) { public void addTableDefault(long where) {
if (whereCaseTab != null) if (whereCaseTab != null)
whereCaseTab.put("default", new Long(where)); ((Hashtable)whereCaseTab).put("default", Long.valueOf(where));
} }
public long whereCase(Object key) { public long whereCase(Object key) {
Long i = (Long) whereCaseTab.get(key); Long i = whereCaseTab.get(key);
return (i == null) ? 0 : i.longValue(); return (i == null) ? 0L : i.longValue();
} }
public boolean getDefault() { public boolean getDefault() {
return (whereCase("default") != 0); return (whereCase("default") != 0L);
} }
// end JCOV // end JCOV
} }
class SwitchDataEnumeration implements Enumeration { class SwitchDataEnumeration implements Enumeration<Integer> {
private Integer table[]; private Integer table[];
private int current_index = 0; private int current_index = 0;
...@@ -121,11 +123,11 @@ class SwitchDataEnumeration implements Enumeration { ...@@ -121,11 +123,11 @@ class SwitchDataEnumeration implements Enumeration {
* hash table will be an Integer, with the value being a label. The * hash table will be an Integer, with the value being a label. The
* enumeration returns the keys in sorted order. * enumeration returns the keys in sorted order.
*/ */
SwitchDataEnumeration(Hashtable tab) { SwitchDataEnumeration(Hashtable<Integer,Label> tab) {
table = new Integer[tab.size()]; table = new Integer[tab.size()];
int i = 0; int i = 0;
for (Enumeration e = tab.keys() ; e.hasMoreElements() ; ) { for (Enumeration<Integer> e = tab.keys() ; e.hasMoreElements() ; ) {
table[i++] = (Integer)e.nextElement(); table[i++] = e.nextElement();
} }
Arrays.sort(table); Arrays.sort(table);
current_index = 0; current_index = 0;
...@@ -141,7 +143,7 @@ class SwitchDataEnumeration implements Enumeration { ...@@ -141,7 +143,7 @@ class SwitchDataEnumeration implements Enumeration {
/** /**
* Return the next key. * Return the next key.
*/ */
public Object nextElement() { public Integer nextElement() {
return table[current_index++]; return table[current_index++];
} }
} }
/* /*
* Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -35,7 +35,7 @@ import java.util.Vector; ...@@ -35,7 +35,7 @@ import java.util.Vector;
*/ */
public final public final
class TryData { class TryData {
Vector catches = new Vector(); Vector<CatchData> catches = new Vector<>();
Label endLabel = new Label(); Label endLabel = new Label();
/** /**
...@@ -51,7 +51,7 @@ class TryData { ...@@ -51,7 +51,7 @@ class TryData {
* Get a label * Get a label
*/ */
public CatchData getCatch(int n) { public CatchData getCatch(int n) {
return (CatchData)catches.elementAt(n); return catches.elementAt(n);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册