jvm-binary

A library for reading Java class-files https://github.com/ucla-pls/jvm-binary#readme

Latest on Hackage:0.1.0

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

MIT licensed by Christian Gram Kalhauge

jvm-binary

A library for reading and writing Java class-files. To get started importing the Language.JVM file should be sufficient for most uses.

If you want to access Code elements of methods it is recommended to import Language.JVM.Attribute.Code qualified, like this:

import           Language.JVM
import qualified Language.JVM.Attribute.Code as Code

import qualified Data.ByteString.Lazy as BL

main :: IO ()
main = 
  ecfl <- readClassFile <$> BL.readFile "test/data/project/Main.class" 
  case ecfl of 
    Right clf -> do
      print (cThisClass clf)
      print (cSuperClass clf)
    Left msg -> 
      print msg

Stages

There are two stages in the current state of the repository. Low is closer to the class-file, while the High stage is easier to work with. The reason that we have the two stages is that the class-file representation has indices into the Constant Pool. The High stage eliminates all these problems.

Todo’s

  • Add more Attributes as to the docs.
  • Add documentation for Code
  • Setup regular benchmarks

Developing

Use stack to build, test, and benchmark.

Changes

Change log

Version 0.1.0

  • Fix documentation

  • Remove ConstantRef

  • Add better method and field descriptions

  • Introducing a stageing system

  • Added Code writing

  • Changed Megaparsec to Attoparsec of improved performance.

  • A lot of extra work

  • Add Attributes

    • LineNumberTable

Version 0.0.2

  • Fix problems with package.yaml file
  • Add ConstantValue
  • Add Exceptions
  • Add StackMapTable
  • Add BootstrapMethods

Version 0.0.1

The initial version

comments powered byDisqus