fix: Remove internal DslObject API for Gradle 10 compatibility#1724
fix: Remove internal DslObject API for Gradle 10 compatibility#1724Frisch12 wants to merge 11 commits into
Conversation
The DslObject fallback in resolveSpotBugVersion() was unreachable dead code — when the SpotBugs plugin is present, its extension is always a CodeQualityExtension subclass handled by the public API path above. Replace with a simple default version fallback.
… types SpotBugsExtension does not extend CodeQualityExtension, so the instanceof check always fails. Use reflection to invoke getToolVersion() on the actual extension type, falling back to the default version only when reflection also fails. This preserves user-configured SpotBugs versions without depending on the SpotBugs Gradle plugin at compile time.
Work Summary — Automated MaintenanceChanges pushed
CI StatusChecks still running. All local tests passed. |
Resolves import conflict (VerificationType vs DslObject) in favor of the PR branch. Adds warn-level logging when reflection-based SpotBugs version resolution fails, improving diagnosability.
Work Summary — Automated MaintenanceChanges pushed
Code ReviewFull code review completed. The reflection-based approach for Gradle 10 compatibility is correct. The CI StatusCI pipelines running. Validation passed. Build and CodeQL checks pending. |
Fixes checkstyle violation introduced during merge conflict resolution — the import was kept from the PR branch but is not used in this branch's code.
CI Status UpdateAll checks passed after fixing the unused |
- Rename spotbugConfigured → spotbugsConfigured for consistency - Move @SuppressWarnings("unchecked") from method to cast site - Catch ClassCastException alongside ReflectiveOperationException
Work Summary — Automated MaintenanceCode ReviewFull code review completed. One actionable finding: Missing warn log for unexpected return type — } else if (result != null) {
project.getLogger().warn("SpotBugs getToolVersion() returned unexpected type {}; falling back to {}",
result.getClass().getName(), SPOTBUGS_DEFAULT_VERSION);
}Could not push the fix — GPG commit signing via 1Password failed (no interactive session available in automated run). The fix needs to be applied manually. Status
|
Work Summary — Automated MaintenanceChanges pushed
Code ReviewFull code review completed. No further issues found in Note: CI StatusAll build checks passed. CodeQL analysis still running (historically always passes for this repo). |
- Use getOrElse() instead of getOrNull() to honour Property convention chain - Add setAccessible(true) for JVM module boundary safety - Add debug log for unexpected getToolVersion() return types
Work Summary — Automated MaintenanceCode ReviewFull code review completed. Two actionable findings:
Could not push fixesGPG commit signing via 1Password failed (no interactive session available in automated run). The fixes need to be applied manually. Status
|
Work Summary — Automated MaintenanceChanges pushed
Code ReviewFull code review completed. All three findings were fixed and pushed. CI StatusCI pipelines running. Local build and tests passed. Monitoring scheduled for final CI verification. |
… reflection - Consistent naming with spotbugsConfigured field - Use imported Property type instead of fully-qualified name - Remove unnecessary setAccessible(true) for public method
Work Summary — Automated MaintenanceChanges pushed
Code ReviewFull code review completed. Two additional observations (non-blocking):
CI StatusAll checks passed (Build, Examples, CodeQL, Validation, Deploy). |
Add proper import for java.lang.reflect.Method instead of inline FQN. Downgrade catch-block logging from warn to info — the reflection failure is gracefully handled and warn-level with a stack trace is unnecessarily noisy for a safe fallback path.
Work Summary — Automated MaintenanceChanges pushed
Code ReviewFull code review completed. Two non-blocking observations for future consideration:
CI StatusAll checks passed (Build, Examples, CodeQL, Validation, Deploy). |
SpotBugsExtension no longer extends CodeQualityExtension since spotbugs-gradle-plugin 5.0+, making the instanceof check dead code. The reflection path already handles all real cases. Also moves java.lang.reflect.Method import to the correct java.* block and removes the now-unused CodeQualityExtension import.
Guard extension lookup against UnknownDomainObjectException, unwrap InvocationTargetException cause for useful log messages.
Work Summary — Automated MaintenanceChanges pushed
Code ReviewFull code review completed. No further actionable issues in CI StatusAll checks passed (Build plugin 17/21, Build examples 17/21, CodeQL, Validation, Deploy). |
Work Summary — Automated MaintenanceCode ReviewFull code review completed. Two actionable findings:
Could not push fixesGPG commit signing via 1Password failed (no interactive session available in automated run). The fixes need to be applied manually. Status
|
…ked exceptions Guard Property<String> and String return paths against blank/empty values that would produce malformed Maven coordinates. Widen catch clause from ClassCastException to RuntimeException to cover unchecked exceptions from Property.getOrElse().
Work Summary — Automated MaintenanceChanges pushed
Code ReviewFull code review completed. All three findings from the June 5 comment are now fixed. No further actionable issues. CI StatusAll checks passed (Build plugin 17/21, Build examples 17/21, CodeQL, Validation, Deploy). |
Summary
DslObjectinternal Gradle API usage fromLombokPlugin.resolveSpotBugVersion()DslObjectfallback was unreachable dead code — when the SpotBugs plugin is present, its extension is always aCodeQualityExtensionsubclass handled by the public API pathFound during automated main branch review. The
DslObjectimport fromorg.gradle.api.internal.pluginswill break in Gradle 10.Test plan