Class ImmutableAnalysis
- java.lang.Object
-
- com.google.errorprone.bugpatterns.threadsafety.ImmutableAnalysis
-
public class ImmutableAnalysis extends Object
Analyzes types for deep immutability.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ImmutableAnalysis.ViolationReporter
Acceptsviolations
that are found during the analysis.
-
Constructor Summary
Constructors Constructor Description ImmutableAnalysis(BugChecker bugChecker, VisitorState state, WellKnownMutability wellKnownMutability)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThreadSafety.Violation
checkForImmutability(Optional<com.sun.source.tree.ClassTree> tree, com.google.common.collect.ImmutableSet<String> immutableTyParams, com.sun.tools.javac.code.Type.ClassType type, ImmutableAnalysis.ViolationReporter reporter)
Check that an@Immutable
-annotated class: does not declare or inherit any mutable fields, any immutable supertypes are instantiated with immutable type arguments as required by their containerOf spec, and any enclosing instances are immutable.ThreadSafety.Violation
checkInvocation(com.sun.tools.javac.code.Type methodType, com.sun.tools.javac.code.Symbol symbol)
-
-
-
Constructor Detail
-
ImmutableAnalysis
public ImmutableAnalysis(BugChecker bugChecker, VisitorState state, WellKnownMutability wellKnownMutability)
-
-
Method Detail
-
checkInvocation
public ThreadSafety.Violation checkInvocation(com.sun.tools.javac.code.Type methodType, com.sun.tools.javac.code.Symbol symbol)
-
checkForImmutability
public ThreadSafety.Violation checkForImmutability(Optional<com.sun.source.tree.ClassTree> tree, com.google.common.collect.ImmutableSet<String> immutableTyParams, com.sun.tools.javac.code.Type.ClassType type, ImmutableAnalysis.ViolationReporter reporter)
Check that an@Immutable
-annotated class:- does not declare or inherit any mutable fields,
- any immutable supertypes are instantiated with immutable type arguments as required by their containerOf spec, and
- any enclosing instances are immutable.
-
-