jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1171225 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons: ./ batch/ logging/ name/ namespace/ nodetype/ nodetype/constraint/ query/ query/qom/ query/sql/ query/xpath/ util/ value/
Date Thu, 15 Sep 2011 19:05:45 GMT
Author: mduerig
Date: Thu Sep 15 19:05:43 2011
New Revision: 1171225

URL: http://svn.apache.org/viewvc?rev=1171225&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP) 
refactor: use cast function instead of explicit casts wherever casting is provable correct, correct overly general types to reduce casts, correct Array.toString

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoCacheImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/AbstractChangeLog.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RelativePath.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/NamespaceMapping.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/RegistryNamespaceResolver.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractItemDefinitionTemplate.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/ItemDefinitionImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionTemplateImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DerefQueryNode.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ExactQueryNode.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/LocationStepQueryNode.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NAryQueryNode.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PathQueryNode.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PropertyFunctionQueryNode.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryRootNode.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/RelationQueryNode.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelFactoryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLQueryBuilder.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/xpath/XPathQueryBuilder.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/Exceptions.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/StringCache.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/WeakIdentityCollection.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValue.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/QValueFactoryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/QValueValue.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/ValueFormat.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java Thu Sep 15 19:05:43 2011
@@ -26,6 +26,7 @@ import org.apache.jackrabbit.spi.QValue;
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import java.io.Serializable;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -163,7 +164,7 @@ public class EventImpl implements Event,
             .append("itemId: ").append(itemId).append(", ")
             .append("parentId: ").append(parentId).append(", ")
             .append("primaryNodeTypeName: ").append(primaryNodeTypeName).append(", ")
-            .append("mixinTypeNames: ").append(mixinTypeNames).append(", ")
+            .append("mixinTypeNames: ").append(Arrays.deepToString(mixinTypeNames)).append(", ")
             .append("userId").append(userId)
             .append(']')
             .toString();

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoCacheImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoCacheImpl.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoCacheImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoCacheImpl.java Thu Sep 15 19:05:43 2011
@@ -25,6 +25,7 @@ import org.apache.jackrabbit.spi.NodeInf
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.spi.PropertyInfo;
 import org.apache.jackrabbit.spi.RepositoryService;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 
 import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
 
@@ -139,7 +140,7 @@ public class ItemInfoCacheImpl implement
     }
 
     private static Entry<NodeInfo> node(Object entry) {
-        if (entry != null && ((Entry<?>) entry).info.denotesNode()) {
+        if (entry != null && Unchecked.<Entry<?>>cast(entry).info.denotesNode()) {
             return cast(entry);
         }
         else {
@@ -148,7 +149,7 @@ public class ItemInfoCacheImpl implement
     }
 
     private static Entry<PropertyInfo> property(Object entry) {
-        if (entry != null && !((Entry<?>) entry).info.denotesNode()) {
+        if (entry != null && !Unchecked.<Entry<?>>cast(entry).info.denotesNode()) {
             return cast(entry);
         }
         else {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java Thu Sep 15 19:05:43 2011
@@ -46,6 +46,8 @@ import java.util.TreeSet;
 import java.util.Set;
 import java.io.Serializable;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * {@code QNodeTypeDefinitionImpl} implements a serializable SPI node
  * type definition.
@@ -330,7 +332,7 @@ public class QNodeTypeDefinitionImpl imp
             return true;
         }
         if (obj instanceof QNodeTypeDefinitionImpl) {
-            QNodeTypeDefinitionImpl other = (QNodeTypeDefinitionImpl) obj;
+            QNodeTypeDefinitionImpl other = cast(obj);
             return (name == null ? other.name == null : name.equals(other.name))
                     && (primaryItemName == null ? other.primaryItemName == null : primaryItemName.equals(other.primaryItemName))
                     && new HashSet<Name>(Arrays.asList(getSupertypes())).equals(new HashSet<Name>(Arrays.asList(other.getSupertypes())))

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/AbstractChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/AbstractChangeLog.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/AbstractChangeLog.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/AbstractChangeLog.java Thu Sep 15 19:05:43 2011
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.spi.commons.batch;
 
 import org.apache.jackrabbit.spi.Batch;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 
 import javax.jcr.RepositoryException;
 import java.util.Iterator;
@@ -81,7 +82,7 @@ public abstract class AbstractChangeLog<
             return true;
         }
         if (other instanceof AbstractChangeLog<?>) {
-            return equals((AbstractChangeLog<?>) other);
+            return equals(Unchecked.<AbstractChangeLog<?>>cast(other));
         }
         return false;
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java Thu Sep 15 19:05:43 2011
@@ -25,11 +25,14 @@ import org.apache.jackrabbit.spi.PathFac
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 
 import javax.jcr.RepositoryException;
 import java.util.Iterator;
 import java.util.ListIterator;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * A {@link ChangeLog} implementation which does basic consolidation on its
  * {@link org.apache.jackrabbit.spi.commons.batch.Operation Operation}s. That is, cancelling
@@ -296,7 +299,7 @@ public class ConsolidatingChangeLog exte
             public Cancel cancel(CancelableOperation other) throws RepositoryException {
                 if (other instanceof Remove) {
                     Path thisPath = ConsolidatingChangeLog.getPath(parentId, nodeName);
-                    Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId);
+                    Path otherPath = ConsolidatingChangeLog.getPath(Unchecked.<Remove>cast(other).itemId);
                     if (thisPath == null || otherPath == null) {
                         return Cancel.NONE;
                     }
@@ -365,7 +368,7 @@ public class ConsolidatingChangeLog exte
             public Cancel cancel(CancelableOperation other) throws RepositoryException {
                 if (other instanceof Remove) {
                     Path thisPath = ConsolidatingChangeLog.getPath(parentId, propertyName);
-                    Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId);
+                    Path otherPath = ConsolidatingChangeLog.getPath(Unchecked.<Remove>cast(other).itemId);
                     if (thisPath == null || otherPath == null) {
                         return Cancel.NONE;
                     }
@@ -377,7 +380,7 @@ public class ConsolidatingChangeLog exte
                         : Cancel.NONE;
                 }
                 if (other instanceof SetValue) {
-                    SetValue setValue = (SetValue) other;
+                    SetValue setValue = cast(other);
                     Path thisPath = ConsolidatingChangeLog.getPath(parentId, propertyName);
                     Path otherPath = ConsolidatingChangeLog.getPath(setValue.propertyId);
                     if (thisPath == null || otherPath == null) {
@@ -520,7 +523,7 @@ public class ConsolidatingChangeLog exte
             public Cancel cancel(CancelableOperation other) throws RepositoryException {
                 if (other instanceof Remove) {
                     Path thisPath = ConsolidatingChangeLog.getPath(srcNodeId);
-                    Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId);
+                    Path otherPath = ConsolidatingChangeLog.getPath(Unchecked.<Remove>cast(other).itemId);
                     if (thisPath == null || otherPath == null) {
                         return Cancel.NONE;
                     }
@@ -530,7 +533,7 @@ public class ConsolidatingChangeLog exte
                 }
                 if (other instanceof ReorderNodes) {
                     Path thisPath = ConsolidatingChangeLog.getPath(parentId);
-                    Path otherPath = ConsolidatingChangeLog.getPath(((ReorderNodes) other).parentId);
+                    Path otherPath = ConsolidatingChangeLog.getPath(Unchecked.<ReorderNodes>cast(other).parentId);
                     if (thisPath == null || otherPath == null) {
                         return Cancel.NONE;
                     }
@@ -592,7 +595,7 @@ public class ConsolidatingChangeLog exte
             public Cancel cancel(CancelableOperation other) throws RepositoryException {
                 if (other instanceof Remove) {
                     Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
-                    Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId);
+                    Path otherPath = ConsolidatingChangeLog.getPath(Unchecked.<Remove>cast(other).itemId);
                     if (thisPath == null || otherPath == null) {
                         return Cancel.NONE;
                     }
@@ -601,7 +604,7 @@ public class ConsolidatingChangeLog exte
                         : Cancel.NONE;
                 }
                 if (other instanceof SetMixins) {
-                    SetMixins setMixin = (SetMixins) other;
+                    SetMixins setMixin = cast(other);
                     if (mixinNodeTypeNames.length == setMixin.mixinNodeTypeNames.length) {
                         Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
                         Path otherPath = ConsolidatingChangeLog.getPath(setMixin.nodeId);
@@ -662,7 +665,7 @@ public class ConsolidatingChangeLog exte
             public Cancel cancel(CancelableOperation other) throws RepositoryException {
                 if (other instanceof Remove) {
                     Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
-                    Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId);
+                    Path otherPath = ConsolidatingChangeLog.getPath(Unchecked.<Remove>cast(other).itemId);
                     if (thisPath == null || otherPath == null) {
                         return Cancel.NONE;
                     }
@@ -671,7 +674,7 @@ public class ConsolidatingChangeLog exte
                         : Cancel.NONE;
                 }
                 if (other instanceof SetPrimaryType) {
-                    SetPrimaryType setPrimaryType = (SetPrimaryType) other;
+                    SetPrimaryType setPrimaryType = cast(other);
                     if (primaryTypeName.equals(setPrimaryType.primaryTypeName)) {
                         Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
                         Path otherPath = ConsolidatingChangeLog.getPath(setPrimaryType.nodeId);
@@ -730,7 +733,7 @@ public class ConsolidatingChangeLog exte
             public Cancel cancel(CancelableOperation other) throws RepositoryException {
                 if (other instanceof Remove) {
                     Path thisPath = ConsolidatingChangeLog.getPath(propertyId);
-                    Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId);
+                    Path otherPath = ConsolidatingChangeLog.getPath(Unchecked.<Remove>cast(other).itemId);
                     if (thisPath == null || otherPath == null) {
                         return Cancel.NONE;
                     }
@@ -740,7 +743,7 @@ public class ConsolidatingChangeLog exte
                 }
                 if (other instanceof SetValue) {
                     Path thisPath = ConsolidatingChangeLog.getPath(propertyId);
-                    Path otherPath = ConsolidatingChangeLog.getPath(((SetValue) other).propertyId);
+                    Path otherPath = ConsolidatingChangeLog.getPath(Unchecked.<SetValue>cast(other).propertyId);
                     if (thisPath == null || otherPath == null) {
                         return Cancel.NONE;
                     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java Thu Sep 15 19:05:43 2011
@@ -22,6 +22,7 @@ import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 
 import javax.jcr.RepositoryException;
 import java.util.Arrays;
@@ -126,7 +127,7 @@ public final class Operations {
                 return true;
             }
             if (other instanceof AddNode) {
-                return equals((AddNode) other);
+                return equals(Unchecked.<AddNode>cast(other));
             }
             return false;
         }
@@ -221,7 +222,7 @@ public final class Operations {
 
         @Override
         public String toString() {
-            return "AddProperty[" + parentId + ", " + propertyName + ", " + values + ']';
+            return "AddProperty[" + parentId + ", " + propertyName + ", " + Arrays.deepToString(values) + ']';
         }
 
         @Override
@@ -233,7 +234,7 @@ public final class Operations {
                 return true;
             }
             if (other instanceof AddProperty) {
-                return equals((AddProperty) other);
+                return equals(Unchecked.<AddProperty>cast(other));
             }
             return false;
         }
@@ -325,7 +326,7 @@ public final class Operations {
                 return true;
             }
             if (other instanceof Move) {
-                return equals((Move) other);
+                return equals(Unchecked.<Move>cast(other));
             }
             return false;
         }
@@ -397,7 +398,7 @@ public final class Operations {
                 return true;
             }
             if (other instanceof Remove) {
-                return equals((Remove) other);
+                return equals(Unchecked.<Remove>cast(other));
             }
             return false;
         }
@@ -467,7 +468,7 @@ public final class Operations {
                 return true;
             }
             if (other instanceof ReorderNodes) {
-                return equals((ReorderNodes) other);
+                return equals(Unchecked.<ReorderNodes>cast(other));
             }
             return false;
         }
@@ -530,7 +531,7 @@ public final class Operations {
 
         @Override
         public String toString() {
-            return "SetMixins[" + nodeId + ", " + mixinNodeTypeNames + ']';
+            return "SetMixins[" + nodeId + ", " + Arrays.deepToString(mixinNodeTypeNames) + ']';
         }
 
         @Override
@@ -542,7 +543,7 @@ public final class Operations {
                 return true;
             }
             if (other instanceof SetMixins) {
-                return equals((SetMixins) other);
+                return equals(Unchecked.<SetMixins>cast(other));
             }
             return false;
         }
@@ -613,7 +614,7 @@ public final class Operations {
                 return true;
             }
             if (other instanceof SetPrimaryType) {
-                return equals((SetPrimaryType) other);
+                return equals(Unchecked.<SetPrimaryType>cast(other));
             }
             return false;
         }
@@ -695,7 +696,7 @@ public final class Operations {
 
         @Override
         public String toString() {
-            return "SetValue[" + propertyId + ", " + values + ']';
+            return "SetValue[" + propertyId + ", " + Arrays.deepToString(values) + ']';
         }
 
         @Override
@@ -707,7 +708,7 @@ public final class Operations {
                 return true;
             }
             if (other instanceof SetValue) {
-                return equals((SetValue) other);
+                return equals(Unchecked.<SetValue>cast(other));
             }
             return false;
         }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java Thu Sep 15 19:05:43 2011
@@ -40,6 +40,7 @@ import org.apache.jackrabbit.spi.QueryIn
 import org.apache.jackrabbit.spi.RepositoryService;
 import org.apache.jackrabbit.spi.SessionInfo;
 import org.apache.jackrabbit.spi.Subscription;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 
 import javax.jcr.Credentials;
 import javax.jcr.RepositoryException;
@@ -901,7 +902,7 @@ public class RepositoryServiceLogger ext
 
     private static SessionInfo unwrap(SessionInfo sessionInfo) {
         if (sessionInfo instanceof SessionInfoLogger) {
-            return ((SessionInfoLogger) sessionInfo).getSessionInfo();
+            return Unchecked.<SessionInfoLogger>cast(sessionInfo).getSessionInfo();
         }
         else {
             return sessionInfo;
@@ -910,7 +911,7 @@ public class RepositoryServiceLogger ext
 
     private static Batch unwrap(Batch batch) {
         if (batch instanceof BatchLogger) {
-            return ((BatchLogger) batch).getBatch();
+            return Unchecked.<BatchLogger>cast(batch).getBatch();
         }
         else {
             return batch;

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java Thu Sep 15 19:05:43 2011
@@ -19,6 +19,8 @@ package org.apache.jackrabbit.spi.common
 import org.apache.jackrabbit.spi.NameFactory;
 import org.apache.jackrabbit.spi.Name;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * {@code NameFactoryImpl}...
  */
@@ -168,7 +170,7 @@ public class NameFactoryImpl implements 
                 return true;
             }
             if (obj instanceof NameImpl) {
-                NameImpl other = (NameImpl) obj;
+                NameImpl other = cast(obj);
                 // we can use == operator for namespaceURI since it is internalized
                 return namespaceURI == other.namespaceURI && localName.equals(other.localName);
             }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RelativePath.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RelativePath.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RelativePath.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RelativePath.java Thu Sep 15 19:05:43 2011
@@ -20,6 +20,8 @@ import org.apache.jackrabbit.spi.Path;
 
 import javax.jcr.RepositoryException;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 abstract class RelativePath extends AbstractPath {
 
     /** Serial version UID */
@@ -150,7 +152,7 @@ abstract class RelativePath extends Abst
         if (this == that) {
             return true;
         } else if (that instanceof RelativePath) {
-            RelativePath path = (RelativePath) that;
+            RelativePath path = cast(that);
             if (parent != null) {
                 return parent.equals(path.parent);
             } else {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/NamespaceMapping.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/NamespaceMapping.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/NamespaceMapping.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/NamespaceMapping.java Thu Sep 15 19:05:43 2011
@@ -20,6 +20,8 @@ import javax.jcr.NamespaceException;
 import java.util.HashMap;
 import java.util.Map;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * A Simple Namespace Mapping table. Mappings can be added
  * and then the object can be used as a NamespaceResolver. Additionally, it can
@@ -151,7 +153,7 @@ public class NamespaceMapping implements
             return true;
         }
         if (obj instanceof NamespaceMapping) {
-            NamespaceMapping other = (NamespaceMapping) obj;
+            NamespaceMapping other = cast(obj);
             return getPrefixToURIMapping().equals(other.getPrefixToURIMapping())
                    && getURIToPrefixMapping().equals(other.getURIToPrefixMapping());
         }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/RegistryNamespaceResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/RegistryNamespaceResolver.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/RegistryNamespaceResolver.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/RegistryNamespaceResolver.java Thu Sep 15 19:05:43 2011
@@ -45,6 +45,7 @@ public class RegistryNamespaceResolver i
         try {
             return registry.getPrefix(uri);
         } catch (RepositoryException e) {
+            //noinspection InstanceofCatchParameter
             if (!(e instanceof NamespaceException)) {
                 e = new NamespaceException("Failed to resolve namespace URI: " + uri, e);
             }
@@ -57,6 +58,7 @@ public class RegistryNamespaceResolver i
         try {
             return registry.getURI(prefix);
         } catch (RepositoryException e) {
+            //noinspection InstanceofCatchParameter
             if (!(e instanceof NamespaceException)) {
                 e = new NamespaceException("Failed to resolve namespace prefix: " + prefix, e);
             }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractItemDefinitionTemplate.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractItemDefinitionTemplate.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractItemDefinitionTemplate.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractItemDefinitionTemplate.java Thu Sep 15 19:05:43 2011
@@ -19,6 +19,7 @@ package org.apache.jackrabbit.spi.common
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -66,7 +67,7 @@ abstract class AbstractItemDefinitionTem
         this.resolver = resolver;
 
         if (def instanceof ItemDefinitionImpl) {
-            name = ((ItemDefinitionImpl) def).itemDef.getName();
+            name = Unchecked.<ItemDefinitionImpl>cast(def).itemDef.getName();
         } else {
             setName(def.getName());
         }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/ItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/ItemDefinitionImpl.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/ItemDefinitionImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/ItemDefinitionImpl.java Thu Sep 15 19:05:43 2011
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.spi.common
 
 import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
@@ -148,7 +149,7 @@ abstract class ItemDefinitionImpl implem
         if (!(o instanceof ItemDefinitionImpl)) {
             return false;
         }
-        return itemDef.equals(((ItemDefinitionImpl) o).itemDef);
+        return itemDef.equals(Unchecked.<ItemDefinitionImpl>cast(o).itemDef);
     }
 
     @Override

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionTemplateImpl.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionTemplateImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionTemplateImpl.java Thu Sep 15 19:05:43 2011
@@ -19,6 +19,7 @@ package org.apache.jackrabbit.spi.common
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QNodeDefinition;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -66,7 +67,7 @@ class NodeDefinitionTemplateImpl extends
         allowSameNameSiblings = def.allowsSameNameSiblings();
 
         if (def instanceof NodeDefinitionImpl) {
-            QNodeDefinition qDef = (QNodeDefinition) ((NodeDefinitionImpl) def).itemDef;
+            QNodeDefinition qDef = (QNodeDefinition) Unchecked.<NodeDefinitionImpl>cast(def).itemDef;
             requiredPrimaryTypeNames = qDef.getRequiredPrimaryTypes();
             defaultPrimaryTypeName = qDef.getDefaultPrimaryType();
         } else {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java Thu Sep 15 19:05:43 2011
@@ -34,6 +34,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * A {@code NodeTypeDefDiff} represents the result of the comparison of
  * two node type definitions.
@@ -646,7 +648,7 @@ public class NodeTypeDefDiff {
                 return true;
             }
             if (obj instanceof QPropertyDefinitionId) {
-                QPropertyDefinitionId other = (QPropertyDefinitionId) obj;
+                QPropertyDefinitionId other = cast(obj);
                 return declaringNodeType.equals(other.declaringNodeType)
                         && name.equals(other.name)
                         && requiredType == other.requiredType
@@ -696,7 +698,7 @@ public class NodeTypeDefDiff {
                 return true;
             }
             if (obj instanceof QNodeDefinitionId) {
-                QNodeDefinitionId other = (QNodeDefinitionId) obj;
+                QNodeDefinitionId other = cast(obj);
                 return declaringNodeType.equals(other.declaringNodeType)
                         && name.equals(other.name)
                         && Arrays.equals(requiredPrimaryTypes, other.requiredPrimaryTypes);

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java Thu Sep 15 19:05:43 2011
@@ -19,6 +19,7 @@ package org.apache.jackrabbit.spi.common
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -76,7 +77,7 @@ public class NodeTypeTemplateImpl implem
         this.resolver = resolver;
         
         if (def instanceof NodeTypeDefinitionImpl) {
-            QNodeTypeDefinition qDef = ((NodeTypeDefinitionImpl) def).ntd;
+            QNodeTypeDefinition qDef = Unchecked.<NodeTypeDefinitionImpl>cast(def).ntd;
             name = qDef.getName();
             superTypeNames = qDef.getSupertypes();
             primaryItemName = qDef.getPrimaryItemName();

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java Thu Sep 15 19:05:43 2011
@@ -24,6 +24,7 @@ import org.apache.jackrabbit.spi.QValueC
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.nodetype.InvalidConstraintException;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -101,7 +102,7 @@ public abstract class ValueConstraint im
     public boolean equals(Object other) {
         return other == this
                 || other instanceof ValueConstraint
-                && definition.equals(((ValueConstraint) other).definition);
+                && definition.equals(Unchecked.<ValueConstraint>cast(other).definition);
     }
 
     /**

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DerefQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DerefQueryNode.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DerefQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DerefQueryNode.java Thu Sep 15 19:05:43 2011
@@ -20,6 +20,8 @@ import org.apache.jackrabbit.spi.Name;
 
 import javax.jcr.RepositoryException;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * Represents query node that dereferences a reference property into a node and
  * does an optional name test on the target node.
@@ -77,7 +79,7 @@ public class DerefQueryNode extends Loca
      */
     public boolean equals(Object obj) {
         if (obj instanceof DerefQueryNode) {
-            DerefQueryNode other = (DerefQueryNode) obj;
+            DerefQueryNode other = cast(obj);
             return super.equals(obj)
                     && refProperty == null ? other.refProperty == null : refProperty.equals(other.refProperty);
         }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ExactQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ExactQueryNode.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ExactQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ExactQueryNode.java Thu Sep 15 19:05:43 2011
@@ -20,6 +20,8 @@ import org.apache.jackrabbit.spi.Name;
 
 import javax.jcr.RepositoryException;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * Implements a query node that defines an exact match of a property and a
  * value.
@@ -85,7 +87,7 @@ public class ExactQueryNode extends Quer
      */
     public boolean equals(Object obj) {
         if (obj instanceof ExactQueryNode) {
-            ExactQueryNode other = (ExactQueryNode) obj;
+            ExactQueryNode other = cast(obj);
             return (value == null ? other.value == null : value.equals(other.value))
                     && (property == null ? other.property == null : property.equals(other.property));
         }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/LocationStepQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/LocationStepQueryNode.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/LocationStepQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/LocationStepQueryNode.java Thu Sep 15 19:05:43 2011
@@ -21,6 +21,8 @@ import org.apache.jackrabbit.spi.commons
 
 import javax.jcr.RepositoryException;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * Defines a location step for querying the path of a node.
  * <p/>
@@ -173,7 +175,7 @@ public class LocationStepQueryNode exten
      */
     public boolean equals(Object obj) {
         if (obj instanceof LocationStepQueryNode) {
-            LocationStepQueryNode other = (LocationStepQueryNode) obj;
+            LocationStepQueryNode other = cast(obj);
             return super.equals(other)
                     && includeDescendants == other.includeDescendants
                     && index == other.index

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NAryQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NAryQueryNode.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NAryQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NAryQueryNode.java Thu Sep 15 19:05:43 2011
@@ -22,6 +22,8 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * Defines an abstract query node for nodes that have child nodes.
  */
@@ -152,7 +154,7 @@ public abstract class NAryQueryNode<T ex
      */
     public boolean equals(Object obj) {
         if (obj instanceof NAryQueryNode) {
-            NAryQueryNode<?> other = (NAryQueryNode<?>) obj;
+            NAryQueryNode<?> other = cast(obj);
             return operands == null ? other.operands == null : operands.equals(other.operands);
         }
         return false;

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java Thu Sep 15 19:05:43 2011
@@ -22,6 +22,8 @@ import javax.jcr.RepositoryException;
 import java.util.ArrayList;
 import java.util.List;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * Implements a query node that defines the order of nodes according to the
  * values of properties.
@@ -178,7 +180,7 @@ public class OrderQueryNode extends Quer
      */
     public boolean equals(Object obj) {
         if (obj instanceof OrderQueryNode) {
-            OrderQueryNode other = (OrderQueryNode) obj;
+            OrderQueryNode other = cast(obj);
             return specs.equals(other.specs);
         }
         return false;
@@ -283,7 +285,7 @@ public class OrderQueryNode extends Quer
          */
         public boolean equals(Object obj) {
             if (obj instanceof OrderSpec) {
-                OrderSpec other = (OrderSpec) obj;
+                OrderSpec other = cast(obj);
                 return (property == null ? other.property == null : property.equals(other.property))
                         && ascending == other.ascending;
             }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PathQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PathQueryNode.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PathQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PathQueryNode.java Thu Sep 15 19:05:43 2011
@@ -22,6 +22,8 @@ import org.apache.jackrabbit.spi.commons
 import javax.jcr.RepositoryException;
 import java.util.Collection;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * Implements a query node that defines a path restriction.
  */
@@ -129,7 +131,7 @@ public class PathQueryNode extends NAryQ
      */
     public boolean equals(Object obj) {
         if (obj instanceof PathQueryNode) {
-            PathQueryNode other = (PathQueryNode) obj;
+            PathQueryNode other = cast(obj);
             return super.equals(obj) && absolute == other.absolute;
         }
         return false;
@@ -152,7 +154,7 @@ public class PathQueryNode extends NAryQ
             QueryNode[] pathStepOperands = pathSteps[0].getOperands();
             if (pathStepOperands.length > 0) {
                 if (pathStepOperands[0] instanceof NodeTypeQueryNode) {
-                    NodeTypeQueryNode nodeTypeQueryNode = (NodeTypeQueryNode) pathStepOperands[0];
+                    NodeTypeQueryNode nodeTypeQueryNode = cast(pathStepOperands[0]);
                     if (!validJcrSystemNodeTypeNames.contains(nodeTypeQueryNode.getValue())) {
                         return false;
                     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PropertyFunctionQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PropertyFunctionQueryNode.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PropertyFunctionQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PropertyFunctionQueryNode.java Thu Sep 15 19:05:43 2011
@@ -21,6 +21,8 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * {@code PropertyFunctionQueryNode} allows to place function calls on properties
  * in a query. Supported function names are:
@@ -96,7 +98,7 @@ public class PropertyFunctionQueryNode e
 
     public boolean equals(Object obj) {
         if (obj instanceof PropertyFunctionQueryNode) {
-            PropertyFunctionQueryNode other = (PropertyFunctionQueryNode) obj;
+            PropertyFunctionQueryNode other = cast(obj);
             return functionName.equals(other.functionName);
         }
         return false;

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryRootNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryRootNode.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryRootNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryRootNode.java Thu Sep 15 19:05:43 2011
@@ -22,6 +22,8 @@ import javax.jcr.RepositoryException;
 import java.util.ArrayList;
 import java.util.List;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * Implements the root node of a query tree.
  */
@@ -126,7 +128,7 @@ public class QueryRootNode extends Query
      */
     public boolean equals(Object obj) {
         if (obj instanceof QueryRootNode) {
-            QueryRootNode other = (QueryRootNode) obj;
+            QueryRootNode other = cast(obj);
             return (locationNode == null ? other.locationNode == null : locationNode.equals(other.locationNode))
                     && selectProperties.equals(other.selectProperties)
                     && (orderNode == null ? other.orderNode == null : orderNode.equals(other.orderNode));

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/RelationQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/RelationQueryNode.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/RelationQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/RelationQueryNode.java Thu Sep 15 19:05:43 2011
@@ -25,6 +25,7 @@ import javax.jcr.RepositoryException;
 import java.util.Date;
 
 import static org.apache.jackrabbit.spi.commons.query.QueryConstants.*;
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
 
 /**
  * Implements a query node that defines property value relation.
@@ -297,7 +298,7 @@ public class RelationQueryNode extends N
      */
     public boolean equals(Object obj) {
         if (obj instanceof RelationQueryNode) {
-            RelationQueryNode other = (RelationQueryNode) obj;
+            RelationQueryNode other = cast(obj);
             return type == other.type
                     && (valueDate == null ? other.valueDate == null : valueDate.equals(other.valueDate))
                     && valueDouble == other.valueDouble

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java Thu Sep 15 19:05:43 2011
@@ -22,6 +22,8 @@ import org.apache.jackrabbit.spi.commons
 
 import javax.jcr.RepositoryException;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * Implements a query node that defines a textsearch clause.
  */
@@ -156,7 +158,7 @@ public class TextsearchQueryNode extends
      */
     public boolean equals(Object obj) {
         if (obj instanceof TextsearchQueryNode) {
-            TextsearchQueryNode other = (TextsearchQueryNode) obj;
+            TextsearchQueryNode other = cast(obj);
             return (query == null ? other.query == null : query.equals(other.query))
                     && (relPath == null ? other.relPath == null : relPath.equals(other.relPath)
                     && propertyRef == other.propertyRef);

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelFactoryImpl.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelFactoryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelFactoryImpl.java Thu Sep 15 19:05:43 2011
@@ -22,6 +22,7 @@ import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
@@ -61,6 +62,8 @@ import javax.jcr.query.qom.Source;
 import javax.jcr.query.qom.StaticOperand;
 import javax.jcr.query.qom.UpperCase;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * {@code QueryObjectModelFactoryImpl} implements the query object model
  * factory from JSR 283.
@@ -145,7 +148,7 @@ public abstract class QueryObjectModelFa
                 if (!(orderings[i] instanceof OrderingImpl)) {
                     throw new RepositoryException("Unknown Ordering implementation");
                 }
-                ord[i] = (OrderingImpl) orderings[i];
+                ord[i] = cast(orderings[i]);
             }
         } else {
             ord = OrderingImpl.EMPTY_ARRAY;
@@ -157,14 +160,15 @@ public abstract class QueryObjectModelFa
                 if (!(columns[i] instanceof ColumnImpl)) {
                     throw new RepositoryException("Unknown Column implementation");
                 }
-                cols[i] = (ColumnImpl) columns[i];
+                cols[i] = cast(columns[i]);
             }
         } else {
             cols = ColumnImpl.EMPTY_ARRAY;
         }
-        QueryObjectModelTree qomTree = new QueryObjectModelTree(
-                resolver, (SourceImpl) source,
-                (ConstraintImpl) constraint, ord, cols);
+        QueryObjectModelTree qomTree = new QueryObjectModelTree(resolver,
+                Unchecked.<SourceImpl>cast(source),
+                Unchecked.<ConstraintImpl>cast(constraint), ord, cols);
+        
         return createQuery(qomTree);
     }
 
@@ -225,12 +229,11 @@ public abstract class QueryObjectModelFa
         if (!(joinCondition instanceof JoinConditionImpl)) {
             throw new RepositoryException("Unknown JoinCondition implementation");
         }
-        return new JoinImpl(
-                resolver,
-                (SourceImpl) left,
-                (SourceImpl) right,
+        return new JoinImpl(resolver,
+                Unchecked.<SourceImpl>cast(left),
+                Unchecked.<SourceImpl>cast(right),
                 JoinType.getJoinTypeByName(joinTypeName),
-                (JoinConditionImpl) joinCondition);
+                Unchecked.<JoinConditionImpl>cast(joinCondition));
     }
 
     /**
@@ -359,8 +362,8 @@ public abstract class QueryObjectModelFa
         if (constraint1 instanceof ConstraintImpl
                 && constraint2 instanceof ConstraintImpl) {
             return new AndImpl(resolver,
-                    (ConstraintImpl) constraint1,
-                    (ConstraintImpl) constraint2);
+                    Unchecked.<ConstraintImpl>cast(constraint1),
+                    Unchecked.<ConstraintImpl>cast(constraint2));
         } else {
             throw new RepositoryException("Unknown constraint implementation");
         }
@@ -384,8 +387,8 @@ public abstract class QueryObjectModelFa
         if (constraint1 instanceof ConstraintImpl
                 && constraint2 instanceof ConstraintImpl) {
             return new OrImpl(resolver,
-                    (ConstraintImpl) constraint1,
-                    (ConstraintImpl) constraint2);
+                    Unchecked.<ConstraintImpl>cast(constraint1),
+                    Unchecked.<ConstraintImpl>cast(constraint2));
         } else {
             throw new RepositoryException("Unknown constraint implementation");
         }
@@ -405,7 +408,7 @@ public abstract class QueryObjectModelFa
         if (!(constraint instanceof ConstraintImpl)) {
             throw new RepositoryException("Unknown Constraint implementation");
         }
-        return new NotImpl(resolver, (ConstraintImpl) constraint);
+        return new NotImpl(resolver, Unchecked.<ConstraintImpl>cast(constraint));
     }
 
     /**
@@ -437,9 +440,9 @@ public abstract class QueryObjectModelFa
 
         return new ComparisonImpl(
                 resolver,
-                (DynamicOperandImpl) left,
+                Unchecked.<DynamicOperandImpl>cast(left),
                 Operator.getOperatorByName(operatorName),
-                (StaticOperandImpl) right);
+                Unchecked.<StaticOperandImpl>cast(right));
     }
 
     /**
@@ -673,7 +676,7 @@ public abstract class QueryObjectModelFa
         if (!(propertyValue instanceof PropertyValueImpl)) {
             throw new RepositoryException("Unknown PropertyValue implementation");
         }
-        return new LengthImpl(resolver, (PropertyValueImpl) propertyValue);
+        return new LengthImpl(resolver, Unchecked.<PropertyValueImpl>cast(propertyValue));
     }
 
     /**
@@ -780,7 +783,7 @@ public abstract class QueryObjectModelFa
         if (!(operand instanceof DynamicOperandImpl)) {
             throw new RepositoryException("Unknown DynamicOperand implementation");
         }
-        return new LowerCaseImpl(resolver, (DynamicOperandImpl) operand);
+        return new LowerCaseImpl(resolver, Unchecked.<DynamicOperandImpl>cast(operand));
     }
 
     /**
@@ -799,7 +802,7 @@ public abstract class QueryObjectModelFa
         if (!(operand instanceof DynamicOperandImpl)) {
             throw new RepositoryException("Unknown DynamicOperand implementation");
         }
-        return new UpperCaseImpl(resolver, (DynamicOperandImpl) operand);
+        return new UpperCaseImpl(resolver, Unchecked.<DynamicOperandImpl>cast(operand));
     }
 
     /**
@@ -854,7 +857,7 @@ public abstract class QueryObjectModelFa
         if (!(operand instanceof DynamicOperandImpl)) {
             throw new RepositoryException("Unknown DynamicOperand implementation");
         }
-        return new OrderingImpl(resolver, (DynamicOperandImpl) operand,
+        return new OrderingImpl(resolver, Unchecked.<DynamicOperandImpl>cast(operand),
                 QueryObjectModelConstants.JCR_ORDER_ASCENDING);
     }
 
@@ -872,7 +875,7 @@ public abstract class QueryObjectModelFa
         if (!(operand instanceof DynamicOperandImpl)) {
             throw new RepositoryException("Unknown DynamicOperand implementation");
         }
-        return new OrderingImpl(resolver, (DynamicOperandImpl) operand,
+        return new OrderingImpl(resolver, Unchecked.<DynamicOperandImpl>cast(operand),
                 QueryObjectModelConstants.JCR_ORDER_DESCENDING);
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLQueryBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLQueryBuilder.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLQueryBuilder.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLQueryBuilder.java Thu Sep 15 19:05:43 2011
@@ -232,8 +232,8 @@ public class JCRSQLQueryBuilder implemen
                 while (pathConstraints.size() > 1) {
                     // merge path nodes
                     MergingPathQueryNode path = null;
-                    for (Object pathConstraint : pathConstraints) {
-                        path = (MergingPathQueryNode) pathConstraint;
+                    for (MergingPathQueryNode pathConstraint : pathConstraints) {
+                        path = pathConstraint;
                         if (path.needsMerge()) {
                             break;
                         } else {
@@ -370,7 +370,7 @@ public class JCRSQLQueryBuilder implemen
                     if (node.jjtGetNumChildren() > 0) {
                         Node n = node.jjtGetChild(0);
                         if (n instanceof ASTIdentifier) {
-                            ASTIdentifier identifier = (ASTIdentifier) n;
+                            ASTIdentifier identifier = cast(n);
                             if (tmp[0] == null) {
                                 tmp[0] = identifier.getName();
                             } else if (tmp[1] == null) {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/xpath/XPathQueryBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/xpath/XPathQueryBuilder.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/xpath/XPathQueryBuilder.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/xpath/XPathQueryBuilder.java Thu Sep 15 19:05:43 2011
@@ -43,6 +43,7 @@ import org.apache.jackrabbit.spi.commons
 import org.apache.jackrabbit.spi.commons.query.QueryRootNode;
 import org.apache.jackrabbit.spi.commons.query.RelationQueryNode;
 import org.apache.jackrabbit.spi.commons.query.TextsearchQueryNode;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 import org.apache.jackrabbit.util.ISO8601;
 import org.apache.jackrabbit.util.ISO9075;
 
@@ -426,7 +427,7 @@ public class XPathQueryBuilder implement
             case JJTROOT:
             case JJTROOTDESCENDANTS:
                 if (queryNode instanceof PathQueryNode) {
-                    ((PathQueryNode) queryNode).setAbsolute(true);
+                    Unchecked.<PathQueryNode>cast(queryNode).setAbsolute(true);
                 } else {
                     exceptions.add(new InvalidQueryException(
                             "Unsupported root level query node: " + queryNode));
@@ -435,7 +436,8 @@ public class XPathQueryBuilder implement
             case JJTSTEPEXPR:
                 if (isAttributeAxis(node)) {
                     if (queryNode.getType() == QueryNode.TYPE_RELATION
-                            || queryNode.getType() == QueryNode.TYPE_DEREF && ((DerefQueryNode) queryNode).getRefProperty() == null
+                            || queryNode.getType() == QueryNode.TYPE_DEREF &&
+                                ((DerefQueryNode) queryNode).getRefProperty() == null
                             || queryNode.getType() == QueryNode.TYPE_ORDER
                             || queryNode.getType() == QueryNode.TYPE_PATH
                             || queryNode.getType() == QueryNode.TYPE_TEXTSEARCH) {
@@ -605,7 +607,7 @@ public class XPathQueryBuilder implement
                 break;
             case JJTDOTDOT:
                 if (queryNode instanceof LocationStepQueryNode) {
-                    ((LocationStepQueryNode) queryNode).setNameTest(PATH_FACTORY.getParentElement().getName());
+                    Unchecked.<LocationStepQueryNode>cast(queryNode).setNameTest(PATH_FACTORY.getParentElement().getName());
                 } else {
                     ((RelationQueryNode) queryNode).addPathElement(PATH_FACTORY.getParentElement());
                 }
@@ -878,7 +880,7 @@ public class XPathQueryBuilder implement
                 // check arguments
                 if (node.jjtGetNumChildren() == 2) {
                     if (queryNode instanceof RelationQueryNode) {
-                        RelationQueryNode rel = (RelationQueryNode) queryNode;
+                        RelationQueryNode rel = cast(queryNode);
                         SimpleNode literal = (SimpleNode) node.jjtGetChild(1).jjtGetChild(0);
                         if (literal.getId() == JJTSTRINGLITERAL) {
                             String value = literal.getValue();

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/Exceptions.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/Exceptions.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/Exceptions.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/Exceptions.java Thu Sep 15 19:05:43 2011
@@ -23,6 +23,7 @@ public final class Exceptions {
     private Exceptions() {}
 
     public static <E extends Throwable> E setCause(E exception, Throwable cause) {
+        //noinspection RedundantTypeArguments
         return Unchecked.<E>cast(exception.initCause(cause));
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/StringCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/StringCache.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/StringCache.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/StringCache.java Thu Sep 15 19:05:43 2011
@@ -158,6 +158,7 @@ public class StringCache {
         }
         // create a new object that is not shared
         // (to avoid out of memory if it is a substring of a big String)
+        //noinspection RedundantStringConstructorCall
         s = new String(s);
         cache[index] = s;
         return s;

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/WeakIdentityCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/WeakIdentityCollection.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/WeakIdentityCollection.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/util/WeakIdentityCollection.java Thu Sep 15 19:05:43 2011
@@ -246,6 +246,7 @@ public class WeakIdentityCollection<E> i
         }
 
         for (int i = 0; i < size; i++) {
+            //noinspection RedundantTypeArguments
             a[i] = Unchecked.<T>cast(elementData.get(i).get());
         }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValue.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValue.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValue.java Thu Sep 15 19:05:43 2011
@@ -35,6 +35,8 @@ import java.io.InputStream;
 import java.io.IOException;
 import java.io.Serializable;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * {@code AbstractQValue}...
  */
@@ -445,7 +447,7 @@ public abstract class AbstractQValue imp
             return true;
         }
         if (obj instanceof AbstractQValue) {
-            AbstractQValue other = (AbstractQValue) obj;
+            AbstractQValue other = cast(obj);
             return type == other.type && val.equals(other.val);
         }
         return false;

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/QValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/QValueFactoryImpl.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/QValueFactoryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/QValueFactoryImpl.java Thu Sep 15 19:05:43 2011
@@ -37,6 +37,8 @@ import java.io.OutputStream;
 import java.io.Serializable;
 import java.util.Arrays;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * {@code QValueFactoryImpl}...
  */
@@ -342,7 +344,7 @@ public class QValueFactoryImpl extends A
                 return file.toString();
             } else {
                 // this instance is backed by an in-memory buffer
-                return buffer.toString();
+                return Arrays.toString(buffer);
             }
         }
 
@@ -352,7 +354,7 @@ public class QValueFactoryImpl extends A
                 return true;
             }
             if (obj instanceof BinaryQValue) {
-                BinaryQValue other = (BinaryQValue) obj;
+                BinaryQValue other = cast(obj);
                 return (file == null ? other.file == null : file.equals(other.file))
                     && Arrays.equals(buffer, other.buffer);
             }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/QValueValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/QValueValue.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/QValueValue.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/QValueValue.java Thu Sep 15 19:05:43 2011
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.spi.common
 
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 
 import javax.jcr.Binary;
 import javax.jcr.PropertyType;
@@ -215,7 +216,7 @@ public final class QValueValue implement
      */
     @Override
     public boolean equals(Object obj) {
-        return obj instanceof QValueValue && qValue.equals(((QValueValue) obj).qValue);
+        return obj instanceof QValueValue && qValue.equals(Unchecked.<QValueValue>cast(obj).qValue);
     }
 
     /**

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/ValueFormat.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/ValueFormat.java?rev=1171225&r1=1171224&r2=1171225&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/ValueFormat.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/ValueFormat.java Thu Sep 15 19:05:43 2011
@@ -21,6 +21,7 @@ import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.QValueFactory;
+import org.apache.jackrabbit.spi.commons.util.Unchecked;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.PropertyType;
@@ -51,7 +52,7 @@ public final class ValueFormat {
         if (jcrValue == null) {
             throw new IllegalArgumentException("null value");
         } else if (jcrValue instanceof QValueValue) {
-            return ((QValueValue)jcrValue).getQValue();
+            return Unchecked.<QValueValue>cast(jcrValue).getQValue();
         } else if (jcrValue.getType() == PropertyType.BINARY) {
             // TODO: jsr 283 binary property conversion
             try {
@@ -149,7 +150,7 @@ public final class ValueFormat {
                                     NamePathResolver resolver,
                                     ValueFactory factory) throws RepositoryException {
         if (factory instanceof ValueFactoryQImpl) {
-            return ((ValueFactoryQImpl)factory).createValue(value);
+            return Unchecked.<ValueFactoryQImpl>cast(factory).createValue(value);
         } else {
             Value jcrValue;
             int propertyType = value.getType();



Mime
View raw message