100 java mistakes and how to avoid them - index Page
100 Java Mistakes and How to Avoid Them - Index
Return to 100 Java Mistakes and How to Avoid Them, Effective Java, 100 Java Mistakes and How to Avoid Them - Table of Contents
index
SYMBOLS
–2,147,483,648 (Integer.MIN_VALUE)[2,147,483,648 (Integer.MIN_VALUE], 2nd, 3rd, 4th, 5th
–0.0 (negative zero)[0.0 (negative zero)], 2nd
& (bitwise and) operator
@OverridingMethodsMustInvokeSuper annotation[OverridingMethodsMustInvokeSuper annotation]
]
@MustBeInvokedByOverriders annotation[MustBeInvokedByOverriders annotation]
2,147,483,647 (Integer.MAX_VALUE) , 2nd, 3rd
@RegEx annotation[RegEx annotation]
@Deprecated annotation[Deprecated annotation]
&= operator
// fallthrough comment
@Nested annotation[Nested annotation]
\ method[clinit method]
32,767 (Short.MAX_VALUE)
@Range annotation[Range annotation]
–128 (Byte.MIN_VALUE)[128 (Byte.MIN_VALUE)], 2nd, 3rd, 4th
@GTENegativeOne annotation[GTENegativeOne annotation]
@NonNullByDefault annotation[NonNullByDefault annotation]
@SuppressWarnings annotation[SuppressWarnings annotation], 2nd
@CheckReturnValue annotation[CheckReturnValue annotation], 2nd
@FormatMethod annotation[FormatMethod annotation]
@Nonnegative annotation[Nonnegative annotation]
@Nullable annotation[Nullable annotation], 2nd, 3rd
%b specifier
% operation
@NonNegative annotation[NonNegative annotation]
@Unmodifiable annotation[Unmodifiable annotation], 2nd
@SideEffectFree annotation[SideEffectFree annotation]
@Contract annotation[Contract annotation]
127 (Byte.MAX_VALUE), 2nd, 3rd, 4th
-ea (enable assertions) command-line option[ea (enable assertions) command-line option]
@Test annotation[Test annotation], 2nd
0 (zero)
failing to return when comparing equal objects, 2nd
4.9 × 10–324 (Double.MIN_VALUE)[4.9]
@FormatString annotation[FormatString annotation]
@IntRange annotation[IntRange annotation]
\ entry[localInspection]
+ operator
-c javap tool command line option[c javap tool command line option]
AAA (ARRANGE, ACT, ASSERT) PATTERN
AAA (Arrange, Act, Assert) pattern
ABS() METHOD (MATH CLASS)
abs() method (Math class), 2nd, 3rd
ACT PART
Act part
ADD() METHOD (COLLECTION INTERFACE)
add() method (Collection interface), 2nd, 3rd, 4th, 5th
ADDALL() METHOD (COLLECTION INTERFACE)
addAll() method (Collection interface)
ADDEXACT() METHOD (MATH CLASS)
addExact() method (Math class)
ADDITION
addition, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th
AND() METHOD (BITSET CLASS)
and() method (BitSet class)
ANDROID ANNOTATIONS
Android annotations
ANNOTATION, CALLING GETCLASS() ON
annotation, calling getClass() on
ANNOTATIONTYPE() METHOD (ANNOTATION INTERFACE)
annotationType() method (Annotation interface)
ANTISYMMETRY
antisymmetry
ANYMATCH() METHOD (STREAM INTERFACE)
anyMatch() method (Stream interface)
APACHE COMMONS LANG
Apache Commons Lang, 2nd
APPENDCODEPOINT() METHOD (STRINGBUILDER CLASS)
appendCodePoint() method (StringBuilder class)
ARITHMETIC OPERATORS
arithmetic operators
addition, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th
division, 2nd, 3rd, 4th, 5th, 6th, 7th
multiplication, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th
subtraction, 2nd, 3rd, 4th, 5th, 6th, 7th
unary minus
ARITHMETICEXCEPTION
ArithmeticException, 2nd, 3rd, 4th, 5th
ARRANGE PART
Arrange part
ARRAY
array, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th
binary search bug
hash code of, 2nd
index out of bounds, 2nd
using in loops, 2nd
variable arity parameter, 2nd
ARRAYDEQUE CLASS
ArrayDeque class, 2nd, 3rd
ARRAYINDEXOUTOFBOUNDSEXCEPTION
ArrayIndexOutOfBoundsException
ARRAYLIST CLASS
ArrayList class, 2nd
ARRAYS UTILITY CLASS
Arrays utility class
asList() method, 2nd
binarySearch() method
deepEquals() method
deepHashCode() method
equals() method
hashCode() method
setAll() method, 2nd, 3rd
sort() method, 2nd
ASLIST() METHOD (ARRAYS CLASS)
asList() method (Arrays class), 2nd, 3rd
ASSERT PART
Assert part
ASSERT PREFIX
assert prefix
ASSERT STATEMENT
assert statement
ASSERT STATEMENT WITH SIDE EFFECTS INSPECTION
assert Statement with Side Effects inspection
ASSERTEQUALS() METHOD
assertEquals() method, 2nd
ASSERTION IS SUPPRESSED BY CATCH INSPECTION
Assertion Is Suppressed by catch inspection
ASSERTNOTEQUALS() METHOD
assertNotEquals() method
ASSERTNOTNULL() METHOD
assertNotNull() method, 2nd, 3rd
ASSERTTHAT() METHOD
assertThat() method
ASSERTTHROWS() METHOD
assertThrows() method, 2nd, 3rd
ASSIGNMENT TO FOR LOOP PARAMETER INSPECTION
Assignment to for Loop Parameter inspection
ASSIGNMENT TO STATIC FIELD FROM INSTANCE CONTEXT INSPECTION
Assignment to Static Field from Instance Context inspection
ASSUMPTIONS, WORLD IS STABLE
assumptions, world is stable, 2nd
ATOMICINTEGER CLASS
AtomicInteger class
AUTOMATED TESTING
automated testing, 2nd
AVAILABLEPROCESSORS() METHOD (RUNTIME CLASS)
availableProcessors() method (Runtime class)
BIFUNCTION INTERFACE
BiFunction interface
BIGDECIMAL CLASS
BigDecimal class, 2nd
comparing with different scales
stripTrailingZeros() method
BIGINTEGER CLASS
BigInteger class, 2nd, 3rd
BINARY SHIFT
binary shift, 2nd, 3rd, 4th, 5th, 6th
left
right, 2nd
BINARYSEARCH() METHOD (ARRAYS CLASS)
binarySearch() method (Arrays class)
BITSET CLASS
BitSet class, 2nd, 3rd
BITWISE OPERATORS
bitwise operators, 2nd, 3rd, 4th
BOOLEAN CLASS
Boolean class
FALSE constant
TRUE constant
compare() method
getBoolean() method
parseBoolean() method
BOOLEAN TYPE
Boolean type, 2nd
BOOLEAN VALUE
boolean value, 2nd, 3rd
comparison
conversion from string, 2nd
BOXED BOOLEAN
boxed Boolean, 2nd
BOXED NUMBERS
boxed numbers, 2nd, 3rd, 4th, 5th, 6th
cache
BREAK STATEMENT
break statement
BREAKITERATOR CLASS
BreakIterator class
BUFFEREDREADER.READLINE() METHOD
BufferedReader.readLine() method, 2nd
BYTE TYPE
byte type
array of
cast to
negative values, 2nd
widening, 2nd
BYTEARRAYOUTPUTSTREAM CLASS
ByteArrayOutputStream class
BYTE[] ARRAY
byte[] array
CALENDAR CLASS
Calendar class
CALL TO STRING.TOUPPERCASE() OR TOLOWERCASE() WITHOUT A LOCALE INSPECTION
Call to String.toUpperCase() or toLowerCase() Without a Locale inspection
CASE CONVERSIONS
case conversions, 2nd
CAST CONFLICTS WITH INSTANCEOF INSPECTION
Cast Conflicts With Instanceof inspection
CHAR TYPE
char type
compound assignment
passing to StringBuilder constructor
widening, 2nd, 3rd
CHARACTER.ISDIGIT() METHOD
Character.isDigit() method, 2nd
CHARAT() METHOD (STRING CLASS)
charAt() method (String class), 2nd, 3rd
CHARSEQUENCE INTERFACE
CharSequence interface
CHECKER FRAMEWORK ANNOTATIONS
Checker Framework annotations
CHECKINDEX() METHOD (OBJECTS CLASS)
checkIndex() method (Objects class)
CLAMP() METHOD (MATH CLASS)
clamp() method (Math class)
CLASS CLASS
Class class
getClass() method
getClassLoader() method
getMethod() method, 2nd
isInstance() method, 2nd
CLONEABLE INTERFACE
Cloneable interface
CODE QUALITY
code quality
code assertions
code review
code style, 2nd
static analysis
CODEPOINTAT() METHOD (STRING CLASS)
codePointAt() method (String class)
CODEPOINTCOUNT() METHOD (STRING CLASS)
codePointCount() method (String class)
CODEQL
CodeQL
COLLECT() METHOD (STREAM CLASS)
collect() method (Stream class)
COLLECTION INTERFACE
Collection interface
add() method, 2nd, 3rd, 4th, 5th
addAll() method, 2nd
contains() method, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th
containsAll() method
forEach() method, 2nd
isEmpty() method, 2nd
parallelStream() method
remove(Object) method
removeAll() method
removeIf() method, 2nd
retainAll() method
stream() method
COLLECTIONS
collections
COLLECTIONS UTILITY CLASS
Collections utility class
checkedList() method
checkedMap() method
max() method
min() method, 2nd
shuffle() method
unmodifiableCollection() method
unmodifiableList() method, 2nd
unmodifiableSet() method
COLLECTORS CLASS
Collectors class
groupingBy() method
maxBy() method
minBy() method
partitioningBy() method
toList() method, 2nd
toMap() method
toSet() method
toUnmodifiableList() method
COM.GOOGLE.ERRORPRONE.BUGPATTERNS.BUGCHECKER ABSTRACT CLASS
com.google.errorprone.bugpatterns.BugChecker abstract class
COM.GOOGLE.ERRORPRONE\
com.google.errorprone\
error_prone_check_api artifact
COMPARABLE INTERFACE
Comparable interface
compareTo() method, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th
COMPARATOR INTERFACE
Comparator interface
compare() method
comparing() method
comparingDouble() method
nullsFirst() method, 2nd
nullsLast() method, 2nd
thenComparing() method
COMPARATORS
comparators
returning random numbers from
COMPARE() METHOD
compare() method
of Boolean class
of Comparator interface, 2nd, 3rd
of Double class
COMPARE() METHOD CAN BE USED TO COMPARE NUMBERS INSPECTION
compare() Method Can Be Used to Compare Numbers inspection
COMPARETO() METHOD (COMPARABLE INTERFACE)
compareTo() method (Comparable interface), 2nd, 3rd, 4th, 5th, 6th, 7th, 8th
COMPARINGDOUBLE() METHOD (COMPARATOR INTERFACE)
comparingDouble() method (Comparator interface)
COMPARISON METHODS
comparison methods
malformed implementation, 2nd
COMPARISON TO DOUBLE.NAN OR FLOAT.NAN INSPECTION
Comparison to Double.NaN or Float.NaN inspection
COMPARISONCHAIN CLASS
ComparisonChain class
COMPONENT.HANDLEEVENT() METHOD
Component.handleEvent() method
COMPUTE() METHOD (MAP INTERFACE)
compute() method (Map interface)
COMPUTEIFABSENT() METHOD (MAP INTERFACE)
computeIfAbsent() method (Map interface), 2nd, 3rd, 4th
COMPUTEIFPRESENT() METHOD (MAP INTERFACE)
computeIfPresent() method (Map interface)
CONCATENATION
concatenation, 2nd
CONCURRENTHASHMAP CLASS
ConcurrentHashMap class
CONCURRENTLINKEDDEQUE CLASS
ConcurrentLinkedDeque class
CONCURRENTLINKEDQUEUE CLASS
ConcurrentLinkedQueue class
CONCURRENTMODIFICATIONEXCEPTION
ConcurrentModificationException
CONDITIONS
conditions
dominated by previous condition, 2nd
CONFUSING ARGUMENT TO VARARGS METHOD INSPECTION
Confusing Argument to Varargs Method inspection
CONSTANT VALUES INSPECTION
Constant Values inspection, 2nd, 3rd, 4th
CONTAINS() METHOD (COLLECTION INTERFACE)
contains() method (Collection interface), 2nd, 3rd, 4th, 5th, 6th
CONTAINSKEY() METHOD (MAP INTERFACE)
containsKey() method (Map interface)
COPYOF() METHOD
copyOf() method
COUNT() METHOD (STREAM INTERFACE)
count() method (Stream interface)
COUNTDOWN() METHOD (COUNTDOWNLATCH CLASS)
countDown() method (CountDownLatch class)
COUNTDOWNLATCH CLASS
CountDownLatch class
COVERITY
Coverity
CREATENEWFILE() METHOD (FILE CLASS)
createNewFile() method (File class)
CRYPTOGRAPHIC KEYS
cryptographic keys
DATA STRUCTURES, NON-ATOMIC ACCESS
data structures, non-atomic access
DATE CLASS
Date class, 2nd
DATETIMEFORMATTER CLASS
DateTimeFormatter class
ofPattern() method
DECIMALFORMAT CLASS
DecimalFormat class
DEFAULT LOCALE
default locale
in String.format() method, 2nd
in case conversions, 2nd
DIVISION
division, 2nd, 3rd, 4th, 5th, 6th
DOUBLE CLASS
Double class
MAX_VALUE constant
NEGATIVE_INFINITY constant
NaN constant
compare() method
isNaN() method
parseDouble() method
DOUBLE TYPE
double type, 2nd
boxing in conditional expression
comparing
domain
rounding errors
signed zero
underflow
widening
DYNAMIC ANALYSIS
dynamic analysis
ELEMENT INTERFACE
Element interface
ELSE BRANCH
else branch, 2nd, 3rd
ENUM CLASS
enum class, 2nd, 3rd, 4th
getClass() method
getDeclaringClass() method
initialization order, 2nd
ordinal() method
ENUM SWITCH
enum switch
ENUMSET CLASS
EnumSet class, 2nd
EQUALS() BETWEEN OBJECTS OF INCONVERTIBLE TYPES INSPECTION
equals() Between Objects of Inconvertible Types inspection, 2nd
EQUALS() CALLED ON ITSELF INSPECTION
equals() Called on Itself inspection
EQUALS() CALLED ON JAVA.MATH.BIGDECIMAL INSPECTION
equals() Called on java.math.BigDecimal inspection
EQUALS() CALLED ON STRINGBUILDER INSPECTION
equals() Called on StringBuilder inspection
EQUALS() METHOD
equals() method, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th
malformed implementation, 2nd
using on unrelated types, 2nd
EQUIVALENCECHECKER CLASS
EquivalenceChecker class
ERROR PRONE ANALYZER
Error Prone analyzer
ERROR PRONE ANNOTATIONS
Error Prone annotations
ERROR PRONE BUG PATTERNS
Error Prone bug patterns
BareDotMetacharacter
CheckReturnValue
CollectionIncompatibleType
EqualsNaN
FormatString
GetClassOnAnnotation
GetClassOnClass
GetClassOnEnum
IndexOfChar
InfiniteRecursion
MissingSuperCall
StringBuilderInitWithChar
URLEqualsHashCode
EXCEPTIONS
exceptions
ArithmeticException, 2nd, 3rd, 4th
ArrayIndexOutOfBoundsException, 2nd, 3rd
ClassCastException
ConcurrentModificationException, 2nd, 3rd
IndexOutOfBoundsException, 2nd, 3rd, 4th, 5th
StringIndexOutOfBoundsException, 2nd
EXPRESSIONS
expressions
accidental concatenation instead of addition
conditional expression, 2nd
EXTENDING STATIC ANALYSIS TOOLS
extending static analysis tools
Error Prone plugin
SpotBugs plugin
FAIL() METHOD
fail() method
FAIL-FAST BEHAVIOR
fail-fast behavior
FASTUTIL LIBRARY
FastUtil library
FIELD
field
comparing in equals, 2nd
initialization order, 2nd, 3rd
stability
FIELD.SETACCESSIBLE() METHOD
Field.setAccessible() method
FILE CLASS
File class, 2nd
createNewFile() method
delete() method
mkdir() method
rename() method
separator constant
FILES CLASS
Files class
createDirectories() method
getLastModifiedTime() method
isDirectory() method
isRegularFile() method
isSymbolicLink() method
list() method
size() method
FILTER() METHOD (STREAM INTERFACE)
filter() method (Stream interface)
FINAL VARIABLE
final variable, 2nd
FINDBUGS/SPOTBUGS ANNOTATIONS
FindBugs/SpotBugs annotations
FLAKY TESTS
flaky tests
FLOAT TYPE
float type, 2nd, 3rd
FLOORMOD() METHOD (MATH CLASS)
floorMod() method (Math class), 2nd, 3rd
FOR LOOPS
for loops, 2nd, 3rd
not using variable of, 2nd
overflow, 2nd
wrong direction of, 2nd
FOR-EACH LOOP
for-each loop, 2nd, 3rd
FOREACH() METHOD (COLLECTION INTERFACE)
forEach() method (Collection interface), 2nd
FOREACHORDERED() METHOD (STREAM INTERFACE)
forEachOrdered() method (Stream interface), 2nd
FORI LIVE TEMPLATE
fori live template
FORKJOINPOOL CLASS
ForkJoinPool class
FORMAT SPECIFIERS, INCORRECT IN DATE FORMATTING
format specifiers, incorrect in date formatting
FORMAT() METHOD
format() method
of String class
FORMATTED() METHOD (STRING CLASS)
formatted() method (String class), 2nd
FORR POSTFIX TEMPLATE
forr postfix template
FUTURE INTERFACE
Future interface
GET() METHOD
get() method
of AtomicInteger class
of Future interface
of List interface, 2nd
of Map interface, 2nd
of WeakReference class
GET/PUT SEQUENCE
get/put sequence
GETATTRIBUTE() METHOD (ELEMENT INTERFACE)
getAttribute() method (Element interface)
GETBOOLEAN() METHOD (BOOLEAN CLASS)
getBoolean() method (Boolean class)
GETCHARACTERINSTANCE() METHOD (BREAKITERATOR CLASS)
getCharacterInstance() method (BreakIterator class)
GETCLASS() METHOD
getClass() method, 2nd, 3rd
GETDECLARINGCLASS() METHOD (ENUM INTERFACE)
getDeclaringClass() method (Enum interface)
GETHOUR() METHOD (LOCALDATETIME CLASS)
getHour() method (LocalDateTime class)
GETMETHOD() METHOD (CLASS CLASS)
getMethod() method (Class class)
GETNUMBERINSTANCE() METHOD (NUMBERFORMAT CLASS)
getNumberInstance() method (NumberFormat class)
GOOGLE JAVA STYLE GUIDE
Google Java Style Guide
GRADLE RUNIDE COMMAND
gradle runIde command
GUAVA LIBRARY
Guava library, 2nd, 3rd, 4th, 5th, 6th
HASATTRIBUTE() METHOD (ELEMENT INTERFACE)
hasAttribute() method (Element interface)
HASHCODE() CALLED ON ARRAY INSPECTION
hashCode() Called on Array inspection
HASHCODE() METHOD
hashCode() method, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th
StackOverflowError when computing
for case-insensitive string, 2nd
in URL class, 2nd
in array, 2nd, 3rd
in mutable objects, 2nd
HASHMAP CLASS
HashMap class
HASHMAP KEY
HashMap key, 2nd
HASHSET CLASS
HashSet class, 2nd, 3rd
HASNEXT() METHOD (ITERATOR INTERFACE)
hasNext() method (Iterator interface), 2nd
HEXADECIMAL VALUES
hexadecimal values
HEXFORMAT CLASS
HexFormat class
IC (INTELLIJ IDEA COMMUNITY EDITION)
IC (IntelliJ IDEA Community Edition)
IDENTITYHASHMAP CLASS
IdentityHashMap class
IF STATEMENT
if statement, 2nd, 3rd, 4th, 5th, 6th, 7th
IFEMPTY() METHOD (STREAMEX CLASS)
ifEmpty() method (StreamEx class)
IF–ELSE CHAINS
if–else chains
IMMUTABLECOLLECTION CLASS
ImmutableCollection class
INDEXOF() METHOD
indexOf() method, 2nd, 3rd, 4th, 5th
checking result of
recursive implementation, 2nd
INDEXOUTOFBOUNDSEXCEPTION
IndexOutOfBoundsException, 2nd, 3rd
INFINITE RECURSION INSPECTION
Infinite Recursion inspection, 2nd
INITIALIZATION
initialization
class initialization order, 2nd
enum initialization loop
incorrect initialization order
subclass fields
INPUTSTREAM.READ() METHOD
InputStream.read() method, 2nd, 3rd
INSPECTION PROFILE
inspection profile
INSTANCEOF OPERATOR
instanceof operator, 2nd, 3rd, 4th, 5th, 6th
and different class loaders, 2nd
dominating condition, 2nd
in equals() implementation
to protect cast, 2nd
INT TYPE
int type, 2nd, 3rd, 4th, 5th
comparison
literal
overflow
INTEGER CLASS
Integer class
compare() method, 2nd
INTEGER DIVISION IN FLOATING POINT CONTEXT INSPECTION
Integer Division in Floating Point Context inspection
INTEGER MULTIPLICATION OR SHIFT IMPLICITLY CAST TO LONG INSPECTION
Integer Multiplication or Shift Implicitly Cast to long inspection, 2nd
INTEGERCACHE CLASS
IntegerCache class
INTELLIJ IDEA
IntelliJ IDEA, 2nd, 3rd, 4th, 5th, 6th
INTELLIJ IDEA INSPECTION
IntelliJ IDEA inspection
Assertion Is Suppressed by catch
Assignment to Static Field from Instance Context
Assignment to for Loop Parameter
Call to String.toUpperCase() or toLowerCase() Without a Locale
Cast Conflicts With instanceof
Comparison to Double.NaN or Float.NaN
Confusing Argument to Varargs Method
Constant Values, 2nd, 3rd, 4th
Fallthrough in Switch Statement
Idempotent Loop Body
Infinite Recursion
Integer Division in Floating Point Context
Integer Multiplication or Shift Implicitly Cast to long, 2nd
Iterable Is Used as Vararg
JUnit Malformed Declaration
Loop Executes Zero or Billions of Times
Malformed Format String
Method Does Not Call Super Method
Mismatched Case in String Operation
Multiple Operators with Different Precedence
Negative int Hexadecimal Constant in long Context
Non-Short-Circuit Boolean Expression
Non-terminal Use of ’\\\s’ Escape Sequence
Null-Check Method Is Called with Obviously Non-null Argument
Nullability and Data Flow Problems, 2nd, 3rd, 4th, 5th, 6th, 7th
Number Comparison Using ==, Instead of equals(), 2nd
Numeric Cast That Loses Precision
Numeric Overflow
Octal Integer
Overridable Method Called During Object Construction
Replacement Operation Has No Effect
Result of Method Call Ignored, 2nd
Return of null
Static Initializer References Subclass
String Comparison Using ==, Instead of equals()
Subtraction in compareTo()
Suspicious Class.getClass() Call
Suspicious Collections Method Calls, 2nd
Suspicious Comparator.compare() Implementation
Suspicious Date Format Pattern
Suspicious List.remove() in the Loop
Suspicious Oddness Check
Suspicious Regex Expression Argument
Suspicious Ternary Operator in Varargs Method Call
Suspicious Usage of Compare Method
Throwable Not Thrown
Too Weak Variable Type Leads to Unnecessary Cast
assert Statement with Side Effects
compare() Method Can Be Used to Compare Numbers
equals() Between Objects of Inconvertible Types, 2nd
equals() Called on Itself
equals() Called on StringBuilder
equals() Called on java.math.BigDecimal
hashCode() Called on Array
INTERRUPTED() METHOD (THREAD CLASS)
interrupted() method (Thread class)
INTSTREAM.RANGECLOSED() METHOD
IntStream.rangeClosed() method
INVOKESTATIC INSTRUCTION
invokestatic instruction
ISDIGIT() METHOD (CHARACTER CLASS)
isDigit() method (Character class), 2nd
ISDIRECTORY() METHOD (FILES CLASS)
isDirectory() method (Files class)
ISEMPTY() METHOD (COLLECTION INTERFACE)
isEmpty() method (Collection interface), 2nd
ISINSTANCE() METHOD (CLASS CLASS)
isInstance() method (Class class)
ISREGULARFILE() METHOD (FILES CLASS)
isRegularFile() method (Files class)
ITERATOR INTERFACE
Iterator interface
hasNext() method, 2nd, 3rd
next() method
remove() method
violating contracts, 2nd
ITERATOR() METHOD (ITERABLE INTERFACE)
iterator() method (Iterable interface)
JAVA CONCURRENCY IN PRACTICE ANNOTATIONS
Java Concurrency in Practice annotations
JAVA LANGUAGE SPECIFICATION (JLS)
Java Language Specification (JLS), 2nd
JAVA SPECIFICATION REQUEST (JSR)
Java Specification Request (JSR)
JAVA VIRTUAL MACHINES (JVMS)
Java virtual machines (JVMs)
JAVA.UTIL.CONCURRENT APIS
java.util.concurrent APIs
JAVAP TOOL
javap tool
JDT ANNOTATIONS FOR ENHANCED NULL ANALYSIS
JDT Annotations for Enhanced Null Analysis
JETBRAINS ANNOTATIONS
JetBrains annotations
JIT (JUST-IN-TIME)
JIT (just-in-time)
JSTACK TOOL
jstack tool
JUNIT MALFORMED DECLARATION INSPECTION
JUnit Malformed Declaration inspection
KEYLISTENER INTERFACE
KeyListener interface
KLOCWORK
Klocwork
LEFT SHIFT
left shift
LENGTH() METHOD (STRING CLASS)
length() method (String class)
LINT
lint
LIST INTERFACE
List interface, 2nd, 3rd, 4th, 5th
add() method
copyOf() method
remove(index) method, 2nd
set() method
sort() method, 2nd
subList() method
LISTITERATOR INTERFACE
ListIterator interface
LOCALDATETIME CLASS
LocalDateTime class
getHour() method
LOCALINSPECTIONTOOL ABSTRACT CLASS
LocalInspectionTool abstract class
LOGICAL OPERATORS && AND ||
logical operators && and ||, 2nd
LONG TYPE
long type, 2nd, 3rd, 4th, 5th, 6th
cast to
narrowing
overflow
LOOP
loop
idempotent body of, 2nd
not using variable of
overflow
wrong direction of, 2nd
LOOP EXECUTES ZERO OR BILLIONS OF TIMES INSPECTION
Loop Executes Zero or Billions of Times inspection
MAIN() METHOD
main() method, 2nd
MALFORMED FORMAT STRING INSPECTION
Malformed Format String inspection
MAP INTERFACE
Map interface, 2nd
compute() method
computeIfAbsent() method, 2nd, 3rd, 4th, 5th, 6th, 7th
computeIfPresent() method
merge() method, 2nd, 3rd
put() method, 2nd, 3rd
putIfAbsent() method, 2nd
MAP() METHOD (STREAM INTERFACE)
map() method (Stream interface), 2nd
MAPS
maps
concurrent modification during iteration, 2nd
MATH UTILITY CLASS
Math utility class
*Exact methods
abs() method, 2nd, 3rd
absExact() method
clamp() method
floorMod() method, 2nd, 3rd
hypot() method
min() method
sqrt() method, 2nd
toIntExact() method
MAX() METHOD
max() method
in Collections utility class, 2nd
in Math utility class
MAXBY() METHOD (COLLECTORS CLASS)
maxBy() method (Collectors class)
MERGE() METHOD (MAP INTERFACE)
merge() method (Map interface), 2nd
METHOD DOES NOT CALL SUPER METHOD INSPECTION
Method Does Not Call Super Method inspection
METHOD REFERENCES
method references, 2nd
MIN() METHOD
min() method
in Collections utility class, 2nd
in Math utility class
MISMATCHED CASE IN STRING OPERATION INSPECTION
Mismatched Case in String Operation inspection
MODCOUNT FIELD
modCount field
MOUNT --RBIND COMMAND
mount --rbind command
MULTIPLE OPERATORS WITH DIFFERENT PRECEDENCE INSPECTION
Multiple Operators with Different Precedence inspection
MUTABLE OBJECTS, AS KEYS
mutable objects, as keys, 2nd
MUTATION COVERAGE
mutation coverage
MVN INSTALL COMMAND
mvn install command
MVN PACKAGE COMMAND
mvn package command
NAN VALUES
NaN values, 2nd
NEGATIVE INT HEXADECIMAL CONSTANT IN LONG CONTEXT INSPECTION
Negative int Hexadecimal Constant in long Context inspection
NEGATIVE NUMBERS
negative numbers
due to overflow
hexadecimal
in byte type
result of Math.abs() method, 2nd
NEW EXPRESSION
new expression
NEWLY CREATED OBJECTS
newly created objects
NON-NULLABLE VARIABLES
non-nullable variables
NON-SHORT-CIRCUIT BOOLEAN EXPRESSION INSPECTION
Non-Short-Circuit Boolean Expression inspection
NON-SHORT-CIRCUIT LOGIC OPERATORS
non-short-circuit logic operators, 2nd
NON-TERMINAL USE OF ’\\\S’ ESCAPE SEQUENCE INSPECTION
Non-terminal Use of ’\\\s’ Escape Sequence inspection
NULL ELEMENTS
null elements, 2nd, 3rd
NULL VALUES
null values
in maps, 2nd
NULL-CHECK METHOD IS CALLED WITH OBVIOUSLY NON-NULL ARGUMENT INSPECTION
Null-Check Method Is Called with Obviously Non-null Argument inspection
NULLABILITY AND DATA FLOW PROBLEMS INSPECTION
Nullability and Data Flow Problems inspection, 2nd, 3rd, 4th, 5th, 6th
NULLPOINTEREXCEPTION
NullPointerException, 2nd, 3rd, 4th, 5th, 6th, 7th
defensive checks, 2nd
nullity annotations, 2nd
static analysis
NULLS
nulls
nullity annotations
searching for in null-hostile collection
NULLSFIRST() METHOD (COMPARATOR INTERFACE)
nullsFirst() method (Comparator interface), 2nd
NUMBER CLASS
Number class
NUMBER COMPARISON USING ==, INSTEAD OF EQUALS() INSPECTION
Number Comparison Using ==, Instead of equals() inspection
NUMBERS
numbers
Integer.MIN_VALUE, 2nd
bit-manipulating algorithms, 2nd
clamping order
division and compound assignment
negative hexadecimal values
oddness check and negative numbers
rounding during integer division
special floating-point numbers, 2nd
NUMERIC CAST THAT LOSES PRECISION INSPECTION
Numeric Cast That Loses Precision inspection
NUMERIC OPERATOR PRECEDENCE
numeric operator precedence, 2nd
binary shift
bitwise operators
NUMERIC OVERFLOW
numeric overflow
assigning result of int multiplication to long variable
file size, time, and financial computations, 2nd
NUMERIC OVERFLOW INSPECTION
Numeric Overflow inspection
OBJECT CLASS
Object class, 2nd
comparing objects
equals() method, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th
hashCode() method, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th
malformed implementation, 2nd
toString() method
using on unrelated types
OBJECTS
objects
comparing
comparing, 2nd, 3rd, 4th, 5th
not using newly created
searching of unrelated type
OBJECTS CLASS
Objects class
checkFromIndexSize() method
checkFromToIndex() method
checkIndex() method
equals() method, 2nd
hash() method, 2nd
requireNonNullElse() method
OCTAL INTEGER INSPECTION
Octal Integer inspection
OCTAL LITERALS
octal literals
OPCODESTACK.ITEM CLASS
OpcodeStack.Item class
OPCODESTACKDETECTOR CLASS
OpcodeStackDetector class
OPTIONAL CLASS
Optional class, 2nd
OR (||) OPERATOR
or (||) operator
OVERFLOW
overflow
numeric
PAIR PROGRAMMING
pair programming
PARALLELSTREAM() METHOD (COLLECTION INTERFACE)
parallelStream() method (Collection interface)
PARENTHESES, MISSING IN CONDITIONS
parentheses, missing in conditions
&& and || precedence, 2nd
conditional operator and null check
PARSEDOUBLE() METHOD (DOUBLE CLASS)
parseDouble() method (Double class)
PATH CLASS
Path class
PATTERN.QUOTE() METHOD
Pattern.quote() method
PATTERNSYNTAXEXCEPTION
PatternSyntaxException
PECS (PRODUCER EXTENDS CONSUMER SUPER)
PECS (producer extends consumer super)
PEEK() METHOD (STREAM INTERFACE)
peek() method (Stream interface), 2nd
PHONEACCOUNT OBJECTS
PhoneAccount objects
PITEST TOOL
Pitest tool, 2nd, 3rd
PMD, STATIC ANALYZER
PMD, static analyzer
POLL() METHOD (QUEUE INTERFACE)
poll() method (Queue interface)
POP2 INSTRUCTION
pop2 instruction
PRECEDENCE
precedence
binary shift
bitwise operators
PRECISION LOSS
precision loss
PRIMITIVE WIDENING
primitive widening
PRINTF() METHOD (PRINTSTREAM CLASS)
printf() method (PrintStream class), 2nd, 3rd
PROBLEMSHOLDER CLASS
ProblemsHolder class
PROGRAM STRUCTURE
program structure
idempotent loop body
loop variables
malformed classic for loop, 2nd
PUT() METHOD (MAP INTERFACE)
put() method (Map interface)
PUTIFABSENT() METHOD (INTERFACE)
putIfAbsent() method (interface)
PVS-STUDIO ANALYZER
PVS-Studio analyzer, 2nd
PVS-STUDIO WARNING
PVS-Studio warning
Automatic Unboxing of a Variable May Cause NullPointerException
Expression Is Always True/False, 2nd
Possibly Index Is Out of Bound
Suspicious Access to Element by a Constant Index Inside a Loop
The Variable X Is Being Used for This Loop and for the Outer Loop
QODANA TOOL
Qodana tool , 2nd
QUALITY OF CODE
quality of code
automated testing
code style, 2nd
dynamic analysis, 2nd
managing, 2nd
static analysis
QUEUE.POLL() METHOD
Queue.poll() method
QUOTE() METHOD (PATTERN CLASS)
quote() method (Pattern class)
RANDOM.NEXTINT() METHOD
Random.nextInt() method
RANDOMACCESS INTERFACE
RandomAccess interface
RANDOMACCESSFILE.SEEK() METHOD
RandomAccessFile.seek() method
RANGECLOSED METHOD (INTSTREAM INTERFACE)
rangeClosed method (IntStream interface)
RAW TYPE
raw type
REACHABILITYFENCE() METHOD (REFERENCE CLASS)
reachabilityFence() method (Reference class)
READ() METHOD (INPUTSTREAM CLASS)
read() method (InputStream class)
READING COLLECTION INSIDE COLLECTION.REMOVEIF()
reading collection inside Collection.removeIf()
READLINE() METHOD (BUFFEREDREADER CLASS)
readLine() method (BufferedReader class), 2nd
READNBYTES() METHOD (INPUTSTREAM CLASS)
readNBytes() method (InputStream class)
RECURSION
recursion
infinite recursion
REDUCE() METHOD (STREAM CLASS)
reduce() method (Stream class), 2nd, 3rd
REFERENCE EQUALITY
reference equality, 2nd
REFERENCE.REACHABILITYFENCE() METHOD
Reference.reachabilityFence() method
REGIONMATCHES() METHOD (STRING CLASS)
regionMatches() method (String class)
REMOVE() METHOD
remove() method
of List interface (accepting index)
of Queue interface
REMOVEIF() METHOD (COLLECTION INTERFACE)
removeIf() method (Collection interface), 2nd, 3rd
REPEAT() METHOD (STRING CLASS)
repeat() method (String class)
REPLACE() METHOD (STRING CLASS)
replace() method (String class), 2nd
REPLACEALL() METHOD (STRING CLASS)
replaceAll() method (String class)
REPLACEMENT OPERATION HAS NO EFFECT INSPECTION
Replacement Operation Has No Effect inspection
REQUIRENONNULL() METHOD (OBJECTS CLASS)
requireNonNull() method (Objects class), 2nd
RESOURCEBUNDLE CLASS
ResourceBundle class
RESULT OF METHOD CALL IGNORED INSPECTION
Result of Method Call Ignored inspection, 2nd, 3rd
RETAINALL() METHOD (COLLECTION INTERFACE)
retainAll() method (Collection interface)
RETURN OF NULL INSPECTION
Return of null inspection
RETURN STATEMENT
return statement, 2nd, 3rd
RETURN VALUES, IGNORING
return values, ignoring
RIGHT SHIFT
right shift
SAWOPCODE() METHOD (OPCODESTACKDETECTOR CLASS)
sawOpcode() method (OpcodeStackDetector class), 2nd
SEEK() METHOD (RANDOMACCESSFILE CLASS)
seek() method (RandomAccessFile class)
SET INTERFACE
Set interface
SET- METHOD
set- method
SETACCESSIBLE() METHOD (FIELD CLASS)
setAccessible() method (Field class)
SETALL() METHOD (ARRAYS CLASS)
setAll() method (Arrays class)
SHORT TYPE
short type, 2nd
SHUFFLED LIST
shuffled list
SIDE EFFECT IN ASSERT STATEMENT
side effect in assert statement
SIGNED HEXADECIMAL
signed hexadecimal
SIGNED ZERO
signed zero, 2nd
SIMPLEDATEFORMAT CLASS
SimpleDateFormat class, 2nd
SINGLE OBJECTS
single objects
SKIP() METHOD (STREAM INTERFACE)
skip() method (Stream interface)
SOFTLY REACHABLE OBJECTS
softly reachable objects, 2nd
SONARLINT ANALYZER
SonarLint analyzer
SONARLINT RULE
SonarLint rule
A for Loop Update Clause Should Move the Counter in the Right Direction
Assertion Methods Should Not Be Used within the Try Block of a Try-Catch Catching an Error
Classes Should Not Access Their Own Subclasses During Initialization
Collapsible if statements should be merged
Conditionally Executed Code Should Be Reachable
Constructors Should Only Call Non-overridable Methods
Consumed Stream Pipelines Should Not Be Reused
Exceptions Should Not Be Created Without Being Thrown
Identical Expressions Should Not Be Used on Both Sides of a Binary Operator
Inappropriate Collection Calls Should Not Be Made, 2nd
Instance Methods Should Not Write to Static Fields
Iterator.next() Methods Should Throw NoSuchElementException
JUnit5 Inner Test Classes Should Be Annotated with @Nested
JUnit5 Test Classes and Methods Should Not Be Silently Ignored
Limited Dependence Should Be Placed on Operator Precedence
List.remove() Should Not Be Used in Ascending for Loops
Math Operands Should Be Cast before Assignment
Modulus Results Should not Be Checked for Direct Equality
Neither Math.abs nor Negation Should Be Used on Numbers That Could Be MIN_VALUE
Non-Thread-Safe Fields Should Not Be Static
Octal Values Should Not Be Used
Printf-Style Format Strings Should Be Used Correctly
Printf-Style Format Strings Should Not Lead to Unexpected Behavior at Runtime
Raw Byte Values Should Not Be Used in Bitwise Operations in Combination with Shifts
Results Should Not Be Checked for Specific Values
Return Values from Functions Without Side Effects Should Not Be Ignored
Short-Circuit Logic Should Be Used in Boolean Contexts
Silly Equality Checks Should Not Be Made
Stream.peek Should Be Used with Caution
String Operations Should Not Rely on the Default System Locale
String#replace Should Be Preferred to String#replaceAll
StringBuilder and StringBuffer Should Not Be Instantiated with a Character
Strings and Boxed Types Should Be Compared Using equals()
The Value Returned From a Stream Read Should Be Checked
URL.hashCode and URL.equals Should Be Avoided
Week Year (YYYY) Should Not Be Used for Date Formatting
equals(Object obj) Should Test Argument Type
for Loop Stop Conditions Should Be Invariant
indexOf Checks Should Not Be for Positive Numbers
min and max Used in Combination Should not Always Return the Same Value
null Should Not Be Used with Optional
SORT() METHOD (LIST INTERFACE)
sort() method (List interface), 2nd
SPLIT() METHOD (STRING CLASS)
split() method (String class)
SPOTBUGS
SpotBugs, 2nd
SPOTBUGS WARNING
SpotBugs warning
Bad Attempt to Compute Absolute Value of Signed 32-bit Hashcode
Bad Attempt to Compute Absolute Value of Signed Random Integer
Check for Oddness That Won’t Work for Negative Numbers
Code Checks for Specific Values Returned by compareTo
Computation of Average Could Overflow
Exception Created and Dropped Rather than Thrown
Impossible Cast and Impossible Downcast
Incorrect Combination of Math.max and Math.min
Method With Optional Return Type Returns Explicit null
Result of Integer Multiplication Cast to Long
Switch Statement Found Where One Case Falls Through to the Next Case
Unchecked/Unconfirmed Cast
Unchecked/Unconfirmed Cast of Return Value from Method
SS (GERMAN LETTER)
ß (German letter)
SSR (STRUCTURAL SEARCH AND REPLACEMENT), IN INTELLIJ IDEA
SSR (Structural Search and Replacement), in IntelliJ IDEA
STACK CLASS
Stack class
STACKOVERFLOWERROR
StackOverflowError
deep but finite recursion, 2nd
infinite recursion, 2nd
STANDALONE EXPRESSIONS
standalone expressions
STARTSWITH() METHOD (STRING CLASS)
startsWith() method (String class)
STATIC ANALYSIS
static analysis
Error Prone plugins, 2nd
IDEA plugin, 2nd
SpotBugs plugins, 2nd
limitations of, 2nd
plugins
using, 2nd
warnings, 2nd, 3rd, 4th, 5th, 6th
STATIC ANALYZERS
static analyzers, 2nd
STATIC FIELDS
static fields, 2nd
accidental declaration of, 2nd
STREAM API
Stream API
consuming stream twice, 2nd
violating contract of operations
STREAM INTERFACE
Stream interface, 2nd, 3rd, 4th
count() method, 2nd, 3rd
filter() method
limit() method
map() method
max() method
min() method
parallel() method
peek() method
reduce() method, 2nd
sequential() method
skip() method
toArray() method
STREAMEX LIBRARY
StreamEx library, 2nd, 3rd, 4th
STREAMS, NULL VALUES IN
streams, null values in
STRING CLASS
String class
format() method, 2nd, 3rd, 4th
formatted() method
indexOf() method, 2nd
length() method
regionMatches() method
repeat() method
replace() method, 2nd, 3rd
replaceAll() method, 2nd, 3rd
replaceFirst() method
split() method
startsWith() method
toLowerCase() method, 2nd
toUpperCase() method, 2nd, 3rd
STRING LITERALS, MULTILINE
string literals, multiline
STRINGBUILDER CLASS
StringBuilder class
append() method
appendCodePoint() method
constructor, 2nd
passing char to constructor
STRINGBUILDER CONSTRUCTOR CALL WITH CHAR ARGUMENT WARNING
StringBuilder Constructor Call with char Argument warning
STRINGINDEXOUTOFBOUNDSEXCEPTION
StringIndexOutOfBoundsException, 2nd
STRINGS
strings
case conversions
comparing in different case
escape sequences, 2nd
incorrect Boolean conversion
mismatched format arguments, 2nd
mixing arguments of indexOf()
regular expressions
STRINGUTILS CLASS
StringUtils class
substringAfter() method
STRIPTRAILINGZEROS() METHOD (BIGDECIMAL CLASS)
stripTrailingZeros() method (BigDecimal class)
SUBLIST() METHOD (LIST INTERFACE)
subList() method (List interface)
SUBSTRING() METHOD (STRING CLASS)
substring() method (String class)
SUBTRACTION IN COMPARETO() INSPECTION
Subtraction in compareTo() inspection
SUBTRACTION, USING WHEN COMPARING NUMBERS
subtraction, using when comparing numbers
SUPERCLASS METHOD CALLS
superclass method calls
SURROGATE PAIR
surrogate pair, 2nd
SUSPICIOUS CLASS.GETCLASS() CALL INSPECTION
Suspicious Class.getClass() Call inspection
SUSPICIOUS COLLECTIONS METHOD CALLS INSPECTION
Suspicious Collections Method Calls inspection, 2nd
SUSPICIOUS COMPARATOR.COMPARE() IMPLEMENTATION INSPECTION
Suspicious Comparator.compare() Implementation inspection
SUSPICIOUS DATE FORMAT PATTERN INSPECTION
Suspicious Date Format Pattern inspection
SUSPICIOUS LIST.REMOVE() IN THE LOOP INSPECTION
Suspicious List.remove() in the Loop inspection
SUSPICIOUS ODDNESS CHECK INSPECTION
Suspicious Oddness Check inspection
SUSPICIOUS TERNARY OPERATOR IN VARARGS METHOD CALL INSPECTION
Suspicious Ternary Operator in Varargs Method Call inspection
SUSPICIOUS USAGE OF COMPARE METHOD INSPECTION
Suspicious Usage of Compare Method inspection
SWITCH EXPRESSIONS
switch expressions
SWITCH STATEMENT
switch statement, 2nd, 3rd, 4th
accidental pass through
TDD (TEST-DRIVEN DEVELOPMENT)
TDD (test-driven development)
TERNARY OPERATOR
ternary operator, 2nd
TESTNG FRAMEWORK
TestNG framework
THEN BRANCH
then branch
THROW STATEMENT
throw statement
THROWABLE CLASS
Throwable class
THROWABLE NOT THROWN INSPECTION
Throwable Not Thrown inspection
TIMEUNIT ENUM
TimeUnit enum
TIMSORT ALGORITHM
TimSort algorithm, 2nd
TITIN PROTEIN
titin protein
TOLIST() METHOD (STREAM INTERFACE)
toList() method (Stream interface)
TOO WEAK VARIABLE TYPE LEADS TO UNNECESSARY CAST INSPECTION
Too Weak Variable Type Leads to Unnecessary Cast inspection
TOSTRING() METHOD
toString() method
TOUPPERCASE() METHOD (STRING CLASS)
toUpperCase() method (String class)
TRANSITIVITY
transitivity
TREESET CLASS
TreeSet class
TRUE CONSTANT (BOOLEAN CLASS)
TRUE constant (Boolean class)
TYPE CONVERSION, IMPLICIT
type conversion, implicit, 2nd
boxed numbers in conditional expressions, 2nd
in compound assignments
nested conditional expressions
UNARY MINUS
unary minus
UNARY PLUS
unary plus
UNCHECKED CALLS
unchecked calls
UNCONDITIONAL NARROWING
unconditional narrowing
UNICODE CHARACTERS
Unicode characters, 2nd
UNIT TESTING
unit testing
assertNotEquals() method
ignoring AssertionError in, 2nd
malformed assertion method calls
malformed exception test
malformed test methods
premature exit from test method
UNMODIFIABLE COLLECTIONS
unmodifiable collections
UNMODIFIABLECOLLECTION() METHOD (COLLECTIONS CLASS)
unmodifiableCollection() method (Collections class)
UNMODIFIABLELIST() METHOD (COLLECTIONS CLASS)
unmodifiableList() method (Collections class), 2nd
UNSIGNED HEXADECIMAL
unsigned hexadecimal
UNSIGNED RIGHT SHIFT
unsigned right shift
UPDATEANDGET() METHOD (ATOMICINTEGER CLASS)
updateAndGet() method (AtomicInteger class)
URI CLASS
URI class , 2nd
URL CLASS
URL class
URLCLASSLOADER CLASS
URLClassLoader class
VALUES() METHOD (ENUM CLASS)
values() method (enum class), 2nd
VAR KEYWORD
var keyword
VARIABLE ARITY CALLS
variable arity calls, 2nd, 3rd
ambiguous
mixing array and collection
using primitive array in
VISITMETHODCALLEXPRESSION() METHOD (JAVAELEMENTVISITOR CLASS)
visitMethodCallExpression() method (JavaElementVisitor class)
WEAK REFERENCES
weak references, 2nd
WEAKREFERENCE CLASS
WeakReference class
WIDENING
widening, 2nd, 3rd, 4th
XLINT\
Xlint\
rawtypes command line option
----
Fair Use Sources
Fair Use Sources:
* ddg>100 Java Mistakes and How to Avoid Them on DuckDuckGo
* B0CTHRGJH3 2024
{{navbar_java}}
{{navbar_footer}}