aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-12 20:17:18 +0000
committeracolyer <acolyer>2005-09-12 20:17:18 +0000
commit056db42f1697ed27a47e04759bfb8162acd92590 (patch)
tree3dc54476bd1499898f669af72162f03df065e90b /weaver
parent776613eebf410baacd178bf73f3de0783f5df98f (diff)
downloadaspectj-056db42f1697ed27a47e04759bfb8162acd92590.tar.gz
aspectj-056db42f1697ed27a47e04759bfb8162acd92590.zip
tests and a fix for the bug with no name, in which Pooh gets carried away and tries to create raw types all the time, but Christopher Robin kindly explains that raw types should only be created in -1.5 mode.
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java4
-rw-r--r--weaver/src/org/aspectj/weaver/World.java2
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelPerClauseAspectAdder.java3
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelShadow.java3
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java10
-rw-r--r--weaver/testsrc/org/aspectj/weaver/ReferenceTypeTestCase.java4
-rw-r--r--weaver/testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java1
7 files changed, 22 insertions, 5 deletions
diff --git a/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java b/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java
index 73e0cbd92..e51e40a14 100644
--- a/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java
+++ b/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java
@@ -43,6 +43,10 @@ public abstract class ConcreteTypeMunger implements PartialOrder.PartialComparab
return munger.getSignature();
}
+ public World getWorld() {
+ return aspectType.getWorld();
+ }
+
public ISourceLocation getSourceLocation() {
if (munger == null) return null;
return munger.getSourceLocation(); //XXX
diff --git a/weaver/src/org/aspectj/weaver/World.java b/weaver/src/org/aspectj/weaver/World.java
index fbd8edf37..87d021bf1 100644
--- a/weaver/src/org/aspectj/weaver/World.java
+++ b/weaver/src/org/aspectj/weaver/World.java
@@ -282,7 +282,7 @@ public abstract class World implements Dump.INode {
ReferenceTypeDelegate delegate = resolveDelegate(simpleOrRawType);
if (delegate == null) return ResolvedType.MISSING;
- if (delegate.isGeneric()) {
+ if (delegate.isGeneric() && behaveInJava5Way) {
// ======== raw type ===========
simpleOrRawType.typeKind = TypeKind.RAW;
ReferenceType genericType = new ReferenceType(
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelPerClauseAspectAdder.java b/weaver/src/org/aspectj/weaver/bcel/BcelPerClauseAspectAdder.java
index 87ca7852b..724c06816 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelPerClauseAspectAdder.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelPerClauseAspectAdder.java
@@ -69,7 +69,8 @@ public class BcelPerClauseAspectAdder extends BcelTypeMunger {
"java.lang.Object",
null,
Constants.ACC_INTERFACE + Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT,
- new String[0]
+ new String[0],
+ getWorld()
);
interfaceGen.addMethodGen(makeMethodGen(interfaceGen, AjcMemberMaker.perObjectInterfaceGet(aspectType)));
interfaceGen.addMethodGen(makeMethodGen(interfaceGen, AjcMemberMaker.perObjectInterfaceSet(aspectType)));
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
index 5125ecc39..1dc4c52e8 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
@@ -2722,7 +2722,8 @@ public class BcelShadow extends Shadow {
superClassName,
getEnclosingClass().getFileName(),
Modifier.PUBLIC,
- new String[] {});
+ new String[] {},
+ getWorld());
InstructionFactory fact = new InstructionFactory(closureClass.getConstantPoolGen());
// constructor
diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
index f75ec647f..946dc4869 100644
--- a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
+++ b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
@@ -87,6 +87,7 @@ public final class LazyClassGen {
private BcelObjectType myType; // XXX is not set for types we create
private ClassGen myGen;
private ConstantPoolGen constantPoolGen;
+ private World world;
private List /*LazyMethodGen*/ methodGens = new ArrayList();
private List /*LazyClassGen*/ classGens = new ArrayList();
@@ -236,12 +237,14 @@ public final class LazyClassGen {
String super_class_name,
String file_name,
int access_flags,
- String[] interfaces)
+ String[] interfaces,
+ World world)
{
myGen = new ClassGen(class_name, super_class_name, file_name, access_flags, interfaces);
constantPoolGen = myGen.getConstantPool();
fact = new InstructionFactory(myGen, constantPoolGen);
regenerateGenericSignatureAttribute = true;
+ this.world = world;
}
//Non child type, so it comes from a real type in the world.
@@ -250,6 +253,7 @@ public final class LazyClassGen {
constantPoolGen = myGen.getConstantPool();
fact = new InstructionFactory(myGen, constantPoolGen);
this.myType = myType;
+ this.world = myType.getResolvedTypeX().getWorld();
/* Does this class support serialization */
if (UnresolvedType.SERIALIZABLE.resolve(getType().getWorld()).isAssignableFrom(getType())) {
@@ -386,7 +390,7 @@ public final class LazyClassGen {
}
public World getWorld () {
- return myType.getResolvedTypeX().getWorld();
+ return world;
}
public List getMethodGens() {
@@ -485,6 +489,8 @@ public final class LazyClassGen {
*/
private void fixupGenericSignatureAttribute () {
+ if (getWorld() != null && !getWorld().isInJava5Mode()) return;
+
// TODO asc generics Temporarily assume that types we generate dont need a signature attribute (closure/etc).. will need revisiting no doubt...
if (myType==null) return;
diff --git a/weaver/testsrc/org/aspectj/weaver/ReferenceTypeTestCase.java b/weaver/testsrc/org/aspectj/weaver/ReferenceTypeTestCase.java
index 1e0e435c7..0d84c135a 100644
--- a/weaver/testsrc/org/aspectj/weaver/ReferenceTypeTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/ReferenceTypeTestCase.java
@@ -21,6 +21,7 @@ public class ReferenceTypeTestCase extends TestCase {
public void testIsRawTrue() {
BcelWorld world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
UnresolvedType javaLangClass = UnresolvedType.forName("java.lang.Class");
ResolvedType rtx = world.resolve(javaLangClass);
assertTrue("Resolves to reference type",(rtx instanceof ReferenceType));
@@ -30,6 +31,7 @@ public class ReferenceTypeTestCase extends TestCase {
public void testIsRawFalse() {
BcelWorld world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
UnresolvedType javaLangObject = UnresolvedType.forName("java.lang.Object");
ResolvedType rtx = world.resolve(javaLangObject);
assertTrue("Resolves to reference type",(rtx instanceof ReferenceType));
@@ -39,6 +41,7 @@ public class ReferenceTypeTestCase extends TestCase {
public void testIsGenericTrue() {
BcelWorld world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
UnresolvedType javaLangClass = UnresolvedType.forName("java.lang.Class");
ResolvedType rtx = world.resolve(javaLangClass);
assertTrue("java.lang.Class has underpinning generic type",rtx.getGenericType().isGenericType());
@@ -46,6 +49,7 @@ public class ReferenceTypeTestCase extends TestCase {
public void testIsGenericFalse() {
BcelWorld world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
UnresolvedType javaLangObject = UnresolvedType.forName("java.lang.Object");
ResolvedType rtx = world.resolve(javaLangObject);
assertFalse(rtx.isGenericType());
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java b/weaver/testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java
index 59fdb7d63..e9db3caa8 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java
@@ -450,6 +450,7 @@ import org.aspectj.weaver.bcel.BcelWorld;
protected void setUp() throws Exception {
super.setUp();
this.world = new BcelWorld();
+ this.world.setBehaveInJava5Way(true);
this.bindings = new Bindings(0);
this.scope = new SimpleScope(world , new FormalBinding[] {});
this.scope.setImportedPrefixes(new String[] {"java.io.","java.util.","java.lang."});