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

MF-5140 Adds @Nullable & @Nonnull annotations to generated data model getters #527

Merged
merged 11 commits into from
Mar 19, 2024
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
6.1.0 (202X-XX-XX)
---------------------------------------------
- [#527](https://github.com/dropbox/dropbox-sdk-java/pull/527) Adds nullability annotations to data models for improved interop with Kotlin

6.0.0 (2023-11-30)
---------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions android/dependencies/releaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ch.randelshofer:fastdoubleparser:0.8.0
com.fasterxml.jackson.core:jackson-core:2.15.0
com.fasterxml.jackson:jackson-bom:2.15.0
com.google.code.findbugs:jsr305:3.0.2
org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21
Expand Down
1 change: 1 addition & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ sourceSets.main.java.srcDir(versionWriterTask)

dependencies {
api(dropboxJavaSdkLibs.jackson.core)
api(dropboxJavaSdkLibs.jsr305)

compileOnly dropboxJavaSdkLibs.appengine.api
compileOnly dropboxJavaSdkLibs.jakarta.servlet.api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

class SetProfilePhotoArg {
// struct account.SetProfilePhotoArg (account.stone)

Expand All @@ -29,7 +31,7 @@ class SetProfilePhotoArg {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public SetProfilePhotoArg(PhotoSourceArg photo) {
public SetProfilePhotoArg(@Nonnull PhotoSourceArg photo) {
if (photo == null) {
throw new IllegalArgumentException("Required value for 'photo' is null");
}
Expand All @@ -41,6 +43,7 @@ public SetProfilePhotoArg(PhotoSourceArg photo) {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public PhotoSourceArg getPhoto() {
return photo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

public class SetProfilePhotoResult {
// struct account.SetProfilePhotoResult (account.stone)

Expand All @@ -29,7 +31,7 @@ public class SetProfilePhotoResult {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public SetProfilePhotoResult(String profilePhotoUrl) {
public SetProfilePhotoResult(@Nonnull String profilePhotoUrl) {
if (profilePhotoUrl == null) {
throw new IllegalArgumentException("Required value for 'profilePhotoUrl' is null");
}
Expand All @@ -41,6 +43,7 @@ public SetProfilePhotoResult(String profilePhotoUrl) {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getProfilePhotoUrl() {
return profilePhotoUrl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

/**
* Arguments for methods that poll the status of an asynchronous job.
*/
Expand All @@ -34,7 +36,7 @@ public class PollArg {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public PollArg(String asyncJobId) {
public PollArg(@Nonnull String asyncJobId) {
if (asyncJobId == null) {
throw new IllegalArgumentException("Required value for 'asyncJobId' is null");
}
Expand All @@ -50,6 +52,7 @@ public PollArg(String asyncJobId) {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getAsyncJobId() {
return asyncJobId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

/**
* Error occurred because the app is being rate limited.
*/
Expand All @@ -36,7 +38,7 @@ public class RateLimitError {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public RateLimitError(RateLimitReason reason, long retryAfter) {
public RateLimitError(@Nonnull RateLimitReason reason, long retryAfter) {
if (reason == null) {
throw new IllegalArgumentException("Required value for 'reason' is null");
}
Expand All @@ -55,7 +57,7 @@ public RateLimitError(RateLimitReason reason, long retryAfter) {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public RateLimitError(RateLimitReason reason) {
public RateLimitError(@Nonnull RateLimitReason reason) {
this(reason, 1L);
}

Expand All @@ -64,6 +66,7 @@ public RateLimitError(RateLimitReason reason) {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public RateLimitReason getReason() {
return reason;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

class TokenFromOAuth1Arg {
// struct auth.TokenFromOAuth1Arg (auth.stone)

Expand All @@ -32,7 +34,7 @@ class TokenFromOAuth1Arg {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public TokenFromOAuth1Arg(String oauth1Token, String oauth1TokenSecret) {
public TokenFromOAuth1Arg(@Nonnull String oauth1Token, @Nonnull String oauth1TokenSecret) {
if (oauth1Token == null) {
throw new IllegalArgumentException("Required value for 'oauth1Token' is null");
}
Expand All @@ -54,6 +56,7 @@ public TokenFromOAuth1Arg(String oauth1Token, String oauth1TokenSecret) {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getOauth1Token() {
return oauth1Token;
}
Expand All @@ -63,6 +66,7 @@ public String getOauth1Token() {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getOauth1TokenSecret() {
return oauth1TokenSecret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

public class TokenFromOAuth1Result {
// struct auth.TokenFromOAuth1Result (auth.stone)

Expand All @@ -29,7 +31,7 @@ public class TokenFromOAuth1Result {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public TokenFromOAuth1Result(String oauth2Token) {
public TokenFromOAuth1Result(@Nonnull String oauth2Token) {
if (oauth2Token == null) {
throw new IllegalArgumentException("Required value for 'oauth2Token' is null");
}
Expand All @@ -44,6 +46,7 @@ public TokenFromOAuth1Result(String oauth2Token) {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getOauth2Token() {
return oauth2Token;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

public class TokenScopeError {
// struct auth.TokenScopeError (auth.stone)

Expand All @@ -29,7 +31,7 @@ public class TokenScopeError {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public TokenScopeError(String requiredScope) {
public TokenScopeError(@Nonnull String requiredScope) {
if (requiredScope == null) {
throw new IllegalArgumentException("Required value for 'requiredScope' is null");
}
Expand All @@ -41,6 +43,7 @@ public TokenScopeError(String requiredScope) {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getRequiredScope() {
return requiredScope;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

/**
* Contains the arguments to be sent to the Dropbox servers.
*/
Expand All @@ -33,7 +35,7 @@ class EchoArg {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public EchoArg(String query) {
public EchoArg(@Nonnull String query) {
if (query == null) {
throw new IllegalArgumentException("Required value for 'query' is null");
}
Expand All @@ -58,6 +60,7 @@ public EchoArg() {
* @return value for this field, or {@code null} if not present. Defaults to
* "".
*/
@Nonnull
public String getQuery() {
return query;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

/**
* EchoResult contains the result returned from the Dropbox servers.
*/
Expand All @@ -33,7 +35,7 @@ public class EchoResult {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public EchoResult(String result) {
public EchoResult(@Nonnull String result) {
if (result == null) {
throw new IllegalArgumentException("Required value for 'result' is null");
}
Expand All @@ -55,6 +57,7 @@ public EchoResult() {
* @return value for this field, or {@code null} if not present. Defaults to
* "".
*/
@Nonnull
public String getResult() {
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.util.Arrays;
import java.util.regex.Pattern;

import javax.annotation.Nonnull;

/**
* Information about current user's root.
*/
Expand All @@ -40,7 +42,7 @@ public class RootInfo {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public RootInfo(String rootNamespaceId, String homeNamespaceId) {
public RootInfo(@Nonnull String rootNamespaceId, @Nonnull String homeNamespaceId) {
if (rootNamespaceId == null) {
throw new IllegalArgumentException("Required value for 'rootNamespaceId' is null");
}
Expand All @@ -65,6 +67,7 @@ public RootInfo(String rootNamespaceId, String homeNamespaceId) {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getRootNamespaceId() {
return rootNamespaceId;
}
Expand All @@ -74,6 +77,7 @@ public String getRootNamespaceId() {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getHomeNamespaceId() {
return homeNamespaceId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.util.Arrays;
import java.util.regex.Pattern;

import javax.annotation.Nonnull;

/**
* Root info when user is member of a team with a separate root namespace ID.
*/
Expand All @@ -42,7 +44,7 @@ public class TeamRootInfo extends RootInfo {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public TeamRootInfo(String rootNamespaceId, String homeNamespaceId, String homePath) {
public TeamRootInfo(@Nonnull String rootNamespaceId, @Nonnull String homeNamespaceId, @Nonnull String homePath) {
super(rootNamespaceId, homeNamespaceId);
if (homePath == null) {
throw new IllegalArgumentException("Required value for 'homePath' is null");
Expand All @@ -58,6 +60,7 @@ public TeamRootInfo(String rootNamespaceId, String homeNamespaceId, String homeP
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getRootNamespaceId() {
return rootNamespaceId;
}
Expand All @@ -67,6 +70,7 @@ public String getRootNamespaceId() {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getHomeNamespaceId() {
return homeNamespaceId;
}
Expand All @@ -76,6 +80,7 @@ public String getHomeNamespaceId() {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getHomePath() {
return homePath;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.io.IOException;
import java.util.regex.Pattern;

import javax.annotation.Nonnull;

/**
* Root info when user is not member of a team or the user is a member of a team
* and the team does not have a separate root namespace.
Expand All @@ -39,7 +41,7 @@ public class UserRootInfo extends RootInfo {
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public UserRootInfo(String rootNamespaceId, String homeNamespaceId) {
public UserRootInfo(@Nonnull String rootNamespaceId, @Nonnull String homeNamespaceId) {
super(rootNamespaceId, homeNamespaceId);
}

Expand All @@ -51,6 +53,7 @@ public UserRootInfo(String rootNamespaceId, String homeNamespaceId) {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getRootNamespaceId() {
return rootNamespaceId;
}
Expand All @@ -60,6 +63,7 @@ public String getRootNamespaceId() {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getHomeNamespaceId() {
return homeNamespaceId;
}
Expand Down
Loading
Loading