Fixed KNPE when inline functions/constants are completely removed.
This commit is contained in:
@@ -280,7 +280,12 @@ public class IncrementalCacheImpl(val baseDir: File): StorageOwner, IncrementalC
|
|||||||
if (oldMap == constantsMap) {
|
if (oldMap == constantsMap) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
map.put(key, constantsMap)
|
if (constantsMap != null) {
|
||||||
|
map.put(key, constantsMap)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
map.remove(key)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -396,6 +401,9 @@ public class IncrementalCacheImpl(val baseDir: File): StorageOwner, IncrementalC
|
|||||||
if (inlineFunctionsMap != null) {
|
if (inlineFunctionsMap != null) {
|
||||||
map.put(key, inlineFunctionsMap)
|
map.put(key, inlineFunctionsMap)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
map.remove(key)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,6 +135,12 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constantRemoved")
|
||||||
|
public void testConstantRemoved() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/constantRemoved/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("constantsUnchanged")
|
@TestMetadata("constantsUnchanged")
|
||||||
public void testConstantsUnchanged() throws Exception {
|
public void testConstantsUnchanged() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/constantsUnchanged/");
|
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/constantsUnchanged/");
|
||||||
@@ -171,6 +177,12 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inlineFunctionRemoved")
|
||||||
|
public void testInlineFunctionRemoved() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/inlineFunctionRemoved/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inlineFunctionsCircularDependency")
|
@TestMetadata("inlineFunctionsCircularDependency")
|
||||||
public void testInlineFunctionsCircularDependency() throws Exception {
|
public void testInlineFunctionsCircularDependency() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/inlineFunctionsCircularDependency/");
|
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/inlineFunctionsCircularDependency/");
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
Cleaning output files:
|
||||||
|
out/production/module/test/TestPackage$const$*.class
|
||||||
|
out/production/module/test/TestPackage.class
|
||||||
|
End of files
|
||||||
|
Compiling files:
|
||||||
|
src/const.kt
|
||||||
|
End of files
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
val CONST = "foo"
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
val CONST = "I'm not a constant anymore:" + System.currentTimeMillis()
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
Cleaning output files:
|
||||||
|
out/production/module/inline/InlinePackage$inline$*.class
|
||||||
|
out/production/module/inline/InlinePackage.class
|
||||||
|
End of files
|
||||||
|
Compiling files:
|
||||||
|
src/inline.kt
|
||||||
|
End of files
|
||||||
|
Cleaning output files:
|
||||||
|
out/production/module/inline/InlinePackage$inline$*.class
|
||||||
|
out/production/module/inline/InlinePackage.class
|
||||||
|
End of files
|
||||||
|
Compiling files:
|
||||||
|
src/inline.kt
|
||||||
|
End of files
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package inline
|
||||||
|
|
||||||
|
inline fun f(body: () -> Unit) {
|
||||||
|
println("i'm inline function")
|
||||||
|
body()
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package inline
|
||||||
|
|
||||||
|
fun f(body: () -> Unit) {
|
||||||
|
println("i'm not an inline function")
|
||||||
|
body()
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user