From c0113c694bcc7aa590caea20508adc3d1e4009a4 Mon Sep 17 00:00:00 2001
From: Pavel Vojtechovsky
Date: Mon, 1 Jan 2018 10:05:38 +0100
Subject: [PATCH] workaround of bug: Order of type members is not kept (#1787)
---
.../java/spoon/support/reflect/declaration/CtTypeImpl.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/spoon/support/reflect/declaration/CtTypeImpl.java b/src/main/java/spoon/support/reflect/declaration/CtTypeImpl.java
index 61e727eafb7..8da0df402e3 100644
--- a/src/main/java/spoon/support/reflect/declaration/CtTypeImpl.java
+++ b/src/main/java/spoon/support/reflect/declaration/CtTypeImpl.java
@@ -107,6 +107,10 @@ public List getTypeMembers() {
return Collections.unmodifiableList(typeMembers);
}
+ public void sortTypeMembers() {
+ typeMembers.sort(new CtLineElementComparator());
+ }
+
@Override
public > C addTypeMember(CtTypeMember member) {
if (member == null) {