Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Guava's EventBus marked unstable in IntelliJ 2018.2?

A new inspection was added in IntelliJ 2018.2 which should warn from unstable APIs: https://youtrack.jetbrains.com/issue/IDEA-159541.

This warning shows up for the Guava's EventBus. Why is this an unstable API?

like image 507
20knots Avatar asked Aug 20 '18 08:08

20knots


4 Answers

Because the EventBus class is annotated as @Beta.

You'd have to ask the Guava project maintainers why a class that exists for 16 versions of Guava is still Beta, but it still is.

like image 159
JB Nizet Avatar answered Nov 02 '22 20:11

JB Nizet


Besides @JB Nizet's answer that perfectly explains why IntelliJ flags this error, you may also want to suppress it globally but only for the Google Beta annotations.

Just go to Settings -> Editor -> Inspections -> JVM languages as per the picture below and, if you feel like it, delete the com.google.common.anotations.Beta.

how to disable IntelliJ's Google Beta annotation

like image 45
Frankie Avatar answered Nov 02 '22 21:11

Frankie


You can also ask IntelliJ to suppress the warning for the definition of your @Beta annotated class as follows:

@SuppressWarnings("UnstableApiUsage")
static RateLimiter API_RATE_LIMITER = RateLimiter.create(8);

This properly deals with the warning in a particular case when you're okay with using the class anyway (and don't run into issues).

like image 6
BullyWiiPlaza Avatar answered Nov 02 '22 22:11

BullyWiiPlaza


EventBus class is marked with the @com.google.common.annotations.Beta annotation. So I think the inspection is triggering on that. See: https://google.github.io/guava/releases/22.0/api/docs/com/google/common/eventbus/EventBus.html

like image 1
Hiery Nomus Avatar answered Nov 02 '22 22:11

Hiery Nomus