]> source.dussan.org Git - aspectj.git/commitdiff
invokedynamic support in bcel
authorAndy Clement <aclement@vmware.com>
Mon, 19 Mar 2012 18:57:01 +0000 (11:57 -0700)
committerAndy Clement <aclement@vmware.com>
Mon, 19 Mar 2012 18:57:01 +0000 (11:57 -0700)
25 files changed:
bcel-builder/src/org/aspectj/apache/bcel/Constants.java
bcel-builder/src/org/aspectj/apache/bcel/classfile/Attribute.java
bcel-builder/src/org/aspectj/apache/bcel/classfile/BootstrapMethods.java [new file with mode: 0644]
bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassVisitor.java
bcel-builder/src/org/aspectj/apache/bcel/classfile/Constant.java
bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantInvokeDynamic.java [new file with mode: 0644]
bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantMethodHandle.java [new file with mode: 0644]
bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantMethodType.java [new file with mode: 0644]
bcel-builder/src/org/aspectj/apache/bcel/classfile/Utility.java
bcel-builder/src/org/aspectj/apache/bcel/generic/FieldOrMethod.java
bcel-builder/src/org/aspectj/apache/bcel/generic/Instruction.java
bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionFactory.java
bcel-builder/src/org/aspectj/apache/bcel/generic/InvokeDynamic.java [new file with mode: 0644]
bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/DescendingVisitor.java
bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/EmptyClassVisitor.java
lib/asm/asm-4.0.jar [new file with mode: 0644]
lib/asm/asm-4.0.renamed.jar [new file with mode: 0644]
lib/asm/build.xml
lib/bcel/bcel-src.zip
lib/bcel/bcel-verifier-src.zip
lib/bcel/bcel-verifier.jar
lib/bcel/bcel.jar
tests/src/org/aspectj/systemtest/ajc170/IndyTests.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc170/indy.xml [new file with mode: 0644]
weaver/.classpath

index a46daf157ec59de4c20c3013817ac937cf0d3fd5..2604d8e5460b24e2c53dcfe2c720d34f0d775954 100644 (file)
@@ -127,10 +127,14 @@ public interface Constants {
        public final static byte CONSTANT_Methodref = 10;
        public final static byte CONSTANT_InterfaceMethodref = 11;
        public final static byte CONSTANT_NameAndType = 12;
+       
+       public final static byte CONSTANT_MethodHandle = 15;
+       public final static byte CONSTANT_MethodType = 16;
+       public final static byte CONSTANT_InvokeDynamic = 18;
 
        public final static 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_InterfaceMethodref", "CONSTANT_NameAndType","","","CONSTANT_MethodHandle","CONSTANT_MethodType","","CONSTANT_InvokeDynamic" };
 
        /**
         * The name of the static initializer, also called &quot;class initialization method&quot; or &quot;interface initialization
@@ -346,6 +350,7 @@ public interface Constants {
        public static final short INVOKENONVIRTUAL = 183; // Old name in JDK 1.0
        public static final short INVOKESTATIC = 184;
        public static final short INVOKEINTERFACE = 185;
+       public static final short INVOKEDYNAMIC = 186;
        public static final short NEW = 187;
        public static final short NEWARRAY = 188;
        public static final short ANEWARRAY = 189;
@@ -533,7 +538,7 @@ public interface Constants {
                        "dcmpg", "ifeq", "ifne", "iflt", "ifge", "ifgt", "ifle", "if_icmpeq", "if_icmpne", "if_icmplt", "if_icmpge",
                        "if_icmpgt", "if_icmple", "if_acmpeq", "if_acmpne", "goto", "jsr", "ret", "tableswitch", "lookupswitch", "ireturn",
                        "lreturn", "freturn", "dreturn", "areturn", "return", "getstatic", "putstatic", "getfield", "putfield",
-                       "invokevirtual", "invokespecial", "invokestatic", "invokeinterface", ILLEGAL_OPCODE, "new", "newarray", "anewarray",
+                       "invokevirtual", "invokespecial", "invokestatic", "invokeinterface", "invokedynamic", "new", "newarray", "anewarray",
                        "arraylength", "athrow", "checkcast", "instanceof", "monitorenter", "monitorexit", "wide", "multianewarray", "ifnull",
                        "ifnonnull", "goto_w", "jsr_w", "breakpoint", ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
                        ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
@@ -603,13 +608,14 @@ public interface Constants {
        public static final byte ATTR_LOCAL_VARIABLE_TYPE_TABLE = 16;
        public static final byte ATTR_ENCLOSING_METHOD = 17;
        public static final byte ATTR_ANNOTATION_DEFAULT = 18;
+       public static final byte ATTR_BOOTSTRAPMETHODS = 19;
 
-       public static final short KNOWN_ATTRIBUTES = 19;
+       public static final short KNOWN_ATTRIBUTES = 20;
 
        public static final String[] ATTRIBUTE_NAMES = { "SourceFile", "ConstantValue", "Code", "Exceptions", "LineNumberTable",
                        "LocalVariableTable", "InnerClasses", "Synthetic", "Deprecated", "PMGClass", "Signature", "StackMap",
                        "RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations", "RuntimeVisibleParameterAnnotations",
-                       "RuntimeInvisibleParameterAnnotations", "LocalVariableTypeTable", "EnclosingMethod", "AnnotationDefault" };
+                       "RuntimeInvisibleParameterAnnotations", "LocalVariableTypeTable", "EnclosingMethod", "AnnotationDefault","BootstrapMethods" };
 
        /**
         * Constants used in the StackMap attribute.
index bc30b719c252087798f60354d789b887b6717ebd..939fa36be78064e3370c624e1eb6938318f35a3e 100644 (file)
@@ -157,6 +157,8 @@ public abstract class Attribute implements Cloneable, Node, Serializable {
                        return new LocalVariableTypeTable(idx, len, file, cpool);
                case Constants.ATTR_ENCLOSING_METHOD:
                        return new EnclosingMethod(idx, len, file, cpool);
+               case Constants.ATTR_BOOTSTRAPMETHODS:
+                       return new BootstrapMethods(idx,len,file,cpool);
                default:
                        throw new IllegalStateException();
                }
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/BootstrapMethods.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/BootstrapMethods.java
new file mode 100644 (file)
index 0000000..04b1c76
--- /dev/null
@@ -0,0 +1,240 @@
+package org.aspectj.apache.bcel.classfile;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache BCEL" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache BCEL", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.aspectj.apache.bcel.Constants;
+
+/**
+ * Represents the BootstrapMethods attribute in Java 7 classes.
+ * 
+ * @author Andy Clement
+ */
+public final class BootstrapMethods extends Attribute {
+
+       // if 'isInPackedState' then this data needs unpacking
+       private boolean isInPackedState = false;
+       private byte[] data; // discarded once unpacked
+
+       private int numBootstrapMethods;
+       private BootstrapMethod[] bootstrapMethods;
+
+       public BootstrapMethods(BootstrapMethods c) {
+               this(c.getNameIndex(), c.getLength(), c.getBootstrapMethods(), c.getConstantPool());
+       }
+
+       public BootstrapMethods(int nameIndex, int length, BootstrapMethod[] lineNumberTable, ConstantPool constantPool) {
+               super(Constants.ATTR_BOOTSTRAPMETHODS, nameIndex, length, constantPool);
+               setBootstrapMethods(lineNumberTable);
+               isInPackedState = false;
+       }
+
+       public final void setBootstrapMethods(BootstrapMethod[] bootstrapMethods) {
+               this.data = null;
+               this.isInPackedState = false;
+               this.bootstrapMethods = bootstrapMethods;
+               this.numBootstrapMethods = bootstrapMethods==null?0:bootstrapMethods.length;
+       }
+
+       BootstrapMethods(int name_index, int length, DataInputStream file, ConstantPool constant_pool) throws IOException {
+               this(name_index, length, (BootstrapMethod[])null, constant_pool);
+               data = new byte[length];
+               file.read(data);
+               isInPackedState = true;
+       }
+       
+       static class BootstrapMethod {
+               private int bootstrapMethodRef;
+               private int[] bootstrapArguments;
+
+               BootstrapMethod(DataInputStream file) throws IOException {
+                       this(file.readUnsignedShort(), readBootstrapArguments(file));
+               }
+               
+               private static int[] readBootstrapArguments(DataInputStream dis) throws IOException {
+                       int numBootstrapMethods = dis.readUnsignedShort();
+                       int[] bootstrapArguments = new int[numBootstrapMethods];
+                       for (int i=0;i<numBootstrapMethods;i++) {
+                               bootstrapArguments[i] = dis.readUnsignedShort();
+                       }
+                       return bootstrapArguments;
+               }
+               
+               BootstrapMethod(int bootstrapMethodRef, int[] bootstrapArguments) {
+                       this.bootstrapMethodRef = bootstrapMethodRef;
+                       this.bootstrapArguments = bootstrapArguments;
+               }
+
+               public final void dump(DataOutputStream file) throws IOException {
+                       file.writeShort(bootstrapMethodRef);
+                       int len = bootstrapArguments.length;
+                       file.writeShort(len);
+                       for (int i=0;i<len;i++) {
+                               file.writeShort(bootstrapArguments[i]);
+                       }
+               }
+       }
+       
+       // Unpacks the byte array into the table
+       private void unpack() {
+               if (isInPackedState) {
+                       try {
+                               ByteArrayInputStream bs = new ByteArrayInputStream(data);
+                               DataInputStream dis = new DataInputStream(bs);
+                               int bootstrapMethodCount = dis.readUnsignedShort();
+                               bootstrapMethods = new BootstrapMethod[bootstrapMethodCount];
+                               for (int i = 0; i < bootstrapMethodCount; i++) {
+                                       bootstrapMethods[i] = new BootstrapMethod(dis);
+                               }
+                               dis.close();
+                               data = null; // throw it away now
+                       } catch (IOException e) {
+                               throw new RuntimeException("Unpacking of LineNumberTable attribute failed");
+                       }
+                       isInPackedState = false;
+               }
+       }
+
+       /**
+        * Called by objects that are traversing the nodes of the tree implicitely 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(ClassVisitor v) {
+               unpack();
+               v.visitBootstrapMethods(this);
+       }
+
+       /**
+        * Dump line number table attribute to file stream in binary format.
+        * 
+        * @param file Output file stream
+        * @throws IOException
+        */
+       @Override
+       public final void dump(DataOutputStream file) throws IOException {
+               super.dump(file);
+               if (isInPackedState) {
+                       file.write(data);
+               } else {
+                       int blen = bootstrapMethods.length;
+                       file.writeShort(blen);
+                       for (int i = 0; i < blen; i++) {
+                               bootstrapMethods[i].dump(file);
+                       }
+               }
+       }
+
+       public final BootstrapMethod[] getBootstrapMethods() {
+               unpack();
+               return bootstrapMethods;
+       }
+
+
+       /**
+        * @return String representation.
+        */
+       @Override
+       public final String toString() {
+               throw new IllegalStateException("nyi");
+//             unpack();
+//             StringBuffer buf = new StringBuffer();
+//             StringBuffer line = new StringBuffer();
+//
+//             for (int i = 0; i < bootstrapMethodCount; i++) {
+//                     line.append(table[i].toString());
+//
+//                     if (i < bootstrapMethodCount - 1) {
+//                             line.append(", ");
+//                     }
+//
+//                     if (line.length() > 72) {
+//                             line.append('\n');
+//                             buf.append(line);
+//                             line.setLength(0);
+//                     }
+//             }
+//
+//             buf.append(line);
+//
+//             return buf.toString();
+       }
+
+
+       /**
+        * @return deep copy of this attribute
+        */
+       // @Override
+       // public Attribute copy(ConstantPool constant_pool) {
+       // unpack();
+       // LineNumberTable newTable = (LineNumberTable) clone();
+       // newTable.table = new LineNumber[tableLength];
+       // for (int i = 0; i < tableLength; i++) {
+       // newTable.table[i] = table[i].copy();
+       // }
+       // newTable.cpool = constant_pool;
+       // return newTable;
+       // }
+       public final int getNumBootstrapMethods () {
+               unpack();
+               return bootstrapMethods.length;
+       }
+}
index 0957bfba825a406e35732088f6be4f8924e3b6b2..c411cb5d691b8eeb949a6100321cfc2b36458783 100644 (file)
@@ -88,8 +88,14 @@ public interface ClassVisitor {
        public void visitConstantLong(ConstantLong obj);
 
        public void visitConstantMethodref(ConstantMethodref obj);
+       
+       public void visitConstantMethodHandle(ConstantMethodHandle obj);
 
        public void visitConstantNameAndType(ConstantNameAndType obj);
+       
+       public void visitConstantMethodType(ConstantMethodType obj);
+       
+       public void visitConstantInvokeDynamic(ConstantInvokeDynamic obj);
 
        public void visitConstantPool(ConstantPool obj);
 
@@ -126,6 +132,8 @@ public interface ClassVisitor {
        public void visitSourceFile(SourceFile obj);
 
        public void visitSynthetic(Synthetic obj);
+       
+       public void visitBootstrapMethods(BootstrapMethods obj);
 
        public void visitUnknown(Unknown obj);
 
index eedcc98f24f586c039709a5a15526edf82a8ebdd..2110bdc08e3c3e896bbb3fae7639a03829a65bb9 100644 (file)
@@ -129,6 +129,12 @@ public abstract class Constant implements Cloneable, Node {
                        return new ConstantLong(dis);
                case Constants.CONSTANT_Double:
                        return new ConstantDouble(dis);
+               case Constants.CONSTANT_MethodHandle:
+                       return new ConstantMethodHandle(dis);
+               case Constants.CONSTANT_MethodType:
+                       return new ConstantMethodType(dis);
+               case Constants.CONSTANT_InvokeDynamic:
+                       return new ConstantInvokeDynamic(dis);
                default:
                        throw new ClassFormatException("Invalid byte tag in constant pool: " + b);
                }
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantInvokeDynamic.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantInvokeDynamic.java
new file mode 100644 (file)
index 0000000..be71b4e
--- /dev/null
@@ -0,0 +1,128 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache BCEL" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache BCEL", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.aspectj.apache.bcel.classfile;
+
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.aspectj.apache.bcel.Constants;
+
+/**
+ * This class is derived from the abstract <A HREF="org.aspectj.apache.bcel.classfile.Constant.html">Constant</A> class and
+ * represents a reference to the name and signature of a field or method.
+ * 
+ * http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4.10
+ * 
+ * @author Andy Clement
+ * @see Constant
+ */
+public final class ConstantInvokeDynamic extends Constant {
+       private final int bootstrapMethodAttrIndex;
+       private final int nameAndTypeIndex; 
+
+       ConstantInvokeDynamic(DataInputStream file) throws IOException {
+               this(file.readUnsignedShort(), file.readUnsignedShort());
+       }
+
+       public ConstantInvokeDynamic(int readUnsignedShort, int nameAndTypeIndex) {
+               super(Constants.CONSTANT_InvokeDynamic);
+               this.bootstrapMethodAttrIndex = readUnsignedShort;
+               this.nameAndTypeIndex = nameAndTypeIndex;
+       }
+
+       @Override
+       public final void dump(DataOutputStream file) throws IOException {
+               file.writeByte(tag);
+               file.writeShort(bootstrapMethodAttrIndex);
+               file.writeShort(nameAndTypeIndex);
+       }
+//
+//     public final byte getReferenceKind() {
+//             return bootstrapMethodAttrIndex;
+//     }
+//
+//     public final String getName(ConstantPool cp) {
+//             return cp.constantToString(getNameIndex(), Constants.CONSTANT_Utf8);
+//     }
+//
+//     public final int getSignatureIndex() {
+//             return referenceIndex;
+//     }
+//     
+//     public final String getSignature(ConstantPool cp) {
+//             return cp.constantToString(getSignatureIndex(), Constants.CONSTANT_Utf8);
+//     }
+       
+       public final int getNameAndTypeIndex() {
+               return nameAndTypeIndex;
+       }
+
+       @Override
+       public final String toString() {
+               return super.toString() + "(bootstrapMethodAttrIndex=" + bootstrapMethodAttrIndex + ",nameAndTypeIndex=" + nameAndTypeIndex + ")";
+       }
+
+       @Override
+       public String getValue() {
+               return toString();
+       }
+
+       @Override
+       public void accept(ClassVisitor v) {
+               v.visitConstantInvokeDynamic(this);
+       }
+
+}
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantMethodHandle.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantMethodHandle.java
new file mode 100644 (file)
index 0000000..fe5623f
--- /dev/null
@@ -0,0 +1,124 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache BCEL" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache BCEL", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.aspectj.apache.bcel.classfile;
+
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.aspectj.apache.bcel.Constants;
+
+/**
+ * This class is derived from the abstract <A HREF="org.aspectj.apache.bcel.classfile.Constant.html">Constant</A> class and
+ * represents a reference to the name and signature of a field or method.
+ * 
+ * http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4.8
+ * 
+ * @author Andy Clement
+ * @see Constant
+ */
+public final class ConstantMethodHandle extends Constant {
+       private byte referenceKind;
+       private int referenceIndex; 
+
+       ConstantMethodHandle(DataInputStream file) throws IOException {
+               this(file.readByte(), file.readUnsignedShort());
+       }
+
+       public ConstantMethodHandle(byte referenceKind, int referenceIndex) {
+               super(Constants.CONSTANT_MethodHandle);
+               this.referenceKind = referenceKind;
+               this.referenceIndex = referenceIndex;
+       }
+
+       @Override
+       public final void dump(DataOutputStream file) throws IOException {
+               file.writeByte(tag);
+               file.writeByte(referenceKind);
+               file.writeShort(referenceIndex);
+       }
+
+       public final byte getReferenceKind() {
+               return referenceKind;
+       }
+
+//     public final String getName(ConstantPool cp) {
+//             return cp.constantToString(getNameIndex(), Constants.CONSTANT_Utf8);
+//     }
+//
+//     public final int getSignatureIndex() {
+//             return referenceIndex;
+//     }
+//     
+//     public final String getSignature(ConstantPool cp) {
+//             return cp.constantToString(getSignatureIndex(), Constants.CONSTANT_Utf8);
+//     }
+
+       @Override
+       public final String toString() {
+               return super.toString() + "(referenceKind=" + referenceKind + ",referenceIndex=" + referenceIndex + ")";
+       }
+
+       @Override
+       public String getValue() {
+               return toString();
+       }
+
+       @Override
+       public void accept(ClassVisitor v) {
+               v.visitConstantMethodHandle(this);
+       }
+
+}
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantMethodType.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantMethodType.java
new file mode 100644 (file)
index 0000000..867e7eb
--- /dev/null
@@ -0,0 +1,121 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache BCEL" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache BCEL", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.aspectj.apache.bcel.classfile;
+
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.aspectj.apache.bcel.Constants;
+
+/**
+ * This class is derived from the abstract <A HREF="org.aspectj.apache.bcel.classfile.Constant.html">Constant</A> class and
+ * represents a reference to the name and signature of a field or method.
+ * 
+ * http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4.9
+ * 
+ * @author Andy Clement
+ * @see Constant
+ */
+public final class ConstantMethodType extends Constant {
+       private int descriptorIndex;
+
+       ConstantMethodType(DataInputStream file) throws IOException {
+               this(file.readUnsignedShort());
+       }
+
+       public ConstantMethodType(int descriptorIndex) {
+               super(Constants.CONSTANT_MethodType);
+               this.descriptorIndex = descriptorIndex;
+       }
+
+       @Override
+       public final void dump(DataOutputStream file) throws IOException {
+               file.writeByte(tag);
+               file.writeShort(descriptorIndex);
+       }
+
+       public final int getDescriptorIndex() {
+               return descriptorIndex;
+       }
+
+//     public final String getName(ConstantPool cp) {
+//             return cp.constantToString(getNameIndex(), Constants.CONSTANT_Utf8);
+//     }
+//
+//     public final int getSignatureIndex() {
+//             return referenceIndex;
+//     }
+//     
+//     public final String getSignature(ConstantPool cp) {
+//             return cp.constantToString(getSignatureIndex(), Constants.CONSTANT_Utf8);
+//     }
+
+       @Override
+       public final String toString() {
+               return super.toString() + "(descriptorIndex=" + descriptorIndex + ")";
+       }
+
+       @Override
+       public String getValue() {
+               return toString();
+       }
+
+       @Override
+       public void accept(ClassVisitor v) {
+               v.visitConstantMethodType(this);
+       }
+
+}
index 6845139a39fffc1f15e6b2df6662e6d7dc7a24b8..98f5952aee065476da08203dfab3a5afa3b007f9 100644 (file)
@@ -995,7 +995,13 @@ public abstract class Utility {
                                        + bytes.readUnsignedByte()); // Last byte is a reserved
                        // space
                        break;
-
+                       
+               case Constants.INVOKEDYNAMIC://http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.invokedynamic
+                       index = bytes.readUnsignedShort();
+                       bytes.readUnsignedShort(); // zeroes
+                       buf.append("\t" + constant_pool.constantToString(index) + (verbose ? " (" + index + ")" : ""));
+                       break;
+                       
                // Operands are references to items in constant pool
                case Constants.LDC_W:
                case Constants.LDC2_W:
index bf2c73299dd7d61a01df38c008ec3dc16153c887..4987969c3379408db0e8b18189b9d09c16974c20 100644 (file)
@@ -53,6 +53,7 @@ package org.aspectj.apache.bcel.generic;
  * information on the Apache Software Foundation, please see
  * <http://www.apache.org/>.
  */
+import org.aspectj.apache.bcel.classfile.Constant;
 import org.aspectj.apache.bcel.classfile.ConstantCP;
 import org.aspectj.apache.bcel.classfile.ConstantNameAndType;
 import org.aspectj.apache.bcel.classfile.ConstantPool;
@@ -66,7 +67,7 @@ import org.aspectj.apache.bcel.classfile.ConstantUtf8;
  */
 public abstract class FieldOrMethod extends InstructionCP {
 
-       private String signature;
+       protected String signature;
        private String name;
        private String classname;
 
@@ -79,7 +80,8 @@ public abstract class FieldOrMethod extends InstructionCP {
         */
        public String getSignature(ConstantPool cp) {
                if (signature == null) {
-                       ConstantCP cmr = (ConstantCP) cp.getConstant(index);
+                       Constant c = cp.getConstant(index);
+                       ConstantCP cmr = (ConstantCP) c;
                        ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
                        signature = ((ConstantUtf8) cp.getConstant(cnat.getSignatureIndex())).getValue();
                }
index e610253ac6a50bdd9bf27b3a91eb8ce227da8b11..113be06ee501f762a60375daa4f8626d176c1d71 100644 (file)
@@ -208,6 +208,9 @@ public class Instruction implements Cloneable, Serializable, Constants {
                        case Constants.INVOKEINTERFACE:
                                obj = new INVOKEINTERFACE(bytes.readUnsignedShort(), bytes.readUnsignedByte(), bytes.readByte());
                                break;
+                       case Constants.INVOKEDYNAMIC:
+                               obj = new InvokeDynamic(bytes.readUnsignedShort(),bytes.readUnsignedShort());
+                               break;
                        case Constants.NEWARRAY:
                                obj = new InstructionByte(Constants.NEWARRAY, bytes.readByte());
                                break;
index c327af96cae87d44a8de9bd2679e0b0b4b8ea701..4ff25bd55b7a5c142be4f4459f41df506d006d2c 100644 (file)
@@ -99,6 +99,8 @@ public class InstructionFactory implements InstructionConstants {
                int index;
                if (kind == Constants.INVOKEINTERFACE) {
                        index = cp.addInterfaceMethodref(class_name, name, signature);
+               } else if (kind == Constants.INVOKEDYNAMIC){
+                       throw new IllegalStateException("NYI");
                } else {
                        index = cp.addMethodref(class_name, name, signature);
                }
@@ -125,6 +127,8 @@ public class InstructionFactory implements InstructionConstants {
                int index;
                if (kind == Constants.INVOKEINTERFACE) {
                        index = cp.addInterfaceMethodref(class_name, name, signature);
+               } else if (kind == Constants.INVOKEDYNAMIC){
+                       throw new IllegalStateException("NYI");
                } else {
                        index = cp.addMethodref(class_name, name, signature);
                }
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/InvokeDynamic.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/InvokeDynamic.java
new file mode 100644 (file)
index 0000000..7083500
--- /dev/null
@@ -0,0 +1,116 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache BCEL" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache BCEL", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.aspectj.apache.bcel.generic;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.aspectj.apache.bcel.Constants;
+import org.aspectj.apache.bcel.classfile.ConstantInvokeDynamic;
+import org.aspectj.apache.bcel.classfile.ConstantNameAndType;
+import org.aspectj.apache.bcel.classfile.ConstantPool;
+import org.aspectj.apache.bcel.classfile.ConstantUtf8;
+
+/**
+ * INVOKEDYNAMIC
+ * 
+ * @author Andy Clement
+ */
+public final class InvokeDynamic extends InvokeInstruction {
+
+       public InvokeDynamic(int index, int zeroes) {
+               super(Constants.INVOKEDYNAMIC, index);
+       }
+
+       public void dump(DataOutputStream out) throws IOException {
+               out.writeByte(opcode);
+               out.writeShort(index);
+               out.writeShort(0);
+       }
+       
+       public String toString(ConstantPool cp) {
+               return super.toString(cp) + " " + index;
+       }
+
+       public boolean equals(Object other) {
+               if (!(other instanceof InvokeDynamic)) {
+                       return false;
+               }
+               InvokeDynamic o = (InvokeDynamic) other;
+               return o.opcode == opcode && o.index == index;
+       }
+
+       public int hashCode() {
+               return opcode * 37 + index;
+       }
+       
+       public Type getReturnType(ConstantPool cp) {
+               return Type.getReturnType(getSignature(cp));
+       }
+
+       public Type[] getArgumentTypes(ConstantPool cp) {
+               return Type.getArgumentTypes(getSignature(cp));
+       }
+       
+       public String getSignature(ConstantPool cp) {
+               if (signature == null) {
+                       ConstantInvokeDynamic cid = (ConstantInvokeDynamic)cp.getConstant(index);
+                       ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cid.getNameAndTypeIndex());
+                       signature = ((ConstantUtf8) cp.getConstant(cnat.getSignatureIndex())).getValue();
+               }
+               return signature;
+       }
+
+}
index 3c8483120b5411c12d41271f40e7f74172d120e1..d8b6ba1ac2d99749f66e7633b22977a7bb4c7f62 100644 (file)
@@ -58,6 +58,7 @@ import java.util.Stack;
 import org.aspectj.apache.bcel.classfile.AnnotationDefault;
 import org.aspectj.apache.bcel.classfile.Attribute;
 import org.aspectj.apache.bcel.classfile.AttributeUtils;
+import org.aspectj.apache.bcel.classfile.BootstrapMethods;
 import org.aspectj.apache.bcel.classfile.Code;
 import org.aspectj.apache.bcel.classfile.CodeException;
 import org.aspectj.apache.bcel.classfile.Constant;
@@ -67,7 +68,10 @@ import org.aspectj.apache.bcel.classfile.ConstantFieldref;
 import org.aspectj.apache.bcel.classfile.ConstantFloat;
 import org.aspectj.apache.bcel.classfile.ConstantInteger;
 import org.aspectj.apache.bcel.classfile.ConstantInterfaceMethodref;
+import org.aspectj.apache.bcel.classfile.ConstantInvokeDynamic;
 import org.aspectj.apache.bcel.classfile.ConstantLong;
+import org.aspectj.apache.bcel.classfile.ConstantMethodHandle;
+import org.aspectj.apache.bcel.classfile.ConstantMethodType;
 import org.aspectj.apache.bcel.classfile.ConstantMethodref;
 import org.aspectj.apache.bcel.classfile.ConstantNameAndType;
 import org.aspectj.apache.bcel.classfile.ConstantPool;
@@ -326,6 +330,22 @@ public class DescendingVisitor implements ClassVisitor {
     constant.accept(visitor); 
     stack.pop();
   }
+  
+  public void visitConstantMethodHandle(ConstantMethodHandle constant) {
+         throw new IllegalStateException("nyi");
+  }
+
+  public void visitConstantMethodType(ConstantMethodType obj) {
+         throw new IllegalStateException("nyi");
+  }
+  
+  public void visitConstantInvokeDynamic(ConstantInvokeDynamic obj) {
+         throw new IllegalStateException("nyi");
+  }
+
+  public void visitBootstrapMethods(BootstrapMethods obj) {
+         throw new IllegalStateException("nyi");
+  }
 
   public void visitConstantNameAndType(ConstantNameAndType constant) {
     stack.push(constant);
index 5dbe317b896ac9f43656e078a3e9302415b5d451..cbfd079ca1a1c1670b3940e35dc25e89102b156b 100644 (file)
@@ -55,6 +55,7 @@ package org.aspectj.apache.bcel.verifier;
  */
 
 import org.aspectj.apache.bcel.classfile.AnnotationDefault;
+import org.aspectj.apache.bcel.classfile.BootstrapMethods;
 import org.aspectj.apache.bcel.classfile.Code;
 import org.aspectj.apache.bcel.classfile.CodeException;
 import org.aspectj.apache.bcel.classfile.ConstantClass;
@@ -63,7 +64,10 @@ import org.aspectj.apache.bcel.classfile.ConstantFieldref;
 import org.aspectj.apache.bcel.classfile.ConstantFloat;
 import org.aspectj.apache.bcel.classfile.ConstantInteger;
 import org.aspectj.apache.bcel.classfile.ConstantInterfaceMethodref;
+import org.aspectj.apache.bcel.classfile.ConstantInvokeDynamic;
 import org.aspectj.apache.bcel.classfile.ConstantLong;
+import org.aspectj.apache.bcel.classfile.ConstantMethodHandle;
+import org.aspectj.apache.bcel.classfile.ConstantMethodType;
 import org.aspectj.apache.bcel.classfile.ConstantMethodref;
 import org.aspectj.apache.bcel.classfile.ConstantNameAndType;
 import org.aspectj.apache.bcel.classfile.ConstantPool;
@@ -118,6 +122,9 @@ public class EmptyClassVisitor implements ClassVisitor {
   public void visitConstantInterfaceMethodref(ConstantInterfaceMethodref obj) {}
   public void visitConstantLong(ConstantLong obj) {}
   public void visitConstantMethodref(ConstantMethodref obj) {}
+  public void visitConstantMethodHandle(ConstantMethodHandle obj) {}
+  public void visitConstantMethodType(ConstantMethodType obj) {}
+  public void visitConstantInvokeDynamic(ConstantInvokeDynamic obj) {}
   public void visitConstantNameAndType(ConstantNameAndType obj) {}
   public void visitConstantPool(ConstantPool obj) {}
   public void visitConstantString(ConstantString obj) {}
@@ -130,6 +137,7 @@ public class EmptyClassVisitor implements ClassVisitor {
   public void visitInnerClasses(InnerClasses obj) {}
   public void visitJavaClass(JavaClass obj) {}
   public void visitLineNumber(LineNumber obj) {}
+  public void visitBootstrapMethods(BootstrapMethods obj) {}
   public void visitLineNumberTable(LineNumberTable obj) {}
   public void visitLocalVariable(LocalVariable obj) {}
   public void visitLocalVariableTable(LocalVariableTable obj) {}
diff --git a/lib/asm/asm-4.0.jar b/lib/asm/asm-4.0.jar
new file mode 100644 (file)
index 0000000..6d63075
Binary files /dev/null and b/lib/asm/asm-4.0.jar differ
diff --git a/lib/asm/asm-4.0.renamed.jar b/lib/asm/asm-4.0.renamed.jar
new file mode 100644 (file)
index 0000000..bb506ad
Binary files /dev/null and b/lib/asm/asm-4.0.renamed.jar differ
index 2502b3b61c35c823503947e405026265ee527ae8..ce3b4a7aaa8a4b29bfded62377b645f171aae36d 100644 (file)
@@ -3,9 +3,9 @@
        <!-- if you need this defining, use the jarjar-1.0.jar in this project -->
     <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"/>
 
-       <target name="package" description="Jarjar asm-3.3.1.jar and prefix package name with aj">
-               <jarjar destfile="asm-3.3.1.renamed.jar">
-                 <zipfileset src="asm-3.3.1.jar"/>
+       <target name="package" description="Jarjar asm-4.0.jar and prefix package name with aj">
+               <jarjar destfile="asm-4.0.renamed.jar">
+                 <zipfileset src="asm-4.0.jar"/>
                  <rule pattern="org.objectweb.asm.**" result="aj.org.objectweb.asm.@1"/>
                </jarjar>
        </target> 
index eeded5ee71a3783e46eed456f0e6fcce87fbd68d..b512f9051de9b555b4ff91ca44ba018df769c40e 100644 (file)
Binary files a/lib/bcel/bcel-src.zip and b/lib/bcel/bcel-src.zip differ
index 443b9d8acee84ae299bbd65bcf82702e566c9a69..c764a9a28df2435595580fd55f199defb568c38a 100644 (file)
Binary files a/lib/bcel/bcel-verifier-src.zip and b/lib/bcel/bcel-verifier-src.zip differ
index 0391a965a0d21de310fc6cec31c23fd04acd1c38..fed7db520a560bcdff3fc88cb1a527492a9bfd76 100644 (file)
Binary files a/lib/bcel/bcel-verifier.jar and b/lib/bcel/bcel-verifier.jar differ
index a029381b5041f335f771bfdc41d2768a73f06b7f..c439c077679dffb2d42c2f5f0f393be8791466e7 100644 (file)
Binary files a/lib/bcel/bcel.jar and b/lib/bcel/bcel.jar differ
diff --git a/tests/src/org/aspectj/systemtest/ajc170/IndyTests.java b/tests/src/org/aspectj/systemtest/ajc170/IndyTests.java
new file mode 100644 (file)
index 0000000..24503ce
--- /dev/null
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc170;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.Test;
+
+import org.aspectj.apache.bcel.classfile.ClassParser;
+import org.aspectj.apache.bcel.classfile.Field;
+import org.aspectj.apache.bcel.classfile.JavaClass;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.weaver.TypeFactory;
+import org.aspectj.weaver.UnresolvedType;
+
+/**
+ * @author Andy Clement
+ */ 
+public class IndyTests extends org.aspectj.testing.XMLBasedAjcTestCase {
+
+       // staticinitialization on bytecode containing methodtyperef/methodhandle/bootstrapmethods/invokedynamic
+       public void testInvokeDynamic_staticinitialization() throws IOException {
+               runTest("indy - 1");
+       }
+
+       // execution pointcuts on same bytecode
+       public void testInvokeDynamic_execution() throws IOException {
+               runTest("indy - 2");
+       }
+
+       // ---
+
+       public static Test suite() {
+               return XMLBasedAjcTestCase.loadSuite(IndyTests.class);
+       }
+
+       @Override
+       protected File getSpecFile() {
+               return new File("../tests/src/org/aspectj/systemtest/ajc170/indy.xml");
+       }
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc170/indy.xml b/tests/src/org/aspectj/systemtest/ajc170/indy.xml
new file mode 100644 (file)
index 0000000..0e1b85a
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<suite>
+    <ajc-test dir="indy/one" title="indy - 1">
+      <compile files="Code1.java,Asp.java" inpath="indy.jar" options="-1.7"/>
+      <run class="Invoker">
+      <stdout>
+      <line text="staticinitialization(Invoker.&lt;clinit&gt;)"/>
+      <line text="staticinitialization(Code1.&lt;clinit&gt;)"/>
+      <line text="foo() is running"/>
+      </stdout>
+      </run>
+    </ajc-test>
+    
+    <ajc-test dir="indy/two" title="indy - 2">
+      <compile files="Code1.java,Asp.java" inpath="indy.jar" options="-1.7"/>
+      <run class="Invoker">
+      <stdout>
+      <line text="execution(void Invoker.main(String[]))"/>
+      <line text="execution(CallSite Code1.bootstrap(MethodHandles.Lookup, String, MethodType))"/>
+      <line text="execution(void Code1.foo())"/>
+      <line text="foo() is running"/>
+      </stdout>
+      </run>
+    </ajc-test>
+   
+</suite>
index 803dcce59697d82f2a6fcffccfb9db0d1a1998b4..aeb0703e6a3fef1e7a45e7c2115e2da59eee2a58 100644 (file)
@@ -13,6 +13,6 @@
        <classpathentry kind="lib" path="/lib/bcel/bcel.jar" sourcepath="/lib/bcel/bcel-src.zip"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry combineaccessrules="false" kind="src" path="/org.aspectj.matcher"/>
-       <classpathentry kind="lib" path="/lib/asm/asm-3.3.1.renamed.jar"/>
+       <classpathentry kind="lib" path="/lib/asm/asm-4.0.renamed.jar"/>
        <classpathentry kind="output" path="bin"/>
 </classpath>