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

Jsonb JsonbTransient on class field diagnostic #241

Closed
1 of 4 tasks
Tracked by #16
aditrada opened this issue Feb 9, 2022 · 3 comments
Closed
1 of 4 tasks
Tracked by #16

Jsonb JsonbTransient on class field diagnostic #241

aditrada opened this issue Feb 9, 2022 · 3 comments
Assignees
Labels
diagnostic Diagnostic item

Comments

@aditrada
Copy link
Contributor

aditrada commented Feb 9, 2022

Description:

@JsonbTransient is mutually exclusive with all other JSON Binding defined annotations. That is, when this annotation is present on a class field, then there should be no other annotations on that class field.

Specification:

Acceptable:

@JsonbTransient
String name;

Error:

@JsonbTransient
@JsonbProperty("name")
String name;

JsonbTransient Annotation

Specifically, when @JsonbTransient annotation is present on a field, the following annotations should not be there on the same field:

@JsonbAnnotation
@JsonbCreator
@JsonbDateFormat
@JsonbNillable
@JsonbNumberFormat
@JsonbProperty
@JsonbPropertyOrder
@JsonbTypeAdapter
@JsonbTypeDeserializer
@JsonbTypeSerializer
@JsonbVisibility

Type of language feature proposed:

Select all that apply

  • diagnostic
  • quick-fix
  • snippet
  • other, please specify:
@kathrynkodama
Copy link
Contributor

kathrynkodama commented Feb 9, 2022

Thanks @adit333, from the spec:
If a class field is annotated with @JsonbTransient, exception is thrown when this field, getter or setter is annotated with other JSON Binding annotations.

Can you please clarify/list what the other JSON Binding annotations the diagnostic would check for?

Also consider that a quick-fix could be offered to fix this diagnostic:

  1. Remove the @JsonbTransient annotation
  2. Remove all JSON Binding annotations but the @JsonbTransient annotation

@kathrynkodama
Copy link
Contributor

@adit333 can this issue be closed now that #256 has been merged?

@aditrada
Copy link
Contributor Author

Yes, it can be closed

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

No branches or pull requests

2 participants