You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/08/27 00:15:41 UTC

svn commit: r1377532 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel: ./ Constants.java classfile/Constant.java classfile/ConstantInvokeDynamic.java classfile/ConstantMethodHandle.java classfile/ConstantMethodType.java

Author: markt
Date: Sun Aug 26 22:15:41 2012
New Revision: 1377532

URL: http://svn.apache.org/viewvc?rev=1377532&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51661
Merge updates from Commons BCEL that provide the limited Java 7 support required for Tomcat's cut-down BCEL fork.

Added:
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
      - copied, changed from r1377530, commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantInvokeDynamic.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java
      - copied, changed from r1377530, commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantMethodHandle.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java
      - copied, changed from r1377530, commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantMethodType.java
Modified:
    tomcat/trunk/java/org/apache/tomcat/util/bcel/   (props changed)
    tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java

Propchange: tomcat/trunk/java/org/apache/tomcat/util/bcel/
------------------------------------------------------------------------------
  Merged /commons/proper/bcel/trunk/src/main/java/org/apache/bcel:r1343597-1377530

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java?rev=1377532&r1=1377531&r2=1377532&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java Sun Aug 26 22:15:41 2012
@@ -94,13 +94,23 @@ public interface Constants {
   /** Marks a constant pool entry as a name and type.  */
   public static final byte CONSTANT_NameAndType        = 12;
 
+  /** Marks a constant pool entry as a Method Handle.  */
+  public static final byte CONSTANT_MethodHandle       = 15;
+
+  /** Marks a constant pool entry as a Method Type.    */
+  public static final byte CONSTANT_MethodType         = 16;
+
+  /** Marks a constant pool entry as an Invoke Dynamic */
+  public static final byte CONSTANT_InvokeDynamic      = 18;
+
   /** The names of the types of entries in a constant pool. */
   public static final String[] CONSTANT_NAMES = {
     "", "CONSTANT_Utf8", "", "CONSTANT_Integer",
     "CONSTANT_Float", "CONSTANT_Long", "CONSTANT_Double",
     "CONSTANT_Class", "CONSTANT_String", "CONSTANT_Fieldref",
     "CONSTANT_Methodref", "CONSTANT_InterfaceMethodref",
-    "CONSTANT_NameAndType" };
+    "CONSTANT_NameAndType", "CONSTANT_MethodHandle",
+    "CONSTANT_MethodType", "CONSTANT_InvokeDynamic" };
 
   /** Java VM opcode.
    * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java?rev=1377532&r1=1377531&r2=1377532&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java Sun Aug 26 22:15:41 2012
@@ -123,6 +123,12 @@ public abstract class Constant implement
                 return new ConstantNameAndType(file);
             case Constants.CONSTANT_Utf8:
                 return new ConstantUtf8(file);
+            case Constants.CONSTANT_MethodHandle:
+                return new ConstantMethodHandle(file);
+            case Constants.CONSTANT_MethodType:
+                return new ConstantMethodType(file);
+            case Constants.CONSTANT_InvokeDynamic:
+                return new ConstantInvokeDynamic(file);
             default:
                 throw new ClassFormatException("Invalid byte tag in constant pool: " + b);
         }

Copied: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java (from r1377530, commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantInvokeDynamic.java)
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java?p2=tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java&p1=commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantInvokeDynamic.java&r1=1377530&r2=1377532&rev=1377532&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantInvokeDynamic.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java Sun Aug 26 22:15:41 2012
@@ -15,19 +15,18 @@
  *  limitations under the License.
  *
  */
-package org.apache.bcel.classfile;
+package org.apache.tomcat.util.bcel.classfile;
 
 import java.io.DataInput;
-import java.io.DataOutputStream;
 import java.io.IOException;
 
-import org.apache.bcel.Constants;
+import org.apache.tomcat.util.bcel.Constants;
 
-/** 
- * This class is derived from the abstract 
- * <A HREF="org.apache.bcel.classfile.Constant.html">Constant</A> class 
+/**
+ * This class is derived from the abstract
+ * <A HREF="org.apache.bcel.classfile.Constant.html">Constant</A> class
  * and represents a reference to a invoke dynamic.
- * 
+ *
  * @see     Constant
  */
 public final class ConstantInvokeDynamic extends Constant {
@@ -64,33 +63,6 @@ public final class ConstantInvokeDynamic
     }
 
 
-    /**
-     * Called by objects that are traversing the nodes of the tree implicitly
-     * defined by the contents of a Java class. I.e., the hierarchy of methods,
-     * fields, attributes, etc. spawns a tree of objects.
-     *
-     * @param v Visitor object
-     */
-    @Override
-    public void accept( Visitor v ) {
-        // TODO Add .visitMethodType to Visitor interface
-    }
-
-
-    /**
-     * Dump name and signature index to file stream in binary format.
-     *
-     * @param file Output file stream
-     * @throws IOException
-     */
-    @Override
-    public final void dump( DataOutputStream file ) throws IOException {
-        file.writeByte(tag);
-        file.writeShort(bootstrap_method_attr_index);
-        file.writeShort(name_and_type_index);
-    }
-
-
     public int getBootstrapMethodAttrIndex() {
         return bootstrap_method_attr_index;
     }

Copied: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java (from r1377530, commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantMethodHandle.java)
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java?p2=tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java&p1=commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantMethodHandle.java&r1=1377530&r2=1377532&rev=1377532&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantMethodHandle.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java Sun Aug 26 22:15:41 2012
@@ -15,19 +15,18 @@
  *  limitations under the License.
  *
  */
-package org.apache.bcel.classfile;
+package org.apache.tomcat.util.bcel.classfile;
 
 import java.io.DataInput;
-import java.io.DataOutputStream;
 import java.io.IOException;
 
-import org.apache.bcel.Constants;
+import org.apache.tomcat.util.bcel.Constants;
 
-/** 
- * This class is derived from the abstract 
- * <A HREF="org.apache.bcel.classfile.Constant.html">Constant</A> class 
+/**
+ * This class is derived from the abstract
+ * <A HREF="org.apache.bcel.classfile.Constant.html">Constant</A> class
  * and represents a reference to a method handle.
- * 
+ *
  * @see     Constant
  */
 public final class ConstantMethodHandle extends Constant {
@@ -63,33 +62,6 @@ public final class ConstantMethodHandle 
     }
 
 
-    /**
-     * Called by objects that are traversing the nodes of the tree implicitly
-     * defined by the contents of a Java class. I.e., the hierarchy of methods,
-     * fields, attributes, etc. spawns a tree of objects.
-     *
-     * @param v Visitor object
-     */
-    @Override
-    public void accept( Visitor v ) {
-        // TODO Add .visitMethodHandle to Visitor interface
-    }
-
-
-    /**
-     * Dump method kind and index to file stream in binary format.
-     *
-     * @param file Output file stream
-     * @throws IOException
-     */
-    @Override
-    public final void dump( DataOutputStream file ) throws IOException {
-        file.writeByte(tag);
-        file.writeByte(reference_kind);
-        file.writeShort(reference_index);
-    }
-
-
     public int getReferenceKind() {
         return reference_kind;
     }

Copied: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java (from r1377530, commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantMethodType.java)
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java?p2=tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java&p1=commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantMethodType.java&r1=1377530&r2=1377532&rev=1377532&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ConstantMethodType.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java Sun Aug 26 22:15:41 2012
@@ -15,19 +15,18 @@
  *  limitations under the License.
  *
  */
-package org.apache.bcel.classfile;
+package org.apache.tomcat.util.bcel.classfile;
 
 import java.io.DataInput;
-import java.io.DataOutputStream;
 import java.io.IOException;
 
-import org.apache.bcel.Constants;
+import org.apache.tomcat.util.bcel.Constants;
 
-/** 
- * This class is derived from the abstract 
- * <A HREF="org.apache.bcel.classfile.Constant.html">Constant</A> class 
+/**
+ * This class is derived from the abstract
+ * <A HREF="org.apache.bcel.classfile.Constant.html">Constant</A> class
  * and represents a reference to a method type.
- * 
+ *
  * @see     Constant
  */
 public final class ConstantMethodType extends Constant {
@@ -61,32 +60,6 @@ public final class ConstantMethodType ex
     }
 
 
-    /**
-     * Called by objects that are traversing the nodes of the tree implicitly
-     * defined by the contents of a Java class. I.e., the hierarchy of methods,
-     * fields, attributes, etc. spawns a tree of objects.
-     *
-     * @param v Visitor object
-     */
-    @Override
-    public void accept( Visitor v ) {
-        // TODO Add .visitMethodType to Visitor interface
-    }
-
-
-    /**
-     * Dump name and signature index to file stream in binary format.
-     *
-     * @param file Output file stream
-     * @throws IOException
-     */
-    @Override
-    public final void dump( DataOutputStream file ) throws IOException {
-        file.writeByte(tag);
-        file.writeShort(descriptor_index);
-    }
-
-
     public int getDescriptorIndex() {
         return descriptor_index;
     }



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