{"record":{"id":"2bd830fbe7f08ad8","repo":"oracle/graal","slug":"not-an-annotation-type","errorCode":null,"errorMessage":"Not an annotation type","messagePattern":"Not an annotation type","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/annotation/AnnotationValueType.java","lineNumber":70,"sourceCode":"         * @interface Named { String value(); }\n         *\n         * @interface Anno { Named named() default @Named(\"foo\"); }\n         *\n         * Creating the AnnotationValueType for Anno will recursively call getInstance to create the\n         * AnnotationValueType for Named.\n         */\n        AnnotationValueType value = ANNOTATION_TYPES.get(annotationClass);\n        if (value != null) {\n            return value;\n        }\n        AnnotationValueType created = new AnnotationValueType(annotationClass);\n        AnnotationValueType existing = ANNOTATION_TYPES.putIfAbsent(annotationClass, created);\n        return existing != null ? existing : created;\n    }\n\n    private AnnotationValueType(ResolvedJavaType annotationClass) {\n        if (!annotationClass.isAnnotation()) {\n            throw new IllegalArgumentException(\"Not an annotation type\");\n        }\n\n        ResolvedJavaMethod[] methods = annotationClass.getDeclaredMethods();\n\n        memberTypes = new EconomicHashMap<>(methods.length + 1);\n        memberDefaults = new EconomicHashMap<>(0);\n\n        for (ResolvedJavaMethod method : methods) {\n            if (method.isPublic() &&\n                            method.isAbstract() &&\n                            !method.isSynthetic()) {\n                if (method.getSignature().getParameterCount(false) != 0) {\n                    throw new IllegalArgumentException(method + \" has params\");\n                }\n                String name = method.getName();\n                ResolvedJavaType memberType = method.getSignature().getReturnType(annotationClass).resolve(annotationClass);\n                memberTypes.put(name, memberType);\n","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/annotation/AnnotationValueType.java#L52-L88","documentation":"After locating the include folder, findJNIHeaders() searches it (depth 2) for each required header name in INCLUDES (jni.h, jni_md.h and friends). If a header cannot be found it throws IllegalStateException. Note the message prints res[i] (the still-null/empty slot) instead of the missing name, so read the source INCLUDES array to know which file is actually missing.","triggerScenarios":"A JDK whose include/ exists but is missing platform headers (jni_md.h lives in include/linux or include/darwin and was not packaged); a partially installed or corrupted JDK; a nonstandard JDK layout where headers sit deeper than depth 2 from include/.","commonSituations":"Distro JDK packages that split headers across packages; hand-copied JDK directories that missed include/<platform>/ subfolders; stripped container images.","solutions":["Check that $JAVA_HOME/include contains jni.h and a platform subfolder (linux/darwin/win32) with jni_md.h; reinstall the JDK-devel package if not.","Point java.home at a complete, official JDK distribution.","If the message is ambiguous (prints null), cross-check the INCLUDES array in JNI.java to identify the missing file."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"Path inc = Paths.get(System.getProperty(\"java.home\"), \"include\");\nfor (String h : new String[]{\"jni.h\", \"linux/jni_md.h\"}) { // adjust platform dir for darwin/win32\n    if (!Files.exists(inc.resolve(h))) {\n        throw new IllegalStateException(\"Missing JNI header \" + h + \" under \" + inc);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Smoke-test that $JAVA_HOME/include contains jni.h plus the platform subfolder with jni_md.h.","Prefer official JDK distributions over distro-split or hand-copied JDK folders."],"tags":["environment","jni-headers","jdk","build-config"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}