Minor, fix KotlinSignature of DFS methods

This commit is contained in:
Alexander Udalov
2014-04-14 15:59:36 +04:00
parent 79e7ee91e4
commit 4a60c59f39
3 changed files with 9 additions and 8 deletions
@@ -71,14 +71,14 @@ public fun <Function : FunctionHandle, Signature> generateBridges(
private fun <Function : FunctionHandle> findAllReachableDeclarations(function: Function): MutableSet<Function> {
val collector = object : DFS.NodeHandlerWithListResult<Function, Function>() {
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<Function> }, collector)
DFS.dfs(listOf(function), { it.getOverridden() as Iterable<Function> }, collector)
return HashSet(collector.result())
}
@@ -75,13 +75,13 @@ class BridgeTest : TestCase() {
fun findAllReachableDeclarations(from: Fun): MutableSet<Fun> {
val handler = object : DFS.NodeHandlerWithListResult<Fun, Fun>() {
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
@@ -79,16 +79,17 @@ public class DFS {
}
public interface NodeHandler<N, R> {
@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<N> {
@KotlinSignature("fun getNeighbors(current: N?): Iterable<N>")
@KotlinSignature("fun getNeighbors(current: N): Iterable<N>")
@NotNull
Iterable<N> getNeighbors(N current);
}