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 9df8518923e78395c77c5c6214ad87f1dd1ad967 Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Mon Sep 9 10:13:27 2019 -0400 Remove trailing white spaces on all lines. --- src/examples/ClassDumper.java | 84 +++++++++++----------- src/examples/HelloWorldBuilder.java | 10 +-- src/examples/Mini/ASCII_CharStream.java | 2 +- src/examples/Mini/ASTExpr.java | 18 ++--- src/examples/Mini/ASTFunDecl.java | 20 +++--- src/examples/Mini/ASTIfExpr.java | 4 +- src/examples/Mini/ASTLetExpr.java | 12 ++-- src/examples/Mini/ASTProgram.java | 26 +++---- src/examples/Mini/Environment.java | 10 +-- src/examples/Mini/Function.java | 6 +- src/examples/Mini/MiniC.java | 6 +- src/examples/Mini/MiniParserTokenManager.java | 46 ++++++------ src/examples/Mini/Node.java | 2 +- src/examples/Mini/ParseException.java | 4 +- src/examples/Mini/SimpleNode.java | 2 +- src/examples/Mini/TokenMgrError.java | 4 +- src/examples/helloify.java | 2 +- src/examples/patchclass.java | 2 +- src/main/java/org/apache/bcel/Const.java | 2 +- src/main/java/org/apache/bcel/Repository.java | 10 +-- .../java/org/apache/bcel/classfile/Attribute.java | 4 +- .../org/apache/bcel/classfile/ConstantUtf8.java | 16 ++--- .../java/org/apache/bcel/classfile/Visitor.java | 2 +- .../org/apache/bcel/generic/InstructionHandle.java | 4 +- .../bcel/util/LruCacheClassPathRepository.java | 2 +- .../bcel/verifier/statics/Pass2Verifier.java | 4 +- .../bcel/verifier/statics/Pass3aVerifier.java | 2 +- .../bcel/classfile/ConstantPoolTestCase.java | 2 +- .../bcel/generic/JdkGenericDumpTestCase.java | 2 +- 29 files changed, 155 insertions(+), 155 deletions(-) diff --git a/src/examples/ClassDumper.java b/src/examples/ClassDumper.java index a223672..0c4a18b 100644 --- a/src/examples/ClassDumper.java +++ b/src/examples/ClassDumper.java @@ -31,7 +31,7 @@ import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.Method; import org.apache.bcel.util.BCELifier; -/** +/** * Display Java .class file data. * Output is based on javap tool. * Built using the BCEL libary. @@ -115,10 +115,10 @@ class ClassDumper { if (magic != Const.JVM_CLASSFILE_MAGIC) { throw new ClassFormatException(file_name + " is not a Java .class file"); } - System.out.println("Java Class Dump"); - System.out.println(" file: " + file_name); - System.out.printf("%nClass header:%n"); - System.out.printf(" magic: %X%n", magic); + System.out.println("Java Class Dump"); + System.out.println(" file: " + file_name); + System.out.printf("%nClass header:%n"); + System.out.printf(" magic: %X%n", magic); } /** @@ -128,10 +128,10 @@ class ClassDumper { */ private final void processVersion () throws IOException, ClassFormatException { minor = file.readUnsignedShort(); - System.out.printf(" minor version: %s%n", minor); + System.out.printf(" minor version: %s%n", minor); major = file.readUnsignedShort(); - System.out.printf(" major version: %s%n", major); + System.out.printf(" major version: %s%n", major); } /** @@ -146,19 +146,19 @@ class ClassDumper { constant_pool = new ConstantPool(constant_items); // constant_pool[0] is unused by the compiler - System.out.printf("%nConstant pool(%d):%n", constant_pool_count - 1); + System.out.printf("%nConstant pool(%d):%n", constant_pool_count - 1); for (int i = 1; i < constant_pool_count; i++) { constant_items[i] = Constant.readConstant(file); // i'm sure there is a better way to do this if (i < 10) { - System.out.printf(" #%1d = ", i); + System.out.printf(" #%1d = ", i); } else if (i <100) { - System.out.printf(" #%2d = ", i); + System.out.printf(" #%2d = ", i); } else { - System.out.printf(" #%d = ", i); - } - System.out.println(constant_items[i]); + System.out.printf(" #%d = ", i); + } + System.out.println(constant_items[i]); // All eight byte constants take up two spots in the constant pool tag = constant_items[i].getTag(); @@ -188,15 +188,15 @@ class ClassDumper { " can't be both final and abstract"); } - System.out.printf("%nClass info:%n"); + System.out.printf("%nClass info:%n"); System.out.println(" flags: " + BCELifier.printFlags(access_flags, BCELifier.FLAGS.CLASS)); class_name_index = file.readUnsignedShort(); - System.out.printf(" this_class: %d (", class_name_index); - System.out.println(constantToString(class_name_index) + ")"); + System.out.printf(" this_class: %d (", class_name_index); + System.out.println(constantToString(class_name_index) + ")"); superclass_name_index = file.readUnsignedShort(); - System.out.printf(" super_class: %d (", superclass_name_index); + System.out.printf(" super_class: %d (", superclass_name_index); if (superclass_name_index > 0) { System.out.printf("%s", constantToString(superclass_name_index)); } @@ -213,17 +213,17 @@ class ClassDumper { interfaces_count = file.readUnsignedShort(); interfaces = new int[interfaces_count]; - System.out.printf("%nInterfaces(%d):%n", interfaces_count); + System.out.printf("%nInterfaces(%d):%n", interfaces_count); for (int i = 0; i < interfaces_count; i++) { interfaces[i] = file.readUnsignedShort(); // i'm sure there is a better way to do this if (i < 10) { - System.out.printf(" #%1d = ", i); + System.out.printf(" #%1d = ", i); } else if (i <100) { - System.out.printf(" #%2d = ", i); + System.out.printf(" #%2d = ", i); } else { - System.out.printf(" #%d = ", i); + System.out.printf(" #%d = ", i); } System.out.println(interfaces[i] + " (" + constant_pool.getConstantString(interfaces[i], @@ -241,13 +241,13 @@ class ClassDumper { fields_count = file.readUnsignedShort(); fields = new Field[fields_count]; - // sometimes fields[0] is magic used for serialization - System.out.printf("%nFields(%d):%n", fields_count); + // sometimes fields[0] is magic used for serialization + System.out.printf("%nFields(%d):%n", fields_count); for (int i = 0; i < fields_count; i++) { processFieldOrMethod(); if (i < fields_count - 1) { - System.out.println(); + System.out.println(); } } } @@ -262,12 +262,12 @@ class ClassDumper { methods_count = file.readUnsignedShort(); methods = new Method[methods_count]; - System.out.printf("%nMethods(%d):%n", methods_count); + System.out.printf("%nMethods(%d):%n", methods_count); for (int i = 0; i < methods_count; i++) { processFieldOrMethod(); if (i < methods_count - 1) { - System.out.println(); + System.out.println(); } } } @@ -282,7 +282,7 @@ class ClassDumper { attributes_count = file.readUnsignedShort(); attributes = new Attribute[attributes_count]; - System.out.printf("%nAttributes(%d):%n", attributes_count); + System.out.printf("%nAttributes(%d):%n", attributes_count); for (int i = 0; i < attributes_count; i++) { attributes[i] = Attribute.readAttribute(file, constant_pool); @@ -303,17 +303,17 @@ class ClassDumper { private final void processFieldOrMethod () throws IOException, ClassFormatException { final int access_flags = file.readUnsignedShort(); final int name_index = file.readUnsignedShort(); - System.out.printf(" name_index: %d (", name_index); - System.out.println(constantToString(name_index) + ")"); + System.out.printf(" name_index: %d (", name_index); + System.out.println(constantToString(name_index) + ")"); System.out.println(" access_flags: " + BCELifier.printFlags(access_flags, BCELifier.FLAGS.METHOD)); final int descriptor_index = file.readUnsignedShort(); - System.out.printf(" descriptor_index: %d (", descriptor_index); - System.out.println(constantToString(descriptor_index) + ")"); + System.out.printf(" descriptor_index: %d (", descriptor_index); + System.out.println(constantToString(descriptor_index) + ")"); final int attributes_count = file.readUnsignedShort(); final Attribute[] attributes = new Attribute[attributes_count]; - System.out.println(" attribute count: " + attributes_count); + System.out.println(" attribute count: " + attributes_count); for (int i = 0; i < attributes_count; i++) { // going to peek ahead a bit @@ -323,10 +323,10 @@ class ClassDumper { // restore file location file.reset(); // Usefull for debugging - // System.out.printf(" attribute_name_index: %d (", attribute_name_index); - // System.out.println(constantToString(attribute_name_index) + ")"); - // System.out.printf(" atribute offset in file: %x%n", + file.getStreamPosition()); - // System.out.println(" atribute_length: " + attribute_length); + // System.out.printf(" attribute_name_index: %d (", attribute_name_index); + // System.out.println(constantToString(attribute_name_index) + ")"); + // System.out.printf(" atribute offset in file: %x%n", + file.getStreamPosition()); + // System.out.println(" atribute_length: " + attribute_length); // A stronger verification test would be to read attribute_length bytes // into a buffer. Then pass that buffer to readAttribute and also @@ -337,17 +337,17 @@ class ClassDumper { final long pos2 = file.getStreamPosition(); if ((pos2 - pos1) != (attribute_length + 6)) { System.out.printf("%nWHOOPS attribute_length: %d pos2-pos1-6: %d pos1: %x(%d) pos2: %x(%d)%n", - attribute_length, pos2-pos1-6, pos1, pos1, pos2, pos2); + attribute_length, pos2-pos1-6, pos1, pos1, pos2, pos2); } - System.out.printf(" "); - System.out.println(attributes[i]); + System.out.printf(" "); + System.out.println(attributes[i]); } } private final String constantToString (final int index) { - final Constant c = constant_items[index]; - return constant_pool.constantToString(c); - } + final Constant c = constant_items[index]; + return constant_pool.constantToString(c); + } } diff --git a/src/examples/HelloWorldBuilder.java b/src/examples/HelloWorldBuilder.java index eb45906..00487c7 100644 --- a/src/examples/HelloWorldBuilder.java +++ b/src/examples/HelloWorldBuilder.java @@ -44,15 +44,15 @@ import org.apache.bcel.generic.Type; * public static void main(String[] argv) { * BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); * String name = null; - * + * * try { * System.out.print("Please enter your name> "); * name = in.readLine(); - * } catch(IOException e) { + * } catch(IOException e) { * System.out.println(e); - * return; + * return; * } - * + * * System.out.println("Hello, " + name); * } * } @@ -148,7 +148,7 @@ public class HelloWorldBuilder { Type.VOID, new Type[]{Type.STRING}, Constants.INVOKESPECIAL)); il.append(new ALOAD(name)); - + // Concatenate strings using a StringBuffer and print them. il.append(factory.createInvoke("java.lang.StringBuffer", "append", Type.STRINGBUFFER, new Type[]{Type.STRING}, diff --git a/src/examples/Mini/ASCII_CharStream.java b/src/examples/Mini/ASCII_CharStream.java index 943c51f..002032c 100644 --- a/src/examples/Mini/ASCII_CharStream.java +++ b/src/examples/Mini/ASCII_CharStream.java @@ -364,7 +364,7 @@ public final class ASCII_CharStream bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; - } + } if (i < len) { diff --git a/src/examples/Mini/ASTExpr.java b/src/examples/Mini/ASTExpr.java index a82442b..63e87c7 100644 --- a/src/examples/Mini/ASTExpr.java +++ b/src/examples/Mini/ASTExpr.java @@ -47,7 +47,7 @@ import org.apache.bcel.generic.PUSH; * obeying the aritmetical precedences (* stronger than +, etc.) and * are discarded in the first pass. */ -public class ASTExpr extends SimpleNode +public class ASTExpr extends SimpleNode implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constants { protected int kind=-1; // Single twig to leaf? private int unop=-1; // Special case: Unary operand applied @@ -87,7 +87,7 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan /* Special constructor, called from ASTTerm.traverse() and * ASTFactor.traverse(), when traverse()ing the parse tree replace - * themselves with Expr nodes. + * themselves with Expr nodes. */ ASTExpr(final ASTExpr[] children, final int kind, final int line, final int column) { this(line, column, kind, JJTEXPR); @@ -140,25 +140,25 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan for(int i=0; i < exprs.length; i++) { exprs[i] = exprs[i].traverse(env); // References may change } - + return this; } } - /** + /** * Second and third pass * @return type of expression * @param expected type */ public int eval(final int expected) { int child_type = T_UNKNOWN, t; - + is_simple = true; // Determine expected node type depending on used operator. if(unop != -1) { if(unop == MINUS) { - child_type = type = T_INT; // - + child_type = type = T_INT; // - } else { child_type = type = T_BOOLEAN; // ! } @@ -178,7 +178,7 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan // Get type of subexpressions for(int i=0; i < exprs.length; i++) { - t = exprs[i].eval(child_type); + t = exprs[i].eval(child_type); if(t != child_type) { MiniC.addError(exprs[i].getLine(), exprs[i].getColumn(), @@ -202,7 +202,7 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan /** * Fourth pass, produce Java code. - */ + */ public void code(final StringBuffer buf) { if(unop != -1) { exprs[0].code(buf); @@ -225,7 +225,7 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan case MULT: ASTFunDecl.push(buf, _body_int + " * " + _body_int2); break; case DIV: ASTFunDecl.push(buf, _body_int + " / " + _body_int2); break; - case AND: ASTFunDecl.push(buf, toInt(toBool(_body_int) + " && " + + case AND: ASTFunDecl.push(buf, toInt(toBool(_body_int) + " && " + toBool(_body_int2))); break; case OR: ASTFunDecl.push(buf, toInt(toBool(_body_int) + " || " + toBool(_body_int2))); break; diff --git a/src/examples/Mini/ASTFunDecl.java b/src/examples/Mini/ASTFunDecl.java index 4b2e507..0cb714b 100644 --- a/src/examples/Mini/ASTFunDecl.java +++ b/src/examples/Mini/ASTFunDecl.java @@ -52,7 +52,7 @@ implements MiniParserTreeConstants, org.apache.bcel.Constants { private ASTIdent[] argv; private ASTExpr body; private int type = T_UNKNOWN; - private int line, column; + private int line, column; private boolean is_simple; // true, if simple expression like `12 + f(a)' private boolean is_recursive; // Not used yet, TODO // private int max_depth; // max. expression tree depth @@ -73,13 +73,13 @@ implements MiniParserTreeConstants, org.apache.bcel.Constants { ASTFunDecl(final ASTIdent name, final ASTIdent[] argv, final ASTExpr body, final int type) { this(JJTFUNDECL); - + this.name = name; this.argv = argv; this.body = body; this.type = type; } - + /** * Overrides SimpleNode.closeNode() * Cast children to appropiate type. @@ -118,12 +118,12 @@ implements MiniParserTreeConstants, org.apache.bcel.Constants { /* Update entry of this function, i.e. set argument references. * The entry is already in there by garantuee, but may be of wrong type, * i.e. the user defined a function `TRUE', e.g. and `TRUE' is of type `Variable'. - */ + */ try { final Function fun = (Function)env.get(name.getName()); fun.setArgs(argv); } catch(final ClassCastException e) {} // Who cares? - + body = body.traverse(env); // Traverse expression body return this; @@ -138,7 +138,7 @@ implements MiniParserTreeConstants, org.apache.bcel.Constants { if((expected != T_UNKNOWN) && (type != expected)) { MiniC.addError(line, column, - "Function f ist not of type " + TYPE_NAMES[expected] + + "Function f ist not of type " + TYPE_NAMES[expected] + " as previously assumed, but " + TYPE_NAMES[type]); } @@ -172,18 +172,18 @@ implements MiniParserTreeConstants, org.apache.bcel.Constants { else { out.print(" public static final " + "int" + // type_names[type] + " " + fname + "("); - + for(int i = 0; i < argv.length; i++) { out.print("int " + argv[i].getName()); - + if(i < argv.length - 1) { out.print(", "); } } - + out.println(")\n throws IOException\n {"); } - + if(!ignore) { final StringBuffer buf = new StringBuffer(); diff --git a/src/examples/Mini/ASTIfExpr.java b/src/examples/Mini/ASTIfExpr.java index d331d9a..a04f4ed 100644 --- a/src/examples/Mini/ASTIfExpr.java +++ b/src/examples/Mini/ASTIfExpr.java @@ -69,7 +69,7 @@ public class ASTIfExpr extends ASTExpr implements org.apache.bcel.Constants { * Overrides ASTExpr.traverse() */ @Override - public ASTExpr traverse(final Environment env) { + public ASTExpr traverse(final Environment env) { this.env = env; if_expr = if_expr.traverse(env); @@ -94,7 +94,7 @@ public class ASTIfExpr extends ASTExpr implements org.apache.bcel.Constants { if((if_type=if_expr.eval(T_BOOLEAN)) != T_BOOLEAN) { MiniC.addError(if_expr.getLine(), if_expr.getColumn(), - "IF expression is not of type boolean, but " + + "IF expression is not of type boolean, but " + TYPE_NAMES[if_type] + "."); } diff --git a/src/examples/Mini/ASTLetExpr.java b/src/examples/Mini/ASTLetExpr.java index 364625b..b3a1dbb 100644 --- a/src/examples/Mini/ASTLetExpr.java +++ b/src/examples/Mini/ASTLetExpr.java @@ -56,7 +56,7 @@ public class ASTLetExpr extends ASTExpr implements org.apache.bcel.Constants { */ @Override public void closeNode() { - int i; /* length must be a multiple of + int i; /* length must be a multiple of * two (ident = expr) + 1 (body expr) */ final int len_2 = children.length / 2; idents = new ASTIdent[len_2]; @@ -78,12 +78,12 @@ public class ASTLetExpr extends ASTExpr implements org.apache.bcel.Constants { @Override public ASTExpr traverse(final Environment env) { this.env = env; - + // Traverse RHS exprs first, so no references to LHS vars are allowed for(int i=0; i < exprs.length; i++) { exprs[i] = exprs[i].traverse((Environment)env.clone()); } - + // Put argument names into hash table aka. environment for(int i=0; i < idents.length; i++) { final ASTIdent id = idents[i]; @@ -99,10 +99,10 @@ public class ASTLetExpr extends ASTExpr implements org.apache.bcel.Constants { } body = body.traverse(env); - + return this; } - + /** * Second pass * Overrides AstExpr.eval() @@ -115,7 +115,7 @@ public class ASTLetExpr extends ASTExpr implements org.apache.bcel.Constants { for(int i=0; i < idents.length; i++) { final int t = exprs[i].eval(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 8966ccf..7d52785 100644 --- a/src/examples/Mini/ASTProgram.java +++ b/src/examples/Mini/ASTProgram.java @@ -57,7 +57,7 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan * 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[] args = { new ASTIdent("", T_INT, -1, -1) }; Function fun = new Function(ident, args, true); env.put(fun); @@ -65,7 +65,7 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan args = new ASTIdent[0]; fun = new Function(ident, args, true); env.put(fun); - + /* Add predefined idents TRUE/FALSE of type T_BOOLEAN */ ident = new ASTIdent("TRUE", T_BOOLEAN, -1, -1); @@ -103,7 +103,7 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan * * Put everything into the environment, which is copied appropiately to each * recursion level, i.e. each FunDecl gets its own copy that it can further - * manipulate. + * manipulate. * * Checks for name clashes of function declarations. */ @@ -121,7 +121,7 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan name = f.getName(); fname = name.getName(); fun = env.get(fname); // Lookup in env - + if(fun != null) { MiniC.addError(f.getLine(), f.getColumn(), "Redeclaration of " + fun + "."); @@ -129,24 +129,24 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan env.put(new Function(name, null)); // `args' will be set by FunDecl.traverse() } - + } // Go for it for(int i=0; i < fun_decls.length; i++) { fun_decls[i] = fun_decls[i].traverse((Environment)env.clone()); - + // Look for `main' routine fname = fun_decls[i].getName().getName(); if(fname.equals("main")) { main = (Function)env.get(fname); } } - + if(main == null) { MiniC.addError(0, 0, "You didn't declare a `main' function."); } else if(main.getNoArgs() != 0) { - MiniC.addError(main.getLine(), main.getColumn(), + MiniC.addError(main.getLine(), main.getColumn(), "Main function has too many arguments declared."); } } @@ -154,7 +154,7 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan return this; } - /** + /** * Second pass, determine type of each node, if possible. */ public void eval(final int pass) { @@ -183,11 +183,11 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan out.println("import java.io.IOException;\n"); out.println("public final class " + name + " {"); - out.println(" private static BufferedReader _in = new BufferedReader" + + out.println(" private static BufferedReader _in = new BufferedReader" + "(new InputStreamReader(System.in));\n"); out.println(" private static int _readInt() throws IOException {\n" + - " System.out.print(\"Please enter a number> \");\n" + + " System.out.print(\"Please enter a number> \");\n" + " return Integer.parseInt(_in.readLine());\n }\n"); out.println(" private static int _writeInt(int n) {\n" + @@ -268,7 +268,7 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan il.append(new INVOKEVIRTUAL(cp.addMethodref("java.lang.StringBuffer", "toString", "()Ljava/lang/String;"))); - + il.append(new INVOKEVIRTUAL(cp.addMethodref("java.io.PrintStream", "println", "(Ljava/lang/String;)V"))); @@ -294,7 +294,7 @@ implements MiniParserConstants, MiniParserTreeConstants, org.apache.bcel.Constan method = new MethodGen(ACC_PUBLIC, Type.VOID, Type.NO_ARGS, null, "<init>", class_name, il, cp); - + method.setMaxStack(1); class_gen.addMethod(method.getMethod()); diff --git a/src/examples/Mini/Environment.java b/src/examples/Mini/Environment.java index 3f61c02..1afd1bf 100644 --- a/src/examples/Mini/Environment.java +++ b/src/examples/Mini/Environment.java @@ -26,14 +26,14 @@ import java.util.Vector; * That environment contains all function definitions and identifiers. * Hash keys are Strings (identifiers), which are mapped to a table index. * - * The table consists of `SIZE' fields which have `SLOTS' subfields. Thus + * The table consists of `SIZE' fields which have `SLOTS' subfields. Thus * the maximum number of storable items is `SLOTS' * `SIZE'. * */ public class Environment implements Cloneable { private static final int SIZE = 127; // Prime number large enough for most cases private static final int SLOTS = 3; // Number of slots of each field - + private final int size; // The table is an array of private final Vector<EnvEntry>[] table; // Vectors private int elements=0; @@ -136,7 +136,7 @@ public class Environment implements Cloneable { } catch(final ArrayIndexOutOfBoundsException e) {} } - private static int lookup(final Vector<EnvEntry> v, final String key) + private static int lookup(final Vector<EnvEntry> v, final String key) throws ArrayIndexOutOfBoundsException { final int len = v.size(); @@ -153,7 +153,7 @@ public class Environment implements Cloneable { } @Override - public Object clone() { + public Object clone() { final Vector<EnvEntry>[] copy = new Vector[size]; for(int i=0; i < size; i++) { @@ -199,7 +199,7 @@ public class Environment implements Cloneable { for(int j=0; j < len; j++) { entries[k++] = v.elementAt(j); } - } catch(final ArrayIndexOutOfBoundsException e) {} + } catch(final ArrayIndexOutOfBoundsException e) {} } } diff --git a/src/examples/Mini/Function.java b/src/examples/Mini/Function.java index f6c56bd..b584a69 100644 --- a/src/examples/Mini/Function.java +++ b/src/examples/Mini/Function.java @@ -45,7 +45,7 @@ public class Function implements org.apache.bcel.Constants, EnvEntry { column = name.getColumn(); setArgs(args); } - + @Override public String toString() { final StringBuffer buf = new StringBuffer(); @@ -74,8 +74,8 @@ public class Function implements org.apache.bcel.Constants, EnvEntry { public int getColumn() { return column; } public ASTIdent getArg(final int i) { return args[i]; } public ASTIdent[] getArgs() { return args; } - public void setArgs(final ASTIdent[] args) { - this.args = args; + public void setArgs(final ASTIdent[] args) { + this.args = args; no_args = (args == null)? 0 : args.length; } } diff --git a/src/examples/Mini/MiniC.java b/src/examples/Mini/MiniC.java index 645c0fc..34a7b3e 100644 --- a/src/examples/Mini/MiniC.java +++ b/src/examples/Mini/MiniC.java @@ -30,7 +30,7 @@ public class MiniC implements org.apache.bcel.Constants { private static Vector<String> warnings = null; private static String file = null; private static int pass = 0; - + public static void main(final String[] argv) { final String[] file_name = new String[argv.length]; int files=0; @@ -55,7 +55,7 @@ public class MiniC implements org.apache.bcel.Constants { file_name[files++] = argv[i]; } } - + if(files == 0) { System.err.println("Nothing to compile."); } @@ -170,7 +170,7 @@ public class MiniC implements org.apache.bcel.Constants { if(diff > 0) { final char[] chs = new char[diff]; - + for(int i=0; i < diff; i++) { chs[i] = ' '; } diff --git a/src/examples/Mini/MiniParserTokenManager.java b/src/examples/Mini/MiniParserTokenManager.java index 694e1f7..bffe0b1 100644 --- a/src/examples/Mini/MiniParserTokenManager.java +++ b/src/examples/Mini/MiniParserTokenManager.java @@ -317,7 +317,7 @@ static private int jjMoveStringLiteralDfa2_0(final long old0, long active0) { if (((active0 &= old0)) == 0L) { return jjStartNfa_0(0, old0); -} +} try { curChar = ASCII_CharStream.readChar(); } catch(final java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0); @@ -361,7 +361,7 @@ static private int jjMoveStringLiteralDfa3_0(final long old0, long active0) { if (((active0 &= old0)) == 0L) { return jjStartNfa_0(1, old0); -} +} try { curChar = ASCII_CharStream.readChar(); } catch(final java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0); @@ -399,7 +399,7 @@ static private int jjMoveStringLiteralDfa4_0(final long old0, long active0) { if (((active0 &= old0)) == 0L) { return jjStartNfa_0(2, old0); -} +} try { curChar = ASCII_CharStream.readChar(); } catch(final java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0); @@ -554,34 +554,34 @@ static private int jjMoveNfa_0(final int startState, int curPos) } } static final int[] jjnextStates = { - 4, 5, + 4, 5, }; public static final String[] jjstrLiteralImages = { -"", null, null, null, null, null, null, null, null, "\106\125\116", -"\111\106", "\124\110\105\116", "\105\114\123\105", "\106\111", "\114\105\124", -"\111\116", "\76", "\74", "\76\75", "\74\75", "\75\75", "\41\75", "\41", -"\106\101\114\123\105", "\124\122\125\105", "\101\116\104", "\117\122", "\53", "\55", "\52", "\45", -"\57", "\50", "\51", "\75", "\54", "\122\105\101\104", "\127\122\111\124\105", null, +"", null, null, null, null, null, null, null, null, "\106\125\116", +"\111\106", "\124\110\105\116", "\105\114\123\105", "\106\111", "\114\105\124", +"\111\116", "\76", "\74", "\76\75", "\74\75", "\75\75", "\41\75", "\41", +"\106\101\114\123\105", "\124\122\125\105", "\101\116\104", "\117\122", "\53", "\55", "\52", "\45", +"\57", "\50", "\51", "\75", "\54", "\122\105\101\104", "\127\122\111\124\105", null, null, null, null, null, }; public static final String[] lexStateNames = { - "DEFAULT", - "SINGLE_LINE_COMMENT_STATE", + "DEFAULT", + "SINGLE_LINE_COMMENT_STATE", }; public static final int[] jjnewLexState = { - -1, -1, -1, -1, -1, -1, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; static final long[] jjtoToken = { - 0x73ffffffe01L, + 0x73ffffffe01L, }; static final long[] jjtoSkip = { - 0xbeL, + 0xbeL, }; static final long[] jjtoSpecial = { - 0x80L, + 0x80L, }; static final long[] jjtoMore = { - 0x140L, + 0x140L, }; static private ASCII_CharStream input_stream; static private final int[] jjrounds = new int[6]; @@ -654,7 +654,7 @@ static int jjround; static int jjmatchedPos; static int jjmatchedKind; -public static Token getNextToken() +public static Token getNextToken() { Token specialToken = null; Token matchedToken; @@ -662,13 +662,13 @@ public static Token getNextToken() EOFLoop : for (;;) - { - try - { + { + try + { curChar = ASCII_CharStream.BeginToken(); - } + } catch(final java.io.IOException e) - { + { jjmatchedKind = 0; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; diff --git a/src/examples/Mini/Node.java b/src/examples/Mini/Node.java index 18cc9cb..3a0ade2 100644 --- a/src/examples/Mini/Node.java +++ b/src/examples/Mini/Node.java @@ -36,7 +36,7 @@ public interface Node { /** This pair of methods are used to inform the node of its parent. */ void jjtSetParent(Node n); - + Node jjtGetParent(); /** This method tells the node to add its argument to the node's diff --git a/src/examples/Mini/ParseException.java b/src/examples/Mini/ParseException.java index 399b9bd..99aee2b 100644 --- a/src/examples/Mini/ParseException.java +++ b/src/examples/Mini/ParseException.java @@ -141,7 +141,7 @@ public class ParseException extends Exception { break; } retval += add_escapes(tok.image); - tok = tok.next; + tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol; if (expectedTokenSequences.length == 1) { @@ -157,7 +157,7 @@ public class ParseException extends Exception { * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); - + /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII diff --git a/src/examples/Mini/SimpleNode.java b/src/examples/Mini/SimpleNode.java index 54ed00d..0f91b76 100644 --- a/src/examples/Mini/SimpleNode.java +++ b/src/examples/Mini/SimpleNode.java @@ -46,7 +46,7 @@ public abstract class SimpleNode implements Node { public void closeNode() { } - + public void jjtSetParent(final Node n) { parent = n; } public Node jjtGetParent() { return parent; } diff --git a/src/examples/Mini/TokenMgrError.java b/src/examples/Mini/TokenMgrError.java index 587d3f7..4e9340a 100644 --- a/src/examples/Mini/TokenMgrError.java +++ b/src/examples/Mini/TokenMgrError.java @@ -102,7 +102,7 @@ public class TokenMgrError extends Error /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. - * Parameters : + * Parameters : * EOFSeen : indicates if EOF caused the lexicl error * curLexState : lexical state in which this error occured * errorLine : line number when the error occured @@ -122,7 +122,7 @@ public class TokenMgrError extends Error /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not - * of end-users concern, so you can return something like : + * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * diff --git a/src/examples/helloify.java b/src/examples/helloify.java index 2df07b7..44c05cc 100644 --- a/src/examples/helloify.java +++ b/src/examples/helloify.java @@ -95,7 +95,7 @@ public final class helloify implements Constants { if (m.isNative() || m.isAbstract() || (code == null)) { return m; } - + // Create instruction list to be inserted at method start. final String mesg = "Hello from " + Utility.methodSignatureToString(m.getSignature(), name, diff --git a/src/examples/patchclass.java b/src/examples/patchclass.java index 029f584..91fcb94 100644 --- a/src/examples/patchclass.java +++ b/src/examples/patchclass.java @@ -56,7 +56,7 @@ public class patchclass { } /* - * Replace all occurences of string "<em>old</em>" with + * Replace all occurences of string "<em>old</em>" with * "<em>replacement</em>" in all Utf8 constants */ private static void patchIt(final String old, final String replacement, final Constant[] constant_pool) { diff --git a/src/main/java/org/apache/bcel/Const.java b/src/main/java/org/apache/bcel/Const.java index ba9e156..139bd74 100644 --- a/src/main/java/org/apache/bcel/Const.java +++ b/src/main/java/org/apache/bcel/Const.java @@ -336,7 +336,7 @@ public final class Const { */ @Deprecated public static final short MAX_ACC_FLAG = ACC_ENUM; - + /** One of the access flags for fields, methods, or classes. * ACC_MODULE is negative as a short. * @see #ACC_PUBLIC diff --git a/src/main/java/org/apache/bcel/Repository.java b/src/main/java/org/apache/bcel/Repository.java index 9e5ef21..edcccb4 100644 --- a/src/main/java/org/apache/bcel/Repository.java +++ b/src/main/java/org/apache/bcel/Repository.java @@ -37,7 +37,7 @@ public abstract class Repository { private static org.apache.bcel.util.Repository repository = SyntheticRepository.getInstance(); - /** + /** * @return currently used repository instance */ public static org.apache.bcel.util.Repository getRepository() { @@ -45,7 +45,7 @@ public abstract class Repository { } - /** + /** * Sets repository instance to be used for class loading */ public static void setRepository( final org.apache.bcel.util.Repository rep ) { @@ -53,7 +53,7 @@ public abstract class Repository { } - /** + /** * Lookups class somewhere found on your CLASSPATH, or whereever the * repository instance looks for it. * @@ -68,7 +68,7 @@ public abstract class Repository { /** * Tries to find class source using the internal repository instance. - * + * * @see Class * @return JavaClass object for given runtime class * @throws ClassNotFoundException if the class could not be found or @@ -97,7 +97,7 @@ public abstract class Repository { } - /** + /** * Clears the repository. */ public static void clearCache() { diff --git a/src/main/java/org/apache/bcel/classfile/Attribute.java b/src/main/java/org/apache/bcel/classfile/Attribute.java index e833c96..72e5c4e 100644 --- a/src/main/java/org/apache/bcel/classfile/Attribute.java +++ b/src/main/java/org/apache/bcel/classfile/Attribute.java @@ -49,7 +49,7 @@ import org.apache.bcel.Const; public abstract class Attribute implements Cloneable, Node { private static final boolean debug = Boolean.getBoolean(Attribute.class.getCanonicalName() + ".debug"); // Debugging on/off - + private static final Map<String, Object> readers = new HashMap<>(); /** @@ -270,7 +270,7 @@ public abstract class Attribute implements Cloneable, Node { */ @Override public abstract void accept(Visitor v); - + /** * Use copy() if you want to have a deep copy(), i.e., with all references * copied correctly. diff --git a/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java b/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java index 6ac696e..f421f66 100644 --- a/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java +++ b/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java @@ -40,18 +40,18 @@ import org.apache.bcel.Const; * <p> * Here is a sample Maven invocation with caching disabled: * </p> - * + * * <pre> * mvn test -Dbcel.statistics=true -Dbcel.maxcached.size=0 -Dbcel.maxcached=0 * </pre> * <p> * Here is a sample Maven invocation with caching enabled: * </p> - * + * * <pre> * mvn test -Dbcel.statistics=true -Dbcel.maxcached.size=100000 -Dbcel.maxcached=5000000 * </pre> - * + * * @see Constant */ public final class ConstantUtf8 extends Constant { @@ -105,7 +105,7 @@ public final class ConstantUtf8 extends Constant { /** * Clears the cache. - * + * * @since 6.4.0 */ public static synchronized void clearCache() { @@ -122,7 +122,7 @@ public final class ConstantUtf8 extends Constant { * <p> * See {@link ConstantUtf8} class Javadoc for details. * </p> - * + * * @param value the value. * @return a new or cached instance of the given value. * @since 6.0 @@ -150,7 +150,7 @@ public final class ConstantUtf8 extends Constant { * <p> * See {@link ConstantUtf8} class Javadoc for details. * </p> - * + * * @param dataInput the value. * @return a new or cached instance of the given value. * @throws IOException if an I/O error occurs. @@ -165,7 +165,7 @@ public final class ConstantUtf8 extends Constant { * <p> * See {@link ConstantUtf8} class Javadoc for details. * </p> - * + * * @param value the value. * @return a new or cached instance of the given value. * @since 6.0 @@ -187,7 +187,7 @@ public final class ConstantUtf8 extends Constant { /** * Initializes from another object. - * + * * @param constantUtf8 the value. */ public ConstantUtf8(final ConstantUtf8 constantUtf8) { diff --git a/src/main/java/org/apache/bcel/classfile/Visitor.java b/src/main/java/org/apache/bcel/classfile/Visitor.java index 0655c13..64e4f18 100644 --- a/src/main/java/org/apache/bcel/classfile/Visitor.java +++ b/src/main/java/org/apache/bcel/classfile/Visitor.java @@ -183,7 +183,7 @@ public interface Visitor default void visitModuleRequires(ModuleRequires constantModule) { // empty } - + /** * @since 6.4.0 */ diff --git a/src/main/java/org/apache/bcel/generic/InstructionHandle.java b/src/main/java/org/apache/bcel/generic/InstructionHandle.java index 323aa32..552e8a3 100644 --- a/src/main/java/org/apache/bcel/generic/InstructionHandle.java +++ b/src/main/java/org/apache/bcel/generic/InstructionHandle.java @@ -59,14 +59,14 @@ public class InstructionHandle { /** * Does nothing. - * + * * @deprecated Does nothing as of 6.3.1. */ @Deprecated protected void addHandle() { // noop } - + public final InstructionHandle getNext() { return next; } diff --git a/src/main/java/org/apache/bcel/util/LruCacheClassPathRepository.java b/src/main/java/org/apache/bcel/util/LruCacheClassPathRepository.java index 4b5f099..157a0e7 100644 --- a/src/main/java/org/apache/bcel/util/LruCacheClassPathRepository.java +++ b/src/main/java/org/apache/bcel/util/LruCacheClassPathRepository.java @@ -29,7 +29,7 @@ import org.apache.bcel.classfile.JavaClass; * This repository supports a class path consisting of too many JAR files to handle in {@link ClassPathRepository} or * {@link MemorySensitiveClassPathRepository} without causing {@code OutOfMemoryError}. * </p> - * + * * @since 6.4.0 */ public class LruCacheClassPathRepository extends AbstractClassPathRepository { diff --git a/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java b/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java index 9b3ac9a..fe79b22 100644 --- a/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java +++ b/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java @@ -1545,13 +1545,13 @@ public final class Pass2Verifier extends PassVerifier implements Constants { /** * Returns if the JavaClass this InnerClassDetector is working on * has an Inner Class reference in its constant pool. - * + * * @return Whether this InnerClassDetector is working on has an Inner Class reference in its constant pool. */ public boolean innerClassReferenced() { return hasInnerClass; } - + /** This method casually visits ConstantClass references. */ @Override public void visitConstantClass(final ConstantClass obj) { diff --git a/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java b/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java index 3fee63d..af6f037 100644 --- a/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java +++ b/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java @@ -126,7 +126,7 @@ public final class Pass3aVerifier extends PassVerifier{ * It's here for performance reasons by do_verify() and its callees. */ private InstructionList instructionList; - + /** * The one and only Code object used by an instance of this class. * It's here for performance reasons by do_verify() and its callees. diff --git a/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java b/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java index 028f369..2cc10af 100644 --- a/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java +++ b/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java @@ -26,7 +26,7 @@ import org.junit.Assert; import org.junit.Test; public class ConstantPoolTestCase extends AbstractTestCase { - + @Test public void testConstantToString() throws ClassNotFoundException { final JavaClass clazz = getTestClass(PACKAGE_BASE_NAME + ".data.SimpleClassWithDefaultConstructor"); diff --git a/src/test/java/org/apache/bcel/generic/JdkGenericDumpTestCase.java b/src/test/java/org/apache/bcel/generic/JdkGenericDumpTestCase.java index fdf1375..46de372 100644 --- a/src/test/java/org/apache/bcel/generic/JdkGenericDumpTestCase.java +++ b/src/test/java/org/apache/bcel/generic/JdkGenericDumpTestCase.java @@ -68,7 +68,7 @@ import com.sun.jna.platform.win32.Advapi32Util; * <p> * For example: * </p> - * + * * <pre> * mvn test -Dtest=JdkGenericDumpTestCase -DExtraJavaHomes="C:\Program Files\Java\openjdk\jdk-13;C:\Program Files\Java\openjdk\jdk-14" * </pre>