Repository navigation
What's New in v0.4.0
modern-java-guidance (mjg) evolves from a Java 21 / Boot 3 modernization linter into an all-version (Java 8–25, Spring Boot 2.7–3.4+) Spring Boot production guardrail across 3 pillars—still with zero third-party Python dependencies.
Pillar 1 — 14 Version-Independent Production Footguns
Catches real outage & security causes that javac compiles with zero warnings (works on Boot 2.7 through Boot 3.4+):
- AOP & Transactions:
TX-001(@Transactionalonprivate/final),TX-002(JDK checkedthrowswithoutrollbackFor),CONC-001(@Asynconprivate/final) - JPA / Hibernate:
JPA-001(Lombok@Dataon@Entity),JPA-002(@ManyToOne/@OneToOnemissingFetchType.LAZY) - Spring & Precision:
SPRING-001(new ObjectMapper()in services),JAVA-020(new BigDecimal(0.1)double literal),OPS-001(e.printStackTrace()) - Security & WebFlux:
SEC-001(SQL string concatenation inJdbcTemplate/createNativeQuery, ignoring literal+literal concat),SEC-002(CORSallowedOrigins("*")+allowCredentials(true)startup crash),REACT-001(.block()in WebFlux-only apps) - Spring Config (
application*.yml/.properties):CFG-001(Actuator*wildcard),CFG-002(prodddl-auto: update/create/create-drop),CFG-003(explicitopen-in-view: true)
Pillar 2 — 6 Bidirectional Version Compatibility Guards (COMPAT-001..006)
Protects teams on older Java 8/11/17 or Spring Boot 2.7/3.0–3.3 repos from AI-hallucinated future APIs (activates only when build files declare explicit versions):
COMPAT-001: Blocksjakarta.*EE imports on Spring Boot 2.xCOMPAT-002: BlocksRestClient/@HttpExchangeon Spring Boot< 3.2COMPAT-003: Blocks@MockitoBean/@MockitoSpyBeanon Spring Boot< 3.4COMPAT-004: Blocks Virtual Threads /SequencedCollectionon Java< 21(never false-positives onLinkedList.getLast()/Comparator.reversed())COMPAT-005: Blocksrecord(< 16) andsealed(< 17)COMPAT-006: Blocks.formatted()(< 15) and.stream()...toList()(< 16)
Pillar 3 — Team Config (.mjg.toml), --profile prod, ARCH-001 & mjg init
- Zero-dependency
.mjg.tomlloader via Python 3.11+ stdlibtomllib --profile prod(andprofile: prodinaction.yml) skips pure style rules (JAVA-003,JAVA-004,BOOT-010) so enterprise teams only see real bugs, security, JPA/TX footguns, and version safetymjg init [--profile prod]auto-generates.mjg.tomland suggestsARCH-001(forbid_controller_repository = true) when a*Servicelayer exists- Supports
disable,severityoverrides, and[[custom_rules]]
Verification
unittest(Python 3.11, 3.12, 3.13): 16/16 passed- A/B eval suite: 8/8 passed (100.0%, +87.5 pp vs. 12.5% unguided baseline)
- Semgrep CI job: 20/20 Java AST rules (
semgrep --validate0 errors,semgrep --test20/20 passed) - GitHub Action E2E job (
47539452922): all 5 CI jobs passed