myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r803558 - in /myfaces/tobago/branches/tobago-1.0.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt: AnnotationDeclarationVisitorCollector.java TaglibAnnotationVisitor.java
Date Wed, 12 Aug 2009 15:34:10 GMT
Author: lofwyr
Date: Wed Aug 12 15:34:09 2009
New Revision: 803558

URL: http://svn.apache.org/viewvc?rev=803558&view=rev
Log:
TOBAGO-782: APT Generator should used sorted collections of elements to produce stable output.

Modified:
    myfaces/tobago/branches/tobago-1.0.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationDeclarationVisitorCollector.java
    myfaces/tobago/branches/tobago-1.0.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/TaglibAnnotationVisitor.java

Modified: myfaces/tobago/branches/tobago-1.0.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationDeclarationVisitorCollector.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationDeclarationVisitorCollector.java?rev=803558&r1=803557&r2=803558&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationDeclarationVisitorCollector.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationDeclarationVisitorCollector.java
Wed Aug 12 15:34:09 2009
@@ -24,9 +24,9 @@
 import com.sun.mirror.util.SimpleDeclarationVisitor;
 
 import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
-import java.util.Set;
 
 /*
  * Created: Mar 22, 2005 8:12:24 PM
@@ -35,20 +35,35 @@
  */
 public class AnnotationDeclarationVisitorCollector extends SimpleDeclarationVisitor {
 
-  private Set<MethodDeclaration> collectedMethodDeclarations = new HashSet<MethodDeclaration>();
-  private Set<ClassDeclaration> collectedClassDeclarations = new HashSet<ClassDeclaration>();
-  private Set<InterfaceDeclaration> collectedInterfaceDeclarations = new HashSet<InterfaceDeclaration>();
+  private List<MethodDeclaration> collectedMethodDeclarations = new ArrayList<MethodDeclaration>();
+  private List<ClassDeclaration> collectedClassDeclarations = new ArrayList<ClassDeclaration>();
+  private List<InterfaceDeclaration> collectedInterfaceDeclarations = new ArrayList<InterfaceDeclaration>();
   private List<PackageDeclaration> collectedPackageDeclarations = new ArrayList<PackageDeclaration>();
 
-  public Set<MethodDeclaration> getCollectedMethodDeclarations() {
+  public List<MethodDeclaration> getCollectedMethodDeclarations() {
+    Collections.sort(collectedMethodDeclarations, new Comparator<MethodDeclaration>()
{
+      public int compare(MethodDeclaration d1, MethodDeclaration d2) {
+          return d1.getSimpleName().compareTo(d2.getSimpleName());
+      }
+    });
     return collectedMethodDeclarations;
   }
 
-  public Set<ClassDeclaration> getCollectedClassDeclarations() {
+  public List<ClassDeclaration> getCollectedClassDeclarations() {
+    Collections.sort(collectedClassDeclarations, new Comparator<ClassDeclaration>()
{
+      public int compare(ClassDeclaration d1, ClassDeclaration d2) {
+        return d1.getSimpleName().compareTo(d2.getSimpleName());
+      }
+    });
     return collectedClassDeclarations;
   }
 
-  public Set<InterfaceDeclaration> getCollectedInterfaceDeclarations() {
+  public List<InterfaceDeclaration> getCollectedInterfaceDeclarations() {
+    Collections.sort(collectedInterfaceDeclarations, new Comparator<InterfaceDeclaration>()
{
+      public int compare(InterfaceDeclaration d1, InterfaceDeclaration d2) {
+        return d1.getSimpleName().compareTo(d2.getSimpleName());
+      }
+    });
     return collectedInterfaceDeclarations;
   }
 

Modified: myfaces/tobago/branches/tobago-1.0.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/TaglibAnnotationVisitor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/TaglibAnnotationVisitor.java?rev=803558&r1=803557&r2=803558&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/TaglibAnnotationVisitor.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/TaglibAnnotationVisitor.java
Wed Aug 12 15:34:09 2009
@@ -28,13 +28,13 @@
 import org.apache.commons.io.IOUtils;
 import org.apache.myfaces.tobago.apt.annotation.BodyContent;
 import org.apache.myfaces.tobago.apt.annotation.BodyContentDescription;
+import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
+import org.apache.myfaces.tobago.apt.annotation.Facet;
 import org.apache.myfaces.tobago.apt.annotation.Preliminary;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
 import org.apache.myfaces.tobago.apt.annotation.Taglib;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
-import org.apache.myfaces.tobago.apt.annotation.Facet;
-import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -51,8 +51,8 @@
 import java.io.Writer;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Set;
 import java.util.Locale;
+import java.util.Set;
 
 /*
  * Created: Mar 22, 2005 8:18:35 PM
@@ -302,8 +302,7 @@
   }
 
   private InterfaceDeclaration getInterfaceDeclaration(String name) {
-    Set<InterfaceDeclaration> declarations = getCollectedInterfaceDeclarations();
-    for (InterfaceDeclaration declaration : declarations) {
+    for (InterfaceDeclaration declaration : getCollectedInterfaceDeclarations()) {
       if (name.equals(declaration.getQualifiedName())) {
         return declaration;
       }



Mime
View raw message