Browse Source

Fix for Bug 82134: AspectJ 5 M2 should implement backwards compatibility for binary aspect form

tags/Root_AspectJ5_Development
aclement 19 years ago
parent
commit
797b6a6afb
70 changed files with 316 additions and 151 deletions
  1. 1
    0
      tests/src/org/aspectj/systemtest/ajc150/AllTestsJava5_binaryWeaving.java
  2. 59
    0
      tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java
  3. 1
    2
      weaver/src/org/aspectj/weaver/AdviceKind.java
  4. 29
    15
      weaver/src/org/aspectj/weaver/AjAttribute.java
  5. 1
    2
      weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java
  6. 31
    0
      weaver/src/org/aspectj/weaver/VersionedDataInputStream.java
  7. 1
    1
      weaver/src/org/aspectj/weaver/WeaverStateInfo.java
  8. 15
    2
      weaver/src/org/aspectj/weaver/bcel/BcelAttributes.java
  9. 1
    1
      weaver/src/org/aspectj/weaver/bcel/BcelField.java
  10. 1
    1
      weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
  11. 8
    10
      weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
  12. 1
    1
      weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
  13. 2
    2
      weaver/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java
  14. 2
    2
      weaver/src/org/aspectj/weaver/patterns/AndPointcut.java
  15. 2
    2
      weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java
  16. 2
    2
      weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java
  17. 2
    2
      weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java
  18. 2
    2
      weaver/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java
  19. 2
    2
      weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java
  20. 2
    2
      weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java
  21. 2
    2
      weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java
  22. 2
    2
      weaver/src/org/aspectj/weaver/patterns/BindingTypePattern.java
  23. 2
    2
      weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java
  24. 2
    2
      weaver/src/org/aspectj/weaver/patterns/Declare.java
  25. 2
    2
      weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java
  26. 2
    2
      weaver/src/org/aspectj/weaver/patterns/DeclareParents.java
  27. 2
    2
      weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java
  28. 2
    2
      weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java
  29. 2
    2
      weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java
  30. 18
    2
      weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java
  31. 2
    2
      weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java
  32. 2
    2
      weaver/src/org/aspectj/weaver/patterns/IfPointcut.java
  33. 2
    2
      weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java
  34. 3
    2
      weaver/src/org/aspectj/weaver/patterns/ModifiersPattern.java
  35. 3
    2
      weaver/src/org/aspectj/weaver/patterns/NamePattern.java
  36. 2
    2
      weaver/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java
  37. 2
    2
      weaver/src/org/aspectj/weaver/patterns/NotPointcut.java
  38. 2
    2
      weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java
  39. 2
    2
      weaver/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java
  40. 2
    2
      weaver/src/org/aspectj/weaver/patterns/OrPointcut.java
  41. 2
    2
      weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java
  42. 2
    2
      weaver/src/org/aspectj/weaver/patterns/PerCflow.java
  43. 2
    3
      weaver/src/org/aspectj/weaver/patterns/PerClause.java
  44. 2
    2
      weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java
  45. 2
    2
      weaver/src/org/aspectj/weaver/patterns/PerObject.java
  46. 2
    2
      weaver/src/org/aspectj/weaver/patterns/PerSingleton.java
  47. 2
    2
      weaver/src/org/aspectj/weaver/patterns/Pointcut.java
  48. 2
    2
      weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java
  49. 10
    3
      weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java
  50. 2
    2
      weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java
  51. 2
    2
      weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
  52. 2
    2
      weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java
  53. 2
    2
      weaver/src/org/aspectj/weaver/patterns/TypePattern.java
  54. 2
    2
      weaver/src/org/aspectj/weaver/patterns/TypePatternList.java
  55. 2
    2
      weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
  56. 33
    9
      weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java
  57. 2
    2
      weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java
  58. 2
    2
      weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java
  59. 2
    2
      weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java
  60. 2
    2
      weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java
  61. 1
    1
      weaver/testsrc/org/aspectj/weaver/bcel/PatternWeaveTestCase.java
  62. 1
    1
      weaver/testsrc/org/aspectj/weaver/bcel/PointcutResidueTestCase.java
  63. 1
    1
      weaver/testsrc/org/aspectj/weaver/patterns/AndOrNotTestCase.java
  64. 3
    1
      weaver/testsrc/org/aspectj/weaver/patterns/DeclareErrorOrWarningTestCase.java
  65. 1
    1
      weaver/testsrc/org/aspectj/weaver/patterns/ModifiersPatternTestCase.java
  66. 3
    2
      weaver/testsrc/org/aspectj/weaver/patterns/NamePatternTestCase.java
  67. 1
    1
      weaver/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java
  68. 1
    1
      weaver/testsrc/org/aspectj/weaver/patterns/TypePatternListTestCase.java
  69. 1
    1
      weaver/testsrc/org/aspectj/weaver/patterns/TypePatternTestCase.java
  70. 1
    1
      weaver/testsrc/org/aspectj/weaver/patterns/WithinTestCase.java

+ 1
- 0
tests/src/org/aspectj/systemtest/ajc150/AllTestsJava5_binaryWeaving.java View File

@@ -24,6 +24,7 @@ public class AllTestsJava5_binaryWeaving {
public static Test suite() {
TestSuite suite = new TestSuite("Java5 - binary weaving");
//$JUnit-BEGIN$
suite.addTestSuite(MigrationTests.class);
suite.addTest(Ajc150Tests.suite());
suite.addTest(AccBridgeMethods.suite());
suite.addTestSuite(CovarianceTests.class);

+ 59
- 0
tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java View File

@@ -0,0 +1,59 @@
/*******************************************************************************
* Copyright (c) 2004 IBM
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* Andy Clement - initial API and implementation
*******************************************************************************/
package org.aspectj.systemtest.ajc150;

import java.io.File;

import org.aspectj.tools.ajc.CompilationResult;


/**
* Checks if we are obeying migration rules.
*/
public class MigrationTests extends TestUtils {
protected void setUp() throws Exception {
super.setUp();
baseDir = new File("../tests/migration");
}

/**
* Compile a simple java class with an aspect library built with aspectj 1.2.1 - this
* checks that we can load in attributes (especially pointcuts) that were written out
* in the 'old way'
*
*/
public void testMigrationFrom121_pointcutsAndAdvice() {
CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects121.jar","Program.java"});
System.err.println(cR.getStandardError());
assertTrue("Should not coredump: "+cR.getStandardError(),cR.getStandardError().indexOf("Dumping to ajcore")==-1);
assertTrue("Should be no error messages: \n"+cR.getErrorMessages(),cR.getErrorMessages().size()==0);
File f = new File(ajc.getSandboxDirectory()+File.separator+"Program.class");
assertTrue("Missing class file",f.exists());
run("Program");
}
// /**
// * We cannot support all aspects built prior to AspectJ 1.2.1 - so we don't support any.
// * There are probably many reasons but the first one I've hit is:
// * - Changes for cflow optimizations (counters instead of stacks where we can) mean that an aspect
// * compiled at AspectJ1.2.0 will contain stack cases but AspectJ1.5.0 will look for counter
// * fields in some cases.
// *
// * This means we should get a reasonable failure message in this case.
// */
// public void testMigrationFrom120_pointcutsAndAdvice() {
// CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects120.jar","Program.java"});
// assertTrue("Should have failed",cR.getFailMessages().size()>0);
// assertTrue("Should have produced nice message",cR.getFailMessages().get(0).toString().indexOf("Unable to continue")!=-1);
// }
}

+ 1
- 2
weaver/src/org/aspectj/weaver/AdviceKind.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver;

import java.io.DataInputStream;
import java.io.IOException;

import org.aspectj.util.TypeSafeEnum;
@@ -35,7 +34,7 @@ public class AdviceKind extends TypeSafeEnum {
this.isCflow = isCflow;
}
public static AdviceKind read(DataInputStream s) throws IOException {
public static AdviceKind read(VersionedDataInputStream s) throws IOException {
int key = s.readByte();
switch(key) {
case 1: return Before;

+ 29
- 15
weaver/src/org/aspectj/weaver/AjAttribute.java View File

@@ -15,7 +15,6 @@ package org.aspectj.weaver;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

@@ -82,11 +81,12 @@ public abstract class AjAttribute {
throw new RuntimeException("sanity check");
}
}
public static AjAttribute read(String name, byte[] bytes, ISourceContext context,IMessageHandler msgHandler) {
public static AjAttribute read(AjAttribute.WeaverVersionInfo v, String name, byte[] bytes, ISourceContext context,IMessageHandler msgHandler) {
try {
if (bytes == null) bytes = new byte[0];
DataInputStream s = new DataInputStream(new ByteArrayInputStream(bytes));
VersionedDataInputStream s = new VersionedDataInputStream(new ByteArrayInputStream(bytes));
s.setVersion(v);
if (name.equals(Aspect.AttributeName)) {
return new Aspect(PerClause.readPerClause(s, context));
} else if (name.equals(MethodDeclarationLineNumberAttribute.AttributeName)) {
@@ -196,13 +196,25 @@ public abstract class AjAttribute {
// The user will get a warning for any org.aspectj.weaver attributes the weaver does
// not recognize.
// When we don't know ... (i.e. pre 1.2.1)
public static short WEAVER_VERSION_MAJOR_UNKNOWN = 0;
public static short WEAVER_VERSION_MINOR_UNKNOWN = 0;
// These are the weaver major/minor numbers for AspectJ 1.2.1
private static short WEAVER_VERSION_MAJOR_AJ121 = 1;
private static short WEAVER_VERSION_MINOR_AJ121 = 0;
public static short WEAVER_VERSION_MAJOR_AJ121 = 1;
public static short WEAVER_VERSION_MINOR_AJ121 = 0;
// These are the weaver major/minor numbers for AspectJ 1.5.0
public static short WEAVER_VERSION_MAJOR_AJ150 = 2;
public static short WEAVER_VERSION_MINOR_AJ150 = 0;
// These are the weaver major/minor versions for *this* weaver
private static short CURRENT_VERSION_MAJOR = WEAVER_VERSION_MAJOR_AJ121;
private static short CURRENT_VERSION_MINOR = WEAVER_VERSION_MINOR_AJ121;
private static short CURRENT_VERSION_MAJOR = WEAVER_VERSION_MAJOR_AJ150;
private static short CURRENT_VERSION_MINOR = WEAVER_VERSION_MINOR_AJ150;
public static final WeaverVersionInfo UNKNOWN =
new WeaverVersionInfo(WEAVER_VERSION_MAJOR_UNKNOWN,WEAVER_VERSION_MINOR_UNKNOWN);
// These are the versions read in from a particular class file.
private short major_version;
@@ -228,10 +240,12 @@ public abstract class AjAttribute {
s.writeShort(CURRENT_VERSION_MINOR);
}
public static WeaverVersionInfo read(DataInputStream s) throws IOException {
public static WeaverVersionInfo read(VersionedDataInputStream s) throws IOException {
short major = s.readShort();
short minor = s.readShort();
return new WeaverVersionInfo(major,minor);
WeaverVersionInfo wvi = new WeaverVersionInfo(major,minor);
// s.setVersion(wvi);
return wvi;
}
public short getMajorVersion() {
@@ -279,7 +293,7 @@ public abstract class AjAttribute {
FileUtil.writeIntArray(lineBreaks, s);
}
public static SourceContextAttribute read(DataInputStream s) throws IOException {
public static SourceContextAttribute read(VersionedDataInputStream s) throws IOException {
return new SourceContextAttribute(s.readUTF(), FileUtil.readIntArray(s));
}
public int[] getLineBreaks() {
@@ -311,7 +325,7 @@ public abstract class AjAttribute {
s.writeInt(lineNumber);
}
public static MethodDeclarationLineNumberAttribute read(DataInputStream s) throws IOException {
public static MethodDeclarationLineNumberAttribute read(VersionedDataInputStream s) throws IOException {
return new MethodDeclarationLineNumberAttribute(s.readInt());
}

@@ -417,7 +431,7 @@ public abstract class AjAttribute {
this.declaredExceptions = declaredExceptions;
}
public static AdviceAttribute read(DataInputStream s, ISourceContext context) throws IOException {
public static AdviceAttribute read(VersionedDataInputStream s, ISourceContext context) throws IOException {
AdviceKind kind = AdviceKind.read(s);
if (kind == AdviceKind.Around) {
return new AdviceAttribute(
@@ -544,7 +558,7 @@ public abstract class AjAttribute {
return accessedMembers;
}

public static PrivilegedAttribute read(DataInputStream s, ISourceContext context) throws IOException {
public static PrivilegedAttribute read(VersionedDataInputStream s, ISourceContext context) throws IOException {
return new PrivilegedAttribute(ResolvedMember.readResolvedMemberArray(s, context));
}
}
@@ -571,7 +585,7 @@ public abstract class AjAttribute {
s.writeBoolean(weaveBody);
}

public static EffectiveSignatureAttribute read(DataInputStream s, ISourceContext context) throws IOException {
public static EffectiveSignatureAttribute read(VersionedDataInputStream s, ISourceContext context) throws IOException {
return new EffectiveSignatureAttribute(
ResolvedMember.readResolvedMember(s, context),
Shadow.Kind.read(s),

+ 1
- 2
weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

@@ -52,7 +51,7 @@ public class ResolvedPointcutDefinition extends ResolvedMember {
pointcut.write(s);
}
public static ResolvedPointcutDefinition read(DataInputStream s, ISourceContext context) throws IOException {
public static ResolvedPointcutDefinition read(VersionedDataInputStream s, ISourceContext context) throws IOException {
return new ResolvedPointcutDefinition(
TypeX.read(s),
s.readInt(),

+ 31
- 0
weaver/src/org/aspectj/weaver/VersionedDataInputStream.java View File

@@ -0,0 +1,31 @@
/* *******************************************************************
* Copyright (c) 2005 IBM
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Common Public License v1.0
* which accompanies this distribution and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* Andy Clement initial implementation
* ******************************************************************/

package org.aspectj.weaver;

import java.io.DataInputStream;
import java.io.InputStream;

import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;

/**
* Lightweight subclass of DataInputStream that knows what version of the weaver was used to construct the data in it.
*/
public class VersionedDataInputStream extends DataInputStream {
private WeaverVersionInfo version = new WeaverVersionInfo();// assume we are the latest unless something tells us otherwise...
public VersionedDataInputStream(InputStream is) { super(is); }
public int getMajorVersion() { return version.getMajorVersion(); }
public int getMinorVersion() { return version.getMinorVersion(); }
public void setVersion(WeaverVersionInfo version) { this.version = version; }
}

+ 1
- 1
weaver/src/org/aspectj/weaver/WeaverStateInfo.java View File

@@ -84,7 +84,7 @@ public class WeaverStateInfo {
private static final byte REWEAVABLE_BIT = 1<<4;
private static final byte REWEAVABLE_COMPRESSION_BIT = 1<<5;
public static final WeaverStateInfo read(DataInputStream s, ISourceContext context) throws IOException {
public static final WeaverStateInfo read(VersionedDataInputStream s, ISourceContext context) throws IOException {
byte b = s.readByte();
boolean isReweavable = ((b&REWEAVABLE_BIT)!=0);

+ 15
- 2
weaver/src/org/aspectj/weaver/bcel/BcelAttributes.java View File

@@ -21,22 +21,35 @@ import org.aspectj.apache.bcel.classfile.Unknown;
import org.aspectj.apache.bcel.generic.ConstantPoolGen;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;


// this is a class o' static methods for reading attributes. It's pretty much a bridge from
// bcel to AjAttribute.
class BcelAttributes {

public static List readAjAttributes(Attribute[] as, ISourceContext context,IMessageHandler msgHandler) {
public static List readAjAttributes(String classname,Attribute[] as, ISourceContext context,IMessageHandler msgHandler) {
List l = new ArrayList();
AjAttribute.WeaverVersionInfo version = new WeaverVersionInfo();
for (int i = as.length - 1; i >= 0; i--) {
Attribute a = as[i];
if (a instanceof Unknown) {
Unknown u = (Unknown) a;
String name = u.getName();
if (name.startsWith(AjAttribute.AttributePrefix)) {
AjAttribute attr = AjAttribute.read(name, u.getBytes(), context,msgHandler);
AjAttribute attr = AjAttribute.read(version,name,u.getBytes(),context,msgHandler);
if (attr!=null && attr instanceof AjAttribute.WeaverVersionInfo) {
version = (AjAttribute.WeaverVersionInfo)attr;
// Do a version check, this weaver can't process versions
// from a future AspectJ (where the major number has changed)
if (version.getMajorVersion() > WeaverVersionInfo.getCurrentWeaverMajorVersion()) {
throw new BCException("Unable to continue, this version of AspectJ supports classes built with weaver version "+
WeaverVersionInfo.toCurrentVersionString()+" but the class "+classname+" is version "+version.toString());
}
}
if (attr!=null) l.add(attr);
}
}

+ 1
- 1
weaver/src/org/aspectj/weaver/bcel/BcelField.java View File

@@ -52,7 +52,7 @@ final class BcelField extends ResolvedMember {
private void unpackAttributes(World world) {
Attribute[] attrs = field.getAttributes();
List as = BcelAttributes.readAjAttributes(attrs, getSourceContext(world),world.getMessageHandler());
List as = BcelAttributes.readAjAttributes(getDeclaringType().getClassName(),attrs, getSourceContext(world),world.getMessageHandler());
for (Iterator iter = as.iterator(); iter.hasNext();) {
AjAttribute a = (AjAttribute) iter.next();
if (a instanceof AjAttribute.AjSynthetic) {

+ 1
- 1
weaver/src/org/aspectj/weaver/bcel/BcelMethod.java View File

@@ -90,7 +90,7 @@ final class BcelMethod extends ResolvedMember {
}

private void unpackAjAttributes(World world) {
List as = BcelAttributes.readAjAttributes(method.getAttributes(), getSourceContext(world),world.getMessageHandler());
List as = BcelAttributes.readAjAttributes(getDeclaringType().getClassName(),method.getAttributes(), getSourceContext(world),world.getMessageHandler());
//System.out.println("unpack: " + this + ", " + as);
for (Iterator iter = as.iterator(); iter.hasNext();) {
AjAttribute a = (AjAttribute) iter.next();

+ 8
- 10
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java View File

@@ -35,7 +35,6 @@ import org.aspectj.weaver.ResolvedPointcutDefinition;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.WeaverStateInfo;
import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
import org.aspectj.weaver.patterns.PerClause;

// ??? exposed for testing
@@ -169,7 +168,7 @@ public class BcelObjectType extends ResolvedTypeX.ConcreteName {
List pointcuts = new ArrayList();
typeMungers = new ArrayList();
declares = new ArrayList();
List l = BcelAttributes.readAjAttributes(javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),getResolvedTypeX().getWorld().getMessageHandler());
List l = BcelAttributes.readAjAttributes(javaClass.getClassName(),javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),getResolvedTypeX().getWorld().getMessageHandler());
for (Iterator iter = l.iterator(); iter.hasNext();) {
AjAttribute a = (AjAttribute) iter.next();
//System.err.println("unpacking: " + this + " and " + a);
@@ -190,20 +189,19 @@ public class BcelObjectType extends ResolvedTypeX.ConcreteName {
((BcelSourceContext)getResolvedTypeX().getSourceContext()).addAttributeInfo((AjAttribute.SourceContextAttribute)a);
}
} else if (a instanceof AjAttribute.WeaverVersionInfo) {
wvInfo = (AjAttribute.WeaverVersionInfo)a;
if (wvInfo.getMajorVersion() > WeaverVersionInfo.getCurrentWeaverMajorVersion()) {
// The class file containing this attribute was created by a version of AspectJ that
// added some behavior that 'this' version of AspectJ doesn't understand. And the
// class file contains changes that mean 'this' version of AspectJ cannot continue.
throw new BCException("Unable to continue, this version of AspectJ supports classes built with weaver version "+
WeaverVersionInfo.toCurrentVersionString()+" but the class "+ javaClass.getClassName()+" is version "+wvInfo.toString());
}
wvInfo = (AjAttribute.WeaverVersionInfo)a; // Set the weaver version used to build this type
} else {
throw new BCException("bad attribute " + a);
}
}
this.pointcuts = (ResolvedPointcutDefinition[])
pointcuts.toArray(new ResolvedPointcutDefinition[pointcuts.size()]);
// Test isn't quite right, leaving this out for now...
// if (isAspect() && wvInfo.getMajorVersion() == WeaverVersionInfo.UNKNOWN.getMajorVersion()) {
// throw new BCException("Unable to continue, this version of AspectJ cannot use aspects as input that were built "+
// "with an AspectJ earlier than version 1.2.1. Please rebuild class: "+javaClass.getClassName());
// }
// this.typeMungers = (BcelTypeMunger[])
// typeMungers.toArray(new BcelTypeMunger[typeMungers.size()]);
// this.declares = (Declare[])

+ 1
- 1
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java View File

@@ -441,7 +441,7 @@ public final class LazyMethodGen {
if (enclosingClass != null && enclosingClass.getType() != null) {
context = enclosingClass.getType().getSourceContext();
}
List as = BcelAttributes.readAjAttributes(attributes, context,null);
List as = BcelAttributes.readAjAttributes(getClassName(),attributes, context,null);
if (! as.isEmpty()) {
out.println(" " + as.get(0)); // XXX assuming exactly one attribute, munger...
}

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java View File

@@ -9,13 +9,13 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.AnnotatedElement;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;

/**
@@ -54,7 +54,7 @@ public class AndAnnotationTypePattern extends AnnotationTypePattern {
return this;
}
public static AnnotationTypePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
AnnotationTypePattern p = new AndAnnotationTypePattern(
AnnotationTypePattern.read(s,context),
AnnotationTypePattern.read(s,context));

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/AndPointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
@@ -26,6 +25,7 @@ import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.ast.Test;

public class AndPointcut extends Pointcut {
@@ -120,7 +120,7 @@ public class AndPointcut extends Pointcut {
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
AndPointcut ret = new AndPointcut(Pointcut.read(s, context), Pointcut.read(s, context));
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java View File

@@ -13,13 +13,13 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.VersionedDataInputStream;

/**
* left && right
@@ -75,7 +75,7 @@ public class AndTypePattern extends TypePattern {
writeLocation(s);
}
public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
TypePattern ret = new AndTypePattern(TypePattern.read(s, context), TypePattern.read(s, context));
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java View File

@@ -9,7 +9,6 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;
@@ -18,6 +17,7 @@ import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;

/**
@@ -155,7 +155,7 @@ public class AnnotationPatternList extends PatternNode {
return result;
}
public static AnnotationPatternList read(DataInputStream s, ISourceContext context) throws IOException {
public static AnnotationPatternList read(VersionedDataInputStream s, ISourceContext context) throws IOException {
short len = s.readShort();
AnnotationTypePattern[] arguments = new AnnotationTypePattern[len];
for (int i=0; i<len; i++) {

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java View File

@@ -10,7 +10,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -29,6 +28,7 @@ import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
import org.aspectj.weaver.ast.Var;
@@ -194,7 +194,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
writeLocation(s);
}

public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
AnnotationTypePattern type = AnnotationTypePattern.read(s, context);
AnnotationPointcut ret = new AnnotationPointcut((ExactAnnotationTypePattern)type);
ret.readLocation(context, s);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java View File

@@ -9,7 +9,6 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

@@ -18,6 +17,7 @@ import org.aspectj.weaver.AnnotatedElement;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;

public abstract class AnnotationTypePattern extends PatternNode {
@@ -64,7 +64,7 @@ public abstract class AnnotationTypePattern extends PatternNode {
public static final byte ANY_KEY = 7;
public static final byte WILD = 8;

public static AnnotationTypePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
byte key = s.readByte();
switch(key) {
case EXACT: return ExactAnnotationTypePattern.read(s, context);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java View File

@@ -9,7 +9,6 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -26,6 +25,7 @@ import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
@@ -182,7 +182,7 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut {
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
AnnotationPatternList annotationPatternList = AnnotationPatternList.read(s,context);
ArgsAnnotationPointcut ret = new ArgsAnnotationPointcut(annotationPatternList);
ret.readLocation(context, s);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Constructor;
@@ -39,6 +38,7 @@ import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
@@ -170,7 +170,7 @@ public class ArgsPointcut extends NameBindingPointcut {
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
ArgsPointcut ret = new ArgsPointcut(TypePatternList.read(s, context));
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java View File

@@ -9,7 +9,6 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

@@ -19,6 +18,7 @@ import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;

@@ -103,7 +103,7 @@ public class BindingAnnotationTypePattern extends ExactAnnotationTypePattern imp
writeLocation(s);
}
public static AnnotationTypePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
byte version = s.readByte();
if (version > VERSION) {
throw new BCException("BindingAnnotationTypePattern was written by a more recent version of AspectJ");

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/BindingTypePattern.java View File

@@ -13,13 +13,13 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;

public class BindingTypePattern extends ExactTypePattern implements BindingPattern {
private int formalIndex;
@@ -59,7 +59,7 @@ public class BindingTypePattern extends ExactTypePattern implements BindingPatte
writeLocation(out);
}
public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
TypePattern ret = new BindingTypePattern(TypeX.read(s), s.readShort(), s.readBoolean());
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
@@ -37,6 +36,7 @@ import org.aspectj.weaver.ResolvedPointcutDefinition;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;
import org.aspectj.weaver.ast.Test;
@@ -106,7 +106,7 @@ public class CflowPointcut extends Pointcut {
FileUtil.writeIntArray(freeVars, s);
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {

CflowPointcut ret = new CflowPointcut(Pointcut.read(s, context), s.readBoolean(), FileUtil.readIntArray(s));
ret.readLocation(context, s);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/Declare.java View File

@@ -13,10 +13,10 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.IOException;

import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.VersionedDataInputStream;

public abstract class Declare extends PatternNode {
public static final byte ERROR_OR_WARNING = 1;
@@ -24,7 +24,7 @@ public abstract class Declare extends PatternNode {
public static final byte SOFT = 3;
public static final byte DOMINATES = 4;

public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
byte kind = s.readByte();
switch (kind) {
case ERROR_OR_WARNING:

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java View File

@@ -13,11 +13,11 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.VersionedDataInputStream;

public class DeclareErrorOrWarning extends Declare {
private boolean isError;
@@ -67,7 +67,7 @@ public class DeclareErrorOrWarning extends Declare {
writeLocation(s);
}

public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
Declare ret = new DeclareErrorOrWarning(
s.readBoolean(),
Pointcut.read(s, context),

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/DeclareParents.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -24,6 +23,7 @@ import org.aspectj.bridge.IMessage;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;

@@ -86,7 +86,7 @@ public class DeclareParents extends Declare {
writeLocation(s);
}

public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
Declare ret = new DeclareParents(TypePattern.read(s, context), TypePatternList.read(s, context));
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;
@@ -21,6 +20,7 @@ import java.util.List;
import org.aspectj.bridge.IMessage;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;

public class DeclarePrecedence extends Declare {
@@ -60,7 +60,7 @@ public class DeclarePrecedence extends Declare {
writeLocation(s);
}

public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
Declare ret = new DeclarePrecedence(TypePatternList.read(s, context));
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

@@ -21,6 +20,7 @@ import org.aspectj.bridge.IMessage;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;

public class DeclareSoft extends Declare {
@@ -65,7 +65,7 @@ public class DeclareSoft extends Declare {
writeLocation(s);
}

public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
Declare ret = new DeclareSoft(
TypePattern.read(s, context),
Pointcut.read(s, context)

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java View File

@@ -9,7 +9,6 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

@@ -21,6 +20,7 @@ import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;

@@ -151,7 +151,7 @@ public class ExactAnnotationTypePattern extends AnnotationTypePattern {
writeLocation(s);
}

public static AnnotationTypePattern read(DataInputStream s,ISourceContext context) throws IOException {
public static AnnotationTypePattern read(VersionedDataInputStream s,ISourceContext context) throws IOException {
AnnotationTypePattern ret;
byte version = s.readByte();
if (version > VERSION) {

+ 18
- 2
weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java View File

@@ -20,10 +20,12 @@ import java.util.HashMap;
import java.util.Map;

import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;

public class ExactTypePattern extends TypePattern {
protected TypeX type;
@@ -197,7 +199,15 @@ public class ExactTypePattern extends TypePattern {
writeLocation(out);
}
public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
if (s.getMajorVersion()>=AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) {
return readTypePattern150(s,context);
} else {
return readTypePatternOldStyle(s,context);
}
}
public static TypePattern readTypePattern150(VersionedDataInputStream s, ISourceContext context) throws IOException {
byte version = s.readByte();
if (version > EXACT_VERSION) throw new BCException("ExactTypePattern was written by a more recent version of AspectJ");
TypePattern ret = new ExactTypePattern(TypeX.read(s), s.readBoolean(), s.readBoolean());
@@ -206,7 +216,13 @@ public class ExactTypePattern extends TypePattern {
return ret;
}

public String toString() {
public static TypePattern readTypePatternOldStyle(DataInputStream s, ISourceContext context) throws IOException {
TypePattern ret = new ExactTypePattern(TypeX.read(s), s.readBoolean(),false);
ret.readLocation(context, s);
return ret;
}

public String toString() {
StringBuffer buff = new StringBuffer();
if (annotationPattern != AnnotationTypePattern.ANY) {
buff.append('(');

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
@@ -26,6 +25,7 @@ import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
import org.aspectj.weaver.internal.tools.PointcutExpressionImpl;
@@ -128,7 +128,7 @@ public class HandlerPointcut extends Pointcut {
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
HandlerPointcut ret = new HandlerPointcut(TypePattern.read(s, context));
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/IfPointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
@@ -33,6 +32,7 @@ import org.aspectj.weaver.ResolvedPointcutDefinition;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Expr;
import org.aspectj.weaver.ast.Literal;
@@ -100,7 +100,7 @@ public class IfPointcut extends Pointcut {
s.writeByte(extraParameterFlags);
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
IfPointcut ret = new IfPointcut(ResolvedMember.readResolvedMember(s, context), s.readByte());
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashSet;
@@ -31,6 +30,7 @@ import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
@@ -257,7 +257,7 @@ public class KindedPointcut extends Pointcut {
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
Shadow.Kind kind = Shadow.Kind.read(s);
SignaturePattern sig = SignaturePattern.read(s, context);
KindedPointcut ret = new KindedPointcut(kind, sig);

+ 3
- 2
weaver/src/org/aspectj/weaver/patterns/ModifiersPattern.java View File

@@ -13,13 +13,14 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;

import org.aspectj.weaver.VersionedDataInputStream;

public class ModifiersPattern extends PatternNode {
private int requiredModifiers;
private int forbiddenModifiers;
@@ -58,7 +59,7 @@ public class ModifiersPattern extends PatternNode {
}

public static ModifiersPattern read(DataInputStream s) throws IOException {
public static ModifiersPattern read(VersionedDataInputStream s) throws IOException {
int requiredModifiers = s.readShort();
int forbiddenModifiers = s.readShort();
if (requiredModifiers == 0 && forbiddenModifiers == 0) return ANY;

+ 3
- 2
weaver/src/org/aspectj/weaver/patterns/NamePattern.java View File

@@ -13,10 +13,11 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.aspectj.weaver.VersionedDataInputStream;

public class NamePattern extends PatternNode {
char[] pattern;
int starCount = 0;
@@ -135,7 +136,7 @@ public class NamePattern extends PatternNode {
out.writeUTF(new String(pattern));
}
public static NamePattern read(DataInputStream in) throws IOException {
public static NamePattern read(VersionedDataInputStream in) throws IOException {
String s = in.readUTF();
if (s.length() == 0) return ELLIPSIS;
return new NamePattern(s);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java View File

@@ -9,13 +9,13 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.AnnotatedElement;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;

public class NotAnnotationTypePattern extends AnnotationTypePattern {
@@ -59,7 +59,7 @@ public class NotAnnotationTypePattern extends AnnotationTypePattern {
writeLocation(s);
}

public static AnnotationTypePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
AnnotationTypePattern ret = new NotAnnotationTypePattern(AnnotationTypePattern.read(s,context));
ret.readLocation(context,s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/NotPointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
@@ -25,6 +24,7 @@ import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.ast.Test;

public class NotPointcut extends Pointcut {
@@ -117,7 +117,7 @@ public class NotPointcut extends Pointcut {
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
NotPointcut ret = new NotPointcut(Pointcut.read(s, context));
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java View File

@@ -13,13 +13,13 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.VersionedDataInputStream;

/**
* !TypePattern
@@ -76,7 +76,7 @@ public class NotTypePattern extends TypePattern {
writeLocation(s);
}
public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
TypePattern ret = new NotTypePattern(TypePattern.read(s, context));
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java View File

@@ -9,13 +9,13 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.AnnotatedElement;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;

public class OrAnnotationTypePattern extends AnnotationTypePattern {
@@ -48,7 +48,7 @@ public class OrAnnotationTypePattern extends AnnotationTypePattern {
return this;
}

public static AnnotationTypePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
AnnotationTypePattern p = new OrAnnotationTypePattern(
AnnotationTypePattern.read(s,context),
AnnotationTypePattern.read(s,context));

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/OrPointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
@@ -26,6 +25,7 @@ import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.ast.Test;

public class OrPointcut extends Pointcut {
@@ -123,7 +123,7 @@ public class OrPointcut extends Pointcut {
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
OrPointcut ret = new OrPointcut(Pointcut.read(s, context), Pointcut.read(s, context));
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java View File

@@ -13,13 +13,13 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.VersionedDataInputStream;

/**
* left || right
@@ -79,7 +79,7 @@ public class OrTypePattern extends TypePattern {
writeLocation(s);
}
public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
TypePattern ret = new OrTypePattern(TypePattern.read(s, context), TypePattern.read(s, context));
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/PerCflow.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
@@ -33,6 +32,7 @@ import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;
import org.aspectj.weaver.ast.Expr;
import org.aspectj.weaver.ast.Test;
@@ -105,7 +105,7 @@ public class PerCflow extends PerClause {
writeLocation(s);
}
public static PerClause readPerClause(DataInputStream s, ISourceContext context) throws IOException {
public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException {
PerCflow ret = new PerCflow(Pointcut.read(s, context), s.readBoolean());
ret.readLocation(context, s);
return ret;

+ 2
- 3
weaver/src/org/aspectj/weaver/patterns/PerClause.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.IOException;

import org.aspectj.util.TypeSafeEnum;
@@ -22,7 +21,7 @@ import org.aspectj.weaver.*;
public abstract class PerClause extends Pointcut {
protected ResolvedTypeX inAspect;

public static PerClause readPerClause(DataInputStream s, ISourceContext context) throws IOException {
public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException {
Kind kind = Kind.read(s);
if (kind == SINGLETON) return PerSingleton.readPerClause(s, context);
else if (kind == PERCFLOW) return PerCflow.readPerClause(s, context);
@@ -43,7 +42,7 @@ public abstract class PerClause extends Pointcut {
public static class Kind extends TypeSafeEnum {
public Kind(String name, int key) { super(name, key); }
public static Kind read(DataInputStream s) throws IOException {
public static Kind read(VersionedDataInputStream s) throws IOException {
int key = s.readByte();
switch(key) {
case 1: return SINGLETON;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Set;
@@ -23,6 +22,7 @@ import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Test;

@@ -88,7 +88,7 @@ public class PerFromSuper extends PerClause {
writeLocation(s);
}
public static PerClause readPerClause(DataInputStream s, ISourceContext context) throws IOException {
public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException {
PerFromSuper ret = new PerFromSuper(Kind.read(s));
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/PerObject.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashSet;
@@ -28,6 +27,7 @@ import org.aspectj.weaver.PerObjectInterfaceTypeMunger;
import org.aspectj.weaver.ResolvedTypeMunger;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;
import org.aspectj.weaver.ast.Expr;
import org.aspectj.weaver.ast.Test;
@@ -115,7 +115,7 @@ public class PerObject extends PerClause {
writeLocation(s);
}
public static PerClause readPerClause(DataInputStream s, ISourceContext context) throws IOException {
public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException {
PerClause ret = new PerObject(Pointcut.read(s, context), s.readBoolean());
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/PerSingleton.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Set;
@@ -23,6 +22,7 @@ import org.aspectj.weaver.AjcMemberMaker;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.ast.Expr;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
@@ -71,7 +71,7 @@ public class PerSingleton extends PerClause {
writeLocation(s);
}
public static PerClause readPerClause(DataInputStream s, ISourceContext context) throws IOException {
public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException {
PerSingleton ret = new PerSingleton();
ret.readLocation(context, s);
return ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/Pointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
@@ -32,6 +31,7 @@ import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;

@@ -298,7 +298,7 @@ public abstract class Pointcut extends PatternNode implements PointcutExpression
//XXX currently it's unused we're keeping it around as a stub
public void postRead(ResolvedTypeX enclosingType) {}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
byte kind = s.readByte();
Pointcut ret;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
@@ -30,6 +29,7 @@ import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Test;

@@ -107,7 +107,7 @@ public class ReferencePointcut extends Pointcut {
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
TypeX onType = null;
if (s.readBoolean()) {
onType = TypeX.read(s);

+ 10
- 3
weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Constructor;
@@ -30,6 +29,7 @@ import org.aspectj.lang.reflect.AdviceSignature;
import org.aspectj.lang.reflect.ConstructorSignature;
import org.aspectj.lang.reflect.FieldSignature;
import org.aspectj.lang.reflect.MethodSignature;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.Constants;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.Member;
@@ -37,6 +37,7 @@ import org.aspectj.weaver.NameMangler;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;


@@ -516,7 +517,7 @@ public class SignaturePattern extends PatternNode {
writeLocation(s);
}

public static SignaturePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static SignaturePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
Member.Kind kind = Member.Kind.read(s);
ModifiersPattern modifiers = ModifiersPattern.read(s);
TypePattern returnType = TypePattern.read(s, context);
@@ -524,7 +525,13 @@ public class SignaturePattern extends PatternNode {
NamePattern name = NamePattern.read(s);
TypePatternList parameterTypes = TypePatternList.read(s, context);
ThrowsPattern throwsPattern = ThrowsPattern.read(s, context);
AnnotationTypePattern annotationPattern = AnnotationTypePattern.read(s,context);
AnnotationTypePattern annotationPattern = AnnotationTypePattern.ANY;
if (s.getMajorVersion()>=AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) {
annotationPattern = AnnotationTypePattern.read(s,context);
}

SignaturePattern ret = new SignaturePattern(kind, modifiers, returnType, declaringType,
name, parameterTypes, throwsPattern,annotationPattern);
ret.readLocation(context, s);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java View File

@@ -9,7 +9,6 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -28,6 +27,7 @@ import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
@@ -227,7 +227,7 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut {
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
boolean isThis = s.readBoolean();
AnnotationTypePattern type = AnnotationTypePattern.read(s, context);
ThisOrTargetAnnotationPointcut ret = new ThisOrTargetAnnotationPointcut(isThis,(ExactAnnotationTypePattern)type);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
@@ -32,6 +31,7 @@ import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
@@ -127,7 +127,7 @@ public class ThisOrTargetPointcut extends NameBindingPointcut {
type.write(s);
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
boolean isThis = s.readBoolean();
TypePattern type = TypePattern.read(s, context);
ThisOrTargetPointcut ret = new ThisOrTargetPointcut(isThis, type);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java View File

@@ -13,13 +13,13 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;


@@ -129,7 +129,7 @@ public class ThrowsPattern extends PatternNode {
return false;
}

public static ThrowsPattern read(DataInputStream s, ISourceContext context) throws IOException {
public static ThrowsPattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
TypePatternList required = TypePatternList.read(s, context);
TypePatternList forbidden = TypePatternList.read(s, context);
if (required.size() == 0 && forbidden.size() == 0) return ANY;

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/TypePattern.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Iterator;
@@ -25,6 +24,7 @@ import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;
/**
@@ -267,7 +267,7 @@ public abstract class TypePattern extends PatternNode {
public static final byte AND = 8;
public static final byte NO_KEY = 9;

public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
byte key = s.readByte();
switch(key) {
case WILD: return WildTypePattern.read(s, context);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/TypePatternList.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -25,6 +24,7 @@ import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;

public class TypePatternList extends PatternNode {
private TypePattern[] typePatterns;
@@ -471,7 +471,7 @@ public class TypePatternList extends PatternNode {
}

public static TypePatternList read(DataInputStream s, ISourceContext context) throws IOException {
public static TypePatternList read(VersionedDataInputStream s, ISourceContext context) throws IOException {
short len = s.readShort();
TypePattern[] arguments = new TypePattern[len];
for (int i=0; i<len; i++) {

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java View File

@@ -9,7 +9,6 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

@@ -20,6 +19,7 @@ import org.aspectj.weaver.AnnotatedElement;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;

@@ -102,7 +102,7 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern {
writeLocation(s);
}

public static AnnotationTypePattern read(DataInputStream s,ISourceContext context) throws IOException {
public static AnnotationTypePattern read(VersionedDataInputStream s,ISourceContext context) throws IOException {
AnnotationTypePattern ret;
byte version = s.readByte();
if (version > VERSION) {

+ 33
- 9
weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -24,10 +23,12 @@ import org.aspectj.bridge.Message;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.util.FileUtil;
import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;

//XXX need to use dim in matching
@@ -607,11 +608,36 @@ public class WildTypePattern extends TypePattern {
annotationPattern.write(s);
}
public static TypePattern read(DataInputStream s, ISourceContext context) throws IOException {
byte version = s.readByte();
if (version > VERSION) {
throw new BCException("WildTypePattern was written by a more recent version of AspectJ, cannot read");
}
public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
if (s.getMajorVersion()>=AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) {
return readTypePattern150(s,context);
} else {
return readTypePatternOldStyle(s,context);
}
}

public static TypePattern readTypePattern150(VersionedDataInputStream s, ISourceContext context) throws IOException {
byte version = s.readByte();
if (version > VERSION) {
throw new BCException("WildTypePattern was written by a more recent version of AspectJ, cannot read");
}
int len = s.readShort();
NamePattern[] namePatterns = new NamePattern[len];
for (int i=0; i < len; i++) {
namePatterns[i] = NamePattern.read(s);
}
boolean includeSubtypes = s.readBoolean();
int dim = s.readInt();
boolean varArg = s.readBoolean();
WildTypePattern ret = new WildTypePattern(namePatterns, includeSubtypes, dim, varArg);
ret.knownMatches = FileUtil.readStringArray(s);
ret.importedPrefixes = FileUtil.readStringArray(s);
ret.readLocation(context, s);
ret.setAnnotationTypePattern(AnnotationTypePattern.read(s,context));
return ret;
}
public static TypePattern readTypePatternOldStyle(VersionedDataInputStream s, ISourceContext context) throws IOException {
int len = s.readShort();
NamePattern[] namePatterns = new NamePattern[len];
for (int i=0; i < len; i++) {
@@ -619,12 +645,10 @@ public class WildTypePattern extends TypePattern {
}
boolean includeSubtypes = s.readBoolean();
int dim = s.readInt();
boolean varArg = s.readBoolean();
WildTypePattern ret = new WildTypePattern(namePatterns, includeSubtypes, dim,varArg);
WildTypePattern ret = new WildTypePattern(namePatterns, includeSubtypes, dim, false);
ret.knownMatches = FileUtil.readStringArray(s);
ret.importedPrefixes = FileUtil.readStringArray(s);
ret.readLocation(context, s);
ret.setAnnotationTypePattern(AnnotationTypePattern.read(s,context));
return ret;
}


+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java View File

@@ -9,7 +9,6 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -27,6 +26,7 @@ import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
@@ -162,7 +162,7 @@ public class WithinAnnotationPointcut extends NameBindingPointcut {
writeLocation(s);
}

public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
AnnotationTypePattern type = AnnotationTypePattern.read(s, context);
WithinAnnotationPointcut ret = new WithinAnnotationPointcut((ExactAnnotationTypePattern)type);
ret.readLocation(context, s);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java View File

@@ -9,7 +9,6 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -29,6 +28,7 @@ import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
import org.aspectj.weaver.ast.Var;
@@ -176,7 +176,7 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
writeLocation(s);
}

public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
AnnotationTypePattern type = AnnotationTypePattern.read(s, context);
WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern)type);
ret.readLocation(context, s);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
@@ -28,6 +27,7 @@ import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
@@ -121,7 +121,7 @@ public class WithinPointcut extends Pointcut {
typePattern.write(s);
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
TypePattern type = TypePattern.read(s, context);
WithinPointcut ret = new WithinPointcut(type);
ret.readLocation(context, s);

+ 2
- 2
weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java View File

@@ -13,7 +13,6 @@

package org.aspectj.weaver.patterns;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
@@ -27,6 +26,7 @@ import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;

@@ -91,7 +91,7 @@ public class WithincodePointcut extends Pointcut {
writeLocation(s);
}
public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
WithincodePointcut ret = new WithincodePointcut(SignaturePattern.read(s, context));
ret.readLocation(context, s);
return ret;

+ 1
- 1
weaver/testsrc/org/aspectj/weaver/bcel/PatternWeaveTestCase.java View File

@@ -108,7 +108,7 @@ public class PatternWeaveTestCase extends WeaveTestCase {
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
DataInputStream in = new DataInputStream(bi);
VersionedDataInputStream in = new VersionedDataInputStream(bi);
Pointcut newP = Pointcut.read(in, null);
assertEquals("write/read", p, newP);

+ 1
- 1
weaver/testsrc/org/aspectj/weaver/bcel/PointcutResidueTestCase.java View File

@@ -226,7 +226,7 @@ public class PointcutResidueTestCase extends WeaveTestCase {
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
DataInputStream in = new DataInputStream(bi);
VersionedDataInputStream in = new VersionedDataInputStream(bi);
Pointcut newP = Pointcut.read(in, null);
assertEquals("write/read", p, newP);

+ 1
- 1
weaver/testsrc/org/aspectj/weaver/patterns/AndOrNotTestCase.java View File

@@ -142,7 +142,7 @@ public class AndOrNotTestCase extends TestCase {
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
DataInputStream in = new DataInputStream(bi);
VersionedDataInputStream in = new VersionedDataInputStream(bi);
Pointcut newP = Pointcut.read(in, null);
assertEquals("write/read", p, newP);

+ 3
- 1
weaver/testsrc/org/aspectj/weaver/patterns/DeclareErrorOrWarningTestCase.java View File

@@ -15,6 +15,8 @@ package org.aspectj.weaver.patterns;

import java.io.*;

import org.aspectj.weaver.VersionedDataInputStream;

import junit.framework.TestCase;

public class DeclareErrorOrWarningTestCase extends TestCase {
@@ -53,7 +55,7 @@ public class DeclareErrorOrWarningTestCase extends TestCase {
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
DataInputStream in = new DataInputStream(bi);
VersionedDataInputStream in = new VersionedDataInputStream(bi);
Declare newDeclare = Declare.read(in, null);
assertEquals("write/read", declare, newDeclare);

+ 1
- 1
weaver/testsrc/org/aspectj/weaver/patterns/ModifiersPatternTestCase.java View File

@@ -130,7 +130,7 @@ public class ModifiersPatternTestCase extends TestCase {
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
DataInputStream in = new DataInputStream(bi);
VersionedDataInputStream in = new VersionedDataInputStream(bi);
ModifiersPattern newP = ModifiersPattern.read(in);
assertEquals("write/read", p, newP);

+ 3
- 2
weaver/testsrc/org/aspectj/weaver/patterns/NamePatternTestCase.java View File

@@ -15,10 +15,11 @@ package org.aspectj.weaver.patterns;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.aspectj.weaver.VersionedDataInputStream;

import junit.framework.TestCase;

/**
@@ -111,7 +112,7 @@ public class NamePatternTestCase extends TestCase {
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
DataInputStream in = new DataInputStream(bi);
VersionedDataInputStream in = new VersionedDataInputStream(bi);
NamePattern newP = NamePattern.read(in);
assertEquals("write/read", p, newP);

+ 1
- 1
weaver/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java View File

@@ -166,7 +166,7 @@ public class SignaturePatternTestCase extends TestCase {
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
DataInputStream in = new DataInputStream(bi);
VersionedDataInputStream in = new VersionedDataInputStream(bi);
SignaturePattern newP = SignaturePattern.read(in, null);
assertEquals("write/read", p, newP);

+ 1
- 1
weaver/testsrc/org/aspectj/weaver/patterns/TypePatternListTestCase.java View File

@@ -181,7 +181,7 @@ public class TypePatternListTestCase extends TestCase {
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
DataInputStream in = new DataInputStream(bi);
VersionedDataInputStream in = new VersionedDataInputStream(bi);
TypePatternList newP = TypePatternList.read(in, null);
assertEquals("write/read", p, newP);

+ 1
- 1
weaver/testsrc/org/aspectj/weaver/patterns/TypePatternTestCase.java View File

@@ -294,7 +294,7 @@ public class TypePatternTestCase extends TestCase {
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
DataInputStream in = new DataInputStream(bi);
VersionedDataInputStream in = new VersionedDataInputStream(bi);
TypePattern newP = TypePattern.read(in, null);
assertEquals("write/read", p, newP);

+ 1
- 1
weaver/testsrc/org/aspectj/weaver/patterns/WithinTestCase.java View File

@@ -117,7 +117,7 @@ public class WithinTestCase extends TestCase {
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
DataInputStream in = new DataInputStream(bi);
VersionedDataInputStream in = new VersionedDataInputStream(bi);
Pointcut newP = Pointcut.read(in, null);
assertEquals("write/read", p, newP);

Loading…
Cancel
Save