src/share/classes/java/util/EnumSet.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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,13 +356,16 @@
/**
* Returns a copy of this set.
*
* @return a copy of this set
*/
+ @Override
public EnumSet<E> clone() {
try {
- return (EnumSet<E>) super.clone();
+ @SuppressWarnings("unchecked")
+ EnumSet<E> clone = (EnumSet<E>) super.clone();
+ return clone;
} catch(CloneNotSupportedException e) {
throw new AssertionError(e);
}
}
@@ -373,11 +376,11 @@
/**
* Throws an exception if e is not of the correct type for this enum set.
*/
final void typeCheck(E e) {
- Class eClass = e.getClass();
+ Class<?> eClass = e.getClass();
if (eClass != elementType && eClass.getSuperclass() != elementType)
throw new ClassCastException(eClass + " != " + elementType);
}
/**