Issue Description
Generated sources are not compatible with JSpecify annotations. org.jspecify.annotations.NonNull is specified as @Target(TYPE_USE) so the annotation needs to directly precede the type.
Steps to Reproduce
- Install plugin
- Set up project to use the config below
- Create a simple schema with a required element on a list type
type Example {
listExample: [String]!
}
- Run a build to attempt to compile
- Compilation error:
/build/generated/sources/graphqlCodegen/test/graphql/model/Example.java:NN: error: scoping construct cannot be annotated with type-use annotation: @org.jspecify.annotations.NonNull
private java.util.List listExample;
^
Expected Result
The sources are generated and can compile without errors.
private java.util. @org.jspecify.annotations.NonNull List<String> listExample;
Actual Result
The sources are generated in a way that cannot be compiled.
@org.jspecify.annotations.NonNull
private java.util.List<String> listExample;
Your Environment and Setup
- graphql-java-codegen version: 5.10.0
- Build tool: Gradle 8.13
- Mapping Config:
graphqlCodegen {
graphqlSchemas {
rootDir = "$projectDir/src/main/resources/graphql"
}
generateApis = false
generateEqualsAndHashCode = true
generateImmutableModels = true
generateToString = true
modelValidationAnnotation = '@org.jspecify.annotations.NonNull'
outputDir = new File(graphqlCodegenSourcesDir)
packageName = 'test.graphql.model'
}
Issue Description
Generated sources are not compatible with JSpecify annotations.
org.jspecify.annotations.NonNullis specified as@Target(TYPE_USE)so the annotation needs to directly precede the type.Steps to Reproduce
/build/generated/sources/graphqlCodegen/test/graphql/model/Example.java:NN: error: scoping construct cannot be annotated with type-use annotation: @org.jspecify.annotations.NonNull
private java.util.List listExample;
^
Expected Result
The sources are generated and can compile without errors.
Actual Result
The sources are generated in a way that cannot be compiled.
Your Environment and Setup
graphqlCodegen { graphqlSchemas { rootDir = "$projectDir/src/main/resources/graphql" } generateApis = false generateEqualsAndHashCode = true generateImmutableModels = true generateToString = true modelValidationAnnotation = '@org.jspecify.annotations.NonNull' outputDir = new File(graphqlCodegenSourcesDir) packageName = 'test.graphql.model' }