Open
Description
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:
@Restricted(NoExternalUse.class)
class Foo { }
And this in another module:
class Bar {
Bar() {
Foo.class.getName();
}
}
I think it is straightforward to fix this if we do consider it a bug by expanding Checker.RestrictedMethodVisitor
to override visitLdcInsn
, although I would not be surprised if plugins are inadvertently relying on the current behavior, making this a source-incompatible change.