google/error-prone
Catch common Java mistakes as compile-time errors
https://skillcdn.ai/gh/google/error-proneConnect this address to your AI to use these skills. How to connect
- Unverified
- Default branch
master - Commit
72b2ac8 - License
Apache-2.0
Explore this repository
Searches the original text of skills and documents; display translations are not searched.
Folders
Documents
- AddNullMarkedToClass.mdChecks if @NullMarked annotation is applied to a Java class.docs/bugpattern/AddNullMarkedToClass.md
- AddNullMarkedToPackageInfo.mdChecks if @NullMarked annotation is applied to a package-info.java file.docs/bugpattern/AddNullMarkedToPackageInfo.md
- AddressSelection.mdAvoid APIs that convert a hostname to a single IP address:docs/bugpattern/AddressSelection.md
- AlreadyChecked.mdChecking a provably-identical condition twice can be a sign of a logic error.docs/bugpattern/AlreadyChecked.md
- AmbiguousMethodReference.mdThe following code is fine in Java 7, but poses a problem in Java 8.docs/bugpattern/AmbiguousMethodReference.md
- AndroidInjectionBeforeSuper.mdMembers injection should always be called as early as possible to avoid uninitialized @Inject members. This is also crucial to protect against bugs during configuration changes and reattached Fragmen…docs/bugpattern/AndroidInjectionBeforeSuper.md
- AnnotateFormatMethod.mdThis method passes a pair of parameters through to String#format, but the enclosing method wasn't annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malforme…docs/bugpattern/AnnotateFormatMethod.md
- AnnotationMirrorToString.mdIn recent versions of javac, AnnotationMirror#toString returns a string representation of the annotation that uses simple names. If the string is used in generated source code, it may require additio…docs/bugpattern/AnnotationMirrorToString.md
- AnnotationPosition.mdPer the [style guide][style-guide], TYPE_USE annotations should appear immediately before the type being annotated, and after any modifiers:docs/bugpattern/AnnotationPosition.md
- AnnotationValueToString.mdIn recent versions of javac, AnnotationValue#toString returns a string representation of the annotation value that uses simple names. If the string is used in generated source code, it may require ad…docs/bugpattern/AnnotationValueToString.md
- ArgumentSelectionDefectChecker.mdIf permuting the arguments of a method call means that the argument names are a better match for the parameter names than the original ordering then this might indicate that they have been accidental…docs/bugpattern/ArgumentSelectionDefectChecker.md
- ArrayEquals.mdGenerally when comparing arrays for equality, the programmer intends to check that the contents of the arrays are equal rather than that they are actually the same object. But many commonly used equa…docs/bugpattern/ArrayEquals.md
- ArrayFillIncompatibleType.mdArrays.fill(Object[], Object) is used to copy a reference into every slot of an array.docs/bugpattern/ArrayFillIncompatibleType.md
- ArrayHashCode.mdComputing a hashcode for an array is tricky. Typically you want a hashcode that depends on the value of each element in the array, but many of the common ways to do this actually return a hashcode ba…docs/bugpattern/ArrayHashCode.md
- ArrayRecordComponent.mdThere are two main problems with having a component of a record be an array.docs/bugpattern/ArrayRecordComponent.md
- ArrayToString.mdThe toString method on an array will print its identity, such as [I@4488aabb. This is almost never needed. Use Arrays.toString to print a human-readable summary.docs/bugpattern/ArrayToString.md
- ArraysAsListPrimitiveArray.mdArrays.asList does not autobox primitive arrays, as one might expect. If you intended to autobox the primitive array, use an asList method from Guava that does autobox. If you intended to create a si…docs/bugpattern/ArraysAsListPrimitiveArray.md
- AssertEqualsArgumentOrderChecker.mdJUnit's assertEquals (and similar) are defined to take the expected value first and the actual value second. Getting these the wrong way round will cause a confusing error message if the assertion fa…docs/bugpattern/AssertEqualsArgumentOrderChecker.md
- AssertFalse.mdJava assertions do not necessarily execute at runtime; they may be enabled and disabled depending on which options are passed to the JVM invocation. An assert false statement may be intended to ensur…docs/bugpattern/AssertFalse.md
- AssertThrowsMinimizer.mdPrefer to minimize the amount of logic in a lambda passed to assertThrows.docs/bugpattern/AssertThrowsMinimizer.md
- AssertThrowsMultipleStatements.mdIf the body of the lambda passed to assertThrows contains multiple statements, execution of the lambda will stop at the first statement that throws an exception and all subsequent statements will be…docs/bugpattern/AssertThrowsMultipleStatements.md
- AssertionFailureIgnored.mdJUnit's fail() and assert methods throw an AssertionError, so using the try/fail/catch pattern to test for AssertionError (or any of its super-types) is incorrect. The following example will never fa…docs/bugpattern/AssertionFailureIgnored.md
- AssignmentExpression.mdUsing the result of an assignment expression can be quite unclear, except for simple cases where the result is used to initialise another variable, such as x = y = 0.docs/bugpattern/AssignmentExpression.md
- AssistedInjectAndInjectOnConstructors.mdMixing @Inject and @AssistedInject leads to confusing code and the documentation specifies not to do it. See https://google.github.io/guice/api-docs/latest/javadoc/com/google/inject/assistedinject/As…docs/bugpattern/AssistedInjectAndInjectOnConstructors.md
- AssistedInjectAndInjectOnSameConstructor.mdUsing @AssistedInject and @Inject on the same constructor is a runtimeerror in Guice.docs/bugpattern/AssistedInjectAndInjectOnSameConstructor.md
- AsyncCallableReturnsNull.mdMethods like Futures.whenAllComplete(...).callAsync(...) will throw a NullPointerException if the provided AsyncCallable returns a null Future. To produce a Future with an output of null, instead ret…docs/bugpattern/AsyncCallableReturnsNull.md
- AsyncFunctionReturnsNull.mdMethods like Futures.transformAsync and Futures.catchingAsync will throw a NullPointerException if the provided AsyncFunction returns a null Future. To produce a Future with an output of null, instea…docs/bugpattern/AsyncFunctionReturnsNull.md
- AttemptedNegativeZero.mdBecause 0 is an integer constant, -0 is an integer, too. Integers have no concept of "negative zero," so it is the same as plain 0.docs/bugpattern/AttemptedNegativeZero.md
- AutoFactoryAtInject.md@AutoFactory classes should not be @Inject-ed, inject the generated factory instead. Classes that are annotated with @AutoFactory are intended to be constructed by invoking the factory method on the…docs/bugpattern/AutoFactoryAtInject.md
- AutoValueBoxedValues.mdAutoValue classes reject null values, unless the property is annotated with @Nullable. For this reason, the usage of boxed primitives (e.g. Long) is discouraged, except when annotated as @Nullable. O…docs/bugpattern/AutoValueBoxedValues.md
- AutoValueConstructorOrderChecker.mdAutoValue constructors are synthesized with their parameters in the same order as the abstract accessor methods. Calls to the constructor need to match this ordering.docs/bugpattern/AutoValueConstructorOrderChecker.md
- AutoValueFinalMethods.mdConsider that other developers will try to read and understand your value class while looking only at your hand-written class, not the actual (generated) implementation class. If you mark your concre…docs/bugpattern/AutoValueFinalMethods.md
- AutoValueImmutableFields.mdAutoValue instances should be deeply immutable. Therefore, we recommend using immutable types for fields. E.g., use ImmutableMap instead of Map, ImmutableSet instead of Set, etc.docs/bugpattern/AutoValueImmutableFields.md
- AvoidCommonTypeNames.mdClass names from java.lang should never be reused. From Java Puzzlers:docs/bugpattern/AvoidCommonTypeNames.md
- Method ParametersDon't use object arrays as method parameters:docs/bugpattern/AvoidObjectArrays.md
- BadAnnotationImplementation.mdImplementations of [Annotation] must override equals and hashCode to match the expectations defined in that interface, to ensure compatibility with the annotation instances that source annotations cr…docs/bugpattern/BadAnnotationImplementation.md
- BadComparable.mdA narrowing integral conversion can cause a sign flip, since it simply discards all but the n lowest order bits, where n is the number of bits used to represent the target type (JLS 5.1.3). In a comp…docs/bugpattern/BadComparable.md
- BadInstanceof.mdFlags instanceof checks where the expression can be determined to be a supertype of the type it is compared to.docs/bugpattern/BadInstanceof.md
- BadShiftAmount.mdFor shift operations on int types, only the five lowest-order bits of the shift amount are used as the shift distance. This means that shift amounts that are not in the range 0 to 31, inclusive, are…docs/bugpattern/BadShiftAmount.md
- BanClassLoader.mdThe Java class loading APIs can lead to remote code execution vulnerabilities if not used carefully. Interpreting potentially untrusted input as bytecode can give an attacker control of the applicati…docs/bugpattern/BanClassLoader.md
- BanJNDI.mdJNDI ("Java Naming and Directory Interface") is a Java JDK API representing an abstract directory service such as DNS, a file system or LDAP. Critically, JNDI allows Java objects to be serialized and…docs/bugpattern/BanJNDI.md
- BanSerializableRead.mdThe Java Serializable API is very powerful, and very dangerous. Any consumption of a serialized object that cannot be explicitly trusted will likely result in a critical remote code execution bug tha…docs/bugpattern/BanSerializableRead.md
- BigDecimalEquals.mdBigDecimal's equals method compares the scale of the representation as well as the numeric value, which may not be expected.docs/bugpattern/BigDecimalEquals.md
- BigDecimalLiteralDouble.mdBigDecimal's double can lose precision in surprising ways.docs/bugpattern/BigDecimalLiteralDouble.md