commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1697695 - in /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6: generic/ util/ verifier/structurals/
Date Tue, 25 Aug 2015 15:13:12 GMT
Author: sebb
Date: Tue Aug 25 15:13:11 2015
New Revision: 1697695

URL: http://svn.apache.org/r1697695
Log:
Add deprecated markers to non-private mutable fields so usage is detected
Add getters/setters as necessary to give access

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/BranchInstruction.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ConstantPoolGen.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ElementValueGen.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/FieldGenOrMethodGen.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionFactory.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionHandle.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LocalVariableInstruction.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Select.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Type.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/ClassQueue.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/Frame.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/BranchInstruction.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/BranchInstruction.java?rev=1697695&r1=1697694&r2=1697695&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/BranchInstruction.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/BranchInstruction.java
Tue Aug 25 15:13:11 2015
@@ -32,8 +32,22 @@ import org.apache.commons.bcel6.util.Byt
  */
 public abstract class BranchInstruction extends Instruction implements InstructionTargeter
{
 
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected int index; // Branch target relative to this instruction
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected InstructionHandle target; // Target object in instruction list
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected int position; // Byte code offset
 
 

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=1697695&r1=1697694&r2=1697695&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
Tue Aug 25 15:13:11 2015
@@ -53,9 +53,25 @@ import org.apache.commons.bcel6.classfil
 public class ConstantPoolGen {
 
     private static final int DEFAULT_BUFFER_SIZE = 256;
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected int size; 
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected Constant[] constants;
+
+    /**
+     * @deprecated will be made private; do not access directly, use getSize()
+     */
+    @Deprecated
     protected int index = 1; // First entry (0) used by JVM
+
     private static final String METHODREF_DELIM = ":";
     private static final String IMETHODREF_DELIM = "#";
     private static final String FIELDREF_DELIM = "&";

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ElementValueGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ElementValueGen.java?rev=1697695&r1=1697694&r2=1697695&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ElementValueGen.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ElementValueGen.java
Tue Aug 25 15:13:11 2015
@@ -34,8 +34,16 @@ import org.apache.commons.bcel6.classfil
  */
 public abstract class ElementValueGen
 {
+    /**
+     * @deprecated will be made private and final; do not access directly, use getter
+     */
+    @Deprecated
     protected int type;
 
+    /**
+     * @deprecated will be made private and final; do not access directly, use getter
+     */
+    @Deprecated
     protected ConstantPoolGen cpGen;
 
     protected ElementValueGen(int type, ConstantPoolGen cpGen)

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/FieldGenOrMethodGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/FieldGenOrMethodGen.java?rev=1697695&r1=1697694&r2=1697695&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/FieldGenOrMethodGen.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/FieldGenOrMethodGen.java
Tue Aug 25 15:13:11 2015
@@ -32,10 +32,26 @@ import org.apache.commons.bcel6.classfil
  */
 public abstract class FieldGenOrMethodGen extends AccessFlags implements NamedAndTyped, Cloneable
{
 
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected String name;
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected Type type;
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected ConstantPoolGen cp;
+
     private final List<Attribute> attribute_vec = new ArrayList<>();
+
     // @since 6.0
     private final List<AnnotationEntryGen>       annotation_vec= new ArrayList<>();
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java?rev=1697695&r1=1697694&r2=1697695&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java
Tue Aug 25 15:13:11 2015
@@ -31,8 +31,18 @@ import org.apache.commons.bcel6.util.Byt
  */
 public abstract class Instruction implements Cloneable {
 
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected short length = 1; // Length of instruction in bytes 
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected short opcode = -1; // Opcode number
+
     private static InstructionComparator cmp = InstructionComparator.DEFAULT;
 
 
@@ -505,11 +515,20 @@ public abstract class Instruction implem
     /**
      * Needed in readInstruction and subclasses in this package
      */
-    void setOpcode( short opcode ) {
+    final void setOpcode( short opcode ) {
         this.opcode = opcode;
     }
 
 
+    /**
+     * Needed in readInstruction and subclasses in this package
+     * @since 6.0
+     */
+    final void setLength( int length ) {
+        this.length = (short) length; // TODO check range?
+    }
+
+
     /** Some instructions may be reused, so don't do anything by default.
      */
     void dispose() {

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionFactory.java?rev=1697695&r1=1697694&r2=1697695&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionFactory.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionFactory.java
Tue Aug 25 15:13:11 2015
@@ -39,7 +39,16 @@ public class InstructionFactory {
             "C", "F", "D", "B", "S", "I", "L"
     };
 
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected ClassGen cg;
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected ConstantPoolGen cp;
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionHandle.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionHandle.java?rev=1697695&r1=1697694&r2=1697695&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionHandle.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionHandle.java
Tue Aug 25 15:13:11 2015
@@ -44,10 +44,17 @@ import org.apache.commons.bcel6.classfil
  */
 public class InstructionHandle {
 
+    // TODO make private
     InstructionHandle next;
-    InstructionHandle prev; // Will be set from the outside
+    InstructionHandle prev;
     Instruction instruction;
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected int i_position = -1; // byte code offset of instruction
+
     private Set<InstructionTargeter> targeters;
     private Map<Object, Object> attributes;
 
@@ -289,4 +296,24 @@ public class InstructionHandle {
     public void accept( Visitor v ) {
         instruction.accept(v);
     }
+
+
+    /**
+     * @param next the next to set
+     * @ since 6.0
+     */
+    final InstructionHandle setNext(InstructionHandle next) {
+        this.next = next;
+        return next;
+    }
+
+
+    /**
+     * @param prev the prev to set
+     * @ since 6.0
+     */
+    final InstructionHandle setPrev(InstructionHandle prev) {
+        this.prev = prev;
+        return prev;
+    }
 }

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LocalVariableInstruction.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LocalVariableInstruction.java?rev=1697695&r1=1697694&r2=1697695&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LocalVariableInstruction.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LocalVariableInstruction.java
Tue Aug 25 15:13:11 2015
@@ -31,7 +31,12 @@ import org.apache.commons.bcel6.util.Byt
 public abstract class LocalVariableInstruction extends Instruction implements TypedInstruction,
         IndexedInstruction {
 
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected int n = -1; // index of referenced variable
+
     private short c_tag = -1; // compact version, such as ILOAD_0
     private short canon_tag = -1; // canonical tag such as ILOAD
 
@@ -139,7 +144,7 @@ public abstract class LocalVariableInstr
 
 
     /**
-     * @return local variable index  referred by this instruction.
+     * @return local variable index (n) referred by this instruction.
      */
     @Override
     public final int getIndex() {

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Select.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Select.java?rev=1697695&r1=1697694&r2=1697695&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Select.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Select.java Tue
Aug 25 15:13:11 2015
@@ -35,11 +35,40 @@ import org.apache.commons.bcel6.util.Byt
 public abstract class Select extends BranchInstruction implements VariableLengthInstruction,
         StackConsumer /* @since 6.0 */, StackProducer {
 
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected int[] match; // matches, i.e., case 1: ... TODO could be package-protected?
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected int[] indices; // target offsets TODO could be package-protected?
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected InstructionHandle[] targets; // target objects in instruction list TODO could
be package-protected?
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected int fixed_length; // fixed length defined by subclasses TODO could be package-protected?
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected int match_length; // number of cases TODO could be package-protected?
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected int padding = 0; // number of pad bytes for alignment TODO could be package-protected?
 
 
@@ -243,4 +272,119 @@ public abstract class Select extends Bra
     public InstructionHandle[] getTargets() {
         return targets;
     }
+
+    /**
+     * @return match entry
+     * @since 6.0
+     */
+    final int getMatch(int index) {
+        return match[index];
+    }
+
+
+    /**
+     * @return index entry from indices
+     * @since 6.0
+     */
+    final int getIndices(int index) {
+        return indices[index];
+    }
+
+    /**
+     * @return target entry
+     * @since 6.0
+     */
+    final InstructionHandle getTarget(int index) {
+        return targets[index];
+    }
+
+
+    /**
+     * @return the fixed_length
+     * @since 6.0
+     */
+    final int getFixed_length() {
+        return fixed_length;
+    }
+
+
+    /**
+     * @param fixed_length the fixed_length to set
+     * @since 6.0
+     */
+    final void setFixed_length(int fixed_length) {
+        this.fixed_length = fixed_length;
+    }
+
+
+    /**
+     * @return the match_length
+     * @since 6.0
+     */
+    final int getMatch_length() {
+        return match_length;
+    }
+
+
+    /**
+     * @param match_length the match_length to set
+     * @since 6.0
+     */
+    final int setMatch_length(int match_length) {
+        this.match_length = match_length;
+        return match_length;
+    }
+    
+    /**
+     * 
+     * @param index
+     * @param value
+     * @since 6.0
+     */
+    final void setMatch(int index, int value) {
+        match[index] = value;
+    }
+    
+    /**
+     * 
+     * @param array
+     * @since 6.0
+     */
+    final void setIndices(int[] array) {
+        indices = array;
+    }
+    
+    /**
+     * 
+     * @param array
+     * @since 6.0
+     */
+    final void setMatches(int[] array) {
+        match = array;
+    }
+    
+    /**
+     * 
+     * @param array
+     * @since 6.0
+     */
+    final void setTargets(InstructionHandle[] array) {
+        targets = array;
+    }
+    
+    /**
+     * 
+     * @return
+     * @since 6.0
+     */
+    final int getPadding() {
+        return padding;
+    }
+
+
+    /** @since 6.0 */
+    final int setIndices(int i, int value) {
+        indices[i] = value;
+        return value;  // Allow use in nested calls
+    }
 }

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Type.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Type.java?rev=1697695&r1=1697694&r2=1697695&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Type.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Type.java Tue
Aug 25 15:13:11 2015
@@ -32,7 +32,16 @@ import org.apache.commons.bcel6.classfil
  */
 public abstract class Type {
 
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected byte type; // TODO should be final (and private)
+
+    /**
+     * @deprecated will be made private; do not access directly, use getter/setter
+     */
+    @Deprecated
     protected String signature; // signature for the type TODO should be private
     /** Predefined constants
      */

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/ClassQueue.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/ClassQueue.java?rev=1697695&r1=1697694&r2=1697695&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/ClassQueue.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/ClassQueue.java
Tue Aug 25 15:13:11 2015
@@ -29,7 +29,11 @@ import org.apache.commons.bcel6.classfil
  */
 public class ClassQueue {
 
-    protected LinkedList<JavaClass> vec = new LinkedList<>();
+    /**
+     * @deprecated will be made private; do not access
+     */
+    @Deprecated
+    protected LinkedList<JavaClass> vec = new LinkedList<>(); // TODO not used
externally
 
 
     public void enqueue( JavaClass clazz ) {

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/Frame.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/Frame.java?rev=1697695&r1=1697694&r2=1697695&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/Frame.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/Frame.java
Tue Aug 25 15:13:11 2015
@@ -33,9 +33,10 @@ public class Frame{
      * which instance it is that is not initialized yet. It will be
      * initialized invoking another constructor later.
      * NULL means the instance already *is* initialized.
-     * N.B. Use the getter/setter to access the field as it may
+     * @deprecated Use the getter/setter to access the field as it may
      * be made private in a later release
      */
+    @Deprecated
     protected static UninitializedObjectType _this;
 
     /**



Mime
View raw message