Skip to content

Commit

Permalink
Merge pull request #458 from F43nd1r/cleanup
Browse files Browse the repository at this point in the history
Never return null for BuildConfig class
  • Loading branch information
william-ferguson-au committed May 7, 2016
2 parents 1e881be + a8e01dd commit 5b351b6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ private String getStackTraceHash(@Nullable Throwable th) {
@NonNull
private Class<?> getBuildConfigClass() throws ClassNotFoundException {
final Class configuredBuildConfig = config.buildConfigClass();
if (configuredBuildConfig != null && !configuredBuildConfig.equals(Object.class)) {
if (!configuredBuildConfig.equals(Object.class)) {
// If set via annotations or programmatically then it will have a real value,
// otherwise it will be Object.class (annotation default) or null (explicit programmatic).
return configuredBuildConfig;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/acra/config/ACRAConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public final class ACRAConfiguration implements Serializable {

private final ImmutableSet<String> excludeMatchingSharedPreferencesKeys;
private final ImmutableSet<String> excludeMatchingSettingsKeys;
@Nullable
private final Class buildConfigClass;
private final String applicationLogFile;
private final int applicationLogFileLines;
Expand Down Expand Up @@ -359,7 +358,7 @@ public ImmutableSet<String> excludeMatchingSettingsKeys() {
*
* @return Class generated at compile time containing the build config for this application.
*/
@Nullable
@NonNull
public Class buildConfigClass() {
return buildConfigClass;
}
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/org/acra/config/ConfigurationBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -1102,12 +1102,15 @@ String[] excludeMatchingSettingsKeys() {
}

/**
* Will return null if no value has been configured.
* It is up to clients to construct the recommended default value oof context.getClass().getPackage().getName() + BuildConfig.class
* Will return {@link Object} if no value has been configured.
* It is up to clients to construct the recommended default value of context.getClass().getPackage().getName() + BuildConfig.class
*/
@Nullable
@NonNull
Class buildConfigClass() {
return buildConfigClass;
if(buildConfigClass != null) {
return buildConfigClass;
}
return Object.class;
}

@NonNull
Expand Down

0 comments on commit 5b351b6

Please sign in to comment.