You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/10/07 18:06:58 UTC
[commons-bcel] 02/02: Replace use of deprecated code in examples
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git
commit c6e1019f786fac478298941d7408e415dc7daaeb
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Fri Oct 7 14:06:51 2022 -0400
Replace use of deprecated code in examples
---
src/examples/Mini/ASTExpr.java | 25 ++++++++++++++-----------
src/examples/Mini/ASTFunAppl.java | 10 ++++++----
src/examples/Mini/ASTFunDecl.java | 17 ++++++++++-------
src/examples/Mini/ASTIdent.java | 9 +++++----
src/examples/Mini/ASTIfExpr.java | 18 ++++++++++--------
src/examples/Mini/ASTInteger.java | 3 ++-
src/examples/Mini/ASTLetExpr.java | 6 ++++--
src/examples/Mini/ASTProgram.java | 26 ++++++++++++++------------
src/examples/Mini/MiniC.java | 11 +++++++----
src/examples/Package.java | 4 ++--
src/examples/TransitiveHull.java | 4 ++--
src/examples/listclass.java | 4 ++--
12 files changed, 78 insertions(+), 59 deletions(-)
diff --git a/src/examples/Mini/ASTExpr.java b/src/examples/Mini/ASTExpr.java
index 85370311..7fcff2ce 100644
--- a/src/examples/Mini/ASTExpr.java
+++ b/src/examples/Mini/ASTExpr.java
@@ -20,6 +20,8 @@
package Mini;
+import org.apache.bcel.Const;
+import org.apache.bcel.Constants;
import org.apache.bcel.generic.BranchHandle;
import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.GOTO;
@@ -44,7 +46,7 @@ import org.apache.bcel.generic.PUSH;
* build the parse tree obeying the aritmetical precedences (* stronger than +, etc.) and are discarded in the first
* pass.
*/
-public class ASTExpr extends SimpleNode implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constants {
+public class ASTExpr extends SimpleNode implements MiniParserConstants, MiniParserTreeConstants {
public static Node jjtCreate(final MiniParser p, final int id) {
return new ASTExpr(p, id);
}
@@ -71,7 +73,7 @@ public class ASTExpr extends SimpleNode implements MiniParserConstants, MiniPars
* Not all children shall inherit this, exceptions are ASTIdent and ASTFunAppl, which look up the type in the
* corresponding environment entry.
*/
- protected int type = T_UNKNOWN;
+ protected int type = Const.T_UNKNOWN;
/*
* Special constructor, called from ASTTerm.traverse() and ASTFactor.traverse(), when traverse()ing the parse tree
@@ -295,25 +297,25 @@ public class ASTExpr extends SimpleNode implements MiniParserConstants, MiniPars
* @param expected type
*/
public int eval(final int expected) {
- int childType = T_UNKNOWN, t;
+ int childType = Const.T_UNKNOWN, t;
is_simple = true;
// Determine expected node type depending on used operator.
if (unop != -1) {
if (unop == MINUS) {
- childType = type = T_INT; // -
+ childType = type = Const.T_INT; // -
} else {
- childType = type = T_BOOLEAN; // !
+ childType = type = Const.T_BOOLEAN; // !
}
} else // Compute expected type
if (kind == PLUS || kind == MINUS || kind == MULT || kind == MOD || kind == DIV) {
- childType = type = T_INT;
+ childType = type = Const.T_INT;
} else if (kind == AND || kind == OR) {
- childType = type = T_BOOLEAN;
+ childType = type = Const.T_BOOLEAN;
} else { // LEQ, GT, etc.
- childType = T_INT;
- type = T_BOOLEAN;
+ childType = Const.T_INT;
+ type = Const.T_BOOLEAN;
}
// Get type of subexpressions
@@ -321,7 +323,8 @@ public class ASTExpr extends SimpleNode implements MiniParserConstants, MiniPars
t = expr.eval(childType);
if (t != childType) {
- MiniC.addError(expr.getLine(), expr.getColumn(), "Expression has not expected type " + TYPE_NAMES[childType] + " but " + TYPE_NAMES[t] + ".");
+ MiniC.addError(expr.getLine(), expr.getColumn(),
+ "Expression has not expected type " + Constants.TYPE_NAMES[childType] + " but " + Constants.TYPE_NAMES[t] + ".");
}
is_simple = is_simple && expr.isSimple();
@@ -392,7 +395,7 @@ public class ASTExpr extends SimpleNode implements MiniParserConstants, MiniPars
op = tokenImage[kind];
}
- return jjtNodeName[id] + "(" + op + ")[" + len + "]<" + TYPE_NAMES[type] + "> @" + line + ", " + column;
+ return jjtNodeName[id] + "(" + op + ")[" + len + "]<" + Constants.TYPE_NAMES[type] + "> @" + line + ", " + column;
}
/**
diff --git a/src/examples/Mini/ASTFunAppl.java b/src/examples/Mini/ASTFunAppl.java
index fd429f48..b6034fed 100644
--- a/src/examples/Mini/ASTFunAppl.java
+++ b/src/examples/Mini/ASTFunAppl.java
@@ -20,6 +20,8 @@
package Mini;
+import org.apache.bcel.Const;
+import org.apache.bcel.Constants;
import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.INVOKESTATIC;
import org.apache.bcel.generic.InstructionList;
@@ -171,9 +173,9 @@ public class ASTFunAppl extends ASTExpr {
final int expect = args[i].getType(); // May be T_UNKNOWN
final int t_e = exprs[i].eval(expect); // May be T_UNKNOWN
- if (expect != T_UNKNOWN && t_e != expect) {
- MiniC.addError(exprs[i].getLine(), exprs[i].getColumn(),
- "Argument " + (i + 1) + " in application of " + fname + " is not of type " + TYPE_NAMES[expect] + " but " + TYPE_NAMES[t_e]);
+ if (expect != Const.T_UNKNOWN && t_e != expect) {
+ MiniC.addError(exprs[i].getLine(), exprs[i].getColumn(), "Argument " + (i + 1) + " in application of " + fname + " is not of type "
+ + Constants.TYPE_NAMES[expect] + " but " + Constants.TYPE_NAMES[t_e]);
} else {
args[i].setType(t_e); // Update, may be identical
}
@@ -182,7 +184,7 @@ public class ASTFunAppl extends ASTExpr {
}
}
- if (t == T_UNKNOWN) {
+ if (t == Const.T_UNKNOWN) {
fun.setType(t = expected); // May be still T_UNKNOWN
}
diff --git a/src/examples/Mini/ASTFunDecl.java b/src/examples/Mini/ASTFunDecl.java
index 8b713abb..adb76869 100644
--- a/src/examples/Mini/ASTFunDecl.java
+++ b/src/examples/Mini/ASTFunDecl.java
@@ -23,6 +23,8 @@ package Mini;
import java.io.PrintWriter;
import java.util.Iterator;
+import org.apache.bcel.Const;
+import org.apache.bcel.Constants;
import org.apache.bcel.generic.ALOAD;
import org.apache.bcel.generic.ASTORE;
import org.apache.bcel.generic.ArrayType;
@@ -47,7 +49,7 @@ import org.apache.bcel.util.InstructionFinder;
/**
*
*/
-public class ASTFunDecl extends SimpleNode implements MiniParserTreeConstants, org.apache.bcel.Constants {
+public class ASTFunDecl extends SimpleNode implements MiniParserTreeConstants {
private static final InstructionFinder.CodeConstraint my_constraint = match -> {
final BranchInstruction if_icmp = (BranchInstruction) match[0].getInstruction();
final GOTO goto_ = (GOTO) match[2].getInstruction();
@@ -162,7 +164,7 @@ public class ASTFunDecl extends SimpleNode implements MiniParserTreeConstants, o
private ASTExpr body;
- private int type = T_UNKNOWN;
+ private int type = Const.T_UNKNOWN;
private int line, column;
@@ -205,7 +207,7 @@ public class ASTFunDecl extends SimpleNode implements MiniParserTreeConstants, o
String[] arg_names = {"$argv"};
if (fname.equals("main")) {
- method = new MethodGen(ACC_STATIC | ACC_PUBLIC, Type.VOID, args, arg_names, "main", className, il, cp);
+ method = new MethodGen(Const.ACC_STATIC | Const.ACC_PUBLIC, Type.VOID, args, arg_names, "main", className, il, cp);
main = true;
} else if (fname.equals("READ") || fname.equals("WRITE")) { // Do nothing
@@ -221,7 +223,7 @@ public class ASTFunDecl extends SimpleNode implements MiniParserTreeConstants, o
arg_names[i] = argv[i].getName();
}
- method = new MethodGen(ACC_STATIC | ACC_PRIVATE | ACC_FINAL, Type.INT, args, arg_names, fname, className, il, cp);
+ method = new MethodGen(Const.ACC_STATIC | Const.ACC_PRIVATE | Const.ACC_FINAL, Type.INT, args, arg_names, fname, className, il, cp);
final LocalVariableGen[] lv = method.getLocalVariables();
for (int i = 0; i < size; i++) {
@@ -364,15 +366,16 @@ public class ASTFunDecl extends SimpleNode implements MiniParserTreeConstants, o
final int expected = name.getType(); // Maybe other function has already called us
type = body.eval(expected); // And updated the env
- if (expected != T_UNKNOWN && type != expected) {
- MiniC.addError(line, column, "Function f ist not of type " + TYPE_NAMES[expected] + " as previously assumed, but " + TYPE_NAMES[type]);
+ if (expected != Const.T_UNKNOWN && type != expected) {
+ MiniC.addError(line, column,
+ "Function f ist not of type " + Constants.TYPE_NAMES[expected] + " as previously assumed, but " + Constants.TYPE_NAMES[type]);
}
name.setType(type);
is_simple = body.isSimple();
- if (pass == 2 && type == T_UNKNOWN) {
+ if (pass == 2 && type == Const.T_UNKNOWN) {
is_recursive = true;
}
diff --git a/src/examples/Mini/ASTIdent.java b/src/examples/Mini/ASTIdent.java
index b3392736..011b36cd 100644
--- a/src/examples/Mini/ASTIdent.java
+++ b/src/examples/Mini/ASTIdent.java
@@ -20,6 +20,7 @@
package Mini;
+import org.apache.bcel.Const;
import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.ILOAD;
import org.apache.bcel.generic.InstructionList;
@@ -97,13 +98,13 @@ public class ASTIdent extends ASTExpr {
is_simple = true; // (Very) simple expression, always true
- if (t == T_UNKNOWN && expected == T_UNKNOWN) {
- type = T_UNKNOWN;
- } else if (t == T_UNKNOWN && expected != T_UNKNOWN) {
+ if (t == Const.T_UNKNOWN && expected == Const.T_UNKNOWN) {
+ type = Const.T_UNKNOWN;
+ } else if (t == Const.T_UNKNOWN && expected != Const.T_UNKNOWN) {
ident.setType(expected);
type = expected;
} else {
- if (t != T_UNKNOWN && expected == T_UNKNOWN) {
+ if (t != Const.T_UNKNOWN && expected == Const.T_UNKNOWN) {
ident.setType(t);
}
type = t;
diff --git a/src/examples/Mini/ASTIfExpr.java b/src/examples/Mini/ASTIfExpr.java
index 58d12c55..7983a38d 100644
--- a/src/examples/Mini/ASTIfExpr.java
+++ b/src/examples/Mini/ASTIfExpr.java
@@ -20,6 +20,8 @@
package Mini;
+import org.apache.bcel.Const;
+import org.apache.bcel.Constants;
import org.apache.bcel.generic.BranchHandle;
import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.GOTO;
@@ -124,24 +126,24 @@ public class ASTIfExpr extends ASTExpr {
public int eval(final int expected) {
int thenType, elseType, ifType;
- if ((ifType = if_expr.eval(T_BOOLEAN)) != T_BOOLEAN) {
- MiniC.addError(if_expr.getLine(), if_expr.getColumn(), "IF expression is not of type boolean, but " + TYPE_NAMES[ifType] + ".");
+ if ((ifType = if_expr.eval(Const.T_BOOLEAN)) != Const.T_BOOLEAN) {
+ MiniC.addError(if_expr.getLine(), if_expr.getColumn(), "IF expression is not of type boolean, but " + Constants.TYPE_NAMES[ifType] + ".");
}
thenType = then_expr.eval(expected);
- if (expected != T_UNKNOWN && thenType != expected) {
+ if (expected != Const.T_UNKNOWN && thenType != expected) {
MiniC.addError(then_expr.getLine(), then_expr.getColumn(),
- "THEN expression is not of expected type " + TYPE_NAMES[expected] + " but " + TYPE_NAMES[thenType] + ".");
+ "THEN expression is not of expected type " + Constants.TYPE_NAMES[expected] + " but " + Constants.TYPE_NAMES[thenType] + ".");
}
if (else_expr != null) {
elseType = else_expr.eval(expected);
- if (expected != T_UNKNOWN && elseType != expected) {
+ if (expected != Const.T_UNKNOWN && elseType != expected) {
MiniC.addError(else_expr.getLine(), else_expr.getColumn(),
- "ELSE expression is not of expected type " + TYPE_NAMES[expected] + " but " + TYPE_NAMES[elseType] + ".");
- } else if (thenType == T_UNKNOWN) {
+ "ELSE expression is not of expected type " + Constants.TYPE_NAMES[expected] + " but " + Constants.TYPE_NAMES[elseType] + ".");
+ } else if (thenType == Const.T_UNKNOWN) {
thenType = elseType;
then_expr.setType(elseType);
}
@@ -151,7 +153,7 @@ public class ASTIfExpr extends ASTExpr {
}
if (thenType != elseType) {
- MiniC.addError(line, column, "Type mismatch in THEN-ELSE: " + TYPE_NAMES[thenType] + " vs. " + TYPE_NAMES[elseType] + ".");
+ MiniC.addError(line, column, "Type mismatch in THEN-ELSE: " + Constants.TYPE_NAMES[thenType] + " vs. " + Constants.TYPE_NAMES[elseType] + ".");
}
type = thenType;
diff --git a/src/examples/Mini/ASTInteger.java b/src/examples/Mini/ASTInteger.java
index f38685ef..14df92a8 100644
--- a/src/examples/Mini/ASTInteger.java
+++ b/src/examples/Mini/ASTInteger.java
@@ -20,6 +20,7 @@
package Mini;
+import org.apache.bcel.Const;
import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.MethodGen;
@@ -72,7 +73,7 @@ public class ASTInteger extends ASTExpr {
public int eval(final int expected) {
is_simple = true; // (Very) simple expression, always true
- return type = T_INT;
+ return type = Const.T_INT;
}
int getValue() {
diff --git a/src/examples/Mini/ASTLetExpr.java b/src/examples/Mini/ASTLetExpr.java
index f148e1b8..9ed50743 100644
--- a/src/examples/Mini/ASTLetExpr.java
+++ b/src/examples/Mini/ASTLetExpr.java
@@ -20,6 +20,8 @@
package Mini;
+import org.apache.bcel.Const;
+import org.apache.bcel.Constants;
import org.apache.bcel.generic.BasicType;
import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.ISTORE;
@@ -120,7 +122,7 @@ public class ASTLetExpr extends ASTExpr {
*/
exprs[i].code(buf);
- buf.append(" " + TYPE_NAMES[t] + " " + ident + " = " + ASTFunDecl.pop() + ";\n");
+ buf.append(" " + Constants.TYPE_NAMES[t] + " " + ident + " = " + ASTFunDecl.pop() + ";\n");
}
body.code(buf);
@@ -149,7 +151,7 @@ public class ASTLetExpr extends ASTExpr {
// is_simple = true;
for (int i = 0; i < idents.length; i++) {
- final int t = exprs[i].eval(T_UNKNOWN);
+ final int t = exprs[i].eval(Const.T_UNKNOWN);
idents[i].setType(t);
// is_simple = is_simple && exprs[i].isSimple();
diff --git a/src/examples/Mini/ASTProgram.java b/src/examples/Mini/ASTProgram.java
index a1fdd770..038130f0 100644
--- a/src/examples/Mini/ASTProgram.java
+++ b/src/examples/Mini/ASTProgram.java
@@ -22,6 +22,7 @@ package Mini;
import java.io.PrintWriter;
+import org.apache.bcel.Const;
import org.apache.bcel.classfile.Field;
import org.apache.bcel.generic.ALOAD;
import org.apache.bcel.generic.ClassGen;
@@ -44,7 +45,7 @@ import org.apache.bcel.generic.Type;
* Root node of everything, direct children are nodes of type FunDecl
*
*/
-public class ASTProgram extends SimpleNode implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constants {
+public class ASTProgram extends SimpleNode implements MiniParserConstants, MiniParserTreeConstants {
public static Node jjtCreate(final MiniParser p, final int id) {
return new ASTProgram(p, id);
}
@@ -61,12 +62,12 @@ public class ASTProgram extends SimpleNode implements MiniParserConstants, MiniP
/*
* Add predefined functions WRITE/READ. WRITE has one arg of type T_INT, both return T_INT.
*/
- ASTIdent ident = new ASTIdent("WRITE", T_INT, -1, -1);
- ASTIdent[] args = {new ASTIdent("", T_INT, -1, -1)};
+ ASTIdent ident = new ASTIdent("WRITE", Const.T_INT, -1, -1);
+ ASTIdent[] args = {new ASTIdent("", Const.T_INT, -1, -1)};
Function fun = new Function(ident, args, true);
env.put(fun);
- ident = new ASTIdent("READ", T_INT, -1, -1);
+ ident = new ASTIdent("READ", Const.T_INT, -1, -1);
args = new ASTIdent[0];
fun = new Function(ident, args, true);
env.put(fun);
@@ -74,11 +75,11 @@ public class ASTProgram extends SimpleNode implements MiniParserConstants, MiniP
/*
* Add predefined idents TRUE/FALSE of type T_BOOLEAN
*/
- ident = new ASTIdent("TRUE", T_BOOLEAN, -1, -1);
+ ident = new ASTIdent("TRUE", Const.T_BOOLEAN, -1, -1);
Variable var = new Variable(ident, true);
env.put(var);
- ident = new ASTIdent("FALSE", T_BOOLEAN, -1, -1);
+ ident = new ASTIdent("FALSE", Const.T_BOOLEAN, -1, -1);
var = new Variable(ident, true);
env.put(var);
}
@@ -94,7 +95,8 @@ public class ASTProgram extends SimpleNode implements MiniParserConstants, MiniP
/*
* private static BufferedReader _in;
*/
- classGen.addField(new Field(ACC_PRIVATE | ACC_STATIC, cp.addUtf8("_in"), cp.addUtf8("Ljava/io/BufferedReader;"), null, cp.getConstantPool()));
+ classGen.addField(
+ new Field(Const.ACC_PRIVATE | Const.ACC_STATIC, cp.addUtf8("_in"), cp.addUtf8("Ljava/io/BufferedReader;"), null, cp.getConstantPool()));
MethodGen method;
InstructionList il = new InstructionList();
@@ -118,7 +120,7 @@ public class ASTProgram extends SimpleNode implements MiniParserConstants, MiniP
/*
* private static int _readInt() throws IOException
*/
- method = new MethodGen(ACC_STATIC | ACC_PRIVATE | ACC_FINAL, Type.INT, Type.NO_ARGS, null, "_readInt", className, il, cp);
+ method = new MethodGen(Const.ACC_STATIC | Const.ACC_PRIVATE | Const.ACC_FINAL, Type.INT, Type.NO_ARGS, null, "_readInt", className, il, cp);
method.addException("java.io.IOException");
@@ -146,7 +148,7 @@ public class ASTProgram extends SimpleNode implements MiniParserConstants, MiniP
il.append(new PUSH(cp, 0));
il.append(InstructionConst.IRETURN); // Reuse objects, if possible
- method = new MethodGen(ACC_STATIC | ACC_PRIVATE | ACC_FINAL, Type.INT, args, argv, "_writeInt", className, il, cp);
+ method = new MethodGen(Const.ACC_STATIC | Const.ACC_PRIVATE | Const.ACC_FINAL, Type.INT, args, argv, "_writeInt", className, il, cp);
method.setMaxStack(4);
classGen.addMethod(method.getMethod());
@@ -161,7 +163,7 @@ public class ASTProgram extends SimpleNode implements MiniParserConstants, MiniP
il.append(new INVOKESPECIAL(cp.addMethodref("java.lang.Object", "<init>", "()V")));
il.append(new RETURN());
- method = new MethodGen(ACC_PUBLIC, Type.VOID, Type.NO_ARGS, null, "<init>", className, il, cp);
+ method = new MethodGen(Const.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, null, "<init>", className, il, cp);
method.setMaxStack(1);
classGen.addMethod(method.getMethod());
@@ -181,7 +183,7 @@ public class ASTProgram extends SimpleNode implements MiniParserConstants, MiniP
il.append(new PUTSTATIC(_in));
il.append(InstructionConst.RETURN); // Reuse instruction constants
- method = new MethodGen(ACC_STATIC, Type.VOID, Type.NO_ARGS, null, "<clinit>", className, il, cp);
+ method = new MethodGen(Const.ACC_STATIC, Type.VOID, Type.NO_ARGS, null, "<clinit>", className, il, cp);
method.setMaxStack(5);
classGen.addMethod(method.getMethod());
@@ -246,7 +248,7 @@ public class ASTProgram extends SimpleNode implements MiniParserConstants, MiniP
if (pass == 3) { // Final check for unresolved types
final ASTIdent name = fun_decl.getName();
- if (name.getType() == T_UNKNOWN) {
+ if (name.getType() == Const.T_UNKNOWN) {
MiniC.addError(name.getColumn(), name.getLine(), "Type of function " + name.getName() + " can not be determined (infinite recursion?).");
}
}
diff --git a/src/examples/Mini/MiniC.java b/src/examples/Mini/MiniC.java
index 349183d1..80ed21cd 100644
--- a/src/examples/Mini/MiniC.java
+++ b/src/examples/Mini/MiniC.java
@@ -18,15 +18,17 @@
package Mini;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.Vector;
+import org.apache.bcel.Const;
import org.apache.bcel.classfile.JavaClass;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.ConstantPoolGen;
-public class MiniC implements org.apache.bcel.Constants {
+public class MiniC {
private static Vector<String> errors = null;
private static Vector<String> warnings = null;
private static String file = null;
@@ -97,9 +99,9 @@ public class MiniC implements org.apache.bcel.Constants {
pass = 0;
if (j == 0) {
- parser = new MiniParser(new java.io.FileInputStream(file_name[0]));
+ parser = new MiniParser(new FileInputStream(file_name[0]));
} else {
- MiniParser.ReInit(new java.io.FileInputStream(file_name[j]));
+ MiniParser.ReInit(new FileInputStream(file_name[j]));
}
int index = file_name[j].lastIndexOf('.');
@@ -141,7 +143,8 @@ public class MiniC implements org.apache.bcel.Constants {
if (errors.isEmpty()) {
if (byte_code) {
System.out.println("Pass 5: Generating byte code ...");
- final ClassGen class_gen = new ClassGen(base_name, "java.lang.Object", file_name[j], ACC_PUBLIC | ACC_FINAL | ACC_SUPER, null);
+ final ClassGen class_gen = new ClassGen(base_name, "java.lang.Object", file_name[j],
+ Const.ACC_PUBLIC | Const.ACC_FINAL | Const.ACC_SUPER, null);
final ConstantPoolGen cp = class_gen.getConstantPool();
program.byte_code(class_gen, cp);
diff --git a/src/examples/Package.java b/src/examples/Package.java
index a5897a18..75338f61 100644
--- a/src/examples/Package.java
+++ b/src/examples/Package.java
@@ -27,7 +27,7 @@ import java.util.TreeMap;
import java.util.jar.JarOutputStream;
import java.util.zip.ZipEntry;
-import org.apache.bcel.Constants;
+import org.apache.bcel.Const;
import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.Constant;
import org.apache.bcel.classfile.ConstantClass;
@@ -147,7 +147,7 @@ public class Package {
for (int i = 1; i < pool.getLength(); i++) {
final Constant cons = pool.getConstant(i);
// System.out.println("("+i+") " + cons );
- if (cons != null && cons.getTag() == Constants.CONSTANT_Class) {
+ if (cons != null && cons.getTag() == Const.CONSTANT_Class) {
final int idx = ((ConstantClass) pool.getConstant(i)).getNameIndex();
final String clas = ((ConstantUtf8) pool.getConstant(idx)).getBytes();
addClassString(clas, name);
diff --git a/src/examples/TransitiveHull.java b/src/examples/TransitiveHull.java
index 61c5b720..9ebaf5e0 100644
--- a/src/examples/TransitiveHull.java
+++ b/src/examples/TransitiveHull.java
@@ -19,7 +19,7 @@
import java.util.Arrays;
import java.util.regex.Pattern;
-import org.apache.bcel.Constants;
+import org.apache.bcel.Const;
import org.apache.bcel.Repository;
import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.ConstantCP;
@@ -178,7 +178,7 @@ public class TransitiveHull extends org.apache.bcel.classfile.EmptyVisitor {
final String className = ccp.getClass(cp);
add(className);
- final ConstantNameAndType cnat = cp.getConstant(ccp.getNameAndTypeIndex(), Constants.CONSTANT_NameAndType, ConstantNameAndType.class);
+ final ConstantNameAndType cnat = cp.getConstant(ccp.getNameAndTypeIndex(), Const.CONSTANT_NameAndType, ConstantNameAndType.class);
final String signature = cnat.getSignature(cp);
diff --git a/src/examples/listclass.java b/src/examples/listclass.java
index be619dfa..84ced5d0 100644
--- a/src/examples/listclass.java
+++ b/src/examples/listclass.java
@@ -22,7 +22,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.bcel.Constants;
+import org.apache.bcel.Const;
import org.apache.bcel.Repository;
import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.Code;
@@ -102,7 +102,7 @@ public class listclass {
for (int idx = 0; idx < pool.getLength(); idx++) {
final Constant c = pool.getConstant(idx);
- if (c != null && c.getTag() == Constants.CONSTANT_Class) {
+ if (c != null && c.getTag() == Const.CONSTANT_Class) {
final ConstantUtf8 c1 = (ConstantUtf8) pool.getConstant(((ConstantClass) c).getNameIndex());
buf.setLength(0);
buf.append(c1.getBytes());