tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1384068 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: Method.java Utility.java
Date Wed, 12 Sep 2012 18:05:49 GMT
Author: markt
Date: Wed Sep 12 18:05:48 2012
New Revision: 1384068

URL: http://svn.apache.org/viewvc?rev=1384068&view=rev
Log:
Remove unused toString() method along with utility method it accessed that was using a deprecated
API.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java?rev=1384068&r1=1384067&r2=1384068&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java Wed Sep 12 18:05:48
2012
@@ -20,7 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
 import org.apache.tomcat.util.bcel.util.BCELComparator;
 
 /**
@@ -113,43 +112,6 @@ public final class Method extends FieldO
 
 
     /**
-     * Return string representation close to declaration format,
-     * `public static void main(String[] args) throws IOException', e.g.
-     *
-     * @return String representation of the method.
-     */
-    @Override
-    public final String toString() {
-        ConstantUtf8 c;
-        String name, signature, access; // Short cuts to constant pool
-        StringBuilder buf;
-        access = Utility.accessToString(access_flags);
-        // Get name and signature from constant pool
-        c = (ConstantUtf8) constant_pool.getConstant(signature_index, Constants.CONSTANT_Utf8);
-        signature = c.getBytes();
-        c = (ConstantUtf8) constant_pool.getConstant(name_index, Constants.CONSTANT_Utf8);
-        name = c.getBytes();
-        signature = Utility.methodSignatureToString(signature, name, access, true,
-                getLocalVariableTable());
-        buf = new StringBuilder(signature);
-        for (int i = 0; i < attributes_count; i++) {
-            Attribute a = attributes[i];
-            if (!((a instanceof Code) || (a instanceof ExceptionTable))) {
-                buf.append(" [").append(a.toString()).append("]");
-            }
-        }
-        ExceptionTable e = getExceptionTable();
-        if (e != null) {
-            String str = e.toString();
-            if (!str.equals("")) {
-                buf.append("\n\t\tthrows ").append(str);
-            }
-        }
-        return buf.toString();
-    }
-
-
-    /**
      * Return value as defined by given BCELComparator strategy.
      * By default two method objects are said to be equal when
      * their names and signatures are equal.

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=1384068&r1=1384067&r2=1384068&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 Wed Sep 12 18:05:48
2012
@@ -458,80 +458,6 @@ public abstract class Utility {
         return compactClassName(str, "java.lang.", chopit);
     }
 
-    /**
-     * A returntype signature represents the return value from a method.
-     * It is a series of bytes in the following grammar:
-     *
-     * <return_signature> ::= <field_type> | V
-     *
-     * The character V indicates that the method returns no value. Otherwise, the
-     * signature indicates the type of the return value.
-     * An argument signature represents an argument passed to a method:
-     *
-     * <argument_signature> ::= <field_type>
-     *
-     * A method signature represents the arguments that the method expects, and
-     * the value that it returns.
-     * <method_signature> ::= (<arguments_signature>) <return_signature>
-     * <arguments_signature>::= <argument_signature>*
-     *
-     * This method converts such a string into a Java type declaration like
-     * `void main(String[])' and throws a `ClassFormatException' when the parsed
-     * type is invalid.
-     *
-     * @param  signature    Method signature
-     * @param  name         Method name
-     * @param  access       Method access rights
-     * @param chopit
-     * @param vars
-     * @return Java type declaration
-     * @throws  ClassFormatException
-     */
-    public static final String methodSignatureToString( String signature, String name,
-            String access, boolean chopit, LocalVariableTable vars ) throws ClassFormatException
{
-        StringBuilder buf = new StringBuilder("(");
-        String type;
-        int index;
-        int var_index = (access.indexOf("static") >= 0) ? 0 : 1;
-        try { // Read all declarations between for `(' and `)'
-            if (signature.charAt(0) != '(') {
-                throw new ClassFormatException("Invalid method signature: " + signature);
-            }
-            index = 1; // current string position
-            while (signature.charAt(index) != ')') {
-                String param_type = signatureToString(signature.substring(index), chopit);
-                buf.append(param_type);
-                if (vars != null) {
-                    LocalVariable l = vars.getLocalVariable(var_index);
-                    if (l != null) {
-                        buf.append(" ").append(l.getName());
-                    }
-                } else {
-                    buf.append(" arg").append(var_index);
-                }
-                if ("double".equals(param_type) || "long".equals(param_type)) {
-                    var_index += 2;
-                } else {
-                    var_index++;
-                }
-                buf.append(", ");
-                //corrected concurrent private static field acess
-                index += unwrap(consumed_chars); // update position
-            }
-            index++; // update position
-            // Read return type after `)'
-            type = signatureToString(signature.substring(index), chopit);
-        } catch (StringIndexOutOfBoundsException e) { // Should never occur
-            throw new ClassFormatException("Invalid method signature: " + signature, e);
-        }
-        if (buf.length() > 1) {
-            buf.setLength(buf.length() - 2);
-        }
-        buf.append(")");
-        return access + ((access.length() > 0) ? " " : "") + // May be an empty string
-                type + " " + name + buf.toString();
-    }
-
 
     // Guess what this does
     private static final int pow2( int n ) {



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


Mime
View raw message