diff options
author | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
commit | 144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch) | |
tree | b12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/other-systems | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/other-systems')
-rw-r--r-- | tests/other-systems/ajc-src/FindShowError.java | 26 | ||||
-rw-r--r-- | tests/other-systems/ajc-src/Pcds.java | 4 | ||||
-rw-r--r-- | tests/other-systems/java-src/Pcds.java | 4 | ||||
-rw-r--r-- | tests/other-systems/rsa/aspects/Gets.java | 3 | ||||
-rw-r--r-- | tests/other-systems/rsa/aspects/GetsSets.java | 8 | ||||
-rw-r--r-- | tests/other-systems/sablecc/src/LexerAspect.java | 12 | ||||
-rw-r--r-- | tests/other-systems/sablecc/src/NodeAspect.java | 21 | ||||
-rw-r--r-- | tests/other-systems/sablecc/src/NodesAspect.java | 71 | ||||
-rw-r--r-- | tests/other-systems/sablecc/src/ParserAspect.java | 18 | ||||
-rw-r--r-- | tests/other-systems/util/AroundAll.java | 11 | ||||
-rw-r--r-- | tests/other-systems/util/Trace.java | 37 | ||||
-rw-r--r-- | tests/other-systems/util/TraceAll.java | 3 | ||||
-rw-r--r-- | tests/other-systems/util/TraceCalls.java | 3 | ||||
-rw-r--r-- | tests/other-systems/util/TraceMembers.java | 3 | ||||
-rw-r--r-- | tests/other-systems/util/TraceSets.java | 3 |
15 files changed, 227 insertions, 0 deletions
diff --git a/tests/other-systems/ajc-src/FindShowError.java b/tests/other-systems/ajc-src/FindShowError.java new file mode 100644 index 000000000..49ed8f4bd --- /dev/null +++ b/tests/other-systems/ajc-src/FindShowError.java @@ -0,0 +1,26 @@ +import org.aspectj.compiler.base.ast.*; + + + +aspect Wins { + + pointcut showError(ASTObject ast, String msg): + within(org.aspectj..*) && target(ast) && args(msg) && call(void showError(String)); + + void around(ASTObject ast, String msg): showError(ast, msg) { + System.out.println("hi"); + proceed(ast, msg); + } +} + +aspect Loses { + + pointcut showError(ASTObject ast, String msg): + target(ast) && args(msg) && call(void showError(String)); + + void around(ASTObject ast, String msg): showError(ast, msg) { + System.out.println("hi"); + proceed(ast, msg); + } +} + diff --git a/tests/other-systems/ajc-src/Pcds.java b/tests/other-systems/ajc-src/Pcds.java new file mode 100644 index 000000000..fec81138e --- /dev/null +++ b/tests/other-systems/ajc-src/Pcds.java @@ -0,0 +1,4 @@ +public aspect Pcds { + public pointcut withinMe(): within(org.aspectj..*); + public pointcut myTarget(): target(org.aspectj..*); +} diff --git a/tests/other-systems/java-src/Pcds.java b/tests/other-systems/java-src/Pcds.java new file mode 100644 index 000000000..9bd156879 --- /dev/null +++ b/tests/other-systems/java-src/Pcds.java @@ -0,0 +1,4 @@ +public aspect Pcds { + public pointcut withinMe(): within(java..*) || within(javax..*); + public pointcut myTarget(): target(java..*) || target(javax..*); +} diff --git a/tests/other-systems/rsa/aspects/Gets.java b/tests/other-systems/rsa/aspects/Gets.java new file mode 100644 index 000000000..dc3284c79 --- /dev/null +++ b/tests/other-systems/rsa/aspects/Gets.java @@ -0,0 +1,3 @@ +aspect Gets { + +} diff --git a/tests/other-systems/rsa/aspects/GetsSets.java b/tests/other-systems/rsa/aspects/GetsSets.java new file mode 100644 index 000000000..b5d81dcff --- /dev/null +++ b/tests/other-systems/rsa/aspects/GetsSets.java @@ -0,0 +1,8 @@ +aspect Gets { + pointcut setters(): call(void *.set(..)); + pointcut getters(): call(Object *.get()); + + pointcut all(): setters() || getters(); + before(): all() {} + after(): all() {} +} diff --git a/tests/other-systems/sablecc/src/LexerAspect.java b/tests/other-systems/sablecc/src/LexerAspect.java new file mode 100644 index 000000000..7b04f3e08 --- /dev/null +++ b/tests/other-systems/sablecc/src/LexerAspect.java @@ -0,0 +1,12 @@ +import org.sablecc.sablecc.lexer.*; +import org.sablecc.sablecc.node.*; + +public aspect LexerAspect { + + pointcut callstoSets(): + call(void set*(Object)) && target(Token); + + before () : callstoSets() {} + void around () : callstoSets() { proceed(); } + after () : callstoSets() {} +} diff --git a/tests/other-systems/sablecc/src/NodeAspect.java b/tests/other-systems/sablecc/src/NodeAspect.java new file mode 100644 index 000000000..e43069ad4 --- /dev/null +++ b/tests/other-systems/sablecc/src/NodeAspect.java @@ -0,0 +1,21 @@ +import org.sablecc.sablecc.node.*; +import org.sablecc.sablecc.analysis.Analysis; + +public aspect NodeAspect { + + pointcut removes(): call(void removeChild(Node)) && target(Node); + pointcut callstoSets(): call(void set*(Analysis,Object)) && target(Node); + pointcut callstoGets(): call(void get*(Analysis)) && target(Node); + + before() : removes() {} + void around() : removes() { proceed(); } + after () : removes() {} + + before() : callstoSets() {} + void around() : callstoSets() { proceed(); } + after () : callstoSets() {} + + before() : callstoGets() {} + void around() : callstoGets() { proceed(); } + after () : callstoGets() {} +} diff --git a/tests/other-systems/sablecc/src/NodesAspect.java b/tests/other-systems/sablecc/src/NodesAspect.java new file mode 100644 index 000000000..b2c8eb403 --- /dev/null +++ b/tests/other-systems/sablecc/src/NodesAspect.java @@ -0,0 +1,71 @@ +import org.sablecc.sablecc.node.*; +import org.sablecc.sablecc.analysis.Analysis; +import org.sablecc.sablecc.node.Package; // avoid name conflicts with java.lang.Package + +public aspect NodesAspect { + + pointcut bangAlt(): target(Node) && !target(Alt) && call(* *(..)); + pointcut bangAltName(): target(Node) && !target(AltName) && call(* *(..)); + pointcut bangAltNameOpt(): target(Node) && !target(AltNameOpt) && call(* *(..)); + pointcut bangAlts(): target(Node) && !target(Alts) && call(* *(..)); + pointcut bangAltsTail(): target(Node) && !target(AltsTail) && call(* *(..)); + pointcut bangAltsTails(): target(Node) && !target(AltsTails) && call(* *(..)); + pointcut bangBasic(): target(Node) && !target(Basic) && call(* *(..)); + pointcut bangBinOp(): target(Node) && !target(BinOp) && call(* *(..)); + pointcut bangConcat(): target(Node) && !target(Concat) && call(* *(..)); + pointcut bangElem(): target(Node) && !target(Elem) && call(* *(..)); + pointcut bangElemName(): target(Node) && !target(ElemName) && call(* *(..)); + pointcut bangElemNameOpt(): target(Node) && !target(ElemNameOpt) && call(* *(..)); + pointcut bangElems(): target(Node) && !target(Elems) && call(* *(..)); + pointcut bangGrammar(): target(Node) && !target(Grammar) && call(* *(..)); + pointcut bangHelperDef(): target(Node) && !target(HelperDef) && call(* *(..)); + pointcut bangHelperDefs(): target(Node) && !target(HelperDefs) && call(* *(..)); + pointcut bangHelpers(): target(Node) && !target(Helpers) && call(* *(..)); + pointcut bangHelpersOpt(): target(Node) && !target(HelpersOpt) && call(* *(..)); + pointcut bangIdList(): target(Node) && !target(IdList) && call(* *(..)); + pointcut bangIdListOpt(): target(Node) && !target(IdListOpt) && call(* *(..)); + pointcut bangIdListTail(): target(Node) && !target(IdListTail) && call(* *(..)); + pointcut bangIdListTails(): target(Node) && !target(IdListTails) && call(* *(..)); + pointcut bangIgnTokens(): target(Node) && !target(IgnTokens) && call(* *(..)); + pointcut bangIgnTokensOpt(): target(Node) && !target(IgnTokensOpt) && call(* *(..)); + pointcut bangLookAhead(): target(Node) && !target(LookAhead) && call(* *(..)); + pointcut bangLookAheadOpt(): target(Node) && !target(LookAheadOpt) && call(* *(..)); + pointcut bangPackage(): target(Node) && !target(Package) && call(* *(..)); + pointcut bangPackageOpt(): target(Node) && !target(PackageOpt) && call(* *(..)); + pointcut bangPChar(): target(Node) && !target(PChar) && call(* *(..)); + pointcut bangPkgId(): target(Node) && !target(PkgId) && call(* *(..)); + pointcut bangPkgName(): target(Node) && !target(PkgName) && call(* *(..)); + pointcut bangPkgNameOpt(): target(Node) && !target(PkgNameOpt) && call(* *(..)); + pointcut bangPkgNameTail(): target(Node) && !target(PkgNameTail) && call(* *(..)); + pointcut bangPkgNameTails(): target(Node) && !target(PkgNameTails) && call(* *(..)); + pointcut bangProd(): target(Node) && !target(Prod) && call(* *(..)); + pointcut bangProds(): target(Node) && !target(Prods) && call(* *(..)); + pointcut bangProductions(): target(Node) && !target(Productions) && call(* *(..)); + pointcut bangProductionsOpt(): target(Node) && !target(ProductionsOpt) && call(* *(..)); + pointcut bangPSet(): target(Node) && !target(PSet) && call(* *(..)); + pointcut bangRegExp(): target(Node) && !target(RegExp) && call(* *(..)); + pointcut bangRegExpTail(): target(Node) && !target(RegExpTail) && call(* *(..)); + pointcut bangRegExpTails(): target(Node) && !target(RegExpTails) && call(* *(..)); + pointcut bangSpecifier(): target(Node) && !target(Specifier) && call(* *(..)); + pointcut bangSpecifierOpt(): target(Node) && !target(SpecifierOpt) && call(* *(..)); + pointcut bangStart(): target(Node) && !target(Start) && call(* *(..)); + pointcut bangStateList(): target(Node) && !target(StateList) && call(* *(..)); + pointcut bangStateListOpt(): target(Node) && !target(StateListOpt) && call(* *(..)); + pointcut bangStateListTail(): target(Node) && !target(StateListTail) && call(* *(..)); + pointcut bangStateListTails(): target(Node) && !target(StateListTails) && call(* *(..)); + pointcut bangStates(): target(Node) && !target(States) && call(* *(..)); + pointcut bangStatesOpt(): target(Node) && !target(StatesOpt) && call(* *(..)); + pointcut bangToken(): target(Node) && !target(Token) && call(* *(..)); + pointcut bangTokenDef(): target(Node) && !target(TokenDef) && call(* *(..)); + pointcut bangTokenDefs(): target(Node) && !target(TokenDefs) && call(* *(..)); + pointcut bangTokens(): target(Node) && !target(Tokens) && call(* *(..)); + pointcut bangTokensOpt(): target(Node) && !target(TokensOpt) && call(* *(..)); + pointcut bangTransition(): target(Node) && !target(Transition) && call(* *(..)); + pointcut bangTransitionOpt(): target(Node) && !target(TransitionOpt) && call(* *(..)); + pointcut bangUnExp(): target(Node) && !target(UnExp) && call(* *(..)); + pointcut bangUnExps(): target(Node) && !target(UnExps) && call(* *(..)); + pointcut bangUnOp(): target(Node) && !target(UnOp) && call(* *(..)); + pointcut bangUnOpOpt(): target(Node) && !target(UnOpOpt) && call(* *(..)); +} + + diff --git a/tests/other-systems/sablecc/src/ParserAspect.java b/tests/other-systems/sablecc/src/ParserAspect.java new file mode 100644 index 000000000..cbb8334a5 --- /dev/null +++ b/tests/other-systems/sablecc/src/ParserAspect.java @@ -0,0 +1,18 @@ +import org.sablecc.sablecc.node.*; +import org.sablecc.sablecc.analysis.*; +import org.sablecc.sablecc.parser.*; + +public aspect ParserAspect { + + pointcut pushes(): call(void push(int,Object)) && target(Parser); + pointcut callstoSets(): call(void set*(Object)) && target(Node); + + before () : pushes() {} + void around () : pushes() { proceed(); } + + before () : callstoSets() {} + void around () : callstoSets() { proceed(); } + + after () : callstoSets() {} + after () : pushes() {} +} diff --git a/tests/other-systems/util/AroundAll.java b/tests/other-systems/util/AroundAll.java new file mode 100644 index 000000000..2b57c39fb --- /dev/null +++ b/tests/other-systems/util/AroundAll.java @@ -0,0 +1,11 @@ +aspect AroundAll { + pointcut targets(Object o): + execution(!abstract !native * *(..)) && this(o) && Pcds.withinMe(); + + Object around(Object thisObj): targets(thisObj) { + if (true) { + throw new RuntimeException("not meant to run"); + } + return proceed(thisObj); + } +} diff --git a/tests/other-systems/util/Trace.java b/tests/other-systems/util/Trace.java new file mode 100644 index 000000000..72aa89b20 --- /dev/null +++ b/tests/other-systems/util/Trace.java @@ -0,0 +1,37 @@ +import java.io.Serializable; + +abstract aspect Trace { + abstract pointcut targets(); + + /* + * toString() can throw exceptions, so we'll print + * the java.lang.Class instead. + */ + + before (): targets() { + System.out.println("entering " + thisJoinPoint); + } + after (): targets() { + System.out.println("exiting " + + thisJoinPointStaticPart); + } + + after () throwing (Throwable t): targets() { + System.out.println("throwing " + t); + } + + after () throwing (java.io.IOException ioe): targets() { + System.out.println("throwing " + ioe); + } + + after () returning (Object o): targets() { + System.out.println("returning " + (o!=null ? o.getClass() : null)); + } + + + private static int initCounter() { + return 0; + } + + //private int Serializable.counter = initCounter(); +} diff --git a/tests/other-systems/util/TraceAll.java b/tests/other-systems/util/TraceAll.java new file mode 100644 index 000000000..0c5b0e8c8 --- /dev/null +++ b/tests/other-systems/util/TraceAll.java @@ -0,0 +1,3 @@ +aspect TraceAll extends Trace { + pointcut targets(): call(!native * *(..)) && Pcds.myTarget(); +} diff --git a/tests/other-systems/util/TraceCalls.java b/tests/other-systems/util/TraceCalls.java new file mode 100644 index 000000000..9ecfc2417 --- /dev/null +++ b/tests/other-systems/util/TraceCalls.java @@ -0,0 +1,3 @@ +aspect TraceCalls extends Trace { + pointcut targets(): Pcds.withinMe() && (call(* *(..)) || call(new(..))); +} diff --git a/tests/other-systems/util/TraceMembers.java b/tests/other-systems/util/TraceMembers.java new file mode 100644 index 000000000..5f663d0c4 --- /dev/null +++ b/tests/other-systems/util/TraceMembers.java @@ -0,0 +1,3 @@ +aspect TraceMembers extends Trace { + pointcut targets(): Pcds.withinMe() && execution(!abstract !native * *(..)); +} diff --git a/tests/other-systems/util/TraceSets.java b/tests/other-systems/util/TraceSets.java new file mode 100644 index 000000000..69d1e873b --- /dev/null +++ b/tests/other-systems/util/TraceSets.java @@ -0,0 +1,3 @@ +aspect TraceSets extends Trace { + pointcut targets(): Pcds.withinMe() && set(* *..*.*); +} |