Skip to content

Commit df04353

Browse files
authored
Merge pull request #39 from prockallsyms/master
Implement the remaining attribute parsing
2 parents 3639d2d + 203045e commit df04353

44 files changed

Lines changed: 1663 additions & 176 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "classfile-parser"
33
description = "A parser for Java Class files written in rust"
44
version = "0.3.9"
5-
edition = "2021"
5+
edition = "2024"
66
authors = ["Nick Palmer <nick@palmr.co.uk>"]
77
keywords = ["java", "parsing", "class", "classfile"]
88
categories = ["parser-implementations"]
@@ -12,6 +12,10 @@ license = "MIT"
1212
exclude = ["java-assets/out/**/*"]
1313

1414
[dependencies]
15-
nom = "7"
15+
nom = "^7"
1616
bitflags = "^2.3"
1717
cesu8 = "^1.1"
18+
binrw = "0.15.0"
19+
20+
[dev-dependencies]
21+
assert_matches = "1.5.0"

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use classfile_parser::class_parser;
2424

2525
fn main() {
2626
let classfile_bytes = include_bytes!("../path/to/JavaClass.class");
27-
27+
2828
match class_parser(classfile_bytes) {
2929
Ok((_, class_file)) => {
3030
println!(
@@ -84,30 +84,30 @@ fn main() {
8484
- [x] Methods
8585
- [x] Attributes
8686
- [x] Basic attribute info block parsing
87-
- [ ] Known typed attributes parsing
87+
- [x] Known typed attributes parsing
8888
- [x] Critical for JVM
8989
- [x] ConstantValue
9090
- [x] Code
9191
- [x] StackMapTable
9292
- [x] Exceptions
9393
- [x] BootstrapMethods
94-
- [ ] Critical for Java SE
95-
- [ ] InnerClasses
96-
- [ ] EnclosingMethod
97-
- [ ] Synthetic
98-
- [ ] Signature
99-
- [ ] RuntimeVisibleAnnotations
100-
- [ ] RuntimeInvisibleAnnotations
101-
- [ ] RuntimeVisibleParameterAnnotations
102-
- [ ] RuntimeInvisibleParameterAnnotations
103-
- [ ] RuntimeVisibleTypeAnnotations
104-
- [ ] RuntimeInvisibleTypeAnnotations
105-
- [ ] AnnotationDefault
94+
- [x] Critical for Java SE
95+
- [x] InnerClasses
96+
- [x] EnclosingMethod
97+
- [x] Synthetic
98+
- [x] Signature
99+
- [x] RuntimeVisibleAnnotations
100+
- [x] RuntimeInvisibleAnnotations
101+
- [x] RuntimeVisibleParameterAnnotations
102+
- [x] RuntimeInvisibleParameterAnnotations
103+
- [x] RuntimeVisibleTypeAnnotations
104+
- [x] RuntimeInvisibleTypeAnnotations
105+
- [x] AnnotationDefault
106106
- [X] MethodParameters
107-
- [ ] Useful but not critical
107+
- [x] Useful but not critical
108108
- [x] SourceFile
109-
- [ ] SourceDebugExtension
110-
- [ ] LineNumberTable
109+
- [~] SourceDebugExtension
110+
- [x] LineNumberTable
111111
- [x] LocalVariableTable
112-
- [ ] LocalVariableTypeTable
113-
- [ ] Deprecated
112+
- [x] LocalVariableTypeTable
113+
- [x] Deprecated

java-assets/compile.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ javac -d java-assets/compiled-classes/ -g:none java-assets/src/Factorial.java
2525
javac -d java-assets/compiled-classes/ java-assets/src/Instructions.java
2626
javac -d java-assets/compiled-classes/ java-assets/src/UnicodeStrings.java
2727
javac -d java-assets/compiled-classes/ java-assets/src/DeprecatedAnnotation.java
28+
javac -d java-assets/compiled-classes/ java-assets/src/InnerClasses.java
29+
javac -d java-assets/compiled-classes/ java-assets/src/Annotations.java
2830

2931
javac -g -d java-assets/compiled-classes/ java-assets/src/LocalVariableTable.java
3032
javac -d java-assets/compiled-classes/ java-assets/src/HelloWorld.java
419 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
519 Bytes
Binary file not shown.
467 Bytes
Binary file not shown.
1.72 KB
Binary file not shown.

0 commit comments

Comments
 (0)