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
+27
-27
@@ -21,17 +21,28 @@ public final class TopLevelKt {
|
||||
public TopLevelKt() {
|
||||
super();
|
||||
}
|
||||
private static final int topLevelProperty = 2;
|
||||
public static final int topLevelConstProperty = 2;
|
||||
private static final int topLevelProperty = 2;
|
||||
|
||||
@org.jetbrains.annotations.Nullable()
|
||||
public static final java.lang.String topLevelFunction() {
|
||||
public static final void extensionFunction(@org.jetbrains.annotations.NotNull()
|
||||
@Anno(value = "rec")
|
||||
java.lang.String $this$extensionFunction, @org.jetbrains.annotations.NotNull()
|
||||
@Anno(value = "1")
|
||||
java.lang.String a, @org.jetbrains.annotations.NotNull()
|
||||
@Anno(value = "2")
|
||||
java.lang.String b) {
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public static final <T extends java.lang.Object>java.lang.String getExtensionProperty(@org.jetbrains.annotations.NotNull()
|
||||
@Anno(value = "propRec")
|
||||
T $this$extensionProperty) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.Nullable()
|
||||
public static final <X extends java.lang.CharSequence, T extends java.util.List<? extends X>>T topLevelGenericFunction() {
|
||||
return null;
|
||||
@Anno(value = "extpr")
|
||||
@java.lang.Deprecated()
|
||||
public static void getExtensionProperty$annotations(java.lang.Object p0) {
|
||||
}
|
||||
|
||||
public static final int getTopLevelProperty() {
|
||||
@@ -43,31 +54,20 @@ public final class TopLevelKt {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final void extensionFunction(@org.jetbrains.annotations.NotNull()
|
||||
@Anno(value = "rec")
|
||||
java.lang.String $this$extensionFunction, @org.jetbrains.annotations.NotNull()
|
||||
@Anno(value = "1")
|
||||
java.lang.String a, @org.jetbrains.annotations.NotNull()
|
||||
@Anno(value = "2")
|
||||
java.lang.String b) {
|
||||
}
|
||||
|
||||
@Anno(value = "extpr")
|
||||
@java.lang.Deprecated()
|
||||
public static void getExtensionProperty$annotations(java.lang.Object p0) {
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public static final <T extends java.lang.Object>java.lang.String getExtensionProperty(@org.jetbrains.annotations.NotNull()
|
||||
@Anno(value = "propRec")
|
||||
T $this$extensionProperty) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final <T extends java.lang.Object>void setExtensionProperty(@org.jetbrains.annotations.NotNull()
|
||||
@Anno(value = "propRec")
|
||||
T $this$extensionProperty, @org.jetbrains.annotations.NotNull()
|
||||
@Anno(value = "setparam")
|
||||
java.lang.String setParamName) {
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.Nullable()
|
||||
public static final java.lang.String topLevelFunction() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.Nullable()
|
||||
public static final <X extends java.lang.CharSequence, T extends java.util.List<? extends X>>T topLevelGenericFunction() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user