From df3adcd1825893130a1873dfcad1bd82e5b9f70b Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 12 Dec 2005 19:16:06 +0000 Subject: [PATCH] fixes and tests for 119570 (member type subaspect) --- .../compiler/lookup/AjLookupEnvironment.java | 37 +++++++++++++------ .../PR119570/base/bugs/ParameterizedDP.java | 4 +- .../systemtest/ajc150/Ajc150Tests.java | 4 +- .../org/aspectj/systemtest/ajc150/ajc150.xml | 12 ++++++ .../tools/MultiProjectIncrementalTests.java | 3 +- 5 files changed, 43 insertions(+), 17 deletions(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index 966f2c564..9174ef4ca 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -289,6 +289,19 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC } + public void doSupertypesFirst(ReferenceBinding rb,Collection yetToProcess) { + if (rb instanceof SourceTypeBinding) { + if (yetToProcess.contains(rb)) { + collectAllITDsAndDeclares((SourceTypeBinding)rb, yetToProcess); + } + } else if (rb instanceof ParameterizedTypeBinding) { + // If its a PTB we need to pull the SourceTypeBinding out of it. + ParameterizedTypeBinding ptb = (ParameterizedTypeBinding)rb; + if (ptb.type instanceof SourceTypeBinding && yetToProcess.contains(ptb.type)) { + collectAllITDsAndDeclares((SourceTypeBinding)ptb.type, yetToProcess); + } + } + } /** * Find all the ITDs and Declares, but it is important we do this from the supertypes * down to the subtypes. @@ -298,18 +311,18 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC private void collectAllITDsAndDeclares(SourceTypeBinding sourceType, Collection yetToProcess) { // Look at the supertype first ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.COLLECTING_ITDS_AND_DECLARES, sourceType.sourceName); - ReferenceBinding superType = sourceType.superclass(); - if (superType instanceof SourceTypeBinding) { - if (yetToProcess.contains(superType)) { - collectAllITDsAndDeclares((SourceTypeBinding)superType, yetToProcess); - } - } else if (superType instanceof ParameterizedTypeBinding) { - // If its a PTB we need to pull the SourceTypeBinding out of it. - ParameterizedTypeBinding ptb = (ParameterizedTypeBinding)superType; - if (ptb.type instanceof SourceTypeBinding && yetToProcess.contains(ptb.type)) { - collectAllITDsAndDeclares((SourceTypeBinding)ptb.type, yetToProcess); - } - } + + // look out our direct supertype + doSupertypesFirst(sourceType.superclass(),yetToProcess); + + // now check our membertypes (pr119570) + ReferenceBinding[] memberTypes = sourceType.memberTypes; + for (int i = 0, length = memberTypes.length; i < length; i++) { + SourceTypeBinding rb = (SourceTypeBinding)memberTypes[i]; + if (!rb.superclass().equals(sourceType)) + doSupertypesFirst(rb.superclass(),yetToProcess); + } + buildInterTypeAndPerClause(sourceType.scope); addCrosscuttingStructures(sourceType.scope); yetToProcess.remove(sourceType); diff --git a/tests/multiIncremental/PR119570/base/bugs/ParameterizedDP.java b/tests/multiIncremental/PR119570/base/bugs/ParameterizedDP.java index e35fbd207..d3210cde7 100644 --- a/tests/multiIncremental/PR119570/base/bugs/ParameterizedDP.java +++ b/tests/multiIncremental/PR119570/base/bugs/ParameterizedDP.java @@ -22,6 +22,6 @@ class TaggedTexts { // unneeded declare-parents duplicates one in NodeImpl // when here, get spurious error message // when commented out, d-p fails and get compiler error at 1) above - declare parents : Tag implements INode; +// declare parents : Tag implements INode; } -} \ No newline at end of file +} diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java index faf86ad29..bba83eeeb 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -51,6 +51,7 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testCunningDeclareParents_pr92311() { runTest("cunning declare parents");} public void testGenericITDsAndAbstractMethodError_pr102357() { runTest("generic itds and abstract method error");} */ + //public void testIncorrectSignatureMatchingWithExceptions_pr119749() { runTest("incorrect exception signature matching");} public void testGeneratingCodeForAnOldRuntime_pr116679_1() { runTest("generating code for a 1.2.1 runtime - 1");} public void testGeneratingCodeForAnOldRuntime_pr116679_2() { runTest("generating code for a 1.2.1 runtime - 2");} public void testAmbiguousMethod_pr118599_1() { runTest("ambiguous method when binary weaving - 1");} @@ -86,7 +87,8 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testBadDecp_pr110788_2() { runTest("bad generic decp - 2");} public void testBadDecp_pr110788_3() { runTest("bad generic decp - 3");} public void testBadDecp_pr110788_4() { runTest("bad generic decp - 4");} - public void testSpuriousOverrideMethodWarning_pr119570() { runTest("spurious override method warning");} + public void testSpuriousOverrideMethodWarning_pr119570_1() { runTest("spurious override method warning");} + public void testSpuriousOverrideMethodWarning_pr119570_2() { runTest("spurious override method warning - 2");} public void testBrokenSwitch_pr117854() { runTest("broken switch transform");} public void testVarargsITD_pr110906() { runTest("ITD varargs problem");} public void testBadRenderer_pr86903() { runTest("bcelrenderer bad");} diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 99628ba9b..27b59d27f 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -72,6 +72,11 @@ + + + + + @@ -126,6 +131,13 @@ + + + + + + + diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index b38feb72b..e38ff536b 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -293,8 +293,7 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed { public void testPr119570() { initialiseProject("PR119570"); build("PR119570"); - List l = MyTaskListManager.getWarningMessages(); - assertTrue("Should be no warnings, but got "+l,l.size()==0); + assertTrue("Should be no errors, but got "+MyTaskListManager.getErrorMessages(),MyTaskListManager.getErrorMessages().size()==0); } public void testPr119570_2() { -- 2.39.5