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

[ java, jvm, language, library, mit ] [ Propose Tags ] [ Report a vulnerability ]
Versions [RSS] 0.0.1, 0.0.2, 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.8.0, 0.9.0, 0.10.0
Change log CHANGELOG.md
Dependencies attoparsec, base (>=4.9 && <4.15), binary, bytestring, containers, data-binary-ieee754, deepseq (>=1.4.3.0), deriving-compat, mtl, template-haskell, text, vector [details]
License MIT
Author Christian Gram Kalhauge
Maintainer Christian Gram Kalhauge <kalhauge@cs.ucla.edu>
Category Language, Java, JVM
Home page https://github.com/ucla-pls/jvm-binary#readme
Bug tracker https://github.com/ucla-pls/jvm-binary/issues
Source repo head: git clone https://github.com/ucla-pls/jvm-binary
Uploaded by kalhauge at 2021-05-12T09:21:37Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 6032 total (29 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-05-12 [all 1 reports]

Readme for jvm-binary-0.10.0

[back to package description]

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.