Drop external annotations support in build tools
External annotations will only be considered in the IDE for additional inspections based on more precise types in Java libraries
This commit is contained in:
committed by
Dmitry Jemerov
parent
f2efd30a5d
commit
13c54a2678
Vendored
+1
-3
@@ -2,14 +2,12 @@ Usage: kotlinc-jvm <options> <source files>
|
||||
where possible options include:
|
||||
-d <directory|jar> Destination for generated class files
|
||||
-classpath (-cp) <path> Paths where to find user class files
|
||||
-annotations <path> Paths to external annotations
|
||||
-include-runtime Include Kotlin runtime in to resulting .jar
|
||||
-no-jdk Don't include Java runtime into classpath
|
||||
-no-stdlib Don't include Kotlin runtime into classpath
|
||||
-no-jdk-annotations Don't include JDK external annotations into classpath
|
||||
-module <path> Path to the module file to compile
|
||||
-script Evaluate the script file
|
||||
-kotlin-home <path> Path to Kotlin compiler home directory, used for annotations and runtime libraries discovery
|
||||
-kotlin-home <path> Path to Kotlin compiler home directory, used for runtime libraries discovery
|
||||
-module-name Module name
|
||||
-nowarn Generate no warnings
|
||||
-verbose Enable verbose logging output
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
$TESTDATA_DIR$/simple.kt
|
||||
-classpath
|
||||
not/existing/path
|
||||
-annotations
|
||||
yet/another/not/existing/path
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
warning: classpath entry points to a non-existent location: not/existing/path
|
||||
warning: annotations path entry points to a non-existent location: yet/another/not/existing/path
|
||||
OK
|
||||
|
||||
+1
-3
@@ -3,14 +3,12 @@ Usage: kotlinc-jvm <options> <source files>
|
||||
where possible options include:
|
||||
-d <directory|jar> Destination for generated class files
|
||||
-classpath (-cp) <path> Paths where to find user class files
|
||||
-annotations <path> Paths to external annotations
|
||||
-include-runtime Include Kotlin runtime in to resulting .jar
|
||||
-no-jdk Don't include Java runtime into classpath
|
||||
-no-stdlib Don't include Kotlin runtime into classpath
|
||||
-no-jdk-annotations Don't include JDK external annotations into classpath
|
||||
-module <path> Path to the module file to compile
|
||||
-script Evaluate the script file
|
||||
-kotlin-home <path> Path to Kotlin compiler home directory, used for annotations and runtime libraries discovery
|
||||
-kotlin-home <path> Path to Kotlin compiler home directory, used for runtime libraries discovery
|
||||
-module-name Module name
|
||||
-nowarn Generate no warnings
|
||||
-verbose Enable verbose logging output
|
||||
|
||||
@@ -50,7 +50,6 @@ fun test6() : Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
// ArrayList without jdk-annotations cannot be used in these tests
|
||||
class MyArrayList<T>() {
|
||||
private var value17: T? = null
|
||||
private var value39: T? = null
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
package kotlin1
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
val al : ArrayList<Int> = ArrayList<Int>()
|
||||
val al1 = ArrayList<Int>(1)
|
||||
// for (x in al1) {
|
||||
//
|
||||
// }
|
||||
val <!UNUSED_VARIABLE!>al2<!> = ArrayList<Int>(ArrayList<Int>())
|
||||
checkSubtype<RandomAccess>(al)
|
||||
checkSubtype<Unit>(al.clear())
|
||||
checkSubtype<Boolean>(al.add(1))
|
||||
checkSubtype<Unit>(al.add(0, 1))
|
||||
checkSubtype<Boolean>(al.addAll(al1))
|
||||
checkSubtype<Boolean>(al.addAll(0, al1))
|
||||
checkSubtype<Int>(al.get(0))
|
||||
val m = HashMap<String, Int>()
|
||||
m.put("", 1)
|
||||
test(al, m)
|
||||
}
|
||||
fun test(a : List<Int>, m : Map<String, Int>) {
|
||||
System.out.println(
|
||||
a.get(0) + 1
|
||||
)
|
||||
HashMap<Int, Int>().get(0)
|
||||
if (m.get("") != null)
|
||||
System.out.println(m.get("")!!.plus(1))
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package
|
||||
|
||||
package kotlin1 {
|
||||
public fun main(/*0*/ args: kotlin.Array<kotlin.String>): kotlin.Unit
|
||||
public fun test(/*0*/ a: kotlin.List<kotlin.Int>, /*1*/ m: kotlin.Map<kotlin.String, kotlin.Int>): kotlin.Unit
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
package kotlin1
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
val al : ArrayList<Int> = ArrayList<Int>()
|
||||
checkSubtype<Any>(al.clone()) // A type mismatch on this line means that jdk-annotations were not loaded
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package
|
||||
|
||||
package kotlin1 {
|
||||
public fun main(/*0*/ args: kotlin.Array<kotlin.String>): kotlin.Unit
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
package kotlin1
|
||||
import java.util.*
|
||||
|
||||
public inline fun <reified T> Array(n: Int, block: (Int) -> T): Array<T> = null!!
|
||||
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
val al : ArrayList<Int> = ArrayList<Int>()
|
||||
|
||||
// A type mismatch on this line means that jdk-annotations were not loaded
|
||||
checkSubtype<Array<Int>>(al.toArray(Array<Int>(3, {1})))
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package
|
||||
|
||||
package kotlin1 {
|
||||
@kotlin.inline() public fun </*0*/ reified T> Array(/*0*/ n: kotlin.Int, /*1*/ block: (kotlin.Int) -> T): kotlin.Array<T>
|
||||
public fun main(/*0*/ args: kotlin.Array<kotlin.String>): kotlin.Unit
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
import java.sql.DriverManager
|
||||
|
||||
fun getConnection(url: String?) {
|
||||
DriverManager.getConnection(url)
|
||||
checkSubtype<java.sql.Connection>(DriverManager.getConnection(url!!))
|
||||
}
|
||||
|
||||
fun getConnection(url: String?, props: java.util.Properties?) {
|
||||
DriverManager.getConnection(url, props)
|
||||
checkSubtype<java.sql.Connection>(DriverManager.getConnection(url!!, props))
|
||||
}
|
||||
|
||||
fun getConnection(url: String?, user: String?, password: String?) {
|
||||
DriverManager.getConnection(url, user!!, password!!)
|
||||
DriverManager.getConnection(url!!, user, password<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
|
||||
DriverManager.getConnection(url<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>, user<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>, password)
|
||||
checkSubtype<java.sql.Connection>(DriverManager.getConnection(url<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>, user<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>, password<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>))
|
||||
}
|
||||
|
||||
fun getDriver(url: String?) {
|
||||
DriverManager.getDriver(url)
|
||||
checkSubtype<java.sql.Driver>(DriverManager.getDriver(url!!))
|
||||
}
|
||||
|
||||
fun registerDriver(driver: java.sql.Driver?) {
|
||||
DriverManager.registerDriver(driver)
|
||||
DriverManager.registerDriver(driver!!)
|
||||
}
|
||||
|
||||
fun getDrivers() {
|
||||
checkSubtype<java.util.Enumeration<java.sql.Driver>>(DriverManager.getDrivers())
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package
|
||||
|
||||
public fun getConnection(/*0*/ url: kotlin.String?): kotlin.Unit
|
||||
public fun getConnection(/*0*/ url: kotlin.String?, /*1*/ props: java.util.Properties?): kotlin.Unit
|
||||
public fun getConnection(/*0*/ url: kotlin.String?, /*1*/ user: kotlin.String?, /*2*/ password: kotlin.String?): kotlin.Unit
|
||||
public fun getDriver(/*0*/ url: kotlin.String?): kotlin.Unit
|
||||
public fun getDrivers(): kotlin.Unit
|
||||
public fun registerDriver(/*0*/ driver: java.sql.Driver?): kotlin.Unit
|
||||
@@ -1,5 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
fun getMetaData(rs: java.sql.ResultSet) {
|
||||
checkSubtype<java.sql.ResultSetMetaData>(rs.getMetaData())
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
package
|
||||
|
||||
public fun getMetaData(/*0*/ rs: java.sql.ResultSet): kotlin.Unit
|
||||
@@ -1,15 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
fun executeQuery(statement: java.sql.Statement, cmd: String?) {
|
||||
statement.executeQuery(cmd)
|
||||
checkSubtype<java.sql.ResultSet>(statement.executeQuery(cmd!!))
|
||||
}
|
||||
|
||||
fun executeQuery(statement: java.sql.PreparedStatement) {
|
||||
checkSubtype<java.sql.ResultSet>(statement.executeQuery())
|
||||
}
|
||||
|
||||
fun executeUpdate(statement: java.sql.Statement, cmd: String?) {
|
||||
statement.executeUpdate(cmd)
|
||||
statement.executeUpdate(cmd!!)
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package
|
||||
|
||||
public fun executeQuery(/*0*/ statement: java.sql.PreparedStatement): kotlin.Unit
|
||||
public fun executeQuery(/*0*/ statement: java.sql.Statement, /*1*/ cmd: kotlin.String?): kotlin.Unit
|
||||
public fun executeUpdate(/*0*/ statement: java.sql.Statement, /*1*/ cmd: kotlin.String?): kotlin.Unit
|
||||
@@ -1,16 +0,0 @@
|
||||
OUT:
|
||||
Buildfile: [TestData]/build.xml
|
||||
|
||||
build:
|
||||
[mkdir] Created dir: [Temp]/classes
|
||||
[javac] Compiling 2 source files to [Temp]/classes
|
||||
[javac] Compiling [[TestData]/root1] => [[Temp]/classes]
|
||||
[javac] Running javac...
|
||||
[jar] Building jar: [Temp]/hello.jar
|
||||
[java] Hello, a!
|
||||
[java] Java Hello
|
||||
|
||||
BUILD SUCCESSFUL
|
||||
Total time: [time]
|
||||
|
||||
Return code: 0
|
||||
@@ -1,23 +0,0 @@
|
||||
<project name="Ant Task Test" default="build">
|
||||
<taskdef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
|
||||
|
||||
<target name="build">
|
||||
<delete dir="${temp}/classes" failonerror="false"/>
|
||||
<mkdir dir="${temp}/classes"/>
|
||||
<javac destdir="${temp}/classes" includeAntRuntime="false" srcdir="${test.data}/root1">
|
||||
<withKotlin externalannotations="${test.data}/root1/b/">
|
||||
<externalannotations path="${test.data}/root1/a/"/>
|
||||
</withKotlin>
|
||||
</javac>
|
||||
<jar destfile="${temp}/hello.jar">
|
||||
<fileset dir="${temp}/classes"/>
|
||||
</jar>
|
||||
|
||||
<java classname="hello.HelloPackage" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${temp}/hello.jar"/>
|
||||
<pathelement location="${kotlin.runtime.jar}"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
</project>
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
<root>
|
||||
<item name='j.Java java.lang.String f()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
<root>
|
||||
<item name='j.Java java.lang.String f2()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
@@ -1,9 +0,0 @@
|
||||
package hello
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
for (s in arrayListOf("a"))
|
||||
println("Hello, $s!")
|
||||
val java: String = j.Java().f()
|
||||
val hello: String = j.Java().f2()
|
||||
println("$java $hello")
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package j;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.String;
|
||||
import java.lang.System;
|
||||
|
||||
public class Java {
|
||||
public String f() {
|
||||
return "Java";
|
||||
}
|
||||
|
||||
public String f2() {
|
||||
return "Hello";
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
hello.HelloPackage.main(new String[] {});
|
||||
}
|
||||
}
|
||||
-1
@@ -3,4 +3,3 @@ name
|
||||
outputDir=out
|
||||
sources=[foo]
|
||||
classpath=[bar]
|
||||
annotations=[baz]
|
||||
|
||||
-1
@@ -2,6 +2,5 @@
|
||||
<module name="name" outputDir="out" type="java-production">
|
||||
<sources path="foo"/>
|
||||
<classpath path="bar"/>
|
||||
<externalAnnotations path="baz"/>
|
||||
</module>
|
||||
</modules>
|
||||
-1
@@ -3,4 +3,3 @@ name
|
||||
outputDir=out
|
||||
sources=[foo, foo1, foo2]
|
||||
classpath=[bar1, bar2]
|
||||
annotations=[baz, baz1, baz2]
|
||||
|
||||
-3
@@ -9,8 +9,5 @@
|
||||
<classpath path="bar1"/>
|
||||
<!-- sdfgadfg -->
|
||||
<classpath path="bar2"/>
|
||||
<externalAnnotations path="baz"/>
|
||||
<externalAnnotations path="baz1"/>
|
||||
<externalAnnotations path="baz2"/>
|
||||
</module>
|
||||
</modules>
|
||||
@@ -3,4 +3,3 @@ name
|
||||
outputDir=out
|
||||
sources=[]
|
||||
classpath=[]
|
||||
annotations=[]
|
||||
|
||||
-1
@@ -3,4 +3,3 @@ name
|
||||
outputDir=out
|
||||
sources=[foo, foo1, foo2]
|
||||
classpath=[bar, bar1, bar2]
|
||||
annotations=[baz, baz1, baz2]
|
||||
|
||||
-3
@@ -6,8 +6,5 @@
|
||||
<classpath path="bar"/>
|
||||
<classpath path="bar1"/>
|
||||
<classpath path="bar2"/>
|
||||
<externalAnnotations path="baz"/>
|
||||
<externalAnnotations path="baz1"/>
|
||||
<externalAnnotations path="baz2"/>
|
||||
</module>
|
||||
</modules>
|
||||
@@ -3,4 +3,3 @@ name
|
||||
outputDir=out
|
||||
sources=[foo]
|
||||
classpath=[]
|
||||
annotations=[]
|
||||
|
||||
@@ -3,10 +3,8 @@ name
|
||||
outputDir=out
|
||||
sources=[foo, foo1, foo2]
|
||||
classpath=[bar, bar1, bar2]
|
||||
annotations=[baz, baz1, baz2]
|
||||
name2
|
||||
type=java-production
|
||||
outputDir=out2
|
||||
sources=[2foo, 2foo1, 2foo2]
|
||||
classpath=[2bar, 2bar1, 2bar2]
|
||||
annotations=[2baz, 2baz1, 2baz2]
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
<classpath path="bar"/>
|
||||
<classpath path="bar1"/>
|
||||
<classpath path="bar2"/>
|
||||
<externalAnnotations path="baz"/>
|
||||
<externalAnnotations path="baz1"/>
|
||||
<externalAnnotations path="baz2"/>
|
||||
</module>
|
||||
<module name="name2" outputDir="out2" type="java-production">
|
||||
<sources path="2foo"/>
|
||||
@@ -17,8 +14,5 @@
|
||||
<classpath path="2bar"/>
|
||||
<classpath path="2bar1"/>
|
||||
<classpath path="2bar2"/>
|
||||
<externalAnnotations path="2baz"/>
|
||||
<externalAnnotations path="2baz1"/>
|
||||
<externalAnnotations path="2baz2"/>
|
||||
</module>
|
||||
</modules>
|
||||
Reference in New Issue
Block a user