You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Alexander Kriegisch (Jira)" <ji...@apache.org> on 2023/04/29 18:04:00 UTC

[jira] [Created] (MSHADE-443) Fix problems with shadeSourcesContent

Alexander Kriegisch created MSHADE-443:
------------------------------------------

             Summary: Fix problems with shadeSourcesContent
                 Key: MSHADE-443
                 URL: https://issues.apache.org/jira/browse/MSHADE-443
             Project: Maven Shade Plugin
          Issue Type: Bug
    Affects Versions: 3.4.1, 3.3.0
            Reporter: Alexander Kriegisch


*History:* Initially, I improved {{shadeSourcesContent}} in MSHADE-252. In MSHADE-396, [~Reamer] suggested some improvements, which I picked up and improved. Alas, I did not improve his PR enough, but it went unnoticed, because my other project was until today still using a private release of Maven Shade, which contained some of my other fixes which I was at the time waiting to be merged. Now they have been merged, so I switched to 3.4.1, only to notice that now some code which was shaded correctly with MSHADE-252, broke due to MSHADE-396.

Source code shading being an imperfect, heuristic search & replace process, there will never be a perfect solution, unless we create full parsers for different JVM languages, Java being but one of them. Anyway, for one of my Java projects which creates Javadoc for relocated sources, I noticed several shortcomings and improved source shading for them.

Fully qualified names are now matched correctly 
* after keywords {{extends}}, {{implements}} and {{throws}}, in addition to the keywords already matched previously,
* after any of opening curly brace, opening parenthesis, comma, equals, semicolon, closing curly brace, closing multi-line comment, if whitespace follows (without whitespace there was no problem).

All of the above were problems I met in real life when shading and relocating packages from Eclipse JDT Core for use in AspectJ.

I also adjusted the existing {{SimpleRelocatorTest}} in order to test some of these cases at least in smoke test fashion. All other tests are still green, so I can reasonably hope not to have broken anything in a serious way. Like I said, souce relocation is a best-effort thing anyway, nobody should rely on it 100%.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)