]> source.dussan.org Git - aspectj.git/commitdiff
Fix more LTW tests
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Wed, 23 Mar 2022 04:55:22 +0000 (11:55 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Wed, 23 Mar 2022 04:55:22 +0000 (11:55 +0700)
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
testing/src/test/java/org/aspectj/testing/RunSpec.java
tests/src/test/resources/org/aspectj/systemtest/ajc150/ltw/ltw.xml
tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml

index d687ae86ba2de40441bfb5a9eeb4960eb03be115..534ed6374427076b5531721bbfc59ee32234014e 100644 (file)
@@ -22,7 +22,7 @@ import java.util.StringTokenizer;
 import org.aspectj.tools.ajc.AjcTestCase;
 import org.aspectj.util.FileUtil;
 
-import static org.aspectj.util.LangUtil.is16VMOrGreater;
+import static org.aspectj.util.LangUtil.is9VMOrGreater;
 
 /**
  * @author Adrian Colyer
@@ -70,7 +70,11 @@ public class RunSpec implements ITestStep {
                        // On Java 16+, LTW no longer works without this parameter. Add the argument here and not in AjcTestCase::run,
                        // because even if 'useLTW' and 'useFullLTW' are not set, we might in the future have tests for weaver attachment
                        // during runtime. See also docs/dist/doc/README-187.html.
-                       vmargs += is16VMOrGreater() ? " --add-opens java.base/java.lang=ALL-UNNAMED" : "";
+                       //
+                       // The reason for setting this parameter for Java 9+ instead of 16+ is that it helps to avoid the JVM printing
+                       // unwanted illegal access warnings during weaving in 'useFullLTW' mode, either making existing tests fail or
+                       // having to assert on the warning messages.
+                       vmargs += is9VMOrGreater() ? " --add-opens java.base/java.lang=ALL-UNNAMED" : "";
 
                        AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(), getModuleToRun(), args, vmargs, getClasspath(), getModulepath(), useLtw, "true".equalsIgnoreCase(usefullltw));
 
index 975b35cd82336b010efb7c508e83fa4e5742db37..6e66e388e22b99214cde76778f800d184eefedb1 100644 (file)
                        <line text="Main.test1" />
                        <line text="Main.test2" />
                </stdout>
-               <stderr>
+               <stderr ordered="no">
                        <line text="info AspectJ Weaver Version" />
                        <line text="info register classloader" />
                        <line text="info using" />
                        <line text="debug weaving 'ConcreteAspect'" />
                        <line text="debug generating class 'ConcreteAspect'" />
                        <line text="debug weaving 'Main'" />
+
+                       <!-- In full LTW mode with weaver option '-debug' in aop.xml, the weaver prints this -->
+                       <line text="debug cannot weave 'org.aspectj.lang.Signature'" />
+                       <line text="debug cannot weave 'org.aspectj.runtime.reflect.Factory'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.JoinPoint$StaticPart'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.JoinPoint$EnclosingStaticPart'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.JoinPoint'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.reflect.MethodSignature'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.reflect.CodeSignature'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.reflect.MemberSignature'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.reflect.ConstructorSignature'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.reflect.FieldSignature'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.reflect.AdviceSignature'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.reflect.CatchClauseSignature'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.reflect.LockSignature'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.reflect.UnlockSignature'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.reflect.InitializerSignature'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.reflect.SourceLocation'" />
+                       <line text="debug cannot weave 'org.aspectj.runtime.reflect.MethodSignatureImpl'" />
+                       <line text="debug cannot weave 'org.aspectj.runtime.reflect.CodeSignatureImpl'" />
+                       <line text="debug cannot weave 'org.aspectj.runtime.reflect.MemberSignatureImpl'" />
+                       <line text="debug cannot weave 'org.aspectj.runtime.reflect.SignatureImpl'" />
+                       <line text="debug cannot weave 'org.aspectj.runtime.reflect.SignatureImpl$Cache'" />
+                       <line text="debug cannot weave 'org.aspectj.runtime.reflect.JoinPointImpl$StaticPartImpl'" />
+                       <line text="debug cannot weave 'org.aspectj.runtime.reflect.SourceLocationImpl'" />
+                       <line text="debug cannot weave 'org.aspectj.lang.NoAspectBoundException'" />
+
                        <line text="AbstractSuperAspect.before_test1" />
                </stderr>
        </run>
                        text="this affected type is not exposed to the weaver: TestITDMethod" />
        </compile>
        <run class="TestITDMethod" options="test"
-               ltw="aop-abstractaspect.xml">
+               ltw="aop-abstractaspect.xml" usefullltw="true">
                <stdout>
                        <line text="TestITDMethod.main" />
                </stdout>
index 11049dcf96923dac9733fffcfd2ad5d0be406e59..aade93bf66e8cac4d0d19bca65e34990d48378e4 100644 (file)
@@ -13,7 +13,7 @@
 
  <ajc-test dir="bugs1612/xmldefs" title="xml defined advice">
      <compile files="Hello.java JavaHelper.java"/>
-     <run class="Hello" ltw="aop.xml">
+     <run class="Hello" ltw="aop.xml" usefullltw="true">
        <stdout>
            <line text="Hello"/>
            <line text="in advice"/>