aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs1923/gh326/pkg/BusinessDao.java9
-rw-r--r--tests/bugs1923/gh326/pkg/BusinessDto.java8
-rw-r--r--tests/bugs1923/gh326/pkg/BusinessService.java18
-rw-r--r--tests/bugs1923/gh326/pkg/HandleSourceException.java17
-rw-r--r--tests/bugs1923/gh326/pkg/SourceException.java7
-rw-r--r--tests/bugs1923/gh326/pkg/SourceExceptionHandlerAspect.aj29
-rw-r--r--tests/bugs1923/gh326/pkg/TargetException.java11
-rw-r--r--tests/bugs1923/gh327/A.aj2
-rw-r--r--tests/bugs1923/gh327/B.aj10
-rw-r--r--tests/bugs1923/gh327/C.aj10
-rw-r--r--tests/bugs1923/gh327/F.aj13
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java20
-rw-r--r--tests/src/test/resources/org/aspectj/systemtest/ajc1923/ajc1923.xml28
13 files changed, 180 insertions, 2 deletions
diff --git a/tests/bugs1923/gh326/pkg/BusinessDao.java b/tests/bugs1923/gh326/pkg/BusinessDao.java
new file mode 100644
index 000000000..8ab256912
--- /dev/null
+++ b/tests/bugs1923/gh326/pkg/BusinessDao.java
@@ -0,0 +1,9 @@
+package pkg;
+
+public class BusinessDao<D> {
+
+ public D doSomething() throws SourceException {
+ return (D) new BusinessDto();
+ }
+
+}
diff --git a/tests/bugs1923/gh326/pkg/BusinessDto.java b/tests/bugs1923/gh326/pkg/BusinessDto.java
new file mode 100644
index 000000000..42d792b27
--- /dev/null
+++ b/tests/bugs1923/gh326/pkg/BusinessDto.java
@@ -0,0 +1,8 @@
+package pkg;
+
+public class BusinessDto {
+
+ public BusinessDto() throws SourceException {
+throw new SourceException();
+}
+}
diff --git a/tests/bugs1923/gh326/pkg/BusinessService.java b/tests/bugs1923/gh326/pkg/BusinessService.java
new file mode 100644
index 000000000..10d98400f
--- /dev/null
+++ b/tests/bugs1923/gh326/pkg/BusinessService.java
@@ -0,0 +1,18 @@
+package pkg;
+
+public class BusinessService {
+
+ @HandleSourceException(message="42")
+ public BusinessDto doSomething() throws TargetException {
+ return new BusinessDao<BusinessDto>().doSomething();
+ }
+
+
+public static void main(String []argv) throws TargetException {
+try {
+ new BusinessService().doSomething();
+} catch (TargetException te) {
+ System.out.println(te.getMessage());
+}
+}
+}
diff --git a/tests/bugs1923/gh326/pkg/HandleSourceException.java b/tests/bugs1923/gh326/pkg/HandleSourceException.java
new file mode 100644
index 000000000..a5645cfac
--- /dev/null
+++ b/tests/bugs1923/gh326/pkg/HandleSourceException.java
@@ -0,0 +1,17 @@
+package pkg;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Retention(RUNTIME)
+@Target(METHOD)
+public @interface HandleSourceException {
+
+ String message() default "";
+
+ boolean useLogger() default true;
+
+}
diff --git a/tests/bugs1923/gh326/pkg/SourceException.java b/tests/bugs1923/gh326/pkg/SourceException.java
new file mode 100644
index 000000000..2ada2d6fe
--- /dev/null
+++ b/tests/bugs1923/gh326/pkg/SourceException.java
@@ -0,0 +1,7 @@
+package pkg;
+
+public class SourceException extends Exception {
+
+ private static final long serialVersionUID = 2789789285541660969L;
+
+}
diff --git a/tests/bugs1923/gh326/pkg/SourceExceptionHandlerAspect.aj b/tests/bugs1923/gh326/pkg/SourceExceptionHandlerAspect.aj
new file mode 100644
index 000000000..6bd48f3b7
--- /dev/null
+++ b/tests/bugs1923/gh326/pkg/SourceExceptionHandlerAspect.aj
@@ -0,0 +1,29 @@
+package pkg;
+
+import java.lang.annotation.Annotation;
+
+import org.aspectj.lang.reflect.MethodSignature;
+
+public aspect SourceExceptionHandlerAspect {
+
+ pointcut handleSourceExceptionPointcut(): @annotation(HandleSourceException);
+
+ declare soft : SourceException : handleSourceExceptionPointcut();
+
+ Object around() throws TargetException: handleSourceExceptionPointcut() {
+ try {
+ return proceed();
+ } catch (Throwable exception) {
+ String message = "";
+ Annotation[] annotations = ((MethodSignature) thisJoinPoint.getSignature()).getMethod().getAnnotationsByType(HandleSourceException.class);
+ if (annotations.length == 1) {
+ message = ((HandleSourceException) annotations[0]).message();
+ }
+ if (message.isBlank()) {
+ message = exception.getMessage();
+ }
+ throw new TargetException(message, exception);
+ }
+ }
+
+}
diff --git a/tests/bugs1923/gh326/pkg/TargetException.java b/tests/bugs1923/gh326/pkg/TargetException.java
new file mode 100644
index 000000000..aa3f5c868
--- /dev/null
+++ b/tests/bugs1923/gh326/pkg/TargetException.java
@@ -0,0 +1,11 @@
+package pkg;
+
+public class TargetException extends Exception {
+
+ private static final long serialVersionUID = -1282142579066274623L;
+
+ public TargetException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/tests/bugs1923/gh327/A.aj b/tests/bugs1923/gh327/A.aj
index 28a38429f..f829f0ae0 100644
--- a/tests/bugs1923/gh327/A.aj
+++ b/tests/bugs1923/gh327/A.aj
@@ -1,5 +1,5 @@
privileged public aspect A {
- public static final String B.s = C.f.toString();
+ public final static String B.s = C.f.toString();
}
class B { }
diff --git a/tests/bugs1923/gh327/B.aj b/tests/bugs1923/gh327/B.aj
new file mode 100644
index 000000000..c7aaddcd1
--- /dev/null
+++ b/tests/bugs1923/gh327/B.aj
@@ -0,0 +1,10 @@
+privileged public aspect B {
+ public final String C.s = D.f.toString();
+}
+
+class C { }
+
+class D {
+ public static final D f = new D();
+}
+
diff --git a/tests/bugs1923/gh327/C.aj b/tests/bugs1923/gh327/C.aj
new file mode 100644
index 000000000..16e6bb543
--- /dev/null
+++ b/tests/bugs1923/gh327/C.aj
@@ -0,0 +1,10 @@
+privileged public aspect C {
+ private final String D.s = E.f.toString();
+}
+
+class D { }
+
+class E {
+ public static final E f = new E();
+}
+
diff --git a/tests/bugs1923/gh327/F.aj b/tests/bugs1923/gh327/F.aj
new file mode 100644
index 000000000..45d6de0a8
--- /dev/null
+++ b/tests/bugs1923/gh327/F.aj
@@ -0,0 +1,13 @@
+class A {}
+
+class B {}
+
+public abstract aspect F {
+ @Deprecated
+ public abstract void C.displaySearch(StringBuffer buffer, String name, String prefix, A criteria,
+ B context);
+}
+
+interface C {
+}
+
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java
index 1053c9918..8a3547472 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java
@@ -23,6 +23,26 @@ public class Bugs1923Tests extends XMLBasedAjcTestCase {
runTest("problem with inline accessor generator for around advice");
}
+ public void testGh327_IntertypeFields_Static() {
+ runTest("problem with intertype field declaration code generation - static");
+ }
+
+ public void testGh327_IntertypeFields_NonStatic() {
+ runTest("problem with intertype field declaration code generation - nonstatic");
+ }
+
+ public void testGh327_IntertypeFields_Private() {
+ runTest("problem with intertype field declaration code generation - private");
+ }
+
+ public void testGh327_IntertypeMethods() {
+ runTest("problem with intertype method declaration code generation");
+ }
+
+ public void testGh326_ClassCastExceptionHandling() {
+ runTest("classcast on exception handling aspect");
+ }
+
@Override
protected java.net.URL getSpecFile() {
return getClassResource("ajc1923.xml");
diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1923/ajc1923.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1923/ajc1923.xml
index f21f16701..6908c1e12 100644
--- a/tests/src/test/resources/org/aspectj/systemtest/ajc1923/ajc1923.xml
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1923/ajc1923.xml
@@ -51,10 +51,36 @@
</compile>
</ajc-test>
- <ajc-test dir="bugs1923/gh327" vm="17" title="problem with intertype field declaration code generation">
+ <ajc-test dir="bugs1923/gh327" vm="17" title="problem with intertype field declaration code generation - static">
<compile files="A.aj" options="-17">
</compile>
</ajc-test>
+ <ajc-test dir="bugs1923/gh327" vm="17" title="problem with intertype field declaration code generation - nonstatic">
+ <compile files="B.aj" options="-17">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="new/verifyError" pr="36673"
+ title="problem with intertype field declaration code generation - private">
+ <compile files="Privilege.java" options="-17"/>
+ <run class="Privilege"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs1923/gh327" vm="17" title="problem with intertype method declaration code generation">
+ <compile files="F.aj" options="-17">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs1923/gh326" vm="17" title="classcast on exception handling aspect">
+ <compile files="pkg/BusinessDao.java pkg/BusinessService.java pkg/SourceException.java pkg/TargetException.java pkg/BusinessDto.java pkg/HandleSourceException.java pkg/SourceExceptionHandlerAspect.aj" options="-17">
+ </compile>
+ <run class="pkg.BusinessService">
+ <stdout>
+ <line text="42"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
</suite>