Use javac2 filter to disable NotNull instrumentation of Kotlin code

We skip all classes annotated with kotlin/jvm/internal/<anything> (currently
KotlinClass, KotlinPackage and KotlinSyntheticClass) because Kotlin compiler
emits its own nullability assertions
This commit is contained in:
Alexander Udalov
2015-01-21 13:23:48 +03:00
parent 9dbcd8b55f
commit 5194310d6e
+9 -3
View File
@@ -77,7 +77,9 @@
<pathelement location="${idea.sdk}/lib/javac2.jar"/>
<pathelement location="${idea.sdk}/lib/asm-all.jar"/>
</path>
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath" loaderref="javac2.loader"/>
<typedef name="skip" classname="com.intellij.ant.ClassFilterAnnotationRegexp" classpathref="javac2.classpath"
loaderref="javac2.loader"/>
<echo message="Use javac2 from Idea lib"/>
</then>
<else>
@@ -368,10 +370,10 @@
<target name="preloader">
<cleandir dir="${output}/classes/preloader"/>
<javac2 destdir="${output}/classes/preloader" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
<javac destdir="${output}/classes/preloader" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
source="${java.target}" target="${java.target}">
<src refid="preloaderSources.path"/>
</javac2>
</javac>
<jar jarfile="${kotlin-home}/lib/kotlin-preloader.jar">
<fileset dir="${output}/classes/preloader"/>
@@ -468,6 +470,7 @@
<javac2 destdir="${output}/classes/compiler" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
source="${java.target}" target="${java.target}">
<withKotlin externalannotations="${external.annotations.path}"/>
<skip pattern="kotlin/jvm/internal/.*"/>
<src refid="compilerSources.path"/>
<classpath refid="classpath"/>
</javac2>
@@ -620,6 +623,7 @@
<javac2 destdir="${output}/classes/ant" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
source="${java.target}" target="${java.target}">
<withKotlin externalannotations="${external.annotations.path}"/>
<skip pattern="kotlin/jvm/internal/.*"/>
<src>
<dirset dir="${basedir}/ant">
<include name="src"/>
@@ -711,6 +715,7 @@
<then>
<javac2 srcdir="${src.paths}" destdir="@{output}" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
source="${java.target}" target="${java.target}">
<skip pattern="kotlin/jvm/internal/.*"/>
<classpath>
<path refid="classpath.path"/>
<!-- Include @{output} here for Java compiler to resolve symbols from Kotlin sources -->
@@ -863,6 +868,7 @@
<javac2 destdir="${output}/classes/idea-analysis" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
source="${java.target}" target="${java.target}">
<withKotlin externalannotations="${external.annotations.path}"/>
<skip pattern="kotlin/jvm/internal/.*"/>
<src>
<dirset dir="${basedir}/idea/ide-common" includes="src"/>
<dirset dir="${basedir}/idea/idea-analysis" includes="src"/>