summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bugs150/SimpleInsuranceFailure/model/validation/BusinessRulesValidation.aj29
-rw-r--r--tests/bugs150/SimpleInsuranceFailure/model/validation/SIValidationException.java30
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml4
-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
11 files changed, 89 insertions, 5 deletions
diff --git a/tests/bugs150/SimpleInsuranceFailure/model/validation/BusinessRulesValidation.aj b/tests/bugs150/SimpleInsuranceFailure/model/validation/BusinessRulesValidation.aj
new file mode 100644
index 000000000..b733b110a
--- /dev/null
+++ b/tests/bugs150/SimpleInsuranceFailure/model/validation/BusinessRulesValidation.aj
@@ -0,0 +1,29 @@
+package insurance.model.validation;
+
+import java.util.*;
+import insurance.model.*;
+
+public aspect BusinessRulesValidation {
+
+ private Map validatorsByType = new HashMap();
+
+ // RequiresValidation interface
+
+ public interface RequiresValidation {}
+
+ public List RequiresValidation.getValidationErrors() {
+ if (this.validationErrors == null) {
+ this.validationErrors = new ArrayList();
+ }
+ return validationErrors;
+ }
+
+ private List RequiresValidation.validationErrors;
+
+ // Triggering validation
+ void foo(RequiresValidation domainObject) {
+ throw new SIValidationException(
+ domainObject, domainObject.getValidationErrors());
+ }
+
+}
diff --git a/tests/bugs150/SimpleInsuranceFailure/model/validation/SIValidationException.java b/tests/bugs150/SimpleInsuranceFailure/model/validation/SIValidationException.java
new file mode 100644
index 000000000..99d33c590
--- /dev/null
+++ b/tests/bugs150/SimpleInsuranceFailure/model/validation/SIValidationException.java
@@ -0,0 +1,30 @@
+/*
+ * Created on 18-Jul-2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package insurance.model.validation;
+
+import java.util.List;
+
+/**
+ * @author AndyClement
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class SIValidationException extends RuntimeException {
+
+ private List validationErrors;
+
+ public SIValidationException(BusinessRulesValidation.RequiresValidation obj,java.util.List validationErrors) {
+ super("Business object " + obj + " failed validation");
+ this.validationErrors = validationErrors;
+ }
+
+ public List getValidationErrors() {
+ return validationErrors;
+ }
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index 786716645..bbecd104e 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -430,6 +430,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("no verify error on generic collection member access");
}
+ public void testRawAndGenericTypeConversionITDCons() {
+ runTest("raw and generic type conversion with itd cons");
+ }
+
// helper methods.....
public SyntheticRepository createRepos(File cpentry) {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 5029e4bc6..1014ea653 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -555,6 +555,10 @@
</compile>
</ajc-test>
+ <ajc-test dir="bugs150/SimpleInsuranceFailure" title="raw and generic type conversion with itd cons">
+ <compile files="" options=" -emacssym, -sourceroots ." >
+ </compile>
+ </ajc-test>
<!-- ============================================================================ -->
<!-- ============================================================================ -->
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."});