Repository navigation
Conversation
Continue independent reflection branches when optional field or generic types cannot be resolved. Preserve STRICT checks and cover missing raw fields, transient fields, generic metadata, and bounds with an isolated class loader. Fixes apache#16574
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16575 +/- ##
============================================
+ Coverage 61.00% 61.01% +0.01%
Complexity 15 15
============================================
Files 1953 1953
Lines 89286 89308 +22
Branches 13478 13478
============================================
+ Hits 54471 54495 +24
+ Misses 29213 29212 -1
+ Partials 5602 5601 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change?
When an application omits a dependency referenced by a DTO field or generic signature, reflection can throw
NoClassDefFoundErrororTypeNotPresentExceptionduring automatic serialization allow-list registration. The exception currently aborts the interface scan, leaving otherwise healthy DTOs undiscovered and potentially rejected by STRICT checking. The protocol wrapper catches the exception outside the entire scan, so exporting/referencing the service can still succeed with that incomplete list.Fixes #16574
Catch missing-type/linkage failures at the reflection traversal boundaries, log the affected metadata, and continue independent fields, types, and methods. Preserve automatic trust settings, the visited-type cache, and rejection of unknown classes under STRICT. The fix does not catch arbitrary
Throwableor change the check mode.If
getDeclaredFields()cannot return its field array, skip that class's field enumeration and continue in its caller. This does not repair the application's missing dependency or make an unreadable service-method signature introspectable.Regression tests
SerializeSecurityConfiguratorMissingTypeTestuses an isolated class loader that defines the actual fixture classes but refuses their optional dependency. Eight cases cover raw and transient field types, generic method parameters/returns, generic fields/interfaces/superclasses, and type-variable bounds. Each verifies that healthy DTOs and nested DTOs are discovered while an unrelated class remains rejected under STRICT.Validation
On OpenJDK 17.0.20.1:
2d9730c6ab4358d94c6e3594fdd2dca0009fe912, with only the new tests: all 8 fail with the expected missing-type exceptions.mvn -B -ntp -pl dubbo-common -am clean testsucceeds — 1,186 tests, 0 failures, 0 errors, 10 skipped. This includes Spotless checks.To reproduce both results in a disposable checkout of this PR (JDK 17):
Related allow-list work
#16569 and #16570 address array component traversal in the same scanner. This PR is based directly on upstream
3.3and is independent of that change. Only issue #16574 is closed by this PR.Checklist