Stuart McCulloch created MSHADE-168:
---------------------------------------
Summary: ManifestResourceTransformer manifestEntries map declares
wrong generic type
Key: MSHADE-168
URL: https://jira.codehaus.org/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.1.6#6162)