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

Make fields final in a few classes; suppress warning in another class #1032

Merged
merged 1 commit into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ public class PropertyMaskingOptions {
*/
@NonNull
@Builder.Default
List<String> maskedFieldRegexps = new ArrayList<>();
final List<String> maskedFieldRegexps = new ArrayList<>();

/**
* The replacement text for masked field values. Can be {@code null}.
*/
@Builder.Default
String maskedFieldReplacementText = DEFAULT_MASK_TEXT_REPLACEMENT;
final String maskedFieldReplacementText = DEFAULT_MASK_TEXT_REPLACEMENT;

/**
* The replacement text for serialization errors. Can be {@code null}.
*/
@Builder.Default
String serializationErrorReplacementText = DEFAULT_FAILED_TEXT_REPLACEMENT;
final String serializationErrorReplacementText = DEFAULT_FAILED_TEXT_REPLACEMENT;
}
12 changes: 6 additions & 6 deletions src/main/java/org/kiwiproject/retry/SimpleRetryer.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,42 +92,42 @@ public class SimpleRetryer {
*/
@VisibleForTesting
@Builder.Default
KiwiEnvironment environment = new DefaultEnvironment();
final KiwiEnvironment environment = new DefaultEnvironment();

/**
* The maximum number of attempts before giving up.
*/
@VisibleForTesting
@Builder.Default
int maxAttempts = DEFAULT_MAX_ATTEMPTS;
final int maxAttempts = DEFAULT_MAX_ATTEMPTS;

/**
* The time to sleep between retry attempts.
*/
@VisibleForTesting
@Builder.Default
long retryDelayTime = DEFAULT_RETRY_DELAY_TIME;
final long retryDelayTime = DEFAULT_RETRY_DELAY_TIME;

/**
* The time unit for the time to sleep between retry attempts.
*/
@VisibleForTesting
@Builder.Default
TimeUnit retryDelayUnit = DEFAULT_RETRY_DELAY_UNIT;
final TimeUnit retryDelayUnit = DEFAULT_RETRY_DELAY_UNIT;

/**
* The common type/description to include in log messages for each attempt.
*/
@VisibleForTesting
@Builder.Default
String commonType = DEFAULT_TYPE;
final String commonType = DEFAULT_TYPE;

/**
* The SLF4J log level to use when logging retry attempts. The first attempt is always logged at TRACE level.
*/
@VisibleForTesting
@Builder.Default
Level logLevelForSubsequentAttempts = DEFAULT_RETRY_LOG_LEVEL;
final Level logLevelForSubsequentAttempts = DEFAULT_RETRY_LOG_LEVEL;

/**
* Try to get an object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ void shouldAllowEmpty() {
var user = User.builder().requiredOrEmptyPrefs(new Preferences()).build();
assertNoPropertyViolations(validator, user, "requiredOrEmptyPrefs");
}

@Test
void shouldNotFlagNonEmptyAsViolation() {
var user = User.builder().requiredPrefs(new Preferences(Map.of("theme", "dark"))).build();
assertNoPropertyViolations(validator, user, "requiredPrefs");
}
}

@Nested
Expand Down Expand Up @@ -257,6 +263,7 @@ static class User {
@AllArgsConstructor
static class Preferences {

@SuppressWarnings("CanBeFinal")
Map<String, String> values = new HashMap<>();

public boolean isEmpty() {
Expand Down