From e4fc38637224238b905ac0a9a7c3dc619c5c006b Mon Sep 17 00:00:00 2001 From: Ioannis Tsakpinis Date: Mon, 15 Sep 2014 01:31:22 +0300 Subject: [PATCH] Fixed field/method order so that javac output matches apt output. --- src/java/org/lwjgl/util/generator/TypeInfo.java | 5 ++--- src/java/org/lwjgl/util/generator/Utils.java | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/java/org/lwjgl/util/generator/TypeInfo.java b/src/java/org/lwjgl/util/generator/TypeInfo.java index bb247cca..50970966 100644 --- a/src/java/org/lwjgl/util/generator/TypeInfo.java +++ b/src/java/org/lwjgl/util/generator/TypeInfo.java @@ -158,7 +158,7 @@ public class TypeInfo { } private static Collection getTypeInfos(TypeMap type_map, VariableElement param) { - List annotations = param.getAnnotationMirrors(); + List annotations = Utils.getSortedAnnotations(param.getAnnotationMirrors()); GLvoid void_annotation = param.getAnnotation(GLvoid.class); Map types = new HashMap(); @@ -175,8 +175,7 @@ public class TypeInfo { if ( types.containsKey(inverse_type) ) { TypeInfo inverse_type_info = types.get(inverse_type); String inverse_auto_type = inverse_type_info.getAutoType(); - auto_type = signedness == Signedness.UNSIGNED ? auto_type + " : " + inverse_auto_type - : inverse_auto_type + " : " + auto_type; + auto_type = signedness == Signedness.UNSIGNED ? auto_type + " : " + inverse_auto_type : inverse_auto_type + " : " + auto_type; auto_type = UNSIGNED_PARAMETER_NAME + " ? " + auto_type; signedness = Signedness.BOTH; types.remove(inverse_type); diff --git a/src/java/org/lwjgl/util/generator/Utils.java b/src/java/org/lwjgl/util/generator/Utils.java index 5be6a7e4..cff04ad3 100644 --- a/src/java/org/lwjgl/util/generator/Utils.java +++ b/src/java/org/lwjgl/util/generator/Utils.java @@ -442,11 +442,11 @@ public class Utils { writer.print("\t\t"); } writer.print("ByteBuffer " + return_annotation.value() + " = APIUtil.getBufferByte(" + type_map.getAPIUtilParam(true) + return_annotation.maxLength()); - /* - Params that use the return buffer will advance its position while filling it. When we return, the position will be - at the right spot for grabbing the returned string bytes. We only have to make sure that the original buffer was - large enough to hold everything, so that no re-allocations happen while filling. - */ + /* + Params that use the return buffer will advance its position while filling it. When we return, the position will be + at the right spot for grabbing the returned string bytes. We only have to make sure that the original buffer was + large enough to hold everything, so that no re-allocations happen while filling. + */ final String offset = getStringOffset(method, null); if ( offset != null ) { writer.print(" + " + offset); @@ -496,11 +496,11 @@ public class Utils { } public static Collection getFields(TypeElement d) { - return ElementFilter.fieldsIn(new HashSet(d.getEnclosedElements())); + return ElementFilter.fieldsIn(new LinkedHashSet(d.getEnclosedElements())); } public static Collection getMethods(TypeElement d) { - return ElementFilter.methodsIn(new HashSet(d.getEnclosedElements())); + return ElementFilter.methodsIn(new LinkedHashSet(d.getEnclosedElements())); } }