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,9 +16,12 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

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

@Nonnull
protected final PhotoSourceArg photo;

/**
Expand All @@ -29,7 +32,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 +44,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,9 +16,12 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

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

@Nonnull
protected final String profilePhotoUrl;

/**
Expand All @@ -29,7 +32,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 +44,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,12 +16,15 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

/**
* Arguments for methods that poll the status of an asynchronous job.
*/
public class PollArg {
// struct async.PollArg (async.stone)

@Nonnull
protected final String asyncJobId;

/**
Expand All @@ -34,7 +37,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 +53,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,12 +16,15 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

/**
* Error occurred because the app is being rate limited.
*/
public class RateLimitError {
// struct auth.RateLimitError (auth.stone)

@Nonnull
protected final RateLimitReason reason;
protected final long retryAfter;

Expand All @@ -36,7 +39,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 +58,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 +67,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,10 +16,14 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

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

@Nonnull
protected final String oauth1Token;
@Nonnull
protected final String oauth1TokenSecret;

/**
Expand All @@ -32,7 +36,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 +58,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 +68,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,9 +16,12 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

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

@Nonnull
protected final String oauth2Token;

/**
Expand All @@ -29,7 +32,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 +47,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,9 +16,12 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

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

@Nonnull
protected final String requiredScope;

/**
Expand All @@ -29,7 +32,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 +44,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,12 +16,15 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

/**
* Contains the arguments to be sent to the Dropbox servers.
*/
class EchoArg {
// struct check.EchoArg (check_api_v2_types.stone)

@Nonnull
protected final String query;

/**
Expand All @@ -33,7 +36,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 +61,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,12 +16,15 @@
import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;

/**
* EchoResult contains the result returned from the Dropbox servers.
*/
public class EchoResult {
// struct check.EchoResult (check_api_v2_types.stone)

@Nonnull
protected final String result;

/**
Expand All @@ -33,7 +36,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 +58,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,13 +17,17 @@
import java.util.Arrays;
import java.util.regex.Pattern;

import javax.annotation.Nonnull;

/**
* Information about current user's root.
*/
public class RootInfo {
// struct common.RootInfo (common.stone)

@Nonnull
protected final String rootNamespaceId;
@Nonnull
protected final String homeNamespaceId;

/**
Expand All @@ -40,7 +44,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 +69,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 +79,7 @@ public String getRootNamespaceId() {
*
* @return value for this field, never {@code null}.
*/
@Nonnull
public String getHomeNamespaceId() {
return homeNamespaceId;
}
Expand Down
Loading
Loading