diff options
author | acolyer <acolyer> | 2005-04-18 19:45:53 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-04-18 19:45:53 +0000 |
commit | 5113377894abae3490bc3849c49353890cf70f42 (patch) | |
tree | ccf2c579b1cb9ce8e2b39df2978c96405006f70c /aspectj5rt/java5-src/org/aspectj/lang | |
parent | 45f1f040588862f0100f3844574f3a80afab8e15 (diff) | |
download | aspectj-5113377894abae3490bc3849c49353890cf70f42.tar.gz aspectj-5113377894abae3490bc3849c49353890cf70f42.zip |
I'm committing this shell of an implementation for runtime reflection on AspectJ's type system. It's needed by the aUnit guys and provides a means for us to share a structure, take patches etc.. NOT to be considered finished (ha ha) or even a final design at this point in time. We have to do some compiler work to generate runtime-visible structures to support this...
Diffstat (limited to 'aspectj5rt/java5-src/org/aspectj/lang')
15 files changed, 458 insertions, 0 deletions
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/Advice.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/Advice.java new file mode 100644 index 000000000..b31f94b6e --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/Advice.java @@ -0,0 +1,16 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +public interface Advice { + +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/AdviceType.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AdviceType.java new file mode 100644 index 000000000..541334853 --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AdviceType.java @@ -0,0 +1,24 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +/** + * The different types of advice in AspectJ + * + */ +public enum AdviceType { + BEFORE, + AFTER, + AFTER_RETURNING, + AFTER_THROWING, + AROUND; +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjType.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjType.java new file mode 100644 index 000000000..74f4b32db --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjType.java @@ -0,0 +1,187 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +import java.lang.reflect.Method; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Type; +import java.lang.reflect.TypeVariable; +import java.lang.annotation.Annotation; + +/** + * The runtime representation of a type (Aspect, Class, Interface, Annotation, Enum, or Array) in an AspectJ + * program. + */ +public interface AjType<T> extends Type { + + public String getName(); + + public Package getPackage(); + + public Class[] getInterfaces(); + + public int getModifiers(); + + // scope + + public AjType getSupertype(); + + public Type getGenericSupertype(); + + public Method getEnclosingMethod(); + + public Constructor getEnclosingConstructor(); + + public AjType getEnclosingType(); + + public AjType getDeclaringType(); + + public PerClause getPerClause(); + + // annotations + + public boolean isAnnotationPresent(Class<? extends Annotation> annotationType); + + public <A extends Annotation> A getAnnotation(Class<A> annotationType); + + public Annotation[] getAnnotations(); + + public Annotation[] getDeclaredAnnotations(); + + // inner types + + public AjType[] getAjTypes(); + + public AjType[] getDeclaredAjTypes(); + + // constructors + + public Constructor getConstructor(Class... parameterTypes) throws NoSuchMethodException; + + public Constructor[] getConstructors(); + + public Constructor getDeclaredConstructor(Class... parameterTypes) throws NoSuchMethodException; + + public Constructor[] getDeclaredConstructors(); + + // fields + + public Field getDeclaredField(String name) throws NoSuchFieldException; + + public Field[] getDeclaredFields(); + + public Field getField(String name) throws NoSuchFieldException; + + public Field[] getFields(); + + // methods + + public Method getDeclaredMethod(String name, Class... parameterTypes) throws NoSuchMethodException; + + public Method getMethod(String name, Class... parameterTypes) throws NoSuchMethodException; + + public Method[] getDeclaredMethods(); + + public Method[] getMethods(); + + // pointcuts + + public Pointcut getDeclaredPointcut(String name); + + public Pointcut getPointcut(String name); + + public Pointcut[] getDeclaredPointcuts(); + + public Pointcut[] getPointcuts(); + + // advice + + public Advice[] getDeclaredAdvice(AdviceType adviceType); + + public Advice[] getAdvice(AdviceType adviceType); + + // inter-type declarations + + public InterTypeMethodDeclaration getDeclaredITDMethod(String name, Class target, Class... parameterTypes); + + public InterTypeMethodDeclaration[] getDeclaredITDMethods(); + + public InterTypeMethodDeclaration getITDMethod(String name, Class target, Class... parameterTypes); + + public InterTypeMethodDeclaration[] getITDMethods(); + + public InterTypeConstructorDeclaration getDeclaredITDConstructor(Class target, Class... parameterTypes); + + public InterTypeConstructorDeclaration[] getDeclaredITDConstructors(); + + public InterTypeConstructorDeclaration getITDConstructor(Class target, Class... parameterTypes); + + public InterTypeConstructorDeclaration[] getITDConstructors(); + + public InterTypeFieldDeclaration getDeclaredITDField(String name, Class target); + + public InterTypeFieldDeclaration[] getDeclaredITDFields(); + + public InterTypeFieldDeclaration getITDField(String name, Class target); + + public InterTypeFieldDeclaration[] getITDFields(); + + // declare statements + + public DeclareErrorOrWarning getDeclareErrorOrWarnings(); + + public DeclareParents getDeclareParents(); + + public DeclareSoft getDeclareSofts(); + + public DeclareAnnotation getDeclareAnnotations(); + + public DeclarePrecedence getDeclarePrecedence(); + + // misc + + public T[] getEnumConstants(); + + public TypeVariable<Class<T>>[] getTypeParameters(); + + public boolean isEnum(); + + public boolean isInstance(Object o); + + public boolean isInterface(); + + public boolean isLocalClass(); + + public boolean isMemberClass(); + + public boolean isArray(); + + public boolean isPrimitive(); + + public boolean isAspect(); + + public boolean isMemberAspect(); + +} + + +// implementation notes: + +// additional runtime info we need: +// whether or not a class is an aspect +// pointcuts in a type (+ name, parameter types, parameter names, expression) +// itds in a type (is there enough in the class file already?) +// advice in a type (should be enough in the class file already?) +// declares in an aspect (+ associated info) + +// anchor in a generated static member on the type: ajc$reflectionInfo ? or use annotations??
\ No newline at end of file diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjTypeSystem.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjTypeSystem.java new file mode 100644 index 000000000..e47fe6d8b --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjTypeSystem.java @@ -0,0 +1,23 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +/** + * @author colyer + * + */ +public class AjTypeSystem { + + public static AjType getAjType(Class fromClass) { + return null; + } +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareAnnotation.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareAnnotation.java new file mode 100644 index 000000000..cd594e9da --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareAnnotation.java @@ -0,0 +1,20 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +/** + * @author colyer + * + */ +public interface DeclareAnnotation { + +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareErrorOrWarning.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareErrorOrWarning.java new file mode 100644 index 000000000..f62608b30 --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareErrorOrWarning.java @@ -0,0 +1,20 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +/** + * @author colyer + * + */ +public interface DeclareErrorOrWarning { + +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareParents.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareParents.java new file mode 100644 index 000000000..6b1d6f5b3 --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareParents.java @@ -0,0 +1,20 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +/** + * @author colyer + * + */ +public interface DeclareParents { + +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclarePrecedence.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclarePrecedence.java new file mode 100644 index 000000000..ad7086d95 --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclarePrecedence.java @@ -0,0 +1,20 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +/** + * @author colyer + * + */ +public interface DeclarePrecedence { + +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareSoft.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareSoft.java new file mode 100644 index 000000000..ffb392c3f --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareSoft.java @@ -0,0 +1,20 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +/** + * @author colyer + * + */ +public interface DeclareSoft { + +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeConstructorDeclaration.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeConstructorDeclaration.java new file mode 100644 index 000000000..d20440a83 --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeConstructorDeclaration.java @@ -0,0 +1,20 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +/** + * @author colyer + * + */ +public interface InterTypeConstructorDeclaration extends InterTypeDeclaration { + +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeDeclaration.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeDeclaration.java new file mode 100644 index 000000000..510135813 --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeDeclaration.java @@ -0,0 +1,16 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +public interface InterTypeDeclaration { + +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeFieldDeclaration.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeFieldDeclaration.java new file mode 100644 index 000000000..99045798c --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeFieldDeclaration.java @@ -0,0 +1,20 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +/** + * @author colyer + * + */ +public interface InterTypeFieldDeclaration { + +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeMethodDeclaration.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeMethodDeclaration.java new file mode 100644 index 000000000..3fac5c186 --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/InterTypeMethodDeclaration.java @@ -0,0 +1,16 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +public interface InterTypeMethodDeclaration extends InterTypeDeclaration { + +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClause.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClause.java new file mode 100644 index 000000000..eab0b811e --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClause.java @@ -0,0 +1,20 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +/** + * @author colyer + * + */ +public interface PerClause { + +} diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/Pointcut.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/Pointcut.java new file mode 100644 index 000000000..398729ca4 --- /dev/null +++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/Pointcut.java @@ -0,0 +1,16 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.lang.reflect; + +public interface Pointcut { + +} |