Linting Exception Audit
Audit from mq-rest-admin-project/mq-rest-admin-common#118.
Current Exceptions (~128 total)
Config-Level
- Checkstyle:
package-info.java and module-info.java exempt from all checks
- PMD ruleset: 22 rules excluded (mostly Design complexity), 4 thresholds raised (CyclomaticComplexity→15, CognitiveComplexity→20, NPathComplexity→300, NestedIf→4)
- JaCoCo: excludes
package-info.class, *IT.class, examples/*.class
- Error Prone: NullAway enabled for production, disabled for test code
Source Code Inline (23)
- 21×
@SuppressWarnings("unchecked") — GSON deserialization casts (MappingData: 10, AttributeMapper: 5, MqRestSession: 6)
- 2×
@SuppressWarnings("PMD.CloseResource") — justified resource lifecycle management
Test Code Inline (76)
- 76×
@SuppressWarnings("unchecked") — all Mockito ArgumentCaptor.forClass(Map.class) type erasure
Actionable Items
1. Eliminate source code unchecked casts via Jackson (~2-3 hrs)
Switch JSON deserialization from GSON to Jackson with TypeReference:
// Before (GSON — requires unchecked cast)
Type mapType = new TypeToken<Map<String, Object>>() {}.getType();
Map<String, Object> data = GSON.fromJson(json, mapType);
// After (Jackson — type-safe, no cast needed)
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> data = mapper.readValue(json,
new TypeReference<Map<String, Object>>() {});
Jackson's generic-aware API eliminates the need for @SuppressWarnings("unchecked") at deserialization points.
Eliminates: ~15-21 source code suppressions
Adds: com.fasterxml.jackson.core:jackson-databind dependency
Not Actionable
- 76 test
unchecked casts — Mockito's ArgumentCaptor.forClass() API uses Class<T> which cannot express generic types due to Java type erasure. This is an inherent Mockito limitation (verified against Mockito 5.21.0). Refactoring to inline verification would require 6-8 hours for marginal benefit.
- 2 PMD.CloseResource — both well-documented and correct (HttpClient lifecycle, InputStreamReader closure chain)
- 22 PMD rule exclusions — all justified (Design complexity rules for dispatcher methods, multithreading rules for managed HTTP clients, style rules for readability). Re-enabling would require 15-20 hours of refactoring with no quality improvement.
- 4 PMD threshold overrides — justified by
mqscCommand() dispatcher complexity and 3-layer mapping pipeline
- Checkstyle/JaCoCo config exclusions — standard Java project patterns
Linting Exception Audit
Audit from mq-rest-admin-project/mq-rest-admin-common#118.
Current Exceptions (~128 total)
Config-Level
package-info.javaandmodule-info.javaexempt from all checkspackage-info.class,*IT.class,examples/*.classSource Code Inline (23)
@SuppressWarnings("unchecked")— GSON deserialization casts (MappingData: 10, AttributeMapper: 5, MqRestSession: 6)@SuppressWarnings("PMD.CloseResource")— justified resource lifecycle managementTest Code Inline (76)
@SuppressWarnings("unchecked")— all MockitoArgumentCaptor.forClass(Map.class)type erasureActionable Items
1. Eliminate source code unchecked casts via Jackson (~2-3 hrs)
Switch JSON deserialization from GSON to Jackson with
TypeReference:Jackson's generic-aware API eliminates the need for
@SuppressWarnings("unchecked")at deserialization points.Eliminates: ~15-21 source code suppressions
Adds:
com.fasterxml.jackson.core:jackson-databinddependencyNot Actionable
uncheckedcasts — Mockito'sArgumentCaptor.forClass()API usesClass<T>which cannot express generic types due to Java type erasure. This is an inherent Mockito limitation (verified against Mockito 5.21.0). Refactoring to inline verification would require 6-8 hours for marginal benefit.mqscCommand()dispatcher complexity and 3-layer mapping pipeline