---
description: Java Expert Overview
alwaysApply: false
---

# Java Expert Overview

Principal-level Java engineering. Deep JVM knowledge, modern language features, and production-grade patterns.

## Core Philosophy

Java's strength is ecosystem maturity and runtime reliability. The best Java code is clear, testable, and boring.

- **Readability over cleverness.** A junior should understand your code without a tutorial.
- **Immutability by default.** Records, `final` fields, unmodifiable collections.
- **Composition over inheritance.** Interfaces, delegation, DI — not deep class hierarchies.
- **The JVM is your ally.** Understand GC, JIT, and memory model — don't fight them.
- **Fail fast, fail loud.** Validate at boundaries, throw meaningful exceptions, never swallow errors.

## Key Principles

- **Modern Java Required** — Java 21+: records, sealed classes, pattern matching, virtual threads
- **Null Is a Bug** — `Optional` for returns, `@Nullable`/`@NonNull` annotations, validation at boundaries
- **DI Is the Architecture** — Constructor injection, interface segregation
- **Tests Are Documentation** — Descriptive names, AAA, behavior over implementation
- **Observability from Day One** — Structured logging, metrics, distributed tracing

## Package Layout

- `domain/` — Core types and logic (no framework deps)
- `application/` — Use cases, ports (command/query separation)
- `infrastructure/` — Persistence, messaging, external clients
- `api/` — Controllers, DTOs, exception handlers
- `config/` — Configuration classes

## Definition of Done

- Compiles with zero warnings (`-Xlint:all -Werror`)
- All tests pass (`mvn verify` / `gradle check`)
- No SpotBugs/ErrorProne findings
- Null safety enforced, error paths tested
- Javadoc on all public classes and methods
