compilation fix

This commit is contained in:
Maxim Shafirov
2013-02-13 16:14:33 +04:00
parent 63f88cdf65
commit b851c5597a
3 changed files with 15 additions and 4 deletions
+13
View File
@@ -67,3 +67,16 @@ public inline fun <T> List<T>.reduceRight(operation: (T, T) -> T) : T {
return r
}
/**
* Returns a original Iterable containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
*/
public inline fun <T:Any> List<T?>.requireNoNulls() : List<T> {
for (element in this) {
if (element == null) {
throw IllegalArgumentException("null element found in $this")
}
}
return this as List<T>
}
@@ -1,7 +1,6 @@
package org.jetbrains.kotlin.doc
import java.util.*
import org.jetbrains.kotlin.doc.model.KPackage
/**
* The configuration used with KDoc
@@ -114,7 +113,7 @@ class KDocConfig() {
private class LongestFirstStringComparator() : Comparator<String> {
public override fun compare(s1: String, s2: String): Int {
return compareBy(s1, s2, { length() }, { this })
return compareBy<String>(s1, s2, { length() }, { this })
}
public override fun equals(obj : Any?) : Boolean {
@@ -3,7 +3,6 @@ package org.jetbrains.kotlin.doc.model
import java.io.File
import org.jetbrains.jet.cli.common.CompilerPlugin
import org.jetbrains.jet.cli.common.CompilerPluginContext
import org.jetbrains.kotlin.doc.KDocArguments
/** Base class for any compiler plugin which needs to process a KModel */
abstract class KModelCompilerPlugin(
@@ -17,7 +16,7 @@ abstract class KModelCompilerPlugin(
val bindingContext = context.getContext()
val sources = context.getFiles()
val sourceDirs: List<File> = arguments.getSourceDirs().orEmpty().requireNoNulls().map { path -> File(path) }
val model = KModel(bindingContext, arguments.apply(), sourceDirs, sources.orEmpty().requireNoNulls())
val model = KModel(bindingContext, arguments.apply(), sourceDirs, sources.requireNoNulls())
processModel(model)
}