Sort class members to ensure deterministic builds
Class methods and fields are currently sorted at serialization (see
DescriptorSerializer.sort) and at deserialization (see
DeserializedMemberScope.OptimizedImplementation#addMembers). Therefore,
the contents of the generated stub files are sorted in incremental
builds but not in clean builds.
The consequence is that the contents of the generated stub files may not
be consistent across a clean build and an incremental build, making the
build non-deterministic and dependent tasks run unnecessarily (see
KT-40882).
To work around that, this commit sorts class methods and fields when
outputting stub files.
Bug: KT-40882 (there are actually 2 issues in here; this commit fixes
the first one)
Test: New DeterministicBuildIT + Updated existing test expectation files
This commit is contained in:
committed by
nataliya.valtman
parent
07a797cc3a
commit
4bf63a9539
+41
-41
@@ -17,11 +17,11 @@ public enum EnumError {
|
||||
/*public static final*/ One /* = new EnumError() */,
|
||||
/*public static final*/ Two /* = new EnumError() */;
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public abstract java.lang.String doIt();
|
||||
|
||||
EnumError() {
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public abstract java.lang.String doIt();
|
||||
}
|
||||
|
||||
////////////////////
|
||||
@@ -65,6 +65,31 @@ public final class Test {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
private final java.lang.String prop2 = "";
|
||||
|
||||
public Test() {
|
||||
super();
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getProp2() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* prop2.
|
||||
*/
|
||||
@Anno()
|
||||
@java.lang.Deprecated()
|
||||
public static void getProp2$annotations() {
|
||||
}
|
||||
|
||||
/**
|
||||
* get.
|
||||
*/
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getProp3() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* method().
|
||||
*/
|
||||
@@ -84,37 +109,12 @@ public final class Test {
|
||||
java.lang.String a) {
|
||||
}
|
||||
|
||||
/**
|
||||
* prop2.
|
||||
*/
|
||||
@Anno()
|
||||
@java.lang.Deprecated()
|
||||
public static void getProp2$annotations() {
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getProp2() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get.
|
||||
*/
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getProp3() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* set.
|
||||
*/
|
||||
public final void setProp3(@org.jetbrains.annotations.NotNull()
|
||||
java.lang.String v) {
|
||||
}
|
||||
|
||||
public Test() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
@@ -132,15 +132,15 @@ public final class Test2 {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
private final java.lang.String a = null;
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getA() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Test2(@org.jetbrains.annotations.NotNull()
|
||||
java.lang.String a) {
|
||||
super();
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getA() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
@@ -156,15 +156,15 @@ public final class Test3 {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
private final java.lang.String a = null;
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getA() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Test3(@org.jetbrains.annotations.NotNull()
|
||||
java.lang.String a) {
|
||||
super();
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getA() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
@@ -175,12 +175,12 @@ import java.lang.System;
|
||||
@kotlin.Metadata()
|
||||
public final class Test4 {
|
||||
|
||||
public final void method() {
|
||||
}
|
||||
|
||||
public Test4() {
|
||||
super();
|
||||
}
|
||||
|
||||
public final void method() {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
Reference in New Issue
Block a user