From d70f55e63c38331486249bdfdbd1234ce4bbeb09 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Wed, 3 Apr 2013 23:30:53 -0700 Subject: gluegen: use explicit ArrayList constructor to avoid @SuppressWarnings and clone() ArrayList.clone does _not_ make a shallow copy, a new internal array is allocated. As such, there is nearly no benefit to using clone(). Signed-off-by: Harvey Harrison --- src/java/com/jogamp/common/util/ArrayHashSet.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/java/com/jogamp/common/util/ArrayHashSet.java b/src/java/com/jogamp/common/util/ArrayHashSet.java index 0f5f65b..630e2af 100644 --- a/src/java/com/jogamp/common/util/ArrayHashSet.java +++ b/src/java/com/jogamp/common/util/ArrayHashSet.java @@ -94,8 +94,7 @@ public class ArrayHashSet * @return a shallow copy of this ArrayHashSet, elements are not copied. */ public final Object clone() { - @SuppressWarnings("unchecked") - ArrayList clonedList = (ArrayList)data.clone(); + ArrayList clonedList = new ArrayList(data); ArrayHashSet newObj = new ArrayHashSet(); newObj.addAll(clonedList); @@ -375,9 +374,8 @@ public class ArrayHashSet /** * @return a shallow copy of this ArrayHashSet's ArrayList, elements are not copied. */ - @SuppressWarnings("unchecked") public final ArrayList toArrayList() { - return (ArrayList) data.clone(); + return new ArrayList(data); } /** -- cgit v1.2.3