Top Description Fields Constructors Methods
org.apache.bcel.generic

public abstract Class ReferenceType

extends Type
Class Inheritance
Known Direct Subclasses
org.apache.bcel.verifier.structurals.UninitializedObjectType, org.apache.bcel.generic.ArrayType, org.apache.bcel.generic.ObjectType
Imports
org.apache.bcel.Const, .Repository, org.apache.bcel.classfile.JavaClass

Super class for object and array types.

Field Summary

Inherited from org.apache.bcel.generic.Type:
BOOLEANBYTECHARCLASSDOUBLEFLOATINTLONGNO_ARGSNULLOBJECTSHORTsignatureSTRINGSTRINGBUFFERTHROWABLEtypeUNKNOWNVOID

Constructor Summary

AccessConstructor and Description
pack-priv
ReferenceType()

Class is non-abstract but not instantiable from the outside

protected
ReferenceType(final byte t, final String s)

Method Summary

Modifier and TypeMethod and Description
public ReferenceType
firstCommonSuperclass(final ReferenceType t)

Deprecated use getFirstCommonSuperclass(ReferenceType t) which has slightly changed semantics.
This commutative operation returns the first common superclass (narrowest ReferenceType referencing a class, not an interface).
public ReferenceType
getFirstCommonSuperclass(final ReferenceType t)

This commutative operation returns the first common superclass (narrowest ReferenceType referencing a class, not an interface).

private ReferenceType
public boolean
isAssignmentCompatibleWith(final Type t)

Return true iff this is assignment compatible with another type t as defined in the JVM specification; see the AASTORE definition there.

public boolean
isCastableTo(final Type t)

Return true iff this type is castable to another type t as defined in the JVM specification.

Inherited from org.apache.bcel.generic.Type:
consumedencodeequalsgetArgumentTypesgetArgumentTypesSizegetClassNamegetMethodSignaturegetReturnTypegetReturnTypeSizegetSignaturegetSignaturegetSizegetTypegetTypegetTypegetTypesgetTypeSizehashCodeinternalTypeNameToSignaturenormalizeForStackOrLocalsizetoString

Constructor Detail

ReferenceTypeback to summary
pack-priv ReferenceType()

Class is non-abstract but not instantiable from the outside

ReferenceTypeback to summary
protected ReferenceType(final byte t, final String s)

Method Detail

firstCommonSuperclassback to summary
public ReferenceType firstCommonSuperclass(final ReferenceType t) throws ClassNotFoundException

Deprecated

use getFirstCommonSuperclass(ReferenceType t) which has slightly changed semantics.

This commutative operation returns the first common superclass (narrowest ReferenceType referencing a class, not an interface). If one of the types is a superclass of the other, the former is returned. If "this" is Type.NULL, then t is returned. If t is Type.NULL, then "this" is returned. If "this" equals t ['this.equals(t)'] "this" is returned. If "this" or t is an ArrayType, then Type.OBJECT is returned. If "this" or t is a ReferenceType referencing an interface, then Type.OBJECT is returned. If not all of the two classes' superclasses cannot be found, "null" is returned. See the JVM specification edition 2, "�4.9.2 The Bytecode Verifier".

Annotations
@Deprecated
Exceptions
ClassNotFoundException:
on failure to find superclasses of this type, or the type passed as a parameter
getFirstCommonSuperclassback to summary
public ReferenceType getFirstCommonSuperclass(final ReferenceType t) throws ClassNotFoundException

This commutative operation returns the first common superclass (narrowest ReferenceType referencing a class, not an interface). If one of the types is a superclass of the other, the former is returned. If "this" is Type.NULL, then t is returned. If t is Type.NULL, then "this" is returned. If "this" equals t ['this.equals(t)'] "this" is returned. If "this" or t is an ArrayType, then Type.OBJECT is returned; unless their dimensions match. Then an ArrayType of the same number of dimensions is returned, with its basic type being the first common super class of the basic types of "this" and t. If "this" or t is a ReferenceType referencing an interface, then Type.OBJECT is returned. If not all of the two classes' superclasses cannot be found, "null" is returned. See the JVM specification edition 2, "�4.9.2 The Bytecode Verifier".

Exceptions
ClassNotFoundException:
on failure to find superclasses of this type, or the type passed as a parameter
getFirstCommonSuperclassInternalback to summary
private ReferenceType getFirstCommonSuperclassInternal(final ReferenceType t) throws ClassNotFoundException
isAssignmentCompatibleWithback to summary
public boolean isAssignmentCompatibleWith(final Type t) throws ClassNotFoundException

Return true iff this is assignment compatible with another type t as defined in the JVM specification; see the AASTORE definition there.

Exceptions
ClassNotFoundException:
if any classes or interfaces required to determine assignment compatibility can't be found
isCastableToback to summary
public boolean isCastableTo(final Type t) throws ClassNotFoundException

Return true iff this type is castable to another type t as defined in the JVM specification. The case where this is Type.NULL is not defined (see the CHECKCAST definition in the JVM specification). However, because e.g. CHECKCAST doesn't throw a ClassCastException when casting a null reference to any Object, true is returned in this case.

Exceptions
ClassNotFoundException:
if any classes or interfaces required to determine assignment compatibility can't be found