RFR: 8316971: Add Lint warning for restricted method calls [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Sep 29 08:17:06 UTC 2023


On Thu, 28 Sep 2023 15:56:36 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> question shouldn't the new Restricted annotation be annotated with the @PreviewFeature annotation? it depends on a preview feature

The Restricted annotation is an internal annotation only. So there is no value in annotating it with `@PreviewFeature`. Also, note that there is a PR already filed which, when integrated, will move the FFM API out of preview [1].

[1] - https://git.openjdk.org/jdk/pull/15103

> test/langtools/tools/javac/RestrictedMethods.java line 34:
> 
>> 32:         }
>> 33:     }
>> 34: }
> 
> shouldn't this test include a case using method references? For example:
> 
>     void m(MemorySegment m) {
>         foo(m::reinterpret);
>     }
> 
>     <R> void foo(LongFunction<R> f) {}
> 
> 
> we could also clarify in the CSR that the warning will also be issued for method references where the identifier after `::` is a restricted method

Good point. Will do.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15964#issuecomment-1740490726
PR Review Comment: https://git.openjdk.org/jdk/pull/15964#discussion_r1341052841


More information about the build-dev mailing list