java-review-patterns
Java Code Review Patterns
Overview
Java's size and long history create a distinct review challenge: the language has grown from Java 1 to Java 21 without removing legacy APIs, leaving reviewers to distinguish safe modern idioms from outdated patterns still present in production codebases.
Three forces drive Java-specific review mistakes. First, null is pervasive — NullPointerException remains the most common runtime crash, and Optional was introduced in Java 8 to address this but is frequently misused. Second, the Stream API enables elegant functional pipelines but introduces subtle bugs when side effects, infinite sequences, or parallelism are mixed in carelessly. Third, Java's threading model predates structured concurrency, and the synchronized keyword is still widely used, often with scope wider than necessary, while newer tools like CompletableFuture introduce their own error-swallowing traps.
Load this skill when reviewing any Java PR that touches service logic, data access, background tasks, or concurrent processing. Cross-reference review-accuracy-calibration before posting — Java has moderate false positive risk in the generics and concurrency sections, where correct-looking code can be intentionally chosen over the more idiomatic form.