public static Test suite() { | public static Test suite() { | ||||
TestSuite suite = new TestSuite("Java5 - binary weaving"); | TestSuite suite = new TestSuite("Java5 - binary weaving"); | ||||
//$JUnit-BEGIN$ | //$JUnit-BEGIN$ | ||||
suite.addTestSuite(MigrationTests.class); | |||||
suite.addTest(Ajc150Tests.suite()); | suite.addTest(Ajc150Tests.suite()); | ||||
suite.addTest(AccBridgeMethods.suite()); | suite.addTest(AccBridgeMethods.suite()); | ||||
suite.addTestSuite(CovarianceTests.class); | suite.addTestSuite(CovarianceTests.class); |
/******************************************************************************* | |||||
* 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); | |||||
// } | |||||
} |
package org.aspectj.weaver; | package org.aspectj.weaver; | ||||
import java.io.DataInputStream; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.util.TypeSafeEnum; | import org.aspectj.util.TypeSafeEnum; | ||||
this.isCflow = isCflow; | this.isCflow = isCflow; | ||||
} | } | ||||
public static AdviceKind read(DataInputStream s) throws IOException { | |||||
public static AdviceKind read(VersionedDataInputStream s) throws IOException { | |||||
int key = s.readByte(); | int key = s.readByte(); | ||||
switch(key) { | switch(key) { | ||||
case 1: return Before; | case 1: return Before; |
import java.io.ByteArrayInputStream; | import java.io.ByteArrayInputStream; | ||||
import java.io.ByteArrayOutputStream; | import java.io.ByteArrayOutputStream; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
throw new RuntimeException("sanity check"); | 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 { | try { | ||||
if (bytes == null) bytes = new byte[0]; | 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)) { | if (name.equals(Aspect.AttributeName)) { | ||||
return new Aspect(PerClause.readPerClause(s, context)); | return new Aspect(PerClause.readPerClause(s, context)); | ||||
} else if (name.equals(MethodDeclarationLineNumberAttribute.AttributeName)) { | } else if (name.equals(MethodDeclarationLineNumberAttribute.AttributeName)) { | ||||
// The user will get a warning for any org.aspectj.weaver attributes the weaver does | // The user will get a warning for any org.aspectj.weaver attributes the weaver does | ||||
// not recognize. | // 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 | // 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 | // 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. | // These are the versions read in from a particular class file. | ||||
private short major_version; | private short major_version; | ||||
s.writeShort(CURRENT_VERSION_MINOR); | 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 major = s.readShort(); | ||||
short minor = 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() { | public short getMajorVersion() { | ||||
FileUtil.writeIntArray(lineBreaks, s); | 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)); | return new SourceContextAttribute(s.readUTF(), FileUtil.readIntArray(s)); | ||||
} | } | ||||
public int[] getLineBreaks() { | public int[] getLineBreaks() { | ||||
s.writeInt(lineNumber); | s.writeInt(lineNumber); | ||||
} | } | ||||
public static MethodDeclarationLineNumberAttribute read(DataInputStream s) throws IOException { | |||||
public static MethodDeclarationLineNumberAttribute read(VersionedDataInputStream s) throws IOException { | |||||
return new MethodDeclarationLineNumberAttribute(s.readInt()); | return new MethodDeclarationLineNumberAttribute(s.readInt()); | ||||
} | } | ||||
this.declaredExceptions = declaredExceptions; | 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); | AdviceKind kind = AdviceKind.read(s); | ||||
if (kind == AdviceKind.Around) { | if (kind == AdviceKind.Around) { | ||||
return new AdviceAttribute( | return new AdviceAttribute( | ||||
return accessedMembers; | 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)); | return new PrivilegedAttribute(ResolvedMember.readResolvedMemberArray(s, context)); | ||||
} | } | ||||
} | } | ||||
s.writeBoolean(weaveBody); | 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( | return new EffectiveSignatureAttribute( | ||||
ResolvedMember.readResolvedMember(s, context), | ResolvedMember.readResolvedMember(s, context), | ||||
Shadow.Kind.read(s), | Shadow.Kind.read(s), |
package org.aspectj.weaver; | package org.aspectj.weaver; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
pointcut.write(s); | 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( | return new ResolvedPointcutDefinition( | ||||
TypeX.read(s), | TypeX.read(s), | ||||
s.readInt(), | s.readInt(), |
/* ******************************************************************* | |||||
* 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; } | |||||
} |
private static final byte REWEAVABLE_BIT = 1<<4; | private static final byte REWEAVABLE_BIT = 1<<4; | ||||
private static final byte REWEAVABLE_COMPRESSION_BIT = 1<<5; | 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(); | byte b = s.readByte(); | ||||
boolean isReweavable = ((b&REWEAVABLE_BIT)!=0); | boolean isReweavable = ((b&REWEAVABLE_BIT)!=0); |
import org.aspectj.apache.bcel.generic.ConstantPoolGen; | import org.aspectj.apache.bcel.generic.ConstantPoolGen; | ||||
import org.aspectj.bridge.IMessageHandler; | import org.aspectj.bridge.IMessageHandler; | ||||
import org.aspectj.weaver.AjAttribute; | import org.aspectj.weaver.AjAttribute; | ||||
import org.aspectj.weaver.BCException; | |||||
import org.aspectj.weaver.ISourceContext; | 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 | // this is a class o' static methods for reading attributes. It's pretty much a bridge from | ||||
// bcel to AjAttribute. | // bcel to AjAttribute. | ||||
class BcelAttributes { | 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(); | List l = new ArrayList(); | ||||
AjAttribute.WeaverVersionInfo version = new WeaverVersionInfo(); | |||||
for (int i = as.length - 1; i >= 0; i--) { | for (int i = as.length - 1; i >= 0; i--) { | ||||
Attribute a = as[i]; | Attribute a = as[i]; | ||||
if (a instanceof Unknown) { | if (a instanceof Unknown) { | ||||
Unknown u = (Unknown) a; | Unknown u = (Unknown) a; | ||||
String name = u.getName(); | String name = u.getName(); | ||||
if (name.startsWith(AjAttribute.AttributePrefix)) { | 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); | if (attr!=null) l.add(attr); | ||||
} | } | ||||
} | } |
private void unpackAttributes(World world) { | private void unpackAttributes(World world) { | ||||
Attribute[] attrs = field.getAttributes(); | 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();) { | for (Iterator iter = as.iterator(); iter.hasNext();) { | ||||
AjAttribute a = (AjAttribute) iter.next(); | AjAttribute a = (AjAttribute) iter.next(); | ||||
if (a instanceof AjAttribute.AjSynthetic) { | if (a instanceof AjAttribute.AjSynthetic) { |
} | } | ||||
private void unpackAjAttributes(World world) { | 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); | //System.out.println("unpack: " + this + ", " + as); | ||||
for (Iterator iter = as.iterator(); iter.hasNext();) { | for (Iterator iter = as.iterator(); iter.hasNext();) { | ||||
AjAttribute a = (AjAttribute) iter.next(); | AjAttribute a = (AjAttribute) iter.next(); |
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.WeaverStateInfo; | import org.aspectj.weaver.WeaverStateInfo; | ||||
import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; | |||||
import org.aspectj.weaver.patterns.PerClause; | import org.aspectj.weaver.patterns.PerClause; | ||||
// ??? exposed for testing | // ??? exposed for testing | ||||
List pointcuts = new ArrayList(); | List pointcuts = new ArrayList(); | ||||
typeMungers = new ArrayList(); | typeMungers = new ArrayList(); | ||||
declares = 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();) { | for (Iterator iter = l.iterator(); iter.hasNext();) { | ||||
AjAttribute a = (AjAttribute) iter.next(); | AjAttribute a = (AjAttribute) iter.next(); | ||||
//System.err.println("unpacking: " + this + " and " + a); | //System.err.println("unpacking: " + this + " and " + a); | ||||
((BcelSourceContext)getResolvedTypeX().getSourceContext()).addAttributeInfo((AjAttribute.SourceContextAttribute)a); | ((BcelSourceContext)getResolvedTypeX().getSourceContext()).addAttributeInfo((AjAttribute.SourceContextAttribute)a); | ||||
} | } | ||||
} else if (a instanceof AjAttribute.WeaverVersionInfo) { | } 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 { | } else { | ||||
throw new BCException("bad attribute " + a); | throw new BCException("bad attribute " + a); | ||||
} | } | ||||
} | } | ||||
this.pointcuts = (ResolvedPointcutDefinition[]) | this.pointcuts = (ResolvedPointcutDefinition[]) | ||||
pointcuts.toArray(new ResolvedPointcutDefinition[pointcuts.size()]); | 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[]) | // this.typeMungers = (BcelTypeMunger[]) | ||||
// typeMungers.toArray(new BcelTypeMunger[typeMungers.size()]); | // typeMungers.toArray(new BcelTypeMunger[typeMungers.size()]); | ||||
// this.declares = (Declare[]) | // this.declares = (Declare[]) |
if (enclosingClass != null && enclosingClass.getType() != null) { | if (enclosingClass != null && enclosingClass.getType() != null) { | ||||
context = enclosingClass.getType().getSourceContext(); | context = enclosingClass.getType().getSourceContext(); | ||||
} | } | ||||
List as = BcelAttributes.readAjAttributes(attributes, context,null); | |||||
List as = BcelAttributes.readAjAttributes(getClassName(),attributes, context,null); | |||||
if (! as.isEmpty()) { | if (! as.isEmpty()) { | ||||
out.println(" " + as.get(0)); // XXX assuming exactly one attribute, munger... | out.println(" " + as.get(0)); // XXX assuming exactly one attribute, munger... | ||||
} | } |
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.util.FuzzyBoolean; | import org.aspectj.util.FuzzyBoolean; | ||||
import org.aspectj.weaver.AnnotatedElement; | import org.aspectj.weaver.AnnotatedElement; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
/** | /** | ||||
return this; | 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 p = new AndAnnotationTypePattern( | ||||
AnnotationTypePattern.read(s,context), | AnnotationTypePattern.read(s,context), | ||||
AnnotationTypePattern.read(s,context)); | AnnotationTypePattern.read(s,context)); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Member; | import java.lang.reflect.Member; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
public class AndPointcut extends Pointcut { | public class AndPointcut extends Pointcut { | ||||
writeLocation(s); | 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)); | AndPointcut ret = new AndPointcut(Pointcut.read(s, context), Pointcut.read(s, context)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.util.FuzzyBoolean; | import org.aspectj.util.FuzzyBoolean; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
/** | /** | ||||
* left && right | * left && right | ||||
writeLocation(s); | 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)); | TypePattern ret = new AndTypePattern(TypePattern.read(s, context), TypePattern.read(s, context)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.List; | import java.util.List; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
/** | /** | ||||
return result; | 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(); | short len = s.readShort(); | ||||
AnnotationTypePattern[] arguments = new AnnotationTypePattern[len]; | AnnotationTypePattern[] arguments = new AnnotationTypePattern[len]; | ||||
for (int i=0; i<len; i++) { | for (int i=0; i<len; i++) { |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.ShadowMunger; | import org.aspectj.weaver.ShadowMunger; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
import org.aspectj.weaver.ast.Var; | import org.aspectj.weaver.ast.Var; | ||||
writeLocation(s); | 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); | AnnotationTypePattern type = AnnotationTypePattern.read(s, context); | ||||
AnnotationPointcut ret = new AnnotationPointcut((ExactAnnotationTypePattern)type); | AnnotationPointcut ret = new AnnotationPointcut((ExactAnnotationTypePattern)type); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); |
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.weaver.BCException; | import org.aspectj.weaver.BCException; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
public abstract class AnnotationTypePattern extends PatternNode { | public abstract class AnnotationTypePattern extends PatternNode { | ||||
public static final byte ANY_KEY = 7; | public static final byte ANY_KEY = 7; | ||||
public static final byte WILD = 8; | 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(); | byte key = s.readByte(); | ||||
switch(key) { | switch(key) { | ||||
case EXACT: return ExactAnnotationTypePattern.read(s, context); | case EXACT: return ExactAnnotationTypePattern.read(s, context); |
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
writeLocation(s); | 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); | AnnotationPatternList annotationPatternList = AnnotationPatternList.read(s,context); | ||||
ArgsAnnotationPointcut ret = new ArgsAnnotationPointcut(annotationPatternList); | ArgsAnnotationPointcut ret = new ArgsAnnotationPointcut(annotationPatternList); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Constructor; | import java.lang.reflect.Constructor; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
writeLocation(s); | 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)); | ArgsPointcut ret = new ArgsPointcut(TypePatternList.read(s, context)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
writeLocation(s); | 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(); | byte version = s.readByte(); | ||||
if (version > VERSION) { | if (version > VERSION) { | ||||
throw new BCException("BindingAnnotationTypePattern was written by a more recent version of AspectJ"); | throw new BCException("BindingAnnotationTypePattern was written by a more recent version of AspectJ"); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
public class BindingTypePattern extends ExactTypePattern implements BindingPattern { | public class BindingTypePattern extends ExactTypePattern implements BindingPattern { | ||||
private int formalIndex; | private int formalIndex; | ||||
writeLocation(out); | 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()); | TypePattern ret = new BindingTypePattern(TypeX.read(s), s.readShort(), s.readBoolean()); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Modifier; | import java.lang.reflect.Modifier; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
FileUtil.writeIntArray(freeVars, s); | FileUtil.writeIntArray(freeVars, s); | ||||
writeLocation(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)); | CflowPointcut ret = new CflowPointcut(Pointcut.read(s, context), s.readBoolean(), FileUtil.readIntArray(s)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
public abstract class Declare extends PatternNode { | public abstract class Declare extends PatternNode { | ||||
public static final byte ERROR_OR_WARNING = 1; | public static final byte ERROR_OR_WARNING = 1; | ||||
public static final byte SOFT = 3; | public static final byte SOFT = 3; | ||||
public static final byte DOMINATES = 4; | 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(); | byte kind = s.readByte(); | ||||
switch (kind) { | switch (kind) { | ||||
case ERROR_OR_WARNING: | case ERROR_OR_WARNING: |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
public class DeclareErrorOrWarning extends Declare { | public class DeclareErrorOrWarning extends Declare { | ||||
private boolean isError; | private boolean isError; | ||||
writeLocation(s); | 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( | Declare ret = new DeclareErrorOrWarning( | ||||
s.readBoolean(), | s.readBoolean(), | ||||
Pointcut.read(s, context), | Pointcut.read(s, context), |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
writeLocation(s); | 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)); | Declare ret = new DeclareParents(TypePattern.read(s, context), TypePatternList.read(s, context)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.List; | import java.util.List; | ||||
import org.aspectj.bridge.IMessage; | import org.aspectj.bridge.IMessage; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
public class DeclarePrecedence extends Declare { | public class DeclarePrecedence extends Declare { | ||||
writeLocation(s); | 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)); | Declare ret = new DeclarePrecedence(TypePatternList.read(s, context)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
public class DeclareSoft extends Declare { | public class DeclareSoft extends Declare { | ||||
writeLocation(s); | 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( | Declare ret = new DeclareSoft( | ||||
TypePattern.read(s, context), | TypePattern.read(s, context), | ||||
Pointcut.read(s, context) | Pointcut.read(s, context) |
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
writeLocation(s); | writeLocation(s); | ||||
} | } | ||||
public static AnnotationTypePattern read(DataInputStream s,ISourceContext context) throws IOException { | |||||
public static AnnotationTypePattern read(VersionedDataInputStream s,ISourceContext context) throws IOException { | |||||
AnnotationTypePattern ret; | AnnotationTypePattern ret; | ||||
byte version = s.readByte(); | byte version = s.readByte(); | ||||
if (version > VERSION) { | if (version > VERSION) { |
import java.util.Map; | import java.util.Map; | ||||
import org.aspectj.util.FuzzyBoolean; | import org.aspectj.util.FuzzyBoolean; | ||||
import org.aspectj.weaver.AjAttribute; | |||||
import org.aspectj.weaver.BCException; | import org.aspectj.weaver.BCException; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
public class ExactTypePattern extends TypePattern { | public class ExactTypePattern extends TypePattern { | ||||
protected TypeX type; | protected TypeX type; | ||||
writeLocation(out); | 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(); | byte version = s.readByte(); | ||||
if (version > EXACT_VERSION) throw new BCException("ExactTypePattern was written by a more recent version of AspectJ"); | 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()); | TypePattern ret = new ExactTypePattern(TypeX.read(s), s.readBoolean(), s.readBoolean()); | ||||
return ret; | 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(); | StringBuffer buff = new StringBuffer(); | ||||
if (annotationPattern != AnnotationTypePattern.ANY) { | if (annotationPattern != AnnotationTypePattern.ANY) { | ||||
buff.append('('); | buff.append('('); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Member; | import java.lang.reflect.Member; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
import org.aspectj.weaver.internal.tools.PointcutExpressionImpl; | import org.aspectj.weaver.internal.tools.PointcutExpressionImpl; | ||||
writeLocation(s); | 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)); | HandlerPointcut ret = new HandlerPointcut(TypePattern.read(s, context)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Member; | import java.lang.reflect.Member; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.ShadowMunger; | import org.aspectj.weaver.ShadowMunger; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.ast.Expr; | import org.aspectj.weaver.ast.Expr; | ||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
s.writeByte(extraParameterFlags); | s.writeByte(extraParameterFlags); | ||||
writeLocation(s); | 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()); | IfPointcut ret = new IfPointcut(ResolvedMember.readResolvedMember(s, context), s.readByte()); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.ShadowMunger; | import org.aspectj.weaver.ShadowMunger; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
writeLocation(s); | 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); | Shadow.Kind kind = Shadow.Kind.read(s); | ||||
SignaturePattern sig = SignaturePattern.read(s, context); | SignaturePattern sig = SignaturePattern.read(s, context); | ||||
KindedPointcut ret = new KindedPointcut(kind, sig); | KindedPointcut ret = new KindedPointcut(kind, sig); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Modifier; | import java.lang.reflect.Modifier; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Map; | import java.util.Map; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
public class ModifiersPattern extends PatternNode { | public class ModifiersPattern extends PatternNode { | ||||
private int requiredModifiers; | private int requiredModifiers; | ||||
private int forbiddenModifiers; | private int forbiddenModifiers; | ||||
} | } | ||||
public static ModifiersPattern read(DataInputStream s) throws IOException { | |||||
public static ModifiersPattern read(VersionedDataInputStream s) throws IOException { | |||||
int requiredModifiers = s.readShort(); | int requiredModifiers = s.readShort(); | ||||
int forbiddenModifiers = s.readShort(); | int forbiddenModifiers = s.readShort(); | ||||
if (requiredModifiers == 0 && forbiddenModifiers == 0) return ANY; | if (requiredModifiers == 0 && forbiddenModifiers == 0) return ANY; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
public class NamePattern extends PatternNode { | public class NamePattern extends PatternNode { | ||||
char[] pattern; | char[] pattern; | ||||
int starCount = 0; | int starCount = 0; | ||||
out.writeUTF(new String(pattern)); | 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(); | String s = in.readUTF(); | ||||
if (s.length() == 0) return ELLIPSIS; | if (s.length() == 0) return ELLIPSIS; | ||||
return new NamePattern(s); | return new NamePattern(s); |
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.util.FuzzyBoolean; | import org.aspectj.util.FuzzyBoolean; | ||||
import org.aspectj.weaver.AnnotatedElement; | import org.aspectj.weaver.AnnotatedElement; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
public class NotAnnotationTypePattern extends AnnotationTypePattern { | public class NotAnnotationTypePattern extends AnnotationTypePattern { | ||||
writeLocation(s); | 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)); | AnnotationTypePattern ret = new NotAnnotationTypePattern(AnnotationTypePattern.read(s,context)); | ||||
ret.readLocation(context,s); | ret.readLocation(context,s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Member; | import java.lang.reflect.Member; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
public class NotPointcut extends Pointcut { | public class NotPointcut extends Pointcut { | ||||
writeLocation(s); | 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)); | NotPointcut ret = new NotPointcut(Pointcut.read(s, context)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.util.FuzzyBoolean; | import org.aspectj.util.FuzzyBoolean; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
/** | /** | ||||
* !TypePattern | * !TypePattern | ||||
writeLocation(s); | 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)); | TypePattern ret = new NotTypePattern(TypePattern.read(s, context)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.util.FuzzyBoolean; | import org.aspectj.util.FuzzyBoolean; | ||||
import org.aspectj.weaver.AnnotatedElement; | import org.aspectj.weaver.AnnotatedElement; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
public class OrAnnotationTypePattern extends AnnotationTypePattern { | public class OrAnnotationTypePattern extends AnnotationTypePattern { | ||||
return this; | 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 p = new OrAnnotationTypePattern( | ||||
AnnotationTypePattern.read(s,context), | AnnotationTypePattern.read(s,context), | ||||
AnnotationTypePattern.read(s,context)); | AnnotationTypePattern.read(s,context)); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Member; | import java.lang.reflect.Member; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
public class OrPointcut extends Pointcut { | public class OrPointcut extends Pointcut { | ||||
writeLocation(s); | 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)); | OrPointcut ret = new OrPointcut(Pointcut.read(s, context), Pointcut.read(s, context)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.util.FuzzyBoolean; | import org.aspectj.util.FuzzyBoolean; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
/** | /** | ||||
* left || right | * left || right | ||||
writeLocation(s); | 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)); | TypePattern ret = new OrTypePattern(TypePattern.read(s, context), TypePattern.read(s, context)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Modifier; | import java.lang.reflect.Modifier; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
import org.aspectj.weaver.ast.Expr; | import org.aspectj.weaver.ast.Expr; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
writeLocation(s); | 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()); | PerCflow ret = new PerCflow(Pointcut.read(s, context), s.readBoolean()); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.util.TypeSafeEnum; | import org.aspectj.util.TypeSafeEnum; | ||||
public abstract class PerClause extends Pointcut { | public abstract class PerClause extends Pointcut { | ||||
protected ResolvedTypeX inAspect; | 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); | Kind kind = Kind.read(s); | ||||
if (kind == SINGLETON) return PerSingleton.readPerClause(s, context); | if (kind == SINGLETON) return PerSingleton.readPerClause(s, context); | ||||
else if (kind == PERCFLOW) return PerCflow.readPerClause(s, context); | else if (kind == PERCFLOW) return PerCflow.readPerClause(s, context); | ||||
public static class Kind extends TypeSafeEnum { | public static class Kind extends TypeSafeEnum { | ||||
public Kind(String name, int key) { super(name, key); } | 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(); | int key = s.readByte(); | ||||
switch(key) { | switch(key) { | ||||
case 1: return SINGLETON; | case 1: return SINGLETON; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.Set; | import java.util.Set; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
writeLocation(s); | 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)); | PerFromSuper ret = new PerFromSuper(Kind.read(s)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import org.aspectj.weaver.ResolvedTypeMunger; | import org.aspectj.weaver.ResolvedTypeMunger; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
import org.aspectj.weaver.ast.Expr; | import org.aspectj.weaver.ast.Expr; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
writeLocation(s); | 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()); | PerClause ret = new PerObject(Pointcut.read(s, context), s.readBoolean()); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.Set; | import java.util.Set; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.ast.Expr; | import org.aspectj.weaver.ast.Expr; | ||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
writeLocation(s); | 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(); | PerSingleton ret = new PerSingleton(); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Member; | import java.lang.reflect.Member; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.ShadowMunger; | import org.aspectj.weaver.ShadowMunger; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
//XXX currently it's unused we're keeping it around as a stub | //XXX currently it's unused we're keeping it around as a stub | ||||
public void postRead(ResolvedTypeX enclosingType) {} | 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(); | byte kind = s.readByte(); | ||||
Pointcut ret; | Pointcut ret; | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Modifier; | import java.lang.reflect.Modifier; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.ShadowMunger; | import org.aspectj.weaver.ShadowMunger; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
writeLocation(s); | 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; | TypeX onType = null; | ||||
if (s.readBoolean()) { | if (s.readBoolean()) { | ||||
onType = TypeX.read(s); | onType = TypeX.read(s); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Constructor; | import java.lang.reflect.Constructor; | ||||
import org.aspectj.lang.reflect.ConstructorSignature; | import org.aspectj.lang.reflect.ConstructorSignature; | ||||
import org.aspectj.lang.reflect.FieldSignature; | import org.aspectj.lang.reflect.FieldSignature; | ||||
import org.aspectj.lang.reflect.MethodSignature; | import org.aspectj.lang.reflect.MethodSignature; | ||||
import org.aspectj.weaver.AjAttribute; | |||||
import org.aspectj.weaver.Constants; | import org.aspectj.weaver.Constants; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.Member; | import org.aspectj.weaver.Member; | ||||
import org.aspectj.weaver.ResolvedMember; | import org.aspectj.weaver.ResolvedMember; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
writeLocation(s); | 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); | Member.Kind kind = Member.Kind.read(s); | ||||
ModifiersPattern modifiers = ModifiersPattern.read(s); | ModifiersPattern modifiers = ModifiersPattern.read(s); | ||||
TypePattern returnType = TypePattern.read(s, context); | TypePattern returnType = TypePattern.read(s, context); | ||||
NamePattern name = NamePattern.read(s); | NamePattern name = NamePattern.read(s); | ||||
TypePatternList parameterTypes = TypePatternList.read(s, context); | TypePatternList parameterTypes = TypePatternList.read(s, context); | ||||
ThrowsPattern throwsPattern = ThrowsPattern.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, | SignaturePattern ret = new SignaturePattern(kind, modifiers, returnType, declaringType, | ||||
name, parameterTypes, throwsPattern,annotationPattern); | name, parameterTypes, throwsPattern,annotationPattern); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); |
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.ShadowMunger; | import org.aspectj.weaver.ShadowMunger; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
writeLocation(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(); | boolean isThis = s.readBoolean(); | ||||
AnnotationTypePattern type = AnnotationTypePattern.read(s, context); | AnnotationTypePattern type = AnnotationTypePattern.read(s, context); | ||||
ThisOrTargetAnnotationPointcut ret = new ThisOrTargetAnnotationPointcut(isThis,(ExactAnnotationTypePattern)type); | ThisOrTargetAnnotationPointcut ret = new ThisOrTargetAnnotationPointcut(isThis,(ExactAnnotationTypePattern)type); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Member; | import java.lang.reflect.Member; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
type.write(s); | type.write(s); | ||||
writeLocation(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(); | boolean isThis = s.readBoolean(); | ||||
TypePattern type = TypePattern.read(s, context); | TypePattern type = TypePattern.read(s, context); | ||||
ThisOrTargetPointcut ret = new ThisOrTargetPointcut(isThis, type); | ThisOrTargetPointcut ret = new ThisOrTargetPointcut(isThis, type); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
return false; | 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 required = TypePatternList.read(s, context); | ||||
TypePatternList forbidden = TypePatternList.read(s, context); | TypePatternList forbidden = TypePatternList.read(s, context); | ||||
if (required.size() == 0 && forbidden.size() == 0) return ANY; | if (required.size() == 0 && forbidden.size() == 0) return ANY; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
/** | /** | ||||
public static final byte AND = 8; | public static final byte AND = 8; | ||||
public static final byte NO_KEY = 9; | 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(); | byte key = s.readByte(); | ||||
switch(key) { | switch(key) { | ||||
case WILD: return WildTypePattern.read(s, context); | case WILD: return WildTypePattern.read(s, context); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
public class TypePatternList extends PatternNode { | public class TypePatternList extends PatternNode { | ||||
private TypePattern[] typePatterns; | 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(); | short len = s.readShort(); | ||||
TypePattern[] arguments = new TypePattern[len]; | TypePattern[] arguments = new TypePattern[len]; | ||||
for (int i=0; i<len; i++) { | for (int i=0; i<len; i++) { |
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.weaver.BCException; | import org.aspectj.weaver.BCException; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
writeLocation(s); | writeLocation(s); | ||||
} | } | ||||
public static AnnotationTypePattern read(DataInputStream s,ISourceContext context) throws IOException { | |||||
public static AnnotationTypePattern read(VersionedDataInputStream s,ISourceContext context) throws IOException { | |||||
AnnotationTypePattern ret; | AnnotationTypePattern ret; | ||||
byte version = s.readByte(); | byte version = s.readByte(); | ||||
if (version > VERSION) { | if (version > VERSION) { |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.aspectj.bridge.MessageUtil; | import org.aspectj.bridge.MessageUtil; | ||||
import org.aspectj.util.FileUtil; | import org.aspectj.util.FileUtil; | ||||
import org.aspectj.util.FuzzyBoolean; | import org.aspectj.util.FuzzyBoolean; | ||||
import org.aspectj.weaver.AjAttribute; | |||||
import org.aspectj.weaver.BCException; | import org.aspectj.weaver.BCException; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
//XXX need to use dim in matching | //XXX need to use dim in matching | ||||
annotationPattern.write(s); | 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(); | int len = s.readShort(); | ||||
NamePattern[] namePatterns = new NamePattern[len]; | NamePattern[] namePatterns = new NamePattern[len]; | ||||
for (int i=0; i < len; i++) { | for (int i=0; i < len; i++) { | ||||
} | } | ||||
boolean includeSubtypes = s.readBoolean(); | boolean includeSubtypes = s.readBoolean(); | ||||
int dim = s.readInt(); | 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.knownMatches = FileUtil.readStringArray(s); | ||||
ret.importedPrefixes = FileUtil.readStringArray(s); | ret.importedPrefixes = FileUtil.readStringArray(s); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
ret.setAnnotationTypePattern(AnnotationTypePattern.read(s,context)); | |||||
return ret; | return ret; | ||||
} | } | ||||
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.ShadowMunger; | import org.aspectj.weaver.ShadowMunger; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
writeLocation(s); | 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); | AnnotationTypePattern type = AnnotationTypePattern.read(s, context); | ||||
WithinAnnotationPointcut ret = new WithinAnnotationPointcut((ExactAnnotationTypePattern)type); | WithinAnnotationPointcut ret = new WithinAnnotationPointcut((ExactAnnotationTypePattern)type); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); |
* ******************************************************************/ | * ******************************************************************/ | ||||
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.ShadowMunger; | import org.aspectj.weaver.ShadowMunger; | ||||
import org.aspectj.weaver.TypeX; | import org.aspectj.weaver.TypeX; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
import org.aspectj.weaver.ast.Var; | import org.aspectj.weaver.ast.Var; | ||||
writeLocation(s); | 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); | AnnotationTypePattern type = AnnotationTypePattern.read(s, context); | ||||
WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern)type); | WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern)type); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Member; | import java.lang.reflect.Member; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
typePattern.write(s); | typePattern.write(s); | ||||
writeLocation(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); | TypePattern type = TypePattern.read(s, context); | ||||
WithinPointcut ret = new WithinPointcut(type); | WithinPointcut ret = new WithinPointcut(type); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Member; | import java.lang.reflect.Member; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.ResolvedTypeX; | import org.aspectj.weaver.ResolvedTypeX; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import org.aspectj.weaver.ast.Literal; | import org.aspectj.weaver.ast.Literal; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
writeLocation(s); | 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)); | WithincodePointcut ret = new WithincodePointcut(SignaturePattern.read(s, context)); | ||||
ret.readLocation(context, s); | ret.readLocation(context, s); | ||||
return ret; | return ret; |
out.close(); | out.close(); | ||||
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ||||
DataInputStream in = new DataInputStream(bi); | |||||
VersionedDataInputStream in = new VersionedDataInputStream(bi); | |||||
Pointcut newP = Pointcut.read(in, null); | Pointcut newP = Pointcut.read(in, null); | ||||
assertEquals("write/read", p, newP); | assertEquals("write/read", p, newP); |
out.close(); | out.close(); | ||||
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ||||
DataInputStream in = new DataInputStream(bi); | |||||
VersionedDataInputStream in = new VersionedDataInputStream(bi); | |||||
Pointcut newP = Pointcut.read(in, null); | Pointcut newP = Pointcut.read(in, null); | ||||
assertEquals("write/read", p, newP); | assertEquals("write/read", p, newP); |
out.close(); | out.close(); | ||||
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ||||
DataInputStream in = new DataInputStream(bi); | |||||
VersionedDataInputStream in = new VersionedDataInputStream(bi); | |||||
Pointcut newP = Pointcut.read(in, null); | Pointcut newP = Pointcut.read(in, null); | ||||
assertEquals("write/read", p, newP); | assertEquals("write/read", p, newP); |
import java.io.*; | import java.io.*; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import junit.framework.TestCase; | import junit.framework.TestCase; | ||||
public class DeclareErrorOrWarningTestCase extends TestCase { | public class DeclareErrorOrWarningTestCase extends TestCase { | ||||
out.close(); | out.close(); | ||||
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ||||
DataInputStream in = new DataInputStream(bi); | |||||
VersionedDataInputStream in = new VersionedDataInputStream(bi); | |||||
Declare newDeclare = Declare.read(in, null); | Declare newDeclare = Declare.read(in, null); | ||||
assertEquals("write/read", declare, newDeclare); | assertEquals("write/read", declare, newDeclare); |
out.close(); | out.close(); | ||||
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ||||
DataInputStream in = new DataInputStream(bi); | |||||
VersionedDataInputStream in = new VersionedDataInputStream(bi); | |||||
ModifiersPattern newP = ModifiersPattern.read(in); | ModifiersPattern newP = ModifiersPattern.read(in); | ||||
assertEquals("write/read", p, newP); | assertEquals("write/read", p, newP); |
import java.io.ByteArrayInputStream; | import java.io.ByteArrayInputStream; | ||||
import java.io.ByteArrayOutputStream; | import java.io.ByteArrayOutputStream; | ||||
import java.io.DataInputStream; | |||||
import java.io.DataOutputStream; | import java.io.DataOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.aspectj.weaver.VersionedDataInputStream; | |||||
import junit.framework.TestCase; | import junit.framework.TestCase; | ||||
/** | /** | ||||
out.close(); | out.close(); | ||||
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ||||
DataInputStream in = new DataInputStream(bi); | |||||
VersionedDataInputStream in = new VersionedDataInputStream(bi); | |||||
NamePattern newP = NamePattern.read(in); | NamePattern newP = NamePattern.read(in); | ||||
assertEquals("write/read", p, newP); | assertEquals("write/read", p, newP); |
out.close(); | out.close(); | ||||
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ||||
DataInputStream in = new DataInputStream(bi); | |||||
VersionedDataInputStream in = new VersionedDataInputStream(bi); | |||||
SignaturePattern newP = SignaturePattern.read(in, null); | SignaturePattern newP = SignaturePattern.read(in, null); | ||||
assertEquals("write/read", p, newP); | assertEquals("write/read", p, newP); |
out.close(); | out.close(); | ||||
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ||||
DataInputStream in = new DataInputStream(bi); | |||||
VersionedDataInputStream in = new VersionedDataInputStream(bi); | |||||
TypePatternList newP = TypePatternList.read(in, null); | TypePatternList newP = TypePatternList.read(in, null); | ||||
assertEquals("write/read", p, newP); | assertEquals("write/read", p, newP); |
out.close(); | out.close(); | ||||
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ||||
DataInputStream in = new DataInputStream(bi); | |||||
VersionedDataInputStream in = new VersionedDataInputStream(bi); | |||||
TypePattern newP = TypePattern.read(in, null); | TypePattern newP = TypePattern.read(in, null); | ||||
assertEquals("write/read", p, newP); | assertEquals("write/read", p, newP); |
out.close(); | out.close(); | ||||
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); | ||||
DataInputStream in = new DataInputStream(bi); | |||||
VersionedDataInputStream in = new VersionedDataInputStream(bi); | |||||
Pointcut newP = Pointcut.read(in, null); | Pointcut newP = Pointcut.read(in, null); | ||||
assertEquals("write/read", p, newP); | assertEquals("write/read", p, newP); |