org.springframework.lang.Nullable not supported
klaus7 opened this issue · comments
Klaus Pfeiffer commented
Hello,
some external dependency I use (and inherit from) uses the org.springframework.lang.Nullable annotation. When I add this to my list of nullable annotations like:
val gen = TypeScriptGenerator(Settings().apply {
// ...
nullableAnnotations = listOf(
org.springframework.lang.Nullable::class.java,
javax.annotation.Nullable::class.java,
jakarta.annotation.Nullable::class.java,
)
... it will fail with the following error:
Exception in thread "main" java.lang.RuntimeException: 'org.springframework.lang.Nullable' annotation cannot be used as nullable annotation because it doesn't have 'TYPE_PARAMETER' or 'TYPE_USE' target.
at cz.habarta.typescript.generator.Settings.validate(Settings.java:410)
at cz.habarta.typescript.generator.TypeScriptGenerator.<init>(TypeScriptGenerator.java:59)
This is in the spring framework, so I can't really change anything in the annotation, but I guess the annotation provided by spring should be supported as it is?
Johannes Weberhofer commented
That would really be a nice enhancement. At least with Java 21 org.checkerframework.checker.nullness.qual.Nullable
seems to be the only working annotation for Nullable
.
org.eclipse.jdt.annotation.Nullable
can be configured, but does not have any effectjavax.annotation.Nullable
which could work is no longer available,jakarta.annotation.Nullable
results in the same issue as described above.