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

## com.sun.squawk
Class Klass

    java.lang.Object
      com.sun.squawk.Klass

    public class Klass

extends Object

The Klass class represents the types in the Squawk VM. The Squawk system uses a type hierarchy to simplify verification. The diagram below shows this hierarchy:

The classes in the Java class hierarchy have the expected relationships with each other as specified by the standard Java API. For example, the `getSuperclass()` method returns null for `java.lang.Object` as well as for classes representing interfaces primitive types. The same Java API compliance holds for all the other standard API methods.

Version:
  1.0
See Also:
  `KlassMetadata`

Field Summary
`static Klass` | `ADDRESS` The type for representing machine addresses.
`static Klass` | `ADDRESS_ARRAY` The type for representing an array of machine addresses.
`static boolean` | `ASSERTIONS_ENABLED` A flag that controls conditional features (mainly assertions).
`static Klass` | `BOOLEAN` The type for `boolean`.
`static Klass` | `BOOLEAN_ARRAY` The type for `boolean[]`.
`static Klass` | `BYTE` The type for `byte`.
`static Klass` | `BYTE_ARRAY` The type for `byte[]`.
`static Klass` | `BYTECODE` The type for an element of a method.
`static Klass` | `BYTECODE_ARRAY` The type for an array of bytes that is a method.
`static Klass` | `CHAR` The type for `char`.
`static Klass` | `CHAR_ARRAY` The type for `char[]`.
`static int` | `DATAMAP_ENTRIES_PER_WORD` The number of data map entries in a word.
`static int` | `DATAMAP_ENTRY_BITS` The size (in bits) of a data map entry.
`static int` | `DATAMAP_ENTRY_MASK` The mask used to extract a data map entry.
`static boolean` | `DEBUG_CODE_ENABLED` A flag that controls conditional features (mainly assertions).
`static Klass` | `DOUBLE` The type for `double`.
`static Klass` | `DOUBLE_ARRAY` The type for `double[]`.
`static Klass` | `DOUBLE2` The type for the second word of a `double` value.
`static Klass` | `FLOAT` The type for `float`.
`static Klass` | `FLOAT_ARRAY` The type for `float[]`.
`static Klass` | `GLOBAL` The type for a class state word.
`static Klass` | `GLOBAL_ARRAY` The type for a class state structure.
`static Klass` | `GLOBAL_ARRAYARRAY` The type for a table of class state structures.
`static int` | `ILLEGAL_METHOD_OFFSET` offset given to methods that are illegal to call, such as hosted methods.
`static Klass` | `INT` The type for `int`.
`static Klass` | `INT_ARRAY` The type for `int[]`.
`static Klass` | `KLASS` The type for `com.sun.squawk.Klass`.
`static Klass` | `LOCAL` The type for a slot in a stack chunk.
`static Klass` | `LOCAL_ARRAY` The type for a stack chunk.
`static Klass` | `LONG` The type for `long`.
`static Klass` | `LONG_ARRAY` The type for `long[]`.
`static Klass` | `LONG2` The type for the second word of a `long` value.
`static Klass` | `NATIVEUNSAFE` Container of methods for peeking and poking memory.
`static Klass[]` | `NO_CLASSES` A zero length array of classes.
`static Klass` | `NULL` The type for `null`.
`static Klass` | `OBJECT` The type for `java.lang.Object`.
`static Klass` | `OBJECT_ARRAY` The type for `java.lang.Object[]`.
`static Klass` | `OFFSET` The type for representing the directed distance between two machine addresses.
`static Klass` | `ONE_WORD` The root of all single word types.
`static Klass` | `REFERENCE` The root type for all reference types.
`static Klass` | `SHORT` The type for `short`.
`static Klass` | `SHORT_ARRAY` The type for `short[]`.
`static boolean` | `SQUAWK_64` A flag that controls conditional 64-bitness.
`static byte` | `STATE_CONVERTED` Constant denoting that a Klass has had its methods translated.
`static byte` | `STATE_CONVERTING` Constant denoting that a Klass is currently having its methods translated.
`static byte` | `STATE_DEFINED` Constant denoting the initial state of a Klass.
`static byte` | `STATE_ERROR` Constant denoting that loading or converting a Klass cause a linkage error.
`static byte` | `STATE_LOADED` Constant denoting that a Klass is loaded.
`static byte` | `STATE_LOADING` Constant denoting that a Klass is currently loading.
`static Klass` | `STRING` The type for `java.lang.String`.
`static Klass` | `STRING_ARRAY` The type for `java.lang.String[]`.
`static Klass` | `STRING_OF_BYTES` The type for `com.sun.squawk.StringOfBytes`.
`static Klass` | `THROWABLE` The type for `java.lang.Class`.
`static Klass` | `TOP` The root of the verification type hierarchy.
`static boolean` | `TRACING_ENABLED` A flag specifying whether the `Tracer` class is available.
`static Klass` | `TWO_WORD` The root of all two word types.
`static Klass` | `UNINITIALIZED` The root type for all uninitialized reference types.
`static Klass` | `UNINITIALIZED_NEW` The root of the types representing the result of the new bytecode before it has been passed to a constructor.
`static Klass` | `UNINITIALIZED_THIS` The type for `this` in a constructor before the call to the super constructor.
`static Klass` | `UWORD` The type for representing unsigned machine words.
`static Klass` | `UWORD_ARRAY` The type for representing an array of unsigned word addresses.
`static Klass` | `VOID` The type for `void`.

Constructor Summary
`protected` | `Klass(String name, Klass superType)` Only used by UninitializedObjectClass constructor.

Method Summary
`static Class` | `asClass(Klass klass)` Gets the Class instance corresponding to a given Klass instance, creating it first if necessary.
`static Klass` | `asKlass(Class c)` Gets the Klass instance corresponding to a given Class instance.
`void` | `changeState(byte state)` Updates the state of this class.
`boolean` | `equals(Object obj)` For completeness, define identity equals().
`static Klass` | `forName(String className)` Returns the `Klass` object associated with the class with the given string name.
`static Klass` | `getClass(String name, boolean isFieldDescriptor)` Gets a class corresponding to a given name.
`Klass` | `getComponentType()` Returns the class representing the component type of an array.
`int` | `getDataMapEntry(int index)` Get the number of bytes a particular entry in the table uses.
`int` | `getDataMapLength()` Return the number of entries within the dataMap
`int` | `getDataSize()` Gets the data size (in bytes) of the type represented by this class.
`int` | `getDefaultConstructorModifiers()` Gets the modifiers of this class's default constructor.
`Field` | `getField(int index, boolean isStatic)` Gets a field declared by this class based on a given field table index.
`int` | `getFieldCount(boolean isStatic)` Gets the number of fields declared by this class.
`Klass[]` | `getInterfaces()` Gets the list of interfaces implemented by this class.
`String` | `getInternalName()` Gets the internal class name.
`Method` | `getMethod(int index, boolean isStatic)` Gets a method declared by this class based on a given method table index.
`int` | `getMethodCount(boolean isStatic)` Gets the number of methods declared by this class.
`int` | `getMethodIndex(Object method, boolean isStatic)` Looks up the method's index in the klass.
`Object` | `getMethodObject(Method method)` Gets the bytecode array for the given Method object
`int` | `getModifiers()` Returns the modifiers for this class or interface.
`String` | `getName()` Returns the name of this entity in the format expected by `Class.getName()`.
`static String` | `getNames(Klass[] klasses)` Formats the names of a given array of classes into a single string with each class name separated by a space.
`Object` | `getObject(int index)` Get an object from the object table.
`int` | `getObjectIndex(Object object)` Gets the index of a given object in this object table of this class.
`int` | `getRefStaticFieldsSize()` Get the size (in words) of the static fields of this class that are of a non-primitive type.
`InputStream` | `getResourceAsStream(String name)` Finds a resource with a given name.
`static Klass` | `getSecondWordType(Klass type)` Gets the type representing the second word of a double word type.
`String` | `getSignature()` Gets the JNI signature of this class.
`static char` | `getSignatureFirstChar(int systemID)` Gets the first char of the name of a class when it is in signature form.
`String` | `getSourceFileName()` Get the source file from which the class was compiled.
`int` | `getState()` Gets the state of this class.
`int` | `getStaticFieldsSize()` Get the size (in words) of the static fields of this class.
`Object[]` | `getStaticMethods()` Gets the table of static methods for this class.
`int` | `getSuiteID()` Gets the suite identifier for this class.
`Klass` | `getSuperclass()` Returns the `Class` representing the superclass of the entity (class, interface, primitive type or void) represented by this `Class`.
`Klass` | `getSuperType()` Gets the class representing the super type of this class in the verification type hierarchy.
`int` | `getSystemID()` Gets the system wide unique ID for this class or a negative value if it doesn't have one.
`Object[]` | `getVirtualMethods()` Gets the vtable for virtual methods.
`boolean` | `hasDefaultConstructor()` Determines if this class has a default constructor.
`boolean` | `hasGlobalStatics()` Determines if the static fields of this class are `VM global`.
`int` | `hashCode()` Returns a hashcode for this class.
`boolean` | `hasMain()` Determines if this class has a `void main(String[])` method.
`void` | `installMethodBody(MethodBody body, boolean isStatic)` Installs the method body for a given method in this class.
`boolean` | `isAbstract()` Determines if this is an abstract class.
`boolean` | `isAccessibleFrom(Klass klass)` Determines whether or not this class is accessible by a specified class.
`static boolean` | `isAccessibleFrom(Klass definingClass, int modifiers, Klass accessingKlass)` Determines if a given field or method is accessible from a given klass.
`static boolean` | `isAccessibleFrom(Member member, Klass klass)` Determines if a given field or method is accessible from a given klass.
`boolean` | `isArray()` Determines if this `Class` object represents an array class.
`boolean` | `isAssignableFrom(Klass klass)` Determines if the class or interface represented by this `Class` object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified `Class` parameter.
`boolean` | `isDoubleWord()` Determines if this class represents a type whose values occupy two 32-bit words.
`boolean` | `isFinal()` Determines if this class can be subclassed.
`boolean` | `isImplementorOf(Klass anInterface)` Determine if this class implements a specified class.
`boolean` | `isInitialized()` Determines if this class is initialized.
`boolean` | `isInSamePackageAs(Klass klass)` Return true if a given class is in the same package as this class.
`boolean` | `isInstance(Object obj)` Determines if the specified `Object` is assignment-compatible with the object represented by this `Klass`.
`boolean` | `isInstantiable()` Return true if this class can be allocated (not abstract or interface, etc.) If true, there may be some object "obj" such that GC.getKlass(obj) == this class.
`boolean` | `isInterface()` Determines if the specified `Class` object represents an interface type.
`boolean` | `isInternalType()` Determines if this class is only used by the VM internally and does not correspond to any Java source language type.
`static boolean` | `isMissingMethodObject(Object method, boolean isStatic)` Tests if the given method is the designated "missing method".
`boolean` | `isPragma()` Determines if this class is used to annotate a Java component (i.e.
`boolean` | `isPrimitive()` Determines if this class represents a primitive type (e.g.
`boolean` | `isPublic()` Determines if this is a public class.
`boolean` | `isReferenceType()` Determines whether or not this class is a reference type.
`boolean` | `isSourceSynthetic()` Determines if this class does not appear in any source code.
`boolean` | `isSquawkArray()` Determines if this `Class` object represents an array class in the Squawk sense i.e.
`boolean` | `isSquawkPrimitive()` Determines if this `Class` object represents a special class that the Squawk translator and compiler convert into a primitive type.
`boolean` | `isSynthetic()` Determines if this class is not defined by a class file.
`Field` | `lookupField(String name, Klass type, boolean isStatic)` Finds the `Field` object representing a field in this class's hierarchy.
`static Klass` | `lookupKlass(String name)` Look up klass in current suite or one of it's parents.
`Method` | `lookupMethod(String name, Klass[] parameterTypes, Klass returnType, Klass currentClass, boolean isStatic)` Finds the `Method` object representing a method in this class's hierarchy.
`Method` | `lookupVirtualMethod(int offset)` Finds the `Method` object representing a method in this class, given an index in the vtable.
`void` | `main(String[] args)` Call this class's `public static void main(String[])` method if it is defined.
`boolean` | `mustClinit()` Determines if class initialization must be performed for this class.
`Object` | `newInstance()` Creates a new instance of a class.
`void` | `setClassFileDefinition(Klass superClass, Klass[] interfaces, ClassFileMethod[] virtualMethods, ClassFileMethod[] staticMethods, ClassFileField[] instanceFields, ClassFileField[] staticFields, String sourceFile)` Completes the definition of this class (apart from its bytecodes) based on the information parsed from a class file.
`void` | `setObjectTable(Object[] objects)` Set the object table.
`protected void` | `setSuperType(Klass superType)` Sets the verification hierarchy super type of this class.
`String` | `toString()` Converts the object to a string.
`static String` | `toString(Member member, boolean showType)` Gets a string representation of a given field or method.
`void` | `updateModifiers(int modifiers)` Updates the modifiers for this class by setting one or more modifier flags that are not currently set.

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

Field Detail

### ILLEGAL_METHOD_OFFSET

    public static final int ILLEGAL_METHOD_OFFSET

  offset given to methods that are illegal to call, such as hosted methods.

  See Also:
    Constant Field Values

### NO_CLASSES

    public static final Klass[] NO_CLASSES

  A zero length array of classes.

### DEBUG_CODE_ENABLED

    public static final boolean DEBUG_CODE_ENABLED

  A flag that controls conditional features (mainly assertions).

  See Also:
    Constant Field Values

### ASSERTIONS_ENABLED

    public static final boolean ASSERTIONS_ENABLED

  A flag that controls conditional features (mainly assertions).

  See Also:
    Constant Field Values

### TRACING_ENABLED

    public static final boolean TRACING_ENABLED

  A flag specifying whether the `Tracer` class is available.

  See Also:
    Constant Field Values

### SQUAWK_64

    public static final boolean SQUAWK_64

  A flag that controls conditional 64-bitness.

  See Also:
    Constant Field Values

### STATE_DEFINED

    public static final byte STATE_DEFINED

  Constant denoting the initial state of a Klass.

  See Also:
    Constant Field Values

### STATE_LOADING

    public static final byte STATE_LOADING

  Constant denoting that a Klass is currently loading.

  See Also:
    Constant Field Values

### STATE_LOADED

    public static final byte STATE_LOADED

  Constant denoting that a Klass is loaded.

  See Also:
    Constant Field Values

### STATE_CONVERTING

    public static final byte STATE_CONVERTING

  Constant denoting that a Klass is currently having its methods translated.

  See Also:
    Constant Field Values

### STATE_CONVERTED

    public static final byte STATE_CONVERTED

  Constant denoting that a Klass has had its methods translated.

  See Also:
    Constant Field Values

### STATE_ERROR

    public static final byte STATE_ERROR

  Constant denoting that loading or converting a Klass cause a linkage error.

  See Also:
    Constant Field Values

### DATAMAP_ENTRY_BITS

    public static final int DATAMAP_ENTRY_BITS

  The size (in bits) of a data map entry.

  See Also:
    Constant Field Values

### DATAMAP_ENTRY_MASK

    public static final int DATAMAP_ENTRY_MASK

  The mask used to extract a data map entry.

  See Also:
    Constant Field Values

### DATAMAP_ENTRIES_PER_WORD

    public static final int DATAMAP_ENTRIES_PER_WORD

  The number of data map entries in a word.

  See Also:
    Constant Field Values

### TOP

    public static Klass TOP

  The root of the verification type hierarchy.

  See Also:
    `Klass`

### ONE_WORD

    public static Klass ONE_WORD

  The root of all single word types.

### TWO_WORD

    public static Klass TWO_WORD

  The root of all two word types.

### BOOLEAN

    public static Klass BOOLEAN

  The type for `boolean`.

### BYTE

    public static Klass BYTE

  The type for `byte`.

### CHAR

    public static Klass CHAR

  The type for `char`.

### SHORT

    public static Klass SHORT

  The type for `short`.

### INT

    public static Klass INT

  The type for `int`.

### FLOAT

    public static Klass FLOAT

  The type for `float`.

### LONG

    public static Klass LONG

  The type for `long`.

### LONG2

    public static Klass LONG2

  The type for the second word of a `long` value.

### DOUBLE

    public static Klass DOUBLE

  The type for `double`.

### DOUBLE2

    public static Klass DOUBLE2

  The type for the second word of a `double` value.

### VOID

    public static Klass VOID

  The type for `void`.

### REFERENCE

    public static Klass REFERENCE

  The root type for all reference types.

### UNINITIALIZED

    public static Klass UNINITIALIZED

  The root type for all uninitialized reference types.

### UNINITIALIZED_THIS

    public static Klass UNINITIALIZED_THIS

  The type for `this` in a constructor before the call to the super constructor.

### UNINITIALIZED_NEW

    public static Klass UNINITIALIZED_NEW

  The root of the types representing the result of the new bytecode before it has been passed to a constructor.

### NULL

    public static Klass NULL

  The type for `null`.

### OBJECT

    public static Klass OBJECT

  The type for `java.lang.Object`.

### STRING

    public static Klass STRING

  The type for `java.lang.String`.

### THROWABLE

    public static Klass THROWABLE

  The type for `java.lang.Class`.

### KLASS

    public static Klass KLASS

  The type for `com.sun.squawk.Klass`.

### OBJECT_ARRAY

    public static Klass OBJECT_ARRAY

  The type for `java.lang.Object[]`.

### STRING_ARRAY

    public static Klass STRING_ARRAY

  The type for `java.lang.String[]`.

### BOOLEAN_ARRAY

    public static Klass BOOLEAN_ARRAY

  The type for `boolean[]`.

### BYTE_ARRAY

    public static Klass BYTE_ARRAY

  The type for `byte[]`.

### CHAR_ARRAY

    public static Klass CHAR_ARRAY

  The type for `char[]`.

### SHORT_ARRAY

    public static Klass SHORT_ARRAY

  The type for `short[]`.

### INT_ARRAY

    public static Klass INT_ARRAY

  The type for `int[]`.

### FLOAT_ARRAY

    public static Klass FLOAT_ARRAY

  The type for `float[]`.

### LONG_ARRAY

    public static Klass LONG_ARRAY

  The type for `long[]`.

### DOUBLE_ARRAY

    public static Klass DOUBLE_ARRAY

  The type for `double[]`.

### STRING_OF_BYTES

    public static Klass STRING_OF_BYTES

  The type for `com.sun.squawk.StringOfBytes`.

### LOCAL

    public static Klass LOCAL

  The type for a slot in a stack chunk.

### LOCAL_ARRAY

    public static Klass LOCAL_ARRAY

  The type for a stack chunk.

### GLOBAL

    public static Klass GLOBAL

  The type for a class state word.

### GLOBAL_ARRAY

    public static Klass GLOBAL_ARRAY

  The type for a class state structure.

### GLOBAL_ARRAYARRAY

    public static Klass GLOBAL_ARRAYARRAY

  The type for a table of class state structures.

### BYTECODE

    public static Klass BYTECODE

  The type for an element of a method.

### BYTECODE_ARRAY

    public static Klass BYTECODE_ARRAY

  The type for an array of bytes that is a method.

### ADDRESS

    public static Klass ADDRESS

  The type for representing machine addresses.

### ADDRESS_ARRAY

    public static Klass ADDRESS_ARRAY

  The type for representing an array of machine addresses.

### UWORD

    public static Klass UWORD

  The type for representing unsigned machine words.

### UWORD_ARRAY

    public static Klass UWORD_ARRAY

  The type for representing an array of unsigned word addresses.

### OFFSET

    public static Klass OFFSET

  The type for representing the directed distance between two machine addresses.

### NATIVEUNSAFE

    public static Klass NATIVEUNSAFE

  Container of methods for peeking and poking memory.

Constructor Detail

### Klass

    protected Klass(String name,
                    Klass superType)

  Only used by UninitializedObjectClass constructor.

  Parameters:
    `name` - the name of the class
    `superType` - must be `UNINITIALIZED_NEW`

Method Detail

### asClass

    public static Class asClass(Klass klass)

  Gets the Class instance corresponding to a given Klass instance, creating it first if necessary.

  Parameters:
    `klass` - the Klass object
  Returns:
    the Class object

### asKlass

    public static Klass asKlass(Class c)

  Gets the Klass instance corresponding to a given Class instance.

  Parameters:
    `c` - the Class object
  Returns:
    the Klass object

### forName

    public static Klass forName(String className)
                         throws ClassNotFoundException

  Returns the `Klass` object associated with the class with the given string name.

  Parameters:
    `className` - the class name to lookup
  Returns:
    Klass
  Throws:
    `ClassNotFoundException`

### newInstance

    public final Object newInstance()

  Creates a new instance of a class. This method can only be called for a non-array, non-interface class that `has a default constructor`.

  Returns:
    new object
  Throws:
    `InstantiationException`
    `IllegalAccessException`

### getModifiers

    public final int getModifiers()
                           throws AllowInlinedPragma

  Returns the modifiers for this class or interface.

  Returns:
    int representing class modifiers
  Throws:
    `AllowInlinedPragma`

### isInstantiable

    public boolean isInstantiable()

  Return true if this class can be allocated (not abstract or interface, etc.) If true, there may be some object "obj" such that GC.getKlass(obj) == this class.

  Returns:
    true if objects of this klass can be insta

### isInterface

    public final boolean isInterface()

  Determines if the specified `Class` object represents an interface type.

  Returns:
    `true` if this object represents an interface; `false` otherwise.

### isPrimitive

    public final boolean isPrimitive()

  Determines if this class represents a primitive type (e.g. int, boolean, double, ...etc).

  Returns:
    true if this class represents a primitive type

### hasGlobalStatics

    public final boolean hasGlobalStatics()

  Determines if the static fields of this class are `VM global`.

  Returns:
    true if the static fields of this class are `VM global`

### hasMain

    public final boolean hasMain()

  Determines if this class has a `void main(String[])` method.

  Returns:
    true if it does

### hasDefaultConstructor

    public final boolean hasDefaultConstructor()

  Determines if this class has a default constructor.

  Returns:
    true if it does

### getDefaultConstructorModifiers

    public final int getDefaultConstructorModifiers()

  Gets the modifiers of this class's default constructor. The returned value is meaningless unless `hasDefaultConstructor()` return true.

  Returns:
    the modifiers of this class's default constructor.

### toString

    public final String toString()

  Converts the object to a string. The string representation is the string "class" or "interface", followed by a space, and then by the fully qualified name of the class in the format returned by `getName`. If this `Class` object represents a primitive type, this method returns the name of the primitive type. If this `Class` object represents void this method returns "void".

  Overrides:
    `toString` in class `Object`
  Returns:
    a string representation of this class object.

### isInstance

    public final boolean isInstance(Object obj)

  Determines if the specified `Object` is assignment-compatible with the object represented by this `Klass`.

  Parameters:
    `obj` - object to test
  Returns:
    true if obj is instance of this klass

### isArray

    public final boolean isArray()

  Determines if this `Class` object represents an array class.

  Returns:
    `true` if this object represents an array class; `false` otherwise.

### isSquawkPrimitive

    public final boolean isSquawkPrimitive()

  Determines if this `Class` object represents a special class that the Squawk translator and compiler convert into a primitive type. Values of these types are not compatible with any other types and requires explicit conversions.

  Returns:
    `true` if this object represents a special class; `false` otherwise.

### isSquawkArray

    public final boolean isSquawkArray()
                                throws ForceInlinedPragma

  Determines if this `Class` object represents an array class in the Squawk sense i.e. it is a Java array or some kind of string.

  Returns:
    `true` if this object represents an array class; `false` otherwise.
  Throws:
    `ForceInlinedPragma`

### getName

    public final String getName()

  Returns the name of this entity in the format expected by `Class.getName()`.

  Returns:
    the class name in std Java format

### getSuperclass

    public final Klass getSuperclass()

  Returns the `Class` representing the superclass of the entity (class, interface, primitive type or void) represented by this `Class`. If this `Class` represents either the `Object` class, an interface, a primitive type, or void, then null is returned. If this object represents an array class then the `Class` object representing the `Object` class is returned.

  Returns:
    the superclass of the class represented by this object.

### isAssignableFrom

    public final boolean isAssignableFrom(Klass klass)

  Determines if the class or interface represented by this `Class` object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified `Class` parameter. It returns `true` if so; otherwise it returns `false`. If this `Class` object represents a primitive type, this method returns `true` if the specified `Class` parameter is exactly this `Class` object; otherwise it returns `false`.

  Specifically, this method tests whether the type represented by the specified `Class` parameter can be converted to the type represented by this `Class` object via an identity conversion or via a widening reference conversion. See The Java Language Specification, sections 5.1.1 and 5.1.4 , for details.

  Parameters:
    `klass` - the `Class` object to be checked
  Returns:
    the `boolean` value indicating whether objects of the type `klass` can be assigned to objects of this class
  Throws:
    `NullPointerException` - if the specified Class parameter is null
  Since:
    JDK1.1

### getResourceAsStream

    public final InputStream getResourceAsStream(String name)

  Finds a resource with a given name. This method returns null if no resource with this name is found. The rules for searching resources associated with a given class are profile specific.

  Parameters:
    `name` - name of the desired resource
  Returns:
    a `java.io.InputStream` object.
  Since:
    JDK1.1

### updateModifiers

    public final void updateModifiers(int modifiers)

  Updates the modifiers for this class by setting one or more modifier flags that are not currently set. This method does not unset any modifier flags that are currently set.

  Parameters:
    `modifiers` - a mask of the constants defined in `Modifier`

### getInternalName

    public final String getInternalName()

  Gets the internal class name. The names of classes in the Squawk system are the same as the names returned by `getName` except for classes representing arrays and classes representing primitive types. For the former, the delimiting `L` and `;` are omitted and the internal implementation classes are returned for the latter. Thus:

  >      (new Object[3]).getClass().getInternalName()

  returns "`[java.lang.Object`" and:

  >      (new int[3][4][5][6][7][8][9]).getClass().getInternalName()

  returns "`[[[[[[[java.lang._int_`". The other internal names for the primitive types are as follows:

  >      java.lang._byte_            byte
  >      java.lang._char_            char
  >      java.lang._double_          double
  >      java.lang._float_           float
  >      java.lang._int_             int
  >      java.lang._long_            long
  >      java.lang._short_           short
  >      java.lang._boolean_         boolean
  >      java.lang.Void              void

  Returns:
    the internal class name.

### getSignature

    public final String getSignature()

  Gets the JNI signature of this class.

  Returns:
    the JNI signature for this class
  See Also:
    JNI Signatures

### getSignatureFirstChar

    public static char getSignatureFirstChar(int systemID)

  Gets the first char of the name of a class when it is in signature form.

  Parameters:
    `systemID` - the system ID of the class to query
  Returns:
    char the first char of the class's signature form

### getNames

    public static String getNames(Klass[] klasses)

  Formats the names of a given array of classes into a single string with each class name separated by a space. The `getName()` method is used to convert each class to a name.

  Parameters:
    `klasses` - the classes to format
  Returns:
    the space separated names of the classes in `klasses`

### getSuiteID

    public final int getSuiteID()
                         throws ForceInlinedPragma

  Gets the suite identifier for this class. A suite identifier for a class is only unique within its suite.

  Returns:
    the class identifier for this class
  Throws:
    `ForceInlinedPragma`

### getSystemID

    public final int getSystemID()
                          throws AllowInlinedPragma

  Gets the system wide unique ID for this class or a negative value if it doesn't have one.

  Returns:
    the system wide unique ID for this class or a negative value if it doesn't have one
  Throws:
    `AllowInlinedPragma`

### getComponentType

    public final Klass getComponentType()

  Returns the class representing the component type of an array. If this class does not represent an array class this method returns null.

  Returns:
    the class representing the component type of this class if this class is an array

### getStaticFieldsSize

    public final int getStaticFieldsSize()

  Get the size (in words) of the static fields of this class.

  Returns:
    the number of words

### getRefStaticFieldsSize

    public final int getRefStaticFieldsSize()

  Get the size (in words) of the static fields of this class that are of a non-primitive type. These fields will precede all the primitive type fields in the globals data structure for this class.

  Returns:
    the number of words

### isPublic

    public final boolean isPublic()

  Determines if this is a public class.

  Returns:
    true if this is a public class

### isAbstract

    public final boolean isAbstract()

  Determines if this is an abstract class.

  Returns:
    true if this is an abstract class

### isFinal

    public final boolean isFinal()

  Determines if this class can be subclassed.

  Returns:
    true if this class can be subclassed

### isSynthetic

    public final boolean isSynthetic()

  Determines if this class is not defined by a class file. This will return false for all classes representing arrays, primitive types, verification-only types (e.g. TOP and LONG2) and the type for `void`. For all other classes, this method will return true.

  Returns:
    true if this class is not defined by a class file

### isSourceSynthetic

    public final boolean isSourceSynthetic()

  Determines if this class does not appear in any source code.

  Returns:
    true if this class does not appear in any source code

### isPragma

    public final boolean isPragma()

  Determines if this class is used to annotate a Java component (i.e. class, method or field) that is treated specially in some way by the translator and/or compiler.

  Returns:
    true if this a pragma annotator class

### isInternalType

    public final boolean isInternalType()

  Determines if this class is only used by the VM internally and does not correspond to any Java source language type.

  Returns:
    true if this is a VM internal type

### isImplementorOf

    public final boolean isImplementorOf(Klass anInterface)

  Determine if this class implements a specified class.

  Parameters:
    `anInterface` - the class to check
  Returns:
    true if `klass` is an interface class and this class implements it.

### isInSamePackageAs

    public final boolean isInSamePackageAs(Klass klass)

  Return true if a given class is in the same package as this class.

  Parameters:
    `klass` - the class to test
  Returns:
    true if `klass` is in the same package as this class

### isAccessibleFrom

    public final boolean isAccessibleFrom(Klass klass)

  Determines whether or not this class is accessible by a specified class.

  Parameters:
    `klass` - a class that refers to this class
  Returns:
    true if `other` is null or has access to this class

### isReferenceType

    public final boolean isReferenceType()

  Determines whether or not this class is a reference type.

  Returns:
    true if it is

### getDataSize

    public final int getDataSize()
                          throws ForceInlinedPragma

  Gets the data size (in bytes) of the type represented by this class.

  Returns:
    the data size of a value of the type represented by this class
  Throws:
    `ForceInlinedPragma`

### getSuperType

    public final Klass getSuperType()

  Gets the class representing the super type of this class in the verification type hierarchy.

  Returns:
    the super type of this class

### getInterfaces

    public final Klass[] getInterfaces()

  Gets the list of interfaces implemented by this class.

  Returns:
    the list of interfaces implemented by this class

### getVirtualMethods

    public final Object[] getVirtualMethods()

  Gets the vtable for virtual methods.

  Returns:
    the vtable

### getStaticMethods

    public final Object[] getStaticMethods()

  Gets the table of static methods for this class.

  Returns:
    the table of static methods

### toString

    public static String toString(Member member,
                                  boolean showType)

  Gets a string representation of a given field or method. If `member` is a field, then the returned string will be the fully qualified name (FQN) of the field's type, a space, the FQN of the declaring class of the field, a period, and finally, the field's name. The string returned if `member` is a method will be the same as for a field (with the field type replaced by the method's return type), a '(', the FQNs of the parameter types (if any) separated by a ',', and finally a closing ')'. For example:

  >          java.lang.PrintStream java.lang.System.out
  >          int java.lang.String.indexOf(java.lang.String,int)

  Parameters:
    `member` - the field or method
    `showType` - show the type of the field, or return type of the method
  Returns:
    a string representation of `member`

### isAccessibleFrom

    public static boolean isAccessibleFrom(Member member,
                                           Klass klass)

  Determines if a given field or method is accessible from a given klass.

  Parameters:
    `member` - the field or method to test
    `klass` - the class accessing `member`
  Returns:
    true if `klass` can access `member`

### isAccessibleFrom

    public static boolean isAccessibleFrom(Klass definingClass,
                                           int modifiers,
                                           Klass accessingKlass)

  Determines if a given field or method is accessible from a given klass.

  Parameters:
    `definingClass` - the class in which the member is defined
    `modifiers` - at least the last 8 bits of the method modifiers
    `accessingKlass` - the class accessing the member
  Returns:
    true if `klass` can access `member`

### isDoubleWord

    public final boolean isDoubleWord()

  Determines if this class represents a type whose values occupy two 32-bit words.

  Returns:
    true if this class represents a type whose values occupy two 32-bit words, false otherwise

### getState

    public final int getState()

  Gets the state of this class.

  Returns:
    one of the `STATE_...` constants

### changeState

    public final void changeState(byte state)

  Updates the state of this class. The new state must be logically later than the current state.

  Parameters:
    `state` - the new state of this class

### setSuperType

    protected final void setSuperType(Klass superType)

  Sets the verification hierarchy super type of this class. This method should only be called when creating the bootstrap types.

  Parameters:
    `superType` - the verification hierarchy super type of this class
  See Also:
    `Klass`

### setClassFileDefinition

    public final void setClassFileDefinition(Klass superClass,
                                             Klass[] interfaces,
                                             ClassFileMethod[] virtualMethods,
                                             ClassFileMethod[] staticMethods,
                                             ClassFileField[] instanceFields,
                                             ClassFileField[] staticFields,
                                             String sourceFile)

  Completes the definition of this class (apart from its bytecodes) based on the information parsed from a class file.

  Parameters:
    `superClass` - the super class
    `interfaces` - the implemented interfaces
    `virtualMethods` - the virtual methods declared
    `staticMethods` - the static methods declared (including all constructors)
    `instanceFields` - the instance fields declared
    `staticFields` - the static fields declared
    `sourceFile` - the value of the "SourceFile" attribute

### getDataMapLength

    public final int getDataMapLength()

  Return the number of entries within the dataMap

  Returns:
    the number of entries in the dataMap

### getDataMapEntry

    public final int getDataMapEntry(int index)

  Get the number of bytes a particular entry in the table uses.

  Parameters:
    `index` - an index into the dataMap
  Returns:
    the number of bytes this entry uses

### installMethodBody

    public final void installMethodBody(MethodBody body,
                                        boolean isStatic)

  Installs the method body for a given method in this class.

  Parameters:
    `body` - the method body
    `isStatic` - specifies whether the method is static or virtual

### getSourceFileName

    public final String getSourceFileName()

  Get the source file from which the class was compiled.

  Returns:
    the file name or null if it is not available

### lookupMethod

    public final Method lookupMethod(String name,
                                     Klass[] parameterTypes,
                                     Klass returnType,
                                     Klass currentClass,
                                     boolean isStatic)

  Finds the `Method` object representing a method in this class's hierarchy. This method returns null if the method does not exist.

  Parameters:
    `name` - the name of the method
    `parameterTypes` - the parameter types of the method
    `returnType` - the return type of the method
    `currentClass` - the class context of this lookup or null if there is no current class context
    `isStatic` - specifies a search for a static or virtual method
  Returns:
    the method that matches the given signature or null if there is no match

### lookupVirtualMethod

    public final Method lookupVirtualMethod(int offset)

  Finds the `Method` object representing a method in this class, given an index in the vtable. This method returns null if the method, or metadata for the method does not exist. Use `getMethod` when you have the index of the methods defined in this class. Note that there's not much point in doing this for static method - the index into the stable and the index into the metadata are the same.

  Parameters:
    `offset` - the vtable offset
  Returns:
    Method

### lookupField

    public final Field lookupField(String name,
                                   Klass type,
                                   boolean isStatic)

  Finds the `Field` object representing a field in this class's hierarchy. This method returns null if the field does not exist.

  Parameters:
    `name` - the name of the field
    `type` - the type of the field
    `isStatic` - specifies a search for a static or instance field
  Returns:
    the field that matches the given signature or null if there is no match

### getFieldCount

    public final int getFieldCount(boolean isStatic)

  Gets the number of fields declared by this class.

  Parameters:
    `isStatic` - specifies whether to count static or instance fields
  Returns:
    the number of static or instance fields (as determined by `isStatic`) declared by this class

### getField

    public final Field getField(int index,
                                boolean isStatic)

  Gets a field declared by this class based on a given field table index.

  Parameters:
    `index` - the index of the desired field
    `isStatic` - specifies whether or not the desired field is static
  Returns:
    the field at `index` in the table of static or instance fields (as determined by `isStatic`) declared by this class

### getMethodCount

    public final int getMethodCount(boolean isStatic)

  Gets the number of methods declared by this class.

  Parameters:
    `isStatic` - specifies whether to count static or virtual methods
  Returns:
    the number of static or virtual methods (as determined by `isStatic`) declared by this class

### getMethod

    public final Method getMethod(int index,
                                  boolean isStatic)

  Gets a method declared by this class based on a given method table index.

  Parameters:
    `index` - the index of the desired method
    `isStatic` - specifies whether or not the desired method is static
  Returns:
    the method at `index` in the table of static or virtual methods (as determined by `isStatic`) declared by this class

### getMethodIndex

    public final int getMethodIndex(Object method,
                                    boolean isStatic)

  Looks up the method's index in the klass. Returns the index or -1.

  Parameters:
    `method` - the method look for (Can be real byteocde array, or Method, depending on klass state.
    `isStatic` - If true, look up the index in the static method table, otherwise look up in the virtual method table.
  Returns:
    Returns the methods index, or -1 if the method is not in the specified method table

### getMethodObject

    public final Object getMethodObject(Method method)

  Gets the bytecode array for the given Method object

  Parameters:
    `method` - the Method to look for
  Returns:
    the bytecode array object for the Method

### isMissingMethodObject

    public static boolean isMissingMethodObject(Object method,
                                                boolean isStatic)

  Tests if the given method is the designated "missing method".

  Parameters:
    `method` - the method to check
    `isStatic` - specifies whether or not the desired method is static
  Returns:
    true if method is the missing method method

### setObjectTable

    public final void setObjectTable(Object[] objects)

  Set the object table.

  Parameters:
    `objects` - the object array

### getObject

    public final Object getObject(int index)

  Get an object from the object table.

  Parameters:
    `index` - the index into the table
  Returns:
    the result

### getObjectIndex

    public final int getObjectIndex(Object object)

  Gets the index of a given object in this object table of this class.

  Parameters:
    `object` - the object to search for
  Returns:
    the index of `object` in this class' object table or -1 if it doesn't exist

### hashCode

    public final int hashCode()

  Returns a hashcode for this class.

  Overrides:
    `hashCode` in class `Object`
  Returns:
    a hashcode for this class
  See Also:
    `Object.equals(java.lang.Object)`, `Hashtable`

### equals

    public boolean equals(Object obj)

  For completeness, define identity equals().

  Overrides:
    `equals` in class `Object`
  Parameters:
    `obj` -
  Returns:
  See Also:
    `Boolean.hashCode()`, `Hashtable`

### main

    public final void main(String[] args)
                    throws NotInlinedPragma

  Call this class's `public static void main(String[])` method if it is defined.

  Parameters:
    `args` - the arguments to be passed to the invocation
  Throws:
    `NotInlinedPragma` - as this method saves the current frame pointer

### isInitialized

    public final boolean isInitialized()

  Determines if this class is initialized.

  Returns:
    true if this class is initialized

### mustClinit

    public final boolean mustClinit()

  Determines if class initialization must be performed for this class. Class initialization is required for a class if it or any of it's super classes has a `<clinit>` method.

  Returns:
    true if class initialization must be performed for this class; false otherwise

### getClass

    public static Klass getClass(String name,
                                 boolean isFieldDescriptor)

  Gets a class corresponding to a given name. If the class cannot be found via the leaf suite of the current isolate, it will be created and installed in the leaf suite. If the class represents an array, then this method also ensures that the class representing the component type of the array also exists.

  If the value of `isFieldDescriptor` is true, then the format of `name` is as specified in the JVM specification for field descriptors. Otherwise, the name is in Squawk `internal` format.

  Parameters:
    `name` - the name of the class to get
    `isFieldDescriptor` - if true, then `name` is in the format described above
  Returns:
    klass

### lookupKlass

    public static Klass lookupKlass(String name)

  Look up klass in current suite or one of it's parents.

  Parameters:
    `name` - the name of the class to lookup.
  Returns:
    the Klass instance for `name`, or null if it doesn't exists

### getSecondWordType

    public static Klass getSecondWordType(Klass type)

  Gets the type representing the second word of a double word type.

  Parameters:
    `type` - a double word type
  Returns:
    the type of the second word type of `type`

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

"
For updated information see the Java FRC site
"