staktrace / cafebabe

A java class file parser
43 stars 12 forks source link

Typed RecordComponentEntry::descriptor #34

Closed xitep closed 4 months ago

xitep commented 4 months ago

hello, first of all many thanks for this library!

i wondered if there is any reason to not represent RecordComponentEntry::descriptor with a typed manner by a FieldType instead of merely exposing it as a validated string; having it "typed" would nicely align with ClassFile::fields and MethodDescriptor::parameters. It could allow client code to unify the processing of the "field types." would you accept a PR? (right now i'm parsing the descriptor in my own code since FieldType::parse is "crate" private; it would greatly help me if FieldType exposed its parse method, implemented FromStr or similar.)

staktrace commented 4 months ago

I'd accept a PR to improve the situation. The FieldType stuff was contributed by somebody else after I stopped actively working on this crate, and I guess we just missed that the RecordComponentEntry::descriptor could use that.

xitep commented 4 months ago

just for later reference (at least for myself); there are more places that i'd tackle right away with the PR to come:

xitep commented 4 months ago

many thanks for the release (0.7.0)!