Merge
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index aee7617..335c439 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -10,3 +10,4 @@
 bb1ef4ee3d2c8cbf43a37d372325a7952be590b9 jdk7-b33
 46a989ab932992b2084b946eeb322fa99b9fee6c jdk7-b34
 143c1abedb7d3095eff0f9ee5fec9bf48e3490fc jdk7-b35
+4b4f5fea8d7d0743f0c30d91fcd9bf9d96e5d2ad jdk7-b36
diff --git a/corba/.hgtags b/corba/.hgtags
index 26b7114..dcc46de 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -10,3 +10,4 @@
 6a5b9d2f8b20de54e3bfe33cd12bd0793caedc4e jdk7-b33
 0a812b9824e5d17b073765d1505594b49ff88a10 jdk7-b34
 3867c4d14a5bfdbb37c97b4874ccb0ee5343111c jdk7-b35
+0723891eb8d1c27e67c54163af0b4cea05a4e036 jdk7-b36
diff --git a/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_dynamicany.jmk b/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_dynamicany.jmk
index 3083e94..a3a4ffb 100644
--- a/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_dynamicany.jmk
+++ b/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_dynamicany.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_encoding.jmk b/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_encoding.jmk
index cce82f8..84f725c 100644
--- a/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_encoding.jmk
+++ b/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_encoding.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_ior.jmk b/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_ior.jmk
index 3b155f9..c4cddea 100644
--- a/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_ior.jmk
+++ b/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_ior.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2004 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk b/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk
index ee09206..871b48d 100644
--- a/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk
+++ b/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_protocol.jmk b/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_protocol.jmk
index 269f82c..0a6b350 100644
--- a/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_protocol.jmk
+++ b/corba/make/com/sun/corba/minclude/com_sun_corba_se_impl_protocol.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2002-2003 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_legacy_interceptor.jmk b/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_legacy_interceptor.jmk
index 8995ec9..156eb29 100644
--- a/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_legacy_interceptor.jmk
+++ b/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_legacy_interceptor.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_monitoring.jmk b/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_monitoring.jmk
index 15259a7..6a423c0 100644
--- a/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_monitoring.jmk
+++ b/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_monitoring.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_presentation_rmi.jmk b/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_presentation_rmi.jmk
index e5a564a..d6e5e7f 100644
--- a/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_presentation_rmi.jmk
+++ b/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_presentation_rmi.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_transport.jmk b/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_transport.jmk
index d3982c6..68f68ba 100644
--- a/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_transport.jmk
+++ b/corba/make/com/sun/corba/minclude/com_sun_corba_se_spi_transport.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2002-2004 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/minclude/org_omg_CosNaming.jmk b/corba/make/com/sun/corba/minclude/org_omg_CosNaming.jmk
index 2b48fd5..0cff6b0 100644
--- a/corba/make/com/sun/corba/minclude/org_omg_CosNaming.jmk
+++ b/corba/make/com/sun/corba/minclude/org_omg_CosNaming.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 1997-2002 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/minclude/org_omg_DynamicAny.jmk b/corba/make/com/sun/corba/minclude/org_omg_DynamicAny.jmk
index d9d7b3a..d9e7c1f 100644
--- a/corba/make/com/sun/corba/minclude/org_omg_DynamicAny.jmk
+++ b/corba/make/com/sun/corba/minclude/org_omg_DynamicAny.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2002 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/minclude/org_omg_PortableInterceptor.jmk b/corba/make/com/sun/corba/minclude/org_omg_PortableInterceptor.jmk
index d41e2c8..5f0a661 100644
--- a/corba/make/com/sun/corba/minclude/org_omg_PortableInterceptor.jmk
+++ b/corba/make/com/sun/corba/minclude/org_omg_PortableInterceptor.jmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/com/sun/corba/se/sources/Makefile b/corba/make/com/sun/corba/se/sources/Makefile
index 370ade5..624661e 100644
--- a/corba/make/com/sun/corba/se/sources/Makefile
+++ b/corba/make/com/sun/corba/se/sources/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/javax/xa/Makefile b/corba/make/javax/xa/Makefile
index 3345237..6efdbe1 100644
--- a/corba/make/javax/xa/Makefile
+++ b/corba/make/javax/xa/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/corba/make/org/omg/CORBA/Makefile b/corba/make/org/omg/CORBA/Makefile
index 2a07500..1106602 100644
--- a/corba/make/org/omg/CORBA/Makefile
+++ b/corba/make/org/omg/CORBA/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1997-2004 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 0853b83..cf2a234 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -10,3 +10,4 @@
 585535ec8a14adafa6bfea65d6975e29094c8cec jdk7-b33
 5251a9cd8eb8743eee647365bee1c8afdc131556 jdk7-b34
 5fa96a5a7e76da7c8dad12486293a0456c2c116c jdk7-b35
+e91159f921a58af3698e6479ea1fc5818da66d09 jdk7-b36
diff --git a/hotspot/agent/make/bugspot.bat b/hotspot/agent/make/bugspot.bat
index c3330f0..07f4075 100644
--- a/hotspot/agent/make/bugspot.bat
+++ b/hotspot/agent/make/bugspot.bat
@@ -1,5 +1,5 @@
 REM
-REM Copyright 2002-2003 Sun Microsystems, Inc.  All Rights Reserved.
+REM Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
 REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 REM
 REM This code is free software; you can redistribute it and/or modify it
diff --git a/hotspot/agent/make/build.xml b/hotspot/agent/make/build.xml
index caad5c7..d6f407e 100644
--- a/hotspot/agent/make/build.xml
+++ b/hotspot/agent/make/build.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/agent/make/hsdb.bat b/hotspot/agent/make/hsdb.bat
index 9d43517..6b5cd35 100644
--- a/hotspot/agent/make/hsdb.bat
+++ b/hotspot/agent/make/hsdb.bat
@@ -1,5 +1,5 @@
 REM
-REM Copyright 2002-2003 Sun Microsystems, Inc.  All Rights Reserved.
+REM Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
 REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 REM
 REM This code is free software; you can redistribute it and/or modify it
diff --git a/hotspot/agent/make/hsdb.sh b/hotspot/agent/make/hsdb.sh
index 4dd1108..3e5e8b4 100644
--- a/hotspot/agent/make/hsdb.sh
+++ b/hotspot/agent/make/hsdb.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright 2002-2003 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/agent/make/saenv.bat b/hotspot/agent/make/saenv.bat
index 0bb3704..aa5b927 100644
--- a/hotspot/agent/make/saenv.bat
+++ b/hotspot/agent/make/saenv.bat
@@ -1,6 +1,6 @@
 @echo off
 REM
-REM Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+REM Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
 REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 REM
 REM This code is free software; you can redistribute it and/or modify it
diff --git a/hotspot/agent/make/saenv.sh b/hotspot/agent/make/saenv.sh
index d0b12c5..38e0f78 100644
--- a/hotspot/agent/make/saenv.sh
+++ b/hotspot/agent/make/saenv.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/agent/make/saenv64.bat b/hotspot/agent/make/saenv64.bat
index 3057952..ef16f03 100644
--- a/hotspot/agent/make/saenv64.bat
+++ b/hotspot/agent/make/saenv64.bat
@@ -1,6 +1,6 @@
 @echo off
 REM
-REM Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+REM Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
 REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 REM
 REM This code is free software; you can redistribute it and/or modify it
diff --git a/hotspot/agent/make/saenv64.sh b/hotspot/agent/make/saenv64.sh
index 487004d..a443cb1 100644
--- a/hotspot/agent/make/saenv64.sh
+++ b/hotspot/agent/make/saenv64.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/CompiledVFrame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/CompiledVFrame.java
index dc0f9d4..1642fef 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/CompiledVFrame.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/CompiledVFrame.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
index e50b6b2..5419b2c 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PermStat.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PermStat.java
index d2346a3..159e2f6 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PermStat.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PermStat.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.inline.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.inline.hpp
index 27c2b6a..c4fe7df 100644
--- a/hotspot/src/cpu/x86/vm/assembler_x86.inline.hpp
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp
index 283a63d..2f39485 100644
--- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/c1_Defs_x86.hpp b/hotspot/src/cpu/x86/vm/c1_Defs_x86.hpp
index e8d3e8b..633e539 100644
--- a/hotspot/src/cpu/x86/vm/c1_Defs_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/c1_Defs_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp
index a48a857..b0f7ec9 100644
--- a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp
index d5d9816..65671c3 100644
--- a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.hpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.hpp
index 41747a1..d364010 100644
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.hpp b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.hpp
index 73510cd..ee23a87 100644
--- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.hpp b/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.hpp
index d0b4230..bbd5aad 100644
--- a/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
index 01a2321..9f36305 100644
--- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp
index a829cb3..ecaa3ec 100644
--- a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/dump_x86_32.cpp b/hotspot/src/cpu/x86/vm/dump_x86_32.cpp
index 8bb427e..a31f915 100644
--- a/hotspot/src/cpu/x86/vm/dump_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/dump_x86_32.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/dump_x86_64.cpp b/hotspot/src/cpu/x86/vm/dump_x86_64.cpp
index 3a8b02e..ef64f7d 100644
--- a/hotspot/src/cpu/x86/vm/dump_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/dump_x86_64.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/icache_x86.cpp b/hotspot/src/cpu/x86/vm/icache_x86.cpp
index f489262..58b8f2f 100644
--- a/hotspot/src/cpu/x86/vm/icache_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/icache_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp
index 3e6e35e..78f0f12 100644
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.hpp b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.hpp
index be3dee6..247f4ec 100644
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.hpp
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.hpp b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.hpp
index 3267b48..62396c9 100644
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.hpp
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp b/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp
index 34bf835..96a1c30 100644
--- a/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/interpreterRT_x86_64.cpp b/hotspot/src/cpu/x86/vm/interpreterRT_x86_64.cpp
index 9938190..e3c8c6b 100644
--- a/hotspot/src/cpu/x86/vm/interpreterRT_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/interpreterRT_x86_64.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp
index cb24f12..221cd85 100644
--- a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp b/hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp
index d362b28..f963758 100644
--- a/hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp b/hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp
index 53204e7..b18a2c3 100644
--- a/hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/runtime_x86_32.cpp b/hotspot/src/cpu/x86/vm/runtime_x86_32.cpp
index 108bbee..72870e1 100644
--- a/hotspot/src/cpu/x86/vm/runtime_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/runtime_x86_32.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
index 00b1fa7..ad2606e 100644
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp
index 2bd98ac..d46d510 100644
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp
index d1943f3..57e7553 100644
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp
index aaf91ca..a3483cf 100644
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp
index 37342b8..7cf06f4 100644
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
index 093d404..ca186af 100644
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.hpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.hpp
index f02b9b1..8625720 100644
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.hpp
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp
index cfa1edd..c077929 100644
--- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/os/solaris/vm/osThread_solaris.cpp b/hotspot/src/os/solaris/vm/osThread_solaris.cpp
index ea8b6fb..1497427 100644
--- a/hotspot/src/os/solaris/vm/osThread_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/osThread_solaris.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/assembler_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/assembler_solaris_sparc.cpp
index caab18f..a1ddb4c 100644
--- a/hotspot/src/os_cpu/solaris_sparc/vm/assembler_solaris_sparc.cpp
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/assembler_solaris_sparc.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.ad b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.ad
index 549f7b0..911a8ad 100644
--- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.ad
+++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.ad
@@ -1,5 +1,5 @@
 //
-// Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+// Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
index ff8cdd6..27b6af9 100644
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/asm/assembler.cpp b/hotspot/src/share/vm/asm/assembler.cpp
index dcf1f0d..34ae81c 100644
--- a/hotspot/src/share/vm/asm/assembler.cpp
+++ b/hotspot/src/share/vm/asm/assembler.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.cpp b/hotspot/src/share/vm/c1/c1_FrameMap.cpp
index 465b6d1..970dad4 100644
--- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp
+++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/c1/c1_LIR.hpp b/hotspot/src/share/vm/c1/c1_LIR.hpp
index 15a095d..d263b4e 100644
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp
index 1a0dac7..48f76fd 100644
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
index 12adf1b..1cbf564 100644
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
index 6fe213e..2098993 100644
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.cpp b/hotspot/src/share/vm/c1/c1_LinearScan.cpp
index 2224614..328c2e1 100644
--- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.hpp b/hotspot/src/share/vm/c1/c1_LinearScan.hpp
index 10487b0..40a42e7 100644
--- a/hotspot/src/share/vm/c1/c1_LinearScan.hpp
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.hpp b/hotspot/src/share/vm/ci/ciTypeFlow.hpp
index 9b5193b..f095d66 100644
--- a/hotspot/src/share/vm/ci/ciTypeFlow.hpp
+++ b/hotspot/src/share/vm/ci/ciTypeFlow.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/code/relocInfo.hpp b/hotspot/src/share/vm/code/relocInfo.hpp
index 36006e8..4cbdfd8 100644
--- a/hotspot/src/share/vm/code/relocInfo.hpp
+++ b/hotspot/src/share/vm/code/relocInfo.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
index d42d4fc..40a1d9a 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
index 71b80fb..b5cf4d3 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp
index 7e1d3081..f7fadd7 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp
index 001f579..523103f 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp
index 4fad1bc..7ff3e27 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp
index a6596e7..affc3e4 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp
index ccd11c4..4e5643b 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.hpp b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.hpp
index 7298c47..9566512 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/includeDB_features b/hotspot/src/share/vm/includeDB_features
index 6effcca..7db5dc0 100644
--- a/hotspot/src/share/vm/includeDB_features
+++ b/hotspot/src/share/vm/includeDB_features
@@ -1,5 +1,5 @@
 //
-// Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+// Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/memory/blockOffsetTable.hpp b/hotspot/src/share/vm/memory/blockOffsetTable.hpp
index be9ec01..3d271aa 100644
--- a/hotspot/src/share/vm/memory/blockOffsetTable.hpp
+++ b/hotspot/src/share/vm/memory/blockOffsetTable.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/memory/compactingPermGenGen.hpp b/hotspot/src/share/vm/memory/compactingPermGenGen.hpp
index 3a12a88..913f172 100644
--- a/hotspot/src/share/vm/memory/compactingPermGenGen.hpp
+++ b/hotspot/src/share/vm/memory/compactingPermGenGen.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/opto/block.cpp b/hotspot/src/share/vm/opto/block.cpp
index be861b6..e74eca8 100644
--- a/hotspot/src/share/vm/opto/block.cpp
+++ b/hotspot/src/share/vm/opto/block.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/opto/callGenerator.cpp b/hotspot/src/share/vm/opto/callGenerator.cpp
index 72b04c5..8ce7c0c 100644
--- a/hotspot/src/share/vm/opto/callGenerator.cpp
+++ b/hotspot/src/share/vm/opto/callGenerator.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/opto/coalesce.cpp b/hotspot/src/share/vm/opto/coalesce.cpp
index b7e8a85..7d9ab00 100644
--- a/hotspot/src/share/vm/opto/coalesce.cpp
+++ b/hotspot/src/share/vm/opto/coalesce.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp
index de96112..6dfc5fc 100644
--- a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp
+++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/opto/ifg.cpp b/hotspot/src/share/vm/opto/ifg.cpp
index e7f55aa..4b65eab 100644
--- a/hotspot/src/share/vm/opto/ifg.cpp
+++ b/hotspot/src/share/vm/opto/ifg.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/opto/ifnode.cpp b/hotspot/src/share/vm/opto/ifnode.cpp
index c6a76a8..4f23076 100644
--- a/hotspot/src/share/vm/opto/ifnode.cpp
+++ b/hotspot/src/share/vm/opto/ifnode.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/opto/reg_split.cpp b/hotspot/src/share/vm/opto/reg_split.cpp
index 391fcda..6db3a76 100644
--- a/hotspot/src/share/vm/opto/reg_split.cpp
+++ b/hotspot/src/share/vm/opto/reg_split.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/runtime/statSampler.cpp b/hotspot/src/share/vm/runtime/statSampler.cpp
index d5c4a5f..17b62fa 100644
--- a/hotspot/src/share/vm/runtime/statSampler.cpp
+++ b/hotspot/src/share/vm/runtime/statSampler.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/runtime/threadLocalStorage.cpp b/hotspot/src/share/vm/runtime/threadLocalStorage.cpp
index 2b2b876..1718ae4 100644
--- a/hotspot/src/share/vm/runtime/threadLocalStorage.cpp
+++ b/hotspot/src/share/vm/runtime/threadLocalStorage.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/runtime/threadLocalStorage.hpp b/hotspot/src/share/vm/runtime/threadLocalStorage.hpp
index e345baa..4be9c9e 100644
--- a/hotspot/src/share/vm/runtime/threadLocalStorage.hpp
+++ b/hotspot/src/share/vm/runtime/threadLocalStorage.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/runtime/virtualspace.cpp b/hotspot/src/share/vm/runtime/virtualspace.cpp
index fbbafef..cbcc352 100644
--- a/hotspot/src/share/vm/runtime/virtualspace.cpp
+++ b/hotspot/src/share/vm/runtime/virtualspace.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/runtime/virtualspace.hpp b/hotspot/src/share/vm/runtime/virtualspace.hpp
index 556b4c9..fa65035 100644
--- a/hotspot/src/share/vm/runtime/virtualspace.hpp
+++ b/hotspot/src/share/vm/runtime/virtualspace.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/hotspot/src/share/vm/utilities/macros.hpp b/hotspot/src/share/vm/utilities/macros.hpp
index 7d7bc65..770ac0b 100644
--- a/hotspot/src/share/vm/utilities/macros.hpp
+++ b/hotspot/src/share/vm/utilities/macros.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index e25ed35..a52bc53 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -10,3 +10,4 @@
 95375835527f0bf06124ce984266e2ad5de8a6dc jdk7-b33
 01facdf8cabdeaaf68cca037aef56cc5f074897f jdk7-b34
 eac46d1eb7f0935ba04f1c7929ec15423fd0309e jdk7-b35
+c84ca638db42a8b6b227b4e3b63bca192c5ca634 jdk7-b36
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 19d69e2..fb18d1c 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -10,3 +10,4 @@
 6dcbcfb9551aaa2a80906c28ab48c9a8564e0e64 jdk7-b33
 7a9f629cd957e3169a1a769f763fe060d078785c jdk7-b34
 b0f01c2508b690dd225298edfec70b5e8b8dc367 jdk7-b35
+f60187f44a0d62906a5e2f6bd0989b5b24c1ca1e jdk7-b36
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 5a4391f..eca6ade 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -10,3 +10,4 @@
 fa4c0a6cdd25d97d4e6f5d7aa180bcbb0e0d56af jdk7-b33
 434055a0716ee44bca712ebca02fc04b20e6e288 jdk7-b34
 cf4894b78ceb966326e93bf221db0c2d14d59218 jdk7-b35
+134fd1a656ea85acd1f97f6700f75029b9b472a0 jdk7-b36
diff --git a/jdk/make/com/sun/inputmethods/indicim/Makefile b/jdk/make/com/sun/inputmethods/indicim/Makefile
index 4c7dc97..e6e7c0d 100644
--- a/jdk/make/com/sun/inputmethods/indicim/Makefile
+++ b/jdk/make/com/sun/inputmethods/indicim/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2002-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/com/sun/inputmethods/thaiim/Makefile b/jdk/make/com/sun/inputmethods/thaiim/Makefile
index 9b709d7..d4f47a6 100644
--- a/jdk/make/com/sun/inputmethods/thaiim/Makefile
+++ b/jdk/make/com/sun/inputmethods/thaiim/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2002-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/com/sun/java/pack/Makefile b/jdk/make/com/sun/java/pack/Makefile
index 9229e3f..c8b4e99 100644
--- a/jdk/make/com/sun/java/pack/Makefile
+++ b/jdk/make/com/sun/java/pack/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/com/sun/security/auth/module/Makefile b/jdk/make/com/sun/security/auth/module/Makefile
index d9f705d..d7a4abd 100644
--- a/jdk/make/com/sun/security/auth/module/Makefile
+++ b/jdk/make/com/sun/security/auth/module/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/common/BuildToolJar.gmk b/jdk/make/common/BuildToolJar.gmk
index 638e56b..2c5ad8e 100644
--- a/jdk/make/common/BuildToolJar.gmk
+++ b/jdk/make/common/BuildToolJar.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/common/Demo.gmk b/jdk/make/common/Demo.gmk
index 221bee1..12a3ce1 100644
--- a/jdk/make/common/Demo.gmk
+++ b/jdk/make/common/Demo.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2004-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/common/Library.gmk b/jdk/make/common/Library.gmk
index 2aa247f..3e4318e 100644
--- a/jdk/make/common/Library.gmk
+++ b/jdk/make/common/Library.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1995-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/common/internal/ImportComponents.gmk b/jdk/make/common/internal/ImportComponents.gmk
index d22783d..7436594 100644
--- a/jdk/make/common/internal/ImportComponents.gmk
+++ b/jdk/make/common/internal/ImportComponents.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/common/shared/Defs-java.gmk b/jdk/make/common/shared/Defs-java.gmk
index f6484f4..9bfb96d 100644
--- a/jdk/make/common/shared/Defs-java.gmk
+++ b/jdk/make/common/shared/Defs-java.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/common/shared/Defs-windows.gmk b/jdk/make/common/shared/Defs-windows.gmk
index d0be243..35fa8ce 100644
--- a/jdk/make/common/shared/Defs-windows.gmk
+++ b/jdk/make/common/shared/Defs-windows.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2005-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/fdlibm/Makefile b/jdk/make/java/fdlibm/Makefile
index b2d90ec..eeb5e74 100644
--- a/jdk/make/java/fdlibm/Makefile
+++ b/jdk/make/java/fdlibm/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/hpi/windows/Makefile b/jdk/make/java/hpi/windows/Makefile
index fa04ec6..b82d885 100644
--- a/jdk/make/java/hpi/windows/Makefile
+++ b/jdk/make/java/hpi/windows/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/java/FILES_java.gmk b/jdk/make/java/java/FILES_java.gmk
index 2531ce7..577c58d 100644
--- a/jdk/make/java/java/FILES_java.gmk
+++ b/jdk/make/java/java/FILES_java.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright 1996-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1996-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/java_crw_demo/Makefile b/jdk/make/java/java_crw_demo/Makefile
index c65a84d..6c45bcb 100644
--- a/jdk/make/java/java_crw_demo/Makefile
+++ b/jdk/make/java/java_crw_demo/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2004-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/java_hprof_demo/Makefile b/jdk/make/java/java_hprof_demo/Makefile
index 58805ee..4e1ef2a 100644
--- a/jdk/make/java/java_hprof_demo/Makefile
+++ b/jdk/make/java/java_hprof_demo/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/management/Makefile b/jdk/make/java/management/Makefile
index c1c4edb..466d221 100644
--- a/jdk/make/java/management/Makefile
+++ b/jdk/make/java/management/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/net/Makefile b/jdk/make/java/net/Makefile
index 4141294..b9a3def 100644
--- a/jdk/make/java/net/Makefile
+++ b/jdk/make/java/net/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1995-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/net/mapfile-vers b/jdk/make/java/net/mapfile-vers
index e7da618..d9803f8 100644
--- a/jdk/make/java/net/mapfile-vers
+++ b/jdk/make/java/net/mapfile-vers
@@ -1,5 +1,5 @@
 #
-# Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/nio/FILES_java.gmk b/jdk/make/java/nio/FILES_java.gmk
index 8a6177b..0e8c709 100644
--- a/jdk/make/java/nio/FILES_java.gmk
+++ b/jdk/make/java/nio/FILES_java.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/nio/genCoder.sh b/jdk/make/java/nio/genCoder.sh
index 769b98c..b5f4faa 100644
--- a/jdk/make/java/nio/genCoder.sh
+++ b/jdk/make/java/nio/genCoder.sh
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 #
-# Copyright 2000-2001 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/npt/Makefile b/jdk/make/java/npt/Makefile
index fe9eb0a..57e6a66 100644
--- a/jdk/make/java/npt/Makefile
+++ b/jdk/make/java/npt/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2004-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/java/zip/Makefile b/jdk/make/java/zip/Makefile
index 00b381d..48e8c39 100644
--- a/jdk/make/java/zip/Makefile
+++ b/jdk/make/java/zip/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1996-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1996-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/javax/swing/beaninfo/SwingBeans.gmk b/jdk/make/javax/swing/beaninfo/SwingBeans.gmk
index 462c250..66f16aa 100644
--- a/jdk/make/javax/swing/beaninfo/SwingBeans.gmk
+++ b/jdk/make/javax/swing/beaninfo/SwingBeans.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/jpda/back/Makefile b/jdk/make/jpda/back/Makefile
index bd98183..5237d9c 100644
--- a/jdk/make/jpda/back/Makefile
+++ b/jdk/make/jpda/back/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/jpda/transport/shmem/Makefile b/jdk/make/jpda/transport/shmem/Makefile
index a1e2382..fcc8c63 100644
--- a/jdk/make/jpda/transport/shmem/Makefile
+++ b/jdk/make/jpda/transport/shmem/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/jpda/transport/socket/Makefile b/jdk/make/jpda/transport/socket/Makefile
index 828613d..65f8018 100644
--- a/jdk/make/jpda/transport/socket/Makefile
+++ b/jdk/make/jpda/transport/socket/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/jprt.properties b/jdk/make/jprt.properties
index e6666cb..c909f36 100644
--- a/jdk/make/jprt.properties
+++ b/jdk/make/jprt.properties
@@ -1,5 +1,5 @@
 #
-# Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/mksample/nio/Makefile b/jdk/make/mksample/nio/Makefile
index 1f17a4c..e051062 100644
--- a/jdk/make/mksample/nio/Makefile
+++ b/jdk/make/mksample/nio/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2004-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/mksample/nio/multicast/Makefile b/jdk/make/mksample/nio/multicast/Makefile
index 05a153a..179d3d4 100644
--- a/jdk/make/mksample/nio/multicast/Makefile
+++ b/jdk/make/mksample/nio/multicast/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/netbeans/jconsole/build.properties b/jdk/make/netbeans/jconsole/build.properties
index 189b528..dd442d9 100644
--- a/jdk/make/netbeans/jconsole/build.properties
+++ b/jdk/make/netbeans/jconsole/build.properties
@@ -1,5 +1,5 @@
 #
-# Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
diff --git a/jdk/make/netbeans/jconsole/build.xml b/jdk/make/netbeans/jconsole/build.xml
index b546fb7..8d56df7 100644
--- a/jdk/make/netbeans/jconsole/build.xml
+++ b/jdk/make/netbeans/jconsole/build.xml
@@ -1,5 +1,5 @@
 <!--
- Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
 
  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions
diff --git a/jdk/make/sun/cmm/kcms/Makefile b/jdk/make/sun/cmm/kcms/Makefile
index 000f252..10ff72b 100644
--- a/jdk/make/sun/cmm/kcms/Makefile
+++ b/jdk/make/sun/cmm/kcms/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/sun/font/t2k/Makefile b/jdk/make/sun/font/t2k/Makefile
index 70dd117..d01e825 100644
--- a/jdk/make/sun/font/t2k/Makefile
+++ b/jdk/make/sun/font/t2k/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/sun/image/generic/Makefile b/jdk/make/sun/image/generic/Makefile
index 6657553..5caedf6 100644
--- a/jdk/make/sun/image/generic/Makefile
+++ b/jdk/make/sun/image/generic/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/sun/image/vis/Makefile b/jdk/make/sun/image/vis/Makefile
index bb23d6a..b0e399b 100644
--- a/jdk/make/sun/image/vis/Makefile
+++ b/jdk/make/sun/image/vis/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/sun/jconsole/Makefile b/jdk/make/sun/jconsole/Makefile
index 14d1660..ff27063 100644
--- a/jdk/make/sun/jconsole/Makefile
+++ b/jdk/make/sun/jconsole/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2004-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/sun/jdbc/Makefile b/jdk/make/sun/jdbc/Makefile
index 818a89d..d7e7eaf 100644
--- a/jdk/make/sun/jdbc/Makefile
+++ b/jdk/make/sun/jdbc/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1996-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1996-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/sun/jpeg/Makefile b/jdk/make/sun/jpeg/Makefile
index 6eaef8a..f97e2cd 100644
--- a/jdk/make/sun/jpeg/Makefile
+++ b/jdk/make/sun/jpeg/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1995-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/sun/net/spi/nameservice/dns/Makefile b/jdk/make/sun/net/spi/nameservice/dns/Makefile
index a882ead..87d5e07f 100644
--- a/jdk/make/sun/net/spi/nameservice/dns/Makefile
+++ b/jdk/make/sun/net/spi/nameservice/dns/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/make/sun/text/Makefile b/jdk/make/sun/text/Makefile
index f0fb426..37b8522 100644
--- a/jdk/make/sun/text/Makefile
+++ b/jdk/make/sun/text/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/back/ThreadReferenceImpl.c b/jdk/src/share/back/ThreadReferenceImpl.c
index a854228..2b8e478 100644
--- a/jdk/src/share/back/ThreadReferenceImpl.c
+++ b/jdk/src/share/back/ThreadReferenceImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/back/eventFilter.c b/jdk/src/share/back/eventFilter.c
index 955cf88..5d135a7 100644
--- a/jdk/src/share/back/eventFilter.c
+++ b/jdk/src/share/back/eventFilter.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/back/transport.c b/jdk/src/share/back/transport.c
index f259a93..05c7394 100644
--- a/jdk/src/share/back/transport.c
+++ b/jdk/src/share/back/transport.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/defaults/JmxProperties.java b/jdk/src/share/classes/com/sun/jmx/defaults/JmxProperties.java
index b4bbbb7..fcf769b 100644
--- a/jdk/src/share/classes/com/sun/jmx/defaults/JmxProperties.java
+++ b/jdk/src/share/classes/com/sun/jmx/defaults/JmxProperties.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/event/DaemonThreadFactory.java b/jdk/src/share/classes/com/sun/jmx/event/DaemonThreadFactory.java
index 85377d4..ca2462b 100644
--- a/jdk/src/share/classes/com/sun/jmx/event/DaemonThreadFactory.java
+++ b/jdk/src/share/classes/com/sun/jmx/event/DaemonThreadFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/event/EventBuffer.java b/jdk/src/share/classes/com/sun/jmx/event/EventBuffer.java
index bfdabdb..ed80479 100644
--- a/jdk/src/share/classes/com/sun/jmx/event/EventBuffer.java
+++ b/jdk/src/share/classes/com/sun/jmx/event/EventBuffer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/event/EventClientFactory.java b/jdk/src/share/classes/com/sun/jmx/event/EventClientFactory.java
index f08b099..3cab63c 100644
--- a/jdk/src/share/classes/com/sun/jmx/event/EventClientFactory.java
+++ b/jdk/src/share/classes/com/sun/jmx/event/EventClientFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/event/EventConnection.java b/jdk/src/share/classes/com/sun/jmx/event/EventConnection.java
index d52d9d3..adadef1 100644
--- a/jdk/src/share/classes/com/sun/jmx/event/EventConnection.java
+++ b/jdk/src/share/classes/com/sun/jmx/event/EventConnection.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/event/EventParams.java b/jdk/src/share/classes/com/sun/jmx/event/EventParams.java
index f941fbe..7d875e1 100644
--- a/jdk/src/share/classes/com/sun/jmx/event/EventParams.java
+++ b/jdk/src/share/classes/com/sun/jmx/event/EventParams.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java b/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java
index cb1b88b..e176101 100644
--- a/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java
+++ b/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
@@ -27,7 +27,6 @@
 
 import com.sun.jmx.remote.util.ClassLogger;
 import java.util.concurrent.Executors;
-import java.util.concurrent.FutureTask;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
@@ -115,6 +114,7 @@
                 scheduled = null;
             }
             callback.run();
+            executor.shutdown();
         }
     }
 
@@ -131,6 +131,13 @@
         logger.trace("stop", "canceling lease");
         scheduled.cancel(false);
         scheduled = null;
+        try {
+            executor.shutdown();
+        } catch (SecurityException e) {
+            // OK: caller doesn't have RuntimePermission("modifyThread")
+            // which is unlikely in reality but triggers a test failure otherwise
+            logger.trace("stop", "exception from executor.shutdown", e);
+        }
     }
 
     private final Runnable callback;
@@ -138,7 +145,7 @@
 
     private final ScheduledExecutorService executor
             = Executors.newScheduledThreadPool(1,
-            new DaemonThreadFactory("LeaseManager"));
+            new DaemonThreadFactory("JMX LeaseManager %d"));
 
     private static final ClassLogger logger =
             new ClassLogger("javax.management.event", "LeaseManager");
diff --git a/jdk/src/share/classes/com/sun/jmx/event/LeaseRenewer.java b/jdk/src/share/classes/com/sun/jmx/event/LeaseRenewer.java
index 6f2986e..b3f7c7f 100644
--- a/jdk/src/share/classes/com/sun/jmx/event/LeaseRenewer.java
+++ b/jdk/src/share/classes/com/sun/jmx/event/LeaseRenewer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/event/ReceiverBuffer.java b/jdk/src/share/classes/com/sun/jmx/event/ReceiverBuffer.java
index 7c2a737..a87e2df 100644
--- a/jdk/src/share/classes/com/sun/jmx/event/ReceiverBuffer.java
+++ b/jdk/src/share/classes/com/sun/jmx/event/ReceiverBuffer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/event/RepeatedSingletonJob.java b/jdk/src/share/classes/com/sun/jmx/event/RepeatedSingletonJob.java
index 7de1b40..768ed6f 100644
--- a/jdk/src/share/classes/com/sun/jmx/event/RepeatedSingletonJob.java
+++ b/jdk/src/share/classes/com/sun/jmx/event/RepeatedSingletonJob.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
@@ -95,7 +95,9 @@
             executor.execute(this);
         } catch (RejectedExecutionException e) {
             logger.warning(
-                    "setEventReceiver", "Executor threw exception", e);
+                    "execute",
+                    "Executor threw exception (" + this.getClass().getName() + ")",
+                    e);
             throw new RejectedExecutionException(
                     "Executor.execute threw exception -" +
                     "should not be possible", e);
diff --git a/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java b/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java
index 7d95a77..7da3406 100644
--- a/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java
+++ b/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java
@@ -613,8 +613,7 @@
             List<String> result = new ArrayList<String>(domains.length);
             for (int i = 0; i < domains.length; i++) {
                 try {
-                    ObjectName dom =
-                            Util.newObjectName(domains[i] + ":x=x");
+                    ObjectName dom = ObjectName.valueOf(domains[i] + ":x=x");
                     checkMBeanPermission(mbeanServerName, (String) null, null, dom, "getDomains");
                     result.add(domains[i]);
                 } catch (SecurityException e) {
@@ -1170,7 +1169,7 @@
            if one is supplied where it shouldn't be).  */
         final String completeName = domain + name;
 
-        return Util.newObjectName(completeName);
+        return ObjectName.valueOf(completeName);
     }
 
     public String getDefaultDomain()  {
@@ -2021,7 +2020,7 @@
     private void addJMXNamespace(JMXNamespace namespace,
             final ObjectName logicalName,
             final Queue<Runnable> postQueue) {
-        dispatcher.addNamespace(logicalName, namespace, postQueue);
+        dispatcher.addInterceptorFor(logicalName, namespace, postQueue);
     }
 
     /**
@@ -2035,7 +2034,7 @@
     private void removeJMXNamespace(JMXNamespace namespace,
             final ObjectName logicalName,
             final Queue<Runnable> postQueue) {
-        dispatcher.removeNamespace(logicalName, namespace, postQueue);
+        dispatcher.removeInterceptorFor(logicalName, namespace, postQueue);
     }
 
     /**
diff --git a/jdk/src/share/classes/com/sun/jmx/interceptor/DispatchInterceptor.java b/jdk/src/share/classes/com/sun/jmx/interceptor/DispatchInterceptor.java
index 9e8625d..4a79567 100644
--- a/jdk/src/share/classes/com/sun/jmx/interceptor/DispatchInterceptor.java
+++ b/jdk/src/share/classes/com/sun/jmx/interceptor/DispatchInterceptor.java
@@ -194,7 +194,7 @@
     // found in the handlerMap. Note: there doesn't need to be an interceptor
     // for that key in the Map.
     //
-    public abstract String getHandlerKey(ObjectName name);
+    abstract String getHandlerKey(ObjectName name);
 
     // Returns an interceptor for that name, or null if there's no interceptor
     // for that name.
@@ -277,7 +277,7 @@
     // of JMXNamespace (or a subclass of it) is registered as an MBean.
     // This method is usually invoked from within the repository lock,
     // hence the necessity of the postRegisterQueue.
-    public void addNamespace(ObjectName name, N jmxNamespace,
+    public void addInterceptorFor(ObjectName name, N jmxNamespace,
             Queue<Runnable> postRegisterQueue) {
         final String key = getHandlerKey(name);
         validateHandlerNameFor(key,name);
@@ -298,7 +298,7 @@
     // of JMXNamespace (or a subclass of it) is deregistered.
     // This method is usually invoked from within the repository lock,
     // hence the necessity of the postDeregisterQueue.
-    public void removeNamespace(ObjectName name, N jmxNamespace,
+    public void removeInterceptorFor(ObjectName name, N jmxNamespace,
             Queue<Runnable> postDeregisterQueue) {
         final String key = getHandlerKey(name);
         final T ns;
@@ -330,7 +330,7 @@
     }
 
     // From MBeanServer
-    public ObjectInstance createMBean(String className, ObjectName name)
+    public final ObjectInstance createMBean(String className, ObjectName name)
             throws ReflectionException, InstanceAlreadyExistsException,
                    MBeanRegistrationException, MBeanException,
                    NotCompliantMBeanException {
@@ -338,7 +338,7 @@
     }
 
     // From MBeanServer
-    public ObjectInstance createMBean(String className, ObjectName name,
+    public final ObjectInstance createMBean(String className, ObjectName name,
                                       ObjectName loaderName)
             throws ReflectionException, InstanceAlreadyExistsException,
                    MBeanRegistrationException, MBeanException,
@@ -347,7 +347,7 @@
     }
 
     // From MBeanServer
-    public ObjectInstance createMBean(String className, ObjectName name,
+    public final ObjectInstance createMBean(String className, ObjectName name,
                                       Object params[], String signature[])
             throws ReflectionException, InstanceAlreadyExistsException,
                    MBeanRegistrationException, MBeanException,
@@ -357,7 +357,7 @@
     }
 
     // From MBeanServer
-    public ObjectInstance createMBean(String className, ObjectName name,
+    public final ObjectInstance createMBean(String className, ObjectName name,
                                       ObjectName loaderName, Object params[],
                                       String signature[])
             throws ReflectionException, InstanceAlreadyExistsException,
@@ -368,42 +368,43 @@
     }
 
     // From MBeanServer
-    public ObjectInstance registerMBean(Object object, ObjectName name)
+    public final ObjectInstance registerMBean(Object object, ObjectName name)
             throws InstanceAlreadyExistsException, MBeanRegistrationException,
                    NotCompliantMBeanException {
         return getInterceptorForCreate(name).registerMBean(object,name);
     }
 
     // From MBeanServer
-    public void unregisterMBean(ObjectName name)
+    public final void unregisterMBean(ObjectName name)
             throws InstanceNotFoundException, MBeanRegistrationException {
         getInterceptorForInstance(name).unregisterMBean(name);
     }
 
     // From MBeanServer
-    public ObjectInstance getObjectInstance(ObjectName name)
+    public final ObjectInstance getObjectInstance(ObjectName name)
             throws InstanceNotFoundException {
         return getInterceptorForInstance(name).getObjectInstance(name);
     }
 
     // From MBeanServer
-    public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
-        final QueryInterceptor mbs =
+    public final Set<ObjectInstance> queryMBeans(ObjectName name,
+            QueryExp query) {
+        final QueryInterceptor queryInvoker =
                 getInterceptorForQuery(name);
-        if (mbs == null)  return Collections.emptySet();
-        else return mbs.queryMBeans(name,query);
+        if (queryInvoker == null)  return Collections.emptySet();
+        else return queryInvoker.queryMBeans(name,query);
     }
 
     // From MBeanServer
-    public Set<ObjectName> queryNames(ObjectName name, QueryExp query) {
-        final QueryInterceptor mbs =
+    public final Set<ObjectName> queryNames(ObjectName name, QueryExp query) {
+        final QueryInterceptor queryInvoker =
                 getInterceptorForQuery(name);
-        if (mbs == null)  return Collections.emptySet();
-        else return mbs.queryNames(name,query);
+        if (queryInvoker == null)  return Collections.emptySet();
+        else return queryInvoker.queryNames(name,query);
     }
 
     // From MBeanServer
-    public boolean isRegistered(ObjectName name) {
+    public final boolean isRegistered(ObjectName name) {
         final MBeanServer mbs = getInterceptorOrNullFor(name);
         if (mbs == null) return false;
         else return mbs.isRegistered(name);
@@ -415,20 +416,21 @@
     }
 
     // From MBeanServer
-    public Object getAttribute(ObjectName name, String attribute)
+    public final Object getAttribute(ObjectName name, String attribute)
             throws MBeanException, AttributeNotFoundException,
                    InstanceNotFoundException, ReflectionException {
         return getInterceptorForInstance(name).getAttribute(name,attribute);
     }
 
     // From MBeanServer
-    public AttributeList getAttributes(ObjectName name, String[] attributes)
+    public final AttributeList getAttributes(ObjectName name,
+            String[] attributes)
             throws InstanceNotFoundException, ReflectionException {
         return getInterceptorForInstance(name).getAttributes(name,attributes);
     }
 
     // From MBeanServer
-    public void setAttribute(ObjectName name, Attribute attribute)
+    public final void setAttribute(ObjectName name, Attribute attribute)
             throws InstanceNotFoundException, AttributeNotFoundException,
                    InvalidAttributeValueException, MBeanException,
                    ReflectionException {
@@ -436,14 +438,14 @@
     }
 
     // From MBeanServer
-    public AttributeList setAttributes(ObjectName name,
+    public final AttributeList setAttributes(ObjectName name,
                                        AttributeList attributes)
         throws InstanceNotFoundException, ReflectionException {
         return getInterceptorForInstance(name).setAttributes(name,attributes);
     }
 
     // From MBeanServer
-    public Object invoke(ObjectName name, String operationName,
+    public final Object invoke(ObjectName name, String operationName,
                          Object params[], String signature[])
             throws InstanceNotFoundException, MBeanException,
                    ReflectionException {
@@ -463,63 +465,69 @@
     public abstract String[] getDomains();
 
     // From MBeanServer
-    public void addNotificationListener(ObjectName name,
+    public final void addNotificationListener(ObjectName name,
                                         NotificationListener listener,
                                         NotificationFilter filter,
                                         Object handback)
             throws InstanceNotFoundException {
-        getInterceptorForInstance(name).addNotificationListener(name,listener,filter,
+        getInterceptorForInstance(name).
+                addNotificationListener(name,listener,filter,
                 handback);
     }
 
 
     // From MBeanServer
-    public void addNotificationListener(ObjectName name,
+    public final void addNotificationListener(ObjectName name,
                                         ObjectName listener,
                                         NotificationFilter filter,
                                         Object handback)
             throws InstanceNotFoundException {
-        getInterceptorForInstance(name).addNotificationListener(name,listener,filter,
+        getInterceptorForInstance(name).
+                addNotificationListener(name,listener,filter,
                 handback);
     }
 
     // From MBeanServer
-    public void removeNotificationListener(ObjectName name,
+    public final void removeNotificationListener(ObjectName name,
                                            ObjectName listener)
         throws InstanceNotFoundException, ListenerNotFoundException {
-        getInterceptorForInstance(name).removeNotificationListener(name,listener);
+        getInterceptorForInstance(name).
+                removeNotificationListener(name,listener);
     }
 
     // From MBeanServer
-    public void removeNotificationListener(ObjectName name,
+    public final void removeNotificationListener(ObjectName name,
                                            ObjectName listener,
                                            NotificationFilter filter,
                                            Object handback)
             throws InstanceNotFoundException, ListenerNotFoundException {
-        getInterceptorForInstance(name).removeNotificationListener(name,listener,filter,
+        getInterceptorForInstance(name).
+                removeNotificationListener(name,listener,filter,
                 handback);
     }
 
 
     // From MBeanServer
-    public void removeNotificationListener(ObjectName name,
+    public final void removeNotificationListener(ObjectName name,
                                            NotificationListener listener)
             throws InstanceNotFoundException, ListenerNotFoundException {
-        getInterceptorForInstance(name).removeNotificationListener(name,listener);
+        getInterceptorForInstance(name).
+                removeNotificationListener(name,listener);
     }
 
     // From MBeanServer
-    public void removeNotificationListener(ObjectName name,
+    public final void removeNotificationListener(ObjectName name,
                                            NotificationListener listener,
                                            NotificationFilter filter,
                                            Object handback)
             throws InstanceNotFoundException, ListenerNotFoundException {
-        getInterceptorForInstance(name).removeNotificationListener(name,listener,filter,
+        getInterceptorForInstance(name).
+                removeNotificationListener(name,listener,filter,
                 handback);
     }
 
     // From MBeanServer
-    public MBeanInfo getMBeanInfo(ObjectName name)
+    public final MBeanInfo getMBeanInfo(ObjectName name)
             throws InstanceNotFoundException, IntrospectionException,
                    ReflectionException {
         return getInterceptorForInstance(name).getMBeanInfo(name);
@@ -527,21 +535,23 @@
 
 
     // From MBeanServer
-    public boolean isInstanceOf(ObjectName name, String className)
+    public final boolean isInstanceOf(ObjectName name, String className)
             throws InstanceNotFoundException {
         return getInterceptorForInstance(name).isInstanceOf(name,className);
     }
 
     // From MBeanServer
-    public ClassLoader getClassLoaderFor(ObjectName mbeanName)
+    public final ClassLoader getClassLoaderFor(ObjectName mbeanName)
         throws InstanceNotFoundException {
-        return getInterceptorForInstance(mbeanName).getClassLoaderFor(mbeanName);
+        return getInterceptorForInstance(mbeanName).
+                getClassLoaderFor(mbeanName);
     }
 
     // From MBeanServer
-    public ClassLoader getClassLoader(ObjectName loaderName)
+    public final ClassLoader getClassLoader(ObjectName loaderName)
         throws InstanceNotFoundException {
-        return getInterceptorForInstance(loaderName).getClassLoader(loaderName);
+        return getInterceptorForInstance(loaderName).
+                getClassLoader(loaderName);
     }
 
 }
diff --git a/jdk/src/share/classes/com/sun/jmx/interceptor/DomainDispatchInterceptor.java b/jdk/src/share/classes/com/sun/jmx/interceptor/DomainDispatchInterceptor.java
index cb1489e..9b9b1d6 100644
--- a/jdk/src/share/classes/com/sun/jmx/interceptor/DomainDispatchInterceptor.java
+++ b/jdk/src/share/classes/com/sun/jmx/interceptor/DomainDispatchInterceptor.java
@@ -75,7 +75,7 @@
 
         private final DomainDispatchInterceptor parent;
         AggregatingQueryInterceptor(DomainDispatchInterceptor dispatcher) {
-            super(dispatcher.localNamespace);
+            super(dispatcher.nextInterceptor);
             parent = dispatcher;
         }
 
@@ -91,9 +91,8 @@
             // Add all matching MBeans from local namespace.
             final Set<T> res = Util.cloneSet(local);
 
-            final boolean all = (pattern == null ||
-                    pattern.getDomain().equals("*"));
             if (pattern == null) pattern = ObjectName.WILDCARD;
+            final boolean all = pattern.getDomain().equals("*");
 
             final String domain = pattern.getDomain();
 
@@ -142,7 +141,7 @@
         }
     }
 
-    private final DefaultMBeanServerInterceptor localNamespace;
+    private final DefaultMBeanServerInterceptor nextInterceptor;
     private final String mbeanServerName;
     private final MBeanServerDelegate delegate;
 
@@ -165,7 +164,7 @@
                             MBeanInstantiator   instantiator,
                             Repository          repository,
                             NamespaceDispatchInterceptor namespaces)  {
-           localNamespace = new DefaultMBeanServerInterceptor(outer,
+           nextInterceptor = new DefaultMBeanServerInterceptor(outer,
                    delegate, instantiator,repository,namespaces);
            mbeanServerName = Util.getMBeanServerSecurityName(delegate);
            this.delegate = delegate;
@@ -182,7 +181,7 @@
     @Override
     void validateHandlerNameFor(String key, ObjectName name) {
         super.validateHandlerNameFor(key,name);
-        final String[] domains = localNamespace.getDomains();
+        final String[] domains = nextInterceptor.getDomains();
         for (int i=0;i<domains.length;i++) {
             if (domains[i].equals(key))
                 throw new IllegalArgumentException("domain "+key+
@@ -192,37 +191,72 @@
 
     @Override
     final MBeanServer getInterceptorOrNullFor(ObjectName name) {
-        if (name == null) return localNamespace;
+
+        if (name == null) return nextInterceptor;
+
         final String domain = name.getDomain();
-        if (domain.endsWith(NAMESPACE_SEPARATOR)) return localNamespace;
-        if (domain.contains(NAMESPACE_SEPARATOR)) return null;
-        final String localDomain = domain;
-        if (isLocalHandlerNameFor(localDomain,name)) {
+        if (domain.endsWith(NAMESPACE_SEPARATOR))
+            return nextInterceptor; // This can be a namespace handler.
+        if (domain.contains(NAMESPACE_SEPARATOR))
+            return null; // shouldn't reach here.
+        if (isLocalHandlerNameFor(domain,name)) {
+            // This is the name of a JMXDomain MBean. Return nextInterceptor.
             LOG.finer("dispatching to local namespace");
-            return localNamespace;
+            return nextInterceptor;
         }
-        final DomainInterceptor ns = getInterceptor(localDomain);
+
+        final DomainInterceptor ns = getInterceptor(domain);
         if (ns == null) {
+            // no JMXDomain found for that domain - return nextInterceptor.
             if (LOG.isLoggable(Level.FINER)) {
-                LOG.finer("dispatching to local namespace: " + localDomain);
+                LOG.finer("dispatching to local namespace: " + domain);
             }
             return getNextInterceptor();
         }
+
         if (LOG.isLoggable(Level.FINER)) {
-            LOG.finer("dispatching to domain: " + localDomain);
+            LOG.finer("dispatching to domain: " + domain);
         }
         return ns;
     }
 
+    // This method returns true if the given pattern must be evaluated against
+    // several interceptors. This happens when either:
+    //
+    //   a) the pattern can select several domains (it's null, or it's a
+    //        domain pattern)
+    //   or b) it's not a domain pattern, but it might select the name of a
+    //        JMXDomain MBean in charge of that domain. Since the JMXDomain
+    //        MBean is located in the nextInterceptor, the pattern might need
+    //        to be evaluated on two interceptors.
+    //
+    // 1. When this method returns false, the query is evaluated on a single
+    // interceptor:
+    //    The interceptor for pattern.getDomain(), if there is one,
+    //    or the next interceptor, if there is none.
+    //
+    // 2. When this method returns true, we loop over all the domain
+    // interceptors:
+    //    in the list, and if the domain pattern matches the interceptor domain
+    //    we evaluate the query on that interceptor and aggregate the results.
+    //    Eventually we also evaluate the pattern against the next interceptor.
+    //
+    // See getInterceptorForQuery below.
+    //
     private boolean multipleQuery(ObjectName pattern) {
+        // case a) above
         if (pattern == null) return true;
         if (pattern.isDomainPattern()) return true;
 
         try {
+            // case b) above.
+            //
             // This is a bit of a hack. If there's any chance that a JMXDomain
             // MBean name is selected by the given pattern then we must include
             // the local namespace in our search.
-            // Returning true will have this effect.
+            //
+            // Returning true will have this effect. see 2. above.
+            //
             if (pattern.apply(ALL_DOMAINS.withDomain(pattern.getDomain())))
                 return true;
         } catch (MalformedObjectNameException x) {
@@ -253,7 +287,7 @@
         // We don't have a virtual domain. Send to local domains.
         if (LOG.isLoggable(Level.FINER))
              LOG.finer("dispatching to local namespace: " + domain);
-        return new QueryInterceptor(localNamespace);
+        return new QueryInterceptor(nextInterceptor);
     }
 
     @Override
@@ -288,7 +322,7 @@
 
     @Override
     final DefaultMBeanServerInterceptor getNextInterceptor() {
-        return localNamespace;
+        return nextInterceptor;
     }
 
     /**
@@ -298,11 +332,11 @@
     @Override
     public String[] getDomains() {
         // A JMXDomain is registered in its own domain.
-        // Therefore, localNamespace.getDomains() contains all domains.
-        // In addition, localNamespace will perform the necessary
+        // Therefore, nextInterceptor.getDomains() contains all domains.
+        // In addition, nextInterceptor will perform the necessary
         // MBeanPermission checks for getDomains().
         //
-        return localNamespace.getDomains();
+        return nextInterceptor.getDomains();
     }
 
     /**
@@ -310,13 +344,13 @@
      */
     @Override
     public Integer getMBeanCount() {
-        int count = getNextInterceptor().getMBeanCount().intValue();
+        int count = getNextInterceptor().getMBeanCount();
         final String[] keys = getKeys();
         for (String key:keys) {
             final MBeanServer mbs = getInterceptor(key);
             if (mbs == null) continue;
-            count += mbs.getMBeanCount().intValue();
+            count += mbs.getMBeanCount();
         }
-        return Integer.valueOf(count);
+        return count;
     }
 }
diff --git a/jdk/src/share/classes/com/sun/jmx/interceptor/NamespaceDispatchInterceptor.java b/jdk/src/share/classes/com/sun/jmx/interceptor/NamespaceDispatchInterceptor.java
index dfd4e65..d86c787 100644
--- a/jdk/src/share/classes/com/sun/jmx/interceptor/NamespaceDispatchInterceptor.java
+++ b/jdk/src/share/classes/com/sun/jmx/interceptor/NamespaceDispatchInterceptor.java
@@ -61,7 +61,7 @@
     private static final int NAMESPACE_SEPARATOR_LENGTH =
             NAMESPACE_SEPARATOR.length();
 
-    private final DomainDispatchInterceptor localNamespace;
+    private final DomainDispatchInterceptor nextInterceptor;
     private final String           serverName;
 
     /**
@@ -84,7 +84,7 @@
                                MBeanServerDelegate delegate,
                                MBeanInstantiator   instantiator,
                                Repository          repository)  {
-           localNamespace = new DomainDispatchInterceptor(outer,delegate,
+           nextInterceptor = new DomainDispatchInterceptor(outer,delegate,
                    instantiator,repository,this);
            serverName = Util.getMBeanServerSecurityName(delegate);
     }
@@ -94,21 +94,21 @@
      * Get first name space in ObjectName path. Ignore leading namespace
      * separators.
      **/
-    public static String getFirstNamespace(ObjectName name) {
+    static String getFirstNamespace(ObjectName name) {
         if (name == null) return "";
         final String domain = name.getDomain();
         if (domain.equals("")) return "";
 
+        // skip leading separators
         int first = 0;
-        int end = domain.indexOf(NAMESPACE_SEPARATOR,first);
-        while (end == first) {
-            first = end+NAMESPACE_SEPARATOR_LENGTH;
-            end = domain.indexOf(NAMESPACE_SEPARATOR,first);
-            if (end == -1) break;
-        }
+        while (domain.startsWith(NAMESPACE_SEPARATOR,first))
+            first += NAMESPACE_SEPARATOR_LENGTH;
 
-        if (end == -1) return "";
+        // go to next separator
+        final int end = domain.indexOf(NAMESPACE_SEPARATOR,first);
+        if (end == -1) return ""; // no namespace
 
+        // This is the first element in the namespace path.
         final String namespace = domain.substring(first,end);
 
         return namespace;
@@ -143,7 +143,7 @@
         if (namespace.equals("") || isLocalHandlerNameFor(namespace,name) ||
             name.getDomain().equals(namespace+NAMESPACE_SEPARATOR)) {
             LOG.finer("dispatching to local name space");
-            return localNamespace;
+            return nextInterceptor;
         }
         final NamespaceInterceptor ns = getInterceptor(namespace);
         if (LOG.isLoggable(Level.FINER)) {
@@ -162,7 +162,7 @@
         if (namespace.equals("") || isLocalHandlerNameFor(namespace,pattern) ||
             pattern.getDomain().equals(namespace+NAMESPACE_SEPARATOR)) {
             LOG.finer("dispatching to local name space");
-            return new QueryInterceptor(localNamespace);
+            return new QueryInterceptor(nextInterceptor);
         }
         final NamespaceInterceptor ns = getInterceptor(namespace);
         if (LOG.isLoggable(Level.FINER)) {
@@ -202,7 +202,7 @@
 
     @Override
     final DomainDispatchInterceptor getNextInterceptor() {
-        return localNamespace;
+        return nextInterceptor;
     }
 
     /**
@@ -211,25 +211,25 @@
      */
     @Override
     public String[] getDomains() {
-        return localNamespace.getDomains();
+        return nextInterceptor.getDomains();
     }
 
     @Override
-    public void addNamespace(ObjectName name, JMXNamespace handler,
+    public void addInterceptorFor(ObjectName name, JMXNamespace handler,
             Queue<Runnable> postRegisterQueue) {
         if (handler instanceof JMXDomain)
-            localNamespace.addNamespace(name,
+            nextInterceptor.addInterceptorFor(name,
                     (JMXDomain)handler,postRegisterQueue);
-        else super.addNamespace(name,handler,postRegisterQueue);
+        else super.addInterceptorFor(name,handler,postRegisterQueue);
     }
 
     @Override
-    public void removeNamespace(ObjectName name, JMXNamespace handler,
+    public void removeInterceptorFor(ObjectName name, JMXNamespace handler,
             Queue<Runnable> postDeregisterQueue) {
         if (handler instanceof JMXDomain)
-            localNamespace.removeNamespace(name,(JMXDomain)handler,
+            nextInterceptor.removeInterceptorFor(name,(JMXDomain)handler,
                     postDeregisterQueue);
-        else super.removeNamespace(name,handler,postDeregisterQueue);
+        else super.removeInterceptorFor(name,handler,postDeregisterQueue);
     }
 
 
diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java
index 3509c40..b86b2e0 100644
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java
@@ -1172,10 +1172,10 @@
             final Class<ConstructorProperties> propertyNamesClass = ConstructorProperties.class;
 
             Class targetClass = getTargetClass();
-            Constructor[] constrs = targetClass.getConstructors();
+            Constructor<?>[] constrs = targetClass.getConstructors();
 
             // Applicable if and only if there are any annotated constructors
-            List<Constructor> annotatedConstrList = newList();
+            List<Constructor<?>> annotatedConstrList = newList();
             for (Constructor<?> constr : constrs) {
                 if (Modifier.isPublic(constr.getModifiers())
                         && constr.getAnnotation(propertyNamesClass) != null)
@@ -1206,7 +1206,7 @@
             // Also remember the set of properties in that constructor
             // so we can test unambiguity.
             Set<BitSet> getterIndexSets = newSet();
-            for (Constructor constr : annotatedConstrList) {
+            for (Constructor<?> constr : annotatedConstrList) {
                 String[] propertyNames =
                     constr.getAnnotation(propertyNamesClass).value();
 
@@ -1363,10 +1363,10 @@
         }
 
         private static class Constr {
-            final Constructor constructor;
+            final Constructor<?> constructor;
             final int[] paramIndexes;
             final BitSet presentParams;
-            Constr(Constructor constructor, int[] paramIndexes,
+            Constr(Constructor<?> constructor, int[] paramIndexes,
                    BitSet presentParams) {
                 this.constructor = constructor;
                 this.paramIndexes = paramIndexes;
diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DynamicMBean2.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DynamicMBean2.java
index 270f7ad..d67b166 100644
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DynamicMBean2.java
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DynamicMBean2.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInjector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInjector.java
index e84e043..8ef296a 100644
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInjector.java
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInjector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java
index 725292b..99aaa85 100644
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java
@@ -623,7 +623,7 @@
     }
 
     private static MBeanConstructorInfo[] findConstructors(Class<?> c) {
-        Constructor[] cons = c.getConstructors();
+        Constructor<?>[] cons = c.getConstructors();
         MBeanConstructorInfo[] mbc = new MBeanConstructorInfo[cons.length];
         for (int i = 0; i < cons.length; i++) {
             String descr = "Public constructor of the MBean";
diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/NotifySupport.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/NotifySupport.java
index 9422737..00fbb02 100644
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/NotifySupport.java
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/NotifySupport.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/PerThreadGroupPool.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/PerThreadGroupPool.java
index 6fce0b8..2946f16 100644
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/PerThreadGroupPool.java
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/PerThreadGroupPool.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Repository.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Repository.java
index 5c33398..03f3e52 100644
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Repository.java
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Repository.java
@@ -396,7 +396,7 @@
 
         // Set domain to default if domain is empty and not already set
         if (dom.length() == 0)
-            name = Util.newObjectName(domain + name.toString());
+            name = ObjectName.valueOf(domain + name.toString());
 
         // Do we have default domain ?
         if (dom == domain) {  // ES: OK (dom & domain are interned)
diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanIntrospector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanIntrospector.java
index aca58c3..87aa930 100644
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanIntrospector.java
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanIntrospector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/SunJmxMBeanServer.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/SunJmxMBeanServer.java
index 0a1ab72..091ad7c 100644
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/SunJmxMBeanServer.java
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/SunJmxMBeanServer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java
index fcbdd90..6307adb 100644
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java
@@ -57,7 +57,8 @@
 public class Util {
     private final static int NAMESPACE_SEPARATOR_LENGTH =
             NAMESPACE_SEPARATOR.length();
-    public final static String ILLEGAL_MBEANSERVER_NAME_CHARS=";:*?";
+    public final static char[] ILLEGAL_MBEANSERVER_NAME_CHARS=";:*?".
+            toCharArray();
 
 
     static <K, V> Map<K, V> newMap() {
@@ -109,14 +110,6 @@
         return new ArrayList<E>(c);
     }
 
-    public static ObjectName newObjectName(String s) {
-        try {
-            return new ObjectName(s);
-        } catch (MalformedObjectNameException e) {
-            throw new IllegalArgumentException(e);
-        }
-    }
-
     /* This method can be used by code that is deliberately violating the
      * allowed checked casts.  Rather than marking the whole method containing
      * the code with @SuppressWarnings, you can use a call to this method for
@@ -621,7 +614,7 @@
      * is {@code null}.
      * @throws IllegalArgumentException if mbeanServerName contains illegal
      *         characters, or is empty, or is {@code "-"}.
-     *         Illegal characters are {@value #ILLEGAL_MBEANSERVER_NAME_CHARS}.
+     *         Illegal characters are {@link #ILLEGAL_MBEANSERVER_NAME_CHARS}.
      */
     public static String checkServerName(String mbeanServerName) {
         if ("".equals(mbeanServerName))
@@ -632,7 +625,7 @@
                     "\"-\" is not a valid MBean server name");
         if (isMBeanServerNameUndefined(mbeanServerName))
             return MBeanServerFactory.DEFAULT_MBEANSERVER_NAME;
-        for (char c : ILLEGAL_MBEANSERVER_NAME_CHARS.toCharArray()) {
+        for (char c : ILLEGAL_MBEANSERVER_NAME_CHARS) {
             if (mbeanServerName.indexOf(c) >= 0)
                 throw new IllegalArgumentException(
                         "invalid character in MBeanServer name: "+c);
@@ -662,15 +655,15 @@
     }
 
     // Log the exception and its causes without logging the stack trace.
-    // Use with care - it is usally preferable to log the whole stack trace!
+    // Use with care - it is usually preferable to log the whole stack trace!
     // We don't want to log the whole stack trace here: logshort() is
     // called in those cases where the exception might not be abnormal.
     private static void logshort(String msg, Throwable t) {
         if (JmxProperties.MISC_LOGGER.isLoggable(Level.FINE)) {
             StringBuilder toprint = new StringBuilder(msg);
-               toprint.append("\nCaused By: ").append(String.valueOf(t));
-            while ((t=t.getCause())!=null)
-               toprint.append("\nCaused By: ").append(String.valueOf(t));
+            do {
+                toprint.append("\nCaused By: ").append(String.valueOf(t));
+            } while ((t=t.getCause())!=null);
             JmxProperties.MISC_LOGGER.fine(toprint.toString());
        }
     }
diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/DomainInterceptor.java b/jdk/src/share/classes/com/sun/jmx/namespace/DomainInterceptor.java
index d761981..7b88087 100644
--- a/jdk/src/share/classes/com/sun/jmx/namespace/DomainInterceptor.java
+++ b/jdk/src/share/classes/com/sun/jmx/namespace/DomainInterceptor.java
@@ -85,7 +85,7 @@
 
         final ObjectName pattern;
         public PatternNotificationFilter(ObjectName pattern) {
-            this.pattern = pattern;
+            this.pattern = pattern==null?ObjectName.WILDCARD:pattern;
         }
 
         public boolean isNotificationEnabled(Notification notification) {
@@ -93,7 +93,7 @@
                 return false;
             final MBeanServerNotification mbsn =
                     (MBeanServerNotification) notification;
-            if (pattern == null || pattern.apply(mbsn.getMBeanName()))
+            if (pattern.apply(mbsn.getMBeanName()))
                 return true;
             return false;
         }
@@ -110,6 +110,7 @@
         super(handler);
         this.domainName = domainName;
         this.serverName = serverName;
+        ALL = ObjectName.valueOf(domainName+":*");
     }
 
     @Override
@@ -118,27 +119,27 @@
                 ", domain="+this.domainName+")";
     }
 
-    public void connectDelegate(final MBeanServerDelegate delegate)
+    final void connectDelegate(final MBeanServerDelegate delegate)
             throws InstanceNotFoundException {
         final NotificationFilter filter =
                 new PatternNotificationFilter(getPatternFor(null));
         synchronized (this) {
-            if (mbsListener == null)
+            if (mbsListener == null) {
                 mbsListener = new NotificationListener() {
-
-               public void handleNotification(Notification notification,
-                    Object handback) {
-                    if (filter.isNotificationEnabled(notification))
-                        delegate.sendNotification(notification);
-                }
-            };
+                    public void handleNotification(Notification notification,
+                        Object handback) {
+                        if (filter.isNotificationEnabled(notification))
+                            delegate.sendNotification(notification);
+                    }
+                };
+            }
         }
 
-        getNamespace().
+        getHandlerInterceptorMBean().
                 addMBeanServerNotificationListener(mbsListener, filter);
     }
 
-    public void disconnectDelegate()
+    final void disconnectDelegate()
             throws InstanceNotFoundException, ListenerNotFoundException {
         final NotificationListener l;
         synchronized (this) {
@@ -146,10 +147,10 @@
             if (l == null) return;
             mbsListener = null;
         }
-        getNamespace().removeMBeanServerNotificationListener(l);
+        getHandlerInterceptorMBean().removeMBeanServerNotificationListener(l);
     }
 
-    public void addPostRegisterTask(Queue<Runnable> queue,
+    public final void addPostRegisterTask(Queue<Runnable> queue,
             final MBeanServerDelegate delegate) {
         if (queue == null)
             throw new IllegalArgumentException("task queue must not be null");
@@ -158,14 +159,15 @@
                 try {
                     connectDelegate(delegate);
                 } catch (Exception x) {
-                    throw new UnsupportedOperationException("notification forwarding",x);
+                    throw new UnsupportedOperationException(
+                            "notification forwarding",x);
                 }
             }
         };
         queue.add(task1);
     }
 
-    public void addPostDeregisterTask(Queue<Runnable> queue,
+    public final void addPostDeregisterTask(Queue<Runnable> queue,
             final MBeanServerDelegate delegate) {
         if (queue == null)
             throw new IllegalArgumentException("task queue must not be null");
@@ -174,17 +176,18 @@
                 try {
                     disconnectDelegate();
                 } catch (Exception x) {
-                    throw new UnsupportedOperationException("notification forwarding",x);
+                    throw new UnsupportedOperationException(
+                            "notification forwarding",x);
                 }
             }
         };
         queue.add(task1);
     }
 
-    /**
-     * Throws IllegalArgumentException if targetName.getDomain() is not
-     * in the domain handled.
-     **/
+    // No name conversion for JMXDomains...
+    // Throws IllegalArgumentException if targetName.getDomain() is not
+    // in the domain handled.
+    //
     @Override
     protected ObjectName toSource(ObjectName targetName) {
         if (targetName == null) return null;
@@ -198,6 +201,7 @@
         return targetName;
     }
 
+    // No name conversion for JMXDomains...
     @Override
     protected ObjectName toTarget(ObjectName sourceName) {
         return sourceName;
@@ -255,16 +259,16 @@
             if (LOG.isLoggable(Level.FINE))
                 LOG.fine("Unexpected exception raised in queryNames: "+x);
             LOG.log(Level.FINEST,"Unexpected exception raised in queryNames",x);
+            return Collections.emptySet();
         }
-        // We reach here only when an exception was raised.
-        //
-        final Set<ObjectName> empty = Collections.emptySet();
-        return empty;
     }
 
+    // Compute a new pattern which is a sub pattern of 'name' but only selects
+    // the MBeans in domain 'domainName'
+    // When we reach here, it has been verified that 'name' matches our domain
+    // name (done by DomainDispatchInterceptor)
     private ObjectName getPatternFor(final ObjectName name) {
         try {
-            if (ALL == null) ALL = ObjectName.getInstance(domainName + ":*");
             if (name == null) return ALL;
             if (name.getDomain().equals(domainName)) return name;
             return name.withDomain(domainName);
@@ -284,11 +288,8 @@
             if (LOG.isLoggable(Level.FINE))
                 LOG.fine("Unexpected exception raised in queryNames: "+x);
             LOG.log(Level.FINEST,"Unexpected exception raised in queryNames",x);
+            return Collections.emptySet();
         }
-        // We reach here only when an exception was raised.
-        //
-        final Set<ObjectInstance> empty = Collections.emptySet();
-        return empty;
     }
 
     @Override
@@ -306,7 +307,7 @@
     // in the domain.
     @Override
     public Integer getMBeanCount() {
-        return getNamespace().getMBeanCount();
+        return getHandlerInterceptorMBean().getMBeanCount();
     }
 
     private boolean checkOn() {
@@ -320,8 +321,8 @@
     @Override
     void check(ObjectName routingName, String member, String action) {
         if (!checkOn()) return;
-        final String act = (action==null)?"-":action.intern();
-        if(act == "queryMBeans" || act == "queryNames") { // ES: OK
+        final String act = (action==null)?"-":action;
+        if("queryMBeans".equals(act) || "queryNames".equals(act)) {
             // This is tricky. check with 3 parameters is called
             // by queryNames/queryMBeans before performing the query.
             // At this point we must check with no class name.
@@ -355,16 +356,8 @@
         if (!checkOn()) return;
         final MBeanPermission perm;
 
-        // action is most probably already an intern string.
-        // string literals are intern strings.
-        // we create a new intern string for 'action' - just to be on
-        // the safe side...
-        // We intern it in order to be able to use == rather than equals
-        // below, because if we don't, and if action is not one of the
-        // 4 literals below, we would have to do a full string comparison.
-        //
-        final String act = (action==null)?"-":action.intern();
-        if (act == "getDomains") { // ES: OK
+        final String act = (action==null)?"-":action;
+        if ("getDomains".equals(act)) { // ES: OK
             perm = new  MBeanPermission(serverName,"-",member,
                     routingName,act);
         } else {
@@ -381,7 +374,7 @@
     String getClassName(ObjectName routingName) {
         if (routingName == null || routingName.isPattern()) return "-";
         try {
-            return getNamespace().getSourceServer().
+            return getHandlerInterceptorMBean().getSourceServer().
                     getObjectInstance(routingName).getClassName();
         } catch (InstanceNotFoundException ex) {
             LOG.finest("Can't get class name for "+routingName+
@@ -444,7 +437,7 @@
          int count=0;
          for (int i=0;i<domains.length;i++) {
              try {
-                 check(Util.newObjectName(domains[i]+":x=x"),"-",
+                 check(ObjectName.valueOf(domains[i]+":x=x"),"-",
                          "-","getDomains");
              } catch (SecurityException x) { // DLS: OK
                  count++;
diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/HandlerInterceptor.java b/jdk/src/share/classes/com/sun/jmx/namespace/HandlerInterceptor.java
index eb48ef8..5667244 100644
--- a/jdk/src/share/classes/com/sun/jmx/namespace/HandlerInterceptor.java
+++ b/jdk/src/share/classes/com/sun/jmx/namespace/HandlerInterceptor.java
@@ -63,8 +63,8 @@
 /**
  * This interceptor wraps a JMXNamespace, and performs
  * {@code ObjectName} rewriting. {@code HandlerInterceptor} are
- * usually created and managed by a {@link NamespaceDispatcher} or
- * {@link DomainDispatcher}.
+ * created and managed by a {@link NamespaceDispatchInterceptor} or a
+ * {@link DomainDispatchInterceptor}.
  * <p><b>
  * This API is a Sun internal API and is subject to changes without notice.
  * </b></p>
@@ -90,6 +90,12 @@
         this.handler = handler;
     }
 
+    //
+    // The {@code source} connection is a connection to the MBeanServer
+    // that contains the actual MBeans.
+    // In the case of cascading, that would be a connection to the sub
+    // agent. Practically, this is JMXNamespace.getSourceServer();
+    //
     @Override
     protected MBeanServer source() {
          return handler.getSourceServer();
@@ -105,7 +111,9 @@
          return source();
     }
 
-    T getNamespace() {
+    // The namespace or domain handler - this either a JMXNamespace or a
+    // a JMXDomain
+    T getHandlerInterceptorMBean() {
         return handler;
     }
 
@@ -122,12 +130,16 @@
                     Util.newRuntimeIOException(x));
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public AttributeList getAttributes(ObjectName name, String[] attributes)
         throws InstanceNotFoundException, ReflectionException {
         try {
-            return super.getAttributes(name, attributes);
+            final String[] authorized =
+                    checkAttributes(name,attributes,"getAttribute");
+            final AttributeList attrList =
+                    super.getAttributes(name,authorized);
+            return attrList;
         } catch (IOException ex) {
             throw handleIOException(ex,"getAttributes",name,attributes);
         }
@@ -172,18 +184,19 @@
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public void removeNotificationListener(ObjectName name, ObjectName listener)
         throws InstanceNotFoundException, ListenerNotFoundException {
         try {
-            super.removeNotificationListener(name, listener);
+            check(name,null,"removeNotificationListener");
+            super.removeNotificationListener(name,listener);
         } catch (IOException ex) {
             throw handleIOException(ex,"removeNotificationListener",name,listener);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public String getDefaultDomain() {
         try {
@@ -193,17 +206,19 @@
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public String[] getDomains() {
         try {
-            return super.getDomains();
+            check(null,null,"getDomains");
+            final String[] domains = super.getDomains();
+            return checkDomains(domains,"getDomains");
         } catch (IOException ex) {
             throw handleIOException(ex,"getDomains");
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public Integer getMBeanCount() {
         try {
@@ -213,64 +228,74 @@
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public void setAttribute(ObjectName name, Attribute attribute)
         throws InstanceNotFoundException, AttributeNotFoundException,
             InvalidAttributeValueException, MBeanException,
             ReflectionException {
         try {
-            super.setAttribute(name, attribute);
+            check(name,
+                  (attribute==null?null:attribute.getName()),
+                  "setAttribute");
+            super.setAttribute(name,attribute);
         } catch (IOException ex) {
             throw handleIOException(ex,"setAttribute",name, attribute);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public Set<ObjectName> queryNames(ObjectName name, QueryExp query) {
+        if (name == null) name=ObjectName.WILDCARD;
         try {
-            return super.queryNames(name, query);
+            checkPattern(name,null,"queryNames");
+            return super.queryNames(name,query);
         } catch (IOException ex) {
             throw handleIOException(ex,"queryNames",name, query);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
+        if (name == null) name=ObjectName.WILDCARD;
         try {
-            return super.queryMBeans(name, query);
+            checkPattern(name,null,"queryMBeans");
+            return super.queryMBeans(name,query);
         } catch (IOException ex) {
             throw handleIOException(ex,"queryMBeans",name, query);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public boolean isInstanceOf(ObjectName name, String className)
         throws InstanceNotFoundException {
         try {
+            check(name, null, "isInstanceOf");
             return super.isInstanceOf(name, className);
         } catch (IOException ex) {
             throw handleIOException(ex,"isInstanceOf",name, className);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public ObjectInstance createMBean(String className, ObjectName name)
         throws ReflectionException, InstanceAlreadyExistsException,
             MBeanRegistrationException, MBeanException,
             NotCompliantMBeanException {
         try {
+            checkCreate(name, className, "instantiate");
+            checkCreate(name, className, "registerMBean");
             return super.createMBean(className, name);
         } catch (IOException ex) {
             throw handleIOException(ex,"createMBean",className, name);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public ObjectInstance createMBean(String className, ObjectName name,
                         ObjectName loaderName)
@@ -278,30 +303,34 @@
                 MBeanRegistrationException, MBeanException,
                 NotCompliantMBeanException, InstanceNotFoundException {
         try {
+            checkCreate(name, className, "instantiate");
+            checkCreate(name, className, "registerMBean");
             return super.createMBean(className, name, loaderName);
         } catch (IOException ex) {
             throw handleIOException(ex,"createMBean",className, name, loaderName);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public Object getAttribute(ObjectName name, String attribute)
         throws MBeanException, AttributeNotFoundException,
             InstanceNotFoundException, ReflectionException {
         try {
+            check(name, attribute, "getAttribute");
             return super.getAttribute(name, attribute);
         } catch (IOException ex) {
             throw handleIOException(ex,"getAttribute",name, attribute);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public void removeNotificationListener(ObjectName name, ObjectName listener,
                             NotificationFilter filter, Object handback)
         throws InstanceNotFoundException, ListenerNotFoundException {
         try {
+            check(name,null,"removeNotificationListener");
             super.removeNotificationListener(name, listener, filter, handback);
         } catch (IOException ex) {
             throw handleIOException(ex,"removeNotificationListener",name,
@@ -309,13 +338,14 @@
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public void removeNotificationListener(ObjectName name,
                       NotificationListener listener, NotificationFilter filter,
                       Object handback)
         throws InstanceNotFoundException, ListenerNotFoundException {
         try {
+            check(name,null,"removeNotificationListener");
             super.removeNotificationListener(name, listener, filter, handback);
         } catch (IOException ex) {
             throw handleIOException(ex,"removeNotificationListener",name,
@@ -323,12 +353,13 @@
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public void removeNotificationListener(ObjectName name,
                 NotificationListener listener)
         throws InstanceNotFoundException, ListenerNotFoundException {
         try {
+            check(name,null,"removeNotificationListener");
             super.removeNotificationListener(name, listener);
         } catch (IOException ex) {
             throw handleIOException(ex,"removeNotificationListener",name,
@@ -336,12 +367,13 @@
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public void addNotificationListener(ObjectName name,
                     NotificationListener listener, NotificationFilter filter,
                     Object handback) throws InstanceNotFoundException {
         try {
+            check(name,null,"addNotificationListener");
             super.addNotificationListener(name, listener, filter, handback);
         } catch (IOException ex) {
             throw handleIOException(ex,"addNotificationListener",name,
@@ -349,12 +381,13 @@
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public void addNotificationListener(ObjectName name, ObjectName listener,
                 NotificationFilter filter, Object handback)
         throws InstanceNotFoundException {
         try {
+            check(name,null,"addNotificationListener");
             super.addNotificationListener(name, listener, filter, handback);
         } catch (IOException ex) {
             throw handleIOException(ex,"addNotificationListener",name,
@@ -362,7 +395,7 @@
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public boolean isRegistered(ObjectName name) {
         try {
@@ -372,41 +405,44 @@
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public void unregisterMBean(ObjectName name)
         throws InstanceNotFoundException, MBeanRegistrationException {
         try {
+            check(name, null, "unregisterMBean");
             super.unregisterMBean(name);
         } catch (IOException ex) {
             throw handleIOException(ex,"unregisterMBean",name);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public MBeanInfo getMBeanInfo(ObjectName name)
         throws InstanceNotFoundException, IntrospectionException,
             ReflectionException {
         try {
+            check(name, null, "getMBeanInfo");
             return super.getMBeanInfo(name);
         } catch (IOException ex) {
             throw handleIOException(ex,"getMBeanInfo",name);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public ObjectInstance getObjectInstance(ObjectName name)
         throws InstanceNotFoundException {
         try {
+            check(name, null, "getObjectInstance");
             return super.getObjectInstance(name);
         } catch (IOException ex) {
             throw handleIOException(ex,"getObjectInstance",name);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public ObjectInstance createMBean(String className, ObjectName name,
                 Object[] params, String[] signature)
@@ -414,6 +450,8 @@
             MBeanRegistrationException, MBeanException,
             NotCompliantMBeanException {
         try {
+            checkCreate(name, className, "instantiate");
+            checkCreate(name, className, "registerMBean");
             return super.createMBean(className, name, params, signature);
         } catch (IOException ex) {
             throw handleIOException(ex,"createMBean",className, name,
@@ -421,7 +459,7 @@
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public ObjectInstance createMBean(String className, ObjectName name,
                 ObjectName loaderName, Object[] params, String[] signature)
@@ -429,6 +467,8 @@
             MBeanRegistrationException, MBeanException,
             NotCompliantMBeanException, InstanceNotFoundException {
         try {
+            checkCreate(name, className, "instantiate");
+            checkCreate(name, className, "registerMBean");
             return super.createMBean(className, name, loaderName, params,
                     signature);
         } catch (IOException ex) {
@@ -437,23 +477,26 @@
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public AttributeList setAttributes(ObjectName name,AttributeList attributes)
     throws InstanceNotFoundException, ReflectionException {
         try {
-            return super.setAttributes(name, attributes);
+            final AttributeList authorized =
+                    checkAttributes(name, attributes, "setAttribute");
+            return super.setAttributes(name, authorized);
         } catch (IOException ex) {
             throw handleIOException(ex,"setAttributes",name, attributes);
         }
     }
 
-    // From MBeanServer: catch & handles IOException
+    // From MBeanServerConnection: catch & handles IOException
     @Override
     public Object invoke(ObjectName name, String operationName, Object[] params,
                 String[] signature)
         throws InstanceNotFoundException, MBeanException, ReflectionException {
         try {
+            check(name, operationName, "invoke");
             return super.invoke(name, operationName, params, signature);
         } catch (IOException ex) {
             throw handleIOException(ex,"invoke",name, operationName,
@@ -574,4 +617,118 @@
                 "Not supported in this namespace: "+namespace));
     }
 
+    /**
+     * A result might be excluded for security reasons.
+     */
+    @Override
+    boolean excludesFromResult(ObjectName targetName, String queryMethod) {
+        return !checkQuery(targetName, queryMethod);
+    }
+
+
+    //----------------------------------------------------------------------
+    // Hooks for checking permissions
+    //----------------------------------------------------------------------
+
+   /**
+     * This method is a hook to implement permission checking in subclasses.
+     * A subclass may override this method and throw a {@link
+     * SecurityException} if the permission is denied.
+     *
+     * @param routingName The name of the MBean in the enclosing context.
+     *        This is of the form {@code <namespace>//<ObjectName>}.
+     * @param member The {@link
+     *  javax.management.namespace.JMXNamespacePermission#getMember member}
+     *  name.
+     * @param action The {@link
+     *  javax.management.namespace.JMXNamespacePermission#getActions action}
+     *  name.
+     * @throws SecurityException if the caller doesn't have the permission
+     *         to perform the given action on the MBean pointed to
+     *         by routingName.
+     */
+    abstract void check(ObjectName routingName,
+                        String member, String action);
+
+    // called in createMBean and registerMBean
+    abstract void checkCreate(ObjectName routingName, String className,
+                                String action);
+
+    /**
+     * This is a hook to implement permission checking in subclasses.
+     *
+     * Checks that the caller has sufficient permission for returning
+     * information about {@code sourceName} in {@code action}.
+     *
+     * Subclass may override this method and return false if the caller
+     * doesn't have sufficient permissions.
+     *
+     * @param routingName The name of the MBean to include or exclude from
+     *        the query, expressed in the enclosing context.
+     *        This is of the form {@code <namespace>//<ObjectName>}.
+     * @param action one of "queryNames" or "queryMBeans"
+     * @return true if {@code sourceName} can be returned.
+     */
+    abstract boolean checkQuery(ObjectName routingName, String action);
+
+    /**
+     * This method is a hook to implement permission checking in subclasses.
+     *
+     * @param routingName The name of the MBean in the enclosing context.
+     *        This is of the form {@code <namespace>//<ObjectName>}.
+     * @param attributes  The list of attributes to check permission for.
+     * @param action one of "getAttribute" or "setAttribute"
+     * @return The list of attributes for which the callers has the
+     *         appropriate {@link
+     *         javax.management.namespace.JMXNamespacePermission}.
+     * @throws SecurityException if the caller doesn't have the permission
+     *         to perform {@code action} on the MBean pointed to by routingName.
+     */
+    abstract String[] checkAttributes(ObjectName routingName,
+            String[] attributes, String action);
+
+    /**
+     * This method is a hook to implement permission checking in subclasses.
+     *
+     * @param routingName The name of the MBean in the enclosing context.
+     *        This is of the form {@code <namespace>//<ObjectName>}.
+     * @param attributes The list of attributes to check permission for.
+     * @param action one of "getAttribute" or "setAttribute"
+     * @return The list of attributes for which the callers has the
+     *         appropriate {@link
+     *         javax.management.namespace.JMXNamespacePermission}.
+     * @throws SecurityException if the caller doesn't have the permission
+     *         to perform {@code action} on the MBean pointed to by routingName.
+     */
+    abstract AttributeList checkAttributes(ObjectName routingName,
+            AttributeList attributes, String action);
+
+    /**
+     * This method is a hook to implement permission checking in subclasses.
+     * Checks that the caller as the necessary permissions to view the
+     * given domain. If not remove the domains for which the caller doesn't
+     * have permission from the list.
+     * <p>
+     * By default, this method always returns {@code domains}
+     *
+     * @param domains The domains to return.
+     * @param action  "getDomains"
+     * @return a filtered list of domains.
+     */
+    String[] checkDomains(String[] domains, String action) {
+        return domains;
+    }
+
+    // A priori check for queryNames/queryMBeans/
+    void checkPattern(ObjectName routingPattern,
+               String member, String action) {
+        // pattern is checked only at posteriori by checkQuery.
+        // checking it a priori usually doesn't work, because ObjectName.apply
+        // does not work between two patterns.
+        // We only check that we have the permission requested for 'action'.
+        check(null,null,action);
+    }
+
+
+
 }
diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/JMXNamespaceUtils.java b/jdk/src/share/classes/com/sun/jmx/namespace/JMXNamespaceUtils.java
index 1fccfcb..49f8751 100644
--- a/jdk/src/share/classes/com/sun/jmx/namespace/JMXNamespaceUtils.java
+++ b/jdk/src/share/classes/com/sun/jmx/namespace/JMXNamespaceUtils.java
@@ -29,7 +29,6 @@
 
 import java.io.IOException;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.WeakHashMap;
 import java.util.logging.Level;
@@ -40,6 +39,8 @@
 import javax.management.NotificationFilter;
 import javax.management.NotificationListener;
 import javax.management.event.EventClient;
+import javax.management.event.EventClientDelegateMBean;
+import javax.management.namespace.JMXNamespace;
 import javax.management.namespace.JMXNamespaces;
 import javax.management.remote.JMXAddressable;
 import javax.management.remote.JMXConnector;
@@ -66,26 +67,10 @@
         return new WeakHashMap<K,V>();
     }
 
-    /** Creates a new instance of JMXNamespaces */
+    /** There are no instances of this class */
     private JMXNamespaceUtils() {
     }
 
-    /**
-     * Returns an unmodifiable option map in which the given keys have been
-     * filtered out.
-     * @param keys keys to filter out from the map.
-     * @return An unmodifiable option map in which the given keys have been
-     * filtered out.
-     */
-    public static <K,V> Map<K,V> filterMap(Map<K,V> map, K... keys) {
-        final Map<K,V> filtered;
-        filtered=new HashMap<K,V>(map);
-        for (K key : keys) {
-            filtered.remove(key);
-        }
-        return unmodifiableMap(filtered);
-    }
-
     // returns un unmodifiable view of a map.
     public static <K,V> Map<K,V> unmodifiableMap(Map<K,V> aMap) {
         if (aMap == null || aMap.isEmpty())
diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/NamespaceInterceptor.java b/jdk/src/share/classes/com/sun/jmx/namespace/NamespaceInterceptor.java
index da85fc6..6862066 100644
--- a/jdk/src/share/classes/com/sun/jmx/namespace/NamespaceInterceptor.java
+++ b/jdk/src/share/classes/com/sun/jmx/namespace/NamespaceInterceptor.java
@@ -25,22 +25,15 @@
 package com.sun.jmx.namespace;
 
 import com.sun.jmx.defaults.JmxProperties;
-import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
-import java.util.Set;
-import java.util.UUID;
 import java.util.logging.Logger;
 
 import javax.management.Attribute;
 import javax.management.AttributeList;
 import javax.management.MBeanServer;
-import javax.management.MBeanServerConnection;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-import javax.management.QueryExp;
-import javax.management.namespace.JMXNamespaces;
 import javax.management.namespace.JMXNamespace;
 import javax.management.namespace.JMXNamespacePermission;
 
@@ -54,12 +47,6 @@
  */
 public class NamespaceInterceptor extends HandlerInterceptor<JMXNamespace> {
 
-    /**
-     * A logger for this class.
-     **/
-    private static final Logger LOG = JmxProperties.NAMESPACE_LOGGER;
-    private static final Logger PROBE_LOG = Logger.getLogger(
-            JmxProperties.NAMESPACE_LOGGER+".probe");
 
     // The target name space in which the NamepsaceHandler is mounted.
     private final String           targetNs;
@@ -69,21 +56,6 @@
     private final ObjectNameRouter proc;
 
     /**
-     * Internal hack. The JMXRemoteNamespace can be closed and reconnected.
-     * Each time the JMXRemoteNamespace connects, a probe should be sent
-     * to detect cycle. The MBeanServer exposed by JMXRemoteNamespace thus
-     * implements the DynamicProbe interface, which makes it possible for
-     * this handler to know that it should send a new probe.
-     *
-     * XXX: TODO this probe thing is way too complex and fragile.
-     *      This *must* go away or be replaced by something simpler.
-     *      ideas are welcomed.
-     **/
-    public static interface DynamicProbe {
-        public boolean isProbeRequested();
-    }
-
-    /**
      * Creates a new instance of NamespaceInterceptor
      */
     public NamespaceInterceptor(
@@ -104,164 +76,6 @@
                 ", namespace="+this.targetNs+")";
     }
 
-    /*
-     * XXX: TODO this probe thing is way too complex and fragile.
-     *      This *must* go away or be replaced by something simpler.
-     *      ideas are welcomed.
-     */
-    private volatile boolean probed = false;
-    private volatile ObjectName probe;
-
-    // Query Pattern that we will send through the source server in order
-    // to detect self-linking namespaces.
-    //
-    // XXX: TODO this probe thing is way too complex and fragile.
-    //      This *must* go away or be replaced by something simpler.
-    //      ideas are welcomed.
-    final ObjectName makeProbePattern(ObjectName probe)
-            throws MalformedObjectNameException {
-
-        // we could probably link the probe pattern with the probe - e.g.
-        // using the UUID as key in the pattern - but is it worth it? it
-        // also has some side effects on the context namespace - because
-        // such a probe may get rejected by the jmx.context// namespace.
-        //
-        // The trick here is to devise a pattern that is not likely to
-        // be blocked by intermediate levels. Querying for all namespace
-        // handlers in the source (or source namespace) is more likely to
-        // achieve this goal.
-        //
-        return ObjectName.getInstance("*" +
-                JMXNamespaces.NAMESPACE_SEPARATOR + ":" +
-                JMXNamespace.TYPE_ASSIGNMENT);
-    }
-
-    // tell whether the name pattern corresponds to what might have been
-    // sent as a probe.
-    // XXX: TODO this probe thing is way too complex and fragile.
-    //      This *must* go away or be replaced by something simpler.
-    //      ideas are welcomed.
-    final boolean isProbePattern(ObjectName name) {
-        final ObjectName p = probe;
-        if (p == null) return false;
-        try {
-            return String.valueOf(name).endsWith(targetNs+
-                JMXNamespaces.NAMESPACE_SEPARATOR + "*" +
-                JMXNamespaces.NAMESPACE_SEPARATOR + ":" +
-                JMXNamespace.TYPE_ASSIGNMENT);
-        } catch (RuntimeException x) {
-            // should not happen.
-            PROBE_LOG.finest("Ignoring unexpected exception in self link detection: "+
-                    x);
-            return false;
-        }
-    }
-
-    // The first time a request reaches this NamespaceInterceptor, the
-    // interceptor will send a probe to detect whether the underlying
-    // JMXNamespace links to itslef.
-    //
-    // One way to create such self-linking namespace would be for instance
-    // to create a JMXNamespace whose getSourceServer() method would return:
-    // JMXNamespaces.narrowToNamespace(getMBeanServer(),
-    //                                 getObjectName().getDomain())
-    //
-    // If such an MBeanServer is returned, then any call to that MBeanServer
-    // will trigger an infinite loop.
-    // There can be even trickier configurations if remote connections are
-    // involved.
-    //
-    // In order to prevent this from happening, the NamespaceInterceptor will
-    // send a probe, in an attempt to detect whether it will receive it at
-    // the other end. If the probe is received, an exception will be thrown
-    // in order to break the recursion. The probe is only sent once - when
-    // the first request to the namespace occurs. The DynamicProbe interface
-    // can also be used by a Sun JMXNamespace implementation to request the
-    // emission of a probe at any time (see JMXRemoteNamespace
-    // implementation).
-    //
-    // Probes work this way: the NamespaceInterceptor sets a flag and sends
-    // a queryNames() request. If a queryNames() request comes in when the flag
-    // is on, then it deduces that there is a self-linking loop - and instead
-    // of calling queryNames() on the source MBeanServer of the JMXNamespace
-    // handler (which would cause the loop to go on) it breaks the recursion
-    // by returning the probe ObjectName.
-    // If the NamespaceInterceptor receives the probe ObjectName as result of
-    // its original sendProbe() request it knows that it has been looping
-    // back on itslef and throws an IOException...
-    //
-    //
-    // XXX: TODO this probe thing is way too complex and fragile.
-    //      This *must* go away or be replaced by something simpler.
-    //      ideas are welcomed.
-    //
-    final void sendProbe(MBeanServerConnection msc)
-            throws IOException {
-        try {
-            PROBE_LOG.fine("Sending probe");
-
-            // This is just to prevent any other thread to modify
-            // the probe while the detection cycle is in progress.
-            //
-            final ObjectName probePattern;
-            // we don't want to synchronize on this - we use targetNs
-            // because it's non null and final.
-            synchronized (targetNs) {
-                probed = false;
-                if (probe != null) {
-                    throw new IOException("concurent connection in progress");
-                }
-                final String uuid = UUID.randomUUID().toString();
-                final String endprobe =
-                        JMXNamespaces.NAMESPACE_SEPARATOR + uuid +
-                        ":type=Probe,key="+uuid;
-                final ObjectName newprobe =
-                        ObjectName.getInstance(endprobe);
-                probePattern = makeProbePattern(newprobe);
-                probe = newprobe;
-            }
-
-            try {
-                PROBE_LOG.finer("Probe query: "+probePattern+" expecting: "+probe);
-                final Set<ObjectName> res = msc.queryNames(probePattern, null);
-                final ObjectName expected = probe;
-                PROBE_LOG.finer("Probe res: "+res);
-                if (res.contains(expected)) {
-                    throw new IOException("namespace " +
-                            targetNs + " is linking to itself: " +
-                            "cycle detected by probe");
-                }
-            } catch (SecurityException x) {
-                PROBE_LOG.finer("Can't check for cycles: " + x);
-                // can't do anything....
-            } catch (RuntimeException x) {
-                PROBE_LOG.finer("Exception raised by queryNames: " + x);
-                throw x;
-            } finally {
-                probe = null;
-            }
-        } catch (MalformedObjectNameException x) {
-            final IOException io =
-                    new IOException("invalid name space: probe failed");
-            io.initCause(x);
-            throw io;
-        }
-        PROBE_LOG.fine("Probe returned - no cycles");
-        probed = true;
-    }
-
-    // allows a Sun implementation JMX Namespace, such as the
-    // JMXRemoteNamespace, to control when a probe should be sent.
-    //
-    // XXX: TODO this probe thing is way too complex and fragile.
-    //      This *must* go away or be replaced by something simpler.
-    //      ideas are welcomed.
-    private boolean isProbeRequested(Object o) {
-        if (o instanceof DynamicProbe)
-            return ((DynamicProbe)o).isProbeRequested();
-        return false;
-    }
-
     /**
      * This method will send a probe to detect self-linking name spaces.
      * A self linking namespace is a namespace that links back directly
@@ -281,29 +95,9 @@
      * (see JMXRemoteNamespace implementation).
      */
     private MBeanServer connection() {
-        try {
-            final MBeanServer c = super.source();
-            if (probe != null) // should not happen
-                throw new RuntimeException("connection is being probed");
-
-            if (probed == false || isProbeRequested(c)) {
-                try {
-                    // Should not happen if class well behaved.
-                    // Never probed. Force it.
-                    //System.err.println("sending probe for " +
-                    //        "target="+targetNs+", source="+srcNs);
-                    sendProbe(c);
-                } catch (IOException io) {
-                    throw new RuntimeException(io.getMessage(), io);
-                }
-            }
-
-            if (c != null) {
-                return c;
-            }
-        } catch (RuntimeException x) {
-            throw x;
-        }
+        final MBeanServer c = super.source();
+        if (c != null) return c;
+        // should not come here
         throw new NullPointerException("getMBeanServerConnection");
     }
 
@@ -319,24 +113,6 @@
         return super.source();
     }
 
-    /**
-     * Calls {@link MBeanServerConnection#queryNames queryNames}
-     * on the underlying
-     * {@link #getMBeanServerConnection MBeanServerConnection}.
-     **/
-    @Override
-    public final Set<ObjectName> queryNames(ObjectName name, QueryExp query) {
-        // XXX: TODO this probe thing is way too complex and fragile.
-        //      This *must* go away or be replaced by something simpler.
-        //      ideas are welcomed.
-        PROBE_LOG.finer("probe is: "+probe+" pattern is: "+name);
-        if (probe != null && isProbePattern(name)) {
-            PROBE_LOG.finer("Return probe: "+probe);
-            return Collections.singleton(probe);
-        }
-        return super.queryNames(name, query);
-    }
-
     @Override
     protected ObjectName toSource(ObjectName targetName)
             throws MalformedObjectNameException {
diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingConnectionProxy.java b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingConnectionProxy.java
index 787343e..443c80f 100644
--- a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingConnectionProxy.java
+++ b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingConnectionProxy.java
@@ -45,6 +45,9 @@
  * </b></p>
  * @since 1.7
  */
+// See class hierarchy and detailled explanations in RoutingProxy in this
+// package.
+//
 public class RoutingConnectionProxy
         extends RoutingProxy<MBeanServerConnection> {
 
@@ -93,40 +96,28 @@
                targetNs+"\", "+forwardsContext+")";
     }
 
+    static final RoutingProxyFactory
+            <MBeanServerConnection,RoutingConnectionProxy>
+        FACTORY = new RoutingProxyFactory
+        <MBeanServerConnection,RoutingConnectionProxy>() {
+
+        public RoutingConnectionProxy newInstance(MBeanServerConnection source,
+                String sourcePath, String targetPath,
+                boolean forwardsContext) {
+            return new RoutingConnectionProxy(source,sourcePath,
+                    targetPath,forwardsContext);
+        }
+
+        public RoutingConnectionProxy newInstance(
+                MBeanServerConnection source, String sourcePath) {
+            return new RoutingConnectionProxy(source,sourcePath);
+        }
+    };
+
     public static MBeanServerConnection cd(MBeanServerConnection source,
             String sourcePath) {
-        if (source == null) throw new IllegalArgumentException("null");
-        if (source.getClass().equals(RoutingConnectionProxy.class)) {
-            // cast is OK here, but findbugs complains unless we use class.cast
-            final RoutingConnectionProxy other =
-                    RoutingConnectionProxy.class.cast(source);
-            final String target = other.getTargetNamespace();
-
-            // Avoid multiple layers of serialization.
-            //
-            // We construct a new proxy from the original source instead of
-            // stacking a new proxy on top of the old one.
-            // - that is we replace
-            //      cd ( cd ( x, dir1), dir2);
-            // by
-            //      cd (x, dir1//dir2);
-            //
-            // We can do this only when the source class is exactly
-            //    NamespaceConnectionProxy.
-            //
-            if (target == null || target.equals("")) {
-                final String path =
-                    JMXNamespaces.concat(other.getSourceNamespace(),
-                    sourcePath);
-                return new RoutingConnectionProxy(other.source(),path,"",
-                        other.forwardsContext);
-            }
-            // Note: we could do possibly something here - but it would involve
-            //       removing part of targetDir, and possibly adding
-            //       something to sourcePath.
-            //       Too complex to bother! => simply default to stacking...
-        }
-        return new RoutingConnectionProxy(source,sourcePath);
+        return RoutingProxy.cd(RoutingConnectionProxy.class, FACTORY,
+                source, sourcePath);
     }
 
 }
diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingMBeanServerConnection.java b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingMBeanServerConnection.java
index 904e584..7022e7e 100644
--- a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingMBeanServerConnection.java
+++ b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingMBeanServerConnection.java
@@ -83,18 +83,32 @@
     }
 
     /**
-     * Returns the wrapped source connection.
+     * Returns the wrapped source connection. The {@code source} connection
+     * is a connection to the MBeanServer that contains the actual MBean.
+     * In the case of cascading, that would be a connection to the sub
+     * agent.
      **/
     protected abstract T source() throws IOException;
 
     /**
      * Converts a target ObjectName to a source ObjectName.
+     * The target ObjectName is the name of the MBean in the mount point
+     * target. In the case of cascading, that would be the name of the
+     * MBean in the master agent. So if a subagent S containing an MBean
+     * named "X" is mounted in the target namespace "foo//" of a master agent M,
+     * the source is S, the target is "foo//" in M, the source name is "X", and
+     * the target name is "foo//X".
+     * In the case of cascading - such as in NamespaceInterceptor, this method
+     * will convert "foo//X" (the targetName) into "X", the source name.
      **/
     protected abstract ObjectName toSource(ObjectName targetName)
         throws MalformedObjectNameException;
 
     /**
      * Converts a source ObjectName to a target ObjectName.
+     * (see description of toSource above for explanations)
+     * In the case of cascading - such as in NamespaceInterceptor, this method
+     * will convert "X" (the sourceName) into "foo//X", the target name.
      **/
     protected abstract ObjectName toTarget(ObjectName sourceName)
         throws MalformedObjectNameException;
@@ -142,90 +156,17 @@
         return new RuntimeOperationsException(x2);
     }
 
-    /**
-     * This method is a hook to implement permission checking in subclasses.
-     * By default, this method does nothing and simply returns
-     * {@code attribute}.
-     *
-     * @param routingName The name of the MBean in the enclosing context.
-     *        This is of the form {@code <namespace>//<ObjectName>}.
-     * @param attributes  The list of attributes to check permission for.
-     * @param action one of "getAttribute" or "setAttribute"
-     * @return The list of attributes for which the callers has the
-     *         appropriate {@link
-     *         javax.management.namespace.JMXNamespacePermission}.
-     */
-    String[] checkAttributes(ObjectName routingName,
-            String[] attributes, String action) {
-        check(routingName,null,action);
-        return attributes;
-    }
-
-    /**
-     * This method is a hook to implement permission checking in subclasses.
-     * By default, this method does nothing and simply returns
-     * {@code attribute}.
-     *
-     * @param routingName The name of the MBean in the enclosing context.
-     *        This is of the form {@code <namespace>//<ObjectName>}.
-     * @param attributes The list of attributes to check permission for.
-     * @param action one of "getAttribute" or "setAttribute"
-     * @return The list of attributes for which the callers has the
-     *         appropriate {@link
-     *         javax.management.namespace.JMXNamespacePermission}.
-     */
-    AttributeList checkAttributes(ObjectName routingName,
-            AttributeList attributes, String action) {
-        check(routingName,null,action);
-        return attributes;
-    }
-
     // from MBeanServerConnection
     public AttributeList getAttributes(ObjectName name, String[] attributes)
         throws InstanceNotFoundException, ReflectionException, IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            final String[] authorized =
-                    checkAttributes(name,attributes,"getAttribute");
-            final AttributeList attrList =
-                    source().getAttributes(sourceName,authorized);
-            return attrList;
+            return source().getAttributes(sourceName, attributes);
         } catch (RuntimeException ex) {
             throw makeCompliantRuntimeException(ex);
         }
     }
 
-   /**
-     * This method is a hook to implement permission checking in subclasses.
-     * By default, this method does nothing.
-     * A subclass may override this method and throw a {@link
-     * SecurityException} if the permission is denied.
-     *
-     * @param routingName The name of the MBean in the enclosing context.
-     *        This is of the form {@code <namespace>//<ObjectName>}.
-     * @param member The {@link
-     *  javax.management.namespace.JMXNamespacePermission#getMember member}
-     *  name.
-     * @param action The {@link
-     *  javax.management.namespace.JMXNamespacePermission#getActions action}
-     *  name.
-     */
-    void check(ObjectName routingName,
-               String member, String action) {
-    }
-
-    void checkPattern(ObjectName routingPattern,
-               String member, String action) {
-        // pattern is checked only at posteriori by checkQuery.
-        // checking it a priori usually doesn't work, because ObjectName.apply
-        // does not work between two patterns.
-        check(null,null,action);
-    }
-
-    void checkCreate(ObjectName routingName, String className,
-                     String action) {
-    }
-
     // from MBeanServerConnection
     public Object invoke(ObjectName name, String operationName, Object[] params,
                          String[] signature)
@@ -233,7 +174,6 @@
             IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            check(name, operationName, "invoke");
             final Object result =
                     source().invoke(sourceName,operationName,params,
                                    signature);
@@ -249,7 +189,6 @@
             IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            check(name, null, "unregisterMBean");
             source().unregisterMBean(sourceName);
         } catch (RuntimeException ex) {
             throw makeCompliantRuntimeException(ex);
@@ -262,7 +201,6 @@
             ReflectionException, IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            check(name, null, "getMBeanInfo");
             return source().getMBeanInfo(sourceName);
         } catch (RuntimeException ex) {
             throw makeCompliantRuntimeException(ex);
@@ -274,7 +212,6 @@
         throws InstanceNotFoundException, IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            check(name, null, "getObjectInstance");
             return processOutputInstance(
                     source().getObjectInstance(sourceName));
         } catch (RuntimeException ex) {
@@ -301,9 +238,6 @@
             ReflectionException, IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            check(name,
-                  (attribute==null?null:attribute.getName()),
-                  "setAttribute");
             source().setAttribute(sourceName,attribute);
         } catch (RuntimeException ex) {
             throw makeCompliantRuntimeException(ex);
@@ -321,8 +255,6 @@
         // Loader Name is already a sourceLoaderName.
         final ObjectName sourceLoaderName = loaderName;
         try {
-            checkCreate(name, className, "instantiate");
-            checkCreate(name, className, "registerMBean");
             final ObjectInstance instance =
                     source().createMBean(className,sourceName,
                                          sourceLoaderName,
@@ -341,8 +273,6 @@
             NotCompliantMBeanException, IOException {
         final ObjectName sourceName = newSourceMBeanName(name);
         try {
-            checkCreate(name, className, "instantiate");
-            checkCreate(name, className, "registerMBean");
             return processOutputInstance(source().createMBean(className,
                     sourceName,params,signature));
         } catch (RuntimeException ex) {
@@ -360,8 +290,6 @@
         // Loader Name is already a source Loader Name.
         final ObjectName sourceLoaderName = loaderName;
         try {
-            checkCreate(name, className, "instantiate");
-            checkCreate(name, className, "registerMBean");
             return processOutputInstance(source().createMBean(className,
                     sourceName,sourceLoaderName));
         } catch (RuntimeException ex) {
@@ -376,8 +304,6 @@
             NotCompliantMBeanException, IOException {
         final ObjectName sourceName = newSourceMBeanName(name);
         try {
-            checkCreate(name, className, "instantiate");
-            checkCreate(name, className, "registerMBean");
             return processOutputInstance(source().
                     createMBean(className,sourceName));
         } catch (RuntimeException ex) {
@@ -391,7 +317,6 @@
             InstanceNotFoundException, ReflectionException, IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            check(name, attribute, "getAttribute");
             return source().getAttribute(sourceName,attribute);
         } catch (RuntimeException ex) {
             throw makeCompliantRuntimeException(ex);
@@ -403,7 +328,6 @@
         throws InstanceNotFoundException, IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            check(name, null, "isInstanceOf");
             return source().isInstanceOf(sourceName,className);
         } catch (RuntimeException ex) {
             throw makeCompliantRuntimeException(ex);
@@ -415,10 +339,8 @@
         throws InstanceNotFoundException, ReflectionException, IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            final AttributeList authorized =
-                    checkAttributes(name, attributes, "setAttribute");
             return source().
-                    setAttributes(sourceName,authorized);
+                    setAttributes(sourceName,attributes);
         } catch (RuntimeException ex) {
             throw makeCompliantRuntimeException(ex);
         }
@@ -431,7 +353,7 @@
         for (ObjectInstance i : sources) {
             try {
                 final ObjectInstance target = processOutputInstance(i);
-                if (!checkQuery(target.getObjectName(), "queryMBeans"))
+                if (excludesFromResult(target.getObjectName(), "queryMBeans"))
                     continue;
                 result.add(target);
             } catch (Exception x) {
@@ -446,24 +368,6 @@
         return result;
     }
 
-    /**
-     * This is a hook to implement permission checking in subclasses.
-     *
-     * Checks that the caller has sufficient permission for returning
-     * information about {@code sourceName} in {@code action}.
-     *
-     * By default always return true. Subclass may override this method
-     * and return false if the caller doesn't have sufficient permissions.
-     *
-     * @param routingName The name of the MBean to include or exclude from
-     *        the query, expressed in the enclosing context.
-     *        This is of the form {@code <namespace>//<ObjectName>}.
-     * @param action one of "queryNames" or "queryMBeans"
-     * @return true if {@code sourceName} can be returned.
-     */
-    boolean checkQuery(ObjectName routingName, String action) {
-        return true;
-    }
 
     // Return names in the target's context.
     ObjectInstance processOutputInstance(ObjectInstance source) {
@@ -488,7 +392,7 @@
         for (ObjectName n : sourceNames) {
             try {
                 final ObjectName targetName = toTarget(n);
-                if (!checkQuery(targetName, "queryNames")) continue;
+                if (excludesFromResult(targetName, "queryNames")) continue;
                 names.add(targetName);
             } catch (Exception x) {
                 if (LOG.isLoggable(Level.FINE)) {
@@ -508,7 +412,6 @@
         if (name == null) name=ObjectName.WILDCARD;
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            checkPattern(name,null,"queryMBeans");
             return processOutputInstances(
                     source().queryMBeans(sourceName,query));
         } catch (RuntimeException ex) {
@@ -523,7 +426,6 @@
         if (name == null) name=ObjectName.WILDCARD;
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            checkPattern(name,null,"queryNames");
             final Set<ObjectName> tmp = source().queryNames(sourceName,query);
             final Set<ObjectName> out = processOutputNames(tmp);
             //System.err.println("queryNames: out: "+out);
@@ -540,7 +442,6 @@
         ListenerNotFoundException, IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            check(name,null,"removeNotificationListener");
             source().removeNotificationListener(sourceName,listener);
         } catch (RuntimeException ex) {
             throw makeCompliantRuntimeException(ex);
@@ -554,7 +455,6 @@
         final ObjectName sourceName = toSourceOrRuntime(name);
         // Listener name is already a source listener name.
         try {
-            check(name,null,"addNotificationListener");
             source().addNotificationListener(sourceName,listener,
                     filter,handback);
         } catch (RuntimeException ex) {
@@ -568,7 +468,6 @@
                 Object handback) throws InstanceNotFoundException, IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            check(name,null,"addNotificationListener");
             source().addNotificationListener(sourceName, listener, filter,
                     handback);
         } catch (RuntimeException ex) {
@@ -585,7 +484,6 @@
                 IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            check(name,null,"removeNotificationListener");
             source().removeNotificationListener(sourceName,listener,filter,
                     handback);
         } catch (RuntimeException ex) {
@@ -600,7 +498,6 @@
             IOException {
         final ObjectName sourceName = toSourceOrRuntime(name);
         try {
-            check(name,null,"removeNotificationListener");
             source().removeNotificationListener(sourceName,listener,
                     filter,handback);
         } catch (RuntimeException ex) {
@@ -616,7 +513,6 @@
         // listener name is already a source name...
         final ObjectName sourceListener = listener;
         try {
-            check(name,null,"removeNotificationListener");
             source().removeNotificationListener(sourceName,sourceListener);
         } catch (RuntimeException ex) {
             throw makeCompliantRuntimeException(ex);
@@ -635,30 +531,12 @@
     // from MBeanServerConnection
     public String[] getDomains() throws IOException {
         try {
-            check(null,null,"getDomains");
-            final String[] domains = source().getDomains();
-            return checkDomains(domains,"getDomains");
+            return source().getDomains();
         } catch (RuntimeException ex) {
             throw makeCompliantRuntimeException(ex);
         }
     }
 
-    /**
-     * This method is a hook to implement permission checking in subclasses.
-     * Checks that the caller as the necessary permissions to view the
-     * given domain. If not remove the domains for which the caller doesn't
-     * have permission from the list.
-     * <p>
-     * By default, this method always returns {@code domains}
-     *
-     * @param domains The domains to return.
-     * @param action  "getDomains"
-     * @return a filtered list of domains.
-     */
-    String[] checkDomains(String[] domains, String action) {
-        return domains;
-    }
-
     // from MBeanServerConnection
     public String getDefaultDomain() throws IOException {
         try {
@@ -668,4 +546,22 @@
         }
     }
 
+    /**
+     * Returns true if the given targetName must be excluded from the
+     * query result.
+     * In this base class, always return {@code false}.
+     * By default all object names returned by the sources are
+     * transmitted to the caller - there is no filtering.
+     *
+     * @param name         A target object name expressed in the caller's
+     *                     context. In the case of cascading, where the source
+     *                     is a sub agent mounted on e.g. namespace "foo",
+     *                     that would be a name prefixed by "foo//"...
+     * @param queryMethod  either "queryNames" or "queryMBeans".
+     * @return true if the name must be excluded.
+     */
+    boolean excludesFromResult(ObjectName targetName, String queryMethod) {
+        return false;
+    }
+
 }
diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingProxy.java b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingProxy.java
index 90b3793..aa35c5b 100644
--- a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingProxy.java
+++ b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingProxy.java
@@ -30,31 +30,110 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
 import javax.management.MBeanException;
 import javax.management.MBeanRegistrationException;
 
 import javax.management.MBeanServerConnection;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-import javax.management.ReflectionException;
 import javax.management.namespace.JMXNamespaces;
 
 
 /**
- * An RoutingProxy narrows on a given name space in a
+ * A RoutingProxy narrows on a given name space in a
  * source object implementing MBeanServerConnection.
  * It is used to implement
  * {@code JMXNamespaces.narrowToNamespace(...)}.
  * This abstract class has two concrete subclasses:
- * <p>{@link RoutingConnectionProxy}: to cd in an MBeanServerConnection.</p>
- * <p>{@link RoutingServerProxy}: to cd in an MBeanServer.</p>
+ * <p>{@link RoutingConnectionProxy}: to narrow down into an
+ *    MBeanServerConnection.</p>
+ * <p>{@link RoutingServerProxy}: to narrow down into an MBeanServer.</p>
+ *
+ * <p>This class can also be used to "broaden" from a namespace.  The same
+ * class is used for both purposes because in both cases all that happens
+ * is that ObjectNames are rewritten in one way on the way in (e.g. the
+ * parameter of getMBeanInfo) and another way on the way out (e.g. the
+ * return value of queryNames).</p>
+ *
+ * <p>Specifically, if you narrow into "a//" then you want to add the
+ * "a//" prefix to ObjectNames on the way in and subtract it on the way
+ * out.  But ClientContext uses this class to subtract the
+ * "jmx.context//foo=bar//" prefix on the way in and add it back on the
+ * way out.</p>
+ *
  * <p><b>
  * This API is a Sun internal API and is subject to changes without notice.
  * </b></p>
  * @since 1.7
  */
+//
+// RoutingProxies are client side objects which are used to narrow down
+// into a namespace. They are used to perform ObjectName translation,
+// adding the namespace to the routing ObjectName before sending it over
+// to the source connection, and removing that prefix from results of
+// queries, createMBean, registerMBean, and getObjectInstance.
+// This translation is the opposite to that which is performed by
+// NamespaceInterceptors.
+//
+// There is however a special case where routing proxies are used on the
+// 'server' side to remove a namespace - rather than to add it:
+// This the case of ClientContext.
+// When an ObjectName like "jmx.context//c1=v1,c2=v2//D:k=v" reaches the
+// jmx.context namespace, a routing proxy is used to remove the prefix
+// c1=v1,c2=v2// from the routing objectname.
+//
+// For a RoutingProxy used in a narrowDownToNamespace operation, we have:
+//     targetNs="" // targetNS is the namespace 'to remove'
+//     sourceNS=<namespace-we-narrow-down-to> // namespace 'to add'
+//
+// For a RoutingProxy used in a ClientContext operation, we have:
+//     targetNs=<encoded-context> // context must be removed from object name
+//     sourceNs="" // nothing to add...
+//
+// RoutingProxies can also be used on the client side to implement
+// "withClientContext" operations. In that case, the boolean parameter
+// 'forwards context' is set to true, targetNs is "", and sourceNS may
+// also be "". When forwardsContext is true, the RoutingProxy dynamically
+// creates an ObjectNameRouter for each operation - in order to dynamically add
+// the context attached to the thread to the routing ObjectName. This is
+// performed in the getObjectNameRouter() method.
+//
+// Finally, in order to avoid too many layers of wrapping,
+// RoutingConnectionProxy and RoutingServerProxy can be created through a
+// factory method that can concatenate namespace pathes in order to
+// return a single RoutingProxy - rather than wrapping a RoutingProxy inside
+// another RoutingProxy. See RoutingConnectionProxy.cd and
+// RoutingServerProxy.cd
+//
+// The class hierarchy is as follows:
+//
+//                           RoutingMBeanServerConnection
+//                   [abstract class for all routing interceptors,
+//                    such as RoutingProxies and HandlerInterceptors]
+//                            /                          \
+//                           /                            \
+//                    RoutingProxy                HandlerInterceptor
+//          [base class for                   [base class for server side
+//           client-side objects used          objects, created by
+//           in narrowDownTo]                  DispatchInterceptors]
+//           /                  \                   |          \
+//  RoutingConnectionProxy       \                  |      NamespaceInterceptor
+//  [wraps MBeanServerConnection  \                 |     [used to remove
+//   objects]                      \                |      namespace prefix and
+//                        RoutingServerProxy        |      wrap  JMXNamespace]
+//                        [wraps MBeanServer        |
+//                         Objects]                 |
+//                                            DomainInterceptor
+//                                            [used to wrap JMXDomain]
+//
+// RoutingProxies also differ from HandlerInterceptors in that they transform
+// calls to MBeanServerConnection operations that do not have any parameters
+// into a call to the underlying JMXNamespace MBean.
+// So for instance a call to:
+//    JMXNamespaces.narrowDownToNamespace(conn,"foo").getDomains()
+// is transformed into
+//    conn.getAttribute("foo//type=JMXNamespace","Domains");
+//
 public abstract class RoutingProxy<T extends MBeanServerConnection>
         extends RoutingMBeanServerConnection<T> {
 
@@ -179,17 +258,11 @@
              throw x;
          } catch (MBeanException ex) {
              throw new IOException("Failed to get "+attributeName+": "+
-                     ex.getMessage(),
-                     ex.getTargetException());
-         } catch (AttributeNotFoundException ex) {
+                     ex.getCause(),
+                     ex.getCause());
+         } catch (Exception ex) {
              throw new IOException("Failed to get "+attributeName+": "+
-                     ex.getMessage(),ex);
-         } catch (InstanceNotFoundException ex) {
-             throw new IOException("Failed to get "+attributeName+": "+
-                     ex.getMessage(),ex);
-         } catch (ReflectionException ex) {
-             throw new IOException("Failed to get "+attributeName+": "+
-                     ex.getMessage(),ex);
+                     ex,ex);
          }
     }
 
@@ -279,4 +352,62 @@
                     (" mounted on targetNs="+targetNs));
     }
 
+    // Creates an instance of a subclass 'R' of RoutingProxy<T>
+    // RoutingServerProxy and RoutingConnectionProxy have their own factory
+    // instance.
+    static interface RoutingProxyFactory<T extends MBeanServerConnection,
+            R extends RoutingProxy<T>> {
+            R newInstance(T source,
+                    String sourcePath, String targetPath,
+                    boolean forwardsContext);
+            R newInstance(T source,
+                    String sourcePath);
+    }
+
+    // Performs a narrowDownToNamespace operation.
+    // This method will attempt to merge two RoutingProxies in a single
+    // one if they are of the same class.
+    //
+    // This method is never called directly - it should be called only by
+    // subclasses of RoutingProxy.
+    //
+    // As for now it is called by:
+    // RoutingServerProxy.cd and RoutingConnectionProxy.cd.
+    //
+    static <T extends MBeanServerConnection, R extends RoutingProxy<T>>
+           R cd(Class<R> routingProxyClass,
+              RoutingProxyFactory<T,R> factory,
+              T source, String sourcePath) {
+        if (source == null) throw new IllegalArgumentException("null");
+        if (source.getClass().equals(routingProxyClass)) {
+            // cast is OK here, but findbugs complains unless we use class.cast
+            final R other = routingProxyClass.cast(source);
+            final String target = other.getTargetNamespace();
+
+            // Avoid multiple layers of serialization.
+            //
+            // We construct a new proxy from the original source instead of
+            // stacking a new proxy on top of the old one.
+            // - that is we replace
+            //      cd ( cd ( x, dir1), dir2);
+            // by
+            //      cd (x, dir1//dir2);
+            //
+            // We can do this only when the source class is exactly
+            //    RoutingServerProxy.
+            //
+            if (target == null || target.equals("")) {
+                final String path =
+                    JMXNamespaces.concat(other.getSourceNamespace(),
+                    sourcePath);
+                return factory.newInstance(other.source(),path,"",
+                                           other.forwardsContext);
+            }
+            // Note: we could do possibly something here - but it would involve
+            //       removing part of targetDir, and possibly adding
+            //       something to sourcePath.
+            //       Too complex to bother! => simply default to stacking...
+        }
+        return factory.newInstance(source,sourcePath);
+    }
 }
diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingServerProxy.java b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingServerProxy.java
index 94aa139..f58e398 100644
--- a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingServerProxy.java
+++ b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingServerProxy.java
@@ -69,6 +69,9 @@
  *
  * @since 1.7
  */
+// See class hierarchy and detailled explanations in RoutingProxy in this
+// package.
+//
 public class RoutingServerProxy
         extends RoutingProxy<MBeanServer>
         implements MBeanServer {
@@ -564,39 +567,24 @@
         }
     }
 
+    static final RoutingProxyFactory<MBeanServer,RoutingServerProxy>
+        FACTORY = new RoutingProxyFactory<MBeanServer,RoutingServerProxy>() {
+
+        public RoutingServerProxy newInstance(MBeanServer source,
+                String sourcePath, String targetPath,
+                boolean forwardsContext) {
+            return new RoutingServerProxy(source,sourcePath,
+                    targetPath,forwardsContext);
+        }
+
+        public RoutingServerProxy newInstance(
+                MBeanServer source, String sourcePath) {
+            return new RoutingServerProxy(source,sourcePath);
+        }
+    };
 
     public static MBeanServer cd(MBeanServer source, String sourcePath) {
-        if (source == null) throw new IllegalArgumentException("null");
-        if (source.getClass().equals(RoutingServerProxy.class)) {
-            // cast is OK here, but findbugs complains unless we use class.cast
-            final RoutingServerProxy other =
-                    RoutingServerProxy.class.cast(source);
-            final String target = other.getTargetNamespace();
-
-            // Avoid multiple layers of serialization.
-            //
-            // We construct a new proxy from the original source instead of
-            // stacking a new proxy on top of the old one.
-            // - that is we replace
-            //      cd ( cd ( x, dir1), dir2);
-            // by
-            //      cd (x, dir1//dir2);
-            //
-            // We can do this only when the source class is exactly
-            //    NamespaceServerProxy.
-            //
-            if (target == null || target.equals("")) {
-                final String path =
-                    JMXNamespaces.concat(other.getSourceNamespace(),
-                    sourcePath);
-                return new RoutingServerProxy(other.source(),path,"",
-                                              other.forwardsContext);
-            }
-            // Note: we could do possibly something here - but it would involve
-            //       removing part of targetDir, and possibly adding
-            //       something to sourcePath.
-            //       Too complex to bother! => simply default to stacking...
-        }
-        return new RoutingServerProxy(source,sourcePath);
+        return RoutingProxy.cd(RoutingServerProxy.class, FACTORY,
+                source, sourcePath);
     }
 }
diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientCommunicatorAdmin.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientCommunicatorAdmin.java
index a6635aa..9bc5cc7 100644
--- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientCommunicatorAdmin.java
+++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientCommunicatorAdmin.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
@@ -32,13 +32,15 @@
 import com.sun.jmx.remote.util.EnvHelp;
 
 public abstract class ClientCommunicatorAdmin {
+    private static volatile long threadNo = 1;
+
     public ClientCommunicatorAdmin(long period) {
         this.period = period;
 
         if (period > 0) {
             checker = new Checker();
 
-            Thread t = new Thread(checker);
+            Thread t = new Thread(checker, "JMX client heartbeat " + ++threadNo);
             t.setDaemon(true);
             t.start();
         } else
diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java
index b2ceb2f..ab6bd60 100644
--- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java
+++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java
@@ -290,28 +290,6 @@
 
         infoList.clear();
 
-        if (currentFetchThread == Thread.currentThread()) {
-            /* we do not need to stop the fetching thread, because this thread is
-               used to do restarting and it will not be used to do fetching during
-               the re-registering the listeners.*/
-            return tmp;
-        }
-
-        while (state == STARTING) {
-            try {
-                wait();
-            } catch (InterruptedException ire) {
-                IOException ioe = new IOException(ire.toString());
-                EnvHelp.initCause(ioe, ire);
-
-                throw ioe;
-            }
-        }
-
-        if (state == STARTED) {
-            setState(STOPPING);
-        }
-
         return tmp;
     }
 
@@ -353,8 +331,9 @@
         beingReconnected = false;
         notifyAll();
 
-        if (currentFetchThread == Thread.currentThread()) {
-            // no need to init, simply get the id
+        if (currentFetchThread == Thread.currentThread() ||
+              state == STARTING || state == STARTED) { // doing or waiting reconnection
+              // only update mbeanRemovedNotifID
             try {
                 mbeanRemovedNotifID = addListenerForMBeanRemovedNotif();
             } catch (Exception e) {
@@ -366,12 +345,23 @@
                     logger.trace("init", msg, e);
                 }
             }
-        } else if (listenerInfos.length > 0) { // old listeners re-registered
-            init(true);
-        } else if (infoList.size() > 0) {
-            // but new listeners registered during reconnection
-            init(false);
-        }
+        } else {
+              while (state == STOPPING) {
+                  try {
+                      wait();
+                  } catch (InterruptedException ire) {
+                      IOException ioe = new IOException(ire.toString());
+                      EnvHelp.initCause(ioe, ire);
+                      throw ioe;
+                  }
+              }
+
+              if (listenerInfos.length > 0) { // old listeners are re-added
+                  init(true); // not update clientSequenceNumber
+              } else if (infoList.size() > 0) { // only new listeners added during reconnection
+                  init(false); // need update clientSequenceNumber
+              }
+          }
     }
 
     public synchronized void terminate() {
@@ -486,6 +476,15 @@
             if (nr == null || shouldStop()) {
                 // tell that the thread is REALLY stopped
                 setState(STOPPED);
+
+                try {
+                      removeListenerForMBeanRemovedNotif(mbeanRemovedNotifID);
+                } catch (Exception e) {
+                    if (logger.traceOn()) {
+                        logger.trace("NotifFetcher-run",
+                                "removeListenerForMBeanRemovedNotif", e);
+                    }
+                }
             } else {
                 executor.execute(this);
             }
diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyInputStream.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyInputStream.java
index ceb6cef..8d57b8f 100644
--- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyInputStream.java
+++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyInputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyRef.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyRef.java
index 1a4478a..e159326 100644
--- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyRef.java
+++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyRef.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java b/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java
index 8b99cf1..67b9ea5 100644
--- a/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java
+++ b/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java b/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java
index d0f81e1..6281b68 100644
--- a/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java
+++ b/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/tasks/ThreadService.java b/jdk/src/share/classes/com/sun/jmx/snmp/tasks/ThreadService.java
index 544364a..452500d 100644
--- a/jdk/src/share/classes/com/sun/jmx/snmp/tasks/ThreadService.java
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/tasks/ThreadService.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/tools/jdi/MonitorInfoImpl.java b/jdk/src/share/classes/com/sun/tools/jdi/MonitorInfoImpl.java
index ea2f49d..6653199 100644
--- a/jdk/src/share/classes/com/sun/tools/jdi/MonitorInfoImpl.java
+++ b/jdk/src/share/classes/com/sun/tools/jdi/MonitorInfoImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java b/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java
index 7af0156..ec8ddaf 100644
--- a/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/tools/jdi/VMAction.java b/jdk/src/share/classes/com/sun/tools/jdi/VMAction.java
index 7a5628e..238824c 100644
--- a/jdk/src/share/classes/com/sun/tools/jdi/VMAction.java
+++ b/jdk/src/share/classes/com/sun/tools/jdi/VMAction.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/com/sun/tools/jdi/VMState.java b/jdk/src/share/classes/com/sun/tools/jdi/VMState.java
index 789e5ac..7624197 100644
--- a/jdk/src/share/classes/com/sun/tools/jdi/VMState.java
+++ b/jdk/src/share/classes/com/sun/tools/jdi/VMState.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/awt/EventQueue.java b/jdk/src/share/classes/java/awt/EventQueue.java
index f9c2652..9697ad5 100644
--- a/jdk/src/share/classes/java/awt/EventQueue.java
+++ b/jdk/src/share/classes/java/awt/EventQueue.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java
index 4ba130b..973e085 100644
--- a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java
+++ b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
@@ -42,7 +42,7 @@
     /**
      * The value is used for character storage.
      */
-    char value[];
+    char[] value;
 
     /**
      * The count is the number of characters used.
@@ -333,8 +333,7 @@
      *             <code>dst.length</code>
      *             </ul>
      */
-    public void getChars(int srcBegin, int srcEnd, char dst[],
-                                      int dstBegin)
+    public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
     {
         if (srcBegin < 0)
             throw new StringIndexOutOfBoundsException(srcBegin);
@@ -366,14 +365,14 @@
     }
 
     /**
-     * Appends the string representation of the <code>Object</code>
-     * argument.
+     * Appends the string representation of the {@code Object} argument.
      * <p>
-     * The argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then appended to this sequence.
+     * The overall effect is exactly as if the argument were converted
+     * to a string by the method {@link String#valueOf(Object)},
+     * and the characters of that string were then
+     * {@link #append(String) appended} to this character sequence.
      *
-     * @param   obj   an <code>Object</code>.
+     * @param   obj   an {@code Object}.
      * @return  a reference to this object.
      */
     public AbstractStringBuilder append(Object obj) {
@@ -383,17 +382,17 @@
     /**
      * Appends the specified string to this character sequence.
      * <p>
-     * The characters of the <code>String</code> argument are appended, in
+     * The characters of the {@code String} argument are appended, in
      * order, increasing the length of this sequence by the length of the
-     * argument. If <code>str</code> is <code>null</code>, then the four
-     * characters <code>"null"</code> are appended.
+     * argument. If {@code str} is {@code null}, then the four
+     * characters {@code "null"} are appended.
      * <p>
      * Let <i>n</i> be the length of this character sequence just prior to
-     * execution of the <code>append</code> method. Then the character at
+     * execution of the {@code append} method. Then the character at
      * index <i>k</i> in the new character sequence is equal to the character
      * at index <i>k</i> in the old character sequence, if <i>k</i> is less
      * than <i>n</i>; otherwise, it is equal to the character at index
-     * <i>k-n</i> in the argument <code>str</code>.
+     * <i>k-n</i> in the argument {@code str}.
      *
      * @param   str   a string.
      * @return  a reference to this object.
@@ -435,33 +434,33 @@
     }
 
     /**
-     * Appends a subsequence of the specified <code>CharSequence</code> to this
+     * Appends a subsequence of the specified {@code CharSequence} to this
      * sequence.
      * <p>
-     * Characters of the argument <code>s</code>, starting at
-     * index <code>start</code>, are appended, in order, to the contents of
-     * this sequence up to the (exclusive) index <code>end</code>. The length
-     * of this sequence is increased by the value of <code>end - start</code>.
+     * Characters of the argument {@code s}, starting at
+     * index {@code start}, are appended, in order, to the contents of
+     * this sequence up to the (exclusive) index {@code end}. The length
+     * of this sequence is increased by the value of {@code end - start}.
      * <p>
      * Let <i>n</i> be the length of this character sequence just prior to
-     * execution of the <code>append</code> method. Then the character at
+     * execution of the {@code append} method. Then the character at
      * index <i>k</i> in this character sequence becomes equal to the
      * character at index <i>k</i> in this sequence, if <i>k</i> is less than
      * <i>n</i>; otherwise, it is equal to the character at index
-     * <i>k+start-n</i> in the argument <code>s</code>.
+     * <i>k+start-n</i> in the argument {@code s}.
      * <p>
-     * If <code>s</code> is <code>null</code>, then this method appends
+     * If {@code s} is {@code null}, then this method appends
      * characters as if the s parameter was a sequence containing the four
-     * characters <code>"null"</code>.
+     * characters {@code "null"}.
      *
      * @param   s the sequence to append.
      * @param   start   the starting index of the subsequence to be appended.
      * @param   end     the end index of the subsequence to be appended.
      * @return  a reference to this object.
      * @throws     IndexOutOfBoundsException if
-     *                  <code>start</code> or <code>end</code> are negative, or
-     *             <code>start</code> is greater than <code>end</code> or
-     *             <code>end</code> is greater than <code>s.length()</code>
+     *             {@code start} is negative, or
+     *             {@code start} is greater than {@code end} or
+     *             {@code end} is greater than {@code s.length()}
      */
     public AbstractStringBuilder append(CharSequence s, int start, int end) {
         if (s == null)
@@ -483,22 +482,22 @@
     }
 
     /**
-     * Appends the string representation of the <code>char</code> array
+     * Appends the string representation of the {@code char} array
      * argument to this sequence.
      * <p>
      * The characters of the array argument are appended, in order, to
      * the contents of this sequence. The length of this sequence
      * increases by the length of the argument.
      * <p>
-     * The overall effect is exactly as if the argument were converted to
-     * a string by the method {@link String#valueOf(char[])} and the
-     * characters of that string were then {@link #append(String) appended}
-     * to this character sequence.
+     * The overall effect is exactly as if the argument were converted
+     * to a string by the method {@link String#valueOf(char[])},
+     * and the characters of that string were then
+     * {@link #append(String) appended} to this character sequence.
      *
      * @param   str   the characters to be appended.
      * @return  a reference to this object.
      */
-    public AbstractStringBuilder append(char str[]) {
+    public AbstractStringBuilder append(char[] str) {
         int newCount = count + str.length;
         if (newCount > value.length)
             expandCapacity(newCount);
@@ -509,22 +508,25 @@
 
     /**
      * Appends the string representation of a subarray of the
-     * <code>char</code> array argument to this sequence.
+     * {@code char} array argument to this sequence.
      * <p>
-     * Characters of the <code>char</code> array <code>str</code>, starting at
-     * index <code>offset</code>, are appended, in order, to the contents
+     * Characters of the {@code char} array {@code str}, starting at
+     * index {@code offset}, are appended, in order, to the contents
      * of this sequence. The length of this sequence increases
-     * by the value of <code>len</code>.
+     * by the value of {@code len}.
      * <p>
-     * The overall effect is exactly as if the arguments were converted to
-     * a string by the method {@link String#valueOf(char[],int,int)} and the
-     * characters of that string were then {@link #append(String) appended}
-     * to this character sequence.
+     * The overall effect is exactly as if the arguments were converted
+     * to a string by the method {@link String#valueOf(char[],int,int)},
+     * and the characters of that string were then
+     * {@link #append(String) appended} to this character sequence.
      *
      * @param   str      the characters to be appended.
-     * @param   offset   the index of the first <code>char</code> to append.
-     * @param   len      the number of <code>char</code>s to append.
+     * @param   offset   the index of the first {@code char} to append.
+     * @param   len      the number of {@code char}s to append.
      * @return  a reference to this object.
+     * @throws IndexOutOfBoundsException
+     *         if {@code offset < 0} or {@code len < 0}
+     *         or {@code offset+len > str.length}
      */
     public AbstractStringBuilder append(char str[], int offset, int len) {
         int newCount = count + len;
@@ -536,14 +538,15 @@
     }
 
     /**
-     * Appends the string representation of the <code>boolean</code>
+     * Appends the string representation of the {@code boolean}
      * argument to the sequence.
      * <p>
-     * The argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then appended to this sequence.
+     * The overall effect is exactly as if the argument were converted
+     * to a string by the method {@link String#valueOf(boolean)},
+     * and the characters of that string were then
+     * {@link #append(String) appended} to this character sequence.
      *
-     * @param   b   a <code>boolean</code>.
+     * @param   b   a {@code boolean}.
      * @return  a reference to this object.
      */
     public AbstractStringBuilder append(boolean b) {
@@ -569,18 +572,18 @@
     }
 
     /**
-     * Appends the string representation of the <code>char</code>
+     * Appends the string representation of the {@code char}
      * argument to this sequence.
      * <p>
      * The argument is appended to the contents of this sequence.
-     * The length of this sequence increases by <code>1</code>.
+     * The length of this sequence increases by {@code 1}.
      * <p>
-     * The overall effect is exactly as if the argument were converted to
-     * a string by the method {@link String#valueOf(char)} and the character
-     * in that string were then {@link #append(String) appended} to this
-     * character sequence.
+     * The overall effect is exactly as if the argument were converted
+     * to a string by the method {@link String#valueOf(char)},
+     * and the character in that string were then
+     * {@link #append(String) appended} to this character sequence.
      *
-     * @param   c   a <code>char</code>.
+     * @param   c   a {@code char}.
      * @return  a reference to this object.
      */
     public AbstractStringBuilder append(char c) {
@@ -592,14 +595,15 @@
     }
 
     /**
-     * Appends the string representation of the <code>int</code>
+     * Appends the string representation of the {@code int}
      * argument to this sequence.
      * <p>
-     * The argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then appended to this sequence.
+     * The overall effect is exactly as if the argument were converted
+     * to a string by the method {@link String#valueOf(int)},
+     * and the characters of that string were then
+     * {@link #append(String) appended} to this character sequence.
      *
-     * @param   i   an <code>int</code>.
+     * @param   i   an {@code int}.
      * @return  a reference to this object.
      */
     public AbstractStringBuilder append(int i) {
@@ -618,14 +622,15 @@
     }
 
     /**
-     * Appends the string representation of the <code>long</code>
+     * Appends the string representation of the {@code long}
      * argument to this sequence.
      * <p>
-     * The argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then appended to this sequence.
+     * The overall effect is exactly as if the argument were converted
+     * to a string by the method {@link String#valueOf(long)},
+     * and the characters of that string were then
+     * {@link #append(String) appended} to this character sequence.
      *
-     * @param   l   a <code>long</code>.
+     * @param   l   a {@code long}.
      * @return  a reference to this object.
      */
     public AbstractStringBuilder append(long l) {
@@ -644,14 +649,15 @@
     }
 
     /**
-     * Appends the string representation of the <code>float</code>
+     * Appends the string representation of the {@code float}
      * argument to this sequence.
      * <p>
-     * The argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then appended to this string sequence.
+     * The overall effect is exactly as if the argument were converted
+     * to a string by the method {@link String#valueOf(float)},
+     * and the characters of that string were then
+     * {@link #append(String) appended} to this character sequence.
      *
-     * @param   f   a <code>float</code>.
+     * @param   f   a {@code float}.
      * @return  a reference to this object.
      */
     public AbstractStringBuilder append(float f) {
@@ -660,14 +666,15 @@
     }
 
     /**
-     * Appends the string representation of the <code>double</code>
+     * Appends the string representation of the {@code double}
      * argument to this sequence.
      * <p>
-     * The argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then appended to this sequence.
+     * The overall effect is exactly as if the argument were converted
+     * to a string by the method {@link String#valueOf(double)},
+     * and the characters of that string were then
+     * {@link #append(String) appended} to this character sequence.
      *
-     * @param   d   a <code>double</code>.
+     * @param   d   a {@code double}.
      * @return  a reference to this object.
      */
     public AbstractStringBuilder append(double d) {
@@ -677,17 +684,17 @@
 
     /**
      * Removes the characters in a substring of this sequence.
-     * The substring begins at the specified <code>start</code> and extends to
-     * the character at index <code>end - 1</code> or to the end of the
+     * The substring begins at the specified {@code start} and extends to
+     * the character at index {@code end - 1} or to the end of the
      * sequence if no such character exists. If
-     * <code>start</code> is equal to <code>end</code>, no changes are made.
+     * {@code start} is equal to {@code end}, no changes are made.
      *
      * @param      start  The beginning index, inclusive.
      * @param      end    The ending index, exclusive.
      * @return     This object.
-     * @throws     StringIndexOutOfBoundsException  if <code>start</code>
-     *             is negative, greater than <code>length()</code>, or
-     *             greater than <code>end</code>.
+     * @throws     StringIndexOutOfBoundsException  if {@code start}
+     *             is negative, greater than {@code length()}, or
+     *             greater than {@code end}.
      */
     public AbstractStringBuilder delete(int start, int end) {
         if (start < 0)
@@ -705,7 +712,7 @@
     }
 
     /**
-     * Appends the string representation of the <code>codePoint</code>
+     * Appends the string representation of the {@code codePoint}
      * argument to this sequence.
      *
      * <p> The argument is appended to the contents of this sequence.
@@ -713,15 +720,15 @@
      * {@link Character#charCount(int) Character.charCount(codePoint)}.
      *
      * <p> The overall effect is exactly as if the argument were
-     * converted to a <code>char</code> array by the method {@link
-     * Character#toChars(int)} and the character in that array were
-     * then {@link #append(char[]) appended} to this character
+     * converted to a {@code char} array by the method
+     * {@link Character#toChars(int)} and the character in that array
+     * were then {@link #append(char[]) appended} to this character
      * sequence.
      *
      * @param   codePoint   a Unicode code point
      * @return  a reference to this object.
      * @exception IllegalArgumentException if the specified
-     * <code>codePoint</code> isn't a valid Unicode code point
+     * {@code codePoint} isn't a valid Unicode code point
      */
     public AbstractStringBuilder appendCodePoint(int codePoint) {
         if (!Character.isValidCodePoint(codePoint)) {
@@ -879,27 +886,27 @@
     }
 
     /**
-     * Inserts the string representation of a subarray of the <code>str</code>
+     * Inserts the string representation of a subarray of the {@code str}
      * array argument into this sequence. The subarray begins at the
-     * specified <code>offset</code> and extends <code>len</code> <code>char</code>s.
+     * specified {@code offset} and extends {@code len} {@code char}s.
      * The characters of the subarray are inserted into this sequence at
-     * the position indicated by <code>index</code>. The length of this
-     * sequence increases by <code>len</code> <code>char</code>s.
+     * the position indicated by {@code index}. The length of this
+     * sequence increases by {@code len} {@code char}s.
      *
      * @param      index    position at which to insert subarray.
-     * @param      str       A <code>char</code> array.
-     * @param      offset   the index of the first <code>char</code> in subarray to
+     * @param      str       A {@code char} array.
+     * @param      offset   the index of the first {@code char} in subarray to
      *             be inserted.
-     * @param      len      the number of <code>char</code>s in the subarray to
+     * @param      len      the number of {@code char}s in the subarray to
      *             be inserted.
      * @return     This object
-     * @throws     StringIndexOutOfBoundsException  if <code>index</code>
-     *             is negative or greater than <code>length()</code>, or
-     *             <code>offset</code> or <code>len</code> are negative, or
-     *             <code>(offset+len)</code> is greater than
-     *             <code>str.length</code>.
+     * @throws     StringIndexOutOfBoundsException  if {@code index}
+     *             is negative or greater than {@code length()}, or
+     *             {@code offset} or {@code len} are negative, or
+     *             {@code (offset+len)} is greater than
+     *             {@code str.length}.
      */
-    public AbstractStringBuilder insert(int index, char str[], int offset,
+    public AbstractStringBuilder insert(int index, char[] str, int offset,
                                         int len)
     {
         if ((index < 0) || (index > length()))
@@ -918,20 +925,21 @@
     }
 
     /**
-     * Inserts the string representation of the <code>Object</code>
+     * Inserts the string representation of the {@code Object}
      * argument into this character sequence.
      * <p>
-     * The second argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then inserted into this sequence at the indicated
-     * offset.
+     * The overall effect is exactly as if the second argument were
+     * converted to a string by the method {@link String#valueOf(Object)},
+     * and the characters of that string were then
+     * {@link #insert(int,String) inserted} into this character
+     * sequence at the indicated offset.
      * <p>
-     * The offset argument must be greater than or equal to
-     * <code>0</code>, and less than or equal to the length of this
-     * sequence.
+     * The {@code offset} argument must be greater than or equal to
+     * {@code 0}, and less than or equal to the {@linkplain #length() length}
+     * of this sequence.
      *
      * @param      offset   the offset.
-     * @param      obj      an <code>Object</code>.
+     * @param      obj      an {@code Object}.
      * @return     a reference to this object.
      * @throws     StringIndexOutOfBoundsException  if the offset is invalid.
      */
@@ -942,28 +950,28 @@
     /**
      * Inserts the string into this character sequence.
      * <p>
-     * The characters of the <code>String</code> argument are inserted, in
+     * The characters of the {@code String} argument are inserted, in
      * order, into this sequence at the indicated offset, moving up any
      * characters originally above that position and increasing the length
      * of this sequence by the length of the argument. If
-     * <code>str</code> is <code>null</code>, then the four characters
-     * <code>"null"</code> are inserted into this sequence.
+     * {@code str} is {@code null}, then the four characters
+     * {@code "null"} are inserted into this sequence.
      * <p>
      * The character at index <i>k</i> in the new character sequence is
      * equal to:
      * <ul>
      * <li>the character at index <i>k</i> in the old character sequence, if
-     * <i>k</i> is less than <code>offset</code>
-     * <li>the character at index <i>k</i><code>-offset</code> in the
-     * argument <code>str</code>, if <i>k</i> is not less than
-     * <code>offset</code> but is less than <code>offset+str.length()</code>
-     * <li>the character at index <i>k</i><code>-str.length()</code> in the
+     * <i>k</i> is less than {@code offset}
+     * <li>the character at index <i>k</i>{@code -offset} in the
+     * argument {@code str}, if <i>k</i> is not less than
+     * {@code offset} but is less than {@code offset+str.length()}
+     * <li>the character at index <i>k</i>{@code -str.length()} in the
      * old character sequence, if <i>k</i> is not less than
-     * <code>offset+str.length()</code>
+     * {@code offset+str.length()}
      * </ul><p>
-     * The offset argument must be greater than or equal to
-     * <code>0</code>, and less than or equal to the length of this
-     * sequence.
+     * The {@code offset} argument must be greater than or equal to
+     * {@code 0}, and less than or equal to the {@linkplain #length() length}
+     * of this sequence.
      *
      * @param      offset   the offset.
      * @param      str      a string.
@@ -986,27 +994,30 @@
     }
 
     /**
-     * Inserts the string representation of the <code>char</code> array
+     * Inserts the string representation of the {@code char} array
      * argument into this sequence.
      * <p>
      * The characters of the array argument are inserted into the
      * contents of this sequence at the position indicated by
-     * <code>offset</code>. The length of this sequence increases by
+     * {@code offset}. The length of this sequence increases by
      * the length of the argument.
      * <p>
-     * The overall effect is exactly as if the argument were converted to
-     * a string by the method {@link String#valueOf(char[])} and the
-     * characters of that string were then
-     * {@link #insert(int,String) inserted} into this
-     * character sequence at the position indicated by
-     * <code>offset</code>.
+     * The overall effect is exactly as if the second argument were
+     * converted to a string by the method {@link String#valueOf(char[])},
+     * and the characters of that string were then
+     * {@link #insert(int,String) inserted} into this character
+     * sequence at the indicated offset.
+     * <p>
+     * The {@code offset} argument must be greater than or equal to
+     * {@code 0}, and less than or equal to the {@linkplain #length() length}
+     * of this sequence.
      *
      * @param      offset   the offset.
      * @param      str      a character array.
      * @return     a reference to this object.
      * @throws     StringIndexOutOfBoundsException  if the offset is invalid.
      */
-    public AbstractStringBuilder insert(int offset, char str[]) {
+    public AbstractStringBuilder insert(int offset, char[] str) {
         if ((offset < 0) || (offset > length()))
             throw new StringIndexOutOfBoundsException(offset);
         int len = str.length;
@@ -1020,18 +1031,20 @@
     }
 
     /**
-     * Inserts the specified <code>CharSequence</code> into this sequence.
+     * Inserts the specified {@code CharSequence} into this sequence.
      * <p>
-     * The characters of the <code>CharSequence</code> argument are inserted,
+     * The characters of the {@code CharSequence} argument are inserted,
      * in order, into this sequence at the indicated offset, moving up
      * any characters originally above that position and increasing the length
      * of this sequence by the length of the argument s.
      * <p>
      * The result of this method is exactly the same as if it were an
-     * invocation of this object's insert(dstOffset, s, 0, s.length()) method.
+     * invocation of this object's
+     * {@link #insert(int,CharSequence,int,int) insert}(dstOffset, s, 0, s.length())
+     * method.
      *
-     * <p>If <code>s</code> is <code>null</code>, then the four characters
-     * <code>"null"</code> are inserted into this sequence.
+     * <p>If {@code s} is {@code null}, then the four characters
+     * {@code "null"} are inserted into this sequence.
      *
      * @param      dstOffset   the offset.
      * @param      s the sequence to be inserted
@@ -1047,51 +1060,51 @@
     }
 
     /**
-     * Inserts a subsequence of the specified <code>CharSequence</code> into
+     * Inserts a subsequence of the specified {@code CharSequence} into
      * this sequence.
      * <p>
-     * The subsequence of the argument <code>s</code> specified by
-     * <code>start</code> and <code>end</code> are inserted,
+     * The subsequence of the argument {@code s} specified by
+     * {@code start} and {@code end} are inserted,
      * in order, into this sequence at the specified destination offset, moving
      * up any characters originally above that position. The length of this
-     * sequence is increased by <code>end - start</code>.
+     * sequence is increased by {@code end - start}.
      * <p>
      * The character at index <i>k</i> in this sequence becomes equal to:
      * <ul>
      * <li>the character at index <i>k</i> in this sequence, if
-     * <i>k</i> is less than <code>dstOffset</code>
-     * <li>the character at index <i>k</i><code>+start-dstOffset</code> in
-     * the argument <code>s</code>, if <i>k</i> is greater than or equal to
-     * <code>dstOffset</code> but is less than <code>dstOffset+end-start</code>
-     * <li>the character at index <i>k</i><code>-(end-start)</code> in this
+     * <i>k</i> is less than {@code dstOffset}
+     * <li>the character at index <i>k</i>{@code +start-dstOffset} in
+     * the argument {@code s}, if <i>k</i> is greater than or equal to
+     * {@code dstOffset} but is less than {@code dstOffset+end-start}
+     * <li>the character at index <i>k</i>{@code -(end-start)} in this
      * sequence, if <i>k</i> is greater than or equal to
-     * <code>dstOffset+end-start</code>
+     * {@code dstOffset+end-start}
      * </ul><p>
-     * The dstOffset argument must be greater than or equal to
-     * <code>0</code>, and less than or equal to the length of this
-     * sequence.
+     * The {@code dstOffset} argument must be greater than or equal to
+     * {@code 0}, and less than or equal to the {@linkplain #length() length}
+     * of this sequence.
      * <p>The start argument must be nonnegative, and not greater than
-     * <code>end</code>.
+     * {@code end}.
      * <p>The end argument must be greater than or equal to
-     * <code>start</code>, and less than or equal to the length of s.
+     * {@code start}, and less than or equal to the length of s.
      *
-     * <p>If <code>s</code> is <code>null</code>, then this method inserts
+     * <p>If {@code s} is {@code null}, then this method inserts
      * characters as if the s parameter was a sequence containing the four
-     * characters <code>"null"</code>.
+     * characters {@code "null"}.
      *
      * @param      dstOffset   the offset in this sequence.
      * @param      s       the sequence to be inserted.
      * @param      start   the starting index of the subsequence to be inserted.
      * @param      end     the end index of the subsequence to be inserted.
      * @return     a reference to this object.
-     * @throws     IndexOutOfBoundsException  if <code>dstOffset</code>
-     *             is negative or greater than <code>this.length()</code>, or
-     *              <code>start</code> or <code>end</code> are negative, or
-     *              <code>start</code> is greater than <code>end</code> or
-     *              <code>end</code> is greater than <code>s.length()</code>
+     * @throws     IndexOutOfBoundsException  if {@code dstOffset}
+     *             is negative or greater than {@code this.length()}, or
+     *              {@code start} or {@code end} are negative, or
+     *              {@code start} is greater than {@code end} or
+     *              {@code end} is greater than {@code s.length()}
      */
      public AbstractStringBuilder insert(int dstOffset, CharSequence s,
-                                           int start, int end) {
+                                         int start, int end) {
         if (s == null)
             s = "null";
         if ((dstOffset < 0) || (dstOffset > this.length()))
@@ -1115,20 +1128,21 @@
     }
 
     /**
-     * Inserts the string representation of the <code>boolean</code>
+     * Inserts the string representation of the {@code boolean}
      * argument into this sequence.
      * <p>
-     * The second argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then inserted into this sequence at the indicated
-     * offset.
+     * The overall effect is exactly as if the second argument were
+     * converted to a string by the method {@link String#valueOf(boolean)},
+     * and the characters of that string were then
+     * {@link #insert(int,String) inserted} into this character
+     * sequence at the indicated offset.
      * <p>
-     * The offset argument must be greater than or equal to
-     * <code>0</code>, and less than or equal to the length of this
-     * sequence.
+     * The {@code offset} argument must be greater than or equal to
+     * {@code 0}, and less than or equal to the {@linkplain #length() length}
+     * of this sequence.
      *
      * @param      offset   the offset.
-     * @param      b        a <code>boolean</code>.
+     * @param      b        a {@code boolean}.
      * @return     a reference to this object.
      * @throws     StringIndexOutOfBoundsException  if the offset is invalid.
      */
@@ -1137,25 +1151,21 @@
     }
 
     /**
-     * Inserts the string representation of the <code>char</code>
+     * Inserts the string representation of the {@code char}
      * argument into this sequence.
      * <p>
-     * The second argument is inserted into the contents of this sequence
-     * at the position indicated by <code>offset</code>. The length
-     * of this sequence increases by one.
+     * The overall effect is exactly as if the second argument were
+     * converted to a string by the method {@link String#valueOf(char)},
+     * and the character in that string were then
+     * {@link #insert(int,String) inserted} into this character
+     * sequence at the indicated offset.
      * <p>
-     * The overall effect is exactly as if the argument were converted to
-     * a string by the method {@link String#valueOf(char)} and the character
-     * in that string were then {@link #insert(int, String) inserted} into
-     * this character sequence at the position indicated by
-     * <code>offset</code>.
-     * <p>
-     * The offset argument must be greater than or equal to
-     * <code>0</code>, and less than or equal to the length of this
-     * sequence.
+     * The {@code offset} argument must be greater than or equal to
+     * {@code 0}, and less than or equal to the {@linkplain #length() length}
+     * of this sequence.
      *
      * @param      offset   the offset.
-     * @param      c        a <code>char</code>.
+     * @param      c        a {@code char}.
      * @return     a reference to this object.
      * @throws     IndexOutOfBoundsException  if the offset is invalid.
      */
@@ -1170,20 +1180,21 @@
     }
 
     /**
-     * Inserts the string representation of the second <code>int</code>
+     * Inserts the string representation of the second {@code int}
      * argument into this sequence.
      * <p>
-     * The second argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then inserted into this sequence at the indicated
-     * offset.
+     * The overall effect is exactly as if the second argument were
+     * converted to a string by the method {@link String#valueOf(int)},
+     * and the characters of that string were then
+     * {@link #insert(int,String) inserted} into this character
+     * sequence at the indicated offset.
      * <p>
-     * The offset argument must be greater than or equal to
-     * <code>0</code>, and less than or equal to the length of this
-     * sequence.
+     * The {@code offset} argument must be greater than or equal to
+     * {@code 0}, and less than or equal to the {@linkplain #length() length}
+     * of this sequence.
      *
      * @param      offset   the offset.
-     * @param      i        an <code>int</code>.
+     * @param      i        an {@code int}.
      * @return     a reference to this object.
      * @throws     StringIndexOutOfBoundsException  if the offset is invalid.
      */
@@ -1192,20 +1203,21 @@
     }
 
     /**
-     * Inserts the string representation of the <code>long</code>
+     * Inserts the string representation of the {@code long}
      * argument into this sequence.
      * <p>
-     * The second argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then inserted into this sequence at the position
-     * indicated by <code>offset</code>.
+     * The overall effect is exactly as if the second argument were
+     * converted to a string by the method {@link String#valueOf(long)},
+     * and the characters of that string were then
+     * {@link #insert(int,String) inserted} into this character
+     * sequence at the indicated offset.
      * <p>
-     * The offset argument must be greater than or equal to
-     * <code>0</code>, and less than or equal to the length of this
-     * sequence.
+     * The {@code offset} argument must be greater than or equal to
+     * {@code 0}, and less than or equal to the {@linkplain #length() length}
+     * of this sequence.
      *
      * @param      offset   the offset.
-     * @param      l        a <code>long</code>.
+     * @param      l        a {@code long}.
      * @return     a reference to this object.
      * @throws     StringIndexOutOfBoundsException  if the offset is invalid.
      */
@@ -1214,20 +1226,21 @@
     }
 
     /**
-     * Inserts the string representation of the <code>float</code>
+     * Inserts the string representation of the {@code float}
      * argument into this sequence.
      * <p>
-     * The second argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then inserted into this sequence at the indicated
-     * offset.
+     * The overall effect is exactly as if the second argument were
+     * converted to a string by the method {@link String#valueOf(float)},
+     * and the characters of that string were then
+     * {@link #insert(int,String) inserted} into this character
+     * sequence at the indicated offset.
      * <p>
-     * The offset argument must be greater than or equal to
-     * <code>0</code>, and less than or equal to the length of this
-     * sequence.
+     * The {@code offset} argument must be greater than or equal to
+     * {@code 0}, and less than or equal to the {@linkplain #length() length}
+     * of this sequence.
      *
      * @param      offset   the offset.
-     * @param      f        a <code>float</code>.
+     * @param      f        a {@code float}.
      * @return     a reference to this object.
      * @throws     StringIndexOutOfBoundsException  if the offset is invalid.
      */
@@ -1236,20 +1249,21 @@
     }
 
     /**
-     * Inserts the string representation of the <code>double</code>
+     * Inserts the string representation of the {@code double}
      * argument into this sequence.
      * <p>
-     * The second argument is converted to a string as if by the method
-     * <code>String.valueOf</code>, and the characters of that
-     * string are then inserted into this sequence at the indicated
-     * offset.
+     * The overall effect is exactly as if the second argument were
+     * converted to a string by the method {@link String#valueOf(double)},
+     * and the characters of that string were then
+     * {@link #insert(int,String) inserted} into this character
+     * sequence at the indicated offset.
      * <p>
-     * The offset argument must be greater than or equal to
-     * <code>0</code>, and less than or equal to the length of this
-     * sequence.
+     * The {@code offset} argument must be greater than or equal to
+     * {@code 0}, and less than or equal to the {@linkplain #length() length}
+     * of this sequence.
      *
      * @param      offset   the offset.
-     * @param      d        a <code>double</code>.
+     * @param      d        a {@code double}.
      * @return     a reference to this object.
      * @throws     StringIndexOutOfBoundsException  if the offset is invalid.
      */
diff --git a/jdk/src/share/classes/java/lang/StringBuffer.java b/jdk/src/share/classes/java/lang/StringBuffer.java
index e0ecbef..c8cb51d 100644
--- a/jdk/src/share/classes/java/lang/StringBuffer.java
+++ b/jdk/src/share/classes/java/lang/StringBuffer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1994-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1994-2008 Sun Microsystems, Inc.  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
@@ -212,7 +212,7 @@
      * @throws NullPointerException {@inheritDoc}
      * @throws IndexOutOfBoundsException {@inheritDoc}
      */
-    public synchronized void getChars(int srcBegin, int srcEnd, char dst[],
+    public synchronized void getChars(int srcBegin, int srcEnd, char[] dst,
                                       int dstBegin)
     {
         super.getChars(srcBegin, srcEnd, dst, dstBegin);
@@ -228,10 +228,6 @@
         value[index] = ch;
     }
 
-    /**
-     * @see     java.lang.String#valueOf(java.lang.Object)
-     * @see     #append(java.lang.String)
-     */
     public synchronized StringBuffer append(Object obj) {
         super.append(String.valueOf(obj));
         return this;
@@ -314,20 +310,19 @@
         return this;
     }
 
-    public synchronized StringBuffer append(char str[]) {
+    public synchronized StringBuffer append(char[] str) {
         super.append(str);
         return this;
     }
 
-    public synchronized StringBuffer append(char str[], int offset, int len) {
+    /**
+     * @throws IndexOutOfBoundsException {@inheritDoc}
+     */
+    public synchronized StringBuffer append(char[] str, int offset, int len) {
         super.append(str, offset, len);
         return this;
     }
 
-    /**
-     * @see     java.lang.String#valueOf(boolean)
-     * @see     #append(java.lang.String)
-     */
     public synchronized StringBuffer append(boolean b) {
         super.append(b);
         return this;
@@ -338,10 +333,6 @@
         return this;
     }
 
-    /**
-     * @see     java.lang.String#valueOf(int)
-     * @see     #append(java.lang.String)
-     */
     public synchronized StringBuffer append(int i) {
         super.append(i);
         return this;
@@ -355,28 +346,16 @@
         return this;
     }
 
-    /**
-     * @see     java.lang.String#valueOf(long)
-     * @see     #append(java.lang.String)
-     */
     public synchronized StringBuffer append(long lng) {
         super.append(lng);
         return this;
     }
 
-    /**
-     * @see     java.lang.String#valueOf(float)
-     * @see     #append(java.lang.String)
-     */
     public synchronized StringBuffer append(float f) {
         super.append(f);
         return this;
     }
 
-    /**
-     * @see     java.lang.String#valueOf(double)
-     * @see     #append(java.lang.String)
-     */
     public synchronized StringBuffer append(double d) {
         super.append(d);
         return this;
@@ -437,7 +416,7 @@
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
      * @since      1.2
      */
-    public synchronized StringBuffer insert(int index, char str[], int offset,
+    public synchronized StringBuffer insert(int index, char[] str, int offset,
                                             int len)
     {
         super.insert(index, str, offset, len);
@@ -446,9 +425,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(java.lang.Object)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public synchronized StringBuffer insert(int offset, Object obj) {
         super.insert(offset, String.valueOf(obj));
@@ -457,7 +433,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        #length()
      */
     public synchronized StringBuffer insert(int offset, String str) {
         super.insert(offset, str);
@@ -467,7 +442,7 @@
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
      */
-    public synchronized StringBuffer insert(int offset, char str[]) {
+    public synchronized StringBuffer insert(int offset, char[] str) {
         super.insert(offset, str);
         return this;
     }
@@ -498,9 +473,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(boolean)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public StringBuffer insert(int offset, boolean b) {
         return insert(offset, String.valueOf(b));
@@ -508,7 +480,6 @@
 
     /**
      * @throws IndexOutOfBoundsException {@inheritDoc}
-     * @see        #length()
      */
     public synchronized StringBuffer insert(int offset, char c) {
         super.insert(offset, c);
@@ -517,9 +488,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(int)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public StringBuffer insert(int offset, int i) {
         return insert(offset, String.valueOf(i));
@@ -527,9 +495,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(long)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public StringBuffer insert(int offset, long l) {
         return insert(offset, String.valueOf(l));
@@ -537,9 +502,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(float)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public StringBuffer insert(int offset, float f) {
         return insert(offset, String.valueOf(f));
@@ -547,9 +509,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(double)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public StringBuffer insert(int offset, double d) {
         return insert(offset, String.valueOf(d));
diff --git a/jdk/src/share/classes/java/lang/StringBuilder.java b/jdk/src/share/classes/java/lang/StringBuilder.java
index 99f1976..803d70e 100644
--- a/jdk/src/share/classes/java/lang/StringBuilder.java
+++ b/jdk/src/share/classes/java/lang/StringBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
@@ -124,10 +124,6 @@
         append(seq);
     }
 
-    /**
-     * @see     java.lang.String#valueOf(java.lang.Object)
-     * @see     #append(java.lang.String)
-     */
     public StringBuilder append(Object obj) {
         return append(String.valueOf(obj));
     }
@@ -175,7 +171,6 @@
     }
 
     /**
-     * @throws IndexOutOfBoundsException {@inheritDoc}
      */
     public StringBuilder append(CharSequence s) {
         if (s == null)
@@ -197,20 +192,19 @@
         return this;
     }
 
-    public StringBuilder append(char str[]) {
+    public StringBuilder append(char[] str) {
         super.append(str);
         return this;
     }
 
-    public StringBuilder append(char str[], int offset, int len) {
+    /**
+     * @throws IndexOutOfBoundsException {@inheritDoc}
+     */
+    public StringBuilder append(char[] str, int offset, int len) {
         super.append(str, offset, len);
         return this;
     }
 
-    /**
-     * @see     java.lang.String#valueOf(boolean)
-     * @see     #append(java.lang.String)
-     */
     public StringBuilder append(boolean b) {
         super.append(b);
         return this;
@@ -221,37 +215,21 @@
         return this;
     }
 
-    /**
-     * @see     java.lang.String#valueOf(int)
-     * @see     #append(java.lang.String)
-     */
     public StringBuilder append(int i) {
         super.append(i);
         return this;
     }
 
-    /**
-     * @see     java.lang.String#valueOf(long)
-     * @see     #append(java.lang.String)
-     */
     public StringBuilder append(long lng) {
         super.append(lng);
         return this;
     }
 
-    /**
-     * @see     java.lang.String#valueOf(float)
-     * @see     #append(java.lang.String)
-     */
     public StringBuilder append(float f) {
         super.append(f);
         return this;
     }
 
-    /**
-     * @see     java.lang.String#valueOf(double)
-     * @see     #append(java.lang.String)
-     */
     public StringBuilder append(double d) {
         super.append(d);
         return this;
@@ -292,7 +270,7 @@
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
      */
-    public StringBuilder insert(int index, char str[], int offset,
+    public StringBuilder insert(int index, char[] str, int offset,
                                 int len)
     {
         super.insert(index, str, offset, len);
@@ -301,9 +279,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(java.lang.Object)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public StringBuilder insert(int offset, Object obj) {
         return insert(offset, String.valueOf(obj));
@@ -311,7 +286,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        #length()
      */
     public StringBuilder insert(int offset, String str) {
         super.insert(offset, str);
@@ -321,7 +295,7 @@
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
      */
-    public StringBuilder insert(int offset, char str[]) {
+    public StringBuilder insert(int offset, char[] str) {
         super.insert(offset, str);
         return this;
     }
@@ -349,9 +323,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(boolean)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public StringBuilder insert(int offset, boolean b) {
         super.insert(offset, b);
@@ -360,7 +331,6 @@
 
     /**
      * @throws IndexOutOfBoundsException {@inheritDoc}
-     * @see        #length()
      */
     public StringBuilder insert(int offset, char c) {
         super.insert(offset, c);
@@ -369,9 +339,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(int)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public StringBuilder insert(int offset, int i) {
         return insert(offset, String.valueOf(i));
@@ -379,9 +346,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(long)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public StringBuilder insert(int offset, long l) {
         return insert(offset, String.valueOf(l));
@@ -389,9 +353,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(float)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public StringBuilder insert(int offset, float f) {
         return insert(offset, String.valueOf(f));
@@ -399,9 +360,6 @@
 
     /**
      * @throws StringIndexOutOfBoundsException {@inheritDoc}
-     * @see        java.lang.String#valueOf(double)
-     * @see        #insert(int, java.lang.String)
-     * @see        #length()
      */
     public StringBuilder insert(int offset, double d) {
         return insert(offset, String.valueOf(d));
diff --git a/jdk/src/share/classes/java/lang/management/PlatformComponent.java b/jdk/src/share/classes/java/lang/management/PlatformComponent.java
index a90d0c7..77c0116 100644
--- a/jdk/src/share/classes/java/lang/management/PlatformComponent.java
+++ b/jdk/src/share/classes/java/lang/management/PlatformComponent.java
@@ -388,7 +388,7 @@
             // if there are more than 1 key properties (i.e. other than "type")
             domainAndType += ",*";
         }
-        ObjectName on = com.sun.jmx.mbeanserver.Util.newObjectName(domainAndType);
+        ObjectName on = ObjectName.valueOf(domainAndType);
         Set<ObjectName> set =  mbs.queryNames(on, null);
         for (PlatformComponent pc : subComponents) {
             set.addAll(pc.getObjectNames(mbs));
diff --git a/jdk/src/share/classes/java/net/HttpCookie.java b/jdk/src/share/classes/java/net/HttpCookie.java
index 6e495e0..1fcdd6c 100644
--- a/jdk/src/share/classes/java/net/HttpCookie.java
+++ b/jdk/src/share/classes/java/net/HttpCookie.java
@@ -75,6 +75,7 @@
     private String path;        // Path=VALUE ... URLs that see the cookie
     private String portlist;    // Port[="portlist"] ... the port cookie may be returned to
     private boolean secure;     // Secure ... e.g. use SSL
+    private boolean httpOnly;   // HttpOnly ... i.e. not accessible to scripts
     private int version = 1;    // Version=1 ... RFC 2965 style
 
     //
@@ -656,6 +657,32 @@
         version = v;
     }
 
+    /**
+     * Returns {@code true} if this cookie contains the <i>HttpOnly</i>
+     * attribute. This means that the cookie should not be accessible to
+     * scripting engines, like javascript.
+     *
+     * @return {@code true} if this cookie should be considered http only.
+     * @see #setHttpOnly(boolean)
+     */
+    public boolean isHttpOnly()
+    {
+        return httpOnly;
+    }
+
+    /**
+     * Indicates whether the cookie should be considered HTTP Only. If set to
+     * {@code true} it means the cookie should not be accessible to scripting
+     * engines like javascript.
+     *
+     * @param httpOnly if {@code true} make the cookie HTTP only, i.e.
+     *                 only visible as part of an HTTP request.
+     * @see #isHttpOnly()
+     */
+    public void setHttpOnly(boolean httpOnly)
+    {
+        this.httpOnly = httpOnly;
+    }
 
     /**
      * The utility method to check whether a host name is in a domain
@@ -877,6 +904,7 @@
             || name.equalsIgnoreCase("Port")            // rfc2965 only
             || name.equalsIgnoreCase("Secure")
             || name.equalsIgnoreCase("Version")
+            || name.equalsIgnoreCase("HttpOnly")
             || name.charAt(0) == '$')
         {
             return true;
@@ -996,6 +1024,11 @@
                     cookie.setSecure(true);
                 }
             });
+        assignors.put("httponly", new CookieAttributeAssignor(){
+                public void assign(HttpCookie cookie, String attrName, String attrValue) {
+                    cookie.setHttpOnly(true);
+                }
+            });
         assignors.put("version", new CookieAttributeAssignor(){
                 public void assign(HttpCookie cookie, String attrName, String attrValue) {
                     try {
diff --git a/jdk/src/share/classes/java/net/Inet6Address.java b/jdk/src/share/classes/java/net/Inet6Address.java
index 0778f5a..9441fed 100644
--- a/jdk/src/share/classes/java/net/Inet6Address.java
+++ b/jdk/src/share/classes/java/net/Inet6Address.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/nio/Bits.java b/jdk/src/share/classes/java/nio/Bits.java
index 277fb42..8627103 100644
--- a/jdk/src/share/classes/java/nio/Bits.java
+++ b/jdk/src/share/classes/java/nio/Bits.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/nio/ByteBufferAs-X-Buffer.java b/jdk/src/share/classes/java/nio/ByteBufferAs-X-Buffer.java
index 5761fd8..54deb4c 100644
--- a/jdk/src/share/classes/java/nio/ByteBufferAs-X-Buffer.java
+++ b/jdk/src/share/classes/java/nio/ByteBufferAs-X-Buffer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -186,7 +186,7 @@
 
     // --- Methods to support CharSequence ---
 
-    public CharSequence subSequence(int start, int end) {
+    public CharBuffer subSequence(int start, int end) {
         int pos = position();
         int lim = limit();
         assert (pos <= lim);
diff --git a/jdk/src/share/classes/java/nio/Direct-X-Buffer.java b/jdk/src/share/classes/java/nio/Direct-X-Buffer.java
index d1cfb6b..26b3195 100644
--- a/jdk/src/share/classes/java/nio/Direct-X-Buffer.java
+++ b/jdk/src/share/classes/java/nio/Direct-X-Buffer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -402,7 +402,7 @@
 
     // --- Methods to support CharSequence ---
 
-    public CharSequence subSequence(int start, int end) {
+    public CharBuffer subSequence(int start, int end) {
         int pos = position();
         int lim = limit();
         assert (pos <= lim);
diff --git a/jdk/src/share/classes/java/nio/Heap-X-Buffer.java b/jdk/src/share/classes/java/nio/Heap-X-Buffer.java
index 0c19ca5..28f1ca8 100644
--- a/jdk/src/share/classes/java/nio/Heap-X-Buffer.java
+++ b/jdk/src/share/classes/java/nio/Heap-X-Buffer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2002 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -566,7 +566,7 @@
 
     // --- Methods to support CharSequence ---
 
-    public CharSequence subSequence(int start, int end) {
+    public CharBuffer subSequence(int start, int end) {
         if ((start < 0)
             || (end > length())
             || (start > end))
diff --git a/jdk/src/share/classes/java/nio/StringCharBuffer.java b/jdk/src/share/classes/java/nio/StringCharBuffer.java
index 3f49ae1..648b198 100644
--- a/jdk/src/share/classes/java/nio/StringCharBuffer.java
+++ b/jdk/src/share/classes/java/nio/StringCharBuffer.java
@@ -99,7 +99,7 @@
         return str.toString().substring(start + offset, end + offset);
     }
 
-    public final CharSequence subSequence(int start, int end) {
+    public final CharBuffer subSequence(int start, int end) {
         try {
             int pos = position();
             return new StringCharBuffer(str, -1,
diff --git a/jdk/src/share/classes/java/nio/X-Buffer.java b/jdk/src/share/classes/java/nio/X-Buffer.java
index 99a7468..9fc8185 100644
--- a/jdk/src/share/classes/java/nio/X-Buffer.java
+++ b/jdk/src/share/classes/java/nio/X-Buffer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -1239,13 +1239,13 @@
      *         smaller than <tt>start</tt> and no larger than
      *         <tt>remaining()</tt>
      *
-     * @return  The new character sequence
+     * @return  The new character buffer
      *
      * @throws  IndexOutOfBoundsException
      *          If the preconditions on <tt>start</tt> and <tt>end</tt>
      *          do not hold
      */
-    public abstract CharSequence subSequence(int start, int end);
+    public abstract CharBuffer subSequence(int start, int end);
 
 
     // --- Methods to support Appendable ---
diff --git a/jdk/src/share/classes/java/nio/channels/DatagramChannel.java b/jdk/src/share/classes/java/nio/channels/DatagramChannel.java
index f04b1b0..b8697fa 100644
--- a/jdk/src/share/classes/java/nio/channels/DatagramChannel.java
+++ b/jdk/src/share/classes/java/nio/channels/DatagramChannel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2001 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/nio/channels/SelectionKey.java b/jdk/src/share/classes/java/nio/channels/SelectionKey.java
index 00fd36f..032f240 100644
--- a/jdk/src/share/classes/java/nio/channels/SelectionKey.java
+++ b/jdk/src/share/classes/java/nio/channels/SelectionKey.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java b/jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java
index 578646f..84ea062 100644
--- a/jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java
+++ b/jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2001 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/nio/channels/SocketChannel.java b/jdk/src/share/classes/java/nio/channels/SocketChannel.java
index ccc6342..2e96bd2 100644
--- a/jdk/src/share/classes/java/nio/channels/SocketChannel.java
+++ b/jdk/src/share/classes/java/nio/channels/SocketChannel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2001 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/nio/channels/exceptions b/jdk/src/share/classes/java/nio/channels/exceptions
index dd6e435..04cfbe0 100644
--- a/jdk/src/share/classes/java/nio/channels/exceptions
+++ b/jdk/src/share/classes/java/nio/channels/exceptions
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/nio/channels/package-info.java b/jdk/src/share/classes/java/nio/channels/package-info.java
index fd4d503..e8c2a92 100644
--- a/jdk/src/share/classes/java/nio/channels/package-info.java
+++ b/jdk/src/share/classes/java/nio/channels/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/nio/channels/spi/AbstractSelector.java b/jdk/src/share/classes/java/nio/channels/spi/AbstractSelector.java
index 019dd6e..060d2d3 100644
--- a/jdk/src/share/classes/java/nio/channels/spi/AbstractSelector.java
+++ b/jdk/src/share/classes/java/nio/channels/spi/AbstractSelector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java b/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java
index 1593be1..6b4967ca 100644
--- a/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java
+++ b/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/nio/charset/CoderResult.java b/jdk/src/share/classes/java/nio/charset/CoderResult.java
index 8f3c0be..1232149 100644
--- a/jdk/src/share/classes/java/nio/charset/CoderResult.java
+++ b/jdk/src/share/classes/java/nio/charset/CoderResult.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2002 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java b/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java
index 5fd70c2..8a04aef 100644
--- a/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java
+++ b/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -25,6 +25,9 @@
 
 package java.security.cert;
 
+import java.io.InvalidObjectException;
+import java.io.IOException;
+import java.io.ObjectInputStream;
 import java.security.GeneralSecurityException;
 
 /**
@@ -36,10 +39,11 @@
  * if any, that caused this exception to be thrown.
  * <p>
  * A <code>CertPathValidatorException</code> may also include the
- * certification path that was being validated when the exception was thrown
- * and the index of the certificate in the certification path that caused the
- * exception to be thrown. Use the {@link #getCertPath getCertPath} and
- * {@link #getIndex getIndex} methods to retrieve this information.
+ * certification path that was being validated when the exception was thrown,
+ * the index of the certificate in the certification path that caused the
+ * exception to be thrown, and the reason that caused the failure. Use the
+ * {@link #getCertPath getCertPath}, {@link #getIndex getIndex}, and
+ * {@link #getReason getReason} methods to retrieve this information.
  *
  * <p>
  * <b>Concurrent Access</b>
@@ -72,11 +76,16 @@
     private CertPath certPath;
 
     /**
+     * @serial the reason the validation failed
+     */
+    private Reason reason = BasicReason.UNSPECIFIED;
+
+    /**
      * Creates a <code>CertPathValidatorException</code> with
      * no detail message.
      */
     public CertPathValidatorException() {
-        super();
+        this(null, null);
     }
 
     /**
@@ -87,7 +96,7 @@
      * @param msg the detail message
      */
     public CertPathValidatorException(String msg) {
-        super(msg);
+        this(msg, null);
     }
 
     /**
@@ -104,7 +113,7 @@
      * permitted, and indicates that the cause is nonexistent or unknown.)
      */
     public CertPathValidatorException(Throwable cause) {
-        super(cause);
+        this(null, cause);
     }
 
     /**
@@ -117,7 +126,7 @@
      * permitted, and indicates that the cause is nonexistent or unknown.)
      */
     public CertPathValidatorException(String msg, Throwable cause) {
-        super(msg, cause);
+        this(msg, cause, null, -1);
     }
 
     /**
@@ -139,6 +148,32 @@
      */
     public CertPathValidatorException(String msg, Throwable cause,
             CertPath certPath, int index) {
+        this(msg, cause, certPath, index, BasicReason.UNSPECIFIED);
+    }
+
+    /**
+     * Creates a <code>CertPathValidatorException</code> with the specified
+     * detail message, cause, certification path, index, and reason.
+     *
+     * @param msg the detail message (or <code>null</code> if none)
+     * @param cause the cause (or <code>null</code> if none)
+     * @param certPath the certification path that was in the process of
+     * being validated when the error was encountered
+     * @param index the index of the certificate in the certification path
+     * that caused the error (or -1 if not applicable). Note that
+     * the list of certificates in a <code>CertPath</code> is zero based.
+     * @param reason the reason the validation failed
+     * @throws IndexOutOfBoundsException if the index is out of range
+     * <code>(index < -1 || (certPath != null && index >=
+     * certPath.getCertificates().size())</code>
+     * @throws IllegalArgumentException if <code>certPath</code> is
+     * <code>null</code> and <code>index</code> is not -1
+     * @throws NullPointerException if <code>reason</code> is <code>null</code>
+     *
+     * @since 1.7
+     */
+    public CertPathValidatorException(String msg, Throwable cause,
+            CertPath certPath, int index, Reason reason) {
         super(msg, cause);
         if (certPath == null && index != -1) {
             throw new IllegalArgumentException();
@@ -147,8 +182,12 @@
             (certPath != null && index >= certPath.getCertificates().size())) {
             throw new IndexOutOfBoundsException();
         }
+        if (reason == null) {
+            throw new NullPointerException("reason can't be null");
+        }
         this.certPath = certPath;
         this.index = index;
+        this.reason = reason;
     }
 
     /**
@@ -174,4 +213,79 @@
         return this.index;
     }
 
+    /**
+     * Returns the reason that the validation failed. The reason is
+     * associated with the index of the certificate returned by
+     * {@link getIndex}.
+     *
+     * @return the reason that the validation failed, or
+     *    <code>BasicReason.UNSPECIFIED</code> if a reason has not been
+     *    specified
+     *
+     * @since 1.7
+     */
+    public Reason getReason() {
+        return this.reason;
+    }
+
+    private void readObject(ObjectInputStream stream)
+        throws ClassNotFoundException, IOException {
+        stream.defaultReadObject();
+        if (reason == null) {
+            reason = BasicReason.UNSPECIFIED;
+        }
+        if (certPath == null && index != -1) {
+            throw new InvalidObjectException("certpath is null and index != -1");
+        }
+        if (index < -1 ||
+            (certPath != null && index >= certPath.getCertificates().size())) {
+            throw new InvalidObjectException("index out of range");
+        }
+    }
+
+    /**
+     * The reason the validation algorithm failed.
+     *
+     * @since 1.7
+     */
+    public static interface Reason extends java.io.Serializable { }
+
+
+    /**
+     * The BasicReason enumerates the potential reasons that a certification
+     * path of any type may be invalid.
+     *
+     * @since 1.7
+     */
+    public static enum BasicReason implements Reason {
+        /**
+         * Unspecified reason.
+         */
+        UNSPECIFIED,
+
+        /**
+         * The certificate is expired.
+         */
+        EXPIRED,
+
+        /**
+         * The certificate is not yet valid.
+         */
+        NOT_YET_VALID,
+
+        /**
+         * The certificate is revoked.
+         */
+        REVOKED,
+
+        /**
+         * The revocation status of the certificate could not be determined.
+         */
+        UNDETERMINED_REVOCATION_STATUS,
+
+        /**
+         * The signature is invalid.
+         */
+        INVALID_SIGNATURE
+    }
 }
diff --git a/jdk/src/share/classes/java/security/cert/PKIXReason.java b/jdk/src/share/classes/java/security/cert/PKIXReason.java
new file mode 100644
index 0000000..ed798d3
--- /dev/null
+++ b/jdk/src/share/classes/java/security/cert/PKIXReason.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.cert;
+
+/**
+ * The <code>PKIXReason</code> enumerates the potential PKIX-specific reasons
+ * that an X.509 certification path may be invalid according to the PKIX
+ * (RFC 3280) standard. These reasons are in addition to those of the
+ * <code>CertPathValidatorException.BasicReason</code> enumeration.
+ *
+ * @since 1.7
+ */
+public enum PKIXReason implements CertPathValidatorException.Reason {
+    /**
+     * The certificate does not chain correctly.
+     */
+    NAME_CHAINING,
+
+    /**
+     * The certificate's key usage is invalid.
+     */
+    INVALID_KEY_USAGE,
+
+    /**
+     * The policy constraints have been violated.
+     */
+    INVALID_POLICY,
+
+    /**
+     * No acceptable trust anchor found.
+     */
+    NO_TRUST_ANCHOR,
+
+    /**
+     * The certificate contains one or more unrecognized critical
+     * extensions.
+     */
+    UNRECOGNIZED_CRIT_EXT,
+
+    /**
+     * The certificate is not a CA certificate.
+     */
+    NOT_CA_CERT,
+
+    /**
+     * The path length constraint has been violated.
+     */
+    PATH_TOO_LONG,
+
+    /**
+     * The name constraints have been violated.
+     */
+    INVALID_NAME
+}
diff --git a/jdk/src/share/classes/java/util/CurrencyData.properties b/jdk/src/share/classes/java/util/CurrencyData.properties
index 7b2bd36..15c4530 100644
--- a/jdk/src/share/classes/java/util/CurrencyData.properties
+++ b/jdk/src/share/classes/java/util/CurrencyData.properties
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/util/EnumSet.java b/jdk/src/share/classes/java/util/EnumSet.java
index 5b92a97..c6c013d 100644
--- a/jdk/src/share/classes/java/util/EnumSet.java
+++ b/jdk/src/share/classes/java/util/EnumSet.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/util/Timer.java b/jdk/src/share/classes/java/util/Timer.java
index 7d1cc68..2387c47 100644
--- a/jdk/src/share/classes/java/util/Timer.java
+++ b/jdk/src/share/classes/java/util/Timer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/java/util/logging/Logging.java b/jdk/src/share/classes/java/util/logging/Logging.java
index 7246869..d997824 100644
--- a/jdk/src/share/classes/java/util/logging/Logging.java
+++ b/jdk/src/share/classes/java/util/logging/Logging.java
@@ -118,6 +118,6 @@
     }
 
     public ObjectName getObjectName() {
-        return com.sun.jmx.mbeanserver.Util.newObjectName(LogManager.LOGGING_MXBEAN_NAME);
+        return ObjectName.valueOf(LogManager.LOGGING_MXBEAN_NAME);
     }
 }
diff --git a/jdk/src/share/classes/java/util/zip/ZipOutputStream.java b/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
index 6539426..797a373 100644
--- a/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
+++ b/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc.  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
@@ -317,9 +317,6 @@
         if (current != null) {
             closeEntry();
         }
-        if (xentries.size() < 1) {
-            throw new ZipException("ZIP file must have at least one entry");
-        }
         // write central directory
         long off = written;
         for (XEntry xentry : xentries)
diff --git a/jdk/src/share/classes/javax/management/Description.java b/jdk/src/share/classes/javax/management/Description.java
index a0bf96d..3232054 100644
--- a/jdk/src/share/classes/javax/management/Description.java
+++ b/jdk/src/share/classes/javax/management/Description.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/Descriptor.java b/jdk/src/share/classes/javax/management/Descriptor.java
index 9aa9924..70c17f2 100644
--- a/jdk/src/share/classes/javax/management/Descriptor.java
+++ b/jdk/src/share/classes/javax/management/Descriptor.java
@@ -1,5 +1,5 @@
 /*
- * Portions Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Portions Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/DescriptorFields.java b/jdk/src/share/classes/javax/management/DescriptorFields.java
index 95a4b3a..1264253 100644
--- a/jdk/src/share/classes/javax/management/DescriptorFields.java
+++ b/jdk/src/share/classes/javax/management/DescriptorFields.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/DescriptorKey.java b/jdk/src/share/classes/javax/management/DescriptorKey.java
index 9f91949..7646862 100644
--- a/jdk/src/share/classes/javax/management/DescriptorKey.java
+++ b/jdk/src/share/classes/javax/management/DescriptorKey.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/DynamicWrapperMBean.java b/jdk/src/share/classes/javax/management/DynamicWrapperMBean.java
index 4a67a96..45d2f17 100644
--- a/jdk/src/share/classes/javax/management/DynamicWrapperMBean.java
+++ b/jdk/src/share/classes/javax/management/DynamicWrapperMBean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/Impact.java b/jdk/src/share/classes/javax/management/Impact.java
index 9416df6..a922e20 100644
--- a/jdk/src/share/classes/javax/management/Impact.java
+++ b/jdk/src/share/classes/javax/management/Impact.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/InstanceNotFoundException.java b/jdk/src/share/classes/javax/management/InstanceNotFoundException.java
index baeaed0..0b992d3 100644
--- a/jdk/src/share/classes/javax/management/InstanceNotFoundException.java
+++ b/jdk/src/share/classes/javax/management/InstanceNotFoundException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -61,6 +61,6 @@
      * @since 1.7
      */
     public InstanceNotFoundException(ObjectName name) {
-        this(name.toString());
+        this(String.valueOf(name));
     }
 }
diff --git a/jdk/src/share/classes/javax/management/MBean.java b/jdk/src/share/classes/javax/management/MBean.java
index 6837740..4b609c3 100644
--- a/jdk/src/share/classes/javax/management/MBean.java
+++ b/jdk/src/share/classes/javax/management/MBean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/MBeanOperationInfo.java b/jdk/src/share/classes/javax/management/MBeanOperationInfo.java
index 5863e96..e3c26df 100644
--- a/jdk/src/share/classes/javax/management/MBeanOperationInfo.java
+++ b/jdk/src/share/classes/javax/management/MBeanOperationInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/MBeanPermission.java b/jdk/src/share/classes/javax/management/MBeanPermission.java
index def34be..fe328c2 100644
--- a/jdk/src/share/classes/javax/management/MBeanPermission.java
+++ b/jdk/src/share/classes/javax/management/MBeanPermission.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/MBeanRegistration.java b/jdk/src/share/classes/javax/management/MBeanRegistration.java
index be51f4a..723045a 100644
--- a/jdk/src/share/classes/javax/management/MBeanRegistration.java
+++ b/jdk/src/share/classes/javax/management/MBeanRegistration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/MBeanServerConnection.java b/jdk/src/share/classes/javax/management/MBeanServerConnection.java
index 8b0dd66..0897684 100644
--- a/jdk/src/share/classes/javax/management/MBeanServerConnection.java
+++ b/jdk/src/share/classes/javax/management/MBeanServerConnection.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/MBeanServerDelegate.java b/jdk/src/share/classes/javax/management/MBeanServerDelegate.java
index ea4799d..aa706da 100644
--- a/jdk/src/share/classes/javax/management/MBeanServerDelegate.java
+++ b/jdk/src/share/classes/javax/management/MBeanServerDelegate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -304,7 +304,7 @@
      * @since 1.6
      */
     public static final ObjectName DELEGATE_NAME =
-            Util.newObjectName("JMImplementation:type=MBeanServerDelegate");
+            ObjectName.valueOf("JMImplementation:type=MBeanServerDelegate");
 
     /* Return a timestamp that is monotonically increasing even if
        System.currentTimeMillis() isn't (for example, if you call this
diff --git a/jdk/src/share/classes/javax/management/MBeanServerFactory.java b/jdk/src/share/classes/javax/management/MBeanServerFactory.java
index 7657af1..365f2a7 100644
--- a/jdk/src/share/classes/javax/management/MBeanServerFactory.java
+++ b/jdk/src/share/classes/javax/management/MBeanServerFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/MBeanServerNotification.java b/jdk/src/share/classes/javax/management/MBeanServerNotification.java
index 91362f8..723d2d4 100644
--- a/jdk/src/share/classes/javax/management/MBeanServerNotification.java
+++ b/jdk/src/share/classes/javax/management/MBeanServerNotification.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/ManagedAttribute.java b/jdk/src/share/classes/javax/management/ManagedAttribute.java
index a8a7299..3b10b77 100644
--- a/jdk/src/share/classes/javax/management/ManagedAttribute.java
+++ b/jdk/src/share/classes/javax/management/ManagedAttribute.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/ManagedOperation.java b/jdk/src/share/classes/javax/management/ManagedOperation.java
index fa01ac2..7f70e44 100644
--- a/jdk/src/share/classes/javax/management/ManagedOperation.java
+++ b/jdk/src/share/classes/javax/management/ManagedOperation.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/NotificationBroadcasterSupport.java b/jdk/src/share/classes/javax/management/NotificationBroadcasterSupport.java
index a358a70..33df960 100644
--- a/jdk/src/share/classes/javax/management/NotificationBroadcasterSupport.java
+++ b/jdk/src/share/classes/javax/management/NotificationBroadcasterSupport.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/NotificationInfo.java b/jdk/src/share/classes/javax/management/NotificationInfo.java
index a899346..29712c5 100644
--- a/jdk/src/share/classes/javax/management/NotificationInfo.java
+++ b/jdk/src/share/classes/javax/management/NotificationInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/NotificationInfos.java b/jdk/src/share/classes/javax/management/NotificationInfos.java
index 9d7c497..cc21d06 100644
--- a/jdk/src/share/classes/javax/management/NotificationInfos.java
+++ b/jdk/src/share/classes/javax/management/NotificationInfos.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/ObjectName.java b/jdk/src/share/classes/javax/management/ObjectName.java
index 20bcfce..8185edc 100644
--- a/jdk/src/share/classes/javax/management/ObjectName.java
+++ b/jdk/src/share/classes/javax/management/ObjectName.java
@@ -413,7 +413,7 @@
     }
 
     private void copyToOtherDomain(String domain, ObjectName aname)
-        throws MalformedObjectNameException, NullPointerException {
+        throws MalformedObjectNameException {
 
         // The domain cannot be null
         if (domain == null)
@@ -467,7 +467,7 @@
      * is null.
      */
     private void construct(String name)
-        throws MalformedObjectNameException, NullPointerException {
+        throws MalformedObjectNameException {
 
         // The name cannot be null
         if (name == null)
@@ -729,7 +729,7 @@
      * @exception NullPointerException One of the parameters is null.
      */
     private void construct(String domain, Map<String,String> props)
-        throws MalformedObjectNameException, NullPointerException {
+        throws MalformedObjectNameException {
 
         // The domain cannot be null
         if (domain == null)
@@ -1071,7 +1071,7 @@
      * Check if the supplied key is a valid key.
      */
     private static void checkKey(String key)
-        throws MalformedObjectNameException, NullPointerException {
+        throws MalformedObjectNameException {
 
         if (key == null) throw new
             NullPointerException("Invalid key (null)");
@@ -1359,9 +1359,10 @@
      * @exception NullPointerException The <code>name</code> parameter
      * is null.
      *
+     * @see #valueOf(String)
      */
     public static ObjectName getInstance(String name)
-            throws MalformedObjectNameException, NullPointerException {
+            throws MalformedObjectNameException {
         return new ObjectName(name);
     }
 
@@ -1386,10 +1387,11 @@
      * follow the rules for quoting.
      * @exception NullPointerException One of the parameters is null.
      *
+     * @see #valueOf(String, String, String)
      */
     public static ObjectName getInstance(String domain, String key,
                                          String value)
-            throws MalformedObjectNameException, NullPointerException {
+            throws MalformedObjectNameException {
         return new ObjectName(domain, key, value);
     }
 
@@ -1417,10 +1419,11 @@
      * quoting.
      * @exception NullPointerException One of the parameters is null.
      *
+     * @see #valueOf(String, Hashtable)
      */
     public static ObjectName getInstance(String domain,
                                          Hashtable<String,String> table)
-        throws MalformedObjectNameException, NullPointerException {
+        throws MalformedObjectNameException {
         return new ObjectName(domain, table);
     }
 
@@ -1453,11 +1456,120 @@
      * @exception NullPointerException The <code>name</code> is null.
      *
      */
-    public static ObjectName getInstance(ObjectName name)
-            throws NullPointerException {
+    public static ObjectName getInstance(ObjectName name) {
         if (name.getClass().equals(ObjectName.class))
             return name;
-        return Util.newObjectName(name.getSerializedNameString());
+        return valueOf(name.getSerializedNameString());
+    }
+
+    /**
+     * <p>Return an instance of ObjectName that can be used anywhere
+     * an object obtained with {@link #ObjectName(String) new
+     * ObjectName(name)} can be used.  The returned object may be of
+     * a subclass of ObjectName.  Calling this method twice with the
+     * same parameters may return the same object or two equal but
+     * not identical objects.</p>
+     *
+     * <p>This method is equivalent to {@link #getInstance(String)} except that
+     * it does not throw any checked exceptions.</p>
+     *
+     * @param name  A string representation of the object name.
+     *
+     * @return an ObjectName corresponding to the given String.
+     *
+     * @exception IllegalArgumentException The string passed as a
+     * parameter does not have the right format.  The {@linkplain
+     * Throwable#getCause() cause} of this exception will be a
+     * {@link MalformedObjectNameException}.
+     * @exception NullPointerException The <code>name</code> parameter
+     * is null.
+     *
+     * @since 1.7
+     */
+    public static ObjectName valueOf(String name) {
+        try {
+            return getInstance(name);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalArgumentException(e.getMessage(), e);
+            // Just plain IllegalArgumentException(e) produces an exception
+            // message "javax.management.MalformedObjectNameException: ..."
+            // which is distracting.
+        }
+    }
+
+    /**
+     * <p>Return an instance of ObjectName that can be used anywhere
+     * an object obtained with {@link #ObjectName(String, String,
+     * String) new ObjectName(domain, key, value)} can be used.  The
+     * returned object may be of a subclass of ObjectName.  Calling
+     * this method twice with the same parameters may return the same
+     * object or two equal but not identical objects.</p>
+     *
+     * <p>This method is equivalent to {@link #getInstance(String, String,
+     * String)} except that it does not throw any checked exceptions.</p>
+     *
+     * @param domain  The domain part of the object name.
+     * @param key  The attribute in the key property of the object name.
+     * @param value The value in the key property of the object name.
+     *
+     * @return an ObjectName corresponding to the given domain,
+     * key, and value.
+     *
+     * @exception IllegalArgumentException The
+     * <code>domain</code>, <code>key</code>, or <code>value</code>
+     * contains an illegal character, or <code>value</code> does not
+     * follow the rules for quoting.  The {@linkplain
+     * Throwable#getCause() cause} of this exception will be a
+     * {@link MalformedObjectNameException}.
+     * @exception NullPointerException One of the parameters is null.
+     *
+     * @since 1.7
+     */
+    public static ObjectName valueOf(String domain, String key, String value) {
+        try {
+            return getInstance(domain, key, value);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalArgumentException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * <p>Return an instance of ObjectName that can be used anywhere
+     * an object obtained with {@link #ObjectName(String, Hashtable)
+     * new ObjectName(domain, table)} can be used.  The returned
+     * object may be of a subclass of ObjectName.  Calling this method
+     * twice with the same parameters may return the same object or
+     * two equal but not identical objects.</p>
+     *
+     * <p>This method is equivalent to {@link #getInstance(String, Hashtable)}
+     * except that it does not throw any checked exceptions.</p>
+     *
+     * @param domain  The domain part of the object name.
+     * @param table A hash table containing one or more key
+     * properties.  The key of each entry in the table is the key of a
+     * key property in the object name.  The associated value in the
+     * table is the associated value in the object name.
+     *
+     * @return an ObjectName corresponding to the given domain and
+     * key mappings.
+     *
+     * @exception IllegalArgumentException The <code>domain</code>
+     * contains an illegal character, or one of the keys or values in
+     * <code>table</code> contains an illegal character, or one of the
+     * values in <code>table</code> does not follow the rules for
+     * quoting.  The {@linkplain Throwable#getCause() cause} of this exception
+     * will be a {@link MalformedObjectNameException}.
+     * @exception NullPointerException One of the parameters is null.
+     *
+     * @since 1.7
+     */
+    public static ObjectName valueOf(String domain,
+                                     Hashtable<String,String> table) {
+        try {
+            return new ObjectName(domain, table);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalArgumentException(e.getMessage(), e);
+        }
     }
 
     /**
@@ -1477,7 +1589,7 @@
      * @since 1.7
      **/
     public final ObjectName withDomain(String newDomain)
-            throws NullPointerException, MalformedObjectNameException {
+            throws MalformedObjectNameException {
         return new ObjectName(newDomain, this);
     }
 
@@ -1490,9 +1602,11 @@
      * parameter does not have the right format.
      * @exception NullPointerException The <code>name</code> parameter
      * is null.
+     *
+     * @see #valueOf(String)
      */
     public ObjectName(String name)
-        throws MalformedObjectNameException, NullPointerException {
+        throws MalformedObjectNameException {
         construct(name);
     }
 
@@ -1508,9 +1622,11 @@
      * contains an illegal character, or <code>value</code> does not
      * follow the rules for quoting.
      * @exception NullPointerException One of the parameters is null.
+     *
+     * @see #valueOf(String, String, String)
      */
     public ObjectName(String domain, String key, String value)
-        throws MalformedObjectNameException, NullPointerException {
+        throws MalformedObjectNameException {
         // If key or value are null a NullPointerException
         // will be thrown by the put method in Hashtable.
         //
@@ -1533,9 +1649,11 @@
      * values in <code>table</code> does not follow the rules for
      * quoting.
      * @exception NullPointerException One of the parameters is null.
+     *
+     * @see #valueOf(String, Hashtable)
      */
     public ObjectName(String domain, Hashtable<String,String> table)
-            throws MalformedObjectNameException, NullPointerException {
+            throws MalformedObjectNameException {
         construct(domain, table);
         /* The exception for when a key or value in the table is not a
            String is now ClassCastException rather than
@@ -1629,8 +1747,7 @@
      *
      * @since 1.6
      */
-    public boolean isPropertyValuePattern(String property)
-        throws NullPointerException, IllegalArgumentException {
+    public boolean isPropertyValuePattern(String property) {
         if (property == null)
             throw new NullPointerException("key property can't be null");
         for (int i = 0; i < _ca_array.length; i++) {
@@ -1691,7 +1808,7 @@
      *
      * @exception NullPointerException If <code>property</code> is null.
      */
-    public String getKeyProperty(String property) throws NullPointerException {
+    public String getKeyProperty(String property) {
         return _getKeyPropertyList().get(property);
     }
 
@@ -1950,8 +2067,7 @@
      * @exception NullPointerException if <code>s</code> is null.
      *
      */
-    public static String quote(String s)
-            throws NullPointerException {
+    public static String quote(String s) {
         final StringBuilder buf = new StringBuilder("\"");
         final int len = s.length();
         for (int i = 0; i < len; i++) {
@@ -1995,8 +2111,7 @@
      * @exception NullPointerException if <code>q</code> is null.
      *
      */
-    public static String unquote(String q)
-            throws IllegalArgumentException, NullPointerException {
+    public static String unquote(String q) {
         final StringBuilder buf = new StringBuilder();
         final int len = q.length();
         if (len < 2 || q.charAt(0) != '"' || q.charAt(len - 1) != '"')
@@ -2041,7 +2156,7 @@
      *
      * @since 1.6
      */
-    public static final ObjectName WILDCARD = Util.newObjectName("*:*");
+    public static final ObjectName WILDCARD = valueOf("*:*");
 
     // Category : Utilities <===================================
 
@@ -2064,7 +2179,7 @@
      * @exception NullPointerException if <code>name</code> is null.
      *
      */
-    public boolean apply(ObjectName name) throws NullPointerException {
+    public boolean apply(ObjectName name) {
 
         if (name == null) throw new NullPointerException();
 
diff --git a/jdk/src/share/classes/javax/management/QueryNotificationFilter.java b/jdk/src/share/classes/javax/management/QueryNotificationFilter.java
index 4245108..7d1990f 100644
--- a/jdk/src/share/classes/javax/management/QueryNotificationFilter.java
+++ b/jdk/src/share/classes/javax/management/QueryNotificationFilter.java
@@ -170,7 +170,7 @@
     private static final long serialVersionUID = -8408613922660635231L;
 
     private static final ObjectName DEFAULT_NAME =
-            Util.newObjectName(":type=Notification");
+            ObjectName.valueOf(":type=Notification");
     private static final QueryExp trueQuery;
     static {
         ValueExp zero = Query.value(0);
diff --git a/jdk/src/share/classes/javax/management/SendNotification.java b/jdk/src/share/classes/javax/management/SendNotification.java
index e2875d4..497b51e 100644
--- a/jdk/src/share/classes/javax/management/SendNotification.java
+++ b/jdk/src/share/classes/javax/management/SendNotification.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/StandardEmitterMBean.java b/jdk/src/share/classes/javax/management/StandardEmitterMBean.java
index c3faec3..da5f991 100644
--- a/jdk/src/share/classes/javax/management/StandardEmitterMBean.java
+++ b/jdk/src/share/classes/javax/management/StandardEmitterMBean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/event/EventClient.java b/jdk/src/share/classes/javax/management/event/EventClient.java
index 4b81013..6f5c84e 100644
--- a/jdk/src/share/classes/javax/management/event/EventClient.java
+++ b/jdk/src/share/classes/javax/management/event/EventClient.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
@@ -264,11 +264,12 @@
                 new PerThreadGroupPool.Create<ScheduledThreadPoolExecutor>() {
             public ScheduledThreadPoolExecutor createThreadPool(ThreadGroup group) {
                 ThreadFactory daemonThreadFactory = new DaemonThreadFactory(
-                        "EventClient lease renewer %d");
+                        "JMX EventClient lease renewer %d");
                 ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(
                         20, daemonThreadFactory);
-                exec.setKeepAliveTime(3, TimeUnit.SECONDS);
+                exec.setKeepAliveTime(1, TimeUnit.SECONDS);
                 exec.allowCoreThreadTimeOut(true);
+                exec.setRemoveOnCancelPolicy(true);
                 return exec;
             }
         };
diff --git a/jdk/src/share/classes/javax/management/event/EventClientDelegate.java b/jdk/src/share/classes/javax/management/event/EventClientDelegate.java
index cab3ff49..8d14412 100644
--- a/jdk/src/share/classes/javax/management/event/EventClientDelegate.java
+++ b/jdk/src/share/classes/javax/management/event/EventClientDelegate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/event/EventClientDelegateMBean.java b/jdk/src/share/classes/javax/management/event/EventClientDelegateMBean.java
index ba57cce..a9718a9 100644
--- a/jdk/src/share/classes/javax/management/event/EventClientDelegateMBean.java
+++ b/jdk/src/share/classes/javax/management/event/EventClientDelegateMBean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
@@ -96,7 +96,7 @@
      * <code>{@value #OBJECT_NAME_STRING}</code>.
      */
     public final static ObjectName OBJECT_NAME =
-            Util.newObjectName(OBJECT_NAME_STRING);
+            ObjectName.valueOf(OBJECT_NAME_STRING);
 
     /**
      * A unique listener identifier specified for an EventClient.
diff --git a/jdk/src/share/classes/javax/management/event/EventClientNotFoundException.java b/jdk/src/share/classes/javax/management/event/EventClientNotFoundException.java
index cd691b8..22f22d7 100644
--- a/jdk/src/share/classes/javax/management/event/EventClientNotFoundException.java
+++ b/jdk/src/share/classes/javax/management/event/EventClientNotFoundException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/event/EventConsumer.java b/jdk/src/share/classes/javax/management/event/EventConsumer.java
index 51baf38..c261776 100644
--- a/jdk/src/share/classes/javax/management/event/EventConsumer.java
+++ b/jdk/src/share/classes/javax/management/event/EventConsumer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/event/EventForwarder.java b/jdk/src/share/classes/javax/management/event/EventForwarder.java
index 471aefb..3dff0a7 100644
--- a/jdk/src/share/classes/javax/management/event/EventForwarder.java
+++ b/jdk/src/share/classes/javax/management/event/EventForwarder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/event/EventReceiver.java b/jdk/src/share/classes/javax/management/event/EventReceiver.java
index 5be396d..7cdd38b 100644
--- a/jdk/src/share/classes/javax/management/event/EventReceiver.java
+++ b/jdk/src/share/classes/javax/management/event/EventReceiver.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/event/EventRelay.java b/jdk/src/share/classes/javax/management/event/EventRelay.java
index a8c4866..d723bb0 100644
--- a/jdk/src/share/classes/javax/management/event/EventRelay.java
+++ b/jdk/src/share/classes/javax/management/event/EventRelay.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/event/EventSubscriber.java b/jdk/src/share/classes/javax/management/event/EventSubscriber.java
index 2426345..9948810 100644
--- a/jdk/src/share/classes/javax/management/event/EventSubscriber.java
+++ b/jdk/src/share/classes/javax/management/event/EventSubscriber.java
@@ -149,10 +149,10 @@
         if (listener == null)
             throw new IllegalArgumentException("Null listener");
 
-        final ListenerInfo li = new ListenerInfo(listener, filter, handback);
-        List<ListenerInfo> list;
+        final MyListenerInfo li = new MyListenerInfo(listener, filter, handback);
+        List<MyListenerInfo> list;
 
-        Map<ObjectName, List<ListenerInfo>> map;
+        Map<ObjectName, List<MyListenerInfo>> map;
         Set<ObjectName> names;
         if (name.isPattern()) {
             map = patternSubscriptionMap;
@@ -165,7 +165,7 @@
         synchronized (map) {
             list = map.get(name);
             if (list == null) {
-                list = new ArrayList<ListenerInfo>();
+                list = new ArrayList<MyListenerInfo>();
                 map.put(name, list);
             }
             list.add(li);
@@ -186,7 +186,6 @@
     public void unsubscribe(ObjectName name,
             NotificationListener listener)
             throws ListenerNotFoundException, IOException {
-
         if (logger.traceOn())
             logger.trace("unsubscribe", "" + name);
 
@@ -196,7 +195,7 @@
         if (listener == null)
             throw new ListenerNotFoundException();
 
-        Map<ObjectName, List<ListenerInfo>> map;
+        Map<ObjectName, List<MyListenerInfo>> map;
         Set<ObjectName> names;
 
         if (name.isPattern()) {
@@ -207,22 +206,39 @@
             names = Collections.singleton(name);
         }
 
-        final ListenerInfo li = new ListenerInfo(listener, null, null);
-        List<ListenerInfo> list;
+        List<MyListenerInfo> toRemove = new ArrayList<MyListenerInfo>();
         synchronized (map) {
-            list = map.get(name);
-            if (list == null || !list.remove(li))
+            List<MyListenerInfo> list = map.get(name);
+            if (list == null) {
                 throw new ListenerNotFoundException();
+            }
+
+            for (MyListenerInfo info : list) {
+                if (info.listener == listener) {
+                    toRemove.add(info);
+                }
+            }
+
+            if (toRemove.isEmpty()) {
+                throw new ListenerNotFoundException();
+            }
+
+            for (MyListenerInfo info : toRemove) {
+                list.remove(info);
+            }
 
             if (list.isEmpty())
                 map.remove(name);
         }
 
         for (ObjectName mbeanName : names) {
-            try {
-                mbeanServer.removeNotificationListener(mbeanName, li.listener);
-            } catch (Exception e) {
-                logger.fine("unsubscribe", "removeNotificationListener", e);
+            for (MyListenerInfo i : toRemove) {
+                try {
+                    mbeanServer.removeNotificationListener(mbeanName,
+                        i.listener, i.filter, i.handback);
+                } catch (Exception e) {
+                    logger.fine("unsubscribe", "removeNotificationListener", e);
+                }
             }
         }
     }
@@ -256,12 +272,12 @@
                 return;
             }
 
-            final List<ListenerInfo> listeners = new ArrayList<ListenerInfo>();
+            final List<MyListenerInfo> listeners = new ArrayList<MyListenerInfo>();
 
             // If there are subscribers for the exact name that has just arrived
             // then add their listeners to the list.
             synchronized (exactSubscriptionMap) {
-                List<ListenerInfo> exactListeners = exactSubscriptionMap.get(name);
+                List<MyListenerInfo> exactListeners = exactSubscriptionMap.get(name);
                 if (exactListeners != null)
                     listeners.addAll(exactListeners);
             }
@@ -277,7 +293,7 @@
             }
 
             // Add all the listeners just found to the new MBean.
-            for (ListenerInfo li : listeners) {
+            for (MyListenerInfo li : listeners) {
                 try {
                     mbeanServer.addNotificationListener(
                             name,
@@ -292,12 +308,12 @@
         }
     };
 
-    private static class ListenerInfo {
+    private static class MyListenerInfo {
         public final NotificationListener listener;
         public final NotificationFilter filter;
         public final Object handback;
 
-        public ListenerInfo(NotificationListener listener,
+        public MyListenerInfo(NotificationListener listener,
                 NotificationFilter filter,
                 Object handback) {
 
@@ -308,26 +324,6 @@
             this.filter = filter;
             this.handback = handback;
         }
-
-        /* Two ListenerInfo instances are equal if they have the same
-         * NotificationListener.  This means that we can use List.remove
-         * to implement the two-argument removeNotificationListener.
-         */
-        @Override
-        public boolean equals(Object o) {
-            if (o == this)
-                return true;
-
-            if (!(o instanceof ListenerInfo))
-                return false;
-
-            return listener.equals(((ListenerInfo)o).listener);
-        }
-
-        @Override
-        public int hashCode() {
-            return listener.hashCode();
-        }
     }
 
     // ---------------------------------
@@ -338,10 +334,10 @@
     // ---------------------------------
     private final MBeanServer mbeanServer;
 
-    private final Map<ObjectName, List<ListenerInfo>> exactSubscriptionMap =
-            new HashMap<ObjectName, List<ListenerInfo>>();
-    private final Map<ObjectName, List<ListenerInfo>> patternSubscriptionMap =
-            new HashMap<ObjectName, List<ListenerInfo>>();
+    private final Map<ObjectName, List<MyListenerInfo>> exactSubscriptionMap =
+            new HashMap<ObjectName, List<MyListenerInfo>>();
+    private final Map<ObjectName, List<MyListenerInfo>> patternSubscriptionMap =
+            new HashMap<ObjectName, List<MyListenerInfo>>();
 
 
 
diff --git a/jdk/src/share/classes/javax/management/event/FetchingEventForwarder.java b/jdk/src/share/classes/javax/management/event/FetchingEventForwarder.java
index 528775f..fd0ae6d 100644
--- a/jdk/src/share/classes/javax/management/event/FetchingEventForwarder.java
+++ b/jdk/src/share/classes/javax/management/event/FetchingEventForwarder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java b/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java
index 2b65f9b..2a456ec 100644
--- a/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java
+++ b/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
@@ -31,10 +31,8 @@
 import java.io.IOException;
 import java.io.NotSerializableException;
 import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 import javax.management.MBeanException;
@@ -215,50 +213,47 @@
         this.maxNotifs = maxNotifs;
 
         if (executor == null) {
-            executor = Executors.newSingleThreadScheduledExecutor(
+            ScheduledThreadPoolExecutor stpe = new ScheduledThreadPoolExecutor(1,
                     daemonThreadFactory);
-        }
+            stpe.setKeepAliveTime(1, TimeUnit.SECONDS);
+            stpe.allowCoreThreadTimeOut(true);
+            executor = stpe;
+            this.defaultExecutor = stpe;
+        } else
+            this.defaultExecutor = null;
         this.executor = executor;
-        if (executor instanceof ScheduledExecutorService)
-            leaseScheduler = (ScheduledExecutorService) executor;
-        else {
-            leaseScheduler = Executors.newSingleThreadScheduledExecutor(
-                    daemonThreadFactory);
-        }
 
         startSequenceNumber = 0;
         fetchingJob = new MyJob();
     }
 
-    public void setEventReceiver(EventReceiver eventReceiver) {
+    public synchronized void setEventReceiver(EventReceiver eventReceiver) {
         if (logger.traceOn()) {
             logger.trace("setEventReceiver", ""+eventReceiver);
         }
 
         EventReceiver old = this.eventReceiver;
-        synchronized(fetchingJob) {
-            this.eventReceiver = eventReceiver;
-            if (old == null && eventReceiver != null)
-                fetchingJob.resume();
-        }
+        this.eventReceiver = eventReceiver;
+        if (old == null && eventReceiver != null)
+            fetchingJob.resume();
     }
 
     public String getClientId() {
         return clientId;
     }
 
-    public void stop() {
+    public synchronized void stop() {
         if (logger.traceOn()) {
             logger.trace("stop", "");
         }
-        synchronized(fetchingJob) {
-            if (stopped) {
-                return;
-            }
-
-            stopped = true;
-            clientId = null;
+        if (stopped) {
+            return;
         }
+
+        stopped = true;
+        clientId = null;
+        if (defaultExecutor != null)
+            defaultExecutor.shutdown();
     }
 
     private class MyJob extends RepeatedSingletonJob {
@@ -372,10 +367,9 @@
     private final EventClientDelegateMBean delegate;
     private String clientId;
     private boolean stopped = false;
-    private volatile ScheduledFuture<?> leaseRenewalFuture;
 
     private final Executor executor;
-    private final ScheduledExecutorService leaseScheduler;
+    private final ExecutorService defaultExecutor;
     private final MyJob fetchingJob;
 
     private final long timeout;
@@ -385,5 +379,5 @@
             new ClassLogger("javax.management.event",
             "FetchingEventRelay");
     private static final ThreadFactory daemonThreadFactory =
-                    new DaemonThreadFactory("FetchingEventRelay-executor");
+                    new DaemonThreadFactory("JMX FetchingEventRelay executor %d");
 }
diff --git a/jdk/src/share/classes/javax/management/event/ListenerInfo.java b/jdk/src/share/classes/javax/management/event/ListenerInfo.java
index 063946c..9c7a8fc 100644
--- a/jdk/src/share/classes/javax/management/event/ListenerInfo.java
+++ b/jdk/src/share/classes/javax/management/event/ListenerInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/event/NotificationManager.java b/jdk/src/share/classes/javax/management/event/NotificationManager.java
index 90a522c..89edf9b 100644
--- a/jdk/src/share/classes/javax/management/event/NotificationManager.java
+++ b/jdk/src/share/classes/javax/management/event/NotificationManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/event/RMIPushEventForwarder.java b/jdk/src/share/classes/javax/management/event/RMIPushEventForwarder.java
index 2018f98..636f2e5 100644
--- a/jdk/src/share/classes/javax/management/event/RMIPushEventForwarder.java
+++ b/jdk/src/share/classes/javax/management/event/RMIPushEventForwarder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
@@ -185,7 +185,7 @@
 
     private static final ExecutorService executor =
             Executors.newCachedThreadPool(
-            new DaemonThreadFactory("RMIEventForwarder Executor"));
+            new DaemonThreadFactory("JMX RMIEventForwarder Executor"));
     private final SendingJob sendingJob = new SendingJob();
 
     private final BlockingQueue<TargetedNotification> buffer;
diff --git a/jdk/src/share/classes/javax/management/event/RMIPushEventRelay.java b/jdk/src/share/classes/javax/management/event/RMIPushEventRelay.java
index 51af9959..1cc5509 100644
--- a/jdk/src/share/classes/javax/management/event/RMIPushEventRelay.java
+++ b/jdk/src/share/classes/javax/management/event/RMIPushEventRelay.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/event/RMIPushServer.java b/jdk/src/share/classes/javax/management/event/RMIPushServer.java
index 53bd63c..2534984 100644
--- a/jdk/src/share/classes/javax/management/event/RMIPushServer.java
+++ b/jdk/src/share/classes/javax/management/event/RMIPushServer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/namespace/JMXDomain.java b/jdk/src/share/classes/javax/management/namespace/JMXDomain.java
index a54fde7..bff3c13 100644
--- a/jdk/src/share/classes/javax/management/namespace/JMXDomain.java
+++ b/jdk/src/share/classes/javax/management/namespace/JMXDomain.java
@@ -308,17 +308,17 @@
      * It is however only available for subclasses in this package.
      **/
     @Override
-    ObjectName validateHandlerName(ObjectName supliedName) {
-        if (supliedName == null)
+    ObjectName validateHandlerName(ObjectName suppliedName) {
+        if (suppliedName == null)
             throw new IllegalArgumentException("Must supply a valid name");
         final String dirName = JMXNamespaces.
-                normalizeNamespaceName(supliedName.getDomain());
+                normalizeNamespaceName(suppliedName.getDomain());
         final ObjectName handlerName = getDomainObjectName(dirName);
-        if (!supliedName.equals(handlerName))
+        if (!suppliedName.equals(handlerName))
             throw new IllegalArgumentException("invalid name space name: "+
-                        supliedName);
+                        suppliedName);
 
-        return supliedName;
+        return suppliedName;
     }
 
     /**
diff --git a/jdk/src/share/classes/javax/management/namespace/JMXNamespace.java b/jdk/src/share/classes/javax/management/namespace/JMXNamespace.java
index 39cb11b..23f3004 100644
--- a/jdk/src/share/classes/javax/management/namespace/JMXNamespace.java
+++ b/jdk/src/share/classes/javax/management/namespace/JMXNamespace.java
@@ -482,8 +482,8 @@
     /**
      * This method is part of the {@link MBeanRegistration} interface.
      * The {@link JMXNamespace} class uses the {@link MBeanRegistration}
-     * interface in order to get a handle to the MBean server in which it is
-     * registered. It also check the validity of its own ObjectName.
+     * interface in order to get a reference to the MBean server in which it is
+     * registered. It also checks the validity of its own ObjectName.
      * <p>
      * This method is called by the MBean server.
      * Application classes should never call this method directly.
@@ -502,11 +502,14 @@
      */
     public ObjectName preRegister(MBeanServer server, ObjectName name)
         throws Exception {
-        if (objectName != null && ! objectName.equals(name))
-            throw new IllegalStateException(
+        // need to synchronize to protect against multiple registration.
+        synchronized(this) {
+            if (objectName != null && ! objectName.equals(name))
+                throw new IllegalStateException(
                     "Already registered under another name: " + objectName);
-        objectName = validateHandlerName(name);
-        mbeanServer = server;
+            objectName = validateHandlerName(name);
+            mbeanServer = server;
+        }
         return name;
     }
 
@@ -517,23 +520,23 @@
      * reuse JMXNamespace in order to implement sessions...
      * It is however only available for subclasses in this package.
      **/
-    ObjectName validateHandlerName(ObjectName supliedName) {
-        if (supliedName == null)
+    ObjectName validateHandlerName(ObjectName suppliedName) {
+        if (suppliedName == null)
             throw new IllegalArgumentException("Must supply a valid name");
         final String dirName = JMXNamespaces.
-                normalizeNamespaceName(supliedName.getDomain());
+                normalizeNamespaceName(suppliedName.getDomain());
         final ObjectName handlerName =
                 JMXNamespaces.getNamespaceObjectName(dirName);
-        if (!supliedName.equals(handlerName))
+        if (!suppliedName.equals(handlerName))
             throw new IllegalArgumentException("invalid name space name: "+
-                        supliedName);
-        return supliedName;
+                        suppliedName);
+        return suppliedName;
     }
 
     /**
      * This method is part of the {@link MBeanRegistration} interface.
      * The {@link JMXNamespace} class uses the {@link MBeanRegistration}
-     * interface in order to get a handle to the MBean server in which it is
+     * interface in order to get a reference to the MBean server in which it is
      * registered.
      * <p>
      * This method is called by the MBean server. Application classes should
@@ -549,7 +552,7 @@
     /**
      * This method is part of the {@link MBeanRegistration} interface.
      * The {@link JMXNamespace} class uses the {@link MBeanRegistration}
-     * interface in order to get a handle to the MBean server in which it is
+     * interface in order to get a reference to the MBean server in which it is
      * registered.
      * <p>
      * This method is called by the MBean server. Application classes should
@@ -573,8 +576,11 @@
      * @see MBeanRegistration#postDeregister MBeanRegistration
      */
     public void postDeregister() {
-        mbeanServer = null;
-        objectName  = null;
+        // need to synchronize to protect against multiple registration.
+        synchronized(this) {
+            mbeanServer = null;
+            objectName  = null;
+        }
     }
 
 
diff --git a/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java b/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java
index b3eafd2..429a9d4 100644
--- a/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java
+++ b/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java
@@ -266,11 +266,15 @@
                 ObjectNameRouter.normalizeNamespacePath(namespace,false,
                             true,false);
         try {
+            // We could use Util.newObjectName here - but throwing an
+            // IllegalArgumentException that contains just the supplied
+            // namespace instead of the whole ObjectName seems preferable.
             return ObjectName.getInstance(sourcePath+
                     NAMESPACE_SEPARATOR+":"+
                     JMXNamespace.TYPE_ASSIGNMENT);
         } catch (MalformedObjectNameException x) {
-            throw new IllegalArgumentException(namespace,x);
+            throw new IllegalArgumentException("Invalid namespace: " +
+                                               namespace,x);
         }
     }
 
diff --git a/jdk/src/share/classes/javax/management/namespace/JMXRemoteNamespace.java b/jdk/src/share/classes/javax/management/namespace/JMXRemoteNamespace.java
index 1639fd2..6958f57 100644
--- a/jdk/src/share/classes/javax/management/namespace/JMXRemoteNamespace.java
+++ b/jdk/src/share/classes/javax/management/namespace/JMXRemoteNamespace.java
@@ -28,13 +28,12 @@
 import com.sun.jmx.defaults.JmxProperties;
 import com.sun.jmx.mbeanserver.Util;
 import com.sun.jmx.namespace.JMXNamespaceUtils;
-import com.sun.jmx.namespace.NamespaceInterceptor.DynamicProbe;
 import com.sun.jmx.remote.util.EnvHelp;
 
 import java.io.IOException;
-import java.security.AccessControlException;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -43,9 +42,7 @@
 import javax.management.InstanceNotFoundException;
 import javax.management.ListenerNotFoundException;
 import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanPermission;
 import javax.management.MBeanServerConnection;
-import javax.management.MalformedObjectNameException;
 import javax.management.Notification;
 import javax.management.NotificationBroadcasterSupport;
 import javax.management.NotificationEmitter;
@@ -117,18 +114,13 @@
      */
     private static final Logger LOG = JmxProperties.NAMESPACE_LOGGER;
 
-    private static final Logger PROBE_LOG = Logger.getLogger(
-            JmxProperties.NAMESPACE_LOGGER_NAME+".probe");
-
 
     // This connection listener is used to listen for connection events from
     // the underlying JMXConnector. It is used in particular to maintain the
     // "connected" state in this MBean.
     //
-    private static class ConnectionListener implements NotificationListener {
-        private final JMXRemoteNamespace handler;
-        private ConnectionListener(JMXRemoteNamespace handler) {
-            this.handler = handler;
+    private class ConnectionListener implements NotificationListener {
+        private ConnectionListener() {
         }
         public void handleNotification(Notification notification,
                 Object handback) {
@@ -136,7 +128,11 @@
                 return;
             final JMXConnectionNotification cn =
                     (JMXConnectionNotification)notification;
-            handler.checkState(this,cn,(JMXConnector)handback);
+            final String type = cn.getType();
+            if (JMXConnectionNotification.CLOSED.equals(type)
+                    || JMXConnectionNotification.FAILED.equals(type)) {
+                checkState(this,cn,(JMXConnector)handback);
+            }
         }
     }
 
@@ -150,8 +146,7 @@
     // because the one that is actually used is the one supplied by the
     // override of getMBeanServerConnection().
     private static class JMXRemoteNamespaceDelegate
-            extends MBeanServerConnectionWrapper
-            implements DynamicProbe {
+            extends MBeanServerConnectionWrapper {
         private volatile JMXRemoteNamespace parent=null;
 
         JMXRemoteNamespaceDelegate() {
@@ -177,9 +172,6 @@
 
         }
 
-        public boolean isProbeRequested() {
-            return this.parent.isProbeRequested();
-        }
     }
 
     private static final MBeanNotificationInfo connectNotification =
@@ -188,7 +180,7 @@
             "Connected",
             "Emitted when the Connected state of this object changes");
 
-    private static long seqNumber=0;
+    private static AtomicLong seqNumber = new AtomicLong(0);
 
     private final NotificationBroadcasterSupport broadcaster;
     private final ConnectionListener listener;
@@ -198,7 +190,6 @@
     private volatile MBeanServerConnection server = null;
     private volatile JMXConnector conn = null;
     private volatile ClassLoader defaultClassLoader = null;
-    private volatile boolean probed;
 
     /**
      * Creates a new instance of {@code JMXRemoteNamespace}.
@@ -237,10 +228,7 @@
         this.optionsMap = JMXNamespaceUtils.unmodifiableMap(optionsMap);
 
         // handles (dis)connection events
-        this.listener = new ConnectionListener(this);
-
-        // XXX TODO: remove the probe, or simplify it.
-        this.probed = false;
+        this.listener = new ConnectionListener();
     }
 
    /**
@@ -271,10 +259,6 @@
         return optionsMap;
     }
 
-    boolean isProbeRequested() {
-        return probed==false;
-    }
-
     public void addNotificationListener(NotificationListener listener,
             NotificationFilter filter, Object handback) {
         broadcaster.addNotificationListener(listener, filter, handback);
@@ -313,8 +297,8 @@
         broadcaster.removeNotificationListener(listener, filter, handback);
     }
 
-    private static synchronized long getNextSeqNumber() {
-        return seqNumber++;
+    private static long getNextSeqNumber() {
+        return seqNumber.getAndIncrement();
     }
 
 
@@ -362,14 +346,18 @@
         // lock while evaluating the true value of the connected state,
         // while anyone might also call close() or connect() from a
         // different thread.
-        //
         // The method switchConnection() (called from here too) also has the
-        // same kind of complex logic.
+        // same kind of complex logic:
         //
         // We use the JMXConnector has a handback to the notification listener
         // (emittingConnector) in order to be able to determine whether the
         // notification concerns the current connector in use, or an older
-        // one.
+        // one. The 'emittingConnector' is the connector from which the
+        // notification originated. This could be an 'old' connector - as
+        // closed() and connect() could already have been called before the
+        // notification arrived. So what we do is to compare the
+        // 'emittingConnector' with the current connector, to see if the
+        // notification actually comes from the curent connector.
         //
         boolean remove = false;
 
@@ -486,14 +474,12 @@
         }
     }
 
-    private void closeall(JMXConnector... a) {
-        for (JMXConnector c : a) {
-            try {
-                if (c != null) c.close();
-            } catch (Exception x) {
-                // OK: we're gonna throw the original exception later.
-                LOG.finest("Ignoring exception when closing connector: "+x);
-            }
+    private void close(JMXConnector c) {
+        try {
+            if (c != null) c.close();
+        } catch (Exception x) {
+            // OK: we're gonna throw the original exception later.
+            LOG.finest("Ignoring exception when closing connector: "+x);
         }
     }
 
@@ -598,26 +584,7 @@
     }
 
     public void connect() throws IOException {
-        if (conn != null) {
-            try {
-               // This is much too fragile. It must go away!
-               PROBE_LOG.finest("Probing again...");
-               triggerProbe(getMBeanServerConnection());
-            } catch(Exception x) {
-                close();
-                Throwable cause = x;
-                // if the cause is a security exception - rethrows it...
-                while (cause != null) {
-                    if (cause instanceof SecurityException)
-                        throw (SecurityException) cause;
-                    cause = cause.getCause();
-                }
-                throw new IOException("connection failed: cycle?",x);
-            }
-        }
         LOG.fine("connecting...");
-        // TODO remove these traces
-        // System.err.println(getInitParameter()+" connecting");
         final Map<String,Object> env =
                 new HashMap<String,Object>(getEnvMap());
         try {
@@ -640,86 +607,16 @@
             msc = aconn.getMBeanServerConnection();
             aconn.addConnectionNotificationListener(listener,null,aconn);
         } catch (IOException io) {
-            closeall(aconn);
+            close(aconn);
             throw io;
         } catch (RuntimeException x) {
-            closeall(aconn);
+            close(aconn);
             throw x;
         }
 
-
-        // XXX Revisit here
-        // Note from the author: This business of switching connection is
-        // incredibly complex. Isn't there any means to simplify it?
-        //
         switchConnection(conn,aconn,msc);
-        try {
-           triggerProbe(msc);
-        } catch(Exception x) {
-            close();
-            Throwable cause = x;
-            // if the cause is a security exception - rethrows it...
-            while (cause != null) {
-                if (cause instanceof SecurityException)
-                    throw (SecurityException) cause;
-                cause = cause.getCause();
-            }
-            throw new IOException("connection failed: cycle?",x);
-        }
-        LOG.fine("connected.");
-    }
 
-    // If this is a self-linking namespace, this method should trigger
-    // the emission of a probe in the wrapping NamespaceInterceptor.
-    // The first call to source() in the wrapping NamespaceInterceptor
-    // causes the emission of the probe.
-    //
-    // Note: the MBeanServer returned by getSourceServer
-    //       (our private JMXRemoteNamespaceDelegate inner class)
-    //       implements a sun private interface (DynamicProbe) which is
-    //       used by the NamespaceInterceptor to determine whether it should
-    //       send a probe or not.
-    //       We needed this interface here because the NamespaceInterceptor
-    //       has otherwise no means to knows that this object has just
-    //       connected, and that a new probe should be sent.
-    //
-    // Probes work this way: the NamespaceInterceptor sets a flag and sends
-    // a queryNames() request. If a queryNames() request comes in when the flag
-    // is on, then it deduces that there is a self-linking loop - and instead
-    // of calling queryNames() on the JMXNamespace (which would cause the
-    // loop to go on) it breaks the recursion by returning the probe ObjectName.
-    // If the NamespaceInterceptor receives the probe ObjectName as result of
-    // its original queryNames() it knows that it has been looping back on
-    // itslef and throws an Exception - which will be raised through this
-    // method, thus preventing the connection to be established...
-    //
-    // More info in the com.sun.jmx.namespace.NamespaceInterceptor class
-    //
-    // XXX: TODO this probe thing is way too complex and fragile.
-    //      This *must* go away or be replaced by something simpler.
-    //      ideas are welcomed.
-    //
-    private void triggerProbe(final MBeanServerConnection msc)
-            throws MalformedObjectNameException, IOException {
-        // Query Pattern that we will send through the source server in order
-        // to detect self-linking namespaces.
-        //
-        //
-        final ObjectName pattern;
-        pattern = ObjectName.getInstance("*" +
-                JMXNamespaces.NAMESPACE_SEPARATOR + ":" +
-                JMXNamespace.TYPE_ASSIGNMENT);
-        probed = false;
-        try {
-            msc.queryNames(pattern, null);
-            probed = true;
-        } catch (AccessControlException x) {
-            // if we have an MBeanPermission missing then do nothing...
-            if (!(x.getPermission() instanceof MBeanPermission))
-                throw x;
-            PROBE_LOG.finer("Can't check for cycles: " + x);
-            probed = false; // no need to do it again...
-        }
+        LOG.fine("connected.");
     }
 
     public void close() throws IOException {
diff --git a/jdk/src/share/classes/javax/management/namespace/MBeanServerConnectionWrapper.java b/jdk/src/share/classes/javax/management/namespace/MBeanServerConnectionWrapper.java
index f74785f..7eeda96 100644
--- a/jdk/src/share/classes/javax/management/namespace/MBeanServerConnectionWrapper.java
+++ b/jdk/src/share/classes/javax/management/namespace/MBeanServerConnectionWrapper.java
@@ -28,7 +28,6 @@
 import com.sun.jmx.mbeanserver.Util;
 import java.io.IOException;
 import java.io.ObjectInputStream;
-import java.security.AccessController;
 import java.util.Set;
 
 import javax.management.Attribute;
diff --git a/jdk/src/share/classes/javax/management/namespace/MBeanServerSupport.java b/jdk/src/share/classes/javax/management/namespace/MBeanServerSupport.java
index 2f0e198..903be3c 100644
--- a/jdk/src/share/classes/javax/management/namespace/MBeanServerSupport.java
+++ b/jdk/src/share/classes/javax/management/namespace/MBeanServerSupport.java
@@ -193,14 +193,6 @@
  * }
  *
  * <a name="PropsMBS"></a>public class PropsMBS extends MBeanServerSupport {
- *     private static ObjectName newObjectName(String name) {
- *         try {
- *             return new ObjectName(name);
- *         } catch (MalformedObjectNameException e) {
- *             throw new AssertionError(e);
- *         }
- *     }
- *
  *     public static class PropertyImpl implements PropertyMBean {
  *         private final String name;
  *
@@ -219,7 +211,7 @@
  *             throws InstanceNotFoundException {
  *
  *         // Check that the name is a legal one for a Property MBean
- *         ObjectName namePattern = newObjectName(
+ *         ObjectName namePattern = ObjectName.valueOf(
  *                     "com.example:type=Property,name=\"*\"");
  *         if (!namePattern.apply(name))
  *             throw new InstanceNotFoundException(name);
@@ -239,7 +231,7 @@
  *         {@code Set<ObjectName> names = new TreeSet<ObjectName>();}
  *         Properties props = System.getProperties();
  *         for (String propName : props.stringPropertyNames()) {
- *             ObjectName objectName = newObjectName(
+ *             ObjectName objectName = ObjectName.valueOf(
  *                     "com.example:type=Property,name=" +
  *                     ObjectName.quote(propName));
  *             names.add(objectName);
@@ -278,7 +270,7 @@
  *     }
  *
  *     public void propertyChanged(String name, String newValue) {
- *         ObjectName objectName = newObjectName(
+ *         ObjectName objectName = ObjectName.valueOf(
  *                 "com.example:type=Property,name=" + ObjectName.quote(name));
  *         Notification n = new Notification(
  *                 "com.example.property.changed", objectName, 0L,
diff --git a/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java b/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java
index 12e3cf5..4ef93b4 100644
--- a/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java
+++ b/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java b/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java
index 369efb2..4e0c51c 100644
--- a/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java
+++ b/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/remote/JMXConnector.java b/jdk/src/share/classes/javax/management/remote/JMXConnector.java
index c268dff..1909a5a 100644
--- a/jdk/src/share/classes/javax/management/remote/JMXConnector.java
+++ b/jdk/src/share/classes/javax/management/remote/JMXConnector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java b/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java
index 3a83fae..88348ff5 100644
--- a/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java
+++ b/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/remote/JMXConnectorServerMBean.java b/jdk/src/share/classes/javax/management/remote/JMXConnectorServerMBean.java
index dcc41c8..fb6f883 100644
--- a/jdk/src/share/classes/javax/management/remote/JMXConnectorServerMBean.java
+++ b/jdk/src/share/classes/javax/management/remote/JMXConnectorServerMBean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
index 31964eb..a87d146 100644
--- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
+++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java
index bdcbb15..a620235 100644
--- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java
+++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java
@@ -420,7 +420,7 @@
                 new PerThreadGroupPool.Create<ThreadPoolExecutor>() {
             public ThreadPoolExecutor createThreadPool(ThreadGroup group) {
                 ThreadFactory daemonThreadFactory = new DaemonThreadFactory(
-                        "RMIConnector listener dispatch %d");
+                        "JMX RMIConnector listener dispatch %d");
                 ThreadPoolExecutor exec = new ThreadPoolExecutor(
                         1, 10, 1, TimeUnit.SECONDS,
                         new LinkedBlockingDeque<Runnable>(),
diff --git a/jdk/src/share/classes/javax/net/ssl/SSLServerSocket.java b/jdk/src/share/classes/javax/net/ssl/SSLServerSocket.java
index cafc72d..8232c1d 100644
--- a/jdk/src/share/classes/javax/net/ssl/SSLServerSocket.java
+++ b/jdk/src/share/classes/javax/net/ssl/SSLServerSocket.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/font/NullFontScaler.java b/jdk/src/share/classes/sun/font/NullFontScaler.java
index 3d80f6d..b662b7d 100644
--- a/jdk/src/share/classes/sun/font/NullFontScaler.java
+++ b/jdk/src/share/classes/sun/font/NullFontScaler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalMonitoredVm.java b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalMonitoredVm.java
index ef06f49..c2f2506 100644
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalMonitoredVm.java
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalMonitoredVm.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostProvider.java b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostProvider.java
index 30d4285..6bfb571 100644
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostProvider.java
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/management/ClassLoadingImpl.java b/jdk/src/share/classes/sun/management/ClassLoadingImpl.java
index 2f4b6ed..9eda583 100644
--- a/jdk/src/share/classes/sun/management/ClassLoadingImpl.java
+++ b/jdk/src/share/classes/sun/management/ClassLoadingImpl.java
@@ -71,6 +71,6 @@
     native static void setVerboseClass(boolean value);
 
     public ObjectName getObjectName() {
-        return Util.newObjectName(ManagementFactory.CLASS_LOADING_MXBEAN_NAME);
+        return ObjectName.valueOf(ManagementFactory.CLASS_LOADING_MXBEAN_NAME);
     }
 }
diff --git a/jdk/src/share/classes/sun/management/CompilationImpl.java b/jdk/src/share/classes/sun/management/CompilationImpl.java
index d69d9cc..9c13e67 100644
--- a/jdk/src/share/classes/sun/management/CompilationImpl.java
+++ b/jdk/src/share/classes/sun/management/CompilationImpl.java
@@ -70,7 +70,7 @@
     }
 
     public ObjectName getObjectName() {
-        return Util.newObjectName(ManagementFactory.COMPILATION_MXBEAN_NAME);
+        return ObjectName.valueOf(ManagementFactory.COMPILATION_MXBEAN_NAME);
     }
 
 
diff --git a/jdk/src/share/classes/sun/management/HotSpotDiagnostic.java b/jdk/src/share/classes/sun/management/HotSpotDiagnostic.java
index f42188f..d33337f 100644
--- a/jdk/src/share/classes/sun/management/HotSpotDiagnostic.java
+++ b/jdk/src/share/classes/sun/management/HotSpotDiagnostic.java
@@ -117,6 +117,6 @@
     }
 
     public ObjectName getObjectName() {
-        return Util.newObjectName("com.sun.management:type=HotSpotDiagnostic");
+        return ObjectName.valueOf("com.sun.management:type=HotSpotDiagnostic");
     }
 }
diff --git a/jdk/src/share/classes/sun/management/HotspotInternal.java b/jdk/src/share/classes/sun/management/HotspotInternal.java
index 7006699..88f9a82 100644
--- a/jdk/src/share/classes/sun/management/HotspotInternal.java
+++ b/jdk/src/share/classes/sun/management/HotspotInternal.java
@@ -41,7 +41,7 @@
 
     private final static String HOTSPOT_INTERNAL_MBEAN_NAME =
         "sun.management:type=HotspotInternal";
-    private static ObjectName objName = Util.newObjectName(HOTSPOT_INTERNAL_MBEAN_NAME);
+    private static ObjectName objName = ObjectName.valueOf(HOTSPOT_INTERNAL_MBEAN_NAME);
     private MBeanServer server = null;
 
     /**
diff --git a/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java b/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java
index 9bb4785..c07acfd 100644
--- a/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java
+++ b/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java
@@ -220,7 +220,7 @@
      */
     private static void addMBean(MBeanServer mbs, Object mbean, String mbeanName) {
         try {
-            final ObjectName objName = Util.newObjectName(mbeanName);
+            final ObjectName objName = ObjectName.valueOf(mbeanName);
 
             // inner class requires these fields to be final
             final MBeanServer mbs0 = mbs;
@@ -280,7 +280,7 @@
 
     private static void unregisterMBean(MBeanServer mbs, String mbeanName) {
         try {
-            final ObjectName objName = Util.newObjectName(mbeanName);
+            final ObjectName objName = ObjectName.valueOf(mbeanName);
 
             // inner class requires these fields to be final
             final MBeanServer mbs0 = mbs;
diff --git a/jdk/src/share/classes/sun/management/MemoryImpl.java b/jdk/src/share/classes/sun/management/MemoryImpl.java
index 29da467..aa56186 100644
--- a/jdk/src/share/classes/sun/management/MemoryImpl.java
+++ b/jdk/src/share/classes/sun/management/MemoryImpl.java
@@ -177,7 +177,7 @@
     }
 
     public ObjectName getObjectName() {
-        return Util.newObjectName(ManagementFactory.MEMORY_MXBEAN_NAME);
+        return ObjectName.valueOf(ManagementFactory.MEMORY_MXBEAN_NAME);
     }
 
 }
diff --git a/jdk/src/share/classes/sun/management/OperatingSystemImpl.java b/jdk/src/share/classes/sun/management/OperatingSystemImpl.java
index cfe7296..9ab8b56 100644
--- a/jdk/src/share/classes/sun/management/OperatingSystemImpl.java
+++ b/jdk/src/share/classes/sun/management/OperatingSystemImpl.java
@@ -74,7 +74,7 @@
         }
     }
     public ObjectName getObjectName() {
-        return Util.newObjectName(ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME);
+        return ObjectName.valueOf(ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME);
     }
 
 }
diff --git a/jdk/src/share/classes/sun/management/RuntimeImpl.java b/jdk/src/share/classes/sun/management/RuntimeImpl.java
index e58040e..55bcbdc 100644
--- a/jdk/src/share/classes/sun/management/RuntimeImpl.java
+++ b/jdk/src/share/classes/sun/management/RuntimeImpl.java
@@ -149,7 +149,7 @@
     }
 
     public ObjectName getObjectName() {
-        return Util.newObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
+        return ObjectName.valueOf(ManagementFactory.RUNTIME_MXBEAN_NAME);
     }
 
 }
diff --git a/jdk/src/share/classes/sun/management/ThreadImpl.java b/jdk/src/share/classes/sun/management/ThreadImpl.java
index d12258b..565966e 100644
--- a/jdk/src/share/classes/sun/management/ThreadImpl.java
+++ b/jdk/src/share/classes/sun/management/ThreadImpl.java
@@ -415,7 +415,7 @@
     private static native void resetContentionTimes0(long tid);
 
     public ObjectName getObjectName() {
-        return Util.newObjectName(ManagementFactory.THREAD_MXBEAN_NAME);
+        return ObjectName.valueOf(ManagementFactory.THREAD_MXBEAN_NAME);
     }
 
 }
diff --git a/jdk/src/share/classes/sun/management/Util.java b/jdk/src/share/classes/sun/management/Util.java
index 3c09975..1da8083 100644
--- a/jdk/src/share/classes/sun/management/Util.java
+++ b/jdk/src/share/classes/sun/management/Util.java
@@ -43,12 +43,8 @@
         return (String[]) list.toArray(EMPTY_STRING_ARRAY);
     }
 
-    static ObjectName newObjectName(String name) {
-        return com.sun.jmx.mbeanserver.Util.newObjectName(name);
-    }
-
     public static ObjectName newObjectName(String domainAndType, String name) {
-        return newObjectName(domainAndType + ",name=" + name);
+        return ObjectName.valueOf(domainAndType + ",name=" + name);
     }
 
     private static ManagementPermission monitorPermission =
diff --git a/jdk/src/share/classes/sun/misc/SharedSecrets.java b/jdk/src/share/classes/sun/misc/SharedSecrets.java
index b9de220..938e54c 100644
--- a/jdk/src/share/classes/sun/misc/SharedSecrets.java
+++ b/jdk/src/share/classes/sun/misc/SharedSecrets.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/net/httpserver/ChunkedOutputStream.java b/jdk/src/share/classes/sun/net/httpserver/ChunkedOutputStream.java
index f53d40e..48ce80e 100644
--- a/jdk/src/share/classes/sun/net/httpserver/ChunkedOutputStream.java
+++ b/jdk/src/share/classes/sun/net/httpserver/ChunkedOutputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
@@ -73,6 +73,7 @@
         if (count == CHUNK_SIZE) {
             writeChunk();
         }
+        assert count < CHUNK_SIZE;
     }
 
     public void write (byte[]b, int off, int len) throws IOException {
@@ -86,20 +87,22 @@
             writeChunk();
             len -= remain;
             off += remain;
-            while (len > CHUNK_SIZE) {
+            while (len >= CHUNK_SIZE) {
                 System.arraycopy (b,off,buf,OFFSET,CHUNK_SIZE);
                 len -= CHUNK_SIZE;
                 off += CHUNK_SIZE;
                 count = CHUNK_SIZE;
                 writeChunk();
             }
-            pos = OFFSET;
         }
         if (len > 0) {
             System.arraycopy (b,off,buf,pos,len);
             count += len;
             pos += len;
         }
+        if (count == CHUNK_SIZE) {
+            writeChunk();
+        }
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java b/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java
index a9658d4..a6d4b07 100644
--- a/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java
+++ b/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
index a7939c0..54cbfba 100644
--- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java b/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
index 34b2422..7e515ba 100644
--- a/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/nio/ch/Net.java b/jdk/src/share/classes/sun/nio/ch/Net.java
index 98b4615..ba0ba0b 100644
--- a/jdk/src/share/classes/sun/nio/ch/Net.java
+++ b/jdk/src/share/classes/sun/nio/ch/Net.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/nio/ch/SelectorImpl.java b/jdk/src/share/classes/sun/nio/ch/SelectorImpl.java
index ce6e39b..4319d78 100644
--- a/jdk/src/share/classes/sun/nio/ch/SelectorImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/SelectorImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/nio/ch/SelectorProviderImpl.java b/jdk/src/share/classes/sun/nio/ch/SelectorProviderImpl.java
index 7a87713..f070419 100644
--- a/jdk/src/share/classes/sun/nio/ch/SelectorProviderImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/SelectorProviderImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2001 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java b/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
index ccf8e03..490c328 100644
--- a/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
+++ b/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
index cf4e11d..fd53298 100644
--- a/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
index 4549eac..11567ba 100644
--- a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/nio/cs/standard-charsets b/jdk/src/share/classes/sun/nio/cs/standard-charsets
index da0b26f..401a452 100644
--- a/jdk/src/share/classes/sun/nio/cs/standard-charsets
+++ b/jdk/src/share/classes/sun/nio/cs/standard-charsets
@@ -1,5 +1,5 @@
 #
-# Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java b/jdk/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java
index 54c0908..1b1a3d4 100644
--- a/jdk/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java
+++ b/jdk/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/security/krb5/Config.java b/jdk/src/share/classes/sun/security/krb5/Config.java
index 56e5fb1..2a16b98 100644
--- a/jdk/src/share/classes/sun/security/krb5/Config.java
+++ b/jdk/src/share/classes/sun/security/krb5/Config.java
@@ -803,7 +803,7 @@
             for (int j = 0; j < line.length(); j++) {
                 if (line.charAt(j) == '=') {
                     int index;
-                    key = line.substring(0, j - 1).trim();
+                    key = line.substring(0, j).trim();
                     if (! exists(key, keyVector)) {
                         keyVector.addElement(key);
                         nameVector = new Vector<String> ();
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/BasicChecker.java b/jdk/src/share/classes/sun/security/provider/certpath/BasicChecker.java
index e4f7d1f..491dd47 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/BasicChecker.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/BasicChecker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -29,12 +29,18 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.Set;
+import java.security.GeneralSecurityException;
 import java.security.KeyFactory;
 import java.security.PublicKey;
+import java.security.SignatureException;
 import java.security.cert.Certificate;
+import java.security.cert.CertificateExpiredException;
+import java.security.cert.CertificateNotYetValidException;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertPathValidatorException.BasicReason;
 import java.security.cert.X509Certificate;
 import java.security.cert.PKIXCertPathChecker;
-import java.security.cert.CertPathValidatorException;
+import java.security.cert.PKIXReason;
 import java.security.cert.TrustAnchor;
 import java.security.interfaces.DSAParams;
 import java.security.interfaces.DSAPublicKey;
@@ -152,11 +158,11 @@
 
         try {
             cert.verify(prevPubKey, sigProvider);
-        } catch (Exception e) {
-            if (debug != null) {
-                debug.println(e.getMessage());
-                e.printStackTrace();
-            }
+        } catch (SignatureException e) {
+            throw new CertPathValidatorException
+                (msg + " check failed", e, null, -1,
+                 BasicReason.INVALID_SIGNATURE);
+        } catch (GeneralSecurityException e) {
             throw new CertPathValidatorException(msg + " check failed", e);
         }
 
@@ -176,12 +182,12 @@
 
         try {
             cert.checkValidity(date);
-        } catch (Exception e) {
-            if (debug != null) {
-                debug.println(e.getMessage());
-                e.printStackTrace();
-            }
-            throw new CertPathValidatorException(msg + " check failed", e);
+        } catch (CertificateExpiredException e) {
+            throw new CertPathValidatorException
+                (msg + " check failed", e, null, -1, BasicReason.EXPIRED);
+        } catch (CertificateNotYetValidException e) {
+            throw new CertPathValidatorException
+                (msg + " check failed", e, null, -1, BasicReason.NOT_YET_VALID);
         }
 
         if (debug != null)
@@ -204,12 +210,16 @@
             // reject null or empty issuer DNs
 
             if (X500Name.asX500Name(currIssuer).isEmpty()) {
-                throw new CertPathValidatorException(msg + " check failed: " +
-                    "empty/null issuer DN in certificate is invalid");
+                throw new CertPathValidatorException
+                    (msg + " check failed: " +
+                     "empty/null issuer DN in certificate is invalid", null,
+                     null, -1, PKIXReason.NAME_CHAINING);
             }
 
             if (!(currIssuer.equals(prevSubject))) {
-                throw new CertPathValidatorException(msg + " check failed");
+                throw new CertPathValidatorException
+                    (msg + " check failed", null, null, -1,
+                     PKIXReason.NAME_CHAINING);
             }
 
             if (debug != null)
@@ -270,7 +280,7 @@
                                                        params.getQ(),
                                                        params.getG());
             usableKey = kf.generatePublic(ks);
-        } catch (Exception e) {
+        } catch (GeneralSecurityException e) {
             throw new CertPathValidatorException("Unable to generate key with" +
                                                  " inherited parameters: " +
                                                  e.getMessage(), e);
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/ConstraintsChecker.java b/jdk/src/share/classes/sun/security/provider/certpath/ConstraintsChecker.java
index 40872d7..7e2783c 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/ConstraintsChecker.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ConstraintsChecker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -32,9 +32,10 @@
 import java.io.IOException;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateException;
+import java.security.cert.CertPathValidatorException;
 import java.security.cert.X509Certificate;
 import java.security.cert.PKIXCertPathChecker;
-import java.security.cert.CertPathValidatorException;
+import java.security.cert.PKIXReason;
 import sun.security.util.Debug;
 import sun.security.x509.PKIXExtensions;
 import sun.security.x509.NameConstraintsExtension;
@@ -147,7 +148,8 @@
 
             try {
                 if (!prevNC.verify(currCert)) {
-                    throw new CertPathValidatorException(msg + " check failed");
+                    throw new CertPathValidatorException(msg + " check failed",
+                        null, null, -1, PKIXReason.INVALID_NAME);
                 }
             } catch (IOException ioe) {
                 throw new CertPathValidatorException(ioe);
@@ -228,8 +230,9 @@
         if (i < certPathLength) {
             int pathLenConstraint = currCert.getBasicConstraints();
             if (pathLenConstraint == -1) {
-                throw new CertPathValidatorException(msg + " check failed: "
-                    + "this is not a CA certificate");
+                throw new CertPathValidatorException
+                    (msg + " check failed: this is not a CA certificate", null,
+                     null, -1, PKIXReason.NOT_CA_CERT);
             }
 
             if (!X509CertImpl.isSelfIssued(currCert)) {
@@ -237,7 +240,8 @@
                    throw new CertPathValidatorException
                         (msg + " check failed: pathLenConstraint violated - "
                          + "this cert must be the last cert in the "
-                         + "certification path");
+                         + "certification path", null, null, -1,
+                         PKIXReason.PATH_TOO_LONG);
                 }
                 maxPathLength--;
             }
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java b/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java
index 747ccba..63ee343 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -39,6 +39,7 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.PublicKey;
 import java.security.cert.*;
+import java.security.cert.CertPathValidatorException.BasicReason;
 import java.security.interfaces.DSAPublicKey;
 import javax.security.auth.x500.X500Principal;
 import sun.security.util.Debug;
@@ -268,7 +269,8 @@
                     " circular dependency");
             }
             throw new CertPathValidatorException
-                ("Could not determine revocation status");
+                ("Could not determine revocation status", null, null, -1,
+                 BasicReason.UNDETERMINED_REVOCATION_STATUS);
         }
 
         // init the state for this run
@@ -324,7 +326,8 @@
                 return;
             } else {
                 throw new CertPathValidatorException
-                    ("Could not determine revocation status");
+                ("Could not determine revocation status", null, null, -1,
+                 BasicReason.UNDETERMINED_REVOCATION_STATUS);
             }
         }
 
@@ -370,7 +373,8 @@
                             + unresCritExts);
                         }
                         throw new CertPathValidatorException
-                            ("Could not determine revocation status");
+                        ("Could not determine revocation status", null, null,
+                         -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
                     }
                 }
 
@@ -378,10 +382,11 @@
                 if (reasonCode == null) {
                     reasonCode = CRLReason.UNSPECIFIED;
                 }
-                throw new CertPathValidatorException(
-                    new CertificateRevokedException
-                        (entry.getRevocationDate(), reasonCode,
-                         crl.getIssuerX500Principal(), entry.getExtensions()));
+                Throwable t = new CertificateRevokedException
+                    (entry.getRevocationDate(), reasonCode,
+                     crl.getIssuerX500Principal(), entry.getExtensions());
+                throw new CertPathValidatorException(t.getMessage(), t,
+                    null, -1, BasicReason.REVOKED);
             }
         }
     }
@@ -428,7 +433,8 @@
                     " circular dependency");
             }
             throw new CertPathValidatorException
-                ("Could not determine revocation status");
+                ("Could not determine revocation status", null, null,
+                 -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
         }
 
         // If prevKey wasn't trusted, maybe we just didn't have the right
@@ -617,7 +623,7 @@
                     return;
                 } catch (CertPathValidatorException cpve) {
                     // If it is revoked, rethrow exception
-                    if (cpve.getCause() instanceof CertificateRevokedException) {
+                    if (cpve.getReason() == BasicReason.REVOKED) {
                         throw cpve;
                     }
                     // Otherwise, ignore the exception and
@@ -628,7 +634,8 @@
                 throw new CertPathValidatorException(iape);
             } catch (CertPathBuilderException cpbe) {
                 throw new CertPathValidatorException
-                    ("Could not determine revocation status", cpbe);
+                    ("Could not determine revocation status", null, null,
+                     -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
             }
         }
     }
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java b/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java
index aa88603..d8713cd 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java
@@ -32,6 +32,7 @@
 import java.security.InvalidKeyException;
 import java.security.cert.CertificateException;
 import java.security.cert.CertPathValidatorException;
+import java.security.cert.PKIXReason;
 import java.security.cert.CertStore;
 import java.security.cert.CertStoreException;
 import java.security.cert.PKIXBuilderParameters;
@@ -732,8 +733,9 @@
                     PKIXExtensions.ExtendedKeyUsage_Id.toString());
 
                 if (!unresCritExts.isEmpty())
-                    throw new CertificateException("Unrecognized critical "
-                        + "extension(s)");
+                    throw new CertPathValidatorException
+                        ("Unrecognized critical extension(s)", null, null, -1,
+                         PKIXReason.UNRECOGNIZED_CRIT_EXT);
             }
         }
 
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/KeyChecker.java b/jdk/src/share/classes/sun/security/provider/certpath/KeyChecker.java
index 1ed96c5..d120319 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/KeyChecker.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/KeyChecker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -27,6 +27,7 @@
 
 import java.util.*;
 import java.security.cert.*;
+import java.security.cert.PKIXReason;
 
 import sun.security.util.Debug;
 import sun.security.x509.PKIXExtensions;
@@ -75,11 +76,12 @@
         if (!forward) {
             remainingCerts = certPathLen;
         } else {
-            throw new CertPathValidatorException("forward checking not supported");
+            throw new CertPathValidatorException
+                ("forward checking not supported");
         }
     }
 
-    public boolean isForwardCheckingSupported() {
+    public final boolean isForwardCheckingSupported() {
         return false;
     }
 
@@ -155,8 +157,9 @@
 
         // throw an exception if the keyCertSign bit is not set
         if (!keyUsageBits[keyCertSign]) {
-            throw new CertPathValidatorException(msg + " check failed: "
-                + "keyCertSign bit is not set");
+            throw new CertPathValidatorException
+                (msg + " check failed: keyCertSign bit is not set", null,
+                 null, -1, PKIXReason.INVALID_KEY_USAGE);
         }
 
         if (debug != null) {
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java b/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java
index adf5ea6..35ed85d 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java
@@ -33,6 +33,7 @@
 import java.security.PrivilegedAction;
 import java.security.Security;
 import java.security.cert.*;
+import java.security.cert.CertPathValidatorException.BasicReason;
 import java.net.*;
 import javax.security.auth.x500.X500Principal;
 
@@ -381,17 +382,18 @@
             }
 
             if (certOCSPStatus == OCSPResponse.CERT_STATUS_REVOKED) {
-                throw new CertPathValidatorException(
-                    new CertificateRevokedException(
+                Throwable t = new CertificateRevokedException(
                         ocspResponse.getRevocationTime(),
                         ocspResponse.getRevocationReason(),
                         responderCert.getSubjectX500Principal(),
-                        ocspResponse.getSingleExtensions()));
+                        ocspResponse.getSingleExtensions());
+                throw new CertPathValidatorException(t.getMessage(), t,
+                        null, -1, BasicReason.REVOKED);
 
             } else if (certOCSPStatus == OCSPResponse.CERT_STATUS_UNKNOWN) {
                 throw new CertPathValidatorException(
                     "Certificate's revocation status is unknown", null, cp,
-                    remainingCerts);
+                    remainingCerts, BasicReason.UNDETERMINED_REVOCATION_STATUS);
             }
         } catch (Exception e) {
             throw new CertPathValidatorException(e);
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java b/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java
index 73d7494..63335d2 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -38,6 +38,7 @@
 import java.security.cert.PKIXCertPathChecker;
 import java.security.cert.PKIXCertPathValidatorResult;
 import java.security.cert.PKIXParameters;
+import java.security.cert.PKIXReason;
 import java.security.cert.PolicyNode;
 import java.security.cert.TrustAnchor;
 import java.security.cert.X509Certificate;
@@ -47,7 +48,6 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Set;
-import java.util.HashSet;
 import javax.security.auth.x500.X500Principal;
 import sun.security.util.Debug;
 
@@ -67,6 +67,7 @@
     private List<PKIXCertPathChecker> userCheckers;
     private String sigProvider;
     private BasicChecker basicChecker;
+    private String ocspProperty;
 
     /**
      * Default constructor.
@@ -126,7 +127,7 @@
 
         // Must copy elements of certList into a new modifiable List before
         // calling Collections.reverse().
-        List<X509Certificate> certList = new ArrayList<X509Certificate>
+        ArrayList<X509Certificate> certList = new ArrayList<X509Certificate>
             ((List<X509Certificate>)cp.getCertificates());
         if (debug != null) {
             if (certList.isEmpty()) {
@@ -201,7 +202,8 @@
         }
         // (b) otherwise, generate new exception
         throw new CertPathValidatorException
-                        ("Path does not chain with any of the trust anchors");
+            ("Path does not chain with any of the trust anchors",
+             null, null, -1, PKIXReason.NO_TRUST_ANCHOR);
     }
 
     /**
@@ -210,7 +212,6 @@
      */
     private boolean isWorthTrying(X509Certificate trustedCert,
                                   X509Certificate firstCert)
-        throws CertPathValidatorException
     {
         if (debug != null) {
             debug.println("PKIXCertPathValidator.isWorthTrying() checking "
@@ -240,7 +241,6 @@
      * Internal method to setup the internal state
      */
     private void populateVariables(PKIXParameters pkixParam)
-        throws CertPathValidatorException
     {
         // default value for testDate is current time
         testDate = pkixParam.getDate();
@@ -250,6 +250,17 @@
 
         userCheckers = pkixParam.getCertPathCheckers();
         sigProvider = pkixParam.getSigProvider();
+
+        if (pkixParam.isRevocationEnabled()) {
+            // Examine OCSP security property
+            ocspProperty = AccessController.doPrivileged(
+                new PrivilegedAction<String>() {
+                    public String run() {
+                        return
+                            Security.getProperty(OCSPChecker.OCSP_ENABLE_PROP);
+                    }
+                });
+        }
     }
 
     /**
@@ -259,12 +270,9 @@
      */
     private PolicyNode doValidate(
             TrustAnchor anchor, CertPath cpOriginal,
-            List<X509Certificate> certList, PKIXParameters pkixParam,
+            ArrayList<X509Certificate> certList, PKIXParameters pkixParam,
             PolicyNodeImpl rootNode) throws CertPathValidatorException
     {
-        List<PKIXCertPathChecker> certPathCheckers =
-            new ArrayList<PKIXCertPathChecker>();
-
         int certPathLen = certList.size();
 
         basicChecker = new BasicChecker(anchor, testDate, sigProvider, false);
@@ -281,6 +289,8 @@
                               pkixParam.getPolicyQualifiersRejected(),
                               rootNode);
 
+        ArrayList<PKIXCertPathChecker> certPathCheckers =
+            new ArrayList<PKIXCertPathChecker>();
         // add standard checkers that we will be using
         certPathCheckers.add(keyChecker);
         certPathCheckers.add(constraintsChecker);
@@ -290,15 +300,6 @@
         // only add a revocationChecker if revocation is enabled
         if (pkixParam.isRevocationEnabled()) {
 
-            // Examine OCSP security property
-            String ocspProperty = AccessController.doPrivileged(
-                new PrivilegedAction<String>() {
-                    public String run() {
-                        return
-                            Security.getProperty(OCSPChecker.OCSP_ENABLE_PROP);
-                    }
-                });
-
             // Use OCSP if it has been enabled
             if ("true".equalsIgnoreCase(ocspProperty)) {
                 OCSPChecker ocspChecker =
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/PKIXMasterCertPathValidator.java b/jdk/src/share/classes/sun/security/provider/certpath/PKIXMasterCertPathValidator.java
index faa472f..d5f1216 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/PKIXMasterCertPathValidator.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/PKIXMasterCertPathValidator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -30,11 +30,12 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-import java.util.Iterator;
+import java.security.cert.CertificateRevokedException;
 import java.security.cert.CertPath;
 import java.security.cert.CertPathValidatorException;
-import java.security.cert.CertificateRevokedException;
+import java.security.cert.CertPathValidatorException.BasicReason;
 import java.security.cert.PKIXCertPathChecker;
+import java.security.cert.PKIXReason;
 import java.security.cert.X509Certificate;
 
 /**
@@ -153,10 +154,11 @@
                      */
                     CertPathValidatorException currentCause =
                         new CertPathValidatorException(cpve.getMessage(),
-                            cpve.getCause(), cpOriginal, cpSize - (i + 1));
+                            cpve.getCause(), cpOriginal, cpSize - (i + 1),
+                            cpve.getReason());
 
                     // Check if OCSP has confirmed that the cert was revoked
-                    if (cpve.getCause() instanceof CertificateRevokedException) {
+                    if (cpve.getReason() == BasicReason.REVOKED) {
                         throw currentCause;
                     }
                     // Check if it is appropriate to failover
@@ -184,7 +186,8 @@
                 debug.println("checking for unresolvedCritExts");
             if (!unresolvedCritExts.isEmpty()) {
                 throw new CertPathValidatorException("unrecognized " +
-                    "critical extension(s)", null, cpOriginal, cpSize-(i+1));
+                    "critical extension(s)", null, cpOriginal, cpSize-(i+1),
+                    PKIXReason.UNRECOGNIZED_CRIT_EXT);
             }
 
             if (debug != null)
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/PolicyChecker.java b/jdk/src/share/classes/sun/security/provider/certpath/PolicyChecker.java
index 3b76f62..26dc1e5 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/PolicyChecker.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/PolicyChecker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -30,11 +30,12 @@
 
 import java.security.cert.Certificate;
 import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.security.cert.PKIXCertPathChecker;
 import java.security.cert.CertPathValidatorException;
+import java.security.cert.PKIXCertPathChecker;
+import java.security.cert.PKIXReason;
 import java.security.cert.PolicyNode;
 import java.security.cert.PolicyQualifierInfo;
+import java.security.cert.X509Certificate;
 
 import sun.security.util.Debug;
 import sun.security.x509.CertificatePoliciesExtension;
@@ -482,8 +483,9 @@
                     // the policyQualifiersRejected flag is set in the params
                     if (!pQuals.isEmpty() && rejectPolicyQualifiers &&
                         policiesCritical) {
-                            throw new CertPathValidatorException("critical " +
-                                "policy qualifiers present in certificate");
+                        throw new CertPathValidatorException(
+                            "critical policy qualifiers present in certificate",
+                            null, null, -1, PKIXReason.INVALID_POLICY);
                     }
 
                     // PKIX: Section 6.1.3: Step (d)(1)(i)
@@ -567,7 +569,8 @@
 
         if ((explicitPolicy == 0) && (rootNode == null)) {
             throw new CertPathValidatorException
-                ("non-null policy tree required and policy tree is null");
+                ("non-null policy tree required and policy tree is null",
+                 null, null, -1, PKIXReason.INVALID_POLICY);
         }
 
         return rootNode;
@@ -776,12 +779,14 @@
 
             if (issuerDomain.equals(ANY_POLICY)) {
                 throw new CertPathValidatorException
-                    ("encountered an issuerDomainPolicy of ANY_POLICY");
+                    ("encountered an issuerDomainPolicy of ANY_POLICY",
+                     null, null, -1, PKIXReason.INVALID_POLICY);
             }
 
             if (subjectDomain.equals(ANY_POLICY)) {
                 throw new CertPathValidatorException
-                    ("encountered a subjectDomainPolicy of ANY_POLICY");
+                    ("encountered a subjectDomainPolicy of ANY_POLICY",
+                     null, null, -1, PKIXReason.INVALID_POLICY);
             }
 
             Set<PolicyNodeImpl> validNodes =
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/ReverseBuilder.java b/jdk/src/share/classes/sun/security/provider/certpath/ReverseBuilder.java
index c3f2b67..6f82602 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/ReverseBuilder.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ReverseBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -29,14 +29,15 @@
 import java.security.GeneralSecurityException;
 import java.security.Principal;
 import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
 import java.security.cert.CertPathValidatorException;
 import java.security.cert.CertStore;
 import java.security.cert.CertStoreException;
 import java.security.cert.PKIXBuilderParameters;
 import java.security.cert.PKIXCertPathChecker;
 import java.security.cert.PKIXParameters;
+import java.security.cert.PKIXReason;
 import java.security.cert.TrustAnchor;
+import java.security.cert.X509Certificate;
 import java.security.cert.X509CertSelector;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -402,7 +403,8 @@
              */
             if ((currentState.remainingCACerts <= 0) && !X509CertImpl.isSelfIssued(cert)) {
                     throw new CertPathValidatorException
-                        ("pathLenConstraint violated, path too long");
+                        ("pathLenConstraint violated, path too long", null,
+                         null, -1, PKIXReason.PATH_TOO_LONG);
             }
 
             /*
@@ -438,7 +440,8 @@
                 try {
                     if (!currentState.nc.verify(cert)){
                         throw new CertPathValidatorException
-                            ("name constraints check failed");
+                            ("name constraints check failed", null, null, -1,
+                             PKIXReason.INVALID_NAME);
                     }
                 } catch (IOException ioe){
                     throw new CertPathValidatorException(ioe);
@@ -483,7 +486,9 @@
             unresolvedCritExts.remove(PKIXExtensions.ExtendedKeyUsage_Id.toString());
 
             if (!unresolvedCritExts.isEmpty())
-                throw new CertificateException("Unrecognized critical extension(s)");
+                throw new CertPathValidatorException
+                    ("Unrecognized critical extension(s)", null, null, -1,
+                     PKIXReason.UNRECOGNIZED_CRIT_EXT);
         }
 
         /*
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java
index 14ed530..0c43934 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -30,6 +30,9 @@
 import java.security.InvalidAlgorithmParameterException;
 import java.security.Principal;
 import java.security.PublicKey;
+import java.security.cert.*;
+import java.security.cert.PKIXReason;
+import java.security.interfaces.DSAPublicKey;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -39,10 +42,6 @@
 import java.util.List;
 import java.util.LinkedList;
 import java.util.Set;
-
-import java.security.cert.*;
-import java.security.interfaces.DSAPublicKey;
-
 import javax.security.auth.x500.X500Principal;
 
 import sun.security.x509.X500Name;
@@ -565,8 +564,9 @@
                             (PKIXExtensions.ExtendedKeyUsage_Id.toString());
 
                         if (!unresCritExts.isEmpty()) {
-                            throw new CertPathValidatorException("unrecognized "
-                                + "critical extension(s)");
+                            throw new CertPathValidatorException
+                                ("unrecognized critical extension(s)", null,
+                                 null, -1, PKIXReason.UNRECOGNIZED_CRIT_EXT);
                         }
                     }
                 }
diff --git a/jdk/src/share/classes/sun/text/resources/FormatData_sv.java b/jdk/src/share/classes/sun/text/resources/FormatData_sv.java
index f02245a..8d8cba9 100644
--- a/jdk/src/share/classes/sun/text/resources/FormatData_sv.java
+++ b/jdk/src/share/classes/sun/text/resources/FormatData_sv.java
@@ -1,5 +1,5 @@
 /*
- * Portions Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Portions Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/classes/sun/tools/jconsole/Plotter.java b/jdk/src/share/classes/sun/tools/jconsole/Plotter.java
index ea9d637..b9474c5 100644
--- a/jdk/src/share/classes/sun/tools/jconsole/Plotter.java
+++ b/jdk/src/share/classes/sun/tools/jconsole/Plotter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
@@ -30,18 +30,15 @@
 import java.beans.*;
 import java.io.*;
 import java.lang.reflect.Array;
-import java.text.*;
 import java.util.*;
 
 import javax.accessibility.*;
 import javax.swing.*;
 import javax.swing.border.*;
-import javax.swing.event.*;
 import javax.swing.filechooser.*;
 import javax.swing.filechooser.FileFilter;
 
 import com.sun.tools.jconsole.JConsoleContext;
-import com.sun.tools.jconsole.JConsoleContext.ConnectionState;
 
 import static com.sun.tools.jconsole.JConsoleContext.ConnectionState.*;
 
@@ -130,6 +127,7 @@
     private int bottomMargin = 45;
     private int leftMargin = 65;
     private int rightMargin = 70;
+    private final boolean displayLegend;
 
     public Plotter() {
         this(Unit.NONE, 0);
@@ -139,15 +137,21 @@
         this(unit, 0);
     }
 
+    public Plotter(Unit unit, int decimals) {
+        this(unit,decimals,true);
+    }
+
     // Note: If decimals > 0 then values must be decimally shifted left
     // that many places, i.e. multiplied by Math.pow(10.0, decimals).
-    public Plotter(Unit unit, int decimals) {
+    public Plotter(Unit unit, int decimals, boolean displayLegend) {
+        this.displayLegend = displayLegend;
         setUnit(unit);
         setDecimals(decimals);
 
         enableEvents(AWTEvent.MOUSE_EVENT_MASK);
 
         addMouseListener(new MouseAdapter() {
+            @Override
             public void mousePressed(MouseEvent e) {
                 if (getParent() instanceof PlotterPanel) {
                     getParent().requestFocusInWindow();
@@ -240,6 +244,7 @@
         }
     }
 
+    @Override
     public JPopupMenu getComponentPopupMenu() {
         if (popupMenu == null) {
             popupMenu = new JPopupMenu(Resources.getText("Chart:"));
@@ -330,6 +335,7 @@
         }
     }
 
+    @Override
     public void paintComponent(Graphics g) {
         super.paintComponent(g);
 
@@ -670,7 +676,7 @@
                         curValue += "%";
                     }
                     int valWidth = fm.stringWidth(curValue);
-                    String legend = seq.name;
+                    String legend = (displayLegend?seq.name:"");
                     int legendWidth = fm.stringWidth(legend);
                     if (checkRightMargin(valWidth) || checkRightMargin(legendWidth)) {
                         // Wait for next repaint
@@ -986,10 +992,12 @@
     }
 
     private static class SaveDataFileChooser extends JFileChooser {
+        private static final long serialVersionUID = -5182890922369369669L;
         SaveDataFileChooser() {
             setFileFilter(new FileNameExtensionFilter("CSV file", "csv"));
         }
 
+        @Override
         public void approveSelection() {
             File file = getSelectedFile();
             if (file != null) {
@@ -1034,6 +1042,7 @@
         }
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         if (accessibleContext == null) {
             accessibleContext = new AccessiblePlotter();
@@ -1042,10 +1051,12 @@
     }
 
     protected class AccessiblePlotter extends AccessibleJComponent {
+        private static final long serialVersionUID = -3847205410473510922L;
         protected AccessiblePlotter() {
             setAccessibleName(getText("Plotter.accessibleName"));
         }
 
+        @Override
         public String getAccessibleName() {
             String name = super.getAccessibleName();
 
@@ -1076,6 +1087,7 @@
             return name;
         }
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.CANVAS;
         }
diff --git a/jdk/src/share/classes/sun/tools/jconsole/inspector/XMBeanAttributes.java b/jdk/src/share/classes/sun/tools/jconsole/inspector/XMBeanAttributes.java
index 5fca79d..4fe9e73 100644
--- a/jdk/src/share/classes/sun/tools/jconsole/inspector/XMBeanAttributes.java
+++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/XMBeanAttributes.java
@@ -872,8 +872,8 @@
         MaximizedCellRenderer(Component comp) {
             this.comp = comp;
             Dimension d = comp.getPreferredSize();
-            if (d.getHeight() > 200) {
-                comp.setPreferredSize(new Dimension((int) d.getWidth(), 200));
+            if (d.getHeight() > 220) {
+                comp.setPreferredSize(new Dimension((int) d.getWidth(), 220));
             }
         }
         @Override
diff --git a/jdk/src/share/classes/sun/tools/jconsole/inspector/XPlotter.java b/jdk/src/share/classes/sun/tools/jconsole/inspector/XPlotter.java
index 24b4104..8be8c5c 100644
--- a/jdk/src/share/classes/sun/tools/jconsole/inspector/XPlotter.java
+++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/XPlotter.java
@@ -34,7 +34,7 @@
     JTable table;
     public XPlotter(JTable table,
                     Plotter.Unit unit) {
-        super(unit);
+        super(unit,0,false);
         this.table = table;
     }
     @Override
diff --git a/jdk/src/share/classes/sun/tools/jconsole/inspector/XPlottingViewer.java b/jdk/src/share/classes/sun/tools/jconsole/inspector/XPlottingViewer.java
index 7da7576..0c074a5 100644
--- a/jdk/src/share/classes/sun/tools/jconsole/inspector/XPlottingViewer.java
+++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/XPlottingViewer.java
@@ -27,14 +27,10 @@
 
 import java.awt.*;
 import java.awt.event.*;
-import java.io.*;
 import java.util.*;
 import java.util.Timer;
 
-import javax.management.*;
 import javax.swing.*;
-import javax.swing.border.*;
-import javax.swing.event.*;
 
 import sun.tools.jconsole.*;
 
@@ -127,6 +123,7 @@
         setBackground(g.getColor());
         plotter.paintComponent(g);
         }*/
+    @Override
     public void actionPerformed(ActionEvent evt) {
         plotterCache.remove(key);
         Timer t = timerCache.remove(key);
@@ -141,9 +138,11 @@
                                  JTable table) {
         final Plotter plotter = new XPlotter(table, Plotter.Unit.NONE) {
                 Dimension prefSize = new Dimension(400, 170);
+            @Override
                 public Dimension getPreferredSize() {
                     return prefSize;
                 }
+            @Override
                 public Dimension getMinimumSize() {
                     return prefSize;
                 }
@@ -183,42 +182,40 @@
         return plotter;
     }
 
-    //Create Plotter display
     private void setupDisplay(Plotter plotter) {
-        //setLayout(new GridLayout(2,0));
-        GridBagLayout gbl = new GridBagLayout();
-        setLayout(gbl);
+        final JPanel buttonPanel = new JPanel();
+        final GridBagLayout gbl = new GridBagLayout();
+        buttonPanel.setLayout(gbl);
+        setLayout(new BorderLayout());
         plotButton = new JButton(Resources.getText("Discard chart"));
         plotButton.addActionListener(this);
         plotButton.setEnabled(true);
 
-        // Add the display to the top four cells
         GridBagConstraints buttonConstraints = new GridBagConstraints();
         buttonConstraints.gridx = 0;
         buttonConstraints.gridy = 0;
         buttonConstraints.fill = GridBagConstraints.VERTICAL;
         buttonConstraints.anchor = GridBagConstraints.CENTER;
         gbl.setConstraints(plotButton, buttonConstraints);
-        add(plotButton);
+        buttonPanel.add(plotButton);
 
-        GridBagConstraints plotterConstraints = new GridBagConstraints();
-        plotterConstraints.gridx = 0;
-        plotterConstraints.gridy = 1;
-        plotterConstraints.weightx = 1;
-        //plotterConstraints.gridwidth = (int) plotter.getPreferredSize().getWidth();
-        //plotterConstraints.gridheight =  (int) plotter.getPreferredSize().getHeight();
-        plotterConstraints.fill = GridBagConstraints.VERTICAL;
-        gbl.setConstraints(plotter, plotterConstraints);
-
-
-        //bordered = new JPanel();
-        //bordered.setPreferredSize(new Dimension(400, 250));
-        //bordered.add(plotButton);
-        //bordered.add(plotter);
-
-        //add(bordered);
-
+        if (attributeName != null && attributeName.length()!=0) {
+            final JPanel plotterLabelPanel = new JPanel();
+            final JLabel label = new JLabel(attributeName);
+            final GridBagLayout gbl2 = new GridBagLayout();
+            plotterLabelPanel.setLayout(gbl2);
+            final GridBagConstraints labelConstraints = new GridBagConstraints();
+            labelConstraints.gridx = 0;
+            labelConstraints.gridy = 0;
+            labelConstraints.fill = GridBagConstraints.VERTICAL;
+            labelConstraints.anchor = GridBagConstraints.CENTER;
+            labelConstraints.ipady = 10;
+            gbl2.setConstraints(label, labelConstraints);
+            plotterLabelPanel.add(label);
+            add(plotterLabelPanel, BorderLayout.NORTH);
+        }
         setPlotter(plotter);
+        add(buttonPanel, BorderLayout.SOUTH);
         repaint();
     }
 
diff --git a/jdk/src/share/classes/sun/tools/jmap/JMap.java b/jdk/src/share/classes/sun/tools/jmap/JMap.java
index 3910052..ee4a981 100644
--- a/jdk/src/share/classes/sun/tools/jmap/JMap.java
+++ b/jdk/src/share/classes/sun/tools/jmap/JMap.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/demo/jvmti/hprof/hprof_io.c b/jdk/src/share/demo/jvmti/hprof/hprof_io.c
index 2f67982..fe4eebe 100644
--- a/jdk/src/share/demo/jvmti/hprof/hprof_io.c
+++ b/jdk/src/share/demo/jvmti/hprof/hprof_io.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff --git a/jdk/src/share/demo/jvmti/hprof/hprof_util.c b/jdk/src/share/demo/jvmti/hprof/hprof_util.c
index 6685a6c..b25e563 100644
--- a/jdk/src/share/demo/jvmti/hprof/hprof_util.c
+++ b/jdk/src/share/demo/jvmti/hprof/hprof_util.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff --git a/jdk/src/share/native/java/net/net_util.h b/jdk/src/share/native/java/net/net_util.h
index 9fded2f..9033d66 100644
--- a/jdk/src/share/native/java/net/net_util.h
+++ b/jdk/src/share/native/java/net/net_util.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/native/java/nio/Bits.c b/jdk/src/share/native/java/nio/Bits.c
index 6c87d37..448a058 100644
--- a/jdk/src/share/native/java/nio/Bits.c
+++ b/jdk/src/share/native/java/nio/Bits.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/native/java/util/zip/zip_util.c b/jdk/src/share/native/java/util/zip/zip_util.c
index 1f6e04a..5d518cf 100644
--- a/jdk/src/share/native/java/util/zip/zip_util.c
+++ b/jdk/src/share/native/java/util/zip/zip_util.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1995-2008 Sun Microsystems, Inc.  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
@@ -722,16 +722,22 @@
     }
 
     len = zip->len = ZFILE_Lseek(zfd, 0, SEEK_END);
-    if (len == -1) {
-        if (pmsg && JVM_GetLastErrorString(errbuf, sizeof(errbuf)) > 0)
-            *pmsg = errbuf;
+    if (len <= 0) {
+        if (len == 0) { /* zip file is empty */
+            if (pmsg) {
+                *pmsg = "zip file is empty";
+            }
+        } else { /* error */
+            if (pmsg && JVM_GetLastErrorString(errbuf, sizeof(errbuf)) > 0)
+                *pmsg = errbuf;
+        }
         ZFILE_Close(zfd);
         freeZip(zip);
         return NULL;
     }
 
     zip->zfd = zfd;
-    if (readCEN(zip, -1) <= 0) {
+    if (readCEN(zip, -1) < 0) {
         /* An error occurred while trying to read the zip file */
         if (pmsg != 0) {
             /* Set the zip error message */
@@ -947,10 +953,15 @@
 ZIP_GetEntry(jzfile *zip, char *name, jint ulen)
 {
     unsigned int hsh = hash(name);
-    jint idx = zip->table[hsh % zip->tablelen];
-    jzentry *ze;
+    jint idx;
+    jzentry *ze = 0;
 
     ZIP_Lock(zip);
+    if (zip->total == 0) {
+        goto Finally;
+    }
+
+    idx = zip->table[hsh % zip->tablelen];
 
     /*
      * This while loop is an optimization where a double lookup
@@ -1025,6 +1036,7 @@
         ulen = 0;
     }
 
+Finally:
     ZIP_Unlock(zip);
     return ze;
 }
diff --git a/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c b/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c
index 85088ac..70f95c6 100644
--- a/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c
+++ b/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/transport/shmem/shmemBack.c b/jdk/src/share/transport/shmem/shmemBack.c
index 629325b..e63c2bd 100644
--- a/jdk/src/share/transport/shmem/shmemBack.c
+++ b/jdk/src/share/transport/shmem/shmemBack.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/transport/shmem/shmemBase.c b/jdk/src/share/transport/shmem/shmemBase.c
index 461baf6..f0ee7f0 100644
--- a/jdk/src/share/transport/shmem/shmemBase.c
+++ b/jdk/src/share/transport/shmem/shmemBase.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/transport/socket/socketTransport.c b/jdk/src/share/transport/socket/socketTransport.c
index 705b7ef..f960fae 100644
--- a/jdk/src/share/transport/socket/socketTransport.c
+++ b/jdk/src/share/transport/socket/socketTransport.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/share/transport/socket/sysSocket.h b/jdk/src/share/transport/socket/sysSocket.h
index fc7ecb6..8931e8a 100644
--- a/jdk/src/share/transport/socket/sysSocket.h
+++ b/jdk/src/share/transport/socket/sysSocket.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java b/jdk/src/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java
index 7261443..532b02c 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java b/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java
index 8ebb0c2..d8542e1 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java b/jdk/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java
index 341fd47..b919343 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_Utils.h b/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_Utils.h
index 675aa68..2836b99 100644
--- a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_Utils.h
+++ b/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_Utils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
index dd3895c..dc804be 100644
--- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/java/net/SocketInputStream.c b/jdk/src/solaris/native/java/net/SocketInputStream.c
index a491461..5e5f193 100644
--- a/jdk/src/solaris/native/java/net/SocketInputStream.c
+++ b/jdk/src/solaris/native/java/net/SocketInputStream.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2002 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/java/net/SocketOutputStream.c b/jdk/src/solaris/native/java/net/SocketOutputStream.c
index 2ab6645..575a719 100644
--- a/jdk/src/solaris/native/java/net/SocketOutputStream.c
+++ b/jdk/src/solaris/native/java/net/SocketOutputStream.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2002 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/java/net/linux_close.c b/jdk/src/solaris/native/java/net/linux_close.c
index 4547451..59f0bd3 100644
--- a/jdk/src/solaris/native/java/net/linux_close.c
+++ b/jdk/src/solaris/native/java/net/linux_close.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/java/net/net_util_md.c b/jdk/src/solaris/native/java/net/net_util_md.c
index 460ce10..cfc86a8 100644
--- a/jdk/src/solaris/native/java/net/net_util_md.c
+++ b/jdk/src/solaris/native/java/net/net_util_md.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/java/nio/MappedByteBuffer.c b/jdk/src/solaris/native/java/nio/MappedByteBuffer.c
index 70d5c3e..60572bc 100644
--- a/jdk/src/solaris/native/java/nio/MappedByteBuffer.c
+++ b/jdk/src/solaris/native/java/nio/MappedByteBuffer.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c b/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
index bbbccd7..a1e66d9 100644
--- a/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
+++ b/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c b/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
index 7b4a4e7..635588d 100644
--- a/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
+++ b/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/sun/nio/ch/FileKey.c b/jdk/src/solaris/native/sun/nio/ch/FileKey.c
index fc56188..b0eebea 100644
--- a/jdk/src/solaris/native/sun/nio/ch/FileKey.c
+++ b/jdk/src/solaris/native/sun/nio/ch/FileKey.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/sun/nio/ch/InheritedChannel.c b/jdk/src/solaris/native/sun/nio/ch/InheritedChannel.c
index c6ba463..4087307 100644
--- a/jdk/src/solaris/native/sun/nio/ch/InheritedChannel.c
+++ b/jdk/src/solaris/native/sun/nio/ch/InheritedChannel.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/sun/nio/ch/Net.c b/jdk/src/solaris/native/sun/nio/ch/Net.c
index d9bbb6e..14ef8d1 100644
--- a/jdk/src/solaris/native/sun/nio/ch/Net.c
+++ b/jdk/src/solaris/native/sun/nio/ch/Net.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c b/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
index c0019d5..e946dbd 100644
--- a/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
+++ b/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2002 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c b/jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c
index 7190b1b..785d4a6 100644
--- a/jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c
+++ b/jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2002 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/native/sun/nio/ch/nio_util.h b/jdk/src/solaris/native/sun/nio/ch/nio_util.h
index 02c15ed..79c20bf 100644
--- a/jdk/src/solaris/native/sun/nio/ch/nio_util.h
+++ b/jdk/src/solaris/native/sun/nio/ch/nio_util.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2002 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/solaris/transport/socket/socket_md.c b/jdk/src/solaris/transport/socket/socket_md.c
index 84bfbe9..63ac591 100644
--- a/jdk/src/solaris/transport/socket/socket_md.c
+++ b/jdk/src/solaris/transport/socket/socket_md.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/classes/sun/nio/ch/PipeImpl.java b/jdk/src/windows/classes/sun/nio/ch/PipeImpl.java
index f021265..4bee984 100644
--- a/jdk/src/windows/classes/sun/nio/ch/PipeImpl.java
+++ b/jdk/src/windows/classes/sun/nio/ch/PipeImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java b/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
index 0617c0f..ac25ac0 100644
--- a/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
+++ b/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/javavm/export/jvm_md.h b/jdk/src/windows/javavm/export/jvm_md.h
index cf98f61..771ab10 100644
--- a/jdk/src/windows/javavm/export/jvm_md.h
+++ b/jdk/src/windows/javavm/export/jvm_md.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-1999 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/java/net/NetworkInterface.c b/jdk/src/windows/native/java/net/NetworkInterface.c
index b59595c..47133fd 100644
--- a/jdk/src/windows/native/java/net/NetworkInterface.c
+++ b/jdk/src/windows/native/java/net/NetworkInterface.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/java/net/NetworkInterface.h b/jdk/src/windows/native/java/net/NetworkInterface.h
index 5560083..c3d8511 100644
--- a/jdk/src/windows/native/java/net/NetworkInterface.h
+++ b/jdk/src/windows/native/java/net/NetworkInterface.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/java/net/NetworkInterface_win9x.c b/jdk/src/windows/native/java/net/NetworkInterface_win9x.c
index c211416..1e77adc 100644
--- a/jdk/src/windows/native/java/net/NetworkInterface_win9x.c
+++ b/jdk/src/windows/native/java/net/NetworkInterface_win9x.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c
index e2d878d7..0fcfa9f 100644
--- a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c
+++ b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/java/net/SocketOutputStream.c b/jdk/src/windows/native/java/net/SocketOutputStream.c
index 6b33a7d..7664e5f 100644
--- a/jdk/src/windows/native/java/net/SocketOutputStream.c
+++ b/jdk/src/windows/native/java/net/SocketOutputStream.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c b/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
index ddb7a47..77633f4 100644
--- a/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
+++ b/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c b/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
index f3cfd20..58dbf36 100644
--- a/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
+++ b/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/java/net/net_util_md.h b/jdk/src/windows/native/java/net/net_util_md.h
index 5b3ae84..23574f1 100644
--- a/jdk/src/windows/native/java/net/net_util_md.h
+++ b/jdk/src/windows/native/java/net/net_util_md.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c b/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c
index d698787..9d56405 100644
--- a/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c
+++ b/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c b/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
index 99cc716..5e6a386 100644
--- a/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
+++ b/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/sun/nio/ch/Net.c b/jdk/src/windows/native/sun/nio/ch/Net.c
index c89745a..b6353b9 100644
--- a/jdk/src/windows/native/sun/nio/ch/Net.c
+++ b/jdk/src/windows/native/sun/nio/ch/Net.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c b/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c
index a597d25..4b46692 100644
--- a/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c
+++ b/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2002 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c b/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c
index 1c89925..a8125d9 100644
--- a/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c
+++ b/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c b/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c
index cb424ad..a9d3593 100644
--- a/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c
+++ b/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/sun/windows/ComCtl32Util.cpp b/jdk/src/windows/native/sun/windows/ComCtl32Util.cpp
index d00ef6e..a36ac6d 100644
--- a/jdk/src/windows/native/sun/windows/ComCtl32Util.cpp
+++ b/jdk/src/windows/native/sun/windows/ComCtl32Util.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/sun/windows/ComCtl32Util.h b/jdk/src/windows/native/sun/windows/ComCtl32Util.h
index e410f30..888a14d 100644
--- a/jdk/src/windows/native/sun/windows/ComCtl32Util.h
+++ b/jdk/src/windows/native/sun/windows/ComCtl32Util.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/native/sun/windows/awt_TextArea.cpp b/jdk/src/windows/native/sun/windows/awt_TextArea.cpp
index 3c42ce4..92a36b7 100644
--- a/jdk/src/windows/native/sun/windows/awt_TextArea.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_TextArea.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/transport/socket/socket_md.c b/jdk/src/windows/transport/socket/socket_md.c
index 622b9e2..b8bca54 100644
--- a/jdk/src/windows/transport/socket/socket_md.c
+++ b/jdk/src/windows/transport/socket/socket_md.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/src/windows/transport/socket/socket_md.h b/jdk/src/windows/transport/socket/socket_md.h
index bbf9b34..c2d0143 100644
--- a/jdk/src/windows/transport/socket/socket_md.h
+++ b/jdk/src/windows/transport/socket/socket_md.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2000 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/com/sun/jdi/ClassesByName2Test.java b/jdk/test/com/sun/jdi/ClassesByName2Test.java
index 3bdab5d..438661a 100644
--- a/jdk/test/com/sun/jdi/ClassesByName2Test.java
+++ b/jdk/test/com/sun/jdi/ClassesByName2Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
@@ -41,8 +41,7 @@
     /********** target program **********/
 
 class ClassesByName2Targ {
-    public static void ready() {
-        System.out.println("Ready!");
+    static void bkpt() {
     }
 
     public static void main(String[] args){
@@ -74,22 +73,24 @@
                     }
                 };
 
-            ready();
-
             two.start();
             one.start();
             zero.start();
 
             try {
                 zero.join();
+                System.out.println("zero joined");
                 one.join();
+                System.out.println("one joined");
                 two.join();
+                System.out.println("two joined");
             } catch (InterruptedException iex) {
                 iex.printStackTrace();
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
+        bkpt();
         System.out.println("Goodbye from ClassesByName2Targ!");
     }
 }
@@ -97,29 +98,64 @@
     /********** test program **********/
 
 public class ClassesByName2Test extends TestScaffold {
+    volatile boolean stop = false;
 
     ClassesByName2Test (String args[]) {
         super(args);
     }
 
+    public void breakpointReached(BreakpointEvent event) {
+        System.out.println("Got BreakpointEvent: " + event);
+        stop = true;
+    }
+
+    public void eventSetComplete(EventSet set) {
+        // Don't resume.
+    }
+
     public static void main(String[] args)      throws Exception {
         new ClassesByName2Test(args).startTests();
     }
 
-    protected void runTests() throws Exception {
-        /*
-         * Get to the top of ready()
-         */
-        startTo("ClassesByName2Targ", "ready", "()V");
+    void breakpointAtMethod(ReferenceType ref, String methodName)
+                                           throws Exception {
+        List meths = ref.methodsByName(methodName);
+        if (meths.size() != 1) {
+            throw new Exception("test error: should be one " +
+                                methodName);
+        }
+        Method meth = (Method)meths.get(0);
+        BreakpointRequest bkptReq = vm().eventRequestManager().
+            createBreakpointRequest(meth.location());
+        bkptReq.enable();
+        try {
+            addListener (this);
+        } catch (Exception ex){
+            ex.printStackTrace();
+            failure("failure: Could not add listener");
+            throw new Exception("ClassesByname2Test: failed");
+        }
+    }
 
+    protected void runTests() throws Exception {
+        BreakpointEvent bpe = startToMain("ClassesByName2Targ");
+
+        /*
+          Bug 6263966 - Don't just resume because the debuggee can
+          complete and disconnect while the following loop is
+          accessing it.
+        */
+        breakpointAtMethod(bpe.location().declaringType(), "bkpt");
         vm().resume();
 
-        int i = 0;
-        while (i < 8 && !vmDisconnected) {
-            i++;
+        /* The test of 'stop' is so that we stop when the debuggee hits
+           the bkpt.  The 150 is so we stop if the debuggee
+           is slow (eg, -Xcomp -server) - we don't want to
+           spend all day waiting for it to get to the bkpt.
+        */
+        for (int i = 0; i < 150 && !stop; i++) {
             List all = vm().allClasses();
-            System.out.println("");
-            System.out.println("++++ Lookup number: " + i + ".  allClasses() returned " +
+            System.out.println("\n++++ Lookup number: " + i + ".  allClasses() returned " +
                                all.size() + " classes.");
             for (Iterator it = all.iterator(); it.hasNext(); ) {
                 ReferenceType cls = (ReferenceType)it.next();
@@ -135,9 +171,8 @@
             }
         }
 
-
-        // Doing vm().exit(0) instead of listenUntilVMDisconnect()
-        // speeds up the test up by more than 50% in -server -Xcomp (solsparc32-fastdebug)
+        // In case of a slow debuggee, we don't want to resume the debuggee and wait
+        // for it to complete.
         vm().exit(0);
 
         /*
diff --git a/jdk/test/com/sun/jdi/ConnectedVMs.java b/jdk/test/com/sun/jdi/ConnectedVMs.java
index bbbc769..3b25392 100644
--- a/jdk/test/com/sun/jdi/ConnectedVMs.java
+++ b/jdk/test/com/sun/jdi/ConnectedVMs.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2001 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/com/sun/jdi/MonitorFrameInfo.java b/jdk/test/com/sun/jdi/MonitorFrameInfo.java
index 056428d..a58ddb7 100644
--- a/jdk/test/com/sun/jdi/MonitorFrameInfo.java
+++ b/jdk/test/com/sun/jdi/MonitorFrameInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/com/sun/jdi/Solaris32AndSolaris64Test.sh b/jdk/test/com/sun/jdi/Solaris32AndSolaris64Test.sh
index 37be278..c1b4491 100644
--- a/jdk/test/com/sun/jdi/Solaris32AndSolaris64Test.sh
+++ b/jdk/test/com/sun/jdi/Solaris32AndSolaris64Test.sh
@@ -1,7 +1,7 @@
 #!/bin/ksh -p
 
 #
-# Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/com/sun/jdi/SourceNameFilterTest.java b/jdk/test/com/sun/jdi/SourceNameFilterTest.java
index cb82606..42b1e94 100644
--- a/jdk/test/com/sun/jdi/SourceNameFilterTest.java
+++ b/jdk/test/com/sun/jdi/SourceNameFilterTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/com/sun/jdi/VMConnection.java b/jdk/test/com/sun/jdi/VMConnection.java
index c9cb83f..5d5f9e1 100644
--- a/jdk/test/com/sun/jdi/VMConnection.java
+++ b/jdk/test/com/sun/jdi/VMConnection.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/com/sun/net/httpserver/bugs/B6744329.java b/jdk/test/com/sun/net/httpserver/bugs/B6744329.java
new file mode 100644
index 0000000..9a78384
--- /dev/null
+++ b/jdk/test/com/sun/net/httpserver/bugs/B6744329.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug B6744329
+ * @summary  Exception in light weight Http server
+ */
+
+import com.sun.net.httpserver.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.io.*;
+import java.net.*;
+import java.security.*;
+import java.security.cert.*;
+import javax.net.ssl.*;
+
+public class B6744329 {
+
+    public static void main (String[] args) throws Exception {
+        Handler handler = new Handler();
+        InetSocketAddress addr = new InetSocketAddress (0);
+        HttpServer server = HttpServer.create (addr, 0);
+        HttpContext ctx = server.createContext ("/test", handler);
+        ExecutorService executor = Executors.newCachedThreadPool();
+        server.setExecutor (executor);
+        server.start ();
+
+        URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html");
+        HttpURLConnection urlc = (HttpURLConnection)url.openConnection ();
+        try {
+            InputStream is = urlc.getInputStream();
+            int c = 0;
+            while (is.read()!= -1) {
+                c ++;
+            }
+            System.out.println ("OK");
+        } catch (IOException e) {
+            System.out.println ("exception");
+            error = true;
+        }
+        server.stop(2);
+        executor.shutdown();
+        if (error) {
+            throw new RuntimeException ("Test failed");
+        }
+    }
+
+    public static boolean error = false;
+
+    /* this must be the same size as in ChunkedOutputStream.java
+     */
+    final static int CHUNK_SIZE = 4096;
+
+    static class Handler implements HttpHandler {
+        int invocation = 1;
+        public void handle (HttpExchange t)
+            throws IOException
+        {
+            InputStream is = t.getRequestBody();
+            Headers map = t.getRequestHeaders();
+            Headers rmap = t.getResponseHeaders();
+            while (is.read () != -1) ;
+            is.close();
+            /* chunked response */
+            t.sendResponseHeaders (200, 0);
+            OutputStream os = t.getResponseBody();
+            byte[] first = new byte [CHUNK_SIZE * 2];
+            byte[] second = new byte [2];
+            os.write (first);
+            os.write ('x');
+            os.write ('x');
+            /* An index out of bounds exception will be thrown
+             * below, which is caught by server, and connection
+             * will be closed. resulting in IOException to client
+             * - if bug present
+             */
+            os.write ('x');
+            os.write ('x');
+            os.write ('x');
+            t.close();
+        }
+    }
+}
diff --git a/jdk/test/java/lang/management/ManagementFactory/ThreadMXBeanProxy.java b/jdk/test/java/lang/management/ManagementFactory/ThreadMXBeanProxy.java
index d26e981..75cee8f 100644
--- a/jdk/test/java/lang/management/ManagementFactory/ThreadMXBeanProxy.java
+++ b/jdk/test/java/lang/management/ManagementFactory/ThreadMXBeanProxy.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/java/lang/management/ThreadMXBean/Locks.java b/jdk/test/java/lang/management/ThreadMXBean/Locks.java
index cd81d89..694a862 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/Locks.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/Locks.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/java/net/CookieHandler/TestHttpCookie.java b/jdk/test/java/net/CookieHandler/TestHttpCookie.java
index c627227..43d5484 100644
--- a/jdk/test/java/net/CookieHandler/TestHttpCookie.java
+++ b/jdk/test/java/net/CookieHandler/TestHttpCookie.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
@@ -24,7 +24,7 @@
 /**
  * @test
  * @summary Unit test for java.net.HttpCookie
- * @bug 6244040 6277796 6277801 6277808 6294071
+ * @bug 6244040 6277796 6277801 6277808 6294071 6692802
  * @author Edward Wang
  */
 
@@ -178,6 +178,19 @@
     }
     TestHttpCookie port(String p) { return port(0, p); }
 
+    // check http only
+    TestHttpCookie httpOnly(int index, boolean b) {
+        HttpCookie cookie = cookies.get(index);
+        if (cookie == null || b != cookie.isHttpOnly()) {
+            raiseError("HttpOnly", String.valueOf(cookie.isHttpOnly()), String.valueOf(b));
+        }
+        return this;
+    }
+
+    TestHttpCookie httpOnly(boolean b) {
+        return httpOnly(0, b);
+    }
+
     // check equality
     static void eq(HttpCookie ck1, HttpCookie ck2, boolean same) {
         testCount++;
@@ -362,6 +375,10 @@
         } catch (IllegalArgumentException ignored) {
             // expected exception; no-op
         }
+
+        // CR 6692802: HttpOnly flag
+        test("set-cookie: CUSTOMER=WILE_E_COYOTE;HttpOnly").httpOnly(true);
+        test("set-cookie: CUSTOMER=WILE_E_COYOTE").httpOnly(false);
     }
 
     static void header(String prompt) {
diff --git a/jdk/test/java/net/Inet6Address/serialize/Serialize.java b/jdk/test/java/net/Inet6Address/serialize/Serialize.java
index 17b5500..b3511ee 100644
--- a/jdk/test/java/net/Inet6Address/serialize/Serialize.java
+++ b/jdk/test/java/net/Inet6Address/serialize/Serialize.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/java/nio/channels/FileChannel/ExpandingMap.java b/jdk/test/java/nio/channels/FileChannel/ExpandingMap.java
index 278badb..24820fd 100644
--- a/jdk/test/java/nio/channels/FileChannel/ExpandingMap.java
+++ b/jdk/test/java/nio/channels/FileChannel/ExpandingMap.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/java/nio/channels/Selector/Wakeup.java b/jdk/test/java/nio/channels/Selector/Wakeup.java
index 808ba83..d4fa249 100644
--- a/jdk/test/java/nio/channels/Selector/Wakeup.java
+++ b/jdk/test/java/nio/channels/Selector/Wakeup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/java/security/cert/CertPathValidator/nameConstraintsRFC822/ValidateCertPath.java b/jdk/test/java/security/cert/CertPathValidator/nameConstraintsRFC822/ValidateCertPath.java
index d610262..b2666a3 100644
--- a/jdk/test/java/security/cert/CertPathValidator/nameConstraintsRFC822/ValidateCertPath.java
+++ b/jdk/test/java/security/cert/CertPathValidator/nameConstraintsRFC822/ValidateCertPath.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
@@ -34,6 +34,7 @@
 import java.io.IOException;
 
 import java.security.cert.*;
+import java.security.cert.PKIXReason;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -69,6 +70,9 @@
             validate(path, params);
             throw new Exception("Successfully validated invalid path.");
         } catch (CertPathValidatorException e) {
+            if (e.getReason() != PKIXReason.INVALID_NAME) {
+                throw new Exception("unexpected reason: " + e.getReason());
+            }
             System.out.println("Path rejected as expected: " + e);
         }
     }
@@ -86,14 +90,14 @@
         args = new String[] {"jane2jane.cer", "jane2steve.cer", "steve2tom.cer"};
 
         TrustAnchor anchor = new TrustAnchor(getCertFromFile(args[0]), null);
-        List list = new ArrayList();
+        List<X509Certificate> list = new ArrayList<X509Certificate>();
         for (int i = 1; i < args.length; i++) {
             list.add(0, getCertFromFile(args[i]));
         }
         CertificateFactory cf = CertificateFactory.getInstance("X509");
         path = cf.generateCertPath(list);
 
-        Set anchors = Collections.singleton(anchor);
+        Set<TrustAnchor> anchors = Collections.singleton(anchor);
         params = new PKIXParameters(anchors);
         params.setRevocationEnabled(false);
     }
diff --git a/jdk/test/java/security/cert/CertPathValidatorException/ReasonTest.java b/jdk/test/java/security/cert/CertPathValidatorException/ReasonTest.java
new file mode 100644
index 0000000..3702893
--- /dev/null
+++ b/jdk/test/java/security/cert/CertPathValidatorException/ReasonTest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6465942
+ * @summary unit test for CertPathValidatorException.Reason
+ */
+
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertPathValidatorException.BasicReason;
+
+public class ReasonTest {
+    private static volatile boolean failed = false;
+    public static void main(String[] args) throws Exception {
+
+        // check that getReason returns UNSPECIFIED if reason not specified
+        CertPathValidatorException cpve = new CertPathValidatorException("abc");
+        if (cpve.getReason() != BasicReason.UNSPECIFIED) {
+            failed = true;
+            System.err.println("FAILED: unexpected reason: " + cpve.getReason());
+        }
+
+        // check that getReason returns specified reason
+        cpve = new CertPathValidatorException
+            ("abc", null, null, -1, BasicReason.REVOKED);
+        if (cpve.getReason() != BasicReason.REVOKED) {
+            failed = true;
+            System.err.println("FAILED: unexpected reason: " + cpve.getReason());
+        }
+
+        // check that ctor throws NPE when reason is null
+        try {
+            cpve = new CertPathValidatorException("abc", null, null, -1, null);
+            failed = true;
+            System.err.println("ctor did not throw NPE for null reason");
+        } catch (Exception e) {
+            if (!(e instanceof NullPointerException)) {
+                failed = true;
+                System.err.println("FAILED: unexpected exception: " + e);
+            }
+        }
+        if (failed) {
+            throw new Exception("Some tests FAILED");
+        }
+    }
+}
diff --git a/jdk/test/java/security/cert/CertPathValidatorException/Serial.java b/jdk/test/java/security/cert/CertPathValidatorException/Serial.java
new file mode 100644
index 0000000..a6ffd3b
--- /dev/null
+++ b/jdk/test/java/security/cert/CertPathValidatorException/Serial.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6465942
+ * @summary Test deserialization of CertPathValidatorException
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+//import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CertPath;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertPathValidatorException.BasicReason;
+import java.util.Collections;
+
+/**
+ * This class tests to see if CertPathValidatorException can be serialized and
+ * deserialized properly.
+ */
+public class Serial {
+    private static volatile boolean failed = false;
+    public static void main(String[] args) throws Exception {
+
+        File f = new File(System.getProperty("test.src", "."), "cert_file");
+        FileInputStream fis = new FileInputStream(f);
+        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+        Certificate c = cf.generateCertificate(fis);
+        fis.close();
+        CertPath cp = cf.generateCertPath(Collections.singletonList(c));
+
+        CertPathValidatorException cpve1 =
+            new CertPathValidatorException
+                ("Test", new Exception("Expired"), cp, 0, BasicReason.EXPIRED);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+//        FileOutputStream fos = new FileOutputStream("jdk7.serial");
+        ObjectOutputStream oos = new ObjectOutputStream(baos);
+//        ObjectOutputStream foos = new ObjectOutputStream(fos);
+        oos.writeObject(cpve1);
+//        foos.writeObject(cpve1);
+        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+        ObjectInputStream ois = new ObjectInputStream(bais);
+        CertPathValidatorException cpve2 =
+            (CertPathValidatorException) ois.readObject();
+        check(!cpve1.getMessage().equals(cpve2.getMessage()),
+            "CertPathValidatorException messages not equal");
+        check(!cpve1.getCause().getMessage().equals(cpve2.getCause().getMessage()),
+            "CertPathValidatorException causes not equal");
+        check(!cpve1.getCertPath().equals(cpve2.getCertPath()),
+            "CertPathValidatorException certpaths not equal");
+        check(cpve1.getIndex() != cpve2.getIndex(),
+            "CertPathValidatorException indexes not equal");
+        check(cpve1.getReason() != cpve2.getReason(),
+            "CertPathValidatorException reasons not equal");
+        oos.close();
+        ois.close();
+
+        f = new File(System.getProperty("test.src", "."), "jdk6.serial");
+        fis = new FileInputStream(f);
+        ois = new ObjectInputStream(fis);
+        cpve2 = (CertPathValidatorException) ois.readObject();
+        check(!cpve1.getMessage().equals(cpve2.getMessage()),
+            "CertPathValidatorException messages not equal");
+        check(!cpve1.getCause().getMessage().equals(cpve2.getCause().getMessage()),
+            "CertPathValidatorException causes not equal");
+        check(!cpve1.getCertPath().equals(cpve2.getCertPath()),
+            "CertPathValidatorException certpaths not equal");
+        check(cpve1.getIndex() != cpve2.getIndex(),
+            "CertPathValidatorException indexes not equal");
+//      System.out.println(cpve2.getReason());
+        check(cpve2.getReason() != BasicReason.UNSPECIFIED,
+            "CertPathValidatorException reasons not equal");
+        oos.close();
+        ois.close();
+        if (failed) {
+            throw new Exception("Some tests FAILED");
+        }
+    }
+
+    private static void check(boolean expr, String message) {
+        if (expr) {
+            failed = true;
+            System.err.println("FAILED: " + message);
+        }
+    }
+}
diff --git a/jdk/test/java/security/cert/CertPathValidatorException/cert_file b/jdk/test/java/security/cert/CertPathValidatorException/cert_file
new file mode 100644
index 0000000..42af97b
--- /dev/null
+++ b/jdk/test/java/security/cert/CertPathValidatorException/cert_file
Binary files differ
diff --git a/jdk/test/java/security/cert/CertPathValidatorException/jdk6.serial b/jdk/test/java/security/cert/CertPathValidatorException/jdk6.serial
new file mode 100644
index 0000000..b76d070
--- /dev/null
+++ b/jdk/test/java/security/cert/CertPathValidatorException/jdk6.serial
Binary files differ
diff --git a/jdk/test/java/security/cert/PolicyNode/GetPolicyQualifiers.java b/jdk/test/java/security/cert/PolicyNode/GetPolicyQualifiers.java
index 0ef95a0..b10951b 100644
--- a/jdk/test/java/security/cert/PolicyNode/GetPolicyQualifiers.java
+++ b/jdk/test/java/security/cert/PolicyNode/GetPolicyQualifiers.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
@@ -74,6 +74,10 @@
             throw new Exception("Validation of CertPath containing critical " +
                 "qualifiers should have failed when policyQualifiersRejected " +
                 "flag is true");
-        } catch (CertPathValidatorException cpve) {}
+        } catch (CertPathValidatorException cpve) {
+            if (cpve.getReason() != PKIXReason.INVALID_POLICY) {
+                throw new Exception("unexpected reason: " + cpve.getReason());
+            }
+        }
     }
 }
diff --git a/jdk/test/java/util/zip/TestEmptyZip.java b/jdk/test/java/util/zip/TestEmptyZip.java
new file mode 100644
index 0000000..d19dee4
--- /dev/null
+++ b/jdk/test/java/util/zip/TestEmptyZip.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 6334003 6440786
+ * @summary Test ability to write and read zip files that have no entries.
+ * @author Dave Bristor
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.zip.*;
+
+public class TestEmptyZip {
+    public static void realMain(String[] args) throws Throwable {
+        String zipName = "foo.zip";
+        File f = new File(System.getProperty("test.scratch", "."), zipName);
+        if (f.exists() && !f.delete()) {
+            throw new Exception("failed to delete " + zipName);
+        }
+
+        // Verify 0-length file cannot be read
+        f.createNewFile();
+        ZipFile zf = null;
+        try {
+            zf = new ZipFile(f);
+            fail();
+        } catch (Exception ex) {
+            check(ex.getMessage().contains("zip file is empty"));
+        } finally {
+            if (zf != null) {
+                zf.close();
+            }
+        }
+
+        ZipInputStream zis = null;
+        try {
+            zis = new ZipInputStream(new FileInputStream(f));
+            ZipEntry ze = zis.getNextEntry();
+            check(ze == null);
+        } catch (Exception ex) {
+            unexpected(ex);
+        } finally {
+            if (zis != null) {
+                zis.close();
+            }
+        }
+
+        f.delete();
+
+        // Verify 0-entries file can be written
+        write(f);
+
+        // Verify 0-entries file can be read
+        readFile(f);
+        readStream(f);
+
+        f.delete();
+    }
+
+    static void write(File f) throws Exception {
+        ZipOutputStream zos = null;
+        try {
+            zos = new ZipOutputStream(new FileOutputStream(f));
+            zos.finish();
+            zos.close();
+            pass();
+        } catch (Exception ex) {
+            unexpected(ex);
+        } finally {
+            if (zos != null) {
+                zos.close();
+            }
+        }
+    }
+
+    static void readFile(File f) throws Exception {
+        ZipFile zf = null;
+        try {
+            zf = new ZipFile(f);
+
+            Enumeration e = zf.entries();
+            while (e.hasMoreElements()) {
+                ZipEntry entry = (ZipEntry) e.nextElement();
+                fail();
+            }
+            zf.close();
+            pass();
+        } catch (Exception ex) {
+            unexpected(ex);
+        } finally {
+            if (zf != null) {
+                zf.close();
+            }
+        }
+    }
+
+    static void readStream(File f) throws Exception {
+        ZipInputStream zis = null;
+        try {
+            zis = new ZipInputStream(new FileInputStream(f));
+            ZipEntry ze = zis.getNextEntry();
+            check(ze == null);
+            byte[] buf = new byte[1024];
+            check(zis.read(buf, 0, 1024) == -1);
+        } finally {
+            if (zis != null) {
+                zis.close();
+            }
+        }
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static boolean pass() {passed++; return true;}
+    static boolean fail() {failed++; Thread.dumpStack(); return false;}
+    static boolean fail(String msg) {System.out.println(msg); return fail();}
+    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    static boolean check(boolean cond) {if (cond) pass(); else fail(); return cond;}
+    static boolean equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) return pass();
+        else return fail(x + " not equal to " + y);}
+    public static void main(String[] args) throws Throwable {
+        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        System.out.println("\nPassed = " + passed + " failed = " + failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
diff --git a/jdk/test/javax/management/Introspector/AnnotatedMBeanTest.java b/jdk/test/javax/management/Introspector/AnnotatedMBeanTest.java
index b0782d3..382a121 100644
--- a/jdk/test/javax/management/Introspector/AnnotatedMBeanTest.java
+++ b/jdk/test/javax/management/Introspector/AnnotatedMBeanTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java b/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java
index bc6a335..3db55b7 100644
--- a/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java
+++ b/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/Introspector/MBeanDescriptionTest.java b/jdk/test/javax/management/Introspector/MBeanDescriptionTest.java
index 5fc77f9..5a52b0b 100644
--- a/jdk/test/javax/management/Introspector/MBeanDescriptionTest.java
+++ b/jdk/test/javax/management/Introspector/MBeanDescriptionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/Introspector/ParameterNameTest.java b/jdk/test/javax/management/Introspector/ParameterNameTest.java
index fada6cc..bf5649b 100644
--- a/jdk/test/javax/management/Introspector/ParameterNameTest.java
+++ b/jdk/test/javax/management/Introspector/ParameterNameTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/Introspector/ResourceInjectionTest.java b/jdk/test/javax/management/Introspector/ResourceInjectionTest.java
index ad45ccc..0a8882b 100644
--- a/jdk/test/javax/management/Introspector/ResourceInjectionTest.java
+++ b/jdk/test/javax/management/Introspector/ResourceInjectionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/Introspector/annot/Name.java b/jdk/test/javax/management/Introspector/annot/Name.java
index 790e641..3144978 100644
--- a/jdk/test/javax/management/Introspector/annot/Name.java
+++ b/jdk/test/javax/management/Introspector/annot/Name.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/MBeanInfo/NotificationInfoTest.java b/jdk/test/javax/management/MBeanInfo/NotificationInfoTest.java
index af1cac4..71a9588 100644
--- a/jdk/test/javax/management/MBeanInfo/NotificationInfoTest.java
+++ b/jdk/test/javax/management/MBeanInfo/NotificationInfoTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/MBeanServer/DynamicWrapperMBeanTest.java b/jdk/test/javax/management/MBeanServer/DynamicWrapperMBeanTest.java
index 5867b1a..793419a 100644
--- a/jdk/test/javax/management/MBeanServer/DynamicWrapperMBeanTest.java
+++ b/jdk/test/javax/management/MBeanServer/DynamicWrapperMBeanTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/MBeanServer/InstanceNotFoundExceptionTest.java b/jdk/test/javax/management/MBeanServer/InstanceNotFoundExceptionTest.java
new file mode 100644
index 0000000..3007965
--- /dev/null
+++ b/jdk/test/javax/management/MBeanServer/InstanceNotFoundExceptionTest.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6669137
+ * @summary Test the constructors of InstanceNotFoundExceptionTest.
+ * @author Daniel Fuchs
+ * @compile InstanceNotFoundExceptionTest.java
+ * @run main InstanceNotFoundExceptionTest
+ */
+
+import javax.management.InstanceNotFoundException;
+import javax.management.ObjectName;
+
+public class InstanceNotFoundExceptionTest {
+    public static void main(String[] args) throws Exception {
+        final InstanceNotFoundException x =
+                new InstanceNotFoundException();
+        System.out.println("InstanceNotFoundException(): "+x.getMessage());
+
+        final String msg = "who is toto?";
+        final InstanceNotFoundException x2 =
+                new InstanceNotFoundException(msg);
+        if (!msg.equals(x2.getMessage()))
+            throw new Exception("Bad message: expected "+msg+
+                    ", got "+x2.getMessage());
+        System.out.println("InstanceNotFoundException(" +
+                msg+"): "+x2.getMessage());
+
+        final InstanceNotFoundException x3 =
+                new InstanceNotFoundException((String)null);
+        if (x3.getMessage() != null)
+            throw new Exception("Bad message: expected "+null+
+                    ", got "+x3.getMessage());
+        System.out.println("InstanceNotFoundException((String)null): "+
+                x3.getMessage());
+
+        final ObjectName n = new ObjectName("who is toto?:type=msg");
+        final InstanceNotFoundException x4 =
+                new InstanceNotFoundException(n);
+        if (!String.valueOf(n).equals(x4.getMessage()))
+            throw new Exception("Bad message: expected "+n+
+                    ", got "+x4.getMessage());
+        System.out.println("InstanceNotFoundException(" +
+                n+"): "+x4.getMessage());
+
+        final InstanceNotFoundException x5 =
+                new InstanceNotFoundException((ObjectName)null);
+        if (!String.valueOf((ObjectName)null).equals(x5.getMessage()))
+            throw new Exception("Bad message: expected " +
+                    String.valueOf((ObjectName)null)+" got "+x5.getMessage());
+        System.out.println("InstanceNotFoundException((ObjectName)null): "+
+                x5.getMessage());
+    }
+}
diff --git a/jdk/test/javax/management/MBeanServer/OldMBeanServerTest.java b/jdk/test/javax/management/MBeanServer/OldMBeanServerTest.java
index f35dd77..e33d993 100644
--- a/jdk/test/javax/management/MBeanServer/OldMBeanServerTest.java
+++ b/jdk/test/javax/management/MBeanServer/OldMBeanServerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/MBeanServerFactory/NamedMBeanServerTest.java b/jdk/test/javax/management/MBeanServerFactory/NamedMBeanServerTest.java
index e261683..f2114f9 100644
--- a/jdk/test/javax/management/MBeanServerFactory/NamedMBeanServerTest.java
+++ b/jdk/test/javax/management/MBeanServerFactory/NamedMBeanServerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
@@ -25,6 +25,7 @@
  * @test
  * @summary Test named MBeanServers.
  * @author Daniel Fuchs
+ * @bug 6299231
  * @run clean NamedMBeanServerTest
  * @run build NamedMBeanServerTest
  * @run main NamedMBeanServerTest
diff --git a/jdk/test/javax/management/ObjectName/ApplyWildcardTest.java b/jdk/test/javax/management/ObjectName/ApplyWildcardTest.java
index f3544ff..0301636 100644
--- a/jdk/test/javax/management/ObjectName/ApplyWildcardTest.java
+++ b/jdk/test/javax/management/ObjectName/ApplyWildcardTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/ObjectName/SerialCompatTest.java b/jdk/test/javax/management/ObjectName/SerialCompatTest.java
index a18a688..ff7b20d 100644
--- a/jdk/test/javax/management/ObjectName/SerialCompatTest.java
+++ b/jdk/test/javax/management/ObjectName/SerialCompatTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/ObjectName/ValueOfTest.java b/jdk/test/javax/management/ObjectName/ValueOfTest.java
new file mode 100644
index 0000000..4a68a3d
--- /dev/null
+++ b/jdk/test/javax/management/ObjectName/ValueOfTest.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6734813
+ * @summary Test the ObjectName.valueOf methods
+ * @author Eamonn McManus
+ */
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Hashtable;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+public class ValueOfTest {
+    public static void main(String[] args) throws Exception {
+        // Calls that should work
+        testPositive("d:foo=bar,baz=buh");
+        testPositive("foo", "bar", "baz");
+        Hashtable<String, String> h = new Hashtable<String, String>();
+        h.put("foo", "bar");
+        h.put("baz", "buh");
+        testPositive("domain", h);
+
+        // Calls that should not work
+        testNegative("d");
+        testNegative("d:");
+        testNegative("d::foo=bar");
+        testNegative("d:", "foo", "bar");
+        testNegative("d", "foo=", "bar");
+        testNegative("d:", h);
+        testNegative("d", new Hashtable<String, String>());
+    }
+
+    private static void testPositive(Object... args) throws Exception {
+        Method valueOf = valueOfMethod(args);
+        Method getInstance = getInstanceMethod(args);
+        Constructor<?> constructor = constructor(args);
+
+        Object valueOfValue = valueOf.invoke(null, args);
+        Object getInstanceValue = getInstance.invoke(null, args);
+        Object constructorValue = constructor.newInstance(args);
+
+        String argString =
+                Arrays.toString(args).replace('[', '(').replace(']', ')');
+
+        if (!valueOfValue.equals(getInstanceValue)) {
+            throw new Exception(
+                    "valueOf" + argString + " differs from getInstance" +
+                    argString);
+        }
+
+        if (!valueOfValue.equals(constructorValue)) {
+            throw new Exception(
+                    "valueOf" + argString + " differs from new ObjectName " +
+                    argString);
+        }
+
+        System.out.println("OK: valueOf" + argString);
+    }
+
+    private static void testNegative(Object... args) throws Exception {
+        Method valueOf = valueOfMethod(args);
+        Method getInstance = getInstanceMethod(args);
+
+        String argString =
+                Arrays.toString(args).replace('[', '(').replace(']', ')');
+
+        final Throwable valueOfException;
+        try {
+            valueOf.invoke(null, args);
+            throw new Exception("valueOf" + argString + " did not fail but should");
+        } catch (InvocationTargetException e) {
+            valueOfException = e.getCause();
+        }
+        if (!(valueOfException instanceof IllegalArgumentException)) {
+            throw new Exception(
+                    "valueOf" + argString + " threw " +
+                    valueOfException.getClass().getName() + " instead of " +
+                    "IllegalArgumentException", valueOfException);
+        }
+
+        final Throwable valueOfCause = valueOfException.getCause();
+        if (!(valueOfCause instanceof MalformedObjectNameException)) {
+            throw new Exception(
+                    "valueOf" + argString + " threw exception with wrong " +
+                    "type of cause", valueOfCause);
+        }
+
+        if (!valueOfException.getMessage().equals(valueOfCause.getMessage())) {
+            // The IllegalArgumentException should have the same message as
+            // the MalformedObjectNameException it wraps.
+            // This isn't specified but is desirable.
+            throw new Exception(
+                    "valueOf" + argString + ": message in wrapping " +
+                    "IllegalArgumentException (" + valueOfException.getMessage() +
+                    ") differs from message in wrapped " +
+                    "MalformedObjectNameException (" + valueOfCause.getMessage() +
+                    ")");
+        }
+
+        final Throwable getInstanceException;
+        try {
+            getInstance.invoke(null, args);
+            throw new Exception("getInstance" + argString + " did not fail but should");
+        } catch (InvocationTargetException e) {
+            getInstanceException = e.getCause();
+        }
+        if (!(getInstanceException instanceof MalformedObjectNameException)) {
+            throw new Exception(
+                    "getInstance" + argString + " threw wrong exception",
+                    getInstanceException);
+        }
+
+        if (!valueOfException.getMessage().equals(getInstanceException.getMessage())) {
+            // Again this is not specified.
+            throw new Exception(
+                    "Exception message from valueOf" + argString + " (" +
+                    valueOfException.getMessage() + ") differs from message " +
+                    "from getInstance" + argString + " (" +
+                    getInstanceException.getMessage() + ")");
+        }
+
+        System.out.println("OK (correct exception): valueOf" + argString);
+    }
+
+    private static Method valueOfMethod(Object[] args) throws Exception {
+        return method("valueOf", args);
+    }
+
+    private static Method getInstanceMethod(Object[] args) throws Exception {
+        return method("getInstance", args);
+    }
+
+    private static Method method(String name, Object[] args) throws Exception {
+        Class<?>[] argTypes = argTypes(args);
+        return ObjectName.class.getMethod(name, argTypes);
+    }
+
+    private static Constructor<?> constructor(Object[] args) throws Exception {
+        Class<?>[] argTypes = argTypes(args);
+        return ObjectName.class.getConstructor(argTypes);
+    }
+
+    private static Class<?>[] argTypes(Object[] args) {
+        Class<?>[] argTypes = new Class<?>[args.length];
+        for (int i = 0; i < args.length; i++)
+            argTypes[i] = args[i].getClass();
+        return argTypes;
+    }
+}
diff --git a/jdk/test/javax/management/eventService/AddRemoveListenerTest.java b/jdk/test/javax/management/eventService/AddRemoveListenerTest.java
index 3b90659..72a8c69 100644
--- a/jdk/test/javax/management/eventService/AddRemoveListenerTest.java
+++ b/jdk/test/javax/management/eventService/AddRemoveListenerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/eventService/CustomForwarderTest.java b/jdk/test/javax/management/eventService/CustomForwarderTest.java
index 9392680..22238b3 100644
--- a/jdk/test/javax/management/eventService/CustomForwarderTest.java
+++ b/jdk/test/javax/management/eventService/CustomForwarderTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/eventService/EventClientThreadTest.java b/jdk/test/javax/management/eventService/EventClientThreadTest.java
new file mode 100644
index 0000000..910bc9c
--- /dev/null
+++ b/jdk/test/javax/management/eventService/EventClientThreadTest.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6747411
+ * @summary Check that EventClient instances don't leak threads.
+ * @author Eamonn McManus
+ */
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.Set;
+import java.util.TreeSet;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerDelegate;
+import javax.management.MBeanServerNotification;
+import javax.management.Notification;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.management.event.EventClient;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+
+public class EventClientThreadTest {
+    private static final int MAX_TIME_SECONDS = 20;
+
+    private static final BlockingQueue<Notification> queue =
+            new ArrayBlockingQueue(100);
+
+    private static final NotificationListener queueListener =
+            new NotificationListener() {
+        public void handleNotification(Notification notification,
+                                       Object handback) {
+            queue.add(notification);
+        }
+    };
+
+    private static final NotificationFilter dummyFilter =
+            new NotificationFilter() {
+        public boolean isNotificationEnabled(Notification notification) {
+            return true;
+        }
+    };
+
+    public static void main(String[] args) throws Exception {
+        long start = System.currentTimeMillis();
+        long deadline = start + MAX_TIME_SECONDS * 1000;
+
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
+        JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(
+                url, null, mbs);
+        cs.start();
+        JMXServiceURL addr = cs.getAddress();
+        JMXConnector cc = JMXConnectorFactory.connect(addr);
+        MBeanServerConnection mbsc = cc.getMBeanServerConnection();
+
+        ThreadMXBean threads = ManagementFactory.getThreadMXBean();
+
+        System.out.println("Opening and closing some EventClients...");
+        // If we create a connection, then create and destroy EventClients
+        // over it, then close it, there should be no "JMX *" threads left.
+        for (int i = 0; i < 5; i++)
+            test(mbsc);
+
+        cc.close();
+
+        showTime("opening and closing initial EventClients", start);
+
+        Set<String> jmxThreads = threadsMatching("JMX .*");
+        while (!jmxThreads.isEmpty() && System.currentTimeMillis() < deadline) {
+            Set<String> jmxThreadsNow = threadsMatching("JMX .*");
+            Set<String> gone = new TreeSet<String>(jmxThreads);
+            gone.removeAll(jmxThreadsNow);
+            for (String s : gone)
+                showTime("expiry of \"" + s + "\"", start);
+            jmxThreads = jmxThreadsNow;
+            Thread.sleep(10);
+        }
+        if (System.currentTimeMillis() >= deadline) {
+            showThreads(threads);
+            throw new Exception("Timed out waiting for JMX threads to expire");
+        }
+
+        showTime("waiting for JMX threads to expire", start);
+
+        System.out.println("TEST PASSED");
+    }
+
+    static void showThreads(ThreadMXBean threads) throws Exception {
+        long[] ids = threads.getAllThreadIds();
+        for (long id : ids) {
+            ThreadInfo ti = threads.getThreadInfo(id);
+            String name = (ti == null) ? "(defunct)" : ti.getThreadName();
+            System.out.printf("%4d %s\n", id, name);
+        }
+    }
+
+    static void showTime(String what, long start) {
+        long elapsed = System.currentTimeMillis() - start;
+        System.out.printf("Time after %s: %.3f s\n", what, elapsed / 1000.0);
+    }
+
+    static Set<String> threadsMatching(String pattern) {
+        Set<String> matching = new TreeSet<String>();
+        ThreadMXBean threads = ManagementFactory.getThreadMXBean();
+        long[] ids = threads.getAllThreadIds();
+        for (long id : ids) {
+            ThreadInfo ti = threads.getThreadInfo(id);
+            String name = (ti == null) ? "(defunct)" : ti.getThreadName();
+            if (name.matches(pattern))
+                matching.add(name);
+        }
+        return matching;
+    }
+
+    static void test(MBeanServerConnection mbsc) throws Exception {
+        final ObjectName delegateName = MBeanServerDelegate.DELEGATE_NAME;
+        final ObjectName testName = new ObjectName("test:type=Test");
+        EventClient ec = new EventClient(mbsc);
+        ec.addNotificationListener(delegateName, queueListener, null, null);
+        mbsc.createMBean(MBeanServerDelegate.class.getName(), testName);
+        mbsc.unregisterMBean(testName);
+        final String[] expectedTypes = {
+            MBeanServerNotification.REGISTRATION_NOTIFICATION,
+            MBeanServerNotification.UNREGISTRATION_NOTIFICATION,
+        };
+        for (String s : expectedTypes) {
+            Notification n = queue.poll(3, TimeUnit.SECONDS);
+            if (n == null)
+                throw new Exception("Timed out waiting for notif: " + s);
+            if (!(n instanceof MBeanServerNotification))
+                throw new Exception("Got notif of wrong class: " + n.getClass());
+            if (!n.getType().equals(s)) {
+                throw new Exception("Got notif of wrong type: " + n.getType() +
+                        " (expecting " + s + ")");
+            }
+        }
+        ec.removeNotificationListener(delegateName, queueListener);
+
+        ec.addNotificationListener(delegateName, queueListener, dummyFilter, "foo");
+        ec.removeNotificationListener(delegateName, queueListener, dummyFilter, "foo");
+
+        ec.close();
+    }
+}
\ No newline at end of file
diff --git a/jdk/test/javax/management/eventService/EventManagerTest.java b/jdk/test/javax/management/eventService/EventManagerTest.java
index 473171b..2717c0e 100644
--- a/jdk/test/javax/management/eventService/EventManagerTest.java
+++ b/jdk/test/javax/management/eventService/EventManagerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/eventService/FetchingTest.java b/jdk/test/javax/management/eventService/FetchingTest.java
index 9920ea6..f6fc916 100644
--- a/jdk/test/javax/management/eventService/FetchingTest.java
+++ b/jdk/test/javax/management/eventService/FetchingTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/eventService/LeaseManagerDeadlockTest.java b/jdk/test/javax/management/eventService/LeaseManagerDeadlockTest.java
index 453aafe..ab7d14d 100644
--- a/jdk/test/javax/management/eventService/LeaseManagerDeadlockTest.java
+++ b/jdk/test/javax/management/eventService/LeaseManagerDeadlockTest.java
@@ -27,6 +27,7 @@
  * @summary Check that a lock is not held when a LeaseManager expires.
  * @author Eamonn McManus
  * @compile -XDignore.symbol.file=true LeaseManagerDeadlockTest.java
+ * @run main LeaseManagerDeadlockTest
  */
 
 import com.sun.jmx.event.LeaseManager;
diff --git a/jdk/test/javax/management/eventService/LeaseTest.java b/jdk/test/javax/management/eventService/LeaseTest.java
index 4b543e0..fb056ad 100644
--- a/jdk/test/javax/management/eventService/LeaseTest.java
+++ b/jdk/test/javax/management/eventService/LeaseTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/eventService/ListenerTest.java b/jdk/test/javax/management/eventService/ListenerTest.java
index 5825f83..7195736 100644
--- a/jdk/test/javax/management/eventService/ListenerTest.java
+++ b/jdk/test/javax/management/eventService/ListenerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/eventService/NotSerializableNotifTest.java b/jdk/test/javax/management/eventService/NotSerializableNotifTest.java
index aaadc4b..0bf0bc5 100644
--- a/jdk/test/javax/management/eventService/NotSerializableNotifTest.java
+++ b/jdk/test/javax/management/eventService/NotSerializableNotifTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/eventService/PublishTest.java b/jdk/test/javax/management/eventService/PublishTest.java
index f53056b..c1e27b2 100644
--- a/jdk/test/javax/management/eventService/PublishTest.java
+++ b/jdk/test/javax/management/eventService/PublishTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/eventService/ReconnectableConnectorTest.java b/jdk/test/javax/management/eventService/ReconnectableConnectorTest.java
index 8c79544..d4b1564 100644
--- a/jdk/test/javax/management/eventService/ReconnectableConnectorTest.java
+++ b/jdk/test/javax/management/eventService/ReconnectableConnectorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/eventService/SharingThreadTest.java b/jdk/test/javax/management/eventService/SharingThreadTest.java
index a3d7fd3..32c9dd3 100644
--- a/jdk/test/javax/management/eventService/SharingThreadTest.java
+++ b/jdk/test/javax/management/eventService/SharingThreadTest.java
@@ -1,5 +1,5 @@
-/*/*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+/*
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/eventService/SubUnsubTest.java b/jdk/test/javax/management/eventService/SubUnsubTest.java
new file mode 100644
index 0000000..f888988
--- /dev/null
+++ b/jdk/test/javax/management/eventService/SubUnsubTest.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test SubUnsubTest
+ * @bug 6736611
+ * @summary Test not to remove other listeners when calling unsubscribe
+ * @author Shanliang JIANG
+ * @run clean SubUnsubTest
+ * @run build SubUnsubTest
+ * @run main SubUnsubTest
+ */
+
+import java.lang.management.ManagementFactory;
+import javax.management.MBeanServer;
+import javax.management.Notification;
+import javax.management.NotificationFilter;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.management.event.EventSubscriber;
+import javax.management.event.EventClient;
+public class SubUnsubTest {
+    private static class CountListener implements NotificationListener {
+        volatile int count;
+
+        public void handleNotification(Notification n, Object h) {
+            count++;
+        }
+    }
+
+    public static interface SenderMBean {}
+
+    public static class Sender extends NotificationBroadcasterSupport
+            implements SenderMBean {
+        void send() {
+            Notification n = new Notification("type", this, 1L);
+            sendNotification(n);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        System.out.println("Testing EventSubscriber-unsubscribe method.");
+
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        ObjectName name1 = new ObjectName("d:type=Sender,id=1");
+        ObjectName name2 = new ObjectName("d:type=Sender,id=2");
+        ObjectName pattern = new ObjectName("d:type=Sender,*");
+        Sender sender1 = new Sender();
+        Sender sender2 = new Sender();
+        mbs.registerMBean(sender1, name1);
+        mbs.registerMBean(sender2, name2);
+
+        EventSubscriber sub = EventSubscriber.getEventSubscriber(mbs);
+
+        System.out.println("Single subscribe covering both MBeans");
+        CountListener listener = new CountListener();
+
+        System.out.println("Subscribing and adding listeners ...");
+        sub.subscribe(pattern, listener, null, null);
+        sub.subscribe(name2, listener, null, null);
+        mbs.addNotificationListener(name2, listener, null, null);
+
+        sender1.send();
+        sender2.send();
+        if (listener.count != 4) {
+            throw new RuntimeException("Do not receive all notifications: "+
+                    "Expect 4, got "+listener.count);
+        }
+
+        System.out.println("Unsubscribe the listener with the pattern.");
+        sub.unsubscribe(pattern, listener);
+        listener.count = 0;
+        sender1.send();
+        sender2.send();
+        if (listener.count != 2) {
+            throw new RuntimeException("The method unsubscribe removes wrong listeners.");
+        }
+
+        System.out.println("Unsubscribe the listener with the ObjectName.");
+        sub.unsubscribe(name2, listener);
+        listener.count = 0;
+        sender1.send();
+        sender2.send();
+        if (listener.count != 1) {
+            throw new RuntimeException("The method unsubscribe removes wrong listeners.");
+        }
+
+        System.out.println("Subscribe twice to same MBean with same listener " +
+                "but different handback.");
+        sub.subscribe(name1, listener, null, new Object());
+        sub.subscribe(name1, listener, null, new Object());
+        listener.count = 0;
+
+        sub.unsubscribe(name1, listener);
+        sender1.send();
+        if (listener.count > 0) {
+            throw new RuntimeException("EventSubscriber: the method unsubscribe" +
+                    " does not remove a listener which was subscribed 2 times.");
+        }
+
+        System.out.println("Bye bye!");
+        return;
+    }
+}
\ No newline at end of file
diff --git a/jdk/test/javax/management/mxbean/ComparatorExceptionTest.java b/jdk/test/javax/management/mxbean/ComparatorExceptionTest.java
index cd88a16..fb10a6e 100644
--- a/jdk/test/javax/management/mxbean/ComparatorExceptionTest.java
+++ b/jdk/test/javax/management/mxbean/ComparatorExceptionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/mxbean/GenericArrayTypeTest.java b/jdk/test/javax/management/mxbean/GenericArrayTypeTest.java
index 56778d0..b5f6de3 100644
--- a/jdk/test/javax/management/mxbean/GenericArrayTypeTest.java
+++ b/jdk/test/javax/management/mxbean/GenericArrayTypeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/mxbean/LeakTest.java b/jdk/test/javax/management/mxbean/LeakTest.java
index 9125288..f0be040 100644
--- a/jdk/test/javax/management/mxbean/LeakTest.java
+++ b/jdk/test/javax/management/mxbean/LeakTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/mxbean/MBeanOperationInfoTest.java b/jdk/test/javax/management/mxbean/MBeanOperationInfoTest.java
index 6e462d4..72a571c 100644
--- a/jdk/test/javax/management/mxbean/MBeanOperationInfoTest.java
+++ b/jdk/test/javax/management/mxbean/MBeanOperationInfoTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/mxbean/MXBeanTest.java b/jdk/test/javax/management/mxbean/MXBeanTest.java
index 5a15651..9cfdbdb 100644
--- a/jdk/test/javax/management/mxbean/MXBeanTest.java
+++ b/jdk/test/javax/management/mxbean/MXBeanTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/mxbean/SameObjectTwoNamesTest.java b/jdk/test/javax/management/mxbean/SameObjectTwoNamesTest.java
index 53cc9bb..7aeb580 100644
--- a/jdk/test/javax/management/mxbean/SameObjectTwoNamesTest.java
+++ b/jdk/test/javax/management/mxbean/SameObjectTwoNamesTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/mxbean/ThreadMXBeanTest.java b/jdk/test/javax/management/mxbean/ThreadMXBeanTest.java
index 1b3e3c9..ae2280e1 100644
--- a/jdk/test/javax/management/mxbean/ThreadMXBeanTest.java
+++ b/jdk/test/javax/management/mxbean/ThreadMXBeanTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/mxbean/TigerMXBean.java b/jdk/test/javax/management/mxbean/TigerMXBean.java
index 4d728da..539f6ba 100644
--- a/jdk/test/javax/management/mxbean/TigerMXBean.java
+++ b/jdk/test/javax/management/mxbean/TigerMXBean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/namespace/DomainCreationTest.java b/jdk/test/javax/management/namespace/DomainCreationTest.java
index 93a98dc..02a0986 100644
--- a/jdk/test/javax/management/namespace/DomainCreationTest.java
+++ b/jdk/test/javax/management/namespace/DomainCreationTest.java
@@ -23,6 +23,7 @@
 /*
  *
  * @test DomainCreationTest.java
+ * @bug 5072476
  * @summary Test the creation and registration of JMXDomain instances.
  * @author Daniel Fuchs
  * @run clean DomainCreationTest Wombat WombatMBean
diff --git a/jdk/test/javax/management/namespace/EventWithNamespaceControlTest.java b/jdk/test/javax/management/namespace/EventWithNamespaceControlTest.java
index c1e5a9d..1e39011 100644
--- a/jdk/test/javax/management/namespace/EventWithNamespaceControlTest.java
+++ b/jdk/test/javax/management/namespace/EventWithNamespaceControlTest.java
@@ -27,6 +27,7 @@
  * @summary Check -Djmx.remote.use.event.service=true and
  *                -Djmx.remote.delegate.event.service
  * @author Daniel Fuchs
+ * @bug 5072476 5108776
  * @run clean EventWithNamespaceTest EventWithNamespaceControlTest
  *            Wombat WombatMBean JMXRemoteTargetNamespace
  *            NamespaceController NamespaceControllerMBean
diff --git a/jdk/test/javax/management/namespace/EventWithNamespaceTest.java b/jdk/test/javax/management/namespace/EventWithNamespaceTest.java
index 44fca88..748fdbe 100644
--- a/jdk/test/javax/management/namespace/EventWithNamespaceTest.java
+++ b/jdk/test/javax/management/namespace/EventWithNamespaceTest.java
@@ -24,7 +24,7 @@
 /*
  *
  * @test EventWithNamespaceTest.java 1.8
- * @bug 6539857
+ * @bug 6539857 5072476 5108776
  * @summary General Namespace & Notifications test.
  * @author Daniel Fuchs
  * @run clean EventWithNamespaceTest Wombat WombatMBean
diff --git a/jdk/test/javax/management/namespace/ExportNamespaceTest.java b/jdk/test/javax/management/namespace/ExportNamespaceTest.java
index e734527..ec49a4c 100644
--- a/jdk/test/javax/management/namespace/ExportNamespaceTest.java
+++ b/jdk/test/javax/management/namespace/ExportNamespaceTest.java
@@ -26,6 +26,7 @@
  * @summary Test that you can export a single namespace through a
  *          JMXConnectorServer.
  * @author Daniel Fuchs
+ * @bug 5072476
  * @run clean ExportNamespaceTest Wombat WombatMBean
  * @run build ExportNamespaceTest Wombat WombatMBean
  * @run main ExportNamespaceTest
diff --git a/jdk/test/javax/management/namespace/JMXDomainTest.java b/jdk/test/javax/management/namespace/JMXDomainTest.java
index 4a1a14e..258cead1 100644
--- a/jdk/test/javax/management/namespace/JMXDomainTest.java
+++ b/jdk/test/javax/management/namespace/JMXDomainTest.java
@@ -23,6 +23,7 @@
 /*
  *
  * @test JMXDomainTest.java
+ * @bug 5072476
  * @summary Basic test for JMXDomain.
  * @author Daniel Fuchs
  * @run clean JMXDomainTest Wombat WombatMBean
diff --git a/jdk/test/javax/management/namespace/JMXNamespaceSecurityTest.java b/jdk/test/javax/management/namespace/JMXNamespaceSecurityTest.java
index b948012..213ffbf 100644
--- a/jdk/test/javax/management/namespace/JMXNamespaceSecurityTest.java
+++ b/jdk/test/javax/management/namespace/JMXNamespaceSecurityTest.java
@@ -26,6 +26,7 @@
  * @test JMXNamespaceSecurityTest.java
  * @summary General JMXNamespaceSecurityTest test.
  * @author Daniel Fuchs
+ * @bug 5072476 6299231
  * @run clean JMXNamespaceViewTest JMXNamespaceSecurityTest Wombat WombatMBean
  *            LazyDomainTest
  * @run build JMXNamespaceSecurityTest JMXNamespaceViewTest Wombat WombatMBean
diff --git a/jdk/test/javax/management/namespace/JMXNamespaceTest.java b/jdk/test/javax/management/namespace/JMXNamespaceTest.java
index da553f9..a353771 100644
--- a/jdk/test/javax/management/namespace/JMXNamespaceTest.java
+++ b/jdk/test/javax/management/namespace/JMXNamespaceTest.java
@@ -25,6 +25,7 @@
  *
  * @test JMXNamespaceTest.java
  * @summary General JMXNamespace test.
+ * @bug 5072476
  * @author Daniel Fuchs
  * @run clean JMXNamespaceTest
  *            Wombat WombatMBean JMXRemoteTargetNamespace
@@ -34,7 +35,6 @@
  *            NamespaceController.java NamespaceControllerMBean.java
  * @run main/othervm JMXNamespaceTest
  */
-import java.io.IOException;
 import java.lang.management.ManagementFactory;
 import java.lang.management.MemoryMXBean;
 import java.lang.reflect.InvocationTargetException;
@@ -51,10 +51,10 @@
 import javax.management.JMX;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerFactory;
 import javax.management.NotificationEmitter;
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
-import javax.management.RuntimeOperationsException;
 import javax.management.StandardMBean;
 import javax.management.namespace.JMXNamespaces;
 import javax.management.namespace.JMXNamespace;
@@ -154,7 +154,7 @@
             }
     }
 
-    private static class SimpleTestConf {
+    public static class SimpleTestConf {
         public final  Wombat wombat;
         public final  StandardMBean mbean;
         public final  String dirname;
@@ -456,259 +456,56 @@
         }
     }
 
-    /**
-     * Test cycle detection.
-     * mkdir test ; cd test ; ln -s . kanga ; ln -s kanga/kanga/roo/kanga roo
-     * touch kanga/roo/wombat
-     **/
-    public static void probeKangaRooTest(String[] args) {
-        final SimpleTestConf conf;
+    public static void verySimpleTest(String[] args) {
+        System.err.println("verySimpleTest: starting");
         try {
-            conf = new SimpleTestConf(args);
-            try {
-                final JMXServiceURL url =
-                        new JMXServiceURL("rmi","localHost",0);
-                final Map<String,Object> empty = Collections.emptyMap();
-                final JMXConnectorServer server =
-                        JMXConnectorServerFactory.newJMXConnectorServer(url,
-                        empty,conf.server);
-                server.start();
-                final JMXServiceURL address = server.getAddress();
-                final JMXConnector client =
-                        JMXConnectorFactory.connect(address,
-                        empty);
-                final String[] signature = {
-                    JMXServiceURL.class.getName(),
-                    Map.class.getName(),
-                };
-
-                final Object[] params = {
-                    address,
-                    null,
-                };
-                final MBeanServerConnection c =
-                        client.getMBeanServerConnection();
-
-                // ln -s . kanga
-                final ObjectName dirName1 =
-                        new ObjectName("kanga//:type=JMXNamespace");
-                c.createMBean(JMXRemoteTargetNamespace.class.getName(),
-                              dirName1, params,signature);
-                c.invoke(dirName1, "connect", null, null);
-                try {
-                    // ln -s kanga//kanga//roo//kanga roo
-                    final JMXNamespace local = new JMXNamespace(
-                            new MBeanServerConnectionWrapper(null,
-                            JMXNamespaceTest.class.getClassLoader()){
-
-                        @Override
-                        protected MBeanServerConnection getMBeanServerConnection() {
-                            return JMXNamespaces.narrowToNamespace(c,
-                                    "kanga//kanga//roo//kanga"
-                                    );
-                        }
-
-                    });
-                    final ObjectName dirName2 =
-                            new ObjectName("roo//:type=JMXNamespace");
-                    conf.server.registerMBean(local,dirName2);
-                    System.out.println(dirName2 + " created!");
-                    try {
-                        // touch kanga/roo/wombat
-                        final ObjectName wombatName1 =
-                                new ObjectName("kanga//roo//"+conf.wombatName);
-                        final WombatMBean wombat1 =
-                                JMX.newMBeanProxy(c,wombatName1,WombatMBean.class);
-                        final String newCaption="I am still the same old wombat";
-                        Exception x = null;
-                        try {
-                            wombat1.setCaption(newCaption);
-                        } catch (RuntimeOperationsException r) {
-                            x=r.getTargetException();
-                            System.out.println("Got expected exception: " + x);
-                            // r.printStackTrace();
-                        }
-                        if (x == null)
-                            throw new RuntimeException("cycle not detected!");
-                    } finally {
-                        c.unregisterMBean(dirName2);
-                    }
-                } finally {
-                    c.unregisterMBean(dirName1);
-                    client.close();
-                    server.stop();
-                }
-            } finally {
-                conf.close();
-            }
-            System.err.println("probeKangaRooTest PASSED");
+            final MBeanServer srv = MBeanServerFactory.createMBeanServer();
+            srv.registerMBean(new JMXNamespace(
+                    JMXNamespaces.narrowToNamespace(srv, "foo")),
+                    JMXNamespaces.getNamespaceObjectName("foo"));
+            throw new Exception("Excpected IllegalArgumentException not raised.");
+        } catch (IllegalArgumentException x) {
+            System.err.println("verySimpleTest: got expected exception: "+x);
         } catch (Exception x) {
-            System.err.println("probeKangaRooTest FAILED: " +x);
+            System.err.println("verySimpleTest FAILED: " +x);
             x.printStackTrace();
             throw new RuntimeException(x);
         }
+        System.err.println("verySimpleTest: PASSED");
     }
-    /**
-     * Test cycle detection 2.
-     * mkdir test ; cd test ; ln -s . roo ; ln -s roo/roo kanga
-     * touch kanga/roo/wombat ; rm roo ; ln -s kanga roo ;
-     * touch kanga/roo/wombat
-     *
-     **/
-    public static void probeKangaRooCycleTest(String[] args) {
-        final SimpleTestConf conf;
-        try {
-            conf = new SimpleTestConf(args);
-            Exception failed = null;
-            try {
-                final JMXServiceURL url =
-                        new JMXServiceURL("rmi","localHost",0);
-                final Map<String,Object> empty = Collections.emptyMap();
-                final JMXConnectorServer server =
-                        JMXConnectorServerFactory.newJMXConnectorServer(url,
-                        empty,conf.server);
-                server.start();
-                final JMXServiceURL address = server.getAddress();
-                final JMXConnector client =
-                        JMXConnectorFactory.connect(address,
-                        empty);
-                final String[] signature = {
-                    JMXServiceURL.class.getName(),
-                    Map.class.getName(),
-                };
-                final String[] signature2 = {
-                    JMXServiceURL.class.getName(),
-                    Map.class.getName(),
-                    String.class.getName()
-                };
-                final Object[] params = {
-                    address,
-                    Collections.emptyMap(),
-                };
-                final Object[] params2 = {
-                    address,
-                    null,
-                    "kanga",
-                };
-                final MBeanServerConnection c =
-                        client.getMBeanServerConnection();
 
-                // ln -s . roo
-                final ObjectName dirName1 =
-                        new ObjectName("roo//:type=JMXNamespace");
-                c.createMBean(JMXRemoteTargetNamespace.class.getName(),
-                              dirName1, params,signature);
-                c.invoke(dirName1, "connect",null,null);
-                try {
-                    final Map<String,Object> emptyMap =
-                            Collections.emptyMap();
-                    final JMXNamespace local = new JMXNamespace(
-                            new MBeanServerConnectionWrapper(
-                            JMXNamespaces.narrowToNamespace(c,
-                            "roo//roo//"),
-                            JMXNamespaceTest.class.getClassLoader())) {
-                    };
-                    // ln -s roo/roo kanga
-                    final ObjectName dirName2 =
-                            new ObjectName("kanga//:type=JMXNamespace");
-                    conf.server.registerMBean(local,dirName2);
-                    System.out.println(dirName2 + " created!");
-                    try {
-                        // touch kanga/roo/wombat
-                        final ObjectName wombatName1 =
-                                new ObjectName("kanga//roo//"+conf.wombatName);
-                        final WombatMBean wombat1 =
-                                JMX.newMBeanProxy(c,wombatName1,WombatMBean.class);
-                        final String newCaption="I am still the same old wombat";
-                        wombat1.setCaption(newCaption);
-                        // rm roo
-                        c.unregisterMBean(dirName1);
-                        // ln -s kanga roo
-                        System.err.println("**** Creating " + dirName1 +
-                                " ****");
-                        c.createMBean(JMXRemoteTargetNamespace.class.getName(),
-                              dirName1, params2,signature2);
-                        System.err.println("**** Created " + dirName1 +
-                                " ****");
-                        Exception x = null;
-                        try {
-                            // touch kanga/roo/wombat
-                            wombat1.setCaption(newCaption+" I hope");
-                        } catch (RuntimeOperationsException r) {
-                            x=(Exception)r.getCause();
-                            System.out.println("Got expected exception: " + x);
-                            //r.printStackTrace();
-                        }
-                        if (x == null)
-                            throw new RuntimeException("should have failed!");
-                        x = null;
-                        try {
-                            // ls kanga/roo/wombat
-                            System.err.println("**** Connecting " + dirName1 +
-                                    " ****");
-                            JMX.newMBeanProxy(c,dirName1,
-                                    JMXRemoteNamespaceMBean.class).connect();
-                            System.err.println("**** Connected " + dirName1 +
-                                    " ****");
-                        } catch (IOException r) {
-                            x=r;
-                            System.out.println("Got expected exception: " + x);
-                            //r.printStackTrace();
-                        }
-                        System.err.println("**** Expected Exception Not Raised ****");
-                        if (x == null) {
-                            System.out.println(dirName1+" contains: "+
-                                    c.queryNames(new ObjectName(
-                                    dirName1.getDomain()+"*:*"),null));
-                            throw new RuntimeException("cycle not detected!");
-                        }
-                    } catch (Exception t) {
-                        if (failed == null) failed = t;
-                    } finally {
-                            c.unregisterMBean(dirName2);
-                    }
-                } finally {
-                    try {
-                        c.unregisterMBean(dirName1);
-                    } catch (Exception t) {
-                        if (failed == null) failed = t;
-                        System.err.println("Failed to unregister "+dirName1+
-                                ": "+t);
-                    }
-                    try {
-                        client.close();
-                    } catch (Exception t) {
-                        if (failed == null) failed = t;
-                        System.err.println("Failed to close client: "+t);
-                    }
-                    try {
-                        server.stop();
-                    } catch (Exception t) {
-                        if (failed == null) failed = t;
-                        System.err.println("Failed to stop server: "+t);
-                    }
-                }
-            } finally {
-                try {
-                    conf.close();
-                } catch (Exception t) {
-                    if (failed == null) failed = t;
-                    System.err.println("Failed to stop server: "+t);
-                }
-            }
-            if (failed != null) throw failed;
-            System.err.println("probeKangaRooCycleTest PASSED");
+    public static void verySimpleTest2(String[] args) {
+        System.err.println("verySimpleTest2: starting");
+        try {
+            final MBeanServer srv = MBeanServerFactory.createMBeanServer();
+            final JMXConnectorServer cs = JMXConnectorServerFactory.
+                    newJMXConnectorServer(new JMXServiceURL("rmi",null,0),
+                    null, srv);
+            cs.start();
+            final JMXConnector cc = JMXConnectorFactory.connect(cs.getAddress());
+
+            srv.registerMBean(new JMXNamespace(
+                    new MBeanServerConnectionWrapper(
+                            JMXNamespaces.narrowToNamespace(
+                                cc.getMBeanServerConnection(),
+                                "foo"))),
+                    JMXNamespaces.getNamespaceObjectName("foo"));
+            throw new Exception("Excpected IllegalArgumentException not raised.");
+        } catch (IllegalArgumentException x) {
+            System.err.println("verySimpleTest2: got expected exception: "+x);
         } catch (Exception x) {
-            System.err.println("probeKangaRooCycleTest FAILED: " +x);
+            System.err.println("verySimpleTest2 FAILED: " +x);
             x.printStackTrace();
             throw new RuntimeException(x);
         }
+        System.err.println("verySimpleTest2: PASSED");
     }
+
     public static void main(String[] args) {
         simpleTest(args);
         recursiveTest(args);
-        probeKangaRooTest(args);
-        probeKangaRooCycleTest(args);
+        verySimpleTest(args);
+        verySimpleTest2(args);
     }
 
 }
diff --git a/jdk/test/javax/management/namespace/JMXNamespaceViewTest.java b/jdk/test/javax/management/namespace/JMXNamespaceViewTest.java
index ad51af3..e134968 100644
--- a/jdk/test/javax/management/namespace/JMXNamespaceViewTest.java
+++ b/jdk/test/javax/management/namespace/JMXNamespaceViewTest.java
@@ -24,6 +24,7 @@
  *
  * @test JMXNamespaceViewTest.java
  * @summary Test the JMXNamespaceView class.
+ * @bug 5072476
  * @author Daniel Fuchs
  * @run clean JMXNamespaceViewTest Wombat WombatMBean
  * @run build JMXNamespaceViewTest Wombat WombatMBean
diff --git a/jdk/test/javax/management/namespace/JMXNamespacesTest.java b/jdk/test/javax/management/namespace/JMXNamespacesTest.java
index 4249bf1..4dc7c51 100644
--- a/jdk/test/javax/management/namespace/JMXNamespacesTest.java
+++ b/jdk/test/javax/management/namespace/JMXNamespacesTest.java
@@ -24,6 +24,7 @@
  * @test JMXNamespacesTest.java
  * @summary Test the static method that rewrite ObjectNames in JMXNamespacesTest
  * @author Daniel Fuchs
+ * @bug 5072476
  * @run clean JMXNamespacesTest
  * @compile -XDignore.symbol.file=true JMXNamespacesTest.java
  * @run main JMXNamespacesTest
diff --git a/jdk/test/javax/management/namespace/JMXRemoteNamespaceTest.java b/jdk/test/javax/management/namespace/JMXRemoteNamespaceTest.java
index ccc73bf..8e5f795 100644
--- a/jdk/test/javax/management/namespace/JMXRemoteNamespaceTest.java
+++ b/jdk/test/javax/management/namespace/JMXRemoteNamespaceTest.java
@@ -25,6 +25,7 @@
  * @test JMXRemoteNamespaceTest.java
  * @summary Basic tests on a JMXRemoteNamespace.
  * @author Daniel Fuchs
+ * @bug 5072476
  * @run clean JMXRemoteNamespaceTest Wombat WombatMBean
  * @run build JMXRemoteNamespaceTest Wombat WombatMBean
  * @run main JMXRemoteNamespaceTest
diff --git a/jdk/test/javax/management/namespace/LazyDomainTest.java b/jdk/test/javax/management/namespace/LazyDomainTest.java
index 8343901..eda9b66 100644
--- a/jdk/test/javax/management/namespace/LazyDomainTest.java
+++ b/jdk/test/javax/management/namespace/LazyDomainTest.java
@@ -23,6 +23,7 @@
 /*
  *
  * @test LazyDomainTest.java
+ * @bug 5072476
  * @summary Basic test for Lazy Domains.
  * @author Daniel Fuchs
  * @run clean LazyDomainTest Wombat WombatMBean
diff --git a/jdk/test/javax/management/namespace/LeadingSeparatorsTest.java b/jdk/test/javax/management/namespace/LeadingSeparatorsTest.java
new file mode 100644
index 0000000..5660b27
--- /dev/null
+++ b/jdk/test/javax/management/namespace/LeadingSeparatorsTest.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+/*
+ * @test LeadingSeparatorsTest.java
+ * @summary Test that the semantics of a leading // in ObjectName is respected.
+ * @author Daniel Fuchs
+ * @bug 5072476
+ * @run clean LeadingSeparatorsTest Wombat WombatMBean
+ * @compile -XDignore.symbol.file=true  LeadingSeparatorsTest.java
+ * @run build LeadingSeparatorsTest Wombat WombatMBean
+ * @run main LeadingSeparatorsTest
+ */
+
+import java.lang.management.ManagementFactory;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.logging.Logger;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectName;
+import javax.management.namespace.JMXNamespaces;
+import javax.management.namespace.JMXRemoteNamespace;
+import javax.management.namespace.JMXNamespace;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+
+/**
+ * Class LeadingSeparatorsTest
+ * @author Sun Microsystems, 2005 - All rights reserved.
+ */
+public class LeadingSeparatorsTest {
+
+    /**
+     * A logger for this class.
+     **/
+    private static final Logger LOG =
+            Logger.getLogger(LeadingSeparatorsTest.class.getName());
+
+    /** Creates a new instance of NullObjectNameTest */
+    public LeadingSeparatorsTest() {
+    }
+
+    public static interface MyWombatMBean extends WombatMBean {
+        public Set<ObjectName> untrue(ObjectName pat) throws Exception;
+    }
+    public static class MyWombat
+            extends Wombat implements MyWombatMBean {
+        public MyWombat() throws NotCompliantMBeanException {
+            super(MyWombatMBean.class);
+        }
+
+        public Set<ObjectName> untrue(ObjectName pat) throws Exception {
+            final Set<ObjectName> res=listMatching(pat.withDomain("*"));
+            final Set<ObjectName> untrue = new HashSet<ObjectName>();
+            for (ObjectName a:res) {
+                untrue.add(a.withDomain(pat.getDomain()+"//"+a.getDomain()));
+            }
+            return untrue;
+        }
+    }
+
+    static String failure=null;
+
+    public static void testRegister() throws Exception {
+        final MBeanServer top = ManagementFactory.getPlatformMBeanServer();
+        final MBeanServer sub = MBeanServerFactory.createMBeanServer();
+        final JMXServiceURL url = new JMXServiceURL("rmi",null,0);
+        final JMXConnectorServer srv =
+                JMXConnectorServerFactory.newJMXConnectorServer(url,null,sub);
+        srv.start();
+
+        try {
+
+            // Create a namespace rmi// that points to 'sub' and flows through
+            // a JMXRemoteNamespace connected to 'srv'
+            // The namespace rmi// will accept createMBean, but not registerMBean.
+            //
+            final JMXRemoteNamespace rmiHandler = JMXRemoteNamespace.
+                    newJMXRemoteNamespace(srv.getAddress(),null);
+            top.registerMBean(rmiHandler,
+                    JMXNamespaces.getNamespaceObjectName("rmi"));
+            top.invoke(JMXNamespaces.getNamespaceObjectName("rmi"),
+                    "connect", null, null);
+
+            // Create a namespace direct// that points to 'sub' and flows
+            // through a direct reference to 'sub'.
+            // The namespace direct// will accept createMBean, and registerMBean.
+            //
+            final JMXNamespace directHandler = new JMXNamespace(sub);
+            top.registerMBean(directHandler,
+                    JMXNamespaces.getNamespaceObjectName("direct"));
+
+            final ObjectName n1 = new ObjectName("//direct//w:type=Wombat");
+            final ObjectName n2 = new ObjectName("direct//w:type=Wombat");
+            final ObjectName n3 = new ObjectName("//rmi//w:type=Wombat");
+            final ObjectName n4 = new ObjectName("rmi//w:type=Wombat");
+
+            // register wombat using an object name with a leading //
+            final Object     obj = new MyWombat();
+            // check that returned object name doesn't have the leading //
+            assertEquals(n2,top.registerMBean(obj, n1).getObjectName());
+            System.out.println(n1+" registered");
+
+            // check that the registered Wombat can be accessed with all its
+            // names.
+            System.out.println(n2+" mood is: "+top.getAttribute(n2, "Mood"));
+            System.out.println(n1+" mood is: "+top.getAttribute(n1, "Mood"));
+            System.out.println(n4+" mood is: "+top.getAttribute(n4, "Mood"));
+            System.out.println(n3+" mood is: "+top.getAttribute(n3, "Mood"));
+
+            // call listMatching. The result should not contain any prefix.
+            final Set<ObjectName> res = (Set<ObjectName>)
+                    top.invoke(n3, "listMatching",
+                    // remove rmi// from rmi//*:*
+                    JMXNamespaces.deepReplaceHeadNamespace(
+                    new Object[] {ObjectName.WILDCARD.withDomain("rmi//*")},
+                    "rmi", ""), new String[] {ObjectName.class.getName()});
+
+            // add rmi// prefix to all names in res.
+            final Set<ObjectName> res1 =
+                   JMXNamespaces.deepReplaceHeadNamespace(res, "", "rmi");
+            System.out.println("got: "+res1);
+
+            // compute expected result
+            final Set<ObjectName> res2 = sub.queryNames(null,null);
+            final Set<ObjectName> res3 = new HashSet<ObjectName>();
+            for (ObjectName o:res2) {
+               res3.add(o.withDomain("rmi//"+o.getDomain()));
+            }
+            System.out.println("expected: "+res3);
+            assertEquals(res1, res3);
+
+            // invoke "untrue(//niark//niark:*)"
+            // should return a set were all ObjectNames begin with
+            // //niark//niark//
+            //
+            final Set<ObjectName> res4 = (Set<ObjectName>)
+                    top.invoke(n3, "untrue",
+                    // remove niark//niark : should remove nothing since
+                    // our ObjectName begins with a leading //
+                    JMXNamespaces.deepReplaceHeadNamespace(
+                    new Object[] {
+                       ObjectName.WILDCARD.withDomain("//niark//niark")},
+                    "niark//niark", ""),
+                    new String[] {ObjectName.class.getName()});
+            System.out.println("got: "+res4);
+
+            // add rmi// should add nothing since the returned names have a
+            // leading //
+            //
+            final Set<ObjectName> res5 =
+                   JMXNamespaces.deepReplaceHeadNamespace(res4, "", "rmi");
+            System.out.println("got#2: "+res5);
+
+            // compute expected result
+            final Set<ObjectName> res6 = new HashSet<ObjectName>();
+            for (ObjectName o:res2) {
+               res6.add(o.withDomain("//niark//niark//"+o.getDomain()));
+            }
+            System.out.println("expected: "+res6);
+
+            // both res4 and res5 should be equals to the expected result.
+            assertEquals(res4, res6);
+            assertEquals(res5, res6);
+
+        } finally {
+            srv.stop();
+        }
+
+        if (failure != null)
+            throw new Exception(failure);
+
+
+    }
+    private static void assertEquals(Object x, Object y) {
+        if (!equal(x, y))
+            failed("expected " + string(x) + "; got " + string(y));
+    }
+
+    private static boolean equal(Object x, Object y) {
+        if (x == y)
+            return true;
+        if (x == null || y == null)
+            return false;
+        if (x.getClass().isArray())
+            return Arrays.deepEquals(new Object[] {x}, new Object[] {y});
+        return x.equals(y);
+    }
+
+    private static String string(Object x) {
+        String s = Arrays.deepToString(new Object[] {x});
+        return s.substring(1, s.length() - 1);
+    }
+
+
+    private static void failed(String why) {
+        failure = why;
+        new Throwable("FAILED: " + why).printStackTrace(System.out);
+    }
+
+    public static void main(String[] args) throws Exception {
+        testRegister();
+    }
+}
diff --git a/jdk/test/javax/management/namespace/NamespaceCreationTest.java b/jdk/test/javax/management/namespace/NamespaceCreationTest.java
index 981cdda..871bf02 100644
--- a/jdk/test/javax/management/namespace/NamespaceCreationTest.java
+++ b/jdk/test/javax/management/namespace/NamespaceCreationTest.java
@@ -25,6 +25,7 @@
  * @test NamespaceCreationTest.java
  * @summary General JMXNamespace test.
  * @author Daniel Fuchs
+ * @bug 5072476
  * @run clean NamespaceCreationTest Wombat WombatMBean
  * @run build NamespaceCreationTest Wombat WombatMBean
  * @run main NamespaceCreationTest
diff --git a/jdk/test/javax/management/namespace/NamespaceNotificationsTest.java b/jdk/test/javax/management/namespace/NamespaceNotificationsTest.java
index ae5bb3c..9c5a1a0 100644
--- a/jdk/test/javax/management/namespace/NamespaceNotificationsTest.java
+++ b/jdk/test/javax/management/namespace/NamespaceNotificationsTest.java
@@ -25,6 +25,7 @@
  *
  * @test NamespaceNotificationsTest.java 1.12
  * @summary General Namespace & Notifications test.
+ * @bug 5072476
  * @author Daniel Fuchs
  * @run clean NamespaceNotificationsTest
  *            Wombat WombatMBean JMXRemoteTargetNamespace
diff --git a/jdk/test/javax/management/namespace/NullObjectNameTest.java b/jdk/test/javax/management/namespace/NullObjectNameTest.java
index 7624fb9..156e766 100644
--- a/jdk/test/javax/management/namespace/NullObjectNameTest.java
+++ b/jdk/test/javax/management/namespace/NullObjectNameTest.java
@@ -24,6 +24,7 @@
  * @test NullObjectNameTest.java
  * @summary Test that null ObjectName are correctly handled in namespaces.
  * @author Daniel Fuchs
+ * @bug 5072476
  * @run clean NullObjectNameTest Wombat WombatMBean
  * @compile -XDignore.symbol.file=true  NullObjectNameTest.java
  * @run build NullObjectNameTest Wombat WombatMBean
diff --git a/jdk/test/javax/management/namespace/QueryNamesTest.java b/jdk/test/javax/management/namespace/QueryNamesTest.java
index 6e15c9a..1af597a 100644
--- a/jdk/test/javax/management/namespace/QueryNamesTest.java
+++ b/jdk/test/javax/management/namespace/QueryNamesTest.java
@@ -25,6 +25,7 @@
  * @test QueryNamesTest.java 1.4
  * @summary Test how queryNames works with Namespaces.
  * @author Daniel Fuchs
+ * @bug 5072476
  * @run clean QueryNamesTest Wombat WombatMBean
  * @run build QueryNamesTest Wombat WombatMBean
  * @run main QueryNamesTest
diff --git a/jdk/test/javax/management/namespace/RemoveNotificationListenerTest.java b/jdk/test/javax/management/namespace/RemoveNotificationListenerTest.java
index 08375c0..a8ea2ae 100644
--- a/jdk/test/javax/management/namespace/RemoveNotificationListenerTest.java
+++ b/jdk/test/javax/management/namespace/RemoveNotificationListenerTest.java
@@ -25,6 +25,7 @@
  * @test RemoveNotificationListenerTest.java 1.8
  * @summary General RemoveNotificationListenerTest test.
  * @author Daniel Fuchs
+ * @bug 5072476
  * @run clean RemoveNotificationListenerTest JMXRemoteTargetNamespace
  * @compile -XDignore.symbol.file=true  JMXRemoteTargetNamespace.java
  * @run build RemoveNotificationListenerTest JMXRemoteTargetNamespace
diff --git a/jdk/test/javax/management/namespace/RoutingServerProxyTest.java b/jdk/test/javax/management/namespace/RoutingServerProxyTest.java
index c030269..6980213 100644
--- a/jdk/test/javax/management/namespace/RoutingServerProxyTest.java
+++ b/jdk/test/javax/management/namespace/RoutingServerProxyTest.java
@@ -25,6 +25,7 @@
  * @test RoutingServerProxyTest.java 1.6
  * @summary General RoutingServerProxyTest test.
  * @author Daniel Fuchs
+ * @bug 5072476
  * @run clean RoutingServerProxyTest Wombat WombatMBean
  * @compile -XDignore.symbol.file=true RoutingServerProxyTest.java
  * @run build RoutingServerProxyTest Wombat WombatMBean
diff --git a/jdk/test/javax/management/namespace/SerialParamProcessorTest.java b/jdk/test/javax/management/namespace/SerialParamProcessorTest.java
index 26dd775..20df761 100644
--- a/jdk/test/javax/management/namespace/SerialParamProcessorTest.java
+++ b/jdk/test/javax/management/namespace/SerialParamProcessorTest.java
@@ -26,6 +26,7 @@
  * @test SerialParamProcessorTest.java 1.8
  * @summary General SerialParamProcessorTest test.
  * @author Daniel Fuchs
+ * @bug 5072476
  * @run clean SerialParamProcessorTest Wombat WombatMBean
  * @compile -XDignore.symbol.file=true  SerialParamProcessorTest.java
  * @run build SerialParamProcessorTest Wombat WombatMBean
diff --git a/jdk/test/javax/management/namespace/SourceNamespaceTest.java b/jdk/test/javax/management/namespace/SourceNamespaceTest.java
index 745564b..2335eb2 100644
--- a/jdk/test/javax/management/namespace/SourceNamespaceTest.java
+++ b/jdk/test/javax/management/namespace/SourceNamespaceTest.java
@@ -24,6 +24,7 @@
  *
  * @test SourceNamespaceTest.java
  * @summary Test how queryNames works with Namespaces.
+ * @bug 5072476
  * @author Daniel Fuchs
  * @run clean SourceNamespaceTest Wombat WombatMBean
  * @run build SourceNamespaceTest Wombat WombatMBean
diff --git a/jdk/test/javax/management/namespace/VirtualMBeanNotifTest.java b/jdk/test/javax/management/namespace/VirtualMBeanNotifTest.java
index 301af7a..cc7bbaf 100644
--- a/jdk/test/javax/management/namespace/VirtualMBeanNotifTest.java
+++ b/jdk/test/javax/management/namespace/VirtualMBeanNotifTest.java
@@ -25,6 +25,7 @@
  * @test VirtualMBeanNotifTest.java
  * @bug 5108776
  * @build VirtualMBeanNotifTest Wombat WombatMBean
+ * @run main VirtualMBeanNotifTest
  * @summary Test that Virtual MBeans can be implemented and emit notifs.
  * @author  Daniel Fuchs
  */
diff --git a/jdk/test/javax/management/namespace/VirtualMBeanTest.java b/jdk/test/javax/management/namespace/VirtualMBeanTest.java
index 85860df..03fd398 100644
--- a/jdk/test/javax/management/namespace/VirtualMBeanTest.java
+++ b/jdk/test/javax/management/namespace/VirtualMBeanTest.java
@@ -23,7 +23,7 @@
 
 /*
  * @test VirtualMBeanTest.java
- * @bug 5108776
+ * @bug 5108776 5072476
  * @summary Test that Virtual MBeans can be implemented and emit notifs.
  * @author Eamonn McManus
  */
diff --git a/jdk/test/javax/management/namespace/VirtualNamespaceQueryTest.java b/jdk/test/javax/management/namespace/VirtualNamespaceQueryTest.java
index 020c122..8af244a 100644
--- a/jdk/test/javax/management/namespace/VirtualNamespaceQueryTest.java
+++ b/jdk/test/javax/management/namespace/VirtualNamespaceQueryTest.java
@@ -26,6 +26,7 @@
  * @test VirtualNamespaceQueryTest.java
  * @summary General VirtualNamespaceQueryTest test.
  * @author Daniel Fuchs
+ * @bug 5072476
  * @run clean VirtualNamespaceQueryTest Wombat WombatMBean
  *            NamespaceController NamespaceControllerMBean
  *            JMXRemoteTargetNamespace
diff --git a/jdk/test/javax/management/namespace/VirtualPropsTest.java b/jdk/test/javax/management/namespace/VirtualPropsTest.java
index 8bb57ed..904cc53 100644
--- a/jdk/test/javax/management/namespace/VirtualPropsTest.java
+++ b/jdk/test/javax/management/namespace/VirtualPropsTest.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 5108776
+ * @bug 5108776 5072476
  * @summary Test the properties use case for Virtual MBeans that is documented
  * in MBeanServerSupport.
  * @author Eamonn McManus
diff --git a/jdk/test/javax/management/namespace/Wombat.java b/jdk/test/javax/management/namespace/Wombat.java
index 03dbd02..bef648c 100644
--- a/jdk/test/javax/management/namespace/Wombat.java
+++ b/jdk/test/javax/management/namespace/Wombat.java
@@ -68,7 +68,12 @@
     }
 
     public Wombat() throws NotCompliantMBeanException {
-        super(WombatMBean.class);
+        this(WombatMBean.class);
+    }
+
+    public Wombat(Class<? extends WombatMBean> clazz)
+            throws NotCompliantMBeanException {
+        super(clazz);
         final Random r = new Random();
         seed = ((r.nextLong() % MAX_SEED) + MAX_SEED)%MAX_SEED;
         period = 200 + (((r.nextLong()%80)+80)%80)*10;
diff --git a/jdk/test/javax/management/remote/mandatory/connection/CloseServerTest.java b/jdk/test/javax/management/remote/mandatory/connection/CloseServerTest.java
index 69412b2..c5b1b19 100644
--- a/jdk/test/javax/management/remote/mandatory/connection/CloseServerTest.java
+++ b/jdk/test/javax/management/remote/mandatory/connection/CloseServerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/connection/DeadLockTest.java b/jdk/test/javax/management/remote/mandatory/connection/DeadLockTest.java
index 3106b49..5ea4f8d 100644
--- a/jdk/test/javax/management/remote/mandatory/connection/DeadLockTest.java
+++ b/jdk/test/javax/management/remote/mandatory/connection/DeadLockTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/connection/IdleTimeoutTest.java b/jdk/test/javax/management/remote/mandatory/connection/IdleTimeoutTest.java
index 9cad778..b157bf0 100644
--- a/jdk/test/javax/management/remote/mandatory/connection/IdleTimeoutTest.java
+++ b/jdk/test/javax/management/remote/mandatory/connection/IdleTimeoutTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java b/jdk/test/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java
new file mode 100644
index 0000000..0204afb
--- /dev/null
+++ b/jdk/test/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java
@@ -0,0 +1,256 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.Socket;
+import java.rmi.server.RMIClientSocketFactory;
+import java.util.HashMap;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.rmi.RMIConnectorServer;
+
+/*
+ * @test
+ * @bug 6697180
+ * @summary test on a client notification deadlock.
+ * @author Shanliang JIANG
+ * @run clean MultiThreadDeadLockTest
+ * @run build MultiThreadDeadLockTest
+ * @run main MultiThreadDeadLockTest
+ */
+
+public class MultiThreadDeadLockTest {
+
+    private static long serverTimeout = 500L;
+
+    public static void main(String[] args) throws Exception {
+        print("Create the MBean server");
+        MBeanServer mbs = MBeanServerFactory.createMBeanServer();
+
+        print("Initialize environment map");
+        HashMap env = new HashMap();
+
+        print("Specify a client socket factory to control socket creation.");
+        env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE,
+                clientFactory);
+
+        print("Specify a server idle timeout to make a server close an idle connection.");
+        env.put("jmx.remote.x.server.connection.timeout", serverTimeout);
+
+        print("Disable client heartbeat.");
+        env.put("jmx.remote.x.client.connection.check.period", 0);
+
+        env.put("jmx.remote.x.notification.fetch.timeout", serverTimeout);
+
+        print("Create an RMI server");
+        JMXServiceURL url = new JMXServiceURL("rmi", null, 0);
+        JMXConnectorServer server =
+                JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
+        server.start();
+
+        url = server.getAddress();
+
+        print("Create jmx client on "+url);
+        StateMachine.setState(CREATE_SOCKET); // allow to create client socket
+        client = JMXConnectorFactory.connect(url, env);
+        Thread.sleep(100);
+
+        totoName = new ObjectName("default:name=toto");
+        mbs.registerMBean(toto, totoName);
+        print("Register the mbean: " + totoName);
+
+        print("Add listener to toto MBean");
+        client.getMBeanServerConnection().addNotificationListener(
+                totoName, myListener, null, null);
+        Thread.sleep(10);
+
+        print("send notif, listener will block the fetcher");
+        toto.sendNotif();
+        Thread.sleep(100);
+
+        StateMachine.setState(NO_OP);
+
+        print("Sleep 3 times of server idle timeout: "+serverTimeout+
+                ", the sever should close the idle connection.");
+        Thread.sleep(serverTimeout*3);
+
+        print("start the user thread to call mbean method, it will get IOexception" +
+                " and start the reconnection, the socket factory will block the" +
+                " socket creation.");
+        UserThread ut = new UserThread();
+        ut.start();
+        Thread.sleep(10);
+
+        print("Free the listener, the fetcher will get IO and makes " +
+                "a deadlock if the bug is not fixed.");
+        StateMachine.setState(FREE_LISTENER);
+        Thread.sleep(100);
+
+        print("Allow to create new socket for the reconnection");
+        StateMachine.setState(CREATE_SOCKET);
+
+        print("Check whether the user thread gets free to call the mbean.");
+        if (!ut.waitDone(5000)) {
+            throw new RuntimeException("Possible deadlock!");
+        }
+
+        print("Remove the listener.");
+        client.getMBeanServerConnection().removeNotificationListener(
+                totoName, myListener, null, null);
+        Thread.sleep(serverTimeout*3);
+
+        print("\nWell passed, bye!");
+
+        client.close();
+        Thread.sleep(10);
+        server.stop();
+    }
+
+    private static ObjectName totoName = null;
+    private static JMXConnector client;
+
+    public static class UserThread extends Thread {
+        public UserThread() {
+            setDaemon(true);
+        }
+
+        public void run() {
+            try {
+                client.getMBeanServerConnection().invoke(
+                        totoName, "allowReturn", null, null);
+            } catch (Exception e) {
+                throw new Error(e);
+            }
+
+            synchronized(UserThread.class) {
+                done = true;
+                UserThread.class.notify();
+            }
+        }
+
+        public boolean waitDone(long timeout) {
+            synchronized(UserThread.class) {
+                if(!done) {
+                    try {
+                        UserThread.class.wait(timeout);
+                    } catch (Exception e) {
+                        throw new Error(e);
+                    }
+                }
+            }
+            return done;
+        }
+
+        private boolean done = false;
+    }
+
+    public static interface TotoMBean {
+        public void allowReturn();
+    }
+
+    public static class Toto extends NotificationBroadcasterSupport
+            implements TotoMBean {
+
+        public void allowReturn() {
+            enter("allowReturn");
+
+            leave("allowReturn");
+        }
+
+        public void sendNotif() {
+            enter("sendNotif");
+
+            sendNotification(new Notification("Toto", totoName, 0));
+
+            leave("sendNotif");
+        }
+    }
+    private static Toto toto = new Toto();
+
+    public static NotificationListener myListener = new NotificationListener() {
+        public void handleNotification(Notification notification, Object handback) {
+            enter("handleNotification");
+
+            StateMachine.waitState(FREE_LISTENER);
+
+            leave("handleNotification");
+        }
+    };
+
+    public static class RMIClientFactory
+            implements RMIClientSocketFactory, Serializable {
+
+        public Socket createSocket(String host, int port) throws IOException {
+            enter("createSocket");
+            //print("Calling createSocket(" + host + " " + port + ")");
+
+            StateMachine.waitState(CREATE_SOCKET);
+            Socket s = new Socket(host, port);
+            leave("createSocket");
+
+            return s;
+        }
+    }
+    private static RMIClientFactory clientFactory = new RMIClientFactory();
+
+    private static int CREATE_SOCKET = 1;
+    private static int FREE_LISTENER = 3;
+    private static int NO_OP = 0;
+
+    public static class StateMachine {
+
+        private static int state = NO_OP;
+        private static int[] lock = new int[0];
+
+        public static void waitState(int s) {
+            synchronized (lock) {
+                while (state != s) {
+                    try {
+                        lock.wait();
+                    } catch (InterruptedException ire) {
+                        // should not
+                        throw new Error(ire);
+                    }
+                }
+            }
+        }
+
+        public static int getState() {
+            synchronized (lock) {
+                return state;
+            }
+        }
+
+        public static void setState(int s) {
+            synchronized (lock) {
+                state = s;
+                lock.notifyAll();
+            }
+        }
+    }
+
+    private static void print(String m) {
+        System.out.println(m);
+    }
+
+    private static void enter(String m) {
+        System.out.println("\n---Enter the method " + m);
+    }
+
+    private static void leave(String m) {
+        System.out.println("===Leave the method: " + m);
+    }
+}
+
diff --git a/jdk/test/javax/management/remote/mandatory/connection/RMIExitTest.java b/jdk/test/javax/management/remote/mandatory/connection/RMIExitTest.java
index d0797a9..8b8d6e5 100644
--- a/jdk/test/javax/management/remote/mandatory/connection/RMIExitTest.java
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIExitTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/connection/ReconnectTest.java b/jdk/test/javax/management/remote/mandatory/connection/ReconnectTest.java
index 748cafb..6be0e9e 100644
--- a/jdk/test/javax/management/remote/mandatory/connection/ReconnectTest.java
+++ b/jdk/test/javax/management/remote/mandatory/connection/ReconnectTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java b/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java
index 3b2ce94..98dbdd2 100644
--- a/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java
+++ b/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/AddRemoveTest.java b/jdk/test/javax/management/remote/mandatory/notif/AddRemoveTest.java
index 6aae3b1..667badc 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/AddRemoveTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/AddRemoveTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/DiffHBTest.java b/jdk/test/javax/management/remote/mandatory/notif/DiffHBTest.java
index 8fd8302..887d944 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/DiffHBTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/DiffHBTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java b/jdk/test/javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java
index 334f213..2d098bf 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/ListenerScaleTest.java b/jdk/test/javax/management/remote/mandatory/notif/ListenerScaleTest.java
index 609f4d1..ea50947 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/ListenerScaleTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/ListenerScaleTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java b/jdk/test/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java
index f10ef48..4fad7d0 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java b/jdk/test/javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java
index 2b451be..eb3cd45 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/NotificationAccessControllerTest.java b/jdk/test/javax/management/remote/mandatory/notif/NotificationAccessControllerTest.java
index c7018800..081d0e5 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/NotificationAccessControllerTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotificationAccessControllerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferCreationTest.java b/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferCreationTest.java
index c191ae5..c4988dd 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferCreationTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferCreationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferDeadlockTest.java b/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferDeadlockTest.java
index 172cbd7..ff3c516 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferDeadlockTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferDeadlockTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java b/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java
index 5fa0e51..0d132a4 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/RMINotifTest.java b/jdk/test/javax/management/remote/mandatory/notif/RMINotifTest.java
index 12cf42b..140c6cb 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/RMINotifTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/RMINotifTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/management/remote/mandatory/notif/UnexpectedNotifTest.java b/jdk/test/javax/management/remote/mandatory/notif/UnexpectedNotifTest.java
index 2350624..3166d3f 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/UnexpectedNotifTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/UnexpectedNotifTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/E4XErrorTest.java b/jdk/test/javax/script/E4XErrorTest.java
index 11aa5f0..fb9cc95 100644
--- a/jdk/test/javax/script/E4XErrorTest.java
+++ b/jdk/test/javax/script/E4XErrorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/JavaScriptScopeTest.java b/jdk/test/javax/script/JavaScriptScopeTest.java
index 9793d7a..b6db5a8 100644
--- a/jdk/test/javax/script/JavaScriptScopeTest.java
+++ b/jdk/test/javax/script/JavaScriptScopeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/NullUndefinedVarTest.java b/jdk/test/javax/script/NullUndefinedVarTest.java
index 646009c..d006782 100644
--- a/jdk/test/javax/script/NullUndefinedVarTest.java
+++ b/jdk/test/javax/script/NullUndefinedVarTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/PluggableContextTest.java b/jdk/test/javax/script/PluggableContextTest.java
index eeb2cb0..64f064a 100644
--- a/jdk/test/javax/script/PluggableContextTest.java
+++ b/jdk/test/javax/script/PluggableContextTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/ProviderTest.java b/jdk/test/javax/script/ProviderTest.java
index 9cdcccd..0ca9385 100644
--- a/jdk/test/javax/script/ProviderTest.java
+++ b/jdk/test/javax/script/ProviderTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/RhinoExceptionTest.java b/jdk/test/javax/script/RhinoExceptionTest.java
index cf52f12..d3b58e1 100644
--- a/jdk/test/javax/script/RhinoExceptionTest.java
+++ b/jdk/test/javax/script/RhinoExceptionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/Test1.java b/jdk/test/javax/script/Test1.java
index ba6bceb..809fd08 100644
--- a/jdk/test/javax/script/Test1.java
+++ b/jdk/test/javax/script/Test1.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/Test2.java b/jdk/test/javax/script/Test2.java
index 7e0eef2..d16a07b 100644
--- a/jdk/test/javax/script/Test2.java
+++ b/jdk/test/javax/script/Test2.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/Test3.java b/jdk/test/javax/script/Test3.java
index 4c14f46..8aa876b 100644
--- a/jdk/test/javax/script/Test3.java
+++ b/jdk/test/javax/script/Test3.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/Test4.java b/jdk/test/javax/script/Test4.java
index de67542..e79d2f2 100644
--- a/jdk/test/javax/script/Test4.java
+++ b/jdk/test/javax/script/Test4.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/Test5.java b/jdk/test/javax/script/Test5.java
index 037e822..702c81c 100644
--- a/jdk/test/javax/script/Test5.java
+++ b/jdk/test/javax/script/Test5.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/Test6.java b/jdk/test/javax/script/Test6.java
index a347dd8..cf44c0e 100644
--- a/jdk/test/javax/script/Test6.java
+++ b/jdk/test/javax/script/Test6.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/Test7.java b/jdk/test/javax/script/Test7.java
index 2048834..681661b 100644
--- a/jdk/test/javax/script/Test7.java
+++ b/jdk/test/javax/script/Test7.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/Test8.java b/jdk/test/javax/script/Test8.java
index b55f849..3041bc7 100644
--- a/jdk/test/javax/script/Test8.java
+++ b/jdk/test/javax/script/Test8.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/javax/script/VersionTest.java b/jdk/test/javax/script/VersionTest.java
index 773a984..c7845db 100644
--- a/jdk/test/javax/script/VersionTest.java
+++ b/jdk/test/javax/script/VersionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/sun/tools/jrunscript/common.sh b/jdk/test/sun/tools/jrunscript/common.sh
index 2f63c7e..0472d5c 100644
--- a/jdk/test/sun/tools/jrunscript/common.sh
+++ b/jdk/test/sun/tools/jrunscript/common.sh
@@ -1,5 +1,5 @@
 #
-# Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/sun/tools/jrunscript/jrunscript-DTest.sh b/jdk/test/sun/tools/jrunscript/jrunscript-DTest.sh
index 6919493..8e6c52f1 100644
--- a/jdk/test/sun/tools/jrunscript/jrunscript-DTest.sh
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-DTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/sun/tools/jrunscript/jrunscript-argsTest.sh b/jdk/test/sun/tools/jrunscript/jrunscript-argsTest.sh
index 4c7282c..72567cd 100644
--- a/jdk/test/sun/tools/jrunscript/jrunscript-argsTest.sh
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-argsTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/sun/tools/jrunscript/jrunscript-cpTest.sh b/jdk/test/sun/tools/jrunscript/jrunscript-cpTest.sh
index 5f1dde4..aa5a52c 100644
--- a/jdk/test/sun/tools/jrunscript/jrunscript-cpTest.sh
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-cpTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh b/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh
index 52aee22..677f4f9 100644
--- a/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh b/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh
index 3dfe64b..ad263ff 100644
--- a/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh b/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh
index 64cd14f..cbc9e26 100644
--- a/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh
+++ b/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/.hgtags b/langtools/.hgtags
index fbafc0b..60d45af 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -10,3 +10,4 @@
 0a5f04fb72825302a80a67c636a7ddc410ead266 jdk7-b33
 4026dece07e86ae75154c05b98ba342d00828ed7 jdk7-b34
 81f66dd906eb28e43bcaa66c092e794f59a4e52d jdk7-b35
+258af9b67b7cb4262ab1b5424160c9ad22d52e8f jdk7-b36
diff --git a/langtools/src/share/classes/com/sun/source/util/Trees.java b/langtools/src/share/classes/com/sun/source/util/Trees.java
index ff1c51f..dd4e16e 100644
--- a/langtools/src/share/classes/com/sun/source/util/Trees.java
+++ b/langtools/src/share/classes/com/sun/source/util/Trees.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
@@ -33,6 +33,7 @@
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.ErrorType;
 import javax.lang.model.type.TypeMirror;
 import javax.tools.JavaCompiler.CompilationTask;
 
@@ -177,4 +178,11 @@
      * @return true if {@code member} is accessible in {@code type}
      */
     public abstract boolean isAccessible(Scope scope, Element member, DeclaredType type);
+
+    /**
+      * Gets the original type from the ErrorType object.
+      * @param errorType The errorType for which we want to get the original type.
+      * @returns javax.lang.model.type.TypeMirror corresponding to the original type, replaced by the ErrorType.
+      */
+    public abstract TypeMirror getOriginalType(ErrorType errorType);
 }
diff --git a/langtools/src/share/classes/com/sun/tools/apt/mirror/AptEnv.java b/langtools/src/share/classes/com/sun/tools/apt/mirror/AptEnv.java
index d139bba..f5e5b1a 100644
--- a/langtools/src/share/classes/com/sun/tools/apt/mirror/AptEnv.java
+++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/AptEnv.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
@@ -33,7 +33,7 @@
 import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.Enter;
 import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
 
 
 /**
@@ -42,7 +42,7 @@
 
 public class AptEnv {
 
-    public Name.Table names;            // javac's name table
+    public Names names;                 // javac's name table
     public Symtab symtab;               // javac's predefined symbols
     public Types jctypes;               // javac's type utilities
     public Enter enter;                 // javac's enter phase
@@ -66,7 +66,7 @@
     private AptEnv(Context context) {
         context.put(aptEnvKey, this);
 
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         symtab = Symtab.instance(context);
         jctypes = Types.instance(context);
         enter = Enter.instance(context);
diff --git a/langtools/src/share/classes/com/sun/tools/apt/util/Bark.java b/langtools/src/share/classes/com/sun/tools/apt/util/Bark.java
index 4246072..fe370a0 100644
--- a/langtools/src/share/classes/com/sun/tools/apt/util/Bark.java
+++ b/langtools/src/share/classes/com/sun/tools/apt/util/Bark.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
index 943a7af..f540ad5 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
index ca1f325..90ad065 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
index 98c27bf..4db128b 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
index 7237638..9469213 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
index b219876..0651b25 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
index 67ce9bb..695421e 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
index b14a885..9c0daf8 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
index 0f78a41..4ea71bc 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
index ea10017..5eac4cd 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
index ccece09..83eec5e 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
index fdefbc4..a988b9e 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java
index 2168ec1..5fd2cf4 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
index a27bf73..7f9a5c3 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
index 67a6096..7442b09 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java
index 511b457..5a85eed 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
index 98b5278..70ae996 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
index 3c287a3..908746e 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
index eaf3f11..ca26c7e 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
index d7e2a8c..6e2e448 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java
index f9bb17f..0cf2e74 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java
index cfa53f0..bbee61b 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
index 8cca83d..810ddb5 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
index c375772..27d0cd8 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
index 41531a0..36a3cea 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/CodeTaglet.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/CodeTaglet.java
index e1db9dc..c5e3024 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/CodeTaglet.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/CodeTaglet.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LiteralTaglet.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LiteralTaglet.java
index db7cbe7..2809a80 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LiteralTaglet.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LiteralTaglet.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java
index a53112f..fb9690d 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java
index d040457..84ff491 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java
index 5077c60..c2feb7c 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java
index 31c8d3f..888a202 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
index 8e1ba20..dd57ba8 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java
index b9af617..79f950c 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java
index 271cde9..a1da04f 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java
index 7b0b11c..8124c19 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java
index 6608183..8f26eba 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java
index 4fc3af1..bf35dd0 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java
index 8fad64d..2379803 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java
index ef8c41d..aae0385 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java
index d60da7d..ab5060d 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java
index 6094dbd..67a82e8 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
index 0111db7..1b00c2b 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java
index 480a2ce..7f43884 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java
index dd0b78f..92a8137 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/Server.java b/langtools/src/share/classes/com/sun/tools/javac/Server.java
index 0432799..5999b8a 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/Server.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/Server.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacScope.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacScope.java
index 4023612..1aea840 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacScope.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacScope.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
index bf70197..f256560 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
@@ -27,6 +27,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.CharBuffer;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -45,7 +46,7 @@
 import com.sun.tools.javac.main.*;
 import com.sun.tools.javac.model.*;
 import com.sun.tools.javac.parser.Parser;
-import com.sun.tools.javac.parser.Scanner;
+import com.sun.tools.javac.parser.ParserFactory;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.*;
@@ -93,6 +94,9 @@
         args.getClass();
         context.getClass();
         fileObjects.getClass();
+
+        // force the use of the scanner that captures Javadoc comments
+        com.sun.tools.javac.parser.DocCommentScanner.Factory.preRegister(context);
     }
 
     JavacTaskImpl(JavacTool tool,
@@ -166,8 +170,6 @@
             if (!filenames.isEmpty())
                 throw new IllegalArgumentException("Malformed arguments " + filenames.toString(" "));
             compiler = JavaCompiler.instance(context);
-            // force the use of the scanner that captures Javadoc comments
-            com.sun.tools.javac.parser.DocCommentScanner.Factory.preRegister(context);
             compiler.keepComments = true;
             compiler.genEndPos = true;
             // NOTE: this value will be updated after annotation processing
@@ -519,14 +521,12 @@
             throw new IllegalArgumentException();
         compiler = JavaCompiler.instance(context);
         JavaFileObject prev = compiler.log.useSource(null);
-        Scanner.Factory scannerFactory = Scanner.Factory.instance(context);
-        Parser.Factory parserFactory = Parser.Factory.instance(context);
+        ParserFactory parserFactory = ParserFactory.instance(context);
         Attr attr = Attr.instance(context);
         try {
-            Scanner scanner = scannerFactory.newScanner((expr+"\u0000").toCharArray(),
-                                                        expr.length());
-            Parser parser = parserFactory.newParser(scanner, false, false);
-            JCTree tree = parser.type();
+            CharBuffer buf = CharBuffer.wrap((expr+"\u0000").toCharArray(), 0, expr.length());
+            Parser parser = parserFactory.newParser(buf, false, false, false);
+            JCTree tree = parser.parseType();
             return attr.attribType(tree, (Symbol.TypeSymbol)scope);
         } finally {
             compiler.log.useSource(prev);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
index c8d9fd8..3e92635 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
@@ -322,4 +322,18 @@
             return t2;
         }
     }
+
+    /**
+     * Gets the original type from the ErrorType object.
+     * @param errorType The errorType for which we want to get the original type.
+     * @returns TypeMirror corresponding to the original type, replaced by the ErrorType.
+     *          noType (type.tag == NONE) is returned if there is no original type.
+     */
+    public TypeMirror getOriginalType(javax.lang.model.type.ErrorType errorType) {
+        if (errorType instanceof com.sun.tools.javac.code.Type.ErrorType) {
+            return ((com.sun.tools.javac.code.Type.ErrorType)errorType).getOriginalType();
+        }
+
+        return com.sun.tools.javac.code.Type.noType;
+    }
 }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java b/langtools/src/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java
index 308e557..26efa7e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
index c6cbb91..a41a34b 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
@@ -166,7 +166,7 @@
                     first = false;
 
                     Name name = value.fst.name;
-                    if (len > 1 || name != name.table.value) {
+                    if (len > 1 || name != name.table.names.value) {
                         buf.append(name);
                         buf.append('=');
                     }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java
index 652fae5..4016569 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java b/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
index b3c83df..b860955 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java b/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java
index 6e3fa62..2ebb2cd 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -145,7 +145,7 @@
         assert shared == 0;
         if (table != next.table) return next;
         while (elems != null) {
-            int hash = elems.sym.name.index & hashMask;
+            int hash = elems.sym.name.hashCode() & hashMask;
             Entry e = table[hash];
             assert e == elems : elems.sym;
             table[hash] = elems.shadowed;
@@ -180,7 +180,7 @@
     private void copy(Entry e) {
         if (e.sym != null) {
             copy(e.shadowed);
-            int hash = e.sym.name.index & hashMask;
+            int hash = e.sym.name.hashCode() & hashMask;
             e.shadowed = table[hash];
             table[hash] = e;
         }
@@ -206,7 +206,7 @@
         assert shared == 0;
         // Temporarily disabled (bug 6460352):
         // if (nelems * 3 >= hashMask * 2) dble();
-        int hash = sym.name.index & hashMask;
+        int hash = sym.name.hashCode() & hashMask;
         Entry e = makeEntry(sym, table[hash], elems, s, origin);
         table[hash] = e;
         elems = e;
@@ -227,9 +227,9 @@
         if (e.scope == null) return;
 
         // remove e from table and shadowed list;
-        Entry te = table[sym.name.index & hashMask];
+        Entry te = table[sym.name.hashCode() & hashMask];
         if (te == e)
-            table[sym.name.index & hashMask] = e.shadowed;
+            table[sym.name.hashCode() & hashMask] = e.shadowed;
         else while (true) {
             if (te.shadowed == e) {
                 te.shadowed = e.shadowed;
@@ -279,7 +279,7 @@
      *  for regular entries.
      */
     public Entry lookup(Name name) {
-        Entry e = table[name.index & hashMask];
+        Entry e = table[name.hashCode() & hashMask];
         while (e.scope != null && e.sym.name != name)
             e = e.shadowed;
         return e;
@@ -400,7 +400,7 @@
         }
 
         public Entry lookup(Name name) {
-            Entry e = table[name.index & hashMask];
+            Entry e = table[name.hashCode() & hashMask];
             while (e.scope != null &&
                    (e.sym.name != name ||
                     /* Since an inner class will show up in package and
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
index fdd58b6..9971e50 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
@@ -146,14 +146,14 @@
      * the default package; otherwise, the owner symbol is returned
      */
     public Symbol location() {
-        if (owner.name == null || (owner.name.len == 0 && owner.kind != PCK)) {
+        if (owner.name == null || (owner.name.isEmpty() && owner.kind != PCK)) {
             return null;
         }
         return owner;
     }
 
     public Symbol location(Type site, Types types) {
-        if (owner.name == null || owner.name.len == 0) {
+        if (owner.name == null || owner.name.isEmpty()) {
             return location();
         }
         if (owner.type.tag == CLASS) {
@@ -177,7 +177,7 @@
      */
     public Type externalType(Types types) {
         Type t = erasure(types);
-        if (name == name.table.init && owner.hasOuterInstance()) {
+        if (name == name.table.names.init && owner.hasOuterInstance()) {
             Type outerThisType = types.erasure(owner.type.getEnclosingType());
             return new MethodType(t.getParameterTypes().prepend(outerThisType),
                                   t.getReturnType(),
@@ -212,7 +212,7 @@
     /** Is this symbol a constructor?
      */
     public boolean isConstructor() {
-        return name == name.table.init;
+        return name == name.table.names.init;
     }
 
     /** The fully qualified name of this symbol.
@@ -501,7 +501,7 @@
                  || (owner.kind == TYP && owner.type.tag == TYPEVAR)
                  )) return name;
             Name prefix = owner.getQualifiedName();
-            if (prefix == null || prefix == prefix.table.empty)
+            if (prefix == null || prefix == prefix.table.names.empty)
                 return name;
             else return prefix.append('.', name);
         }
@@ -516,7 +516,7 @@
                 ) return name;
             char sep = owner.kind == TYP ? '$' : '.';
             Name prefix = owner.flatName();
-            if (prefix == null || prefix == prefix.table.empty)
+            if (prefix == null || prefix == prefix.table.names.empty)
                 return name;
             else return prefix.append(sep, name);
         }
@@ -737,7 +737,7 @@
         }
 
         public String className() {
-            if (name.len == 0)
+            if (name.isEmpty())
                 return
                     Log.getLocalizedString("anonymous.class", flatname);
             else
@@ -776,7 +776,7 @@
             } catch (CompletionFailure ex) {
                 // quiet error recovery
                 flags_field |= (PUBLIC|STATIC);
-                this.type = new ErrorType(this);
+                this.type = new ErrorType(this, Type.noType);
                 throw ex;
             }
         }
@@ -1011,7 +1011,7 @@
             if ((flags() & BLOCK) != 0) {
                 return owner.name.toString();
             } else {
-                String s = (name == name.table.init)
+                String s = (name == name.table.names.init)
                     ? owner.name.toString()
                     : name.toString();
                 if (type != null) {
@@ -1208,9 +1208,9 @@
         }
 
         public ElementKind getKind() {
-            if (name == name.table.init)
+            if (name == name.table.names.init)
                 return ElementKind.CONSTRUCTOR;
-            else if (name == name.table.clinit)
+            else if (name == name.table.names.clinit)
                 return ElementKind.STATIC_INIT;
             else
                 return ElementKind.METHOD;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java
index 9b83ec1..f699a2e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -73,7 +73,7 @@
     public final Type botType = new BottomType();
     public final JCNoType voidType = new JCNoType(TypeTags.VOID);
 
-    private final Name.Table names;
+    private final Names names;
     private final ClassReader reader;
     private final Target target;
 
@@ -93,8 +93,7 @@
      */
     public final ClassSymbol errSymbol;
 
-    /** An instance of the error type.
-     */
+    /** A value for the errType, with a originalType of noType */
     public final Type errType;
 
     /** A value for the unknown type. */
@@ -329,7 +328,7 @@
     protected Symtab(Context context) throws CompletionFailure {
         context.put(symtabKey, this);
 
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         target = Target.instance(context);
 
         // Create the unknown type
@@ -348,7 +347,7 @@
 
         // create the error symbols
         errSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.any, null, rootPackage);
-        errType = new ErrorType(errSymbol);
+        errType = new ErrorType(errSymbol, Type.noType);
 
         // initialize builtin types
         initType(byteType, "byte", "Byte");
@@ -389,6 +388,9 @@
         scope.enter(booleanType.tsym);
         scope.enter(errType.tsym);
 
+        // Enter symbol for the errSymbol
+        scope.enter(errSymbol);
+
         classes.put(predefClass.fullname, predefClass);
 
         reader = ClassReader.instance(context);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
index c6e7510..b2a3dae 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
@@ -599,14 +599,14 @@
         }
 //where
             private String className(Symbol sym, boolean longform) {
-                if (sym.name.len == 0 && (sym.flags() & COMPOUND) != 0) {
+                if (sym.name.isEmpty() && (sym.flags() & COMPOUND) != 0) {
                     StringBuffer s = new StringBuffer(supertype_field.toString());
                     for (List<Type> is=interfaces_field; is.nonEmpty(); is = is.tail) {
                         s.append("&");
                         s.append(is.head.toString());
                     }
                     return s.toString();
-                } else if (sym.name.len == 0) {
+                } else if (sym.name.isEmpty()) {
                     String s;
                     ClassType norm = (ClassType) tsym.type;
                     if (norm == null) {
@@ -1194,21 +1194,24 @@
     public static class ErrorType extends ClassType
             implements javax.lang.model.type.ErrorType {
 
-        public ErrorType() {
+        private Type originalType = null;
+
+        public ErrorType(Type originalType, TypeSymbol tsym) {
             super(noType, List.<Type>nil(), null);
             tag = ERROR;
+            this.tsym = tsym;
+            this.originalType = (originalType == null ? noType : originalType);
         }
 
-        public ErrorType(ClassSymbol c) {
-            this();
-            tsym = c;
+        public ErrorType(ClassSymbol c, Type originalType) {
+            this(originalType, c);
             c.type = this;
             c.kind = ERR;
             c.members_field = new Scope.ErrorScope(c);
         }
 
-        public ErrorType(Name name, TypeSymbol container) {
-            this(new ClassSymbol(PUBLIC|STATIC|ACYCLIC, name, null, container));
+        public ErrorType(Name name, TypeSymbol container, Type originalType) {
+            this(new ClassSymbol(PUBLIC|STATIC|ACYCLIC, name, null, container), originalType);
         }
 
         @Override
@@ -1234,6 +1237,10 @@
             return TypeKind.ERROR;
         }
 
+        public Type getOriginalType() {
+            return originalType;
+        }
+
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitError(this, p);
         }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
index 5ad64da..761169e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
@@ -67,7 +67,7 @@
         new Context.Key<Types>();
 
     final Symtab syms;
-    final Name.Table names;
+    final Names names;
     final boolean allowBoxing;
     final ClassReader reader;
     final Source source;
@@ -86,7 +86,7 @@
     protected Types(Context context) {
         context.put(typesKey, this);
         syms = Symtab.instance(context);
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         allowBoxing = Source.instance(context).allowBoxing();
         reader = ClassReader.instance(context);
         source = Source.instance(context);
@@ -2187,6 +2187,20 @@
         };
     // </editor-fold>
 
+    // <editor-fold defaultstate="collapsed" desc="createErrorType">
+    public Type createErrorType(Type originalType) {
+        return new ErrorType(originalType, syms.errSymbol);
+    }
+
+    public Type createErrorType(ClassSymbol c, Type originalType) {
+        return new ErrorType(c, originalType);
+    }
+
+    public Type createErrorType(Name name, TypeSymbol container, Type originalType) {
+        return new ErrorType(name, container, originalType);
+    }
+    // </editor-fold>
+
     // <editor-fold defaultstate="collapsed" desc="rank">
     /**
      * The rank of a class is the length of the longest path between
@@ -2199,7 +2213,7 @@
             ClassType cls = (ClassType)t;
             if (cls.rank_field < 0) {
                 Name fullname = cls.tsym.getQualifiedName();
-                if (fullname == fullname.table.java_lang_Object)
+                if (fullname == names.java_lang_Object)
                     cls.rank_field = 0;
                 else {
                     int r = rank(supertype(cls));
@@ -2604,7 +2618,7 @@
                 if (!bound.isInterface())
                     classCount++;
             if (classCount > 1)
-                return syms.errType;
+                return createErrorType(t);
         }
         return makeCompoundType(bounds);
     }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
index 30751a2..0d882f7 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
@@ -55,7 +55,7 @@
     final TreeMaker make;
     final Log log;
     final Symtab syms;
-    final Name.Table names;
+    final Names names;
     final Resolve rs;
     final Types types;
     final ConstFold cfolder;
@@ -67,7 +67,7 @@
         make = TreeMaker.instance(context);
         log = Log.instance(context);
         syms = Symtab.instance(context);
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         rs = Resolve.instance(context);
         types = Types.instance(context);
         cfolder = ConstFold.instance(context);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
index 5ed1959..91840d4 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -68,7 +68,7 @@
     protected static final Context.Key<Attr> attrKey =
         new Context.Key<Attr>();
 
-    final Name.Table names;
+    final Names names;
     final Log log;
     final Symtab syms;
     final Resolve rs;
@@ -92,7 +92,7 @@
     protected Attr(Context context) {
         context.put(attrKey, this);
 
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         log = Log.instance(context);
         syms = Symtab.instance(context);
         rs = Resolve.instance(context);
@@ -159,7 +159,7 @@
      *  If check succeeds, store type in tree and return it.
      *  If check fails, store errType in tree and return it.
      *  No checks are performed if the prototype is a method type.
-     *  Its not necessary in this case since we know that kind and type
+     *  It is not necessary in this case since we know that kind and type
      *  are correct.
      *
      *  @param tree     The tree whose kind and type is checked
@@ -176,7 +176,7 @@
                 log.error(tree.pos(), "unexpected.type",
                           kindNames(pkind),
                           kindName(ownkind));
-                owntype = syms.errType;
+                owntype = types.createErrorType(owntype);
             }
         }
         tree.type = owntype;
@@ -524,7 +524,7 @@
             // check that type variable is already visible
             if (t.getUpperBound() == null) {
                 log.error(tree.pos(), "illegal.forward.ref");
-                return syms.errType;
+                return types.createErrorType(t);
             }
         } else {
             t = chk.checkClassType(tree.pos(), t, checkExtensible|!allowGenerics);
@@ -533,12 +533,12 @@
             log.error(tree.pos(), "intf.expected.here");
             // return errType is necessary since otherwise there might
             // be undetected cycles which cause attribution to loop
-            return syms.errType;
+            return types.createErrorType(t);
         } else if (checkExtensible &&
                    classExpected &&
                    (t.tsym.flags() & INTERFACE) != 0) {
             log.error(tree.pos(), "no.intf.expected.here");
-            return syms.errType;
+            return types.createErrorType(t);
         }
         if (checkExtensible &&
             ((t.tsym.flags() & FINAL) != 0)) {
@@ -804,7 +804,7 @@
             Type base = types.asSuper(exprType, syms.iterableType.tsym);
             if (base == null) {
                 log.error(tree.expr.pos(), "foreach.not.applicable.to.type");
-                elemtype = syms.errType;
+                elemtype = types.createErrorType(exprType);
             } else {
                 List<Type> iterableParams = base.allparams();
                 elemtype = iterableParams.isEmpty()
@@ -1219,7 +1219,7 @@
                 if (methName == names._super) {
                     if (site == syms.objectType) {
                         log.error(tree.meth.pos(), "no.superclass", site);
-                        site = syms.errType;
+                        site = types.createErrorType(syms.objectType);
                     } else {
                         site = types.supertype(site);
                     }
@@ -1351,7 +1351,7 @@
         }
 
     public void visitNewClass(JCNewClass tree) {
-        Type owntype = syms.errType;
+        Type owntype = types.createErrorType(tree.type);
 
         // The local environment of a class creation is
         // a new environment nested in the current one.
@@ -1551,7 +1551,7 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
-        Type owntype = syms.errType;
+        Type owntype = types.createErrorType(tree.type);
         Type elemtype;
         if (tree.elemtype != null) {
             elemtype = attribType(tree.elemtype, env);
@@ -1571,7 +1571,7 @@
                     log.error(tree.pos(), "illegal.initializer.for.type",
                               pt);
                 }
-                elemtype = syms.errType;
+                elemtype = types.createErrorType(pt);
             }
         }
         if (tree.elems != null) {
@@ -1631,7 +1631,7 @@
         Symbol operator = tree.operator =
             rs.resolveUnaryOperator(tree.pos(), tree.getTag(), env, argtype);
 
-        Type owntype = syms.errType;
+        Type owntype = types.createErrorType(tree.type);
         if (operator.kind == MTH) {
             owntype = (JCTree.PREINC <= tree.getTag() && tree.getTag() <= JCTree.POSTDEC)
                 ? tree.arg.type
@@ -1667,7 +1667,7 @@
         Symbol operator = tree.operator =
             rs.resolveBinaryOperator(tree.pos(), tree.getTag(), env, left, right);
 
-        Type owntype = syms.errType;
+        Type owntype = types.createErrorType(tree.type);
         if (operator.kind == MTH) {
             owntype = operator.type.getReturnType();
             int opc = chk.checkOperator(tree.lhs.pos(),
@@ -1728,7 +1728,7 @@
     }
 
     public void visitIndexed(JCArrayAccess tree) {
-        Type owntype = syms.errType;
+        Type owntype = types.createErrorType(tree.type);
         Type atype = attribExpr(tree.indexed, env);
         attribExpr(tree.index, env, syms.intType);
         if (types.isArray(atype))
@@ -1849,7 +1849,7 @@
                 elt = ((ArrayType)elt).elemtype;
             if (elt.tag == TYPEVAR) {
                 log.error(tree.pos(), "type.var.cant.be.deref");
-                result = syms.errType;
+                result = types.createErrorType(tree.type);
                 return;
             }
         }
@@ -2009,7 +2009,7 @@
                 }
             case ERROR:
                 // preserve identifier names through errors
-                return new ErrorType(name, site.tsym).tsym;
+                return types.createErrorType(name, site.tsym, site).tsym;
             default:
                 // The qualifier expression is of a primitive type -- only
                 // .class is allowed for these.
@@ -2059,7 +2059,7 @@
                      int pkind,
                      Type pt,
                      boolean useVarargs) {
-            if (pt.isErroneous()) return syms.errType;
+            if (pt.isErroneous()) return types.createErrorType(site);
             Type owntype; // The computed type of this identifier occurrence.
             switch (sym.kind) {
             case TYP:
@@ -2129,7 +2129,7 @@
                     for (List<Type> l = env.info.tvars; l.nonEmpty(); l = l.tail)
                         if (!owntype.contains(l.head)) {
                             log.error(tree.pos(), "undetermined.type", owntype1);
-                            owntype1 = syms.errType;
+                            owntype1 = types.createErrorType(owntype1);
                         }
                     owntype = owntype1;
                 }
@@ -2332,7 +2332,7 @@
                           "internal.error.cant.instantiate",
                           sym, site,
                           Type.toString(pt.getParameterTypes()));
-            owntype = syms.errType;
+            owntype = types.createErrorType(site);
         } else {
             // System.out.println("call   : " + env.tree);
             // System.out.println("method : " + owntype);
@@ -2454,7 +2454,7 @@
      *  before supertype structure is completely known
      */
     public void visitTypeApply(JCTypeApply tree) {
-        Type owntype = syms.errType;
+        Type owntype = types.createErrorType(tree.type);
 
         // Attribute functor part of application and make sure it's a class.
         Type clazztype = chk.checkClassType(tree.clazz.pos(), attribType(tree.clazz, env));
@@ -2498,7 +2498,7 @@
                 } else {
                     log.error(tree.pos(), "type.doesnt.take.params", clazztype.tsym);
                 }
-                owntype = syms.errType;
+                owntype = types.createErrorType(tree.type);
             }
         }
         result = check(tree, owntype, TYP, pkind, pt);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/AttrContext.java b/langtools/src/share/classes/com/sun/tools/javac/comp/AttrContext.java
index 84a13ae..ec22b83 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/AttrContext.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/AttrContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
index 7335c32..8a6cb07 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
@@ -56,7 +56,7 @@
     protected static final Context.Key<Check> checkKey =
         new Context.Key<Check>();
 
-    private final Name.Table names;
+    private final Names names;
     private final Log log;
     private final Symtab syms;
     private final Infer infer;
@@ -82,7 +82,7 @@
     protected Check(Context context) {
         context.put(checkKey, this);
 
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         log = Log.instance(context);
         syms = Symtab.instance(context);
         infer = Infer.instance(context);
@@ -192,12 +192,12 @@
     Type typeError(DiagnosticPosition pos, Object problem, Type found, Type req) {
         log.error(pos, "prob.found.req",
                   problem, found, req);
-        return syms.errType;
+        return types.createErrorType(found);
     }
 
     Type typeError(DiagnosticPosition pos, String problem, Type found, Type req, Object explanation) {
         log.error(pos, "prob.found.req.1", problem, found, req, explanation);
-        return syms.errType;
+        return types.createErrorType(found);
     }
 
     /** Report an error that wrong type tag was found.
@@ -208,7 +208,7 @@
      */
     Type typeTagError(DiagnosticPosition pos, Object required, Object found) {
         log.error(pos, "type.found.req", found, required);
-        return syms.errType;
+        return types.createErrorType(found instanceof Type ? (Type)found : syms.errType);
     }
 
     /** Report an error that symbol cannot be referenced before super
@@ -348,11 +348,11 @@
             return typeError(pos, diags.fragment("possible.loss.of.precision"), found, req);
         if (found.isSuperBound()) {
             log.error(pos, "assignment.from.super-bound", found);
-            return syms.errType;
+            return types.createErrorType(found);
         }
         if (req.isExtendsBound()) {
             log.error(pos, "assignment.to.extends-bound", req);
-            return syms.errType;
+            return types.createErrorType(found);
         }
         return typeError(pos, diags.fragment("incompatible.types"), found, req);
     }
@@ -378,7 +378,7 @@
                     log.error(pos,
                               "undetermined.type" + (d!=null ? ".1" : ""),
                               t, d);
-                    return syms.errType;
+                    return types.createErrorType(pt);
                 } else {
                     JCDiagnostic d = ex.getDiagnostic();
                     return typeError(pos,
@@ -469,7 +469,7 @@
     Type checkNonVoid(DiagnosticPosition pos, Type t) {
         if (t.tag == VOID) {
             log.error(pos, "void.not.allowed.here");
-            return syms.errType;
+            return types.createErrorType(t);
         } else {
             return t;
         }
@@ -521,7 +521,7 @@
                                 t);
         } else if (!types.isReifiable(t)) {
             log.error(pos, "illegal.generic.type.for.instof");
-            return syms.errType;
+            return types.createErrorType(t);
         } else {
             return t;
         }
@@ -628,7 +628,7 @@
         case TYP:
             if (sym.isLocal()) {
                 mask = LocalClassFlags;
-                if (sym.name.len == 0) { // Anonymous class
+                if (sym.name.isEmpty()) { // Anonymous class
                     // Anonymous classes in static methods are themselves static;
                     // that's why we admit STATIC here.
                     mask |= STATIC;
@@ -1542,7 +1542,7 @@
             return;
         if (seen.contains(t)) {
             tv = (TypeVar)t;
-            tv.bound = new ErrorType();
+            tv.bound = types.createErrorType(t);
             log.error(pos, "cyclic.inheritance", t);
         } else if (t.tag == TYPEVAR) {
             tv = (TypeVar)t;
@@ -1597,11 +1597,11 @@
     private void noteCyclic(DiagnosticPosition pos, ClassSymbol c) {
         log.error(pos, "cyclic.inheritance", c);
         for (List<Type> l=types.interfaces(c.type); l.nonEmpty(); l=l.tail)
-            l.head = new ErrorType((ClassSymbol)l.head.tsym);
+            l.head = types.createErrorType((ClassSymbol)l.head.tsym, Type.noType);
         Type st = types.supertype(c.type);
         if (st.tag == CLASS)
-            ((ClassType)c.type).supertype_field = new ErrorType((ClassSymbol)st.tsym);
-        c.type = new ErrorType(c);
+            ((ClassType)c.type).supertype_field = types.createErrorType((ClassSymbol)st.tsym, Type.noType);
+        c.type = types.createErrorType(c, c.type);
         c.flags_field |= ACYCLIC;
     }
 
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java
index 2f22fa7..f84ac75 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -98,6 +98,7 @@
     ClassReader reader;
     Annotate annotate;
     MemberEnter memberEnter;
+    Types types;
     Lint lint;
     JavaFileManager fileManager;
 
@@ -119,6 +120,7 @@
         syms = Symtab.instance(context);
         chk = Check.instance(context);
         memberEnter = MemberEnter.instance(context);
+        types = Types.instance(context);
         annotate = Annotate.instance(context);
         lint = Lint.instance(context);
 
@@ -331,7 +333,7 @@
                           "class.public.should.be.in.file", tree.name);
             }
         } else {
-            if (tree.name.len != 0 &&
+            if (!tree.name.isEmpty() &&
                 !chk.checkUniqueClassName(tree.pos(), tree.name, enclScope)) {
                 result = null;
                 return;
@@ -346,7 +348,7 @@
                 // We are seeing a local class.
                 c = reader.defineClass(tree.name, owner);
                 c.flatname = chk.localClassName(c);
-                if (c.name.len != 0)
+                if (!c.name.isEmpty())
                     chk.checkTransparentClass(tree.pos(), c, env.info.scope);
             }
         }
@@ -355,7 +357,7 @@
         // Enter class into `compiled' table and enclosing scope.
         if (chk.compiled.get(c.flatname) != null) {
             duplicateClass(tree.pos(), c);
-            result = new ErrorType(tree.name, (TypeSymbol)owner);
+            result = types.createErrorType(tree.name, (TypeSymbol)owner, Type.noType);
             tree.sym = (ClassSymbol)result.tsym;
             return;
         }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Env.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Env.java
index 816c4f4..3689ca4 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Env.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Env.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
index 36ea3ab..f99f160 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -177,7 +177,7 @@
     protected static final Context.Key<Flow> flowKey =
         new Context.Key<Flow>();
 
-    private final Name.Table names;
+    private final Names names;
     private final Log log;
     private final Symtab syms;
     private final Types types;
@@ -195,7 +195,7 @@
     protected Flow(Context context) {
         context.put(flowKey, this);
 
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         log = Log.instance(context);
         syms = Symtab.instance(context);
         types = Types.instance(context);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
index 48e94dc..cfd47e6 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
@@ -204,7 +204,7 @@
             return true;
         }
 
-    /** Instaniate undetermined type variable to the lub of all its lower bounds.
+    /** Instantiate undetermined type variable to the lub of all its lower bounds.
      *  Throw a NoInstanceException if this not possible.
      */
     void minimizeInst(UndetVar that, Warner warn) throws NoInstanceException {
@@ -216,7 +216,7 @@
             else {
                 that.inst = types.lub(that.lobounds);
             }
-            if (that.inst == null || that.inst == syms.errType)
+            if (that.inst == null || that.inst.tag == ERROR)
                     throw ambiguousNoInstanceException
                         .setMessage("no.unique.minimal.instance.exists",
                                     that.qtype, that.lobounds);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
index f7ec682..423d855 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
@@ -64,7 +64,7 @@
         return instance;
     }
 
-    private Name.Table names;
+    private Names names;
     private Log log;
     private Symtab syms;
     private Resolve rs;
@@ -85,7 +85,7 @@
 
     protected Lower(Context context) {
         context.put(lowerKey, this);
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         log = Log.instance(context);
         syms = Symtab.instance(context);
         rs = Resolve.instance(context);
@@ -1830,7 +1830,7 @@
         }
         VarSymbol var =
             new VarSymbol(FINAL|SYNTHETIC,
-                          Name.fromString(names,
+                          names.fromString(
                                           target.syntheticNameChar()
                                           + "" + rval.hashCode()),
                                       type,
@@ -3338,7 +3338,7 @@
         ListBuffer<JCStatement> blockStatements = new ListBuffer<JCStatement>();
 
         JCModifiers mod1 = make.Modifiers(0L);
-        Name oName = Name.fromString(names, "o");
+        Name oName = names.fromString("o");
         JCVariableDecl par1 = make.Param(oName, cdef.type, compareToSym);
 
         JCIdent paramId1 = make.Ident(names.java_lang_Object);
@@ -3352,7 +3352,7 @@
         JCTypeCast cast = make.TypeCast(castTargetIdent, par1UsageId);
         cast.setType(castTargetIdent.type);
 
-        Name otherName = Name.fromString(names, "other");
+        Name otherName = names.fromString("other");
 
         VarSymbol otherVarSym = new VarSymbol(mod1.flags,
                                               otherName,
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
index 5cc3b79..52f4dc5 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
@@ -61,7 +61,7 @@
      */
     final static boolean checkClash = true;
 
-    private final Name.Table names;
+    private final Names names;
     private final Enter enter;
     private final Log log;
     private final Check chk;
@@ -86,7 +86,7 @@
 
     protected MemberEnter(Context context) {
         context.put(memberEnterKey, this);
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         enter = Enter.instance(context);
         log = Log.instance(context);
         chk = Check.instance(context);
@@ -919,7 +919,7 @@
                 List<Type> thrown = List.nil();
                 long ctorFlags = 0;
                 boolean based = false;
-                if (c.name.len == 0) {
+                if (c.name.isEmpty()) {
                     JCNewClass nc = (JCNewClass)env.next.tree;
                     if (nc.constructor != null) {
                         Type superConstrType = types.memberType(c.type,
@@ -1068,7 +1068,7 @@
             flags = (flags & ~AccessFlags) | PRIVATE | GENERATEDCONSTR;
         } else
             flags |= (c.flags() & AccessFlags) | GENERATEDCONSTR;
-        if (c.name.len == 0) flags |= ANONCONSTR;
+        if (c.name.isEmpty()) flags |= ANONCONSTR;
         JCTree result = make.MethodDef(
             make.Modifiers(flags),
             names.init,
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
index edf1c20..45dc1d6 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
@@ -51,7 +51,7 @@
     protected static final Context.Key<Resolve> resolveKey =
         new Context.Key<Resolve>();
 
-    Name.Table names;
+    Names names;
     Log log;
     Symtab syms;
     Check chk;
@@ -86,7 +86,7 @@
         typeNotFound = new
             ResolveError(ABSENT_TYP, syms.errSymbol, "type not found");
 
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         log = Log.instance(context);
         chk = Check.instance(context);
         infer = Infer.instance(context);
@@ -656,7 +656,7 @@
                     return new AmbiguityError(m1, m2);
                 // both abstract, neither overridden; merge throws clause and result type
                 Symbol result;
-                Type result2 = mt2.getReturnType();;
+                Type result2 = mt2.getReturnType();
                 if (mt2.tag == FORALL)
                     result2 = types.subst(result2, ((ForAll)mt2).tvars, ((ForAll)mt1).tvars);
                 if (types.isSubtype(mt1.getReturnType(), result2)) {
@@ -1099,7 +1099,7 @@
             if (sym == syms.errSymbol // preserve the symbol name through errors
                 || ((sym.kind & ERRONEOUS) == 0 // make sure an error symbol is returned
                     && (sym.kind & TYP) != 0))
-                sym = new ErrorType(name, qualified?site.tsym:syms.noSymbol).tsym;
+                sym = types.createErrorType(name, qualified ? site.tsym : syms.noSymbol, sym.type).tsym;
         }
         return sym;
     }
@@ -1538,7 +1538,7 @@
                 argtypes = List.nil();
             if (typeargtypes == null)
                 typeargtypes = List.nil();
-            if (name != name.table.error) {
+            if (name != names.error) {
                 KindName kindname = absentKind(kind);
                 Name idname = name;
                 if (kind >= WRONG_MTHS && kind <= ABSENT_MTH) {
@@ -1547,7 +1547,7 @@
                                   name, argtypes);
                         return;
                     }
-                    if (name == name.table.init) {
+                    if (name == names.init) {
                         kindname = KindName.CONSTRUCTOR;
                         idname = site.tsym.name;
                     }
@@ -1563,7 +1563,7 @@
                               kindName(ws.owner),
                               ws.owner.type,
                               explanation);
-                } else if (site.tsym.name.len != 0) {
+                } else if (!site.tsym.name.isEmpty()) {
                     if (site.tsym.kind == PCK && !site.tsym.exists())
                         log.error(pos, "doesnt.exist", site.tsym);
                     else {
@@ -1601,9 +1601,9 @@
          */
         boolean isOperator(Name name) {
             int i = 0;
-            while (i < name.len &&
-                   "+-~!*/%&|^<>=".indexOf(name.byteAt(i)) >= 0) i++;
-            return i > 0 && i == name.len;
+            while (i < name.getByteLength() &&
+                   "+-~!*/%&|^<>=".indexOf(name.getByteAt(i)) >= 0) i++;
+            return i > 0 && i == name.getByteLength();
         }
     }
 
@@ -1639,7 +1639,7 @@
         void report(Log log, DiagnosticPosition pos, Type site, Name name,
                     List<Type> argtypes, List<Type> typeargtypes) {
             if (sym.owner.type.tag != ERROR) {
-                if (sym.name == sym.name.table.init && sym.owner != site.tsym)
+                if (sym.name == names.init && sym.owner != site.tsym)
                     new ResolveError(ABSENT_MTH, sym.owner, "absent method " + sym).report(
                         log, pos, site, name, argtypes, typeargtypes);
                 if ((sym.flags() & PUBLIC) != 0
@@ -1723,7 +1723,7 @@
                 else break;
             }
             Name sname = pair.sym1.name;
-            if (sname == sname.table.init) sname = pair.sym1.owner.name;
+            if (sname == names.init) sname = pair.sym1.owner.name;
             log.error(pos, "ref.ambiguous", sname,
                       kindName(pair.sym1),
                       pair.sym1,
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java
index b6725a3..03530d1 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java
@@ -59,7 +59,7 @@
         return instance;
     }
 
-    private Name.Table names;
+    private Names names;
     private Log log;
     private Symtab syms;
     private TreeMaker make;
@@ -77,7 +77,7 @@
 
     protected TransTypes(Context context) {
         context.put(transTypesKey, this);
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         log = Log.instance(context);
         syms = Symtab.instance(context);
         enter = Enter.instance(context);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java
index d4e2a47..247b0e1 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -108,7 +108,7 @@
      *  converting '/' to '.'.
      */
     public static byte[] internalize(Name name) {
-        return internalize(name.table.names, name.index, name.len);
+        return internalize(name.getByteArray(), name.getByteOffset(), name.getByteLength());
     }
 
     /** Return external representation of buf[offset..offset+len-1],
@@ -128,7 +128,7 @@
      *  converting '/' to '.'.
      */
     public static byte[] externalize(Name name) {
-        return externalize(name.table.names, name.index, name.len);
+        return externalize(name.getByteArray(), name.getByteOffset(), name.getByteLength());
     }
 
 /************************************************************************
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
index 919be32..72953f4 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
@@ -122,7 +122,7 @@
     Types types;
 
     /** The name table. */
-    final Name.Table names;
+    final Names names;
 
     /** Force a completion failure on this name
      */
@@ -220,7 +220,7 @@
     protected ClassReader(Context context, boolean definitive) {
         if (definitive) context.put(classReaderKey, this);
 
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         syms = Symtab.instance(context);
         types = Types.instance(context);
         fileManager = context.get(JavaFileManager.class);
@@ -516,14 +516,6 @@
     int siglimit;
     boolean sigEnterPhase = false;
 
-    /** Convert signature to type, where signature is a name.
-     */
-    Type sigToType(Name sig) {
-        return sig == null
-            ? null
-            : sigToType(sig.table.names, sig.index, sig.len);
-    }
-
     /** Convert signature to type, where signature is a byte array segment.
      */
     Type sigToType(byte[] sig, int offset, int len) {
@@ -741,12 +733,6 @@
         return head.tail;
     }
 
-    /** Convert signature to type parameters, where signature is a name.
-     */
-    List<Type> sigToTypeParams(Name name) {
-        return sigToTypeParams(name.table.names, name.index, name.len);
-    }
-
     /** Convert signature to type parameters, where signature is a byte
      *  array segment.
      */
@@ -952,7 +938,7 @@
 
         self.name = simpleBinaryName(self.flatname, c.flatname) ;
         self.owner = m != null ? m : c;
-        if (self.name.len == 0)
+        if (self.name.isEmpty())
             self.fullname = null;
         else
             self.fullname = ClassSymbol.formFullName(self.name, self.owner);
@@ -1500,7 +1486,7 @@
             // Sometimes anonymous classes don't have an outer
             // instance, however, there is no reliable way to tell so
             // we never strip this$n
-            if (currentOwner.name.len != 0)
+            if (!currentOwner.name.isEmpty())
                 type = new MethodType(type.getParameterTypes().tail,
                                       type.getReturnType(),
                                       type.getThrownTypes(),
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
index 20f8752..75e50fd 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -26,7 +26,6 @@
 package com.sun.tools.javac.jvm;
 
 import java.io.*;
-import java.util.*;
 import java.util.Set;
 import java.util.HashSet;
 
@@ -140,7 +139,7 @@
     private final Log log;
 
     /** The name table. */
-    private final Name.Table names;
+    private final Names names;
 
     /** Access to files. */
     private final JavaFileManager fileManager;
@@ -166,7 +165,7 @@
         context.put(classWriterKey, this);
 
         log = Log.instance(context);
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         syms = Symtab.instance(context);
         options = Options.instance(context);
         target = Target.instance(context);
@@ -375,9 +374,7 @@
             sigbuf.appendByte('.');
             assert c.flatname.startsWith(c.owner.enclClass().flatname);
             sigbuf.appendName(rawOuter
-                              ? c.flatname.subName(c.owner.enclClass()
-                                                   .flatname.len+1,
-                                                   c.flatname.len)
+                              ? c.flatname.subName(c.owner.enclClass().flatname.getByteLength()+1,c.flatname.getByteLength())
                               : c.name);
         } else {
             sigbuf.appendBytes(externalize(c.flatname));
@@ -542,7 +539,7 @@
     Name fieldName(Symbol sym) {
         if (scramble && (sym.flags() & PRIVATE) != 0 ||
             scrambleAll && (sym.flags() & (PROTECTED | PUBLIC)) == 0)
-            return names.fromString("_$" + sym.name.index);
+            return names.fromString("_$" + sym.name.getIndex());
         else
             return sym.name;
     }
@@ -917,7 +914,7 @@
             databuf.appendChar(
                 inner.owner.kind == TYP ? pool.get(inner.owner) : 0);
             databuf.appendChar(
-                inner.name.len != 0 ? pool.get(inner.name) : 0);
+                !inner.name.isEmpty() ? pool.get(inner.name) : 0);
             databuf.appendChar(flags);
         }
         endAttr(alenIdx);
@@ -1457,7 +1454,7 @@
         try {
             writeClassFile(out, c);
             if (verbose)
-                log.errWriter.println(log.getLocalizedString("verbose.wrote.file", outFile));
+                log.errWriter.println(Log.getLocalizedString("verbose.wrote.file", outFile));
             out.close();
             out = null;
         } finally {
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
index 8b95160..1816291 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -52,16 +52,16 @@
     public enum StackMapFormat {
         NONE,
         CLDC {
-            Name getAttributeName(Name.Table names) {
+            Name getAttributeName(Names names) {
                 return names.StackMap;
             }
         },
         JSR202 {
-            Name getAttributeName(Name.Table names) {
+            Name getAttributeName(Names names) {
                 return names.StackMapTable;
             }
         };
-        Name getAttributeName(Name.Table names) {
+        Name getAttributeName(Names names) {
             return names.empty;
         }
     }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
index 6197c10..94f46d4 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -61,7 +61,7 @@
     private final Check chk;
     private final Resolve rs;
     private final TreeMaker make;
-    private final Name.Table names;
+    private final Names names;
     private final Target target;
     private final Type stringBufferType;
     private final Map<Type,Symbol> stringBufferAppend;
@@ -92,7 +92,7 @@
     protected Gen(Context context) {
         context.put(genKey, this);
 
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         log = Log.instance(context);
         syms = Symtab.instance(context);
         chk = Check.instance(context);
@@ -365,7 +365,7 @@
     private boolean isOddAccessName(Name name) {
         return
             name.startsWith(accessDollar) &&
-            (name.byteAt(name.len - 1) & 1) == 1;
+            (name.getByteAt(name.getByteLength() - 1) & 1) == 1;
     }
 
 /* ************************************************************************
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java
index a801d0f..8f18c7a 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java
index 374c80d..009cdc9 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
index b116981..ba05d17 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
@@ -236,7 +236,7 @@
 
     /** The name table.
      */
-    protected Name.Table names;
+    protected Names names;
 
     /** The attributor.
      */
@@ -276,7 +276,7 @@
 
     /** Factory for parsers.
      */
-    protected Parser.Factory parserFactory;
+    protected ParserFactory parserFactory;
 
     /** Optional listener for progress events
      */
@@ -310,7 +310,7 @@
         if (context.get(JavaFileManager.class) == null)
             JavacFileManager.preRegister(context);
 
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         log = Log.instance(context);
         diagFactory = JCDiagnostic.Factory.instance(context);
         reader = ClassReader.instance(context);
@@ -320,7 +320,7 @@
         todo = Todo.instance(context);
 
         fileManager = context.get(JavaFileManager.class);
-        parserFactory = Parser.Factory.instance(context);
+        parserFactory = ParserFactory.instance(context);
 
         try {
             // catch completion problems with predefineds
@@ -510,10 +510,6 @@
         return parseErrors;
     }
 
-    protected Scanner.Factory getScannerFactory() {
-        return Scanner.Factory.instance(context);
-    }
-
     /** Try to open input stream with given name.
      *  Report an error if this fails.
      *  @param filename   The file name of the input stream to be opened.
@@ -545,13 +541,9 @@
                 taskListener.started(e);
             }
             int initialErrorCount = log.nerrors;
-            Scanner scanner = getScannerFactory().newScanner(content);
-            Parser parser = parserFactory.newParser(scanner, keepComments(), genEndPos);
-            tree = parser.compilationUnit();
+            Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo);
+            tree = parser.parseCompilationUnit();
             parseErrors |= (log.nerrors > initialErrorCount);
-            if (lineDebugInfo) {
-                tree.lineMap = scanner.getLineMap();
-            }
             if (verbose) {
                 printVerbose("parsing.done", Long.toString(elapsed(msec)));
             }
@@ -1419,7 +1411,7 @@
         close(true);
     }
 
-    private void close(boolean disposeNames) {
+    public void close(boolean disposeNames) {
         rootClasses = null;
         reader = null;
         make = null;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java b/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java
index 60b9e3b..def2d98 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
@@ -181,7 +181,7 @@
         public void visitArray(Attribute.Array a) {
             Name elemName = ((ArrayType) a.type).elemtype.tsym.name;
 
-            if (elemName == elemName.table.java_lang_Class) {   // Class[]
+            if (elemName == elemName.table.names.java_lang_Class) {   // Class[]
                 // Construct a proxy for a MirroredTypesException
                 List<TypeMirror> elems = List.nil();
                 for (Attribute value : a.values) {
diff --git a/langtools/src/share/classes/com/sun/tools/javac/model/FilteredMemberList.java b/langtools/src/share/classes/com/sun/tools/javac/model/FilteredMemberList.java
index 7f95668..62720fe 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/model/FilteredMemberList.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/FilteredMemberList.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java b/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java
index 5ab6801..7d233d5 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
@@ -39,15 +39,14 @@
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Enter;
 import com.sun.tools.javac.comp.Env;
-import com.sun.tools.javac.jvm.ClassReader;
 import com.sun.tools.javac.main.JavaCompiler;
 import com.sun.tools.javac.processing.PrintingProcessor;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.tree.TreeInfo;
 import com.sun.tools.javac.tree.TreeScanner;
-import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.Name;
 
 import static javax.lang.model.util.ElementFilter.methodsIn;
 
@@ -63,10 +62,9 @@
 
     private JavaCompiler javaCompiler;
     private Symtab syms;
-    private Name.Table names;
+    private Names names;
     private Types types;
     private Enter enter;
-    private ClassReader reader;
 
     private static final Context.Key<JavacElements> KEY =
             new Context.Key<JavacElements>();
@@ -96,10 +94,9 @@
     public void setContext(Context context) {
         javaCompiler = JavaCompiler.instance(context);
         syms = Symtab.instance(context);
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         types = Types.instance(context);
         enter = Enter.instance(context);
-        reader = ClassReader.instance(context);
     }
 
 
@@ -126,7 +123,7 @@
                                                          Class<A> annoType) {
         boolean inherited = annoType.isAnnotationPresent(Inherited.class);
         A result = null;
-        while (annotated.name != annotated.name.table.java_lang_Object) {
+        while (annotated.name != annotated.name.table.names.java_lang_Object) {
             result = getAnnotation((Symbol)annotated, annoType);
             if (result != null || !inherited)
                 break;
@@ -568,7 +565,7 @@
     }
 
     public Name getName(CharSequence cs) {
-        return Name.fromString(names, cs.toString());
+        return names.fromString(cs.toString());
     }
 
     /**
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentScanner.java b/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentScanner.java
index 674c0c1..d26cf02 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentScanner.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentScanner.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/EndPosParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/EndPosParser.java
index 2f945a5..f5c082d 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/EndPosParser.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/EndPosParser.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
@@ -41,10 +41,10 @@
  * This code and its internal interfaces are subject to change or
  * deletion without notice.</b></p>
  */
-public class EndPosParser extends Parser {
+public class EndPosParser extends JavacParser {
 
-    public EndPosParser(Factory fac, Lexer S, boolean keepDocComments) {
-        super(fac, S, keepDocComments);
+    public EndPosParser(ParserFactory fac, Lexer S, boolean keepDocComments, boolean keepLineMap) {
+        super(fac, S, keepDocComments, keepLineMap);
         this.S = S;
         endPositions = new HashMap<JCTree,Integer>();
     }
@@ -79,8 +79,8 @@
     }
 
     @Override
-    public JCCompilationUnit compilationUnit() {
-        JCCompilationUnit t = super.compilationUnit();
+    public JCCompilationUnit parseCompilationUnit() {
+        JCCompilationUnit t = super.parseCompilationUnit();
         t.endPositions = endPositions;
         return t;
     }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
new file mode 100644
index 0000000..e18633f
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
@@ -0,0 +1,2819 @@
+/*
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javac.parser;
+
+import java.util.*;
+
+import com.sun.tools.javac.tree.*;
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.List;
+import static com.sun.tools.javac.util.ListBuffer.lb;
+
+import com.sun.tools.javac.tree.JCTree.*;
+
+import static com.sun.tools.javac.parser.Token.*;
+
+/** The parser maps a token sequence into an abstract syntax
+ *  tree. It operates by recursive descent, with code derived
+ *  systematically from an LL(1) grammar. For efficiency reasons, an
+ *  operator precedence scheme is used for parsing binary operation
+ *  expressions.
+ *
+ *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class JavacParser implements Parser {
+
+    /** The number of precedence levels of infix operators.
+     */
+    private static final int infixPrecedenceLevels = 10;
+
+    /** The scanner used for lexical analysis.
+     */
+    private Lexer S;
+
+    /** The factory to be used for abstract syntax tree construction.
+     */
+    protected TreeMaker F;
+
+    /** The log to be used for error diagnostics.
+     */
+    private Log log;
+
+    /** The keyword table. */
+    private Keywords keywords;
+
+    /** The Source language setting. */
+    private Source source;
+
+    /** The name table. */
+    private Names names;
+
+    /** Construct a parser from a given scanner, tree factory and log.
+     */
+    protected JavacParser(ParserFactory fac,
+                     Lexer S,
+                     boolean keepDocComments,
+                     boolean keepLineMap) {
+        this.S = S;
+        S.nextToken(); // prime the pump
+        this.F = fac.F;
+        this.log = fac.log;
+        this.names = fac.names;
+        this.keywords = fac.keywords;
+        this.source = fac.source;
+        this.allowGenerics = source.allowGenerics();
+        this.allowVarargs = source.allowVarargs();
+        this.allowAsserts = source.allowAsserts();
+        this.allowEnums = source.allowEnums();
+        this.allowForeach = source.allowForeach();
+        this.allowStaticImport = source.allowStaticImport();
+        this.allowAnnotations = source.allowAnnotations();
+        this.keepDocComments = keepDocComments;
+        if (keepDocComments)
+            docComments = new HashMap<JCTree,String>();
+        this.keepLineMap = keepLineMap;
+        this.errorTree = F.Erroneous();
+    }
+
+    /** Switch: Should generics be recognized?
+     */
+    boolean allowGenerics;
+
+    /** Switch: Should varargs be recognized?
+     */
+    boolean allowVarargs;
+
+    /** Switch: should we recognize assert statements, or just give a warning?
+     */
+    boolean allowAsserts;
+
+    /** Switch: should we recognize enums, or just give a warning?
+     */
+    boolean allowEnums;
+
+    /** Switch: should we recognize foreach?
+     */
+    boolean allowForeach;
+
+    /** Switch: should we recognize foreach?
+     */
+    boolean allowStaticImport;
+
+    /** Switch: should we recognize annotations?
+     */
+    boolean allowAnnotations;
+
+    /** Switch: should we keep docComments?
+     */
+    boolean keepDocComments;
+
+    /** Switch: should we keep line table?
+     */
+    boolean keepLineMap;
+
+    /** When terms are parsed, the mode determines which is expected:
+     *     mode = EXPR        : an expression
+     *     mode = TYPE        : a type
+     *     mode = NOPARAMS    : no parameters allowed for type
+     *     mode = TYPEARG     : type argument
+     */
+    static final int EXPR = 1;
+    static final int TYPE = 2;
+    static final int NOPARAMS = 4;
+    static final int TYPEARG = 8;
+
+    /** The current mode.
+     */
+    private int mode = 0;
+
+    /** The mode of the term that was parsed last.
+     */
+    private int lastmode = 0;
+
+/* ---------- error recovery -------------- */
+
+    private JCErroneous errorTree;
+
+    /** Skip forward until a suitable stop token is found.
+     */
+    private void skip(boolean stopAtImport, boolean stopAtMemberDecl, boolean stopAtIdentifier, boolean stopAtStatement) {
+         while (true) {
+             switch (S.token()) {
+                case SEMI:
+                    S.nextToken();
+                    return;
+                case PUBLIC:
+                case FINAL:
+                case ABSTRACT:
+                case MONKEYS_AT:
+                case EOF:
+                case CLASS:
+                case INTERFACE:
+                case ENUM:
+                    return;
+                case IMPORT:
+                    if (stopAtImport)
+                        return;
+                    break;
+                case LBRACE:
+                case RBRACE:
+                case PRIVATE:
+                case PROTECTED:
+                case STATIC:
+                case TRANSIENT:
+                case NATIVE:
+                case VOLATILE:
+                case SYNCHRONIZED:
+                case STRICTFP:
+                case LT:
+                case BYTE:
+                case SHORT:
+                case CHAR:
+                case INT:
+                case LONG:
+                case FLOAT:
+                case DOUBLE:
+                case BOOLEAN:
+                case VOID:
+                    if (stopAtMemberDecl)
+                        return;
+                    break;
+                case IDENTIFIER:
+                   if (stopAtIdentifier)
+                        return;
+                    break;
+                case CASE:
+                case DEFAULT:
+                case IF:
+                case FOR:
+                case WHILE:
+                case DO:
+                case TRY:
+                case SWITCH:
+                case RETURN:
+                case THROW:
+                case BREAK:
+                case CONTINUE:
+                case ELSE:
+                case FINALLY:
+                case CATCH:
+                    if (stopAtStatement)
+                        return;
+                    break;
+            }
+            S.nextToken();
+        }
+    }
+
+    private JCErroneous syntaxError(int pos, String key, Token... args) {
+        return syntaxError(pos, null, key, args);
+    }
+
+    private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, Token... args) {
+        setErrorEndPos(pos);
+        reportSyntaxError(pos, key, (Object[])args);
+        return toP(F.at(pos).Erroneous(errs));
+    }
+
+    private int errorPos = Position.NOPOS;
+    /**
+     * Report a syntax error at given position using the given
+     * argument unless one was already reported at the same position.
+     */
+    private void reportSyntaxError(int pos, String key, Object... args) {
+        if (pos > S.errPos() || pos == Position.NOPOS) {
+            if (S.token() == EOF)
+                log.error(pos, "premature.eof");
+            else
+                log.error(pos, key, args);
+        }
+        S.errPos(pos);
+        if (S.pos() == errorPos)
+            S.nextToken(); // guarantee progress
+        errorPos = S.pos();
+    }
+
+
+    /** Generate a syntax error at current position unless one was already
+     *  reported at the same position.
+     */
+    private JCErroneous syntaxError(String key) {
+        return syntaxError(S.pos(), key);
+    }
+
+    /** Generate a syntax error at current position unless one was
+     *  already reported at the same position.
+     */
+    private JCErroneous syntaxError(String key, Token arg) {
+        return syntaxError(S.pos(), key, arg);
+    }
+
+    /** If next input token matches given token, skip it, otherwise report
+     *  an error.
+     */
+    public void accept(Token token) {
+        if (S.token() == token) {
+            S.nextToken();
+        } else {
+            setErrorEndPos(S.pos());
+            reportSyntaxError(S.prevEndPos(), "expected", token);
+        }
+    }
+
+    /** Report an illegal start of expression/type error at given position.
+     */
+    JCExpression illegal(int pos) {
+        setErrorEndPos(S.pos());
+        if ((mode & EXPR) != 0)
+            return syntaxError(pos, "illegal.start.of.expr");
+        else
+            return syntaxError(pos, "illegal.start.of.type");
+
+    }
+
+    /** Report an illegal start of expression/type error at current position.
+     */
+    JCExpression illegal() {
+        return illegal(S.pos());
+    }
+
+    /** Diagnose a modifier flag from the set, if any. */
+    void checkNoMods(long mods) {
+        if (mods != 0) {
+            long lowestMod = mods & -mods;
+            log.error(S.pos(), "mod.not.allowed.here",
+                      Flags.asFlagSet(lowestMod));
+        }
+    }
+
+/* ---------- doc comments --------- */
+
+    /** A hashtable to store all documentation comments
+     *  indexed by the tree nodes they refer to.
+     *  defined only if option flag keepDocComment is set.
+     */
+    Map<JCTree, String> docComments;
+
+    /** Make an entry into docComments hashtable,
+     *  provided flag keepDocComments is set and given doc comment is non-null.
+     *  @param tree   The tree to be used as index in the hashtable
+     *  @param dc     The doc comment to associate with the tree, or null.
+     */
+    void attach(JCTree tree, String dc) {
+        if (keepDocComments && dc != null) {
+//          System.out.println("doc comment = ");System.out.println(dc);//DEBUG
+            docComments.put(tree, dc);
+        }
+    }
+
+/* -------- source positions ------- */
+
+    private int errorEndPos = -1;
+
+    private void setErrorEndPos(int errPos) {
+        if (errPos > errorEndPos)
+            errorEndPos = errPos;
+    }
+
+    protected int getErrorEndPos() {
+        return errorEndPos;
+    }
+
+    /**
+     * Store ending position for a tree.
+     * @param tree   The tree.
+     * @param endpos The ending position to associate with the tree.
+     */
+    protected void storeEnd(JCTree tree, int endpos) {}
+
+    /**
+     * Store ending position for a tree.  The ending position should
+     * be the ending position of the current token.
+     * @param t The tree.
+     */
+    protected <T extends JCTree> T to(T t) { return t; }
+
+    /**
+     * Store ending position for a tree.  The ending position should
+     * be greater of the ending position of the previous token and errorEndPos.
+     * @param t The tree.
+     */
+    protected <T extends JCTree> T toP(T t) { return t; }
+
+    /** Get the start position for a tree node.  The start position is
+     * defined to be the position of the first character of the first
+     * token of the node's source text.
+     * @param tree  The tree node
+     */
+    public int getStartPos(JCTree tree) {
+        return TreeInfo.getStartPos(tree);
+    }
+
+    /**
+     * Get the end position for a tree node.  The end position is
+     * defined to be the position of the last character of the last
+     * token of the node's source text.  Returns Position.NOPOS if end
+     * positions are not generated or the position is otherwise not
+     * found.
+     * @param tree  The tree node
+     */
+    public int getEndPos(JCTree tree) {
+        return Position.NOPOS;
+    }
+
+
+
+/* ---------- parsing -------------- */
+
+    /**
+     * Ident = IDENTIFIER
+     */
+    Name ident() {
+        if (S.token() == IDENTIFIER) {
+            Name name = S.name();
+            S.nextToken();
+            return name;
+        } else if (S.token() == ASSERT) {
+            if (allowAsserts) {
+                log.error(S.pos(), "assert.as.identifier");
+                S.nextToken();
+                return names.error;
+            } else {
+                log.warning(S.pos(), "assert.as.identifier");
+                Name name = S.name();
+                S.nextToken();
+                return name;
+            }
+        } else if (S.token() == ENUM) {
+            if (allowEnums) {
+                log.error(S.pos(), "enum.as.identifier");
+                S.nextToken();
+                return names.error;
+            } else {
+                log.warning(S.pos(), "enum.as.identifier");
+                Name name = S.name();
+                S.nextToken();
+                return name;
+            }
+        } else {
+            accept(IDENTIFIER);
+            return names.error;
+        }
+}
+
+    /**
+     * Qualident = Ident { DOT Ident }
+     */
+    public JCExpression qualident() {
+        JCExpression t = toP(F.at(S.pos()).Ident(ident()));
+        while (S.token() == DOT) {
+            int pos = S.pos();
+            S.nextToken();
+            t = toP(F.at(pos).Select(t, ident()));
+        }
+        return t;
+    }
+
+    /**
+     * Literal =
+     *     INTLITERAL
+     *   | LONGLITERAL
+     *   | FLOATLITERAL
+     *   | DOUBLELITERAL
+     *   | CHARLITERAL
+     *   | STRINGLITERAL
+     *   | TRUE
+     *   | FALSE
+     *   | NULL
+     */
+    JCExpression literal(Name prefix) {
+        int pos = S.pos();
+        JCExpression t = errorTree;
+        switch (S.token()) {
+        case INTLITERAL:
+            try {
+                t = F.at(pos).Literal(
+                    TypeTags.INT,
+                    Convert.string2int(strval(prefix), S.radix()));
+            } catch (NumberFormatException ex) {
+                log.error(S.pos(), "int.number.too.large", strval(prefix));
+            }
+            break;
+        case LONGLITERAL:
+            try {
+                t = F.at(pos).Literal(
+                    TypeTags.LONG,
+                    new Long(Convert.string2long(strval(prefix), S.radix())));
+            } catch (NumberFormatException ex) {
+                log.error(S.pos(), "int.number.too.large", strval(prefix));
+            }
+            break;
+        case FLOATLITERAL: {
+            String proper = (S.radix() == 16 ? ("0x"+ S.stringVal()) : S.stringVal());
+            Float n;
+            try {
+                n = Float.valueOf(proper);
+            } catch (NumberFormatException ex) {
+                // error already repoted in scanner
+                n = Float.NaN;
+            }
+            if (n.floatValue() == 0.0f && !isZero(proper))
+                log.error(S.pos(), "fp.number.too.small");
+            else if (n.floatValue() == Float.POSITIVE_INFINITY)
+                log.error(S.pos(), "fp.number.too.large");
+            else
+                t = F.at(pos).Literal(TypeTags.FLOAT, n);
+            break;
+        }
+        case DOUBLELITERAL: {
+            String proper = (S.radix() == 16 ? ("0x"+ S.stringVal()) : S.stringVal());
+            Double n;
+            try {
+                n = Double.valueOf(proper);
+            } catch (NumberFormatException ex) {
+                // error already reported in scanner
+                n = Double.NaN;
+            }
+            if (n.doubleValue() == 0.0d && !isZero(proper))
+                log.error(S.pos(), "fp.number.too.small");
+            else if (n.doubleValue() == Double.POSITIVE_INFINITY)
+                log.error(S.pos(), "fp.number.too.large");
+            else
+                t = F.at(pos).Literal(TypeTags.DOUBLE, n);
+            break;
+        }
+        case CHARLITERAL:
+            t = F.at(pos).Literal(
+                TypeTags.CHAR,
+                S.stringVal().charAt(0) + 0);
+            break;
+        case STRINGLITERAL:
+            t = F.at(pos).Literal(
+                TypeTags.CLASS,
+                S.stringVal());
+            break;
+        case TRUE: case FALSE:
+            t = F.at(pos).Literal(
+                TypeTags.BOOLEAN,
+                (S.token() == TRUE ? 1 : 0));
+            break;
+        case NULL:
+            t = F.at(pos).Literal(
+                TypeTags.BOT,
+                null);
+            break;
+        default:
+            assert false;
+        }
+        if (t == errorTree)
+            t = F.at(pos).Erroneous();
+        storeEnd(t, S.endPos());
+        S.nextToken();
+        return t;
+    }
+//where
+        boolean isZero(String s) {
+            char[] cs = s.toCharArray();
+            int base = ((Character.toLowerCase(s.charAt(1)) == 'x') ? 16 : 10);
+            int i = ((base==16) ? 2 : 0);
+            while (i < cs.length && (cs[i] == '0' || cs[i] == '.')) i++;
+            return !(i < cs.length && (Character.digit(cs[i], base) > 0));
+        }
+
+        String strval(Name prefix) {
+            String s = S.stringVal();
+            return prefix.isEmpty() ? s : prefix + s;
+        }
+
+    /** terms can be either expressions or types.
+     */
+    public JCExpression parseExpression() {
+        return term(EXPR);
+    }
+
+    public JCExpression parseType() {
+        return term(TYPE);
+    }
+
+    JCExpression term(int newmode) {
+        int prevmode = mode;
+        mode = newmode;
+        JCExpression t = term();
+        lastmode = mode;
+        mode = prevmode;
+        return t;
+    }
+
+    /**
+     *  Expression = Expression1 [ExpressionRest]
+     *  ExpressionRest = [AssignmentOperator Expression1]
+     *  AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" |
+     *                       "&=" | "|=" | "^=" |
+     *                       "%=" | "<<=" | ">>=" | ">>>="
+     *  Type = Type1
+     *  TypeNoParams = TypeNoParams1
+     *  StatementExpression = Expression
+     *  ConstantExpression = Expression
+     */
+    JCExpression term() {
+        JCExpression t = term1();
+        if ((mode & EXPR) != 0 &&
+            S.token() == EQ || PLUSEQ.compareTo(S.token()) <= 0 && S.token().compareTo(GTGTGTEQ) <= 0)
+            return termRest(t);
+        else
+            return t;
+    }
+
+    JCExpression termRest(JCExpression t) {
+        switch (S.token()) {
+        case EQ: {
+            int pos = S.pos();
+            S.nextToken();
+            mode = EXPR;
+            JCExpression t1 = term();
+            return toP(F.at(pos).Assign(t, t1));
+        }
+        case PLUSEQ:
+        case SUBEQ:
+        case STAREQ:
+        case SLASHEQ:
+        case PERCENTEQ:
+        case AMPEQ:
+        case BAREQ:
+        case CARETEQ:
+        case LTLTEQ:
+        case GTGTEQ:
+        case GTGTGTEQ:
+            int pos = S.pos();
+            Token token = S.token();
+            S.nextToken();
+            mode = EXPR;
+            JCExpression t1 = term();
+            return F.at(pos).Assignop(optag(token), t, t1);
+        default:
+            return t;
+        }
+    }
+
+    /** Expression1   = Expression2 [Expression1Rest]
+     *  Type1         = Type2
+     *  TypeNoParams1 = TypeNoParams2
+     */
+    JCExpression term1() {
+        JCExpression t = term2();
+        if ((mode & EXPR) != 0 && S.token() == QUES) {
+            mode = EXPR;
+            return term1Rest(t);
+        } else {
+            return t;
+        }
+    }
+
+    /** Expression1Rest = ["?" Expression ":" Expression1]
+     */
+    JCExpression term1Rest(JCExpression t) {
+        if (S.token() == QUES) {
+            int pos = S.pos();
+            S.nextToken();
+            JCExpression t1 = term();
+            accept(COLON);
+            JCExpression t2 = term1();
+            return F.at(pos).Conditional(t, t1, t2);
+        } else {
+            return t;
+        }
+    }
+
+    /** Expression2   = Expression3 [Expression2Rest]
+     *  Type2         = Type3
+     *  TypeNoParams2 = TypeNoParams3
+     */
+    JCExpression term2() {
+        JCExpression t = term3();
+        if ((mode & EXPR) != 0 && prec(S.token()) >= TreeInfo.orPrec) {
+            mode = EXPR;
+            return term2Rest(t, TreeInfo.orPrec);
+        } else {
+            return t;
+        }
+    }
+
+    /*  Expression2Rest = {infixop Expression3}
+     *                  | Expression3 instanceof Type
+     *  infixop         = "||"
+     *                  | "&&"
+     *                  | "|"
+     *                  | "^"
+     *                  | "&"
+     *                  | "==" | "!="
+     *                  | "<" | ">" | "<=" | ">="
+     *                  | "<<" | ">>" | ">>>"
+     *                  | "+" | "-"
+     *                  | "*" | "/" | "%"
+     */
+    JCExpression term2Rest(JCExpression t, int minprec) {
+        List<JCExpression[]> savedOd = odStackSupply.elems;
+        JCExpression[] odStack = newOdStack();
+        List<Token[]> savedOp = opStackSupply.elems;
+        Token[] opStack = newOpStack();
+        // optimization, was odStack = new Tree[...]; opStack = new Tree[...];
+        int top = 0;
+        odStack[0] = t;
+        int startPos = S.pos();
+        Token topOp = ERROR;
+        while (prec(S.token()) >= minprec) {
+            opStack[top] = topOp;
+            top++;
+            topOp = S.token();
+            int pos = S.pos();
+            S.nextToken();
+            odStack[top] = topOp == INSTANCEOF ? parseType() : term3();
+            while (top > 0 && prec(topOp) >= prec(S.token())) {
+                odStack[top-1] = makeOp(pos, topOp, odStack[top-1],
+                                        odStack[top]);
+                top--;
+                topOp = opStack[top];
+            }
+        }
+        assert top == 0;
+        t = odStack[0];
+
+        if (t.getTag() == JCTree.PLUS) {
+            StringBuffer buf = foldStrings(t);
+            if (buf != null) {
+                t = toP(F.at(startPos).Literal(TypeTags.CLASS, buf.toString()));
+            }
+        }
+
+        odStackSupply.elems = savedOd; // optimization
+        opStackSupply.elems = savedOp; // optimization
+        return t;
+    }
+//where
+        /** Construct a binary or type test node.
+         */
+        private JCExpression makeOp(int pos,
+                                    Token topOp,
+                                    JCExpression od1,
+                                    JCExpression od2)
+        {
+            if (topOp == INSTANCEOF) {
+                return F.at(pos).TypeTest(od1, od2);
+            } else {
+                return F.at(pos).Binary(optag(topOp), od1, od2);
+            }
+        }
+        /** If tree is a concatenation of string literals, replace it
+         *  by a single literal representing the concatenated string.
+         */
+        protected StringBuffer foldStrings(JCTree tree) {
+            List<String> buf = List.nil();
+            while (true) {
+                if (tree.getTag() == JCTree.LITERAL) {
+                    JCLiteral lit = (JCLiteral) tree;
+                    if (lit.typetag == TypeTags.CLASS) {
+                        StringBuffer sbuf =
+                            new StringBuffer((String)lit.value);
+                        while (buf.nonEmpty()) {
+                            sbuf.append(buf.head);
+                            buf = buf.tail;
+                        }
+                        return sbuf;
+                    }
+                } else if (tree.getTag() == JCTree.PLUS) {
+                    JCBinary op = (JCBinary)tree;
+                    if (op.rhs.getTag() == JCTree.LITERAL) {
+                        JCLiteral lit = (JCLiteral) op.rhs;
+                        if (lit.typetag == TypeTags.CLASS) {
+                            buf = buf.prepend((String) lit.value);
+                            tree = op.lhs;
+                            continue;
+                        }
+                    }
+                }
+                return null;
+            }
+        }
+
+        /** optimization: To save allocating a new operand/operator stack
+         *  for every binary operation, we use supplys.
+         */
+        ListBuffer<JCExpression[]> odStackSupply = new ListBuffer<JCExpression[]>();
+        ListBuffer<Token[]> opStackSupply = new ListBuffer<Token[]>();
+
+        private JCExpression[] newOdStack() {
+            if (odStackSupply.elems == odStackSupply.last)
+                odStackSupply.append(new JCExpression[infixPrecedenceLevels + 1]);
+            JCExpression[] odStack = odStackSupply.elems.head;
+            odStackSupply.elems = odStackSupply.elems.tail;
+            return odStack;
+        }
+
+        private Token[] newOpStack() {
+            if (opStackSupply.elems == opStackSupply.last)
+                opStackSupply.append(new Token[infixPrecedenceLevels + 1]);
+            Token[] opStack = opStackSupply.elems.head;
+            opStackSupply.elems = opStackSupply.elems.tail;
+            return opStack;
+        }
+
+    /** Expression3    = PrefixOp Expression3
+     *                 | "(" Expr | TypeNoParams ")" Expression3
+     *                 | Primary {Selector} {PostfixOp}
+     *  Primary        = "(" Expression ")"
+     *                 | Literal
+     *                 | [TypeArguments] THIS [Arguments]
+     *                 | [TypeArguments] SUPER SuperSuffix
+     *                 | NEW [TypeArguments] Creator
+     *                 | Ident { "." Ident }
+     *                   [ "[" ( "]" BracketsOpt "." CLASS | Expression "]" )
+     *                   | Arguments
+     *                   | "." ( CLASS | THIS | [TypeArguments] SUPER Arguments | NEW [TypeArguments] InnerCreator )
+     *                   ]
+     *                 | BasicType BracketsOpt "." CLASS
+     *  PrefixOp       = "++" | "--" | "!" | "~" | "+" | "-"
+     *  PostfixOp      = "++" | "--"
+     *  Type3          = Ident { "." Ident } [TypeArguments] {TypeSelector} BracketsOpt
+     *                 | BasicType
+     *  TypeNoParams3  = Ident { "." Ident } BracketsOpt
+     *  Selector       = "." [TypeArguments] Ident [Arguments]
+     *                 | "." THIS
+     *                 | "." [TypeArguments] SUPER SuperSuffix
+     *                 | "." NEW [TypeArguments] InnerCreator
+     *                 | "[" Expression "]"
+     *  TypeSelector   = "." Ident [TypeArguments]
+     *  SuperSuffix    = Arguments | "." Ident [Arguments]
+     */
+    protected JCExpression term3() {
+        int pos = S.pos();
+        JCExpression t;
+        List<JCExpression> typeArgs = typeArgumentsOpt(EXPR);
+        switch (S.token()) {
+        case QUES:
+            if ((mode & TYPE) != 0 && (mode & (TYPEARG|NOPARAMS)) == TYPEARG) {
+                mode = TYPE;
+                return typeArgument();
+            } else
+                return illegal();
+        case PLUSPLUS: case SUBSUB: case BANG: case TILDE: case PLUS: case SUB:
+            if (typeArgs == null && (mode & EXPR) != 0) {
+                Token token = S.token();
+                S.nextToken();
+                mode = EXPR;
+                if (token == SUB &&
+                    (S.token() == INTLITERAL || S.token() == LONGLITERAL) &&
+                    S.radix() == 10) {
+                    mode = EXPR;
+                    t = literal(names.hyphen);
+                } else {
+                    t = term3();
+                    return F.at(pos).Unary(unoptag(token), t);
+                }
+            } else return illegal();
+            break;
+        case LPAREN:
+            if (typeArgs == null && (mode & EXPR) != 0) {
+                S.nextToken();
+                mode = EXPR | TYPE | NOPARAMS;
+                t = term3();
+                if ((mode & TYPE) != 0 && S.token() == LT) {
+                    // Could be a cast to a parameterized type
+                    int op = JCTree.LT;
+                    int pos1 = S.pos();
+                    S.nextToken();
+                    mode &= (EXPR | TYPE);
+                    mode |= TYPEARG;
+                    JCExpression t1 = term3();
+                    if ((mode & TYPE) != 0 &&
+                        (S.token() == COMMA || S.token() == GT)) {
+                        mode = TYPE;
+                        ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
+                        args.append(t1);
+                        while (S.token() == COMMA) {
+                            S.nextToken();
+                            args.append(typeArgument());
+                        }
+                        accept(GT);
+                        t = F.at(pos1).TypeApply(t, args.toList());
+                        checkGenerics();
+                        t = bracketsOpt(toP(t));
+                    } else if ((mode & EXPR) != 0) {
+                        mode = EXPR;
+                        t = F.at(pos1).Binary(op, t, term2Rest(t1, TreeInfo.shiftPrec));
+                        t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec)));
+                    } else {
+                        accept(GT);
+                    }
+                } else {
+                    t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec)));
+                }
+                accept(RPAREN);
+                lastmode = mode;
+                mode = EXPR;
+                if ((lastmode & EXPR) == 0) {
+                    JCExpression t1 = term3();
+                    return F.at(pos).TypeCast(t, t1);
+                } else if ((lastmode & TYPE) != 0) {
+                    switch (S.token()) {
+                    /*case PLUSPLUS: case SUBSUB: */
+                    case BANG: case TILDE:
+                    case LPAREN: case THIS: case SUPER:
+                    case INTLITERAL: case LONGLITERAL: case FLOATLITERAL:
+                    case DOUBLELITERAL: case CHARLITERAL: case STRINGLITERAL:
+                    case TRUE: case FALSE: case NULL:
+                    case NEW: case IDENTIFIER: case ASSERT: case ENUM:
+                    case BYTE: case SHORT: case CHAR: case INT:
+                    case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case VOID:
+                        JCExpression t1 = term3();
+                        return F.at(pos).TypeCast(t, t1);
+                    }
+                }
+            } else return illegal();
+            t = toP(F.at(pos).Parens(t));
+            break;
+        case THIS:
+            if ((mode & EXPR) != 0) {
+                mode = EXPR;
+                t = to(F.at(pos).Ident(names._this));
+                S.nextToken();
+                if (typeArgs == null)
+                    t = argumentsOpt(null, t);
+                else
+                    t = arguments(typeArgs, t);
+                typeArgs = null;
+            } else return illegal();
+            break;
+        case SUPER:
+            if ((mode & EXPR) != 0) {
+                mode = EXPR;
+                t = to(superSuffix(typeArgs, F.at(pos).Ident(names._super)));
+                typeArgs = null;
+            } else return illegal();
+            break;
+        case INTLITERAL: case LONGLITERAL: case FLOATLITERAL: case DOUBLELITERAL:
+        case CHARLITERAL: case STRINGLITERAL:
+        case TRUE: case FALSE: case NULL:
+            if (typeArgs == null && (mode & EXPR) != 0) {
+                mode = EXPR;
+                t = literal(names.empty);
+            } else return illegal();
+            break;
+        case NEW:
+            if (typeArgs != null) return illegal();
+            if ((mode & EXPR) != 0) {
+                mode = EXPR;
+                S.nextToken();
+                if (S.token() == LT) typeArgs = typeArguments();
+                t = creator(pos, typeArgs);
+                typeArgs = null;
+            } else return illegal();
+            break;
+        case IDENTIFIER: case ASSERT: case ENUM:
+            if (typeArgs != null) return illegal();
+            t = toP(F.at(S.pos()).Ident(ident()));
+            loop: while (true) {
+                pos = S.pos();
+                switch (S.token()) {
+                case LBRACKET:
+                    S.nextToken();
+                    if (S.token() == RBRACKET) {
+                        S.nextToken();
+                        t = bracketsOpt(t);
+                        t = toP(F.at(pos).TypeArray(t));
+                        t = bracketsSuffix(t);
+                    } else {
+                        if ((mode & EXPR) != 0) {
+                            mode = EXPR;
+                            JCExpression t1 = term();
+                            t = to(F.at(pos).Indexed(t, t1));
+                        }
+                        accept(RBRACKET);
+                    }
+                    break loop;
+                case LPAREN:
+                    if ((mode & EXPR) != 0) {
+                        mode = EXPR;
+                        t = arguments(typeArgs, t);
+                        typeArgs = null;
+                    }
+                    break loop;
+                case DOT:
+                    S.nextToken();
+                    int oldmode = mode;
+                    mode &= ~NOPARAMS;
+                    typeArgs = typeArgumentsOpt(EXPR);
+                    mode = oldmode;
+                    if ((mode & EXPR) != 0) {
+                        switch (S.token()) {
+                        case CLASS:
+                            if (typeArgs != null) return illegal();
+                            mode = EXPR;
+                            t = to(F.at(pos).Select(t, names._class));
+                            S.nextToken();
+                            break loop;
+                        case THIS:
+                            if (typeArgs != null) return illegal();
+                            mode = EXPR;
+                            t = to(F.at(pos).Select(t, names._this));
+                            S.nextToken();
+                            break loop;
+                        case SUPER:
+                            mode = EXPR;
+                            t = to(F.at(pos).Select(t, names._super));
+                            t = superSuffix(typeArgs, t);
+                            typeArgs = null;
+                            break loop;
+                        case NEW:
+                            if (typeArgs != null) return illegal();
+                            mode = EXPR;
+                            int pos1 = S.pos();
+                            S.nextToken();
+                            if (S.token() == LT) typeArgs = typeArguments();
+                            t = innerCreator(pos1, typeArgs, t);
+                            typeArgs = null;
+                            break loop;
+                        }
+                    }
+                    // typeArgs saved for next loop iteration.
+                    t = toP(F.at(pos).Select(t, ident()));
+                    break;
+                default:
+                    break loop;
+                }
+            }
+            if (typeArgs != null) illegal();
+            t = typeArgumentsOpt(t);
+            break;
+        case BYTE: case SHORT: case CHAR: case INT: case LONG: case FLOAT:
+        case DOUBLE: case BOOLEAN:
+            if (typeArgs != null) illegal();
+            t = bracketsSuffix(bracketsOpt(basicType()));
+            break;
+        case VOID:
+            if (typeArgs != null) illegal();
+            if ((mode & EXPR) != 0) {
+                S.nextToken();
+                if (S.token() == DOT) {
+                    JCPrimitiveTypeTree ti = toP(F.at(pos).TypeIdent(TypeTags.VOID));
+                    t = bracketsSuffix(ti);
+                } else {
+                    return illegal(pos);
+                }
+            } else {
+                return illegal();
+            }
+            break;
+        default:
+            return illegal();
+        }
+        if (typeArgs != null) illegal();
+        while (true) {
+            int pos1 = S.pos();
+            if (S.token() == LBRACKET) {
+                S.nextToken();
+                if ((mode & TYPE) != 0) {
+                    int oldmode = mode;
+                    mode = TYPE;
+                    if (S.token() == RBRACKET) {
+                        S.nextToken();
+                        t = bracketsOpt(t);
+                        t = toP(F.at(pos1).TypeArray(t));
+                        return t;
+                    }
+                    mode = oldmode;
+                }
+                if ((mode & EXPR) != 0) {
+                    mode = EXPR;
+                    JCExpression t1 = term();
+                    t = to(F.at(pos1).Indexed(t, t1));
+                }
+                accept(RBRACKET);
+            } else if (S.token() == DOT) {
+                S.nextToken();
+                typeArgs = typeArgumentsOpt(EXPR);
+                if (S.token() == SUPER && (mode & EXPR) != 0) {
+                    mode = EXPR;
+                    t = to(F.at(pos1).Select(t, names._super));
+                    S.nextToken();
+                    t = arguments(typeArgs, t);
+                    typeArgs = null;
+                } else if (S.token() == NEW && (mode & EXPR) != 0) {
+                    if (typeArgs != null) return illegal();
+                    mode = EXPR;
+                    int pos2 = S.pos();
+                    S.nextToken();
+                    if (S.token() == LT) typeArgs = typeArguments();
+                    t = innerCreator(pos2, typeArgs, t);
+                    typeArgs = null;
+                } else {
+                    t = toP(F.at(pos1).Select(t, ident()));
+                    t = argumentsOpt(typeArgs, typeArgumentsOpt(t));
+                    typeArgs = null;
+                }
+            } else {
+                break;
+            }
+        }
+        while ((S.token() == PLUSPLUS || S.token() == SUBSUB) && (mode & EXPR) != 0) {
+            mode = EXPR;
+            t = to(F.at(S.pos()).Unary(
+                  S.token() == PLUSPLUS ? JCTree.POSTINC : JCTree.POSTDEC, t));
+            S.nextToken();
+        }
+        return toP(t);
+    }
+
+    /** SuperSuffix = Arguments | "." [TypeArguments] Ident [Arguments]
+     */
+    JCExpression superSuffix(List<JCExpression> typeArgs, JCExpression t) {
+        S.nextToken();
+        if (S.token() == LPAREN || typeArgs != null) {
+            t = arguments(typeArgs, t);
+        } else {
+            int pos = S.pos();
+            accept(DOT);
+            typeArgs = (S.token() == LT) ? typeArguments() : null;
+            t = toP(F.at(pos).Select(t, ident()));
+            t = argumentsOpt(typeArgs, t);
+        }
+        return t;
+    }
+
+    /** BasicType = BYTE | SHORT | CHAR | INT | LONG | FLOAT | DOUBLE | BOOLEAN
+     */
+    JCPrimitiveTypeTree basicType() {
+        JCPrimitiveTypeTree t = to(F.at(S.pos()).TypeIdent(typetag(S.token())));
+        S.nextToken();
+        return t;
+    }
+
+    /** ArgumentsOpt = [ Arguments ]
+     */
+    JCExpression argumentsOpt(List<JCExpression> typeArgs, JCExpression t) {
+        if ((mode & EXPR) != 0 && S.token() == LPAREN || typeArgs != null) {
+            mode = EXPR;
+            return arguments(typeArgs, t);
+        } else {
+            return t;
+        }
+    }
+
+    /** Arguments = "(" [Expression { COMMA Expression }] ")"
+     */
+    List<JCExpression> arguments() {
+        ListBuffer<JCExpression> args = lb();
+        if (S.token() == LPAREN) {
+            S.nextToken();
+            if (S.token() != RPAREN) {
+                args.append(parseExpression());
+                while (S.token() == COMMA) {
+                    S.nextToken();
+                    args.append(parseExpression());
+                }
+            }
+            accept(RPAREN);
+        } else {
+            syntaxError(S.pos(), "expected", LPAREN);
+        }
+        return args.toList();
+    }
+
+    JCMethodInvocation arguments(List<JCExpression> typeArgs, JCExpression t) {
+        int pos = S.pos();
+        List<JCExpression> args = arguments();
+        return toP(F.at(pos).Apply(typeArgs, t, args));
+    }
+
+    /**  TypeArgumentsOpt = [ TypeArguments ]
+     */
+    JCExpression typeArgumentsOpt(JCExpression t) {
+        if (S.token() == LT &&
+            (mode & TYPE) != 0 &&
+            (mode & NOPARAMS) == 0) {
+            mode = TYPE;
+            checkGenerics();
+            return typeArguments(t);
+        } else {
+            return t;
+        }
+    }
+    List<JCExpression> typeArgumentsOpt() {
+        return typeArgumentsOpt(TYPE);
+    }
+
+    List<JCExpression> typeArgumentsOpt(int useMode) {
+        if (S.token() == LT) {
+            checkGenerics();
+            if ((mode & useMode) == 0 ||
+                (mode & NOPARAMS) != 0) {
+                illegal();
+            }
+            mode = useMode;
+            return typeArguments();
+        }
+        return null;
+    }
+
+    /**  TypeArguments  = "<" TypeArgument {"," TypeArgument} ">"
+     */
+    List<JCExpression> typeArguments() {
+        ListBuffer<JCExpression> args = lb();
+        if (S.token() == LT) {
+            S.nextToken();
+            args.append(((mode & EXPR) == 0) ? typeArgument() : parseType());
+            while (S.token() == COMMA) {
+                S.nextToken();
+                args.append(((mode & EXPR) == 0) ? typeArgument() : parseType());
+            }
+            switch (S.token()) {
+            case GTGTGTEQ:
+                S.token(GTGTEQ);
+                break;
+            case GTGTEQ:
+                S.token(GTEQ);
+                break;
+            case GTEQ:
+                S.token(EQ);
+                break;
+            case GTGTGT:
+                S.token(GTGT);
+                break;
+            case GTGT:
+                S.token(GT);
+                break;
+            default:
+                accept(GT);
+                break;
+            }
+        } else {
+            syntaxError(S.pos(), "expected", LT);
+        }
+        return args.toList();
+    }
+
+    /** TypeArgument = Type
+     *               | "?"
+     *               | "?" EXTENDS Type {"&" Type}
+     *               | "?" SUPER Type
+     */
+    JCExpression typeArgument() {
+        if (S.token() != QUES) return parseType();
+        int pos = S.pos();
+        S.nextToken();
+        if (S.token() == EXTENDS) {
+            TypeBoundKind t = to(F.at(S.pos()).TypeBoundKind(BoundKind.EXTENDS));
+            S.nextToken();
+            return F.at(pos).Wildcard(t, parseType());
+        } else if (S.token() == SUPER) {
+            TypeBoundKind t = to(F.at(S.pos()).TypeBoundKind(BoundKind.SUPER));
+            S.nextToken();
+            return F.at(pos).Wildcard(t, parseType());
+        } else if (S.token() == IDENTIFIER) {
+            //error recovery
+            reportSyntaxError(S.prevEndPos(), "expected3",
+                    GT, EXTENDS, SUPER);
+            TypeBoundKind t = F.at(Position.NOPOS).TypeBoundKind(BoundKind.UNBOUND);
+            JCExpression wc = toP(F.at(pos).Wildcard(t, null));
+            JCIdent id = toP(F.at(S.pos()).Ident(ident()));
+            return F.at(pos).Erroneous(List.<JCTree>of(wc, id));
+        } else {
+            TypeBoundKind t = F.at(Position.NOPOS).TypeBoundKind(BoundKind.UNBOUND);
+            return toP(F.at(pos).Wildcard(t, null));
+        }
+    }
+
+    JCTypeApply typeArguments(JCExpression t) {
+        int pos = S.pos();
+        List<JCExpression> args = typeArguments();
+        return toP(F.at(pos).TypeApply(t, args));
+    }
+
+    /** BracketsOpt = {"[" "]"}
+     */
+    private JCExpression bracketsOpt(JCExpression t) {
+        if (S.token() == LBRACKET) {
+            int pos = S.pos();
+            S.nextToken();
+            t = bracketsOptCont(t, pos);
+            F.at(pos);
+        }
+        return t;
+    }
+
+    private JCArrayTypeTree bracketsOptCont(JCExpression t, int pos) {
+        accept(RBRACKET);
+        t = bracketsOpt(t);
+        return toP(F.at(pos).TypeArray(t));
+    }
+
+    /** BracketsSuffixExpr = "." CLASS
+     *  BracketsSuffixType =
+     */
+    JCExpression bracketsSuffix(JCExpression t) {
+        if ((mode & EXPR) != 0 && S.token() == DOT) {
+            mode = EXPR;
+            int pos = S.pos();
+            S.nextToken();
+            accept(CLASS);
+            if (S.pos() == errorEndPos) {
+                // error recovery
+                Name name = null;
+                if (S.token() == IDENTIFIER) {
+                    name = S.name();
+                    S.nextToken();
+                } else {
+                    name = names.error;
+                }
+                t = F.at(pos).Erroneous(List.<JCTree>of(toP(F.at(pos).Select(t, name))));
+            } else {
+                t = toP(F.at(pos).Select(t, names._class));
+            }
+        } else if ((mode & TYPE) != 0) {
+            mode = TYPE;
+        } else {
+            syntaxError(S.pos(), "dot.class.expected");
+        }
+        return t;
+    }
+
+    /** Creator = Qualident [TypeArguments] ( ArrayCreatorRest | ClassCreatorRest )
+     */
+    JCExpression creator(int newpos, List<JCExpression> typeArgs) {
+        switch (S.token()) {
+        case BYTE: case SHORT: case CHAR: case INT: case LONG: case FLOAT:
+        case DOUBLE: case BOOLEAN:
+            if (typeArgs == null)
+                return arrayCreatorRest(newpos, basicType());
+            break;
+        default:
+        }
+        JCExpression t = qualident();
+        int oldmode = mode;
+        mode = TYPE;
+        if (S.token() == LT) {
+            checkGenerics();
+            t = typeArguments(t);
+        }
+        while (S.token() == DOT) {
+            int pos = S.pos();
+            S.nextToken();
+            t = toP(F.at(pos).Select(t, ident()));
+            if (S.token() == LT) {
+                checkGenerics();
+                t = typeArguments(t);
+            }
+        }
+        mode = oldmode;
+        if (S.token() == LBRACKET) {
+            JCExpression e = arrayCreatorRest(newpos, t);
+            if (typeArgs != null) {
+                int pos = newpos;
+                if (!typeArgs.isEmpty() && typeArgs.head.pos != Position.NOPOS) {
+                    // note: this should always happen but we should
+                    // not rely on this as the parser is continuously
+                    // modified to improve error recovery.
+                    pos = typeArgs.head.pos;
+                }
+                setErrorEndPos(S.prevEndPos());
+                reportSyntaxError(pos, "cannot.create.array.with.type.arguments");
+                return toP(F.at(newpos).Erroneous(typeArgs.prepend(e)));
+            }
+            return e;
+        } else if (S.token() == LPAREN) {
+            return classCreatorRest(newpos, null, typeArgs, t);
+        } else {
+            reportSyntaxError(S.pos(), "expected2",
+                               LPAREN, LBRACKET);
+            t = toP(F.at(newpos).NewClass(null, typeArgs, t, List.<JCExpression>nil(), null));
+            return toP(F.at(newpos).Erroneous(List.<JCTree>of(t)));
+        }
+    }
+
+    /** InnerCreator = Ident [TypeArguments] ClassCreatorRest
+     */
+    JCExpression innerCreator(int newpos, List<JCExpression> typeArgs, JCExpression encl) {
+        JCExpression t = toP(F.at(S.pos()).Ident(ident()));
+        if (S.token() == LT) {
+            checkGenerics();
+            t = typeArguments(t);
+        }
+        return classCreatorRest(newpos, encl, typeArgs, t);
+    }
+
+    /** ArrayCreatorRest = "[" ( "]" BracketsOpt ArrayInitializer
+     *                         | Expression "]" {"[" Expression "]"} BracketsOpt )
+     */
+    JCExpression arrayCreatorRest(int newpos, JCExpression elemtype) {
+        accept(LBRACKET);
+        if (S.token() == RBRACKET) {
+            accept(RBRACKET);
+            elemtype = bracketsOpt(elemtype);
+            if (S.token() == LBRACE) {
+                return arrayInitializer(newpos, elemtype);
+            } else {
+                return syntaxError(S.pos(), "array.dimension.missing");
+            }
+        } else {
+            ListBuffer<JCExpression> dims = new ListBuffer<JCExpression>();
+            dims.append(parseExpression());
+            accept(RBRACKET);
+            while (S.token() == LBRACKET) {
+                int pos = S.pos();
+                S.nextToken();
+                if (S.token() == RBRACKET) {
+                    elemtype = bracketsOptCont(elemtype, pos);
+                } else {
+                    dims.append(parseExpression());
+                    accept(RBRACKET);
+                }
+            }
+            return toP(F.at(newpos).NewArray(elemtype, dims.toList(), null));
+        }
+    }
+
+    /** ClassCreatorRest = Arguments [ClassBody]
+     */
+    JCExpression classCreatorRest(int newpos,
+                                  JCExpression encl,
+                                  List<JCExpression> typeArgs,
+                                  JCExpression t)
+    {
+        List<JCExpression> args = arguments();
+        JCClassDecl body = null;
+        if (S.token() == LBRACE) {
+            int pos = S.pos();
+            List<JCTree> defs = classOrInterfaceBody(names.empty, false);
+            JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
+            body = toP(F.at(pos).AnonymousClassDef(mods, defs));
+        }
+        return toP(F.at(newpos).NewClass(encl, typeArgs, t, args, body));
+    }
+
+    /** ArrayInitializer = "{" [VariableInitializer {"," VariableInitializer}] [","] "}"
+     */
+    JCExpression arrayInitializer(int newpos, JCExpression t) {
+        accept(LBRACE);
+        ListBuffer<JCExpression> elems = new ListBuffer<JCExpression>();
+        if (S.token() == COMMA) {
+            S.nextToken();
+        } else if (S.token() != RBRACE) {
+            elems.append(variableInitializer());
+            while (S.token() == COMMA) {
+                S.nextToken();
+                if (S.token() == RBRACE) break;
+                elems.append(variableInitializer());
+            }
+        }
+        accept(RBRACE);
+        return toP(F.at(newpos).NewArray(t, List.<JCExpression>nil(), elems.toList()));
+    }
+
+    /** VariableInitializer = ArrayInitializer | Expression
+     */
+    public JCExpression variableInitializer() {
+        return S.token() == LBRACE ? arrayInitializer(S.pos(), null) : parseExpression();
+    }
+
+    /** ParExpression = "(" Expression ")"
+     */
+    JCExpression parExpression() {
+        accept(LPAREN);
+        JCExpression t = parseExpression();
+        accept(RPAREN);
+        return t;
+    }
+
+    /** Block = "{" BlockStatements "}"
+     */
+    JCBlock block(int pos, long flags) {
+        accept(LBRACE);
+        List<JCStatement> stats = blockStatements();
+        JCBlock t = F.at(pos).Block(flags, stats);
+        while (S.token() == CASE || S.token() == DEFAULT) {
+            syntaxError("orphaned", S.token());
+            switchBlockStatementGroups();
+        }
+        // the Block node has a field "endpos" for first char of last token, which is
+        // usually but not necessarily the last char of the last token.
+        t.endpos = S.pos();
+        accept(RBRACE);
+        return toP(t);
+    }
+
+    public JCBlock block() {
+        return block(S.pos(), 0);
+    }
+
+    /** BlockStatements = { BlockStatement }
+     *  BlockStatement  = LocalVariableDeclarationStatement
+     *                  | ClassOrInterfaceOrEnumDeclaration
+     *                  | [Ident ":"] Statement
+     *  LocalVariableDeclarationStatement
+     *                  = { FINAL | '@' Annotation } Type VariableDeclarators ";"
+     */
+    @SuppressWarnings("fallthrough")
+    List<JCStatement> blockStatements() {
+//todo: skip to anchor on error(?)
+        int lastErrPos = -1;
+        ListBuffer<JCStatement> stats = new ListBuffer<JCStatement>();
+        while (true) {
+            int pos = S.pos();
+            switch (S.token()) {
+            case RBRACE: case CASE: case DEFAULT: case EOF:
+                return stats.toList();
+            case LBRACE: case IF: case FOR: case WHILE: case DO: case TRY:
+            case SWITCH: case SYNCHRONIZED: case RETURN: case THROW: case BREAK:
+            case CONTINUE: case SEMI: case ELSE: case FINALLY: case CATCH:
+                stats.append(parseStatement());
+                break;
+            case MONKEYS_AT:
+            case FINAL: {
+                String dc = S.docComment();
+                JCModifiers mods = modifiersOpt();
+                if (S.token() == INTERFACE ||
+                    S.token() == CLASS ||
+                    allowEnums && S.token() == ENUM) {
+                    stats.append(classOrInterfaceOrEnumDeclaration(mods, dc));
+                } else {
+                    JCExpression t = parseType();
+                    stats.appendList(variableDeclarators(mods, t,
+                                                         new ListBuffer<JCStatement>()));
+                    // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
+                    storeEnd(stats.elems.last(), S.endPos());
+                    accept(SEMI);
+                }
+                break;
+            }
+            case ABSTRACT: case STRICTFP: {
+                String dc = S.docComment();
+                JCModifiers mods = modifiersOpt();
+                stats.append(classOrInterfaceOrEnumDeclaration(mods, dc));
+                break;
+            }
+            case INTERFACE:
+            case CLASS:
+                stats.append(classOrInterfaceOrEnumDeclaration(modifiersOpt(),
+                                                               S.docComment()));
+                break;
+            case ENUM:
+            case ASSERT:
+                if (allowEnums && S.token() == ENUM) {
+                    log.error(S.pos(), "local.enum");
+                    stats.
+                        append(classOrInterfaceOrEnumDeclaration(modifiersOpt(),
+                                                                 S.docComment()));
+                    break;
+                } else if (allowAsserts && S.token() == ASSERT) {
+                    stats.append(parseStatement());
+                    break;
+                }
+                /* fall through to default */
+            default:
+                Name name = S.name();
+                JCExpression t = term(EXPR | TYPE);
+                if (S.token() == COLON && t.getTag() == JCTree.IDENT) {
+                    S.nextToken();
+                    JCStatement stat = parseStatement();
+                    stats.append(F.at(pos).Labelled(name, stat));
+                } else if ((lastmode & TYPE) != 0 &&
+                           (S.token() == IDENTIFIER ||
+                            S.token() == ASSERT ||
+                            S.token() == ENUM)) {
+                    pos = S.pos();
+                    JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
+                    F.at(pos);
+                    stats.appendList(variableDeclarators(mods, t,
+                                                         new ListBuffer<JCStatement>()));
+                    // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
+                    storeEnd(stats.elems.last(), S.endPos());
+                    accept(SEMI);
+                } else {
+                    // This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon
+                    stats.append(to(F.at(pos).Exec(checkExprStat(t))));
+                    accept(SEMI);
+                }
+            }
+
+            // error recovery
+            if (S.pos() == lastErrPos)
+                return stats.toList();
+            if (S.pos() <= errorEndPos) {
+                skip(false, true, true, true);
+                lastErrPos = S.pos();
+            }
+
+            // ensure no dangling /** @deprecated */ active
+            S.resetDeprecatedFlag();
+        }
+    }
+
+    /** Statement =
+     *       Block
+     *     | IF ParExpression Statement [ELSE Statement]
+     *     | FOR "(" ForInitOpt ";" [Expression] ";" ForUpdateOpt ")" Statement
+     *     | FOR "(" FormalParameter : Expression ")" Statement
+     *     | WHILE ParExpression Statement
+     *     | DO Statement WHILE ParExpression ";"
+     *     | TRY Block ( Catches | [Catches] FinallyPart )
+     *     | SWITCH ParExpression "{" SwitchBlockStatementGroups "}"
+     *     | SYNCHRONIZED ParExpression Block
+     *     | RETURN [Expression] ";"
+     *     | THROW Expression ";"
+     *     | BREAK [Ident] ";"
+     *     | CONTINUE [Ident] ";"
+     *     | ASSERT Expression [ ":" Expression ] ";"
+     *     | ";"
+     *     | ExpressionStatement
+     *     | Ident ":" Statement
+     */
+    @SuppressWarnings("fallthrough")
+    public JCStatement parseStatement() {
+        int pos = S.pos();
+        switch (S.token()) {
+        case LBRACE:
+            return block();
+        case IF: {
+            S.nextToken();
+            JCExpression cond = parExpression();
+            JCStatement thenpart = parseStatement();
+            JCStatement elsepart = null;
+            if (S.token() == ELSE) {
+                S.nextToken();
+                elsepart = parseStatement();
+            }
+            return F.at(pos).If(cond, thenpart, elsepart);
+        }
+        case FOR: {
+            S.nextToken();
+            accept(LPAREN);
+            List<JCStatement> inits = S.token() == SEMI ? List.<JCStatement>nil() : forInit();
+            if (inits.length() == 1 &&
+                inits.head.getTag() == JCTree.VARDEF &&
+                ((JCVariableDecl) inits.head).init == null &&
+                S.token() == COLON) {
+                checkForeach();
+                JCVariableDecl var = (JCVariableDecl)inits.head;
+                accept(COLON);
+                JCExpression expr = parseExpression();
+                accept(RPAREN);
+                JCStatement body = parseStatement();
+                return F.at(pos).ForeachLoop(var, expr, body);
+            } else {
+                accept(SEMI);
+                JCExpression cond = S.token() == SEMI ? null : parseExpression();
+                accept(SEMI);
+                List<JCExpressionStatement> steps = S.token() == RPAREN ? List.<JCExpressionStatement>nil() : forUpdate();
+                accept(RPAREN);
+                JCStatement body = parseStatement();
+                return F.at(pos).ForLoop(inits, cond, steps, body);
+            }
+        }
+        case WHILE: {
+            S.nextToken();
+            JCExpression cond = parExpression();
+            JCStatement body = parseStatement();
+            return F.at(pos).WhileLoop(cond, body);
+        }
+        case DO: {
+            S.nextToken();
+            JCStatement body = parseStatement();
+            accept(WHILE);
+            JCExpression cond = parExpression();
+            JCDoWhileLoop t = to(F.at(pos).DoLoop(body, cond));
+            accept(SEMI);
+            return t;
+        }
+        case TRY: {
+            S.nextToken();
+            JCBlock body = block();
+            ListBuffer<JCCatch> catchers = new ListBuffer<JCCatch>();
+            JCBlock finalizer = null;
+            if (S.token() == CATCH || S.token() == FINALLY) {
+                while (S.token() == CATCH) catchers.append(catchClause());
+                if (S.token() == FINALLY) {
+                    S.nextToken();
+                    finalizer = block();
+                }
+            } else {
+                log.error(pos, "try.without.catch.or.finally");
+            }
+            return F.at(pos).Try(body, catchers.toList(), finalizer);
+        }
+        case SWITCH: {
+            S.nextToken();
+            JCExpression selector = parExpression();
+            accept(LBRACE);
+            List<JCCase> cases = switchBlockStatementGroups();
+            JCSwitch t = to(F.at(pos).Switch(selector, cases));
+            accept(RBRACE);
+            return t;
+        }
+        case SYNCHRONIZED: {
+            S.nextToken();
+            JCExpression lock = parExpression();
+            JCBlock body = block();
+            return F.at(pos).Synchronized(lock, body);
+        }
+        case RETURN: {
+            S.nextToken();
+            JCExpression result = S.token() == SEMI ? null : parseExpression();
+            JCReturn t = to(F.at(pos).Return(result));
+            accept(SEMI);
+            return t;
+        }
+        case THROW: {
+            S.nextToken();
+            JCExpression exc = parseExpression();
+            JCThrow t = to(F.at(pos).Throw(exc));
+            accept(SEMI);
+            return t;
+        }
+        case BREAK: {
+            S.nextToken();
+            Name label = (S.token() == IDENTIFIER || S.token() == ASSERT || S.token() == ENUM) ? ident() : null;
+            JCBreak t = to(F.at(pos).Break(label));
+            accept(SEMI);
+            return t;
+        }
+        case CONTINUE: {
+            S.nextToken();
+            Name label = (S.token() == IDENTIFIER || S.token() == ASSERT || S.token() == ENUM) ? ident() : null;
+            JCContinue t =  to(F.at(pos).Continue(label));
+            accept(SEMI);
+            return t;
+        }
+        case SEMI:
+            S.nextToken();
+            return toP(F.at(pos).Skip());
+        case ELSE:
+            return toP(F.Exec(syntaxError("else.without.if")));
+        case FINALLY:
+            return toP(F.Exec(syntaxError("finally.without.try")));
+        case CATCH:
+            return toP(F.Exec(syntaxError("catch.without.try")));
+        case ASSERT: {
+            if (allowAsserts && S.token() == ASSERT) {
+                S.nextToken();
+                JCExpression assertion = parseExpression();
+                JCExpression message = null;
+                if (S.token() == COLON) {
+                    S.nextToken();
+                    message = parseExpression();
+                }
+                JCAssert t = to(F.at(pos).Assert(assertion, message));
+                accept(SEMI);
+                return t;
+            }
+            /* else fall through to default case */
+        }
+        case ENUM:
+        default:
+            Name name = S.name();
+            JCExpression expr = parseExpression();
+            if (S.token() == COLON && expr.getTag() == JCTree.IDENT) {
+                S.nextToken();
+                JCStatement stat = parseStatement();
+                return F.at(pos).Labelled(name, stat);
+            } else {
+                // This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon
+                JCExpressionStatement stat = to(F.at(pos).Exec(checkExprStat(expr)));
+                accept(SEMI);
+                return stat;
+            }
+        }
+    }
+
+    /** CatchClause     = CATCH "(" FormalParameter ")" Block
+     */
+    JCCatch catchClause() {
+        int pos = S.pos();
+        accept(CATCH);
+        accept(LPAREN);
+        JCVariableDecl formal =
+            variableDeclaratorId(optFinal(Flags.PARAMETER),
+                                 qualident());
+        accept(RPAREN);
+        JCBlock body = block();
+        return F.at(pos).Catch(formal, body);
+    }
+
+    /** SwitchBlockStatementGroups = { SwitchBlockStatementGroup }
+     *  SwitchBlockStatementGroup = SwitchLabel BlockStatements
+     *  SwitchLabel = CASE ConstantExpression ":" | DEFAULT ":"
+     */
+    List<JCCase> switchBlockStatementGroups() {
+        ListBuffer<JCCase> cases = new ListBuffer<JCCase>();
+        while (true) {
+            int pos = S.pos();
+            switch (S.token()) {
+            case CASE: {
+                S.nextToken();
+                JCExpression pat = parseExpression();
+                accept(COLON);
+                List<JCStatement> stats = blockStatements();
+                JCCase c = F.at(pos).Case(pat, stats);
+                if (stats.isEmpty())
+                    storeEnd(c, S.prevEndPos());
+                cases.append(c);
+                break;
+            }
+            case DEFAULT: {
+                S.nextToken();
+                accept(COLON);
+                List<JCStatement> stats = blockStatements();
+                JCCase c = F.at(pos).Case(null, stats);
+                if (stats.isEmpty())
+                    storeEnd(c, S.prevEndPos());
+                cases.append(c);
+                break;
+            }
+            case RBRACE: case EOF:
+                return cases.toList();
+            default:
+                S.nextToken(); // to ensure progress
+                syntaxError(pos, "expected3",
+                    CASE, DEFAULT, RBRACE);
+            }
+        }
+    }
+
+    /** MoreStatementExpressions = { COMMA StatementExpression }
+     */
+    <T extends ListBuffer<? super JCExpressionStatement>> T moreStatementExpressions(int pos,
+                                                                    JCExpression first,
+                                                                    T stats) {
+        // This Exec is a "StatementExpression"; it subsumes no terminating token
+        stats.append(toP(F.at(pos).Exec(checkExprStat(first))));
+        while (S.token() == COMMA) {
+            S.nextToken();
+            pos = S.pos();
+            JCExpression t = parseExpression();
+            // This Exec is a "StatementExpression"; it subsumes no terminating token
+            stats.append(toP(F.at(pos).Exec(checkExprStat(t))));
+        }
+        return stats;
+    }
+
+    /** ForInit = StatementExpression MoreStatementExpressions
+     *           |  { FINAL | '@' Annotation } Type VariableDeclarators
+     */
+    List<JCStatement> forInit() {
+        ListBuffer<JCStatement> stats = lb();
+        int pos = S.pos();
+        if (S.token() == FINAL || S.token() == MONKEYS_AT) {
+            return variableDeclarators(optFinal(0), parseType(), stats).toList();
+        } else {
+            JCExpression t = term(EXPR | TYPE);
+            if ((lastmode & TYPE) != 0 &&
+                (S.token() == IDENTIFIER || S.token() == ASSERT || S.token() == ENUM))
+                return variableDeclarators(modifiersOpt(), t, stats).toList();
+            else
+                return moreStatementExpressions(pos, t, stats).toList();
+        }
+    }
+
+    /** ForUpdate = StatementExpression MoreStatementExpressions
+     */
+    List<JCExpressionStatement> forUpdate() {
+        return moreStatementExpressions(S.pos(),
+                                        parseExpression(),
+                                        new ListBuffer<JCExpressionStatement>()).toList();
+    }
+
+    /** AnnotationsOpt = { '@' Annotation }
+     */
+    List<JCAnnotation> annotationsOpt() {
+        if (S.token() != MONKEYS_AT) return List.nil(); // optimization
+        ListBuffer<JCAnnotation> buf = new ListBuffer<JCAnnotation>();
+        while (S.token() == MONKEYS_AT) {
+            int pos = S.pos();
+            S.nextToken();
+            buf.append(annotation(pos));
+        }
+        return buf.toList();
+    }
+
+    /** ModifiersOpt = { Modifier }
+     *  Modifier = PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | FINAL
+     *           | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE | "@"
+     *           | "@" Annotation
+     */
+    JCModifiers modifiersOpt() {
+        return modifiersOpt(null);
+    }
+    JCModifiers modifiersOpt(JCModifiers partial) {
+        long flags = (partial == null) ? 0 : partial.flags;
+        if (S.deprecatedFlag()) {
+            flags |= Flags.DEPRECATED;
+            S.resetDeprecatedFlag();
+        }
+        ListBuffer<JCAnnotation> annotations = new ListBuffer<JCAnnotation>();
+        if (partial != null) annotations.appendList(partial.annotations);
+        int pos = S.pos();
+        int lastPos = Position.NOPOS;
+    loop:
+        while (true) {
+            long flag;
+            switch (S.token()) {
+            case PRIVATE     : flag = Flags.PRIVATE; break;
+            case PROTECTED   : flag = Flags.PROTECTED; break;
+            case PUBLIC      : flag = Flags.PUBLIC; break;
+            case STATIC      : flag = Flags.STATIC; break;
+            case TRANSIENT   : flag = Flags.TRANSIENT; break;
+            case FINAL       : flag = Flags.FINAL; break;
+            case ABSTRACT    : flag = Flags.ABSTRACT; break;
+            case NATIVE      : flag = Flags.NATIVE; break;
+            case VOLATILE    : flag = Flags.VOLATILE; break;
+            case SYNCHRONIZED: flag = Flags.SYNCHRONIZED; break;
+            case STRICTFP    : flag = Flags.STRICTFP; break;
+            case MONKEYS_AT  : flag = Flags.ANNOTATION; break;
+            default: break loop;
+            }
+            if ((flags & flag) != 0) log.error(S.pos(), "repeated.modifier");
+            lastPos = S.pos();
+            S.nextToken();
+            if (flag == Flags.ANNOTATION) {
+                checkAnnotations();
+                if (S.token() != INTERFACE) {
+                JCAnnotation ann = annotation(lastPos);
+                // if first modifier is an annotation, set pos to annotation's.
+                if (flags == 0 && annotations.isEmpty())
+                    pos = ann.pos;
+                annotations.append(ann);
+                lastPos = ann.pos;
+                    flag = 0;
+                }
+            }
+            flags |= flag;
+        }
+        switch (S.token()) {
+        case ENUM: flags |= Flags.ENUM; break;
+        case INTERFACE: flags |= Flags.INTERFACE; break;
+        default: break;
+        }
+
+        /* A modifiers tree with no modifier tokens or annotations
+         * has no text position. */
+        if (flags == 0 && annotations.isEmpty())
+            pos = Position.NOPOS;
+
+        JCModifiers mods = F.at(pos).Modifiers(flags, annotations.toList());
+        if (pos != Position.NOPOS)
+            storeEnd(mods, S.prevEndPos());
+        return mods;
+    }
+
+    /** Annotation              = "@" Qualident [ "(" AnnotationFieldValues ")" ]
+     * @param pos position of "@" token
+     */
+    JCAnnotation annotation(int pos) {
+        // accept(AT); // AT consumed by caller
+        checkAnnotations();
+        JCTree ident = qualident();
+        List<JCExpression> fieldValues = annotationFieldValuesOpt();
+        JCAnnotation ann = F.at(pos).Annotation(ident, fieldValues);
+        storeEnd(ann, S.prevEndPos());
+        return ann;
+    }
+
+    List<JCExpression> annotationFieldValuesOpt() {
+        return (S.token() == LPAREN) ? annotationFieldValues() : List.<JCExpression>nil();
+    }
+
+    /** AnnotationFieldValues   = "(" [ AnnotationFieldValue { "," AnnotationFieldValue } ] ")" */
+    List<JCExpression> annotationFieldValues() {
+        accept(LPAREN);
+        ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>();
+        if (S.token() != RPAREN) {
+            buf.append(annotationFieldValue());
+            while (S.token() == COMMA) {
+                S.nextToken();
+                buf.append(annotationFieldValue());
+            }
+        }
+        accept(RPAREN);
+        return buf.toList();
+    }
+
+    /** AnnotationFieldValue    = AnnotationValue
+     *                          | Identifier "=" AnnotationValue
+     */
+    JCExpression annotationFieldValue() {
+        if (S.token() == IDENTIFIER) {
+            mode = EXPR;
+            JCExpression t1 = term1();
+            if (t1.getTag() == JCTree.IDENT && S.token() == EQ) {
+                int pos = S.pos();
+                accept(EQ);
+                return toP(F.at(pos).Assign(t1, annotationValue()));
+            } else {
+                return t1;
+            }
+        }
+        return annotationValue();
+    }
+
+    /* AnnotationValue          = ConditionalExpression
+     *                          | Annotation
+     *                          | "{" [ AnnotationValue { "," AnnotationValue } ] "}"
+     */
+    JCExpression annotationValue() {
+        int pos;
+        switch (S.token()) {
+        case MONKEYS_AT:
+            pos = S.pos();
+            S.nextToken();
+            return annotation(pos);
+        case LBRACE:
+            pos = S.pos();
+            accept(LBRACE);
+            ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>();
+            if (S.token() != RBRACE) {
+                buf.append(annotationValue());
+                while (S.token() == COMMA) {
+                    S.nextToken();
+                    if (S.token() == RPAREN) break;
+                    buf.append(annotationValue());
+                }
+            }
+            accept(RBRACE);
+            return toP(F.at(pos).NewArray(null, List.<JCExpression>nil(), buf.toList()));
+        default:
+            mode = EXPR;
+            return term1();
+        }
+    }
+
+    /** VariableDeclarators = VariableDeclarator { "," VariableDeclarator }
+     */
+    public <T extends ListBuffer<? super JCVariableDecl>> T variableDeclarators(JCModifiers mods,
+                                                                         JCExpression type,
+                                                                         T vdefs)
+    {
+        return variableDeclaratorsRest(S.pos(), mods, type, ident(), false, null, vdefs);
+    }
+
+    /** VariableDeclaratorsRest = VariableDeclaratorRest { "," VariableDeclarator }
+     *  ConstantDeclaratorsRest = ConstantDeclaratorRest { "," ConstantDeclarator }
+     *
+     *  @param reqInit  Is an initializer always required?
+     *  @param dc       The documentation comment for the variable declarations, or null.
+     */
+    <T extends ListBuffer<? super JCVariableDecl>> T variableDeclaratorsRest(int pos,
+                                                                     JCModifiers mods,
+                                                                     JCExpression type,
+                                                                     Name name,
+                                                                     boolean reqInit,
+                                                                     String dc,
+                                                                     T vdefs)
+    {
+        vdefs.append(variableDeclaratorRest(pos, mods, type, name, reqInit, dc));
+        while (S.token() == COMMA) {
+            // All but last of multiple declarators subsume a comma
+            storeEnd((JCTree)vdefs.elems.last(), S.endPos());
+            S.nextToken();
+            vdefs.append(variableDeclarator(mods, type, reqInit, dc));
+        }
+        return vdefs;
+    }
+
+    /** VariableDeclarator = Ident VariableDeclaratorRest
+     *  ConstantDeclarator = Ident ConstantDeclaratorRest
+     */
+    JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, String dc) {
+        return variableDeclaratorRest(S.pos(), mods, type, ident(), reqInit, dc);
+    }
+
+    /** VariableDeclaratorRest = BracketsOpt ["=" VariableInitializer]
+     *  ConstantDeclaratorRest = BracketsOpt "=" VariableInitializer
+     *
+     *  @param reqInit  Is an initializer always required?
+     *  @param dc       The documentation comment for the variable declarations, or null.
+     */
+    JCVariableDecl variableDeclaratorRest(int pos, JCModifiers mods, JCExpression type, Name name,
+                                  boolean reqInit, String dc) {
+        type = bracketsOpt(type);
+        JCExpression init = null;
+        if (S.token() == EQ) {
+            S.nextToken();
+            init = variableInitializer();
+        }
+        else if (reqInit) syntaxError(S.pos(), "expected", EQ);
+        JCVariableDecl result =
+            toP(F.at(pos).VarDef(mods, name, type, init));
+        attach(result, dc);
+        return result;
+    }
+
+    /** VariableDeclaratorId = Ident BracketsOpt
+     */
+    JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) {
+        int pos = S.pos();
+        Name name = ident();
+        if ((mods.flags & Flags.VARARGS) == 0)
+            type = bracketsOpt(type);
+        return toP(F.at(pos).VarDef(mods, name, type, null));
+    }
+
+    /** CompilationUnit = [ { "@" Annotation } PACKAGE Qualident ";"] {ImportDeclaration} {TypeDeclaration}
+     */
+    public JCTree.JCCompilationUnit parseCompilationUnit() {
+        int pos = S.pos();
+        JCExpression pid = null;
+        String dc = S.docComment();
+        JCModifiers mods = null;
+        List<JCAnnotation> packageAnnotations = List.nil();
+        if (S.token() == MONKEYS_AT)
+            mods = modifiersOpt();
+
+        if (S.token() == PACKAGE) {
+            if (mods != null) {
+                checkNoMods(mods.flags);
+                packageAnnotations = mods.annotations;
+                mods = null;
+            }
+            S.nextToken();
+            pid = qualident();
+            accept(SEMI);
+        }
+        ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
+        boolean checkForImports = true;
+        while (S.token() != EOF) {
+            if (S.pos() <= errorEndPos) {
+                // error recovery
+                skip(checkForImports, false, false, false);
+                if (S.token() == EOF)
+                    break;
+            }
+            if (checkForImports && mods == null && S.token() == IMPORT) {
+                defs.append(importDeclaration());
+            } else {
+                JCTree def = typeDeclaration(mods);
+                if (def instanceof JCExpressionStatement)
+                    def = ((JCExpressionStatement)def).expr;
+                defs.append(def);
+                if (def instanceof JCClassDecl)
+                    checkForImports = false;
+                mods = null;
+            }
+        }
+        JCTree.JCCompilationUnit toplevel = F.at(pos).TopLevel(packageAnnotations, pid, defs.toList());
+        attach(toplevel, dc);
+        if (defs.elems.isEmpty())
+            storeEnd(toplevel, S.prevEndPos());
+        if (keepDocComments)
+            toplevel.docComments = docComments;
+        if (keepLineMap)
+            toplevel.lineMap = S.getLineMap();
+        return toplevel;
+    }
+
+    /** ImportDeclaration = IMPORT [ STATIC ] Ident { "." Ident } [ "." "*" ] ";"
+     */
+    JCTree importDeclaration() {
+        int pos = S.pos();
+        S.nextToken();
+        boolean importStatic = false;
+        if (S.token() == STATIC) {
+            checkStaticImports();
+            importStatic = true;
+            S.nextToken();
+        }
+        JCExpression pid = toP(F.at(S.pos()).Ident(ident()));
+        do {
+            int pos1 = S.pos();
+            accept(DOT);
+            if (S.token() == STAR) {
+                pid = to(F.at(pos1).Select(pid, names.asterisk));
+                S.nextToken();
+                break;
+            } else {
+                pid = toP(F.at(pos1).Select(pid, ident()));
+            }
+        } while (S.token() == DOT);
+        accept(SEMI);
+        return toP(F.at(pos).Import(pid, importStatic));
+    }
+
+    /** TypeDeclaration = ClassOrInterfaceOrEnumDeclaration
+     *                  | ";"
+     */
+    JCTree typeDeclaration(JCModifiers mods) {
+        int pos = S.pos();
+        if (mods == null && S.token() == SEMI) {
+            S.nextToken();
+            return toP(F.at(pos).Skip());
+        } else {
+            String dc = S.docComment();
+            return classOrInterfaceOrEnumDeclaration(modifiersOpt(mods), dc);
+        }
+    }
+
+    /** ClassOrInterfaceOrEnumDeclaration = ModifiersOpt
+     *           (ClassDeclaration | InterfaceDeclaration | EnumDeclaration)
+     *  @param mods     Any modifiers starting the class or interface declaration
+     *  @param dc       The documentation comment for the class, or null.
+     */
+    JCStatement classOrInterfaceOrEnumDeclaration(JCModifiers mods, String dc) {
+        if (S.token() == CLASS) {
+            return classDeclaration(mods, dc);
+        } else if (S.token() == INTERFACE) {
+            return interfaceDeclaration(mods, dc);
+        } else if (allowEnums) {
+            if (S.token() == ENUM) {
+                return enumDeclaration(mods, dc);
+            } else {
+                int pos = S.pos();
+                List<JCTree> errs;
+                if (S.token() == IDENTIFIER) {
+                    errs = List.<JCTree>of(mods, toP(F.at(pos).Ident(ident())));
+                    setErrorEndPos(S.pos());
+                } else {
+                    errs = List.<JCTree>of(mods);
+                }
+                return toP(F.Exec(syntaxError(pos, errs, "expected3",
+                                              CLASS, INTERFACE, ENUM)));
+            }
+        } else {
+            if (S.token() == ENUM) {
+                log.error(S.pos(), "enums.not.supported.in.source", source.name);
+                allowEnums = true;
+                return enumDeclaration(mods, dc);
+            }
+            int pos = S.pos();
+            List<JCTree> errs;
+            if (S.token() == IDENTIFIER) {
+                errs = List.<JCTree>of(mods, toP(F.at(pos).Ident(ident())));
+                setErrorEndPos(S.pos());
+            } else {
+                errs = List.<JCTree>of(mods);
+            }
+            return toP(F.Exec(syntaxError(pos, errs, "expected2",
+                                          CLASS, INTERFACE)));
+        }
+    }
+
+    /** ClassDeclaration = CLASS Ident TypeParametersOpt [EXTENDS Type]
+     *                     [IMPLEMENTS TypeList] ClassBody
+     *  @param mods    The modifiers starting the class declaration
+     *  @param dc       The documentation comment for the class, or null.
+     */
+    JCClassDecl classDeclaration(JCModifiers mods, String dc) {
+        int pos = S.pos();
+        accept(CLASS);
+        Name name = ident();
+
+        List<JCTypeParameter> typarams = typeParametersOpt();
+
+        JCTree extending = null;
+        if (S.token() == EXTENDS) {
+            S.nextToken();
+            extending = parseType();
+        }
+        List<JCExpression> implementing = List.nil();
+        if (S.token() == IMPLEMENTS) {
+            S.nextToken();
+            implementing = typeList();
+        }
+        List<JCTree> defs = classOrInterfaceBody(name, false);
+        JCClassDecl result = toP(F.at(pos).ClassDef(
+            mods, name, typarams, extending, implementing, defs));
+        attach(result, dc);
+        return result;
+    }
+
+    /** InterfaceDeclaration = INTERFACE Ident TypeParametersOpt
+     *                         [EXTENDS TypeList] InterfaceBody
+     *  @param mods    The modifiers starting the interface declaration
+     *  @param dc       The documentation comment for the interface, or null.
+     */
+    JCClassDecl interfaceDeclaration(JCModifiers mods, String dc) {
+        int pos = S.pos();
+        accept(INTERFACE);
+        Name name = ident();
+
+        List<JCTypeParameter> typarams = typeParametersOpt();
+
+        List<JCExpression> extending = List.nil();
+        if (S.token() == EXTENDS) {
+            S.nextToken();
+            extending = typeList();
+        }
+        List<JCTree> defs = classOrInterfaceBody(name, true);
+        JCClassDecl result = toP(F.at(pos).ClassDef(
+            mods, name, typarams, null, extending, defs));
+        attach(result, dc);
+        return result;
+    }
+
+    /** EnumDeclaration = ENUM Ident [IMPLEMENTS TypeList] EnumBody
+     *  @param mods    The modifiers starting the enum declaration
+     *  @param dc       The documentation comment for the enum, or null.
+     */
+    JCClassDecl enumDeclaration(JCModifiers mods, String dc) {
+        int pos = S.pos();
+        accept(ENUM);
+        Name name = ident();
+
+        List<JCExpression> implementing = List.nil();
+        if (S.token() == IMPLEMENTS) {
+            S.nextToken();
+            implementing = typeList();
+        }
+
+        List<JCTree> defs = enumBody(name);
+        JCModifiers newMods =
+            F.at(mods.pos).Modifiers(mods.flags|Flags.ENUM, mods.annotations);
+        JCClassDecl result = toP(F.at(pos).
+            ClassDef(newMods, name, List.<JCTypeParameter>nil(),
+                null, implementing, defs));
+        attach(result, dc);
+        return result;
+    }
+
+    /** EnumBody = "{" { EnumeratorDeclarationList } [","]
+     *                  [ ";" {ClassBodyDeclaration} ] "}"
+     */
+    List<JCTree> enumBody(Name enumName) {
+        accept(LBRACE);
+        ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
+        if (S.token() == COMMA) {
+            S.nextToken();
+        } else if (S.token() != RBRACE && S.token() != SEMI) {
+            defs.append(enumeratorDeclaration(enumName));
+            while (S.token() == COMMA) {
+                S.nextToken();
+                if (S.token() == RBRACE || S.token() == SEMI) break;
+                defs.append(enumeratorDeclaration(enumName));
+            }
+            if (S.token() != SEMI && S.token() != RBRACE) {
+                defs.append(syntaxError(S.pos(), "expected3",
+                                COMMA, RBRACE, SEMI));
+                S.nextToken();
+            }
+        }
+        if (S.token() == SEMI) {
+            S.nextToken();
+            while (S.token() != RBRACE && S.token() != EOF) {
+                defs.appendList(classOrInterfaceBodyDeclaration(enumName,
+                                                                false));
+                if (S.pos() <= errorEndPos) {
+                    // error recovery
+                   skip(false, true, true, false);
+                }
+            }
+        }
+        accept(RBRACE);
+        return defs.toList();
+    }
+
+    /** EnumeratorDeclaration = AnnotationsOpt [TypeArguments] IDENTIFIER [ Arguments ] [ "{" ClassBody "}" ]
+     */
+    JCTree enumeratorDeclaration(Name enumName) {
+        String dc = S.docComment();
+        int flags = Flags.PUBLIC|Flags.STATIC|Flags.FINAL|Flags.ENUM;
+        if (S.deprecatedFlag()) {
+            flags |= Flags.DEPRECATED;
+            S.resetDeprecatedFlag();
+        }
+        int pos = S.pos();
+        List<JCAnnotation> annotations = annotationsOpt();
+        JCModifiers mods = F.at(annotations.isEmpty() ? Position.NOPOS : pos).Modifiers(flags, annotations);
+        List<JCExpression> typeArgs = typeArgumentsOpt();
+        int identPos = S.pos();
+        Name name = ident();
+        int createPos = S.pos();
+        List<JCExpression> args = (S.token() == LPAREN)
+            ? arguments() : List.<JCExpression>nil();
+        JCClassDecl body = null;
+        if (S.token() == LBRACE) {
+            JCModifiers mods1 = F.at(Position.NOPOS).Modifiers(Flags.ENUM | Flags.STATIC);
+            List<JCTree> defs = classOrInterfaceBody(names.empty, false);
+            body = toP(F.at(identPos).AnonymousClassDef(mods1, defs));
+        }
+        if (args.isEmpty() && body == null)
+            createPos = Position.NOPOS;
+        JCIdent ident = F.at(Position.NOPOS).Ident(enumName);
+        JCNewClass create = F.at(createPos).NewClass(null, typeArgs, ident, args, body);
+        if (createPos != Position.NOPOS)
+            storeEnd(create, S.prevEndPos());
+        ident = F.at(Position.NOPOS).Ident(enumName);
+        JCTree result = toP(F.at(pos).VarDef(mods, name, ident, create));
+        attach(result, dc);
+        return result;
+    }
+
+    /** TypeList = Type {"," Type}
+     */
+    List<JCExpression> typeList() {
+        ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
+        ts.append(parseType());
+        while (S.token() == COMMA) {
+            S.nextToken();
+            ts.append(parseType());
+        }
+        return ts.toList();
+    }
+
+    /** ClassBody     = "{" {ClassBodyDeclaration} "}"
+     *  InterfaceBody = "{" {InterfaceBodyDeclaration} "}"
+     */
+    List<JCTree> classOrInterfaceBody(Name className, boolean isInterface) {
+        accept(LBRACE);
+        if (S.pos() <= errorEndPos) {
+            // error recovery
+            skip(false, true, false, false);
+            if (S.token() == LBRACE)
+                S.nextToken();
+        }
+        ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
+        while (S.token() != RBRACE && S.token() != EOF) {
+            defs.appendList(classOrInterfaceBodyDeclaration(className, isInterface));
+            if (S.pos() <= errorEndPos) {
+               // error recovery
+               skip(false, true, true, false);
+           }
+        }
+        accept(RBRACE);
+        return defs.toList();
+    }
+
+    /** ClassBodyDeclaration =
+     *      ";"
+     *    | [STATIC] Block
+     *    | ModifiersOpt
+     *      ( Type Ident
+     *        ( VariableDeclaratorsRest ";" | MethodDeclaratorRest )
+     *      | VOID Ident MethodDeclaratorRest
+     *      | TypeParameters (Type | VOID) Ident MethodDeclaratorRest
+     *      | Ident ConstructorDeclaratorRest
+     *      | TypeParameters Ident ConstructorDeclaratorRest
+     *      | ClassOrInterfaceOrEnumDeclaration
+     *      )
+     *  InterfaceBodyDeclaration =
+     *      ";"
+     *    | ModifiersOpt Type Ident
+     *      ( ConstantDeclaratorsRest | InterfaceMethodDeclaratorRest ";" )
+     */
+    List<JCTree> classOrInterfaceBodyDeclaration(Name className, boolean isInterface) {
+        if (S.token() == SEMI) {
+            S.nextToken();
+            return List.<JCTree>of(F.at(Position.NOPOS).Block(0, List.<JCStatement>nil()));
+        } else {
+            String dc = S.docComment();
+            int pos = S.pos();
+            JCModifiers mods = modifiersOpt();
+            if (S.token() == CLASS ||
+                S.token() == INTERFACE ||
+                allowEnums && S.token() == ENUM) {
+                return List.<JCTree>of(classOrInterfaceOrEnumDeclaration(mods, dc));
+            } else if (S.token() == LBRACE && !isInterface &&
+                       (mods.flags & Flags.StandardFlags & ~Flags.STATIC) == 0 &&
+                       mods.annotations.isEmpty()) {
+                return List.<JCTree>of(block(pos, mods.flags));
+            } else {
+                pos = S.pos();
+                List<JCTypeParameter> typarams = typeParametersOpt();
+                // Hack alert:  if there are type arguments but no Modifiers, the start
+                // position will be lost unless we set the Modifiers position.  There
+                // should be an AST node for type parameters (BugId 5005090).
+                if (typarams.length() > 0 && mods.pos == Position.NOPOS) {
+                    mods.pos = pos;
+                }
+                Token token = S.token();
+                Name name = S.name();
+                pos = S.pos();
+                JCExpression type;
+                boolean isVoid = S.token() == VOID;
+                if (isVoid) {
+                    type = to(F.at(pos).TypeIdent(TypeTags.VOID));
+                    S.nextToken();
+                } else {
+                    type = parseType();
+                }
+                if (S.token() == LPAREN && !isInterface && type.getTag() == JCTree.IDENT) {
+                    if (isInterface || name != className)
+                        log.error(pos, "invalid.meth.decl.ret.type.req");
+                    return List.of(methodDeclaratorRest(
+                        pos, mods, null, names.init, typarams,
+                        isInterface, true, dc));
+                } else {
+                    pos = S.pos();
+                    name = ident();
+                    if (S.token() == LPAREN) {
+                        return List.of(methodDeclaratorRest(
+                            pos, mods, type, name, typarams,
+                            isInterface, isVoid, dc));
+                    } else if (!isVoid && typarams.isEmpty()) {
+                        List<JCTree> defs =
+                            variableDeclaratorsRest(pos, mods, type, name, isInterface, dc,
+                                                    new ListBuffer<JCTree>()).toList();
+                        storeEnd(defs.last(), S.endPos());
+                        accept(SEMI);
+                        return defs;
+                    } else {
+                        pos = S.pos();
+                        List<JCTree> err = isVoid
+                            ? List.<JCTree>of(toP(F.at(pos).MethodDef(mods, name, type, typarams,
+                                List.<JCVariableDecl>nil(), List.<JCExpression>nil(), null, null)))
+                            : null;
+                        return List.<JCTree>of(syntaxError(S.pos(), err, "expected", LPAREN));
+                    }
+                }
+            }
+        }
+    }
+
+    /** MethodDeclaratorRest =
+     *      FormalParameters BracketsOpt [Throws TypeList] ( MethodBody | [DEFAULT AnnotationValue] ";")
+     *  VoidMethodDeclaratorRest =
+     *      FormalParameters [Throws TypeList] ( MethodBody | ";")
+     *  InterfaceMethodDeclaratorRest =
+     *      FormalParameters BracketsOpt [THROWS TypeList] ";"
+     *  VoidInterfaceMethodDeclaratorRest =
+     *      FormalParameters [THROWS TypeList] ";"
+     *  ConstructorDeclaratorRest =
+     *      "(" FormalParameterListOpt ")" [THROWS TypeList] MethodBody
+     */
+    JCTree methodDeclaratorRest(int pos,
+                              JCModifiers mods,
+                              JCExpression type,
+                              Name name,
+                              List<JCTypeParameter> typarams,
+                              boolean isInterface, boolean isVoid,
+                              String dc) {
+        List<JCVariableDecl> params = formalParameters();
+        if (!isVoid) type = bracketsOpt(type);
+        List<JCExpression> thrown = List.nil();
+        if (S.token() == THROWS) {
+            S.nextToken();
+            thrown = qualidentList();
+        }
+        JCBlock body = null;
+        JCExpression defaultValue;
+        if (S.token() == LBRACE) {
+            body = block();
+            defaultValue = null;
+        } else {
+            if (S.token() == DEFAULT) {
+                accept(DEFAULT);
+                defaultValue = annotationValue();
+            } else {
+                defaultValue = null;
+            }
+            accept(SEMI);
+            if (S.pos() <= errorEndPos) {
+                // error recovery
+                skip(false, true, false, false);
+                if (S.token() == LBRACE) {
+                    body = block();
+                }
+            }
+        }
+        JCMethodDecl result =
+            toP(F.at(pos).MethodDef(mods, name, type, typarams,
+                                    params, thrown,
+                                    body, defaultValue));
+        attach(result, dc);
+        return result;
+    }
+
+    /** QualidentList = Qualident {"," Qualident}
+     */
+    List<JCExpression> qualidentList() {
+        ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
+        ts.append(qualident());
+        while (S.token() == COMMA) {
+            S.nextToken();
+            ts.append(qualident());
+        }
+        return ts.toList();
+    }
+
+    /** TypeParametersOpt = ["<" TypeParameter {"," TypeParameter} ">"]
+     */
+    List<JCTypeParameter> typeParametersOpt() {
+        if (S.token() == LT) {
+            checkGenerics();
+            ListBuffer<JCTypeParameter> typarams = new ListBuffer<JCTypeParameter>();
+            S.nextToken();
+            typarams.append(typeParameter());
+            while (S.token() == COMMA) {
+                S.nextToken();
+                typarams.append(typeParameter());
+            }
+            accept(GT);
+            return typarams.toList();
+        } else {
+            return List.nil();
+        }
+    }
+
+    /** TypeParameter = TypeVariable [TypeParameterBound]
+     *  TypeParameterBound = EXTENDS Type {"&" Type}
+     *  TypeVariable = Ident
+     */
+    JCTypeParameter typeParameter() {
+        int pos = S.pos();
+        Name name = ident();
+        ListBuffer<JCExpression> bounds = new ListBuffer<JCExpression>();
+        if (S.token() == EXTENDS) {
+            S.nextToken();
+            bounds.append(parseType());
+            while (S.token() == AMP) {
+                S.nextToken();
+                bounds.append(parseType());
+            }
+        }
+        return toP(F.at(pos).TypeParameter(name, bounds.toList()));
+    }
+
+    /** FormalParameters = "(" [ FormalParameterList ] ")"
+     *  FormalParameterList = [ FormalParameterListNovarargs , ] LastFormalParameter
+     *  FormalParameterListNovarargs = [ FormalParameterListNovarargs , ] FormalParameter
+     */
+    List<JCVariableDecl> formalParameters() {
+        ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
+        JCVariableDecl lastParam = null;
+        accept(LPAREN);
+        if (S.token() != RPAREN) {
+            params.append(lastParam = formalParameter());
+            while ((lastParam.mods.flags & Flags.VARARGS) == 0 && S.token() == COMMA) {
+                S.nextToken();
+                params.append(lastParam = formalParameter());
+            }
+        }
+        accept(RPAREN);
+        return params.toList();
+    }
+
+    JCModifiers optFinal(long flags) {
+        JCModifiers mods = modifiersOpt();
+        checkNoMods(mods.flags & ~(Flags.FINAL | Flags.DEPRECATED));
+        mods.flags |= flags;
+        return mods;
+    }
+
+    /** FormalParameter = { FINAL | '@' Annotation } Type VariableDeclaratorId
+     *  LastFormalParameter = { FINAL | '@' Annotation } Type '...' Ident | FormalParameter
+     */
+    JCVariableDecl formalParameter() {
+        JCModifiers mods = optFinal(Flags.PARAMETER);
+        JCExpression type = parseType();
+        if (S.token() == ELLIPSIS) {
+            checkVarargs();
+            mods.flags |= Flags.VARARGS;
+            type = to(F.at(S.pos()).TypeArray(type));
+            S.nextToken();
+        }
+        return variableDeclaratorId(mods, type);
+    }
+
+/* ---------- auxiliary methods -------------- */
+
+    /** Check that given tree is a legal expression statement.
+     */
+    protected JCExpression checkExprStat(JCExpression t) {
+        switch(t.getTag()) {
+        case JCTree.PREINC: case JCTree.PREDEC:
+        case JCTree.POSTINC: case JCTree.POSTDEC:
+        case JCTree.ASSIGN:
+        case JCTree.BITOR_ASG: case JCTree.BITXOR_ASG: case JCTree.BITAND_ASG:
+        case JCTree.SL_ASG: case JCTree.SR_ASG: case JCTree.USR_ASG:
+        case JCTree.PLUS_ASG: case JCTree.MINUS_ASG:
+        case JCTree.MUL_ASG: case JCTree.DIV_ASG: case JCTree.MOD_ASG:
+        case JCTree.APPLY: case JCTree.NEWCLASS:
+        case JCTree.ERRONEOUS:
+            return t;
+        default:
+            log.error(t.pos, "not.stmt");
+            return F.at(t.pos).Erroneous(List.<JCTree>of(t));
+        }
+    }
+
+    /** Return precedence of operator represented by token,
+     *  -1 if token is not a binary operator. @see TreeInfo.opPrec
+     */
+    static int prec(Token token) {
+        int oc = optag(token);
+        return (oc >= 0) ? TreeInfo.opPrec(oc) : -1;
+    }
+
+    /** Return operation tag of binary operator represented by token,
+     *  -1 if token is not a binary operator.
+     */
+    static int optag(Token token) {
+        switch (token) {
+        case BARBAR:
+            return JCTree.OR;
+        case AMPAMP:
+            return JCTree.AND;
+        case BAR:
+            return JCTree.BITOR;
+        case BAREQ:
+            return JCTree.BITOR_ASG;
+        case CARET:
+            return JCTree.BITXOR;
+        case CARETEQ:
+            return JCTree.BITXOR_ASG;
+        case AMP:
+            return JCTree.BITAND;
+        case AMPEQ:
+            return JCTree.BITAND_ASG;
+        case EQEQ:
+            return JCTree.EQ;
+        case BANGEQ:
+            return JCTree.NE;
+        case LT:
+            return JCTree.LT;
+        case GT:
+            return JCTree.GT;
+        case LTEQ:
+            return JCTree.LE;
+        case GTEQ:
+            return JCTree.GE;
+        case LTLT:
+            return JCTree.SL;
+        case LTLTEQ:
+            return JCTree.SL_ASG;
+        case GTGT:
+            return JCTree.SR;
+        case GTGTEQ:
+            return JCTree.SR_ASG;
+        case GTGTGT:
+            return JCTree.USR;
+        case GTGTGTEQ:
+            return JCTree.USR_ASG;
+        case PLUS:
+            return JCTree.PLUS;
+        case PLUSEQ:
+            return JCTree.PLUS_ASG;
+        case SUB:
+            return JCTree.MINUS;
+        case SUBEQ:
+            return JCTree.MINUS_ASG;
+        case STAR:
+            return JCTree.MUL;
+        case STAREQ:
+            return JCTree.MUL_ASG;
+        case SLASH:
+            return JCTree.DIV;
+        case SLASHEQ:
+            return JCTree.DIV_ASG;
+        case PERCENT:
+            return JCTree.MOD;
+        case PERCENTEQ:
+            return JCTree.MOD_ASG;
+        case INSTANCEOF:
+            return JCTree.TYPETEST;
+        default:
+            return -1;
+        }
+    }
+
+    /** Return operation tag of unary operator represented by token,
+     *  -1 if token is not a binary operator.
+     */
+    static int unoptag(Token token) {
+        switch (token) {
+        case PLUS:
+            return JCTree.POS;
+        case SUB:
+            return JCTree.NEG;
+        case BANG:
+            return JCTree.NOT;
+        case TILDE:
+            return JCTree.COMPL;
+        case PLUSPLUS:
+            return JCTree.PREINC;
+        case SUBSUB:
+            return JCTree.PREDEC;
+        default:
+            return -1;
+        }
+    }
+
+    /** Return type tag of basic type represented by token,
+     *  -1 if token is not a basic type identifier.
+     */
+    static int typetag(Token token) {
+        switch (token) {
+        case BYTE:
+            return TypeTags.BYTE;
+        case CHAR:
+            return TypeTags.CHAR;
+        case SHORT:
+            return TypeTags.SHORT;
+        case INT:
+            return TypeTags.INT;
+        case LONG:
+            return TypeTags.LONG;
+        case FLOAT:
+            return TypeTags.FLOAT;
+        case DOUBLE:
+            return TypeTags.DOUBLE;
+        case BOOLEAN:
+            return TypeTags.BOOLEAN;
+        default:
+            return -1;
+        }
+    }
+
+    void checkGenerics() {
+        if (!allowGenerics) {
+            log.error(S.pos(), "generics.not.supported.in.source", source.name);
+            allowGenerics = true;
+        }
+    }
+    void checkVarargs() {
+        if (!allowVarargs) {
+            log.error(S.pos(), "varargs.not.supported.in.source", source.name);
+            allowVarargs = true;
+        }
+    }
+    void checkForeach() {
+        if (!allowForeach) {
+            log.error(S.pos(), "foreach.not.supported.in.source", source.name);
+            allowForeach = true;
+        }
+    }
+    void checkStaticImports() {
+        if (!allowStaticImport) {
+            log.error(S.pos(), "static.import.not.supported.in.source", source.name);
+            allowStaticImport = true;
+        }
+    }
+    void checkAnnotations() {
+        if (!allowAnnotations) {
+            log.error(S.pos(), "annotations.not.supported.in.source", source.name);
+            allowAnnotations = true;
+        }
+    }
+}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java b/langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java
index 986ce14..bec19a7 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
@@ -28,6 +28,7 @@
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
 
 import static com.sun.tools.javac.parser.Token.*;
 
@@ -51,12 +52,12 @@
     }
 
     private final Log log;
-    private final Name.Table names;
+    private final Names names;
 
     protected Keywords(Context context) {
         context.put(keywordsKey, this);
         log = Log.instance(context);
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
 
         for (Token t : Token.values()) {
             if (t.name != null)
@@ -69,13 +70,13 @@
         for (int i = 0; i <= maxKey; i++) key[i] = IDENTIFIER;
         for (Token t : Token.values()) {
             if (t.name != null)
-                key[tokenName[t.ordinal()].index] = t;
+                key[tokenName[t.ordinal()].getIndex()] = t;
         }
     }
 
 
     public Token key(Name name) {
-        return (name.index > maxKey) ? IDENTIFIER : key[name.index];
+        return (name.getIndex() > maxKey) ? IDENTIFIER : key[name.getIndex()];
     }
 
     /**
@@ -94,6 +95,6 @@
     private void enterKeyword(String s, Token token) {
         Name n = names.fromString(s);
         tokenName[token.ordinal()] = n;
-        if (n.index > maxKey) maxKey = n.index;
+        if (n.getIndex() > maxKey) maxKey = n.getIndex();
     }
 }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/Parser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/Parser.java
index 862dd31..fdf312b 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Parser.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Parser.java
@@ -23,2834 +23,44 @@
  * have any questions.
  */
 
+
 package com.sun.tools.javac.parser;
 
-import java.util.*;
+import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.JCTree.JCStatement;
 
-import com.sun.tools.javac.tree.*;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.util.List;
-import static com.sun.tools.javac.util.ListBuffer.lb;
-
-import com.sun.tools.javac.tree.JCTree.*;
-
-import static com.sun.tools.javac.parser.Token.*;
-
-/** The parser maps a token sequence into an abstract syntax
- *  tree. It operates by recursive descent, with code derived
- *  systematically from an LL(1) grammar. For efficiency reasons, an
- *  operator precedence scheme is used for parsing binary operation
- *  expressions.
+/**
+ * Reads syntactic units from source code.
+ * Parsers are normally created from a ParserFactory.
  *
- *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
- *  you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
+ * <p><b>This is NOT part of any API supported by Sun Microsystems.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
  */
-public class Parser {
-
-    /** A factory for creating parsers. */
-    public static class Factory {
-        /** The context key for the parser factory. */
-        protected static final Context.Key<Parser.Factory> parserFactoryKey =
-            new Context.Key<Parser.Factory>();
-
-        /** Get the Factory instance for this context. */
-        public static Factory instance(Context context) {
-            Factory instance = context.get(parserFactoryKey);
-            if (instance == null)
-                instance = new Factory(context);
-            return instance;
-        }
-
-        final TreeMaker F;
-        final Log log;
-        final Keywords keywords;
-        final Source source;
-        final Name.Table names;
-        final Options options;
-
-        /** Create a new parser factory. */
-        protected Factory(Context context) {
-            context.put(parserFactoryKey, this);
-            this.F = TreeMaker.instance(context);
-            this.log = Log.instance(context);
-            this.names = Name.Table.instance(context);
-            this.keywords = Keywords.instance(context);
-            this.source = Source.instance(context);
-            this.options = Options.instance(context);
-        }
-
-        /**
-         * Create a new Parser.
-         * @param S Lexer for getting tokens while parsing
-         * @param keepDocComments true if javadoc comments should be kept
-         * @param genEndPos true if end positions should be generated
-         */
-        public Parser newParser(Lexer S, boolean keepDocComments, boolean genEndPos) {
-            if (!genEndPos)
-                return new Parser(this, S, keepDocComments);
-            else
-                return new EndPosParser(this, S, keepDocComments);
-        }
-    }
-
-    /** The number of precedence levels of infix operators.
-     */
-    private static final int infixPrecedenceLevels = 10;
-
-    /** The scanner used for lexical analysis.
-     */
-    private Lexer S;
-
-    /** The factory to be used for abstract syntax tree construction.
-     */
-    protected TreeMaker F;
-
-    /** The log to be used for error diagnostics.
-     */
-    private Log log;
-
-    /** The keyword table. */
-    private Keywords keywords;
-
-    /** The Source language setting. */
-    private Source source;
-
-    /** The name table. */
-    private Name.Table names;
-
-    /** Construct a parser from a given scanner, tree factory and log.
-     */
-    protected Parser(Factory fac,
-                     Lexer S,
-                     boolean keepDocComments) {
-        this.S = S;
-        S.nextToken(); // prime the pump
-        this.F = fac.F;
-        this.log = fac.log;
-        this.names = fac.names;
-        this.keywords = fac.keywords;
-        this.source = fac.source;
-        Options options = fac.options;
-        this.allowGenerics = source.allowGenerics();
-        this.allowVarargs = source.allowVarargs();
-        this.allowAsserts = source.allowAsserts();
-        this.allowEnums = source.allowEnums();
-        this.allowForeach = source.allowForeach();
-        this.allowStaticImport = source.allowStaticImport();
-        this.allowAnnotations = source.allowAnnotations();
-        this.keepDocComments = keepDocComments;
-        if (keepDocComments) docComments = new HashMap<JCTree,String>();
-        this.errorTree = F.Erroneous();
-    }
-
-    /** Switch: Should generics be recognized?
-     */
-    boolean allowGenerics;
-
-    /** Switch: Should varargs be recognized?
-     */
-    boolean allowVarargs;
-
-    /** Switch: should we recognize assert statements, or just give a warning?
-     */
-    boolean allowAsserts;
-
-    /** Switch: should we recognize enums, or just give a warning?
-     */
-    boolean allowEnums;
-
-    /** Switch: should we recognize foreach?
-     */
-    boolean allowForeach;
-
-    /** Switch: should we recognize foreach?
-     */
-    boolean allowStaticImport;
-
-    /** Switch: should we recognize annotations?
-     */
-    boolean allowAnnotations;
-
-    /** Switch: should we keep docComments?
-     */
-    boolean keepDocComments;
-
-    /** When terms are parsed, the mode determines which is expected:
-     *     mode = EXPR        : an expression
-     *     mode = TYPE        : a type
-     *     mode = NOPARAMS    : no parameters allowed for type
-     *     mode = TYPEARG     : type argument
-     */
-    static final int EXPR = 1;
-    static final int TYPE = 2;
-    static final int NOPARAMS = 4;
-    static final int TYPEARG = 8;
-
-    /** The current mode.
-     */
-    private int mode = 0;
-
-    /** The mode of the term that was parsed last.
-     */
-    private int lastmode = 0;
-
-/* ---------- error recovery -------------- */
-
-    private JCErroneous errorTree;
-
-    /** Skip forward until a suitable stop token is found.
-     */
-    private void skip(boolean stopAtImport, boolean stopAtMemberDecl, boolean stopAtIdentifier, boolean stopAtStatement) {
-         while (true) {
-             switch (S.token()) {
-                case SEMI:
-                    S.nextToken();
-                    return;
-                case PUBLIC:
-                case FINAL:
-                case ABSTRACT:
-                case MONKEYS_AT:
-                case EOF:
-                case CLASS:
-                case INTERFACE:
-                case ENUM:
-                    return;
-                case IMPORT:
-                    if (stopAtImport)
-                        return;
-                    break;
-                case LBRACE:
-                case RBRACE:
-                case PRIVATE:
-                case PROTECTED:
-                case STATIC:
-                case TRANSIENT:
-                case NATIVE:
-                case VOLATILE:
-                case SYNCHRONIZED:
-                case STRICTFP:
-                case LT:
-                case BYTE:
-                case SHORT:
-                case CHAR:
-                case INT:
-                case LONG:
-                case FLOAT:
-                case DOUBLE:
-                case BOOLEAN:
-                case VOID:
-                    if (stopAtMemberDecl)
-                        return;
-                    break;
-                case IDENTIFIER:
-                   if (stopAtIdentifier)
-                        return;
-                    break;
-                case CASE:
-                case DEFAULT:
-                case IF:
-                case FOR:
-                case WHILE:
-                case DO:
-                case TRY:
-                case SWITCH:
-                case RETURN:
-                case THROW:
-                case BREAK:
-                case CONTINUE:
-                case ELSE:
-                case FINALLY:
-                case CATCH:
-                    if (stopAtStatement)
-                        return;
-                    break;
-            }
-            S.nextToken();
-        }
-    }
-
-    private JCErroneous syntaxError(int pos, String key, Token... args) {
-        return syntaxError(pos, null, key, args);
-    }
-
-    private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, Token... args) {
-        setErrorEndPos(pos);
-        reportSyntaxError(pos, key, (Object[])args);
-        return toP(F.at(pos).Erroneous(errs));
-    }
-
-    private int errorPos = Position.NOPOS;
+public interface Parser {
     /**
-     * Report a syntax error at given position using the given
-     * argument unless one was already reported at the same position.
+     * Parse a compilation unit.
+     * @return a compilation unit
      */
-    private void reportSyntaxError(int pos, String key, Object... args) {
-        if (pos > S.errPos() || pos == Position.NOPOS) {
-            if (S.token() == EOF)
-                log.error(pos, "premature.eof");
-            else
-                log.error(pos, key, args);
-        }
-        S.errPos(pos);
-        if (S.pos() == errorPos)
-            S.nextToken(); // guarantee progress
-        errorPos = S.pos();
-    }
-
-
-    /** Generate a syntax error at current position unless one was already
-     *  reported at the same position.
-     */
-    private JCErroneous syntaxError(String key) {
-        return syntaxError(S.pos(), key);
-    }
-
-    /** Generate a syntax error at current position unless one was
-     *  already reported at the same position.
-     */
-    private JCErroneous syntaxError(String key, Token arg) {
-        return syntaxError(S.pos(), key, arg);
-    }
-
-    /** If next input token matches given token, skip it, otherwise report
-     *  an error.
-     */
-    public void accept(Token token) {
-        if (S.token() == token) {
-            S.nextToken();
-        } else {
-            setErrorEndPos(S.pos());
-            reportSyntaxError(S.prevEndPos(), "expected", token);
-        }
-    }
-
-    /** Report an illegal start of expression/type error at given position.
-     */
-    JCExpression illegal(int pos) {
-        setErrorEndPos(S.pos());
-        if ((mode & EXPR) != 0)
-            return syntaxError(pos, "illegal.start.of.expr");
-        else
-            return syntaxError(pos, "illegal.start.of.type");
-
-    }
-
-    /** Report an illegal start of expression/type error at current position.
-     */
-    JCExpression illegal() {
-        return illegal(S.pos());
-    }
-
-    /** Diagnose a modifier flag from the set, if any. */
-    void checkNoMods(long mods) {
-        if (mods != 0) {
-            long lowestMod = mods & -mods;
-            log.error(S.pos(), "mod.not.allowed.here",
-                      Flags.asFlagSet(lowestMod));
-        }
-    }
-
-/* ---------- doc comments --------- */
-
-    /** A hashtable to store all documentation comments
-     *  indexed by the tree nodes they refer to.
-     *  defined only if option flag keepDocComment is set.
-     */
-    Map<JCTree, String> docComments;
-
-    /** Make an entry into docComments hashtable,
-     *  provided flag keepDocComments is set and given doc comment is non-null.
-     *  @param tree   The tree to be used as index in the hashtable
-     *  @param dc     The doc comment to associate with the tree, or null.
-     */
-    void attach(JCTree tree, String dc) {
-        if (keepDocComments && dc != null) {
-//          System.out.println("doc comment = ");System.out.println(dc);//DEBUG
-            docComments.put(tree, dc);
-        }
-    }
-
-/* -------- source positions ------- */
-
-    private int errorEndPos = -1;
-
-    private void setErrorEndPos(int errPos) {
-        if (errPos > errorEndPos)
-            errorEndPos = errPos;
-    }
-
-    protected int getErrorEndPos() {
-        return errorEndPos;
-    }
+    JCCompilationUnit parseCompilationUnit();
 
     /**
-     * Store ending position for a tree.
-     * @param tree   The tree.
-     * @param endpos The ending position to associate with the tree.
+     * Parse an expression.
+     * @return an expression
      */
-    protected void storeEnd(JCTree tree, int endpos) {}
+    JCExpression parseExpression();
 
     /**
-     * Store ending position for a tree.  The ending position should
-     * be the ending position of the current token.
-     * @param t The tree.
+     * Parse a statement.
+     * @return an expression
      */
-    protected <T extends JCTree> T to(T t) { return t; }
+    JCStatement parseStatement();
 
     /**
-     * Store ending position for a tree.  The ending position should
-     * be greater of the ending position of the previous token and errorEndPos.
-     * @param t The tree.
+     * Parse a type.
+     * @return an expression for a type
      */
-    protected <T extends JCTree> T toP(T t) { return t; }
-
-    /** Get the start position for a tree node.  The start position is
-     * defined to be the position of the first character of the first
-     * token of the node's source text.
-     * @param tree  The tree node
-     */
-    public int getStartPos(JCTree tree) {
-        return TreeInfo.getStartPos(tree);
-    }
-
-    /**
-     * Get the end position for a tree node.  The end position is
-     * defined to be the position of the last character of the last
-     * token of the node's source text.  Returns Position.NOPOS if end
-     * positions are not generated or the position is otherwise not
-     * found.
-     * @param tree  The tree node
-     */
-    public int getEndPos(JCTree tree) {
-        return Position.NOPOS;
-    }
-
-
-
-/* ---------- parsing -------------- */
-
-    /**
-     * Ident = IDENTIFIER
-     */
-    Name ident() {
-        if (S.token() == IDENTIFIER) {
-            Name name = S.name();
-            S.nextToken();
-            return name;
-        } else if (S.token() == ASSERT) {
-            if (allowAsserts) {
-                log.error(S.pos(), "assert.as.identifier");
-                S.nextToken();
-                return names.error;
-            } else {
-                log.warning(S.pos(), "assert.as.identifier");
-                Name name = S.name();
-                S.nextToken();
-                return name;
-            }
-        } else if (S.token() == ENUM) {
-            if (allowEnums) {
-                log.error(S.pos(), "enum.as.identifier");
-                S.nextToken();
-                return names.error;
-            } else {
-                log.warning(S.pos(), "enum.as.identifier");
-                Name name = S.name();
-                S.nextToken();
-                return name;
-            }
-        } else {
-            accept(IDENTIFIER);
-            return names.error;
-        }
-}
-
-    /**
-     * Qualident = Ident { DOT Ident }
-     */
-    public JCExpression qualident() {
-        JCExpression t = toP(F.at(S.pos()).Ident(ident()));
-        while (S.token() == DOT) {
-            int pos = S.pos();
-            S.nextToken();
-            t = toP(F.at(pos).Select(t, ident()));
-        }
-        return t;
-    }
-
-    /**
-     * Literal =
-     *     INTLITERAL
-     *   | LONGLITERAL
-     *   | FLOATLITERAL
-     *   | DOUBLELITERAL
-     *   | CHARLITERAL
-     *   | STRINGLITERAL
-     *   | TRUE
-     *   | FALSE
-     *   | NULL
-     */
-    JCExpression literal(Name prefix) {
-        int pos = S.pos();
-        JCExpression t = errorTree;
-        switch (S.token()) {
-        case INTLITERAL:
-            try {
-                t = F.at(pos).Literal(
-                    TypeTags.INT,
-                    Convert.string2int(strval(prefix), S.radix()));
-            } catch (NumberFormatException ex) {
-                log.error(S.pos(), "int.number.too.large", strval(prefix));
-            }
-            break;
-        case LONGLITERAL:
-            try {
-                t = F.at(pos).Literal(
-                    TypeTags.LONG,
-                    new Long(Convert.string2long(strval(prefix), S.radix())));
-            } catch (NumberFormatException ex) {
-                log.error(S.pos(), "int.number.too.large", strval(prefix));
-            }
-            break;
-        case FLOATLITERAL: {
-            String proper = (S.radix() == 16 ? ("0x"+ S.stringVal()) : S.stringVal());
-            Float n;
-            try {
-                n = Float.valueOf(proper);
-            } catch (NumberFormatException ex) {
-                // error already repoted in scanner
-                n = Float.NaN;
-            }
-            if (n.floatValue() == 0.0f && !isZero(proper))
-                log.error(S.pos(), "fp.number.too.small");
-            else if (n.floatValue() == Float.POSITIVE_INFINITY)
-                log.error(S.pos(), "fp.number.too.large");
-            else
-                t = F.at(pos).Literal(TypeTags.FLOAT, n);
-            break;
-        }
-        case DOUBLELITERAL: {
-            String proper = (S.radix() == 16 ? ("0x"+ S.stringVal()) : S.stringVal());
-            Double n;
-            try {
-                n = Double.valueOf(proper);
-            } catch (NumberFormatException ex) {
-                // error already reported in scanner
-                n = Double.NaN;
-            }
-            if (n.doubleValue() == 0.0d && !isZero(proper))
-                log.error(S.pos(), "fp.number.too.small");
-            else if (n.doubleValue() == Double.POSITIVE_INFINITY)
-                log.error(S.pos(), "fp.number.too.large");
-            else
-                t = F.at(pos).Literal(TypeTags.DOUBLE, n);
-            break;
-        }
-        case CHARLITERAL:
-            t = F.at(pos).Literal(
-                TypeTags.CHAR,
-                S.stringVal().charAt(0) + 0);
-            break;
-        case STRINGLITERAL:
-            t = F.at(pos).Literal(
-                TypeTags.CLASS,
-                S.stringVal());
-            break;
-        case TRUE: case FALSE:
-            t = F.at(pos).Literal(
-                TypeTags.BOOLEAN,
-                (S.token() == TRUE ? 1 : 0));
-            break;
-        case NULL:
-            t = F.at(pos).Literal(
-                TypeTags.BOT,
-                null);
-            break;
-        default:
-            assert false;
-        }
-        if (t == errorTree)
-            t = F.at(pos).Erroneous();
-        storeEnd(t, S.endPos());
-        S.nextToken();
-        return t;
-    }
-//where
-        boolean isZero(String s) {
-            char[] cs = s.toCharArray();
-            int base = ((Character.toLowerCase(s.charAt(1)) == 'x') ? 16 : 10);
-            int i = ((base==16) ? 2 : 0);
-            while (i < cs.length && (cs[i] == '0' || cs[i] == '.')) i++;
-            return !(i < cs.length && (Character.digit(cs[i], base) > 0));
-        }
-
-        String strval(Name prefix) {
-            String s = S.stringVal();
-            return (prefix.len == 0) ? s : prefix + s;
-        }
-
-    /** terms can be either expressions or types.
-     */
-    public JCExpression expression() {
-        return term(EXPR);
-    }
-
-    public JCExpression type() {
-        return term(TYPE);
-    }
-
-    JCExpression term(int newmode) {
-        int prevmode = mode;
-        mode = newmode;
-        JCExpression t = term();
-        lastmode = mode;
-        mode = prevmode;
-        return t;
-    }
-
-    /**
-     *  Expression = Expression1 [ExpressionRest]
-     *  ExpressionRest = [AssignmentOperator Expression1]
-     *  AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" |
-     *                       "&=" | "|=" | "^=" |
-     *                       "%=" | "<<=" | ">>=" | ">>>="
-     *  Type = Type1
-     *  TypeNoParams = TypeNoParams1
-     *  StatementExpression = Expression
-     *  ConstantExpression = Expression
-     */
-    JCExpression term() {
-        JCExpression t = term1();
-        if ((mode & EXPR) != 0 &&
-            S.token() == EQ || PLUSEQ.compareTo(S.token()) <= 0 && S.token().compareTo(GTGTGTEQ) <= 0)
-            return termRest(t);
-        else
-            return t;
-    }
-
-    JCExpression termRest(JCExpression t) {
-        switch (S.token()) {
-        case EQ: {
-            int pos = S.pos();
-            S.nextToken();
-            mode = EXPR;
-            JCExpression t1 = term();
-            return toP(F.at(pos).Assign(t, t1));
-        }
-        case PLUSEQ:
-        case SUBEQ:
-        case STAREQ:
-        case SLASHEQ:
-        case PERCENTEQ:
-        case AMPEQ:
-        case BAREQ:
-        case CARETEQ:
-        case LTLTEQ:
-        case GTGTEQ:
-        case GTGTGTEQ:
-            int pos = S.pos();
-            Token token = S.token();
-            S.nextToken();
-            mode = EXPR;
-            JCExpression t1 = term();
-            return F.at(pos).Assignop(optag(token), t, t1);
-        default:
-            return t;
-        }
-    }
-
-    /** Expression1   = Expression2 [Expression1Rest]
-     *  Type1         = Type2
-     *  TypeNoParams1 = TypeNoParams2
-     */
-    JCExpression term1() {
-        JCExpression t = term2();
-        if ((mode & EXPR) != 0 && S.token() == QUES) {
-            mode = EXPR;
-            return term1Rest(t);
-        } else {
-            return t;
-        }
-    }
-
-    /** Expression1Rest = ["?" Expression ":" Expression1]
-     */
-    JCExpression term1Rest(JCExpression t) {
-        if (S.token() == QUES) {
-            int pos = S.pos();
-            S.nextToken();
-            JCExpression t1 = term();
-            accept(COLON);
-            JCExpression t2 = term1();
-            return F.at(pos).Conditional(t, t1, t2);
-        } else {
-            return t;
-        }
-    }
-
-    /** Expression2   = Expression3 [Expression2Rest]
-     *  Type2         = Type3
-     *  TypeNoParams2 = TypeNoParams3
-     */
-    JCExpression term2() {
-        JCExpression t = term3();
-        if ((mode & EXPR) != 0 && prec(S.token()) >= TreeInfo.orPrec) {
-            mode = EXPR;
-            return term2Rest(t, TreeInfo.orPrec);
-        } else {
-            return t;
-        }
-    }
-
-    /*  Expression2Rest = {infixop Expression3}
-     *                  | Expression3 instanceof Type
-     *  infixop         = "||"
-     *                  | "&&"
-     *                  | "|"
-     *                  | "^"
-     *                  | "&"
-     *                  | "==" | "!="
-     *                  | "<" | ">" | "<=" | ">="
-     *                  | "<<" | ">>" | ">>>"
-     *                  | "+" | "-"
-     *                  | "*" | "/" | "%"
-     */
-    JCExpression term2Rest(JCExpression t, int minprec) {
-        List<JCExpression[]> savedOd = odStackSupply.elems;
-        JCExpression[] odStack = newOdStack();
-        List<Token[]> savedOp = opStackSupply.elems;
-        Token[] opStack = newOpStack();
-        // optimization, was odStack = new Tree[...]; opStack = new Tree[...];
-        int top = 0;
-        odStack[0] = t;
-        int startPos = S.pos();
-        Token topOp = ERROR;
-        while (prec(S.token()) >= minprec) {
-            opStack[top] = topOp;
-            top++;
-            topOp = S.token();
-            int pos = S.pos();
-            S.nextToken();
-            odStack[top] = topOp == INSTANCEOF ? type() : term3();
-            while (top > 0 && prec(topOp) >= prec(S.token())) {
-                odStack[top-1] = makeOp(pos, topOp, odStack[top-1],
-                                        odStack[top]);
-                top--;
-                topOp = opStack[top];
-            }
-        }
-        assert top == 0;
-        t = odStack[0];
-
-        if (t.getTag() == JCTree.PLUS) {
-            StringBuffer buf = foldStrings(t);
-            if (buf != null) {
-                t = toP(F.at(startPos).Literal(TypeTags.CLASS, buf.toString()));
-            }
-        }
-
-        odStackSupply.elems = savedOd; // optimization
-        opStackSupply.elems = savedOp; // optimization
-        return t;
-    }
-//where
-        /** Construct a binary or type test node.
-         */
-        private JCExpression makeOp(int pos,
-                                    Token topOp,
-                                    JCExpression od1,
-                                    JCExpression od2)
-        {
-            if (topOp == INSTANCEOF) {
-                return F.at(pos).TypeTest(od1, od2);
-            } else {
-                return F.at(pos).Binary(optag(topOp), od1, od2);
-            }
-        }
-        /** If tree is a concatenation of string literals, replace it
-         *  by a single literal representing the concatenated string.
-         */
-        protected StringBuffer foldStrings(JCTree tree) {
-            List<String> buf = List.nil();
-            while (true) {
-                if (tree.getTag() == JCTree.LITERAL) {
-                    JCLiteral lit = (JCLiteral) tree;
-                    if (lit.typetag == TypeTags.CLASS) {
-                        StringBuffer sbuf =
-                            new StringBuffer((String)lit.value);
-                        while (buf.nonEmpty()) {
-                            sbuf.append(buf.head);
-                            buf = buf.tail;
-                        }
-                        return sbuf;
-                    }
-                } else if (tree.getTag() == JCTree.PLUS) {
-                    JCBinary op = (JCBinary)tree;
-                    if (op.rhs.getTag() == JCTree.LITERAL) {
-                        JCLiteral lit = (JCLiteral) op.rhs;
-                        if (lit.typetag == TypeTags.CLASS) {
-                            buf = buf.prepend((String) lit.value);
-                            tree = op.lhs;
-                            continue;
-                        }
-                    }
-                }
-                return null;
-            }
-        }
-
-        /** optimization: To save allocating a new operand/operator stack
-         *  for every binary operation, we use supplys.
-         */
-        ListBuffer<JCExpression[]> odStackSupply = new ListBuffer<JCExpression[]>();
-        ListBuffer<Token[]> opStackSupply = new ListBuffer<Token[]>();
-
-        private JCExpression[] newOdStack() {
-            if (odStackSupply.elems == odStackSupply.last)
-                odStackSupply.append(new JCExpression[infixPrecedenceLevels + 1]);
-            JCExpression[] odStack = odStackSupply.elems.head;
-            odStackSupply.elems = odStackSupply.elems.tail;
-            return odStack;
-        }
-
-        private Token[] newOpStack() {
-            if (opStackSupply.elems == opStackSupply.last)
-                opStackSupply.append(new Token[infixPrecedenceLevels + 1]);
-            Token[] opStack = opStackSupply.elems.head;
-            opStackSupply.elems = opStackSupply.elems.tail;
-            return opStack;
-        }
-
-    /** Expression3    = PrefixOp Expression3
-     *                 | "(" Expr | TypeNoParams ")" Expression3
-     *                 | Primary {Selector} {PostfixOp}
-     *  Primary        = "(" Expression ")"
-     *                 | Literal
-     *                 | [TypeArguments] THIS [Arguments]
-     *                 | [TypeArguments] SUPER SuperSuffix
-     *                 | NEW [TypeArguments] Creator
-     *                 | Ident { "." Ident }
-     *                   [ "[" ( "]" BracketsOpt "." CLASS | Expression "]" )
-     *                   | Arguments
-     *                   | "." ( CLASS | THIS | [TypeArguments] SUPER Arguments | NEW [TypeArguments] InnerCreator )
-     *                   ]
-     *                 | BasicType BracketsOpt "." CLASS
-     *  PrefixOp       = "++" | "--" | "!" | "~" | "+" | "-"
-     *  PostfixOp      = "++" | "--"
-     *  Type3          = Ident { "." Ident } [TypeArguments] {TypeSelector} BracketsOpt
-     *                 | BasicType
-     *  TypeNoParams3  = Ident { "." Ident } BracketsOpt
-     *  Selector       = "." [TypeArguments] Ident [Arguments]
-     *                 | "." THIS
-     *                 | "." [TypeArguments] SUPER SuperSuffix
-     *                 | "." NEW [TypeArguments] InnerCreator
-     *                 | "[" Expression "]"
-     *  TypeSelector   = "." Ident [TypeArguments]
-     *  SuperSuffix    = Arguments | "." Ident [Arguments]
-     */
-    protected JCExpression term3() {
-        int pos = S.pos();
-        JCExpression t;
-        List<JCExpression> typeArgs = typeArgumentsOpt(EXPR);
-        switch (S.token()) {
-        case QUES:
-            if ((mode & TYPE) != 0 && (mode & (TYPEARG|NOPARAMS)) == TYPEARG) {
-                mode = TYPE;
-                return typeArgument();
-            } else
-                return illegal();
-        case PLUSPLUS: case SUBSUB: case BANG: case TILDE: case PLUS: case SUB:
-            if (typeArgs == null && (mode & EXPR) != 0) {
-                Token token = S.token();
-                S.nextToken();
-                mode = EXPR;
-                if (token == SUB &&
-                    (S.token() == INTLITERAL || S.token() == LONGLITERAL) &&
-                    S.radix() == 10) {
-                    mode = EXPR;
-                    t = literal(names.hyphen);
-                } else {
-                    t = term3();
-                    return F.at(pos).Unary(unoptag(token), t);
-                }
-            } else return illegal();
-            break;
-        case LPAREN:
-            if (typeArgs == null && (mode & EXPR) != 0) {
-                S.nextToken();
-                mode = EXPR | TYPE | NOPARAMS;
-                t = term3();
-                if ((mode & TYPE) != 0 && S.token() == LT) {
-                    // Could be a cast to a parameterized type
-                    int op = JCTree.LT;
-                    int pos1 = S.pos();
-                    S.nextToken();
-                    mode &= (EXPR | TYPE);
-                    mode |= TYPEARG;
-                    JCExpression t1 = term3();
-                    if ((mode & TYPE) != 0 &&
-                        (S.token() == COMMA || S.token() == GT)) {
-                        mode = TYPE;
-                        ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
-                        args.append(t1);
-                        while (S.token() == COMMA) {
-                            S.nextToken();
-                            args.append(typeArgument());
-                        }
-                        accept(GT);
-                        t = F.at(pos1).TypeApply(t, args.toList());
-                        checkGenerics();
-                        t = bracketsOpt(toP(t));
-                    } else if ((mode & EXPR) != 0) {
-                        mode = EXPR;
-                        t = F.at(pos1).Binary(op, t, term2Rest(t1, TreeInfo.shiftPrec));
-                        t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec)));
-                    } else {
-                        accept(GT);
-                    }
-                } else {
-                    t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec)));
-                }
-                accept(RPAREN);
-                lastmode = mode;
-                mode = EXPR;
-                if ((lastmode & EXPR) == 0) {
-                    JCExpression t1 = term3();
-                    return F.at(pos).TypeCast(t, t1);
-                } else if ((lastmode & TYPE) != 0) {
-                    switch (S.token()) {
-                    /*case PLUSPLUS: case SUBSUB: */
-                    case BANG: case TILDE:
-                    case LPAREN: case THIS: case SUPER:
-                    case INTLITERAL: case LONGLITERAL: case FLOATLITERAL:
-                    case DOUBLELITERAL: case CHARLITERAL: case STRINGLITERAL:
-                    case TRUE: case FALSE: case NULL:
-                    case NEW: case IDENTIFIER: case ASSERT: case ENUM:
-                    case BYTE: case SHORT: case CHAR: case INT:
-                    case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case VOID:
-                        JCExpression t1 = term3();
-                        return F.at(pos).TypeCast(t, t1);
-                    }
-                }
-            } else return illegal();
-            t = toP(F.at(pos).Parens(t));
-            break;
-        case THIS:
-            if ((mode & EXPR) != 0) {
-                mode = EXPR;
-                t = to(F.at(pos).Ident(names._this));
-                S.nextToken();
-                if (typeArgs == null)
-                    t = argumentsOpt(null, t);
-                else
-                    t = arguments(typeArgs, t);
-                typeArgs = null;
-            } else return illegal();
-            break;
-        case SUPER:
-            if ((mode & EXPR) != 0) {
-                mode = EXPR;
-                t = to(superSuffix(typeArgs, F.at(pos).Ident(names._super)));
-                typeArgs = null;
-            } else return illegal();
-            break;
-        case INTLITERAL: case LONGLITERAL: case FLOATLITERAL: case DOUBLELITERAL:
-        case CHARLITERAL: case STRINGLITERAL:
-        case TRUE: case FALSE: case NULL:
-            if (typeArgs == null && (mode & EXPR) != 0) {
-                mode = EXPR;
-                t = literal(names.empty);
-            } else return illegal();
-            break;
-        case NEW:
-            if (typeArgs != null) return illegal();
-            if ((mode & EXPR) != 0) {
-                mode = EXPR;
-                S.nextToken();
-                if (S.token() == LT) typeArgs = typeArguments();
-                t = creator(pos, typeArgs);
-                typeArgs = null;
-            } else return illegal();
-            break;
-        case IDENTIFIER: case ASSERT: case ENUM:
-            if (typeArgs != null) return illegal();
-            t = toP(F.at(S.pos()).Ident(ident()));
-            loop: while (true) {
-                pos = S.pos();
-                switch (S.token()) {
-                case LBRACKET:
-                    S.nextToken();
-                    if (S.token() == RBRACKET) {
-                        S.nextToken();
-                        t = bracketsOpt(t);
-                        t = toP(F.at(pos).TypeArray(t));
-                        t = bracketsSuffix(t);
-                    } else {
-                        if ((mode & EXPR) != 0) {
-                            mode = EXPR;
-                            JCExpression t1 = term();
-                            t = to(F.at(pos).Indexed(t, t1));
-                        }
-                        accept(RBRACKET);
-                    }
-                    break loop;
-                case LPAREN:
-                    if ((mode & EXPR) != 0) {
-                        mode = EXPR;
-                        t = arguments(typeArgs, t);
-                        typeArgs = null;
-                    }
-                    break loop;
-                case DOT:
-                    S.nextToken();
-                    int oldmode = mode;
-                    mode &= ~NOPARAMS;
-                    typeArgs = typeArgumentsOpt(EXPR);
-                    mode = oldmode;
-                    if ((mode & EXPR) != 0) {
-                        switch (S.token()) {
-                        case CLASS:
-                            if (typeArgs != null) return illegal();
-                            mode = EXPR;
-                            t = to(F.at(pos).Select(t, names._class));
-                            S.nextToken();
-                            break loop;
-                        case THIS:
-                            if (typeArgs != null) return illegal();
-                            mode = EXPR;
-                            t = to(F.at(pos).Select(t, names._this));
-                            S.nextToken();
-                            break loop;
-                        case SUPER:
-                            mode = EXPR;
-                            t = to(F.at(pos).Select(t, names._super));
-                            t = superSuffix(typeArgs, t);
-                            typeArgs = null;
-                            break loop;
-                        case NEW:
-                            if (typeArgs != null) return illegal();
-                            mode = EXPR;
-                            int pos1 = S.pos();
-                            S.nextToken();
-                            if (S.token() == LT) typeArgs = typeArguments();
-                            t = innerCreator(pos1, typeArgs, t);
-                            typeArgs = null;
-                            break loop;
-                        }
-                    }
-                    // typeArgs saved for next loop iteration.
-                    t = toP(F.at(pos).Select(t, ident()));
-                    break;
-                default:
-                    break loop;
-                }
-            }
-            if (typeArgs != null) illegal();
-            t = typeArgumentsOpt(t);
-            break;
-        case BYTE: case SHORT: case CHAR: case INT: case LONG: case FLOAT:
-        case DOUBLE: case BOOLEAN:
-            if (typeArgs != null) illegal();
-            t = bracketsSuffix(bracketsOpt(basicType()));
-            break;
-        case VOID:
-            if (typeArgs != null) illegal();
-            if ((mode & EXPR) != 0) {
-                S.nextToken();
-                if (S.token() == DOT) {
-                    JCPrimitiveTypeTree ti = toP(F.at(pos).TypeIdent(TypeTags.VOID));
-                    t = bracketsSuffix(ti);
-                } else {
-                    return illegal(pos);
-                }
-            } else {
-                return illegal();
-            }
-            break;
-        default:
-            return illegal();
-        }
-        if (typeArgs != null) illegal();
-        while (true) {
-            int pos1 = S.pos();
-            if (S.token() == LBRACKET) {
-                S.nextToken();
-                if ((mode & TYPE) != 0) {
-                    int oldmode = mode;
-                    mode = TYPE;
-                    if (S.token() == RBRACKET) {
-                        S.nextToken();
-                        t = bracketsOpt(t);
-                        t = toP(F.at(pos1).TypeArray(t));
-                        return t;
-                    }
-                    mode = oldmode;
-                }
-                if ((mode & EXPR) != 0) {
-                    mode = EXPR;
-                    JCExpression t1 = term();
-                    t = to(F.at(pos1).Indexed(t, t1));
-                }
-                accept(RBRACKET);
-            } else if (S.token() == DOT) {
-                S.nextToken();
-                typeArgs = typeArgumentsOpt(EXPR);
-                if (S.token() == SUPER && (mode & EXPR) != 0) {
-                    mode = EXPR;
-                    t = to(F.at(pos1).Select(t, names._super));
-                    S.nextToken();
-                    t = arguments(typeArgs, t);
-                    typeArgs = null;
-                } else if (S.token() == NEW && (mode & EXPR) != 0) {
-                    if (typeArgs != null) return illegal();
-                    mode = EXPR;
-                    int pos2 = S.pos();
-                    S.nextToken();
-                    if (S.token() == LT) typeArgs = typeArguments();
-                    t = innerCreator(pos2, typeArgs, t);
-                    typeArgs = null;
-                } else {
-                    t = toP(F.at(pos1).Select(t, ident()));
-                    t = argumentsOpt(typeArgs, typeArgumentsOpt(t));
-                    typeArgs = null;
-                }
-            } else {
-                break;
-            }
-        }
-        while ((S.token() == PLUSPLUS || S.token() == SUBSUB) && (mode & EXPR) != 0) {
-            mode = EXPR;
-            t = to(F.at(S.pos()).Unary(
-                  S.token() == PLUSPLUS ? JCTree.POSTINC : JCTree.POSTDEC, t));
-            S.nextToken();
-        }
-        return toP(t);
-    }
-
-    /** SuperSuffix = Arguments | "." [TypeArguments] Ident [Arguments]
-     */
-    JCExpression superSuffix(List<JCExpression> typeArgs, JCExpression t) {
-        S.nextToken();
-        if (S.token() == LPAREN || typeArgs != null) {
-            t = arguments(typeArgs, t);
-        } else {
-            int pos = S.pos();
-            accept(DOT);
-            typeArgs = (S.token() == LT) ? typeArguments() : null;
-            t = toP(F.at(pos).Select(t, ident()));
-            t = argumentsOpt(typeArgs, t);
-        }
-        return t;
-    }
-
-    /** BasicType = BYTE | SHORT | CHAR | INT | LONG | FLOAT | DOUBLE | BOOLEAN
-     */
-    JCPrimitiveTypeTree basicType() {
-        JCPrimitiveTypeTree t = to(F.at(S.pos()).TypeIdent(typetag(S.token())));
-        S.nextToken();
-        return t;
-    }
-
-    /** ArgumentsOpt = [ Arguments ]
-     */
-    JCExpression argumentsOpt(List<JCExpression> typeArgs, JCExpression t) {
-        if ((mode & EXPR) != 0 && S.token() == LPAREN || typeArgs != null) {
-            mode = EXPR;
-            return arguments(typeArgs, t);
-        } else {
-            return t;
-        }
-    }
-
-    /** Arguments = "(" [Expression { COMMA Expression }] ")"
-     */
-    List<JCExpression> arguments() {
-        ListBuffer<JCExpression> args = lb();
-        if (S.token() == LPAREN) {
-            S.nextToken();
-            if (S.token() != RPAREN) {
-                args.append(expression());
-                while (S.token() == COMMA) {
-                    S.nextToken();
-                    args.append(expression());
-                }
-            }
-            accept(RPAREN);
-        } else {
-            syntaxError(S.pos(), "expected", LPAREN);
-        }
-        return args.toList();
-    }
-
-    JCMethodInvocation arguments(List<JCExpression> typeArgs, JCExpression t) {
-        int pos = S.pos();
-        List<JCExpression> args = arguments();
-        return toP(F.at(pos).Apply(typeArgs, t, args));
-    }
-
-    /**  TypeArgumentsOpt = [ TypeArguments ]
-     */
-    JCExpression typeArgumentsOpt(JCExpression t) {
-        if (S.token() == LT &&
-            (mode & TYPE) != 0 &&
-            (mode & NOPARAMS) == 0) {
-            mode = TYPE;
-            checkGenerics();
-            return typeArguments(t);
-        } else {
-            return t;
-        }
-    }
-    List<JCExpression> typeArgumentsOpt() {
-        return typeArgumentsOpt(TYPE);
-    }
-
-    List<JCExpression> typeArgumentsOpt(int useMode) {
-        if (S.token() == LT) {
-            checkGenerics();
-            if ((mode & useMode) == 0 ||
-                (mode & NOPARAMS) != 0) {
-                illegal();
-            }
-            mode = useMode;
-            return typeArguments();
-        }
-        return null;
-    }
-
-    /**  TypeArguments  = "<" TypeArgument {"," TypeArgument} ">"
-     */
-    List<JCExpression> typeArguments() {
-        ListBuffer<JCExpression> args = lb();
-        if (S.token() == LT) {
-            S.nextToken();
-            args.append(((mode & EXPR) == 0) ? typeArgument() : type());
-            while (S.token() == COMMA) {
-                S.nextToken();
-                args.append(((mode & EXPR) == 0) ? typeArgument() : type());
-            }
-            switch (S.token()) {
-            case GTGTGTEQ:
-                S.token(GTGTEQ);
-                break;
-            case GTGTEQ:
-                S.token(GTEQ);
-                break;
-            case GTEQ:
-                S.token(EQ);
-                break;
-            case GTGTGT:
-                S.token(GTGT);
-                break;
-            case GTGT:
-                S.token(GT);
-                break;
-            default:
-                accept(GT);
-                break;
-            }
-        } else {
-            syntaxError(S.pos(), "expected", LT);
-        }
-        return args.toList();
-    }
-
-    /** TypeArgument = Type
-     *               | "?"
-     *               | "?" EXTENDS Type {"&" Type}
-     *               | "?" SUPER Type
-     */
-    JCExpression typeArgument() {
-        if (S.token() != QUES) return type();
-        int pos = S.pos();
-        S.nextToken();
-        if (S.token() == EXTENDS) {
-            TypeBoundKind t = to(F.at(S.pos()).TypeBoundKind(BoundKind.EXTENDS));
-            S.nextToken();
-            return F.at(pos).Wildcard(t, type());
-        } else if (S.token() == SUPER) {
-            TypeBoundKind t = to(F.at(S.pos()).TypeBoundKind(BoundKind.SUPER));
-            S.nextToken();
-            return F.at(pos).Wildcard(t, type());
-        } else if (S.token() == IDENTIFIER) {
-            //error recovery
-            reportSyntaxError(S.prevEndPos(), "expected3",
-                    GT, EXTENDS, SUPER);
-            TypeBoundKind t = F.at(Position.NOPOS).TypeBoundKind(BoundKind.UNBOUND);
-            JCExpression wc = toP(F.at(pos).Wildcard(t, null));
-            JCIdent id = toP(F.at(S.pos()).Ident(ident()));
-            return F.at(pos).Erroneous(List.<JCTree>of(wc, id));
-        } else {
-            TypeBoundKind t = F.at(Position.NOPOS).TypeBoundKind(BoundKind.UNBOUND);
-            return toP(F.at(pos).Wildcard(t, null));
-        }
-    }
-
-    JCTypeApply typeArguments(JCExpression t) {
-        int pos = S.pos();
-        List<JCExpression> args = typeArguments();
-        return toP(F.at(pos).TypeApply(t, args));
-    }
-
-    /** BracketsOpt = {"[" "]"}
-     */
-    private JCExpression bracketsOpt(JCExpression t) {
-        if (S.token() == LBRACKET) {
-            int pos = S.pos();
-            S.nextToken();
-            t = bracketsOptCont(t, pos);
-            F.at(pos);
-        }
-        return t;
-    }
-
-    private JCArrayTypeTree bracketsOptCont(JCExpression t, int pos) {
-        accept(RBRACKET);
-        t = bracketsOpt(t);
-        return toP(F.at(pos).TypeArray(t));
-    }
-
-    /** BracketsSuffixExpr = "." CLASS
-     *  BracketsSuffixType =
-     */
-    JCExpression bracketsSuffix(JCExpression t) {
-        if ((mode & EXPR) != 0 && S.token() == DOT) {
-            mode = EXPR;
-            int pos = S.pos();
-            S.nextToken();
-            accept(CLASS);
-            if (S.pos() == errorEndPos) {
-                // error recovery
-                Name name = null;
-                if (S.token() == IDENTIFIER) {
-                    name = S.name();
-                    S.nextToken();
-                } else {
-                    name = names.error;
-                }
-                t = F.at(pos).Erroneous(List.<JCTree>of(toP(F.at(pos).Select(t, name))));
-            } else {
-                t = toP(F.at(pos).Select(t, names._class));
-            }
-        } else if ((mode & TYPE) != 0) {
-            mode = TYPE;
-        } else {
-            syntaxError(S.pos(), "dot.class.expected");
-        }
-        return t;
-    }
-
-    /** Creator = Qualident [TypeArguments] ( ArrayCreatorRest | ClassCreatorRest )
-     */
-    JCExpression creator(int newpos, List<JCExpression> typeArgs) {
-        switch (S.token()) {
-        case BYTE: case SHORT: case CHAR: case INT: case LONG: case FLOAT:
-        case DOUBLE: case BOOLEAN:
-            if (typeArgs == null)
-                return arrayCreatorRest(newpos, basicType());
-            break;
-        default:
-        }
-        JCExpression t = qualident();
-        int oldmode = mode;
-        mode = TYPE;
-        if (S.token() == LT) {
-            checkGenerics();
-            t = typeArguments(t);
-        }
-        while (S.token() == DOT) {
-            int pos = S.pos();
-            S.nextToken();
-            t = toP(F.at(pos).Select(t, ident()));
-            if (S.token() == LT) {
-                checkGenerics();
-                t = typeArguments(t);
-            }
-        }
-        mode = oldmode;
-        if (S.token() == LBRACKET) {
-            JCExpression e = arrayCreatorRest(newpos, t);
-            if (typeArgs != null) {
-                int pos = newpos;
-                if (!typeArgs.isEmpty() && typeArgs.head.pos != Position.NOPOS) {
-                    // note: this should always happen but we should
-                    // not rely on this as the parser is continuously
-                    // modified to improve error recovery.
-                    pos = typeArgs.head.pos;
-                }
-                setErrorEndPos(S.prevEndPos());
-                reportSyntaxError(pos, "cannot.create.array.with.type.arguments");
-                return toP(F.at(newpos).Erroneous(typeArgs.prepend(e)));
-            }
-            return e;
-        } else if (S.token() == LPAREN) {
-            return classCreatorRest(newpos, null, typeArgs, t);
-        } else {
-            reportSyntaxError(S.pos(), "expected2",
-                               LPAREN, LBRACKET);
-            t = toP(F.at(newpos).NewClass(null, typeArgs, t, List.<JCExpression>nil(), null));
-            return toP(F.at(newpos).Erroneous(List.<JCTree>of(t)));
-        }
-    }
-
-    /** InnerCreator = Ident [TypeArguments] ClassCreatorRest
-     */
-    JCExpression innerCreator(int newpos, List<JCExpression> typeArgs, JCExpression encl) {
-        JCExpression t = toP(F.at(S.pos()).Ident(ident()));
-        if (S.token() == LT) {
-            checkGenerics();
-            t = typeArguments(t);
-        }
-        return classCreatorRest(newpos, encl, typeArgs, t);
-    }
-
-    /** ArrayCreatorRest = "[" ( "]" BracketsOpt ArrayInitializer
-     *                         | Expression "]" {"[" Expression "]"} BracketsOpt )
-     */
-    JCExpression arrayCreatorRest(int newpos, JCExpression elemtype) {
-        accept(LBRACKET);
-        if (S.token() == RBRACKET) {
-            accept(RBRACKET);
-            elemtype = bracketsOpt(elemtype);
-            if (S.token() == LBRACE) {
-                return arrayInitializer(newpos, elemtype);
-            } else {
-                return syntaxError(S.pos(), "array.dimension.missing");
-            }
-        } else {
-            ListBuffer<JCExpression> dims = new ListBuffer<JCExpression>();
-            dims.append(expression());
-            accept(RBRACKET);
-            while (S.token() == LBRACKET) {
-                int pos = S.pos();
-                S.nextToken();
-                if (S.token() == RBRACKET) {
-                    elemtype = bracketsOptCont(elemtype, pos);
-                } else {
-                    dims.append(expression());
-                    accept(RBRACKET);
-                }
-            }
-            return toP(F.at(newpos).NewArray(elemtype, dims.toList(), null));
-        }
-    }
-
-    /** ClassCreatorRest = Arguments [ClassBody]
-     */
-    JCExpression classCreatorRest(int newpos,
-                                  JCExpression encl,
-                                  List<JCExpression> typeArgs,
-                                  JCExpression t)
-    {
-        List<JCExpression> args = arguments();
-        JCClassDecl body = null;
-        if (S.token() == LBRACE) {
-            int pos = S.pos();
-            List<JCTree> defs = classOrInterfaceBody(names.empty, false);
-            JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
-            body = toP(F.at(pos).AnonymousClassDef(mods, defs));
-        }
-        return toP(F.at(newpos).NewClass(encl, typeArgs, t, args, body));
-    }
-
-    /** ArrayInitializer = "{" [VariableInitializer {"," VariableInitializer}] [","] "}"
-     */
-    JCExpression arrayInitializer(int newpos, JCExpression t) {
-        accept(LBRACE);
-        ListBuffer<JCExpression> elems = new ListBuffer<JCExpression>();
-        if (S.token() == COMMA) {
-            S.nextToken();
-        } else if (S.token() != RBRACE) {
-            elems.append(variableInitializer());
-            while (S.token() == COMMA) {
-                S.nextToken();
-                if (S.token() == RBRACE) break;
-                elems.append(variableInitializer());
-            }
-        }
-        accept(RBRACE);
-        return toP(F.at(newpos).NewArray(t, List.<JCExpression>nil(), elems.toList()));
-    }
-
-    /** VariableInitializer = ArrayInitializer | Expression
-     */
-    public JCExpression variableInitializer() {
-        return S.token() == LBRACE ? arrayInitializer(S.pos(), null) : expression();
-    }
-
-    /** ParExpression = "(" Expression ")"
-     */
-    JCExpression parExpression() {
-        accept(LPAREN);
-        JCExpression t = expression();
-        accept(RPAREN);
-        return t;
-    }
-
-    /** Block = "{" BlockStatements "}"
-     */
-    JCBlock block(int pos, long flags) {
-        accept(LBRACE);
-        List<JCStatement> stats = blockStatements();
-        JCBlock t = F.at(pos).Block(flags, stats);
-        while (S.token() == CASE || S.token() == DEFAULT) {
-            syntaxError("orphaned", S.token());
-            switchBlockStatementGroups();
-        }
-        // the Block node has a field "endpos" for first char of last token, which is
-        // usually but not necessarily the last char of the last token.
-        t.endpos = S.pos();
-        accept(RBRACE);
-        return toP(t);
-    }
-
-    public JCBlock block() {
-        return block(S.pos(), 0);
-    }
-
-    /** BlockStatements = { BlockStatement }
-     *  BlockStatement  = LocalVariableDeclarationStatement
-     *                  | ClassOrInterfaceOrEnumDeclaration
-     *                  | [Ident ":"] Statement
-     *  LocalVariableDeclarationStatement
-     *                  = { FINAL | '@' Annotation } Type VariableDeclarators ";"
-     */
-    @SuppressWarnings("fallthrough")
-    List<JCStatement> blockStatements() {
-//todo: skip to anchor on error(?)
-        int lastErrPos = -1;
-        ListBuffer<JCStatement> stats = new ListBuffer<JCStatement>();
-        while (true) {
-            int pos = S.pos();
-            switch (S.token()) {
-            case RBRACE: case CASE: case DEFAULT: case EOF:
-                return stats.toList();
-            case LBRACE: case IF: case FOR: case WHILE: case DO: case TRY:
-            case SWITCH: case SYNCHRONIZED: case RETURN: case THROW: case BREAK:
-            case CONTINUE: case SEMI: case ELSE: case FINALLY: case CATCH:
-                stats.append(statement());
-                break;
-            case MONKEYS_AT:
-            case FINAL: {
-                String dc = S.docComment();
-                JCModifiers mods = modifiersOpt();
-                if (S.token() == INTERFACE ||
-                    S.token() == CLASS ||
-                    allowEnums && S.token() == ENUM) {
-                    stats.append(classOrInterfaceOrEnumDeclaration(mods, dc));
-                } else {
-                    JCExpression t = type();
-                    stats.appendList(variableDeclarators(mods, t,
-                                                         new ListBuffer<JCStatement>()));
-                    // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
-                    storeEnd(stats.elems.last(), S.endPos());
-                    accept(SEMI);
-                }
-                break;
-            }
-            case ABSTRACT: case STRICTFP: {
-                String dc = S.docComment();
-                JCModifiers mods = modifiersOpt();
-                stats.append(classOrInterfaceOrEnumDeclaration(mods, dc));
-                break;
-            }
-            case INTERFACE:
-            case CLASS:
-                stats.append(classOrInterfaceOrEnumDeclaration(modifiersOpt(),
-                                                               S.docComment()));
-                break;
-            case ENUM:
-            case ASSERT:
-                if (allowEnums && S.token() == ENUM) {
-                    log.error(S.pos(), "local.enum");
-                    stats.
-                        append(classOrInterfaceOrEnumDeclaration(modifiersOpt(),
-                                                                 S.docComment()));
-                    break;
-                } else if (allowAsserts && S.token() == ASSERT) {
-                    stats.append(statement());
-                    break;
-                }
-                /* fall through to default */
-            default:
-                Name name = S.name();
-                JCExpression t = term(EXPR | TYPE);
-                if (S.token() == COLON && t.getTag() == JCTree.IDENT) {
-                    S.nextToken();
-                    JCStatement stat = statement();
-                    stats.append(F.at(pos).Labelled(name, stat));
-                } else if ((lastmode & TYPE) != 0 &&
-                           (S.token() == IDENTIFIER ||
-                            S.token() == ASSERT ||
-                            S.token() == ENUM)) {
-                    pos = S.pos();
-                    JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
-                    F.at(pos);
-                    stats.appendList(variableDeclarators(mods, t,
-                                                         new ListBuffer<JCStatement>()));
-                    // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
-                    storeEnd(stats.elems.last(), S.endPos());
-                    accept(SEMI);
-                } else {
-                    // This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon
-                    stats.append(to(F.at(pos).Exec(checkExprStat(t))));
-                    accept(SEMI);
-                }
-            }
-
-            // error recovery
-            if (S.pos() == lastErrPos)
-                return stats.toList();
-            if (S.pos() <= errorEndPos) {
-                skip(false, true, true, true);
-                lastErrPos = S.pos();
-            }
-
-            // ensure no dangling /** @deprecated */ active
-            S.resetDeprecatedFlag();
-        }
-    }
-
-    /** Statement =
-     *       Block
-     *     | IF ParExpression Statement [ELSE Statement]
-     *     | FOR "(" ForInitOpt ";" [Expression] ";" ForUpdateOpt ")" Statement
-     *     | FOR "(" FormalParameter : Expression ")" Statement
-     *     | WHILE ParExpression Statement
-     *     | DO Statement WHILE ParExpression ";"
-     *     | TRY Block ( Catches | [Catches] FinallyPart )
-     *     | SWITCH ParExpression "{" SwitchBlockStatementGroups "}"
-     *     | SYNCHRONIZED ParExpression Block
-     *     | RETURN [Expression] ";"
-     *     | THROW Expression ";"
-     *     | BREAK [Ident] ";"
-     *     | CONTINUE [Ident] ";"
-     *     | ASSERT Expression [ ":" Expression ] ";"
-     *     | ";"
-     *     | ExpressionStatement
-     *     | Ident ":" Statement
-     */
-    @SuppressWarnings("fallthrough")
-    public JCStatement statement() {
-        int pos = S.pos();
-        switch (S.token()) {
-        case LBRACE:
-            return block();
-        case IF: {
-            S.nextToken();
-            JCExpression cond = parExpression();
-            JCStatement thenpart = statement();
-            JCStatement elsepart = null;
-            if (S.token() == ELSE) {
-                S.nextToken();
-                elsepart = statement();
-            }
-            return F.at(pos).If(cond, thenpart, elsepart);
-        }
-        case FOR: {
-            S.nextToken();
-            accept(LPAREN);
-            List<JCStatement> inits = S.token() == SEMI ? List.<JCStatement>nil() : forInit();
-            if (inits.length() == 1 &&
-                inits.head.getTag() == JCTree.VARDEF &&
-                ((JCVariableDecl) inits.head).init == null &&
-                S.token() == COLON) {
-                checkForeach();
-                JCVariableDecl var = (JCVariableDecl)inits.head;
-                accept(COLON);
-                JCExpression expr = expression();
-                accept(RPAREN);
-                JCStatement body = statement();
-                return F.at(pos).ForeachLoop(var, expr, body);
-            } else {
-                accept(SEMI);
-                JCExpression cond = S.token() == SEMI ? null : expression();
-                accept(SEMI);
-                List<JCExpressionStatement> steps = S.token() == RPAREN ? List.<JCExpressionStatement>nil() : forUpdate();
-                accept(RPAREN);
-                JCStatement body = statement();
-                return F.at(pos).ForLoop(inits, cond, steps, body);
-            }
-        }
-        case WHILE: {
-            S.nextToken();
-            JCExpression cond = parExpression();
-            JCStatement body = statement();
-            return F.at(pos).WhileLoop(cond, body);
-        }
-        case DO: {
-            S.nextToken();
-            JCStatement body = statement();
-            accept(WHILE);
-            JCExpression cond = parExpression();
-            JCDoWhileLoop t = to(F.at(pos).DoLoop(body, cond));
-            accept(SEMI);
-            return t;
-        }
-        case TRY: {
-            S.nextToken();
-            JCBlock body = block();
-            ListBuffer<JCCatch> catchers = new ListBuffer<JCCatch>();
-            JCBlock finalizer = null;
-            if (S.token() == CATCH || S.token() == FINALLY) {
-                while (S.token() == CATCH) catchers.append(catchClause());
-                if (S.token() == FINALLY) {
-                    S.nextToken();
-                    finalizer = block();
-                }
-            } else {
-                log.error(pos, "try.without.catch.or.finally");
-            }
-            return F.at(pos).Try(body, catchers.toList(), finalizer);
-        }
-        case SWITCH: {
-            S.nextToken();
-            JCExpression selector = parExpression();
-            accept(LBRACE);
-            List<JCCase> cases = switchBlockStatementGroups();
-            JCSwitch t = to(F.at(pos).Switch(selector, cases));
-            accept(RBRACE);
-            return t;
-        }
-        case SYNCHRONIZED: {
-            S.nextToken();
-            JCExpression lock = parExpression();
-            JCBlock body = block();
-            return F.at(pos).Synchronized(lock, body);
-        }
-        case RETURN: {
-            S.nextToken();
-            JCExpression result = S.token() == SEMI ? null : expression();
-            JCReturn t = to(F.at(pos).Return(result));
-            accept(SEMI);
-            return t;
-        }
-        case THROW: {
-            S.nextToken();
-            JCExpression exc = expression();
-            JCThrow t = to(F.at(pos).Throw(exc));
-            accept(SEMI);
-            return t;
-        }
-        case BREAK: {
-            S.nextToken();
-            Name label = (S.token() == IDENTIFIER || S.token() == ASSERT || S.token() == ENUM) ? ident() : null;
-            JCBreak t = to(F.at(pos).Break(label));
-            accept(SEMI);
-            return t;
-        }
-        case CONTINUE: {
-            S.nextToken();
-            Name label = (S.token() == IDENTIFIER || S.token() == ASSERT || S.token() == ENUM) ? ident() : null;
-            JCContinue t =  to(F.at(pos).Continue(label));
-            accept(SEMI);
-            return t;
-        }
-        case SEMI:
-            S.nextToken();
-            return toP(F.at(pos).Skip());
-        case ELSE:
-            return toP(F.Exec(syntaxError("else.without.if")));
-        case FINALLY:
-            return toP(F.Exec(syntaxError("finally.without.try")));
-        case CATCH:
-            return toP(F.Exec(syntaxError("catch.without.try")));
-        case ASSERT: {
-            if (allowAsserts && S.token() == ASSERT) {
-                S.nextToken();
-                JCExpression assertion = expression();
-                JCExpression message = null;
-                if (S.token() == COLON) {
-                    S.nextToken();
-                    message = expression();
-                }
-                JCAssert t = to(F.at(pos).Assert(assertion, message));
-                accept(SEMI);
-                return t;
-            }
-            /* else fall through to default case */
-        }
-        case ENUM:
-        default:
-            Name name = S.name();
-            JCExpression expr = expression();
-            if (S.token() == COLON && expr.getTag() == JCTree.IDENT) {
-                S.nextToken();
-                JCStatement stat = statement();
-                return F.at(pos).Labelled(name, stat);
-            } else {
-                // This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon
-                JCExpressionStatement stat = to(F.at(pos).Exec(checkExprStat(expr)));
-                accept(SEMI);
-                return stat;
-            }
-        }
-    }
-
-    /** CatchClause     = CATCH "(" FormalParameter ")" Block
-     */
-    JCCatch catchClause() {
-        int pos = S.pos();
-        accept(CATCH);
-        accept(LPAREN);
-        JCVariableDecl formal =
-            variableDeclaratorId(optFinal(Flags.PARAMETER),
-                                 qualident());
-        accept(RPAREN);
-        JCBlock body = block();
-        return F.at(pos).Catch(formal, body);
-    }
-
-    /** SwitchBlockStatementGroups = { SwitchBlockStatementGroup }
-     *  SwitchBlockStatementGroup = SwitchLabel BlockStatements
-     *  SwitchLabel = CASE ConstantExpression ":" | DEFAULT ":"
-     */
-    List<JCCase> switchBlockStatementGroups() {
-        ListBuffer<JCCase> cases = new ListBuffer<JCCase>();
-        while (true) {
-            int pos = S.pos();
-            switch (S.token()) {
-            case CASE: {
-                S.nextToken();
-                JCExpression pat = expression();
-                accept(COLON);
-                List<JCStatement> stats = blockStatements();
-                JCCase c = F.at(pos).Case(pat, stats);
-                if (stats.isEmpty())
-                    storeEnd(c, S.prevEndPos());
-                cases.append(c);
-                break;
-            }
-            case DEFAULT: {
-                S.nextToken();
-                accept(COLON);
-                List<JCStatement> stats = blockStatements();
-                JCCase c = F.at(pos).Case(null, stats);
-                if (stats.isEmpty())
-                    storeEnd(c, S.prevEndPos());
-                cases.append(c);
-                break;
-            }
-            case RBRACE: case EOF:
-                return cases.toList();
-            default:
-                S.nextToken(); // to ensure progress
-                syntaxError(pos, "expected3",
-                    CASE, DEFAULT, RBRACE);
-            }
-        }
-    }
-
-    /** MoreStatementExpressions = { COMMA StatementExpression }
-     */
-    <T extends ListBuffer<? super JCExpressionStatement>> T moreStatementExpressions(int pos,
-                                                                    JCExpression first,
-                                                                    T stats) {
-        // This Exec is a "StatementExpression"; it subsumes no terminating token
-        stats.append(toP(F.at(pos).Exec(checkExprStat(first))));
-        while (S.token() == COMMA) {
-            S.nextToken();
-            pos = S.pos();
-            JCExpression t = expression();
-            // This Exec is a "StatementExpression"; it subsumes no terminating token
-            stats.append(toP(F.at(pos).Exec(checkExprStat(t))));
-        }
-        return stats;
-    }
-
-    /** ForInit = StatementExpression MoreStatementExpressions
-     *           |  { FINAL | '@' Annotation } Type VariableDeclarators
-     */
-    List<JCStatement> forInit() {
-        ListBuffer<JCStatement> stats = lb();
-        int pos = S.pos();
-        if (S.token() == FINAL || S.token() == MONKEYS_AT) {
-            return variableDeclarators(optFinal(0), type(), stats).toList();
-        } else {
-            JCExpression t = term(EXPR | TYPE);
-            if ((lastmode & TYPE) != 0 &&
-                (S.token() == IDENTIFIER || S.token() == ASSERT || S.token() == ENUM))
-                return variableDeclarators(modifiersOpt(), t, stats).toList();
-            else
-                return moreStatementExpressions(pos, t, stats).toList();
-        }
-    }
-
-    /** ForUpdate = StatementExpression MoreStatementExpressions
-     */
-    List<JCExpressionStatement> forUpdate() {
-        return moreStatementExpressions(S.pos(),
-                                        expression(),
-                                        new ListBuffer<JCExpressionStatement>()).toList();
-    }
-
-    /** AnnotationsOpt = { '@' Annotation }
-     */
-    List<JCAnnotation> annotationsOpt() {
-        if (S.token() != MONKEYS_AT) return List.nil(); // optimization
-        ListBuffer<JCAnnotation> buf = new ListBuffer<JCAnnotation>();
-        while (S.token() == MONKEYS_AT) {
-            int pos = S.pos();
-            S.nextToken();
-            buf.append(annotation(pos));
-        }
-        return buf.toList();
-    }
-
-    /** ModifiersOpt = { Modifier }
-     *  Modifier = PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | FINAL
-     *           | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE | "@"
-     *           | "@" Annotation
-     */
-    JCModifiers modifiersOpt() {
-        return modifiersOpt(null);
-    }
-    JCModifiers modifiersOpt(JCModifiers partial) {
-        long flags = (partial == null) ? 0 : partial.flags;
-        if (S.deprecatedFlag()) {
-            flags |= Flags.DEPRECATED;
-            S.resetDeprecatedFlag();
-        }
-        ListBuffer<JCAnnotation> annotations = new ListBuffer<JCAnnotation>();
-        if (partial != null) annotations.appendList(partial.annotations);
-        int pos = S.pos();
-        int lastPos = Position.NOPOS;
-    loop:
-        while (true) {
-            long flag;
-            switch (S.token()) {
-            case PRIVATE     : flag = Flags.PRIVATE; break;
-            case PROTECTED   : flag = Flags.PROTECTED; break;
-            case PUBLIC      : flag = Flags.PUBLIC; break;
-            case STATIC      : flag = Flags.STATIC; break;
-            case TRANSIENT   : flag = Flags.TRANSIENT; break;
-            case FINAL       : flag = Flags.FINAL; break;
-            case ABSTRACT    : flag = Flags.ABSTRACT; break;
-            case NATIVE      : flag = Flags.NATIVE; break;
-            case VOLATILE    : flag = Flags.VOLATILE; break;
-            case SYNCHRONIZED: flag = Flags.SYNCHRONIZED; break;
-            case STRICTFP    : flag = Flags.STRICTFP; break;
-            case MONKEYS_AT  : flag = Flags.ANNOTATION; break;
-            default: break loop;
-            }
-            if ((flags & flag) != 0) log.error(S.pos(), "repeated.modifier");
-            lastPos = S.pos();
-            S.nextToken();
-            if (flag == Flags.ANNOTATION) {
-                checkAnnotations();
-                if (S.token() != INTERFACE) {
-                JCAnnotation ann = annotation(lastPos);
-                // if first modifier is an annotation, set pos to annotation's.
-                if (flags == 0 && annotations.isEmpty())
-                    pos = ann.pos;
-                annotations.append(ann);
-                lastPos = ann.pos;
-                    flag = 0;
-                }
-            }
-            flags |= flag;
-        }
-        switch (S.token()) {
-        case ENUM: flags |= Flags.ENUM; break;
-        case INTERFACE: flags |= Flags.INTERFACE; break;
-        default: break;
-        }
-
-        /* A modifiers tree with no modifier tokens or annotations
-         * has no text position. */
-        if (flags == 0 && annotations.isEmpty())
-            pos = Position.NOPOS;
-
-        JCModifiers mods = F.at(pos).Modifiers(flags, annotations.toList());
-        if (pos != Position.NOPOS)
-            storeEnd(mods, S.prevEndPos());
-        return mods;
-    }
-
-    /** Annotation              = "@" Qualident [ "(" AnnotationFieldValues ")" ]
-     * @param pos position of "@" token
-     */
-    JCAnnotation annotation(int pos) {
-        // accept(AT); // AT consumed by caller
-        checkAnnotations();
-        JCTree ident = qualident();
-        List<JCExpression> fieldValues = annotationFieldValuesOpt();
-        JCAnnotation ann = F.at(pos).Annotation(ident, fieldValues);
-        storeEnd(ann, S.prevEndPos());
-        return ann;
-    }
-
-    List<JCExpression> annotationFieldValuesOpt() {
-        return (S.token() == LPAREN) ? annotationFieldValues() : List.<JCExpression>nil();
-    }
-
-    /** AnnotationFieldValues   = "(" [ AnnotationFieldValue { "," AnnotationFieldValue } ] ")" */
-    List<JCExpression> annotationFieldValues() {
-        accept(LPAREN);
-        ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>();
-        if (S.token() != RPAREN) {
-            buf.append(annotationFieldValue());
-            while (S.token() == COMMA) {
-                S.nextToken();
-                buf.append(annotationFieldValue());
-            }
-        }
-        accept(RPAREN);
-        return buf.toList();
-    }
-
-    /** AnnotationFieldValue    = AnnotationValue
-     *                          | Identifier "=" AnnotationValue
-     */
-    JCExpression annotationFieldValue() {
-        if (S.token() == IDENTIFIER) {
-            mode = EXPR;
-            JCExpression t1 = term1();
-            if (t1.getTag() == JCTree.IDENT && S.token() == EQ) {
-                int pos = S.pos();
-                accept(EQ);
-                return toP(F.at(pos).Assign(t1, annotationValue()));
-            } else {
-                return t1;
-            }
-        }
-        return annotationValue();
-    }
-
-    /* AnnotationValue          = ConditionalExpression
-     *                          | Annotation
-     *                          | "{" [ AnnotationValue { "," AnnotationValue } ] "}"
-     */
-    JCExpression annotationValue() {
-        int pos;
-        switch (S.token()) {
-        case MONKEYS_AT:
-            pos = S.pos();
-            S.nextToken();
-            return annotation(pos);
-        case LBRACE:
-            pos = S.pos();
-            accept(LBRACE);
-            ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>();
-            if (S.token() != RBRACE) {
-                buf.append(annotationValue());
-                while (S.token() == COMMA) {
-                    S.nextToken();
-                    if (S.token() == RPAREN) break;
-                    buf.append(annotationValue());
-                }
-            }
-            accept(RBRACE);
-            return toP(F.at(pos).NewArray(null, List.<JCExpression>nil(), buf.toList()));
-        default:
-            mode = EXPR;
-            return term1();
-        }
-    }
-
-    /** VariableDeclarators = VariableDeclarator { "," VariableDeclarator }
-     */
-    public <T extends ListBuffer<? super JCVariableDecl>> T variableDeclarators(JCModifiers mods,
-                                                                         JCExpression type,
-                                                                         T vdefs)
-    {
-        return variableDeclaratorsRest(S.pos(), mods, type, ident(), false, null, vdefs);
-    }
-
-    /** VariableDeclaratorsRest = VariableDeclaratorRest { "," VariableDeclarator }
-     *  ConstantDeclaratorsRest = ConstantDeclaratorRest { "," ConstantDeclarator }
-     *
-     *  @param reqInit  Is an initializer always required?
-     *  @param dc       The documentation comment for the variable declarations, or null.
-     */
-    <T extends ListBuffer<? super JCVariableDecl>> T variableDeclaratorsRest(int pos,
-                                                                     JCModifiers mods,
-                                                                     JCExpression type,
-                                                                     Name name,
-                                                                     boolean reqInit,
-                                                                     String dc,
-                                                                     T vdefs)
-    {
-        vdefs.append(variableDeclaratorRest(pos, mods, type, name, reqInit, dc));
-        while (S.token() == COMMA) {
-            // All but last of multiple declarators subsume a comma
-            storeEnd((JCTree)vdefs.elems.last(), S.endPos());
-            S.nextToken();
-            vdefs.append(variableDeclarator(mods, type, reqInit, dc));
-        }
-        return vdefs;
-    }
-
-    /** VariableDeclarator = Ident VariableDeclaratorRest
-     *  ConstantDeclarator = Ident ConstantDeclaratorRest
-     */
-    JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, String dc) {
-        return variableDeclaratorRest(S.pos(), mods, type, ident(), reqInit, dc);
-    }
-
-    /** VariableDeclaratorRest = BracketsOpt ["=" VariableInitializer]
-     *  ConstantDeclaratorRest = BracketsOpt "=" VariableInitializer
-     *
-     *  @param reqInit  Is an initializer always required?
-     *  @param dc       The documentation comment for the variable declarations, or null.
-     */
-    JCVariableDecl variableDeclaratorRest(int pos, JCModifiers mods, JCExpression type, Name name,
-                                  boolean reqInit, String dc) {
-        type = bracketsOpt(type);
-        JCExpression init = null;
-        if (S.token() == EQ) {
-            S.nextToken();
-            init = variableInitializer();
-        }
-        else if (reqInit) syntaxError(S.pos(), "expected", EQ);
-        JCVariableDecl result =
-            toP(F.at(pos).VarDef(mods, name, type, init));
-        attach(result, dc);
-        return result;
-    }
-
-    /** VariableDeclaratorId = Ident BracketsOpt
-     */
-    JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) {
-        int pos = S.pos();
-        Name name = ident();
-        if ((mods.flags & Flags.VARARGS) == 0)
-            type = bracketsOpt(type);
-        return toP(F.at(pos).VarDef(mods, name, type, null));
-    }
-
-    /** CompilationUnit = [ { "@" Annotation } PACKAGE Qualident ";"] {ImportDeclaration} {TypeDeclaration}
-     */
-    public JCTree.JCCompilationUnit compilationUnit() {
-        int pos = S.pos();
-        JCExpression pid = null;
-        String dc = S.docComment();
-        JCModifiers mods = null;
-        List<JCAnnotation> packageAnnotations = List.nil();
-        if (S.token() == MONKEYS_AT)
-            mods = modifiersOpt();
-
-        if (S.token() == PACKAGE) {
-            if (mods != null) {
-                checkNoMods(mods.flags);
-                packageAnnotations = mods.annotations;
-                mods = null;
-            }
-            S.nextToken();
-            pid = qualident();
-            accept(SEMI);
-        }
-        ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
-       boolean checkForImports = true;
-        while (S.token() != EOF) {
-            if (S.pos() <= errorEndPos) {
-                // error recovery
-                skip(checkForImports, false, false, false);
-                if (S.token() == EOF)
-                    break;
-            }
-            if (checkForImports && mods == null && S.token() == IMPORT) {
-                defs.append(importDeclaration());
-            } else {
-                JCTree def = typeDeclaration(mods);
-                if (def instanceof JCExpressionStatement)
-                    def = ((JCExpressionStatement)def).expr;
-                defs.append(def);
-                if (def instanceof JCClassDecl)
-                    checkForImports = false;
-                mods = null;
-            }
-        }
-        JCTree.JCCompilationUnit toplevel = F.at(pos).TopLevel(packageAnnotations, pid, defs.toList());
-        attach(toplevel, dc);
-        if (defs.elems.isEmpty())
-            storeEnd(toplevel, S.prevEndPos());
-        if (keepDocComments) toplevel.docComments = docComments;
-        return toplevel;
-    }
-
-    /** ImportDeclaration = IMPORT [ STATIC ] Ident { "." Ident } [ "." "*" ] ";"
-     */
-    JCTree importDeclaration() {
-        int pos = S.pos();
-        S.nextToken();
-        boolean importStatic = false;
-        if (S.token() == STATIC) {
-            checkStaticImports();
-            importStatic = true;
-            S.nextToken();
-        }
-        JCExpression pid = toP(F.at(S.pos()).Ident(ident()));
-        do {
-            int pos1 = S.pos();
-            accept(DOT);
-            if (S.token() == STAR) {
-                pid = to(F.at(pos1).Select(pid, names.asterisk));
-                S.nextToken();
-                break;
-            } else {
-                pid = toP(F.at(pos1).Select(pid, ident()));
-            }
-        } while (S.token() == DOT);
-        accept(SEMI);
-        return toP(F.at(pos).Import(pid, importStatic));
-    }
-
-    /** TypeDeclaration = ClassOrInterfaceOrEnumDeclaration
-     *                  | ";"
-     */
-    JCTree typeDeclaration(JCModifiers mods) {
-        int pos = S.pos();
-        if (mods == null && S.token() == SEMI) {
-            S.nextToken();
-            return toP(F.at(pos).Skip());
-        } else {
-            String dc = S.docComment();
-            return classOrInterfaceOrEnumDeclaration(modifiersOpt(mods), dc);
-        }
-    }
-
-    /** ClassOrInterfaceOrEnumDeclaration = ModifiersOpt
-     *           (ClassDeclaration | InterfaceDeclaration | EnumDeclaration)
-     *  @param mods     Any modifiers starting the class or interface declaration
-     *  @param dc       The documentation comment for the class, or null.
-     */
-    JCStatement classOrInterfaceOrEnumDeclaration(JCModifiers mods, String dc) {
-        if (S.token() == CLASS) {
-            return classDeclaration(mods, dc);
-        } else if (S.token() == INTERFACE) {
-            return interfaceDeclaration(mods, dc);
-        } else if (allowEnums) {
-            if (S.token() == ENUM) {
-                return enumDeclaration(mods, dc);
-            } else {
-                int pos = S.pos();
-                List<JCTree> errs;
-                if (S.token() == IDENTIFIER) {
-                    errs = List.<JCTree>of(mods, toP(F.at(pos).Ident(ident())));
-                    setErrorEndPos(S.pos());
-                } else {
-                    errs = List.<JCTree>of(mods);
-                }
-                return toP(F.Exec(syntaxError(pos, errs, "expected3",
-                                              CLASS, INTERFACE, ENUM)));
-            }
-        } else {
-            if (S.token() == ENUM) {
-                log.error(S.pos(), "enums.not.supported.in.source", source.name);
-                allowEnums = true;
-                return enumDeclaration(mods, dc);
-            }
-            int pos = S.pos();
-            List<JCTree> errs;
-            if (S.token() == IDENTIFIER) {
-                errs = List.<JCTree>of(mods, toP(F.at(pos).Ident(ident())));
-                setErrorEndPos(S.pos());
-            } else {
-                errs = List.<JCTree>of(mods);
-            }
-            return toP(F.Exec(syntaxError(pos, errs, "expected2",
-                                          CLASS, INTERFACE)));
-        }
-    }
-
-    /** ClassDeclaration = CLASS Ident TypeParametersOpt [EXTENDS Type]
-     *                     [IMPLEMENTS TypeList] ClassBody
-     *  @param mods    The modifiers starting the class declaration
-     *  @param dc       The documentation comment for the class, or null.
-     */
-    JCClassDecl classDeclaration(JCModifiers mods, String dc) {
-        int pos = S.pos();
-        accept(CLASS);
-        Name name = ident();
-
-        List<JCTypeParameter> typarams = typeParametersOpt();
-
-        JCTree extending = null;
-        if (S.token() == EXTENDS) {
-            S.nextToken();
-            extending = type();
-        }
-        List<JCExpression> implementing = List.nil();
-        if (S.token() == IMPLEMENTS) {
-            S.nextToken();
-            implementing = typeList();
-        }
-        List<JCTree> defs = classOrInterfaceBody(name, false);
-        JCClassDecl result = toP(F.at(pos).ClassDef(
-            mods, name, typarams, extending, implementing, defs));
-        attach(result, dc);
-        return result;
-    }
-
-    /** InterfaceDeclaration = INTERFACE Ident TypeParametersOpt
-     *                         [EXTENDS TypeList] InterfaceBody
-     *  @param mods    The modifiers starting the interface declaration
-     *  @param dc       The documentation comment for the interface, or null.
-     */
-    JCClassDecl interfaceDeclaration(JCModifiers mods, String dc) {
-        int pos = S.pos();
-        accept(INTERFACE);
-        Name name = ident();
-
-        List<JCTypeParameter> typarams = typeParametersOpt();
-
-        List<JCExpression> extending = List.nil();
-        if (S.token() == EXTENDS) {
-            S.nextToken();
-            extending = typeList();
-        }
-        List<JCTree> defs = classOrInterfaceBody(name, true);
-        JCClassDecl result = toP(F.at(pos).ClassDef(
-            mods, name, typarams, null, extending, defs));
-        attach(result, dc);
-        return result;
-    }
-
-    /** EnumDeclaration = ENUM Ident [IMPLEMENTS TypeList] EnumBody
-     *  @param mods    The modifiers starting the enum declaration
-     *  @param dc       The documentation comment for the enum, or null.
-     */
-    JCClassDecl enumDeclaration(JCModifiers mods, String dc) {
-        int pos = S.pos();
-        accept(ENUM);
-        Name name = ident();
-
-        List<JCExpression> implementing = List.nil();
-        if (S.token() == IMPLEMENTS) {
-            S.nextToken();
-            implementing = typeList();
-        }
-
-        List<JCTree> defs = enumBody(name);
-        JCModifiers newMods =
-            F.at(mods.pos).Modifiers(mods.flags|Flags.ENUM, mods.annotations);
-        JCClassDecl result = toP(F.at(pos).
-            ClassDef(newMods, name, List.<JCTypeParameter>nil(),
-                null, implementing, defs));
-        attach(result, dc);
-        return result;
-    }
-
-    /** EnumBody = "{" { EnumeratorDeclarationList } [","]
-     *                  [ ";" {ClassBodyDeclaration} ] "}"
-     */
-    List<JCTree> enumBody(Name enumName) {
-        accept(LBRACE);
-        ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
-        if (S.token() == COMMA) {
-            S.nextToken();
-        } else if (S.token() != RBRACE && S.token() != SEMI) {
-            defs.append(enumeratorDeclaration(enumName));
-            while (S.token() == COMMA) {
-                S.nextToken();
-                if (S.token() == RBRACE || S.token() == SEMI) break;
-                defs.append(enumeratorDeclaration(enumName));
-            }
-            if (S.token() != SEMI && S.token() != RBRACE) {
-                defs.append(syntaxError(S.pos(), "expected3",
-                                COMMA, RBRACE, SEMI));
-                S.nextToken();
-            }
-        }
-        if (S.token() == SEMI) {
-            S.nextToken();
-            while (S.token() != RBRACE && S.token() != EOF) {
-                defs.appendList(classOrInterfaceBodyDeclaration(enumName,
-                                                                false));
-                if (S.pos() <= errorEndPos) {
-                    // error recovery
-                   skip(false, true, true, false);
-                }
-            }
-        }
-        accept(RBRACE);
-        return defs.toList();
-    }
-
-    /** EnumeratorDeclaration = AnnotationsOpt [TypeArguments] IDENTIFIER [ Arguments ] [ "{" ClassBody "}" ]
-     */
-    JCTree enumeratorDeclaration(Name enumName) {
-        String dc = S.docComment();
-        int flags = Flags.PUBLIC|Flags.STATIC|Flags.FINAL|Flags.ENUM;
-        if (S.deprecatedFlag()) {
-            flags |= Flags.DEPRECATED;
-            S.resetDeprecatedFlag();
-        }
-        int pos = S.pos();
-        List<JCAnnotation> annotations = annotationsOpt();
-        JCModifiers mods = F.at(annotations.isEmpty() ? Position.NOPOS : pos).Modifiers(flags, annotations);
-        List<JCExpression> typeArgs = typeArgumentsOpt();
-        int identPos = S.pos();
-        Name name = ident();
-        int createPos = S.pos();
-        List<JCExpression> args = (S.token() == LPAREN)
-            ? arguments() : List.<JCExpression>nil();
-        JCClassDecl body = null;
-        if (S.token() == LBRACE) {
-            JCModifiers mods1 = F.at(Position.NOPOS).Modifiers(Flags.ENUM | Flags.STATIC);
-            List<JCTree> defs = classOrInterfaceBody(names.empty, false);
-            body = toP(F.at(identPos).AnonymousClassDef(mods1, defs));
-        }
-        if (args.isEmpty() && body == null)
-            createPos = Position.NOPOS;
-        JCIdent ident = F.at(Position.NOPOS).Ident(enumName);
-        JCNewClass create = F.at(createPos).NewClass(null, typeArgs, ident, args, body);
-        if (createPos != Position.NOPOS)
-            storeEnd(create, S.prevEndPos());
-        ident = F.at(Position.NOPOS).Ident(enumName);
-        JCTree result = toP(F.at(pos).VarDef(mods, name, ident, create));
-        attach(result, dc);
-        return result;
-    }
-
-    /** TypeList = Type {"," Type}
-     */
-    List<JCExpression> typeList() {
-        ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
-        ts.append(type());
-        while (S.token() == COMMA) {
-            S.nextToken();
-            ts.append(type());
-        }
-        return ts.toList();
-    }
-
-    /** ClassBody     = "{" {ClassBodyDeclaration} "}"
-     *  InterfaceBody = "{" {InterfaceBodyDeclaration} "}"
-     */
-    List<JCTree> classOrInterfaceBody(Name className, boolean isInterface) {
-        accept(LBRACE);
-        if (S.pos() <= errorEndPos) {
-            // error recovery
-            skip(false, true, false, false);
-            if (S.token() == LBRACE)
-                S.nextToken();
-        }
-        ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
-        while (S.token() != RBRACE && S.token() != EOF) {
-            defs.appendList(classOrInterfaceBodyDeclaration(className, isInterface));
-            if (S.pos() <= errorEndPos) {
-               // error recovery
-               skip(false, true, true, false);
-           }
-        }
-        accept(RBRACE);
-        return defs.toList();
-    }
-
-    /** ClassBodyDeclaration =
-     *      ";"
-     *    | [STATIC] Block
-     *    | ModifiersOpt
-     *      ( Type Ident
-     *        ( VariableDeclaratorsRest ";" | MethodDeclaratorRest )
-     *      | VOID Ident MethodDeclaratorRest
-     *      | TypeParameters (Type | VOID) Ident MethodDeclaratorRest
-     *      | Ident ConstructorDeclaratorRest
-     *      | TypeParameters Ident ConstructorDeclaratorRest
-     *      | ClassOrInterfaceOrEnumDeclaration
-     *      )
-     *  InterfaceBodyDeclaration =
-     *      ";"
-     *    | ModifiersOpt Type Ident
-     *      ( ConstantDeclaratorsRest | InterfaceMethodDeclaratorRest ";" )
-     */
-    List<JCTree> classOrInterfaceBodyDeclaration(Name className, boolean isInterface) {
-        if (S.token() == SEMI) {
-            S.nextToken();
-            return List.<JCTree>of(F.at(Position.NOPOS).Block(0, List.<JCStatement>nil()));
-        } else {
-            String dc = S.docComment();
-            int pos = S.pos();
-            JCModifiers mods = modifiersOpt();
-            if (S.token() == CLASS ||
-                S.token() == INTERFACE ||
-                allowEnums && S.token() == ENUM) {
-                return List.<JCTree>of(classOrInterfaceOrEnumDeclaration(mods, dc));
-            } else if (S.token() == LBRACE && !isInterface &&
-                       (mods.flags & Flags.StandardFlags & ~Flags.STATIC) == 0 &&
-                       mods.annotations.isEmpty()) {
-                return List.<JCTree>of(block(pos, mods.flags));
-            } else {
-                pos = S.pos();
-                List<JCTypeParameter> typarams = typeParametersOpt();
-                // Hack alert:  if there are type arguments but no Modifiers, the start
-                // position will be lost unless we set the Modifiers position.  There
-                // should be an AST node for type parameters (BugId 5005090).
-                if (typarams.length() > 0 && mods.pos == Position.NOPOS) {
-                    mods.pos = pos;
-                }
-                Token token = S.token();
-                Name name = S.name();
-                pos = S.pos();
-                JCExpression type;
-                boolean isVoid = S.token() == VOID;
-                if (isVoid) {
-                    type = to(F.at(pos).TypeIdent(TypeTags.VOID));
-                    S.nextToken();
-                } else {
-                    type = type();
-                }
-                if (S.token() == LPAREN && !isInterface && type.getTag() == JCTree.IDENT) {
-                    if (isInterface || name != className)
-                        log.error(pos, "invalid.meth.decl.ret.type.req");
-                    return List.of(methodDeclaratorRest(
-                        pos, mods, null, names.init, typarams,
-                        isInterface, true, dc));
-                } else {
-                    pos = S.pos();
-                    name = ident();
-                    if (S.token() == LPAREN) {
-                        return List.of(methodDeclaratorRest(
-                            pos, mods, type, name, typarams,
-                            isInterface, isVoid, dc));
-                    } else if (!isVoid && typarams.isEmpty()) {
-                        List<JCTree> defs =
-                            variableDeclaratorsRest(pos, mods, type, name, isInterface, dc,
-                                                    new ListBuffer<JCTree>()).toList();
-                        storeEnd(defs.last(), S.endPos());
-                        accept(SEMI);
-                        return defs;
-                    } else {
-                        pos = S.pos();
-                        List<JCTree> err = isVoid
-                            ? List.<JCTree>of(toP(F.at(pos).MethodDef(mods, name, type, typarams,
-                                List.<JCVariableDecl>nil(), List.<JCExpression>nil(), null, null)))
-                            : null;
-                        return List.<JCTree>of(syntaxError(S.pos(), err, "expected", LPAREN));
-                    }
-                }
-            }
-        }
-    }
-
-    /** MethodDeclaratorRest =
-     *      FormalParameters BracketsOpt [Throws TypeList] ( MethodBody | [DEFAULT AnnotationValue] ";")
-     *  VoidMethodDeclaratorRest =
-     *      FormalParameters [Throws TypeList] ( MethodBody | ";")
-     *  InterfaceMethodDeclaratorRest =
-     *      FormalParameters BracketsOpt [THROWS TypeList] ";"
-     *  VoidInterfaceMethodDeclaratorRest =
-     *      FormalParameters [THROWS TypeList] ";"
-     *  ConstructorDeclaratorRest =
-     *      "(" FormalParameterListOpt ")" [THROWS TypeList] MethodBody
-     */
-    JCTree methodDeclaratorRest(int pos,
-                              JCModifiers mods,
-                              JCExpression type,
-                              Name name,
-                              List<JCTypeParameter> typarams,
-                              boolean isInterface, boolean isVoid,
-                              String dc) {
-        List<JCVariableDecl> params = formalParameters();
-        if (!isVoid) type = bracketsOpt(type);
-        List<JCExpression> thrown = List.nil();
-        if (S.token() == THROWS) {
-            S.nextToken();
-            thrown = qualidentList();
-        }
-        JCBlock body = null;
-        JCExpression defaultValue;
-        if (S.token() == LBRACE) {
-            body = block();
-            defaultValue = null;
-        } else {
-            if (S.token() == DEFAULT) {
-                accept(DEFAULT);
-                defaultValue = annotationValue();
-            } else {
-                defaultValue = null;
-            }
-            accept(SEMI);
-            if (S.pos() <= errorEndPos) {
-                // error recovery
-                skip(false, true, false, false);
-                if (S.token() == LBRACE) {
-                    body = block();
-                }
-            }
-        }
-        JCMethodDecl result =
-            toP(F.at(pos).MethodDef(mods, name, type, typarams,
-                                    params, thrown,
-                                    body, defaultValue));
-        attach(result, dc);
-        return result;
-    }
-
-    /** QualidentList = Qualident {"," Qualident}
-     */
-    List<JCExpression> qualidentList() {
-        ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
-        ts.append(qualident());
-        while (S.token() == COMMA) {
-            S.nextToken();
-            ts.append(qualident());
-        }
-        return ts.toList();
-    }
-
-    /** TypeParametersOpt = ["<" TypeParameter {"," TypeParameter} ">"]
-     */
-    List<JCTypeParameter> typeParametersOpt() {
-        if (S.token() == LT) {
-            checkGenerics();
-            ListBuffer<JCTypeParameter> typarams = new ListBuffer<JCTypeParameter>();
-            S.nextToken();
-            typarams.append(typeParameter());
-            while (S.token() == COMMA) {
-                S.nextToken();
-                typarams.append(typeParameter());
-            }
-            accept(GT);
-            return typarams.toList();
-        } else {
-            return List.nil();
-        }
-    }
-
-    /** TypeParameter = TypeVariable [TypeParameterBound]
-     *  TypeParameterBound = EXTENDS Type {"&" Type}
-     *  TypeVariable = Ident
-     */
-    JCTypeParameter typeParameter() {
-        int pos = S.pos();
-        Name name = ident();
-        ListBuffer<JCExpression> bounds = new ListBuffer<JCExpression>();
-        if (S.token() == EXTENDS) {
-            S.nextToken();
-            bounds.append(type());
-            while (S.token() == AMP) {
-                S.nextToken();
-                bounds.append(type());
-            }
-        }
-        return toP(F.at(pos).TypeParameter(name, bounds.toList()));
-    }
-
-    /** FormalParameters = "(" [ FormalParameterList ] ")"
-     *  FormalParameterList = [ FormalParameterListNovarargs , ] LastFormalParameter
-     *  FormalParameterListNovarargs = [ FormalParameterListNovarargs , ] FormalParameter
-     */
-    List<JCVariableDecl> formalParameters() {
-        ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
-        JCVariableDecl lastParam = null;
-        accept(LPAREN);
-        if (S.token() != RPAREN) {
-            params.append(lastParam = formalParameter());
-            while ((lastParam.mods.flags & Flags.VARARGS) == 0 && S.token() == COMMA) {
-                S.nextToken();
-                params.append(lastParam = formalParameter());
-            }
-        }
-        accept(RPAREN);
-        return params.toList();
-    }
-
-    JCModifiers optFinal(long flags) {
-        JCModifiers mods = modifiersOpt();
-        checkNoMods(mods.flags & ~(Flags.FINAL | Flags.DEPRECATED));
-        mods.flags |= flags;
-        return mods;
-    }
-
-    /** FormalParameter = { FINAL | '@' Annotation } Type VariableDeclaratorId
-     *  LastFormalParameter = { FINAL | '@' Annotation } Type '...' Ident | FormalParameter
-     */
-    JCVariableDecl formalParameter() {
-        JCModifiers mods = optFinal(Flags.PARAMETER);
-        JCExpression type = type();
-        if (S.token() == ELLIPSIS) {
-            checkVarargs();
-            mods.flags |= Flags.VARARGS;
-            type = to(F.at(S.pos()).TypeArray(type));
-            S.nextToken();
-        }
-        return variableDeclaratorId(mods, type);
-    }
-
-/* ---------- auxiliary methods -------------- */
-
-    /** Check that given tree is a legal expression statement.
-     */
-    protected JCExpression checkExprStat(JCExpression t) {
-        switch(t.getTag()) {
-        case JCTree.PREINC: case JCTree.PREDEC:
-        case JCTree.POSTINC: case JCTree.POSTDEC:
-        case JCTree.ASSIGN:
-        case JCTree.BITOR_ASG: case JCTree.BITXOR_ASG: case JCTree.BITAND_ASG:
-        case JCTree.SL_ASG: case JCTree.SR_ASG: case JCTree.USR_ASG:
-        case JCTree.PLUS_ASG: case JCTree.MINUS_ASG:
-        case JCTree.MUL_ASG: case JCTree.DIV_ASG: case JCTree.MOD_ASG:
-        case JCTree.APPLY: case JCTree.NEWCLASS:
-        case JCTree.ERRONEOUS:
-            return t;
-        default:
-            log.error(t.pos, "not.stmt");
-            return F.at(t.pos).Erroneous(List.<JCTree>of(t));
-        }
-    }
-
-    /** Return precedence of operator represented by token,
-     *  -1 if token is not a binary operator. @see TreeInfo.opPrec
-     */
-    static int prec(Token token) {
-        int oc = optag(token);
-        return (oc >= 0) ? TreeInfo.opPrec(oc) : -1;
-    }
-
-    /** Return operation tag of binary operator represented by token,
-     *  -1 if token is not a binary operator.
-     */
-    static int optag(Token token) {
-        switch (token) {
-        case BARBAR:
-            return JCTree.OR;
-        case AMPAMP:
-            return JCTree.AND;
-        case BAR:
-            return JCTree.BITOR;
-        case BAREQ:
-            return JCTree.BITOR_ASG;
-        case CARET:
-            return JCTree.BITXOR;
-        case CARETEQ:
-            return JCTree.BITXOR_ASG;
-        case AMP:
-            return JCTree.BITAND;
-        case AMPEQ:
-            return JCTree.BITAND_ASG;
-        case EQEQ:
-            return JCTree.EQ;
-        case BANGEQ:
-            return JCTree.NE;
-        case LT:
-            return JCTree.LT;
-        case GT:
-            return JCTree.GT;
-        case LTEQ:
-            return JCTree.LE;
-        case GTEQ:
-            return JCTree.GE;
-        case LTLT:
-            return JCTree.SL;
-        case LTLTEQ:
-            return JCTree.SL_ASG;
-        case GTGT:
-            return JCTree.SR;
-        case GTGTEQ:
-            return JCTree.SR_ASG;
-        case GTGTGT:
-            return JCTree.USR;
-        case GTGTGTEQ:
-            return JCTree.USR_ASG;
-        case PLUS:
-            return JCTree.PLUS;
-        case PLUSEQ:
-            return JCTree.PLUS_ASG;
-        case SUB:
-            return JCTree.MINUS;
-        case SUBEQ:
-            return JCTree.MINUS_ASG;
-        case STAR:
-            return JCTree.MUL;
-        case STAREQ:
-            return JCTree.MUL_ASG;
-        case SLASH:
-            return JCTree.DIV;
-        case SLASHEQ:
-            return JCTree.DIV_ASG;
-        case PERCENT:
-            return JCTree.MOD;
-        case PERCENTEQ:
-            return JCTree.MOD_ASG;
-        case INSTANCEOF:
-            return JCTree.TYPETEST;
-        default:
-            return -1;
-        }
-    }
-
-    /** Return operation tag of unary operator represented by token,
-     *  -1 if token is not a binary operator.
-     */
-    static int unoptag(Token token) {
-        switch (token) {
-        case PLUS:
-            return JCTree.POS;
-        case SUB:
-            return JCTree.NEG;
-        case BANG:
-            return JCTree.NOT;
-        case TILDE:
-            return JCTree.COMPL;
-        case PLUSPLUS:
-            return JCTree.PREINC;
-        case SUBSUB:
-            return JCTree.PREDEC;
-        default:
-            return -1;
-        }
-    }
-
-    /** Return type tag of basic type represented by token,
-     *  -1 if token is not a basic type identifier.
-     */
-    static int typetag(Token token) {
-        switch (token) {
-        case BYTE:
-            return TypeTags.BYTE;
-        case CHAR:
-            return TypeTags.CHAR;
-        case SHORT:
-            return TypeTags.SHORT;
-        case INT:
-            return TypeTags.INT;
-        case LONG:
-            return TypeTags.LONG;
-        case FLOAT:
-            return TypeTags.FLOAT;
-        case DOUBLE:
-            return TypeTags.DOUBLE;
-        case BOOLEAN:
-            return TypeTags.BOOLEAN;
-        default:
-            return -1;
-        }
-    }
-
-    void checkGenerics() {
-        if (!allowGenerics) {
-            log.error(S.pos(), "generics.not.supported.in.source", source.name);
-            allowGenerics = true;
-        }
-    }
-    void checkVarargs() {
-        if (!allowVarargs) {
-            log.error(S.pos(), "varargs.not.supported.in.source", source.name);
-            allowVarargs = true;
-        }
-    }
-    void checkForeach() {
-        if (!allowForeach) {
-            log.error(S.pos(), "foreach.not.supported.in.source", source.name);
-            allowForeach = true;
-        }
-    }
-    void checkStaticImports() {
-        if (!allowStaticImport) {
-            log.error(S.pos(), "static.import.not.supported.in.source", source.name);
-            allowStaticImport = true;
-        }
-    }
-    void checkAnnotations() {
-        if (!allowAnnotations) {
-            log.error(S.pos(), "annotations.not.supported.in.source", source.name);
-            allowAnnotations = true;
-        }
-    }
+    JCExpression parseType();
 }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java b/langtools/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java
new file mode 100644
index 0000000..861f3e5
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javac.parser;
+
+import com.sun.tools.javac.code.Source;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Names;
+import com.sun.tools.javac.util.Options;
+
+/**
+ * A factory for creating parsers.
+ */
+public class ParserFactory {
+
+    /** The context key for the parser factory. */
+    protected static final Context.Key<ParserFactory> parserFactoryKey = new Context.Key<ParserFactory>();
+
+    public static ParserFactory instance(Context context) {
+        ParserFactory instance = context.get(parserFactoryKey);
+        if (instance == null) {
+            instance = new ParserFactory(context);
+        }
+        return instance;
+    }
+
+    final TreeMaker F;
+    final Log log;
+    final Keywords keywords;
+    final Source source;
+    final Names names;
+    final Options options;
+    final Scanner.Factory scannerFactory;
+
+    protected ParserFactory(Context context) {
+        super();
+        context.put(parserFactoryKey, this);
+        this.F = TreeMaker.instance(context);
+        this.log = Log.instance(context);
+        this.names = Names.instance(context);
+        this.keywords = Keywords.instance(context);
+        this.source = Source.instance(context);
+        this.options = Options.instance(context);
+        this.scannerFactory = Scanner.Factory.instance(context);
+    }
+
+    public Parser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap) {
+        Lexer lexer = scannerFactory.newScanner(input);
+        if (keepEndPos) {
+            return new EndPosParser(this, lexer, keepDocComments, keepLineMap);
+        } else {
+            return new JavacParser(this, lexer, keepDocComments, keepLineMap);
+        }
+    }
+}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java b/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java
index 9f650b6..15020bf 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java
@@ -62,7 +62,7 @@
         }
 
         final Log log;
-        final Name.Table names;
+        final Names names;
         final Source source;
         final Keywords keywords;
 
@@ -70,7 +70,7 @@
         protected Factory(Context context) {
             context.put(scannerFactoryKey, this);
             this.log = Log.instance(context);
-            this.names = Name.Table.instance(context);
+            this.names = Names.instance(context);
             this.source = Source.instance(context);
             this.keywords = Keywords.instance(context);
         }
@@ -155,7 +155,7 @@
     private final Log log;
 
     /** The name table. */
-    private final Name.Table names;
+    private final Names names;
 
     /** The keyword table. */
     private final Keywords keywords;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/Token.java b/langtools/src/share/classes/com/sun/tools/javac/parser/Token.java
index 55f0ddc..3479d21 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Token.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Token.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java
index cb5cda2..d2332e6 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java
index 1cb0e95..678764e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
index 0f2fae4..ba98882 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
@@ -70,6 +70,7 @@
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Options;
 
 import static javax.tools.StandardLocation.*;
@@ -831,7 +832,7 @@
                     topLevelClasses  = List.nil();
                     packageInfoFiles = List.nil();
 
-                    compiler.close();
+                    compiler.close(false);
                     currentContext = contextForNextRound(currentContext, true);
 
                     JavaFileManager fileManager = currentContext.get(JavaFileManager.class);
@@ -879,7 +880,7 @@
         }
         runLastRound(xout, roundNumber, errorStatus, taskListener);
 
-        compiler.close();
+        compiler.close(false);
         currentContext = contextForNextRound(currentContext, true);
         compiler = JavaCompiler.instance(currentContext);
         filer.newRound(currentContext, true);
@@ -913,7 +914,7 @@
         } else if (procOnly) {
             compiler.todo.clear();
         } else { // Final compilation
-            compiler.close();
+            compiler.close(false);
             currentContext = contextForNextRound(currentContext, true);
             compiler = JavaCompiler.instance(currentContext);
 
@@ -987,7 +988,7 @@
 
     private ListBuffer<ClassSymbol> enterNewClassFiles(Context currentContext) {
         ClassReader reader = ClassReader.instance(currentContext);
-        Name.Table names = Name.Table.instance(currentContext);
+        Names names = Names.instance(currentContext);
         ListBuffer<ClassSymbol> list = new ListBuffer<ClassSymbol>();
 
         for (Map.Entry<String,JavaFileObject> entry : filer.getGeneratedClasses().entrySet()) {
@@ -1047,9 +1048,9 @@
         next.put(Log.outKey, out);
 
         if (shareNames) {
-            Name.Table names = Name.Table.instance(context);
+            Names names = Names.instance(context);
             assert names != null;
-            next.put(Name.Table.namesKey, names);
+            next.put(Names.namesKey, names);
         }
 
         DiagnosticListener dl = context.get(DiagnosticListener.class);
@@ -1067,9 +1068,9 @@
             ((JavacFileManager)jfm).setContext(next);
         }
 
-        Name.Table names = Name.Table.instance(context);
+        Names names = Names.instance(context);
         assert names != null;
-        next.put(Name.Table.namesKey, names);
+        next.put(Names.namesKey, names);
 
         Keywords keywords = Keywords.instance(context);
         assert(keywords != null);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java
index 24f62f6..f6af2af 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java b/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java
index 11720b3..a943358 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/ServiceProxy.java b/langtools/src/share/classes/com/sun/tools/javac/processing/ServiceProxy.java
index d5c38d8..c44bf62 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/ServiceProxy.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/ServiceProxy.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java
index ee5d726..263051e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
index 4d80e91..08ac9f8 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java
index 214b767..30b14d6 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -336,7 +336,7 @@
             if (l.head.getTag() == JCTree.IMPORT) {
                 JCImport imp = (JCImport)l.head;
                 Name name = TreeInfo.name(imp.qualid);
-                if (name == name.table.asterisk ||
+                if (name == name.table.names.asterisk ||
                         cdef == null ||
                         isUsed(TreeInfo.symbol(imp.qualid), cdef)) {
                     if (firstImport) {
@@ -439,14 +439,14 @@
     public void visitMethodDef(JCMethodDecl tree) {
         try {
             // when producing source output, omit anonymous constructors
-            if (tree.name == tree.name.table.init &&
+            if (tree.name == tree.name.table.names.init &&
                     enclClassName == null &&
                     sourceOutput) return;
             println(); align();
             printDocComment(tree);
             printExpr(tree.mods);
             printTypeParameters(tree.typarams);
-            if (tree.name == tree.name.table.init) {
+            if (tree.name == tree.name.table.names.init) {
                 print(enclClassName != null ? enclClassName : tree.name);
             } else {
                 printExpr(tree.restype);
@@ -835,8 +835,8 @@
                 Name enclClassNamePrev = enclClassName;
                 enclClassName =
                         tree.def.name != null ? tree.def.name :
-                            tree.type != null && tree.type.tsym.name != tree.type.tsym.name.table.empty ? tree.type.tsym.name :
-                                null;
+                            tree.type != null && tree.type.tsym.name != tree.type.tsym.name.table.names.empty
+                                ? tree.type.tsym.name : null;
                 if ((tree.def.mods.flags & Flags.ENUM) != 0) print("/*enum*/");
                 printBlock(tree.def.defs);
                 enclClassName = enclClassNamePrev;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java
index b8ecbee..7d574d4 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
index 6da60da..bae93cf 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -61,7 +61,7 @@
     private TreeInfo(Context context) {
         context.put(treeInfoKey, this);
 
-        Name.Table names = Name.Table.instance(context);
+        Names names = Names.instance(context);
         opname[JCTree.POS     - JCTree.POS] = names.fromString("+");
         opname[JCTree.NEG     - JCTree.POS] = names.hyphen;
         opname[JCTree.NOT     - JCTree.POS] = names.fromString("!");
@@ -104,7 +104,7 @@
     public static boolean isConstructor(JCTree tree) {
         if (tree.getTag() == JCTree.METHODDEF) {
             Name name = ((JCMethodDecl) tree).name;
-            return name == name.table.init;
+            return name == name.table.names.init;
         } else {
             return false;
         }
@@ -130,7 +130,7 @@
                     if (select.sym != null &&
                         (select.sym.flags() & SYNTHETIC) != 0) {
                         Name selected = name(select.selected);
-                        if (selected != null && selected == selected.table._this)
+                        if (selected != null && selected == selected.table.names._this)
                             return true;
                     }
                 }
@@ -157,7 +157,7 @@
     public static boolean isSelfCall(JCTree tree) {
         Name name = calledMethodName(tree);
         if (name != null) {
-            Name.Table names = name.table;
+            Names names = name.table.names;
             return name==names._this || name==names._super;
         } else {
             return false;
@@ -169,7 +169,7 @@
     public static boolean isSuperCall(JCTree tree) {
         Name name = calledMethodName(tree);
         if (name != null) {
-            Name.Table names = name.table;
+            Names names = name.table.names;
             return name==names._super;
         } else {
             return false;
@@ -183,14 +183,14 @@
         JCMethodInvocation app = firstConstructorCall(tree);
         if (app == null) return false;
         Name meth = name(app.meth);
-        return meth == null || meth != meth.table._this;
+        return meth == null || meth != meth.table.names._this;
     }
 
     /** Return the first call in a constructor definition. */
     public static JCMethodInvocation firstConstructorCall(JCTree tree) {
         if (tree.getTag() != JCTree.METHODDEF) return null;
         JCMethodDecl md = (JCMethodDecl) tree;
-        Name.Table names = md.name.table;
+        Names names = md.name.table.names;
         if (md.name != names.init) return null;
         if (md.body == null) return null;
         List<JCStatement> stats = md.body.stats;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
index 605d352..ff1c495 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -67,7 +67,7 @@
     public JCCompilationUnit toplevel;
 
     /** The current name table. */
-    Name.Table names;
+    Names names;
 
     Types types;
 
@@ -80,14 +80,14 @@
         context.put(treeMakerKey, this);
         this.pos = Position.NOPOS;
         this.toplevel = null;
-        this.names = Name.Table.instance(context);
+        this.names = Names.instance(context);
         this.syms = Symtab.instance(context);
         this.types = Types.instance(context);
     }
 
     /** Create a tree maker with a given toplevel and FIRSTPOS as initial position.
      */
-    TreeMaker(JCCompilationUnit toplevel, Name.Table names, Types types, Symtab syms) {
+    TreeMaker(JCCompilationUnit toplevel, Names names, Types types, Symtab syms) {
         this.pos = Position.FIRSTPOS;
         this.toplevel = toplevel;
         this.names = names;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/ByteBuffer.java b/langtools/src/share/classes/com/sun/tools/javac/util/ByteBuffer.java
index e88ad36..6c7dfcd 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/util/ByteBuffer.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/ByteBuffer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -150,7 +150,7 @@
     /** Append a name.
      */
     public void appendName(Name name) {
-        appendBytes(name.table.names, name.index, name.len);
+        appendBytes(name.getByteArray(), name.getByteOffset(), name.getByteLength());
     }
 
     /** Reset to zero length.
@@ -161,7 +161,7 @@
 
     /** Convert contents to name.
      */
-    public Name toName(Name.Table names) {
+    public Name toName(Names names) {
         return names.fromUtf(elems, 0, length);
     }
 }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Context.java b/langtools/src/share/classes/com/sun/tools/javac/util/Context.java
index 813453e..428d089 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Context.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Context.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java b/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java
index b38e5bf..a0032e7 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -289,7 +289,7 @@
      */
     public static Name shortName(Name classname) {
         return classname.subName(
-            classname.lastIndexOf((byte)'.') + 1, classname.len);
+            classname.lastIndexOf((byte)'.') + 1, classname.getByteLength());
     }
 
     public static String shortName(String classname) {
diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java b/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java
index 9c26185..ef8c2b1 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Name.java b/langtools/src/share/classes/com/sun/tools/javac/util/Name.java
index 8d9f6cc..a2286c9 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Name.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Name.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -25,246 +25,111 @@
 
 package com.sun.tools.javac.util;
 
-import java.lang.ref.SoftReference;
-
-
-/** An abstraction for internal compiler strings. For efficiency reasons,
- *  GJC uses hashed strings that are stored in a common large buffer.
- *
- *  <p>Names represent unique hashable strings. Two names are equal
- *  if their indices are equal. Utf8 representation is used
- *  for storing names internally.
+/** An abstraction for internal compiler strings. They are stored in
+ *  Utf8 format. Names are stored in a Name.Table, and are unique within
+ *  that table.
  *
  *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
  *  you write code that depends on this, you do so at your own risk.
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
-public class Name implements javax.lang.model.element.Name {
+public abstract class Name implements javax.lang.model.element.Name {
 
-    /** The table structure where the name is stored
-     */
-    public Table table;
+    public final Table table;
 
-    /** The index where the bytes of this name are stored in the global name
-     *  buffer `names'.
-     */
-    public int index;
-
-    /** The number of bytes in this name.
-     */
-    public int len;
-
-    /** The next name occupying the same hash bucket.
-     */
-    Name next;
-
-    /** The hashcode of a name.
-     */
-    private static int hashValue(byte cs[], int start, int len) {
-        int h = 0;
-        int off = start;
-
-        for (int i = 0; i < len; i++) {
-            h = (h << 5) - h + cs[off++];
-        }
-        return h;
+    protected Name(Table table) {
+        this.table = table;
     }
 
-    /** Is (the utf8 representation of) name equal to
-     *  cs[start..start+len-1]?
+    /**
+     * @inheritDoc
      */
-    private static boolean equals(byte[] names, int index,
-                                  byte cs[], int start, int len) {
-        int i = 0;
-        while (i < len && names[index + i] == cs[start + i]) i++;
-        return i == len;
+    public boolean contentEquals(CharSequence cs) {
+        return toString().equals(cs.toString());
     }
 
-    /** Create a name from the bytes in cs[start..start+len-1].
-     *  Assume that bytes are in utf8 format.
-     */
-    public static Name fromUtf(Table table, byte cs[], int start, int len) {
-        int h = hashValue(cs, start, len) & table.hashMask;
-        Name n = table.hashes[h];
-        byte[] names = table.names;
-        while (n != null &&
-               (n.len != len || !equals(names, n.index, cs, start, len)))
-            n = n.next;
-        if (n == null) {
-            int nc = table.nc;
-            while (nc + len > names.length) {
-//              System.err.println("doubling name buffer of length + " + names.length + " to fit " + len + " bytes");//DEBUG
-                byte[] newnames = new byte[names.length * 2];
-                System.arraycopy(names, 0, newnames, 0, names.length);
-                names = table.names = newnames;
-            }
-            System.arraycopy(cs, start, names, nc, len);
-            n = new Name();
-            n.table = table;
-            n.index = nc;
-            n.len = len;
-            n.next = table.hashes[h];
-            table.hashes[h] = n;
-            table.nc = nc + len;
-            if (len == 0) table.nc++;
-        }
-        return n;
-    }
-
-    /** Create a name from the bytes in array cs.
-     *  Assume that bytes are in utf8 format.
-     */
-    public static Name fromUtf(Table table, byte cs[]) {
-        return fromUtf(table, cs, 0, cs.length);
-    }
-
-    /** Create a name from the characters in cs[start..start+len-1].
-     */
-    public static Name fromChars(Table table, char[] cs, int start, int len) {
-        int nc = table.nc;
-        byte[] names = table.names;
-        while (nc + len * 3 >= names.length) {
-//          System.err.println("doubling name buffer of length " + names.length + " to fit " + len + " chars");//DEBUG
-            byte[] newnames = new byte[names.length * 2];
-            System.arraycopy(names, 0, newnames, 0, names.length);
-            names = table.names = newnames;
-        }
-        int nbytes =
-            Convert.chars2utf(cs, start, names, nc, len) - nc;
-        int h = hashValue(names, nc, nbytes) & table.hashMask;
-        Name n = table.hashes[h];
-        while (n != null &&
-               (n.len != nbytes ||
-                !equals(names, n.index, names, nc, nbytes)))
-            n = n.next;
-        if (n == null) {
-            n = new Name();
-            n.table = table;
-            n.index = nc;
-            n.len = nbytes;
-            n.next = table.hashes[h];
-            table.hashes[h] = n;
-            table.nc = nc + nbytes;
-            if (nbytes == 0) table.nc++;
-        }
-        return n;
-    }
-
-    /** Create a name from the characters in string s.
-     */
-    public static Name fromString(Table table, String s) {
-        char[] cs = s.toCharArray();
-        return fromChars(table, cs, 0, cs.length);
-    }
-
-    /** Create a name from the characters in char sequence s.
-     */
-    public static Name fromString(Table table, CharSequence s) {
-        return fromString(table, s.toString());
-    }
-
-    /** Return the Utf8 representation of this name.
-     */
-    public byte[] toUtf() {
-        byte[] bs = new byte[len];
-        System.arraycopy(table.names, index, bs, 0, len);
-        return bs;
-    }
-
-    /** Return the string representation of this name.
-     */
-    public String toString() {
-        return Convert.utf2string(table.names, index, len);
-    }
-
-    /** Copy all bytes of this name to buffer cs, starting at start.
-     */
-    public void getBytes(byte cs[], int start) {
-        System.arraycopy(table.names, index, cs, start, len);
-    }
-
-    /** Return the hash value of this name.
-     */
-    public int hashCode() {
-        return index;
-    }
-
-    /** Is this name equal to other?
-     */
-    public boolean equals(Object other) {
-        if (other instanceof Name)
-            return
-                table == ((Name)other).table && index == ((Name)other).index;
-        else return false;
-    }
-
-    /** Compare this name to other name, yielding -1 if smaller, 0 if equal,
-     *  1 if greater.
-     */
-    public boolean less(Name that) {
-        int i = 0;
-        while (i < this.len && i < that.len) {
-            byte thisb = this.table.names[this.index + i];
-            byte thatb = that.table.names[that.index + i];
-            if (thisb < thatb) return true;
-            else if (thisb > thatb) return false;
-            else i++;
-        }
-        return this.len < that.len;
-    }
-
-    /** Returns the length of this name.
+    /**
+     * @inheritDoc
      */
     public int length() {
         return toString().length();
     }
 
-    /** Returns i'th byte of this name.
+    /**
+     * @inheritDoc
      */
-    public byte byteAt(int i) {
-        return table.names[index + i];
+    public char charAt(int index) {
+        return toString().charAt(index);
     }
 
-    /** Returns first occurrence of byte b in this name, len if not found.
+    /**
+     * @inheritDoc
      */
-    public int indexOf(byte b) {
-        byte[] names = table.names;
-        int i = 0;
-        while (i < len && names[index + i] != b) i++;
-        return i;
+    public CharSequence subSequence(int start, int end) {
+        return toString().subSequence(start, end);
+    }
+
+    /** Return the concatenation of this name and name `n'.
+     */
+    public Name append(Name n) {
+        int len = getByteLength();
+        byte[] bs = new byte[len + n.getByteLength()];
+        getBytes(bs, 0);
+        n.getBytes(bs, len);
+        return table.fromUtf(bs, 0, bs.length);
+    }
+
+    /** Return the concatenation of this name, the given ASCII
+     *  character, and name `n'.
+     */
+    public Name append(char c, Name n) {
+        int len = getByteLength();
+        byte[] bs = new byte[len + 1 + n.getByteLength()];
+        getBytes(bs, 0);
+        bs[len] = (byte) c;
+        n.getBytes(bs, len+1);
+        return table.fromUtf(bs, 0, bs.length);
+    }
+
+    /** An arbitrary but consistent complete order among all Names.
+     */
+    public int compareTo(Name other) {
+        return other.getIndex() - this.getIndex();
+    }
+
+    /** Return true if this is the empty name.
+     */
+    public boolean isEmpty() {
+        return getByteLength() == 0;
     }
 
     /** Returns last occurrence of byte b in this name, -1 if not found.
      */
     public int lastIndexOf(byte b) {
-        byte[] names = table.names;
-        int i = len - 1;
-        while (i >= 0 && names[index + i] != b) i--;
+        byte[] bytes = getByteArray();
+        int offset = getByteOffset();
+        int i = getByteLength() - 1;
+        while (i >= 0 && bytes[offset + i] != b) i--;
         return i;
     }
 
     /** Does this name start with prefix?
      */
     public boolean startsWith(Name prefix) {
-        int i = 0;
-        while (i < prefix.len &&
-               i < len &&
-               table.names[index + i] == prefix.table.names[prefix.index + i])
-            i++;
-        return i == prefix.len;
-    }
+        byte[] thisBytes = this.getByteArray();
+        int thisOffset   = this.getByteOffset();
+        int thisLength   = this.getByteLength();
+        byte[] prefixBytes = prefix.getByteArray();
+        int prefixOffset   = prefix.getByteOffset();
+        int prefixLength   = prefix.getByteLength();
 
-    /** Does this name end with suffix?
-     */
-    public boolean endsWith(Name suffix) {
-        int i = len - 1;
-        int j = suffix.len - 1;
-        while (j >= 0 && i >= 0 &&
-               table.names[index + i] == suffix.table.names[suffix.index + j]) {
-            i--; j--;
-        }
-        return j < 0;
+        int i = 0;
+        while (i < prefixLength &&
+               i < thisLength &&
+               thisBytes[thisOffset + i] == prefixBytes[prefixOffset + i])
+            i++;
+        return i == prefixLength;
     }
 
     /** Returns the sub-name starting at position start, up to and
@@ -272,382 +137,110 @@
      */
     public Name subName(int start, int end) {
         if (end < start) end = start;
-        return fromUtf(table, table.names, index + start, end - start);
+        return table.fromUtf(getByteArray(), getByteOffset() + start, end - start);
     }
 
-    /** Replace all `from' bytes in this name with `to' bytes.
+    /** Return the string representation of this name.
      */
-    public Name replace(byte from, byte to) {
-        byte[] names = table.names;
-        int i = 0;
-        while (i < len) {
-            if (names[index + i] == from) {
-                byte[] bs = new byte[len];
-                System.arraycopy(names, index, bs, 0, i);
-                bs[i] = to;
+    public String toString() {
+        return Convert.utf2string(getByteArray(), getByteOffset(), getByteLength());
+    }
+
+    /** Return the Utf8 representation of this name.
+     */
+    public byte[] toUtf() {
+        byte[] bs = new byte[getByteLength()];
+        getBytes(bs, 0);
+        return bs;
+    }
+
+    /* Get a "reasonably small" value that uniquely identifies this name
+     * within its name table.
+     */
+    public abstract int getIndex();
+
+    /** Get the length (in bytes) of this name.
+     */
+    public abstract int getByteLength();
+
+    /** Returns i'th byte of this name.
+     */
+    public abstract byte getByteAt(int i);
+
+    /** Copy all bytes of this name to buffer cs, starting at start.
+     */
+    public void getBytes(byte cs[], int start) {
+        System.arraycopy(getByteArray(), getByteOffset(), cs, start, getByteLength());
+    }
+
+    /** Get the underlying byte array for this name. The contents of the
+     * array must not be modified.
+     */
+    public abstract byte[] getByteArray();
+
+    /** Get the start offset of this name within its byte array.
+     */
+    public abstract int getByteOffset();
+
+    /** An abstraction for the hash table used to create unique Name instances.
+     */
+    public static abstract class Table {
+        /** Standard name table.
+         */
+        public final Names names;
+
+        Table(Names names) {
+            this.names = names;
+        }
+
+        /** Get the name from the characters in cs[start..start+len-1].
+         */
+        public abstract Name fromChars(char[] cs, int start, int len);
+
+        /** Get the name for the characters in string s.
+         */
+        public Name fromString(String s) {
+            char[] cs = s.toCharArray();
+            return fromChars(cs, 0, cs.length);
+        }
+
+        /** Get the name for the bytes in array cs.
+         *  Assume that bytes are in utf8 format.
+         */
+        public Name fromUtf(byte[] cs) {
+            return fromUtf(cs, 0, cs.length);
+        }
+
+        /** get the name for the bytes in cs[start..start+len-1].
+         *  Assume that bytes are in utf8 format.
+         */
+        public abstract Name fromUtf(byte[] cs, int start, int len);
+
+        /** Release any resources used by this table.
+         */
+        public abstract void dispose();
+
+        /** The hashcode of a name.
+         */
+        protected static int hashValue(byte bytes[], int offset, int length) {
+            int h = 0;
+            int off = offset;
+
+            for (int i = 0; i < length; i++) {
+                h = (h << 5) - h + bytes[off++];
+            }
+            return h;
+        }
+
+        /** Compare two subarrays
+         */
+        protected static boolean equals(byte[] bytes1, int offset1,
+                byte[] bytes2, int offset2, int length) {
+            int i = 0;
+            while (i < length && bytes1[offset1 + i] == bytes2[offset2 + i]) {
                 i++;
-                while (i < len) {
-                    byte b = names[index + i];
-                    bs[i] = b == from ? to : b;
-                    i++;
-                }
-                return fromUtf(table, bs, 0, len);
             }
-            i++;
+            return i == length;
         }
-        return this;
-    }
-
-    /** Return the concatenation of this name and name `n'.
-     */
-    public Name append(Name n) {
-        byte[] bs = new byte[len + n.len];
-        getBytes(bs, 0);
-        n.getBytes(bs, len);
-        return fromUtf(table, bs, 0, bs.length);
-    }
-
-    /** Return the concatenation of this name, the given ASCII
-     *  character, and name `n'.
-     */
-    public Name append(char c, Name n) {
-        byte[] bs = new byte[len + n.len + 1];
-        getBytes(bs, 0);
-        bs[len] = (byte)c;
-        n.getBytes(bs, len+1);
-        return fromUtf(table, bs, 0, bs.length);
-    }
-
-    /** An arbitrary but consistent complete order among all Names.
-     */
-    public int compareTo(Name other) {
-        return other.index - this.index;
-    }
-
-    /** Return the concatenation of all names in the array `ns'.
-     */
-    public static Name concat(Table table, Name ns[]) {
-        int len = 0;
-        for (int i = 0; i < ns.length; i++)
-            len = len + ns[i].len;
-        byte[] bs = new byte[len];
-        len = 0;
-        for (int i = 0; i < ns.length; i++) {
-            ns[i].getBytes(bs, len);
-            len = len + ns[i].len;
-        }
-        return fromUtf(table, bs, 0, len);
-    }
-
-    public char charAt(int index) {
-        return toString().charAt(index);
-    }
-
-    public CharSequence subSequence(int start, int end) {
-        return toString().subSequence(start, end);
-    }
-
-    public boolean contentEquals(CharSequence cs) {
-        return this.toString().equals(cs.toString());
-    }
-
-    public static class Table {
-        // maintain a freelist of recently used name tables for reuse.
-        private static List<SoftReference<Table>> freelist = List.nil();
-
-        static private synchronized Table make() {
-            while (freelist.nonEmpty()) {
-                Table t = freelist.head.get();
-                freelist = freelist.tail;
-                if (t != null) return t;
-            }
-            return new Table();
-        }
-
-        static private synchronized void dispose(Table t) {
-            freelist = freelist.prepend(new SoftReference<Table>(t));
-        }
-
-        public void dispose() {
-            dispose(this);
-        }
-
-        public static final Context.Key<Table> namesKey =
-            new Context.Key<Table>();
-
-        public static Table instance(Context context) {
-            Table instance = context.get(namesKey);
-            if (instance == null) {
-                instance = make();
-                context.put(namesKey, instance);
-            }
-            return instance;
-        }
-
-        /** The hash table for names.
-         */
-        private Name[] hashes;
-
-        /** The array holding all encountered names.
-         */
-        public byte[] names;
-
-        /** The mask to be used for hashing
-         */
-        private int hashMask;
-
-        /** The number of filled bytes in `names'.
-         */
-        private int nc = 0;
-
-        /** Allocator
-         *  @param hashSize the (constant) size to be used for the hash table
-         *                  needs to be a power of two.
-         *  @param nameSize the initial size of the name table.
-         */
-        public Table(int hashSize, int nameSize) {
-            hashMask = hashSize - 1;
-            hashes = new Name[hashSize];
-            names = new byte[nameSize];
-
-            slash = fromString("/");
-            hyphen = fromString("-");
-            T = fromString("T");
-            slashequals = fromString("/=");
-            deprecated = fromString("deprecated");
-
-            init = fromString("<init>");
-            clinit = fromString("<clinit>");
-            error = fromString("<error>");
-            any = fromString("<any>");
-            empty = fromString("");
-            one = fromString("1");
-            period = fromString(".");
-            comma = fromString(",");
-            semicolon = fromString(";");
-            asterisk = fromString("*");
-            _this = fromString("this");
-            _super = fromString("super");
-            _default = fromString("default");
-
-            _class = fromString("class");
-            java_lang = fromString("java.lang");
-            java_lang_Object = fromString("java.lang.Object");
-            java_lang_Class = fromString("java.lang.Class");
-            java_lang_Cloneable = fromString("java.lang.Cloneable");
-            java_io_Serializable = fromString("java.io.Serializable");
-            java_lang_Enum = fromString("java.lang.Enum");
-            package_info = fromString("package-info");
-            serialVersionUID = fromString("serialVersionUID");
-            ConstantValue = fromString("ConstantValue");
-            LineNumberTable = fromString("LineNumberTable");
-            LocalVariableTable = fromString("LocalVariableTable");
-            LocalVariableTypeTable = fromString("LocalVariableTypeTable");
-            CharacterRangeTable = fromString("CharacterRangeTable");
-            StackMap = fromString("StackMap");
-            StackMapTable = fromString("StackMapTable");
-            SourceID = fromString("SourceID");
-            CompilationID = fromString("CompilationID");
-            Code = fromString("Code");
-            Exceptions = fromString("Exceptions");
-            SourceFile = fromString("SourceFile");
-            InnerClasses = fromString("InnerClasses");
-            Synthetic = fromString("Synthetic");
-            Bridge= fromString("Bridge");
-            Deprecated = fromString("Deprecated");
-            Enum = fromString("Enum");
-            _name = fromString("name");
-            Signature = fromString("Signature");
-            Varargs = fromString("Varargs");
-            Annotation = fromString("Annotation");
-            RuntimeVisibleAnnotations = fromString("RuntimeVisibleAnnotations");
-            RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations");
-            RuntimeVisibleParameterAnnotations = fromString("RuntimeVisibleParameterAnnotations");
-            RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
-            Value = fromString("Value");
-            EnclosingMethod = fromString("EnclosingMethod");
-
-            desiredAssertionStatus = fromString("desiredAssertionStatus");
-
-            append  = fromString("append");
-            family  = fromString("family");
-            forName = fromString("forName");
-            toString = fromString("toString");
-            length = fromString("length");
-            valueOf = fromString("valueOf");
-            value = fromString("value");
-            getMessage = fromString("getMessage");
-            getClass = fromString("getClass");
-
-            TYPE = fromString("TYPE");
-            FIELD = fromString("FIELD");
-            METHOD = fromString("METHOD");
-            PARAMETER = fromString("PARAMETER");
-            CONSTRUCTOR = fromString("CONSTRUCTOR");
-            LOCAL_VARIABLE = fromString("LOCAL_VARIABLE");
-            ANNOTATION_TYPE = fromString("ANNOTATION_TYPE");
-            PACKAGE = fromString("PACKAGE");
-
-            SOURCE = fromString("SOURCE");
-            CLASS = fromString("CLASS");
-            RUNTIME = fromString("RUNTIME");
-
-            Array = fromString("Array");
-            Method = fromString("Method");
-            Bound = fromString("Bound");
-            clone = fromString("clone");
-            getComponentType = fromString("getComponentType");
-            getClassLoader = fromString("getClassLoader");
-            initCause = fromString("initCause");
-            values = fromString("values");
-            iterator = fromString("iterator");
-            hasNext = fromString("hasNext");
-            next = fromString("next");
-            AnnotationDefault = fromString("AnnotationDefault");
-            ordinal = fromString("ordinal");
-            equals = fromString("equals");
-            hashCode = fromString("hashCode");
-            compareTo = fromString("compareTo");
-            getDeclaringClass = fromString("getDeclaringClass");
-            ex = fromString("ex");
-            finalize = fromString("finalize");
-        }
-
-        public Table() {
-            this(0x8000, 0x20000);
-        }
-
-        /** Create a name from the bytes in cs[start..start+len-1].
-         *  Assume that bytes are in utf8 format.
-         */
-        public Name fromUtf(byte cs[], int start, int len) {
-            return Name.fromUtf(this, cs, start, len);
-        }
-
-        /** Create a name from the bytes in array cs.
-         *  Assume that bytes are in utf8 format.
-         */
-        public Name fromUtf(byte cs[]) {
-            return Name.fromUtf(this, cs, 0, cs.length);
-        }
-
-        /** Create a name from the characters in cs[start..start+len-1].
-         */
-        public Name fromChars(char[] cs, int start, int len) {
-            return Name.fromChars(this, cs, start, len);
-        }
-
-        /** Create a name from the characters in string s.
-         */
-        public Name fromString(CharSequence s) {
-            return Name.fromString(this, s);
-        }
-
-        public final Name slash;
-        public final Name hyphen;
-        public final Name T;
-        public final Name slashequals;
-        public final Name deprecated;
-
-        public final Name init;
-        public final Name clinit;
-        public final Name error;
-        public final Name any;
-        public final Name empty;
-        public final Name one;
-        public final Name period;
-        public final Name comma;
-        public final Name semicolon;
-        public final Name asterisk;
-        public final Name _this;
-        public final Name _super;
-        public final Name _default;
-
-        public final Name _class;
-        public final Name java_lang;
-        public final Name java_lang_Object;
-        public final Name java_lang_Class;
-        public final Name java_lang_Cloneable;
-        public final Name java_io_Serializable;
-        public final Name serialVersionUID;
-        public final Name java_lang_Enum;
-        public final Name package_info;
-        public final Name ConstantValue;
-        public final Name LineNumberTable;
-        public final Name LocalVariableTable;
-        public final Name LocalVariableTypeTable;
-        public final Name CharacterRangeTable;
-        public final Name StackMap;
-        public final Name StackMapTable;
-        public final Name SourceID;
-        public final Name CompilationID;
-        public final Name Code;
-        public final Name Exceptions;
-        public final Name SourceFile;
-        public final Name InnerClasses;
-        public final Name Synthetic;
-        public final Name Bridge;
-        public final Name Deprecated;
-        public final Name Enum;
-        public final Name _name;
-        public final Name Signature;
-        public final Name Varargs;
-        public final Name Annotation;
-        public final Name RuntimeVisibleAnnotations;
-        public final Name RuntimeInvisibleAnnotations;
-        public final Name RuntimeVisibleParameterAnnotations;
-        public final Name RuntimeInvisibleParameterAnnotations;
-
-        public final Name Value;
-        public final Name EnclosingMethod;
-
-        public final Name desiredAssertionStatus;
-
-        public final Name append;
-        public final Name family;
-        public final Name forName;
-        public final Name toString;
-        public final Name length;
-        public final Name valueOf;
-        public final Name value;
-        public final Name getMessage;
-        public final Name getClass;
-
-        public final Name TYPE;
-        public final Name FIELD;
-        public final Name METHOD;
-        public final Name PARAMETER;
-        public final Name CONSTRUCTOR;
-        public final Name LOCAL_VARIABLE;
-        public final Name ANNOTATION_TYPE;
-        public final Name PACKAGE;
-
-        public final Name SOURCE;
-        public final Name CLASS;
-        public final Name RUNTIME;
-
-        public final Name Array;
-        public final Name Method;
-        public final Name Bound;
-        public final Name clone;
-        public final Name getComponentType;
-        public final Name getClassLoader;
-        public final Name initCause;
-        public final Name values;
-        public final Name iterator;
-        public final Name hasNext;
-        public final Name next;
-        public final Name AnnotationDefault;
-        public final Name ordinal;
-        public final Name equals;
-        public final Name hashCode;
-        public final Name compareTo;
-        public final Name getDeclaringClass;
-        public final Name ex;
-        public final Name finalize;
-    }
-
-    public boolean isEmpty() {
-        return len == 0;
     }
 }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java
new file mode 100644
index 0000000..663ff82
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java
@@ -0,0 +1,281 @@
+/*
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javac.util;
+
+/**
+ * Access to the compiler's name table.  STandard names are defined,
+ * as well as methods to create new names.
+ *
+ *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class Names {
+
+    public static final Context.Key<Names> namesKey = new Context.Key<Names>();
+
+    public static Names instance(Context context) {
+        Names instance = context.get(namesKey);
+        if (instance == null) {
+            instance = new Names(context);
+            context.put(namesKey, instance);
+        }
+        return instance;
+    }
+
+    public final Name slash;
+    public final Name hyphen;
+    public final Name T;
+    public final Name slashequals;
+    public final Name deprecated;
+    public final Name init;
+    public final Name clinit;
+    public final Name error;
+    public final Name any;
+    public final Name empty;
+    public final Name one;
+    public final Name period;
+    public final Name comma;
+    public final Name semicolon;
+    public final Name asterisk;
+    public final Name _this;
+    public final Name _super;
+    public final Name _default;
+    public final Name _class;
+    public final Name java_lang;
+    public final Name java_lang_Object;
+    public final Name java_lang_Class;
+    public final Name java_lang_Cloneable;
+    public final Name java_io_Serializable;
+    public final Name serialVersionUID;
+    public final Name java_lang_Enum;
+    public final Name package_info;
+    public final Name ConstantValue;
+    public final Name LineNumberTable;
+    public final Name LocalVariableTable;
+    public final Name LocalVariableTypeTable;
+    public final Name CharacterRangeTable;
+    public final Name StackMap;
+    public final Name StackMapTable;
+    public final Name SourceID;
+    public final Name CompilationID;
+    public final Name Code;
+    public final Name Exceptions;
+    public final Name SourceFile;
+    public final Name InnerClasses;
+    public final Name Synthetic;
+    public final Name Bridge;
+    public final Name Deprecated;
+    public final Name Enum;
+    public final Name _name;
+    public final Name Signature;
+    public final Name Varargs;
+    public final Name Annotation;
+    public final Name RuntimeVisibleAnnotations;
+    public final Name RuntimeInvisibleAnnotations;
+    public final Name RuntimeVisibleParameterAnnotations;
+    public final Name RuntimeInvisibleParameterAnnotations;
+    public final Name Value;
+    public final Name EnclosingMethod;
+    public final Name desiredAssertionStatus;
+    public final Name append;
+    public final Name family;
+    public final Name forName;
+    public final Name toString;
+    public final Name length;
+    public final Name valueOf;
+    public final Name value;
+    public final Name getMessage;
+    public final Name getClass;
+    public final Name TYPE;
+    public final Name FIELD;
+    public final Name METHOD;
+    public final Name PARAMETER;
+    public final Name CONSTRUCTOR;
+    public final Name LOCAL_VARIABLE;
+    public final Name ANNOTATION_TYPE;
+    public final Name PACKAGE;
+    public final Name SOURCE;
+    public final Name CLASS;
+    public final Name RUNTIME;
+    public final Name Array;
+    public final Name Method;
+    public final Name Bound;
+    public final Name clone;
+    public final Name getComponentType;
+    public final Name getClassLoader;
+    public final Name initCause;
+    public final Name values;
+    public final Name iterator;
+    public final Name hasNext;
+    public final Name next;
+    public final Name AnnotationDefault;
+    public final Name ordinal;
+    public final Name equals;
+    public final Name hashCode;
+    public final Name compareTo;
+    public final Name getDeclaringClass;
+    public final Name ex;
+    public final Name finalize;
+
+    public final Name.Table table;
+
+    public Names(Context context) {
+        Options options = Options.instance(context);
+        table = createTable(options);
+
+        slash = fromString("/");
+        hyphen = fromString("-");
+        T = fromString("T");
+        slashequals = fromString("/=");
+        deprecated = fromString("deprecated");
+
+        init = fromString("<init>");
+        clinit = fromString("<clinit>");
+        error = fromString("<error>");
+        any = fromString("<any>");
+        empty = fromString("");
+        one = fromString("1");
+        period = fromString(".");
+        comma = fromString(",");
+        semicolon = fromString(";");
+        asterisk = fromString("*");
+        _this = fromString("this");
+        _super = fromString("super");
+        _default = fromString("default");
+
+        _class = fromString("class");
+        java_lang = fromString("java.lang");
+        java_lang_Object = fromString("java.lang.Object");
+        java_lang_Class = fromString("java.lang.Class");
+        java_lang_Cloneable = fromString("java.lang.Cloneable");
+        java_io_Serializable = fromString("java.io.Serializable");
+        java_lang_Enum = fromString("java.lang.Enum");
+        package_info = fromString("package-info");
+        serialVersionUID = fromString("serialVersionUID");
+        ConstantValue = fromString("ConstantValue");
+        LineNumberTable = fromString("LineNumberTable");
+        LocalVariableTable = fromString("LocalVariableTable");
+        LocalVariableTypeTable = fromString("LocalVariableTypeTable");
+        CharacterRangeTable = fromString("CharacterRangeTable");
+        StackMap = fromString("StackMap");
+        StackMapTable = fromString("StackMapTable");
+        SourceID = fromString("SourceID");
+        CompilationID = fromString("CompilationID");
+        Code = fromString("Code");
+        Exceptions = fromString("Exceptions");
+        SourceFile = fromString("SourceFile");
+        InnerClasses = fromString("InnerClasses");
+        Synthetic = fromString("Synthetic");
+        Bridge = fromString("Bridge");
+        Deprecated = fromString("Deprecated");
+        Enum = fromString("Enum");
+        _name = fromString("name");
+        Signature = fromString("Signature");
+        Varargs = fromString("Varargs");
+        Annotation = fromString("Annotation");
+        RuntimeVisibleAnnotations = fromString("RuntimeVisibleAnnotations");
+        RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations");
+        RuntimeVisibleParameterAnnotations = fromString("RuntimeVisibleParameterAnnotations");
+        RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
+        Value = fromString("Value");
+        EnclosingMethod = fromString("EnclosingMethod");
+
+        desiredAssertionStatus = fromString("desiredAssertionStatus");
+
+        append = fromString("append");
+        family = fromString("family");
+        forName = fromString("forName");
+        toString = fromString("toString");
+        length = fromString("length");
+        valueOf = fromString("valueOf");
+        value = fromString("value");
+        getMessage = fromString("getMessage");
+        getClass = fromString("getClass");
+
+        TYPE = fromString("TYPE");
+        FIELD = fromString("FIELD");
+        METHOD = fromString("METHOD");
+        PARAMETER = fromString("PARAMETER");
+        CONSTRUCTOR = fromString("CONSTRUCTOR");
+        LOCAL_VARIABLE = fromString("LOCAL_VARIABLE");
+        ANNOTATION_TYPE = fromString("ANNOTATION_TYPE");
+        PACKAGE = fromString("PACKAGE");
+
+        SOURCE = fromString("SOURCE");
+        CLASS = fromString("CLASS");
+        RUNTIME = fromString("RUNTIME");
+
+        Array = fromString("Array");
+        Method = fromString("Method");
+        Bound = fromString("Bound");
+        clone = fromString("clone");
+        getComponentType = fromString("getComponentType");
+        getClassLoader = fromString("getClassLoader");
+        initCause = fromString("initCause");
+        values = fromString("values");
+        iterator = fromString("iterator");
+        hasNext = fromString("hasNext");
+        next = fromString("next");
+        AnnotationDefault = fromString("AnnotationDefault");
+        ordinal = fromString("ordinal");
+        equals = fromString("equals");
+        hashCode = fromString("hashCode");
+        compareTo = fromString("compareTo");
+        getDeclaringClass = fromString("getDeclaringClass");
+        ex = fromString("ex");
+        finalize = fromString("finalize");
+    }
+
+    protected Name.Table createTable(Options options) {
+        boolean useUnsharedTable = options.get("useUnsharedTable") != null;
+        if (useUnsharedTable)
+            return new UnsharedNameTable(this);
+        else
+            return new SharedNameTable(this);
+    }
+
+    public void dispose() {
+        table.dispose();
+    }
+
+    public Name fromChars(char[] cs, int start, int len) {
+        return table.fromChars(cs, start, len);
+    }
+
+    public Name fromString(String s) {
+        return table.fromString(s);
+    }
+
+    public Name fromUtf(byte[] cs) {
+        return table.fromUtf(cs);
+    }
+
+    public Name fromUtf(byte[] cs, int start, int len) {
+        return table.fromUtf(cs, start, len);
+    }
+}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/SharedNameTable.java b/langtools/src/share/classes/com/sun/tools/javac/util/SharedNameTable.java
new file mode 100644
index 0000000..4b4ed44
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/SharedNameTable.java
@@ -0,0 +1,221 @@
+/*
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javac.util;
+
+import java.lang.ref.SoftReference;
+
+/**
+ * Implementation of Name.Table that stores all names in a single shared
+ * byte array, expanding it as needed. This avoids the overhead incurred
+ * by using an array of bytes for each name.
+ *
+ *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class SharedNameTable extends Name.Table {
+    // maintain a freelist of recently used name tables for reuse.
+    private static List<SoftReference<SharedNameTable>> freelist = List.nil();
+
+    static public synchronized SharedNameTable create(Names names) {
+        while (freelist.nonEmpty()) {
+            SharedNameTable t = freelist.head.get();
+            freelist = freelist.tail;
+            if (t != null) {
+                return t;
+            }
+        }
+        return new SharedNameTable(names);
+    }
+
+    static private synchronized void dispose(SharedNameTable t) {
+        freelist = freelist.prepend(new SoftReference<SharedNameTable>(t));
+    }
+
+    /** The hash table for names.
+     */
+    private NameImpl[] hashes;
+
+    /** The shared byte array holding all encountered names.
+     */
+    public byte[] bytes;
+
+    /** The mask to be used for hashing
+     */
+    private int hashMask;
+
+    /** The number of filled bytes in `names'.
+     */
+    private int nc = 0;
+
+    /** Allocator
+     *  @param names The main name table
+     *  @param hashSize the (constant) size to be used for the hash table
+     *                  needs to be a power of two.
+     *  @param nameSize the initial size of the name table.
+     */
+    public SharedNameTable(Names names, int hashSize, int nameSize) {
+        super(names);
+        hashMask = hashSize - 1;
+        hashes = new NameImpl[hashSize];
+        bytes = new byte[nameSize];
+
+    }
+
+    public SharedNameTable(Names names) {
+        this(names, 0x8000, 0x20000);
+    }
+
+    @Override
+    public Name fromChars(char[] cs, int start, int len) {
+        int nc = this.nc;
+        byte[] bytes = this.bytes;
+        while (nc + len * 3 >= bytes.length) {
+            //          System.err.println("doubling name buffer of length " + names.length + " to fit " + len + " chars");//DEBUG
+            byte[] newnames = new byte[bytes.length * 2];
+            System.arraycopy(bytes, 0, newnames, 0, bytes.length);
+            bytes = this.bytes = newnames;
+        }
+        int nbytes = Convert.chars2utf(cs, start, bytes, nc, len) - nc;
+        int h = hashValue(bytes, nc, nbytes) & hashMask;
+        NameImpl n = hashes[h];
+        while (n != null &&
+                (n.getByteLength() != nbytes ||
+                !equals(bytes, n.index, bytes, nc, nbytes))) {
+            n = n.next;
+        }
+        if (n == null) {
+            n = new NameImpl(this);
+            n.index = nc;
+            n.length = nbytes;
+            n.next = hashes[h];
+            hashes[h] = n;
+            this.nc = nc + nbytes;
+            if (nbytes == 0) {
+                this.nc++;
+            }
+        }
+        return n;
+    }
+
+    @Override
+    public Name fromUtf(byte[] cs, int start, int len) {
+        int h = hashValue(cs, start, len) & hashMask;
+        NameImpl n = hashes[h];
+        byte[] names = this.bytes;
+        while (n != null &&
+                (n.getByteLength() != len || !equals(names, n.index, cs, start, len))) {
+            n = n.next;
+        }
+        if (n == null) {
+            int nc = this.nc;
+            while (nc + len > names.length) {
+                //              System.err.println("doubling name buffer of length + " + names.length + " to fit " + len + " bytes");//DEBUG
+                byte[] newnames = new byte[names.length * 2];
+                System.arraycopy(names, 0, newnames, 0, names.length);
+                names = this.bytes = newnames;
+            }
+            System.arraycopy(cs, start, names, nc, len);
+            n = new NameImpl(this);
+            n.index = nc;
+            n.length = len;
+            n.next = hashes[h];
+            hashes[h] = n;
+            this.nc = nc + len;
+            if (len == 0) {
+                this.nc++;
+            }
+        }
+        return n;
+    }
+
+    @Override
+    public void dispose() {
+        dispose(this);
+    }
+
+    static class NameImpl extends Name {
+        /** The next name occupying the same hash bucket.
+         */
+        NameImpl next;
+
+        /** The index where the bytes of this name are stored in the global name
+         *  buffer `byte'.
+         */
+        int index;
+
+        /** The number of bytes in this name.
+         */
+        int length;
+
+        NameImpl(SharedNameTable table) {
+            super(table);
+        }
+
+        @Override
+        public int getIndex() {
+            return index;
+        }
+
+        @Override
+        public int getByteLength() {
+            return length;
+        }
+
+        @Override
+        public byte getByteAt(int i) {
+            return getByteArray()[index + i];
+        }
+
+        @Override
+        public byte[] getByteArray() {
+            return ((SharedNameTable) table).bytes;
+        }
+
+        @Override
+        public int getByteOffset() {
+            return index;
+        }
+
+        /** Return the hash value of this name.
+         */
+        public int hashCode() {
+            return index;
+        }
+
+        /** Is this name equal to other?
+         */
+        public boolean equals(Object other) {
+            if (other instanceof Name)
+                return
+                    table == ((Name)other).table && index == ((Name) other).getIndex();
+            else return false;
+        }
+
+    }
+
+}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java b/langtools/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java
new file mode 100644
index 0000000..78a7541
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javac.util;
+
+import java.lang.ref.WeakReference;
+
+/**
+ * Implementation of Name.Table that stores names in individual arrays
+ * using weak references. It is recommended for use when a single shared
+ * byte array is unsuitable.
+ *
+ *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class UnsharedNameTable extends Name.Table {
+    static public Name.Table create(Names names) {
+        return new UnsharedNameTable(names);
+    }
+
+    static class HashEntry extends WeakReference<NameImpl> {
+        HashEntry next;
+        HashEntry(NameImpl referent) {
+            super(referent);
+        }
+    }
+
+    /** The hash table for names.
+     */
+    private HashEntry[] hashes = null;
+
+    /** The mask to be used for hashing
+     */
+    private int hashMask;
+
+    /** Index counter for names in this table.
+     */
+    public int index;
+
+    /** Allocator
+     *  @param names The main name table
+     *  @param hashSize the (constant) size to be used for the hash table
+     *                  needs to be a power of two.
+     */
+    public UnsharedNameTable(Names names, int hashSize) {
+        super(names);
+        hashMask = hashSize - 1;
+        hashes = new HashEntry[hashSize];
+    }
+
+    public UnsharedNameTable(Names names) {
+        this(names, 0x8000);
+    }
+
+
+    @Override
+    public Name fromChars(char[] cs, int start, int len) {
+        byte[] name = new byte[len * 3];
+        int nbytes = Convert.chars2utf(cs, start, name, 0, len);
+        return fromUtf(name, 0, nbytes);
+    }
+
+    @Override
+    public Name fromUtf(byte[] cs, int start, int len) {
+        int h = hashValue(cs, start, len) & hashMask;
+
+        HashEntry element = hashes[h];
+
+        NameImpl n = null;
+
+        HashEntry previousNonNullTableEntry = null;
+        HashEntry firstTableEntry = element;
+
+        while (element != null) {
+            if (element == null) {
+                break;
+            }
+
+            n = element.get();
+
+            if (n == null) {
+                if (firstTableEntry == element) {
+                    hashes[h] = firstTableEntry = element.next;
+                }
+                else {
+                    assert previousNonNullTableEntry != null : "previousNonNullTableEntry cannot be null here.";
+                    previousNonNullTableEntry.next = element.next;
+                }
+            }
+            else {
+                if (n.getByteLength() == len && equals(n.bytes, 0, cs, start, len)) {
+                    return n;
+                }
+                previousNonNullTableEntry = element;
+            }
+
+            element = element.next;
+        }
+
+        byte[] bytes = new byte[len];
+        System.arraycopy(cs, start, bytes, 0, len);
+        n = new NameImpl(this, bytes, index++);
+
+        System.arraycopy(cs, start, n.bytes, 0, len);
+
+        HashEntry newEntry = new HashEntry(n);
+
+        if (previousNonNullTableEntry == null) { // We are not the first name with that hashCode.
+            hashes[h] = newEntry;
+        }
+        else {
+            assert previousNonNullTableEntry.next == null : "previousNonNullTableEntry.next must be null.";
+            previousNonNullTableEntry.next = newEntry;
+        }
+
+        return n;
+    }
+
+    @Override
+    public void dispose() {
+        hashes = null;
+    }
+
+    static class NameImpl extends Name {
+        NameImpl(UnsharedNameTable table, byte[] bytes, int index) {
+            super(table);
+            this.bytes = bytes;
+            this.index = index;
+        }
+
+        final byte[] bytes;
+        final int index;
+
+        @Override
+        public int getIndex() {
+            return index;
+        }
+
+        @Override
+        public int getByteLength() {
+            return bytes.length;
+        }
+
+        @Override
+        public byte getByteAt(int i) {
+            return bytes[i];
+        }
+
+        @Override
+        public byte[] getByteArray() {
+            return bytes;
+        }
+
+        @Override
+        public int getByteOffset() {
+            return 0;
+        }
+
+    }
+
+}
diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java b/langtools/src/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java
index 0fc498a..dfccd5f 100644
--- a/langtools/src/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
@@ -27,17 +27,13 @@
 
 import com.sun.javadoc.*;
 
-import static com.sun.javadoc.LanguageVersion.*;
 
-import com.sun.tools.javac.code.Flags;
 import com.sun.tools.javac.code.Kinds;
 import com.sun.tools.javac.code.Scope;
-import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Position;
 
 /**
@@ -93,7 +89,7 @@
      * Elements are always public, so no need to filter them.
      */
     public AnnotationTypeElementDoc[] elements() {
-        Name.Table names = tsym.name.table;
+        Names names = tsym.name.table.names;
         List<AnnotationTypeElementDoc> elements = List.nil();
         for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
             if (e.sym != null && e.sym.kind == Kinds.MTH) {
diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
index 1d2adfc..18328a0 100644
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
@@ -25,8 +25,6 @@
 
 package com.sun.tools.javadoc;
 
-import java.util.*;
-
 import com.sun.javadoc.*;
 
 import static com.sun.javadoc.LanguageVersion.*;
@@ -40,7 +38,6 @@
 import com.sun.tools.javac.code.Kinds;
 import com.sun.tools.javac.code.TypeTags;
 import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Types;
 import com.sun.tools.javac.code.Type.ClassType;
 import com.sun.tools.javac.code.Scope;
 import com.sun.tools.javac.code.Symbol;
@@ -55,9 +52,9 @@
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
 import com.sun.tools.javac.tree.TreeInfo;
 
+import com.sun.tools.javac.util.Names;
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.*;
-import static com.sun.tools.javac.code.TypeTags.*;
 
 import java.io.File;
 import java.util.Set;
@@ -549,7 +546,7 @@
      * methods in this class.  Does not include constructors.
      */
     public MethodDoc[] methods(boolean filter) {
-        Name.Table names = tsym.name.table;
+        Names names = tsym.name.table.names;
         List<MethodDocImpl> methods = List.nil();
         for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
             if (e.sym != null &&
@@ -582,7 +579,7 @@
      * constructors in this class.
      */
     public ConstructorDoc[] constructors(boolean filter) {
-        Name.Table names = tsym.name.table;
+        Names names = tsym.name.table.names;
         List<ConstructorDocImpl> constructors = List.nil();
         for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
             if (e.sym != null &&
@@ -696,7 +693,7 @@
     }
 
     private ClassDoc searchClass(String className) {
-        Name.Table names = tsym.name.table;
+        Names names = tsym.name.table.names;
 
         // search by qualified name first
         ClassDoc cd = env.lookupClass(className);
@@ -848,7 +845,7 @@
          *---------------------------------*/
 
         // search current class
-        Name.Table names = tsym.name.table;
+        Names names = tsym.name.table.names;
         Scope.Entry e = tsym.members().lookup(names.fromString(methodName));
 
         //### Using modifier filter here isn't really correct,
@@ -936,7 +933,7 @@
      */
     public ConstructorDoc findConstructor(String constrName,
                                           String[] paramTypes) {
-        Name.Table names = tsym.name.table;
+        Names names = tsym.name.table.names;
         for (Scope.Entry e = tsym.members().lookup(names.fromString("<init>")); e.scope != null; e = e.next()) {
             if (e.sym.kind == Kinds.MTH) {
                 if (hasParameterTypes((MethodSymbol)e.sym, paramTypes)) {
@@ -973,7 +970,7 @@
     }
 
     private FieldDocImpl searchField(String fieldName, Set<ClassDocImpl> searched) {
-        Name.Table names = tsym.name.table;
+        Names names = tsym.name.table.names;
         if (searched.contains(this)) {
             return null;
         }
@@ -1040,7 +1037,7 @@
         Env<AttrContext> compenv = env.enter.getEnv(tsym);
         if (compenv == null) return new ClassDocImpl[0];
 
-        Name asterisk = tsym.name.table.asterisk;
+        Name asterisk = tsym.name.table.names.asterisk;
         for (JCTree t : compenv.toplevel.defs) {
             if (t.getTag() == JCTree.IMPORT) {
                 JCTree imp = ((JCImport) t).qualid;
@@ -1076,7 +1073,7 @@
         ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<PackageDocImpl>();
 
         //### Add the implicit "import java.lang.*" to the result
-        Name.Table names = tsym.name.table;
+        Names names = tsym.name.table.names;
         importedPackages.append(env.getPackageDoc(env.reader.enterPackage(names.java_lang)));
 
         Env<AttrContext> compenv = env.enter.getEnv(tsym);
diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java b/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java
index 8271f56..d8ddd70 100644
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -33,13 +33,11 @@
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.ClassType;
-import com.sun.tools.javac.code.Type.TypeVar;
 import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.Check;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Position;
 
 
@@ -83,7 +81,7 @@
     JavadocEnter enter;
 
     /** The name table. */
-    Name.Table names;
+    Names names;
 
     /** The encoding name. */
     private String encoding;
@@ -131,7 +129,7 @@
         reader = JavadocClassReader.instance0(context);
         enter = JavadocEnter.instance0(context);
         attr = Attr.instance(context);
-        names = Name.Table.instance(context);
+        names = Names.instance(context);
         externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
         chk = Check.instance(context);
         types = Types.instance(context);
diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java b/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java
index 3c60744..d9c6032 100644
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
@@ -82,7 +82,6 @@
         cpString = appendPath(System.getProperty("java.class.path"), cpString);
         cpString = appendPath(docletPath, cpString);
         URL[] urls = pathToURLs(cpString);
-        System.err.println("DocletInvoker urls=" + urls);
         appClassLoader = new URLClassLoader(urls);
 
         // attempt to find doclet
diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java b/langtools/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java
index 5a1a2b8..4162db4 100644
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/JavadocEnter.java b/langtools/src/share/classes/com/sun/tools/javadoc/JavadocEnter.java
index 0137a2b..0716c68 100644
--- a/langtools/src/share/classes/com/sun/tools/javadoc/JavadocEnter.java
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/JavadocEnter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java b/langtools/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java
index ce815b4..86fbff3 100644
--- a/langtools/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java b/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java
index b8feb4c..3935670 100644
--- a/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java b/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java
index 8908fea..838e274 100644
--- a/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc.  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
@@ -35,6 +35,7 @@
 import com.sun.tools.javac.code.Symbol.MethodSymbol;
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Names;
 
 /**
  * The serialized form is the specification of a class' serialization
@@ -149,7 +150,7 @@
      * name SERIALIZABLE_FIELDS.
      */
     private VarSymbol getDefinedSerializableFields(ClassSymbol def) {
-        Name.Table names = def.name.table;
+        Names names = def.name.table.names;
 
         /* SERIALIZABLE_FIELDS can be private,
          * so must lookup by ClassSymbol, not by ClassDocImpl.
@@ -202,7 +203,7 @@
      * @param visibility the visibility flag for the given method.
      */
     private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) {
-        Name.Table names = def.name.table;
+        Names names = def.name.table.names;
 
         for (Scope.Entry e = def.members().lookup(names.fromString(methodName)); e.scope != null; e = e.next()) {
             if (e.sym.kind == Kinds.MTH) {
@@ -228,7 +229,7 @@
     private void mapSerialFieldTagImplsToFieldDocImpls(FieldDocImpl spfDoc,
                                                        DocEnv env,
                                                        ClassSymbol def) {
-        Name.Table names = def.name.table;
+        Names names = def.name.table.names;
 
         SerialFieldTag[] sfTag = spfDoc.serialFieldTags();
         for (int i = 0; i < sfTag.length; i++) {
diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java b/langtools/src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java
index 09a91ea..29e0ca5 100644
--- a/langtools/src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
@@ -36,6 +36,7 @@
 import com.sun.tools.javac.code.Type.TypeVar;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
 
 /**
  * Implementation of <code>TypeVariable</code>, which
@@ -66,7 +67,7 @@
         if ((osym.kind & Kinds.TYP) != 0) {
             return env.getClassDoc((ClassSymbol)osym);
         }
-        Name.Table names = osym.name.table;
+        Names names = osym.name.table.names;
         if (osym.name == names.init) {
             return env.getConstructorDoc((MethodSymbol)osym);
         } else {
@@ -113,7 +114,7 @@
      */
     private static List<Type> getBounds(TypeVar v, DocEnv env) {
         Name boundname = v.getUpperBound().tsym.getQualifiedName();
-        if (boundname == boundname.table.java_lang_Object) {
+        if (boundname == boundname.table.names.java_lang_Object) {
             return List.nil();
         } else {
             return env.types.getBounds(v);
diff --git a/langtools/src/share/classes/com/sun/tools/javah/Gen.java b/langtools/src/share/classes/com/sun/tools/javah/Gen.java
index ef7c131..6b25569 100644
--- a/langtools/src/share/classes/com/sun/tools/javah/Gen.java
+++ b/langtools/src/share/classes/com/sun/tools/javah/Gen.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/src/share/classes/javax/lang/model/type/ErrorType.java b/langtools/src/share/classes/javax/lang/model/type/ErrorType.java
index 2a6a173..516d91e 100644
--- a/langtools/src/share/classes/javax/lang/model/type/ErrorType.java
+++ b/langtools/src/share/classes/javax/lang/model/type/ErrorType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
@@ -25,10 +25,6 @@
 
 package javax.lang.model.type;
 
-
-import javax.lang.model.element.TypeElement;
-
-
 /**
  * Represents a class or interface type that cannot be properly modeled.
  * This may be the result of a processing error,
diff --git a/langtools/src/share/classes/javax/tools/StandardLocation.java b/langtools/src/share/classes/javax/tools/StandardLocation.java
index a979aef..09b1157 100644
--- a/langtools/src/share/classes/javax/tools/StandardLocation.java
+++ b/langtools/src/share/classes/javax/tools/StandardLocation.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/Makefile b/langtools/test/Makefile
index 4f5c3b2..d09f2f4 100644
--- a/langtools/test/Makefile
+++ b/langtools/test/Makefile
@@ -105,7 +105,6 @@
           -w:$(TEST_OUTPUT_DIR)/JTwork \
           -jdk:$(TESTJAVA) \
 	  -Xbootclasspath/p:$(TESTBOOTCLASSPATH) \
-	  -exclude:bootclasspath-exclude.jtx \
           $(JAVA_TOOL_OPTIONS:%=-vmoption:%) \
           $(JAVA_ARGS:%=-vmoption:%) \
           $(TESTDIRS)
diff --git a/langtools/test/bootclasspath-exclude.jtx b/langtools/test/bootclasspath-exclude.jtx
deleted file mode 100644
index 7993d37..0000000
--- a/langtools/test/bootclasspath-exclude.jtx
+++ /dev/null
@@ -1,7 +0,0 @@
-# When you run the tests using a recent build of JDK and -Xbootclasspath/p:JAR
-# some tests may fail. Specifically, javac has a test which verifies the content
-# of the version string by comparing it against a value that is derived from
-# the JRE version string. This file can be given to jtreg to exclude such tests.
-# It should *NOT* be used in full SQE runs.
-
-tools/javac/versionOpt.sh
diff --git a/langtools/test/tools/javac/5045412/Bar.java b/langtools/test/tools/javac/5045412/Bar.java
index 6976dcd..6f93f3b 100644
--- a/langtools/test/tools/javac/5045412/Bar.java
+++ b/langtools/test/tools/javac/5045412/Bar.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/5045412/Foo.java b/langtools/test/tools/javac/5045412/Foo.java
index 34fc285..4c4b3bb 100644
--- a/langtools/test/tools/javac/5045412/Foo.java
+++ b/langtools/test/tools/javac/5045412/Foo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/6199662/Tree.java b/langtools/test/tools/javac/6199662/Tree.java
index 7034618..80890c1 100644
--- a/langtools/test/tools/javac/6199662/Tree.java
+++ b/langtools/test/tools/javac/6199662/Tree.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/6304921/TestLog.java b/langtools/test/tools/javac/6304921/TestLog.java
index 684dd93..3cd94c5 100644
--- a/langtools/test/tools/javac/6304921/TestLog.java
+++ b/langtools/test/tools/javac/6304921/TestLog.java
@@ -34,6 +34,7 @@
 import javax.tools.SimpleJavaFileObject;
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.parser.Parser;
+import com.sun.tools.javac.parser.ParserFactory;
 import com.sun.tools.javac.parser.Scanner;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.TreeScanner;
@@ -60,7 +61,7 @@
 
         JavacFileManager.preRegister(context);
         Scanner.Factory sfac = Scanner.Factory.instance(context);
-        Parser.Factory pfac = Parser.Factory.instance(context);
+        ParserFactory pfac = ParserFactory.instance(context);
 
         final String text =
               "public class Foo {\n"
@@ -74,9 +75,9 @@
         JavaFileObject fo = new StringJavaFileObject("Foo", text);
         log.useSource(fo);
 
-        Scanner s = sfac.newScanner(fo.getCharContent(true));
-        Parser parser = pfac.newParser(s, false, genEndPos);
-        JCTree.JCCompilationUnit tree = parser.compilationUnit();
+        CharSequence cs = fo.getCharContent(true);
+        Parser parser = pfac.newParser(cs, false, genEndPos, false);
+        JCTree.JCCompilationUnit tree = parser.parseCompilationUnit();
         log.setEndPosTable(fo, tree.endPositions);
 
         TreeScanner ts = new LogTester(log, tree.endPositions);
diff --git a/langtools/test/tools/javac/6627362/T6627362.java b/langtools/test/tools/javac/6627362/T6627362.java
index 7230501..a7da200 100644
--- a/langtools/test/tools/javac/6627362/T6627362.java
+++ b/langtools/test/tools/javac/6627362/T6627362.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/6627362/x/E.java b/langtools/test/tools/javac/6627362/x/E.java
index 0ca1ee8..671cd63 100644
--- a/langtools/test/tools/javac/6627362/x/E.java
+++ b/langtools/test/tools/javac/6627362/x/E.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/6627362/x/Object.java b/langtools/test/tools/javac/6627362/x/Object.java
index f618a22..b4863e0 100644
--- a/langtools/test/tools/javac/6627362/x/Object.java
+++ b/langtools/test/tools/javac/6627362/x/Object.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/VersionOpt.java b/langtools/test/tools/javac/VersionOpt.java
new file mode 100644
index 0000000..43b62ce
--- /dev/null
+++ b/langtools/test/tools/javac/VersionOpt.java
@@ -0,0 +1,104 @@
+
+/*
+ * Copyright 2005-2008 Sun Microsystems, Inc.  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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6728697
+ * @summary tools/javac/versionOpt.sh fails on OpenJDK builds
+ * Test checks the version strings displayed by javac, using
+ * strings that come out of the Java runtime.
+ */
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+
+public class VersionOpt {
+    public static void main(String... args) throws Exception {
+        new VersionOpt().run();
+    }
+
+    void run() throws Exception {
+        // Test functions by comparing the version string from javac against
+        // a "golden" version generated automatically from the underlying JVM.
+        // As such, it is only effective in testing the "standard" compiler,
+        // and not any development version being tested via -Xbootclasspath.
+        // Check the version of the compiler being used, and let the test pass
+        // automatically if is is a development version.
+        Class<?> javacClass = com.sun.tools.javac.Main.class;
+        URL javacURL = getClass().getClassLoader().getResource(javacClass.getName().replace(".", "/") + ".class");
+        if (!javacURL.getProtocol().equals("jar") || !javacURL.getFile().contains("!")) {
+            System.err.println("javac not found in tools.jar: " + javacURL);
+            System.err.println("rest of test skipped");
+            return;
+        }
+        String javacHome = javacURL.getFile().substring(0, javacURL.getFile().indexOf("!"));
+
+        File javaHome = new File(System.getProperty("java.home"));
+        if (javaHome.getName().equals("jre"))
+            javaHome = javaHome.getParentFile();
+        File toolsJar = new File(new File(javaHome, "lib"), "tools.jar");
+
+        if (!javacHome.equals(toolsJar.toURI().toString())){
+            System.err.println("javac not found in tools.jar: " + javacHome);
+            System.err.println("rest of test skipped");
+            return;
+        }
+
+        System.out.println("javac found in " + toolsJar);
+
+        String javaVersion = System.getProperty("java.version");
+        String javaRuntimeVersion = System.getProperty("java.runtime.version");
+        System.out.println("java.version: " + javaVersion);
+        System.out.println("java.runtime.version: " + javaRuntimeVersion);
+
+        StringWriter sw = new StringWriter();
+        com.sun.tools.javac.Main.compile(new String[] { "-version" }, new PrintWriter(sw));
+        String javacVersion = sw.toString().trim();
+
+        sw = new StringWriter();
+        com.sun.tools.javac.Main.compile(new String[] { "-fullversion" }, new PrintWriter(sw));
+        String javacFullVersion = sw.toString().trim();
+        System.out.println("javac -version: " + javacVersion);
+        System.out.println("javac -fullversion: " + javacFullVersion);
+
+        checkEqual("javac -version", javacVersion, "javac " + javaVersion);
+        checkEqual("javac -fullversion", javacFullVersion, "javac full version \"" + javaRuntimeVersion + "\"");
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    void checkEqual(String kind, String found, String expect) {
+        if (!found.equals(expect)) {
+            System.err.println("error: unexpected value for " + kind);
+            System.err.println("expect: >>" + expect + "<<");
+            System.err.println(" found: >>" + found + "<<");
+            errors++;
+        }
+    }
+
+    int errors;
+}
diff --git a/langtools/test/tools/javac/api/6557752/T6557752.java b/langtools/test/tools/javac/api/6557752/T6557752.java
new file mode 100644
index 0000000..9910b4c
--- /dev/null
+++ b/langtools/test/tools/javac/api/6557752/T6557752.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+/*
+ * @test
+ * @bug     6557752
+ * @summary Test for wrapping the original type in ErrorType.
+ * @library ../lib
+ * @compile T6557752.java
+ * @run main T6557752
+ */
+
+import com.sun.source.tree.AssignmentTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.MethodInvocationTree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreePath;
+import com.sun.source.util.TreePathScanner;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.util.List;
+import java.io.IOException;
+import java.net.URI;
+import javax.lang.model.type.ErrorType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+import javax.lang.model.util.Types;
+
+public class T6557752 {
+    static class MyFileObject extends SimpleJavaFileObject {
+        public MyFileObject() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+        }
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return "import java.util.*;\n"
+                + "public class Test {\n"
+                + "    void foobar() {\n"
+                + "        Iterator<Number> itr = null;\n"
+                + "        String str = itr.next();\n"
+                + "        FooBar fooBar = FooBar.foobar();\n"
+                + "    }\n"
+                + "}";
+        }
+    }
+    static Trees trees;
+    static JavacTask task = null;
+    public static void main(String[] args) throws IOException {
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        task = (JavacTask) compiler.getTask(null, null, null, null, null, List.of(new MyFileObject()));
+        Iterable<? extends CompilationUnitTree> asts = task.parse();
+        task.analyze();
+        trees = Trees.instance(task);
+        MyVisitor myVisitor = new MyVisitor();
+        for (CompilationUnitTree ast : asts) {
+            myVisitor.compilationUnit = ast;
+            myVisitor.scan(ast, null);
+        }
+
+        if (!myVisitor.foundError) {
+            throw new AssertionError("Expected error not found!");
+        }
+    }
+
+    static class MyVisitor extends TreePathScanner<Void,Void> {
+        public boolean foundError = false;
+        CompilationUnitTree compilationUnit = null;
+        int i = 0;
+        @Override
+        public Void visitMethodInvocation(MethodInvocationTree node, Void ignored) {
+            TreePath path = TreePath.getPath(compilationUnit, node);
+            TypeMirror typeMirror = trees.getTypeMirror(path);
+            if (typeMirror.getKind() == TypeKind.ERROR) {
+              if (i == 0) {
+                String str1 = trees.getOriginalType((ErrorType)typeMirror).toString();
+                if (!str1.equals("java.lang.Number")) {
+                    throw new AssertionError("Trees.getOriginalType() error!");
+                }
+
+                Types types = task.getTypes();
+
+                str1 = types.asElement(trees.getOriginalType((ErrorType)typeMirror)).toString();
+                if (!str1.equals("java.lang.Number")) {
+                    throw new AssertionError("Types.asElement() error!");
+                }
+
+                i++;
+              }
+              else if (i == 1) {
+                String str1 = trees.getOriginalType((ErrorType)typeMirror).toString();
+                if (!str1.equals("FooBar")) {
+                    throw new AssertionError("Trees.getOriginalType() error!");
+                }
+
+                Types types = task.getTypes();
+
+                if (types.asElement(trees.getOriginalType((ErrorType)typeMirror)) != null) {
+                    throw new AssertionError("Ttypes.asElement() error!");
+                }
+                foundError = true;
+              }
+            }
+
+
+            return null;
+        }
+
+    }
+}
diff --git a/langtools/test/tools/javac/foreach/T6500701.java b/langtools/test/tools/javac/foreach/T6500701.java
index b131f27..a3862bb 100644
--- a/langtools/test/tools/javac/foreach/T6500701.java
+++ b/langtools/test/tools/javac/foreach/T6500701.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Boolean.java b/langtools/test/tools/javac/synthesize/Boolean.java
index 12427a0..01e193f 100644
--- a/langtools/test/tools/javac/synthesize/Boolean.java
+++ b/langtools/test/tools/javac/synthesize/Boolean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Byte.java b/langtools/test/tools/javac/synthesize/Byte.java
index 4b7600c..074adb5 100644
--- a/langtools/test/tools/javac/synthesize/Byte.java
+++ b/langtools/test/tools/javac/synthesize/Byte.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Character.java b/langtools/test/tools/javac/synthesize/Character.java
index 9eefdb2..e3d8227 100644
--- a/langtools/test/tools/javac/synthesize/Character.java
+++ b/langtools/test/tools/javac/synthesize/Character.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Cloneable.java b/langtools/test/tools/javac/synthesize/Cloneable.java
index 018159a..feebb87 100644
--- a/langtools/test/tools/javac/synthesize/Cloneable.java
+++ b/langtools/test/tools/javac/synthesize/Cloneable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Integer.java b/langtools/test/tools/javac/synthesize/Integer.java
index 52c4722..177f681 100644
--- a/langtools/test/tools/javac/synthesize/Integer.java
+++ b/langtools/test/tools/javac/synthesize/Integer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Long.java b/langtools/test/tools/javac/synthesize/Long.java
index 748b421..6b7f28a 100644
--- a/langtools/test/tools/javac/synthesize/Long.java
+++ b/langtools/test/tools/javac/synthesize/Long.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Main.java b/langtools/test/tools/javac/synthesize/Main.java
index 33b75a1..bc28991 100644
--- a/langtools/test/tools/javac/synthesize/Main.java
+++ b/langtools/test/tools/javac/synthesize/Main.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Number.java b/langtools/test/tools/javac/synthesize/Number.java
index efef792..6ba3eaa 100644
--- a/langtools/test/tools/javac/synthesize/Number.java
+++ b/langtools/test/tools/javac/synthesize/Number.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Object.java b/langtools/test/tools/javac/synthesize/Object.java
index c52acf9..e421d61 100644
--- a/langtools/test/tools/javac/synthesize/Object.java
+++ b/langtools/test/tools/javac/synthesize/Object.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Serializable.java b/langtools/test/tools/javac/synthesize/Serializable.java
index b5b761e..0de135b 100644
--- a/langtools/test/tools/javac/synthesize/Serializable.java
+++ b/langtools/test/tools/javac/synthesize/Serializable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Short.java b/langtools/test/tools/javac/synthesize/Short.java
index 3d674c2..225e790 100644
--- a/langtools/test/tools/javac/synthesize/Short.java
+++ b/langtools/test/tools/javac/synthesize/Short.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Test.java b/langtools/test/tools/javac/synthesize/Test.java
index fc87318..67e0b6a 100644
--- a/langtools/test/tools/javac/synthesize/Test.java
+++ b/langtools/test/tools/javac/synthesize/Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/synthesize/Void.java b/langtools/test/tools/javac/synthesize/Void.java
index 18415a4..b57b7e9 100644
--- a/langtools/test/tools/javac/synthesize/Void.java
+++ b/langtools/test/tools/javac/synthesize/Void.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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
diff --git a/langtools/test/tools/javac/unit/util/convert/EnclosingCandidates.java b/langtools/test/tools/javac/unit/util/convert/EnclosingCandidates.java
index dadfa5e..3f09081 100644
--- a/langtools/test/tools/javac/unit/util/convert/EnclosingCandidates.java
+++ b/langtools/test/tools/javac/unit/util/convert/EnclosingCandidates.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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
@@ -36,7 +36,7 @@
 
 public class EnclosingCandidates {
 
-    Name.Table names = Name.Table.instance(new Context());
+    Names names = Names.instance(new Context());
 
     void test(String name, String... expected) {
         List<Name> result = enclosingCandidates(names.fromString(name));
diff --git a/langtools/test/tools/javac/versionOpt.sh b/langtools/test/tools/javac/versionOpt.sh
deleted file mode 100644
index e390f80..0000000
--- a/langtools/test/tools/javac/versionOpt.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright 2005 Sun Microsystems, Inc.  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.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
-# CA 95054 USA or visit www.sun.com if you need additional information or
-# have any questions.
-#
-
-
-# @test
-# @bug 4461214 6227587
-# @summary support-version and -fullversion
-# @run shell versionOpt.sh
-
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux )
-    NULL=/dev/null
-    PS=":"
-    FS="/"
-    ;;
-  Windows* )
-    NULL=NUL
-    PS=";"
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-# create reference files based on java values
-"${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -version 2>&1 | \
-    sed -e 's/java version "\([^"]*\)"/javac \1/' -e '2,$d' > version.ref.out
-
-"${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -fullversion 2>&1 | \
-    sed -e 's/java full version/javac full version/' -e '2,$d' > fullversion.ref.out
-
-# run javac
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -version 2> version.out
-cat version.out
-diff -c version.ref.out version.out
-version_result=$?
-
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -fullversion 2> fullversion.out
-cat fullversion.out
-diff -c fullversion.ref.out fullversion.out
-fullversion_result=$?
-
-if [ $version_result -eq 0 -a $fullversion_result -eq 0 ]
-then
-  echo "Passed"
-  exit 0
-else
-  echo "Failed"
-  exit 1
-fi
-
-
-
-
diff --git a/make/jprt.gmk b/make/jprt.gmk
index d1764e1..fcf67f8 100644
--- a/make/jprt.gmk
+++ b/make/jprt.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright 2006-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2006-2008 Sun Microsystems, Inc.  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