jvm-binary-0.0.2: A library for reading Java class-files

Copyright(c) Christian Gram Kalhauge 2017
LicenseMIT
Maintainerkalhuage@cs.ucla.edu
Safe HaskellNone
LanguageHaskell2010

Language.JVM.Attribute

Contents

Description

This is the main module for accessing all kinds of Attributes.

Synopsis

Documentation

data Attribute Source #

An Attribute, simply contains of a reference to a name and contains info.

aInfo :: Attribute -> ByteString Source #

A small helper function to extract the info as a lazy ByteString.

aName :: ConstantPool -> Attribute -> Maybe Text Source #

Extracts the name from the attribute, if it exists in the ConstantPool.

class IsAttribute a where Source #

A class-type that describes a data-type a as an Attribute. Most notable it provides the fromAttribute' method that enables converting an Attribute to a data-type a.

Minimal complete definition

attrName, fromAttribute

Methods

attrName :: Const Text a Source #

The name of the attribute.

fromAttribute :: Attribute -> Either String a Source #

Generate a a from an Attribute.

fromAttribute' :: ConstantPool -> Attribute -> Maybe (Either String a) Source #

SubAttributes

type Code = Code Attribute Source #

Code is redefined with Attribute, as it is recursively containing Attribute. This is a small hack to fix it.

codeStackMapTable :: ConstantPool -> Code -> Maybe (Either String BootstrapMethods) Source #

The a attribute of the code is the StackMapTable. There can be at most one. If the version number of the file is more than 50, and there is no StackMapTable. there is an implicit empty StackMapTable.

data Exceptions Source #

An Exceptions attribute is a list of references into the constant pool.

Helpers

data Const a b Source #

Create a type dependent on another type b, used for accessing the correct attrName in IsAttribute.