View | Details | Raw Unified | Return to bug 241847
Collapse All | Expand All

(-)src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java (+50 lines)
Lines 23-32 Link Here
23
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TrueLiteral;
23
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TrueLiteral;
24
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
24
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
25
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.IntConstant;
25
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.IntConstant;
26
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding;
27
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationHolder;
26
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding;
28
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding;
27
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
29
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
28
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
30
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
29
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
31
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
32
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
30
import org.aspectj.weaver.AnnotationX;
33
import org.aspectj.weaver.AnnotationX;
31
import org.aspectj.weaver.BCException;
34
import org.aspectj.weaver.BCException;
32
import org.aspectj.weaver.MemberKind;
35
import org.aspectj.weaver.MemberKind;
Lines 85-90 Link Here
85
	}
88
	}
86
	
89
	
87
90
91
	public AnnotationX[][] getParameterAnnotations() {
92
		throw new BCException("EclipseResolvedMember.getParameterAnnotations() not-yet-implemented.  Please raise a bug and turn off pipelining as a workaround");
93
	}
94
95
	public ResolvedType[][] getParameterAnnotationTypes() {
96
		if (parameterAnnotationTypes!=null) return parameterAnnotationTypes;
97
		ResolvedType[][] paramAnnos = null;
98
		if (realBinding instanceof MethodBinding) {
99
			MethodBinding mb = (MethodBinding)realBinding;
100
			MethodBinding originalMethod = mb.original();
101
			if (originalMethod.declaringClass instanceof SourceTypeBinding) {
102
				SourceTypeBinding sourceType = (SourceTypeBinding) originalMethod.declaringClass;
103
				if (sourceType.scope != null) {
104
					AbstractMethodDeclaration methodDeclaration = originalMethod.sourceMethod();
105
					sourceType.scope.referenceContext.resolve();
106
//					if (methodDeclaration != null) {
107
//						methodDeclaration.resolve(sourceType.scope);
108
//					}
109
				}
110
			}
111
			
112
			
113
			long abits = realBinding.getAnnotationTagBits(); // ensure resolved
114
			TypeBinding[] params = mb.parameters;
115
			if (params!=null) {
116
				paramAnnos = new ResolvedType[params.length][];				
117
				for (int i=0;i<params.length;i++) {
118
					//AnnotationHolder ah = mb.declaringClass.retrieveAnnotationHolder(mb,true);
119
					AnnotationBinding[] singleParameterAnnotations = mb.getParameterAnnotations(i);
120
					paramAnnos[i] = new ResolvedType[singleParameterAnnotations==null?0:singleParameterAnnotations.length];
121
					if (singleParameterAnnotations!=null) {
122
						for (int j=0;j<singleParameterAnnotations.length;j++) {
123
							UnresolvedType ut = UnresolvedType.forSignature(new String(singleParameterAnnotations[j].getAnnotationType().signature()));
124
							paramAnnos[i][j] = w.resolve(ut);
125
						}
126
					}
127
				}
128
			}
129
		}
130
		if (paramAnnos!=null) {
131
			parameterAnnotationTypes = paramAnnos;
132
		} else {
133
			parameterAnnotationTypes = NO_PARAMETER_ANNOTATION_TYPES;
134
		}
135
		return parameterAnnotationTypes;
136
	}
137
88
	public AnnotationX getAnnotationOfType(UnresolvedType ofType) {
138
	public AnnotationX getAnnotationOfType(UnresolvedType ofType) {
89
		long abits = realBinding.getAnnotationTagBits(); // ensure resolved
139
		long abits = realBinding.getAnnotationTagBits(); // ensure resolved
90
		Annotation[] annos = getEclipseAnnotations();
140
		Annotation[] annos = getEclipseAnnotations();
(-)src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java (+53 lines)
Lines 232-237 Link Here
232
			if (containsAnAspect(units[i])) aspects.add(units[i]); else nonaspects.add(units[i]);
232
			if (containsAnAspect(units[i])) aspects.add(units[i]); else nonaspects.add(units[i]);
233
		}
233
		}
234
		
234
		
235
		
236
		List toDestroy = new ArrayList();
237
		toDestroy.addAll(nonaspects);
238
		List orderedNonAspects = new ArrayList();
239
		sortThem(toDestroy,orderedNonAspects,new ArrayList());
240
		
235
		if (units == null) return; // what does this mean?
241
		if (units == null) return; // what does this mean?
236
		
242
		
237
		// ...and put them back together, aspects first
243
		// ...and put them back together, aspects first
Lines 268-273 Link Here
268
		}
274
		}
269
	}
275
	}
270
	
276
	
277
	private List sortThem(List inputList, List collector,Map theMap) {
278
		if (theMap.isEmpty()) {
279
			for (Iterator iterator = inputList.iterator(); iterator.hasNext();) {
280
				CompilationUnitDeclaration cud =(CompilationUnitDeclaration)iterator.next();
281
				TypeDeclaration[] typeDecls = cud.types;
282
				if (typeDecls!=null) {
283
					for (int i = 0; i < typeDecls.length; i++) { // loop through top level types in the file
284
						TypeDeclaration declaration = typeDecls[i];
285
						theMap.put(declaration.binding.sourceName,cud);
286
						if (declaration.memberTypes!=null) {
287
							TypeDeclaration[] memberTypes = declaration.memberTypes;
288
							for (int j = 0; j < memberTypes.length; j++) { // loop through inner types
289
								theMap.put(memberTypes[j].binding.sourceName,cud);
290
							}
291
						}
292
					}
293
				}
294
			}
295
		}
296
		for (Iterator iterator = inputList.iterator(); iterator.hasNext();) {
297
			CompilationUnitDeclaration cud =(CompilationUnitDeclaration)iterator.next();
298
			TypeDeclaration[] typeDecls = cud.types;
299
			if (typeDecls!=null) {
300
				for (int i = 0; i < typeDecls.length; i++) { // loop through top level types in the file
301
					TypeDeclaration declaration = typeDecls[i];
302
					char[] superName = declaration.superclass.resolvedType.sourceName();
303
					CompilationUnitDeclaration superCud = (CompilationUnitDeclaration)theMap.get(declaration);
304
					if (superCud==null) {
305
						collector.add(cud);
306
					}
307
//					if (declaration.memberTypes!=null) {
308
//						TypeDeclaration[] memberTypes = declaration.memberTypes;
309
//						for (int j = 0; j < memberTypes.length; j++) { // loop through inner types
310
//							theMap.put(memberTypes[j].name,cud);
311
//						}
312
//					}
313
				}
314
			}
315
		}
316
		
317
		
318
		// go through the inputList, if the supertype of the next entry is in the list, add it to collector next otherwise just add the one being processed
319
		
320
		if (cud.)
321
	}
322
323
271
	public void beforeCompiling(ICompilationUnit[] sourceUnits) {
324
	public void beforeCompiling(ICompilationUnit[] sourceUnits) {
272
		resultsPendingWeave = new ArrayList();
325
		resultsPendingWeave = new ArrayList();
273
		reportedErrors = false;		
326
		reportedErrors = false;		

Return to bug 241847