[ 
https://issues.apache.org/jira/browse/IGNITE-28831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18092302#comment-18092302
 ] 

Ignite TC Bot commented on IGNITE-28831:
----------------------------------------

{panel:title=Branch: [pull/13292/head] Base: [master] : No blockers 
found!|borderStyle=dashed|borderColor=#ccc|titleBGColor=#D6F7C1}{panel}
{panel:title=Branch: [pull/13292/head] Base: [master] : No new tests 
found!|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1}{panel}
[TeamCity *--> Run :: All* 
Results|https://ci2.ignite.apache.org/viewLog.html?buildId=9158760&buildTypeId=IgniteTests24Java8_RunAll]
{color:#ffffff}tcbot-analysis-comment chainBuildId=9158760 
rerunBuildIds=none{color}

> 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
>            Priority: Major
>             Fix For: 2.19
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> 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}
> [email protected] 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)

Reply via email to