From 2abe2e581d909b4e69de4c74f827b5bb7ebab496 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Thu, 20 Sep 2012 15:07:02 +0400 Subject: [PATCH] AbstractStringBuilder, StringBuilder and java.io.File annotated with nullable/notnull --- .../tests/checkArguments/SpreadVarargs.kt | 4 +- .../tests/regressions/DoubleDefine.kt | 2 +- .../checker/regression/DoubleDefine.jet | 2 +- jdk-annotations/java/io/annotations.xml | 127 +++++++ jdk-annotations/java/lang/annotations.xml | 331 +++++++++++++++++- libraries/stdlib/src/kotlin/io/Files.kt | 2 +- .../doc/highlighter2/Html2CompilerPlugin.kt | 2 +- .../jetbrains/kotlin/doc/model/KotlinModel.kt | 2 +- 8 files changed, 460 insertions(+), 12 deletions(-) create mode 100644 jdk-annotations/java/io/annotations.xml diff --git a/compiler/testData/diagnostics/tests/checkArguments/SpreadVarargs.kt b/compiler/testData/diagnostics/tests/checkArguments/SpreadVarargs.kt index 14ecb798037..ab24181a58c 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/SpreadVarargs.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/SpreadVarargs.kt @@ -75,7 +75,7 @@ fun join(x : Int, vararg a : String) : String { for (s in a) { b.append(s) } - return b.toString()!! + return b.toString() } fun joinG(x : Int, vararg a : T) : String { @@ -83,7 +83,7 @@ fun joinG(x : Int, vararg a : T) : String { for (s in a) { b.append(s) } - return b.toString()!! + return b.toString() } fun joinT(x : Int, vararg a : T) : T? { diff --git a/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt b/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt index 309c3ff7e7a..1c24007fa5d 100644 --- a/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt +++ b/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt @@ -52,7 +52,7 @@ fun main(args: Array) { System.out.println("Your numbers: " + prompt) System.out.println("Enter your expression:") val reader = BufferedReader(InputStreamReader(System.`in`)) - val expr = StringBuilder(reader.readLine()) + val expr = StringBuilder(reader.readLine()!!) try { val result = evaluate(expr, numbers) if (result != 24) diff --git a/idea/testData/checker/regression/DoubleDefine.jet b/idea/testData/checker/regression/DoubleDefine.jet index 6dc60faa1b2..e8d9f0da451 100644 --- a/idea/testData/checker/regression/DoubleDefine.jet +++ b/idea/testData/checker/regression/DoubleDefine.jet @@ -51,7 +51,7 @@ fun main(args: Array) { System.out.println("Your numbers: " + prompt) System.out.println("Enter your expression:") val reader = BufferedReader(InputStreamReader(System.`in`)) - val expr = StringBuilder(reader.readLine()) + val expr = StringBuilder(reader.readLine()!!) try { val result = evaluate(expr, numbers) if (result != 24) diff --git a/jdk-annotations/java/io/annotations.xml b/jdk-annotations/java/io/annotations.xml new file mode 100644 index 00000000000..b0e3383d32f --- /dev/null +++ b/jdk-annotations/java/io/annotations.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jdk-annotations/java/lang/annotations.xml b/jdk-annotations/java/lang/annotations.xml index 8b71cbfee98..d35a6e7fbe5 100644 --- a/jdk-annotations/java/lang/annotations.xml +++ b/jdk-annotations/java/lang/annotations.xml @@ -14,14 +14,335 @@ + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/stdlib/src/kotlin/io/Files.kt b/libraries/stdlib/src/kotlin/io/Files.kt index 46d1d2d7419..d6ee6ccea0a 100644 --- a/libraries/stdlib/src/kotlin/io/Files.kt +++ b/libraries/stdlib/src/kotlin/io/Files.kt @@ -207,6 +207,6 @@ fun File.readLines(charset : String = "UTF-8") : List { */ fun File.listFiles(filter : (file : File) -> Boolean) : Array? = listFiles( object : FileFilter { - override fun accept(file: File?) = filter(file!!) + override fun accept(file: File) = filter(file) } ) as Array? diff --git a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter2/Html2CompilerPlugin.kt b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter2/Html2CompilerPlugin.kt index 10edfe8449f..7db9c2cd415 100644 --- a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter2/Html2CompilerPlugin.kt +++ b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter2/Html2CompilerPlugin.kt @@ -35,7 +35,7 @@ class Html2CompilerPlugin(private val compilerArguments: KDocArguments) : Doclet private val sourceDirPaths: List = sourceDirs.map { d -> d.getPath()!! } private fun fileToWrite(psiFile: PsiFile): String { - val file = File((psiFile.getVirtualFile() as CoreLocalVirtualFile).getPath()).getCanonicalFile()!! + val file = File((psiFile.getVirtualFile() as CoreLocalVirtualFile).getPath()!!).getCanonicalFile()!! val filePath = file.getPath()!! for (sourceDirPath in sourceDirPaths) { if (filePath.startsWith(sourceDirPath) && filePath.length() > sourceDirPath.length()) { diff --git a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/model/KotlinModel.kt b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/model/KotlinModel.kt index c3fb095a29b..14df8f011f4 100644 --- a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/model/KotlinModel.kt +++ b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/model/KotlinModel.kt @@ -212,7 +212,7 @@ class KModel(val context: BindingContext, val config: KDocConfig, val sourceDirs sourceDirs.map { file -> file.getCanonicalPath()!! } fun relativePath(psiFile: PsiFile): String { - val file = File((psiFile.getVirtualFile() as CoreLocalVirtualFile).getPath()).getCanonicalFile()!! + val file = File((psiFile.getVirtualFile() as CoreLocalVirtualFile).getPath()!!).getCanonicalFile()!! val filePath = file.getPath()!! for (sourceDirPath in normalizedSourceDirs) { if (filePath.startsWith(sourceDirPath) && filePath.length() > sourceDirPath.length()) {