diff options
Diffstat (limited to 'tests/bugs1923')
-rw-r--r-- | tests/bugs1923/gh322/SomeAnnotation.java | 5 | ||||
-rw-r--r-- | tests/bugs1923/gh322/TheAspect.java | 11 | ||||
-rw-r--r-- | tests/bugs1923/gh322/TheClass.java | 5 | ||||
-rw-r--r-- | tests/bugs1923/gh322/TheInterface.java | 3 | ||||
-rw-r--r-- | tests/bugs1923/gh326/pkg/BusinessDao.java | 9 | ||||
-rw-r--r-- | tests/bugs1923/gh326/pkg/BusinessDto.java | 8 | ||||
-rw-r--r-- | tests/bugs1923/gh326/pkg/BusinessService.java | 18 | ||||
-rw-r--r-- | tests/bugs1923/gh326/pkg/HandleSourceException.java | 17 | ||||
-rw-r--r-- | tests/bugs1923/gh326/pkg/SourceException.java | 7 | ||||
-rw-r--r-- | tests/bugs1923/gh326/pkg/SourceExceptionHandlerAspect.aj | 29 | ||||
-rw-r--r-- | tests/bugs1923/gh326/pkg/TargetException.java | 11 | ||||
-rw-r--r-- | tests/bugs1923/gh327/A.aj | 10 | ||||
-rw-r--r-- | tests/bugs1923/gh327/B.aj | 10 | ||||
-rw-r--r-- | tests/bugs1923/gh327/C.aj | 10 | ||||
-rw-r--r-- | tests/bugs1923/gh327/F.aj | 13 | ||||
-rw-r--r-- | tests/bugs1923/gh328/One.java | 11 |
16 files changed, 177 insertions, 0 deletions
diff --git a/tests/bugs1923/gh322/SomeAnnotation.java b/tests/bugs1923/gh322/SomeAnnotation.java new file mode 100644 index 000000000..3d472d3f9 --- /dev/null +++ b/tests/bugs1923/gh322/SomeAnnotation.java @@ -0,0 +1,5 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface SomeAnnotation {} + diff --git a/tests/bugs1923/gh322/TheAspect.java b/tests/bugs1923/gh322/TheAspect.java new file mode 100644 index 000000000..41b33119a --- /dev/null +++ b/tests/bugs1923/gh322/TheAspect.java @@ -0,0 +1,11 @@ +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +public class TheAspect { + @Around("execution(* *(@SomeAnnotation (*), ..))") + public Object aroundContext(ProceedingJoinPoint pjp) throws Throwable { + return pjp.proceed(); + } +} diff --git a/tests/bugs1923/gh322/TheClass.java b/tests/bugs1923/gh322/TheClass.java new file mode 100644 index 000000000..590c4f7bf --- /dev/null +++ b/tests/bugs1923/gh322/TheClass.java @@ -0,0 +1,5 @@ +public class TheClass implements TheInterface { + @Override + public void method(int param) { + } +} diff --git a/tests/bugs1923/gh322/TheInterface.java b/tests/bugs1923/gh322/TheInterface.java new file mode 100644 index 000000000..358f9037b --- /dev/null +++ b/tests/bugs1923/gh322/TheInterface.java @@ -0,0 +1,3 @@ +public interface TheInterface { + void method(@Deprecated int param); +} 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 new file mode 100644 index 000000000..f829f0ae0 --- /dev/null +++ b/tests/bugs1923/gh327/A.aj @@ -0,0 +1,10 @@ +privileged public aspect A { + public final static String B.s = C.f.toString(); +} + +class B { } + +class C { + public static final C f = new C(); +} + 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/bugs1923/gh328/One.java b/tests/bugs1923/gh328/One.java new file mode 100644 index 000000000..218a065dc --- /dev/null +++ b/tests/bugs1923/gh328/One.java @@ -0,0 +1,11 @@ +aspect A { + private void priv(String a) { } + Object around(String s): execution(* foo(..)) && args(s) { + priv(s); + return null; + } +} + +class C { + public void foo(String f) { } +} |