Mailing List Archive

SuppressForbidden for anonymous classes
Hello everyone.
We use Lucene's nice forbidden api check tool. I wonder if anonymous
classes could be supressed using supress annotation. For example:

httpService = new HttpService(...) {
@Override
@SuppressForbidden(reason = "Sun's HTTP server usage")
protected HttpHandler createHandler(...) {
return new HttpHandler(...) {
@Override
protected void handle(HttpExchange he) {
*...*
}
};
}
};

when I run check for this code I get:
ERROR: Forbidden interface use: com.sun.net.httpserver.HttpHandler
[non-portable or internal runtime class]

Since createHandler method already has supress annotation, I was expecting
it would be supressed. Any way to supress this without creating separate
class?

Thanks in advance.

Elbek.
Re: SuppressForbidden for anonymous classes [ In reply to ]
Hi
forbiddenapis itself is an independent project, so maybe the github repo
for it is the right place for you (since it seems the code is not related
to Lucene)?


2019?7?17?(?) 2:05 elbek kamoliddinov <elbek.dev@gmail.com>:

> Hello everyone.
> We use Lucene's nice forbidden api check tool. I wonder if anonymous
> classes could be supressed using supress annotation. For example:
>
> httpService = new HttpService(...) {
> @Override
> @SuppressForbidden(reason = "Sun's HTTP server usage")
> protected HttpHandler createHandler(...) {
> return new HttpHandler(...) {
> @Override
> protected void handle(HttpExchange he) {
> *...*
> }
> };
> }
> };
>
> when I run check for this code I get:
> ERROR: Forbidden interface use: com.sun.net.httpserver.HttpHandler
> [non-portable or internal runtime class]
>
> Since createHandler method already has supress annotation, I was expecting
> it would be supressed. Any way to supress this without creating separate
> class?
>
> Thanks in advance.
>
> Elbek.
>