ZoneId.of("Z")
should be replaced with ZoneOffset.UTC
JAVA-W1085Avoid calling ZoneId.of()
to get the UTC timezone offset, and instead use ZoneOffset.UTC
directly.
A boxed primitive is created just to call its compareTo
method. It's more efficient to use the associated static compare method (for double and float since Java 1.4, for other primitive types since Java 7) which works on primitives directly.
Object.equals()
JAVA-W1080Comparing two primitive values with Objects.equals()
can be inefficient, since both primitives will have to be boxed before being compared.
This JavaDoc comment appears to be malformed. Such comments may raise errors or cause crashes when passed to a JavaDoc generation tool.
Rewrite the comment to use correct syntax.
Duration.withNanos()
may not produce correct results JAVA-E1087Using Duration.withNanos()
may produce wrong results, because it will only set the value of the nanoseconds field of
the duration, and will not correctly adjust for any overflow.
This method/constructor has a parameter tag with no description.
Consider adding a description to the tag. If the parameter's name is clear enough, consider removing the parameter tag entirely.
Empty JavaDoc tags are meaningless, and may even cause tools that consume JavaDoc comments to crash.
Always add an explanation when writing JavaDoc tags.
ZoneId.of()
should be passed a valid timezone identifier JAVA-E1092java.time.ZoneId.of()
should not be passed invalid time zone identifier strings, as this will cause exceptions to be thrown at runtime.
The Java analyzer has detected a narrowing cast of a subtraction in a comparison method that may flip the sign of the result.
The constructor of an abstract class can never be called directly by the dependency injection framework, meaning any injection annotations applied to it will not be considered. Remove the annotation.
This code stores a reference to an externally mutable object into a static field. If unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. It may be possible for external code to inspect or change the value of the static field by holding a reference to it after passing it to this class.
If a method of a superclass has one particular nullability annotation applied to it, avoid marking any overrides in subtypes with a different nullability annotation.
Make sure to use the same annotation present on the super method as much as possible.
setUp
but does not invoke super.setUp()
JAVA-S0337This class inherits from JUnit's TestCase
class and implements the setUp()
method. The setUp
method should call super.setUp()
, but doesn't.
Future
s should not be ignored JAVA-W1087Always use the value returned by a method with return type Future<T>
.
Unused imports should be removed from all source files.
A public static method returns a reference to an array that is part of the static state of the class. Any code that calls this method can freely modify the underlying array. This is dangerous because it could allow external code to modify the behavior of the class by changing data asssumed to be invariant.
Our analysis shows that this object is useless. It's created and modified, but its value never goes outside the method or produces any side effect. Either there is a mistake and the object was intended to be used or it can be removed.
When a catch
clause is empty, it essentially ignores any occurrences of the particular exception it handles. This could allow critical bugs to go undiagnosed because any relevant exceptions indicative of a bug would be discarded within this catch
block.
This method or field is or uses a Map
or Set
of URL
s. Since both the equals
and hashCode
method of URL
perform domain name resolution, this can result in a big performance hit.
@OverridingMethodsMustInvokeSuper
annotation in super method is ignored by overriding method JAVA-S0001The super method is annotated with @OverridingMethodsMustInvokeSuper
, but the overriding method isn't calling the super method.