diff --git a/js/js.libraries/src/core/core.kt b/js/js.libraries/src/core/core.kt index 481d774ff28..da25142f48b 100644 --- a/js/js.libraries/src/core/core.kt +++ b/js/js.libraries/src/core/core.kt @@ -21,10 +21,4 @@ fun parseInt(s : String) : Int = js.noImpl library fun safeParseInt(s : String) : Int? = js.noImpl library -fun safeParseDouble(s : String) : Double? = js.noImpl -library -open class Exception() : Throwable() {} -library -open class RuntimeException() : Exception() {} -library -class NumberFormatException() : Exception() {} \ No newline at end of file +fun safeParseDouble(s : String) : Double? = js.noImpl \ No newline at end of file diff --git a/js/js.libraries/src/core/javalang.kt b/js/js.libraries/src/core/javalang.kt index 4e2c2ce288b..fee437eda5a 100644 --- a/js/js.libraries/src/core/javalang.kt +++ b/js/js.libraries/src/core/javalang.kt @@ -8,6 +8,9 @@ trait Iterable { fun iterator() : java.util.Iterator = js.noImpl } +library +open class Exception() : Throwable() {} + library("splitString") public fun String.split(regex : String) : Array = js.noImpl @@ -19,6 +22,9 @@ class IllegalStateException(message: String = "") : Exception() {} library class IndexOutOfBoundsException(message: String = "") : Exception() {} - +s library class UnsupportedOperationException(message: String = "") : Exception() {} + +library +class NumberFormatException(message: String = "") : Exception() {} diff --git a/js/js.libraries/src/core/javautil.kt b/js/js.libraries/src/core/javautil.kt index a57259f64d9..50659c3ab67 100644 --- a/js/js.libraries/src/core/javautil.kt +++ b/js/js.libraries/src/core/javautil.kt @@ -1,7 +1,6 @@ package java.util -import js.*; - +import java.lang.* library("collectionsMax") public fun max(col : Collection, comp : Comparator) : T = js.noImpl diff --git a/js/js.translator/src/org/jetbrains/k2js/analyze/AnalyzerFacadeForJS.java b/js/js.translator/src/org/jetbrains/k2js/analyze/AnalyzerFacadeForJS.java index 22a29692c54..5a39152ab82 100644 --- a/js/js.translator/src/org/jetbrains/k2js/analyze/AnalyzerFacadeForJS.java +++ b/js/js.translator/src/org/jetbrains/k2js/analyze/AnalyzerFacadeForJS.java @@ -174,8 +174,9 @@ public final class AnalyzerFacadeForJS { @Override public void addDefaultImports(@NotNull Collection directives) { - //TODO: these thing should not be hard-coded like that + //TODO: these things should not be hard-coded like that directives.add(JetPsiFactory.createImportDirective(project, new ImportPath("js.*"))); + directives.add(JetPsiFactory.createImportDirective(project, new ImportPath("java.lang.*"))); directives.add(JetPsiFactory.createImportDirective(project, new ImportPath(JetStandardClasses.STANDARD_CLASSES_FQNAME, true))); directives.add(JetPsiFactory.createImportDirective(project, new ImportPath("kotlin.*"))); }