You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Stuart McCulloch (JIRA)" <ji...@apache.org> on 2015/06/02 16:31:25 UTC

[jira] [Closed] (MSHADE-168) ManifestResourceTransformer manifestEntries map declares wrong generic type

     [ https://issues.apache.org/jira/browse/MSHADE-168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stuart McCulloch closed MSHADE-168.
-----------------------------------
    Resolution: Duplicate

> ManifestResourceTransformer manifestEntries map declares wrong generic type
> ---------------------------------------------------------------------------
>
>                 Key: MSHADE-168
>                 URL: https://issues.apache.org/jira/browse/MSHADE-168
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: Stuart McCulloch
>         Attachments: ManifestResourceTransformer_manifestEntries.patch
>
>
> The ManifestResourceTransformer class declares a map called manifestEntries with a signature of Map<String, Attributes>. This is incorrect because at runtime this map is actually only ever populated with String values. Furthermore the only place where these map values are used is:
> https://github.com/apache/maven-plugins/blob/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ManifestResourceTransformer.java#L106
> and while the signature of Attributes.put accepts values of any type, the javadoc states that values are checked that they are Strings at runtime:
> http://docs.oracle.com/javase/7/docs/api/java/util/jar/Attributes.html#put(java.lang.Object,%20java.lang.Object)
> In fact it turns out that you can change the manifestEntries Map signature to use any type for the value without getting a compile error - and at runtime it's ignored by the code populating the configuration. I only happened to notice this discrepancy when investigating a related issue involving a stricter version of the plexus MapConverter that checks generic bounds when populating maps:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=429369
> The correct signature of manifestEntries should be Map<String, String>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)