IGNITE-28831 Fix DTO serializer codegen NPE on type-use annotated qualified types#13292
Closed
anton-vinogradov wants to merge 1 commit into
Closed
IGNITE-28831 Fix DTO serializer codegen NPE on type-use annotated qualified types#13292anton-vinogradov wants to merge 1 commit into
anton-vinogradov wants to merge 1 commit into
Conversation
…lified types IDTOSerializerGenerator.className(TypeMirror) stripped everything before the first space to drop a leading type-use annotation, but the compiler renders a type-use annotation (@Nullable/@NotNull) inline before the simple name of a qualified type, e.g. "java.util.@org.jetbrains.annotations.NotNull Collection". That discarded the package qualifier, leaving only the simple name, which broke COLL_IMPL lookups (NPE in simpleName) and produced malformed imports in the generated serializers. Strip type-use annotations wherever they occur, preserving the package qualifier. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Possible compatibility issues. Please, check rolling upgrade casesThis PR modifies protected classes (with Order annotation). Affected files:
|
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.
Description
IGNITE-28831
IgniteDataTransferObjectProcessorthrows aNullPointerExceptionduring annotation processing, which breaks compilation ofmodules/corefrom source:Root cause
IDTOSerializerGenerator.className(TypeMirror)stripped everything before the first space to drop a leading type-use annotation (e.g.@NotNull java.util.Collection). But the compiler renders a type-use annotation (@Nullable/@NotNull) inline, right before the simple name of a qualified type:The first-space heuristic discarded the
java.util.qualifier and returned onlyCollection, which caused:COLL_IMPL.get("Collection")→null→ NPE insimpleName()for fields such asBaselineNode.addrs(@NotNull Collection<ResolvedAddresses>) andIdleVerifyResult.txHashConflicts(@Nullable List<List<TransactionsHashRecord>>).import String;/import Exception;/import IdleVerifyResult;in the generated serializers forDurableBackgroundCleanupIndexTreeTaskV2,SnapshotPartitionsVerifyResult,VisorTaskResult(the'.' expectedcompile errors) for@Nullable-annotated fields.The subsequent cascade of
cannot find symbol: class *ViewWalkererrors is a side effect: the processor's exception aborts the annotation-processing round, so the separateSystemViewRowAttributeWalkerProcessoroutput never gets compiled.Fix
Strip type-use annotations wherever they occur (preserving the package qualifier) instead of the first-space heuristic. The change is confined to the codegen module; DTO classes are not touched.
Verification
mvn -o -q -pl modules/core -am test-compile -DskipTests -Dcheckstyle.skip=truecompletes withBUILD SUCCESS, and the serializers forBaselineNode,IdleVerifyResult,DurableBackgroundCleanupIndexTreeTaskV2,SnapshotPartitionsVerifyResult,VisorTaskResultare generated and compile.🤖 Generated with Claude Code