This is an automated email from the ASF dual-hosted git repository. markt-asf pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 3e78682429f129d5d396cca34fdc588c165ca36f Author: Mark Thomas <[email protected]> AuthorDate: Mon Nov 30 15:45:55 2026 +0000 Remove unused code identified by Claude / Sonnet 5.5 --- java/org/apache/tomcat/util/bcel/Const.java | 126 --------------------- .../util/bcel/classfile/ClassFormatException.java | 31 +---- .../tomcat/util/bcel/classfile/ClassParser.java | 2 +- .../tomcat/util/bcel/classfile/ConstantUtf8.java | 9 +- .../tomcat/util/bcel/classfile/ElementValue.java | 12 -- .../tomcat/util/bcel/classfile/JavaClass.java | 7 +- res/spotbugs/filter-false-positives.xml | 15 --- 7 files changed, 7 insertions(+), 195 deletions(-) diff --git a/java/org/apache/tomcat/util/bcel/Const.java b/java/org/apache/tomcat/util/bcel/Const.java index 05c441de71..3f1a25db98 100644 --- a/java/org/apache/tomcat/util/bcel/Const.java +++ b/java/org/apache/tomcat/util/bcel/Const.java @@ -229,132 +229,6 @@ public final class Const { */ public static final int MAX_ARRAY_DIMENSIONS = 255; - /** - * Minor version number of class files for Java 22: {@value}. - * - * @see #MAJOR_22 - * - * @since 6.10.0 - */ - public static final short MINOR_22 = 0; - - /** - * Minor version number of class files for Java 23: {@value}. - * - * @see #MAJOR_23 - * - * @since 6.10.0 - */ - public static final short MINOR_23 = 0; - - /** - * Minor version number of class files for Java 24: {@value}. - * - * @see #MAJOR_24 - * - * @since 6.10.0 - */ - public static final short MINOR_24 = 0; - - /** - * Major version number of class files for Java 22: {@value}. - * - * @see #MINOR_22 - * - * @since 6.10.0 - */ - public static final short MAJOR_22 = 66; - - /** - * Major version number of class files for Java 23: {@value}. - * - * @see #MINOR_23 - * - * @since 6.10.0 - */ - public static final short MAJOR_23 = 67; - - /** - * Major version number of class files for Java 24: {@value}. - * - * @see #MINOR_24 - * - * @since 6.10.0 - */ - public static final short MAJOR_24 = 68; - - /** - * Minor version number of class files for Java 25: {@value}. - * - * @see #MAJOR_25 - * - * @since 6.11.0 - */ - public static final short MINOR_25 = 0; - - /** - * Major version number of class files for Java 25: {@value}. - * - * @see #MINOR_25 - * - * @since 6.11.0 - */ - public static final short MAJOR_25 = 69; - - /** - * Minor version number of class files for Java 26: {@value}. - * - * @see #MAJOR_26 - * - * @since 6.12.0 - */ - public static final short MINOR_26 = 0; - - /** - * Major version number of class files for Java 26: {@value}. - * - * @see #MINOR_26 - * - * @since 6.12.0 - */ - public static final short MAJOR_26 = 70; - - /** - * Minor version number of class files for Java 27: {@value}. - * - * @see #MAJOR_27 - * - * @since 6.13.0 - */ - public static final short MINOR_27 = 0; - - /** - * Major version number of class files for Java 27: {@value}. - * - * @see #MINOR_27 - * - * @since 6.13.0 - */ - public static final short MAJOR_27 = 71; - - /** - * Minor version number of class files for Java 28: {@value}. - * - * @see #MAJOR_28 - * - * @since 6.13.0 - */ - public static final short MINOR_28 = 0; - - /** - * Major version number of class files for Java 28: {@value}. - * - * @see #MINOR_28 - * - * @since 6.13.0 - */ - public static final short MAJOR_28 = 72; - /** * Get the CONSTANT_NAMES entry at the given index. * diff --git a/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java b/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java index 155d655c0c..d1460dbde9 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java +++ b/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java @@ -21,14 +21,7 @@ package org.apache.tomcat.util.bcel.classfile; */ public class ClassFormatException extends RuntimeException { - private static final long serialVersionUID = -3569097343160139969L; - - /** - * Constructs a new instance with {@code null} as its detail message. The cause is not initialized, and may subsequently be initialized by a call to - * {@link #initCause}. - */ - public ClassFormatException() { - } + private static final long serialVersionUID = 1L; /** * Constructs a new instance with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to @@ -50,26 +43,4 @@ public class ClassFormatException extends RuntimeException { public ClassFormatException(String format, Object... args) { super(String.format(format, args)); } - - /** - * Constructs a new instance with the specified detail message and cause. - * - * @param message the detail message (which is saved for later retrieval by the {@link #getMessage()} method). - * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). A {@code null} value is permitted, and indicates that - * the cause is nonexistent or unknown. - */ - public ClassFormatException(final String message, final Throwable cause) { - super(message, cause); - } - - /** - * Constructs a new instance with the specified cause and a detail message of {@code (cause==null ? null : cause.toString())} (which typically contains the - * class and detail message of {@code cause}). This constructor is useful for runtime exceptions that are little more than wrappers for other throwables. - * - * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). A {@code null} value is permitted, and indicates that the - * cause is nonexistent or unknown. - */ - public ClassFormatException(final Throwable cause) { - super(cause); - } } diff --git a/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java b/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java index 06437cb59d..f53ddf577e 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java +++ b/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java @@ -90,7 +90,7 @@ public final class ClassParser { readAttributes(false); // Return the information we have gathered in a new object - return new JavaClass(className, superclassName, accessFlags, constantPool, interfaceNames, + return new JavaClass(className, superclassName, accessFlags, interfaceNames, runtimeVisibleAnnotations, runtimeVisibleFieldOrMethodAnnotations); } diff --git a/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java b/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java index dfbe6e7f52..a3d249a41b 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java +++ b/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java @@ -30,13 +30,10 @@ import org.apache.tomcat.util.bcel.Const; public final class ConstantUtf8 extends Constant { /** - * Gets a new or cached instance of the given value. - * <p> - * See {@link ConstantUtf8} class Javadoc for details. - * </p> + * Reads a new instance from the given input. * - * @param dataInput the value. - * @return a new or cached instance of the given value. + * @param dataInput the input to read the value from. + * @return a new instance of the value read. * @throws IOException if an I/O error occurs. */ static ConstantUtf8 getInstance(final DataInput dataInput) throws IOException { diff --git a/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java b/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java index 479f1dfc8d..f0b4af015e 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java +++ b/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java @@ -104,18 +104,6 @@ public abstract class ElementValue { */ static final ElementValue[] EMPTY_ARRAY = {}; - /** - * Reads an {@code element_value} as an {@code ElementValue}. - * - * @param input Raw data input. - * @param cpool Constant pool. - * @return A new ElementValue. - * @throws IOException Thrown if an I/O error occurs. - */ - public static ElementValue readElementValue(final DataInput input, final ConstantPool cpool) throws IOException { - return readElementValue(input, cpool, 0); - } - static ElementValue readElementValue(final DataInput input, final ConstantPool cpool, int arrayNesting) throws IOException { final byte tag = input.readByte(); diff --git a/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java b/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java index 6220d17a18..adcb4ddc39 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java +++ b/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java @@ -21,9 +21,7 @@ import java.util.List; /** * Represents a Java class, that is, the data structures, constant pool, fields, methods and commands contained in a Java - * .class file. 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 programmatically generating - * classes should see the <a href="../generic/ClassGen.html">ClassGen</a> class. + * .class file. See <a href="https://docs.oracle.com/javase/specs/">JVM specification</a> for details. */ public class JavaClass { @@ -40,13 +38,12 @@ public class JavaClass { * @param className Name of this class. * @param superclassName Name of this class's superclass. * @param accessFlags Access rights defined by bit flags - * @param constantPool Array of constants * @param interfaceNames Implemented interfaces * @param runtimeVisibleAnnotations "RuntimeVisibleAnnotations" attribute defined on the Class, or null * @param runtimeVisibleFieldOrMethodAnnotations "RuntimeVisibleAnnotations" attribute defined on the fields or methods, or null */ JavaClass(final String className, final String superclassName, - final int accessFlags, final ConstantPool constantPool, final String[] interfaceNames, + final int accessFlags, final String[] interfaceNames, final Annotations runtimeVisibleAnnotations, final List<Annotations> runtimeVisibleFieldOrMethodAnnotations) { this.accessFlags = accessFlags; this.runtimeVisibleAnnotations = runtimeVisibleAnnotations; diff --git a/res/spotbugs/filter-false-positives.xml b/res/spotbugs/filter-false-positives.xml index a147734700..004229499d 100644 --- a/res/spotbugs/filter-false-positives.xml +++ b/res/spotbugs/filter-false-positives.xml @@ -1390,21 +1390,6 @@ <Method name="findMethod"/> <Bug code="NP" /> </Match> - <Match> - <!-- Class name is appropriate --> - <Class name="org.apache.tomcat.util.bcel.classfile.CodeException"/> - <Bug code="Nm" /> - </Match> - <Match> - <!-- Field by field copy is fine for clone in this case --> - <Class name="org.apache.tomcat.util.bcel.classfile.StackMapType"/> - <Bug code="CN" /> - </Match> - <Match> - <!-- Fall-through expected --> - <Class name="org.apache.tomcat.util.bcel.classfile.Utility"/> - <Bug code="SF" /> - </Match> <Match> <!-- Handled by abstract base class --> <Or> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
