ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [34/50] [abbrv] incubator-ignite git commit: ignite-nio - Removing message clone
Date Sun, 15 Feb 2015 08:42:16 GMT
ignite-nio - Removing message clone


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5085e468
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5085e468
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5085e468

Branch: refs/heads/sprint-1
Commit: 5085e46810534f4e536b1c3f2e85466ea2f2a5a9
Parents: af8edc0
Author: Valentin Kulichenko <vkulichenko@gridgain.com>
Authored: Sat Feb 14 22:41:33 2015 -0800
Committer: Valentin Kulichenko <vkulichenko@gridgain.com>
Committed: Sat Feb 14 22:41:33 2015 -0800

----------------------------------------------------------------------
 .../CommunicationMessageCodeGenerator.java      | 71 +-------------------
 1 file changed, 1 insertion(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5085e468/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java
b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java
index 0a1d6de..aca45a8 100644
--- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java
+++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java
@@ -113,12 +113,6 @@ public class CommunicationMessageCodeGenerator {
     private final Collection<String> read = new ArrayList<>();
 
     /** */
-    private final Collection<String> clone = new ArrayList<>();
-
-    /** */
-    private final Collection<String> clone0 = new ArrayList<>();
-
-    /** */
     private final Map<Class<?>, Integer> fieldCnt = new HashMap<>();
 
     /** */
@@ -196,8 +190,6 @@ public class CommunicationMessageCodeGenerator {
 
             boolean writeFound = false;
             boolean readFound = false;
-            boolean cloneFound = false;
-            boolean clone0Found = false;
 
             while ((line = rdr.readLine()) != null) {
                 if (!skip) {
@@ -217,20 +209,6 @@ public class CommunicationMessageCodeGenerator {
 
                         readFound = true;
                     }
-                    else if (line.contains("public MessageAdapter clone()")) {
-                        src.addAll(clone);
-
-                        skip = true;
-
-                        cloneFound = true;
-                    }
-                    else if (line.contains("protected void clone0(MessageAdapter _msg)"))
{
-                        src.addAll(clone0);
-
-                        skip = true;
-
-                        clone0Found = true;
-                    }
                 }
                 else if (line.startsWith(TAB + "}")) {
                     src.add(line);
@@ -244,12 +222,6 @@ public class CommunicationMessageCodeGenerator {
 
             if (!readFound)
                 System.out.println("    readFrom method doesn't exist.");
-
-            if (!cloneFound)
-                System.out.println("    clone method doesn't exist.");
-
-            if (!clone0Found)
-                System.out.println("    clone0 method doesn't exist.");
         }
         finally {
             if (rdr != null)
@@ -281,8 +253,6 @@ public class CommunicationMessageCodeGenerator {
 
         write.clear();
         read.clear();
-        clone.clear();
-        clone0.clear();
 
         fields = new ArrayList<>();
 
@@ -301,46 +271,6 @@ public class CommunicationMessageCodeGenerator {
 
         boolean hasSuper = cls.getSuperclass() != BASE_CLS;
 
-        String clsName = cls.getSimpleName();
-
-        if (!Modifier.isAbstract(cls.getModifiers())) {
-            clone.add(builder().a("throw new UnsupportedOperationException();").toString());
-
-//            clone.add(builder().a(clsName).a(" _clone = new ").a(clsName).a("();").toString());
-//            clone.add(EMPTY);
-//            clone.add(builder().a("clone0(_clone);").toString());
-//            clone.add(EMPTY);
-//            clone.add(builder().a("return _clone;").toString());
-        }
-
-        if (hasSuper) {
-            clone0.add(builder().a("super.clone0(_msg);").toString());
-            clone0.add(EMPTY);
-        }
-
-        Collection<Field> cloningFields = new ArrayList<>(declaredFields.length);
-
-        for (Field field: declaredFields)
-            if (!isStatic(field.getModifiers()))
-                cloningFields.add(field);
-
-        if (!cloningFields.isEmpty()) {
-            clone0.add(builder().a(clsName).a(" _clone = (").a(clsName).a(")_msg;").toString());
-            clone0.add(EMPTY);
-
-            for (Field field : cloningFields) {
-                String name = field.getName();
-                Class<?> type = field.getType();
-
-                String res = name;
-
-                if (BASE_CLS.isAssignableFrom(type))
-                    res = name + " != null ? (" + type.getSimpleName() + ")" + name + ".clone()
: null";
-
-                clone0.add(builder().a("_clone.").a(name).a(" = ").a(res).a(";").toString());
-            }
-        }
-
         start(write, hasSuper ? "writeTo" : null, true);
         start(read, hasSuper ? "readFrom" : null, false);
 
@@ -802,6 +732,7 @@ public class CommunicationMessageCodeGenerator {
      * @param col Classes.
      * @throws Exception In case of error.
      */
+    @SuppressWarnings("unchecked")
     private void processFile(File file, ClassLoader ldr, int prefixLen,
         Collection<Class<? extends MessageAdapter>> col) throws Exception {
         assert file != null;


Mime
View raw message