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

Warning fixes #171

Merged
merged 5 commits into from
Oct 21, 2024
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 @@ -102,7 +102,12 @@ public static VariableModification<BigInteger> explicitValueFromFile(int value)
public BigInteger modify(BigInteger oldVal) {
if (value == null) {
System.out.println("Enter new value for BigInt: ");
value = new Scanner(System.in).nextBigInteger();
Scanner scanner = new Scanner(System.in);
try {
value = scanner.nextBigInteger();
} finally {
scanner.close();
}
}
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ public static List<ModifiableVariableListHolder> getAllModifiableVariableHolders
Object possibleHolder = f.get(object);
if (possibleHolder != null && holdsVariable != null) {
if (possibleHolder instanceof List) {
holders.addAll(
getAllModifiableVariableHoldersFromList((List) possibleHolder));
@SuppressWarnings("unchecked")
List<Object> castedList = List.class.cast(possibleHolder);
holders.addAll(getAllModifiableVariableHoldersFromList(castedList));
} else if (possibleHolder.getClass().isArray()) {
holders.addAll(
getAllModifiableVariableHoldersFromArray(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public void setField(Field field) {
this.field = field;
}

public ModifiableVariable getModifiableVariable()
public ModifiableVariable<?> getModifiableVariable()
throws IllegalArgumentException, IllegalAccessException {
field.setAccessible(true);
return (ModifiableVariable) field.get(object);
return (ModifiableVariable<?>) field.get(object);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,32 @@ private boolean containsFieldName(String name, List<Field> list) {
}

private static class SimpleClassWithModVariables {
@SuppressWarnings("unused")
Integer x;

@SuppressWarnings("unused")
ModifiableBigInteger bi;

@SuppressWarnings("unused")
ModifiableByteArray array;

@SuppressWarnings("unused")
ModifiableInteger i;

@HoldsModifiableVariable SimpleClassWithModVariables test;
}

private static class SimpleClassWithModVariablesList {
@SuppressWarnings("unused")
Integer x;

@SuppressWarnings("unused")
ModifiableBigInteger bi;

@SuppressWarnings("unused")
ModifiableByteArray array;

@SuppressWarnings("unused")
ModifiableInteger i;

@HoldsModifiableVariable SimpleClassWithModVariables test;
Expand Down