java-signatures

Crates.iojava-signatures
lib.rsjava-signatures
version0.1.0
sourcesrc
created_at2024-07-05 08:38:54.609185
updated_at2024-07-05 08:38:54.609185
descriptionjava classfile signatures parser
homepage
repositoryhttps://github.com/xitep/java-signatures.git
max_upload_size
id1292504
size57,891
(xitep)

documentation

README

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](https://github.com/staktrace/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.
Commit count: 8

cargo fmt