基于 Apache Isis 2 SimpleApp JDO 项目(https://github.com/apache/isis-app-simpleapp/tree/jdo),我尝试稍微修改类以使用 LombokSimpleObject
将某些字段(name
和)标记为不可为空notes
注释@NonNull
。这意外地导致编译失败
Error: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project simpleapp-jdo-module-simple: Compilation failure: Compilation failure:
Error: /home/runner/work/isis-app-simpleapp/isis-app-simpleapp/module-simple/target/generated-sources/annotations/domainapp/modules/simple/dom/so/QSimpleObject.java:[35,51] cannot find symbol
Error: symbol: class java
Error: location: class domainapp.modules.simple.dom.so.QSimpleObject
Error: /home/runner/work/isis-app-simpleapp/isis-app-simpleapp/module-simple/target/generated-sources/annotations/domainapp/modules/simple/dom/so/QSimpleObject.java:[36,51] cannot find symbol
Error: symbol: class java
Error: location: class domainapp.modules.simple.dom.so.QSimpleObject
Error: -> [Help 1]
相关 GitHub 操作:https ://github.com/a-st/isis-app-simpleapp/runs/5330590432
DataNucleus 生成的类isis-app-simpleapp/module-simple/target/generated-sources/annotations/domainapp/modules/simple/dom/so/QSimpleObject.java
如下所示
package domainapp.modules.simple.dom.so;
import javax.annotation.Generated;
import javax.jdo.query.*;
import org.datanucleus.api.jdo.query.*;
@Generated(value="org.datanucleus.jdo.query.JDOQueryProcessor")
public class QSimpleObject extends PersistableExpressionImpl<SimpleObject> implements PersistableExpression<SimpleObject>
{
public static final QSimpleObject jdoCandidate = candidate("this");
public static QSimpleObject candidate(String name)
{
return new QSimpleObject(null, name, 5);
}
public static QSimpleObject candidate()
{
return jdoCandidate;
}
public static QSimpleObject parameter(String name)
{
return new QSimpleObject(SimpleObject.class, name, ExpressionType.PARAMETER);
}
public static QSimpleObject variable(String name)
{
return new QSimpleObject(SimpleObject.class, name, ExpressionType.VARIABLE);
}
public final ObjectExpression<org.apache.isis.applib.services.repository.RepositoryService> repositoryService;
public final ObjectExpression<org.apache.isis.applib.services.title.TitleService> titleService;
public final ObjectExpression<org.apache.isis.applib.services.message.MessageService> messageService;
public final ObjectExpression<@lombok.NonNull java.lang.String> name;
public final ObjectExpression<@lombok.NonNull java.lang.String> notes;
public QSimpleObject(PersistableExpression parent, String name, int depth)
{
super(parent, name);
this.repositoryService = new ObjectExpressionImpl<org.apache.isis.applib.services.repository.RepositoryService>(this, "repositoryService");
this.titleService = new ObjectExpressionImpl<org.apache.isis.applib.services.title.TitleService>(this, "titleService");
this.messageService = new ObjectExpressionImpl<org.apache.isis.applib.services.message.MessageService>(this, "messageService");
this.name = new StringExpressionImpl(this, "name");
this.notes = new StringExpressionImpl(this, "notes");
}
public QSimpleObject(Class type, String name, ExpressionType exprType)
{
super(type, name, exprType);
this.repositoryService = new ObjectExpressionImpl<org.apache.isis.applib.services.repository.RepositoryService>(this, "repositoryService");
this.titleService = new ObjectExpressionImpl<org.apache.isis.applib.services.title.TitleService>(this, "titleService");
this.messageService = new ObjectExpressionImpl<org.apache.isis.applib.services.message.MessageService>(this, "messageService");
this.name = new StringExpressionImpl(this, "name");
this.notes = new StringExpressionImpl(this, "notes");
}
}
根据 Visual Studio Code,以下几行导致问题 ( Illegally placed annotation: type annotations must directly precede the simple name of the type they are meant to affect (or the [] for arrays)Java(1610613796)
)
public final ObjectExpression<@lombok.NonNull java.lang.String> name;
public final ObjectExpression<@lombok.NonNull java.lang.String> notes;
源代码位于https://github.com/a-st/isis-app-simpleapp/tree/jdo-lombok-nonnull