subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r926184 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/ src/org/tigris/subversion/javahl/
Date Mon, 22 Mar 2010 16:57:47 GMT
Author: hwright
Date: Mon Mar 22 16:57:47 2010
New Revision: 926184

URL: http://svn.apache.org/viewvc?rev=926184&view=rev
Log:
JavaHL: Enum'ize the ConflictDescriptor's Operation.  I suspect this to be
the last one. :)

[ in subversion/bindings/javahl/ ]
* native/CreateJ.cpp
  (ConflictDescriptor): Update constructor signature, and use the java object
    to create the Operation argument.

* native/EnumMapper.h,
  native/EnumMapper.cpp
  (mapOperation): Update to return the proper Java object.

* src/org/apache/subversion/javahl/ConflictDescriptor.java
  (operation, ConflictDescriptor, getOperation): Update to use the enum type.
  (Operation): New.

* src/org/apache/subversion/javahl/Operation.java:
  Remove.

* src/org/tigris/subversion/javahl/ConflictDescriptor.java
  (ConflictDescriptor): Update the wrapper.

Removed:
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/Operation.java
Modified:
    subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
    subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp
    subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java
    subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ConflictDescriptor.java

Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp?rev=926184&r1=926183&r2=926184&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp Mon Mar 22 16:57:47 2010
@@ -59,7 +59,8 @@ CreateJ::ConflictDescriptor(const svn_wc
                               "L"JAVA_PACKAGE"/NodeKind;"
                               "Ljava/lang/String;ZLjava/lang/String;"
                               "L"JAVA_PACKAGE"/ConflictDescriptor$Action;"
-                              "L"JAVA_PACKAGE"/ConflictDescriptor$Reason;I"
+                              "L"JAVA_PACKAGE"/ConflictDescriptor$Reason;"
+                              "L"JAVA_PACKAGE"/ConflictDescriptor$Operation;"
                               "Ljava/lang/String;Ljava/lang/String;"
                               "Ljava/lang/String;Ljava/lang/String;"
                               "L"JAVA_PACKAGE"/ConflictVersion;"
@@ -107,13 +108,15 @@ CreateJ::ConflictDescriptor(const svn_wc
   jobject jconflictReason = EnumMapper::mapConflictReason(desc->reason);
   if (JNIUtil::isJavaExceptionThrown())
     POP_AND_RETURN_NULL;
+  jobject joperation = EnumMapper::mapOperation(desc->operation);
+  if (JNIUtil::isJavaExceptionThrown())
+    POP_AND_RETURN_NULL;
 
   // Instantiate the conflict descriptor.
   jobject jdesc = env->NewObject(clazz, ctor, jpath, jconflictKind,
                                  jnodeKind, jpropertyName,
                                  (jboolean) desc->is_binary, jmimeType,
-                                 jconflictAction, jconflictReason,
-                                 EnumMapper::mapOperation(desc->operation),
+                                 jconflictAction, jconflictReason, joperation,
                                  jbasePath, jreposPath, juserPath,
                                  jmergedPath, jsrcLeft, jsrcRight);
   if (JNIUtil::isJavaExceptionThrown())

Modified: subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp?rev=926184&r1=926183&r2=926184&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp Mon Mar 22 16:57:47
2010
@@ -31,8 +31,6 @@
 #include "JNIUtil.h"
 #include "JNIStringHolder.h"
 #include "../include/org_apache_subversion_javahl_CommitItemStateFlags.h"
-#include "../include/org_apache_subversion_javahl_Operation.h"
-#include "../include/org_apache_subversion_javahl_Revision.h"
 
 /**
  * Map a C commit state flag constant to the Java constant.
@@ -156,20 +154,10 @@ jobject EnumMapper::mapDepth(svn_depth_t
   return mapEnum(JAVA_PACKAGE"/Depth", ((int) depth) + 2);
 }
 
-jint EnumMapper::mapOperation(svn_wc_operation_t operation)
+jobject EnumMapper::mapOperation(svn_wc_operation_t operation)
 {
-  switch (operation)
-    {
-    case svn_wc_operation_none:
-    default:
-      return org_apache_subversion_javahl_Operation_none;
-    case svn_wc_operation_update:
-      return org_apache_subversion_javahl_Operation_update;
-    case svn_wc_operation_switch:
-      return org_apache_subversion_javahl_Operation_switched;
-    case svn_wc_operation_merge:
-      return org_apache_subversion_javahl_Operation_merge;
-    }
+  // We're assuming a valid value for the C enum above
+  return mapEnum(JAVA_PACKAGE"/ConflictDescriptor$Operation", (int) operation);
 }
 
 jobject EnumMapper::mapTristate(svn_tristate_t tristate)

Modified: subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h?rev=926184&r1=926183&r2=926184&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h Mon Mar 22 16:57:47 2010
@@ -60,7 +60,7 @@ class EnumMapper
   static jobject mapConflictAction(svn_wc_conflict_action_t action);
   static jobject mapConflictReason(svn_wc_conflict_reason_t reason);
   static jobject mapDepth(svn_depth_t depth);
-  static jint mapOperation(svn_wc_operation_t);
+  static jobject mapOperation(svn_wc_operation_t);
   static jobject mapTristate(svn_tristate_t);
   static jobject mapSummarizeKind(svn_client_diff_summarize_kind_t);
  private:

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java?rev=926184&r1=926183&r2=926184&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java
Mon Mar 22 16:57:47 2010
@@ -59,7 +59,7 @@ public class ConflictDescriptor
     /**
      * @see Operation
      */
-    private int operation;
+    private Operation operation;
 
     /**
      * @see ConflictVersion
@@ -74,7 +74,7 @@ public class ConflictDescriptor
     /** This constructor should only be called from JNI code. */
     public ConflictDescriptor(String path, Kind conflictKind, NodeKind nodeKind,
                        String propertyName, boolean isBinary, String mimeType,
-                       Action action, Reason reason, int operation,
+                       Action action, Reason reason, Operation operation,
                        String basePath, String theirPath,
                        String myPath, String mergedPath,
                        ConflictVersion srcLeft, ConflictVersion srcRight)
@@ -156,7 +156,7 @@ public class ConflictDescriptor
         return mergedPath;
     }
 
-    public int getOperation()
+    public Operation getOperation()
     {
         return operation;
     }
@@ -243,4 +243,21 @@ public class ConflictDescriptor
          */
         added;
     }
+
+    public enum Operation
+    {
+        /* none */
+        none,
+
+        /* update */
+        update,
+
+        /* switch */
+        /* Note: this is different that svn_wc.h, because 'switch' is a
+        * reserved word in java  :(  */
+        switched,
+
+        /* merge */
+        merge;
+    }
 }

Modified: subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ConflictDescriptor.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ConflictDescriptor.java?rev=926184&r1=926183&r2=926184&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ConflictDescriptor.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ConflictDescriptor.java
Mon Mar 22 16:57:47 2010
@@ -123,8 +123,8 @@ public class ConflictDescriptor
              NodeKind.fromApache(aDesc.getNodeKind()),
              aDesc.getPropertyName(), aDesc.isBinary(), aDesc.getMIMEType(),
              aDesc.getAction().ordinal(), aDesc.getReason().ordinal(),
-             aDesc.getOperation(), aDesc.getBasePath(), aDesc.getTheirPath(),
-             aDesc.getMyPath(), aDesc.getMergedPath(),
+             aDesc.getOperation().ordinal(), aDesc.getBasePath(),
+             aDesc.getTheirPath(), aDesc.getMyPath(), aDesc.getMergedPath(),
              new ConflictVersion(aDesc.getSrcLeftVersion()),
              new ConflictVersion(aDesc.getSrcRightVersion()));
     }



Mime
View raw message