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

Add test for unused class to shrinker-test #2455

Merged

Conversation

Marcono1234
Copy link
Collaborator

@Marcono1234 Marcono1234 commented Jul 29, 2023

Purpose

Extends tests of shrinker-test for unused classes

Description

Based on #2448

Adds a test case for a class with a field annotated with @SerializedName, but which is not actually used anywhere. The default Gson ProGuard rules should allow this class to be removed.

Note: This actually works as intended for R8, but not for ProGuard which keeps the class. Not sure if it is worth investigating that further at the moment.

Checklist

  • New code follows the Google Java Style Guide
  • If necessary, new public API validates arguments, for example rejects null
  • New public API has Javadoc
    • Javadoc uses @since $next-version$
      ($next-version$ is a special placeholder which is automatically replaced during release)
  • If necessary, new unit tests have been added
    • Assertions in unit tests use Truth, see existing tests
    • No JUnit 3 features are used (such as extending class TestCase)
    • If this pull request fixes a bug, a new test was added for a situation which failed previously and is now fixed
  • mvn clean verify javadoc:jar passes without errors

@Marcono1234
Copy link
Collaborator Author

@eamonnmcmanus, just to avoid any confusion, this does not address the open points I mentioned in #2448 regarding updating comments and adding a separate test for a class without no-args constructor.

This here adds a different test case, and I simply decided to base it on #2448 to reduce merge conflicts later.

@Marcono1234 Marcono1234 force-pushed the marcono1234/shrinker-test-unused-class branch from 3abbfcf to 479ceb9 Compare August 22, 2023 21:17
@Marcono1234 Marcono1234 marked this pull request as ready for review August 22, 2023 21:18
@eamonnmcmanus
Copy link
Member

Thanks, still looks good!

@eamonnmcmanus eamonnmcmanus merged commit 393db09 into google:main Aug 22, 2023
9 checks passed
@Marcono1234 Marcono1234 deleted the marcono1234/shrinker-test-unused-class branch August 23, 2023 09:06
@Marcono1234 Marcono1234 added the proguard-r8 Issues relating to the use of ProGuard and/or R8, such as problems due to obfuscation label Mar 29, 2024
tibor-universe pushed a commit to getuniverse/gson that referenced this pull request Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proguard-r8 Issues relating to the use of ProGuard and/or R8, such as problems due to obfuscation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants