Open fweimer opened 10 years ago
@fweimer do you have a patch for this?
@abn, not yet. Until the next great hashing bump, is probably best to create an artificial value for the SourceFile
attribute if it is missing, derived from the class name, i.e. for a class named org/example/Toplevel$Nested
, the SourceFile
attribute value would be "Toplevel.java"
. This will be the correct file name almost all the time, except when a single .java
file defines multiple top-level classes.
If the class file does not contain any debugging information (if it was compiled with
-g:none
, or if it was stripped later), the normalization changes because BCEL replaces the source file name with<Unknown>
. I think this is not desirable at all.javac
code generation might change in corner cases depending on whether debugging information is generated or not (I haven't checked this), but this direct dependency on the debugging information is unnecessary.