diff --git a/finance/src/main/java/net/corda/contracts/JavaCommercialPaper.java b/finance/src/main/java/net/corda/contracts/JavaCommercialPaper.java index 68b780c718..fe5f0e6c5e 100644 --- a/finance/src/main/java/net/corda/contracts/JavaCommercialPaper.java +++ b/finance/src/main/java/net/corda/contracts/JavaCommercialPaper.java @@ -81,7 +81,7 @@ public class JavaCommercialPaper implements Contract { return owner; } - public Amount> getFaceValue() { + Amount> getFaceValue() { return faceValue; } @@ -119,7 +119,7 @@ public class JavaCommercialPaper implements Contract { return result; } - public State withoutOwner() { + State withoutOwner() { return new State(issuance, new AnonymousParty(NullPublicKey.INSTANCE), faceValue, maturityDate); } @@ -171,9 +171,7 @@ public class JavaCommercialPaper implements Contract { // There are two possible things that can be done with this CP. The first is trading it. The second is redeeming // it for cash on or after the maturity date. final List> commands = tx.getCommands().stream().filter( - it -> { - return it.getValue() instanceof Commands; - } + it -> it.getValue() instanceof Commands ).collect(Collectors.toList()); final AuthenticatedObject command = Iterables.getOnlyElement(commands); final TimeWindow timeWindow = tx.getTimeWindow(); @@ -247,7 +245,7 @@ public class JavaCommercialPaper implements Contract { @Suspendable public void generateRedeem(TransactionBuilder tx, StateAndRef paper, ServiceHub services) throws InsufficientBalanceException { - Cash.generateSpend(services, tx, Structures.withoutIssuer(paper.getState().getData().getFaceValue()), paper.getState().getData().getOwner(), Collections.EMPTY_SET); + Cash.generateSpend(services, tx, Structures.withoutIssuer(paper.getState().getData().getFaceValue()), paper.getState().getData().getOwner(), Collections.emptySet()); tx.addInputState(paper); tx.addCommand(new Command<>(new Commands.Redeem(), paper.getState().getData().getOwner().getOwningKey())); } diff --git a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/SerializationOutputTests.kt b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/SerializationOutputTests.kt index ebb97347dd..2252d2ec3c 100644 --- a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/SerializationOutputTests.kt +++ b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/SerializationOutputTests.kt @@ -14,8 +14,6 @@ import net.corda.nodeapi.RPCException import net.corda.nodeapi.internal.serialization.AbstractAMQPSerializationScheme import net.corda.nodeapi.internal.serialization.EmptyWhitelist import net.corda.nodeapi.internal.serialization.amqp.SerializerFactory.Companion.isPrimitive -import net.corda.nodeapi.internal.serialization.SerializationFactoryImpl -import net.corda.nodeapi.internal.serialization.AMQPServerSerializationScheme import net.corda.nodeapi.internal.serialization.AllWhitelist import net.corda.testing.MEGA_CORP import net.corda.testing.MEGA_CORP_PUBKEY @@ -96,35 +94,35 @@ class SerializationOutputTests { data class SortedSetWrapper(val set: SortedSet) - open class InheritedGeneric(val foo: X) + open class InheritedGeneric(val foo: X) data class ExtendsGeneric(val bar: Int, val pub: String) : InheritedGeneric(pub) - interface GenericInterface { + interface GenericInterface { val pub: X } data class ImplementsGenericString(val bar: Int, override val pub: String) : GenericInterface - data class ImplementsGenericX(val bar: Int, override val pub: Y) : GenericInterface + data class ImplementsGenericX(val bar: Int, override val pub: Y) : GenericInterface - abstract class AbstractGenericX : GenericInterface + abstract class AbstractGenericX : GenericInterface - data class InheritGenericX(val duke: Double, override val pub: A) : AbstractGenericX() + data class InheritGenericX(val duke: Double, override val pub: A) : AbstractGenericX() data class CapturesGenericX(val foo: GenericInterface) object KotlinObject class Mismatch(fred: Int) { - val ginger: Int = fred + private val ginger: Int = fred override fun equals(other: Any?): Boolean = (other as? Mismatch)?.ginger == ginger override fun hashCode(): Int = ginger } class MismatchType(fred: Long) { - val ginger: Int = fred.toInt() + private val ginger: Int = fred.toInt() override fun equals(other: Any?): Boolean = (other as? MismatchType)?.ginger == ginger override fun hashCode(): Int = ginger @@ -246,7 +244,7 @@ class SerializationOutputTests { @Test(expected = IllegalArgumentException::class) fun `test dislike of HashMap`() { - val obj = WrapHashMap(HashMap()) + val obj = WrapHashMap(HashMap()) serdes(obj) } @@ -358,7 +356,7 @@ class SerializationOutputTests { @Test fun `test TreeMap property`() { - val obj = TreeMapWrapper(TreeMap()) + val obj = TreeMapWrapper(TreeMap()) obj.tree[456] = Foo("Fred", 123) serdes(obj) } @@ -438,11 +436,10 @@ class SerializationOutputTests { } } - fun assertSerializedThrowableEquivalent(t: Throwable, desThrowable: Throwable) { + private fun assertSerializedThrowableEquivalent(t: Throwable, desThrowable: Throwable) { assertTrue(desThrowable is CordaRuntimeException) // Since we don't handle the other case(s) yet if (desThrowable is CordaRuntimeException) { assertEquals("${t.javaClass.name}: ${t.message}", desThrowable.message) - assertTrue(desThrowable is CordaRuntimeException) assertTrue(Objects.deepEquals(t.stackTrace, desThrowable.stackTrace)) assertEquals(t.suppressed.size, desThrowable.suppressed.size) t.suppressed.zip(desThrowable.suppressed).forEach { (before, after) -> assertSerializedThrowableEquivalent(before, after) }