{"record":{"id":"016fa40b5df83c8a","repo":"apache/flink","slug":"the-given-class-is-no-subclass-of","errorCode":null,"errorMessage":"The given class is no subclass of {}","messagePattern":"The given class is no subclass of (.+?)","errorType":"validation","errorClass":"InvalidTypesException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/ValueTypeInfo.java","lineNumber":273,"sourceCode":"\n    @Override\n    public boolean canEqual(Object obj) {\n        return obj instanceof ValueTypeInfo;\n    }\n\n    @Override\n    public String toString() {\n        return \"ValueType<\" + type.getSimpleName() + \">\";\n    }\n\n    // --------------------------------------------------------------------------------------------\n\n    @PublicEvolving\n    static <X extends Value> TypeInformation<X> getValueTypeInfo(Class<X> typeClass) {\n        if (Value.class.isAssignableFrom(typeClass) && !typeClass.equals(Value.class)) {\n            return new ValueTypeInfo<X>(typeClass);\n        } else {\n            throw new InvalidTypesException(\n                    \"The given class is no subclass of \" + Value.class.getName());\n        }\n    }\n}\n","sourceCodeStart":255,"sourceCodeEnd":278,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/ValueTypeInfo.java#L255-L278","documentation":"Thrown by ValueTypeInfo.getValueTypeInfo when the provided class is not a valid subclass of org.apache.flink.types.Value — either it does not extend Value at all, or it is the raw Value.class interface itself (which has no concrete serialization behavior).","triggerScenarios":"Called when ValueTypeInfo.getValueTypeInfo(typeClass) is invoked with a class that is either not assignable to Value, or is exactly Value.class. This is used internally during type extraction to validate that a class is a concrete Value implementation before constructing a ValueTypeInfo.","commonSituations":"Passing a raw class that doesn't implement Value to a type extraction context expecting a Value type. Accidentally using Value.class as a type parameter instead of a concrete subclass like IntValue.class. Generic code that resolves the type parameter to Value.class itself rather than a concrete subclass.","solutions":["Use a concrete Value subclass (e.g., IntValue, StringValue, or a custom class implementing Value) instead of Value.class itself.","If the type is not a Value, use the appropriate TypeInformation (e.g., BasicTypeInfo for primitives, PojoTypeInfo for POJOs).","Ensure generic code that constructs ValueTypeInfo resolves to a concrete Value subclass, not the raw Value interface.","Register a custom TypeInfoFactory via @TypeInfo if you need custom type info for non-Value types."],"exampleFix":"// before\nTypeInformation<?> info = ValueTypeInfo.getValueTypeInfo(Value.class);\n// throws: Value.class is not a valid subclass of itself\n\n// after\nTypeInformation<?> info = ValueTypeInfo.getValueTypeInfo(MyCustomValue.class);\n// where MyCustomValue extends Value implements Value { ... }","handlingStrategy":"validation","validationCode":"// Check if the class is a valid concrete Value subclass\nif (!Value.class.isAssignableFrom(typeClass) || typeClass.equals(Value.class)) {\n    // not a valid Value subclass; use appropriate TypeInformation\n}","typeGuard":"static boolean isValidValueSubclass(Class<?> typeClass) {\n    return Value.class.isAssignableFrom(typeClass) && !typeClass.equals(Value.class);\n}","tryCatchPattern":"try {\n    TypeInformation<?> ti = ValueTypeInfo.getValueTypeInfo(typeClass);\n} catch (InvalidTypesException e) {\n    // use a concrete Value subclass or appropriate TypeInformation\n    ti = TypeInformation.of(typeClass);\n}","preventionTips":["Use concrete Value subclasses (IntValue, StringValue, etc.), never Value.class itself.","Ensure generic code resolves type parameters to concrete Value implementations.","If the type is not a Value, use the appropriate TypeInformation class."],"tags":["value-type","type-validation","typeinfo","subclass-check"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}