From 191c26bb4fc0b90a183e4448ab57d9b62fed429c Mon Sep 17 00:00:00 2001 From: avasseur Date: Mon, 13 Jun 2005 09:21:14 +0000 Subject: [PATCH] fixed bug with LTW Xreweavable, fix this reflective issue in RunAllBeforeCommit (was misnamed..) --- run-all-junit-tests/testsrc/AllTests.java | 2 +- .../org/aspectj/testing/util/TestUtil.java | 4 ++-- tests/java5/ataspectj/ajc-ant.xml | 1 + .../ataspectj/ataspectj/PerClauseTest.java | 2 +- .../ajc150/ataspectj/AtAjLTWTests.java | 15 ++++++------ .../aspectj/weaver/bcel/AtAjAttributes.java | 1 + .../org/aspectj/weaver/bcel/BcelWeaver.java | 24 ++++--------------- 7 files changed, 19 insertions(+), 30 deletions(-) diff --git a/run-all-junit-tests/testsrc/AllTests.java b/run-all-junit-tests/testsrc/AllTests.java index 116812b20..57ccf35bf 100644 --- a/run-all-junit-tests/testsrc/AllTests.java +++ b/run-all-junit-tests/testsrc/AllTests.java @@ -46,7 +46,7 @@ public class AllTests extends TestCase { // with 1.5, i.e., wrong class version to load under 1.3 // so the class name can only be used reflectively TestUtil.loadTestsReflectively(suite, "Aspectj5rtModuleTests", false); - TestUtil.loadTestsReflectively(suite, "Loadtime5ModuleTests", false); + TestUtil.loadTestsReflectively(suite, "Loadtime515ModuleTests", false); } else { suite.addTest(TestUtil.skipTest("for 1.5")); } diff --git a/testing-util/src/org/aspectj/testing/util/TestUtil.java b/testing-util/src/org/aspectj/testing/util/TestUtil.java index ecd738478..16d0a396a 100644 --- a/testing-util/src/org/aspectj/testing/util/TestUtil.java +++ b/testing-util/src/org/aspectj/testing/util/TestUtil.java @@ -204,7 +204,7 @@ public final class TestUtil { } /** - * @param s the String to parse for [on|off|true|false] + * @param input the String to parse for [on|off|true|false] * @throws IllegalArgumentException if input is bad **/ public static boolean parseBoolean(String input) { @@ -212,7 +212,7 @@ public final class TestUtil { } /** - * @param s the String to parse for [on|off|true|false] + * @param input the String to parse for [on|off|true|false] * @param iaxOnError if true and input is bad, throw * IllegalArgumentException * @return true if input is true, false otherwise diff --git a/tests/java5/ataspectj/ajc-ant.xml b/tests/java5/ataspectj/ajc-ant.xml index 85f1367da..0703756e5 100644 --- a/tests/java5/ataspectj/ajc-ant.xml +++ b/tests/java5/ataspectj/ajc-ant.xml @@ -30,6 +30,7 @@ + diff --git a/tests/java5/ataspectj/ataspectj/PerClauseTest.java b/tests/java5/ataspectj/ataspectj/PerClauseTest.java index 268873696..08e019489 100644 --- a/tests/java5/ataspectj/ataspectj/PerClauseTest.java +++ b/tests/java5/ataspectj/ataspectj/PerClauseTest.java @@ -203,7 +203,7 @@ public class PerClauseTest extends TestCase { ;//ok } } - + static class PTW1 { static void foo() {}; } diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java index 5bc6ea025..145426d70 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java @@ -36,14 +36,15 @@ public class AtAjLTWTests extends XMLBasedAjcTestCase { public void testAjcLTWPerClauseTest_XnoWeave() { runTest("AjcLTW PerClauseTest -XnoWeave"); } +//FIXME AV - fails with ?? ataspectj\PerClauseTestAspects.java::0 the parameter jp is not bound in [all branches of] pointcut // -// public void testAjcLTWPerClauseTest_Xreweavable() { -// runTest("AjcLTW PerClauseTest -Xreweavable"); -// } -// -// public void testJavaCAjcLTWPerClauseTest() { -// runTest("JavaCAjcLTW PerClauseTest"); -// } + public void testAjcLTWPerClauseTest_Xreweavable() { + runTest("AjcLTW PerClauseTest -Xreweavable"); + } + + public void testJavaCAjcLTWPerClauseTest() { + runTest("JavaCAjcLTW PerClauseTest"); + } public void testAjcLTWAroundInlineMungerTest_XnoWeave() { runTest("AjcLTW AroundInlineMungerTest -XnoWeave"); diff --git a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java index f3a8cf88f..98ad849bb 100644 --- a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java +++ b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java @@ -541,6 +541,7 @@ public class AtAjAttributes { Pointcut pc = null; if (preResolvedPointcut != null) { pc = preResolvedPointcut.getPointcut(); + //pc.resolve(binding); } else { pc = parsePointcut(beforeAdvice.getValue().stringifyValue(), struct, false); if (pc == null) return false;//parse error diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index ade0a191f..a96237b19 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -242,8 +242,7 @@ public class BcelWeaver implements IWeaver { // // The ANT copy task should be used to copy resources across. // private final static boolean CopyResourcesFromInpathDirectoriesToOutput=false; - private Set alreadyConfirmedReweavableState; - + /** * Add any .class files in the directory to the outdir. Anything other than .class files in * the directory (or its subdirectories) are considered resources and are also copied. @@ -486,6 +485,7 @@ public class BcelWeaver implements IWeaver { int numArgs = advice.getSignature().getParameterTypes().length; if (numFormals > 0) { names = advice.getSignature().getParameterNames(world); + System.out.println(advice.getSignature().toLongString());//AVB validateBindings(newP,p,numArgs,names); } } else { @@ -947,18 +947,6 @@ public class BcelWeaver implements IWeaver { processReweavableStateIfPresent(className, classType); } - // register all aspect that have been extracted from reweavable state for LTW - // note: when doing AJC, the missing aspect is already catch in the previous state thru Type.MISSING - if (alreadyConfirmedReweavableState != null) { - for (Iterator iterator = alreadyConfirmedReweavableState.iterator(); iterator.hasNext();) { - String aspectClassName = (String) iterator.next(); - addLibraryAspect(aspectClassName); - } - // refresh all the stuff... perhaps too much here... - if (!alreadyConfirmedReweavableState.isEmpty()) - prepareForWeave(); - } - requestor.addingTypeMungers(); // We process type mungers in two groups, first mungers that change the type @@ -1075,9 +1063,6 @@ public class BcelWeaver implements IWeaver { world.showMessage(IMessage.INFO, WeaverMessages.format(WeaverMessages.REWEAVABLE_MODE), null, null); - - //TODO AV - can't we avoid this creation (LTW = happens for each class load!) - alreadyConfirmedReweavableState = new HashSet(); } public void processReweavableStateIfPresent(String className, BcelObjectType classType) { @@ -1089,6 +1074,8 @@ public class BcelWeaver implements IWeaver { null,null); Set aspectsPreviouslyInWorld = wsi.getAspectsAffectingType(); if (aspectsPreviouslyInWorld!=null) { + // keep track of them just to ensure unique missing aspect error reporting + Set alreadyConfirmedReweavableState = new HashSet(); for (Iterator iter = aspectsPreviouslyInWorld.iterator(); iter.hasNext();) { String requiredTypeName = (String) iter.next(); if (!alreadyConfirmedReweavableState.contains(requiredTypeName)) { @@ -1171,8 +1158,7 @@ public class BcelWeaver implements IWeaver { onType.clearInterTypeMungers(); List decpToRepeat = new ArrayList(); - List decaToRepeat = new ArrayList(); - + boolean aParentChangeOccurred = false; boolean anAnnotationChangeOccurred = false; // First pass - apply all decp mungers -- 2.39.5