Skip to content

Commit

Permalink
Clean up IDEA warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mlopatkin committed Apr 26, 2024
1 parent f4188de commit 4b02fa0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.gradle.internal.snapshot.ValueSnapshot;
import org.gradle.internal.snapshot.ValueSnapshotter;

import javax.annotation.Nullable;

public class EnumValueSnapshot implements ValueSnapshot {
private final String className;
private final String name;
Expand All @@ -44,19 +46,17 @@ public String getName() {
}

@Override
public ValueSnapshot snapshot(Object value, ValueSnapshotter snapshotter) {
public ValueSnapshot snapshot(@Nullable Object value, ValueSnapshotter snapshotter) {
if (isEqualEnum(value)) {
return this;
}
return snapshotter.snapshot(value);
}

private boolean isEqualEnum(Object value) {
if (value instanceof Enum) {
private boolean isEqualEnum(@Nullable Object value) {
if (value instanceof Enum<?>) {
Enum<?> enumValue = (Enum<?>) value;
if (enumValue.name().equals(name) && enumValue.getDeclaringClass().getName().equals(className)) {
return true;
}
return enumValue.name().equals(name) && enumValue.getDeclaringClass().getName().equals(className);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Isolates an Enum value and is a snapshot for that value.
*/
public class IsolatedEnumValueSnapshot extends EnumValueSnapshot implements Isolatable<Enum> {
public class IsolatedEnumValueSnapshot extends EnumValueSnapshot implements Isolatable<Enum<?>> {
private final Enum<?> value;

public IsolatedEnumValueSnapshot(Enum<?> value) {
Expand All @@ -43,7 +43,7 @@ public ValueSnapshot asSnapshot() {
}

@Override
public Enum isolate() {
public Enum<?> isolate() {
return value;
}

Expand Down

0 comments on commit 4b02fa0

Please sign in to comment.