Skip to content

Commit

Permalink
Add @nullable annotations for pegasus java getters and setters with m…
Browse files Browse the repository at this point in the history
…ode (#932)
  • Loading branch information
macklee authored Sep 11, 2023
1 parent 74f51f5 commit 1fce408
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and what APIs have changed, if applicable.

## [Unreleased]

## [29.45.1] - 2023-09-05
- add @Nullable annotations to pegasus java getters and setters with mode

## [29.45.0] - 2023-08-25

- Downgrade major version back to 29. Technically this is not semver-compatible
Expand Down Expand Up @@ -5524,7 +5527,8 @@ patch operations can re-use these classes for generating patch messages.

## [0.14.1]

[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.45.0...master
[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.45.1...master
[29.45.1]: https://github.com/linkedin/rest.li/compare/v29.45.0...v29.45.1
[29.45.0]: https://github.com/linkedin/rest.li/compare/v30.0.0...v29.45.0
[30.0.0]: https://github.com/linkedin/rest.li/compare/v29.44.0...v30.0.0
[29.44.0]: https://github.com/linkedin/rest.li/compare/v29.43.11...v29.44.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,7 @@ private void generateRecordFieldAccessors(JDefinedClass templateClass, RecordTem
final JMethod getterWithMode = templateClass.method(JMod.PUBLIC, type, getterName);
addAccessorDoc(templateClass, getterWithMode, schemaField, "Getter");
setDeprecatedAnnotationAndJavadoc(getterWithMode, schemaField);
getterWithMode.annotate(Nullable.class);
JVar modeParam = getterWithMode.param(_getModeClass, "mode");
final JBlock getterWithModeBody = getterWithMode.body();

Expand Down Expand Up @@ -1200,6 +1201,7 @@ else if (!schemaField.getOptional())
addAccessorDoc(templateClass, setterWithMode, schemaField, "Setter");
setDeprecatedAnnotationAndJavadoc(setterWithMode, schemaField);
JVar param = setterWithMode.param(type, "value");
param.annotate(Nullable.class);
JVar modeParam = setterWithMode.param(_setModeClass, "mode");
JSwitch modeSwitch = setterWithMode.body()._switch(modeParam);
JCase disallowNullCase = modeSwitch._case(JExpr.ref("DISALLOW_NULL"));
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=29.45.0
version=29.45.1
group=com.linkedin.pegasus
org.gradle.configureondemand=true
org.gradle.parallel=true
Expand Down

0 comments on commit 1fce408

Please sign in to comment.