Skip to content

[MSHADE-260] shading does not rewrite Lambda deserializers#807

Open
KWojcik-sudo wants to merge 2 commits intoapache:masterfrom
KWojcik-sudo:bug/pr-mshade-260
Open

[MSHADE-260] shading does not rewrite Lambda deserializers#807
KWojcik-sudo wants to merge 2 commits intoapache:masterfrom
KWojcik-sudo:bug/pr-mshade-260

Conversation

@KWojcik-sudo
Copy link
Copy Markdown

[MSHADE-260] shading does not rewrite Lambda deserializers

Added additional relocator that is able to detect java's function definitions, inside raw strings. This is enabled only by adding tag in plugin configuration, e.g.

<relocation>
  <pattern>com.example</pattern>
  <shadedPattern>com.shaded.example</shadedPattern>
  <shadeSerializedLambda/>
</relocation>

New relocator uses regex to find function definitions inside raw strings, upon detecting such definition it proceeds to replace all references to original package.

Added new integration test to test if new behavior is really replacing original pattern in serialized lambdas.

This is my first PR so I didn't want to integrate into original code, my idea was to add this under feature flag so if there are problems with it (performance, regression, whatever) end user does not have to opt in.

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [MSHADE-XXX] - Fixes bug in ApproximateQuantiles,
    where you replace MSHADE-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the
    commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its clean verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

Added additional relocator that is able to detect java's function
definitions, inside raw strings. This is enabled only by adding tag
in plugin configuration, e.g.
<relocation>
  <pattern>com.example</pattern>
  <shadedPattern>com.shaded.example</shadedPattern>
  <shadeSerializedLambda/>
</relocation>

New relocator uses regex to find function definitions inside raw strings,
upon detecting such definition it proceeds to replace all references to original
package.

Added new integration test to test if new behavior is really replacing
original pattern in serialized lambdas.
@pzwatkmddk
Copy link
Copy Markdown

+1

@cstamas
Copy link
Copy Markdown
Member

cstamas commented Apr 20, 2026

Wanted to say immediately, strange reformatting happened. Pls mvn spotless:apply and push the reformats applied.

@KWojcik-sudo
Copy link
Copy Markdown
Author

I have ran mvn spotless:apply, by just looking at all changes I think it is good now.

@KWojcik-sudo
Copy link
Copy Markdown
Author

@cstamas Would you have a moment to have another look?

If you don't have time right now could you let me know when I should follow up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants