aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test/java/org/aspectj/systemtest/xlint
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2019-01-30 16:55:38 -0800
committerAndy Clement <aclement@pivotal.io>2019-01-30 16:55:38 -0800
commit2b24e7377da7c849fe7f9f4fa06a701664f9d27d (patch)
tree64c36c8fcf29633af7a5e2f7405b94cbec629ca8 /tests/src/test/java/org/aspectj/systemtest/xlint
parentd60de8d0b3e62eb36b612a824bb9345d865c0155 (diff)
downloadaspectj-2b24e7377da7c849fe7f9f4fa06a701664f9d27d.tar.gz
aspectj-2b24e7377da7c849fe7f9f4fa06a701664f9d27d.zip
mavenizing tests - wip
Diffstat (limited to 'tests/src/test/java/org/aspectj/systemtest/xlint')
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/xlint/XLint5Tests.java36
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/xlint/XLintTests.java169
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/xlint/xlint-tests.xml267
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/xlint/xlint.xml10
4 files changed, 482 insertions, 0 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/XLint5Tests.java b/tests/src/test/java/org/aspectj/systemtest/xlint/XLint5Tests.java
new file mode 100644
index 000000000..35e5b05ca
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/xlint/XLint5Tests.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster Move Java 5 dependent tests
+ *******************************************************************************/
+package org.aspectj.systemtest.xlint;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+public class XLint5Tests extends XMLBasedAjcTestCase {
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(XLint5Tests.class);
+ }
+
+ protected File getSpecFile() {
+ return getClassResource("xlint.xml");
+ }
+
+ public void testBug99136(){
+ runTest("Two Xlint warnings wth cflow?");
+ if(ajc.getLastCompilationResult().getWarningMessages().size() != 1){
+ fail();
+ }
+ }
+
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/XLintTests.java b/tests/src/test/java/org/aspectj/systemtest/xlint/XLintTests.java
new file mode 100644
index 000000000..c5a2b7fdf
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/xlint/XLintTests.java
@@ -0,0 +1,169 @@
+/* *******************************************************************
+ * Copyright (c) 2004 IBM Corporation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * ******************************************************************/
+package org.aspectj.systemtest.xlint;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.weaver.bcel.BcelShadow;
+
+public class XLintTests extends org.aspectj.testing.XMLBasedAjcTestCase {
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(XLintTests.class);
+ }
+
+ protected File getSpecFile() {
+ return getClassResource("xlint.xml");
+ }
+
+
+ public void test001(){
+ runTest("options -Xlint args()");
+ }
+
+ public void test002(){
+ runTest("options declare field on bad type");
+ }
+
+ public void test003(){
+ runTest("options declare method on bad type");
+ }
+
+ public void test004(){
+ runTest("options -Xlint declare parent");
+ }
+
+ public void test005(){
+ runTest("options -Xlint target()");
+ }
+
+ public void test006(){
+ runTest("options -Xlint this()");
+ }
+
+ public void test007(){
+ runTest("options negative -Xlint args()");
+ }
+
+ public void test008(){
+ runTest("options negative -Xlint declare parent");
+ }
+
+ public void test009(){
+ runTest("options negative -Xlint target()");
+ }
+
+ public void test010(){
+ runTest("options negative -Xlint this()");
+ }
+
+ public void test011(){
+ runTest("unmatched type name in a declare parents should result in a warning in -Xlint mode");
+ }
+
+ public void test012(){
+ runTest("privileged access to code outside the control of the compiler");
+ }
+
+ public void test013(){
+ runTest("Unexpected Xlint:unresolvableMember warning with withincode");
+ }
+
+ public void test014(){
+ runTest("valid XLintWarningTest file, default level of warning");
+ }
+
+ public void test015(){
+ runTest("XLint:ignore suppresses XLint warnings");
+ }
+
+ public void test016(){
+ runTest("XLint:error promotes XLint warnings to error");
+ }
+
+ public void test017(){
+ runTest("alias getCause for getWrappedThrowable in SoftException");
+ }
+
+// public void test018(){
+// runTest("XLint warning for call PCD's using subtype of defining type");
+// }
+
+ public void test019(){
+ runTest("XLint warning for call PCD's using subtype of defining type (-1.3 -Xlint:ignore)");
+ }
+
+
+ // the following five tests check various scenarios around the lazyTjp XLint message
+ public void test020(){
+ runTest("no XLint warning: thisJoinPoint potentially lazy and nothing stopping it");
+ assertTrue("Something prevented the lazytjp optimization from working??",BcelShadow.appliedLazyTjpOptimization);
+ }
+
+ public void test021(){
+ runTest("XLint warning: thisJoinPoint potentially lazy but stopped by around advice which doesn't use tjp");
+ assertFalse("lazytjp optimization should have failed to be applied because of around advice at the jp",
+ BcelShadow.appliedLazyTjpOptimization);
+ }
+
+ public void test022(){
+ runTest("no XLint warning: thisJoinPoint not lazy (no if PCD) but would have been stopped anyway by around advice");
+ assertFalse("lazytjp optimization should have failed to be applied because of around advice *and* before advice has no if() at the jp",
+ BcelShadow.appliedLazyTjpOptimization);
+ }
+
+ public void test023(){
+ runTest("no XLint warning: thisJoinPoint cannot be built lazily");
+ assertFalse("lazytjp optimization should have failed to be applied because before advice has no if() at the jp",
+ BcelShadow.appliedLazyTjpOptimization);
+ }
+
+ public void test024(){
+ runTest("XLint warning: thisJoinPoint potentially lazy but stopped by around advice which uses tjp");
+ assertFalse("lazytjp optimization should have failed to be applied because around advice uses tjp",
+ BcelShadow.appliedLazyTjpOptimization);
+ }
+
+ public void test025(){
+ runTest("check for xlazytjp warning if actually supplied");
+ assertTrue("Something prevented the lazytjp optimization from working??",BcelShadow.appliedLazyTjpOptimization);
+ }
+
+ public void test026(){
+ runTest("lazytjp: warning when around advice uses tjp");
+ }
+
+ public void test027() {
+ runTest("lazytjp: warning when if missing on before advice");
+ }
+
+ public void test028() {
+ runTest("lazytjp: warning when if missing on after advice");
+ }
+
+ public void test029() {
+ runTest("lazytjp: multiple clashing advice preventing lazytjp");
+ }
+
+ public void test030() {
+ runTest("lazytjp: interfering before and around");
+ }
+
+ // FIXME asc put this back in !
+// public void test031() {
+// if (is15VMOrGreater)
+// runTest("7 lint warnings");
+// }
+
+}
+
diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/xlint-tests.xml b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint-tests.xml
new file mode 100644
index 000000000..4bbf23841
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint-tests.xml
@@ -0,0 +1,267 @@
+<!-- XLint Tests -->
+
+ <!-- .................................... -Xlint tests -->
+ <!-- ............... positive -Xlint tests -->
+
+ <ajc-test dir="bugs/lazyTjpXLintWarning"
+ title="no XLint warning: thisJoinPoint potentially lazy and nothing stopping it">
+ <compile options="-Xlint:warning" files="Scenario1.aj"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs/lazyTjpXLintWarning"
+ title="XLint warning: thisJoinPoint potentially lazy but stopped by around advice which doesn't use tjp">
+ <compile options="-Xlint:warning" files="Scenario2.aj">
+ <message kind="warning" line="21" text="can not implement lazyTjp on this joinpoint method-execution(void Test.main(java.lang.String[])) because around advice is used [Xlint:canNotImplementLazyTjp]"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/lazyTjpXLintWarning"
+ title="no XLint warning: thisJoinPoint not lazy (no if PCD) but would have been stopped anyway by around advice">
+ <compile options="-Xlint:warning" files="Scenario3.aj">
+ <message kind="warning" line="14" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/lazyTjpXLintWarning" title="no XLint warning: thisJoinPoint cannot be built lazily">
+ <compile options="-Xlint:warning" files="Scenario4.aj">
+ <message kind="warning" line="9" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/lazyTjpXLintWarning"
+ title="XLint warning: thisJoinPoint potentially lazy but stopped by around advice which uses tjp">
+ <compile options="-Xlint:warning" files="Scenario5.aj">
+ <message kind="warning" line="22" text="can not implement lazyTjp on this joinpoint method-execution(void Test.main(java.lang.String[])) because around advice is used [Xlint:canNotImplementLazyTjp]"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/lazyTjpXLintWarning"
+ title="check for xlazytjp warning if actually supplied">
+ <compile options="-XlazyTjp -Xlint:warning" files="Scenario1.aj">
+ <message kind="warning" text="-XlazyTjp should no longer be used, build tjps lazily is now the default"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/lazyTjpXLintWarning"
+ title="lazytjp: warning when around advice uses tjp">
+ <compile options="-Xlint:warning" files="LazyTjpTest1.java">
+ <message kind="warning" line="4" text="can not implement lazyTjp on this joinpoint method-execution(void LazyTjpTest1.test2()) because around advice is used [Xlint:canNotImplementLazyTjp]"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/lazyTjpXLintWarning"
+ title="lazytjp: warning when if missing on before advice">
+ <compile options="-Xlint:warning" files="LazyTjpTest2.java">
+ <message kind="warning" line="16" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/lazyTjpXLintWarning"
+ title="lazytjp: warning when if missing on after advice">
+ <compile options="-Xlint:warning" files="LazyTjpTest3.java">
+ <message kind="warning" line="17" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/lazyTjpXLintWarning"
+ title="lazytjp: multiple clashing advice preventing lazytjp">
+ <compile options="-Xlint:warning" files="LazyTjpTest4.java">
+ <message kind="warning" line="13" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/>
+ <message kind="warning" line="3" text="can not implement lazyTjp at joinpoint method-execution(void LazyTjpTest4.test1()) because of advice conflicts, see secondary locations to find conflicting advice"/>
+ <message kind="warning" line="17" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/lazyTjpXLintWarning"
+ title="lazytjp: interfering before and around">
+ <compile options="-Xlint:warning" files="LazyTjpTest5.java">
+ <message kind="warning" line="3" text="can not implement lazyTjp at joinpoint method-execution(void LazyTjpTest5.test1()) because of advice conflicts, see secondary locations to find conflicting advice"/>
+ <message kind="warning" line="13" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="options"
+ title="options -Xlint args()"
+ keywords="lint">
+ <compile files="XLintTypeArgsPCD.java">
+ <message kind="warning" line="10"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="options"
+ title="options declare field on bad type">
+ <compile files="XLintTypeDeclareField.java" options="!eclipse">
+ <message kind="error" line="10"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="options"
+ title="options declare method on bad type">
+ <compile files="XLintTypeDeclareMethod.java" options="!eclipse">
+ <message kind="error" line="10"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="options"
+ title="options -Xlint declare parent"
+ keywords="lint">
+ <compile files="XLintTypeDeclareParent.java">
+ <message kind="warning" line="10"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="options"
+ title="options -Xlint target()"
+ keywords="lint">
+ <compile files="XLintTypeTargetPCD.java">
+ <message kind="warning" line="10"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="options"
+ title="options -Xlint this()"
+ keywords="lint">
+ <compile files="XLintTypeThisPCD.java">
+ <message kind="warning" line="10"/>
+ </compile>
+ </ajc-test>
+
+ <!-- ............... negative -Xlint tests -->
+ <ajc-test dir="options"
+ title="options negative -Xlint args()"
+ keywords="lint">
+ <compile files="XLintTypeArgsPCD.java" options="-Xlint:ignore"/>
+ </ajc-test>
+
+ <ajc-test dir="options"
+ title="options negative -Xlint declare parent"
+ keywords="lint">
+ <compile files="XLintTypeDeclareParent.java" options="-Xlint:ignore"/>
+ </ajc-test>
+
+ <ajc-test dir="options"
+ title="options negative -Xlint target()"
+ keywords="lint">
+ <compile files="XLintTypeTargetPCD.java" options="-Xlint:ignore"/>
+ </ajc-test>
+
+ <ajc-test dir="options"
+ title="options negative -Xlint this()"
+ keywords="lint">
+ <compile files="XLintTypeThisPCD.java" options="-Xlint:ignore"/>
+ </ajc-test>
+
+
+ <ajc-test dir="new"
+ title="unmatched type name in a declare parents should result in a warning in -Xlint mode"
+ keywords="tofix">
+ <compile options="-Xlint" files="MissingTypeInDeclareParents.java">
+ <message kind="warning" line="20"/>
+ </compile>
+ <run class="MissingTypeInDeclareParents"/>
+ </ajc-test>
+
+
+ <!-- The correct behavior of this program is to produce an Xlint
+ warning for the lack of access to the needed type, and then
+ to generate code with link errors that will throw a NoSuchMethodError
+ when run.
+ -->
+ <ajc-test dir="bugs" pr="906"
+ title="privileged access to code outside the control of the compiler">
+ <compile files="PrivilegeBeyondScope.java" options="-Xlint:warning">
+ <message kind="warning" line="23"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs" pr="37739"
+ title="Unexpected Xlint:unresolvableMember warning with withincode">
+ <compile files="CatchSig.java">
+ </compile>
+ <run class="CatchSig"/>
+ </ajc-test>
+
+
+ <ajc-test dir="harness"
+ title="valid XLintWarningTest file, default level of warning">
+ <compile files="XLintWarningTest.java" options="-1.4">
+ <message kind="warning" line="5"
+ text="Xlint:invalidAbsoluteTypeName"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="harness"
+ title="XLint:ignore suppresses XLint warnings">
+ <compile files="XLintWarningTest.java" options="-Xlint:ignore"/>
+ </ajc-test>
+
+ <ajc-test dir="harness"
+ title="XLint:error promotes XLint warnings to error">
+ <compile files="XLintWarningTest.java" options="-Xlint:error">
+ <message kind="error" line="5"
+ text="Xlint:invalidAbsoluteTypeName"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs" pr="49250"
+ title="alias getCause for getWrappedThrowable in SoftException">
+ <compile files="GetCauseOnSoftException.java" options="-Xlint:warning">
+ </compile>
+ <run vm="1.3" class="GetCauseOnSoftException"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs"
+ title="XLint warning for call PCD's using subtype of defining type"
+ pr="41952"
+ >
+ <compile
+ files="DeclaringTypeWarning.java"
+ options="-1.3" >
+ <message kind="warning" line="6" text="declaring type">
+ <source line="12" file="DeclaringTypeWarning.java" />
+ </message>
+ <message kind="warning" line="6" text="declaring type">
+ <source line="14" file="DeclaringTypeWarning.java" />
+ </message>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs"
+ title="XLint warning for call PCD's using subtype of defining type (-1.3 -Xlint:ignore)"
+ pr="41952"
+ >
+ <compile
+ options="-Xlint:ignore,-1.3"
+ files="DeclaringTypeWarning.java" >
+ </compile>
+ </ajc-test>
+
+<!--
+ <ajc-test dir="bugs/seven/lint" title="7 lint warnings" pr="91719">
+ <compile options="-1.5" files="Main.java">
+ <message kind="warning" line="31" text="no match for this type name: java.xxx.Object [Xlint:invalidAbsoluteTypeName]">
+ </message>
+ <message kind="warning" line="34" text="no match for this type name: java.lang.Xxx [Xlint:invalidAbsoluteTypeName]">
+ </message>
+ <message kind="warning" line="41" text="no match for this type name: java.lang.Xxx [Xlint:invalidAbsoluteTypeName]">
+ </message>
+ <message kind="warning" line="69" text="this affected type is not exposed to the weaver: java.lang.Object [Xlint:typeNotExposedToWeaver]">
+ </message>
+ <message kind="warning" line="87" text="does not match because declaring type is java.lang.Object, if match desired use target(Car) [Xlint:unmatchedSuperTypeInCall]">
+ </message>
+ <message kind="warning" line="92" text="advice defined in XlintTest has not been applied [Xlint:adviceDidNotMatch]">
+ </message>
+ <message kind="warning" line="157" text="no interface constructor-execution join point - use java.util.List+ for implementing classes [Xlint:noInterfaceCtorJoinpoint]">
+ </message>
+ </compile>
+ </ajc-test>
+-->
+
+ <ajc-test dir="harness"
+ title="Two Xlint warnings wth cflow?">
+ <compile files="XLintcflow.java" options="-1.5">
+ <message kind="warning" line="4" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/>
+ </compile>
+ </ajc-test>
+
+ \ No newline at end of file
diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/xlint.xml b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint.xml
new file mode 100644
index 000000000..efe2a0014
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint.xml
@@ -0,0 +1,10 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[
+<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml">
+]>
+<!-- XLint Tests -->
+
+<suite>
+
+&tests;
+
+</suite> \ No newline at end of file