diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-06-04 07:58:52 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-06-04 07:58:52 +0700 |
commit | 49cb924f5402c9d24379ae1af62def6fa5892649 (patch) | |
tree | 69844405209043e2e18aa9eef0f01f287bc1ae52 /docs/sandbox | |
parent | 82df3f0fc9842758f15f12299c9113e48f1ccb5c (diff) | |
download | aspectj-49cb924f5402c9d24379ae1af62def6fa5892649.tar.gz aspectj-49cb924f5402c9d24379ae1af62def6fa5892649.zip |
Upgrade license from CPLv1/EPLv1 to EPLv2
This was required by the Eclipse team as one precondition for the next
release.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'docs/sandbox')
8 files changed, 312 insertions, 312 deletions
diff --git a/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/AOPAllianceAdapter.aj b/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/AOPAllianceAdapter.aj index 3487a2500..50c71830b 100644 --- a/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/AOPAllianceAdapter.aj +++ b/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/AOPAllianceAdapter.aj @@ -1,72 +1,72 @@ -/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.aspectj.aopalliance;
-
-import org.aspectj.lang.SoftException;
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.ConstructorInterceptor;
-
-public abstract aspect AOPAllianceAdapter {
-
- /**
- * Return the interceptor to use at method execution join points.
- * Must be overriden by subclasses.
- * @return MethodInterceptor, or null if no method advice required
- */
- protected abstract MethodInterceptor getMethodInterceptor();
-
- /**
- * Return the interceptor to use at constructor execution join points.
- * May be overriden by subclasses.
- * @return ConstructorInterceptor, or null if no constructor advice required
- */
- protected ConstructorInterceptor getConstructorInterceptor() {
- return null;
- }
-
- protected abstract pointcut targetJoinPoint();
-
- pointcut methodExecution() : execution(* *(..));
- pointcut constructorExecution() : execution(new(..));
-
- Object around() : targetJoinPoint() && methodExecution() {
- MethodInvocationClosure mic = new MethodInvocationClosure(thisJoinPoint) {
- public Object execute() { return proceed();}
- };
- MethodInterceptor mInt = getMethodInterceptor();
- if (mInt != null) {
- try {
- return mInt.invoke(mic);
- } catch (Throwable t) {
- throw new SoftException(t);
- }
- } else {
- return proceed();
- }
- }
-
- Object around() : targetJoinPoint() && constructorExecution() {
- ConstructorInvocationClosure cic = new ConstructorInvocationClosure(thisJoinPoint) {
- public Object execute() { proceed(); return thisJoinPoint.getThis();}
- };
- ConstructorInterceptor cInt = getConstructorInterceptor();
- if (cInt != null) {
- try {
- return cInt.construct(cic);
- } catch (Throwable t) {
- throw new SoftException(t);
- }
- } else {
- return proceed();
- }
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.aspectj.aopalliance; + +import org.aspectj.lang.SoftException; +import org.aopalliance.intercept.MethodInterceptor; +import org.aopalliance.intercept.ConstructorInterceptor; + +public abstract aspect AOPAllianceAdapter { + + /** + * Return the interceptor to use at method execution join points. + * Must be overriden by subclasses. + * @return MethodInterceptor, or null if no method advice required + */ + protected abstract MethodInterceptor getMethodInterceptor(); + + /** + * Return the interceptor to use at constructor execution join points. + * May be overriden by subclasses. + * @return ConstructorInterceptor, or null if no constructor advice required + */ + protected ConstructorInterceptor getConstructorInterceptor() { + return null; + } + + protected abstract pointcut targetJoinPoint(); + + pointcut methodExecution() : execution(* *(..)); + pointcut constructorExecution() : execution(new(..)); + + Object around() : targetJoinPoint() && methodExecution() { + MethodInvocationClosure mic = new MethodInvocationClosure(thisJoinPoint) { + public Object execute() { return proceed();} + }; + MethodInterceptor mInt = getMethodInterceptor(); + if (mInt != null) { + try { + return mInt.invoke(mic); + } catch (Throwable t) { + throw new SoftException(t); + } + } else { + return proceed(); + } + } + + Object around() : targetJoinPoint() && constructorExecution() { + ConstructorInvocationClosure cic = new ConstructorInvocationClosure(thisJoinPoint) { + public Object execute() { proceed(); return thisJoinPoint.getThis();} + }; + ConstructorInterceptor cInt = getConstructorInterceptor(); + if (cInt != null) { + try { + return cInt.construct(cic); + } catch (Throwable t) { + throw new SoftException(t); + } + } else { + return proceed(); + } + } + +} diff --git a/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/ConstructorInvocationClosure.java b/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/ConstructorInvocationClosure.java index f14d3c4e8..8495d13be 100644 --- a/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/ConstructorInvocationClosure.java +++ b/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/ConstructorInvocationClosure.java @@ -1,32 +1,32 @@ -/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.aspectj.aopalliance;
-
-import java.lang.reflect.Constructor;
-
-import org.aopalliance.intercept.ConstructorInvocation;
-import org.aspectj.lang.JoinPoint;
-
-public abstract class ConstructorInvocationClosure extends InvocationJoinPointClosure
- implements ConstructorInvocation {
-
- public ConstructorInvocationClosure(JoinPoint jp) {
- super(jp);
- }
-
- /* (non-Javadoc)
- * @see org.aopalliance.intercept.MethodInvocation#getMethod()
- */
- public Constructor getConstructor() {
- return (Constructor) getStaticPart();
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.aspectj.aopalliance; + +import java.lang.reflect.Constructor; + +import org.aopalliance.intercept.ConstructorInvocation; +import org.aspectj.lang.JoinPoint; + +public abstract class ConstructorInvocationClosure extends InvocationJoinPointClosure + implements ConstructorInvocation { + + public ConstructorInvocationClosure(JoinPoint jp) { + super(jp); + } + + /* (non-Javadoc) + * @see org.aopalliance.intercept.MethodInvocation#getMethod() + */ + public Constructor getConstructor() { + return (Constructor) getStaticPart(); + } + +} diff --git a/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/InvocationJoinPointClosure.java b/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/InvocationJoinPointClosure.java index 1bb20c4d8..d26f031b8 100644 --- a/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/InvocationJoinPointClosure.java +++ b/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/InvocationJoinPointClosure.java @@ -1,54 +1,54 @@ -/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.aspectj.aopalliance;
-
-import java.lang.reflect.AccessibleObject;
-
-import org.aopalliance.intercept.Invocation;
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.reflect.CodeSignature;
-import org.aspectj.lang.reflect.ConstructorSignature;
-import org.aspectj.lang.reflect.MethodSignature;
-
-public abstract class InvocationJoinPointClosure extends JoinPointClosure implements Invocation {
-
- public InvocationJoinPointClosure(JoinPoint jp) {
- super(jp);
- }
-
- /* (non-Javadoc)
- * @see org.aopalliance.intercept.Joinpoint#getStaticPart()
- */
- public AccessibleObject getStaticPart() {
- CodeSignature cSig = (CodeSignature)jp.getSignature();
- Class clazz = cSig.getDeclaringType();
- AccessibleObject ret = null;
- try {
- if (cSig instanceof MethodSignature) {
- ret = clazz.getMethod(cSig.getName(),cSig.getParameterTypes());
- } else if (cSig instanceof ConstructorSignature) {
- ret = clazz.getConstructor(cSig.getParameterTypes());
- }
- } catch (NoSuchMethodException mEx) {
- throw new UnsupportedOperationException(
- "Can't find member " + cSig.toLongString());
- }
- return ret;
- }
-
- /* (non-Javadoc)
- * @see org.aopalliance.intercept.Invocation#getArguments()
- */
- public Object[] getArguments() {
- return jp.getArgs();
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.aspectj.aopalliance; + +import java.lang.reflect.AccessibleObject; + +import org.aopalliance.intercept.Invocation; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.reflect.CodeSignature; +import org.aspectj.lang.reflect.ConstructorSignature; +import org.aspectj.lang.reflect.MethodSignature; + +public abstract class InvocationJoinPointClosure extends JoinPointClosure implements Invocation { + + public InvocationJoinPointClosure(JoinPoint jp) { + super(jp); + } + + /* (non-Javadoc) + * @see org.aopalliance.intercept.Joinpoint#getStaticPart() + */ + public AccessibleObject getStaticPart() { + CodeSignature cSig = (CodeSignature)jp.getSignature(); + Class clazz = cSig.getDeclaringType(); + AccessibleObject ret = null; + try { + if (cSig instanceof MethodSignature) { + ret = clazz.getMethod(cSig.getName(),cSig.getParameterTypes()); + } else if (cSig instanceof ConstructorSignature) { + ret = clazz.getConstructor(cSig.getParameterTypes()); + } + } catch (NoSuchMethodException mEx) { + throw new UnsupportedOperationException( + "Can't find member " + cSig.toLongString()); + } + return ret; + } + + /* (non-Javadoc) + * @see org.aopalliance.intercept.Invocation#getArguments() + */ + public Object[] getArguments() { + return jp.getArgs(); + } + +} diff --git a/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/JoinPointClosure.java b/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/JoinPointClosure.java index e2c709289..38f2846d4 100644 --- a/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/JoinPointClosure.java +++ b/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/JoinPointClosure.java @@ -1,50 +1,50 @@ -/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.aspectj.aopalliance;
-
-import java.lang.reflect.AccessibleObject;
-
-import org.aopalliance.intercept.Joinpoint;
-import org.aspectj.lang.JoinPoint;
-
-public abstract class JoinPointClosure implements Joinpoint {
-
- protected JoinPoint jp;
-
- public JoinPointClosure(JoinPoint joinPoint) {
- this.jp = joinPoint;
- }
-
- /* (non-Javadoc)
- * @see org.aopalliance.intercept.Joinpoint#proceed()
- */
- public Object proceed() throws Throwable {
- return execute();
- }
-
- // for subclasses, renamed from proceed to avoid confusion in
- // AspectJ around advice.
- public abstract Object execute();
-
- /* (non-Javadoc)
- * @see org.aopalliance.intercept.Joinpoint#getThis()
- */
- public Object getThis() {
- return jp.getThis();
- }
- /* (non-Javadoc)
- * @see org.aopalliance.intercept.Joinpoint#getStaticPart()
- * Must return either a Field, Method or Constructor representing the entity
- * at the joinpoint.
- */
- public abstract AccessibleObject getStaticPart();
-
-}
+/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.aspectj.aopalliance; + +import java.lang.reflect.AccessibleObject; + +import org.aopalliance.intercept.Joinpoint; +import org.aspectj.lang.JoinPoint; + +public abstract class JoinPointClosure implements Joinpoint { + + protected JoinPoint jp; + + public JoinPointClosure(JoinPoint joinPoint) { + this.jp = joinPoint; + } + + /* (non-Javadoc) + * @see org.aopalliance.intercept.Joinpoint#proceed() + */ + public Object proceed() throws Throwable { + return execute(); + } + + // for subclasses, renamed from proceed to avoid confusion in + // AspectJ around advice. + public abstract Object execute(); + + /* (non-Javadoc) + * @see org.aopalliance.intercept.Joinpoint#getThis() + */ + public Object getThis() { + return jp.getThis(); + } + /* (non-Javadoc) + * @see org.aopalliance.intercept.Joinpoint#getStaticPart() + * Must return either a Field, Method or Constructor representing the entity + * at the joinpoint. + */ + public abstract AccessibleObject getStaticPart(); + +} diff --git a/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/MethodInvocationClosure.java b/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/MethodInvocationClosure.java index 166c8a70c..087761fec 100644 --- a/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/MethodInvocationClosure.java +++ b/docs/sandbox/aopalliance/src/org/aspectj/aopalliance/MethodInvocationClosure.java @@ -1,33 +1,33 @@ -/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.aspectj.aopalliance;
-
-import java.lang.reflect.Method;
-
-import org.aopalliance.intercept.MethodInvocation;
-import org.aspectj.lang.JoinPoint;
-
-public abstract class MethodInvocationClosure extends InvocationJoinPointClosure
- implements
- MethodInvocation {
-
- public MethodInvocationClosure(JoinPoint jp) {
- super(jp);
- }
-
- /* (non-Javadoc)
- * @see org.aopalliance.intercept.MethodInvocation#getMethod()
- */
- public Method getMethod() {
- return (Method) getStaticPart();
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.aspectj.aopalliance; + +import java.lang.reflect.Method; + +import org.aopalliance.intercept.MethodInvocation; +import org.aspectj.lang.JoinPoint; + +public abstract class MethodInvocationClosure extends InvocationJoinPointClosure + implements + MethodInvocation { + + public MethodInvocationClosure(JoinPoint jp) { + super(jp); + } + + /* (non-Javadoc) + * @see org.aopalliance.intercept.MethodInvocation#getMethod() + */ + public Method getMethod() { + return (Method) getStaticPart(); + } + +} diff --git a/docs/sandbox/api-clients/org/aspectj/samples/AsmHierarchyBuilderExtensionTest.java b/docs/sandbox/api-clients/org/aspectj/samples/AsmHierarchyBuilderExtensionTest.java index 1c99844ab..040929c67 100644 --- a/docs/sandbox/api-clients/org/aspectj/samples/AsmHierarchyBuilderExtensionTest.java +++ b/docs/sandbox/api-clients/org/aspectj/samples/AsmHierarchyBuilderExtensionTest.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2004 Contributors. - * 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: - * Mik Kersten initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Mik Kersten initial implementation * ******************************************************************/ package org.aspectj.samples; @@ -21,35 +21,35 @@ import org.aspectj.asm.IProgramElement; import org.aspectj.asm.internal.ProgramElement; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BlockScope; - + /** * This test demonstrates how hierarchy building in the ASM can be extended * to put additional information in the model, for example method call sites. - * + * * @author Mik Kersten */ public class AsmHierarchyBuilderExtensionTest extends AjdeTestCase { private ExtendedAsmHiearchyBuilder builder = new ExtendedAsmHiearchyBuilder(); - + public void testHiearchyExtension() { assertNotNull(AsmManager.getDefault().getHierarchy().getRoot()); System.out.println(AsmManager.getDefault().getHierarchy().getRoot().toLongString()); } - + protected void setUp() throws Exception { super.setUp("examples"); AjBuildManager.setAsmHierarchyBuilder(builder); // NOTE that we set our builder here - assertTrue("build success", doSynchronousBuild("../examples/coverage/coverage.lst")); + assertTrue("build success", doSynchronousBuild("../examples/coverage/coverage.lst")); } } class ExtendedAsmHiearchyBuilder extends AsmHierarchyBuilder { - + public boolean visit(MessageSend messageSend, BlockScope scope) { IProgramElement peNode = new ProgramElement( new String(">>> found call: " + messageSend.toString()), - IProgramElement.Kind.CODE, + IProgramElement.Kind.CODE, null, //makeLocation(messageSend), 0, "", diff --git a/docs/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapUsageTest.java b/docs/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapUsageTest.java index 98ecdfa7b..d1f050be3 100644 --- a/docs/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapUsageTest.java +++ b/docs/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapUsageTest.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2004 Contributors. - * 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: - * Mik Kersten initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Mik Kersten initial implementation * ******************************************************************/ package org.aspectj.samples; @@ -20,13 +20,13 @@ import org.aspectj.ajdt.internal.core.builder.AjBuildManager; import org.aspectj.asm.*; /** - * Collects join point information for all advised methods and constructors. - * + * Collects join point information for all advised methods and constructors. + * * @author Mik Kersten */ public class AsmRelationshipMapUsageTest extends AjdeTestCase { - public void testFindAdvisedMethods() { + public void testFindAdvisedMethods() { System.out.println("----------------------------------"); System.out.println("Methods affected by advice: "); HierarchyWalker walker = new HierarchyWalker() { @@ -38,9 +38,9 @@ public class AsmRelationshipMapUsageTest extends AjdeTestCase { IRelationship relationship = (IRelationship)it.next(); if (relationship.getKind().equals(IRelationship.Kind.ADVICE)) { System.out.println( - "method: " + node.toString() + "method: " + node.toString() + ", advised by: " + relationship.getTargets()); - } + } } } } @@ -48,7 +48,7 @@ public class AsmRelationshipMapUsageTest extends AjdeTestCase { }; AsmManager.getDefault().getHierarchy().getRoot().walk(walker); } - + public void testListFilesAffectedByInterTypeDecs() { System.out.println("----------------------------------"); System.out.println("Files affected by inter type declarations: "); @@ -61,9 +61,9 @@ public class AsmRelationshipMapUsageTest extends AjdeTestCase { IRelationship relationship = (IRelationship)it.next(); if (relationship.getKind().equals(IRelationship.Kind.DECLARE_INTER_TYPE)) { System.out.println( - "file: " + node.getSourceLocation().getSourceFile().getName() + "file: " + node.getSourceLocation().getSourceFile().getName() + ", declared on by: " + relationship.getTargets()); - } + } } } } @@ -71,11 +71,11 @@ public class AsmRelationshipMapUsageTest extends AjdeTestCase { }; AsmManager.getDefault().getHierarchy().getRoot().walk(walker); } - - + + protected void setUp() throws Exception { super.setUp("examples"); - assertTrue("build success", doSynchronousBuild("../examples/spacewar/spacewar/debug.lst")); + assertTrue("build success", doSynchronousBuild("../examples/spacewar/spacewar/debug.lst")); } } diff --git a/docs/sandbox/common/org/aspectj/langlib/Pointcuts.java b/docs/sandbox/common/org/aspectj/langlib/Pointcuts.java index ce6151a38..89faecc95 100644 --- a/docs/sandbox/common/org/aspectj/langlib/Pointcuts.java +++ b/docs/sandbox/common/org/aspectj/langlib/Pointcuts.java @@ -1,16 +1,16 @@ /* ******************************************************************* * Copyright (c) 2003 Contributors. - * 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: - * Wes Isberg initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ -// START-SAMPLE library-pointcutIdioms Standard pointcut idioms +// START-SAMPLE library-pointcutIdioms Standard pointcut idioms package org.aspectj.langlib; import java.io.*; @@ -19,7 +19,7 @@ import java.util.*; /** * Library of pointcut idioms to use in combination with * other pointcuts. - * + * * @author Wes Isberg */ public final class Pointcuts { @@ -36,54 +36,54 @@ public final class Pointcuts { public pointcut mainExecution() : execution(public static void main(String[])); - + /** staticly-determinable to never match any join point */ public pointcut never(); // if(false) && execution(ThreadDeath *(ThreadDeath, ThreadDeath)); - + public pointcut afterAdviceSupported() : !handler(*); public pointcut aroundAdviceSupported() : !handler(*) && !initialization(new(..)) && !preinitialization(new(..)); - public pointcut anyMethodExecution() : + public pointcut anyMethodExecution() : execution(* *(..)); - public pointcut anyPublicMethodExecution() : + public pointcut anyPublicMethodExecution() : execution(public * *(..)); - public pointcut anyNonPrivateMethodExecution() : + public pointcut anyNonPrivateMethodExecution() : execution(!private * *(..)); - public pointcut anyConstructorExecution() : + public pointcut anyConstructorExecution() : execution(new(..)); - public pointcut anyPublicConstructorExecution() : + public pointcut anyPublicConstructorExecution() : execution(public new(..)); public pointcut anyNonPrivateConstructorExecution() : execution(!private new(..)); - public pointcut anyPublicFieldGet() : + public pointcut anyPublicFieldGet() : get(public * *); - public pointcut anyNonPrivateFieldGet() : + public pointcut anyNonPrivateFieldGet() : get(!private * *); - public pointcut anyPublicFieldSet() : + public pointcut anyPublicFieldSet() : set(public * *); - public pointcut anyNonPrivateFieldSet() : + public pointcut anyNonPrivateFieldSet() : set(!private * *); // also !transient? public pointcut withinSetter() : // require !static? withincode(void set*(*)); // use any return type? multiple parms? - public pointcut withinGetter() : + public pointcut withinGetter() : withincode(!void get*()); // permit parms? require !static? - - public pointcut anyNonPublicFieldSetOutsideConstructorOrSetter() : - set(!public * *) && !withincode(new(..)) + + public pointcut anyNonPublicFieldSetOutsideConstructorOrSetter() : + set(!public * *) && !withincode(new(..)) && !withinSetter(); public pointcut anyRunnableImplementation() : @@ -94,7 +94,7 @@ public final class Pointcuts { public pointcut anySetSystemErrOut() : call(void System.setOut(..)) || call(void System.setErr(..)); - + public pointcut withinAnyJavaCode() : within(java..*) || within(javax..*); @@ -108,15 +108,15 @@ public final class Pointcuts { public pointcut anyThreadConstruction() : call(Thread+.new(..)) || execution(Thread+.new(..)); - /** - * Any calls to java.io classes + /** + * Any calls to java.io classes * (but not methods declared only on their subclasses). */ public pointcut anyJavaIOCalls() : call(* java.io..*.*(..)) || call(java.io..*.new(..)); - /** - * Any calls to java.awt or javax.swing methods or constructors + /** + * Any calls to java.awt or javax.swing methods or constructors * (but not methods declared only on their subclasses). */ public pointcut anyJavaAWTOrSwingCalls() : @@ -125,10 +125,10 @@ public final class Pointcuts { public pointcut cloneImplementationsInNonCloneable() : execution(Object !Cloneable+.clone()); - + public pointcut runImplementationsInNonRunnable() : execution(void !Runnable+.run()); - + /** any calls to java.lang.reflect or Class.get* (except getName()) */ public pointcut anySystemReflectiveCalls() : call(* java.lang.reflect..*.*(..)) @@ -152,13 +152,13 @@ public final class Pointcuts { * an Iterator can remove elements. */ public pointcut anyCollectionWriteCalls() : - call(boolean Collection+.add(Object)) - || call(boolean Collection+.addAll(Collection)) + call(boolean Collection+.add(Object)) + || call(boolean Collection+.addAll(Collection)) || call(void Collection+.clear()) || call(boolean Collection+.remove(Object)) || call(boolean Collection+.removeAll(Collection)) || call(boolean Collection+.retainAll(Collection)); - + public pointcut mostThrowableReadCalls() : call(* Throwable+.get*(..)) || call(* Throwable+.print*(..)) @@ -167,13 +167,13 @@ public final class Pointcuts { public pointcut exceptionWrappingCalls() : (args(Throwable+,..) || args(.., Throwable+)) && (set(Throwable+ Throwable+.*) - || (call(* Throwable+.*(..)) + || (call(* Throwable+.*(..)) || call(Throwable+.new(..)))); public pointcut anyCodeThrowingException() : execution(* *(..) throws Exception+) || execution(new(..) throws Exception+); - + private Pointcuts() {} // XXX avoid this? else pointcuts match it... } //END-SAMPLE library-pointcutIdioms |