src/share/classes/java/util/EnumSet.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 356,368 **** /** * Returns a copy of this set. * * @return a copy of this set */ public EnumSet<E> clone() { try { ! return (EnumSet<E>) super.clone(); } catch(CloneNotSupportedException e) { throw new AssertionError(e); } } --- 356,371 ---- /** * Returns a copy of this set. * * @return a copy of this set */ + @Override public EnumSet<E> clone() { try { ! @SuppressWarnings("unchecked") ! EnumSet<E> clone = (EnumSet<E>) super.clone(); ! return clone; } catch(CloneNotSupportedException e) { throw new AssertionError(e); } }
*** 373,383 **** /** * Throws an exception if e is not of the correct type for this enum set. */ final void typeCheck(E e) { ! Class eClass = e.getClass(); if (eClass != elementType && eClass.getSuperclass() != elementType) throw new ClassCastException(eClass + " != " + elementType); } /** --- 376,386 ---- /** * Throws an exception if e is not of the correct type for this enum set. */ final void typeCheck(E e) { ! Class<?> eClass = e.getClass(); if (eClass != elementType && eClass.getSuperclass() != elementType) throw new ClassCastException(eClass + " != " + elementType); } /**