{"record":{"id":"c4ee88908b3906bf","repo":"quarkusio/quarkus","slug":"getter-gettername-of-class-returntypeclass","errorCode":null,"errorMessage":"Getter '${getterName}' of class '${returnTypeClassInfo}' must be public","messagePattern":"Getter '(.+?)' of class '(.+?)' must be public","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/generation/multipart/FormDataOutputMapperGenerator.java","lineNumber":177,"sourceCode":"                    AnnotationInstance formParamInstance = field.annotation(REST_FORM_PARAM);\n                    if (formParamInstance == null) {\n                        formParamInstance = field.annotation(FORM_PARAM);\n                    }\n                    if (formParamInstance == null) { // fields not annotated with @RestForm or @FormParam are completely ignored\n                        continue;\n                    }\n\n                    boolean useFieldAccess = false;\n                    String getterName = JavaBeanUtil.getGetterName(field.name(), field.type().name());\n                    Type fieldType = field.type();\n                    DotName fieldDotName = fieldType.name();\n                    MethodInfo getter = currentClassInHierarchy.method(getterName);\n                    if (getter == null) {\n                        // even if the field is private, it will be transformed to be made public\n                        useFieldAccess = true;\n                    }\n                    if (!useFieldAccess && !Modifier.isPublic(getter.flags())) {\n                        throw new IllegalArgumentException(\n                                \"Getter '\" + getterName + \"' of class '\" + returnTypeClassInfo + \"' must be public\");\n                    }\n\n                    String formAttrName = field.name();\n                    AnnotationValue formParamValue = formParamInstance.value();\n                    if (formParamValue != null) {\n                        formAttrName = formParamValue.asString();\n                    }\n\n                    // TODO: not sure this is correct, but it seems to be what RESTEasy does and it also makes most sense in the context of a POJO\n                    String partType = MediaType.TEXT_PLAIN;\n                    AnnotationInstance partTypeInstance = field.annotation(ResteasyReactiveDotNames.PART_TYPE_NAME);\n                    if (partTypeInstance != null) {\n                        AnnotationValue partTypeValue = partTypeInstance.value();\n                        if (partTypeValue != null) {\n                            partType = partTypeValue.asString();\n                        }\n                    }","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/generation/multipart/FormDataOutputMapperGenerator.java#L159-L195","documentation":"When generating a mapper that reads properties of a multipart OUTPUT form class back from a request, FormDataOutputMapperGenerator calls the bean getter. If a getter exists in the hierarchy but is not public (and field access is not being used), the generated mapper cannot invoke it, so the build fails with this IllegalArgumentException.","triggerScenarios":"Using a class as a multipart/@RestForm output type where a field's getter (found via class hierarchy lookup) is protected, private or package-private while field access is not enabled for that field.","commonSituations":"Base classes with protected getters reused in multipart forms; Lombok generating non-public accessors via custom settings; tightening visibility during refactoring.","solutions":["Make the getter public in the form class.","If the getter is non-public in a superclass, override it publicly in the subclass.","Remove the getter so the generator falls back to field access (fields are made public during transformation)."],"exampleFix":"// before\nclass UploadForm {\n    protected String getName() { return name; }\n}\n// after\nclass UploadForm {\n    public String getName() { return name; }\n}","handlingStrategy":"validation","validationCode":"import java.lang.reflect.Method;\nimport java.lang.reflect.Modifier;\n\nvoid validateFormGettersPublic(Class<?> formClass) {\n    for (Method m : formClass.getMethods()) {\n        if (m.getParameterCount() == 0 && m.getName().startsWith(\"get\")\n                && m.getDeclaringClass() == formClass\n                && !Modifier.isPublic(m.getModifiers())) {\n            throw new IllegalStateException(\"Form getter must be public: \" + m);\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make all getters on multipart form classes public.","Check superclass getters — the generator walks the hierarchy.","If using Lombok, keep the default public access level for getters.","Either a public getter or direct field access; avoid non-public getters."],"tags":["quarkus","resteasy-reactive","build-time","multipart","encapsulation"],"backgroundTag":"getter-must-be-public","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"}