Merged in remove-warnings (pull request #169)

Remove warnings
This commit is contained in:
Andras Slemmer 2016-06-20 14:45:04 +01:00
commit 32b593671b
8 changed files with 14 additions and 11 deletions

View File

@ -10,6 +10,10 @@ apply plugin: QuasarPlugin
allprojects {
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
buildscript {

View File

@ -229,7 +229,7 @@ public class JavaCommercialPaper implements Contract {
return SecureHash.sha256("https://en.wikipedia.org/wiki/Commercial_paper");
}
public TransactionBuilder generateIssue(@NotNull PartyAndReference issuance, @NotNull Amount faceValue, @Nullable Instant maturityDate, @NotNull Party notary) {
public TransactionBuilder generateIssue(@NotNull PartyAndReference issuance, @NotNull Amount<Issued<Currency>> faceValue, @Nullable Instant maturityDate, @NotNull Party notary) {
State state = new State(issuance, issuance.getParty().getOwningKey(), faceValue, maturityDate);
TransactionState output = new TransactionState<>(state, notary);
return new TransactionType.General.Builder().withItems(output, new Command(new Commands.Issue(), issuance.getParty().getOwningKey()));

View File

@ -172,7 +172,7 @@ class Cash : FungibleAsset<Currency>() {
val keysUsed = gathered.map { it.state.data.owner }.toSet()
val states = gathered.groupBy { it.state.data.deposit }.map {
val (deposit, coins) = it
val coins = it.value
val totalAmount = coins.map { it.state.data.amount }.sumOrThrow()
TransactionState(State(totalAmount, to), coins.first().state.notary)
}

View File

@ -385,7 +385,7 @@ class CashTests {
makeCash(80.SWISS_FRANCS, MINI_CORP, 2)
)
fun makeSpend(amount: Amount<Currency>, dest: PublicKey, corp: Party, depositRef: OpaqueBytes = defaultRef): WireTransaction {
fun makeSpend(amount: Amount<Currency>, dest: PublicKey, @Suppress("UNUSED_PARAMETER") corp: Party, @Suppress("UNUSED_PARAMETER") depositRef: OpaqueBytes = defaultRef): WireTransaction {
val tx = TransactionType.General.Builder()
Cash().generateSpend(tx, amount, dest, WALLET)
return tx.toWireTransaction()
@ -516,8 +516,8 @@ class CashTests {
Cash.State(4000.DOLLARS `issued by` defaultIssuer, MEGA_CORP_PUBKEY)
)
// Test that summing everything produces the total number of dollars
var expected = 7000.DOLLARS `issued by` defaultIssuer
var actual = states.sumCash()
val expected = 7000.DOLLARS `issued by` defaultIssuer
val actual = states.sumCash()
assertEquals(expected, actual)
}

View File

@ -212,12 +212,12 @@ inline fun <T> Kryo.useClassLoader(cl: ClassLoader, body: () -> T) : T {
}
}
inline fun Output.writeBytesWithLength(byteArray: ByteArray) {
fun Output.writeBytesWithLength(byteArray: ByteArray) {
this.writeInt(byteArray.size, true)
this.writeBytes(byteArray)
}
inline fun Input.readBytesWithLength(): ByteArray {
fun Input.readBytesWithLength(): ByteArray {
val size = this.readInt(true)
return this.readBytes(size)
}

View File

@ -3,7 +3,6 @@ package com.r3corda.core.serialization
import com.google.common.primitives.Ints
import com.r3corda.core.crypto.generateKeyPair
import com.r3corda.core.crypto.signWithECDSA
import com.r3corda.core.crypto.verifyWithECDSA
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.assertThatThrownBy
import org.junit.Test

View File

@ -103,7 +103,7 @@ class ProtocolStateMachineImpl<R>(val logic: ProtocolLogic<R>,
private fun suspend(with: StateMachineManager.FiberRequest) {
parkAndSerialize { fiber, serializer ->
try {
suspendAction!!(with)
suspendAction(with)
} catch (t: Throwable) {
logger.warn("Captured exception which was swallowed by Quasar", t)
// TODO to throw or not to throw, that is the question

View File

@ -201,7 +201,7 @@ fun runBuyer(node: Node, amount: Amount<Issued<Currency>>) {
}
val future = if (node.isPreviousCheckpointsPresent) {
val (buyer, future) = node.smm.findStateMachines(TraderDemoProtocolBuyer::class.java).single()
val (@Suppress("UNUSED_VARIABLE") buyer, future) = node.smm.findStateMachines(TraderDemoProtocolBuyer::class.java).single()
future
} else {
// We use a simple scenario-specific wrapper protocol to make things happen.
@ -381,4 +381,4 @@ class TraderDemoProtocolSeller(val myAddress: HostAndPort,
return move.tx.outRef(0)
}
}
}