]> source.dussan.org Git - aspectj.git/commitdiff
Fix for Bug 82134: AspectJ 5 M2 should implement backwards compatibility for binary...
authoraclement <aclement>
Fri, 7 Jan 2005 14:14:45 +0000 (14:14 +0000)
committeraclement <aclement>
Fri, 7 Jan 2005 14:14:45 +0000 (14:14 +0000)
70 files changed:
tests/src/org/aspectj/systemtest/ajc150/AllTestsJava5_binaryWeaving.java
tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java [new file with mode: 0644]
weaver/src/org/aspectj/weaver/AdviceKind.java
weaver/src/org/aspectj/weaver/AjAttribute.java
weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java
weaver/src/org/aspectj/weaver/VersionedDataInputStream.java [new file with mode: 0644]
weaver/src/org/aspectj/weaver/WeaverStateInfo.java
weaver/src/org/aspectj/weaver/bcel/BcelAttributes.java
weaver/src/org/aspectj/weaver/bcel/BcelField.java
weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
weaver/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java
weaver/src/org/aspectj/weaver/patterns/AndPointcut.java
weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java
weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java
weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java
weaver/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java
weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java
weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java
weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java
weaver/src/org/aspectj/weaver/patterns/BindingTypePattern.java
weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java
weaver/src/org/aspectj/weaver/patterns/Declare.java
weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java
weaver/src/org/aspectj/weaver/patterns/DeclareParents.java
weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java
weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java
weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java
weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java
weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java
weaver/src/org/aspectj/weaver/patterns/IfPointcut.java
weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java
weaver/src/org/aspectj/weaver/patterns/ModifiersPattern.java
weaver/src/org/aspectj/weaver/patterns/NamePattern.java
weaver/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java
weaver/src/org/aspectj/weaver/patterns/NotPointcut.java
weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java
weaver/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java
weaver/src/org/aspectj/weaver/patterns/OrPointcut.java
weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java
weaver/src/org/aspectj/weaver/patterns/PerCflow.java
weaver/src/org/aspectj/weaver/patterns/PerClause.java
weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java
weaver/src/org/aspectj/weaver/patterns/PerObject.java
weaver/src/org/aspectj/weaver/patterns/PerSingleton.java
weaver/src/org/aspectj/weaver/patterns/Pointcut.java
weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java
weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java
weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java
weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java
weaver/src/org/aspectj/weaver/patterns/TypePattern.java
weaver/src/org/aspectj/weaver/patterns/TypePatternList.java
weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java
weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java
weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java
weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java
weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java
weaver/testsrc/org/aspectj/weaver/bcel/PatternWeaveTestCase.java
weaver/testsrc/org/aspectj/weaver/bcel/PointcutResidueTestCase.java
weaver/testsrc/org/aspectj/weaver/patterns/AndOrNotTestCase.java
weaver/testsrc/org/aspectj/weaver/patterns/DeclareErrorOrWarningTestCase.java
weaver/testsrc/org/aspectj/weaver/patterns/ModifiersPatternTestCase.java
weaver/testsrc/org/aspectj/weaver/patterns/NamePatternTestCase.java
weaver/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java
weaver/testsrc/org/aspectj/weaver/patterns/TypePatternListTestCase.java
weaver/testsrc/org/aspectj/weaver/patterns/TypePatternTestCase.java
weaver/testsrc/org/aspectj/weaver/patterns/WithinTestCase.java

index e69327932730a9c4bab6970ab21a2ef49ec31600..353b5d07d4196d1457e915e2f672f3968767967d 100644 (file)
@@ -24,6 +24,7 @@ public class AllTestsJava5_binaryWeaving {
        public static Test suite() {
                TestSuite suite = new TestSuite("Java5 - binary weaving");
                //$JUnit-BEGIN$
+               suite.addTestSuite(MigrationTests.class);
                suite.addTest(Ajc150Tests.suite());
                suite.addTest(AccBridgeMethods.suite());
                suite.addTestSuite(CovarianceTests.class);
diff --git a/tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java b/tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java
new file mode 100644 (file)
index 0000000..869b71b
--- /dev/null
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ *    Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc150;
+
+import java.io.File;
+
+import org.aspectj.tools.ajc.CompilationResult;
+
+
+/**
+ * Checks if we are obeying migration rules. 
+ */
+public class MigrationTests extends TestUtils {
+       
+  protected void setUp() throws Exception {
+       super.setUp();
+       baseDir = new File("../tests/migration");
+  }
+
+  /**
+   * Compile a simple java class with an aspect library built with aspectj 1.2.1 - this
+   * checks that we can load in attributes (especially pointcuts) that were written out
+   * in the 'old way'
+   *
+   */
+  public void testMigrationFrom121_pointcutsAndAdvice() {
+       CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects121.jar","Program.java"});
+       System.err.println(cR.getStandardError());
+       assertTrue("Should not coredump: "+cR.getStandardError(),cR.getStandardError().indexOf("Dumping to ajcore")==-1);
+    assertTrue("Should be no error messages: \n"+cR.getErrorMessages(),cR.getErrorMessages().size()==0);
+    File f = new File(ajc.getSandboxDirectory()+File.separator+"Program.class");
+    assertTrue("Missing class file",f.exists());
+       run("Program");
+  }
+  
+//  /**
+//   * We cannot support all aspects built prior to AspectJ 1.2.1 - so we don't support any.
+//   * There are probably many reasons but the first one I've hit is:
+//   * - Changes for cflow optimizations (counters instead of stacks where we can) mean that an aspect
+//   *   compiled at AspectJ1.2.0 will contain stack cases but AspectJ1.5.0 will look for counter
+//   *   fields in some cases.
+//   * 
+//   * This means we should get a reasonable failure message in this case.
+//   */
+//  public void testMigrationFrom120_pointcutsAndAdvice() {
+//     CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects120.jar","Program.java"});
+//     assertTrue("Should have failed",cR.getFailMessages().size()>0);
+//     assertTrue("Should have produced nice message",cR.getFailMessages().get(0).toString().indexOf("Unable to continue")!=-1);
+//  }
+}
\ No newline at end of file
index 55fbb1e971441bed5e8b45cbfb028bf61b633227..abc560386051c1d1605e2702955f6e85edabd6f9 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataInputStream;
 import java.io.IOException;
 
 import org.aspectj.util.TypeSafeEnum;
@@ -35,7 +34,7 @@ public class AdviceKind extends TypeSafeEnum {
        this.isCflow = isCflow;
     }
     
-    public static AdviceKind read(DataInputStream s) throws IOException {
+    public static AdviceKind read(VersionedDataInputStream s) throws IOException {
         int key = s.readByte();
         switch(key) {
             case 1: return Before;
index c1d631e6cc60213faa1fe7bb9a1eea13060c852d..8bb1f6a9c623c8f9e5fc97c2d51789c509aa3629 100644 (file)
@@ -15,7 +15,6 @@ package org.aspectj.weaver;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
@@ -82,11 +81,12 @@ public abstract class AjAttribute {
                        throw new RuntimeException("sanity check");
                }
        }
-
-       public static AjAttribute read(String name, byte[] bytes, ISourceContext context,IMessageHandler msgHandler) {
+       
+       public static AjAttribute read(AjAttribute.WeaverVersionInfo v, String name, byte[] bytes, ISourceContext context,IMessageHandler msgHandler) {
                try {
                        if (bytes == null) bytes = new byte[0];
-                       DataInputStream s = new DataInputStream(new ByteArrayInputStream(bytes));
+                       VersionedDataInputStream s = new VersionedDataInputStream(new ByteArrayInputStream(bytes));
+                       s.setVersion(v);
                        if (name.equals(Aspect.AttributeName)) {
                                return new Aspect(PerClause.readPerClause(s, context));
                        } else if (name.equals(MethodDeclarationLineNumberAttribute.AttributeName)) {
@@ -196,13 +196,25 @@ public abstract class AjAttribute {
                // The user will get a warning for any org.aspectj.weaver attributes the weaver does
                // not recognize.
                
+               // When we don't know ... (i.e. pre 1.2.1)
+               public static short WEAVER_VERSION_MAJOR_UNKNOWN = 0;
+               public static short WEAVER_VERSION_MINOR_UNKNOWN = 0;
+               
+               
                // These are the weaver major/minor numbers for AspectJ 1.2.1
-               private static short WEAVER_VERSION_MAJOR_AJ121 = 1;
-               private static short WEAVER_VERSION_MINOR_AJ121 = 0;
+               public static short WEAVER_VERSION_MAJOR_AJ121 = 1;
+               public static short WEAVER_VERSION_MINOR_AJ121 = 0;
+               
+               // These are the weaver major/minor numbers for AspectJ 1.5.0
+               public static short WEAVER_VERSION_MAJOR_AJ150 = 2;
+               public static short WEAVER_VERSION_MINOR_AJ150 = 0;
                
                // These are the weaver major/minor versions for *this* weaver
-               private static short CURRENT_VERSION_MAJOR      = WEAVER_VERSION_MAJOR_AJ121;
-               private static short CURRENT_VERSION_MINOR      = WEAVER_VERSION_MINOR_AJ121;
+               private static short CURRENT_VERSION_MAJOR      = WEAVER_VERSION_MAJOR_AJ150;
+               private static short CURRENT_VERSION_MINOR      = WEAVER_VERSION_MINOR_AJ150;
+               
+               public static final WeaverVersionInfo UNKNOWN = 
+                       new WeaverVersionInfo(WEAVER_VERSION_MAJOR_UNKNOWN,WEAVER_VERSION_MINOR_UNKNOWN);
                
                // These are the versions read in from a particular class file.
                private short major_version; 
@@ -228,10 +240,12 @@ public abstract class AjAttribute {
                        s.writeShort(CURRENT_VERSION_MINOR);
                }
                
-               public static WeaverVersionInfo read(DataInputStream s) throws IOException {
+               public static WeaverVersionInfo read(VersionedDataInputStream s) throws IOException {
                        short major = s.readShort();
                        short minor = s.readShort();
-                       return new WeaverVersionInfo(major,minor);
+                       WeaverVersionInfo wvi = new WeaverVersionInfo(major,minor);
+//                     s.setVersion(wvi);              
+                       return wvi;
                }
                
                public short getMajorVersion() {
@@ -279,7 +293,7 @@ public abstract class AjAttribute {
                        FileUtil.writeIntArray(lineBreaks, s);
                }
                
-               public static SourceContextAttribute read(DataInputStream s) throws IOException {
+               public static SourceContextAttribute read(VersionedDataInputStream s) throws IOException {
                        return new SourceContextAttribute(s.readUTF(), FileUtil.readIntArray(s));
                }
                public int[] getLineBreaks() {
@@ -311,7 +325,7 @@ public abstract class AjAttribute {
                        s.writeInt(lineNumber);
                }
                
-               public static MethodDeclarationLineNumberAttribute read(DataInputStream s) throws IOException {
+               public static MethodDeclarationLineNumberAttribute read(VersionedDataInputStream s) throws IOException {
                        return new MethodDeclarationLineNumberAttribute(s.readInt());
                }
 
@@ -417,7 +431,7 @@ public abstract class AjAttribute {
                        this.declaredExceptions = declaredExceptions;
                }
                
-               public static AdviceAttribute read(DataInputStream s, ISourceContext context) throws IOException {
+               public static AdviceAttribute read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                        AdviceKind kind = AdviceKind.read(s);
                        if (kind == AdviceKind.Around) {
                                return new AdviceAttribute(
@@ -544,7 +558,7 @@ public abstract class AjAttribute {
                        return accessedMembers;
                }
 
-               public static PrivilegedAttribute read(DataInputStream s, ISourceContext context) throws IOException {
+               public static PrivilegedAttribute read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                        return new PrivilegedAttribute(ResolvedMember.readResolvedMemberArray(s, context));
                }
        }       
@@ -571,7 +585,7 @@ public abstract class AjAttribute {
                        s.writeBoolean(weaveBody);
                }               
 
-               public static EffectiveSignatureAttribute read(DataInputStream s, ISourceContext context) throws IOException {
+               public static EffectiveSignatureAttribute read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                        return new EffectiveSignatureAttribute(
                                        ResolvedMember.readResolvedMember(s, context),
                                        Shadow.Kind.read(s),
index c5539a5fe21d53625def6abe74c0fabf570c7689..7492438100de738a0266d6399070b9d4c38aafdb 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
@@ -52,7 +51,7 @@ public class ResolvedPointcutDefinition extends ResolvedMember {
                pointcut.write(s);
        }
        
-       public static ResolvedPointcutDefinition read(DataInputStream s, ISourceContext context) throws IOException {
+       public static ResolvedPointcutDefinition read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                return new ResolvedPointcutDefinition(
                        TypeX.read(s),
                        s.readInt(),
diff --git a/weaver/src/org/aspectj/weaver/VersionedDataInputStream.java b/weaver/src/org/aspectj/weaver/VersionedDataInputStream.java
new file mode 100644 (file)
index 0000000..a9f2396
--- /dev/null
@@ -0,0 +1,31 @@
+/* *******************************************************************
+ * Copyright (c) 2005 IBM
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Common Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/cpl-v10.html 
+ *  
+ * Contributors: 
+ *     Andy Clement           initial implementation
+ * ******************************************************************/
+
+package org.aspectj.weaver;    
+
+import java.io.DataInputStream;
+import java.io.InputStream;
+
+import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
+
+/**
+ * Lightweight subclass of DataInputStream that knows what version of the weaver was used to construct the data in it.
+ */
+public class VersionedDataInputStream extends DataInputStream {
+       private WeaverVersionInfo version = new WeaverVersionInfo();// assume we are the latest unless something tells us otherwise...
+       public VersionedDataInputStream(InputStream is) { super(is); }
+       
+       public int getMajorVersion() { return version.getMajorVersion(); }
+       public int getMinorVersion() { return version.getMinorVersion(); }
+       
+       public void setVersion(WeaverVersionInfo version) { this.version = version; }
+}
\ No newline at end of file
index 4b1a1a7b69ee503033f11e7427d994971884a837..a2fc8eacbfeaf9e8ccd5b07981a888c32503bd27 100644 (file)
@@ -84,7 +84,7 @@ public class WeaverStateInfo {
        private static final byte REWEAVABLE_BIT             = 1<<4;
        private static final byte REWEAVABLE_COMPRESSION_BIT = 1<<5;
        
-       public static final WeaverStateInfo read(DataInputStream s, ISourceContext context) throws IOException {
+       public static final WeaverStateInfo read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                byte b = s.readByte();
                
                boolean isReweavable = ((b&REWEAVABLE_BIT)!=0);
index 9fb4b451e4306c8b4e19f01d681c8f866cd19777..f43ab8f2bab8aaaca68be5683f8f9681544e049d 100644 (file)
@@ -21,22 +21,35 @@ import org.aspectj.apache.bcel.classfile.Unknown;
 import org.aspectj.apache.bcel.generic.ConstantPoolGen;
 import org.aspectj.bridge.IMessageHandler;
 import org.aspectj.weaver.AjAttribute;
+import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.ISourceContext;
+import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
 
 
 // this is a class o' static methods for reading attributes.  It's pretty much a bridge from 
 // bcel to AjAttribute.
 class BcelAttributes {
 
-       public static List readAjAttributes(Attribute[] as, ISourceContext context,IMessageHandler msgHandler) {
+       public static List readAjAttributes(String classname,Attribute[] as, ISourceContext context,IMessageHandler msgHandler) {
                List l = new ArrayList();
+               AjAttribute.WeaverVersionInfo version = new WeaverVersionInfo();
                for (int i = as.length - 1; i >= 0; i--) {
                        Attribute a = as[i];
                        if (a instanceof Unknown) {
                                Unknown u = (Unknown) a;
                                String name = u.getName();
                                if (name.startsWith(AjAttribute.AttributePrefix)) {
-                                       AjAttribute attr = AjAttribute.read(name, u.getBytes(), context,msgHandler);
+                                       AjAttribute attr = AjAttribute.read(version,name,u.getBytes(),context,msgHandler); 
+                                       if (attr!=null && attr instanceof AjAttribute.WeaverVersionInfo) {
+                                               version = (AjAttribute.WeaverVersionInfo)attr;
+                                               
+                                               // Do a version check, this weaver can't process versions 
+                                               // from a future AspectJ (where the major number has changed)
+                                               if (version.getMajorVersion() > WeaverVersionInfo.getCurrentWeaverMajorVersion()) {
+                                                       throw new BCException("Unable to continue, this version of AspectJ supports classes built with weaver version "+
+                                                                       WeaverVersionInfo.toCurrentVersionString()+" but the class "+classname+" is version "+version.toString());
+                                               }
+                                       }
                                        if (attr!=null) l.add(attr);
                                }
                        }
index 230513585b1689268e977720e9eb2e41a714a64e..042947543cc4c2a855d69f7ff53c6dc961af557f 100644 (file)
@@ -52,7 +52,7 @@ final class BcelField extends ResolvedMember {
        
        private void unpackAttributes(World world) {
                Attribute[] attrs = field.getAttributes();
-               List as = BcelAttributes.readAjAttributes(attrs, getSourceContext(world),world.getMessageHandler());
+               List as = BcelAttributes.readAjAttributes(getDeclaringType().getClassName(),attrs, getSourceContext(world),world.getMessageHandler());
                for (Iterator iter = as.iterator(); iter.hasNext();) {
                        AjAttribute a = (AjAttribute) iter.next();
                        if (a instanceof AjAttribute.AjSynthetic) {
index e7725f37408fa06ecfe93de891a5ec4d50a66208..e3e2de98e0fd2fbf2c9bc617cc0600c7b6724e05 100644 (file)
@@ -90,7 +90,7 @@ final class BcelMethod extends ResolvedMember {
        }
 
        private void unpackAjAttributes(World world) {
-               List as = BcelAttributes.readAjAttributes(method.getAttributes(), getSourceContext(world),world.getMessageHandler());
+               List as = BcelAttributes.readAjAttributes(getDeclaringType().getClassName(),method.getAttributes(), getSourceContext(world),world.getMessageHandler());
                //System.out.println("unpack: " + this + ", " + as);
                for (Iterator iter = as.iterator(); iter.hasNext();) {
                        AjAttribute a = (AjAttribute) iter.next();
index 9ccd7ad6de81091fb345056d008ccfcc0bc9c16d..34f9c6577e40bdc905ef3c8ae62ea9a4c6f91ce9 100644 (file)
@@ -35,7 +35,6 @@ import org.aspectj.weaver.ResolvedPointcutDefinition;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.TypeX;
 import org.aspectj.weaver.WeaverStateInfo;
-import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
 import org.aspectj.weaver.patterns.PerClause;
 
 // ??? exposed for testing
@@ -169,7 +168,7 @@ public class BcelObjectType extends ResolvedTypeX.ConcreteName {
                List pointcuts = new ArrayList();
                typeMungers = new ArrayList();
                declares = new ArrayList();
-               List l = BcelAttributes.readAjAttributes(javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),getResolvedTypeX().getWorld().getMessageHandler());
+               List l = BcelAttributes.readAjAttributes(javaClass.getClassName(),javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),getResolvedTypeX().getWorld().getMessageHandler());
                for (Iterator iter = l.iterator(); iter.hasNext();) {
                        AjAttribute a = (AjAttribute) iter.next();
                        //System.err.println("unpacking: " + this + " and " + a);
@@ -190,20 +189,19 @@ public class BcelObjectType extends ResolvedTypeX.ConcreteName {
                                        ((BcelSourceContext)getResolvedTypeX().getSourceContext()).addAttributeInfo((AjAttribute.SourceContextAttribute)a);
                                }
                        } else if (a instanceof AjAttribute.WeaverVersionInfo) {
-                               wvInfo = (AjAttribute.WeaverVersionInfo)a;
-                               if (wvInfo.getMajorVersion() > WeaverVersionInfo.getCurrentWeaverMajorVersion()) {
-                                       // The class file containing this attribute was created by a version of AspectJ that
-                                       // added some behavior that 'this' version of AspectJ doesn't understand.  And the
-                                       // class file contains changes that mean 'this' version of AspectJ cannot continue.
-                                       throw new BCException("Unable to continue, this version of AspectJ supports classes built with weaver version "+
-                                                       WeaverVersionInfo.toCurrentVersionString()+" but the class "+ javaClass.getClassName()+" is version "+wvInfo.toString());
-                               }
+                               wvInfo = (AjAttribute.WeaverVersionInfo)a; // Set the weaver version used to build this type
                        } else {
                                throw new BCException("bad attribute " + a);
                        }
                }
                this.pointcuts = (ResolvedPointcutDefinition[]) 
                        pointcuts.toArray(new ResolvedPointcutDefinition[pointcuts.size()]);
+               // Test isn't quite right, leaving this out for now...
+//             if (isAspect() && wvInfo.getMajorVersion() == WeaverVersionInfo.UNKNOWN.getMajorVersion()) {
+//                     throw new BCException("Unable to continue, this version of AspectJ cannot use aspects as input that were built "+
+//                                     "with an AspectJ earlier than version 1.2.1.  Please rebuild class: "+javaClass.getClassName());
+//             }
+               
 //             this.typeMungers = (BcelTypeMunger[]) 
 //                     typeMungers.toArray(new BcelTypeMunger[typeMungers.size()]);
 //             this.declares = (Declare[])
index dc7741c4ccd5868cfbc11a2fec0a00cc47500dfd..9c002bd9c10478782127d60043b9f69ccafe8189 100644 (file)
@@ -441,7 +441,7 @@ public final class LazyMethodGen {
                if (enclosingClass != null && enclosingClass.getType() != null) {
                        context = enclosingClass.getType().getSourceContext();
                }
-               List as = BcelAttributes.readAjAttributes(attributes, context,null);
+               List as = BcelAttributes.readAjAttributes(getClassName(),attributes, context,null);
                if (! as.isEmpty()) {
                        out.println("    " + as.get(0)); // XXX assuming exactly one attribute, munger...
                }
index 47ec35969c1d6423049e36492ad59691a680bc6c..018a0e8fcc492415d5ddc095c44865e6d3ad1639 100644 (file)
@@ -9,13 +9,13 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.ISourceContext;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 
 /**
@@ -54,7 +54,7 @@ public class AndAnnotationTypePattern extends AnnotationTypePattern {
                return this;
        }
        
-       public static AnnotationTypePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                AnnotationTypePattern p = new AndAnnotationTypePattern(
                                AnnotationTypePattern.read(s,context),
                                AnnotationTypePattern.read(s,context));
index dcb951d462f3aef0b369c98b19a4448ce77693b9..4bb8b1ce40a0afa01086677967bd520909c05c42 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Member;
@@ -26,6 +25,7 @@ import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.ast.Test;
 
 public class AndPointcut extends Pointcut {
@@ -120,7 +120,7 @@ public class AndPointcut extends Pointcut {
                writeLocation(s);
        }
        
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                AndPointcut ret = new AndPointcut(Pointcut.read(s, context), Pointcut.read(s, context));
                ret.readLocation(context, s);
                return ret;
index 5258151fa44e45561da8f4890d19e813abe4f326..d72b84371df2f5e2dd7ad1069b4893a66b654ab6 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 
 /**
  * left && right
@@ -75,7 +75,7 @@ public class AndTypePattern extends TypePattern {
                writeLocation(s);
        }
        
-       public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                TypePattern ret = new AndTypePattern(TypePattern.read(s, context), TypePattern.read(s, context));
                ret.readLocation(context, s);
                return ret;
index d586a824c525be3ed5cf1c0e932183fe966ca1b7..8361e65e459579bc1aa135ffb6a2179a8685694b 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.List;
@@ -18,6 +17,7 @@ import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 
 /**
@@ -155,7 +155,7 @@ public class AnnotationPatternList extends PatternNode {
         return result;
     }
     
-       public static AnnotationPatternList read(DataInputStream s, ISourceContext context) throws IOException  {
+       public static AnnotationPatternList read(VersionedDataInputStream s, ISourceContext context) throws IOException  {
                short len = s.readShort();
                AnnotationTypePattern[] arguments = new AnnotationTypePattern[len];
                for (int i=0; i<len; i++) {
index d8b378a9b03ae3bc396eadb3156337c8e6432a35..8cc80a37a5921c2f5c0af13fd4b2b73100e17bbc 100644 (file)
@@ -10,7 +10,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -29,6 +28,7 @@ import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.ShadowMunger;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
 import org.aspectj.weaver.ast.Var;
@@ -194,7 +194,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
                writeLocation(s);
        }
 
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                AnnotationTypePattern type = AnnotationTypePattern.read(s, context);
                AnnotationPointcut ret = new AnnotationPointcut((ExactAnnotationTypePattern)type);
                ret.readLocation(context, s);
index df5952b72e683e4041ed3feaede2e7932a1b2482..df25c75fb70bdc2e1eea4de4e85f9a4e4a6a3f8b 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
@@ -18,6 +17,7 @@ import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 
 public abstract class AnnotationTypePattern extends PatternNode {
@@ -64,7 +64,7 @@ public abstract class AnnotationTypePattern extends PatternNode {
        public static final byte ANY_KEY = 7;
        public static final byte WILD = 8;
 
-       public static AnnotationTypePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                byte key = s.readByte();
                switch(key) {
                        case EXACT: return ExactAnnotationTypePattern.read(s, context);
index d78dd875134dd44bc3abdfd3af1e52bd7720d623..ff3336d62d0fa881ff2d0cb86ed6979f3cc139bc 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -26,6 +25,7 @@ import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
@@ -182,7 +182,7 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut {
                writeLocation(s);
        }
        
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                AnnotationPatternList annotationPatternList = AnnotationPatternList.read(s,context);
                ArgsAnnotationPointcut ret = new ArgsAnnotationPointcut(annotationPatternList);
                ret.readLocation(context, s);
index aaa780cdd3151a5c7a22c8c5855157ad41fa4d86..15198d92deb7bd92264e33b5803d3e19912fd5ef 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
@@ -39,6 +38,7 @@ import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
@@ -170,7 +170,7 @@ public class ArgsPointcut extends NameBindingPointcut {
                writeLocation(s);
        }
        
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                ArgsPointcut ret = new ArgsPointcut(TypePatternList.read(s, context));
                ret.readLocation(context, s);
                return ret;
index a140e91493670592b719e7a6bd05bc098c190601..df35459eb8d4bd9d2a1ca5d1f68be08fed909f47 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
@@ -19,6 +18,7 @@ import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.World;
 
@@ -103,7 +103,7 @@ public class BindingAnnotationTypePattern extends ExactAnnotationTypePattern imp
                writeLocation(s);
        }       
        
-       public static AnnotationTypePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                byte version = s.readByte();
                if (version > VERSION) {
                        throw new BCException("BindingAnnotationTypePattern was written by a more recent version of AspectJ");
index b49b75f8bb405d3ab3656a5fd41fca3f38568c0c..7a2488459750b6553cd19e51a80b15bea089e22b 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 
 public class BindingTypePattern extends ExactTypePattern implements BindingPattern {
        private int formalIndex;
@@ -59,7 +59,7 @@ public class BindingTypePattern extends ExactTypePattern implements BindingPatte
                writeLocation(out);
        }
        
-       public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                TypePattern ret = new BindingTypePattern(TypeX.read(s), s.readShort(), s.readBoolean());
                ret.readLocation(context, s);
                return ret;
index 7203339f8928af68de3f15497cf71075a09ffdbc..b8d1348f793b53cfd74f03a7c424e997ee9a6564 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
@@ -37,6 +36,7 @@ import org.aspectj.weaver.ResolvedPointcutDefinition;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Test;
@@ -106,7 +106,7 @@ public class CflowPointcut extends Pointcut {
                FileUtil.writeIntArray(freeVars, s);
                writeLocation(s);
        }
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
 
                CflowPointcut ret = new CflowPointcut(Pointcut.read(s, context), s.readBoolean(), FileUtil.readIntArray(s));
                ret.readLocation(context, s);
index 010a306a1d4c7de298b47c4b858d39f15b2a98ac..c0339431679dcffb8034acae98de348aa1c9fbff 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.IOException;
 
 import org.aspectj.weaver.ISourceContext;
+import org.aspectj.weaver.VersionedDataInputStream;
 
 public abstract class Declare extends PatternNode {
        public static final byte ERROR_OR_WARNING = 1;
@@ -24,7 +24,7 @@ public abstract class Declare extends PatternNode {
        public static final byte SOFT = 3;
        public static final byte DOMINATES = 4;
 
-       public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                byte kind = s.readByte();
                switch (kind) {
                        case ERROR_OR_WARNING:
index 051b44d817dfd907f65f05f033e92154e35e1e1d..33321dd734e016f0d935fe7e5f2a997ef6d80ae1 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.weaver.ISourceContext;
+import org.aspectj.weaver.VersionedDataInputStream;
 
 public class DeclareErrorOrWarning extends Declare {
        private boolean isError;
@@ -67,7 +67,7 @@ public class DeclareErrorOrWarning extends Declare {
                writeLocation(s);
        }
 
-       public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                Declare ret = new DeclareErrorOrWarning(
                        s.readBoolean(),
                        Pointcut.read(s, context),
index abb93d4b498d19102ca7c9a79e12bd07a06d41c9..a6bbe0af1a37ed3d8422c1d9ad92caf96c712a90 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -24,6 +23,7 @@ import org.aspectj.bridge.IMessage;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.World;
 
@@ -86,7 +86,7 @@ public class DeclareParents extends Declare {
                writeLocation(s);
        }
 
-       public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                Declare ret = new DeclareParents(TypePattern.read(s, context), TypePatternList.read(s, context));
                ret.readLocation(context, s);
                return ret;
index 19686b063197b82e5ea28235c352d1d71fffb7c8..02f59df487cece23632f2ba5d3c8919e3151425e 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.List;
@@ -21,6 +20,7 @@ import java.util.List;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 
 public class DeclarePrecedence extends Declare {
@@ -60,7 +60,7 @@ public class DeclarePrecedence extends Declare {
                writeLocation(s);
        }
 
-       public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                Declare ret = new DeclarePrecedence(TypePatternList.read(s, context));
                ret.readLocation(context, s);
                return ret;
index 766df62d2f8aaccc74ec5d0d33d9fbcde8d3284e..b794c9459197207c30acb43b4c527419366558b5 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
@@ -21,6 +20,7 @@ import org.aspectj.bridge.IMessage;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 
 public class DeclareSoft extends Declare {
@@ -65,7 +65,7 @@ public class DeclareSoft extends Declare {
                writeLocation(s);
        }
 
-       public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                Declare ret = new DeclareSoft(
                        TypePattern.read(s, context),
                        Pointcut.read(s, context)
index 61b1eaa13b389fbdf8e918450818547a9c80647c..b4a67924bfffb2132134475187706ad49fc8a12d 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
@@ -21,6 +20,7 @@ import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.World;
 
@@ -151,7 +151,7 @@ public class ExactAnnotationTypePattern extends AnnotationTypePattern {
                writeLocation(s);
        }
 
-       public static AnnotationTypePattern read(DataInputStream s,ISourceContext context) throws IOException {
+       public static AnnotationTypePattern read(VersionedDataInputStream s,ISourceContext context) throws IOException {
                AnnotationTypePattern ret;
                byte version = s.readByte();
                if (version > VERSION) {
index 2f150d3f473e3206c0166fae888bd4d2e956e209..1339c4dd8a63fc21a627511a01a81844dfaf9cca 100644 (file)
@@ -20,10 +20,12 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.AjAttribute;
 import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 
 public class ExactTypePattern extends TypePattern {
        protected TypeX type;
@@ -197,7 +199,15 @@ public class ExactTypePattern extends TypePattern {
                writeLocation(out);
        }
        
-       public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
+               if (s.getMajorVersion()>=AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) {
+                       return readTypePattern150(s,context);
+               } else {
+                       return readTypePatternOldStyle(s,context);
+           }
+    }
+       
+       public static TypePattern readTypePattern150(VersionedDataInputStream s, ISourceContext context) throws IOException {
                byte version = s.readByte();
                if (version > EXACT_VERSION) throw new BCException("ExactTypePattern was written by a more recent version of AspectJ");
                TypePattern ret = new ExactTypePattern(TypeX.read(s), s.readBoolean(), s.readBoolean());
@@ -206,7 +216,13 @@ public class ExactTypePattern extends TypePattern {
                return ret;
        }
 
-    public String toString() {
+       public static TypePattern readTypePatternOldStyle(DataInputStream s, ISourceContext context) throws IOException {
+               TypePattern ret = new ExactTypePattern(TypeX.read(s), s.readBoolean(),false);
+               ret.readLocation(context, s);
+               return ret;
+       }
+
+       public String toString() {
                StringBuffer buff = new StringBuffer();
                if (annotationPattern != AnnotationTypePattern.ANY) {
                        buff.append('(');
index 398763788bb6f7782643980a56053a1a48444ead..0c3b80385e7099b786b858c80e2c8f4f059d0156 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Member;
@@ -26,6 +25,7 @@ import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
 import org.aspectj.weaver.internal.tools.PointcutExpressionImpl;
@@ -128,7 +128,7 @@ public class HandlerPointcut extends Pointcut {
                writeLocation(s);
        }
        
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                HandlerPointcut ret = new HandlerPointcut(TypePattern.read(s, context));
                ret.readLocation(context, s);
                return ret;
index 612d18a01f1e7b0b05429d323b577f1f3d091c6e..b15d81a39d86090c66767ddd555ee742095882ab 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Member;
@@ -33,6 +32,7 @@ import org.aspectj.weaver.ResolvedPointcutDefinition;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.ShadowMunger;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.ast.Expr;
 import org.aspectj.weaver.ast.Literal;
@@ -100,7 +100,7 @@ public class IfPointcut extends Pointcut {
                s.writeByte(extraParameterFlags);
                writeLocation(s);
        }
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                IfPointcut ret = new IfPointcut(ResolvedMember.readResolvedMember(s, context), s.readByte());
                ret.readLocation(context, s);
                return ret;
index 611dbe4f62025291fdc72bc150f9ef08b7464cdc..26749020b0d0357dbae88324b0a292fb25038e17 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.HashSet;
@@ -31,6 +30,7 @@ import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.ShadowMunger;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
@@ -257,7 +257,7 @@ public class KindedPointcut extends Pointcut {
                writeLocation(s);
        }
        
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                Shadow.Kind kind = Shadow.Kind.read(s);
                SignaturePattern sig = SignaturePattern.read(s, context);
                KindedPointcut ret = new KindedPointcut(kind, sig);
index f60eecc3b477cc310271d8202b93a10c613c8ab6..ad11cfd1270ef6a57d0eb27ebc97a8a9edd7a84d 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.aspectj.weaver.VersionedDataInputStream;
+
 public class ModifiersPattern extends PatternNode {
        private int requiredModifiers;
        private int forbiddenModifiers;
@@ -58,7 +59,7 @@ public class ModifiersPattern extends PatternNode {
        }
        
 
-       public static ModifiersPattern read(DataInputStream s) throws IOException {
+       public static ModifiersPattern read(VersionedDataInputStream s) throws IOException {
                int requiredModifiers = s.readShort();
                int forbiddenModifiers = s.readShort();
                if (requiredModifiers == 0 && forbiddenModifiers == 0) return ANY;
index 361060faf1cb12e074f80f6dd59fa9ac0b62744c..9ede44bf2221d5aebd7000429e1b6324adbe37a4 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.aspectj.weaver.VersionedDataInputStream;
+
 public class NamePattern extends PatternNode {
        char[] pattern;
        int starCount = 0;
@@ -135,7 +136,7 @@ public class NamePattern extends PatternNode {
                out.writeUTF(new String(pattern));
        }
        
-       public static NamePattern read(DataInputStream in) throws IOException {
+       public static NamePattern read(VersionedDataInputStream in) throws IOException {
                String s = in.readUTF();
                if (s.length() == 0) return ELLIPSIS;
                return new NamePattern(s);
index 869bbf43cd4128c7af66d880c8abec056b3bb7f2..694cf4652422589c822575351a83faba1250759f 100644 (file)
@@ -9,13 +9,13 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.ISourceContext;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 
 public class NotAnnotationTypePattern extends AnnotationTypePattern {
@@ -59,7 +59,7 @@ public class NotAnnotationTypePattern extends AnnotationTypePattern {
                writeLocation(s);
        }
 
-       public static AnnotationTypePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                AnnotationTypePattern ret = new NotAnnotationTypePattern(AnnotationTypePattern.read(s,context));
                ret.readLocation(context,s);
                return ret;
index ea2587ed57c3eb618718465569d837ad3898d2b4..bdbecfcbf7b47453f3668e5ebd4f616fa5179bcc 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Member;
@@ -25,6 +24,7 @@ import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.ast.Test;
 
 public class NotPointcut extends Pointcut {
@@ -117,7 +117,7 @@ public class NotPointcut extends Pointcut {
                writeLocation(s);
        }
        
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                NotPointcut ret = new NotPointcut(Pointcut.read(s, context));
                ret.readLocation(context, s);
                return ret;
index 2e6ab0a43eb34c549b89b060487fdfb244bdc4b9..772b4cdd4905e6720696ebf0f2b815475f337c7c 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 
 /**
  * !TypePattern
@@ -76,7 +76,7 @@ public class NotTypePattern extends TypePattern {
                writeLocation(s);
        }
        
-       public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                TypePattern ret = new NotTypePattern(TypePattern.read(s, context));
                ret.readLocation(context, s);
                return ret;
index 7c7c12fcafd8107f2484ca6f6dc8bb5d4ccfe07a..6bdf616e418fb4567e02b9fd40d0921fad6b2bc9 100644 (file)
@@ -9,13 +9,13 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.ISourceContext;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 
 public class OrAnnotationTypePattern extends AnnotationTypePattern {
@@ -48,7 +48,7 @@ public class OrAnnotationTypePattern extends AnnotationTypePattern {
                return this;
        }
 
-       public static AnnotationTypePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                AnnotationTypePattern p = new OrAnnotationTypePattern(
                                AnnotationTypePattern.read(s,context),
                                AnnotationTypePattern.read(s,context));
index 2eca6de019e9212f94d258e2e217f124228eecea..d5fd12471168a7e8bec68d6aefbc64298cf8ee7b 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Member;
@@ -26,6 +25,7 @@ import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.ast.Test;
 
 public class OrPointcut extends Pointcut {
@@ -123,7 +123,7 @@ public class OrPointcut extends Pointcut {
                writeLocation(s);
        }
        
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                OrPointcut ret = new OrPointcut(Pointcut.read(s, context), Pointcut.read(s, context));
                ret.readLocation(context, s);
                return ret;
index 4d8e6316cc47b75ca958b99f30cd2e53431bd584..0d51c464edd0789b3bb58e3d7ef88acf069811f0 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 
 /**
  * left || right
@@ -79,7 +79,7 @@ public class OrTypePattern extends TypePattern {
                writeLocation(s);
        }
        
-       public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                TypePattern ret = new OrTypePattern(TypePattern.read(s, context), TypePattern.read(s, context));
                ret.readLocation(context, s);
                return ret;
index d03daa5eb9b56f02816b28b19eca7adb0de156dc..3c7c2067f0a12613071c2d5a84693b6a130cb3cd 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
@@ -33,6 +32,7 @@ import org.aspectj.weaver.ResolvedMember;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Expr;
 import org.aspectj.weaver.ast.Test;
@@ -105,7 +105,7 @@ public class PerCflow extends PerClause {
        writeLocation(s);
     }
     
-       public static PerClause readPerClause(DataInputStream s, ISourceContext context) throws IOException {
+       public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException {
                PerCflow ret = new PerCflow(Pointcut.read(s, context), s.readBoolean());
                ret.readLocation(context, s);
                return ret;
index 632778c9e018f172970c99d074610463963b5659..5bff424ebf1014bd2299a53b996a241f6125033c 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.IOException;
 
 import org.aspectj.util.TypeSafeEnum;
@@ -22,7 +21,7 @@ import org.aspectj.weaver.*;
 public abstract class PerClause extends Pointcut {
        protected ResolvedTypeX inAspect;
 
-       public static PerClause readPerClause(DataInputStream s, ISourceContext context) throws IOException {
+       public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException {
                Kind kind = Kind.read(s);
                if (kind == SINGLETON) return PerSingleton.readPerClause(s, context);
                else if (kind == PERCFLOW) return PerCflow.readPerClause(s, context);
@@ -43,7 +42,7 @@ public abstract class PerClause extends Pointcut {
        public static class Kind extends TypeSafeEnum {
         public Kind(String name, int key) { super(name, key); }
         
-        public static Kind read(DataInputStream s) throws IOException {
+        public static Kind read(VersionedDataInputStream s) throws IOException {
             int key = s.readByte();
             switch(key) {
                 case 1: return SINGLETON;
index c7274ea81f8546cbe35d79446cc407f87032a969..d7841008efc20e9326cd931c65f5a6ade6e103e7 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Set;
@@ -23,6 +22,7 @@ import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.ast.Test;
 
@@ -88,7 +88,7 @@ public class PerFromSuper extends PerClause {
        writeLocation(s);
     }
     
-       public static PerClause readPerClause(DataInputStream s, ISourceContext context) throws IOException {
+       public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException {
                PerFromSuper ret = new PerFromSuper(Kind.read(s));
                ret.readLocation(context, s);
                return ret;
index ef74a8d131b69bc242a68c8c383f0923f01f2beb..76d7425bb4b08d4900512dd8d5945e42025c8ec0 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.HashSet;
@@ -28,6 +27,7 @@ import org.aspectj.weaver.PerObjectInterfaceTypeMunger;
 import org.aspectj.weaver.ResolvedTypeMunger;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Expr;
 import org.aspectj.weaver.ast.Test;
@@ -115,7 +115,7 @@ public class PerObject extends PerClause {
        writeLocation(s);
     }
     
-       public static PerClause readPerClause(DataInputStream s, ISourceContext context) throws IOException {
+       public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException {
                PerClause ret = new PerObject(Pointcut.read(s, context), s.readBoolean());
                ret.readLocation(context, s);
                return ret;
index f4d8b98797676f7eeeeb6df35ba37f7a77a1696e..ead14bef2ae995e8fa7e41718b4b00a6a0ab3a28 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Set;
@@ -23,6 +22,7 @@ import org.aspectj.weaver.AjcMemberMaker;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.ast.Expr;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
@@ -71,7 +71,7 @@ public class PerSingleton extends PerClause {
        writeLocation(s);
     }
     
-       public static PerClause readPerClause(DataInputStream s, ISourceContext context) throws IOException {
+       public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException {
                PerSingleton ret = new PerSingleton();
                ret.readLocation(context, s);
                return ret;
index 1ba966c059bcf36da124111f0cf307a42f3a072b..d6950a4c467a67ee6c6e7b4fee015e6568e8d87c 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Member;
@@ -32,6 +31,7 @@ import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.ShadowMunger;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
 
@@ -298,7 +298,7 @@ public abstract class Pointcut extends PatternNode implements PointcutExpression
        //XXX currently it's unused  we're keeping it around as a stub
        public void postRead(ResolvedTypeX enclosingType) {}
        
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                byte kind = s.readByte();
                Pointcut ret;
                
index ded642b4e7d5bd54b0a9641ddb35a1227206788b..664ddbfb5cfb8d70e37e973d170e81ad148d4be3 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
@@ -30,6 +29,7 @@ import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.ShadowMunger;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.ast.Test;
 
@@ -107,7 +107,7 @@ public class ReferencePointcut extends Pointcut {
                writeLocation(s);
        }
        
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                TypeX onType = null;
                if (s.readBoolean()) {
                        onType = TypeX.read(s);
index f48cd76ae832ee82ed338f779266569cf3cd74a2..983b5409b035278551a9deb9a774823a596dc071 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
@@ -30,6 +29,7 @@ import org.aspectj.lang.reflect.AdviceSignature;
 import org.aspectj.lang.reflect.ConstructorSignature;
 import org.aspectj.lang.reflect.FieldSignature;
 import org.aspectj.lang.reflect.MethodSignature;
+import org.aspectj.weaver.AjAttribute;
 import org.aspectj.weaver.Constants;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.Member;
@@ -37,6 +37,7 @@ import org.aspectj.weaver.NameMangler;
 import org.aspectj.weaver.ResolvedMember;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 
 
@@ -516,7 +517,7 @@ public class SignaturePattern extends PatternNode {
                writeLocation(s);
        }
 
-       public static SignaturePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static SignaturePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                Member.Kind kind = Member.Kind.read(s);
                ModifiersPattern modifiers = ModifiersPattern.read(s);
                TypePattern returnType = TypePattern.read(s, context);
@@ -524,7 +525,13 @@ public class SignaturePattern extends PatternNode {
                NamePattern name = NamePattern.read(s);
                TypePatternList parameterTypes = TypePatternList.read(s, context);
                ThrowsPattern throwsPattern = ThrowsPattern.read(s, context);
-               AnnotationTypePattern annotationPattern = AnnotationTypePattern.read(s,context);
+               
+               AnnotationTypePattern annotationPattern = AnnotationTypePattern.ANY;
+               
+               if (s.getMajorVersion()>=AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) {
+                 annotationPattern = AnnotationTypePattern.read(s,context);
+               }
+
                SignaturePattern ret = new SignaturePattern(kind, modifiers, returnType, declaringType,
                                        name, parameterTypes, throwsPattern,annotationPattern);
                ret.readLocation(context, s);
index a0ee2ffd4862c049442f4b7dfdd865e8f085b899..6870b6ee99ee3f6b537f06418b76209191510069 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -28,6 +27,7 @@ import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.ShadowMunger;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
@@ -227,7 +227,7 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut {
                writeLocation(s);
        }
        
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
            boolean isThis = s.readBoolean();
                AnnotationTypePattern type = AnnotationTypePattern.read(s, context);
                ThisOrTargetAnnotationPointcut ret = new ThisOrTargetAnnotationPointcut(isThis,(ExactAnnotationTypePattern)type);
index 148d29a7c019daa26ea5d19fe0544963020a8830..8c3dcccfd07933a9cd38b094a3556880a8df624f 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Member;
@@ -32,6 +31,7 @@ import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
@@ -127,7 +127,7 @@ public class ThisOrTargetPointcut extends NameBindingPointcut {
                type.write(s);
                writeLocation(s);
        }
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                boolean isThis = s.readBoolean();
                TypePattern type = TypePattern.read(s, context);
                ThisOrTargetPointcut ret = new ThisOrTargetPointcut(isThis, type);
index 5af1c40493f0480e1d13b5f6ce2368482def8902..ea66f5900a196b6a48ea7e440c90734f61064a46 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 
 
@@ -129,7 +129,7 @@ public class ThrowsPattern extends PatternNode {
                return false;
        }
 
-       public static ThrowsPattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static ThrowsPattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                TypePatternList required = TypePatternList.read(s, context);
                TypePatternList forbidden = TypePatternList.read(s, context);
                if (required.size() == 0 && forbidden.size() == 0) return ANY;
index 2563731982ada25f514f7ddb5be2a06a72a657ee..dd63bae16b5850905aba8a0bcab8a147b5b715be 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Iterator;
@@ -25,6 +24,7 @@ import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.World;
 /**
@@ -267,7 +267,7 @@ public abstract class TypePattern extends PatternNode {
        public static final byte AND = 8;
        public static final byte NO_KEY = 9;
 
-       public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
+       public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                byte key = s.readByte();
                switch(key) {
                        case WILD: return WildTypePattern.read(s, context);
index 3aa4f9cf84957fb748aba189ebd294f84dc74d49..67dff9dc14c0ba8aac4d36f4b6ed9f716af1f728 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -25,6 +24,7 @@ import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 
 public class TypePatternList extends PatternNode {
        private TypePattern[] typePatterns;
@@ -471,7 +471,7 @@ public class TypePatternList extends PatternNode {
     }
     
 
-       public static TypePatternList read(DataInputStream s, ISourceContext context) throws IOException  {
+       public static TypePatternList read(VersionedDataInputStream s, ISourceContext context) throws IOException  {
                short len = s.readShort();
                TypePattern[] arguments = new TypePattern[len];
                for (int i=0; i<len; i++) {
index 3cce9aca89e905837352a90f20eaa1b7e7c5d9c9..c6a9fabe288787a9054db97a6890ebb4a1a5e659 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
@@ -20,6 +19,7 @@ import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.World;
 
@@ -102,7 +102,7 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern {
                writeLocation(s);
        }
 
-       public static AnnotationTypePattern read(DataInputStream s,ISourceContext context) throws IOException {
+       public static AnnotationTypePattern read(VersionedDataInputStream s,ISourceContext context) throws IOException {
                AnnotationTypePattern ret;
                byte version = s.readByte();
                if (version > VERSION) {
index d0cc882a659035a82b10a4f23affb2e535fa629e..8e631c09b38c46db9fe741d5644ba561203d4fb5 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -24,10 +23,12 @@ import org.aspectj.bridge.Message;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FileUtil;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.AjAttribute;
 import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 
 //XXX need to use dim in matching
@@ -607,11 +608,36 @@ public class WildTypePattern extends TypePattern {
                annotationPattern.write(s);
        }
        
-       public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
-               byte version = s.readByte();
-               if (version > VERSION) {
-                       throw new BCException("WildTypePattern was written by a more recent version of AspectJ, cannot read");
-               }
+       public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
+               if (s.getMajorVersion()>=AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) {
+                       return readTypePattern150(s,context);
+               } else {
+                       return readTypePatternOldStyle(s,context);
+           }
+    }
+
+    public static TypePattern readTypePattern150(VersionedDataInputStream s, ISourceContext context) throws IOException {
+         byte version = s.readByte();
+         if (version > VERSION) {
+               throw new BCException("WildTypePattern was written by a more recent version of AspectJ, cannot read");
+         }
+         int len = s.readShort();
+         NamePattern[] namePatterns = new NamePattern[len];
+         for (int i=0; i < len; i++) {
+               namePatterns[i] = NamePattern.read(s);
+         }
+         boolean includeSubtypes = s.readBoolean();
+         int dim = s.readInt();
+         boolean varArg = s.readBoolean();
+         WildTypePattern ret = new WildTypePattern(namePatterns, includeSubtypes, dim, varArg);
+         ret.knownMatches = FileUtil.readStringArray(s);
+         ret.importedPrefixes = FileUtil.readStringArray(s);
+         ret.readLocation(context, s);
+         ret.setAnnotationTypePattern(AnnotationTypePattern.read(s,context));
+         return ret;
+       }
+    
+       public static TypePattern readTypePatternOldStyle(VersionedDataInputStream s, ISourceContext context) throws IOException {
                int len = s.readShort();
                NamePattern[] namePatterns = new NamePattern[len];
                for (int i=0; i < len; i++) {
@@ -619,12 +645,10 @@ public class WildTypePattern extends TypePattern {
                }
                boolean includeSubtypes = s.readBoolean();
                int dim = s.readInt();
-               boolean varArg = s.readBoolean();
-               WildTypePattern ret = new WildTypePattern(namePatterns, includeSubtypes, dim,varArg);
+               WildTypePattern ret = new WildTypePattern(namePatterns, includeSubtypes, dim, false);
                ret.knownMatches = FileUtil.readStringArray(s);
                ret.importedPrefixes = FileUtil.readStringArray(s);
                ret.readLocation(context, s);
-               ret.setAnnotationTypePattern(AnnotationTypePattern.read(s,context));
                return ret;
        }
 
index bc65e609ed785630dd367585f6ef70b6882cdfc5..7dc8c60f307e349ec0897af9e3d18b9be40ce6a7 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -27,6 +26,7 @@ import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.ShadowMunger;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
@@ -162,7 +162,7 @@ public class WithinAnnotationPointcut extends NameBindingPointcut {
                writeLocation(s);
        }
 
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                AnnotationTypePattern type = AnnotationTypePattern.read(s, context);
                WithinAnnotationPointcut ret = new WithinAnnotationPointcut((ExactAnnotationTypePattern)type);
                ret.readLocation(context, s);
index 9e0411e3ebf844e652805db11078efc8111ebfc9..b91ee20e3d5789771a3c39f223927f85b6e4019b 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -29,6 +28,7 @@ import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.ShadowMunger;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
 import org.aspectj.weaver.ast.Var;
@@ -176,7 +176,7 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
                writeLocation(s);
        }
 
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                AnnotationTypePattern type = AnnotationTypePattern.read(s, context);
                WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern)type);
                ret.readLocation(context, s);
index 96201d2037fae26582a448ee56f7cb6c20d76208..5e043d43834f1eeaf330ca4069ff21d67f01f51f 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Member;
@@ -28,6 +27,7 @@ import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
@@ -121,7 +121,7 @@ public class WithinPointcut extends Pointcut {
                typePattern.write(s);
                writeLocation(s);
        }
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                TypePattern type = TypePattern.read(s, context);
                WithinPointcut ret = new WithinPointcut(type);
                ret.readLocation(context, s);
index 2de912cc4b2ebe6ec018d8cdbea2d0f796fac245..326567be368d5ab9f78b7fe150ea13840d507f2b 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Member;
@@ -27,6 +26,7 @@ import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
 
@@ -91,7 +91,7 @@ public class WithincodePointcut extends Pointcut {
                writeLocation(s);
        }
        
-       public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
+       public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                WithincodePointcut ret = new WithincodePointcut(SignaturePattern.read(s, context));
                ret.readLocation(context, s);
                return ret;
index fa3b0481f0a9dfb0fb9c31d39380cbca31b7be86..31560fa9007b456b1691ac1e9024ae29d1a148cf 100644 (file)
@@ -108,7 +108,7 @@ public class PatternWeaveTestCase extends WeaveTestCase {
                out.close();
                
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               DataInputStream in = new DataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi);
                Pointcut newP = Pointcut.read(in, null);
                
                assertEquals("write/read", p, newP);    
index 3c37e1bf97cf7b6e9070697bc5f0dbebb5334b74..28cc91bc5123f729146ea953f74f9b999dc9f37f 100644 (file)
@@ -226,7 +226,7 @@ public class PointcutResidueTestCase extends WeaveTestCase {
                out.close();
                
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               DataInputStream in = new DataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi);
                Pointcut newP = Pointcut.read(in, null);
                
                assertEquals("write/read", p, newP);    
index 45f9b59d5d71cda074f056854fe71d4491bd5fe8..ddb00a31856613ac5fe325528439e0ef804b3827 100644 (file)
@@ -142,7 +142,7 @@ public class AndOrNotTestCase extends TestCase {
                out.close();
                
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               DataInputStream in = new DataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi);
                Pointcut newP = Pointcut.read(in, null);
                
                assertEquals("write/read", p, newP);    
index c0d5fa84889da0a5bab7cd85595b4cdb773225ab..00bebaef9f319d41b4da92b90ef257447b249677 100644 (file)
@@ -15,6 +15,8 @@ package org.aspectj.weaver.patterns;
 
 import java.io.*;
 
+import org.aspectj.weaver.VersionedDataInputStream;
+
 import junit.framework.TestCase;
 
 public class DeclareErrorOrWarningTestCase extends TestCase {
@@ -53,7 +55,7 @@ public class DeclareErrorOrWarningTestCase extends TestCase {
                out.close();
                
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               DataInputStream in = new DataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi);
                Declare newDeclare = Declare.read(in, null);
                
                assertEquals("write/read", declare, newDeclare);        
index 9a1026032f74340f598560a692136233f8b32e13..4adf2e88c87a57a9f872f09452a68fd0db865cc4 100644 (file)
@@ -130,7 +130,7 @@ public class ModifiersPatternTestCase extends TestCase {
                out.close();
                
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               DataInputStream in = new DataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi);
                ModifiersPattern newP = ModifiersPattern.read(in);
                
                assertEquals("write/read", p, newP);    
index 2239d0be841312fd865be4adea16cbf13d8f0d8f..e3baf278d4433db78233cfe059971bc08b92fb83 100644 (file)
@@ -15,10 +15,11 @@ package org.aspectj.weaver.patterns;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.aspectj.weaver.VersionedDataInputStream;
+
 import junit.framework.TestCase;
 
 /**
@@ -111,7 +112,7 @@ public class NamePatternTestCase extends TestCase {
                out.close();
                
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               DataInputStream in = new DataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi);
                NamePattern newP = NamePattern.read(in);
                
                assertEquals("write/read", p, newP);    
index b61d3aa1e2fc326cd4da164f2f1e2d97b80d8f75..4a9188bbc02bb4354c073608f7a9ab6dcf1f905e 100644 (file)
@@ -166,7 +166,7 @@ public class SignaturePatternTestCase extends TestCase {
                out.close();
                
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               DataInputStream in = new DataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi);
                SignaturePattern newP = SignaturePattern.read(in, null);
                
                assertEquals("write/read", p, newP);    
index acd6dcb65b252f31579bad741376c750b543b465..429e8634ec449168663b4efc4c891b83ab8e715e 100644 (file)
@@ -181,7 +181,7 @@ public class TypePatternListTestCase extends TestCase {
                out.close();
                
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               DataInputStream in = new DataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi);
                TypePatternList newP = TypePatternList.read(in, null);
                
                assertEquals("write/read", p, newP);    
index ad6d7e45aa4257160585a2f6b320c791b68b8fa5..354d6edbaeabb74af7fac2d5e51bf4880ecc0fee 100644 (file)
@@ -294,7 +294,7 @@ public class TypePatternTestCase extends TestCase {
                out.close();
                
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               DataInputStream in = new DataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi);
                TypePattern newP = TypePattern.read(in, null);
                
                assertEquals("write/read", p, newP);    
index 18d0380ca2ce0fc554ff91eaf597df032161f6ec..208431598b14c97f9d104d2779bcfe5e8f0a9526 100644 (file)
@@ -117,7 +117,7 @@ public class WithinTestCase extends TestCase {
                out.close();
                
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               DataInputStream in = new DataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi);
                Pointcut newP = Pointcut.read(in, null);
                
                assertEquals("write/read", p, newP);