{"record":{"id":"b1f3c1b4fba99004","repo":"quarkusio/quarkus","slug":"not-an-array-type-type","errorCode":null,"errorMessage":"Not an array type ${type}","messagePattern":"Not an array type (.+?)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/Types.java","lineNumber":94,"sourceCode":"    }\n\n    /**\n     * Determines the component type for a given array type.\n     *\n     * @param type the given array type\n     * @return the component type of a given array type\n     */\n    public static Type getArrayComponentType(Type type) {\n        if (type instanceof GenericArrayType) {\n            return GenericArrayType.class.cast(type).getGenericComponentType();\n        }\n        if (type instanceof Class<?>) {\n            Class<?> clazz = (Class<?>) type;\n            if (clazz.isArray()) {\n                return clazz.getComponentType();\n            }\n        }\n        throw new IllegalArgumentException(\"Not an array type \" + type);\n    }\n\n    /**\n     * Determines whether the given array only contains unbounded type variables or Object.class.\n     *\n     * @param types the given array of types\n     * @return true if and only if the given array only contains unbounded type variables or Object.class\n     */\n    static boolean isArrayOfUnboundedTypeVariablesOrObjects(Type[] types) {\n        for (Type type : types) {\n            if (Object.class.equals(type)) {\n                continue;\n            }\n            if (type instanceof TypeVariable<?>) {\n                Type[] bounds = ((TypeVariable<?>) type).getBounds();\n                if (bounds == null || bounds.length == 0 || (bounds.length == 1 && Object.class.equals(bounds[0]))) {\n                    continue;\n                }","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/Types.java#L76-L112","documentation":"Types.getArrayComponentType() returns the component type of an array Type. If the given type is not a Class that isArray() (e.g. a parameterized type, type variable, or plain class), it throws this IllegalArgumentException. It is a strict precondition helper: callers must pass actual array types.","triggerScenarios":"Calling Types.getArrayComponentType(type) with a non-array type — a scalar Class, ParameterizedType, GenericArrayType handled elsewhere, WildcardType, or TypeVariable.","commonSituations":"Extension code resolving bean types from raw metadata without first checking isArray(); handling GenericArrayType (e.g. List<String>[]) which is not a plain Class; accidental pass-through of field/method generic types.","solutions":["Check type instanceof Class && ((Class<?>) type).isArray() before calling, or handle GenericArrayType explicitly","Use Types.getTypeName/other helpers to inspect the type first","Unwrap wrapper types (ParameterizedType raw type, wildcard bounds) to reach the actual array Class"],"exampleFix":"// before\nClass<?> comp = Types.getArrayComponentType(genericArrayType);\n// after\nClass<?> comp = type instanceof GenericArrayType\n    ? (Class<?>) ((GenericArrayType) type).getGenericComponentType()\n    : Types.getArrayComponentType(type);","handlingStrategy":"type-guard","validationCode":"if (!(type instanceof Class<?> c) || !c.isArray()) throw new IllegalArgumentException(\"Expected array type: \" + type);","typeGuard":"static boolean isArrayType(Type t) { return (t instanceof Class<?> c && c.isArray()) || t instanceof GenericArrayType; }","tryCatchPattern":"try { return Types.getArrayComponentType(type); }\ncatch (IllegalArgumentException e) { throw new IllegalArgumentException(\"Not an array: \" + type, e); }","preventionTips":["Check for GenericArrayType (e.g. String[][]) before assuming a Class","Unwrap ParameterizedType raw types first","Guard with isArrayType() before calling"],"tags":["cdi","reflection","types","quarkus-arc"],"backgroundTag":"not-an-array-type","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}