Skip to content

Commit

Permalink
Migrate uses of @IncompatibleModifiers and @RequiredModifiers
Browse files Browse the repository at this point in the history
to use `com.google.errorprone.annotations.Modifier`
instead of `javax.lang.model.element.Modifier`.

#2122

Follow-up to 26f1f54

PiperOrigin-RevId: 375582676
  • Loading branch information
cushon authored and Error Prone Team committed Jun 3, 2021
1 parent 9e07539 commit 1ecbd0a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Expand Up @@ -18,10 +18,6 @@

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.CLASS;
import static javax.lang.model.element.Modifier.FINAL;
import static javax.lang.model.element.Modifier.PRIVATE;
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
Expand All @@ -39,7 +35,8 @@
* protected or package-private visibility, although their effective visibility is actually "none".
*/
@Documented
@IncompatibleModifiers({PUBLIC, PRIVATE, STATIC, FINAL})
@IncompatibleModifiers(
modifier = {Modifier.PUBLIC, Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL})
@Retention(CLASS) // Parent source might not be available while compiling subclass
@Target(METHOD)
public @interface ForOverride {}
Expand Up @@ -20,7 +20,6 @@
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.lang.model.element.Modifier.FINAL;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;
Expand All @@ -42,5 +41,5 @@
*/
@Target({FIELD, PARAMETER, LOCAL_VARIABLE})
@Retention(RUNTIME)
@IncompatibleModifiers(FINAL)
@IncompatibleModifiers(modifier = {Modifier.FINAL})
public @interface Var {}
Expand Up @@ -15,9 +15,9 @@
*/
package com.google.errorprone.annotations.concurrent;

import static javax.lang.model.element.Modifier.FINAL;

import com.google.errorprone.annotations.IncompatibleModifiers;
import com.google.errorprone.annotations.Modifier;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
Expand Down Expand Up @@ -61,7 +61,7 @@
* unless you really understand this <b>and</b> you really need the performance benefits of
* introducing the data race, do not use this construct.
*/
@IncompatibleModifiers({FINAL})
@IncompatibleModifiers(modifier = {Modifier.FINAL})
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface LazyInit {}

0 comments on commit 1ecbd0a

Please sign in to comment.