ReflectionHelper::assertGetterMethod() 与 Construction Heuristics 要求冲突

ReflectionHelper::assertGetterMethod() conflicts with Construction Heuristics requirement

我有以下内容:

@CustomShadowVariable(variableListenerRef = @PlanningVariableReference(variableName = "..."))
@Override
public boolean isXyz() {
    return xyz;
}

然后我得到以下信息:

java.lang.IllegalStateException: The entityClass (class ...) has a PlanningVariable annotated member (bean property ... on class ...) that returns a primitive type (boolean). This means it cannot represent an uninitialized variable as null and the Construction Heuristics think it's already initialized.
Maybe let the member (...) return its primitive wrapper type instead.

...看到我真的会将 boolean 更改为 Boolean,但我会得到以下内容:

java.lang.IllegalStateException: The getterMethod (public java.lang.Boolean isXyz()) with a CustomShadowVariable annotation must have a primitive boolean return type (class java.lang.Boolean) or use another prefix in its methodName (isXyz).

Construction Heuristics 似乎需要一个可为 null 的类型,因此它可以有一个 null 初始化值,但是当提供一个 Boolean 对象时,反射帮助程序断言会尝试根据失败的原始类型对其进行验证。

这是缺陷吗?

将方法名称更改为 getXyz(完整签名:Boolean getXyz())。

我只是在猜测,因为我手边没有包含此类影子变量的示例域。但是查看 ReflectionHelper 代码,这可能是解决方案。如果可行,我会尝试改进异常消息。