gnodet opened a new pull request, #23021:
URL: https://github.com/apache/camel/pull/23021

   [CAMEL-22640](https://issues.apache.org/jira/browse/CAMEL-22640)
   
   ## Summary
   
   - Add a `nullcheck` Maven profile that enables 
[NullAway](https://github.com/uber/NullAway) (via Error Prone) to validate 
JSpecify `@NullMarked` / `@Nullable` annotations at compile time
   - Fix all 134 NullAway warnings found in `camel-api`
   - Profile requires JDK 21+ and is opt-in: `mvn install -Pnullcheck 
-DskipTests`
   
   ## Changes
   
   ### NullAway profile (`parent/pom.xml`)
   - Error Prone 2.49.0 + NullAway 0.13.4
   - Forked compiler with `--add-exports` flags for JDK 21+
   - Only checks `@NullMarked` packages (`-XepOpt:NullAway:OnlyNullMarked=true`)
   - JSpecify mode enabled (`-XepOpt:NullAway:JSpecifyMode=true`)
   - All other Error Prone checks disabled — only NullAway runs
   
   ### Annotation fixes (30+ files in `camel-api`)
   - `HasCamelContext.getCamelContext()` → returns `@Nullable` (lazily-set 
field)
   - `BulkTypeConverters` — matched `@Nullable` params/returns to 
`TypeConverter` interface
   - `BaseSSLContextParameters` — `@Nullable` on static Method fields and 
filter method parameters
   - JSSE classes — null guards for `getCamelContext()`, 
`parsePropertyValue()`, `getContextPlugin()`
   - `BeanIntrospection.MethodInfo/ClassInfo` — `@Nullable` on uninitialized 
public fields
   - `Serializable/OffsetKey/Offset` — `@Nullable` on serialize methods
   - `TrustManagersParameters` — fixed array nullability annotation placement
   - Various null guards for `@Nullable` dereferences (HealthCheckHelper, 
RoutesLoader, GroovyScriptCompiler, etc.)
   - Velocity template updated so generated `ExchangeConstantProvider` includes 
`@Nullable`
   
   ## Verification
   
   ```bash
   # Run NullAway on camel-api (requires JDK 21+)
   JAVA_HOME=$HOME/.sdkman/candidates/java/21 mvn clean install -B -pl 
core/camel-api -Pnullcheck -DskipTests -am
   # Result: BUILD SUCCESS, 0 NullAway warnings
   
   # Also verified clean across full camel-core module tree
   JAVA_HOME=$HOME/.sdkman/candidates/java/21 mvn clean install -B -pl 
core/camel-core -Pnullcheck -DskipTests -am
   # Result: BUILD SUCCESS, 0 NullAway warnings
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to