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

Improve record obfuscation #119

Open
thomasbehr opened this issue Mar 1, 2022 · 0 comments
Open

Improve record obfuscation #119

thomasbehr opened this issue Mar 1, 2022 · 0 comments
Labels
difficulty:medium Some knowledge required.

Comments

@thomasbehr
Copy link
Member

thomasbehr commented Mar 1, 2022

When compiling a record, the java compiler inserts bootstrap methods that handle equals/hashCode/toString. These bootstrap methods are passed a descriptor string identifying the record's components by name.
yGuard replaces that descriptor string for the bootstrap method invocation with a remapped descriptor string. The value of the old descriptor string is kept in the constant pool to prevent breaking string literals in code that have the same value as the descriptor, e.g. suppose

record MyRecord(int value) {
  String getName() {
   return "value";
  }
}

However, for most cases the descriptor string will be unique and should be removed to ensure all traces of the original component names are gone. This requires counting the references to string literals in code blocks.

@Fohlen Fohlen added the difficulty:medium Some knowledge required. label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty:medium Some knowledge required.
Projects
None yet
Development

No branches or pull requests

2 participants