You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2015/08/12 17:55:32 UTC
svn commit: r1695560 - in
/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6:
classfile/Annotations.java classfile/BootstrapMethod.java
classfile/ConstantPool.java classfile/JavaClass.java
generic/ConstantPoolGen.java
Author: sebb
Date: Wed Aug 12 15:55:32 2015
New Revision: 1695560
URL: http://svn.apache.org/r1695560
Log:
BCEL-235 Remove unused setters
(incomplete)
Modified:
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Annotations.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/BootstrapMethod.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantPool.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/JavaClass.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ConstantPoolGen.java
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Annotations.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Annotations.java?rev=1695560&r1=1695559&r2=1695560&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Annotations.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Annotations.java Wed Aug 12 15:55:32 2015
@@ -31,7 +31,7 @@ public abstract class Annotations extend
private static final long serialVersionUID = 1L;
- private AnnotationEntry[] annotation_table; // TODO could this be final?
+ private final AnnotationEntry[] annotation_table;
private final boolean isRuntimeVisible;
/**
@@ -42,12 +42,16 @@ public abstract class Annotations extend
* @param constant_pool Array of constants
*/
Annotations(byte annotation_type, int name_index, int length, DataInput input, ConstantPool constant_pool, boolean isRuntimeVisible) throws IOException {
- this(annotation_type, name_index, length, (AnnotationEntry[]) null, constant_pool, isRuntimeVisible);
+ this(annotation_type, name_index, length, makeAnnotationTable(input, constant_pool, isRuntimeVisible), constant_pool, isRuntimeVisible);
+ }
+
+ static AnnotationEntry[] makeAnnotationTable(DataInput input, ConstantPool constant_pool, boolean isRuntimeVisible) throws IOException {
final int annotation_table_length = (input.readUnsignedShort());
- annotation_table = new AnnotationEntry[annotation_table_length];
+ AnnotationEntry[] at = new AnnotationEntry[annotation_table_length];
for (int i = 0; i < annotation_table_length; i++) {
- annotation_table[i] = AnnotationEntry.read(input, constant_pool, isRuntimeVisible);
+ at[i] = AnnotationEntry.read(input, constant_pool, isRuntimeVisible);
}
+ return at;
}
/**
@@ -75,13 +79,6 @@ public abstract class Annotations extend
}
/**
- * @param annotation_table the entries to set in this annotation
- */
- public final void setAnnotationTable(AnnotationEntry[] annotation_table) {
- this.annotation_table = annotation_table;
- }
-
- /**
* returns the array of annotation entries in this annotation
*/
public AnnotationEntry[] getAnnotationEntries() {
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/BootstrapMethod.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/BootstrapMethod.java?rev=1695560&r1=1695559&r2=1695560&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/BootstrapMethod.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/BootstrapMethod.java Wed Aug 12 15:55:32 2015
@@ -37,12 +37,12 @@ public class BootstrapMethod implements
private static final long serialVersionUID = -4517534834047695344L;
/** Index of the CONSTANT_MethodHandle_info structure in the constant_pool table */
- private int bootstrap_method_ref; // TODO this could be made final (setter is not used)
+ private final int bootstrap_method_ref;
private final int num_bootstrap_arguments;
/** Array of references to the constant_pool table */
- private int[] bootstrap_arguments; // TODO this could be made final (setter is not used)
+ private final int[] bootstrap_arguments;
/**
@@ -59,9 +59,9 @@ public class BootstrapMethod implements
* @throws IOException
*/
BootstrapMethod(DataInput input) throws IOException {
- this(input.readUnsignedShort(), input.readUnsignedShort(), (int[]) null);
-
- bootstrap_arguments = new int[num_bootstrap_arguments];
+ this.bootstrap_method_ref = input.readUnsignedShort();
+ this.num_bootstrap_arguments = input.readUnsignedShort();
+ this.bootstrap_arguments = new int[num_bootstrap_arguments];
for (int i = 0; i < num_bootstrap_arguments; i++) {
bootstrap_arguments[i] = input.readUnsignedShort();
}
@@ -87,13 +87,6 @@ public class BootstrapMethod implements
}
/**
- * @param bootstrap_method_ref int index into constant_pool of CONSTANT_MethodHandle
- */
- public void setBootstrapMethodRef(int bootstrap_method_ref) {
- this.bootstrap_method_ref = bootstrap_method_ref;
- }
-
- /**
* @return int[] of bootstrap_method indices into constant_pool of CONSTANT_<type>_info
*/
public int[] getBootstrapArguments() {
@@ -108,13 +101,6 @@ public class BootstrapMethod implements
}
/**
- * @param bootstrap_arguments int[] indices into constant_pool of CONSTANT_<type>_info
- */
- public void setBootstrapArguments(int[] bootstrap_arguments) {
- this.bootstrap_arguments = bootstrap_arguments;
- }
-
- /**
* @return String representation.
*/
@Override
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantPool.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantPool.java?rev=1695560&r1=1695559&r2=1695560&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantPool.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantPool.java Wed Aug 12 15:55:32 2015
@@ -39,7 +39,7 @@ import org.apache.commons.bcel6.Constant
public class ConstantPool implements Cloneable, Node, Serializable {
private static final long serialVersionUID = -9093478476423540196L;
- private Constant[] constant_pool; // TODO this could be final; the setConstantPool method is not called externally
+ private Constant[] constant_pool; // TODO this could be final if the copy() method were rewritten
/**
@@ -323,14 +323,6 @@ public class ConstantPool implements Clo
}
- /**
- * @param constant Constant to set
- */
- public void setConstant( int index, Constant constant ) {
- constant_pool[index] = constant;
- }
-
-
/**
* @return String representation.
*/
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/JavaClass.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/JavaClass.java?rev=1695560&r1=1695559&r2=1695560&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/JavaClass.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/JavaClass.java Wed Aug 12 15:55:32 2015
@@ -483,118 +483,6 @@ public class JavaClass extends AccessFla
/**
- * @param attributes .
- */
- public void setAttributes( Attribute[] attributes ) {
- this.attributes = attributes;
- }
-
-
- /**
- * @param class_name .
- */
- public void setClassName( String class_name ) {
- this.class_name = class_name;
- }
-
-
- /**
- * @param class_name_index .
- */
- public void setClassNameIndex( int class_name_index ) {
- this.class_name_index = class_name_index;
- }
-
-
- /**
- * @param constant_pool .
- */
- public void setConstantPool( ConstantPool constant_pool ) {
- this.constant_pool = constant_pool;
- }
-
-
- /**
- * @param fields .
- */
- public void setFields( Field[] fields ) {
- this.fields = fields;
- }
-
-
- /**
- * Set File name of class, aka SourceFile attribute value
- */
- public void setFileName( String file_name ) {
- this.file_name = file_name;
- }
-
-
- /**
- * @param interface_names .
- */
- public void setInterfaceNames( String[] interface_names ) {
- this.interface_names = interface_names;
- }
-
-
- /**
- * @param interfaces .
- */
- public void setInterfaces( int[] interfaces ) {
- this.interfaces = interfaces;
- }
-
-
- /**
- * @param major .
- */
- public void setMajor( int major ) {
- this.major = major;
- }
-
-
- /**
- * @param methods .
- */
- public void setMethods( Method[] methods ) {
- this.methods = methods;
- }
-
-
- /**
- * @param minor .
- */
- public void setMinor( int minor ) {
- this.minor = minor;
- }
-
-
- /**
- * Set absolute path to file this class was read from.
- */
- public void setSourceFileName( String source_file_name ) {
- this.source_file_name = source_file_name;
- }
-
-
- /**
- * @param superclass_name .
- */
- public void setSuperclassName( String superclass_name ) {
- this.superclass_name = superclass_name;
- }
-
-
- /**
- * @param superclass_name_index .
- */
- public void setSuperclassNameIndex( int superclass_name_index ) {
- this.superclass_name_index = superclass_name_index;
- }
-
-
- /**
* @return String representing class contents.
*/
@Override
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ConstantPoolGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ConstantPoolGen.java?rev=1695560&r1=1695559&r2=1695560&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ConstantPoolGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ConstantPoolGen.java Wed Aug 12 15:55:32 2015
@@ -54,7 +54,7 @@ public class ConstantPoolGen implements
private static final long serialVersionUID = 6664071417323174824L;
protected int size;
- protected Constant[] constants;
+ private Constant[] constants;
protected int index = 1; // First entry (0) used by JVM
private static final String METHODREF_DELIM = ":";
private static final String IMETHODREF_DELIM = "#";
@@ -688,17 +688,6 @@ public class ConstantPoolGen implements
}
- /**
- * Use with care!
- *
- * @param i index in constant pool
- * @param c new constant pool entry at index i
- */
- public void setConstant( int i, Constant c ) {
- constants[i] = c;
- }
-
-
/**
* @return intermediate constant pool
*/