db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1485961 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/
Date Fri, 24 May 2013 08:12:49 GMT
Author: kahatlen
Date: Fri May 24 08:12:49 2013
New Revision: 1485961

URL: http://svn.apache.org/r1485961
Log:
DERBY-5840: Clean up compiler warnings introduced by using Java 5 language features

Generify CollectNodesVisitor so that the SuppressWarnings annotation
on its visit() method can be removed.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CollectNodesVisitor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CollectNodesVisitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CollectNodesVisitor.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CollectNodesVisitor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CollectNodesVisitor.java
Fri May 24 08:12:49 2013
@@ -38,8 +38,8 @@ import org.apache.derby.iapi.sql.compile
 public class CollectNodesVisitor<T extends Visitable> implements Visitor
 {
     private final List<T> nodeList;
-    private final Class nodeClass;
-    private final Class skipOverClass;
+    private final Class<T> nodeClass;
+    private final Class<? extends Visitable> skipOverClass;
 
 	/**
 	 * Construct a visitor
@@ -47,7 +47,7 @@ public class CollectNodesVisitor<T exten
 	 * @param nodeClass the class of the node that 
 	 * 	we are looking for.
 	 */
-	public CollectNodesVisitor(Class nodeClass)
+    public CollectNodesVisitor(Class<T> nodeClass)
 	{
         this(nodeClass, null);
 	}
@@ -60,7 +60,8 @@ public class CollectNodesVisitor<T exten
 	 * @param skipOverClass do not go below this
 	 * node when searching for nodeClass.
 	 */
-	public CollectNodesVisitor(Class nodeClass, Class skipOverClass)
+    public CollectNodesVisitor(Class<T> nodeClass,
+                               Class<? extends Visitable> skipOverClass)
 	{
         this.nodeList = new ArrayList<T>();
         this.nodeClass = nodeClass;
@@ -89,12 +90,11 @@ public class CollectNodesVisitor<T exten
 	 *
 	 * @return me
 	 */
-    @SuppressWarnings("unchecked")
 	public Visitable visit(Visitable node)
 	{
 		if (nodeClass.isInstance(node))
 		{
-			nodeList.add( (T) node);
+            nodeList.add(nodeClass.cast(node));
 		}
 		return node;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java
Fri May 24 08:12:49 2013
@@ -719,16 +719,13 @@ public class CreateTriggerNode extends D
 
         if ( genColCount == 0 ) { return; }
 
-        CollectNodesVisitor     visitor = new CollectNodesVisitor( ColumnReference.class
);
+        CollectNodesVisitor<ColumnReference> visitor =
+            new CollectNodesVisitor<ColumnReference>(ColumnReference.class);
 
         actionNode.accept( visitor );
 
-        List columnRefs = visitor.getList();
-        int                             colRefCount = columnRefs.size();
-
-        for ( int crf_idx = 0; crf_idx < colRefCount; crf_idx++ )
+        for (ColumnReference cr : visitor.getList())
         {
-            ColumnReference     cr = (ColumnReference) columnRefs.get( crf_idx );
             String  colRefName = cr.getColumnName();
             String  tabRefName = cr.getTableName();
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java Fri
May 24 08:12:49 2013
@@ -66,7 +66,6 @@ import org.apache.derby.iapi.sql.diction
 import org.apache.derby.iapi.sql.dictionary.ViewDescriptor;
 
 import org.apache.derby.iapi.sql.execute.ExecRow;
-import org.apache.derby.iapi.sql.execute.ExecutionContext;
 
 import org.apache.derby.iapi.sql.LanguageProperties;
 
@@ -2368,13 +2367,13 @@ public class FromBaseTable extends FromT
 				//Following call is marking the query to run with definer 
 				//privileges. This marking will make sure that we do not collect
 				//any privilege requirement for it.
-                CollectNodesVisitor cnv =
-                    new CollectNodesVisitor(QueryTreeNode.class, null);
+                CollectNodesVisitor<QueryTreeNode> cnv =
+                    new CollectNodesVisitor<QueryTreeNode>(QueryTreeNode.class);
 
                 fsq.accept(cnv);
 
-                for (Iterator it = cnv.getList().iterator(); it.hasNext(); ) {
-                    ((QueryTreeNode)it.next()).disablePrivilegeCollection();
+                for (QueryTreeNode node : cnv.getList()) {
+                    node.disablePrivilegeCollection();
                 }
 
 				fsq.setOrigTableName(this.getOrigTableName());

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java Fri
May 24 08:12:49 2013
@@ -21,8 +21,6 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import java.util.Iterator;
-import java.util.List;
 
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.compile.C_NodeTypes;
@@ -265,12 +263,11 @@ public class FromSubquery extends FromTa
         // Nested VTI/tableFunctions will want to know whether their arguments
         // reference tables in the FROM list which contains this subquery. Those
         // references are illegal. See DERBY-5554 and DERBY-5779.
-		CollectNodesVisitor nestedVTIs = new CollectNodesVisitor( FromVTI.class );
+        CollectNodesVisitor<FromVTI> nestedVTIs =
+                new CollectNodesVisitor<FromVTI>(FromVTI.class);
 		subquery.accept( nestedVTIs );
-		List vtiRefs = nestedVTIs.getList();
-		for (Iterator it = vtiRefs.iterator(); it.hasNext(); )
+        for (FromVTI ref : nestedVTIs.getList())
 		{
-			FromVTI ref = (FromVTI) it.next();
             ref.addOuterFromList( fromListParam );
 		}
         

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java Fri May
24 08:12:49 2013
@@ -31,7 +31,6 @@ import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import org.apache.derby.catalog.TypeDescriptor;
 import org.apache.derby.catalog.DefaultInfo;
@@ -54,6 +53,7 @@ import org.apache.derby.iapi.sql.compile
 import org.apache.derby.iapi.sql.compile.OptimizablePredicateList;
 import org.apache.derby.iapi.sql.compile.Optimizer;
 import org.apache.derby.iapi.sql.compile.RowOrdering;
+import org.apache.derby.iapi.sql.compile.Visitable;
 import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
@@ -61,7 +61,6 @@ import org.apache.derby.iapi.sql.diction
 import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
-import org.apache.derby.iapi.sql.execute.ExecutionContext;
 import org.apache.derby.iapi.transaction.TransactionControl;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.DataValueDescriptor;
@@ -901,12 +900,9 @@ public class FromVTI extends FromTable i
 		 * from other VTIs that appear after this one in the FROM list.
 		 * These CRs will have uninitialized column and table numbers.
 		 */
-		List colRefs = getNodesFromParameters(ColumnReference.class);
         ArrayList<AggregateNode> aggregates = null;
-		for (Iterator it = colRefs.iterator(); it.hasNext(); )
+        for (ColumnReference ref : getNodesFromParameters(ColumnReference.class))
 		{
-			ColumnReference ref = (ColumnReference) it.next();
-
             //
             // Table Function parameters may not reference columns from other tables in the
             // FROM list of the current query block. See DERBY-5579. We also do not allow
@@ -1010,10 +1006,10 @@ public class FromVTI extends FromTable i
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	List getNodesFromParameters(Class nodeClass)
+    <T extends Visitable> List<T> getNodesFromParameters(Class<T> nodeClass)
 		throws StandardException
 	{
-		CollectNodesVisitor getCRs = new CollectNodesVisitor(nodeClass);
+        CollectNodesVisitor<T> getCRs = new CollectNodesVisitor<T>(nodeClass);
 		methodCall.accept(getCRs);
 		return getCRs.getList();
 	}
@@ -1609,10 +1605,8 @@ public class FromVTI extends FromTable i
      */
     private void remapBaseTableColumns() throws StandardException
     {
-		List colRefs = getNodesFromParameters(ColumnReference.class);
-		for (Iterator it = colRefs.iterator(); it.hasNext(); )
+        for (ColumnReference ref : getNodesFromParameters(ColumnReference.class))
 		{
-			ColumnReference ref = (ColumnReference) it.next();
             FromTable   fromTable = argSources.get( new Integer( ref.getTableNumber() ) );
 
             if ( fromTable != null )

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
Fri May 24 08:12:49 2013
@@ -132,10 +132,11 @@ public class GenerationClauseNode extend
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-    public List findReferencedColumns()
+    public List<ColumnReference> findReferencedColumns()
         throws StandardException
     {
-        CollectNodesVisitor visitor = new CollectNodesVisitor( ColumnReference.class );
+        CollectNodesVisitor<ColumnReference> visitor =
+            new CollectNodesVisitor<ColumnReference>(ColumnReference.class);
 
         _generationExpression.accept( visitor );
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java Fri
May 24 08:12:49 2013
@@ -21,7 +21,6 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import java.util.Iterator;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Collections;
@@ -576,15 +575,13 @@ public class GroupByNode extends SingleC
 			// it is allright to have columns from parent or child subqueries;
 			//   select * from p where p.p1 in 
 			//      (select c.c1 from c group by c.c1 having count(*) = p.p2
-			CollectNodesVisitor collectNodesVisitor = 
-				new CollectNodesVisitor(ColumnReference.class, AggregateNode.class);
+            CollectNodesVisitor<ColumnReference> collectNodesVisitor =
+                new CollectNodesVisitor<ColumnReference>(
+                    ColumnReference.class, AggregateNode.class);
 			havingClause.accept(collectNodesVisitor);
 
-			for (Iterator it = collectNodesVisitor.getList().iterator();
-			     it.hasNext(); ) 
+            for (ColumnReference cr: collectNodesVisitor.getList())
 			{
-				ColumnReference cr = (ColumnReference)it.next();
-
 				if ( ! (cr.getGeneratedToReplaceAggregate() ||
 						cr.getGeneratedToReplaceWindowFunctionCall()) &&
 					 cr.getSourceLevel() == level) {
@@ -1362,11 +1359,13 @@ public class GroupByNode extends SingleC
 				ValueNode v1 = o1.getSource();
 				ValueNode v2 = o2.getSource();
 				int refCount1, refCount2;
-				CollectNodesVisitor vis = new CollectNodesVisitor(
-				ColumnReference.class);
+                CollectNodesVisitor<ColumnReference> vis =
+                    new CollectNodesVisitor<ColumnReference>(
+                        ColumnReference.class);
 				v1.accept(vis);
 				refCount1 = vis.getList().size();
-				vis = new CollectNodesVisitor(ColumnReference.class);
+                vis = new CollectNodesVisitor<ColumnReference>(
+                        ColumnReference.class);
 				v2.accept(vis);
 				refCount2 = vis.getList().size();
 				// The ValueNode with the larger number of refs

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java
Fri May 24 08:12:49 2013
@@ -235,11 +235,11 @@ abstract class MethodCallNode extends Ja
 	void getCorrelationTables(JBitSet correlationMap)
 		throws StandardException
 	{
-		CollectNodesVisitor getCRs = new CollectNodesVisitor(ColumnReference.class);
+        CollectNodesVisitor<ColumnReference> getCRs =
+            new CollectNodesVisitor<ColumnReference>(ColumnReference.class);
 		accept(getCRs);
-		for (Iterator it = getCRs.getList().iterator(); it.hasNext(); )
+        for (ColumnReference ref : getCRs.getList())
 		{
-			ColumnReference ref = (ColumnReference) it.next();
 			if (ref.getCorrelated())
 			{
 				correlationMap.set(ref.getTableNumber());

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java Fri
May 24 08:12:49 2013
@@ -21,8 +21,6 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import java.util.Iterator;
-
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.services.sanity.SanityManager;
@@ -249,14 +247,13 @@ public class OrderByColumn extends Order
 				String col=null;
 				boolean match=false;
 
-				CollectNodesVisitor collectNodesVisitor =
-					new CollectNodesVisitor(ColumnReference.class);
+                CollectNodesVisitor<ColumnReference> collectNodesVisitor =
+                    new CollectNodesVisitor<ColumnReference>(
+                        ColumnReference.class);
 				expression.accept(collectNodesVisitor);
 
-				for (Iterator it = collectNodesVisitor.getList().iterator();
-				it.hasNext(); )
+                for (ColumnReference cr1 : collectNodesVisitor.getList())
 				{//visits through the columns in this OrderByColumn
-					ColumnReference cr1=(ColumnReference)it.next();
 					col=cr1.getColumnName();
 					match = columnMatchFound(target,cr1);
 					/* breaks if a match not found, this is needed

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java Fri
May 24 08:12:49 2013
@@ -58,7 +58,6 @@ import java.lang.reflect.Modifier;
 
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -1463,11 +1462,11 @@ public class PredicateList extends Query
 			Predicate	predicate;
 			predicate = (Predicate) elementAt(index);
 
-			CollectNodesVisitor getCRs = 
-                new CollectNodesVisitor(ColumnReference.class);
+            CollectNodesVisitor<ColumnReference> getCRs =
+                new CollectNodesVisitor<ColumnReference>(ColumnReference.class);
 
 			predicate.getAndNode().accept(getCRs);
-			List colRefs = getCRs.getList();
+            List<ColumnReference> colRefs = getCRs.getList();
 
 			/* state doesn't become true until we find the 1st
 			 * ColumnReference.  (We probably will always find
@@ -1476,9 +1475,8 @@ public class PredicateList extends Query
 			boolean state = colRefs.size() > 0;
 			if (state)
 			{
-				for (Iterator it = colRefs.iterator(); it.hasNext(); )
+                for (ColumnReference ref : colRefs)
 				{
-					ColumnReference ref = (ColumnReference) it.next();
 					if (!ref.pointsToColumnReference())
 					{
 						state = false;
@@ -1640,8 +1638,8 @@ public class PredicateList extends Query
 	void markReferencedColumns()
 		throws StandardException
 	{
-		CollectNodesVisitor collectCRs = 
-            new CollectNodesVisitor(ColumnReference.class);
+        CollectNodesVisitor<ColumnReference> collectCRs =
+            new CollectNodesVisitor<ColumnReference>(ColumnReference.class);
 
 		int size = size();
 		for (int index = 0; index < size; index++)
@@ -1650,10 +1648,8 @@ public class PredicateList extends Query
 			predicate.getAndNode().accept(collectCRs);
 		}
 
-		List colRefs = collectCRs.getList();
-		for (Iterator it = colRefs.iterator(); it.hasNext(); )
+        for (ColumnReference ref : collectCRs.getList())
 		{
-			ColumnReference ref = (ColumnReference) it.next();
 			ResultColumn source = ref.getSource();
 
             // DERBY-4391: Don't try to call markAllRCsInChainReferenced() if

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java Fri
May 24 08:12:49 2013
@@ -174,8 +174,9 @@ public class SelectNode extends ResultSe
 		
 		this.originalWhereClauseHadSubqueries = false;
 		if (this.whereClause != null){
-			CollectNodesVisitor cnv = 
-				new CollectNodesVisitor(SubqueryNode.class, SubqueryNode.class);
+            CollectNodesVisitor<SubqueryNode> cnv =
+                new CollectNodesVisitor<SubqueryNode>(
+                    SubqueryNode.class, SubqueryNode.class);
 			this.whereClause.accept(cnv);
 			if (!cnv.getList().isEmpty()){
 				this.originalWhereClauseHadSubqueries = true;
@@ -756,8 +757,9 @@ public class SelectNode extends ResultSe
 		 * With a FromSubquery in the FromList we cannot bind target expressions 
 		 * at this level (DERBY-3321)
 		 */
-		CollectNodesVisitor cnv = new CollectNodesVisitor(FromSubquery.class, 
-														  FromSubquery.class);
+        CollectNodesVisitor<FromSubquery> cnv =
+            new CollectNodesVisitor<FromSubquery>(
+                FromSubquery.class, FromSubquery.class);
 		fromList.accept(cnv);
 		if (!cnv.getList().isEmpty()){		
 			bindTargetListOnly = false;
@@ -1312,14 +1314,12 @@ public class SelectNode extends ResultSe
 			// Collect window function calls and in-lined window definitions
 			// contained in them from the orderByList.
 
-			CollectNodesVisitor cnvw =
-				new CollectNodesVisitor(WindowFunctionNode.class);
+            CollectNodesVisitor<WindowFunctionNode> cnvw =
+                new CollectNodesVisitor<WindowFunctionNode>(
+                    WindowFunctionNode.class);
             orderByLists[0].accept(cnvw);
-			List wfcInOrderBy = cnvw.getList();
 
-			for (int i=0; i < wfcInOrderBy.size(); i++) {
-				WindowFunctionNode wfn =
-					(WindowFunctionNode) wfcInOrderBy.get(i);
+            for (WindowFunctionNode wfn : cnvw.getList()) {
 				windowFuncCalls.add(wfn);
 
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java
Fri May 24 08:12:49 2013
@@ -39,7 +39,6 @@ import org.apache.derby.iapi.types.DataT
 import org.apache.derby.iapi.util.JBitSet;
 
 import java.util.HashMap;
-import java.util.List;
 
 /**
  * A SetOperatorNode represents a UNION, INTERSECT, or EXCEPT in a DML statement. Binding
and optimization
@@ -219,15 +218,15 @@ abstract class SetOperatorNode extends T
 		 */
 
 		// Find all UnionNodes in the subtree.
-		CollectNodesVisitor cnv = new CollectNodesVisitor(UnionNode.class);
+        CollectNodesVisitor<UnionNode> cnv =
+                new CollectNodesVisitor<UnionNode>(UnionNode.class);
 		this.accept(cnv);
-		List unions = cnv.getList();
 
 		// Now see if any of them have unpushed predicates.
 		boolean genPRN = false;
-		for (int i = unions.size() - 1; i >= 0; i--)
+        for (UnionNode node : cnv.getList())
 		{
-			if (((UnionNode)unions.get(i)).hasUnPushedPredicates())
+            if (node.hasUnPushedPredicates())
 			{
 				genPRN = true;
 				break;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowResultSetNode.java?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowResultSetNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowResultSetNode.java
Fri May 24 08:12:49 2013
@@ -147,20 +147,17 @@ public class WindowResultSetNode extends
         // Add all referenced columns in select list to windowing node's RCL
         // and substitute references in original node to point to the Windowing
         // result set. (modelled on GroupByNode's action for addUnAggColumns)
-        CollectNodesVisitor getCRVisitor =
-            new CollectNodesVisitor(ColumnReference.class);
+        CollectNodesVisitor<ColumnReference> getCRVisitor =
+            new CollectNodesVisitor<ColumnReference>(ColumnReference.class);
 
         ResultColumnList prcl = parent.getResultColumns();
 
         parent.getResultColumns().accept(getCRVisitor);
 
-        List colRefs = getCRVisitor.getList();
-
         // Find all unique columns referenced and add those to windowing result
         // set.
         ArrayList<ValueNode> uniqueCols = new ArrayList<ValueNode>();
-        for (int i= 0; i< colRefs.size(); i++) {
-            ColumnReference cr = (ColumnReference) colRefs.get(i);
+        for (ColumnReference cr : getCRVisitor.getList()) {
             if (!colRefAlreadySeen(uniqueCols, cr)) {
                 uniqueCols.add(cr);
             }
@@ -174,12 +171,9 @@ public class WindowResultSetNode extends
             new CollectNodesVisitor<VirtualColumnNode>(VirtualColumnNode.class);
 
         parent.getResultColumns().accept(getVCVisitor);
-        List<VirtualColumnNode> vcs = getVCVisitor.getList();
 
         // Add any virtual columns to windowing result.
-        for (int i= 0; i< vcs.size(); i++) {
-            uniqueCols.add(vcs.get(i));
-        }
+        uniqueCols.addAll(getVCVisitor.getList());
 
         ResultColumnList bottomRCL  = childResult.getResultColumns();
         ResultColumnList windowingRCL = resultColumns;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?rev=1485961&r1=1485960&r2=1485961&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Fri May
24 08:12:49 2013
@@ -10063,12 +10063,12 @@ groupingColumnReference(GroupByList grou
         // inside the expression and mark them so that at bind() time
         // we can reject them if they turn out to be user-defined aggregates
         // rather than ordinary function calls.
-        CollectNodesVisitor  functionSniffer = new CollectNodesVisitor( StaticMethodCallNode.class
);
+        CollectNodesVisitor<StaticMethodCallNode> functionSniffer =
+            new CollectNodesVisitor<StaticMethodCallNode>(StaticMethodCallNode.class);
         columnExpression.accept( functionSniffer );
-        List functionNodes = functionSniffer.getList();
-        for ( int i = 0; i < functionNodes.size(); i++ )
+        for (StaticMethodCallNode node : functionSniffer.getList())
         {
-            ((StaticMethodCallNode) functionNodes.get(i)).setAppearsInGroupBy();
+            node.setAppearsInGroupBy();
         }
 
 		if (columnExpression.isParameterNode()) 



Mime
View raw message