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

Allow ILaunchPluginService to filter handling classes based on constant pool #122

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

embeddedt
Copy link

This PR introduces a new constantsFilter method on ILaunchPluginService. The intent of this is to allow transformers like RuntimeDistCleaner to be implemented more efficiently, by skipping parsing of the class file if the constant pool does not contain a given byte sequence. This should work because if the Dist annotation were to be present in the class, it would have to be in the constant pool.

Using this feature is optional and existing ILaunchPluginService implementations will continue to work as before without changes.

case INT:
case FLOAT:
case NAME_TYPE:
case INDY:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot CONDY.

continue;
}
// Filter out classes that don't match the constants filter
if (!ClassConstantPoolParser.constantPoolMatches(plugin.constantsFilter(className, reason), inputClass)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a way to opt-out of this behavior in case it causes issues (for example due to forgetting to update the constant pool parser). Probably via an env variable or ML arg.

@embeddedt embeddedt marked this pull request as draft January 15, 2024 20:47
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.

2 participants