victims / victims-lib-java

The victims library containing the hashing logic for java specific artifacts.
GNU Affero General Public License v3.0
5 stars 8 forks source link

Normalization changes when class is compiled with -g:none #33

Open fweimer opened 10 years ago

fweimer commented 10 years ago

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.

abn commented 10 years ago

@fweimer do you have a patch for this?

fweimer commented 10 years ago

@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.