You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Anton Vinogradov (Jira)" <ji...@apache.org> on 2026/06/28 21:37:00 UTC

[jira] [Created] (IGNITE-28831) DTO serializer code generator throws NPE on fields with type-use annotations (@Nullable/@NotNull) on qualified types

Anton Vinogradov created IGNITE-28831:
-----------------------------------------

             Summary: DTO serializer code generator throws NPE on fields with type-use annotations (@Nullable/@NotNull) on qualified types
                 Key: IGNITE-28831
                 URL: https://issues.apache.org/jira/browse/IGNITE-28831
             Project: Ignite
          Issue Type: Task
            Reporter: Anton Vinogradov
            Assignee: Anton Vinogradov


h2. Problem

{\{IgniteDataTransferObjectProcessor}} throws a \{{NullPointerException}} during annotation
processing, which breaks compilation of \{{modules/core}} from source.

Reproduce from a clean master:

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

First (root-cause) errors:

{noformat}
BaselineNode.java: Failed to generate a dto serializer: Cannot invoke "String.lastIndexOf(int)" because "fqn" is null
IdleVerifyResult.java: Failed to generate a dto serializer: Cannot invoke "String.lastIndexOf(int)" because "fqn" is null
.../DurableBackgroundCleanupIndexTreeTaskV2Serializer.java:[26,14] '.' expected
.../SnapshotPartitionsVerifyResultSerializer.java:[20,24] '.' expected
.../VisorTaskResultSerializer.java:[26,17] '.' expected
{noformat}

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 output of the separate
{\{SystemViewRowAttributeWalkerProcessor}} never gets compiled.

h2. Root cause

{\{IDTOSerializerGenerator.className(TypeMirror)}} strips everything before the first space in order
to drop a *leading* type-use annotation (e.g. \{{@NotNull java.util.Collection}}). But the compiler
renders a type-use annotation \{*}inline, right before the simple name\{*} of a qualified type:

{code}
java.util.@org.jetbrains.annotations.NotNull Collection<...>
{code}

The first-space heuristic then discards the \{{java.util.}} qualifier and returns only \{{Collection}},
which causes:

# \{{COLL_IMPL.get("Collection")}} returns \{{null}} -> NPE in \{{simpleName()}} for fields like
{\{BaselineNode.addrs}} (\{{@NotNull Collection<ResolvedAddresses>}}) and
{\{IdleVerifyResult.txHashConflicts}} (\{{@Nullable List<List<TransactionsHashRecord>>}}).
# Malformed \{{import String;}} / \{{import Exception;}} / \{{import IdleVerifyResult;}} emitted into the
generated serializers for \{{DurableBackgroundCleanupIndexTreeTaskV2}}, \{{SnapshotPartitionsVerifyResult}}
and \{{VisorTaskResult}} (the \{{'.' expected}} compile errors) — for \{{@Nullable}}-annotated fields.

h2. Fix

Strip type-use annotations wherever they occur (preserving the package qualifier) instead of using the
first-space heuristic. The fix is confined to the codegen module; DTO classes are not touched.

h2. 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)