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

Check null for the packages field of ClassLoader #252

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IssueFloppa
Copy link

allows the mod to run under modern java irrespective of method

Copy link

@Imran-imtiaz48 Imran-imtiaz48 left a comment

Choose a reason for hiding this comment

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

The recent update to the removePackageField method introduces a notable improvement in handling reflection for accessing the packages field of ClassLoader. The addition of a null check for packagesField ensures that the method gracefully handles scenarios where reflection access might be restricted in newer Java versions, thereby enhancing compatibility and robustness. This change also adheres to best practices by directly retrieving the packagesField only once, reducing redundant reflection operations. The code remains clear and maintainable, though it could benefit from more specific exception handling or logging to provide better insight into potential issues during runtime. Overall, this update is a solid enhancement to the reflection handling mechanism.

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