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:
@@ -77,7 +77,9 @@
|
|||||||
<pathelement location="${idea.sdk}/lib/javac2.jar"/>
|
<pathelement location="${idea.sdk}/lib/javac2.jar"/>
|
||||||
<pathelement location="${idea.sdk}/lib/asm-all.jar"/>
|
<pathelement location="${idea.sdk}/lib/asm-all.jar"/>
|
||||||
</path>
|
</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"/>
|
<echo message="Use javac2 from Idea lib"/>
|
||||||
</then>
|
</then>
|
||||||
<else>
|
<else>
|
||||||
@@ -368,10 +370,10 @@
|
|||||||
|
|
||||||
<target name="preloader">
|
<target name="preloader">
|
||||||
<cleandir dir="${output}/classes/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}">
|
source="${java.target}" target="${java.target}">
|
||||||
<src refid="preloaderSources.path"/>
|
<src refid="preloaderSources.path"/>
|
||||||
</javac2>
|
</javac>
|
||||||
|
|
||||||
<jar jarfile="${kotlin-home}/lib/kotlin-preloader.jar">
|
<jar jarfile="${kotlin-home}/lib/kotlin-preloader.jar">
|
||||||
<fileset dir="${output}/classes/preloader"/>
|
<fileset dir="${output}/classes/preloader"/>
|
||||||
@@ -468,6 +470,7 @@
|
|||||||
<javac2 destdir="${output}/classes/compiler" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
<javac2 destdir="${output}/classes/compiler" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
||||||
source="${java.target}" target="${java.target}">
|
source="${java.target}" target="${java.target}">
|
||||||
<withKotlin externalannotations="${external.annotations.path}"/>
|
<withKotlin externalannotations="${external.annotations.path}"/>
|
||||||
|
<skip pattern="kotlin/jvm/internal/.*"/>
|
||||||
<src refid="compilerSources.path"/>
|
<src refid="compilerSources.path"/>
|
||||||
<classpath refid="classpath"/>
|
<classpath refid="classpath"/>
|
||||||
</javac2>
|
</javac2>
|
||||||
@@ -620,6 +623,7 @@
|
|||||||
<javac2 destdir="${output}/classes/ant" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
<javac2 destdir="${output}/classes/ant" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
||||||
source="${java.target}" target="${java.target}">
|
source="${java.target}" target="${java.target}">
|
||||||
<withKotlin externalannotations="${external.annotations.path}"/>
|
<withKotlin externalannotations="${external.annotations.path}"/>
|
||||||
|
<skip pattern="kotlin/jvm/internal/.*"/>
|
||||||
<src>
|
<src>
|
||||||
<dirset dir="${basedir}/ant">
|
<dirset dir="${basedir}/ant">
|
||||||
<include name="src"/>
|
<include name="src"/>
|
||||||
@@ -711,6 +715,7 @@
|
|||||||
<then>
|
<then>
|
||||||
<javac2 srcdir="${src.paths}" destdir="@{output}" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
<javac2 srcdir="${src.paths}" destdir="@{output}" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
||||||
source="${java.target}" target="${java.target}">
|
source="${java.target}" target="${java.target}">
|
||||||
|
<skip pattern="kotlin/jvm/internal/.*"/>
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="classpath.path"/>
|
<path refid="classpath.path"/>
|
||||||
<!-- Include @{output} here for Java compiler to resolve symbols from Kotlin sources -->
|
<!-- 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"
|
<javac2 destdir="${output}/classes/idea-analysis" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
||||||
source="${java.target}" target="${java.target}">
|
source="${java.target}" target="${java.target}">
|
||||||
<withKotlin externalannotations="${external.annotations.path}"/>
|
<withKotlin externalannotations="${external.annotations.path}"/>
|
||||||
|
<skip pattern="kotlin/jvm/internal/.*"/>
|
||||||
<src>
|
<src>
|
||||||
<dirset dir="${basedir}/idea/ide-common" includes="src"/>
|
<dirset dir="${basedir}/idea/ide-common" includes="src"/>
|
||||||
<dirset dir="${basedir}/idea/idea-analysis" includes="src"/>
|
<dirset dir="${basedir}/idea/idea-analysis" includes="src"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user