Updated EmulSet to throw an explicit NPE instead of an implicit JavaScriptException. This fixes some failing unit tets. Patch by: scottb, tobyr (pair prog) git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1727 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/super/com/google/gwt/emul/java/lang/Enum.java b/user/super/com/google/gwt/emul/java/lang/Enum.java index 0a2a5b2..c0efe0b 100644 --- a/user/super/com/google/gwt/emul/java/lang/Enum.java +++ b/user/super/com/google/gwt/emul/java/lang/Enum.java
@@ -1,5 +1,5 @@ /* - * Copyright 2007 Google Inc. + * Copyright 2008 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -52,7 +52,7 @@ public final int compareTo(E other) { // TODO: will a bridge method do the cast for us? - // if (GWT.getTypeName(this) != GWT.getTypeName(other)) { + // if (this.getDeclaringClass() != other.getDeclaringClass()) { // throw new ClassCastException(); // } return this.ordinal - other.ordinal;
diff --git a/user/super/com/google/gwt/emul/java/util/EnumSet.java b/user/super/com/google/gwt/emul/java/util/EnumSet.java index de65752..41789b8 100644 --- a/user/super/com/google/gwt/emul/java/util/EnumSet.java +++ b/user/super/com/google/gwt/emul/java/util/EnumSet.java
@@ -1,5 +1,5 @@ /* - * Copyright 2007 Google Inc. + * Copyright 2008 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -195,7 +195,9 @@ @Override public boolean add(E o) { - // Throws NullPointerException according to spec + if (o == null) { + throw new NullPointerException("Can't add null to an EnumSet"); + } int value = 1 << o.ordinal(); boolean exists = (enumValues & value) != 0; enumValues |= value;