Class NoAllocationChecker

java.lang.Object
com.google.errorprone.bugpatterns.BugChecker
com.google.errorprone.bugpatterns.NoAllocationChecker
All Implemented Interfaces:
BugChecker.AssignmentTreeMatcher, BugChecker.BinaryTreeMatcher, BugChecker.CompoundAssignmentTreeMatcher, BugChecker.EnhancedForLoopTreeMatcher, BugChecker.MethodInvocationTreeMatcher, BugChecker.MethodTreeMatcher, BugChecker.NewArrayTreeMatcher, BugChecker.NewClassTreeMatcher, BugChecker.ReturnTreeMatcher, BugChecker.TypeCastTreeMatcher, BugChecker.UnaryTreeMatcher, BugChecker.VariableTreeMatcher, Suppressible, Serializable

Checks methods annotated with @NoAllocation to ensure they really do not allocate.
  1. Calls to new are disallowed.
  2. Methods statically determined to be reachable from this method must also be annotated with @NoAllocation.
  3. Autoboxing is disallowed.
  4. String concatenation and conversions are disallowed.
  5. To make it easier to use exceptions, allocations are always allowed within a throw statement. (But not in the methods of nested classes if they are annotated with NoAllocation.)
  6. The check is done at the source level. The compiler or runtime may perform optimizations or transformations that add or remove allocations in a way not visible to this check.
See Also: