Uploaded image for project: 'Maven Shade Plugin'
  1. Maven Shade Plugin
  2. MSHADE-443

Fix problems with shadeSourcesContent

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.3.0, 3.4.1
    • 3.5.0
    • None

    Description

      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%.

      Attachments

        Issue Links

          Activity

            People

              cstamas Tamas Cservenak
              kriegaex Alexander Kriegisch
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: