[ https://issues.apache.org/jira/browse/FLINK-35887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17868530#comment-17868530 ]
Dylan He commented on FLINK-35887: ---------------------------------- Actually my understanding is that the TypeInfo extracted from the interface class in createTypeInfo() appears to contain nothing, because interfaces do not contain any fields. Could you clarify the practical objective behind attempting to extract TypeInfo for an interface? [~gyfora] Do you have any ideas?Because I actually don't know much about TypeInformation. > 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)