Aleksandr Chesnokov created IGNITE-28818:
--------------------------------------------

             Summary: Fix IDTO code generation on JDK 21
                 Key: IGNITE-28818
                 URL: https://issues.apache.org/jira/browse/IGNITE-28818
             Project: Ignite
          Issue Type: Bug
            Reporter: Aleksandr Chesnokov
            Assignee: Aleksandr Chesnokov


IDTO serializer generation fails on JDK 21 for DTO fields where JetBrains 
nullability annotations are applied to collection types, for example:
{noformat}
@NotNull Collection<ResolvedAddresses>
@Nullable List<List<TransactionsHashRecord>>{noformat}
On JDK 17, TypeMirror.toString() renders these types as:
{noformat}
@org.jetbrains.annotations.NotNull java.util.Collection<...>
@org.jetbrains.annotations.Nullable java.util.List<...>{noformat}
On JDK 21, javac renders them as:
{noformat}
[email protected] Collection<...>
[email protected] List<...>{noformat}
IDTOSerializerGenerator parsed TypeMirror.toString() to derive the class FQN. 
With the JDK 21 format, the parser returned short names such as Collection/List 
instead of java.util.Collection/java.util.List. This caused collection 
implementation lookup to return null and the processor failed with:
{noformat}
Cannot invoke "String.lastIndexOf(int)" because "fqn" is null{noformat}
The failed processor run also produced invalid generated imports such as

import String, import Exception and import IdleVerifyResult, causing 
compilation errors.

Use the annotation processing model API for declared types instead of parsing 
TypeMirror.toString()



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

Reply via email to