From 4a60c59f3969b090e0956147a21a641e6781e5c6 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 14 Apr 2014 15:59:36 +0400 Subject: [PATCH] Minor, fix KotlinSignature of DFS methods --- compiler/backend-common/src/bridges/bridges.kt | 6 +++--- compiler/tests/org/jetbrains/jet/codegen/BridgeTest.kt | 6 +++--- core/util.runtime/src/org/jetbrains/jet/utils/DFS.java | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/compiler/backend-common/src/bridges/bridges.kt b/compiler/backend-common/src/bridges/bridges.kt index 7ebc16845de..0ea7f09041f 100644 --- a/compiler/backend-common/src/bridges/bridges.kt +++ b/compiler/backend-common/src/bridges/bridges.kt @@ -71,14 +71,14 @@ public fun generateBridges( private fun findAllReachableDeclarations(function: Function): MutableSet { val collector = object : DFS.NodeHandlerWithListResult() { - override fun afterChildren(current: Function?) { - if (current != null && current.isDeclaration) { + override fun afterChildren(current: Function) { + if (current.isDeclaration) { result.add(current) } } } [suppress("UNCHECKED_CAST")] - DFS.dfs(listOf(function), { it!!.getOverridden() as Iterable }, collector) + DFS.dfs(listOf(function), { it.getOverridden() as Iterable }, collector) return HashSet(collector.result()) } diff --git a/compiler/tests/org/jetbrains/jet/codegen/BridgeTest.kt b/compiler/tests/org/jetbrains/jet/codegen/BridgeTest.kt index d980273efa9..933f5024bba 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/BridgeTest.kt +++ b/compiler/tests/org/jetbrains/jet/codegen/BridgeTest.kt @@ -75,13 +75,13 @@ class BridgeTest : TestCase() { fun findAllReachableDeclarations(from: Fun): MutableSet { val handler = object : DFS.NodeHandlerWithListResult() { - override fun afterChildren(current: Fun?) { - if (current!!.isDeclaration) { + override fun afterChildren(current: Fun) { + if (current.isDeclaration) { result.add(current) } } } - DFS.dfs(listOf(from), { it!!.getOverridden() }, handler) + DFS.dfs(listOf(from), { it.getOverridden() }, handler) val result = HashSet(handler.result()) result.remove(from) return result diff --git a/core/util.runtime/src/org/jetbrains/jet/utils/DFS.java b/core/util.runtime/src/org/jetbrains/jet/utils/DFS.java index 0cef37a5c9f..d2926ddb926 100644 --- a/core/util.runtime/src/org/jetbrains/jet/utils/DFS.java +++ b/core/util.runtime/src/org/jetbrains/jet/utils/DFS.java @@ -79,16 +79,17 @@ public class DFS { } public interface NodeHandler { - + @KotlinSignature("fun beforeChildren(current: N): Unit") void beforeChildren(N current); + @KotlinSignature("fun afterChildren(current: N): Unit") void afterChildren(N current); R result(); } public interface Neighbors { - @KotlinSignature("fun getNeighbors(current: N?): Iterable") + @KotlinSignature("fun getNeighbors(current: N): Iterable") @NotNull Iterable getNeighbors(N current); }