diff options
author | Andy Clement <aclement@gopivotal.com> | 2015-03-23 12:54:54 -0700 |
---|---|---|
committer | Andy Clement <aclement@gopivotal.com> | 2015-03-23 12:54:54 -0700 |
commit | a1cfe944a602101d144c8efd7df217ab20e4b9ee (patch) | |
tree | ddb06c095990717713c90a2efb7cf0c0ab49f194 /tests/bugs186 | |
parent | 3869f363bc6e473f4063faf2c296825283a21f1a (diff) | |
download | aspectj-a1cfe944a602101d144c8efd7df217ab20e4b9ee.tar.gz aspectj-a1cfe944a602101d144c8efd7df217ab20e4b9ee.zip |
462821: invokedynamic detection in hierarchy of aspects
Diffstat (limited to 'tests/bugs186')
-rw-r--r-- | tests/bugs186/462821/AbstractLoggerAspect.java | 59 | ||||
-rw-r--r-- | tests/bugs186/462821/FooService.java | 10 | ||||
-rw-r--r-- | tests/bugs186/462821/FooServiceLoggerAspect.java | 23 | ||||
-rw-r--r-- | tests/bugs186/462821/java | 1 |
4 files changed, 93 insertions, 0 deletions
diff --git a/tests/bugs186/462821/AbstractLoggerAspect.java b/tests/bugs186/462821/AbstractLoggerAspect.java new file mode 100644 index 000000000..5b9e3c14b --- /dev/null +++ b/tests/bugs186/462821/AbstractLoggerAspect.java @@ -0,0 +1,59 @@ +//package no.kantega; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; + +@Aspect +public abstract class AbstractLoggerAspect { + + @Pointcut + public abstract void debugJoinPoints(); + + @Pointcut + public abstract void infoJoinPoints(); + + @Pointcut + public abstract void excludedJoinPoints(); + + + @Pointcut("execution(public String Object+.toString()) || call(public String Object.toString())" + + "|| call(public int Object.hashCode()) || call(public boolean Object.equals())" + + "|| execution(public static void Object+.main(String[])) ") + public void defaultExcludedJoinPoints() {} + + @Pointcut("(infoJoinPoints() && !defaultExcludedJoinPoints() && !excludedJoinPoints())") + public void infoJoinPointsToLog() {} + +/* + @Pointcut("(debugJoinPoints() && !defaultExcludedJoinPoints() && !infoJoinPointsToLog() && !excludedJoinPoints())") + public void debugJoinPointsToLog() {} + + + @Around("debugJoinPointsToLog()") + public Object handleDebugJoinPointsToLog(ProceedingJoinPoint thisJoinPoint) + { + // do stuff + try { + return thisJoinPoint.proceed(); + } catch (Throwable throwable) { + throw new RuntimeException("foo"); + } + // then do other stuff + } +*/ + + @Around("infoJoinPoints()") + public Object handleInfoJoinPointsToLog(ProceedingJoinPoint thisJoinPoint) + { + // first do stuff + try { + return thisJoinPoint.proceed(); + } catch (Throwable throwable) { + throw new RuntimeException("foo"); + } + // then do other stuff + } +} + diff --git a/tests/bugs186/462821/FooService.java b/tests/bugs186/462821/FooService.java new file mode 100644 index 000000000..5d9ab18bf --- /dev/null +++ b/tests/bugs186/462821/FooService.java @@ -0,0 +1,10 @@ +//package no.kantega; + +public class FooService { + + /** Adviced method */ + public String doSomething() { + return "foo"; + } + +} diff --git a/tests/bugs186/462821/FooServiceLoggerAspect.java b/tests/bugs186/462821/FooServiceLoggerAspect.java new file mode 100644 index 000000000..f471694e1 --- /dev/null +++ b/tests/bugs186/462821/FooServiceLoggerAspect.java @@ -0,0 +1,23 @@ +//package no.kantega; + +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; + +@Aspect +public class FooServiceLoggerAspect extends AbstractLoggerAspect { + + @Pointcut + @Override + public void debugJoinPoints() { + } + + @Pointcut("execution(public * FooService.*(..)) && !debugJoinPoints()") + @Override + public void infoJoinPoints() { + } + + @Pointcut + @Override + public void excludedJoinPoints() { + } +} diff --git a/tests/bugs186/462821/java b/tests/bugs186/462821/java new file mode 100644 index 000000000..f1d45a49f --- /dev/null +++ b/tests/bugs186/462821/java @@ -0,0 +1 @@ +[?25l[J[J[J[?12l[?25h[?1049h[?1h=[1;46r[?12;25h[?12l[?25h[27m[m[H[2J[?25l[2;1H[94m~ [3;1H~ [4;1H~ [5;1H~ [6;1H~ [7;1H~ [8;1H~ [9;1H~ [10;1H~ [11;1H~ [12;1H~ [13;1H~ [14;1H~ [15;1H~ [16;1H~ [17;1H~ [18;1H~ [19;1H~ [20;1H~ [21;1H~ [22;1H~ [23;1H~ [24;1H~ [25;1H~ [26;1H~ [27;1H~ [28;1H~ [29;1H~ [30;1H~ [31;1H~ [32;1H~ [33;1H~ [34;1H~ [35;1H~ [36;1H~ [37;1H~ [38;1H~ [39;1H~ [40;1H~ [41;1H~ [42;1H~ [43;1H~ [44;1H~ [45;1H~ [m[16;76HVIM - Vi IMproved[18;79Hversion 7.3[19;73Hby Bram Moolenaar et al.[20;63HVim is open source and freely distributable[22;70HBecome a registered Vim user![23;62Htype :help register[34m<Enter>[m for information [25;62Htype :q[34m<Enter>[m to exit [26;62Htype :help[34m<Enter>[m or [34m<F1>[m for on-line help[27;62Htype :help version7[34m<Enter>[m for version info[29;70HRunning in Vi compatible mode[30;62Htype :set nocp[34m<Enter>[m for Vim defaults[31;62Htype :help cp-default[34m<Enter>[m for info on this[1;1H[?12l[?25h[?25l[46;1HType :quit<Enter> to exit Vim[1;1H[?12l[?25h[?25l[?12l[?25h
\ No newline at end of file |