From 761b2855b9c01c421ecd4d435a828a67b3a2471b Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Thu, 18 Oct 2012 09:00:36 +0200
Subject: Revert "Minor revert of clone replacement w/ copt-ctor of commit
 d7fb6a7bcfbd2d5ac452abdcdd31fb4d71441c70"

This reverts commit 73e8828566404e864170688dfb4fd530a83f8add.

Convinced after discussing semantics w/ Harvey Harrison:

"the copy-constructor is way for predictable (as in branch-predictable)
and has better cache behavior, it can issue almost all the writes in
parallel, and has no exception catching.

So, the copy-constructor actually ends up being more efficient, and
you get typechecking to boot."
---
 src/java/com/jogamp/gluegen/cgram/types/CompoundType.java | 3 +--
 src/java/com/jogamp/gluegen/cgram/types/EnumType.java     | 3 +--
 src/java/com/jogamp/gluegen/cgram/types/FunctionType.java | 5 ++---
 3 files changed, 4 insertions(+), 7 deletions(-)

(limited to 'src/java')

diff --git a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java
index 8893283..746212d 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java
@@ -71,11 +71,10 @@ public abstract class CompoundType extends MemoryLayoutType implements Cloneable
     }
   }
   
-  @SuppressWarnings("unchecked")
   public Object clone() {
     CompoundType n = (CompoundType) super.clone();
     if(null!=this.fields) {
-        n.fields = (ArrayList<Field>) this.fields.clone();
+        n.fields = new ArrayList<Field>(this.fields);
     }
     return n;
   }
diff --git a/src/java/com/jogamp/gluegen/cgram/types/EnumType.java b/src/java/com/jogamp/gluegen/cgram/types/EnumType.java
index 99d0f7e..d21774f 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/EnumType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/EnumType.java
@@ -85,14 +85,13 @@ public class EnumType extends IntType implements Cloneable {
         this.underlyingType = underlyingType;
     }
 
-    @SuppressWarnings("unchecked")
     public Object clone() {
         EnumType n = (EnumType) super.clone();
         if(null!=this.underlyingType) {
             n.underlyingType = (IntType) this.underlyingType.clone();
         }
         if(null!=this.enums) {
-            n.enums = (ArrayList<Enum>) this.enums.clone();
+            n.enums = new ArrayList<Enum>(this.enums);
         }
         return n;
     }
diff --git a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java
index ca625cb..fcaf97b 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java
@@ -54,14 +54,13 @@ public class FunctionType extends Type implements Cloneable {
         this.returnType = returnType;
     }
 
-    @SuppressWarnings("unchecked")
     public Object clone() {
         FunctionType n = (FunctionType) super.clone();
         if(null!=this.argumentTypes) {
-            n.argumentTypes = (ArrayList<Type>) this.argumentTypes.clone();
+            n.argumentTypes = new ArrayList<Type>(this.argumentTypes);
         }
         if(null!=this.argumentNames) {
-            n.argumentNames = (ArrayList<String>) this.argumentNames.clone();
+            n.argumentNames = new ArrayList<String>(this.argumentNames);
         }
         return n;
     }
-- 
cgit v1.2.3