[
https://issues.apache.org/jira/browse/FLINK-35887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17868246#comment-17868246
]
Dylan He edited comment on FLINK-35887 at 7/24/24 5:36 AM:
-----------------------------------------------------------
I have solved the problem, but what is the practical purpose of adding TypeInfo
to an interface? [~jjf0]
was (Author: JIRAUSER305836):
I have solved the problem, but what is the practical purpose of adding TypeInfo
to an interface?
> Null Pointer Exception in TypeExtractor.isRecord when trying to provide type
> info for interface
> -----------------------------------------------------------------------------------------------
>
> Key: FLINK-35887
> URL: https://issues.apache.org/jira/browse/FLINK-35887
> Project: Flink
> Issue Type: Bug
> Components: API / Type Serialization System
> Affects Versions: 1.19.1
> Reporter: Jacob Jona Fahlenkamp
> Priority: Major
>
> The following code
> {code:java}
> import org.apache.flink.api.common.typeinfo.TypeInfo;
> import org.apache.flink.api.common.typeinfo.TypeInfoFactory;
> import org.apache.flink.api.common.typeinfo.TypeInformation;
> import org.apache.flink.api.common.typeinfo.Types;
> import org.apache.flink.types.PojoTestUtils;
> import org.junit.jupiter.api.Test;
> import java.lang.reflect.Type;
> import java.util.Map;
> public class DebugTest {
> @TypeInfo(FooFactory.class)
> public interface Foo{}
> public static class FooFactory extends TypeInfoFactory<Foo> {
> @Override
> public TypeInformation<Foo> createTypeInfo(Type type, Map<String,
> TypeInformation<?>> map) {
> return Types.POJO(Foo.class, Map.of());
> }
> }
> @Test
> void test() {
> PojoTestUtils.assertSerializedAsPojo(Foo.class);
> }
> } {code}
> throws this exception:
> {code:java}
> java.lang.NullPointerException: Cannot invoke "java.lang.Class.getName()"
> because the return value of "java.lang.Class.getSuperclass()" is null
> at
> org.apache.flink.api.java.typeutils.TypeExtractor.isRecord(TypeExtractor.java:2227)
> at
> org.apache.flink.api.java.typeutils.runtime.PojoSerializer.<init>(PojoSerializer.java:125)
> at
> org.apache.flink.api.java.typeutils.PojoTypeInfo.createPojoSerializer(PojoTypeInfo.java:359)
> at
> org.apache.flink.api.java.typeutils.PojoTypeInfo.createSerializer(PojoTypeInfo.java:347)
> at
> org.apache.flink.types.PojoTestUtils.assertSerializedAsPojo(PojoTestUtils.java:48)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)