Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.springframework.lang.Nullable not supported #1040

Open
klaus7 opened this issue Nov 17, 2023 · 1 comment
Open

org.springframework.lang.Nullable not supported #1040

klaus7 opened this issue Nov 17, 2023 · 1 comment

Comments

@klaus7
Copy link

klaus7 commented Nov 17, 2023

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?

@weberhofer
Copy link

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 effect
  • javax.annotation.Nullable which could work is no longer available, jakarta.annotation.Nullable results in the same issue as described above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants