[ https://issues.apache.org/jira/browse/MSHADE-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15329500#comment-15329500 ]
Harvey Raja commented on MSHADE-228: ------------------------------------ You will be able to see the difference in the constant pool in the ClassFile generated by javac and the ClassFile generated by shade. You can also run against java 9 to see the runtime error: {code} Exception in thread "main" java.lang.BootstrapMethodError: java.lang.IncompatibleClassChangeError: Inconsistent constant data for com/screwed/constantpool/InvalidMethodRefExample.lambda$autoDetect$0()Ljava/lang/String; at index 26 at com.screwed.constantpool.InvalidMethodRefExample.autoDetect(InvalidMethodRefExample.java:10) at Test.main(Test.java:5) Caused by: java.lang.IncompatibleClassChangeError: Inconsistent constant data for com/screwed/constantpool/InvalidMethodRefExample.lambda$autoDetect$0()Ljava/lang/String; at index 26 ... 2 more {code} > Shade can incorrectly re-write an InterfaceMethodRef in the constant pool to > a MethodRef > ---------------------------------------------------------------------------------------- > > Key: MSHADE-228 > URL: https://issues.apache.org/jira/browse/MSHADE-228 > Project: Maven Shade Plugin > Issue Type: Bug > Affects Versions: 2.4.3 > Reporter: Harvey Raja > > Given an interface such as: > {code} > public interface InvalidMethodRefExample > { > String getLocation(); > static InvalidMethodRefExample autoDetect() > { > return () -> "$Default$"; > } > } > {code} > {{javac}} correctly produces a bootstrap method that has a {{MethodHandle}} > for its second argument to {{LambdaMetafactory.metafactory}}, and the > {{MethodHandle}} is to an {{InterfaceMethodref}}. > After running shade the {{InterfaceMethodref}} becomes a {{Methodref}}. > This seems to have been the result for some time now but with Java 9 it > appears that the java team have decided to enforce this CP type and will be a > real problem when using shade and Java 9. -- This message was sent by Atlassian JIRA (v6.3.4#6332)