Remapper logic for InnerClasses attribute is wrong for method-local Java classes
If Jarjar is used with ASM 7.0 to rewrite the packages of classes, we observe that the InnerClasses
attribute is wrong for method-local Java classes. I believe the culprit is this change.
Each entry in InnerClasses
describes an inner class with four items, one of which is the simple name of the inner class.
The bug that was addressed by the change above was that Remapper
would not change the simple name in the InnerClasses
attribute even if the actual name of the inner class was being changed. Unfortunately the fix is not completely correct. This method provides the default derivation of the simple name of a renamed inner class.
But it fails to take local classes into account. For example, Guava's AbstractSortedMultiset
has a method-local class called DescendingMultisetImpl
. The fully-qualified name of this class is com.google.common.collect.AbstractSortedMultiset$1DescendingMultisetImpl
, where the 1 serves to distinguish this from another DescendingMultisetImpl
that might be declared local to another method. The logic introduced by the fix incorrectly derives a value for the simple name that is 1DescendingMultisetImpl
instead of DescendingMultisetImpl
. It should skip digits after the $
.