Flags instances of non-API types from being accepted or returned in public APIs.
int[], Integer[], double[], Double[],
long[], Long[]). Prefer ImmutableIntArray, ImmutableDoubleArray, or
ImmutableLongArray instead.
int... rest) are not flagged, as
var-args is idiomatic Java for parameter lists.ArrayList, LinkedList, HashSet, LinkedHashSet, TreeSet,
HashMap, LinkedHashMap, TreeMap). Prefer interface types (List,
Set, Map).ImmutableCollection,
ImmutableList, ImmutableSet, or ImmutableMap as method parameters.
Prefer accepting Collection, List, Set, Map, or Iterable for
parameter generality.java.util.Optional or
com.google.common.base.Optional as method parameters. Prefer method
overloading: creating one signature with the parameter and one without (or
use @Nullable parameters).com.google.common.base.Pair: Passing Pair across API boundaries.
Define a well-named class or record instead.Iterator (prefer Stream or collecting
to an ImmutableList/ImmutableSet) or accepting Stream as a parameter
(prefer Iterable or Collection).
Iterators limits caller optionscom.google.protobuf.Duration, Timestamp, or
com.google.type.* types across public APIs instead of standard
java.time.* types (Duration, Instant, LocalDate, etc.).FluentLogger or GoogleLogger instances
across method boundaries; this can break standard per-class logger
initialization patterns.List rather than ArrayList) to give callers
flexibility in implementation details.ImmutableIntArray,
ImmutableDoubleArray, and ImmutableLongArray provide immutable, safe,
and efficient alternatives.Suppress false positives by adding the suppression annotation @SuppressWarnings("NonApiType") to the enclosing element.