You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2014/09/13 00:57:55 UTC

svn commit: r1624670 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

Author: kkolinko
Date: Fri Sep 12 22:57:54 2014
New Revision: 1624670

URL: http://svn.apache.org/r1624670
Log:
Remove unused method Attribute.getName(). It allows to remove name_index field as well.
Found thanks to Cobertura coverage report.

It is merge of r1624564 from tomcat/trunk.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1624564

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
------------------------------------------------------------------------------
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624564

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624670&r1=1624669&r2=1624670&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java Fri Sep 12 22:57:54 2014
@@ -29,8 +29,6 @@ import java.io.IOException;
 public class AnnotationDefault extends Attribute {
 
     /**
-     * @param name_index
-     *            Index pointing to the name <em>Code</em>
      * @param length
      *            Content length in bytes
      * @param file
@@ -38,11 +36,9 @@ public class AnnotationDefault extends A
      * @param constant_pool
      *            Array of constants
      */
-    public AnnotationDefault(int name_index, int length,
-            DataInputStream file, ConstantPool constant_pool)
-            throws IOException
-    {
-        super(name_index, length, constant_pool);
+    public AnnotationDefault(int length, DataInputStream file,
+            ConstantPool constant_pool) throws IOException {
+        super(length, constant_pool);
         // Default value
         ElementValue.readElementValue(file, constant_pool);
     }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624670&r1=1624669&r2=1624670&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java Fri Sep 12 22:57:54 2014
@@ -31,14 +31,13 @@ public abstract class Annotations extend
     private final AnnotationEntry[] annotation_table;
     
     /**
-     * @param name_index Index pointing to the name <em>Code</em>
      * @param length Content length in bytes
      * @param file Input stream
      * @param constant_pool Array of constants
      */
-    public Annotations(int name_index, int length, DataInputStream file,
+    public Annotations(int length, DataInputStream file,
             ConstantPool constant_pool) throws IOException {
-        super(name_index, length, constant_pool);
+        super(length, constant_pool);
         final int annotation_table_length = (file.readUnsignedShort());
         annotation_table = new AnnotationEntry[annotation_table_length];
         for (int i = 0; i < annotation_table_length; i++) {

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624670&r1=1624669&r2=1624670&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri Sep 12 22:57:54 2014
@@ -34,16 +34,11 @@ import org.apache.tomcat.util.bcel.Const
  */
 public abstract class Attribute {
 
-    protected int name_index; // Points to attribute name in constant pool
-
     protected int length; // Content length of attribute field
 
     protected ConstantPool constant_pool;
 
-    protected Attribute(int name_index, int length,
-            ConstantPool constant_pool)
-    {
-        this.name_index = name_index;
+    protected Attribute(int length, ConstantPool constant_pool) {
         this.length = length;
         this.constant_pool = constant_pool;
     }
@@ -88,27 +83,15 @@ public abstract class Attribute {
         switch (tag)
         {
         case Constants.ATTR_RUNTIME_VISIBLE_ANNOTATIONS:
-            return new RuntimeVisibleAnnotations(name_index, length, file,
-                    constant_pool);
+            return new RuntimeVisibleAnnotations(length, file, constant_pool);
         case Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS:
-            return new RuntimeVisibleParameterAnnotations(name_index, length,
-                    file, constant_pool);
-        case Constants.ATTR_ANNOTATION_DEFAULT:
-            return new AnnotationDefault(name_index, length, file,
+            return new RuntimeVisibleParameterAnnotations(length, file,
                     constant_pool);
+        case Constants.ATTR_ANNOTATION_DEFAULT:
+            return new AnnotationDefault(length, file, constant_pool);
         default: // All other attributes are skipped
             Utility.skipFully(file, length);
             return null;
         }
     }
-
-    /**
-     * @return Name of attribute
-     */
-    public String getName()
-    {
-        ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(name_index,
-                Constants.CONSTANT_Utf8);
-        return c.getBytes();
-    }
 }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java?rev=1624670&r1=1624669&r2=1624670&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java Fri Sep 12 22:57:54 2014
@@ -33,14 +33,13 @@ public abstract class ParameterAnnotatio
 
 
     /**
-     * @param name_index Index pointing to the name <em>Code</em>
      * @param length Content length in bytes
      * @param file Input stream
      * @param constant_pool Array of constants
      */
-    ParameterAnnotations(int name_index, int length,
-            DataInputStream file, ConstantPool constant_pool) throws IOException {
-        super(name_index, length, constant_pool);
+    ParameterAnnotations(int length, DataInputStream file,
+            ConstantPool constant_pool) throws IOException {
+        super(length, constant_pool);
         num_parameters = (file.readUnsignedByte());
         parameter_annotation_table = new ParameterAnnotationEntry[num_parameters];
         for (int i = 0; i < num_parameters; i++) {

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java?rev=1624670&r1=1624669&r2=1624670&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java Fri Sep 12 22:57:54 2014
@@ -30,8 +30,6 @@ import java.io.IOException;
 public class RuntimeVisibleAnnotations extends Annotations {
 
     /**
-     * @param name_index
-     *            Index pointing to the name <em>Code</em>
      * @param length
      *            Content length in bytes
      * @param file
@@ -39,10 +37,8 @@ public class RuntimeVisibleAnnotations e
      * @param constant_pool
      *            Array of constants
      */
-    public RuntimeVisibleAnnotations(int name_index, int length,
-            DataInputStream file, ConstantPool constant_pool)
-            throws IOException
-    {
-        super(name_index, length, file, constant_pool);
+    public RuntimeVisibleAnnotations(int length, DataInputStream file,
+            ConstantPool constant_pool) throws IOException {
+        super(length, file, constant_pool);
     }
 }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java?rev=1624670&r1=1624669&r2=1624670&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java Fri Sep 12 22:57:54 2014
@@ -30,13 +30,12 @@ import java.io.IOException;
 public class RuntimeVisibleParameterAnnotations extends ParameterAnnotations {
 
     /**
-     * @param name_index Index pointing to the name <em>Code</em>
      * @param length Content length in bytes
      * @param file Input stream
      * @param constant_pool Array of constants
      */
-    RuntimeVisibleParameterAnnotations(int name_index, int length, DataInputStream file,
+    RuntimeVisibleParameterAnnotations(int length, DataInputStream file,
             ConstantPool constant_pool) throws IOException {
-        super(name_index, length, file, constant_pool);
+        super(length, file, constant_pool);
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org