You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2013/06/21 09:47:52 UTC

svn commit: r1495305 [8/21] - in /db/derby/code/trunk: java/engine/org/apache/derby/ java/engine/org/apache/derby/catalog/types/ java/engine/org/apache/derby/iapi/services/io/ java/engine/org/apache/derby/iapi/sql/ java/engine/org/apache/derby/iapi/sql...

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java Fri Jun 21 07:47:47 2013
@@ -21,27 +21,22 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Properties;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.Optimizable;
 import org.apache.derby.iapi.sql.compile.OptimizableList;
 import org.apache.derby.iapi.sql.compile.Optimizer;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.reference.SQLState;
-
 import org.apache.derby.iapi.util.JBitSet;
 import org.apache.derby.iapi.util.ReuseFactory;
 import org.apache.derby.iapi.util.StringUtil;
 
-import java.util.ArrayList;
-import java.util.Properties;
-import java.util.Enumeration;
-
 
 /**
  * A FromList represents the list of tables in a FROM clause in a DML
@@ -49,7 +44,7 @@ import java.util.Enumeration;
  *
  */
 
-public class FromList extends QueryTreeNodeVector implements OptimizableList
+class FromList extends QueryTreeNodeVector implements OptimizableList
 {
 	Properties	properties;
 	// RESOLVE: The default should be false
@@ -78,28 +73,54 @@ public class FromList extends QueryTreeN
 	 */
 	private WindowList windows;
 
-
-	/** Initializer for a FromList */
-
-	public void init(Object optimizeJoinOrder)
-	{
-		fixedJoinOrder = ! (((Boolean) optimizeJoinOrder).booleanValue());
-		isTransparent = false;
+    /**
+     *  Does not change the default for join order optimization, i.e.
+     * {@code false}.
+     * @param cm context manager
+     */
+    FromList(ContextManager cm) {
+        super(cm);
+        this.isTransparent = false;
+        setNodeType(C_NodeTypes.FROM_LIST);
+    }
+
+    /**
+     * Constructor for a FromList
+     *
+     * @param optimizeJoinOrder {@code true} if join order optimization is to
+     *                          be performed
+     * @param cm                context manager
+     */
+
+    FromList(boolean optimizeJoinOrder, ContextManager cm)
+	{
+        super(cm);
+        constructorMinion(optimizeJoinOrder);
 	}
 
 	/**
-	 * Initializer for a FromList
-	 *
+     * Constructor for a FromList
+	 *
+     * @param optimizeJoinOrder {@code true} if join order optimization is to
+     *                          be performed
+     * @param fromTable         initialize list with this table
+     * @param cm                context manager
 	 * @exception StandardException		Thrown on error
 	 */
-	public void init(Object optimizeJoinOrder, Object fromTable)
-				throws StandardException
-	{
-		init(optimizeJoinOrder);
-
-		addFromTable((FromTable) fromTable);
+    FromList(boolean optimizeJoinOrder,
+             FromTable fromTable,
+             ContextManager cm) throws StandardException
+	{
+        super(cm);
+        constructorMinion(optimizeJoinOrder);
+        addFromTable(fromTable);
 	}
 
+    private void constructorMinion(boolean optimizeJoinOrder) {
+        this.fixedJoinOrder = !optimizeJoinOrder;
+        this.isTransparent = false;
+        setNodeType(C_NodeTypes.FROM_LIST);
+    }
 	/*
 	 * OptimizableList interface
 	 */
@@ -142,7 +163,7 @@ public class FromList extends QueryTreeN
 	 * @exception StandardException		Thrown on error
 	 */
 
-    void addFromTable(FromTable fromTable) throws StandardException
+    final void addFromTable(FromTable fromTable) throws StandardException
 	{
 		/* Don't worry about checking TableOperatorNodes since
 		 * they don't have exposed names.  This will potentially
@@ -153,8 +174,9 @@ public class FromList extends QueryTreeN
 		 * user is executing a really dumb query and we won't throw
 		 * and exception - consider it an ANSI extension.
 		 */
-        TableName leftTable = null;
-        TableName rightTable = null;
+        TableName leftTable;
+        TableName rightTable;
+
 		if (! (fromTable instanceof TableOperatorNode))
 		{
 			/* Check for duplicate table name in FROM list */
@@ -190,7 +212,7 @@ public class FromList extends QueryTreeN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public boolean referencesTarget(String name, boolean baseTable)
+    boolean referencesTarget(String name, boolean baseTable)
 		throws StandardException
 	{
 		FromTable		fromTable;
@@ -219,6 +241,7 @@ public class FromList extends QueryTreeN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public boolean referencesSessionSchema()
 		throws StandardException
 	{
@@ -289,7 +312,7 @@ public class FromList extends QueryTreeN
 	 * @see HalfOuterJoinNode#isJoinColumnForRightOuterJoin
 	 */
 
-	public void isJoinColumnForRightOuterJoin(ResultColumn rc) 
+    void isJoinColumnForRightOuterJoin(ResultColumn rc)
 	{
 		FromTable	fromTable;
 		int size = size();
@@ -299,7 +322,7 @@ public class FromList extends QueryTreeN
 			fromTable.isJoinColumnForRightOuterJoin(rc);
 		}
 	}
-	public void bindTables(DataDictionary dataDictionary, 
+    void bindTables(DataDictionary dataDictionary,
 							FromList fromListParam) 
 			throws StandardException
 	{
@@ -344,7 +367,7 @@ public class FromList extends QueryTreeN
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public void bindExpressions( FromList fromListParam )
+    void bindExpressions( FromList fromListParam )
 					throws StandardException
 	{
 		FromTable	fromTable;
@@ -373,7 +396,7 @@ public class FromList extends QueryTreeN
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public void bindResultColumns(FromList fromListParam)
+    void bindResultColumns(FromList fromListParam)
 				throws StandardException
 	{
 		FromTable	fromTable;
@@ -428,11 +451,11 @@ public class FromList extends QueryTreeN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultColumnList expandAll(TableName allTableName)
+    ResultColumnList expandAll(TableName allTableName)
 			throws StandardException
 	{
 		ResultColumnList resultColumnList = null;
-		ResultColumnList tempRCList = null;
+        ResultColumnList tempRCList;
 		boolean			 matchfound = false;
 		FromTable	 fromTable;
  
@@ -547,13 +570,13 @@ public class FromList extends QueryTreeN
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public ResultColumn bindColumnReference(ColumnReference columnReference)
+    ResultColumn bindColumnReference(ColumnReference columnReference)
 				throws StandardException
 	{
 		boolean			columnNameMatch = false;
 		boolean			tableNameMatch = false;
 		FromTable		fromTable;
-		int				currentLevel = -1;
+        int             currentLevel;
 		int				previousLevel = -1;
 		ResultColumn	matchingRC = null;
 		ResultColumn	resultColumn;
@@ -638,7 +661,7 @@ public class FromList extends QueryTreeN
 	 *									directly under a ResultColumn
 	 */
 
-	public void rejectParameters() throws StandardException
+    void rejectParameters() throws StandardException
 	{
 		FromTable	fromTable;
 
@@ -653,7 +676,7 @@ public class FromList extends QueryTreeN
 	// This method reorders LOJs in the FROM clause.
 	// For now, we process only a LOJ.  For example, "... from LOJ_1, LOJ2 ..."
 	// will not be processed. 
-	public boolean LOJ_reorderable(int numTables) throws StandardException
+    boolean LOJ_reorderable(int numTables) throws StandardException
 	{
 		boolean anyChange = false;
 
@@ -683,7 +706,7 @@ public class FromList extends QueryTreeN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void preprocess(int numTables,
+    void preprocess(int numTables,
 						   GroupByList gbl,
 						   ValueNode predicateTree)
 								throws StandardException
@@ -715,7 +738,7 @@ public class FromList extends QueryTreeN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void flattenFromTables(ResultColumnList rcl,
+    void flattenFromTables(ResultColumnList rcl,
 								  PredicateList predicateList,
 								  SubqueryList sql,
                                   GroupByList gbl,
@@ -853,7 +876,7 @@ public class FromList extends QueryTreeN
 	 *
 	 * @param level		The query block level for this table.
 	 */
-	public void setLevel(int level)
+    void setLevel(int level)
 	{
 		int size = size();
 		for (int index = 0; index < size; index++)
@@ -899,7 +922,7 @@ public class FromList extends QueryTreeN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void setProperties(Properties props) throws StandardException
+    void setProperties(Properties props) throws StandardException
 	{
 		properties = props;
 
@@ -1062,7 +1085,7 @@ public class FromList extends QueryTreeN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL)
+    void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL)
 				throws StandardException
 	{
 		int size = size();
@@ -1193,8 +1216,7 @@ public class FromList extends QueryTreeN
 		ColumnReference	additionalCR = null;
 
 		PredicateList predicatesTemp;
-		predicatesTemp = (PredicateList) getNodeFactory().getNode(
-			C_NodeTypes.PREDICATE_LIST,	getContextManager());
+        predicatesTemp = new PredicateList(getContextManager());
 		int wherePredicatesSize = wherePredicates.size();
 		for (int index = 0; index < wherePredicatesSize; index++)
 			predicatesTemp.addPredicate((Predicate)wherePredicates.elementAt(index));
@@ -1276,7 +1298,7 @@ public class FromList extends QueryTreeN
 				for (int predicatesTempIndex = predicatesTempSize-1;
 					predicatesTempIndex >= 0; predicatesTempIndex--)
 				{
-					AndNode topAndNode = (AndNode)
+                    AndNode topAndNode =
 						((Predicate) predicatesTemp.elementAt(predicatesTempIndex)).getAndNode();
 
 					for (ValueNode whereWalker = topAndNode; whereWalker instanceof AndNode;
@@ -1313,7 +1335,7 @@ public class FromList extends QueryTreeN
 		tableNumbers = getTableNumbers();
 		JBitSet[][] tableColMap = new JBitSet[size][size];
 		boolean[] oneRow = new boolean[size];
-		boolean oneRowResult = false;
+        boolean oneRowResult;
 
 		/* See if each table has a uniqueness condition */
 		for (int index = 0; index < size; index++)
@@ -1561,7 +1583,7 @@ public class FromList extends QueryTreeN
 	 *
 	 * @return	The lock mode
 	 */
-	public int updateTargetLockMode()
+    int updateTargetLockMode()
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -1614,7 +1636,7 @@ public class FromList extends QueryTreeN
 	 * Set windows field to the supplied value.
 	 * @param windows list of window definitions associated with a SELECT.
 	 */
-	public void setWindows(WindowList windows) {
+    void setWindows(WindowList windows) {
 		this.windows = windows;
 	}
 
@@ -1622,7 +1644,7 @@ public class FromList extends QueryTreeN
 	/**
 	 * @return list of window definitions associated with a SELECT.
 	 */
-	public WindowList getWindows() {
+    WindowList getWindows() {
 		return windows;
 	}
 }

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=1495305&r1=1495304&r2=1495305&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 Jun 21 07:47:47 2013
@@ -21,19 +21,17 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-
+import java.util.Properties;
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
+import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.sql.compile.Visitor;
-
 import org.apache.derby.iapi.util.JBitSet;
 
-
 /**
  * A FromSubquery represents a subquery in the FROM list of a DML statement.
  *
@@ -44,7 +42,7 @@ import org.apache.derby.iapi.util.JBitSe
  * of the insert target table.
  *
  */
-public class FromSubquery extends FromTable
+class FromSubquery extends FromTable
 {
 	ResultSetNode	subquery;
 	private OrderByList orderByList;
@@ -59,34 +57,37 @@ public class FromSubquery extends FromTa
 	private SchemaDescriptor origCompilationSchema = null;
 
 	/**
-	 * Intializer for a table in a FROM list.
+     * Constructor for a table in a FROM list.
 	 *
 	 * @param subquery		The subquery
 	 * @param orderByList   ORDER BY list if any, or null
      * @param offset        OFFSET if any, or null
      * @param fetchFirst    FETCH FIRST if any, or null
-	 * @param hasJDBClimitClause True if the offset/fetchFirst clauses come from JDBC limit/offset escape syntax
+     * @param hasJDBClimitClause True if the offset/fetchFirst clauses come
+     *                      from JDBC limit/offset escape syntax
 	 * @param correlationName	The correlation name
 	 * @param derivedRCL		The derived column list
 	 * @param tableProperties	Properties list associated with the table
+     * @param cm            The context manager
 	 */
-	public void init(
-					Object subquery,
-					Object orderByList,
-                    Object offset,
-                    Object fetchFirst,
-                    Object hasJDBClimitClause,
-					Object correlationName,
-				 	Object derivedRCL,
-					Object tableProperties)
-	{
-		super.init(correlationName, tableProperties);
-		this.subquery = (ResultSetNode) subquery;
-		this.orderByList = (OrderByList)orderByList;
-        this.offset = (ValueNode)offset;
-        this.fetchFirst = (ValueNode)fetchFirst;
-        this.hasJDBClimitClause = (hasJDBClimitClause == null) ? false : ((Boolean) hasJDBClimitClause).booleanValue();
-		resultColumns = (ResultColumnList) derivedRCL;
+    FromSubquery(ResultSetNode subquery,
+                 OrderByList orderByList,
+                 ValueNode offset,
+                 ValueNode fetchFirst,
+                 boolean hasJDBClimitClause,
+                 String correlationName,
+                 ResultColumnList derivedRCL,
+                 Properties tableProperties,
+                 ContextManager cm)
+	{
+        super(correlationName, tableProperties, cm);
+        setNodeType(C_NodeTypes.FROM_SUBQUERY);
+        this.subquery = subquery;
+        this.orderByList = orderByList;
+        this.offset = offset;
+        this.fetchFirst = fetchFirst;
+        this.hasJDBClimitClause = hasJDBClimitClause;
+        resultColumns = derivedRCL;
 	}
 
 	/**
@@ -95,8 +96,8 @@ public class FromSubquery extends FromTa
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG) {
 			super.printSubNodes(depth);
@@ -132,7 +133,7 @@ public class FromSubquery extends FromTa
 	 *
 	 * @return ResultSetNode	The "subquery" from this node.
 	 */
-	public ResultSetNode getSubquery()
+    ResultSetNode getSubquery()
 	{
 		return subquery;
 	}
@@ -150,6 +151,7 @@ public class FromSubquery extends FromTa
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     FromTable getFromTableByName(String name, String schemaName, boolean exactMatch)
 		throws StandardException
 	{
@@ -178,8 +180,8 @@ public class FromSubquery extends FromTa
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode bindNonVTITables(DataDictionary dataDictionary, 
+    @Override
+    ResultSetNode bindNonVTITables(DataDictionary dataDictionary,
 						  FromList fromListParam) 
 							throws StandardException
 	{
@@ -201,8 +203,8 @@ public class FromSubquery extends FromTa
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode bindVTITables(FromList fromListParam) 
+    @Override
+    ResultSetNode bindVTITables(FromList fromListParam)
 							throws StandardException
 	{
 		subquery = subquery.bindVTITables(fromListParam);
@@ -218,8 +220,8 @@ public class FromSubquery extends FromTa
 	 * @exception StandardException		Thrown if a ? parameter found
 	 *									directly under a ResultColumn
 	 */
-
-	public void rejectParameters() throws StandardException
+    @Override
+    void rejectParameters() throws StandardException
 	{
 		subquery.rejectParameters();
 	}
@@ -231,15 +233,13 @@ public class FromSubquery extends FromTa
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public void bindExpressions(FromList fromListParam)
+    @Override
+    void bindExpressions(FromList fromListParam)
 					throws StandardException
 	{
-		FromList			emptyFromList =
-								(FromList) getNodeFactory().getNode(
-									C_NodeTypes.FROM_LIST,
-									getNodeFactory().doJoinOrderOptimization(),
-									getContextManager());
+        FromList            emptyFromList = new FromList(
+                getOptimizerFactory().doJoinOrderOptimization(),
+                getContextManager());
 		ResultColumnList	derivedRCL = resultColumns;
 		ResultColumnList	subqueryRCL;
 		FromList			nestedFromList;
@@ -332,8 +332,9 @@ public class FromSubquery extends FromTa
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultColumn getMatchingColumn(ColumnReference columnReference) throws StandardException
+    @Override
+    ResultColumn getMatchingColumn(ColumnReference columnReference)
+            throws StandardException
 	{
 		ResultColumn	resultColumn = null;
 		String			columnsTableName;
@@ -385,8 +386,8 @@ public class FromSubquery extends FromTa
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode preprocess(int numTables,
+    @Override
+    ResultSetNode preprocess(int numTables,
 									GroupByList gbl,
 									FromList fromList)
 								throws StandardException
@@ -465,14 +466,13 @@ public class FromSubquery extends FromTa
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public ResultSetNode extractSubquery(int numTables)
+    ResultSetNode extractSubquery(int numTables)
 		throws StandardException
 	{
 		JBitSet		  newJBS;
 		ResultSetNode newPRN;
 
-		newPRN = (ResultSetNode) getNodeFactory().getNode(
-								C_NodeTypes.PROJECT_RESTRICT_NODE,
+        newPRN = new ProjectRestrictNode(
 								subquery,		/* Child ResultSet */
 								resultColumns,	/* Projection */
 								null,			/* Restriction */
@@ -518,7 +518,8 @@ public class FromSubquery extends FromTa
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public FromList flatten(ResultColumnList rcl,
+    @Override
+    FromList flatten(ResultColumnList rcl,
 							PredicateList outerPList,
 							SubqueryList sql,
                             GroupByList gbl,
@@ -585,8 +586,8 @@ public class FromSubquery extends FromTa
 	 *
 	 * @return	The exposed name for this table.
 	 */
-
-	public String getExposedName()
+    @Override
+    String getExposedName()
 	{
 		return correlationName;
 	}
@@ -596,10 +597,10 @@ public class FromSubquery extends FromTa
 	 * result columns from the subquery.
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultColumnList getAllResultColumns(TableName allTableName)
+    @Override
+    ResultColumnList getAllResultColumns(TableName allTableName)
 			throws StandardException
 	{
-		ResultColumnList rcList = null;
 		TableName		 exposedName;
         TableName        toCompare;
 
@@ -621,9 +622,7 @@ public class FromSubquery extends FromTa
 		 */
 		exposedName = makeTableName(null, correlationName);
 
-		rcList = (ResultColumnList) getNodeFactory().getNode(
-										C_NodeTypes.RESULT_COLUMN_LIST,
-										getContextManager());
+        ResultColumnList rcList = new ResultColumnList((getContextManager()));
 
 		/* Build a new result column list based off of resultColumns.
 		 * NOTE: This method will capture any column renaming due to 
@@ -656,14 +655,10 @@ public class FromSubquery extends FromTa
 
 			tableName = exposedName;
 
-			valueNode = (ValueNode) getNodeFactory().getNode(
-											C_NodeTypes.COLUMN_REFERENCE,
-											columnName,
+            valueNode = new ColumnReference(columnName,
 											tableName,
 											getContextManager());
-			resultColumn = (ResultColumn) getNodeFactory().getNode(
-											C_NodeTypes.RESULT_COLUMN,
-											columnName,
+           resultColumn = new ResultColumn(columnName,
 											valueNode,
 											getContextManager());
 
@@ -684,7 +679,8 @@ public class FromSubquery extends FromTa
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public boolean referencesTarget(String name, boolean baseTable)
+    @Override
+    boolean referencesTarget(String name, boolean baseTable)
 		throws StandardException
 	{
 		return subquery.referencesTarget(name, baseTable);
@@ -697,6 +693,7 @@ public class FromSubquery extends FromTa
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public boolean referencesSessionSchema()
 		throws StandardException
 	{
@@ -710,7 +707,8 @@ public class FromSubquery extends FromTa
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL)
+    @Override
+    void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL)
 				throws StandardException
 	{
 		subquery.bindUntypedNullsToResultColumns(bindingRCL);
@@ -722,6 +720,7 @@ public class FromSubquery extends FromTa
 	 *
 	 * @param decrement	The amount to decrement by.
 	 */
+    @Override
 	void decrementLevel(int decrement)
 	{
 		super.decrementLevel(decrement);
@@ -734,13 +733,14 @@ public class FromSubquery extends FromTa
 	 * @param sd schema descriptor of the original compilation schema of the
 	 * view.
 	 */
-	public void setOrigCompilationSchema(SchemaDescriptor sd) {
+    void setOrigCompilationSchema(SchemaDescriptor sd) {
 		origCompilationSchema = sd;
 	}
 
     /**
      * @see QueryTreeNode#acceptChildren
      */
+    @Override
     void acceptChildren(Visitor v)
         throws StandardException
     {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java Fri Jun 21 07:47:47 2013
@@ -28,10 +28,10 @@ import java.util.List;
 import java.util.Properties;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.io.FormatableBitSet;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.compile.AccessPath;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CostEstimate;
 import org.apache.derby.iapi.sql.compile.JoinStrategy;
 import org.apache.derby.iapi.sql.compile.Optimizable;
@@ -109,18 +109,22 @@ abstract class FromTable extends ResultS
 	protected TableName origTableName;
 	
 	/**
-	 * Initializer for a table in a FROM list.
-	 *
-	 * @param correlationName	The correlation name
-	 * @param tableProperties	Properties list associated with the table
-	 */
-	public void init(Object correlationName, Object tableProperties)
-	{
-		this.correlationName = (String) correlationName;
-		this.tableProperties = (Properties) tableProperties;
-		tableNumber = -1;
-		bestPlanMap = null;
-	}
+     * Constructor for a table in a FROM list.
+     *
+     * @param correlationName   The correlation name
+     * @param tableProperties   Properties list associated with the table
+     * @param cm                The context manager
+     */
+    FromTable(String correlationName,
+              Properties tableProperties,
+              ContextManager cm)
+    {
+        super(cm);
+        this.correlationName = correlationName;
+        this.tableProperties = tableProperties;
+        tableNumber = -1;
+        bestPlanMap = null;
+    }
 
 	/**
 	 * Get this table's correlation name, if any.
@@ -302,22 +306,29 @@ abstract class FromTable extends ResultS
 	/** @see Optimizable#rememberJoinStrategyAsBest */
 	public void rememberJoinStrategyAsBest(AccessPath ap)
 	{
-		Optimizer optimizer = ap.getOptimizer();
+        Optimizer opt = ap.getOptimizer();
 
 		ap.setJoinStrategy(getCurrentAccessPath().getJoinStrategy());
 
-        if ( optimizer.tracingIsOn() )
-        { optimizer.tracer().traceRememberingJoinStrategy( getCurrentAccessPath().getJoinStrategy(), tableNumber ); }
+        if (opt.tracingIsOn()) {
+            opt.tracer().traceRememberingJoinStrategy(
+                getCurrentAccessPath().getJoinStrategy(), tableNumber);
+        }
 
 		if (ap == bestAccessPath)
 		{
-            if ( optimizer.tracingIsOn() )
-            { optimizer.tracer().traceRememberingBestAccessPathSubstring( ap, tableNumber ); }
+            if (opt.tracingIsOn()) {
+                opt.tracer().traceRememberingBestAccessPathSubstring(
+                    ap, tableNumber);
+            }
 		}
 		else if (ap == bestSortAvoidancePath)
 		{
-            if ( optimizer.tracingIsOn() )
-            { optimizer.tracer().traceRememberingBestSortAvoidanceAccessPathSubstring( ap, tableNumber ); }
+            if (opt.tracingIsOn()) {
+                opt.tracer().
+                    traceRememberingBestSortAvoidanceAccessPathSubstring(
+                        ap, tableNumber);
+            }
 		}
 		else
 		{
@@ -330,8 +341,10 @@ abstract class FromTable extends ResultS
 					"unknown access path type");
 			}
 			 */
-            if ( optimizer.tracingIsOn() )
-            { optimizer.tracer().traceRememberingBestUnknownAccessPathSubstring( ap, tableNumber ); }
+            if (opt.tracingIsOn()) {
+                opt.tracer().traceRememberingBestUnknownAccessPathSubstring(
+                    ap, tableNumber);
+            }
 		}
 	}
 
@@ -370,7 +383,6 @@ abstract class FromTable extends ResultS
 				throws StandardException
 	{
 		/* For most types of Optimizable, do nothing */
-		return;
 	}
 
 	/**
@@ -511,8 +523,9 @@ abstract class FromTable extends ResultS
 			if (bestPlanMap != null)
 			{
 				bestPlanMap.remove(planKey);
-				if (bestPlanMap.size() == 0)
+                if (bestPlanMap.isEmpty()) {
 					bestPlanMap = null;
+                }
 			}
 
 			return;
@@ -570,7 +583,6 @@ abstract class FromTable extends ResultS
 		// We found a best plan in our map, so load it into this Optimizable's
 		// trulyTheBestAccessPath field.
 		bestPath.copy(ap);
-		return;
 	}
 
 	/** @see Optimizable#rememberAsBest */
@@ -706,7 +718,8 @@ abstract class FromTable extends ResultS
 	 *  If there's no trulyTheBestAccessPath for this node, then
 	 *  we just return the value stored in costEstimate as a default.
 	 */
-	public CostEstimate getFinalCostEstimate()
+    @Override
+    CostEstimate getFinalCostEstimate()
 		throws StandardException
 	{
 		// If we already found it, just return it.
@@ -906,9 +919,8 @@ abstract class FromTable extends ResultS
 	 * 
 	 * @see HalfOuterJoinNode#isJoinColumnForRightOuterJoin
 	 */
-	public void isJoinColumnForRightOuterJoin(ResultColumn rc) 
+    void isJoinColumnForRightOuterJoin(ResultColumn rc)
 	{
-		return;
 	}
 
 	/**
@@ -1063,7 +1075,7 @@ abstract class FromTable extends ResultS
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -1093,12 +1105,11 @@ abstract class FromTable extends ResultS
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultColumnList getResultColumnsForList(TableName allTableName,
+    ResultColumnList getResultColumnsForList(TableName allTableName,
 												ResultColumnList inputRcl,
 												TableName tableName)
 			throws StandardException
 	{
-		ResultColumnList rcList = null;
 		ResultColumn	 resultColumn;
 		ValueNode		 valueNode;
 		String			 columnName;
@@ -1137,9 +1148,7 @@ abstract class FromTable extends ResultS
 			exposedName = makeTableName(null, correlationName);
 		}
 
-		rcList = (ResultColumnList) getNodeFactory().getNode(
-										C_NodeTypes.RESULT_COLUMN_LIST,
-										getContextManager());
+        ResultColumnList rcList = new ResultColumnList((getContextManager()));
 
 		/* Build a new result column list based off of resultColumns.
 		 * NOTE: This method will capture any column renaming due to 
@@ -1150,17 +1159,11 @@ abstract class FromTable extends ResultS
 		{
 			// Build a ResultColumn/ColumnReference pair for the column //
 			columnName = ((ResultColumn) inputRcl.elementAt(index)).getName();
-			valueNode = (ValueNode) getNodeFactory().getNode(
-											C_NodeTypes.COLUMN_REFERENCE,
-											columnName,
+            valueNode = new ColumnReference(columnName,
 											exposedName,
 											getContextManager());
-			resultColumn = (ResultColumn) getNodeFactory().getNode(
-											C_NodeTypes.RESULT_COLUMN,
-											columnName,
-											valueNode,
-											getContextManager());
-
+            resultColumn =
+                new ResultColumn(columnName, valueNode, getContextManager());
 			// Build the ResultColumnList to return //
 			rcList.addResultColumn(resultColumn);
 		}
@@ -1196,7 +1199,7 @@ abstract class FromTable extends ResultS
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public String getExposedName() throws StandardException
+    String getExposedName() throws StandardException
 	{
 		if (SanityManager.DEBUG)
 		SanityManager.THROWASSERT(
@@ -1209,7 +1212,7 @@ abstract class FromTable extends ResultS
 	 *
 	 * @param tableNumber	The table # for this table.
 	 */
-	public void setTableNumber(int tableNumber)
+    void setTableNumber(int tableNumber)
 	{
 		/* This should only be called if the tableNumber has not been set yet */
 		if (SanityManager.DEBUG)
@@ -1226,7 +1229,7 @@ abstract class FromTable extends ResultS
 	 * @return a TableName node representing this FromTable.
 	 * @exception StandardException		Thrown on error
 	 */
-	public TableName getTableName()
+    TableName getTableName()
 		throws StandardException
 	{
 		if (correlationName == null) return null;
@@ -1244,7 +1247,7 @@ abstract class FromTable extends ResultS
 	 *
 	 * @param level		The query block level for this FromTable.
 	 */
-	public void setLevel(int level)
+    void setLevel(int level)
 	{
 		this.level = level;
 	}
@@ -1254,7 +1257,7 @@ abstract class FromTable extends ResultS
 	 *
 	 * @return int	The query block level for this FromTable.
 	 */
-	public int getLevel()
+    int getLevel()
 	{
 		return level;
 	}
@@ -1298,7 +1301,7 @@ abstract class FromTable extends ResultS
 	* @exception	StandardException	throws on schema name
 	*						that doesn't exist	
 	*/
-	public SchemaDescriptor getSchemaDescriptor() throws StandardException
+    SchemaDescriptor getSchemaDescriptor() throws StandardException
 	{
 		return getSchemaDescriptor(corrTableName);
 	}	
@@ -1313,7 +1316,8 @@ abstract class FromTable extends ResultS
 	* @exception	StandardException	throws on schema name
 	*						that doesn't exist	
 	*/
-	public SchemaDescriptor getSchemaDescriptor(TableName tableName) throws StandardException
+    SchemaDescriptor getSchemaDescriptor(TableName tableName)
+            throws StandardException
 	{
 		SchemaDescriptor		sd;
 
@@ -1335,6 +1339,7 @@ abstract class FromTable extends ResultS
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     FromTable getFromTableByName(String name, String schemaName, boolean exactMatch)
 		throws StandardException
 	{
@@ -1357,7 +1362,7 @@ abstract class FromTable extends ResultS
 	 *
 	 * @return boolean		Whether or not this FromTable can be flattened.
 	 */
-	public boolean isFlattenableJoinNode()
+    boolean isFlattenableJoinNode()
 	{
 		return false;
 	}
@@ -1365,7 +1370,7 @@ abstract class FromTable extends ResultS
 	/**
 	 * no LOJ reordering for this FromTable.
 	 */
-	public boolean LOJ_reorderable(int numTables)
+    boolean LOJ_reorderable(int numTables)
 		throws StandardException
 	{
 		return false;
@@ -1393,7 +1398,8 @@ abstract class FromTable extends ResultS
 	 *
 	 * @param passedMap	The table map to fill in.
 	 */
-	public void fillInReferencedTableMap(JBitSet passedMap)
+    @Override
+    void fillInReferencedTableMap(JBitSet passedMap)
 	{
 		if (tableNumber != -1)
 		{
@@ -1409,7 +1415,7 @@ abstract class FromTable extends ResultS
      * @param updateColumns     A list representing the columns
 	 *							that can be updated.
 	 */
-	protected void markUpdatableByCursor(List updateColumns)
+    protected void markUpdatableByCursor(List<String> updateColumns)
 	{
 		resultColumns.markUpdatableByCursor(updateColumns);
 	}
@@ -1432,7 +1438,7 @@ abstract class FromTable extends ResultS
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public FromList flatten(ResultColumnList rcl,
+    FromList flatten(ResultColumnList rcl,
 							PredicateList outerPList,
 							SubqueryList sql,
                             GroupByList gbl,
@@ -1495,7 +1501,7 @@ abstract class FromTable extends ResultS
 		
 	}
 	
-	public boolean needsSpecialRCLBinding()
+    boolean needsSpecialRCLBinding()
 	{
 		return false;
 	}
@@ -1506,7 +1512,7 @@ abstract class FromTable extends ResultS
 	 * @param tableName the unbound table name
 	 *
 	 */
-	public void setOrigTableName(TableName tableName) 
+    void setOrigTableName(TableName tableName)
 	{
 		this.origTableName = tableName;
 	}
@@ -1519,7 +1525,7 @@ abstract class FromTable extends ResultS
 	 * @return TableName the original or unbound tablename
 	 *
 	 */
-	public TableName getOrigTableName() 
+    TableName getOrigTableName()
 	{
 		return this.origTableName;
 	}

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=1495305&r1=1495304&r2=1495305&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 Jun 21 07:47:47 2013
@@ -32,8 +32,9 @@ import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import org.apache.derby.catalog.TypeDescriptor;
+import java.util.Properties;
 import org.apache.derby.catalog.DefaultInfo;
+import org.apache.derby.catalog.TypeDescriptor;
 import org.apache.derby.catalog.UUID;
 import org.apache.derby.catalog.types.RoutineAliasInfo;
 import org.apache.derby.iapi.error.StandardException;
@@ -42,6 +43,7 @@ import org.apache.derby.iapi.reference.S
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 import org.apache.derby.iapi.services.compiler.LocalField;
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.io.FormatableBitSet;
 import org.apache.derby.iapi.services.io.FormatableHashtable;
 import org.apache.derby.iapi.services.loader.ClassInspector;
@@ -75,7 +77,7 @@ import org.apache.derby.vti.VTIEnvironme
  * A FromVTI represents a VTI in the FROM list of a DML statement.
  *
  */
-public class FromVTI extends FromTable implements VTIEnvironment
+class FromVTI extends FromTable implements VTIEnvironment
 {
 
 	JBitSet				correlationMap;
@@ -137,6 +139,7 @@ public class FromVTI extends FromTable i
     private HashMap<Integer,FromTable> argSources = new HashMap<Integer,FromTable>();
 
     /**
+     * Constructor.
 	 * @param invocation		The constructor or static method for the VTI
 	 * @param correlationName	The correlation name
 	 * @param derivedRCL		The derived column list
@@ -144,60 +147,60 @@ public class FromVTI extends FromTable i
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void init(
-					Object invocation,
-					Object correlationName,
-					Object derivedRCL,
-					Object tableProperties)
-		throws StandardException
-	{
-        init( invocation,
-              correlationName,
-              derivedRCL,
-              tableProperties,
-              makeTableName(null, (String) correlationName));
+    FromVTI(MethodCallNode invocation,
+            String correlationName,
+            ResultColumnList derivedRCL,
+            Properties tableProperties,
+            ContextManager cm) throws StandardException {
+        super(correlationName, tableProperties, cm);
+        constructorMinion(
+                invocation, derivedRCL, makeTableName(null, correlationName));
 	}
 
     /**
+     * Constructor.
 	 * @param invocation		The constructor or static method for the VTI
 	 * @param correlationName	The correlation name
 	 * @param derivedRCL		The derived column list
 	 * @param tableProperties	Properties list associated with the table
      * @param exposedTableName  The table name (TableName class)
-	 *
-	 * @exception StandardException		Thrown on error
+     * @param cm                The context manager
 	 */
-	public void init(
-					Object invocation,
-					Object correlationName,
-					Object derivedRCL,
-					Object tableProperties,
-                    Object exposedTableName)
-		throws StandardException
-	{
-		super.init(correlationName, tableProperties);
+    FromVTI(MethodCallNode invocation,
+            String correlationName,
+            ResultColumnList derivedRCL,
+            Properties tableProperties,
+            TableName exposedTableName,
+            ContextManager cm) {
 
-		this.methodCall = (MethodCallNode) invocation;
+        super(correlationName, tableProperties, cm);
+        constructorMinion(invocation, derivedRCL, exposedTableName);
+    }
 
-		resultColumns = (ResultColumnList) derivedRCL;
-		subqueryList = (SubqueryList) getNodeFactory().getNode(
-											C_NodeTypes.SUBQUERY_LIST,
-											getContextManager());
+    private void constructorMinion(
+            MethodCallNode invocation,
+            ResultColumnList derivedRCL,
+            TableName exposedTableName) {
 
-		/* Cache exposed name for this table.
-		 * The exposed name becomes the qualifier for each column
-		 * in the expanded list.
-		 */
-		this.exposedName = (TableName) exposedTableName;
-	}
+        setNodeType(C_NodeTypes.FROM_VTI);
+        this.methodCall = invocation;
+        this.resultColumns = derivedRCL;
+        this.subqueryList = new SubqueryList(getContextManager());
 
-	// Optimizable interface
+        // Cache exposed name for this table.
+        // The exposed name becomes the qualifier for each column
+        // in the expanded list.
+        this.exposedName = exposedTableName;
+    }
+
+    // Optimizable interface
 
 	/**
 	 * @see Optimizable#estimateCost
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public CostEstimate estimateCost(
 				OptimizablePredicateList predList,
 				ConglomerateDescriptor cd,
@@ -273,6 +276,7 @@ public class FromVTI extends FromTable i
 	/**
 	 * @see Optimizable#legalJoinOrder
 	 */
+    @Override
 	public boolean legalJoinOrder(JBitSet assignedTableMap)
 	{
 		/* In order to tell if this is a legal join order, we
@@ -280,7 +284,7 @@ public class FromVTI extends FromTable i
 		 * outer tables that we are correlated with, contains
 		 * our dependency map.
 		 */
-		JBitSet tempBitSet = (JBitSet) assignedTableMap;
+        JBitSet tempBitSet = assignedTableMap;
 		tempBitSet.or(correlationMap);
 
 		/* Have all of our dependencies been satisified? */
@@ -291,12 +295,14 @@ public class FromVTI extends FromTable i
 	/** @see Optimizable#isMaterializable 
 	 *
 	 */
+    @Override
 	public boolean isMaterializable()
 	{
 		return materializable;
 	}
 
 	/** @see Optimizable#supportsMultipleInstantiations */
+    @Override
 	public boolean supportsMultipleInstantiations()
 	{
 		return supportsMultipleInstantiations;
@@ -311,7 +317,8 @@ public class FromVTI extends FromTable i
 	/**
 	 * @see ResultSetNode#adjustForSortElimination()
 	 */
-	public void adjustForSortElimination()
+    @Override
+    void adjustForSortElimination()
 	{
 		/* It's possible that we have an ORDER BY on the columns for this
 		 * VTI but that the sort was eliminated during preprocessing (see
@@ -334,6 +341,7 @@ public class FromVTI extends FromTable i
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException
 	{
 		/* Close the rs if one was instantiated */
@@ -363,6 +371,7 @@ public class FromVTI extends FromTable i
         outerFromLists.add( fromList );
     }
 
+    @Override
 	public boolean pushOptPredicate(OptimizablePredicate optimizablePredicate)
 		throws StandardException
 	{
@@ -374,9 +383,7 @@ public class FromVTI extends FromTable i
             return false;
         
 		if (restrictionList == null) {
-			restrictionList = (PredicateList) getNodeFactory().getNode(
-											C_NodeTypes.PREDICATE_LIST,
-											getContextManager());
+            restrictionList = new PredicateList(getContextManager());
 		}
 
 		restrictionList.addPredicate((Predicate) optimizablePredicate);
@@ -391,6 +398,7 @@ public class FromVTI extends FromTable i
 	 * @return	This object as a String
 	 */
 
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -411,7 +419,8 @@ public class FromVTI extends FromTable i
 	 * @param depth		The depth of this node in the tree
 	 */
 
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG) {
 			super.printSubNodes(depth);
@@ -439,7 +448,7 @@ public class FromVTI extends FromTable i
 	/** 
 	 * Return true if this VTI is a constructor. Otherwise, it is a static method.
 	 */
-	public boolean  isConstructor()
+    boolean  isConstructor()
 	{
 		return ( methodCall instanceof NewInvocationNode );
 	}
@@ -459,7 +468,8 @@ public class FromVTI extends FromTable i
 	 * @return	The exposed name for this table.
 	 */
 
-	public String getExposedName()
+    @Override
+    String getExposedName()
 	{
 		return correlationName;
 	}
@@ -495,7 +505,8 @@ public class FromVTI extends FromTable i
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public ResultSetNode bindNonVTITables(DataDictionary dataDictionary, 
+    @Override
+    ResultSetNode bindNonVTITables(DataDictionary dataDictionary,
 							FromList fromListParam) 
 					throws StandardException
 	{
@@ -524,7 +535,8 @@ public class FromVTI extends FromTable i
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public ResultSetNode bindVTITables(FromList fromListParam) 
+    @Override
+    ResultSetNode bindVTITables(FromList fromListParam)
 							throws StandardException
 	{
 		ResultColumnList	derivedRCL = resultColumns;
@@ -630,9 +642,7 @@ public class FromVTI extends FromTable i
 		}
 		else
 		{	
-			resultColumns = (ResultColumnList) getNodeFactory().getNode(
-												C_NodeTypes.RESULT_COLUMN_LIST,
-												getContextManager());
+            resultColumns = new ResultColumnList((getContextManager()));
 
 			// if this is a Derby-style Table Function, then build the result
 			// column list from the RowMultiSetImpl return datatype
@@ -689,7 +699,7 @@ public class FromVTI extends FromTable i
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetMetaData getResultSetMetaData() 
+    ResultSetMetaData getResultSetMetaData()
 		throws StandardException
 	{
 		// Get the actual 
@@ -756,7 +766,7 @@ public class FromVTI extends FromTable i
     {
 		NewInvocationNode   constructor = (NewInvocationNode) methodCall;
 		Class[]  paramTypeClasses = constructor.getMethodParameterClasses();
-		Object[] paramObjects = null;
+        Object[] paramObjects;
 
 		if (paramTypeClasses != null)
 		{
@@ -776,10 +786,12 @@ public class FromVTI extends FromTable i
 
 					if (paramClass.equals(Short.TYPE)) {
 						paramObjects[index] =
-							new Short(((Integer) paramObjects[index]).shortValue());
+                            Short.valueOf(
+                                ((Integer) paramObjects[index]).shortValue());
 					} else if (paramClass.equals(Byte.TYPE)) {
 						paramObjects[index] =
-							new Byte(((Integer) paramObjects[index]).byteValue());
+                            Byte.valueOf(
+                                ((Integer) paramObjects[index]).byteValue());
 					}
 				}
 
@@ -801,7 +813,7 @@ public class FromVTI extends FromTable i
 					}
 					else if (paramClass.equals(Long.TYPE))
 					{
-						paramObjects[index] = new Long((long) 0);
+                        paramObjects[index] = Long.valueOf((long) 0);
 					}
 					else if (paramClass.equals(Float.TYPE))
 					{
@@ -817,7 +829,8 @@ public class FromVTI extends FromTable i
 					}
 					else if (paramClass.equals(Character.TYPE))
 					{
-						paramObjects[index] = new Character(Character.MIN_VALUE);
+                        paramObjects[index] =
+                                Character.valueOf(Character.MIN_VALUE);
 					}
 				}
 			}
@@ -887,7 +900,8 @@ public class FromVTI extends FromTable i
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public void bindExpressions(FromList fromListParam)
+    @Override
+    void bindExpressions(FromList fromListParam)
 					throws StandardException
 	{
 		/* Figure out if the VTIs parameters are QUERY_INVARIANT.  If so,
@@ -943,7 +957,6 @@ public class FromVTI extends FromTable i
                     // references a non-VTI/tableFunction table in the current query block
                     if ( !isDerbyStyleTableFunction && !(fromTable instanceof FromVTI) )
                     {
-                        illegalReference = false;
                         break;
                     }
                 }
@@ -987,7 +1000,8 @@ public class FromVTI extends FromTable i
             {
                 // remember this FromTable so that we can code generate the arg
                 // from actual result columns later on.
-                argSources.put( new Integer( fromTable.getTableNumber() ), fromTable );
+                argSources.put(Integer.valueOf(fromTable.getTableNumber()),
+                               fromTable );
 
                 return fromTable;
             }
@@ -1019,10 +1033,10 @@ public class FromVTI extends FromTable i
 	 * result columns from the subquery.
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultColumnList getAllResultColumns(TableName allTableName)
+    @Override
+    ResultColumnList getAllResultColumns(TableName allTableName)
 			throws StandardException
 	{
-		ResultColumnList rcList = null;
 		ResultColumn	 resultColumn;
 		ValueNode		 valueNode;
 		String			 columnName;
@@ -1039,9 +1053,7 @@ public class FromVTI extends FromTable i
             return null;
         }
 
-		rcList = (ResultColumnList) getNodeFactory().getNode(
-										C_NodeTypes.RESULT_COLUMN_LIST,
-										getContextManager());
+        ResultColumnList rcList = new ResultColumnList((getContextManager()));
 
 		/* Build a new result column list based off of resultColumns.
 		 * NOTE: This method will capture any column renaming due to 
@@ -1059,16 +1071,11 @@ public class FromVTI extends FromTable i
 
 			// Build a ResultColumn/ColumnReference pair for the column //
 			columnName = resultColumn.getName();
-			valueNode = (ValueNode) getNodeFactory().getNode(
-											C_NodeTypes.COLUMN_REFERENCE,
-											columnName,
+            valueNode = new ColumnReference(columnName,
 											exposedName,
 											getContextManager());
-			resultColumn = (ResultColumn) getNodeFactory().getNode(
-											C_NodeTypes.RESULT_COLUMN,
-											columnName,
-											valueNode,
-											getContextManager());
+            resultColumn =
+                new ResultColumn(columnName, valueNode, getContextManager());
 
 			// Build the ResultColumnList to return //
 			rcList.addResultColumn(resultColumn);
@@ -1090,7 +1097,9 @@ public class FromVTI extends FromTable i
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public ResultColumn getMatchingColumn(ColumnReference columnReference) throws StandardException
+    @Override
+    ResultColumn getMatchingColumn(ColumnReference columnReference)
+            throws StandardException
 	{
 		/* We could get called before our RCL is built.  That's okay, we'll
 		 * just say that we don't match. 
@@ -1144,23 +1153,20 @@ public class FromVTI extends FromTable i
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public ResultSetNode preprocess(int numTables,
+    @Override
+    ResultSetNode preprocess(int numTables,
 									GroupByList gbl,
 									FromList fromList)
 								throws StandardException
 	{
 		methodCall.preprocess(
-								numTables,
-								(FromList) getNodeFactory().getNode(
-									C_NodeTypes.FROM_LIST,
-									getNodeFactory().doJoinOrderOptimization(),
-									getContextManager()),
-								 (SubqueryList) getNodeFactory().getNode(
-								 					C_NodeTypes.SUBQUERY_LIST,
-													getContextManager()),
-								 (PredicateList) getNodeFactory().getNode(
-								 					C_NodeTypes.PREDICATE_LIST,
-													getContextManager()));
+            numTables,
+            new FromList(
+                getOptimizerFactory().doJoinOrderOptimization(),
+                getContextManager()),
+            new SubqueryList(getContextManager()),
+            new PredicateList(getContextManager()));
+
 		/* Generate the referenced table map */
 		referencedTableMap = new JBitSet(numTables);
 		referencedTableMap.set(tableNumber);
@@ -1214,6 +1220,7 @@ public class FromVTI extends FromTable i
 	 * @exception StandardException		Thrown on error
 	 */
 
+    @Override
 	protected ResultSetNode genProjectRestrict(int numTables)
 				throws StandardException
 	{
@@ -1239,8 +1246,7 @@ public class FromVTI extends FromTable i
 		prRCList.doProjection();
 
 		/* Finally, we create the new ProjectRestrictNode */
-		return (ResultSetNode) getNodeFactory().getNode(
-								C_NodeTypes.PROJECT_RESTRICT_NODE,
+        return new ProjectRestrictNode(
 								this,
 								prRCList,
 								null,	/* Restriction */
@@ -1259,7 +1265,8 @@ public class FromVTI extends FromTable i
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public boolean performMaterialization(JBitSet outerTables)
+    @Override
+    boolean performMaterialization(JBitSet outerTables)
 		throws StandardException
 	{
 		/* We need to materialize the VTI iff:
@@ -1313,7 +1320,7 @@ public class FromVTI extends FromTable i
         for ( int i = 0; i < totalColumnCount; i++ )
         {
             ResultColumn column = allVTIColumns.getResultColumn( i + 1 );
-            String       exposedName = column.getName();
+            String       exposedNam = column.getName();
 
             if ( column.isReferenced() )
             {
@@ -1321,7 +1328,7 @@ public class FromVTI extends FromTable i
                 
                 projectedColumnNames[ i ] = baseName;
 
-                nameMap.put( exposedName, baseName );
+                nameMap.put( exposedNam, baseName );
             }
         }
 
@@ -1568,6 +1575,7 @@ public class FromVTI extends FromTable i
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     void generate(ActivationClassBuilder acb, MethodBuilder mb)
 							throws StandardException
 	{
@@ -1607,7 +1615,8 @@ public class FromVTI extends FromTable i
     {
         for (ColumnReference ref : getNodesFromParameters(ColumnReference.class))
 		{
-            FromTable   fromTable = argSources.get( new Integer( ref.getTableNumber() ) );
+            FromTable fromTable = argSources.get(
+                Integer.valueOf(ref.getTableNumber()));
 
             if ( fromTable != null )
             {
@@ -1834,7 +1843,8 @@ public class FromVTI extends FromTable i
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public boolean referencesTarget(String name, boolean baseTable)
+    @Override
+    boolean referencesTarget(String name, boolean baseTable)
 		throws StandardException
 	{
 		return (! baseTable) && name.equals(methodCall.getJavaClassName());
@@ -1847,6 +1857,7 @@ public class FromVTI extends FromTable i
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException
 	{
@@ -1893,35 +1904,22 @@ public class FromVTI extends FromTable i
 	private ResultColumnList genResultColList(TableDescriptor td)
 			throws StandardException
 	{
-		ResultColumnList 			rcList = null;
-		ResultColumn	 			resultColumn;
-		ValueNode		 			valueNode;
-		ColumnDescriptor 			colDesc = null;
-
 		/* Add all of the columns in the table */
-		rcList = (ResultColumnList) getNodeFactory().getNode(
-										C_NodeTypes.RESULT_COLUMN_LIST,
-										getContextManager());
+        ResultColumnList rcList = new ResultColumnList((getContextManager()));
 		ColumnDescriptorList cdl = td.getColumnDescriptorList();
 		int					 cdlSize = cdl.size();
 
 		for (int index = 0; index < cdlSize; index++)
 		{
 			/* Build a ResultColumn/BaseColumnNode pair for the column */
-			colDesc = (ColumnDescriptor) cdl.elementAt(index);
+            ColumnDescriptor colDesc = cdl.elementAt(index);
 
-			valueNode = (ValueNode) getNodeFactory().getNode(
-											C_NodeTypes.BASE_COLUMN_NODE,
-											colDesc.getColumnName(),
+            ValueNode valueNode = new BaseColumnNode(colDesc.getColumnName(),
 									  		exposedName,
 											colDesc.getType(),
 											getContextManager());
-			resultColumn = (ResultColumn) getNodeFactory().getNode(
-											C_NodeTypes.RESULT_COLUMN,
-											colDesc,
-											valueNode,
-											getContextManager());
-
+            ResultColumn resultColumn =
+                    new ResultColumn(colDesc, valueNode, getContextManager());
 			/* Build the ResultColumnList to return */
 			rcList.addResultColumn(resultColumn);
 		}
@@ -1929,7 +1927,8 @@ public class FromVTI extends FromTable i
 		return rcList;
 	}
 	
-	public boolean needsSpecialRCLBinding()
+    @Override
+    boolean needsSpecialRCLBinding()
 	{
 		return true;
 	}
@@ -1941,7 +1940,7 @@ public class FromVTI extends FromTable i
 	/*
 	** VTIEnvironment
 	*/
-	public final boolean isCompileTime() {
+    final public boolean isCompileTime() {
 		return true;
 	}
 
@@ -1949,7 +1948,7 @@ public class FromVTI extends FromTable i
 		return getCompilerContext().getParser().getSQLtext();
 	}
 	
-	public final int getStatementIsolationLevel() {
+    final public int getStatementIsolationLevel() {
 		return TransactionControl.jdbcIsolationLevel( getCompilerContext().getScanIsolationLevel() );
 	}
 
@@ -2057,7 +2056,8 @@ public class FromVTI extends FromTable i
         
         try {
             Constructor         constructor = vtiClass.getConstructor( new Class[] {} );
-            VTICosting          result = (VTICosting) constructor.newInstance( null );
+            VTICosting          result =
+                    (VTICosting) constructor.newInstance( (Object[])null );
 
             return result;
         }

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=1495305&r1=1495304&r2=1495305&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 Jun 21 07:47:47 2013
@@ -22,22 +22,19 @@
 package	org.apache.derby.impl.sql.compile;
 
 import java.util.List;
-
-import org.apache.derby.iapi.sql.depend.ProviderList;
-
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.SQLState;
-
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.error.StandardException;
-
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.depend.ProviderList;
 
 /**
  * This node describes a Generation Clause in a column definition.
  *
  */
-public class GenerationClauseNode extends ValueNode
+class GenerationClauseNode extends ValueNode
 {
     ///////////////////////////////////////////////////////////////////////////////////
     //
@@ -59,15 +56,19 @@ public class GenerationClauseNode extend
 
     ///////////////////////////////////////////////////////////////////////////////////
     //
-    // INITIALIZATION
+    // CONSTRUCTOR
     //
     ///////////////////////////////////////////////////////////////////////////////////
 
 
-	public void init( Object generationExpression, Object expressionText )
+    GenerationClauseNode( ValueNode generationExpression,
+                          String expressionText,
+                          ContextManager cm)
     {
-        _generationExpression = (ValueNode) generationExpression;
-        _expressionText = (String) expressionText;
+        super(cm);
+        setNodeType(C_NodeTypes.GENERATION_CLAUSE_NODE);
+        _generationExpression = generationExpression;
+        _expressionText = expressionText;
 	}
 
     ///////////////////////////////////////////////////////////////////////////////////
@@ -83,7 +84,7 @@ public class GenerationClauseNode extend
 	void setAuxiliaryProviderList(ProviderList apl) { _apl = apl; }
 
 	/** Return the auxiliary provider list. */
-	public ProviderList getAuxiliaryProviderList() { return _apl; }
+    ProviderList getAuxiliaryProviderList() { return _apl; }
 
     ///////////////////////////////////////////////////////////////////////////////////
     //
@@ -94,6 +95,7 @@ public class GenerationClauseNode extend
 	/**
 	 * Binding the generation clause.
 	 */
+    @Override
     ValueNode bindExpression
         ( FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
         throws StandardException
@@ -111,6 +113,7 @@ public class GenerationClauseNode extend
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
 									throws StandardException
 	{
@@ -146,6 +149,7 @@ public class GenerationClauseNode extend
 	/*
 		Stringify.
 	 */
+    @Override
 	public String toString()
     {
         return
@@ -161,7 +165,8 @@ public class GenerationClauseNode extend
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GetCurrentConnectionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GetCurrentConnectionNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GetCurrentConnectionNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GetCurrentConnectionNode.java Fri Jun 21 07:47:47 2013
@@ -22,25 +22,16 @@
 package	org.apache.derby.impl.sql.compile;
 
 import java.util.List;
-
-import org.apache.derby.iapi.sql.compile.CompilerContext;
-
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
-
 import org.apache.derby.iapi.error.StandardException;
-
+import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
-
-
+import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.store.access.Qualifier;
-
-
 import org.apache.derby.iapi.util.JBitSet;
 
-import org.apache.derby.iapi.reference.ClassName;
-
-
 /**
  * This node represents a unary getCurrentConnection operator
  * RESOLVE - parameter will always be null for now.  Someday
@@ -53,11 +44,12 @@ public final class GetCurrentConnectionN
 {
 	/**
 	 * Constructor for a GetCurrentConnectionNode
-	 *
 	 */
 
-	public GetCurrentConnectionNode()
+    GetCurrentConnectionNode(ContextManager cm)
 	{
+        super(cm);
+        setNodeType(C_NodeTypes.GET_CURRENT_CONNECTION_NODE);
 		/*
 		** The result type of getCurrentConnection is
 		** java.sql.Connection
@@ -75,8 +67,9 @@ public final class GetCurrentConnectionN
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-    JavaValueNode bindExpression(
-        FromList fromList, SubqueryList subqueryList, List aggregates)
+    JavaValueNode bindExpression(FromList fromList,
+                                 SubqueryList subqueryList,
+                                 List<AggregateNode> aggregates)
 			throws StandardException
 	{
 		return this;
@@ -164,6 +157,7 @@ public final class GetCurrentConnectionN
 	 *
 	 * @return	The variant type for the underlying expression.
 	 */
+    @Override
     int getOrderableVariantType()
 	{
 		return Qualifier.QUERY_INVARIANT;
@@ -191,6 +185,7 @@ public final class GetCurrentConnectionN
 
 		@see org.apache.derby.iapi.sql.compile.CompilerContext
 	*/
+    @Override
     void checkReliability(ValueNode sqlNode)
 		throws StandardException {
 		sqlNode.checkReliability("getCurrentConnection()",

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GrantNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GrantNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GrantNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GrantNode.java Fri Jun 21 07:47:47 2013
@@ -21,23 +21,40 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.sql.depend.Provider;
-import org.apache.derby.iapi.sql.execute.ConstantAction;
-import org.apache.derby.impl.sql.execute.PrivilegeInfo;
-import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.error.StandardException;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.depend.Provider;
+import org.apache.derby.iapi.sql.execute.ConstantAction;
 
 /**
  * This class represents a GRANT statement.
  */
-public class GrantNode extends DDLStatementNode
+class GrantNode extends DDLStatementNode
 {
 	private PrivilegeNode privileges;
-	private List grantees;
+    private List<String> grantees;
+
+    /**
+     * Constructor for a GrantNode.
+     *
+     * @param privileges PrivilegesNode
+     * @param grantees List
+     * @param cm Context manager
+     */
+    GrantNode(PrivilegeNode privileges,
+              List<String> grantees,
+              ContextManager cm)
+    {
+        super(cm);
+        setNodeType(C_NodeTypes.GRANT_NODE);
+        this.privileges = privileges;
+        this.grantees = grantees;
+    }
 
 	/**
 	 * Convert this object to a String.  See comments in QueryTreeNode.java
@@ -45,17 +62,18 @@ public class GrantNode extends DDLStatem
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
 		{
-			StringBuffer sb = new StringBuffer();
-			for( Iterator it = grantees.iterator(); it.hasNext();)
+            StringBuilder sb = new StringBuilder();
+
+            for (String grantee : grantees)
 			{
 				if( sb.length() > 0)
 					sb.append( ",");
-				sb.append( it.next().toString());
+                sb.append(grantee);
 			}
 			return super.toString() +
 				   privileges.toString() +
@@ -67,31 +85,19 @@ public class GrantNode extends DDLStatem
 		}
 	} // end of toString
 
-	public String statementToString()
+    String statementToString()
 	{
 		return "GRANT";
 	}
 
 	
 	/**
-	 * Initialize a GrantNode.
-	 *
-	 * @param privileges PrivilegesNode
-	 * @param grantees List
-	 */
-	public void init( Object privileges,
-					  Object grantees)
-	{
-		this.privileges = (PrivilegeNode) privileges;
-		this.grantees = (List) grantees;
-	}
-
-	/**
 	 * Bind this GrantNode. Resolve all table, column, and routine references.
 	 *
 	 *
 	 * @exception StandardException	Standard error policy.
 	 */
+    @Override
 	public void bindStatement() throws StandardException
 	{
 		privileges = (PrivilegeNode) privileges.bind( new HashMap<Provider,Provider>(), grantees, true);
@@ -103,6 +109,7 @@ public class GrantNode extends DDLStatem
 	 *
 	 * @exception StandardException	Standard error policy.
 	 */
+    @Override
 	public ConstantAction makeConstantAction() throws StandardException
 	{
 		return getGenericConstantActionFactory().getGrantConstantAction( privileges.makePrivilegeInfo(),

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GrantRoleNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GrantRoleNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GrantRoleNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GrantRoleNode.java Fri Jun 21 07:47:47 2013
@@ -21,36 +21,35 @@
 
 package org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.sql.execute.ConstantAction;
-import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.error.StandardException;
-
-import java.util.Iterator;
 import java.util.List;
-import org.apache.derby.iapi.sql.compile.CompilerContext;
-import org.apache.derby.iapi.sql.conn.Authorizer;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.execute.ConstantAction;
 
 /**
  * This class represents a GRANT role statement.
  */
-public class GrantRoleNode extends DDLStatementNode
+class GrantRoleNode extends DDLStatementNode
 {
-    private List roles;
-    private List grantees;
+    private List<String> roles;
+    private List<String> grantees;
 
     /**
-     * Initialize a GrantRoleNode.
+     * Constructor for GrantRoleNode.
      *
      * @param roles list of strings containing role name to be granted
      * @param grantees list of strings containing grantee names
+     * @param cm context manager
      */
-    public void init(Object roles,
-					 Object grantees)
-        throws StandardException
-    {
-        initAndCheck(null);
-        this.roles = (List) roles;
-        this.grantees = (List) grantees;
+    GrantRoleNode(List<String> roles,
+                  List<String> grantees,
+                  ContextManager cm) throws StandardException {
+        super(null, cm);
+        this.roles = roles;
+        this.grantees = grantees;
+        setNodeType(C_NodeTypes.GRANT_ROLE_NODE);
     }
 
 
@@ -59,6 +58,7 @@ public class GrantRoleNode extends DDLSt
      *
      * @exception StandardException Standard error policy.
      */
+    @Override
     public ConstantAction makeConstantAction() throws StandardException
     {
         return getGenericConstantActionFactory().
@@ -72,24 +72,24 @@ public class GrantRoleNode extends DDLSt
      *
      * @return  This object as a String
      */
-
+    @Override
     public String toString()
     {
         if (SanityManager.DEBUG) {
-                StringBuffer sb1 = new StringBuffer();
-                for( Iterator it = roles.iterator(); it.hasNext();) {
+                StringBuilder sb1 = new StringBuilder();
+                for(String role : roles) {
 					if( sb1.length() > 0) {
 						sb1.append( ", ");
 					}
-					sb1.append( it.next().toString());
+                    sb1.append(role);
 				}
 
-                StringBuffer sb2 = new StringBuffer();
-                for( Iterator it = grantees.iterator(); it.hasNext();) {
+                StringBuilder sb2 = new StringBuilder();
+                for(String grantee : grantees) {
 					if( sb2.length() > 0) {
 						sb2.append( ", ");
 					}
-					sb2.append( it.next().toString());
+                    sb2.append(grantee);
 				}
                 return (super.toString() +
                         sb1.toString() +

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByColumn.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByColumn.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByColumn.java Fri Jun 21 07:47:47 2013
@@ -23,33 +23,34 @@ package	org.apache.derby.impl.sql.compil
 
 import java.util.List;
 import org.apache.derby.iapi.error.StandardException;
-
+import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.sql.compile.Visitor;
-
 import org.apache.derby.iapi.types.TypeId;
 
-import org.apache.derby.iapi.reference.SQLState;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-
 /**
  * A GroupByColumn is a column in the GROUP BY clause.
  *
  */
-public class GroupByColumn extends OrderedColumn 
+class GroupByColumn extends OrderedColumn
 {
 	private ValueNode columnExpression;
 	
 	/**
-	 * Initializer.
+     * Constructor.
 	 *
 	 * @param colRef	The ColumnReference for the grouping column
+     * @param cm        The context manager
 	 */
-	public void init(Object colRef) 
+    GroupByColumn(ValueNode colRef,
+                  ContextManager cm)
 	{
-		this.columnExpression = (ValueNode)colRef;
+        super(cm);
+        setNodeType(C_NodeTypes.GROUP_BY_COLUMN);
+        this.columnExpression = colRef;
 	}
 
 	/**
@@ -58,8 +59,8 @@ public class GroupByColumn extends Order
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -78,7 +79,7 @@ public class GroupByColumn extends Order
 	 *
 	 * @return	The name of this column
 	 */
-	public String getColumnName() 
+    String getColumnName()
 	{
 		return columnExpression.getColumnName();
 	}
@@ -102,7 +103,7 @@ public class GroupByColumn extends Order
 	{
 		/* Bind the ColumnReference to the FromList */
         int previousReliability = orReliability( CompilerContext.GROUP_BY_RESTRICTION );
-		columnExpression = (ValueNode) columnExpression.bindExpression(fromList,
+        columnExpression = columnExpression.bindExpression(fromList,
 							  subqueryList,
                               aggregates);
         getCompilerContext().setReliability( previousReliability );
@@ -128,12 +129,12 @@ public class GroupByColumn extends Order
 		}
 	}
 
-	public ValueNode getColumnExpression() 
+    ValueNode getColumnExpression()
 	{
 		return columnExpression;
 	}
 
-	public void setColumnExpression(ValueNode cexpr) 
+    void setColumnExpression(ValueNode cexpr)
 	{
 		this.columnExpression = cexpr;
 		
@@ -146,6 +147,7 @@ public class GroupByColumn extends Order
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException {
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByList.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByList.java Fri Jun 21 07:47:47 2013
@@ -22,12 +22,12 @@
 package	org.apache.derby.impl.sql.compile;
 
 import java.util.List;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.reference.Limits;
-
+import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 
 /**
  * A GroupByList represents the list of expressions in a GROUP BY clause in
@@ -35,17 +35,23 @@ import org.apache.derby.iapi.reference.L
  *
  */
 
-public class GroupByList extends OrderedColumnList
+class GroupByList extends OrderedColumnList
 {
 	int		numGroupingColsAdded = 0;
 	boolean         rollup = false;
 
+    public GroupByList(ContextManager cm) {
+        super(cm);
+        setNodeType(C_NodeTypes.GROUP_BY_LIST);
+    }
+
+
 	/**
 		Add a column to the list
 
 		@param column	The column to add to the list
 	 */
-	public void addGroupByColumn(GroupByColumn column)
+    void addGroupByColumn(GroupByColumn column)
 	{
 		addElement(column);
 	}
@@ -55,7 +61,7 @@ public class GroupByList extends Ordered
 
 		@param position	The column to get from the list
 	 */
-	public GroupByColumn getGroupByColumn(int position)
+    GroupByColumn getGroupByColumn(int position)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -67,11 +73,11 @@ public class GroupByList extends Ordered
 	}
 
 
-	public void setRollup()
+    void setRollup()
 	{
 		rollup = true;
 	}
-	public boolean isRollup()
+    boolean isRollup()
 	{
 		return rollup;
 	}
@@ -83,7 +89,7 @@ public class GroupByList extends Ordered
 	 * @return int	The number of grouping columns that need to be added to
 	 *				the SELECT list.
 	 */
-	public int getNumNeedToAddGroupingCols()
+    int getNumNeedToAddGroupingCols()
 	{
 		return numGroupingColsAdded;
 	}
@@ -106,10 +112,7 @@ public class GroupByList extends Ordered
 	{
 		FromList		 fromList = select.getFromList();
 		ResultColumnList selectRCL = select.getResultColumns();
-		SubqueryList	 dummySubqueryList =
-									(SubqueryList) getNodeFactory().getNode(
-													C_NodeTypes.SUBQUERY_LIST,
-													getContextManager());
+        SubqueryList dummySubqueryList = new SubqueryList(getContextManager());
 		int				 numColsAddedHere = 0;
 		int				 size = size();
 
@@ -172,11 +175,10 @@ public class GroupByList extends Ordered
 				ResultColumn newRC;
 
 				/* Get a new ResultColumn */
-				newRC = (ResultColumn) getNodeFactory().getNode(
-								C_NodeTypes.RESULT_COLUMN,
-								groupingCol.getColumnName(),
-								groupingCol.getColumnExpression().getClone(),
-								getContextManager());
+                newRC = new ResultColumn(
+                        groupingCol.getColumnName(),
+                        groupingCol.getColumnExpression().getClone(),
+                        getContextManager());
 				newRC.setVirtualColumnId(selectRCL.size() + 1);
 				newRC.markGenerated();
 				newRC.markAsGroupingColumn();
@@ -237,7 +239,7 @@ public class GroupByList extends Ordered
 	 * 
 	 * @throws StandardException
 	 */
-	public GroupByColumn findGroupingColumn(ValueNode node)
+    GroupByColumn findGroupingColumn(ValueNode node)
 	        throws StandardException
 	{
 		int sz = size();
@@ -258,7 +260,7 @@ public class GroupByList extends Ordered
 	 *
 	 * @exception StandardException			Thrown on error
 	 */
-	public void remapColumnReferencesToExpressions() throws StandardException
+    void remapColumnReferencesToExpressions() throws StandardException
 	{
 		GroupByColumn	gbc;
 		int				size = size();
@@ -293,6 +295,7 @@ public class GroupByList extends Ordered
 	 *
 	 * @return	This object as a String
 	 */
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG) {
@@ -304,7 +307,7 @@ public class GroupByList extends Ordered
 	}
 
 
-	public void preprocess(
+    void preprocess(
 			int numTables, FromList fromList, SubqueryList whereSubquerys, 
 			PredicateList wherePredicates) throws StandardException 
 	{