kriegaex commented on a change in pull request #95:
URL: https://github.com/apache/maven-shade-plugin/pull/95#discussion_r636857368
##########
File path: src/main/java/org/apache/maven/plugins/shade/DefaultShader.java
##########
@@ -706,45 +719,25 @@ public boolean hasRelocators()
public Object mapValue( Object object )
{
- if ( object instanceof String )
- {
- String name = (String) object;
- String value = name;
-
- String prefix = "";
- String suffix = "";
-
- Matcher m = classPattern.matcher( name );
- if ( m.matches() )
- {
- prefix = m.group( 1 ) + "L";
- suffix = ";";
- name = m.group( 2 );
- }
-
- for ( Relocator r : relocators )
- {
- if ( r.canRelocateClass( name ) )
- {
- value = prefix + r.relocateClass( name ) + suffix;
- break;
- }
- else if ( r.canRelocatePath( name ) )
- {
- value = prefix + r.relocatePath( name ) + suffix;
- break;
- }
- }
-
- return value;
- }
-
- return super.mapValue( object );
+ return object instanceof String ? map( (String) object, true ) :
super.mapValue( object );
}
public String map( String name )
{
- String value = name;
+ // TODO: Before the refactoring of duplicate code to 'private
String map(String, boolean)', this method did
Review comment:
You see the duplication in the original code before my change, but also
the slight difference. That might be an oversight or on purpose, but nobody
documented the intent of duplicating with a minimal difference. The tests I ran
locally (all unit and integration tests plus the project I am working on) did
not show any differences if I just always check for both dotty and slashy
package names.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]