From c83fc5cdcc615b4ee88ac2e0eb8737970fb2b8c3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 1 Aug 2009 02:31:15 -0700 Subject: Retain interface order in Custom Pipeline --- .../gluegen/opengl/BuildComposablePipeline.java | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java index d62a68573..b52047bbf 100644 --- a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java +++ b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java @@ -330,15 +330,29 @@ public class BuildComposablePipeline PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter(file))); + List baseInterfaces = Arrays.asList(baseInterfaceClass.getInterfaces()); HashSet clazzList = new HashSet(); clazzList.add(baseInterfaceClass); - clazzList.addAll(Arrays.asList(baseInterfaceClass.getInterfaces())); + clazzList.addAll(baseInterfaces); + int ifNamesNumber = clazzList.size(); - String[] ifNames = new String[clazzList.size()]; + // keep original order .. + clazzList.clear(); + String[] ifNames = new String[ifNamesNumber]; { int i=0; - for (Iterator iter=clazzList.iterator(); iter.hasNext(); ) { - ifNames[i++] = new String(((Class)iter.next()).getName()); + + for (Iterator iter=baseInterfaces.iterator(); iter.hasNext(); ) { + Class ifClass = (Class)iter.next(); + if(!clazzList.contains(ifClass)) { + ifNames[i++] = new String(ifClass.getName()); + clazzList.add(ifClass); + } + } + + if(null!=baseInterfaceClass && !clazzList.contains(baseInterfaceClass)) { + ifNames[i++] = new String(baseInterfaceClass.getName()); + clazzList.add(baseInterfaceClass); } } -- cgit v1.2.3