JML

java.lang
Class Class

java.lang.Object
  extended byjava.lang.Class
All Implemented Interfaces:
Serializable

public final class Class
extends Object
implements Serializable

JML's specification of java.lang.Class

Version:
$Revision: 1.19 $
Author:
Gary T. Leavens, Erik Poll

Class Specifications
represents _isInterface <- this.isInterface();
represents _isArray <- this.isArray();
represents _isPrimitive <- this.isPrimitive();
represents _getName <- this.getName();

Specifications inherited from class Object
represents objectState <- org.jmlspecs.lang.JMLDataGroup.IT;
public represents _getClass <- \typeof(this);

Model Field Summary
 String _getName
           
 boolean _isArray
          Needed to specify that invoking isArray() on an object always produces the same result: no methods include this model field in their assignable clause, so no methods can alter the outcome of invoking isArray() on some object.
 boolean _isInterface
           
 boolean _isPrimitive
           
 
Model fields inherited from class java.lang.Object
_getClass, objectState, theString
 
Ghost Field Summary
 
Ghost fields inherited from class java.lang.Object
objectTimesFinalized, owner
 
Constructor Summary
private Class()
           
 
Model Method Summary
 
Model methods inherited from class java.lang.Object
hashValue
 
Method Summary
 boolean desiredAssertionStatus()
           
static Class forName(non_null String className)
           
static Class forName(non_null String name, boolean initialize, non_null ClassLoader loader)
           
 Class[] getClasses()
           
 ClassLoader getClassLoader()
           
(package private)  ClassLoader getClassLoader0()
           
 Class getComponentType()
           
 Constructor getConstructor(non_null Class[] parameterTypes)
           
 Constructor[] getConstructors()
           
 Class[] getDeclaredClasses()
           
 Constructor getDeclaredConstructor(non_null Class[] parameterTypes)
           
 Constructor[] getDeclaredConstructors()
           
 Field getDeclaredField(non_null String name)
           
 Field[] getDeclaredFields()
           
 Method getDeclaredMethod(non_null String name, non_null Class[] parameterTypes)
           
 Method[] getDeclaredMethods()
           
 Class getDeclaringClass()
           
 Field getField(non_null String name)
           
 Field[] getFields()
           
 Class[] getInterfaces()
           
 Method getMethod(non_null String name, non_null Class[] parameterTypes)
           
 Method[] getMethods()
           
 int getModifiers()
           
 String getName()
           
 Package getPackage()
           
(package private) static Class getPrimitiveClass(non_null String name)
           
 ProtectionDomain getProtectionDomain()
           
 URL getResource(non_null String name)
           
 InputStream getResourceAsStream(non_null String name)
           
 Object[] getSigners()
           
 Class getSuperclass()
           
 boolean isArray()
           
 boolean isAssignableFrom(non_null Class cls)
           
 boolean isInstance(non_null Object obj)
           
 boolean isInterface()
           
 boolean isPrimitive()
           
 Object newInstance()
           
(package private)  void setProtectionDomain0(non_null ProtectionDomain pd)
           
(package private)  void setSigners(non_null Object[] signers)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Model Field Detail

_isInterface

public boolean _isInterface

_isArray

public boolean _isArray
Needed to specify that invoking isArray() on an object always produces the same result: no methods include this model field in their assignable clause, so no methods can alter the outcome of invoking isArray() on some object. This property is important when using ESC/Java on specs that use isArray(), just knowing that isArray() is pure is not enough. Similar specs could be added to all other pure methods in this Class.


_isPrimitive

public boolean _isPrimitive

_getName

public String _getName
Specifications: non_null
Constructor Detail

Class

private Class()
Method Detail

toString

public String toString()
Overrides:
toString in class Object
Specifications: pure non_null
     also
public normal_behavior
ensures \result != null&&!\result .equals("")&&(* \result is the name of this class object *);
Specifications inherited from overridden method in class Object:
       non_null
public normal_behavior
assignable objectState;
ensures \result != null;
ensures \result == this.theString;
ensures (* \result is a string representation of this object *);
     also
public code normal_behavior
assignable \nothing;
ensures \result != null&&(* \result is the instance's class name, followed by an @, followed by the instance's hashcode in hex *);
     also
public code model_program { ... }
    implies_that
assignable objectState;
ensures \result != null;

forName

public static Class forName(non_null String className)
                     throws ClassNotFoundException
Throws:
ClassNotFoundException
Specifications: non_null
public normal_behavior
requires className != null&&(* a class named className has been or can be loaded by the defining loader of the current class *);
assignable \not_specified;
ensures \result != null;
     also
public behavior
requires className != null;
assignable \not_specified;
ensures true;
signals_only java.lang.LinkageError, java.lang.ExceptionInInitializerError, java.lang.ClassNotFoundException;
signals (java.lang.LinkageError) (* if linkage fails *);
signals (java.lang.ExceptionInInitializerError) (* if the class must be loaded and its initialization throws an exception *);
signals (java.lang.ClassNotFoundException) (* if className can't be located *);

forName

public static Class forName(non_null String name,
                            boolean initialize,
                            non_null ClassLoader loader)
                     throws ClassNotFoundException
Throws:
ClassNotFoundException
Specifications: non_null
public normal_behavior
requires name != null&&loader != null&&(* a class named name has been/can be loaded by loader *);
assignable \not_specified;
ensures \result != null;
     also
public behavior
requires name != null&&loader != null;
assignable \not_specified;
ensures true;
signals_only java.lang.LinkageError, java.lang.ExceptionInInitializerError, java.lang.ClassNotFoundException;
signals (java.lang.LinkageError) (* if linkage fails *);
signals (java.lang.ExceptionInInitializerError) (* if the class must be loaded and its initialization throws an exception *);
signals (java.lang.ClassNotFoundException) (* if name can't be located *);

newInstance

public Object newInstance()
                   throws InstantiationException,
                          IllegalAccessException
Throws:
InstantiationException
IllegalAccessException
Specifications: pure non_null

isInstance

public boolean isInstance(non_null Object obj)
Specifications: pure

isAssignableFrom

public boolean isAssignableFrom(non_null Class cls)
Specifications: pure

isInterface

public boolean isInterface()
Specifications: pure
ensures \result == this._isInterface;

isArray

public boolean isArray()
Specifications: pure
ensures \result == this._isArray;
ensures \elemtype(this) <: \type(java.lang.Object) ==> \result ;
ensures \elemtype(this) == \type(int) ==> \result ;
ensures \elemtype(this) == \type(byte) ==> \result ;
ensures \elemtype(this) == \type(short) ==> \result ;
ensures \elemtype(this) == \type(long) ==> \result ;
ensures \elemtype(this) == \type(char) ==> \result ;
ensures \elemtype(this) == \type(float) ==> \result ;
ensures \elemtype(this) == \type(double) ==> \result ;
ensures \elemtype(this) == \type(boolean) ==> \result ;

isPrimitive

public boolean isPrimitive()
Specifications: pure
ensures \result == this._isPrimitive;

getName

public String getName()
Specifications: pure non_null
ensures \result == this._getName;

getClassLoader

public ClassLoader getClassLoader()
Specifications: pure non_null

getClassLoader0

ClassLoader getClassLoader0()
Specifications: pure non_null

getSuperclass

public Class getSuperclass()
Specifications: pure non_null

getPackage

public Package getPackage()
Specifications: pure non_null

getInterfaces

public Class[] getInterfaces()
Specifications: pure non_null

getComponentType

public Class getComponentType()
Specifications: pure non_null

getModifiers

public int getModifiers()
Specifications: pure

getSigners

public Object[] getSigners()
Specifications: pure non_null

setSigners

void setSigners(non_null Object[] signers)

getDeclaringClass

public Class getDeclaringClass()
Specifications: pure non_null

getClasses

public Class[] getClasses()
Specifications: pure non_null

getFields

public Field[] getFields()
                  throws SecurityException
Throws:
SecurityException
Specifications: pure non_null

getMethods

public Method[] getMethods()
                    throws SecurityException
Throws:
SecurityException
Specifications: pure non_null

getConstructors

public Constructor[] getConstructors()
                              throws SecurityException
Throws:
SecurityException
Specifications: pure non_null

getField

public Field getField(non_null String name)
               throws NoSuchFieldException,
                      SecurityException
Throws:
NoSuchFieldException
SecurityException
Specifications: pure non_null

getMethod

public Method getMethod(non_null String name,
                        non_null Class[] parameterTypes)
                 throws NoSuchMethodException,
                        SecurityException
Throws:
NoSuchMethodException
SecurityException
Specifications: pure non_null

getConstructor

public Constructor getConstructor(non_null Class[] parameterTypes)
                           throws NoSuchMethodException,
                                  SecurityException
Throws:
NoSuchMethodException
SecurityException
Specifications: pure non_null

getDeclaredClasses

public Class[] getDeclaredClasses()
                           throws SecurityException
Throws:
SecurityException
Specifications: pure non_null
ensures \result != null;
ensures \nonnullelements(\result );

getDeclaredFields

public Field[] getDeclaredFields()
                          throws SecurityException
Throws:
SecurityException
Specifications: pure non_null
ensures \result != null;
ensures \nonnullelements(\result );

getDeclaredMethods

public Method[] getDeclaredMethods()
                            throws SecurityException
Throws:
SecurityException
Specifications: pure non_null
ensures \result != null;
ensures \nonnullelements(\result );

getDeclaredConstructors

public Constructor[] getDeclaredConstructors()
                                      throws SecurityException
Throws:
SecurityException
Specifications: pure non_null

getDeclaredField

public Field getDeclaredField(non_null String name)
                       throws NoSuchFieldException,
                              SecurityException
Throws:
NoSuchFieldException
SecurityException
Specifications: pure non_null

getDeclaredMethod

public Method getDeclaredMethod(non_null String name,
                                non_null Class[] parameterTypes)
                         throws NoSuchMethodException,
                                SecurityException
Throws:
NoSuchMethodException
SecurityException
Specifications: pure non_null

getDeclaredConstructor

public Constructor getDeclaredConstructor(non_null Class[] parameterTypes)
                                   throws NoSuchMethodException,
                                          SecurityException
Throws:
NoSuchMethodException
SecurityException
Specifications: pure non_null

getResourceAsStream

public InputStream getResourceAsStream(non_null String name)
Specifications: pure non_null

getResource

public URL getResource(non_null String name)
Specifications: pure non_null

getProtectionDomain

public ProtectionDomain getProtectionDomain()
Specifications: pure non_null

setProtectionDomain0

void setProtectionDomain0(non_null ProtectionDomain pd)

getPrimitiveClass

static Class getPrimitiveClass(non_null String name)
Specifications: pure non_null

desiredAssertionStatus

public boolean desiredAssertionStatus()
Specifications: pure

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.