{"record":{"id":"8fff13c828bdb023","repo":"theonedev/onedev","slug":"getter-not-found-for-property-dependson-propert","errorCode":null,"errorMessage":"Getter not found for property: ${dependsOn.property()}","messagePattern":"Getter not found for property: (.+?)","errorType":"validation","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java","lineNumber":1355,"sourceCode":"\t\tvar location = metaConstraint.getLocation();\n\t\tif (location instanceof TypeArgumentConstraintLocation) {\n\t\t\tlocation = ((TypeArgumentConstraintLocation) location).getOuterDelegate();\n\t\t}\t\t\n\t\tif (location instanceof AbstractPropertyConstraintLocation && valueContext.getCurrentBean() != null) {\n\t\t\t// Check if this constraint comes from a superclass method that has been overridden\n\t\t\tif (isConstraintFromOverriddenMethod(location, valueContext.getCurrentBean().getClass(), metaConstraint.getDescriptor().getAnnotationType())) {\n\t\t\t\treturn false; // Skip validation for constraints from overridden superclass methods\n\t\t\t}\n\t\t\tvar bean = valueContext.getCurrentBean();\t\t\t\n\t\t\tvar propertyName = ((AbstractPropertyConstraintLocation<?>) location).getPropertyName();\n\t\t\tvar getter = BeanUtils.findGetter(bean.getClass(), propertyName);\n\t\t\tif (getter == null) {\n\t\t\t\tthrow new ExplicitException(\"Getter not found for property: \" + propertyName);\n\t\t\t}\n\t\t\tfor (var dependsOn : getter.getAnnotationsByType(DependsOn.class)) {\n\t\t\t\tvar dependencyGetter = BeanUtils.findGetter(bean.getClass(), dependsOn.property());\n\t\t\t\tif (dependencyGetter == null) {\n\t\t\t\t\tthrow new ExplicitException(\"Getter not found for property: \" + dependsOn.property());\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tvar dependencyPropertyValue = dependencyGetter.invoke(bean);\n\t\t\t\t\tif (!DependsOnUtils.isPropertyVisible(dependsOn, dependencyGetter.getReturnType(), dependencyPropertyValue))\n\t\t\t\t\t\treturn false;\n\t\t\t\t} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {\n\t\t\t\t\tthrow new ExplicitException(\"Error invoking getter for property: \" + dependsOn.property(), e);\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar showCondition = getter.getAnnotation(ShowCondition.class);\n\t\t\tif (showCondition != null) {\n\t\t\t\tEditContext.push(new EditContext() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Object getInputValue(String name) {\n\t\t\t\t\t\tvar getter =  BeanUtils.findGetter(bean.getClass(), name);\n\t\t\t\t\t\tif (getter == null) {\n\t\t\t\t\t\t\tfor (var eachGetter: BeanUtils.findGetters(bean.getClass())) {\n\t\t\t\t\t\t\t\tif (EditableUtils.getDisplayName(eachGetter).equals(name)) {","sourceCodeStart":1337,"sourceCodeEnd":1373,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java#L1337-L1373","documentation":"Variant of the getter-not-found error: the constrained property's getter exists, but a @DependsOn annotation on it references another property whose getter cannot be found on the bean class. OneDev needs the dependency getter to evaluate whether the constrained property should be visible/validated.","triggerScenarios":"A getter annotated @DependsOn(property=\"x\") where the bean has no getter for 'x' — typically a typo in the dependsOn property name, a renamed/deleted dependency property, or a dependency field lacking a getter.","commonSituations":"OneDev settings/input forms using conditional properties, refactoring property names without updating @DependsOn references, boolean dependency properties using wrong accessor prefix.","solutions":["Correct the property name in @DependsOn to reference an existing getter.","Add the missing getter for the referenced property.","Remove the stale @DependsOn if the dependency property no longer exists."],"exampleFix":"// before\n@DependsOn(property = \"enabeld\") // typo\npublic Boolean isVerbose() { return verbose; }\n\n// after\n@DependsOn(property = \"enabled\")\npublic Boolean isVerbose() { return verbose; }","handlingStrategy":"type-guard","validationCode":"for (DependsOn d : getter.getAnnotationsByType(DependsOn.class)) {\n    if (BeanUtils.findGetter(beanClass, d.property()) == null)\n        throw new IllegalStateException(\"@DependsOn references missing getter: \" + d.property());\n}","typeGuard":"static boolean dependsOnPropertiesExist(Class<?> type) {\n    for (Method m : type.getMethods()) {\n        for (DependsOn d : m.getAnnotationsByType(DependsOn.class)) {\n            String cap = Character.toUpperCase(d.property().charAt(0)) + d.property().substring(1);\n            try { type.getMethod(\"get\" + cap); }\n            catch (NoSuchMethodException e) { return false; }\n        }\n    }\n    return true;\n}","tryCatchPattern":"try {\n    validator.validate(bean);\n} catch (Exception e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Getter not found\")) {\n        // fix @DependsOn property name or add the referenced getter\n    } else throw e;\n}","preventionTips":["After renaming a property, search for all @DependsOn references to it.","Keep @DependsOn values as compile-checked constants where possible.","Add an early startup/test check that all @DependsOn references resolve."],"tags":["validation","reflection","javabeans","onedev"],"backgroundTag":"getter-not-found","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}