Skip to content

Commit

Permalink
Add final to instanceof variable declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDoe committed Feb 9, 2024
1 parent a6b073e commit dac1d2d
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private static long returnNull() {
////////////////////////

private long objectToInteger(final Object object) {
if (object instanceof Long longObject) {
if (object instanceof final Long longObject) {
return longObject;
}
LogUtils.PRIMITIVES.severe(() -> "Object to long called with non-Long: " + object);
Expand All @@ -286,7 +286,7 @@ private long objectToInteger(final Object object) {
}

private double objectToFloat(final Object object) {
if (object instanceof FloatObject floatObject) {
if (object instanceof final FloatObject floatObject) {
return floatObject.getValue();
}
LogUtils.PRIMITIVES.severe(() -> "Object to long called with non-FloatObject: " + object);
Expand Down Expand Up @@ -333,7 +333,7 @@ private long instanceOfCheck(final long oop, final Class<?> klass) {

private long nativeObjectCheck(final long oop, final Predicate<NativeObject> predicate) {
final Object object = objectRegistryGet(oop);
if (object instanceof NativeObject nativeObject) {
if (object instanceof final NativeObject nativeObject) {
return returnBoolean(predicate.test(nativeObject));
}
return returnVoid();
Expand All @@ -345,15 +345,15 @@ private long nativeObjectCheck(final long oop, final Predicate<NativeObject> pre

private long booleanValueOf(final long oop) {
final Object object = objectRegistryGet(oop);
if (object instanceof Boolean bool) {
if (object instanceof final Boolean bool) {
return returnBoolean(bool);
}
primitiveFail();
return returnNull();
}

private long byteSizeOf(final long oop) {
if (objectRegistryGet(oop) instanceof NativeObject nativeObject) {
if (objectRegistryGet(oop) instanceof final NativeObject nativeObject) {
return NativeObjectStorage.from(nativeObject).byteSizeOf();
}
// type is not supported (yet)
Expand Down Expand Up @@ -474,7 +474,7 @@ private long fetchPointerofObject(final long index, final long oop) {
}

private NativeObjectStorage firstIndexableField(final long oop) {
if (objectRegistryGet(oop) instanceof NativeObject nativeObject) {
if (objectRegistryGet(oop) instanceof final NativeObject nativeObject) {
final NativeObjectStorage storage = NativeObjectStorage.from(nativeObject);
postPrimitiveCleanups.add(storage);
return storage;
Expand All @@ -488,7 +488,7 @@ private double floatValueOf(final long oop) {

private long instantiateClassindexableSize(final long classPointer, final long size) {
final Object object = objectRegistryGet(classPointer);
if (object instanceof ClassObject classObject) {
if (object instanceof final ClassObject classObject) {
final AbstractSqueakObject newObject = SqueakObjectNewNode.executeUncached(context, classObject, (int) size);
return oopFor(newObject);
}
Expand Down Expand Up @@ -529,10 +529,10 @@ private long isPointers(final long oop) {

private long isPositiveMachineIntegerObject(final long oop) {
final Object object = objectRegistryGet(oop);
if (object instanceof Long integer) {
if (object instanceof final Long integer) {
return returnBoolean(integer >= 0L);
}
if (object instanceof LargeIntegerObject largeInteger) {
if (object instanceof final LargeIntegerObject largeInteger) {
return returnBoolean(largeInteger.isZeroOrPositive() && largeInteger.fitsIntoLong());
}
return returnBoolean(false);
Expand Down

0 comments on commit dac1d2d

Please sign in to comment.