From fe032a8ba9669ebc979d11fdd995d7f92c34501b Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Mon, 14 Nov 2016 14:08:20 +0300 Subject: [PATCH] Add missing classes to work without builtins. (#57) --- runtime/src/main/kotlin/kotlin/Annotation.kt | 8 ++++++++ runtime/src/main/kotlin/kotlin/Throwable.kt | 15 +++++++++++++++ runtime/src/main/kotlin/kotlin/annotations.kt | 13 +++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 runtime/src/main/kotlin/kotlin/Annotation.kt create mode 100644 runtime/src/main/kotlin/kotlin/Throwable.kt diff --git a/runtime/src/main/kotlin/kotlin/Annotation.kt b/runtime/src/main/kotlin/kotlin/Annotation.kt new file mode 100644 index 00000000000..a9f5a9703dc --- /dev/null +++ b/runtime/src/main/kotlin/kotlin/Annotation.kt @@ -0,0 +1,8 @@ +package kotlin + +/** + * Base interface implicitly implemented by all annotation interfaces. + * See [Kotlin language documentation](http://kotlinlang.org/docs/reference/annotations.html) for more information + * on annotations. + */ +public interface Annotation diff --git a/runtime/src/main/kotlin/kotlin/Throwable.kt b/runtime/src/main/kotlin/kotlin/Throwable.kt new file mode 100644 index 00000000000..f2bc07cdd8a --- /dev/null +++ b/runtime/src/main/kotlin/kotlin/Throwable.kt @@ -0,0 +1,15 @@ +package kotlin + +/** + * The base class for all errors and exceptions. Only instances of this class can be thrown or caught. + * + * @param message the detail message string. + * @param cause the cause of this throwable. + */ +public open class Throwable(open val message: String?, open val cause: Throwable?) { + constructor(message: String?) : this(message, null) + + constructor(cause: Throwable?) : this(cause?.toString(), cause) + + constructor() : this(null, null) +} diff --git a/runtime/src/main/kotlin/kotlin/annotations.kt b/runtime/src/main/kotlin/kotlin/annotations.kt index 87b57312545..aea14403a09 100644 --- a/runtime/src/main/kotlin/kotlin/annotations.kt +++ b/runtime/src/main/kotlin/kotlin/annotations.kt @@ -10,11 +10,20 @@ package kotlin */ //@Target(AnnotationTarget.FUNCTION) //@Retention(AnnotationRetention.SOURCE) -annotation class SymbolName(val name: kotlin.String) +annotation class SymbolName(val name: String) /** * Exports the TypeInfo of this class by given name to use it from runtime. */ //@Target(AnnotationTarget.CLASS) //@Retention(AnnotationRetention.SOURCE) -annotation class ExportTypeInfo(val name: kotlin.String) +annotation class ExportTypeInfo(val name: String) + +/** + * Suppresses the given compilation warnings in the annotated element. + * @property names names of the compiler diagnostics to suppress. + */ +//@Target(CLASS, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, +// CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, TYPE, EXPRESSION, FILE, TYPEALIAS) +//@Retention(SOURCE) +public annotation class Suppress(vararg val names: String) \ No newline at end of file