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

[ERROR] javax.annotation.Nullable is not found #1534

Open
kislerdm opened this issue Dec 26, 2024 · 1 comment
Open

[ERROR] javax.annotation.Nullable is not found #1534

kislerdm opened this issue Dec 26, 2024 · 1 comment
Labels
area/codegen Code generation area/sdks SDKs kind/bug Some behavior is incorrect or out of spec

Comments

@kislerdm
Copy link

What happened?

Hello pulumi team!

Problem

It appears that the java sdk generator is configured to yield the codebase contradictory to the gradle configuration:

  • On the one hand, the annotation @Nullable is imported from the package javax.annotation.
  • On the other, the gradle is configured to use java 11:
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(11)
    }
}

javax.annotation has been removed from java 11, see the API overview.

Proposed solution

Modify the SDK generator to swap the package javax.annotation with jakarta.annotation. The drawback is the change of the dependency's licences to EPL-2.0 and GPL from CDDL and GPL-2.0.

Example

Steps to reproduce

  1. git clone git@github.com:kislerdm/pulumi-neon.git ${HOME}/pulumi-neon
  2. mkdir -p sdk-java-temp
  3. pulumi package gen-sdk schema.json -o sdk-java-temp --language java
  4. cd sdk-java-temp/java
  5. gradle build

Error message

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler output below.
  ${HOME}/pulumi-neon/sdk-java-temp/src/main/java/com/pulumi/neon/Provider.java:13: error: package javax.annotation does not exist
  import javax.annotation.Nullable;
                         ^
  22 errors

Dependencies

Gradle version:

gradle --version

Output:

------------------------------------------------------------
Gradle 8.12
------------------------------------------------------------

Build time:    2024-12-20 15:46:53 UTC
Revision:      a3cacb207fec727859be9354c1937da2e59004c1

Kotlin:        2.0.21
Groovy:        3.0.22
Ant:           Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM:  23.0.1 (Homebrew 23.0.1)
Daemon JVM:    /opt/homebrew/Cellar/openjdk/23.0.1/libexec/openjdk.jdk/Contents/Home (no JDK specified, using current Java home)
OS:            Mac OS X 14.2.1 aarch64

Output of pulumi about

CLI          
Version      3.134.1
Go Version   go1.23.1
Go Compiler  gc

Host     
OS       darwin
Version  14.2.1
Arch     arm64

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/kislerdm
User           kislerdm
Organizations  kislerdm
Token type     personal

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@kislerdm kislerdm added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Dec 26, 2024
@justinvp justinvp added area/codegen Code generation area/sdks SDKs and removed needs-triage Needs attention from the triage team labels Jan 6, 2025
@justinvp
Copy link
Member

justinvp commented Jan 6, 2025

Thanks for opening this issue @kislerdm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/codegen Code generation area/sdks SDKs kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants