Added init keyword to builtins, maven projects and stdlib

This commit is contained in:
Stanislav Erokhin
2015-04-01 03:58:05 +03:00
parent 7cac6e3c5e
commit 6ab83c9b8c
8 changed files with 18 additions and 17 deletions
+7 -7
View File
@@ -26,7 +26,7 @@ public class ByteProgression(
override val end: Byte, override val end: Byte,
override val increment: Int override val increment: Int
) : Progression<Byte> { ) : Progression<Byte> {
{ init {
if (increment == 0) throw IllegalArgumentException("Increment must be non-zero") if (increment == 0) throw IllegalArgumentException("Increment must be non-zero")
} }
@@ -53,7 +53,7 @@ public class CharProgression(
override val end: Char, override val end: Char,
override val increment: Int override val increment: Int
) : Progression<Char> { ) : Progression<Char> {
{ init {
if (increment == 0) throw IllegalArgumentException("Increment must be non-zero") if (increment == 0) throw IllegalArgumentException("Increment must be non-zero")
} }
@@ -80,7 +80,7 @@ public class ShortProgression(
override val end: Short, override val end: Short,
override val increment: Int override val increment: Int
) : Progression<Short> { ) : Progression<Short> {
{ init {
if (increment == 0) throw IllegalArgumentException("Increment must be non-zero") if (increment == 0) throw IllegalArgumentException("Increment must be non-zero")
} }
@@ -107,7 +107,7 @@ public class IntProgression(
override val end: Int, override val end: Int,
override val increment: Int override val increment: Int
) : Progression<Int> { ) : Progression<Int> {
{ init {
if (increment == 0) throw IllegalArgumentException("Increment must be non-zero") if (increment == 0) throw IllegalArgumentException("Increment must be non-zero")
} }
@@ -134,7 +134,7 @@ public class LongProgression(
override val end: Long, override val end: Long,
override val increment: Long override val increment: Long
) : Progression<Long> { ) : Progression<Long> {
{ init {
if (increment == 0L) throw IllegalArgumentException("Increment must be non-zero") if (increment == 0L) throw IllegalArgumentException("Increment must be non-zero")
} }
@@ -161,7 +161,7 @@ public class FloatProgression(
override val end: Float, override val end: Float,
override val increment: Float override val increment: Float
) : Progression<Float> { ) : Progression<Float> {
{ init {
if (java.lang.Float.isNaN(increment)) throw IllegalArgumentException("Increment must be not NaN") if (java.lang.Float.isNaN(increment)) throw IllegalArgumentException("Increment must be not NaN")
if (increment == 0.0f) throw IllegalArgumentException("Increment must be non-zero") if (increment == 0.0f) throw IllegalArgumentException("Increment must be non-zero")
} }
@@ -189,7 +189,7 @@ public class DoubleProgression(
override val end: Double, override val end: Double,
override val increment: Double override val increment: Double
) : Progression<Double> { ) : Progression<Double> {
{ init {
if (java.lang.Double.isNaN(increment)) throw IllegalArgumentException("Increment must be not NaN") if (java.lang.Double.isNaN(increment)) throw IllegalArgumentException("Increment must be not NaN")
if (increment == 0.0) throw IllegalArgumentException("Increment must be non-zero") if (increment == 0.0) throw IllegalArgumentException("Increment must be non-zero")
} }
@@ -73,7 +73,7 @@ public class $progression(
override val end: $t, override val end: $t,
override val increment: $incrementType override val increment: $incrementType
) : Progression<$t> { ) : Progression<$t> {
{ init {
$constructor $constructor
} }
@@ -279,7 +279,7 @@ public class TakeStream<T>(stream: Stream<T>, count: Int)
public class TakeSequence<T>(private val sequence: Sequence<T>, public class TakeSequence<T>(private val sequence: Sequence<T>,
private val count: Int private val count: Int
) : Sequence<T> { ) : Sequence<T> {
{ init {
if (count < 0) if (count < 0)
throw IllegalArgumentException("count should be non-negative, but is $count") throw IllegalArgumentException("count should be non-negative, but is $count")
} }
@@ -360,7 +360,7 @@ public class DropStream<T>(stream: Stream<T>, count: Int)
public class DropSequence<T>(private val sequence: Sequence<T>, public class DropSequence<T>(private val sequence: Sequence<T>,
private val count: Int private val count: Int
) : Sequence<T> { ) : Sequence<T> {
{ init {
if (count < 0) if (count < 0)
throw IllegalArgumentException("count should be non-negative, but is $count") throw IllegalArgumentException("count should be non-negative, but is $count")
} }
@@ -66,7 +66,7 @@ class KDocConfig() {
*/ */
public var includeProtected: Boolean = true public var includeProtected: Boolean = true
{ init {
// add some common defaults // add some common defaults
addPackageLink("http://docs.oracle.com/javase/6/docs/api/", "java", "org.w3c.dom", "org.xml.sax", "org.omg", "org.ietf.jgss") addPackageLink("http://docs.oracle.com/javase/6/docs/api/", "java", "org.w3c.dom", "org.xml.sax", "org.omg", "org.ietf.jgss")
addPackageLink("http://kentbeck.github.com/junit/javadoc/latest/", "org.junit", "junit") addPackageLink("http://kentbeck.github.com/junit/javadoc/latest/", "org.junit", "junit")
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.template.escapeHtml
class Html2CompilerPlugin(private val compilerArguments: KDocArguments) : Doclet { class Html2CompilerPlugin(private val compilerArguments: KDocArguments) : Doclet {
private val docOutputRoot: File private val docOutputRoot: File
{ init {
val docOutputDir = compilerArguments.docConfig.docOutputDir val docOutputDir = compilerArguments.docConfig.docOutputDir
if (docOutputDir.isEmpty()) { if (docOutputDir.isEmpty()) {
throw IllegalArgumentException("empty doc output dir") throw IllegalArgumentException("empty doc output dir")
@@ -992,7 +992,7 @@ class KPackage(
class KType(val jetType: JetType, model: KModel, val klass: KClass?, val arguments: MutableList<KType> = ArrayList<KType>()) class KType(val jetType: JetType, model: KModel, val klass: KClass?, val arguments: MutableList<KType> = ArrayList<KType>())
: KNamed(klass?.name ?: jetType.toString()!!, model, jetType.getConstructor().getDeclarationDescriptor()!!) { : KNamed(klass?.name ?: jetType.toString()!!, model, jetType.getConstructor().getDeclarationDescriptor()!!) {
{ init {
if (klass != null) { if (klass != null) {
this.wikiDescription = klass.wikiDescription this.wikiDescription = klass.wikiDescription
} }
@@ -209,7 +209,7 @@ public open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArgumen
public val sourceMap: Boolean public val sourceMap: Boolean
get() = kotlinOptions.sourceMap get() = kotlinOptions.sourceMap
{ init {
getOutputs().file(MethodClosure(this, "getOutputFile")) getOutputs().file(MethodClosure(this, "getOutputFile"))
} }
@@ -255,7 +255,7 @@ public open class KDoc() : SourceTask() {
public var destinationDir: File? = null public var destinationDir: File? = null
{ init {
// by default, output dir is not defined in options // by default, output dir is not defined in options
kdocArgs.docConfig.docOutputDir = "" kdocArgs.docConfig.docOutputDir = ""
} }
@@ -16,8 +16,9 @@ trait KotlinSourceSet {
open class KotlinSourceSetImpl(displayName: String?, resolver: FileResolver?): KotlinSourceSet { open class KotlinSourceSetImpl(displayName: String?, resolver: FileResolver?): KotlinSourceSet {
private val kotlin: DefaultSourceDirectorySet = DefaultSourceDirectorySet(displayName + " Kotlin source", resolver); private val kotlin: DefaultSourceDirectorySet = DefaultSourceDirectorySet(displayName + " Kotlin source", resolver)
{
init {
kotlin.getFilter()?.include("**/*.java", "**/*.kt") kotlin.getFilter()?.include("**/*.java", "**/*.kt")
} }