Jacob Jona Fahlenkamp created FLINK-35887:
---------------------------------------------

             Summary: 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


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)

Reply via email to