aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2006-07-26 15:23:57 +0000
committeraclement <aclement>2006-07-26 15:23:57 +0000
commit5526c123cdb6a8a92f0f5b0af66e7e65d13988ef (patch)
tree640dfc0a4daa41e710dd385340658baf69ee7a53 /org.aspectj.ajdt.core
parent7ab3074afd99992ef9301311f7c1e1c4dfc50905 (diff)
downloadaspectj-5526c123cdb6a8a92f0f5b0af66e7e65d13988ef.tar.gz
aspectj-5526c123cdb6a8a92f0f5b0af66e7e65d13988ef.zip
pipeline changes: new kind of ResolvedMember for Eclipsey members
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java78
1 files changed, 78 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
new file mode 100644
index 000000000..38dca6826
--- /dev/null
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
@@ -0,0 +1,78 @@
+/* *******************************************************************
+ * Copyright (c) 2006 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:
+ * Andy Clement initial implementation
+ * ******************************************************************/
+package org.aspectj.ajdt.internal.compiler.lookup;
+
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
+import org.aspectj.weaver.AnnotationX;
+import org.aspectj.weaver.ResolvedMemberImpl;
+import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
+
+/**
+ * In the pipeline world, we can be weaving before all types have come through from compilation.
+ * In some cases this means the weaver will want to ask questions of eclipse types and this
+ * subtype of ResolvedMemberImpl is here to answer some of those questions - it is backed by
+ * the real eclipse MethodBinding object and can translate from Eclipse -> Weaver information.
+ */
+public class EclipseResolvedMember extends ResolvedMemberImpl {
+
+ private static String[] NO_ARGS = new String[]{};
+
+ private MethodBinding realBinding;
+ private String[] argumentNames;
+
+ public EclipseResolvedMember(MethodBinding binding, Kind memberKind, ResolvedType realDeclaringType, int modifiers, UnresolvedType type, String string, UnresolvedType[] types, UnresolvedType[] types2) {
+ super(memberKind,realDeclaringType,modifiers,type,string,types,types2);
+ this.realBinding = binding;
+ }
+
+ public AnnotationX[] getAnnotations() {
+ long abits = realBinding.getAnnotationTagBits(); // ensure resolved
+ TypeDeclaration typeDecl = ((SourceTypeBinding)realBinding.declaringClass).scope.referenceContext;
+ AbstractMethodDeclaration methodDecl = typeDecl.declarationOf(realBinding);
+ Annotation[] annos = methodDecl.annotations; // this is what to add
+ if (annos==null) return null;
+ return super.getAnnotations();
+ }
+
+ public ResolvedType[] getAnnotationTypes() {
+ long abits = realBinding.getAnnotationTagBits(); // ensure resolved
+ TypeDeclaration typeDecl = ((SourceTypeBinding)realBinding.declaringClass).scope.referenceContext;
+ AbstractMethodDeclaration methodDecl = typeDecl.declarationOf(realBinding);
+ Annotation[] annos = methodDecl.annotations; // this is what to add
+ if (annos==null) return null;
+ return super.getAnnotationTypes();
+ }
+
+
+ public String[] getParameterNames() {
+ if (argumentNames!=null) return argumentNames;
+ TypeDeclaration typeDecl = ((SourceTypeBinding)realBinding.declaringClass).scope.referenceContext;
+ AbstractMethodDeclaration methodDecl = typeDecl.declarationOf(realBinding);
+ Argument[] args = (methodDecl==null?null:methodDecl.arguments); // dont like this - why isnt the method found sometimes? is it because other errors are being reported?
+ if (args==null) {
+ argumentNames=NO_ARGS;
+ } else {
+ argumentNames = new String[args.length];
+ for (int i = 0; i < argumentNames.length; i++) {
+ argumentNames[i] = new String(methodDecl.arguments[i].name);
+ }
+ }
+ return argumentNames;
+ }
+
+}