java-signatures 0.2.0

java classfile signatures parser
Documentation
  • Coverage
  • 56.92%
    37 out of 65 items documented1 out of 26 items with examples
  • Size
  • Source code size: 59.01 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.85 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • xitep/java-signatures
    0 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • xitep

crates.io docs.rs

java-signatures

A parser for Java's class / method / field signatures as described by the class file format allowing access to generic type information.

There is a number of rust crates to parse Java's classfiles and give access to the signatures, albeit, merely as raw strings. This small library attempts to fill the gap.

status

All of OpenJDK's 21 class, method, and field signatures parse correctly. This is, the parsed form serialized again to a signature yields the same string.

At this stage, the library does the right thing at providing structured access to the encoded signature data. While avoiding copies of the parsed string, no focused effort has been spent on performance yet, though.

testing

Apart of the embedded unit tests, test/parse.rs will pick up any .class file below test/parse/**, extract their class / method / field signature strings using cafebabe, parse them using java-signatures and validate that the parsed signatures correctly serialize back to their original form. To keep the repository small, we do not host any class files there permanently.

alternatives

  • the cfsp project provides parsed signatures as well. Unlike java-signatures the parsed model owns the type information / names, hence, allocates, but may be easier to work with as it retains no reference to the originally parsed string.