geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject [28/51] [abbrv] geronimo-yoko git commit: Re-fix typeCode generation
Date Sun, 19 Feb 2017 01:49:45 GMT
Re-fix typeCode generation


Project: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/repo
Commit: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/commit/c4cb4e48
Tree: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/tree/c4cb4e48
Diff: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/diff/c4cb4e48

Branch: refs/heads/master
Commit: c4cb4e482b5bd9d7dac95ce37b9ad32172c7c2c0
Parents: 022ef4c
Author: Neil GM Richards <neil_richards@uk.ibm.com>
Authored: Sun Mar 27 00:08:39 2016 +0000
Committer: Neil GM Richards <neil_richards@uk.ibm.com>
Committed: Sun Mar 27 00:08:39 2016 +0000

----------------------------------------------------------------------
 yoko-core/pom.xml                                 |  3 +--
 .../apache/yoko/rmi/impl/SimpleDescriptor.java    | 12 ++++++------
 .../org/apache/yoko/rmi/impl/TypeDescriptor.java  |  9 ++++++++-
 .../org/apache/yoko/rmi/impl/ValueDescriptor.java | 18 +++++++++---------
 4 files changed, 24 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/c4cb4e48/yoko-core/pom.xml
----------------------------------------------------------------------
diff --git a/yoko-core/pom.xml b/yoko-core/pom.xml
index 54af256..dfe3cf7 100644
--- a/yoko-core/pom.xml
+++ b/yoko-core/pom.xml
@@ -131,8 +131,7 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
-                    <argLine>-Xmx128m</argLine>
-                    <argLine>-Djava.endorsed.dirs=${project.build.directory}/endorsed</argLine>
+                    <argLine>-Xmx128m -Djava.endorsed.dirs=${project.build.directory}/endorsed</argLine>
                     <includes>
                         <include>**/org/apache/yoko/*Test.java</include>
                     </includes>

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/c4cb4e48/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/SimpleDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/SimpleDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/SimpleDescriptor.java
index f51ee0b..fe3df2c 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/SimpleDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/SimpleDescriptor.java
@@ -18,17 +18,17 @@
 
 package org.apache.yoko.rmi.impl;
 
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
 import org.omg.CORBA.TypeCode;
 
 abstract class SimpleDescriptor extends TypeDescriptor {
     private final String idl_name;
-    SimpleDescriptor(Class type, TypeRepository repository, String idl_name,
-            org.omg.CORBA.TCKind tc) {
+    private final TCKind tc;
+    SimpleDescriptor(Class type, TypeRepository repository, String idl_name, TCKind tc) {
         super(type, repository);
         this.idl_name = idl_name;
-
-        org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
-        _type_code = orb.get_primitive_tc(tc);
+        this.tc = tc;
     }
 
     @Override
@@ -48,7 +48,7 @@ abstract class SimpleDescriptor extends TypeDescriptor {
 
     @Override
     protected final TypeCode genTypeCode() {
-        return _type_code;
+        return ORB.init().get_primitive_tc(tc);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/c4cb4e48/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeDescriptor.java
index 3bbabf2..ed66893 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeDescriptor.java
@@ -206,14 +206,21 @@ abstract class TypeDescriptor extends ModelElement {
         return 0L;
     }
 
-    protected TypeCode _type_code = null;
+    @Override
+    protected void init() {
+        typeCode = genTypeCode();
+    }
 
     private volatile TypeCode typeCode = null;
     protected abstract TypeCode genTypeCode();
     final TypeCode getTypeCode() {
+        // typeCode should have already been set from within init(), so this is just defensive
         if (null == typeCode) typeCode = genTypeCode();
         return typeCode;
     }
+    protected final void setTypeCode(TypeCode tc) {
+        typeCode = tc;
+    }
 
     Object copyObject(Object value, CopyState state) {
         throw new InternalError("cannot copy " + value.getClass().getName());

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/c4cb4e48/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java
index 0d2a3e8..e6b1849 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java
@@ -839,21 +839,21 @@ class ValueDescriptor extends TypeDescriptor {
     @Override
     protected TypeCode genTypeCode() {
         ORB orb = ORB.init();
-        TypeCode typeCode = orb.create_recursive_tc(getRepositoryID());
+        setTypeCode(orb.create_recursive_tc(getRepositoryID()));
 
         TypeCode _base = ((_super_descriptor == null) ? null : _super_descriptor.getTypeCode());
 
-        Class javaClass = type;
-        if (javaClass.isArray()) {
-            TypeDescriptor desc = repo.getDescriptor(javaClass.getComponentType());
-            typeCode = desc.getTypeCode();
-            typeCode = orb.create_sequence_tc(0, typeCode);
-            typeCode = orb.create_value_box_tc(getRepositoryID(), "Sequence", typeCode);
+        TypeCode tc;
+        if (type.isArray()) {
+            TypeDescriptor desc = repo.getDescriptor(type.getComponentType());
+            tc = desc.getTypeCode();
+            tc = orb.create_sequence_tc(0, tc);
+            tc = orb.create_value_box_tc(getRepositoryID(), "Sequence", tc);
         } else {
-            typeCode = orb.create_value_tc(getRepositoryID(), javaClass.getSimpleName(),
VM_NONE.value, _base, getValueMembers());
+            tc = orb.create_value_tc(getRepositoryID(), type.getSimpleName(), VM_NONE.value,
_base, getValueMembers());
         }
 
-        return typeCode;
+        return tc;
     }
 
     private static final OperationDescription[] ZERO_OPERATIONS = {};


Mime
View raw message