View | Details | Raw Unified | Return to bug 172633 | Differences between
and this patch

Collapse All | Expand All

(-)dom/org/eclipse/jdt/core/dom/MethodBinding.java (-30 / +48 lines)
Lines 108-115 Link Here
108
		if (annotations == null || (length = annotations.length) == 0)
108
		if (annotations == null || (length = annotations.length) == 0)
109
			return AnnotationBinding.NoAnnotations;
109
			return AnnotationBinding.NoAnnotations;
110
		IAnnotationBinding[] domInstances = new AnnotationBinding[length];
110
		IAnnotationBinding[] domInstances = new AnnotationBinding[length];
111
		for (int i = 0; i < length; i++)
111
		for (int i = 0; i < length; i++) {
112
			domInstances[i] = this.resolver.getAnnotationInstance(annotations[i]);
112
			IAnnotationBinding annotationInstance = this.resolver.getAnnotationInstance(annotations[i]);
113
			if (annotationInstance == null) {
114
				return AnnotationBinding.NoAnnotations;
115
			}
116
			domInstances[i] = annotationInstance;
117
		}
113
		return domInstances; 
118
		return domInstances; 
114
	}
119
	}
115
120
Lines 128-136 Link Here
128
		int length;
133
		int length;
129
		if (annotations == null || (length = annotations.length) == 0)
134
		if (annotations == null || (length = annotations.length) == 0)
130
			return AnnotationBinding.NoAnnotations;
135
			return AnnotationBinding.NoAnnotations;
131
		IAnnotationBinding[] domInstances =new AnnotationBinding[length];
136
		IAnnotationBinding[] domInstances = new AnnotationBinding[length];
132
		for (int i = 0; i < length; i++)
137
		for (int i = 0; i < length; i++) {
133
			domInstances[i] = this.resolver.getAnnotationInstance(annotations[i]);
138
			IAnnotationBinding annotationInstance = this.resolver.getAnnotationInstance(annotations[i]);
139
			if (annotationInstance == null) {
140
				return AnnotationBinding.NoAnnotations;
141
			}
142
			domInstances[i] = annotationInstance;
143
		}
134
		return domInstances; 
144
		return domInstances; 
135
	}
145
	}
136
146
Lines 142-157 Link Here
142
			return parameterTypes;
152
			return parameterTypes;
143
		}
153
		}
144
		org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] parameters = this.binding.parameters;
154
		org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] parameters = this.binding.parameters;
145
		int length = parameters.length;
155
		int length = parameters == null ? 0 : parameters.length;
146
		if (length == 0) {
156
		if (length == 0) {
147
			this.parameterTypes = NO_TYPE_BINDINGS;
157
			return this.parameterTypes = NO_TYPE_BINDINGS;
148
		} else {
158
		} else {
149
			this.parameterTypes = new ITypeBinding[length];
159
			ITypeBinding[] paramTypes = new ITypeBinding[length];
150
			for (int i = 0; i < length; i++) {
160
			for (int i = 0; i < length; i++) {
151
				this.parameterTypes[i] = this.resolver.getTypeBinding(parameters[i]);
161
				ITypeBinding typeBinding = this.resolver.getTypeBinding(parameters[i]);
162
				if (typeBinding == null) {
163
					return this.parameterTypes = NO_TYPE_BINDINGS;
164
				}
165
				paramTypes[i] = typeBinding;
152
			}
166
			}
167
			return this.parameterTypes = paramTypes;
153
		}
168
		}
154
		return this.parameterTypes;
155
	}
169
	}
156
170
157
	/**
171
	/**
Lines 180-193 Link Here
180
		org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] exceptions = this.binding.thrownExceptions;
194
		org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] exceptions = this.binding.thrownExceptions;
181
		int length = exceptions.length;
195
		int length = exceptions.length;
182
		if (length == 0) {
196
		if (length == 0) {
183
			this.exceptionTypes = NO_TYPE_BINDINGS;
197
			return this.exceptionTypes = NO_TYPE_BINDINGS;
184
		} else {
198
		} else {
185
			this.exceptionTypes = new ITypeBinding[length];
199
			ITypeBinding[] exTypes = new ITypeBinding[length];
186
			for (int i = 0; i < length; i++) {
200
			for (int i = 0; i < length; i++) {
187
				this.exceptionTypes[i] = this.resolver.getTypeBinding(exceptions[i]);
201
				ITypeBinding typeBinding = this.resolver.getTypeBinding(exceptions[i]);
202
				if (typeBinding == null) {
203
					return this.exceptionTypes = NO_TYPE_BINDINGS;
204
				}
205
				exTypes[i] = typeBinding;
188
			}
206
			}
207
			return this.exceptionTypes = exTypes;
189
		}
208
		}
190
		return this.exceptionTypes;
191
	}
209
	}
192
	
210
	
193
	public IJavaElement getJavaElement() {
211
	public IJavaElement getJavaElement() {
Lines 339-355 Link Here
339
		if (typeVariableBindings != null) {
357
		if (typeVariableBindings != null) {
340
			int typeVariableBindingsLength = typeVariableBindings.length;
358
			int typeVariableBindingsLength = typeVariableBindings.length;
341
			if (typeVariableBindingsLength != 0) {
359
			if (typeVariableBindingsLength != 0) {
342
				this.typeParameters = new ITypeBinding[typeVariableBindingsLength];
360
				ITypeBinding[] tParameters = new ITypeBinding[typeVariableBindingsLength];
343
				for (int i = 0; i < typeVariableBindingsLength; i++) {
361
				for (int i = 0; i < typeVariableBindingsLength; i++) {
344
					typeParameters[i] = this.resolver.getTypeBinding(typeVariableBindings[i]);
362
					ITypeBinding typeBinding = this.resolver.getTypeBinding(typeVariableBindings[i]);
363
					if (typeBinding == null) {
364
						return this.typeParameters = NO_TYPE_BINDINGS;
365
					}
366
					tParameters[i] = typeBinding;
345
				}
367
				}
346
			} else {
368
				return this.typeParameters = tParameters;
347
				this.typeParameters = NO_TYPE_BINDINGS;
348
			}
369
			}
349
		} else {
350
			this.typeParameters = NO_TYPE_BINDINGS;
351
		}
370
		}
352
		return this.typeParameters;
371
		return this.typeParameters = NO_TYPE_BINDINGS;
353
	}
372
	}
354
373
355
	/**
374
	/**
Lines 379-398 Link Here
379
			if (typeArgumentsBindings != null) {
398
			if (typeArgumentsBindings != null) {
380
				int typeArgumentsLength = typeArgumentsBindings.length;
399
				int typeArgumentsLength = typeArgumentsBindings.length;
381
				if (typeArgumentsLength != 0) {
400
				if (typeArgumentsLength != 0) {
382
					this.typeArguments = new ITypeBinding[typeArgumentsLength];
401
					ITypeBinding[] newTypeArguments = new ITypeBinding[typeArgumentsLength];
383
					for (int i = 0; i < typeArgumentsLength; i++) {
402
					for (int i = 0; i < typeArgumentsLength; i++) {
384
						this.typeArguments[i] = this.resolver.getTypeBinding(typeArgumentsBindings[i]);
403
						ITypeBinding typeBinding = this.resolver.getTypeBinding(typeArgumentsBindings[i]);
404
						if (typeBinding == null) {
405
							return this.typeArguments = NO_TYPE_BINDINGS;
406
						}
407
						newTypeArguments[i] = typeBinding;
385
					}
408
					}
386
				} else {
409
					return this.typeArguments = newTypeArguments;
387
					this.typeArguments = NO_TYPE_BINDINGS;
388
				}
410
				}
389
			} else {
390
				this.typeArguments = NO_TYPE_BINDINGS;
391
			}
411
			}
392
		} else {
393
			this.typeArguments = NO_TYPE_BINDINGS;
394
		}
412
		}
395
		return this.typeArguments;
413
		return this.typeArguments = NO_TYPE_BINDINGS;
396
	}
414
	}
397
415
398
	/**
416
	/**
(-)dom/org/eclipse/jdt/core/dom/TypeBinding.java (-44 / +97 lines)
Lines 69-74 Link Here
69
	private org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding;
69
	private org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding;
70
	private String key;
70
	private String key;
71
	private BindingResolver resolver;
71
	private BindingResolver resolver;
72
	private ITypeBinding[] members;
73
	private ITypeBinding[] interfaces;
74
	private ITypeBinding[] typeArguments;
75
	private ITypeBinding[] typeParameters;
76
	private ITypeBinding[] bounds;
72
	
77
	
73
	public TypeBinding(BindingResolver resolver, org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding) {
78
	public TypeBinding(BindingResolver resolver, org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding) {
74
		this.binding = binding;
79
		this.binding = binding;
Lines 84-91 Link Here
84
			int length = internalAnnotations == null ? 0 : internalAnnotations.length;
89
			int length = internalAnnotations == null ? 0 : internalAnnotations.length;
85
			if (length > 0) {
90
			if (length > 0) {
86
				domInstances = new AnnotationBinding[length];
91
				domInstances = new AnnotationBinding[length];
87
				for (int i = 0; i < length; i++)
92
				for (int i = 0; i < length; i++) {
88
					domInstances[i] = this.resolver.getAnnotationInstance(internalAnnotations[i]);
93
					IAnnotationBinding annotationInstance = this.resolver.getAnnotationInstance(internalAnnotations[i]);
94
					if (annotationInstance == null) {
95
						return AnnotationBinding.NoAnnotations;
96
					}
97
					domInstances[i] = annotationInstance;
98
				}
89
			}
99
			}
90
		}
100
		}
91
		return domInstances;
101
		return domInstances;
Lines 234-249 Link Here
234
	 * @see ITypeBinding#getDeclaredTypes()
244
	 * @see ITypeBinding#getDeclaredTypes()
235
	 */
245
	 */
236
	public ITypeBinding[] getDeclaredTypes() {
246
	public ITypeBinding[] getDeclaredTypes() {
247
		if (this.members != null) {
248
			return this.members;
249
		}
237
		try {
250
		try {
238
			if (isClass() || isInterface() || isEnum()) {
251
			if (isClass() || isInterface() || isEnum()) {
239
				ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
252
				ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
240
				ReferenceBinding[] members = referenceBinding.memberTypes();
253
				ReferenceBinding[] referenceBindingMembers = referenceBinding.memberTypes();
241
				int length = members.length;
254
				int length = referenceBindingMembers.length;
242
				ITypeBinding[] newMembers = new ITypeBinding[length];
255
				ITypeBinding[] newMembers = new ITypeBinding[length];
243
				for (int i = 0; i < length; i++) {
256
				for (int i = 0; i < length; i++) {
244
					newMembers[i] = this.resolver.getTypeBinding(members[i]);
257
					ITypeBinding typeBinding = this.resolver.getTypeBinding(referenceBindingMembers[i]);
258
					if (typeBinding == null) {
259
						return this.members = NO_TYPE_BINDINGS;
260
					}
261
					newMembers[i] = typeBinding;
245
				}
262
				}
246
				return newMembers;
263
				return this.members = newMembers;
247
			}
264
			}
248
		} catch (RuntimeException e) {
265
		} catch (RuntimeException e) {
249
			/* in case a method cannot be resolvable due to missing jars on the classpath
266
			/* in case a method cannot be resolvable due to missing jars on the classpath
Lines 252-258 Link Here
252
			 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=64299
269
			 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=64299
253
			 */
270
			 */
254
		}
271
		}
255
		return NO_TYPE_BINDINGS;
272
		return this.members = NO_TYPE_BINDINGS;
256
	}
273
	}
257
274
258
	/*
275
	/*
Lines 365-381 Link Here
365
	}
382
	}
366
383
367
	public ITypeBinding[] getInterfaces() {
384
	public ITypeBinding[] getInterfaces() {
385
		if (this.interfaces != null) {
386
			return this.interfaces;
387
		}
368
		if (this.binding == null) 
388
		if (this.binding == null) 
369
			return NO_TYPE_BINDINGS;
389
			return this.interfaces = NO_TYPE_BINDINGS;
370
		switch (this.binding.kind()) {
390
		switch (this.binding.kind()) {
371
			case Binding.ARRAY_TYPE :
391
			case Binding.ARRAY_TYPE :
372
			case Binding.BASE_TYPE :
392
			case Binding.BASE_TYPE :
373
				return NO_TYPE_BINDINGS;
393
				return this.interfaces = NO_TYPE_BINDINGS;
374
		}
394
		}
375
		ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
395
		ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
376
		ReferenceBinding[] interfaces = null;
396
		ReferenceBinding[] referenceBindingInterfaces = null;
377
		try {
397
		try {
378
			interfaces = referenceBinding.superInterfaces();
398
			referenceBindingInterfaces = referenceBinding.superInterfaces();
379
		} catch (RuntimeException e) {
399
		} catch (RuntimeException e) {
380
			/* in case a method cannot be resolvable due to missing jars on the classpath
400
			/* in case a method cannot be resolvable due to missing jars on the classpath
381
			 * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=57871
401
			 * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=57871
Lines 383-400 Link Here
383
			 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=64299
403
			 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=64299
384
			 */
404
			 */
385
		}
405
		}
386
		if (interfaces == null) {
406
		if (referenceBindingInterfaces == null) {
387
			return NO_TYPE_BINDINGS;
407
			return this.interfaces = NO_TYPE_BINDINGS;
388
		}
408
		}
389
		int length = interfaces.length;
409
		int length = referenceBindingInterfaces.length;
390
		if (length == 0) {
410
		if (length == 0) {
391
			return NO_TYPE_BINDINGS;
411
			return this.interfaces = NO_TYPE_BINDINGS;
392
		} else {
412
		} else {
393
			ITypeBinding[] newInterfaces = new ITypeBinding[length];
413
			ITypeBinding[] newInterfaces = new ITypeBinding[length];
394
			for (int i = 0; i < length; i++) {
414
			for (int i = 0; i < length; i++) {
395
				newInterfaces[i] = this.resolver.getTypeBinding(interfaces[i]);
415
				ITypeBinding typeBinding = this.resolver.getTypeBinding(referenceBindingInterfaces[i]);
416
				if (typeBinding == null) {
417
					return this.interfaces = NO_TYPE_BINDINGS;
418
				}
419
				newInterfaces[i] = typeBinding;
396
			}
420
			}
397
			return newInterfaces;
421
			return this.interfaces = newInterfaces;
398
		}
422
		}
399
	}
423
	}
400
	
424
	
Lines 470-476 Link Here
470
				IMethod declaringMethod = (IMethod) declaringTypeBinding.getJavaElement();
494
				IMethod declaringMethod = (IMethod) declaringTypeBinding.getJavaElement();
471
				return (JavaElement) declaringMethod.getTypeParameter(typeVariableName);
495
				return (JavaElement) declaringMethod.getTypeParameter(typeVariableName);
472
			} else {
496
			} else {
473
				declaringTypeBinding = this.resolver.getTypeBinding((org.eclipse.jdt.internal.compiler.lookup.TypeBinding) declaringElement);
497
				ITypeBinding typeBinding2 = this.resolver.getTypeBinding((org.eclipse.jdt.internal.compiler.lookup.TypeBinding) declaringElement);
498
				if (typeBinding2 == null) return null;
499
				declaringTypeBinding = typeBinding2;
474
				IType declaringType = (IType) declaringTypeBinding.getJavaElement();
500
				IType declaringType = (IType) declaringTypeBinding.getJavaElement();
475
				return (JavaElement) declaringType.getTypeParameter(typeVariableName);
501
				return (JavaElement) declaringType.getTypeParameter(typeVariableName);
476
			}
502
			}
Lines 576-590 Link Here
576
				ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) this.binding;
602
				ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) this.binding;
577
				buffer = new StringBuffer();
603
				buffer = new StringBuffer();
578
				buffer.append(parameterizedTypeBinding.sourceName());
604
				buffer.append(parameterizedTypeBinding.sourceName());
579
				ITypeBinding[] typeArguments = getTypeArguments();
605
				ITypeBinding[] tArguments = getTypeArguments();
580
				final int typeArgumentsLength = typeArguments.length;
606
				final int typeArgumentsLength = tArguments.length;
581
				if (typeArgumentsLength != 0) {
607
				if (typeArgumentsLength != 0) {
582
					buffer.append('<');
608
					buffer.append('<');
583
					for (int i = 0, max = typeArguments.length; i < max; i++) {
609
					for (int i = 0, max = tArguments.length; i < max; i++) {
584
						if (i > 0) {
610
						if (i > 0) {
585
							buffer.append(',');
611
							buffer.append(',');
586
						}
612
						}
587
						buffer.append(typeArguments[i].getName());
613
						buffer.append(tArguments[i].getName());
588
					}
614
					}
589
					buffer.append('>');	
615
					buffer.append('>');	
590
				}
616
				}
Lines 729-758 Link Here
729
						.append('.');
755
						.append('.');
730
					ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) this.binding;
756
					ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) this.binding;
731
					buffer.append(parameterizedTypeBinding.sourceName());
757
					buffer.append(parameterizedTypeBinding.sourceName());
732
					ITypeBinding[] typeArguments = getTypeArguments();
758
					ITypeBinding[] tArguments = getTypeArguments();
733
					final int typeArgumentsLength = typeArguments.length;
759
					final int typeArgumentsLength = tArguments.length;
734
					if (typeArgumentsLength != 0) {
760
					if (typeArgumentsLength != 0) {
735
						buffer.append('<');
761
						buffer.append('<');
736
						for (int i = 0, max = typeArguments.length; i < max; i++) {
762
						for (int i = 0, max = tArguments.length; i < max; i++) {
737
							if (i > 0) {
763
							if (i > 0) {
738
								buffer.append(',');
764
								buffer.append(',');
739
							}
765
							}
740
							buffer.append(typeArguments[i].getQualifiedName());
766
							buffer.append(tArguments[i].getQualifiedName());
741
						}
767
						}
742
						buffer.append('>');	
768
						buffer.append('>');	
743
					}
769
					}
744
					return String.valueOf(buffer);
770
					return String.valueOf(buffer);
745
				}				
771
				}				
746
				buffer.append(getTypeDeclaration().getQualifiedName());
772
				buffer.append(getTypeDeclaration().getQualifiedName());
747
				ITypeBinding[] typeArguments = getTypeArguments();
773
				ITypeBinding[] tArguments = getTypeArguments();
748
				final int typeArgumentsLength = typeArguments.length;
774
				final int typeArgumentsLength = tArguments.length;
749
				if (typeArgumentsLength != 0) {
775
				if (typeArgumentsLength != 0) {
750
					buffer.append('<');
776
					buffer.append('<');
751
					for (int i = 0, max = typeArguments.length; i < max; i++) {
777
					for (int i = 0, max = tArguments.length; i < max; i++) {
752
						if (i > 0) {
778
						if (i > 0) {
753
							buffer.append(',');
779
							buffer.append(',');
754
						}
780
						}
755
						buffer.append(typeArguments[i].getQualifiedName());
781
						buffer.append(tArguments[i].getQualifiedName());
756
					}
782
					}
757
					buffer.append('>');
783
					buffer.append('>');
758
				}
784
				}
Lines 820-844 Link Here
820
	 * @see org.eclipse.jdt.core.dom.ITypeBinding#getTypeArguments()
846
	 * @see org.eclipse.jdt.core.dom.ITypeBinding#getTypeArguments()
821
	 */
847
	 */
822
	public ITypeBinding[] getTypeArguments() {
848
	public ITypeBinding[] getTypeArguments() {
849
		if (this.typeArguments != null) {
850
			return this.typeArguments;
851
		}
823
		if (this.binding.isParameterizedType()) {
852
		if (this.binding.isParameterizedType()) {
824
			ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) this.binding;
853
			ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) this.binding;
825
			final org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] arguments = parameterizedTypeBinding.arguments;
854
			final org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] arguments = parameterizedTypeBinding.arguments;
826
			if (arguments != null) {
855
			if (arguments != null) {
827
				int argumentsLength = arguments.length;
856
				int argumentsLength = arguments.length;
828
				ITypeBinding[] typeArguments = new ITypeBinding[argumentsLength];
857
				if (argumentsLength != 0) {
829
				for (int i = 0; i < argumentsLength; i++) {
858
					ITypeBinding[] tArguments = new ITypeBinding[argumentsLength];
830
					typeArguments[i] = this.resolver.getTypeBinding(arguments[i]);
859
					for (int i = 0; i < argumentsLength; i++) {
860
						ITypeBinding typeBinding = this.resolver.getTypeBinding(arguments[i]);
861
						if (typeBinding == null) {
862
							return this.typeArguments = NO_TYPE_BINDINGS;
863
						}
864
						tArguments[i] = typeBinding;
865
					}
866
					return this.typeArguments = tArguments;
831
				}
867
				}
832
				return typeArguments;
833
			}
868
			}
834
		}
869
		}
835
		return NO_TYPE_BINDINGS;
870
		return this.typeArguments = NO_TYPE_BINDINGS;
836
	}
871
	}
837
872
838
	/* (non-Javadoc)
873
	/* (non-Javadoc)
839
	 * @see org.eclipse.jdt.core.dom.ITypeBinding#getTypeBounds()
874
	 * @see org.eclipse.jdt.core.dom.ITypeBinding#getTypeBounds()
840
	 */
875
	 */
841
	public ITypeBinding[] getTypeBounds() {
876
	public ITypeBinding[] getTypeBounds() {
877
		if (this.bounds != null) {
878
			return this.bounds;
879
		}
842
		if (this.binding instanceof TypeVariableBinding) {
880
		if (this.binding instanceof TypeVariableBinding) {
843
			TypeVariableBinding typeVariableBinding = (TypeVariableBinding) this.binding;
881
			TypeVariableBinding typeVariableBinding = (TypeVariableBinding) this.binding;
844
			ReferenceBinding varSuperclass = typeVariableBinding.superclass();
882
			ReferenceBinding varSuperclass = typeVariableBinding.superclass();
Lines 863-902 Link Here
863
				ITypeBinding[] typeBounds = new ITypeBinding[boundsLength];
901
				ITypeBinding[] typeBounds = new ITypeBinding[boundsLength];
864
				int boundsIndex = 0;
902
				int boundsIndex = 0;
865
				if (firstClassOrArrayBound != null) {
903
				if (firstClassOrArrayBound != null) {
866
					typeBounds[boundsIndex++] = this.resolver.getTypeBinding(firstClassOrArrayBound);
904
					ITypeBinding typeBinding = this.resolver.getTypeBinding(firstClassOrArrayBound);
905
					if (typeBinding == null) {
906
						return this.bounds = NO_TYPE_BINDINGS;
907
					}
908
					typeBounds[boundsIndex++] = typeBinding;
867
				}
909
				}
868
				if (superinterfaces != null) {
910
				if (superinterfaces != null) {
869
					for (int i = 0; i < superinterfacesLength; i++, boundsIndex++) {
911
					for (int i = 0; i < superinterfacesLength; i++, boundsIndex++) {
870
						typeBounds[boundsIndex] = this.resolver.getTypeBinding(superinterfaces[i]);
912
						ITypeBinding typeBinding = this.resolver.getTypeBinding(superinterfaces[i]);
913
						if (typeBinding == null) {
914
							return this.bounds = NO_TYPE_BINDINGS;
915
						}
916
						typeBounds[boundsIndex] = typeBinding;
871
					}
917
					}
872
				}
918
				}
873
				return typeBounds;
919
				return this.bounds = typeBounds;
874
			}
920
			}
875
		}
921
		}
876
		return NO_TYPE_BINDINGS;
922
		return this.bounds = NO_TYPE_BINDINGS;
877
	}
923
	}
878
924
879
	/* (non-Javadoc)
925
	/* (non-Javadoc)
880
	 * @see org.eclipse.jdt.core.dom.ITypeBinding#getTypeParameters()
926
	 * @see org.eclipse.jdt.core.dom.ITypeBinding#getTypeParameters()
881
	 */
927
	 */
882
	public ITypeBinding[] getTypeParameters() {
928
	public ITypeBinding[] getTypeParameters() {
929
		if (this.typeParameters != null) {
930
			return this.typeParameters;
931
		}
883
		switch(this.binding.kind()) {
932
		switch(this.binding.kind()) {
884
			case Binding.RAW_TYPE :
933
			case Binding.RAW_TYPE :
885
			case Binding.PARAMETERIZED_TYPE :
934
			case Binding.PARAMETERIZED_TYPE :
886
				return NO_TYPE_BINDINGS;
935
				return this.typeParameters = NO_TYPE_BINDINGS;
887
		}
936
		}
888
		TypeVariableBinding[] typeVariableBindings = this.binding.typeVariables();
937
		TypeVariableBinding[] typeVariableBindings = this.binding.typeVariables();
889
		if (typeVariableBindings != null) {
938
		if (typeVariableBindings != null) {
890
			int typeVariableBindingsLength = typeVariableBindings.length;
939
			int typeVariableBindingsLength = typeVariableBindings.length;
891
			if (typeVariableBindingsLength != 0) {
940
			if (typeVariableBindingsLength != 0) {
892
				ITypeBinding[] typeParameters = new ITypeBinding[typeVariableBindingsLength];
941
				ITypeBinding[] tParameters = new ITypeBinding[typeVariableBindingsLength];
893
				for (int i = 0; i < typeVariableBindingsLength; i++) {
942
				for (int i = 0; i < typeVariableBindingsLength; i++) {
894
					typeParameters[i] = this.resolver.getTypeBinding(typeVariableBindings[i]);
943
					ITypeBinding typeBinding = this.resolver.getTypeBinding(typeVariableBindings[i]);
944
					if (typeBinding == null) {
945
						return this.typeParameters = NO_TYPE_BINDINGS;
946
					}
947
					tParameters[i] = typeBinding;
895
				}
948
				}
896
				return typeParameters;
949
				return this.typeParameters = tParameters;
897
			}
950
			}
898
		}
951
		}
899
		return NO_TYPE_BINDINGS;
952
		return this.typeParameters = NO_TYPE_BINDINGS;
900
	}
953
	}
901
	
954
	
902
	/* (non-Javadoc)
955
	/* (non-Javadoc)
(-)dom/org/eclipse/jdt/core/dom/VariableBinding.java (-6 / +11 lines)
Lines 48-56 Link Here
48
		int length = internalAnnotations == null ? 0 : internalAnnotations.length;
48
		int length = internalAnnotations == null ? 0 : internalAnnotations.length;
49
		IAnnotationBinding[] domInstances =
49
		IAnnotationBinding[] domInstances =
50
			length == 0 ? AnnotationBinding.NoAnnotations : new AnnotationBinding[length];
50
			length == 0 ? AnnotationBinding.NoAnnotations : new AnnotationBinding[length];
51
		for (int i = 0; i < length; i++)
51
		for (int i = 0; i < length; i++) {
52
			domInstances[i] = this.resolver.getAnnotationInstance(internalAnnotations[i]);
52
			IAnnotationBinding annotationInstance = this.resolver.getAnnotationInstance(internalAnnotations[i]);
53
		return domInstances;                                                                  
53
			if (annotationInstance == null) {
54
				return AnnotationBinding.NoAnnotations;
55
			}
56
			domInstances[i] = annotationInstance;
57
		}
58
		return domInstances;                                          
54
	}
59
	}
55
60
56
	/* (non-Javadoc)
61
	/* (non-Javadoc)
Lines 174-183 Link Here
174
	 * @see IVariableBinding#getType()
179
	 * @see IVariableBinding#getType()
175
	 */
180
	 */
176
	public ITypeBinding getType() {
181
	public ITypeBinding getType() {
177
		if (type == null) {
182
		if (this.type == null) {
178
			type = this.resolver.getTypeBinding(this.binding.type);
183
			this.type = this.resolver.getTypeBinding(this.binding.type);
179
		}
184
		}
180
		return type;
185
		return this.type;
181
	}
186
	}
182
187
183
	private JavaElement getUnresolvedJavaElement() {
188
	private JavaElement getUnresolvedJavaElement() {

Return to bug 172633