From 1468daa88534262ebdd209574d3be360a0c78143 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 20 Jun 2006 07:51:45 +0000 Subject: [PATCH] test and fix for 147701: @DeclareParents: was failing to include package name for checked exceptions, failing to report when impl class didnt implement interface --- .../aspectj/systemtest/ajc152/Ajc152Tests.java | 3 +++ .../src/org/aspectj/systemtest/ajc152/ajc152.xml | 16 ++++++++++++++++ .../org/aspectj/weaver/bcel/AtAjAttributes.java | 3 +++ .../org/aspectj/weaver/bcel/BcelTypeMunger.java | 1 - .../src/org/aspectj/weaver/bcel/BcelWorld.java | 2 +- 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java index c33abb8ab..6871867d8 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -32,6 +32,9 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // public void testBrokenIfArgsCflowAtAj_pr145018() { runTest("ataj crashing with cflow, if and args");} // public void testItdCallingGenericMethod_pr145391() { runTest("itd calling generic method");} // public void testItdCallingGenericMethod_pr145391_2() { runTest("itd calling generic method - 2");} + public void testPackageIgnoredForException_pr147701_1() { runTest("package for exception ignored");} + public void testPackageIgnoredForException_pr147701_2() { runTest("package for exception ignored - 2");} + public void testPackageIgnoredForException_pr147701_3() { runTest("package for exception ignored - 3");} public void testBrokenAddSerialVersionUID_pr145950() {runTest("fails to discover Serializable");} public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_1() {runTest("no unnecessary declaration of thrown exception warning - 1");} public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_2() {runTest("no unnecessary declaration of thrown exception warning - 2");} diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml index 77e80c794..1525089a0 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml @@ -630,6 +630,22 @@ + + + + + + + + + + + + + + + + diff --git a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java index ed676fde9..4e28a619e 100644 --- a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java +++ b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java @@ -734,6 +734,9 @@ public class AtAjAttributes { + defaultImplClassName + "\" has no public no-arg constructor", struct); } + if (!fieldType.isAssignableFrom(impl)) { + reportError("@DeclareParents: defaultImpl=\""+defaultImplClassName+"\" does not implement the interface '"+fieldType.toString()+"'",struct); + } } } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java index c7cc01c79..cee9a43f0 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -1168,7 +1168,6 @@ public class BcelTypeMunger extends ConcreteTypeMunger { ); mg.getBody().append(body); - // XXX make sure to check that we set exceptions properly on this guy. weaver.addLazyMethodGen(mg); weaver.getLazyClassGen().warnOnAddedMethod(mg.getMethod(),getSignature().getSourceLocation()); return true; diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java index e75f79a27..c06f963c0 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java @@ -227,7 +227,7 @@ public class BcelWorld extends World implements Repository { static String[] makeBcelTypesAsClassNames(UnresolvedType[] types) { String[] ret = new String[types.length]; for (int i = 0, len = types.length; i < len; i++) { - ret[i] = types[i].getClassName();//makeBcelType(types[i]); + ret[i] = types[i].getName(); } return ret; } -- 2.39.5