45 * 46 * @return {@code true} if this class has any subclasses with finalizers 47 */ 48 AssumptionResult<Boolean> hasFinalizableSubclass(); 49 50 /** 51 * Checks whether this type is an interface. 52 * 53 * @return {@code true} if this type is an interface 54 */ 55 boolean isInterface(); 56 57 /** 58 * Checks whether this type is an instance class. 59 * 60 * @return {@code true} if this type is an instance class 61 */ 62 boolean isInstanceClass(); 63 64 /** 65 * Checks whether this type is an array class. 66 * 67 * @return {@code true} if this type is an array class 68 */ 69 boolean isArray(); 70 71 /** 72 * Checks whether this type is primitive. 73 * 74 * @return {@code true} if this type is primitive 75 */ 76 boolean isPrimitive(); 77 78 /** 79 * {@inheritDoc} 80 * <p> 81 * Only the flags specified in the JVM specification will be included in the returned mask. This 82 * method is identical to {@link Class#getModifiers()} in terms of the value return for this 83 * type. 84 */ 85 int getModifiers(); 86 87 /* 88 * The setting of the final bit for types is a bit confusing since arrays are marked as final. 89 * This method provides a semantically equivalent test that appropriate for types. 90 */ 91 default boolean isLeaf() { 120 */ 121 boolean isAssignableFrom(ResolvedJavaType other); 122 123 /** 124 * Returns true if this type is exactly the type {@link java.lang.Object}. 125 */ 126 default boolean isJavaLangObject() { 127 // Removed assertion due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=434442 128 return getSuperclass() == null && !isInterface() && getJavaKind() == JavaKind.Object; 129 } 130 131 /** 132 * Checks whether the specified object is an instance of this type. 133 * 134 * @param obj the object to test 135 * @return {@code true} if the object is an instance of this type 136 */ 137 boolean isInstance(JavaConstant obj); 138 139 /** 140 * Returns this type if it is an exact type otherwise returns null. This type is exact if it is 141 * void, primitive, final, or an array of a final or primitive type. 142 * 143 * @return this type if it is exact; {@code null} otherwise 144 */ 145 ResolvedJavaType asExactType(); 146 147 /** 148 * Gets the super class of this type. If this type represents either the {@code Object} class, 149 * an interface, a primitive type, or void, then null is returned. If this object represents an 150 * array class then the type object representing the {@code Object} class is returned. 151 */ 152 ResolvedJavaType getSuperclass(); 153 154 /** 155 * Gets the interfaces implemented or extended by this type. This method is analogous to 156 * {@link Class#getInterfaces()} and as such, only returns the interfaces directly implemented 157 * or extended by this type. 158 */ 159 ResolvedJavaType[] getInterfaces(); 160 161 /** 162 * Gets the single implementor of this type. Calling this method on a non-interface type causes 163 * an exception. 164 * <p> 165 * If the compiler uses the result of this method for its compilation, the usage must be guarded 166 * because the verifier can not guarantee that the assigned type really implements this 167 * interface. Additionally, class loading can invalidate the result of this method. | 45 * 46 * @return {@code true} if this class has any subclasses with finalizers 47 */ 48 AssumptionResult<Boolean> hasFinalizableSubclass(); 49 50 /** 51 * Checks whether this type is an interface. 52 * 53 * @return {@code true} if this type is an interface 54 */ 55 boolean isInterface(); 56 57 /** 58 * Checks whether this type is an instance class. 59 * 60 * @return {@code true} if this type is an instance class 61 */ 62 boolean isInstanceClass(); 63 64 /** 65 * Checks whether this type is primitive. 66 * 67 * @return {@code true} if this type is primitive 68 */ 69 boolean isPrimitive(); 70 71 /** 72 * {@inheritDoc} 73 * <p> 74 * Only the flags specified in the JVM specification will be included in the returned mask. This 75 * method is identical to {@link Class#getModifiers()} in terms of the value return for this 76 * type. 77 */ 78 int getModifiers(); 79 80 /* 81 * The setting of the final bit for types is a bit confusing since arrays are marked as final. 82 * This method provides a semantically equivalent test that appropriate for types. 83 */ 84 default boolean isLeaf() { 113 */ 114 boolean isAssignableFrom(ResolvedJavaType other); 115 116 /** 117 * Returns true if this type is exactly the type {@link java.lang.Object}. 118 */ 119 default boolean isJavaLangObject() { 120 // Removed assertion due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=434442 121 return getSuperclass() == null && !isInterface() && getJavaKind() == JavaKind.Object; 122 } 123 124 /** 125 * Checks whether the specified object is an instance of this type. 126 * 127 * @param obj the object to test 128 * @return {@code true} if the object is an instance of this type 129 */ 130 boolean isInstance(JavaConstant obj); 131 132 /** 133 * Gets the super class of this type. If this type represents either the {@code Object} class, 134 * an interface, a primitive type, or void, then null is returned. If this object represents an 135 * array class then the type object representing the {@code Object} class is returned. 136 */ 137 ResolvedJavaType getSuperclass(); 138 139 /** 140 * Gets the interfaces implemented or extended by this type. This method is analogous to 141 * {@link Class#getInterfaces()} and as such, only returns the interfaces directly implemented 142 * or extended by this type. 143 */ 144 ResolvedJavaType[] getInterfaces(); 145 146 /** 147 * Gets the single implementor of this type. Calling this method on a non-interface type causes 148 * an exception. 149 * <p> 150 * If the compiler uses the result of this method for its compilation, the usage must be guarded 151 * because the verifier can not guarantee that the assigned type really implements this 152 * interface. Additionally, class loading can invalidate the result of this method. |