-
Notifications
You must be signed in to change notification settings - Fork 19
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
Restrictions do not apply to class literals, instanceof
, casts, or method references
#166
Comments
Given how we use it in core, e.g. freely renaming/refactoring/removing things, this seems like a net positive change, +1 from me. (Compare restricting generated |
I am pretty sure I have relied on the current behavior. |
For what it's worth, looking a little deeper, restrictions also don't apply when casting
Method references seem distinct and for those I don't really see any reason to allow them. It is a bit awkward to work with them though using ASM.
Are you just noting that as far as concern about potential incompatibilities, or do you mean that you think we should preserve the current behavior? |
instanceof
, casts, or method references
I don't think we should be making breaking changes without proactively identifying and adapting consumers. |
I am not too concerned since this is only a build-time error and you can always suppress this tool on a per-class level. |
To be absolutely clear, I intend to block this change unless consumers are proactively identified and adapted. |
I am not sure if this is intended, but restrictions do not apply to class literals (
XYZ.class
) (EDIT: and a few other cases, see #166 (comment)). For example,access-modifier-checker
does not fail given this in one module:And this in another module:
I think it is straightforward to fix this if we do consider it a bug by expanding
Checker.RestrictedMethodVisitor
to overridevisitLdcInsn
, although I would not be surprised if plugins are inadvertently relying on the current behavior, making this a source-incompatible change.The text was updated successfully, but these errors were encountered: