Class RecordAccessorInCompactConstructor

java.lang.Object
com.google.errorprone.bugpatterns.BugChecker
com.google.errorprone.bugpatterns.RecordAccessorInCompactConstructor
All Implemented Interfaces:
BugChecker.MethodInvocationTreeMatcher, Suppressible, Serializable

public final class RecordAccessorInCompactConstructor extends BugChecker implements BugChecker.MethodInvocationTreeMatcher
Detects when record accessors read uninitialized fields inside a compact constructor. Use the component parameter instead.

Example:

record R(int x) {
  public R {
    int y = x(); // BUG: use `x` instead
  }
}
See Also: