Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not change package when non-recursive #4447

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

timtebeek
Copy link
Contributor

Add unit test as reported via Slack by @BhavanaPidapa; update precondition to evaluate recursive boolean for package declaration too.

@timtebeek timtebeek added the bug Something isn't working label Aug 26, 2024
@timtebeek timtebeek requested a review from cjobinabo August 26, 2024 21:53
@timtebeek timtebeek self-assigned this Aug 26, 2024
anandfresh

This comment was marked as outdated.

@BhavanaPidapa
Copy link

BhavanaPidapa commented Aug 27, 2024

Hey Tim,

Below is the test case where changes to com.sun.net.ssl.internal.* are not expected. Please refer to the attached screenshot.

@Test
void excludePackageTest() {
    //language=java
    rewriteRun(
      spec -> spec.recipe(new ChangePackage(
        "com.sun.net.ssl",
        "javax.net.ssl",
        false
      )),
      java(
        """
          package com.test;
          import com.sun.net.ssl.internal.*;
          import com.sun.net.ssl.HostnameVerifier;
          class Test {
           public com.sun.net.ssl.HostnameVerifier hv;
              void exampleMethod() {
              }
          }
          """,
        """
          package com.test;
          import com.sun.net.ssl.internal.*;
          import javax.net.ssl.HostnameVerifier;
          class Test {
           public javax.net.ssl.HostnameVerifier hv;
              void exampleMethod() {
              }
          }
          """
      )
    );
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants