This module declares (low-level) data types for Java .class files structures, and Binary instances to read/write them.
- data Attribute = Attribute {}
- data FieldType
- = SignedByte
- | CharByte
- | DoubleType
- | FloatType
- | IntType
- | LongInt
- | ShortInt
- | BoolType
- | ObjectType String
- | Array (Maybe Int) FieldType
- type FieldSignature = FieldType
- data MethodSignature = MethodSignature [ArgumentSignature] ReturnSignature
- data ReturnSignature
- type ArgumentSignature = FieldType
- type Pool stage = Map Word16 (Constant stage)
- type family Link s a
- data Method stage = Method {
- methodAccessFlags :: AccessFlags stage
- methodName :: Link stage ByteString
- methodSignature :: Link stage MethodSignature
- methodAttributesCount :: Word16
- methodAttributes :: Attributes stage
- data Field stage = Field {
- fieldAccessFlags :: AccessFlags stage
- fieldName :: Link stage ByteString
- fieldSignature :: Link stage FieldSignature
- fieldAttributesCount :: Word16
- fieldAttributes :: Attributes stage
- data Class stage = Class {
- magic :: Word32
- minorVersion :: Word16
- majorVersion :: Word16
- constsPoolSize :: Word16
- constsPool :: Pool stage
- accessFlags :: AccessFlags stage
- thisClass :: Link stage ByteString
- superClass :: Link stage ByteString
- interfacesCount :: Word16
- interfaces :: [Link stage ByteString]
- classFieldsCount :: Word16
- classFields :: [Field stage]
- classMethodsCount :: Word16
- classMethods :: [Method stage]
- classAttributesCount :: Word16
- classAttributes :: Attributes stage
- data Constant stage
- = CClass (Link stage ByteString)
- | CField {
- refClass :: Link stage ByteString
- fieldNameType :: Link stage (NameType Field)
- | CMethod { }
- | CIfaceMethod { }
- | CString (Link stage ByteString)
- | CInteger Word32
- | CFloat Float
- | CLong Integer
- | CDouble Double
- | CNameType (Link stage ByteString) (Link stage ByteString)
- | CUTF8 { }
- | CUnicode { }
- data Pointers
- data Resolved
- data NameType a = NameType {
- ntName :: ByteString
- ntSignature :: Signature a
- class HasSignature a where
- type Signature a
- class HasAttributes a where
- attributes :: a stage -> Attributes stage
- data AccessFlag
- type family AccessFlags stage
- data family Attributes stage
- className :: Constant Resolved -> ByteString
- apsize :: Attributes Pointers -> Int
- arsize :: Attributes Resolved -> Int
- arlist :: Attributes Resolved -> [(ByteString, ByteString)]
Documentation
Any (class field method/ ...) attribute format.
Some formats specify special formats for attributeValue
.
Field signature format
SignedByte | B |
CharByte | C |
DoubleType | D |
FloatType | F |
IntType | I |
LongInt | J |
ShortInt | S |
BoolType | Z |
ObjectType String | L |
Array (Maybe Int) FieldType | [{type} |
type FieldSignature = FieldTypeSource
Class field signature
data MethodSignature Source
Class method argument signature
data ReturnSignature Source
Return value signature
type ArgumentSignature = FieldTypeSource
Method argument signature
Class method format
Method | |
|
Class field format
Field | |
|
Generic .class file format
Class | |
|
Constant pool item
CClass (Link stage ByteString) | |
CField | |
| |
CMethod | |
CIfaceMethod | |
CString (Link stage ByteString) | |
CInteger Word32 | |
CFloat Float | |
CLong Integer | |
CDouble Double | |
CNameType (Link stage ByteString) (Link stage ByteString) | |
CUTF8 | |
CUnicode | |
Name and signature pair. Used for methods and fields.
NameType | |
|
class HasAttributes a whereSource
attributes :: a stage -> Attributes stageSource
data AccessFlag Source
Access flags. Used for classess, methods, variables.
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
apsize :: Attributes Pointers -> IntSource
arsize :: Attributes Resolved -> IntSource
arlist :: Attributes Resolved -> [(ByteString, ByteString)]Source