diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2012-10-15 23:49:08 -0700 |
---|---|---|
committer | Harvey Harrison <harvey.harrison@gmail.com> | 2012-10-15 23:50:31 -0700 |
commit | d7fb6a7bcfbd2d5ac452abdcdd31fb4d71441c70 (patch) | |
tree | 566fdbf1325861a2ae50a215dc7c9961b223d434 /src/java/com/jogamp/gluegen/cgram | |
parent | 33ffe6769081401741813507ab01faa5ede80eae (diff) |
gluegen: generics annotations for various ArrayList/List use
- Use the copy constructor rather than ArrayList.clone()
- constrain listsEqual so the compiler will warn about comparing lists of different types
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Diffstat (limited to 'src/java/com/jogamp/gluegen/cgram')
4 files changed, 5 insertions, 5 deletions
diff --git a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java index a4b419f..746212d 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java @@ -74,7 +74,7 @@ public abstract class CompoundType extends MemoryLayoutType implements Cloneable public Object clone() { CompoundType n = (CompoundType) super.clone(); if(null!=this.fields) { - n.fields = (ArrayList) 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 7967ba0..d21774f 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/EnumType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/EnumType.java @@ -91,7 +91,7 @@ public class EnumType extends IntType implements Cloneable { n.underlyingType = (IntType) this.underlyingType.clone(); } if(null!=this.enums) { - n.enums = (ArrayList) 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 4c908dc..fcaf97b 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java @@ -57,10 +57,10 @@ public class FunctionType extends Type implements Cloneable { public Object clone() { FunctionType n = (FunctionType) super.clone(); if(null!=this.argumentTypes) { - n.argumentTypes = (ArrayList) this.argumentTypes.clone(); + n.argumentTypes = new ArrayList<Type>(this.argumentTypes); } if(null!=this.argumentNames) { - n.argumentNames = (ArrayList) this.argumentNames.clone(); + n.argumentNames = new ArrayList<String>(this.argumentNames); } return n; } diff --git a/src/java/com/jogamp/gluegen/cgram/types/Type.java b/src/java/com/jogamp/gluegen/cgram/types/Type.java index 281f35c..cffbb67 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/Type.java +++ b/src/java/com/jogamp/gluegen/cgram/types/Type.java @@ -269,7 +269,7 @@ public abstract class Type implements Cloneable { } /** Helper routine for list equality comparison */ - static boolean listsEqual(List a, List b) { + static <C> boolean listsEqual(List<C> a, List<C> b) { return ((a == null && b == null) || (a != null && b != null && a.equals(b))); } } |