{"record":{"id":"92ad0543fa9b8ec4","repo":"apache/beam","slug":"unknown-implementation-of-type","errorCode":null,"errorMessage":"Unknown implementation of Type","messagePattern":"Unknown implementation of Type","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/ApiSurface.java","lineNumber":581,"sourceCode":"   */\n  private void addExposedTypes(Type type, Class<?> cause) {\n    if (type instanceof TypeVariable) {\n      LOG.debug(\"Adding exposed types from {}, which is a type variable\", type);\n      addExposedTypes((TypeVariable) type, cause);\n    } else if (type instanceof WildcardType) {\n      LOG.debug(\"Adding exposed types from {}, which is a wildcard type\", type);\n      addExposedTypes((WildcardType) type, cause);\n    } else if (type instanceof GenericArrayType) {\n      LOG.debug(\"Adding exposed types from {}, which is a generic array type\", type);\n      addExposedTypes((GenericArrayType) type, cause);\n    } else if (type instanceof ParameterizedType) {\n      LOG.debug(\"Adding exposed types from {}, which is a parameterized type\", type);\n      addExposedTypes((ParameterizedType) type, cause);\n    } else if (type instanceof Class) {\n      LOG.debug(\"Adding exposed types from {}, which is a class\", type);\n      addExposedTypes((Class) type, cause);\n    } else {\n      throw new IllegalArgumentException(\"Unknown implementation of Type\");\n    }\n  }\n\n  /**\n   * Adds any types exposed to this set. These will come from the (possibly absent) bounds on the\n   * type variable.\n   */\n  private void addExposedTypes(TypeVariable type, Class<?> cause) {\n    if (done(type)) {\n      return;\n    }\n    visit(type);\n    for (Type bound : type.getBounds()) {\n      LOG.debug(\"Adding exposed types from {}, which is a type bound on {}\", bound, type);\n      addExposedTypes(bound, cause);\n    }\n  }\n","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/ApiSurface.java#L563-L599","documentation":"ApiSurface.addExposedTypes(Type, Class) dispatches on the reflection Type implementation, handling ParameterizedType, TypeVariable, GenericArrayType, WildcardType and Class. A java.lang.reflect.Type instance of any other implementation (e.g. a custom or exotic Type produced by frameworks or bytecode manipulation) falls through to the else branch and throws IllegalArgumentException. It means the reflection type is of a kind this analyzer does not understand.","triggerScenarios":"Analyzing an API surface that includes a field/method/generic signature whose resolved java.lang.reflect.Type is not one of Class, ParameterizedType, TypeVariable, GenericArrayType, or WildcardType — e.g. types synthesized by bytecode enhancement agents or custom Type implementations.","commonSituations":"Running API-surface checks on classes processed by code-generation/enhancement tools (AOP proxies, annotation processors) that inject custom Type implementations; unusual reflective generics in dependencies.","solutions":["Identify which class in the analyzed surface has the exotic Type (enable the LOG.debug output) and exclude it from the surface roots.","Upgrade Beam — the dispatch set of handled Type kinds has been extended over time.","Normalize the type first: if it comes from a framework, convert it to a standard Class/ParameterizedType before analysis."],"exampleFix":"// before\nApiSurface surface = ApiSurface.of(enhancedClasses, packages); // classes rewritten by an enhancement agent\n// after\nSet<Class<?>> plain = enhancedClasses.stream().map(Class::getSuperclass).collect(Collectors.toSet()); // analyze the original classes\nApiSurface surface = ApiSurface.of(plain, packages);","handlingStrategy":"validation","validationCode":"if (!(type instanceof Class) && !(type instanceof ParameterizedType) && !(type instanceof TypeVariable)\n    && !(type instanceof GenericArrayType) && !(type instanceof WildcardType)) {\n  throw new IllegalArgumentException(\"unsupported reflection Type: \" + type.getClass());\n}","typeGuard":"boolean isSupportedReflectType(java.lang.reflect.Type t) {\n  return t instanceof Class || t instanceof ParameterizedType || t instanceof TypeVariable\n      || t instanceof GenericArrayType || t instanceof WildcardType;\n}","tryCatchPattern":null,"preventionTips":["Avoid analyzing classes rewritten by bytecode-enhancement agents in API-surface checks.","Normalize framework-provided Types to standard Class/ParameterizedType before analysis.","Keep Beam SDK updated so newer reflection Type kinds are handled."],"tags":["java","apache-beam","reflection","api-surface"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}