JML

org.multijava.util.classfile
Class UniverseClassAttribute

java.lang.Object
  extended byorg.multijava.util.classfile.Attribute
      extended byorg.multijava.util.classfile.UniverseClassAttribute

public class UniverseClassAttribute
extends Attribute

This class implements a JUTS class attribute. It contains the JUTS version (e.g. "1.0") plus a boolean flag that indicates if the class has been compiled with run-time checks enabled. The format of the attribute (not including the standard initial six bytes): - the first two bytes are an index into the constant pool. The constant pool entry at that index must be String constant - the next byte is interpreted as a boolean value, and tells if the class has run-time checks enabled or not This attribute is recognized by UniverseAttributeParser. VMS 4.7.1: The attribute's name is org.multijava.universe_class

Author:
AHS
See Also:
UniverseAttributeParser

Field Summary
private static AsciiConstant attr
           
private  boolean runtimeSupport
          does the class have run-time checks enabled?
(package private) static String tagString
          the name of the attribute
private  AsciiConstant version
          the version of JUTS used
 
Constructor Summary
UniverseClassAttribute(DataInput in, ConstantPool cp)
          Constructs a universe version attribute from a classfile stream.
UniverseClassAttribute(String version, boolean runtimeSupport)
          Create a Universe version attribute.
 
Method Summary
protected  int getSize()
          Returns the space in bytes used by this attribute in the classfile.
protected  int getTag()
          Returns the attribute's tag.
 String getVersion()
          Return the version of the Universe Type System used.
 boolean hasRuntimeSupport()
          Return if the class was compiled with run-time support enabled.
protected  void resolveConstants(ConstantPool cp)
          Insert or check location of constant value on constant pool.
protected  void write(ConstantPool cp, DataOutput out)
          Write this class into the the file (out) getting data position from the constant pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tagString

static final String tagString
the name of the attribute


attr

private static AsciiConstant attr

version

private AsciiConstant version
the version of JUTS used


runtimeSupport

private boolean runtimeSupport
does the class have run-time checks enabled?

Constructor Detail

UniverseClassAttribute

public UniverseClassAttribute(String version,
                              boolean runtimeSupport)
Create a Universe version attribute.

Parameters:
version - the version of the Universe Type System used
runtimeSupport - does the class have run-time checks

UniverseClassAttribute

public UniverseClassAttribute(DataInput in,
                              ConstantPool cp)
                       throws IOException,
                              ClassFileFormatException
Constructs a universe version attribute from a classfile stream.

Parameters:
in - the stream to read from
cp - the constant pool
Throws:
IOException - an IO problem has occured
ClassFileFormatException - the classfile is malformed
Method Detail

getTag

protected int getTag()
Returns the attribute's tag.


getSize

protected int getSize()
Returns the space in bytes used by this attribute in the classfile.


getVersion

public String getVersion()
Return the version of the Universe Type System used.

See Also:
version

hasRuntimeSupport

public boolean hasRuntimeSupport()
Return if the class was compiled with run-time support enabled.

See Also:
runtimeSupport

resolveConstants

protected void resolveConstants(ConstantPool cp)
Insert or check location of constant value on constant pool.

Parameters:
cp - the constant pool for this class

write

protected void write(ConstantPool cp,
                     DataOutput out)
              throws IOException
Write this class into the the file (out) getting data position from the constant pool.

Parameters:
cp - the constant pool
out - the output stream
Throws:
IOException - an IO problem has occurred

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.