Based on the Apache Isis 2 SimpleApp JDO project (https://github.com/apache/isis-app-simpleapp/tree/jdo) I tried to slightly modify the SimpleObject
class to mark some fields (name
and notes
) as not nullable using the Lombok annotation @NonNull
. This unexpectedly results in a compilation failure
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]
Related GitHub Action: https://github.com/a-st/isis-app-simpleapp/runs/5330590432
The DataNucleus generated class isis-app-simpleapp/module-simple/target/generated-sources/annotations/domainapp/modules/simple/dom/so/QSimpleObject.java
looks like this
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");
}
}
According to Visual Studio Code the following lines are causing issues (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;
The source code is located at https://github.com/a-st/isis-app-simpleapp/tree/jdo-lombok-nonnull
Issue seems to be related to https://github.com/datanucleus/datanucleus-jdo-query/issues/18 and is solved with specifying