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
+5
-5
@@ -26,9 +26,8 @@ public final class User {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
private final java.lang.String name = "John";
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getName() {
|
||||
return null;
|
||||
public User() {
|
||||
super();
|
||||
}
|
||||
|
||||
public User(@org.jetbrains.annotations.NotNull()
|
||||
@@ -36,7 +35,8 @@ public final class User {
|
||||
super();
|
||||
}
|
||||
|
||||
public User() {
|
||||
super();
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,14 +25,14 @@ public final class Simple {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public static final test.Simple.Companion Companion = null;
|
||||
|
||||
@MyAnnotation()
|
||||
public final void myMethod() {
|
||||
}
|
||||
|
||||
public Simple() {
|
||||
super();
|
||||
}
|
||||
|
||||
@MyAnnotation()
|
||||
public final void myMethod() {
|
||||
}
|
||||
|
||||
@kotlin.Metadata()
|
||||
public static final class NestedClass {
|
||||
|
||||
|
||||
@@ -28,6 +28,15 @@ public final class State {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
private final java.lang.String someString = null;
|
||||
|
||||
public State(int someInt, long someLong) {
|
||||
super();
|
||||
}
|
||||
|
||||
public State(int someInt, long someLong, @org.jetbrains.annotations.NotNull()
|
||||
java.lang.String someString) {
|
||||
super();
|
||||
}
|
||||
|
||||
public final int getSomeInt() {
|
||||
return 0;
|
||||
}
|
||||
@@ -40,13 +49,4 @@ public final class State {
|
||||
public final java.lang.String getSomeString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public State(int someInt, long someLong, @org.jetbrains.annotations.NotNull()
|
||||
java.lang.String someString) {
|
||||
super();
|
||||
}
|
||||
|
||||
public State(int someInt, long someLong) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,16 +16,16 @@ import java.lang.System;
|
||||
@kotlin.Metadata()
|
||||
public final class Simple {
|
||||
|
||||
@MyAnnotation()
|
||||
public final void myMethod() {
|
||||
public Simple() {
|
||||
super();
|
||||
}
|
||||
|
||||
public final int heavyMethod() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Simple() {
|
||||
super();
|
||||
@MyAnnotation()
|
||||
public final void myMethod() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user