This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 1f2ce94 Update BCEL to 6.5.0 - code clean-up only
1f2ce94 is described below
commit 1f2ce94f96a5cbdf55743dadd5788951f3c701ca
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Aug 25 16:45:20 2020 +0100
Update BCEL to 6.5.0 - code clean-up only
---
MERGE.txt | 4 +--
java/org/apache/tomcat/util/bcel/Const.java | 40 +++++++++++-----------
.../bcel/classfile/AnnotationElementValue.java | 2 +-
.../util/bcel/classfile/AnnotationEntry.java | 16 ++++-----
.../tomcat/util/bcel/classfile/Annotations.java | 12 +++----
.../util/bcel/classfile/ArrayElementValue.java | 14 ++++----
.../tomcat/util/bcel/classfile/ClassParser.java | 40 +++++++++++-----------
.../tomcat/util/bcel/classfile/ConstantClass.java | 6 ++--
.../tomcat/util/bcel/classfile/ConstantPool.java | 18 +++++-----
.../tomcat/util/bcel/classfile/ElementValue.java | 2 +-
.../util/bcel/classfile/EnumElementValue.java | 2 +-
.../tomcat/util/bcel/classfile/JavaClass.java | 38 ++++++++++----------
.../util/bcel/classfile/SimpleElementValue.java | 2 +-
.../apache/tomcat/util/bcel/classfile/Utility.java | 6 ++--
java/org/apache/tomcat/util/bcel/package.html | 2 +-
webapps/docs/changelog.xml | 4 +++
16 files changed, 106 insertions(+), 102 deletions(-)
diff --git a/MERGE.txt b/MERGE.txt
index 5551fb2..d63a3ca 100644
--- a/MERGE.txt
+++ b/MERGE.txt
@@ -35,8 +35,8 @@ BCEL
----
Sub-tree:
src/main/java/org/apache/bcel
-The SHA1 ID for the most recent commit to be merged to Tomcat is:
-ff6941e4491c68f6eaf270ff03c1bc1e554c7b42 (2019-12-06)
+The SHA1 ID / tag for the most recent commit to be merged to Tomcat is:
+rel/commons-bcel-6.5.0
Codec
-----
diff --git a/java/org/apache/tomcat/util/bcel/Const.java
b/java/org/apache/tomcat/util/bcel/Const.java
index bfaeb42..ad19386 100644
--- a/java/org/apache/tomcat/util/bcel/Const.java
+++ b/java/org/apache/tomcat/util/bcel/Const.java
@@ -23,13 +23,13 @@ package org.apache.tomcat.util.bcel;
public final class Const {
/** One of the access flags for fields, methods, or classes.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.1-200-E.1">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.1-200-E.1">
* Flag definitions for Classes in the Java Virtual Machine Specification
(Java SE 9 Edition).</a>
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.5">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.5">
* Flag definitions for Fields in the Java Virtual Machine Specification
(Java SE 9 Edition).</a>
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.6">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.6">
* Flag definitions for Methods in the Java Virtual Machine Specification
(Java SE 9 Edition).</a>
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.6-300-D.1-D.1">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.6-300-D.1-D.1">
* Flag definitions for Inner Classes in the Java Virtual Machine
Specification (Java SE 9 Edition).</a>
*/
public static final short ACC_FINAL = 0x0010;
@@ -48,91 +48,91 @@ public final class Const {
/**
* Marks a constant pool entry as type UTF-8.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.7">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.7">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_Utf8 = 1;
/**
* Marks a constant pool entry as type Integer.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.4">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.4">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_Integer = 3;
/**
* Marks a constant pool entry as type Float.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.4">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.4">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_Float = 4;
/**
* Marks a constant pool entry as type Long.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.5">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.5">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_Long = 5;
/**
* Marks a constant pool entry as type Double.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.5">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.5">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_Double = 6;
/**
* Marks a constant pool entry as a Class
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.1">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.1">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_Class = 7;
/**
* Marks a constant pool entry as type String
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.3">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.3">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_String = 8;
/**
* Marks a constant pool entry as a Field Reference.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_Fieldref = 9;
/**
* Marks a constant pool entry as a Method Reference.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_Methodref = 10;
/**
* Marks a constant pool entry as an Interface Method Reference.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_InterfaceMethodref = 11;
/**
* Marks a constant pool entry as a name and type.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.6">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.6">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_NameAndType = 12;
/**
* Marks a constant pool entry as a Method Handle.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.8">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.8">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_MethodHandle = 15;
/**
* Marks a constant pool entry as a Method Type.
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.9">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.9">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_MethodType = 16;
@@ -146,7 +146,7 @@ public final class Const {
/**
* Marks a constant pool entry as an Invoke Dynamic
- * @see <a
href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.10">
+ * @see <a
href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.10">
* The Constant Pool in The Java Virtual Machine Specification</a>
*/
public static final byte CONSTANT_InvokeDynamic = 18;
@@ -156,7 +156,7 @@ public final class Const {
*
* <p>Note: Early access Java 9 support- currently subject to change</p>
*
- * @see <a
href="http://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html#jigsaw-2.6">
+ * @see <a
href="https://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html#jigsaw-2.6">
* JPMS: Modules in the Java Language and JVM</a>
*/
public static final byte CONSTANT_Module = 19;
@@ -166,7 +166,7 @@ public final class Const {
*
* <p>Note: Early access Java 9 support- currently subject to change</p>
*
- * @see <a
href="http://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html#jigsaw-2.6">
+ * @see <a
href="https://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html#jigsaw-2.6">
* JPMS: Modules in the Java Language and JVM</a>
*/
public static final byte CONSTANT_Package = 20;
diff --git
a/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
b/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
index 58081b1..3c43a57 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
@@ -27,7 +27,7 @@ public class AnnotationElementValue extends ElementValue
{
super(type, cpool);
if (type != ANNOTATION) {
- throw new RuntimeException(
+ throw new IllegalArgumentException(
"Only element values of type annotation can be built with
this ctor - type specified: " + type);
}
this.annotationEntry = annotationEntry;
diff --git a/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
b/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
index 5a5fde8..f4fb7e9 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
@@ -29,8 +29,8 @@ import org.apache.tomcat.util.bcel.Const;
*/
public class AnnotationEntry {
- private final int type_index;
- private final ConstantPool constant_pool;
+ private final int typeIndex;
+ private final ConstantPool constantPool;
private final List<ElementValuePair> element_value_pairs;
@@ -38,19 +38,19 @@ public class AnnotationEntry {
* Creates an AnnotationEntry from a DataInputStream
*
* @param input
- * @param constant_pool
+ * @param constantPool
* @throws IOException
*/
- AnnotationEntry(final DataInput input, final ConstantPool constant_pool)
throws IOException {
+ AnnotationEntry(final DataInput input, final ConstantPool constantPool)
throws IOException {
- this.constant_pool = constant_pool;
+ this.constantPool = constantPool;
- type_index = input.readUnsignedShort();
+ typeIndex = input.readUnsignedShort();
final int num_element_value_pairs = input.readUnsignedShort();
element_value_pairs = new ArrayList<>(num_element_value_pairs);
for (int i = 0; i < num_element_value_pairs; i++) {
- element_value_pairs.add(new ElementValuePair(input,
constant_pool));
+ element_value_pairs.add(new ElementValuePair(input, constantPool));
}
}
@@ -58,7 +58,7 @@ public class AnnotationEntry {
* @return the annotation type name
*/
public String getAnnotationType() {
- final ConstantUtf8 c = (ConstantUtf8)
constant_pool.getConstant(type_index, Const.CONSTANT_Utf8);
+ final ConstantUtf8 c = (ConstantUtf8)
constantPool.getConstant(typeIndex, Const.CONSTANT_Utf8);
return c.getBytes();
}
diff --git a/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
b/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
index d363e7e..60cb253 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
@@ -25,17 +25,17 @@ import java.io.IOException;
*/
public class Annotations {
- private final AnnotationEntry[] annotation_table;
+ private final AnnotationEntry[] annotationTable;
/**
* @param input Input stream
- * @param constant_pool Array of constants
+ * @param constantPool Array of constants
*/
- Annotations(final DataInput input, final ConstantPool constant_pool)
throws IOException {
+ Annotations(final DataInput input, final ConstantPool constantPool) throws
IOException {
final int annotation_table_length = input.readUnsignedShort();
- annotation_table = new AnnotationEntry[annotation_table_length];
+ annotationTable = new AnnotationEntry[annotation_table_length];
for (int i = 0; i < annotation_table_length; i++) {
- annotation_table[i] = new AnnotationEntry(input, constant_pool);
+ annotationTable[i] = new AnnotationEntry(input, constantPool);
}
}
@@ -44,6 +44,6 @@ public class Annotations {
* @return the array of annotation entries in this annotation
*/
public AnnotationEntry[] getAnnotationEntries() {
- return annotation_table;
+ return annotationTable;
}
}
diff --git a/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
b/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
index d5ee725..caff880 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
@@ -20,16 +20,16 @@ package org.apache.tomcat.util.bcel.classfile;
public class ArrayElementValue extends ElementValue
{
// For array types, this is the array
- private final ElementValue[] evalues;
+ private final ElementValue[] elementValues;
ArrayElementValue(final int type, final ElementValue[] datums, final
ConstantPool cpool)
{
super(type, cpool);
if (type != ARRAY) {
- throw new RuntimeException(
+ throw new IllegalArgumentException(
"Only element values of type array can be built with this
ctor - type specified: " + type);
}
- this.evalues = datums;
+ this.elementValues = datums;
}
@Override
@@ -37,10 +37,10 @@ public class ArrayElementValue extends ElementValue
{
final StringBuilder sb = new StringBuilder();
sb.append('[');
- for (int i = 0; i < evalues.length; i++)
+ for (int i = 0; i < elementValues.length; i++)
{
- sb.append(evalues[i].stringifyValue());
- if ((i + 1) < evalues.length) {
+ sb.append(elementValues[i].stringifyValue());
+ if ((i + 1) < elementValues.length) {
sb.append(',');
}
}
@@ -50,6 +50,6 @@ public class ArrayElementValue extends ElementValue
public ElementValue[] getElementValuesArray()
{
- return evalues;
+ return elementValues;
}
}
diff --git a/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
b/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
index 4ff1427..303be90 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
@@ -42,10 +42,10 @@ public final class ClassParser {
private static final int MAGIC = 0xCAFEBABE;
private final DataInput dataInputStream;
- private String class_name, superclass_name;
- private int access_flags; // Access rights of parsed class
- private String[] interface_names; // Names of implemented interfaces
- private ConstantPool constant_pool; // collection of constants
+ private String class_name, superclassName;
+ private int accessFlags; // Access rights of parsed class
+ private String[] interfaceNames; // Names of implemented interfaces
+ private ConstantPool constantPool; // collection of constants
private Annotations runtimeVisibleAnnotations; //
"RuntimeVisibleAnnotations" attribute defined in the class
private static final int BUFSIZE = 8192;
@@ -94,8 +94,8 @@ public final class ClassParser {
readAttributes();
// Return the information we have gathered in a new object
- return new JavaClass(class_name, superclass_name,
- access_flags, constant_pool, interface_names,
+ return new JavaClass(class_name, superclassName,
+ accessFlags, constantPool, interfaceNames,
runtimeVisibleAnnotations);
}
@@ -114,7 +114,7 @@ public final class ClassParser {
int length;
// Get class name from constant pool via `name_index' indirection
name_index = dataInputStream.readUnsignedShort();
- c = (ConstantUtf8) constant_pool.getConstant(name_index,
+ c = (ConstantUtf8) constantPool.getConstant(name_index,
Const.CONSTANT_Utf8);
name = c.getBytes();
// Length of data in bytes
@@ -125,7 +125,7 @@ public final class ClassParser {
throw new ClassFormatException(
"RuntimeVisibleAnnotations attribute is not
allowed more than once in a class file");
}
- runtimeVisibleAnnotations = new Annotations(dataInputStream,
constant_pool);
+ runtimeVisibleAnnotations = new Annotations(dataInputStream,
constantPool);
} else {
// All other attributes are skipped
Utility.skipFully(dataInputStream, length);
@@ -140,27 +140,27 @@ public final class ClassParser {
* @throws ClassFormatException
*/
private void readClassInfo() throws IOException, ClassFormatException {
- access_flags = dataInputStream.readUnsignedShort();
+ accessFlags = dataInputStream.readUnsignedShort();
/* Interfaces are implicitly abstract, the flag should be set
* according to the JVM specification.
*/
- if ((access_flags & Const.ACC_INTERFACE) != 0) {
- access_flags |= Const.ACC_ABSTRACT;
+ if ((accessFlags & Const.ACC_INTERFACE) != 0) {
+ accessFlags |= Const.ACC_ABSTRACT;
}
- if (((access_flags & Const.ACC_ABSTRACT) != 0)
- && ((access_flags & Const.ACC_FINAL) != 0)) {
+ if (((accessFlags & Const.ACC_ABSTRACT) != 0)
+ && ((accessFlags & Const.ACC_FINAL) != 0)) {
throw new ClassFormatException("Class can't be both final and
abstract");
}
int class_name_index = dataInputStream.readUnsignedShort();
- class_name = Utility.getClassName(constant_pool, class_name_index);
+ class_name = Utility.getClassName(constantPool, class_name_index);
int superclass_name_index = dataInputStream.readUnsignedShort();
if (superclass_name_index > 0) {
// May be zero -> class is java.lang.Object
- superclass_name = Utility.getClassName(constant_pool,
superclass_name_index);
+ superclassName = Utility.getClassName(constantPool,
superclass_name_index);
} else {
- superclass_name = "java.lang.Object";
+ superclassName = "java.lang.Object";
}
}
@@ -171,7 +171,7 @@ public final class ClassParser {
* @throws ClassFormatException
*/
private void readConstantPool() throws IOException, ClassFormatException {
- constant_pool = new ConstantPool(dataInputStream);
+ constantPool = new ConstantPool(dataInputStream);
}
@@ -210,13 +210,13 @@ public final class ClassParser {
private void readInterfaces() throws IOException, ClassFormatException {
final int interfaces_count = dataInputStream.readUnsignedShort();
if (interfaces_count > 0) {
- interface_names = new String[interfaces_count];
+ interfaceNames = new String[interfaces_count];
for (int i = 0; i < interfaces_count; i++) {
int index = dataInputStream.readUnsignedShort();
- interface_names[i] = Utility.getClassName(constant_pool,
index);
+ interfaceNames[i] = Utility.getClassName(constantPool, index);
}
} else {
- interface_names = INTERFACES_EMPTY_ARRAY;
+ interfaceNames = INTERFACES_EMPTY_ARRAY;
}
}
diff --git a/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
b/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
index 4bce5cc..bc0a861 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
@@ -30,7 +30,7 @@ import org.apache.tomcat.util.bcel.Const;
*/
public final class ConstantClass extends Constant {
- private final int name_index; // Identical to ConstantString except for
the name
+ private final int nameIndex; // Identical to ConstantString except for the
name
/**
@@ -41,7 +41,7 @@ public final class ConstantClass extends Constant {
*/
ConstantClass(final DataInput dataInput) throws IOException {
super(Const.CONSTANT_Class);
- this.name_index = dataInput.readUnsignedShort();
+ this.nameIndex = dataInput.readUnsignedShort();
}
@@ -49,6 +49,6 @@ public final class ConstantClass extends Constant {
* @return Name index in constant pool of class name.
*/
public int getNameIndex() {
- return name_index;
+ return nameIndex;
}
}
diff --git a/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
b/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
index bf441f8..0cc4ba7 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
@@ -34,7 +34,7 @@ import org.apache.tomcat.util.bcel.Const;
*/
public class ConstantPool {
- private final Constant[] constant_pool;
+ private final Constant[] constantPool;
/**
* Reads constants from given input stream.
@@ -45,12 +45,12 @@ public class ConstantPool {
*/
ConstantPool(final DataInput input) throws IOException,
ClassFormatException {
final int constant_pool_count = input.readUnsignedShort();
- constant_pool = new Constant[constant_pool_count];
- /* constant_pool[0] is unused by the compiler and may be used freely
+ constantPool = new Constant[constant_pool_count];
+ /* constantPool[0] is unused by the compiler and may be used freely
* by the implementation.
*/
for (int i = 1; i < constant_pool_count; i++) {
- constant_pool[i] = Constant.readConstant(input);
+ constantPool[i] = Constant.readConstant(input);
/* Quote from the JVM specification:
* "All eight byte constants take up two spots in the constant
pool.
* If this is the n'th byte in the constant pool, then the next
item
@@ -58,8 +58,8 @@ public class ConstantPool {
*
* Thus we have to increment the index counter.
*/
- if (constant_pool[i] != null) {
- byte tag = constant_pool[i].getTag();
+ if (constantPool[i] != null) {
+ byte tag = constantPool[i].getTag();
if ((tag == Const.CONSTANT_Double) || (tag ==
Const.CONSTANT_Long)) {
i++;
}
@@ -75,11 +75,11 @@ public class ConstantPool {
* @see Constant
*/
public Constant getConstant( final int index ) {
- if (index >= constant_pool.length || index < 0) {
+ if (index >= constantPool.length || index < 0) {
throw new ClassFormatException("Invalid constant pool reference: "
+ index
- + ". Constant pool size is: " + constant_pool.length);
+ + ". Constant pool size is: " + constantPool.length);
}
- return constant_pool[index];
+ return constantPool[index];
}
/**
diff --git a/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
b/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
index 43dad8a..e9dd30d 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
@@ -84,7 +84,7 @@ public abstract class ElementValue
return new ArrayElementValue(ARRAY, evalues, cpool);
default:
- throw new ClassFormatException(
+ throw new IllegalArgumentException(
"Unexpected element value kind in annotation: " +
type);
}
}
diff --git a/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
b/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
index 421a69f..d4c3171 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
@@ -26,7 +26,7 @@ public class EnumElementValue extends ElementValue
EnumElementValue(final int type, final int valueIdx, final ConstantPool
cpool) {
super(type, cpool);
if (type != ENUM_CONSTANT)
- throw new RuntimeException(
+ throw new IllegalArgumentException(
"Only element values of type enum can be built with this
ctor - type specified: " + type);
this.valueIdx = valueIdx;
}
diff --git a/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
b/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
index 5536492..df1cd21 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
@@ -20,44 +20,44 @@ package org.apache.tomcat.util.bcel.classfile;
/**
* Represents a Java class, i.e., the data structures, constant pool,
* fields, methods and commands contained in a Java .class file.
- * See <a href="http://docs.oracle.com/javase/specs/">JVM specification</a>
for details.
+ * See <a href="https://docs.oracle.com/javase/specs/">JVM specification</a>
for details.
* The intent of this class is to represent a parsed or otherwise existing
* class file. Those interested in programatically generating classes
* should see the <a href="../generic/ClassGen.html">ClassGen</a> class.
*/
public class JavaClass {
- private final int access_flags;
- private final String class_name;
- private final String superclass_name;
- private final String[] interface_names;
+ private final int accessFlags;
+ private final String className;
+ private final String superclassName;
+ private final String[] interfaceNames;
private final Annotations runtimeVisibleAnnotations; //
"RuntimeVisibleAnnotations" attribute defined in the class
/**
* Constructor gets all contents as arguments.
*
- * @param class_name Name of this class.
- * @param superclass_name Name of this class's superclass.
- * @param access_flags Access rights defined by bit flags
+ * @param className Name of this class.
+ * @param superclassName Name of this class's superclass.
+ * @param accessFlags Access rights defined by bit flags
* @param constant_pool Array of constants
- * @param interface_names Implemented interfaces
+ * @param interfaceNames Implemented interfaces
* @param runtimeVisibleAnnotations "RuntimeVisibleAnnotations" attribute
defined on the Class, or null
*/
- JavaClass(final String class_name, final String superclass_name,
- final int access_flags, final ConstantPool constant_pool, final
String[] interface_names,
+ JavaClass(final String className, final String superclassName,
+ final int accessFlags, final ConstantPool constant_pool, final
String[] interfaceNames,
final Annotations runtimeVisibleAnnotations) {
- this.access_flags = access_flags;
+ this.accessFlags = accessFlags;
this.runtimeVisibleAnnotations = runtimeVisibleAnnotations;
- this.class_name = class_name;
- this.superclass_name = superclass_name;
- this.interface_names = interface_names;
+ this.className = className;
+ this.superclassName = superclassName;
+ this.interfaceNames = interfaceNames;
}
/**
* @return Access flags of the object aka. "modifiers".
*/
public final int getAccessFlags() {
- return access_flags;
+ return accessFlags;
}
/**
@@ -77,7 +77,7 @@ public class JavaClass {
* @return Class name.
*/
public String getClassName() {
- return class_name;
+ return className;
}
@@ -85,7 +85,7 @@ public class JavaClass {
* @return Names of implemented interfaces.
*/
public String[] getInterfaceNames() {
- return interface_names;
+ return interfaceNames;
}
@@ -97,6 +97,6 @@ public class JavaClass {
* @return Superclass name.
*/
public String getSuperclassName() {
- return superclass_name;
+ return superclassName;
}
}
diff --git a/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
b/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
index d86cde9..e450b67 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
@@ -85,7 +85,7 @@ public class SimpleElementValue extends ElementValue
Const.CONSTANT_Utf8);
return cu8.getBytes();
default:
- throw new RuntimeException("SimpleElementValue class does not know
how to stringify type " + _type);
+ throw new IllegalStateException("SimpleElementValue class does not
know how to stringify type " + _type);
}
}
}
diff --git a/java/org/apache/tomcat/util/bcel/classfile/Utility.java
b/java/org/apache/tomcat/util/bcel/classfile/Utility.java
index 3a4ad5a..1097b01 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/Utility.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/Utility.java
@@ -44,12 +44,12 @@ final class Utility {
return str.replace('/', '.'); // Is `/' on all systems, even DOS
}
- static String getClassName(final ConstantPool constant_pool, final int
index) {
- Constant c = constant_pool.getConstant(index, Const.CONSTANT_Class);
+ static String getClassName(final ConstantPool constantPool, final int
index) {
+ Constant c = constantPool.getConstant(index, Const.CONSTANT_Class);
int i = ((ConstantClass) c).getNameIndex();
// Finally get the string from the constant pool
- c = constant_pool.getConstant(i, Const.CONSTANT_Utf8);
+ c = constantPool.getConstant(i, Const.CONSTANT_Utf8);
String name = ((ConstantUtf8) c).getBytes();
return compactClassName(name);
diff --git a/java/org/apache/tomcat/util/bcel/package.html
b/java/org/apache/tomcat/util/bcel/package.html
index 77cd3fe..3deb1a3 100644
--- a/java/org/apache/tomcat/util/bcel/package.html
+++ b/java/org/apache/tomcat/util/bcel/package.html
@@ -23,7 +23,7 @@
This package contains basic classes for the
<a href="https://commons.apache.org/bcel/">Byte Code Engineering Library</a>
and constants defined by the
-<a href="http://docs.oracle.com/javase/specs/">
+<a href="https://docs.oracle.com/javase/specs/">
JVM specification</a>.
</p>
</body>
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a5cad12..01bd929 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -194,6 +194,10 @@
<bug>64645</bug>: Use a non-zero exit code if the
<code>service.bat</code> does not complete normally. (markt)
</fix>
+ <add>
+ Update the internal fork of Apache Commons BCEL to 6.5.0. Code clean-up
+ only. (markt)
+ </add>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]