Minor: run IntelliJ 'code cleanup'

This commit is contained in:
Mike Hearn 2016-07-11 16:33:17 +02:00
parent 41d092a169
commit 0a2f313d40
12 changed files with 20 additions and 21 deletions

View File

@ -19,7 +19,7 @@ fun newSecureRandom(): SecureRandom {
} }
// "sealed" here means there can't be any subclasses other than the ones defined here. // "sealed" here means there can't be any subclasses other than the ones defined here.
sealed class SecureHash private constructor(bits: ByteArray) : OpaqueBytes(bits) { sealed class SecureHash constructor(bits: ByteArray) : OpaqueBytes(bits) {
class SHA256(bits: ByteArray) : SecureHash(bits) { class SHA256(bits: ByteArray) : SecureHash(bits) {
init { init {
require(bits.size == 32) require(bits.size == 32)

View File

@ -326,7 +326,7 @@ fun createKryo(k: Kryo = Kryo()): Kryo {
// no-arg constructor available. // no-arg constructor available.
instantiatorStrategy = DefaultInstantiatorStrategy(StdInstantiatorStrategy()) instantiatorStrategy = DefaultInstantiatorStrategy(StdInstantiatorStrategy())
register(Arrays.asList("").javaClass, ArraysAsListSerializer()); register(Arrays.asList("").javaClass, ArraysAsListSerializer())
// Because we like to stick a Kryo object in a ThreadLocal to speed things up a bit, we can end up trying to // Because we like to stick a Kryo object in a ThreadLocal to speed things up a bit, we can end up trying to
// serialise the Kryo object itself when suspending a fiber. That's dumb, useless AND can cause crashes, so // serialise the Kryo object itself when suspending a fiber. That's dumb, useless AND can cause crashes, so

View File

@ -32,7 +32,7 @@ class Base58Test {
@Test @Test
fun testDecode() { fun testDecode() {
val testbytes = "Hello World".toByteArray() val testbytes = "Hello World".toByteArray()
val actualbytes = Base58.decode("JxF12TrwUP45BMd"); val actualbytes = Base58.decode("JxF12TrwUP45BMd")
assertTrue(String(actualbytes)) { Arrays.equals(testbytes, actualbytes) } assertTrue(String(actualbytes)) { Arrays.equals(testbytes, actualbytes) }
assertTrue("1") { Arrays.equals(ByteArray(1), Base58.decode("1")) } assertTrue("1") { Arrays.equals(ByteArray(1), Base58.decode("1")) }

View File

@ -43,8 +43,8 @@ class NonEmptySetTest {
.suppressing(CollectionAddAllTester::class.java.getMethod("testAddAll_nullCollectionReference")) .suppressing(CollectionAddAllTester::class.java.getMethod("testAddAll_nullCollectionReference"))
// Disable tests that try to remove everything: // Disable tests that try to remove everything:
.suppressing(CollectionRemoveAllTester::class.java.getMethod("testRemoveAll_nullCollectionReferenceNonEmptySubject")) .suppressing(CollectionRemoveAllTester::class.java.getMethod("testRemoveAll_nullCollectionReferenceNonEmptySubject"))
.suppressing(CollectionClearTester::class.java.getMethods().toList()) .suppressing(CollectionClearTester::class.java.methods.toList())
.suppressing(CollectionRetainAllTester::class.java.getMethods().toList()) .suppressing(CollectionRetainAllTester::class.java.methods.toList())
.createTestSuite() .createTestSuite()
} }

View File

@ -69,7 +69,7 @@ function ThemeNav () {
}) })
.on('click', "[data-toggle='rst-current-version']", function() { .on('click', "[data-toggle='rst-current-version']", function() {
$("[data-toggle='rst-versions']").toggleClass("shift-up"); $("[data-toggle='rst-versions']").toggleClass("shift-up");
}) });
// Make tables responsive // Make tables responsive
$("table.docutils:not(.field-list)") $("table.docutils:not(.field-list)")
@ -139,12 +139,11 @@ function ThemeNav () {
parent_li.siblings().find('li.current').removeClass('current'); parent_li.siblings().find('li.current').removeClass('current');
parent_li.find('> ul li.current').removeClass('current'); parent_li.find('> ul li.current').removeClass('current');
parent_li.toggleClass('current'); parent_li.toggleClass('current');
} };
return nav; return nav;
}; }
module.exports.ThemeNav = ThemeNav();
module.exports.ThemeNav = ThemeNav();
if (typeof(window) != 'undefined') { if (typeof(window) != 'undefined') {
window.SphinxRtdTheme = { StickyNav: module.exports.ThemeNav }; window.SphinxRtdTheme = { StickyNav: module.exports.ThemeNav };

View File

@ -191,7 +191,7 @@ var Stemmer = function() {
w = firstch.toLowerCase() + w.substr(1); w = firstch.toLowerCase() + w.substr(1);
return w; return w;
} }
} };
@ -564,7 +564,7 @@ var Search = {
$u.each(_o, function(o) { $u.each(_o, function(o) {
var _files = o.files; var _files = o.files;
if (_files === undefined) if (_files === undefined)
return return;
if (_files.length === undefined) if (_files.length === undefined)
_files = [_files]; _files = [_files];
@ -574,7 +574,7 @@ var Search = {
for (j = 0; j < _files.length; j++) { for (j = 0; j < _files.length; j++) {
file = _files[j]; file = _files[j];
if (!(file in scoreMap)) if (!(file in scoreMap))
scoreMap[file] = {} scoreMap[file] = {};
scoreMap[file][word] = o.score; scoreMap[file][word] = o.score;
} }
}); });

View File

@ -49,7 +49,7 @@ abstract class MutableClock : Clock() {
*/ */
val mutations: Observable<Long> by lazy { val mutations: Observable<Long> by lazy {
Observable.create({ subscriber: Subscriber<in Long> -> Observable.create({ subscriber: Subscriber<in Long> ->
if (!subscriber.isUnsubscribed()) { if (!subscriber.isUnsubscribed) {
mutationObservers.add(subscriber) mutationObservers.add(subscriber)
// This is not very intuitive, but subscribing to a subscriber observes unsubscribes. // This is not very intuitive, but subscribing to a subscriber observes unsubscribes.
subscriber.add(Subscriptions.create { mutationObservers.remove(subscriber) }) subscriber.add(Subscriptions.create { mutationObservers.remove(subscriber) })

View File

@ -29,7 +29,7 @@ object JsonSupport {
fun createDefaultMapper(identities: IdentityService): ObjectMapper { fun createDefaultMapper(identities: IdentityService): ObjectMapper {
val mapper = ServiceHubObjectMapper(identities) val mapper = ServiceHubObjectMapper(identities)
mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.enable(SerializationFeature.INDENT_OUTPUT)
mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
mapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS) mapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)

View File

@ -32,7 +32,7 @@ var Node.styleClass: String
get() = getAttribute("ui.class") get() = getAttribute("ui.class")
fun createGraph(name: String, styles: String): SingleGraph { fun createGraph(name: String, styles: String): SingleGraph {
System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer"); System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer")
return SingleGraph(name).apply { return SingleGraph(name).apply {
stylesheet = styles stylesheet = styles
setAttribute("ui.quality") setAttribute("ui.quality")

View File

@ -51,7 +51,7 @@ class TraderDemoTest {
"--base-directory", baseDirectory "--base-directory", baseDirectory
) )
val proc = spawn("com.r3corda.demos.TraderDemoKt", args, "TradeDemoSeller") val proc = spawn("com.r3corda.demos.TraderDemoKt", args, "TradeDemoSeller")
assertExitOrKill(proc); assertExitOrKill(proc)
assertEquals(proc.exitValue(), 0) assertEquals(proc.exitValue(), 0)
} }

View File

@ -12,7 +12,7 @@ fun spawn(className: String, args: List<String>, appName: String): Process {
val builder = ProcessBuilder(javaArgs + args) val builder = ProcessBuilder(javaArgs + args)
builder.redirectError(Paths.get("error.$className.log").toFile()) builder.redirectError(Paths.get("error.$className.log").toFile())
builder.inheritIO() builder.inheritIO()
val process = builder.start(); val process = builder.start()
return process return process
} }

View File

@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit
private val client by lazy { private val client by lazy {
OkHttpClient.Builder() OkHttpClient.Builder()
.connectTimeout(5, TimeUnit.SECONDS) .connectTimeout(5, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS).build(); .readTimeout(60, TimeUnit.SECONDS).build()
} }
fun putJson(url: URL, data: String) : Boolean { fun putJson(url: URL, data: String) : Boolean {
@ -27,12 +27,12 @@ fun uploadFile(url: URL, file: String) : Boolean {
val body = MultipartBody.Builder() val body = MultipartBody.Builder()
.setType(MultipartBody.FORM) .setType(MultipartBody.FORM)
.addFormDataPart("rates", "example.rates.txt", RequestBody.create(MediaType.parse("text/plain"), file)) .addFormDataPart("rates", "example.rates.txt", RequestBody.create(MediaType.parse("text/plain"), file))
.build(); .build()
return makeRequest(Request.Builder().url(url).post(body).build()) return makeRequest(Request.Builder().url(url).post(body).build())
} }
private fun makeRequest(request: Request): Boolean { private fun makeRequest(request: Request): Boolean {
val response = client.newCall(request).execute(); val response = client.newCall(request).execute()
if (!response.isSuccessful) { if (!response.isSuccessful) {
println("Could not fulfill HTTP request. Status Code: ${response.code()}. Message: ${response.body()}") println("Could not fulfill HTTP request. Status Code: ${response.code()}. Message: ${response.body()}")