Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 20088 Details for
Bug 84496
[1.5][compiler] Capture Conversion not correctly implemented
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Individual patch for DOM AST ITypeBinding
patch-ITypeBinding.txt (text/plain), 51.68 KB, created by
Philipe Mulet
on 2005-04-19 18:17:05 EDT
(
hide
)
Description:
Individual patch for DOM AST ITypeBinding
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2005-04-19 18:17:05 EDT
Size:
51.68 KB
patch
obsolete
>Index: ITypeBinding.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ITypeBinding.java,v >retrieving revision 1.44 >diff -u -r1.44 ITypeBinding.java >--- ITypeBinding.java 24 Mar 2005 21:01:15 -0000 1.44 >+++ ITypeBinding.java 19 Apr 2005 22:12:34 -0000 >@@ -63,233 +63,141 @@ > public String getBinaryName(); > > /** >- * Returns whether this type binding represents a primitive type. >- * <p> >- * There are nine predefined type bindings to represent the eight primitive >- * types and <code>void</code>. These have the same names as the primitive >- * types that they represent, namely boolean, byte, char, short, int, >- * long, float, and double, and void. >- * </p> >+ * Returns the bound of this wildcard type if it has one. >+ * Returns <code>null</code> if this is not a wildcard type. > * >- * @return <code>true</code> if this type binding is for a primitive type, >- * and <code>false</code> otherwise >+ * @return the bound of this wildcard type, or <code>null</code> if none >+ * @see #isWildcardType() >+ * @see #isUpperbound() >+ * @since 3.1 > */ >- public boolean isPrimitive(); >+ public ITypeBinding getBound(); > > /** >- * Returns whether this type binding represents the null type. >- * <p> >- * The null type is the type of a <code>NullLiteral</code> node. >- * </p> >+ * Returns a list of bindings representing all the fields declared >+ * as members of this class, interface, or enum type. These include public, >+ * protected, default (package-private) access, and private fields declared >+ * by the class, but excludes inherited fields. Synthetic fields may or >+ * may not be included. >+ * Returns an empty list if the class, interface, or enum declares no fields, >+ * and for other kinds of type bindings that do not directly have members. >+ * The resulting bindings are in no particular order. > * >- * @return <code>true</code> if this type binding is for the null type, >- * and <code>false</code> otherwise >- */ >- public boolean isNullType(); >- >- /** >- * Returns whether this type binding represents an array type. >- * >- * @return <code>true</code> if this type binding is for an array type, >- * and <code>false</code> otherwise >- * @see #getElementType() >- * @see #getDimensions() >+ * @return the list of bindings for the field members of this type, >+ * or the empty list if this type does not have field members > */ >- public boolean isArray(); >+ public IVariableBinding[] getDeclaredFields(); > > /** >- * Returns the binding representing the element type of this array type, >- * or <code>null</code> if this is not an array type binding. The element >- * type of an array is never itself an array type. >- * >- * @return the element type binding, or <code>null</code> if this is >- * not an array type >+ * Returns a list of method bindings representing all the methods and >+ * constructors declared for this class, interface, enum, or annotation >+ * type. These include public, protected, default (package-private) access, >+ * and private methods Synthetic methods and constructors may or may not be >+ * included. Returns an empty list if the class, interface, or enum, >+ * type declares no methods or constructors, if the annotation type declares >+ * no members, or if this type binding represents some other kind of type >+ * binding. The resulting bindings are in no particular order. >+ * >+ * @return the list of method bindings for the methods and constructors >+ * declared by this class, interface, enum type, or annotation type, >+ * or the empty list if this type does not declare any methods or constructors > */ >- public ITypeBinding getElementType(); >+ public IMethodBinding[] getDeclaredMethods(); > > /** >- * Returns the dimensionality of this array type, or <code>0</code> if this >- * is not an array type binding. >+ * Returns the declared modifiers for this class or interface binding >+ * as specified in the original source declaration of the class or >+ * interface. The result may not correspond to the modifiers in the compiled >+ * binary, since the compiler may change them (in particular, for inner >+ * class emulation). The <code>getModifiers</code> method should be used if >+ * the compiled modifiers are needed. Returns -1 if this type does not >+ * represent a class or interface. > * >- * @return the number of dimension of this array type binding, or >- * <code>0</code> if this is not an array type >- */ >- public int getDimensions(); >- >- /** >- * Returns whether this type is assigment compatible with the given type, >- * as specified in section 5.2 of <em>The Java Language >- * Specification, Second Edition</em> (JLS2). >- * >- * @param type the type to check compatibility against >- * @return <code>true</code> if this type is assigment compatible with the >- * given type, and <code>false</code> otherwise >- * @since 3.1 >+ * @return the bit-wise or of <code>Modifier</code> constants >+ * @see #getModifiers() >+ * @see Modifier > */ >- public boolean isAssignmentCompatible(ITypeBinding type); >+ public int getDeclaredModifiers(); > > /** >- * Returns whether this type is cast compatible with the given type, >- * as specified in section 5.5 of <em>The Java Language >- * Specification, Second Edition</em> (JLS2). >+ * Returns a list of type bindings representing all the types declared as >+ * members of this class, interface, or enum type. >+ * These include public, protected, default (package-private) access, >+ * and private classes, interfaces, enum types, and annotation types >+ * declared by the type, but excludes inherited types. Returns an empty >+ * list if the type declares no type members, or if this type >+ * binding represents an array type, a primitive type, a type variable, >+ * a wildcard type, or the null type. >+ * The resulting bindings are in no particular order. > * >- * @param type the type to check compatibility against >- * @return <code>true</code> if this type is cast compatible with the >- * given type, and <code>false</code> otherwise >- * @since 3.1 >- */ >- public boolean isCastCompatible(ITypeBinding type); >- >- /** >- * Returns whether this type binding represents a class type. >- * >- * @return <code>true</code> if this object represents a class, >- * and <code>false</code> otherwise >+ * @return the list of type bindings for the member types of this type, >+ * or the empty list if this type does not have member types > */ >- public boolean isClass(); >+ public ITypeBinding[] getDeclaredTypes(); > > /** >- * Returns whether this type binding represents an interface type. >+ * Returns the type binding representing the class, interface, or enum >+ * that declares this binding. > * <p> >- * Note that an interface can also be an annotation type. >+ * The declaring class of a member class, interface, enum, annotation >+ * type is the class, interface, or enum type of which it is a member. >+ * The declaring class of a local class or interface (including anonymous >+ * classes) is the innermost class or interface containing the expression >+ * or statement in which this type is declared. > * </p> >- * >- * @return <code>true</code> if this object represents an interface, >- * and <code>false</code> otherwise >- */ >- public boolean isInterface(); >- >- /** >- * Returns whether this type binding represents an enum type. >- * >- * @return <code>true</code> if this object represents an enum type, >- * and <code>false</code> otherwise >- * @since 3.1 >- */ >- public boolean isEnum(); >- >- /** >- * Returns whether this type binding represents an annotation type. >- * <p> >- * Note that an annotation type is always an interface. >+ * <p>The declaring class of a type variable is the class in which the type variable >+ * is declared if it is declared on a type. It returns <code>null</code> otherwise. > * </p> >- * >- * @return <code>true</code> if this object represents an annotation type, >- * and <code>false</code> otherwise >- * @since 3.1 >- */ >- public boolean isAnnotation(); >- >- /** >- * Returns the type parameters of this class or interface type binding. >- * <p> >- * Note that type parameters only occur on the binding of the >- * declaring generic class or interface; e.g., <code>Collection<T></code>. >- * Type bindings corresponding to a raw or parameterized reference to a generic >- * type do not carry type parameters (they instead have non-empty type arguments >- * and non-trivial erasure). >- * </p> >- * >- * @return the list of binding for the type variables for the type >- * parameters of this type, or otherwise the empty list >- * @see #isTypeVariable() >- * @since 3.1 >+ * <p>Array types, primitive types, the null type, top-level types, >+ * and wildcard types have no declaring class. >+ * </p> >+ * >+ * @return the binding of the type that declares this type, or >+ * <code>null</code> if none > */ >- // 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 >- public ITypeBinding[] getTypeParameters(); >+ public ITypeBinding getDeclaringClass(); > > /** >- * Returns whether this type binding represents a declaration of >- * a generic class or interface. >+ * Returns the method binding representing the method that declares this binding >+ * of a local type or type variable. > * <p> >- * Note that type parameters only occur on the binding of the >- * declaring generic class or interface; e.g., <code>Collection<T></code>. >- * Type bindings corresponding to a raw or parameterized reference to a generic >- * type do not carry type parameters (they instead have non-empty type arguments >- * and non-trivial erasure). >- * This method is fully equivalent to <code>getTypeParameters().length > 0)</code>. >+ * The declaring method of a local class or interface (including anonymous >+ * classes) is the innermost method containing the expression or statement in >+ * which this type is declared. Returns <code>null</code> if the type >+ * is declared in an initializer. > * </p> > * <p> >- * Note that {@link #isGenericType()}, >- * {@link #isParameterizedType()}, >- * and {@link #isRawType()} are mutually exclusive. >+ * The declaring method of a type variable is the method in which the type >+ * variable is declared if it is declared on a method. It >+ * returns <code>null</code> otherwise. >+ * </p> >+ * <p>Array types, primitive types, the null type, top-level types, >+ * and wildcard types have no declaring method. > * </p> >- * >- * @return <code>true</code> if this type binding represents a >- * declaration of a generic class or interface, and <code>false</code> otherwise >- * @see #getTypeParameters() >- * @since 3.1 >- */ >- public boolean isGenericType(); >- >- /** >- * Returns whether this type binding represents a type variable. >- * Type variables bindings carry the type variable's bounds. > * >- * @return <code>true</code> if this type binding is for a type variable, >- * and <code>false</code> otherwise >- * @see #getName() >- * @see #getTypeBounds() >- * @since 3.1 >- */ >- public boolean isTypeVariable(); >- >- /** >- * Returns the type bounds of this type variable. >- * >- * @return the list of type bindings for this type variable, or otherwise >- * the empty list >- * @see #isTypeVariable() >- * @since 3.1 >+ * @return the binding of the method that declares this type, or >+ * <code>null</code> if none > */ >- public ITypeBinding[] getTypeBounds(); >- >+ public IMethodBinding getDeclaringMethod(); >+ > /** >- * Returns whether this type binding represents an instance of >- * a generic type corresponding to a parameterized type reference. >- * <p> >- * For example, an AST type like >- * <code>Collection<String></code> typically resolves to a >- * type binding whose type argument is the type binding for the >- * class <code>java.lang.String</code> and whose erasure is the type >- * binding for the generic type <code>java.util.Collection</code>. >- * </p> >- * Note that {@link #isGenericType()}, >- * {@link #isParameterizedType()}, >- * and {@link #isRawType()} are mutually exclusive. >- * </p> >+ * Returns the dimensionality of this array type, or <code>0</code> if this >+ * is not an array type binding. > * >- * @return <code>true</code> if this type binding represents a >- * an instance of a generic type corresponding to a parameterized >- * type reference, and <code>false</code> otherwise >- * @see #getTypeArguments() >- * @see #getTypeDeclaration() >- * @since 3.1 >+ * @return the number of dimension of this array type binding, or >+ * <code>0</code> if this is not an array type > */ >- public boolean isParameterizedType(); >- >+ public int getDimensions(); >+ > /** >- * Returns the type arguments of this generic type instance, or the >- * empty list for other type bindings. >- * <p> >- * Note that type arguments only occur on a type binding that represents >- * an instance of a generic type corresponding to a parameterized type >- * reference (e.g., <code>Collection<String></code>) or to a raw >- * type reference (e.g., <code>Collection</code>) to a generic type. >- * Do not confuse these with type parameters which only occur on the >- * type binding corresponding directly to the declaration of the >- * generic class or interface (e.g., <code>Collection<T></code>). >- * </p> >+ * Returns the binding representing the element type of this array type, >+ * or <code>null</code> if this is not an array type binding. The element >+ * type of an array is never itself an array type. > * >- * @return the list of type bindings for the type arguments used to >- * instantiate the corrresponding generic type, or otherwise the empty list >- * @see #getTypeDeclaration() >- * @see #isGenericType() >- * @see #isParameterizedType() >- * @see #isRawType() >- * @since 3.1 >+ * @return the element type binding, or <code>null</code> if this is >+ * not an array type > */ >- public ITypeBinding[] getTypeArguments(); >+ public ITypeBinding getElementType(); > > /** > * Returns the erasure of this type binding. >@@ -300,11 +208,13 @@ > * - returns the binding for the corresponding generic type.</li> > * <li>For wildcard types ({@link #isWildcardType()}) > * - returns the binding for the upper bound if it has one and >- * java.lang.Object in other cases. >- * </li> >+ * java.lang.Object in other cases.</li> > * <li>For type variables ({@link #isTypeVariable()}) > * - returns the binding for the erasure of the leftmost bound > * if it has bounds and java.lang.Object if it does not.</li> >+ * <li>For captures ({@link #isCapture()}) >+ * - returns the binding for the erasure of the leftmost bound >+ * if it has bounds and java.lang.Object if it does not.</li> > * <li>For all other type bindings - returns the identical binding.</li> > * </ul> > * >@@ -314,87 +224,52 @@ > public ITypeBinding getErasure(); > > /** >- * Returns the binding for the type declaration corresponding to this type >- * binding. For parameterized types ({@link #isParameterizedType()}) >- * and raw types ({@link #isRawType()}), this method returns the binding >- * for the corresponding generic type. For other type bindings, this >- * returns the same binding. >- * >- * @return the type binding >- * @since 3.1 >- */ >- public ITypeBinding getTypeDeclaration(); >- >- /** >- * Returns whether this type binding represents an instance of >- * a generic type corresponding to a raw type reference. >+ * Returns a list of type bindings representing the direct superinterfaces >+ * of the class, interface, or enum type represented by this type binding. > * <p> >- * For example, an AST type like >- * <code>Collection</code> typically resolves to a >- * type binding whose type argument is the type binding for >- * the class <code>java.lang.Object</code> (the >- * default bound for the single type parameter of >- * <code>java.util.Collection</code>) and whose erasure is the >- * type binding for the generic type >- * <code>java.util.Collection</code>. >+ * If this type binding represents a class or enum type, the return value >+ * is an array containing type bindings representing all interfaces >+ * directly implemented by this class. The number and order of the interface >+ * objects in the array corresponds to the number and order of the interface >+ * names in the <code>implements</code> clause of the original declaration >+ * of this type. > * </p> > * <p> >- * Note that {@link #isGenericType()}, >- * {@link #isParameterizedType()}, >- * and {@link #isRawType()} are mutually exclusive. >+ * If this type binding represents an interface, the array contains >+ * type bindings representing all interfaces directly extended by this >+ * interface. The number and order of the interface objects in the array >+ * corresponds to the number and order of the interface names in the >+ * <code>extends</code> clause of the original declaration of this interface. > * </p> >- * >- * @return <code>true</code> if this type binding represents a >- * an instance of a generic type corresponding to a raw >- * type reference, and <code>false</code> otherwise >- * @see #getTypeDeclaration() >- * @see #getTypeArguments() >- * @since 3.1 >- */ >- public boolean isRawType(); >- >- /** >- * Returns whether this type binding represents a wildcard type. A wildcard >- * type occus only as an argument to a parameterized type reference. > * <p> >- * For example, a AST type like >- * <code>Collection<? extends Object></code> typically resolves to a >- * parameterized type binding whose type argument is a wildcard type >- * with upper type bound <code>java.util.Object/code>. >+ * If the class or enum implements no interfaces, or the interface extends >+ * no interfaces, or if this type binding represents an array type, a >+ * primitive type, the null type, a type variable, an annotation type, >+ * or a wildcard type, this method returns an array of length 0. > * </p> > * >- * @return <code>true</code> if this object represents a wildcard type, >- * and <code>false</code> otherwise >- * @since 3.1 >- * @see #getBound() >- * @see #isUpperbound() >+ * @return the list of type bindings for the interfaces extended by this >+ * class or enum, or interfaces extended by this interface, or otherwise >+ * the empty list > */ >- public boolean isWildcardType(); >+ public ITypeBinding[] getInterfaces(); > > /** >- * Returns the bound of this wildcard type if it has one. >- * Returns <code>null</code> if this is not a wildcard type. >+ * Returns the compiled modifiers for this class, interface, enum, >+ * or annotation type binding. >+ * The result may not correspond to the modifiers as declared in the >+ * original source, since the compiler may change them (in particular, >+ * for inner class emulation). The <code>getDeclaredModifiers</code> method >+ * should be used if the original modifiers are needed. >+ * Returns 0 if this type does not represent a class, interface, enum, or annotation >+ * type. > * >- * @return the bound of this wildcard type, or <code>null</code> if none >- * @see #isWildcardType() >- * @see #isUpperbound() >- * @since 3.1 >- */ >- public ITypeBinding getBound(); >- >- /** >- * Returns whether this wildcard type is an upper bound >- * ("extends") as opposed to a lower bound ("super"). >- * Note that this property is only relevant for wildcards >- * that have a bound. >- * >- * @return <code>true</code> if this wildcard type has a bound that is >- * an upper bound, and <code>false</code> in all other cases >- * @see #isWildcardType() >- * @see #getBound() >- * @since 3.1 >+ * @return the compiled modifiers for this type binding or 0 >+ * if this type does not represent a class, interface, enum, or annotation >+ * type >+ * @see #getDeclaredModifiers() > */ >- public boolean isUpperbound(); >+ public int getModifiers(); > > /** > * Returns the unqualified name of the type represented by this binding >@@ -433,6 +308,10 @@ > * this method) when present. > * Example: <code>"? extends InputStream"</code>. > * </li> >+ * <li>For capture types, the name is "capture-of" followed by a single space >+ * followed by the name {@link #getName()} of the corresponding wildcard. >+ * Example: <code>"capture-of ? extends InputStream"</code>. >+ * </li> > * </ul> > * > * @return the unqualified name of the type represented by this binding, >@@ -440,7 +319,7 @@ > * @see #getQualifiedName() > */ > public String getName(); >- >+ > /** > * Returns the binding for the package in which this type is declared. > * >@@ -452,50 +331,65 @@ > public IPackageBinding getPackage(); > > /** >- * Returns the type binding representing the class, interface, or enum >- * that declares this binding. >- * <p> >- * The declaring class of a member class, interface, enum, annotation >- * type is the class, interface, or enum type of which it is a member. >- * The declaring class of a local class or interface (including anonymous >- * classes) is the innermost class or interface containing the expression >- * or statement in which this type is declared. >- * </p> >- * <p>The declaring class of a type variable is the class in which the type variable >- * is declared if it is declared on a type. It returns <code>null</code> otherwise. >- * </p> >- * <p>Array types, primitive types, the null type, top-level types, >- * and wildcard types have no declaring class. >- * </p> >- * >- * @return the binding of the type that declares this type, or >- * <code>null</code> if none >- */ >- public ITypeBinding getDeclaringClass(); >- >- /** >- * Returns the method binding representing the method that declares this binding >- * of a local type or type variable. >- * <p> >- * The declaring method of a local class or interface (including anonymous >- * classes) is the innermost method containing the expression or statement in >- * which this type is declared. Returns <code>null</code> if the type >- * is declared in an initializer. >- * </p> >- * <p> >- * The declaring method of a type variable is the method in which the type >- * variable is declared if it is declared on a method. It >- * returns <code>null</code> otherwise. >- * </p> >- * <p>Array types, primitive types, the null type, top-level types, >- * and wildcard types have no declaring method. >- * </p> >+ * Returns the fully qualified name of the type represented by this >+ * binding if it has one. >+ * <ul> >+ * <li>For top-level types, the fully qualified name is the simple name of >+ * the type preceded by the package name (or unqualified if in a default package) >+ * and a ".". >+ * Example: <code>"java.lang.String"</code> or <code>"java.util.Collection"</code>. >+ * Note that the type parameters of a generic type are not included.</li> >+ * <li>For members of top-level types, the fully qualified name is the >+ * simple name of the type preceded by the fully qualified name of the >+ * enclosing type (as computed by this method) and a ".". >+ * Example: <code>"java.io.ObjectInputStream.GetField"</code>. >+ * If the binding is for a member type that corresponds to a particular instance >+ * of a generic type arising from a parameterized type reference, the simple >+ * name of the type is followed by the fully qualified names of the type arguments >+ * (as computed by this method) surrounded by "<>" and separated by ",". >+ * Example: <code>"pkg.Outer.Inner<java.lang.String>"</code>. >+ * </li> >+ * <li>For primitive types, the fully qualified name is the keyword for >+ * the primitive type. >+ * Example: <code>"int"</code>.</li> >+ * <li>For the null type, the fully qualified name is the string >+ * "null".</li> >+ * <li>Local types (including anonymous classes) and members of local >+ * types do not have a fully qualified name. For these types, and array >+ * types thereof, this method returns an empty string.</li> >+ * <li>For array types whose component type has a fully qualified name, >+ * the fully qualified name is the fully qualified name of the component >+ * type (as computed by this method) followed by "[]". >+ * Example: <code>"java.lang.String[]"</code>.</li> >+ * <li>For type variables, the fully qualified name is just the name of the >+ * type variable (type bounds are not included). >+ * Example: <code>"X"</code>.</li> >+ * <li>For type bindings that correspond to particular instances of a generic >+ * type arising from a parameterized type reference, >+ * the fully qualified name is the fully qualified name of the erasure >+ * type followed by the fully qualified names of the type arguments surrounded by "<>" and separated by ",". >+ * Example: <code>"java.util.Collection<java.lang.String>"</code>. >+ * </li> >+ * <li>For type bindings that correspond to particular instances of a generic >+ * type arising from a raw type reference, >+ * the fully qualified name is the fully qualified name of the erasure type. >+ * Example: <code>"java.util.Collection"</code>. Note that the >+ * the type parameters are omitted.</li> >+ * <li>For wildcard types, the fully qualified name is "?" optionally followed by >+ * a single space followed by the keyword "extends" or "super" >+ * followed a single space followed by the fully qualified name of the bound >+ * (as computed by this method) when present. >+ * Example: <code>"? extends java.io.InputStream"</code>. >+ * </li> >+ * </ul> > * >- * @return the binding of the method that declares this type, or >- * <code>null</code> if none >+ * @return the fully qualified name of the type represented by this >+ * binding, or the empty string if it has none >+ * @see #getName() >+ * @since 2.1 > */ >- public IMethodBinding getDeclaringMethod(); >- >+ public String getQualifiedName(); >+ > /** > * Returns the type binding for the superclass of the type represented > * by this class binding. >@@ -526,94 +420,260 @@ > public ITypeBinding getSuperclass(); > > /** >- * Returns a list of type bindings representing the direct superinterfaces >- * of the class, interface, or enum type represented by this type binding. >+ * Returns the type arguments of this generic type instance, or the >+ * empty list for other type bindings. > * <p> >- * If this type binding represents a class or enum type, the return value >- * is an array containing type bindings representing all interfaces >- * directly implemented by this class. The number and order of the interface >- * objects in the array corresponds to the number and order of the interface >- * names in the <code>implements</code> clause of the original declaration >- * of this type. >- * </p> >+ * Note that type arguments only occur on a type binding that represents >+ * an instance of a generic type corresponding to a parameterized type >+ * reference (e.g., <code>Collection<String></code>) or to a raw >+ * type reference (e.g., <code>Collection</code>) to a generic type. >+ * Do not confuse these with type parameters which only occur on the >+ * type binding corresponding directly to the declaration of the >+ * generic class or interface (e.g., <code>Collection<T></code>). >+ * </p> >+ * >+ * @return the list of type bindings for the type arguments used to >+ * instantiate the corrresponding generic type, or otherwise the empty list >+ * @see #getTypeDeclaration() >+ * @see #isGenericType() >+ * @see #isParameterizedType() >+ * @see #isRawType() >+ * @since 3.1 >+ */ >+ public ITypeBinding[] getTypeArguments(); >+ >+ /** >+ * Returns the type bounds of this type variable or capture. >+ * >+ * @return the list of type bindings for this type variable or capture, or otherwise >+ * the empty list >+ * @see #isCapture() >+ * @see #isTypeVariable() >+ * @since 3.1 >+ */ >+ public ITypeBinding[] getTypeBounds(); >+ >+ /** >+ * Returns the binding for the type declaration corresponding to this type >+ * binding. For parameterized types ({@link #isParameterizedType()}) >+ * and raw types ({@link #isRawType()}), this method returns the binding >+ * for the corresponding generic type. For other type bindings, this >+ * returns the same binding. >+ * >+ * @return the type binding >+ * @since 3.1 >+ */ >+ public ITypeBinding getTypeDeclaration(); >+ >+ /** >+ * Returns the type parameters of this class or interface type binding. > * <p> >- * If this type binding represents an interface, the array contains >- * type bindings representing all interfaces directly extended by this >- * interface. The number and order of the interface objects in the array >- * corresponds to the number and order of the interface names in the >- * <code>extends</code> clause of the original declaration of this interface. >- * </p> >+ * Note that type parameters only occur on the binding of the >+ * declaring generic class or interface; e.g., <code>Collection<T></code>. >+ * Type bindings corresponding to a raw or parameterized reference to a generic >+ * type do not carry type parameters (they instead have non-empty type arguments >+ * and non-trivial erasure). >+ * </p> >+ * >+ * @return the list of binding for the type variables for the type >+ * parameters of this type, or otherwise the empty list >+ * @see #isTypeVariable() >+ * @since 3.1 >+ */ >+ // 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 >+ public ITypeBinding[] getTypeParameters(); >+ >+ /** >+ * Return the corresponding wildcard binding if this type binding represents a capture >+ * binding, <code>null</code> otherwise. >+ * >+ * @return the corresponding wildcard binding if this type binding represents a capture >+ * binding, <code>null</code> otherwise >+ * @since 3.1 >+ */ >+ public ITypeBinding getWildcard(); >+ >+ /** >+ * Returns whether this type binding represents an annotation type. > * <p> >- * If the class or enum implements no interfaces, or the interface extends >- * no interfaces, or if this type binding represents an array type, a >- * primitive type, the null type, a type variable, an annotation type, >- * or a wildcard type, this method returns an array of length 0. >+ * Note that an annotation type is always an interface. > * </p> > * >- * @return the list of type bindings for the interfaces extended by this >- * class or enum, or interfaces extended by this interface, or otherwise >- * the empty list >+ * @return <code>true</code> if this object represents an annotation type, >+ * and <code>false</code> otherwise >+ * @since 3.1 > */ >- public ITypeBinding[] getInterfaces(); >- >+ public boolean isAnnotation(); >+ > /** >- * Returns the compiled modifiers for this class, interface, enum, >- * or annotation type binding. >- * The result may not correspond to the modifiers as declared in the >- * original source, since the compiler may change them (in particular, >- * for inner class emulation). The <code>getDeclaredModifiers</code> method >- * should be used if the original modifiers are needed. >- * Returns 0 if this type does not represent a class, interface, enum, or annotation >- * type. >- * >- * @return the compiled modifiers for this type binding or 0 >- * if this type does not represent a class, interface, enum, or annotation >- * type >- * @see #getDeclaredModifiers() >+ * Returns whether this type binding represents an anonymous class. >+ * <p> >+ * An anonymous class is a subspecies of local class, and therefore mutually >+ * exclusive with member types. Note that anonymous classes have no name >+ * (<code>getName</code> returns the empty string). >+ * </p> >+ * >+ * @return <code>true</code> if this type binding is for an anonymous class, >+ * and <code>false</code> otherwise > */ >- public int getModifiers(); >+ public boolean isAnonymous(); > > /** >- * Returns the declared modifiers for this class or interface binding >- * as specified in the original source declaration of the class or >- * interface. The result may not correspond to the modifiers in the compiled >- * binary, since the compiler may change them (in particular, for inner >- * class emulation). The <code>getModifiers</code> method should be used if >- * the compiled modifiers are needed. Returns -1 if this type does not >- * represent a class or interface. >+ * Returns whether this type binding represents an array type. > * >- * @return the bit-wise or of <code>Modifier</code> constants >- * @see #getModifiers() >- * @see Modifier >+ * @return <code>true</code> if this type binding is for an array type, >+ * and <code>false</code> otherwise >+ * @see #getElementType() >+ * @see #getDimensions() > */ >- public int getDeclaredModifiers(); >+ public boolean isArray(); > > /** >- * Returns whether this type is subtype compatible with the given type, >- * as specified in section 4.10 of <em>The Java Language >- * Specification, Third Edition</em> (JLS3). >+ * Returns whether this type is assigment compatible with the given type, >+ * as specified in section 5.2 of <em>The Java Language >+ * Specification, Second Edition</em> (JLS2). > * > * @param type the type to check compatibility against >- * @return <code>true</code> if this type is subtype compatible with the >+ * @return <code>true</code> if this type is assigment compatible with the > * given type, and <code>false</code> otherwise > * @since 3.1 > */ >- public boolean isSubTypeCompatible(ITypeBinding type); >+ public boolean isAssignmentCompatible(ITypeBinding type); > > /** >- * Returns whether this type binding represents a top-level class, >- * interface, enum, or annotation type. >+ * Returns whether this type binding represents a capture binding. > * <p> >- * A top-level type is any type whose declaration does not occur within the >- * body of another type declaration. The set of top level types is disjoint >- * from the set of nested types. >+ * Capture bindings result from capture conversion as specified >+ * in section 5.1.10 of <em>The Java Language Specification, >+ * Third Edition</em> (JLS3). >+ *</p> >+ *<p> >+ * A capture binding may have upper bounds and a lower bound. >+ * Upper bounds may be accessed using {@link #getTypeBounds()}, >+ * the lower bound must be accessed indirectly through the associated >+ * wildcard {@link #getWildcard()} when it is a lower bound wildcard. >+ *</p> >+ *<p> >+ * Note that capture are different from regular type variable (even >+ * though they are often depicted as synthetic type variables), and >+ * as such {@link #isTypeVariable()} will answer <code>false</code>. >+ *</p> >+ * @return <code>true</code> if this type binding is a capture, >+ * and <code>false</code> otherwise >+ * @see #getTypeBounds() >+ * @see #getWildcard() >+ * @since 3.1 >+ */ >+ public boolean isCapture(); >+ >+ /** >+ * Returns whether this type is cast compatible with the given type, >+ * as specified in section 5.5 of <em>The Java Language >+ * Specification, Second Edition</em> (JLS2). >+ * >+ * @param type the type to check compatibility against >+ * @return <code>true</code> if this type is cast compatible with the >+ * given type, and <code>false</code> otherwise >+ * @since 3.1 >+ */ >+ public boolean isCastCompatible(ITypeBinding type); >+ >+ /** >+ * Returns whether this type binding represents a class type. >+ * >+ * @return <code>true</code> if this object represents a class, >+ * and <code>false</code> otherwise >+ */ >+ public boolean isClass(); >+ >+ /** >+ * Returns whether this type binding represents an enum type. >+ * >+ * @return <code>true</code> if this object represents an enum type, >+ * and <code>false</code> otherwise >+ * @since 3.1 >+ */ >+ public boolean isEnum(); >+ >+ /** >+ * Returns whether this type binding originated in source code. >+ * Returns <code>false</code> for all primitive types, the null type, >+ * array types, and for all classes, interfaces, enums, annotation >+ * types, type variables, parameterized type references, >+ * raw type references, and wildcard types, whose information came from a >+ * pre-compiled binary class file. >+ * >+ * @return <code>true</code> if the type is in source code, >+ * and <code>false</code> otherwise >+ */ >+ public boolean isFromSource(); >+ >+ /** >+ * Returns whether this type binding represents a declaration of >+ * a generic class or interface. >+ * <p> >+ * Note that type parameters only occur on the binding of the >+ * declaring generic class or interface; e.g., <code>Collection<T></code>. >+ * Type bindings corresponding to a raw or parameterized reference to a generic >+ * type do not carry type parameters (they instead have non-empty type arguments >+ * and non-trivial erasure). >+ * This method is fully equivalent to <code>getTypeParameters().length > 0)</code>. >+ * </p> >+ * <p> >+ * Note that {@link #isGenericType()}, >+ * {@link #isParameterizedType()}, >+ * and {@link #isRawType()} are mutually exclusive. >+ * </p> >+ * >+ * @return <code>true</code> if this type binding represents a >+ * declaration of a generic class or interface, and <code>false</code> otherwise >+ * @see #getTypeParameters() >+ * @since 3.1 >+ */ >+ public boolean isGenericType(); >+ >+ /** >+ * Returns whether this type binding represents an interface type. >+ * <p> >+ * Note that an interface can also be an annotation type. >+ * </p> >+ * >+ * @return <code>true</code> if this object represents an interface, >+ * and <code>false</code> otherwise >+ */ >+ public boolean isInterface(); >+ >+ /** >+ * Returns whether this type binding represents a local class. >+ * <p> >+ * A local class is any nested class or enum type not declared as a member >+ * of another class or interface. A local class is a subspecies of nested >+ * type, and mutually exclusive with member types. Note that anonymous >+ * classes are a subspecies of local classes. >+ * </p> >+ * <p> >+ * Also note that interfaces and annotation types cannot be local. >+ * </p> >+ * >+ * @return <code>true</code> if this type binding is for a local class or >+ * enum type, and <code>false</code> otherwise >+ */ >+ public boolean isLocal(); >+ >+ /** >+ * Returns whether this type binding represents a member class or >+ * interface. >+ * <p> >+ * A member type is any type declared as a member of >+ * another type. A member type is a subspecies of nested >+ * type, and mutually exclusive with local types. > * </p> > * >- * @return <code>true</code> if this type binding is for a top-level class, >+ * @return <code>true</code> if this type binding is for a member class, > * interface, enum, or annotation type, and <code>false</code> otherwise > */ >- public boolean isTopLevel(); >- >+ public boolean isMember(); >+ > /** > * Returns whether this type binding represents a nested class, interface, > * enum, or annotation type. >@@ -630,166 +690,149 @@ > public boolean isNested(); > > /** >- * Returns whether this type binding represents a member class or >- * interface. >+ * Returns whether this type binding represents the null type. > * <p> >- * A member type is any type declared as a member of >- * another type. A member type is a subspecies of nested >- * type, and mutually exclusive with local types. >+ * The null type is the type of a <code>NullLiteral</code> node. > * </p> >- * >- * @return <code>true</code> if this type binding is for a member class, >- * interface, enum, or annotation type, and <code>false</code> otherwise >+ * >+ * @return <code>true</code> if this type binding is for the null type, >+ * and <code>false</code> otherwise > */ >- public boolean isMember(); >- >+ public boolean isNullType(); >+ > /** >- * Returns whether this type binding represents a local class. >+ * Returns whether this type binding represents an instance of >+ * a generic type corresponding to a parameterized type reference. > * <p> >- * A local class is any nested class or enum type not declared as a member >- * of another class or interface. A local class is a subspecies of nested >- * type, and mutually exclusive with member types. Note that anonymous >- * classes are a subspecies of local classes. >+ * For example, an AST type like >+ * <code>Collection<String></code> typically resolves to a >+ * type binding whose type argument is the type binding for the >+ * class <code>java.lang.String</code> and whose erasure is the type >+ * binding for the generic type <code>java.util.Collection</code>. > * </p> >- * <p> >- * Also note that interfaces and annotation types cannot be local. >+ * Note that {@link #isGenericType()}, >+ * {@link #isParameterizedType()}, >+ * and {@link #isRawType()} are mutually exclusive. > * </p> > * >- * @return <code>true</code> if this type binding is for a local class or >- * enum type, and <code>false</code> otherwise >+ * @return <code>true</code> if this type binding represents a >+ * an instance of a generic type corresponding to a parameterized >+ * type reference, and <code>false</code> otherwise >+ * @see #getTypeArguments() >+ * @see #getTypeDeclaration() >+ * @since 3.1 > */ >- public boolean isLocal(); >+ public boolean isParameterizedType(); > > /** >- * Returns whether this type binding represents an anonymous class. >+ * Returns whether this type binding represents a primitive type. > * <p> >- * An anonymous class is a subspecies of local class, and therefore mutually >- * exclusive with member types. Note that anonymous classes have no name >- * (<code>getName</code> returns the empty string). >+ * There are nine predefined type bindings to represent the eight primitive >+ * types and <code>void</code>. These have the same names as the primitive >+ * types that they represent, namely boolean, byte, char, short, int, >+ * long, float, and double, and void. > * </p> >- * >- * @return <code>true</code> if this type binding is for an anonymous class, >+ * >+ * @return <code>true</code> if this type binding is for a primitive type, > * and <code>false</code> otherwise > */ >- public boolean isAnonymous(); >+ public boolean isPrimitive(); >+ >+ /** >+ * Returns whether this type binding represents an instance of >+ * a generic type corresponding to a raw type reference. >+ * <p> >+ * For example, an AST type like >+ * <code>Collection</code> typically resolves to a >+ * type binding whose type argument is the type binding for >+ * the class <code>java.lang.Object</code> (the >+ * default bound for the single type parameter of >+ * <code>java.util.Collection</code>) and whose erasure is the >+ * type binding for the generic type >+ * <code>java.util.Collection</code>. >+ * </p> >+ * <p> >+ * Note that {@link #isGenericType()}, >+ * {@link #isParameterizedType()}, >+ * and {@link #isRawType()} are mutually exclusive. >+ * </p> >+ * >+ * @return <code>true</code> if this type binding represents a >+ * an instance of a generic type corresponding to a raw >+ * type reference, and <code>false</code> otherwise >+ * @see #getTypeDeclaration() >+ * @see #getTypeArguments() >+ * @since 3.1 >+ */ >+ public boolean isRawType(); > > /** >- * Returns a list of type bindings representing all the types declared as >- * members of this class, interface, or enum type. >- * These include public, protected, default (package-private) access, >- * and private classes, interfaces, enum types, and annotation types >- * declared by the type, but excludes inherited types. Returns an empty >- * list if the type declares no type members, or if this type >- * binding represents an array type, a primitive type, a type variable, >- * a wildcard type, or the null type. >- * The resulting bindings are in no particular order. >+ * Returns whether this type is subtype compatible with the given type, >+ * as specified in section 4.10 of <em>The Java Language >+ * Specification, Third Edition</em> (JLS3). > * >- * @return the list of type bindings for the member types of this type, >- * or the empty list if this type does not have member types >+ * @param type the type to check compatibility against >+ * @return <code>true</code> if this type is subtype compatible with the >+ * given type, and <code>false</code> otherwise >+ * @since 3.1 > */ >- public ITypeBinding[] getDeclaredTypes(); >+ public boolean isSubTypeCompatible(ITypeBinding type); > > /** >- * Returns a list of bindings representing all the fields declared >- * as members of this class, interface, or enum type. These include public, >- * protected, default (package-private) access, and private fields declared >- * by the class, but excludes inherited fields. Synthetic fields may or >- * may not be included. >- * Returns an empty list if the class, interface, or enum declares no fields, >- * and for other kinds of type bindings that do not directly have members. >- * The resulting bindings are in no particular order. >- * >- * @return the list of bindings for the field members of this type, >- * or the empty list if this type does not have field members >+ * Returns whether this type binding represents a top-level class, >+ * interface, enum, or annotation type. >+ * <p> >+ * A top-level type is any type whose declaration does not occur within the >+ * body of another type declaration. The set of top level types is disjoint >+ * from the set of nested types. >+ * </p> >+ * >+ * @return <code>true</code> if this type binding is for a top-level class, >+ * interface, enum, or annotation type, and <code>false</code> otherwise > */ >- public IVariableBinding[] getDeclaredFields(); >+ public boolean isTopLevel(); > > /** >- * Returns a list of method bindings representing all the methods and >- * constructors declared for this class, interface, enum, or annotation >- * type. These include public, protected, default (package-private) access, >- * and private methods Synthetic methods and constructors may or may not be >- * included. Returns an empty list if the class, interface, or enum, >- * type declares no methods or constructors, if the annotation type declares >- * no members, or if this type binding represents some other kind of type >- * binding. The resulting bindings are in no particular order. >- * >- * @return the list of method bindings for the methods and constructors >- * declared by this class, interface, enum type, or annotation type, >- * or the empty list if this type does not declare any methods or constructors >+ * Returns whether this type binding represents a type variable. >+ * Type variables bindings carry the type variable's bounds. >+ * >+ * @return <code>true</code> if this type binding is for a type variable, >+ * and <code>false</code> otherwise >+ * @see #getName() >+ * @see #getTypeBounds() >+ * @since 3.1 > */ >- public IMethodBinding[] getDeclaredMethods(); >+ public boolean isTypeVariable(); > > /** >- * Returns whether this type binding originated in source code. >- * Returns <code>false</code> for all primitive types, the null type, >- * array types, and for all classes, interfaces, enums, annotation >- * types, type variables, parameterized type references, >- * raw type references, and wildcard types, whose information came from a >- * pre-compiled binary class file. >- * >- * @return <code>true</code> if the type is in source code, >- * and <code>false</code> otherwise >+ * Returns whether this wildcard type is an upper bound >+ * ("extends") as opposed to a lower bound ("super"). >+ * Note that this property is only relevant for wildcards >+ * that have a bound. >+ * >+ * @return <code>true</code> if this wildcard type has a bound that is >+ * an upper bound, and <code>false</code> in all other cases >+ * @see #isWildcardType() >+ * @see #getBound() >+ * @since 3.1 > */ >- public boolean isFromSource(); >+ public boolean isUpperbound(); > > /** >- * Returns the fully qualified name of the type represented by this >- * binding if it has one. >- * <ul> >- * <li>For top-level types, the fully qualified name is the simple name of >- * the type preceded by the package name (or unqualified if in a default package) >- * and a ".". >- * Example: <code>"java.lang.String"</code> or <code>"java.util.Collection"</code>. >- * Note that the type parameters of a generic type are not included.</li> >- * <li>For members of top-level types, the fully qualified name is the >- * simple name of the type preceded by the fully qualified name of the >- * enclosing type (as computed by this method) and a ".". >- * Example: <code>"java.io.ObjectInputStream.GetField"</code>. >- * If the binding is for a member type that corresponds to a particular instance >- * of a generic type arising from a parameterized type reference, the simple >- * name of the type is followed by the fully qualified names of the type arguments >- * (as computed by this method) surrounded by "<>" and separated by ",". >- * Example: <code>"pkg.Outer.Inner<java.lang.String>"</code>. >- * </li> >- * <li>For primitive types, the fully qualified name is the keyword for >- * the primitive type. >- * Example: <code>"int"</code>.</li> >- * <li>For the null type, the fully qualified name is the string >- * "null".</li> >- * <li>Local types (including anonymous classes) and members of local >- * types do not have a fully qualified name. For these types, and array >- * types thereof, this method returns an empty string.</li> >- * <li>For array types whose component type has a fully qualified name, >- * the fully qualified name is the fully qualified name of the component >- * type (as computed by this method) followed by "[]". >- * Example: <code>"java.lang.String[]"</code>.</li> >- * <li>For type variables, the fully qualified name is just the name of the >- * type variable (type bounds are not included). >- * Example: <code>"X"</code>.</li> >- * <li>For type bindings that correspond to particular instances of a generic >- * type arising from a parameterized type reference, >- * the fully qualified name is the fully qualified name of the erasure >- * type followed by the fully qualified names of the type arguments surrounded by "<>" and separated by ",". >- * Example: <code>"java.util.Collection<java.lang.String>"</code>. >- * </li> >- * <li>For type bindings that correspond to particular instances of a generic >- * type arising from a raw type reference, >- * the fully qualified name is the fully qualified name of the erasure type. >- * Example: <code>"java.util.Collection"</code>. Note that the >- * the type parameters are omitted.</li> >- * <li>For wildcard types, the fully qualified name is "?" optionally followed by >- * a single space followed by the keyword "extends" or "super" >- * followed a single space followed by the fully qualified name of the bound >- * (as computed by this method) when present. >- * Example: <code>"? extends java.io.InputStream"</code>. >- * </li> >- * </ul> >- * >- * @return the fully qualified name of the type represented by this >- * binding, or the empty string if it has none >- * @see #getName() >- * @since 2.1 >+ * Returns whether this type binding represents a wildcard type. A wildcard >+ * type occus only as an argument to a parameterized type reference. >+ * <p> >+ * For example, a AST type like >+ * <code>Collection<? extends Object></code> typically resolves to a >+ * parameterized type binding whose type argument is a wildcard type >+ * with upper type bound <code>java.util.Object/code>. >+ * </p> >+ * >+ * @return <code>true</code> if this object represents a wildcard type, >+ * and <code>false</code> otherwise >+ * @since 3.1 >+ * @see #getBound() >+ * @see #isUpperbound() > */ >- public String getQualifiedName(); >+ public boolean isWildcardType(); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 84496
:
18084
|
18107
|
20088
|
20089
|
20118
|
20121
|
20124