Ignoring not static final fields.
Added tests with class object of trait and val inside object.
Original commit: 42cba1cc3c
This commit is contained in:
@@ -190,7 +190,8 @@ public class IncrementalCacheImpl(val baseDir: File): IncrementalCache {
|
||||
|
||||
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.ASM5) {
|
||||
override fun visitField(access: Int, name: String, desc: String, signature: String?, value: Any?): FieldVisitor? {
|
||||
if (value != null) {
|
||||
val staticFinal = Opcodes.ACC_STATIC or Opcodes.ACC_FINAL
|
||||
if (value != null && access and staticFinal == staticFinal) {
|
||||
result[name] = value
|
||||
}
|
||||
return null
|
||||
|
||||
@@ -116,6 +116,11 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
|
||||
doTest("jps-plugin/testData/incremental/multiplePackagesModified/");
|
||||
}
|
||||
|
||||
@TestMetadata("objectValChanged")
|
||||
public void testObjectValChanged() throws Exception {
|
||||
doTest("jps-plugin/testData/incremental/objectValChanged/");
|
||||
}
|
||||
|
||||
@TestMetadata("ourClassReferenced")
|
||||
public void testOurClassReferenced() throws Exception {
|
||||
doTest("jps-plugin/testData/incremental/ourClassReferenced/");
|
||||
@@ -206,4 +211,9 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
|
||||
doTest("jps-plugin/testData/incremental/topLevelMembersInTwoFiles/");
|
||||
}
|
||||
|
||||
@TestMetadata("traitClassObjectConstantChanged")
|
||||
public void testTraitClassObjectConstantChanged() throws Exception {
|
||||
doTest("jps-plugin/testData/incremental/traitClassObjectConstantChanged/");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Cleaning output files:
|
||||
out/production/module/test/Object.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/const.kt
|
||||
End of files
|
||||
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
object Object {
|
||||
// Value is changed, but we don't care, it is not compile-time constant, and therefore can't be inlined
|
||||
val CONST = "old"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
object Object {
|
||||
// Value is changed, but we don't care, it is not compile-time constant, and therefore can't be inlined
|
||||
val CONST = "new"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val x = Object.CONST + Object.CONST
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
Cleaning output files:
|
||||
out/production/module/test/Trait$$TImpl.class
|
||||
out/production/module/test/Trait$object.class
|
||||
out/production/module/test/Trait.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/const.kt
|
||||
End of files
|
||||
Cleaning output files:
|
||||
out/production/module/test/Usage.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/usage.kt
|
||||
End of files
|
||||
@@ -0,0 +1,8 @@
|
||||
package test
|
||||
|
||||
trait Trait {
|
||||
class object {
|
||||
// Old and new constant values are different, but their hashes are the same
|
||||
val CONST = "BF"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package test
|
||||
|
||||
trait Trait {
|
||||
class object {
|
||||
// Old and new constant values are different, but their hashes are the same
|
||||
val CONST = "Ae"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package test
|
||||
|
||||
deprecated(Trait.CONST + Trait.CONST)
|
||||
class Usage
|
||||
Reference in New Issue
Block a user