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

Generated Class and CompletableFuture<Void> Annotations #3170

Merged
merged 7 commits into from
Aug 18, 2023

Conversation

ramsessanchez
Copy link
Contributor

@ramsessanchez ramsessanchez commented Aug 17, 2023

Fixes: #3106

Also,
Noticed an edge case that wasn't considered when I removed the annotations from 'Void' returns.
Initially removed annotations when the return value is 'Void', however Api-Linting for the Java-SDK is telling us that an annotation is still needed if the Void return is wrapped in a completable future.

    public java.util.concurrent.CompletableFuture<Void> delete() {
        return delete(null);
    }

Needs to be

    @jakarta.annotation.Nonnull
    public java.util.concurrent.CompletableFuture<Void> delete() {
        return delete(null);
    }

@ramsessanchez ramsessanchez requested a review from a team as a code owner August 17, 2023 21:21
@ramsessanchez ramsessanchez changed the title CompletableFuture<Void> still needs annotation Generated Class and CompletableFuture<Void> Annotations Aug 17, 2023
Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a changelog entry.
You're probably missing adding a using in the refiner for the generated annotation.

@ramsessanchez
Copy link
Contributor Author

ramsessanchez commented Aug 18, 2023

@baywet , Should I add a using in the refiner or simply use the full annotation in a similar way to the other annotations? It would be like: "jakarta.annotation.Generated("com.microsoft.kiota") instead of just "Generated"
Also, I put "com.microsoft.kiota" as the place holder for the 'name' value that is required for the generation annotation, is this a good name to use or is there a better option in your opinion?

@baywet
Copy link
Member

baywet commented Aug 18, 2023

I think the name is good, you should probably centralize the constant in the JavaConventionService though.
As per the refiner, just add Generated, additional symbol will be in the import statement and that's not going to work well.

@ramsessanchez
Copy link
Contributor Author

ramsessanchez commented Aug 18, 2023

additional symbol will be in the import statement and that's not going to work well.
What do you mean here?

Also, would that then be a standard that we should refactor? If we are already using the jakarta annotations across the board quite frequently then should it simply be added to the refiner? So that the Nullable (and NonNull) annotations are also just 'Nullable' rather than the current 'jakarta.annotation.Nullable'?

@baywet
Copy link
Member

baywet commented Aug 18, 2023

I misread your prior question. Please go ahead and use the full name for the annotation to align with others. Sorry about the confusion.
We can go to the refiner way, which would map closer to the other languages, however if we do that we need to add those keywords to the reserved name provider (Nonnull, Nullable, Generated). Your call.

Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it was because I hadn't added the fully qualified name. Just added that, should be good soon.

@sonarcloud
Copy link

sonarcloud bot commented Aug 18, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

90.0% 90.0% Coverage
0.0% 0.0% Duplication

@ramsessanchez ramsessanchez merged commit 413fc87 into main Aug 18, 2023
94 checks passed
@ramsessanchez ramsessanchez deleted the java_kotlinRequiredAnnotations branch August 18, 2023 20:59
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

Successfully merging this pull request may close these issues.

Add the generated annotation to Java classes and enums
2 participants