shade plugin modifying string constants

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

shade plugin modifying string constants

Anurag Shekhar
Hi

I am trying to shade a package with following tags

<relocation>
     <pattern>org.example.pkg</pattern>
<shadedPattern>org.example.shaded.pkg</shadedPattern>
</relocation>

I also have a string in one of my class which matches the pattern gets

modified during shading

     public static void main (String [] args) {
         System.out.println ("org.example.pkg."); //prints
org.example.shaded.pkg.
         System.out.println ("org.example.PKG.".toLowerCase()); //prints
org.example.pkg.
     }

Is this expected behavior ?

I was thinking about making use of this behavior. Will it be safe to do so ?

Or its something undocumented so might change without prior notice ?


thanks

Anurag


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: shade plugin modifying string constants

John Patrick
From the views of a another user, relocation should be dumb and should
be exact case sensitive for both pattern and shadedPattern. So I would
not expect PKG to be altered. Yes the output is what your pattern
match lists but but so does; System.out.println ("org.example" +
".pkg."); and I wouldn't expect that to be changed.

Based on your example would you have expect it to be replaced with
either A or B;
a) org.example.shaded.PKG
b) org.example.shaded.pkg

John

On Fri, 26 Jun 2020 at 07:30, Anurag Shekhar
<[hidden email]> wrote:

>
> Hi
>
> I am trying to shade a package with following tags
>
> <relocation>
>      <pattern>org.example.pkg</pattern>
> <shadedPattern>org.example.shaded.pkg</shadedPattern>
> </relocation>
>
> I also have a string in one of my class which matches the pattern gets
>
> modified during shading
>
>      public static void main (String [] args) {
>          System.out.println ("org.example.pkg."); //prints
> org.example.shaded.pkg.
>          System.out.println ("org.example.PKG.".toLowerCase()); //prints
> org.example.pkg.
>      }
>
> Is this expected behavior ?
>
> I was thinking about making use of this behavior. Will it be safe to do so ?
>
> Or its something undocumented so might change without prior notice ?
>
>
> thanks
>
> Anurag
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: shade plugin modifying string constants

Anurag Shekhar
Thank you for your reply.

On 6/27/20 3:21 PM, John Patrick wrote:
>  From the views of a another user, relocation should be dumb and should
> be exact case sensitive for both pattern and shadedPattern. So I would
> not expect PKG to be altered. Yes the output is what your pattern
> match lists but but so does; System.out.println ("org.example" +
> ".pkg."); and I wouldn't expect that to be changed.
That clarifies my confusion.
> Based on your example would you have expect it to be replaced with
> either A or B;
> a) org.example.shaded.PKG
> b) org.example.shaded.pkg

I wasn't expecting the capitalized name to undergo replacement. I had

added second println just for my clarity and didn't remove while posting

in the mailing list.

Thanks

anurag


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]