Skip to content

IGNITE-28831 Fix DTO serializer codegen NPE on type-use annotated qualified types#13292

Closed
anton-vinogradov wants to merge 1 commit into
apache:masterfrom
anton-vinogradov:ignite-28831
Closed

IGNITE-28831 Fix DTO serializer codegen NPE on type-use annotated qualified types#13292
anton-vinogradov wants to merge 1 commit into
apache:masterfrom
anton-vinogradov:ignite-28831

Conversation

@anton-vinogradov

Copy link
Copy Markdown
Contributor

Description

IGNITE-28831

IgniteDataTransferObjectProcessor throws a NullPointerException during annotation processing, which breaks compilation of modules/core from source:

mvn -o -q -pl modules/core -am test-compile -DskipTests -Dcheckstyle.skip=true

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:

java.util.@org.jetbrains.annotations.NotNull Collection<...>

The first-space heuristic discarded the java.util. qualifier and returned only Collection, which caused:

  1. COLL_IMPL.get("Collection")null → NPE in simpleName() for fields such as BaselineNode.addrs (@NotNull Collection<ResolvedAddresses>) and IdleVerifyResult.txHashConflicts (@Nullable List<List<TransactionsHashRecord>>).
  2. Malformed import String; / import Exception; / import IdleVerifyResult; in the generated serializers for DurableBackgroundCleanupIndexTreeTaskV2, SnapshotPartitionsVerifyResult, VisorTaskResult (the '.' expected compile errors) for @Nullable-annotated fields.

The subsequent cascade of cannot find symbol: class *ViewWalker errors is a side effect: the processor's exception aborts the annotation-processing round, so the separate SystemViewRowAttributeWalkerProcessor output 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=true completes with BUILD SUCCESS, and the serializers for BaselineNode, IdleVerifyResult, DurableBackgroundCleanupIndexTreeTaskV2, SnapshotPartitionsVerifyResult, VisorTaskResult are generated and compile.

🤖 Generated with Claude Code

…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>
@github-actions

Copy link
Copy Markdown

Possible compatibility issues. Please, check rolling upgrade cases

This PR modifies protected classes (with Order annotation).
Changes to these classes can break rolling upgrade compatibility.

Affected files:

  • modules/codegen/src/main/java/org/apache/ignite/internal/idto/IDTOSerializerGenerator.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant