Commit e1aae8f
[class-parse] Support
Running `class-parse --dump` on `java.lang.Object` would fail:
# on macOS, JDK 1.8 installed
$ unzip /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/rt.jar java/lang/Object.class
$ mono class-parse.exe --dump java/lang/Object.class
...
class-parse: Unable to read file 'java/lang/Object.class': Object reference not set to an instance of an object
Enabling verbose output (`class-parse -v`) didn't help:
$ mono class-parse.exe -v --dump java/lang/Object.class
Unhandled Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Mono.Options.Option.Parse[T] (System.String value, Mono.Options.OptionContext c) [0x0005e] in <4d78dd3d6bb745d7a994cb7587b83fb2>:0
...
Doh!
The problem with the `IndexOutOfRangeException` is a bug in
`Mono.Options-PCL.cs`: it should be using `GenericTypeArguments[0]`,
*not* `GenericTypeParameters[0]`. Fix that.
Once that is fixed, we see that the `NullReferenceException` is coming
from accessing `ClassFile.SuperClass.Name`, because `java.lang.Object`
*has no superclass*, and thus `ClassFile.SuperClass` returns `null`.
Properly check for that.
With those changes in place, `class-parse --dump java.lang.Object`
works as intended:
$ mono class-parse.exe --dump java/lang/Object.class
.class version: 52.0
...
Methods Count: 12
...
11: finalize ()V Protected
Code(10, Unknown[LineNumberTable](6))
Exceptions(java/lang/Throwable)class-parse --dump on java.lang.Object (#108)1 parent 0f82b99 commit e1aae8f
2 files changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
533 | | - | |
| 533 | + | |
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
0 commit comments