From d70f55e63c38331486249bdfdbd1234ce4bbeb09 Mon Sep 17 00:00:00 2001 From: Harvey Harrison <harvey.harrison@gmail.com> 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 <harvey.harrison@gmail.com> --- src/java/com/jogamp/common/util/ArrayHashSet.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/java/com/jogamp/common') 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<E> * @return a shallow copy of this ArrayHashSet, elements are not copied. */ public final Object clone() { - @SuppressWarnings("unchecked") - ArrayList<E> clonedList = (ArrayList<E>)data.clone(); + ArrayList<E> clonedList = new ArrayList<E>(data); ArrayHashSet<E> newObj = new ArrayHashSet<E>(); newObj.addAll(clonedList); @@ -375,9 +374,8 @@ public class ArrayHashSet<E> /** * @return a shallow copy of this ArrayHashSet's ArrayList, elements are not copied. */ - @SuppressWarnings("unchecked") public final ArrayList<E> toArrayList() { - return (ArrayList<E>) data.clone(); + return new ArrayList<E>(data); } /** -- cgit v1.2.3