Browse Source

Adjust 1.6.1 'testRunningBrokenCode_pr102733*' tests ECJ Java 22

Initially, these tests made sure that an old AJC bug causing
incompatibility to ECJ when using `-proceedOnError` was fixed and there
were no regressions. See also:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=102733

Now with the Java 22 changes for JEP 463 "Implicitly Declared Classes
and Instance Main Methods (Second Preview)" in JDT Core, source code is
parsed into a significantly different AST structure than before, even
when using compiler targets < 22. See also https://openjdk.org/jeps/463.

One test has been temporarily adjusted to the byte code created by
ECJ/AJC now.

TODO: Revert/adjust after this upstream bug has been
fixed:
https://github.com/eclipse-jdt/eclipse.jdt.core/issues/2205
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
pull/156/merge
Alexander Kriegisch 1 month ago
parent
commit
dcc2fd168c

+ 6
- 0
tests/bugs161/pr102733/C3.java View File

@@ -0,0 +1,6 @@

public class C3 {
public static void main(String[] argv) {}

blahblahpackage pack;
}

+ 14
- 13
tests/bugs161/pr102733/Invoker.java View File

@@ -1,14 +1,15 @@
import java.lang.reflect.Method;

public class Invoker {
public static void main(String[] args) throws Throwable {
try {
C.main(null);
} catch (Throwable t) {
boolean failedCorrectly = t.toString().indexOf("Unresolved compilation")!=-1;
if (failedCorrectly) return;
throw t;
}
throw new RuntimeException("Call to main should have failed!");
}
}
public static void main(String[] args) throws Throwable {
try {
new C();
}
catch (Throwable t) {
boolean failedCorrectly =
t.toString().contains("Unresolved compilation problem") &&
t.toString().contains("The method main cannot be declared static");
if (failedCorrectly)
return;
throw new RuntimeException("Constructor call should have failed!", t);
}
}
}

+ 24
- 0
tests/bugs161/pr102733/Invoker3.java View File

@@ -0,0 +1,24 @@
public class Invoker3 {
public static void main(String[] args) throws Throwable {
try {
C3.main(null);
}
catch (Throwable t) {
boolean failedCorrectly = t.toString().indexOf("Unresolved compilation") != -1;
if (failedCorrectly)
return;
throw new RuntimeException("Call to main should have failed!", t);
}
try {
new C3();
}
catch (Throwable t) {
boolean failedCorrectly =
t.toString().contains("Unresolved compilation problem") &&
t.toString().contains("blahblahpackage cannot be resolved to a type");
if (failedCorrectly)
return;
throw new RuntimeException("Constructor call should have failed!", t);
}
}
}

+ 8
- 2
tests/src/test/java/org/aspectj/systemtest/ajc161/Ajc161Tests.java View File

@@ -54,12 +54,18 @@ public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("ataspectj deow - 2");
}

public void testRunningBrokenCode_pr102733() {
// TODO: Revert, when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/2205 is fixed
runTest("running broken code");
}

public void testRunningBrokenCode_pr102733_2() {
runTest("running broken code - 2");
}

public void testRunningBrokenCode_pr102733() {
runTest("running broken code");
public void testRunningBrokenCode_pr102733_3() {
// TODO: Adjust as necessary, when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/2205 is fixed
runTest("running broken code - 3");
}

public void testErrorOnNonabstractGenericAtAspectJAspect_pr168982() {

+ 58
- 47
tests/src/test/resources/org/aspectj/systemtest/ajc161/ajc161.xml View File

@@ -11,17 +11,17 @@
<ajc-test dir="bugs161/pr173978" title="lv table for around">
<compile files="TestAroundAspect.java Test.java" options="-1.5"/>
</ajc-test>
<ajc-test dir="bugs161/pr237419" title="generics ataround">
<compile files="problem/aspect/AnyAspect.java problem/SpecificService.java problem/Specific.java problem/GenericService.java problem/Generic.java" options="-1.5"/>
<run class="problem.SpecificService"/>
</ajc-test>
<ajc-test dir="bugs161/pr203367" title="generic marker match">
<compile files="CantMatchOnInterfaceIntroducedToGenericClass.java" options="-1.5"/>
<run class="bug.CantMatchOnInterfaceIntroducedToGenericClass"/>
</ajc-test>
<ajc-test dir="bugs161/pr198196" title="super itds - 2">
<compile files="Marker.java Foo.java MarkerAspect2.java"/>
<run class="Foo">
@@ -35,65 +35,76 @@
</stdout>
</run>
</ajc-test>
<ajc-test dir="bugs161/pr198196" title="super itds - 3">
<compile files="Marker.java Foo.java MarkerAspect1.java"/>
<run class="Foo"/>
</ajc-test>
<ajc-test dir="bugs161/pr198196" title="super itds - 4">
<compile files="Marker.java Foo.java MarkerAspect3.java"/>
<run class="Foo"/>
</ajc-test>
<ajc-test dir="bugs161/pr134425" title="super itds">
<compile files="Derived.java Base.java"/>
<run class="pkg.Derived"/>
</ajc-test>
<ajc-test dir="bugs161/pr237381" title="ataspectj deow - 1">
<compile files="Deow1.java" options="-1.5">
<message kind="warning" line="7" text="fromX"/>
<message kind="warning" line="15" text="fromY"/>
</compile>
</ajc-test>
<ajc-test dir="bugs161/pr237381" title="ataspectj deow - 2">
<compile files="Deow2.java" options="-1.5">
<message kind="error" line="7" text="fromX"/>
<message kind="error" line="15" text="fromY"/>
</compile>
</ajc-test>
<ajc-test dir="bugs161/pr102733" title="running broken code">
<compile files="Invoker.java C.java" options="-proceedOnError">
<message kind="error" line="2" text="Syntax error"/>
<compile files="C.java" options="-proceedOnError">
<message file="C.java" kind="error" line="1" text="Unnamed Classes and Instance Main Methods"/>
<message file="C.java" kind="error" line="2" text="blahblahpackage cannot be resolved to a type"/>
<message file="C.java" kind="error" line="2" text="Implicitly declared class must have a candidate main method"/>
<message file="C.java" kind="error" line="2" text="The method main cannot be declared static; static methods can only be declared in a static or top level type"/>
</compile>
<compile files="Invoker.java"/>
<run class="Invoker"/>
</ajc-test>
<ajc-test dir="bugs161/pr102733" title="running broken code - 2">
<compile files="Invoker2.java C2.java" options="-proceedOnError">
<message kind="error" line="5"/>
</compile>
<run class="Invoker2"/>
</ajc-test>

<ajc-test dir="bugs161/pr102733" title="running broken code - 3">
<compile files="C3.java Invoker3.java" options="-proceedOnError">
<message file="C3.java" kind="error" line="5" text="blahblahpackage cannot be resolved to a type"/>
</compile>
<run class="Invoker3"/>
</ajc-test>

<ajc-test dir="bugs161/pr168982" title="error on non-abstract generic ataspectj aspect">
<compile files="TracingAspect2.java" options="-1.5">
<message kind="error" line="9"/>
</compile>
</ajc-test>
<ajc-test dir="bugs161/pr234933" title="ignoring type level suppress">
<compile files="Foobar.java" options="-1.5 -Xlint:error"/>
</ajc-test>
<ajc-test dir="bugs161/pr223226" title="duplicate method signature - 2">
<compile files="AspectX.java BInterface.java FooInterface.java AspectXMarker.java Foo.java Test.java" options="-1.5"/>
<run class="Test"/>
</ajc-test>
<ajc-test dir="bugs161/pr223226" title="duplicate method signature">
<compile files="AspectX.java BInterface.java FooInterface.java AspectXMarker.java Foo.java Test.java" options="">
<message kind="error" line="1"/>
@@ -106,7 +117,7 @@
<ajc-test dir="bugs161/pr197719" title="protected methods and around advice - again - 2">
<compile files="test/aspects/C1.java test/aspects/C3.java test/aspects/MyAnn.java test/aspects/MyAnnAspect.java test/aspects2/C2.java" options="-1.5 -showWeaveInfo">
<message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C1' (C1.java:12) "/>
<!-- first of these through accessor - so line number wrong and target wrong -->
<message kind="weave" text="Join point 'method-call(void test.aspects2.C2.aMethod())' in Type 'test.aspects2.C2' (C2.java:1) "/><!-- was line 18 -->
<message kind="weave" text="Join point 'method-call(void test.aspects2.C2.aMethod())' in Type 'test.aspects2.C2' (C2.java:8) "/>
@@ -123,7 +134,7 @@
<run class="test.aspects.C3">
</run>
</ajc-test>
<ajc-test dir="bugs161/pr197719" title="protected methods and around advice - again">
<compile files="A.java B.java X.java" options="-1.5"/>
<run class="b.B">
@@ -139,24 +150,24 @@
<compile files="A.java B.java C.java X.java" options="-1.5"/>
<run class="a.C"/>
</ajc-test>
<ajc-test dir="bugs161/pr174385" title="static strings in annotation pointcuts">
<compile files="StaticFinalStringInPointcutAspect.java" options="-1.5"/>
<run class="bug.StaticFinalStringInPointcutAspect"/>
</ajc-test>
<ajc-test dir="bugs161/pr199130" title="complex bounds on generic aspect - 1">
<compile files="Simple.java" options="-1.5"/>
<run class="Simple">
</run>
</ajc-test>
<ajc-test dir="bugs161/pr199130" title="complex bounds on generic aspect - 2">
<compile files="Complex.java" options="-1.5"/>
<run class="Complex">
</run>
</ajc-test>
<ajc-test dir="bugs161/pr199130" title="complex bounds on generic aspect - 3">
<compile files="Complex2.java" options="-1.5"/>
<run class="Complex2">
@@ -172,7 +183,7 @@
<ajc-test dir="bugs161/pr235829" title="crazy generics and inner types">
<compile files="Main.java a/Adapter.java a/b/Adapter.java" options="-1.5"/>
<run class="Main"/>
</ajc-test>
</ajc-test>

<ajc-test dir="bugs161/pr235597" title="annotation exposure and generics">
<compile files="AnnotationTest1.java SomeAnnotation.java SomeAspect.java" options="-1.5"/>
@@ -196,12 +207,12 @@
</stdout>
</run>
</ajc-test>

<ajc-test dir="bugs161/pr235204" title="incorrect call relationship">
<compile files="RecursiveCatcher.java" options="-1.5 -emacssym"/>
</ajc-test>
<ajc-test dir="bugs161/pr233838" title="itd precedence - 1">
<compile files="Z.java" options="-1.5"/>
<run class="Z">
@@ -219,7 +230,7 @@
</stdout>
</run>
</ajc-test>

<ajc-test dir="bugs161/pr227401" title="getfield problem with generics">
<compile files="Instrumentation.java Fails.java" options="-1.5"/>
@@ -236,8 +247,8 @@
<line text="22"/>
</stdout>
</run>
</ajc-test>
</ajc-test>
<ajc-test dir="bugs161/pr231478" title="generic abstract aspects">
<compile files="Base.java Sub.java AbstractComponent.java AbstractWindow.java" options="-1.5"/>
</ajc-test>
@@ -255,7 +266,7 @@
<line text="set of NO field"/>
</stderr>
</run>
</ajc-test>
</ajc-test>

<ajc-test dir="bugs161/pr231187x" title="generics bounds decp">
<compile files="Cement.java ConcreteClass.java SuperClass.java SuperClassAspect.aj WetCement.java Main.java" options="-1.5"/>
@@ -264,14 +275,14 @@
<line text="ran!"/>
</stdout>
</run>
</ajc-test>
</ajc-test>
<ajc-test dir="bugs161/pr231187x" title="generics bounds decp - 2">
<compile files="Cement.java ConcreteClass.java SuperClass.java WetCement.java" options="-1.5">
<message kind="error" text="The type WetCement is not a valid substitute for the bounded parameter"/>
</compile>
</ajc-test>
</ajc-test>
<ajc-test dir="bugs161/pr230134" title="ltw inherited cflow">
<compile files="HW.java"/>
<compile files="SimpleTracing.java Tracing.java HelloWorldTracing.java" outjar="foo.jar" options="-1.4"/>
@@ -281,21 +292,21 @@
</stdout>
</run>
</ajc-test>
<ajc-test dir="bugs161/pr229910" title="around advice on field set">
<compile files="Test.java" options="-1.5"/>
<run class="Test"/>
</ajc-test>
</ajc-test>
<ajc-test dir="bugs161/pr226567" title="pipeline compilation and generic return type">
<compile files="BarAspect.aj Foo.java Bar.java" options="-1.5"/>
<compile files="BarAspect.aj Bar.java Foo.java" options="-1.5"/>
</ajc-test>
</ajc-test>
<ajc-test dir="bugs161/pr235505" title="privileged generic aspect">
<compile files="A.java" options="-1.5"/>
</ajc-test>
</ajc-test>
<ajc-test dir="bugs161/pr235505" title="privileged generic aspect - 2">
<compile files="B.java" options="-1.5"/>
<run class="B">
@@ -304,18 +315,18 @@
<line text="Hello World"/>
</stdout>
</run>
</ajc-test>
</ajc-test>
<ajc-test dir="bugs161/pr64222" title="parsing around advice no return">
<compile files="C.java" options="-1.5">
<message kind="error" line="6" text="to complete around advice declaration"/>
</compile>
</ajc-test>
</ajc-test>

<ajc-test dir="bugs161/pr159268" title="before array name">
<compile files="C.java" options="-1.5"/>
</ajc-test>
</ajc-test>

</suite>
</suite>

Loading…
Cancel
Save