Commit f74ee547 authored by Him188's avatar Him188

Fix #369

parent bba5b005
...@@ -261,7 +261,7 @@ private fun Method.registerEvent( ...@@ -261,7 +261,7 @@ private fun Method.registerEvent(
} }
} }
when (kotlinFunction.returnType.classifier) { when (kotlinFunction.returnType.classifier) {
Unit::class -> { Unit::class, Nothing::class -> {
scope.subscribeAlways( scope.subscribeAlways(
param[1].type.classifier as KClass<out Event>, param[1].type.classifier as KClass<out Event>,
priority = annotation.priority, priority = annotation.priority,
...@@ -289,7 +289,7 @@ private fun Method.registerEvent( ...@@ -289,7 +289,7 @@ private fun Method.registerEvent(
} else callFunction(this) as ListeningStatus } else callFunction(this) as ListeningStatus
}.also { listener = it } }.also { listener = it }
} }
else -> error("Illegal method return type. Required Void or ListeningStatus, found ${kotlinFunction.returnType.classifier}") else -> error("Illegal method return type. Required Void, Nothing or ListeningStatus, found ${kotlinFunction.returnType.classifier}")
} }
} else { } else {
// java methods // java methods
...@@ -299,7 +299,7 @@ private fun Method.registerEvent( ...@@ -299,7 +299,7 @@ private fun Method.registerEvent(
"Illegal method parameter. Required one exact Event subclass. found $paramType" "Illegal method parameter. Required one exact Event subclass. found $paramType"
} }
when (this.returnType) { when (this.returnType) {
Void::class.java -> { Void::class.java, Void.TYPE -> {
scope.subscribeAlways( scope.subscribeAlways(
paramType.kotlin as KClass<out Event>, paramType.kotlin as KClass<out Event>,
priority = annotation.priority, priority = annotation.priority,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment