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);
--- /dev/null
+/*******************************************************************************
+ * 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
package org.aspectj.weaver;
-import java.io.DataInputStream;
import java.io.IOException;
import org.aspectj.util.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;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
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)) {
// 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;
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() {
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() {
s.writeInt(lineNumber);
}
- public static MethodDeclarationLineNumberAttribute read(DataInputStream s) throws IOException {
+ public static MethodDeclarationLineNumberAttribute read(VersionedDataInputStream s) throws IOException {
return new MethodDeclarationLineNumberAttribute(s.readInt());
}
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(
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));
}
}
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),
package org.aspectj.weaver;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
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(),
--- /dev/null
+/* *******************************************************************
+ * 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
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);
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);
}
}
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) {
}
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();
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
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);
((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[])
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...
}
* ******************************************************************/
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;
/**
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));
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
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 {
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;
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
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;
* ******************************************************************/
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;
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;
/**
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++) {
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
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;
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);
* ******************************************************************/
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
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 {
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);
* ******************************************************************/
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
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;
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);
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Constructor;
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;
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;
* ******************************************************************/
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;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;
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");
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;
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
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;
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);
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;
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:
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;
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),
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
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;
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
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 {
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;
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.WeaverMessages;
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)
* ******************************************************************/
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.WeaverMessages;
import org.aspectj.weaver.World;
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) {
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;
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());
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('(');
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
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;
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
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;
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashSet;
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;
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);
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;
}
- 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;
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;
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);
* ******************************************************************/
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 {
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
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 {
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;
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
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;
* ******************************************************************/
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 {
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));
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
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 {
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;
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
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
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;
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.IOException;
import org.aspectj.util.TypeSafeEnum;
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);
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Set;
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;
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashSet;
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;
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Set;
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;
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
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;
//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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
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;
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);
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Constructor;
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;
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;
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);
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);
* ******************************************************************/
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
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;
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);
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
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;
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);
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;
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;
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Iterator;
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;
/**
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);
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
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;
}
- 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++) {
* ******************************************************************/
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
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;
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) {
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
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
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++) {
}
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;
}
* ******************************************************************/
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
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;
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);
* ******************************************************************/
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
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;
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);
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
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;
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);
package org.aspectj.weaver.patterns;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
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;
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;
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);
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);
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);
import java.io.*;
+import org.aspectj.weaver.VersionedDataInputStream;
+
import junit.framework.TestCase;
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);
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);
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;
/**
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);
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);
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);
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);
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);