ReferenceType (jakarta-bcel 5.2 API)
Keywords: org.apache.bcel.generic.ReferenceType class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.bcel.generic
Class ReferenceType

    java.lang.Object
      org.apache.bcel.generic.Type
          org.apache.bcel.generic.ReferenceType

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  ArrayType, ObjectType, UninitializedObjectType

    public abstract class ReferenceType

extends Type

Super class for object and array types.

Version:
  $Id: ReferenceType.java 386056 2006-03-15 11:31:56Z tcurdt $
See Also:
  Serialized Form

Field Summary

Fields inherited from class org.apache.bcel.generic.Type
`BOOLEAN, BYTE, CHAR, CLASS, DOUBLE, FLOAT, INT, LONG, NO_ARGS, NULL, OBJECT, SHORT, signature, STRING, STRINGBUFFER, THROWABLE, type, UNKNOWN, VOID`

Constructor Summary
`protected` | `ReferenceType(byte t, String s)`

Method Summary
`ReferenceType` | `firstCommonSuperclass(ReferenceType t)` Deprecated. use getFirstCommonSuperclass(ReferenceType t) which has slightly changed semantics.
`ReferenceType` | `getFirstCommonSuperclass(ReferenceType t)` This commutative operation returns the first common superclass (narrowest ReferenceType referencing a class, not an interface).
`boolean` | `isAssignmentCompatibleWith(Type t)` Return true iff this is assignment compatible with another type t as defined in the JVM specification; see the AASTORE definition there.
`boolean` | `isCastableTo(Type t)` Return true iff this type is castable to another type t as defined in the JVM specification.

Methods inherited from class org.apache.bcel.generic.Type
`equals, getArgumentTypes, getMethodSignature, getReturnType, getSignature, getSignature, getSize, getType, getType, getType, getTypes, hashCode, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ReferenceType

    protected ReferenceType(byte t,
                            String s)

Method Detail

### isCastableTo

    public boolean isCastableTo(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.

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

### isAssignmentCompatibleWith

    public boolean isAssignmentCompatibleWith(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.

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

### getFirstCommonSuperclass

    public ReferenceType getFirstCommonSuperclass(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".

  Throws:
    `ClassNotFoundException` - on failure to find superclasses of this type, or the type passed as a parameter

### firstCommonSuperclass

    public ReferenceType firstCommonSuperclass(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".

  Throws:
    `ClassNotFoundException` - on failure to find superclasses of this type, or the type passed as a parameter

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2006 Apache Software Foundation. All Rights Reserved.