jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1339249 - in /jackrabbit/oak/trunk: oak-core/ oak-core/src/main/java/org/apache/jackrabbit/oak/api/ oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/ oak-jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/
Date Wed, 16 May 2012 16:13:42 GMT
Author: reschke
Date: Wed May 16 16:13:41 2012
New Revision: 1339249

URL: http://svn.apache.org/viewvc?rev=1339249&view=rev
Log:
OAK-37: Use nullability annotation to enforce/document API contract (WIP)

Modified:
    jackrabbit/oak/trunk/oak-core/pom.xml
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValueFactory.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NameMapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/PathMapper.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java

Modified: jackrabbit/oak/trunk/oak-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/pom.xml?rev=1339249&r1=1339248&r2=1339249&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-core/pom.xml Wed May 16 16:13:41 2012
@@ -143,6 +143,14 @@
       <version>1.6.4</version>
     </dependency>
 
+    <!-- Findbugs annotations -->
+    <dependency>
+      <groupId>com.google.code.findbugs</groupId>
+      <artifactId>jsr305</artifactId>
+      <version>2.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+
     <!-- Test Dependencies -->
     <dependency>
       <groupId>junit</groupId>

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValueFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValueFactory.java?rev=1339249&r1=1339248&r2=1339249&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValueFactory.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValueFactory.java
Wed May 16 16:13:41 2012
@@ -20,6 +20,8 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.math.BigDecimal;
 
+import javax.annotation.Nonnull;
+
 /**
  * {@code CoreValueFactory} defines methods to create new instances of
  * {@code CoreValue}.
@@ -92,5 +94,5 @@ public interface CoreValueFactory {
      * conversion to any of the number types and the conversion fails.
      * @throws //TODO define and consolidate exceptions
      */
-    CoreValue createValue(String value, int type);
+    CoreValue createValue(@Nonnull String value, int type);
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NameMapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NameMapper.java?rev=1339249&r1=1339248&r2=1339249&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NameMapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NameMapper.java
Wed May 16 16:13:41 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.namepath;
 
+import javax.annotation.CheckForNull;
+
 public interface NameMapper {
 
     /**
@@ -26,6 +28,7 @@ public interface NameMapper {
      * @param jcrName JCR name
      * @return Oak name, or {@code null}
      */
+    @CheckForNull
     String getOakName(String jcrName);
 
     /**
@@ -38,6 +41,6 @@ public interface NameMapper {
      * @param oakName Oak name
      * @return JCR name
      */
+    @CheckForNull
     String getJcrName(String oakName);
-
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/PathMapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/PathMapper.java?rev=1339249&r1=1339248&r2=1339249&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/PathMapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/PathMapper.java
Wed May 16 16:13:41 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.namepath;
 
+import javax.annotation.CheckForNull;
+
 /**
  * TODO
  */
@@ -29,6 +31,7 @@ public interface PathMapper {
      * @param jcrPath JCR path
      * @return Oak path, or {@code null}
      */
+    @CheckForNull
     String getOakPath(String jcrPath);
 
     /**
@@ -42,6 +45,7 @@ public interface PathMapper {
      * @param oakPath Oak path
      * @return JCR path
      */
+    @CheckForNull
     String getJcrPath(String oakPath);
 
 }

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1339249&r1=1339248&r2=1339249&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Wed May 16 16:13:41 2012
@@ -122,6 +122,14 @@
       <version>1.6.4</version>
     </dependency>
 
+    <!-- Findbugs annotations -->
+    <dependency>
+      <groupId>com.google.code.findbugs</groupId>
+      <artifactId>jsr305</artifactId>
+      <version>2.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+
     <!-- Test dependencies -->
     <dependency>
       <groupId>junit</groupId>

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java?rev=1339249&r1=1339248&r2=1339249&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
Wed May 16 16:13:41 2012
@@ -27,6 +27,8 @@ import org.apache.jackrabbit.oak.util.It
 import java.util.Iterator;
 import java.util.List;
 
+import javax.annotation.CheckForNull;
+
 /**
  * {@code NodeDelegate} serve as internal representations of {@code Node}s.
  * The methods of this class do not throw checked exceptions. Instead clients
@@ -119,6 +121,7 @@ public class NodeDelegate extends ItemDe
      * @return  property at the path given by {@code relPath} or {@code null} if
      * no such property exists
      */
+    @CheckForNull
     public PropertyDelegate getProperty(String relPath) {
         Tree parent = getTree(PathUtils.getParentPath(relPath));
         if (parent == null) {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1339249&r1=1339248&r2=1339249&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Wed May 16 16:13:41 2012
@@ -31,6 +31,7 @@ import org.apache.jackrabbit.value.Value
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.Nonnull;
 import javax.jcr.Binary;
 import javax.jcr.Item;
 import javax.jcr.ItemExistsException;
@@ -415,6 +416,7 @@ public class NodeImpl extends ItemImpl i
     }
 
     @Override
+    @Nonnull
     public Property getProperty(String relPath) throws RepositoryException {
         checkStatus();
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1339249&r1=1339248&r2=1339249&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Wed May 16 16:13:41 2012
@@ -16,6 +16,21 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
+import java.io.IOException;
+
+import javax.annotation.CheckForNull;
+import javax.jcr.ItemExistsException;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+import javax.jcr.lock.LockManager;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.query.QueryManager;
+import javax.jcr.version.VersionManager;
+
 import org.apache.jackrabbit.oak.api.AuthInfo;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.ContentSession;
@@ -32,19 +47,6 @@ import org.apache.jackrabbit.oak.namepat
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.ItemExistsException;
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Workspace;
-import javax.jcr.lock.LockManager;
-import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.query.QueryManager;
-import javax.jcr.version.VersionManager;
-import java.io.IOException;
-
 public class SessionDelegate {
     static final Logger log = LoggerFactory.getLogger(SessionDelegate.class);
 
@@ -312,6 +314,7 @@ public class SessionDelegate {
     private class SessionNameMapper extends AbstractNameMapper {
 
         @Override
+        @CheckForNull
         protected String getJcrPrefix(String oakPrefix) {
             try {
                 String ns = nsRegistry.getURI(oakPrefix);
@@ -323,6 +326,7 @@ public class SessionDelegate {
         }
 
         @Override
+        @CheckForNull
         protected String getOakPrefix(String jcrPrefix) {
             try {
                 String ns = getSession().getNamespaceURI(jcrPrefix);
@@ -334,6 +338,7 @@ public class SessionDelegate {
         }
 
         @Override
+        @CheckForNull
         protected String getOakPrefixFromURI(String uri) {
             try {
                 return nsRegistry.getPrefix(uri);



Mime
View raw message