Author: markt
Date: Thu Sep 11 09:13:47 2014
New Revision: 1624233

URL: http://svn.apache.org/r1624233
Log:
Remove unused code (FieldOrMethod)

Removed:
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java
Modified:
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1624233&r1=1624232&r2=1624233&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
Thu Sep 11 09:13:47 2014
@@ -48,8 +48,6 @@ public final class ClassParser {
     private int access_flags; // Access rights of parsed class
     private int[] interfaces; // Names of implemented interfaces
     private ConstantPool constant_pool; // collection of constants
-    private FieldOrMethod[] fields; // class fields, i.e., its variables
-    private FieldOrMethod[] methods; // methods defined in the class
     private Attribute[] attributes; // attributes defined in the class
     private static final int BUFSIZE = 8192;
 
@@ -177,9 +175,8 @@ public final class ClassParser {
     private void readFields() throws IOException, ClassFormatException {
         int fields_count;
         fields_count = file.readUnsignedShort();
-        fields = new FieldOrMethod[fields_count];
         for (int i = 0; i < fields_count; i++) {
-            fields[i] = new FieldOrMethod(file, constant_pool);
+            Utility.swallowFieldOrMethod(file, constant_pool);
         }
     }
 
@@ -221,9 +218,8 @@ public final class ClassParser {
     private void readMethods() throws IOException, ClassFormatException {
         int methods_count;
         methods_count = file.readUnsignedShort();
-        methods = new FieldOrMethod[methods_count];
         for (int i = 0; i < methods_count; i++) {
-            methods[i] = new FieldOrMethod(file, constant_pool);
+            Utility.swallowFieldOrMethod(file, constant_pool);
         }
     }
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=1624233&r1=1624232&r2=1624233&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Thu 
Sep 11 09:13:47 2014
@@ -303,4 +303,16 @@ final class Utility {
             AnnotationEntry.read(file, constant_pool);
         }
     }
+
+    static void swallowFieldOrMethod(DataInputStream file, ConstantPool 
constant_pool)
+            throws IOException {
+        file.readUnsignedShort();   // Unused access flags
+        file.readUnsignedShort();   // name index
+        file.readUnsignedShort();   // signature index
+
+        int attributes_count = file.readUnsignedShort();
+        for (int i = 0; i < attributes_count; i++) {
+            Attribute.readAttribute(file, constant_pool);
+        }
+    }
 }



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

Reply via email to