Skip to content

Commit

Permalink
Applying sonar suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
nagarev committed Jan 20, 2022
1 parent c851ae8 commit 4b593f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public enum DisableOption {
DISABLE_STACK("disableStack", "stack"),
DISABLE_STORAGE("disableStorage", "storage");

final String option;
final String value;
public final String option;
public final String value;

DisableOption(String option, String value) {
this.option = option;
Expand Down
22 changes: 9 additions & 13 deletions rskj-core/src/main/java/co/rsk/rpc/modules/debug/TraceOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@

public class TraceOptions {

private List<String> supportedOptions;
private Set<String> disabledFields;
private Set<String> unsupportedOptions;
private final List<String> supportedOptions;
private final Set<String> disabledFields;
private final Set<String> unsupportedOptions;

public TraceOptions(Map<String, String> traceOptions) {
init();
supportedOptions = new ArrayList<>();
supportedOptions.addAll(Arrays.stream(DisableOption.values())
.map(option -> option.option).collect(Collectors.toList()));

this.disabledFields = new HashSet<>();
this.unsupportedOptions = new HashSet<>();

if (traceOptions == null || traceOptions.isEmpty()) return;

Expand All @@ -49,15 +54,6 @@ public TraceOptions(Map<String, String> traceOptions) {
.forEach(unsupportedOptions::add);
}

public void init() {
supportedOptions = new ArrayList<>();
supportedOptions.addAll(Arrays.stream(DisableOption.values())
.map(option -> option.option).collect(Collectors.toList()));

this.disabledFields = new HashSet<>();
this.unsupportedOptions = new HashSet<>();
}

public Set<String> getDisabledFields() {
return Collections.unmodifiableSet(disabledFields);
}
Expand Down

0 comments on commit 4b593f8

Please sign in to comment.