RFR: 7439: Introduced IConstantPoolExtension for Constant Pools [v6]

Michael Südkamp duke at openjdk.java.net
Sat Jan 1 11:26:19 UTC 2022


On Wed, 29 Dec 2021 21:23:43 GMT, Jean-Philippe Bempel <jpbempel at openjdk.org> wrote:

>> Jean-Philippe Bempel has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   remove unused import
>
> is your stacktrace for the error similar to:
> 
> java.lang.StringIndexOutOfBoundsException: String index out of range: -11
>         at java.base/java.lang.String.substring(String.java:1841)
>         at org.openjdk.jmc.flightrecorder.internal.parser.v1.StructTypes$JfrJavaClass.convertNames(StructTypes.java:331)
>         at org.openjdk.jmc.flightrecorder.internal.parser.v1.StructTypes$JfrJavaClass.getFullName(StructTypes.java:315)
>         at org.openjdk.jmc.flightrecorder.internal.parser.v1.StructTypes$JfrJavaClass.hashCode(StructTypes.java:341)
>         at java.base/java.util.Objects.hashCode(Objects.java:116)
>         at org.openjdk.jmc.flightrecorder.internal.parser.v1.StructTypes$JfrMethod.hashCode(StructTypes.java:625)
>         at org.openjdk.jmc.flightrecorder.stacktrace.graph.AggregatableFrame.hashCode(AggregatableFrame.java:90)
>         at java.base/java.util.HashMap.hash(HashMap.java:339)
>         at java.base/java.util.HashMap.get(HashMap.java:552)
> 
> ?
> in that case it's because you have changed the class name but not the package name associated. 
> Then when referencing a class or a method, package name & class name are not the same, which is not expected.
> 
> in your example to fix the issue:
> 
> 
>     private static Deobfuscator createFooDeobfuscator() {
>     	Map<String, String> obfuscatorClassMap = new HashMap<String, String>();  // obfuscated class -> class
>     	obfuscatorClassMap.put("se/hirt/jmc/tutorial/hotmethods/HotMethods", "de/docware/ms/foo/Foo");
> 		Map<String, String> obfuscatorPackageMap = new HashMap<String, String>();  // obfuscated package -> package
> +++             obfuscatorPackageMap.put("se/hirt/jmc/tutorial/hotmethods", "de/docware/ms/foo");
> 		Map<String, Map<String, String>> obfuscatorClassMethodsMap = new HashMap<String, Map<String, String>>();  // (class, obfuscated method) -> method
>     	return new Deobfuscator(obfuscatorClassMap, obfuscatorPackageMap, obfuscatorClassMethodsMap);
>     }

@jpbempel A happy new to year to you and everyone of the JMC team :-)

Yes, that's very obvious, once I replaced the package too, the error was gone and I could see the replacement effect inside JMC.
I should now be able to complete my code. I will provide a new PR for review in a while.

Thanks a lot!

-------------

PR: https://git.openjdk.java.net/jmc/pull/333


More information about the jmc-dev mailing list