On Fri, 19 Jul 2024 21:42:09 GMT, Shaojin Wen <d...@openjdk.org> wrote:

>> Currently simpleConcat is implemented using mix and prepend, but in this 
>> simple scenario, it can be implemented in a simpler way and can improve 
>> performance.
>
> Shaojin Wen has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - Update src/java.base/share/classes/java/lang/String.java
>    
>    Co-authored-by: Chen Liang <li...@openjdk.org>
>  - add comments

Now StringCconcatFactory constructs MethodHandle through 
StringConcatHelper.lookupStatic, so it can access the private methods of 
StringConcatHelper.

If code is generated through ClassFile, how to access the private methods of 
classes such as String/StringConcatHelper?

I made a try and found it was wrong:

Exception in thread "main" java.lang.IllegalAccessError: failed to access class 
java.lang.StringConcatHelper from class 
jdk.tools.jlink.internal.Utils$$StringConcat/0x00000070000d2000 
(java.lang.StringConcatHelper is in module java.base of loader 'bootstrap'; 
jdk.tools.jlink.internal.Utils$$StringConcat/0x00000070000d2000 is in module 
jdk.jlink of loader 'app')
        at 
jdk.jlink/jdk.tools.jlink.internal.Utils.getPathMatcher(Utils.java:96)
        at 
jdk.jlink/jdk.tools.jmod.JmodTask$PathMatcherConverter.convert(JmodTask.java:1256)
        at 
jdk.jlink/jdk.tools.jmod.JmodTask$PathMatcherConverter.convert(JmodTask.java:1252)
        at 
jdk.internal.opt/jdk.internal.joptsimple.internal.Reflection.convertWith(Reflection.java:154)
        at 
jdk.internal.opt/jdk.internal.joptsimple.AbstractOptionSpec.convertWith(AbstractOptionSpec.java:120)
        at 
jdk.internal.opt/jdk.internal.joptsimple.ArgumentAcceptingOptionSpec.convert(ArgumentAcceptingOptionSpec.java:308)
        at 
jdk.internal.opt/jdk.internal.joptsimple.OptionSet.valuesOf(OptionSet.java:253)
        at jdk.jlink/jdk.tools.jmod.JmodTask.handleOptions(JmodTask.java:1490)
        at jdk.jlink/jdk.tools.jmod.JmodTask.run(JmodTask.java:181)
        at jdk.jlink/jdk.tools.jmod.Main.main(Main.java:35)

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

PR Comment: https://git.openjdk.org/jdk/pull/20253#issuecomment-2240950163

Reply via email to