{"record":{"id":"494da58492a36b6a","repo":"oracle/graal","slug":"input-field-must-not-be-public","errorCode":null,"errorMessage":"Input field must not be public","messagePattern":"Input field must not be public","errorType":"validation","errorClass":"ElementException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler.processor/src/jdk/graal/compiler/nodeinfo/processor/GraphNodeVerifier.java","lineNumber":141,"sourceCode":"                        throw new ElementException(field, \"Field cannot be both input and successor\");\n                    } else if (isNonOptionalInput && isOptionalInput) {\n                        throw new ElementException(field, \"Inputs must be either optional or non-optional\");\n                    } else if (isAssignableWithErasure(field, NodeInputList)) {\n                        if (modifiers.contains(FINAL)) {\n                            throw new ElementException(field, \"Input list field must not be final\");\n                        }\n                        if (modifiers.contains(PUBLIC)) {\n                            throw new ElementException(field, \"Input list field must not be public\");\n                        }\n                    } else {\n                        if (!isAssignableWithErasure(field, Node) && field.getKind() == ElementKind.INTERFACE) {\n                            throw new ElementException(field, \"Input field type must be an interface or assignable to Node\");\n                        }\n                        if (modifiers.contains(FINAL)) {\n                            throw new ElementException(field, \"Input field must not be final\");\n                        }\n                        if (modifiers.contains(PUBLIC)) {\n                            throw new ElementException(field, \"Input field must not be public\");\n                        }\n                    }\n                } else if (isSuccessor) {\n                    if (isAssignableWithErasure(field, NodeSuccessorList)) {\n                        if (modifiers.contains(FINAL)) {\n                            throw new ElementException(field, \"Successor list field must not be final\");\n                        }\n                        if (modifiers.contains(PUBLIC)) {\n                            throw new ElementException(field, \"Successor list field must not be public\");\n                        }\n                    } else {\n                        if (!isAssignableWithErasure(field, Node)) {\n                            throw new ElementException(field, \"Successor field must be a Node type\");\n                        }\n                        if (modifiers.contains(FINAL)) {\n                            throw new ElementException(field, \"Successor field must not be final\");\n                        }\n                        if (modifiers.contains(PUBLIC)) {","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.processor/src/jdk/graal/compiler/nodeinfo/processor/GraphNodeVerifier.java#L123-L159","documentation":"Single-valued input fields (@Input/@OptionalInput, non-list) must not be public. Public input fields would allow uncontrolled mutation of graph edges, breaking the usage-tracking invariants the generated node code maintains (inputs must be changed via methods that update usages lists). This is a compile-time check performed over the node class and all superclasses.","triggerScenarios":"modifiers.contains(PUBLIC) on an @Input/@OptionalInput field in the non-NodeInputList branch at GraphNodeVerifier.java:140-142, e.g. '@Input public ValueNode value;'.","commonSituations":"Node classes written like public data carriers; generated code that emits public fields; refactoring a public struct into a Node while keeping field visibility.","solutions":["Reduce the field's visibility to protected or package-private.","Expose read access via a getter if callers need the input value.","Rebuild with mx build to confirm."],"exampleFix":"// before\n@Input\npublic ValueNode value;\n\n// after\n@Input\nprotected ValueNode value;","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep input fields protected or package-private.","Expose read-only access with a getter (e.g. ValueNode x() { return x; }) as the existing nodes do.","Review field visibility when converting existing classes into nodes."],"tags":["java","graalvm","annotation-processing","graal-node","encapsulation","compile-time"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}