You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Harvey Raja (JIRA)" <ji...@apache.org> on 2016/06/14 13:33:01 UTC
[jira] [Commented] (MSHADE-228) Shade can incorrectly re-write an
InterfaceMethodRef in the constant pool to a MethodRef
[ https://issues.apache.org/jira/browse/MSHADE-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15329499#comment-15329499 ]
Harvey Raja commented on MSHADE-228:
------------------------------------
Unfortunately I can not attach the maven project I have that shows the issue, but other than the interface in the description there is the pom file:
{code}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.screwed</groupId>
<artifactId>constant-pool</artifactId>
<name>Screwed Constant Pool</name>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>shade</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>screwed-jar</finalName>
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>true</createDependencyReducedPom>
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/maven/**/*</exclude>
</excludes>
</filter>
</filters>
<!-- the presence of relocation will result in a ClassFile
re-write with an invalid MethodRef -->
<relocations>
<relocation>
<pattern>org.something</pattern>
<shadedPattern>com.screwed.something</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
{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)