myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r803587 - in /myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt: AnnotationDeclarationVisitorCollector.java TaglibAnnotationVisitor.java
Date Wed, 12 Aug 2009 16:37:10 GMT
Author: lofwyr
Date: Wed Aug 12 16:37:09 2009
New Revision: 803587

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

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

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationDeclarationVisitorCollector.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationDeclarationVisitorCollector.java?rev=803587&r1=803586&r2=803587&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationDeclarationVisitorCollector.java
(original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationDeclarationVisitorCollector.java
Wed Aug 12 16:37: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
@@ -34,20 +34,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/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/TaglibAnnotationVisitor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/TaglibAnnotationVisitor.java?rev=803587&r1=803586&r2=803587&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/TaglibAnnotationVisitor.java
(original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/TaglibAnnotationVisitor.java
Wed Aug 12 16:37:09 2009
@@ -337,8 +337,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