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

Collapse All | Expand All

(-)ITypeBinding.java (-497 / +540 lines)
Lines 63-295 Link Here
63
	public String getBinaryName();
63
	public String getBinaryName();
64
	
64
	
65
	/**
65
	/**
66
	 * Returns whether this type binding represents a primitive type.
66
	 * Returns the bound of this wildcard type if it has one.
67
	 * <p>
67
	 * Returns <code>null</code> if this is not a wildcard type.
68
	 * There are nine predefined type bindings to represent the eight primitive
69
	 * types and <code>void</code>. These have the same names as the primitive
70
	 * types that they represent, namely boolean, byte, char, short, int,
71
	 * long, float, and double, and void.
72
	 * </p>
73
	 * 
68
	 * 
74
	 * @return <code>true</code> if this type binding is for a primitive type,
69
	 * @return the bound of this wildcard type, or <code>null</code> if none
75
	 *   and <code>false</code> otherwise
70
	 * @see #isWildcardType()
71
	 * @see #isUpperbound()
72
	 * @since 3.1
76
	 */
73
	 */
77
	public boolean isPrimitive();
74
	public ITypeBinding getBound();
78
75
79
	/**
76
	/**
80
	 * Returns whether this type binding represents the null type.
77
	 * Returns a list of bindings representing all the fields declared
81
	 * <p>
78
	 * as members of this class, interface, or enum type. These include public, 
82
	 * The null type is the type of a <code>NullLiteral</code> node.
79
	 * protected, default (package-private) access, and private fields declared
83
	 * </p>
80
	 * by the class, but excludes inherited fields. Synthetic fields may or
81
	 * may not be included.
82
	 * Returns an empty list if the class, interface, or enum declares no fields,
83
	 * and for other kinds of type bindings that do not directly have members.
84
	 * The resulting bindings are in no particular order.
84
	 * 
85
	 * 
85
	 * @return <code>true</code> if this type binding is for the null type,
86
	 * @return the list of bindings for the field members of this type,
86
	 *   and <code>false</code> otherwise
87
	 *   or the empty list if this type does not have field members
87
	 */
88
	public boolean isNullType();
89
	
90
	/**
91
	 * Returns whether this type binding represents an array type.
92
	 *
93
	 * @return <code>true</code> if this type binding is for an array type,
94
	 *   and <code>false</code> otherwise
95
	 * @see #getElementType()
96
	 * @see #getDimensions()
97
	 */
88
	 */
98
	public boolean isArray();
89
	public IVariableBinding[] getDeclaredFields();
99
	
90
	
100
	/**
91
	/**
101
	 * Returns the binding representing the element type of this array type,
92
	 * Returns a list of method bindings representing all the methods and 
102
	 * or <code>null</code> if this is not an array type binding. The element
93
	 * constructors declared for this class, interface, enum, or annotation
103
	 * type of an array is never itself an array type.
94
	 * type. These include public, protected, default (package-private) access,
104
	 *
95
	 * and private methods Synthetic methods and constructors may or may not be
105
	 * @return the element type binding, or <code>null</code> if this is
96
	 * included. Returns an empty list if the class, interface, or enum,
106
	 *   not an array type
97
	 * type declares no methods or constructors, if the annotation type declares
98
	 * no members, or if this type binding represents some other kind of type
99
	 * binding. The resulting bindings are in no particular order.
100
	 * 
101
	 * @return the list of method bindings for the methods and constructors
102
	 *   declared by this class, interface, enum type, or annotation type, 
103
	 *   or the empty list if this type does not declare any methods or constructors
107
	 */
104
	 */
108
	public ITypeBinding getElementType();
105
	public IMethodBinding[] getDeclaredMethods();
109
	
106
	
110
	/**
107
	/**
111
	 * Returns the dimensionality of this array type, or <code>0</code> if this
108
	 * Returns the declared modifiers for this class or interface binding
112
	 * is not an array type binding.
109
	 * as specified in the original source declaration of the class or 
110
	 * interface. The result may not correspond to the modifiers in the compiled
111
	 * binary, since the compiler may change them (in particular, for inner 
112
	 * class emulation). The <code>getModifiers</code> method should be used if
113
	 * the compiled modifiers are needed. Returns -1 if this type does not 
114
	 * represent a class or interface.
113
	 *
115
	 *
114
	 * @return the number of dimension of this array type binding, or 
116
	 * @return the bit-wise or of <code>Modifier</code> constants
115
	 *   <code>0</code> if this is not an array type
117
	 * @see #getModifiers()
116
	 */
118
	 * @see Modifier
117
	public int getDimensions();
118
	
119
	/**
120
	 * Returns whether this type is assigment compatible with the given type,
121
	 * as specified in section 5.2 of <em>The Java Language 
122
	 * Specification, Second Edition</em> (JLS2).
123
	 * 
124
	 * @param type the type to check compatibility against
125
	 * @return <code>true</code> if this type is assigment compatible with the
126
	 * given type, and <code>false</code> otherwise
127
	 * @since 3.1
128
	 */
119
	 */
129
	public boolean isAssignmentCompatible(ITypeBinding type);
120
	public int getDeclaredModifiers();
130
	
121
	
131
	/**
122
	/**
132
	 * Returns whether this type is cast compatible with the given type,
123
	 * Returns a list of type bindings representing all the types declared as
133
	 * as specified in section 5.5 of <em>The Java Language 
124
	 * members of this class, interface, or enum type. 
134
	 * Specification, Second Edition</em> (JLS2).
125
	 * These include public, protected, default (package-private) access,
126
	 * and private classes, interfaces, enum types, and annotation types
127
	 * declared by the type, but excludes inherited types. Returns an empty
128
	 * list if the type declares no type members, or if this type
129
	 * binding represents an array type, a primitive type, a type variable,
130
	 * a wildcard type, or the null type.
131
	 * The resulting bindings are in no particular order.
135
	 * 
132
	 * 
136
	 * @param type the type to check compatibility against
133
	 * @return the list of type bindings for the member types of this type,
137
	 * @return <code>true</code> if this type is cast compatible with the
134
	 *   or the empty list if this type does not have member types
138
	 * given type, and <code>false</code> otherwise
139
	 * @since 3.1
140
	 */
141
	public boolean isCastCompatible(ITypeBinding type);
142
143
	/**
144
	 * Returns whether this type binding represents a class type.
145
	 *
146
	 * @return <code>true</code> if this object represents a class,
147
	 *    and <code>false</code> otherwise
148
	 */
135
	 */
149
	public boolean isClass();
136
	public ITypeBinding[] getDeclaredTypes();
150
	
137
	
151
	/**
138
	/**
152
	 * Returns whether this type binding represents an interface type.
139
	 * Returns the type binding representing the class, interface, or enum
140
	 * that declares this binding.
153
	 * <p>
141
	 * <p>
154
	 * Note that an interface can also be an annotation type.
142
	 * The declaring class of a member class, interface, enum, annotation
143
	 * type is the class, interface, or enum type of which it is a member.
144
	 * The declaring class of a local class or interface (including anonymous
145
	 * classes) is the innermost class or interface containing the expression
146
	 * or statement in which this type is declared.
155
	 * </p>
147
	 * </p>
156
	 *
148
	 * <p>The declaring class of a type variable is the class in which the type variable
157
	 * @return <code>true</code> if this object represents an interface,
149
	 * is declared if it is declared on a type. It returns <code>null</code> otherwise.
158
	 *    and <code>false</code> otherwise
159
	 */
160
	public boolean isInterface();
161
	
162
	/**
163
	 * Returns whether this type binding represents an enum type.
164
	 *
165
	 * @return <code>true</code> if this object represents an enum type,
166
	 *    and <code>false</code> otherwise
167
	 * @since 3.1
168
	 */
169
	public boolean isEnum();
170
	
171
	/**
172
	 * Returns whether this type binding represents an annotation type.
173
	 * <p>
174
	 * Note that an annotation type is always an interface.
175
	 * </p>
150
	 * </p>
176
	 *
151
	 * <p>Array types, primitive types, the null type, top-level types,
177
	 * @return <code>true</code> if this object represents an annotation type,
152
	 * and wildcard types have no declaring class.
178
	 *    and <code>false</code> otherwise
153
	 * </p>
179
	 * @since 3.1
154
	 * 
180
	 */
155
	 * @return the binding of the type that declares this type, or
181
	public boolean isAnnotation();
156
	 * <code>null</code> if none
182
	
183
	/**
184
	 * Returns the type parameters of this class or interface type binding.
185
	 * <p>
186
	 * Note that type parameters only occur on the binding of the
187
	 * declaring generic class or interface; e.g., <code>Collection&lt;T&gt;</code>.
188
	 * Type bindings corresponding to a raw or parameterized reference to a generic
189
	 * type do not carry type parameters (they instead have non-empty type arguments
190
	 * and non-trivial erasure).
191
	 * </p> 
192
	 *
193
	 * @return the list of binding for the type variables for the type
194
	 * parameters of this type, or otherwise the empty list
195
	 * @see #isTypeVariable()
196
	 * @since 3.1
197
	 */
157
	 */
198
	// TODO (jeem) - clarify whether binding for a generic type instance carries a copy of the generic type's type parameters as well as type arguments
158
	public ITypeBinding getDeclaringClass();
199
	public ITypeBinding[] getTypeParameters();
200
	
159
	
201
	/**
160
	/**
202
	 * Returns whether this type binding represents a declaration of
161
	 * Returns the method binding representing the method that declares this binding
203
	 * a generic class or interface.
162
	 * of a local type or type variable.
204
	 * <p>
163
	 * <p>
205
	 * Note that type parameters only occur on the binding of the
164
	 * The declaring method of a local class or interface (including anonymous
206
	 * declaring generic class or interface; e.g., <code>Collection&lt;T&gt;</code>.
165
	 * classes) is the innermost method containing the expression or statement in
207
	 * Type bindings corresponding to a raw or parameterized reference to a generic
166
	 * which this type is declared. Returns <code>null</code> if the type
208
	 * type do not carry type parameters (they instead have non-empty type arguments
167
	 * is declared in an initializer.
209
	 * and non-trivial erasure).
210
	 * This method is fully equivalent to <code>getTypeParameters().length &gt; 0)</code>.
211
	 * </p>
168
	 * </p>
212
	 * <p>
169
	 * <p>
213
	 * Note that {@link #isGenericType()},
170
	 * The declaring method of a type variable is the method in which the type
214
	 * {@link #isParameterizedType()},
171
	 * variable is declared if it is declared on a method. It
215
	 * and {@link #isRawType()} are mutually exclusive.
172
	 * returns <code>null</code> otherwise.
173
	 * </p>
174
	 * <p>Array types, primitive types, the null type, top-level types,
175
	 * and wildcard types have no declaring method.
216
	 * </p>
176
	 * </p>
217
	 *
218
	 * @return <code>true</code> if this type binding represents a 
219
	 * declaration of a generic class or interface, and <code>false</code> otherwise
220
	 * @see #getTypeParameters()
221
	 * @since 3.1
222
	 */
223
	public boolean isGenericType();
224
	
225
	/**
226
	 * Returns whether this type binding represents a type variable.
227
	 * Type variables bindings carry the type variable's bounds.
228
	 * 
177
	 * 
229
	 * @return <code>true</code> if this type binding is for a type variable,
178
	 * @return the binding of the method that declares this type, or
230
	 *   and <code>false</code> otherwise
179
	 * <code>null</code> if none
231
	 * @see #getName()
232
	 * @see #getTypeBounds()
233
	 * @since 3.1
234
	 */
235
	public boolean isTypeVariable();
236
	
237
	/**
238
	 * Returns the type bounds of this type variable.
239
	 *
240
	 * @return the list of type bindings for this type variable, or otherwise
241
	 * the empty list
242
	 * @see #isTypeVariable()
243
	 * @since 3.1
244
	 */
180
	 */
245
	public ITypeBinding[] getTypeBounds();
181
	public IMethodBinding getDeclaringMethod();
246
	
182
247
	/**
183
	/**
248
	 * Returns whether this type binding represents an instance of
184
	 * Returns the dimensionality of this array type, or <code>0</code> if this
249
	 * a generic type corresponding to a parameterized type reference.
185
	 * is not an array type binding.
250
	 * <p>
251
	 * For example, an AST type like 
252
	 * <code>Collection&lt;String&gt;</code> typically resolves to a
253
	 * type binding whose type argument is the type binding for the
254
	 * class <code>java.lang.String</code> and whose erasure is the type
255
	 * binding for the generic type <code>java.util.Collection</code>.
256
	 * </p>
257
	 * Note that {@link #isGenericType()},
258
	 * {@link #isParameterizedType()},
259
	 * and {@link #isRawType()} are mutually exclusive.
260
	 * </p>
261
	 *
186
	 *
262
	 * @return <code>true</code> if this type binding represents a 
187
	 * @return the number of dimension of this array type binding, or 
263
	 * an instance of a generic type corresponding to a parameterized
188
	 *   <code>0</code> if this is not an array type
264
	 * type reference, and <code>false</code> otherwise
265
	 * @see #getTypeArguments()
266
	 * @see #getTypeDeclaration()
267
	 * @since 3.1
268
	 */
189
	 */
269
	public boolean isParameterizedType();
190
	public int getDimensions();
270
	
191
271
	/**
192
	/**
272
	 * Returns the type arguments of this generic type instance, or the
193
	 * Returns the binding representing the element type of this array type,
273
	 * empty list for other type bindings.
194
	 * or <code>null</code> if this is not an array type binding. The element
274
	 * <p>
195
	 * type of an array is never itself an array type.
275
	 * Note that type arguments only occur on a type binding that represents
276
	 * an instance of a generic type corresponding to a parameterized type
277
	 * reference (e.g., <code>Collection&lt;String&gt;</code>) or to a raw
278
	 * type reference (e.g., <code>Collection</code>) to a generic type.
279
	 * Do not confuse these with type parameters which only occur on the
280
	 * type binding corresponding directly to the declaration of the 
281
	 * generic class or interface (e.g., <code>Collection&lt;T&gt;</code>).
282
	 * </p> 
283
	 *
196
	 *
284
	 * @return the list of type bindings for the type arguments used to
197
	 * @return the element type binding, or <code>null</code> if this is
285
	 * instantiate the corrresponding generic type, or otherwise the empty list
198
	 *   not an array type
286
	 * @see #getTypeDeclaration()
287
	 * @see #isGenericType()
288
	 * @see #isParameterizedType()
289
	 * @see #isRawType()
290
	 * @since 3.1
291
	 */
199
	 */
292
	public ITypeBinding[] getTypeArguments();
200
	public ITypeBinding getElementType();
293
	
201
	
294
	/**
202
	/**
295
	 * Returns the erasure of this type binding.
203
	 * Returns the erasure of this type binding.
Lines 300-310 Link Here
300
	 * - returns the binding for the corresponding generic type.</li>
208
	 * - returns the binding for the corresponding generic type.</li>
301
	 * <li>For wildcard types ({@link #isWildcardType()})
209
	 * <li>For wildcard types ({@link #isWildcardType()})
302
	 * - returns the binding for the upper bound if it has one and
210
	 * - returns the binding for the upper bound if it has one and
303
	 * java.lang.Object in other cases.
211
	 * java.lang.Object in other cases.</li>
304
	 * </li>
305
	 * <li>For type variables ({@link #isTypeVariable()})
212
	 * <li>For type variables ({@link #isTypeVariable()})
306
	 * - returns the binding for the erasure of the leftmost bound
213
	 * - returns the binding for the erasure of the leftmost bound
307
	 * if it has bounds and java.lang.Object if it does not.</li>
214
	 * if it has bounds and java.lang.Object if it does not.</li>
215
	 * <li>For captures ({@link #isCapture()})
216
	 * - returns the binding for the erasure of the leftmost bound
217
	 * if it has bounds and java.lang.Object if it does not.</li>	 
308
	 * <li>For all other type bindings - returns the identical binding.</li>
218
	 * <li>For all other type bindings - returns the identical binding.</li>
309
	 * </ul>
219
	 * </ul>
310
	 *
220
	 *
Lines 314-400 Link Here
314
	public ITypeBinding getErasure();
224
	public ITypeBinding getErasure();
315
	
225
	
316
	/**
226
	/**
317
	 * Returns the binding for the type declaration corresponding to this type
227
	 * Returns a list of type bindings representing the direct superinterfaces
318
	 * binding. For parameterized types ({@link #isParameterizedType()})
228
	 * of the class, interface, or enum type represented by this type binding. 
319
	 * and raw types ({@link #isRawType()}), this method returns the binding
320
	 * for the corresponding generic type. For other type bindings, this
321
	 * returns the same binding.
322
	 *
323
	 * @return the type binding
324
	 * @since 3.1
325
	 */
326
	public ITypeBinding getTypeDeclaration();
327
	
328
	/**
329
	 * Returns whether this type binding represents an instance of
330
	 * a generic type corresponding to a raw type reference.
331
	 * <p>
229
	 * <p>
332
	 * For example, an AST type like 
230
	 * If this type binding represents a class or enum type, the return value
333
	 * <code>Collection</code> typically resolves to a
231
	 * is an array containing type bindings representing all interfaces
334
	 * type binding whose type argument is the type binding for
232
	 * directly implemented by this class. The number and order of the interface
335
	 * the class <code>java.lang.Object</code> (the
233
	 * objects in the array corresponds to the number and order of the interface
336
	 * default bound for the single type parameter of 
234
	 * names in the <code>implements</code> clause of the original declaration
337
	 * <code>java.util.Collection</code>) and whose erasure is the
235
	 * of this type.
338
	 * type binding for the generic type
339
	 * <code>java.util.Collection</code>.
340
	 * </p>
236
	 * </p>
341
	 * <p>
237
	 * <p>
342
	 * Note that {@link #isGenericType()},
238
	 * If this type binding represents an interface, the array contains 
343
	 * {@link #isParameterizedType()},
239
	 * type bindings representing all interfaces directly extended by this
344
	 * and {@link #isRawType()} are mutually exclusive.
240
	 * interface. The number and order of the interface objects in the array 
241
	 * corresponds to the number and order of the interface names in the 
242
	 * <code>extends</code> clause of the original declaration of this interface. 
345
	 * </p>
243
	 * </p>
346
	 *
347
	 * @return <code>true</code> if this type binding represents a 
348
	 * an instance of a generic type corresponding to a raw
349
	 * type reference, and <code>false</code> otherwise
350
	 * @see #getTypeDeclaration()
351
	 * @see #getTypeArguments()
352
	 * @since 3.1
353
	 */
354
	public boolean isRawType();
355
	
356
	/**
357
	 * Returns whether this type binding represents a wildcard type. A wildcard
358
	 * type occus only as an argument to a parameterized type reference.
359
	 * <p>
244
	 * <p>
360
	 * For example, a AST type like 
245
	 * If the class or enum implements no interfaces, or the interface extends 
361
	 * <code>Collection&lt;? extends Object&gt;</code> typically resolves to a
246
	 * no interfaces, or if this type binding represents an array type, a
362
	 * parameterized type binding whose type argument is a wildcard type
247
	 * primitive type, the null type, a type variable, an annotation type, 
363
	 * with upper type bound <code>java.util.Object/code>.
248
	 * or a wildcard type, this method returns an array of length 0.
364
	 * </p>
249
	 * </p>
365
	 *
250
	 *
366
	 * @return <code>true</code> if this object represents a wildcard type,
251
	 * @return the list of type bindings for the interfaces extended by this
367
	 *    and <code>false</code> otherwise
252
	 *   class or enum, or interfaces extended by this interface, or otherwise 
368
	 * @since 3.1
253
	 *   the empty list
369
	 * @see #getBound()
370
	 * @see #isUpperbound()
371
	 */
254
	 */
372
	public boolean isWildcardType();
255
	public ITypeBinding[] getInterfaces();
373
	
256
	
374
	/**
257
	/**
375
	 * Returns the bound of this wildcard type if it has one.
258
	 * Returns the compiled modifiers for this class, interface, enum,
376
	 * Returns <code>null</code> if this is not a wildcard type.
259
	 * or annotation type binding.
260
	 * The result may not correspond to the modifiers as declared in the
261
	 * original source, since the compiler may change them (in particular, 
262
	 * for inner class emulation). The <code>getDeclaredModifiers</code> method
263
	 * should be used if the original modifiers are needed. 
264
	 * Returns 0 if this type does not represent a class, interface, enum, or annotation
265
	 * type.
377
	 * 
266
	 * 
378
	 * @return the bound of this wildcard type, or <code>null</code> if none
267
	 * @return the compiled modifiers for this type binding or 0
379
	 * @see #isWildcardType()
268
	 * if this type does not represent a class, interface, enum, or annotation
380
	 * @see #isUpperbound()
269
	 * type
381
	 * @since 3.1
270
	 * @see #getDeclaredModifiers()
382
	 */
383
	public ITypeBinding getBound();
384
	
385
	/**
386
	 * Returns whether this wildcard type is an upper bound
387
	 * ("extends") as opposed to a lower bound ("super").
388
	 * Note that this property is only relevant for wildcards
389
	 * that have a bound.
390
	 *
391
	 * @return <code>true</code> if this wildcard type has a bound that is
392
	 * an upper bound, and <code>false</code> in all other cases
393
	 * @see #isWildcardType()
394
	 * @see #getBound()
395
	 * @since 3.1
396
	 */
271
	 */
397
	public boolean isUpperbound();
272
	public int getModifiers();
398
	
273
	
399
	/**
274
	/**
400
	 * Returns the unqualified name of the type represented by this binding
275
	 * Returns the unqualified name of the type represented by this binding
Lines 433-438 Link Here
433
	 * this method) when present.
308
	 * this method) when present.
434
	 * Example: <code>"? extends InputStream"</code>.
309
	 * Example: <code>"? extends InputStream"</code>.
435
	 * </li>
310
	 * </li>
311
	 * <li>For capture types, the name is "capture-of" followed by a single space
312
	 * followed by the name {@link #getName()} of the corresponding wildcard.
313
	 * Example: <code>"capture-of ? extends InputStream"</code>.
314
	 * </li>
436
	 * </ul> 
315
	 * </ul> 
437
	 * 
316
	 * 
438
	 * @return the unqualified name of the type represented by this binding,
317
	 * @return the unqualified name of the type represented by this binding,
Lines 440-446 Link Here
440
	 * @see #getQualifiedName()
319
	 * @see #getQualifiedName()
441
	 */
320
	 */
442
	public String getName();
321
	public String getName();
443
			
322
	
444
	/**
323
	/**
445
	 * Returns the binding for the package in which this type is declared.
324
	 * Returns the binding for the package in which this type is declared.
446
	 * 
325
	 * 
Lines 452-501 Link Here
452
	public IPackageBinding getPackage();
331
	public IPackageBinding getPackage();
453
	
332
	
454
	/**
333
	/**
455
	 * Returns the type binding representing the class, interface, or enum
334
	 * Returns the fully qualified name of the type represented by this 
456
	 * that declares this binding.
335
	 * binding if it has one.
457
	 * <p>
336
	 * <ul>
458
	 * The declaring class of a member class, interface, enum, annotation
337
	 * <li>For top-level types, the fully qualified name is the simple name of
459
	 * type is the class, interface, or enum type of which it is a member.
338
	 * the type preceded by the package name (or unqualified if in a default package)
460
	 * The declaring class of a local class or interface (including anonymous
339
	 * and a ".".
461
	 * classes) is the innermost class or interface containing the expression
340
	 * Example: <code>"java.lang.String"</code> or <code>"java.util.Collection"</code>.
462
	 * or statement in which this type is declared.
341
	 * Note that the type parameters of a generic type are not included.</li>
463
	 * </p>
342
	 * <li>For members of top-level types, the fully qualified name is the
464
	 * <p>The declaring class of a type variable is the class in which the type variable
343
	 * simple name of the type preceded by the fully qualified name of the
465
	 * is declared if it is declared on a type. It returns <code>null</code> otherwise.
344
	 * enclosing type (as computed by this method) and a ".".
466
	 * </p>
345
	 * Example: <code>"java.io.ObjectInputStream.GetField"</code>.
467
	 * <p>Array types, primitive types, the null type, top-level types,
346
	 * If the binding is for a member type that corresponds to a particular instance
468
	 * and wildcard types have no declaring class.
347
	 * of a generic type arising from a parameterized type reference, the simple
469
	 * </p>
348
	 * name of the type is followed by the fully qualified names of the type arguments
470
	 * 
349
	 * (as computed by this method) surrounded by "&lt;&gt;" and separated by ",".
471
	 * @return the binding of the type that declares this type, or
350
	 * Example: <code>"pkg.Outer.Inner&lt;java.lang.String&gt;"</code>.
472
	 * <code>null</code> if none
351
	 * </li>
473
	 */
352
	 * <li>For primitive types, the fully qualified name is the keyword for
474
	public ITypeBinding getDeclaringClass();
353
	 * the primitive type.
475
354
	 * Example: <code>"int"</code>.</li>
476
	/**
355
	 * <li>For the null type, the fully qualified name is the string 
477
	 * Returns the method binding representing the method that declares this binding
356
	 * "null".</li>
478
	 * of a local type or type variable.
357
	 * <li>Local types (including anonymous classes) and members of local
479
	 * <p>
358
	 * types do not have a fully qualified name. For these types, and array
480
	 * The declaring method of a local class or interface (including anonymous
359
	 * types thereof, this method returns an empty string.</li>
481
	 * classes) is the innermost method containing the expression or statement in
360
	 * <li>For array types whose component type has a fully qualified name, 
482
	 * which this type is declared. Returns <code>null</code> if the type
361
	 * the fully qualified name is the fully qualified name of the component
483
	 * is declared in an initializer.
362
	 * type (as computed by this method) followed by "[]".
484
	 * </p>
363
	 * Example: <code>"java.lang.String[]"</code>.</li>
485
	 * <p>
364
	 * <li>For type variables, the fully qualified name is just the name of the
486
	 * The declaring method of a type variable is the method in which the type
365
	 * type variable (type bounds are not included).
487
	 * variable is declared if it is declared on a method. It
366
	 * Example: <code>"X"</code>.</li>
488
	 * returns <code>null</code> otherwise.
367
	 * <li>For type bindings that correspond to particular instances of a generic
489
	 * </p>
368
	 * type arising from a parameterized type reference,
490
	 * <p>Array types, primitive types, the null type, top-level types,
369
	 * the fully qualified name is the fully qualified name of the erasure
491
	 * and wildcard types have no declaring method.
370
	 * type followed by the fully qualified names of the type arguments surrounded by "&lt;&gt;" and separated by ",".
492
	 * </p>
371
	 * Example: <code>"java.util.Collection&lt;java.lang.String&gt;"</code>.
372
	 * </li>
373
	 * <li>For type bindings that correspond to particular instances of a generic
374
	 * type arising from a raw type reference,
375
	 * the fully qualified name is the fully qualified name of the erasure type.
376
	 * Example: <code>"java.util.Collection"</code>. Note that the
377
	 * the type parameters are omitted.</li>
378
	 * <li>For wildcard types, the fully qualified name is "?" optionally followed by 
379
	 * a single space followed by the keyword "extends" or "super" 
380
	 * followed a single space followed by the fully qualified name of the bound
381
	 * (as computed by this method) when present.
382
	 * Example: <code>"? extends java.io.InputStream"</code>.
383
	 * </li>
384
	 * </ul>
493
	 * 
385
	 * 
494
	 * @return the binding of the method that declares this type, or
386
	 * @return the fully qualified name of the type represented by this 
495
	 * <code>null</code> if none
387
	 *    binding, or the empty string if it has none
388
	 * @see #getName()
389
	 * @since 2.1
496
	 */
390
	 */
497
	public IMethodBinding getDeclaringMethod();
391
	public String getQualifiedName();
498
392
	
499
	/**
393
	/**
500
	 * Returns the type binding for the superclass of the type represented
394
	 * Returns the type binding for the superclass of the type represented
501
	 * by this class binding.
395
	 * by this class binding.
Lines 526-619 Link Here
526
	public ITypeBinding getSuperclass();
420
	public ITypeBinding getSuperclass();
527
	
421
	
528
	/**
422
	/**
529
	 * Returns a list of type bindings representing the direct superinterfaces
423
	 * Returns the type arguments of this generic type instance, or the
530
	 * of the class, interface, or enum type represented by this type binding. 
424
	 * empty list for other type bindings.
531
	 * <p>
425
	 * <p>
532
	 * If this type binding represents a class or enum type, the return value
426
	 * Note that type arguments only occur on a type binding that represents
533
	 * is an array containing type bindings representing all interfaces
427
	 * an instance of a generic type corresponding to a parameterized type
534
	 * directly implemented by this class. The number and order of the interface
428
	 * reference (e.g., <code>Collection&lt;String&gt;</code>) or to a raw
535
	 * objects in the array corresponds to the number and order of the interface
429
	 * type reference (e.g., <code>Collection</code>) to a generic type.
536
	 * names in the <code>implements</code> clause of the original declaration
430
	 * Do not confuse these with type parameters which only occur on the
537
	 * of this type.
431
	 * type binding corresponding directly to the declaration of the 
538
	 * </p>
432
	 * generic class or interface (e.g., <code>Collection&lt;T&gt;</code>).
433
	 * </p> 
434
	 *
435
	 * @return the list of type bindings for the type arguments used to
436
	 * instantiate the corrresponding generic type, or otherwise the empty list
437
	 * @see #getTypeDeclaration()
438
	 * @see #isGenericType()
439
	 * @see #isParameterizedType()
440
	 * @see #isRawType()
441
	 * @since 3.1
442
	 */
443
	public ITypeBinding[] getTypeArguments();
444
	
445
	/**
446
	 * Returns the type bounds of this type variable or capture.
447
	 *
448
	 * @return the list of type bindings for this type variable or capture, or otherwise
449
	 * the empty list
450
	 * @see #isCapture()
451
	 * @see #isTypeVariable()
452
	 * @since 3.1
453
	 */
454
	public ITypeBinding[] getTypeBounds();
455
	
456
	/**
457
	 * Returns the binding for the type declaration corresponding to this type
458
	 * binding. For parameterized types ({@link #isParameterizedType()})
459
	 * and raw types ({@link #isRawType()}), this method returns the binding
460
	 * for the corresponding generic type. For other type bindings, this
461
	 * returns the same binding.
462
	 *
463
	 * @return the type binding
464
	 * @since 3.1
465
	 */
466
	public ITypeBinding getTypeDeclaration();
467
	
468
	/**
469
	 * Returns the type parameters of this class or interface type binding.
539
	 * <p>
470
	 * <p>
540
	 * If this type binding represents an interface, the array contains 
471
	 * Note that type parameters only occur on the binding of the
541
	 * type bindings representing all interfaces directly extended by this
472
	 * declaring generic class or interface; e.g., <code>Collection&lt;T&gt;</code>.
542
	 * interface. The number and order of the interface objects in the array 
473
	 * Type bindings corresponding to a raw or parameterized reference to a generic
543
	 * corresponds to the number and order of the interface names in the 
474
	 * type do not carry type parameters (they instead have non-empty type arguments
544
	 * <code>extends</code> clause of the original declaration of this interface. 
475
	 * and non-trivial erasure).
545
	 * </p>
476
	 * </p> 
477
	 *
478
	 * @return the list of binding for the type variables for the type
479
	 * parameters of this type, or otherwise the empty list
480
	 * @see #isTypeVariable()
481
	 * @since 3.1
482
	 */
483
	// TODO (jeem) - clarify whether binding for a generic type instance carries a copy of the generic type's type parameters as well as type arguments
484
	public ITypeBinding[] getTypeParameters();
485
	
486
	/**
487
	 * Return the corresponding wildcard binding if this type binding represents a capture
488
	 * binding, <code>null</code> otherwise.
489
	 * 
490
	 * @return the corresponding wildcard binding if this type binding represents a capture
491
	 * binding, <code>null</code> otherwise
492
	 * @since 3.1
493
	 */
494
	public ITypeBinding getWildcard();
495
	
496
	/**
497
	 * Returns whether this type binding represents an annotation type.
546
	 * <p>
498
	 * <p>
547
	 * If the class or enum implements no interfaces, or the interface extends 
499
	 * Note that an annotation type is always an interface.
548
	 * no interfaces, or if this type binding represents an array type, a
549
	 * primitive type, the null type, a type variable, an annotation type, 
550
	 * or a wildcard type, this method returns an array of length 0.
551
	 * </p>
500
	 * </p>
552
	 *
501
	 *
553
	 * @return the list of type bindings for the interfaces extended by this
502
	 * @return <code>true</code> if this object represents an annotation type,
554
	 *   class or enum, or interfaces extended by this interface, or otherwise 
503
	 *    and <code>false</code> otherwise
555
	 *   the empty list
504
	 * @since 3.1
556
	 */
505
	 */
557
	public ITypeBinding[] getInterfaces();
506
	public boolean isAnnotation();
558
		
507
	
559
	/**
508
	/**
560
	 * Returns the compiled modifiers for this class, interface, enum,
509
	 * Returns whether this type binding represents an anonymous class.
561
	 * or annotation type binding.
510
	 * <p>
562
	 * The result may not correspond to the modifiers as declared in the
511
	 * An anonymous class is a subspecies of local class, and therefore mutually
563
	 * original source, since the compiler may change them (in particular, 
512
	 * exclusive with member types. Note that anonymous classes have no name 
564
	 * for inner class emulation). The <code>getDeclaredModifiers</code> method
513
	 * (<code>getName</code> returns the empty string).
565
	 * should be used if the original modifiers are needed. 
514
	 * </p>
566
	 * Returns 0 if this type does not represent a class, interface, enum, or annotation
515
	 *
567
	 * type.
516
	 * @return <code>true</code> if this type binding is for an anonymous class,
568
	 * 
517
	 *   and <code>false</code> otherwise
569
	 * @return the compiled modifiers for this type binding or 0
570
	 * if this type does not represent a class, interface, enum, or annotation
571
	 * type
572
	 * @see #getDeclaredModifiers()
573
	 */
518
	 */
574
	public int getModifiers();
519
	public boolean isAnonymous();
575
	
520
	
576
	/**
521
	/**
577
	 * Returns the declared modifiers for this class or interface binding
522
	 * Returns whether this type binding represents an array type.
578
	 * as specified in the original source declaration of the class or 
579
	 * interface. The result may not correspond to the modifiers in the compiled
580
	 * binary, since the compiler may change them (in particular, for inner 
581
	 * class emulation). The <code>getModifiers</code> method should be used if
582
	 * the compiled modifiers are needed. Returns -1 if this type does not 
583
	 * represent a class or interface.
584
	 *
523
	 *
585
	 * @return the bit-wise or of <code>Modifier</code> constants
524
	 * @return <code>true</code> if this type binding is for an array type,
586
	 * @see #getModifiers()
525
	 *   and <code>false</code> otherwise
587
	 * @see Modifier
526
	 * @see #getElementType()
527
	 * @see #getDimensions()
588
	 */
528
	 */
589
	public int getDeclaredModifiers();
529
	public boolean isArray();
590
	
530
	
591
	/**
531
	/**
592
	 * Returns whether this type is subtype compatible with the given type,
532
	 * Returns whether this type is assigment compatible with the given type,
593
	 * as specified in section 4.10 of <em>The Java Language 
533
	 * as specified in section 5.2 of <em>The Java Language 
594
	 * Specification, Third Edition</em> (JLS3).
534
	 * Specification, Second Edition</em> (JLS2).
595
	 * 
535
	 * 
596
	 * @param type the type to check compatibility against
536
	 * @param type the type to check compatibility against
597
	 * @return <code>true</code> if this type is subtype compatible with the
537
	 * @return <code>true</code> if this type is assigment compatible with the
598
	 * given type, and <code>false</code> otherwise
538
	 * given type, and <code>false</code> otherwise
599
	 * @since 3.1
539
	 * @since 3.1
600
	 */
540
	 */
601
	public boolean isSubTypeCompatible(ITypeBinding type);
541
	public boolean isAssignmentCompatible(ITypeBinding type);
602
	
542
	
603
	/**
543
	/**
604
	 * Returns whether this type binding represents a top-level class,
544
	 * Returns whether this type binding represents a capture binding.
605
	 * interface, enum, or annotation type.
606
	 * <p>
545
	 * <p>
607
	 * A top-level type is any type whose declaration does not occur within the
546
	 * Capture bindings result from capture conversion as specified 
608
	 * body of another type declaration. The set of top level types is disjoint
547
	 * in section 5.1.10 of <em>The Java Language Specification, 
609
	 * from the set of nested types.
548
	 * Third Edition</em> (JLS3). 
549
	 *</p>
550
	 *<p>
551
	 * A capture binding may have upper bounds and a lower bound.
552
	 * Upper bounds may be accessed using {@link #getTypeBounds()},
553
	 * the lower bound must be accessed indirectly through the associated
554
	 * wildcard {@link #getWildcard()} when it is a lower bound wildcard.
555
	 *</p>
556
	 *<p>
557
	 * Note that capture are different from regular type variable (even
558
	 * though they are often depicted as synthetic type variables), and
559
	 * as such {@link #isTypeVariable()} will answer <code>false</code>.
560
	 *</p>
561
	 * @return <code>true</code> if this type binding is a capture,
562
	 *   and <code>false</code> otherwise
563
	 *   @see #getTypeBounds()
564
	 *   @see #getWildcard()
565
	 *   @since 3.1
566
	 */
567
	public boolean isCapture();
568
			
569
	/**
570
	 * Returns whether this type is cast compatible with the given type,
571
	 * as specified in section 5.5 of <em>The Java Language 
572
	 * Specification, Second Edition</em> (JLS2).
573
	 * 
574
	 * @param type the type to check compatibility against
575
	 * @return <code>true</code> if this type is cast compatible with the
576
	 * given type, and <code>false</code> otherwise
577
	 * @since 3.1
578
	 */
579
	public boolean isCastCompatible(ITypeBinding type);
580
	
581
	/**
582
	 * Returns whether this type binding represents a class type.
583
	 *
584
	 * @return <code>true</code> if this object represents a class,
585
	 *    and <code>false</code> otherwise
586
	 */
587
	public boolean isClass();
588
589
	/**
590
	 * Returns whether this type binding represents an enum type.
591
	 *
592
	 * @return <code>true</code> if this object represents an enum type,
593
	 *    and <code>false</code> otherwise
594
	 * @since 3.1
595
	 */
596
	public boolean isEnum();
597
598
	/**
599
	 * Returns whether this type binding originated in source code.
600
	 * Returns <code>false</code> for all primitive types, the null type,
601
	 * array types, and for all classes, interfaces, enums, annotation
602
	 * types, type variables, parameterized type references,
603
	 * raw type references, and wildcard types, whose information came from a
604
	 * pre-compiled binary class file.
605
	 * 
606
	 * @return <code>true</code> if the type is in source code,
607
	 *    and <code>false</code> otherwise
608
	 */
609
	public boolean isFromSource();
610
	
611
	/**
612
	 * Returns whether this type binding represents a declaration of
613
	 * a generic class or interface.
614
	 * <p>
615
	 * Note that type parameters only occur on the binding of the
616
	 * declaring generic class or interface; e.g., <code>Collection&lt;T&gt;</code>.
617
	 * Type bindings corresponding to a raw or parameterized reference to a generic
618
	 * type do not carry type parameters (they instead have non-empty type arguments
619
	 * and non-trivial erasure).
620
	 * This method is fully equivalent to <code>getTypeParameters().length &gt; 0)</code>.
621
	 * </p>
622
	 * <p>
623
	 * Note that {@link #isGenericType()},
624
	 * {@link #isParameterizedType()},
625
	 * and {@link #isRawType()} are mutually exclusive.
626
	 * </p>
627
	 *
628
	 * @return <code>true</code> if this type binding represents a 
629
	 * declaration of a generic class or interface, and <code>false</code> otherwise
630
	 * @see #getTypeParameters()
631
	 * @since 3.1
632
	 */
633
	public boolean isGenericType();
634
		
635
	/**
636
	 * Returns whether this type binding represents an interface type.
637
	 * <p>
638
	 * Note that an interface can also be an annotation type.
639
	 * </p>
640
	 *
641
	 * @return <code>true</code> if this object represents an interface,
642
	 *    and <code>false</code> otherwise
643
	 */
644
	public boolean isInterface();
645
	
646
	/**
647
	 * Returns whether this type binding represents a local class.
648
	 * <p>
649
	 * A local class is any nested class or enum type not declared as a member
650
	 * of another class or interface. A local class is a subspecies of nested
651
	 * type, and mutually exclusive with member types. Note that anonymous
652
	 * classes are a subspecies of local classes.
653
	 * </p>
654
	 * <p>
655
	 * Also note that interfaces and annotation types cannot be local.
656
	 * </p>
657
	 *
658
	 * @return <code>true</code> if this type binding is for a local class or
659
	 * enum type, and <code>false</code> otherwise
660
	 */
661
	public boolean isLocal();
662
	
663
	/**
664
	 * Returns whether this type binding represents a member class or
665
	 * interface.
666
	 * <p>
667
	 * A member type is any type declared as a member of
668
	 * another type. A member type is a subspecies of nested
669
	 * type, and mutually exclusive with local types.
610
	 * </p>
670
	 * </p>
611
	 *
671
	 *
612
	 * @return <code>true</code> if this type binding is for a top-level class,
672
	 * @return <code>true</code> if this type binding is for a member class,
613
	 *   interface, enum, or annotation type, and <code>false</code> otherwise
673
	 *   interface, enum, or annotation type, and <code>false</code> otherwise
614
	 */
674
	 */
615
	public boolean isTopLevel();
675
	public boolean isMember();
616
676
	
617
	/**
677
	/**
618
	 * Returns whether this type binding represents a nested class, interface,
678
	 * Returns whether this type binding represents a nested class, interface,
619
	 * enum, or annotation type.
679
	 * enum, or annotation type.
Lines 630-795 Link Here
630
	public boolean isNested();
690
	public boolean isNested();
631
691
632
	/**
692
	/**
633
	 * Returns whether this type binding represents a member class or
693
	 * Returns whether this type binding represents the null type.
634
	 * interface.
635
	 * <p>
694
	 * <p>
636
	 * A member type is any type declared as a member of
695
	 * The null type is the type of a <code>NullLiteral</code> node.
637
	 * another type. A member type is a subspecies of nested
638
	 * type, and mutually exclusive with local types.
639
	 * </p>
696
	 * </p>
640
	 *
697
	 * 
641
	 * @return <code>true</code> if this type binding is for a member class,
698
	 * @return <code>true</code> if this type binding is for the null type,
642
	 *   interface, enum, or annotation type, and <code>false</code> otherwise
699
	 *   and <code>false</code> otherwise
643
	 */
700
	 */
644
	public boolean isMember();
701
	public boolean isNullType();
645
	
702
646
	/**
703
	/**
647
	 * Returns whether this type binding represents a local class.
704
	 * Returns whether this type binding represents an instance of
705
	 * a generic type corresponding to a parameterized type reference.
648
	 * <p>
706
	 * <p>
649
	 * A local class is any nested class or enum type not declared as a member
707
	 * For example, an AST type like 
650
	 * of another class or interface. A local class is a subspecies of nested
708
	 * <code>Collection&lt;String&gt;</code> typically resolves to a
651
	 * type, and mutually exclusive with member types. Note that anonymous
709
	 * type binding whose type argument is the type binding for the
652
	 * classes are a subspecies of local classes.
710
	 * class <code>java.lang.String</code> and whose erasure is the type
711
	 * binding for the generic type <code>java.util.Collection</code>.
653
	 * </p>
712
	 * </p>
654
	 * <p>
713
	 * Note that {@link #isGenericType()},
655
	 * Also note that interfaces and annotation types cannot be local.
714
	 * {@link #isParameterizedType()},
715
	 * and {@link #isRawType()} are mutually exclusive.
656
	 * </p>
716
	 * </p>
657
	 *
717
	 *
658
	 * @return <code>true</code> if this type binding is for a local class or
718
	 * @return <code>true</code> if this type binding represents a 
659
	 * enum type, and <code>false</code> otherwise
719
	 * an instance of a generic type corresponding to a parameterized
720
	 * type reference, and <code>false</code> otherwise
721
	 * @see #getTypeArguments()
722
	 * @see #getTypeDeclaration()
723
	 * @since 3.1
660
	 */
724
	 */
661
	public boolean isLocal();
725
	public boolean isParameterizedType();
662
	
726
	
663
	/**
727
	/**
664
	 * Returns whether this type binding represents an anonymous class.
728
	 * Returns whether this type binding represents a primitive type.
665
	 * <p>
729
	 * <p>
666
	 * An anonymous class is a subspecies of local class, and therefore mutually
730
	 * There are nine predefined type bindings to represent the eight primitive
667
	 * exclusive with member types. Note that anonymous classes have no name 
731
	 * types and <code>void</code>. These have the same names as the primitive
668
	 * (<code>getName</code> returns the empty string).
732
	 * types that they represent, namely boolean, byte, char, short, int,
733
	 * long, float, and double, and void.
669
	 * </p>
734
	 * </p>
670
	 *
735
	 * 
671
	 * @return <code>true</code> if this type binding is for an anonymous class,
736
	 * @return <code>true</code> if this type binding is for a primitive type,
672
	 *   and <code>false</code> otherwise
737
	 *   and <code>false</code> otherwise
673
	 */
738
	 */
674
	public boolean isAnonymous();
739
	public boolean isPrimitive();
740
	
741
	/**
742
	 * Returns whether this type binding represents an instance of
743
	 * a generic type corresponding to a raw type reference.
744
	 * <p>
745
	 * For example, an AST type like 
746
	 * <code>Collection</code> typically resolves to a
747
	 * type binding whose type argument is the type binding for
748
	 * the class <code>java.lang.Object</code> (the
749
	 * default bound for the single type parameter of 
750
	 * <code>java.util.Collection</code>) and whose erasure is the
751
	 * type binding for the generic type
752
	 * <code>java.util.Collection</code>.
753
	 * </p>
754
	 * <p>
755
	 * Note that {@link #isGenericType()},
756
	 * {@link #isParameterizedType()},
757
	 * and {@link #isRawType()} are mutually exclusive.
758
	 * </p>
759
	 *
760
	 * @return <code>true</code> if this type binding represents a 
761
	 * an instance of a generic type corresponding to a raw
762
	 * type reference, and <code>false</code> otherwise
763
	 * @see #getTypeDeclaration()
764
	 * @see #getTypeArguments()
765
	 * @since 3.1
766
	 */
767
	public boolean isRawType();
675
768
676
	/**
769
	/**
677
	 * Returns a list of type bindings representing all the types declared as
770
	 * Returns whether this type is subtype compatible with the given type,
678
	 * members of this class, interface, or enum type. 
771
	 * as specified in section 4.10 of <em>The Java Language 
679
	 * These include public, protected, default (package-private) access,
772
	 * Specification, Third Edition</em> (JLS3).
680
	 * and private classes, interfaces, enum types, and annotation types
681
	 * declared by the type, but excludes inherited types. Returns an empty
682
	 * list if the type declares no type members, or if this type
683
	 * binding represents an array type, a primitive type, a type variable,
684
	 * a wildcard type, or the null type.
685
	 * The resulting bindings are in no particular order.
686
	 * 
773
	 * 
687
	 * @return the list of type bindings for the member types of this type,
774
	 * @param type the type to check compatibility against
688
	 *   or the empty list if this type does not have member types
775
	 * @return <code>true</code> if this type is subtype compatible with the
776
	 * given type, and <code>false</code> otherwise
777
	 * @since 3.1
689
	 */
778
	 */
690
	public ITypeBinding[] getDeclaredTypes();
779
	public boolean isSubTypeCompatible(ITypeBinding type);
691
	
780
	
692
	/**
781
	/**
693
	 * Returns a list of bindings representing all the fields declared
782
	 * Returns whether this type binding represents a top-level class,
694
	 * as members of this class, interface, or enum type. These include public, 
783
	 * interface, enum, or annotation type.
695
	 * protected, default (package-private) access, and private fields declared
784
	 * <p>
696
	 * by the class, but excludes inherited fields. Synthetic fields may or
785
	 * A top-level type is any type whose declaration does not occur within the
697
	 * may not be included.
786
	 * body of another type declaration. The set of top level types is disjoint
698
	 * Returns an empty list if the class, interface, or enum declares no fields,
787
	 * from the set of nested types.
699
	 * and for other kinds of type bindings that do not directly have members.
788
	 * </p>
700
	 * The resulting bindings are in no particular order.
789
	 *
701
	 * 
790
	 * @return <code>true</code> if this type binding is for a top-level class,
702
	 * @return the list of bindings for the field members of this type,
791
	 *   interface, enum, or annotation type, and <code>false</code> otherwise
703
	 *   or the empty list if this type does not have field members
704
	 */
792
	 */
705
	public IVariableBinding[] getDeclaredFields();
793
	public boolean isTopLevel();
706
	
794
	
707
	/**
795
	/**
708
	 * Returns a list of method bindings representing all the methods and 
796
	 * Returns whether this type binding represents a type variable.
709
	 * constructors declared for this class, interface, enum, or annotation
797
	 * Type variables bindings carry the type variable's bounds.
710
	 * type. These include public, protected, default (package-private) access,
798
	 *
711
	 * and private methods Synthetic methods and constructors may or may not be
799
	 * @return <code>true</code> if this type binding is for a type variable,
712
	 * included. Returns an empty list if the class, interface, or enum,
800
	 *   and <code>false</code> otherwise
713
	 * type declares no methods or constructors, if the annotation type declares
801
	 * @see #getName()
714
	 * no members, or if this type binding represents some other kind of type
802
	 * @see #getTypeBounds()
715
	 * binding. The resulting bindings are in no particular order.
803
	 * @since 3.1
716
	 * 
717
	 * @return the list of method bindings for the methods and constructors
718
	 *   declared by this class, interface, enum type, or annotation type, 
719
	 *   or the empty list if this type does not declare any methods or constructors
720
	 */
804
	 */
721
	public IMethodBinding[] getDeclaredMethods();
805
	public boolean isTypeVariable();
722
	
806
	
723
	/**
807
	/**
724
	 * Returns whether this type binding originated in source code.
808
	 * Returns whether this wildcard type is an upper bound
725
	 * Returns <code>false</code> for all primitive types, the null type,
809
	 * ("extends") as opposed to a lower bound ("super").
726
	 * array types, and for all classes, interfaces, enums, annotation
810
	 * Note that this property is only relevant for wildcards
727
	 * types, type variables, parameterized type references,
811
	 * that have a bound.
728
	 * raw type references, and wildcard types, whose information came from a
812
	 *
729
	 * pre-compiled binary class file.
813
	 * @return <code>true</code> if this wildcard type has a bound that is
730
	 * 
814
	 * an upper bound, and <code>false</code> in all other cases
731
	 * @return <code>true</code> if the type is in source code,
815
	 * @see #isWildcardType()
732
	 *    and <code>false</code> otherwise
816
	 * @see #getBound()
817
	 * @since 3.1
733
	 */
818
	 */
734
	public boolean isFromSource();
819
	public boolean isUpperbound();
735
	
820
	
736
	/**
821
	/**
737
	 * Returns the fully qualified name of the type represented by this 
822
	 * Returns whether this type binding represents a wildcard type. A wildcard
738
	 * binding if it has one.
823
	 * type occus only as an argument to a parameterized type reference.
739
	 * <ul>
824
	 * <p>
740
	 * <li>For top-level types, the fully qualified name is the simple name of
825
	 * For example, a AST type like 
741
	 * the type preceded by the package name (or unqualified if in a default package)
826
	 * <code>Collection&lt;? extends Object&gt;</code> typically resolves to a
742
	 * and a ".".
827
	 * parameterized type binding whose type argument is a wildcard type
743
	 * Example: <code>"java.lang.String"</code> or <code>"java.util.Collection"</code>.
828
	 * with upper type bound <code>java.util.Object/code>.
744
	 * Note that the type parameters of a generic type are not included.</li>
829
	 * </p>
745
	 * <li>For members of top-level types, the fully qualified name is the
830
	 *
746
	 * simple name of the type preceded by the fully qualified name of the
831
	 * @return <code>true</code> if this object represents a wildcard type,
747
	 * enclosing type (as computed by this method) and a ".".
832
	 *    and <code>false</code> otherwise
748
	 * Example: <code>"java.io.ObjectInputStream.GetField"</code>.
833
	 * @since 3.1
749
	 * If the binding is for a member type that corresponds to a particular instance
834
	 * @see #getBound()
750
	 * of a generic type arising from a parameterized type reference, the simple
835
	 * @see #isUpperbound()
751
	 * name of the type is followed by the fully qualified names of the type arguments
752
	 * (as computed by this method) surrounded by "&lt;&gt;" and separated by ",".
753
	 * Example: <code>"pkg.Outer.Inner&lt;java.lang.String&gt;"</code>.
754
	 * </li>
755
	 * <li>For primitive types, the fully qualified name is the keyword for
756
	 * the primitive type.
757
	 * Example: <code>"int"</code>.</li>
758
	 * <li>For the null type, the fully qualified name is the string 
759
	 * "null".</li>
760
	 * <li>Local types (including anonymous classes) and members of local
761
	 * types do not have a fully qualified name. For these types, and array
762
	 * types thereof, this method returns an empty string.</li>
763
	 * <li>For array types whose component type has a fully qualified name, 
764
	 * the fully qualified name is the fully qualified name of the component
765
	 * type (as computed by this method) followed by "[]".
766
	 * Example: <code>"java.lang.String[]"</code>.</li>
767
	 * <li>For type variables, the fully qualified name is just the name of the
768
	 * type variable (type bounds are not included).
769
	 * Example: <code>"X"</code>.</li>
770
	 * <li>For type bindings that correspond to particular instances of a generic
771
	 * type arising from a parameterized type reference,
772
	 * the fully qualified name is the fully qualified name of the erasure
773
	 * type followed by the fully qualified names of the type arguments surrounded by "&lt;&gt;" and separated by ",".
774
	 * Example: <code>"java.util.Collection&lt;java.lang.String&gt;"</code>.
775
	 * </li>
776
	 * <li>For type bindings that correspond to particular instances of a generic
777
	 * type arising from a raw type reference,
778
	 * the fully qualified name is the fully qualified name of the erasure type.
779
	 * Example: <code>"java.util.Collection"</code>. Note that the
780
	 * the type parameters are omitted.</li>
781
	 * <li>For wildcard types, the fully qualified name is "?" optionally followed by 
782
	 * a single space followed by the keyword "extends" or "super" 
783
	 * followed a single space followed by the fully qualified name of the bound
784
	 * (as computed by this method) when present.
785
	 * Example: <code>"? extends java.io.InputStream"</code>.
786
	 * </li>
787
	 * </ul>
788
	 * 
789
	 * @return the fully qualified name of the type represented by this 
790
	 *    binding, or the empty string if it has none
791
	 * @see #getName()
792
	 * @since 2.1
793
	 */
836
	 */
794
	public String getQualifiedName();
837
	public boolean isWildcardType();
795
}
838
}

Return to bug 84496