hs-java-0.2: Java .class files assembler/disassembler

JVM.ClassFile

Description

This module declares (low-level) data types for Java .class files structures, and Binary instances to read/write them.

Synopsis

Documentation

data Attribute Source

Any (class field method/ ...) attribute format. Some formats specify special formats for attributeValue.

type FieldSignature = FieldTypeSource

Class field signature

type ArgumentSignature = FieldTypeSource

Method argument signature

type Pool stage = Map Word16 (Constant stage)Source

Constant pool

type family Link s a Source

data Class stage Source

Generic .class file format

Constructors

Class 

Fields

magic :: Word32

Magic value: 0xCAFEBABE

minorVersion :: Word16
 
majorVersion :: Word16
 
constsPoolSize :: Word16

Number of items in constants pool

constsPool :: Pool stage

Constants pool itself

accessFlags :: AccessFlags stage

See JVM.Types.AccessFlag

thisClass :: Link stage ByteString

Constants pool item index for this class

superClass :: Link stage ByteString
  • -/-- for super class, zero for java.lang.Object
interfacesCount :: Word16

Number of implemented interfaces

interfaces :: [Link stage ByteString]

Constants pool item indexes for implemented interfaces

classFieldsCount :: Word16

Number of class fileds

classFields :: [Field stage]

Class fields

classMethodsCount :: Word16

Number of class methods

classMethods :: [Method stage]

Class methods

classAttributesCount :: Word16

Number of class attributes

classAttributes :: Attributes stage

Class attributes

data NameType a Source

Name and signature pair. Used for methods and fields.

Constructors

NameType 

Instances

class HasSignature a Source

Associated Types

type Signature a Source

data AccessFlag Source

Access flags. Used for classess, methods, variables.

Constructors

ACC_PUBLIC

0x0001 Visible for all

ACC_PRIVATE

0x0002 Visible only for defined class

ACC_PROTECTED

0x0004 Visible only for subclasses

ACC_STATIC

0x0008 Static method or variable

ACC_FINAL

0x0010 No further subclassing or assignments

ACC_SYNCHRONIZED

0x0020 Uses monitors

ACC_VOLATILE

0x0040 Could not be cached

ACC_TRANSIENT

0x0080

ACC_NATIVE

0x0100 Implemented in other language

ACC_INTERFACE

0x0200 Class is interface

ACC_ABSTRACT

0x0400

type family AccessFlags stage Source

data family Attributes stage Source