Merge
authorlana
Fri, 23 Sep 2011 23:29:56 -0700
changeset 10610 13b9a7aee6f3
parent 10609 0caee7f44e7b (current diff)
parent 10465 429da7734bf4 (diff)
child 10611 3a8a66de0892
Merge
--- a/.hgtags	Fri Sep 23 14:24:04 2011 +0100
+++ b/.hgtags	Fri Sep 23 23:29:56 2011 -0700
@@ -125,3 +125,5 @@
 de9223c94f9c710b3eebb599cd3586f36c8b94a9 jdk8-b01
 1b9d19620eb4606a25b1e28f86d66c8bfa867e06 jdk8-b02
 6815e85bf96d6d3875954f9777660372cd70d065 jdk8-b03
+31f5c34d78081572ad9a2401c0bb0c6b9711dd65 jdk8-b04
+c4f9ea1ecb55ff44e0dd21d2888ead308c86a3aa jdk8-b05
--- a/.hgtags-top-repo	Fri Sep 23 14:24:04 2011 +0100
+++ b/.hgtags-top-repo	Fri Sep 23 23:29:56 2011 -0700
@@ -125,3 +125,5 @@
 f42e3d9394b40a423d345b8da22687b5462e5f25 jdk8-b01
 69f592185747226a9c765a9fe139c1d34d616f9c jdk8-b02
 587bb549dff83131b65f40aa51864f69562f34a7 jdk8-b03
+0b66a233bfb9ba2ebda1e5cdfdb0373d6c1e3c69 jdk8-b04
+b910aac18c772b823b1f7da03e2c6528725cc6de jdk8-b05
--- a/corba/.hgtags	Fri Sep 23 14:24:04 2011 +0100
+++ b/corba/.hgtags	Fri Sep 23 23:29:56 2011 -0700
@@ -125,3 +125,5 @@
 949fb60ca830364571e7c4c9964e6b351ca929ec jdk8-b01
 ed8d94519a87b4adac270c3eec9134ff1f62bff5 jdk8-b02
 cd0da00694fbce642db9be936d3e4909a71d911d jdk8-b03
+60a68d688e24473cf84dedd1e60901a61ab82555 jdk8-b04
+cc1b599b986a37cb57de4584c5e58169766ca535 jdk8-b05
--- a/hotspot/.hgtags	Fri Sep 23 14:24:04 2011 +0100
+++ b/hotspot/.hgtags	Fri Sep 23 23:29:56 2011 -0700
@@ -177,3 +177,5 @@
 0cc8a70952c368e06de2adab1f2649a408f5e577 jdk8-b01
 31e253c1da429124bb87570ab095d9bc89850d0a jdk8-b02
 3a2fb61165dfc72e398179a2796d740c8da5b8c0 jdk8-b03
+0fa3ace511fe98fe948e751531f3e2b7c60c8376 jdk8-b04
+dce7d24674f4d0bed00de24f00119057fdce7cfb jdk8-b05
--- a/jaxp/.hgtags	Fri Sep 23 14:24:04 2011 +0100
+++ b/jaxp/.hgtags	Fri Sep 23 23:29:56 2011 -0700
@@ -125,3 +125,5 @@
 4f0fcb812767594fe9de509f946b56942db5a2f0 jdk8-b01
 ca4d6ad55a660f0469882e85b4dacf7822d50abf jdk8-b02
 7a74371ce0c64108b857c497ae130dfe9514532c jdk8-b03
+acbcadef0b21582abf406f07f1b74d2b8f80dc01 jdk8-b04
+ff0a3d78e7a22743eabbaa71e9d17b2f094ddf62 jdk8-b05
--- a/jaxws/.hgtags	Fri Sep 23 14:24:04 2011 +0100
+++ b/jaxws/.hgtags	Fri Sep 23 23:29:56 2011 -0700
@@ -125,3 +125,5 @@
 64df57a1edeca74388bd62f0a87d056db981fbdf jdk8-b01
 1034127ed402e9d0f1ed1477238ef594e9cc8da6 jdk8-b02
 7dcb0307508f408507d878cd7c2048c102b15158 jdk8-b03
+3f6f08163331ed75b30a6de1246670ce655645c8 jdk8-b04
+7d5d91fddbceb1fc3ae7ff409e732ae4a0391b34 jdk8-b05
--- a/jdk/.hgtags	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/.hgtags	Fri Sep 23 23:29:56 2011 -0700
@@ -126,3 +126,4 @@
 13e70aa1398eb959c54bc68b783ca0eef1286ad2 jdk8-b02
 7989ee9fe673a87f4db3917fa6a005732a6a9b85 jdk8-b03
 fc569517f3cf242f90ce3503b743eb5553938946 jdk8-b04
+0b32369b83d81c226a2e79e730f3a8c0d2595e92 jdk8-b05
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Fri Sep 23 23:29:56 2011 -0700
@@ -529,21 +529,25 @@
         Locale l = fc.getLocale();
 
         enterFolderNameLabelText = UIManager.getString("FileChooser.enterFolderNameLabelText",l);
-        enterFolderNameLabelMnemonic = UIManager.getInt("FileChooser.enterFolderNameLabelMnemonic");
+        enterFolderNameLabelMnemonic = getMnemonic("FileChooser.enterFolderNameLabelMnemonic", l);
         enterFileNameLabelText = UIManager.getString("FileChooser.enterFileNameLabelText",l);
-        enterFileNameLabelMnemonic = UIManager.getInt("FileChooser.enterFileNameLabelMnemonic");
+        enterFileNameLabelMnemonic = getMnemonic("FileChooser.enterFileNameLabelMnemonic", l);
 
         filesLabelText = UIManager.getString("FileChooser.filesLabelText",l);
-        filesLabelMnemonic = UIManager.getInt("FileChooser.filesLabelMnemonic");
+        filesLabelMnemonic = getMnemonic("FileChooser.filesLabelMnemonic", l);
 
         foldersLabelText = UIManager.getString("FileChooser.foldersLabelText",l);
-        foldersLabelMnemonic = UIManager.getInt("FileChooser.foldersLabelMnemonic");
+        foldersLabelMnemonic = getMnemonic("FileChooser.foldersLabelMnemonic", l);
 
         pathLabelText = UIManager.getString("FileChooser.pathLabelText",l);
-        pathLabelMnemonic = UIManager.getInt("FileChooser.pathLabelMnemonic");
+        pathLabelMnemonic = getMnemonic("FileChooser.pathLabelMnemonic", l);
 
         filterLabelText = UIManager.getString("FileChooser.filterLabelText",l);
-        filterLabelMnemonic = UIManager.getInt("FileChooser.filterLabelMnemonic");
+        filterLabelMnemonic = getMnemonic("FileChooser.filterLabelMnemonic", l);
+    }
+
+    private Integer getMnemonic(String key, Locale l) {
+        return SwingUtilities2.getUIDefaultsInt(key, l);
     }
 
     protected void installIcons(JFileChooser fc) {
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java	Fri Sep 23 23:29:56 2011 -0700
@@ -1215,11 +1215,6 @@
             "EditorPane.focusInputMap", multilineInputMap,
 
 
-            "FileChooser.pathLabelMnemonic", new Integer(KeyEvent.VK_P), // 'p'
-            "FileChooser.filterLabelMnemonic", new Integer (KeyEvent.VK_R), // 'r'
-            "FileChooser.foldersLabelMnemonic", new Integer (KeyEvent.VK_L), // 'l'
-            "FileChooser.filesLabelMnemonic", new Integer (KeyEvent.VK_I), // 'i'
-            "FileChooser.enterFileNameLabelMnemonic", new Integer (KeyEvent.VK_N), // 'n'
             "FileChooser.ancestorInputMap",
                new UIDefaults.LazyInputMap(new Object[] {
                      "ESCAPE", "cancelSelection"
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -27,10 +27,15 @@
 FileChooser.updateButtonText=Update
 FileChooser.helpButtonText=Help
 FileChooser.pathLabelText=Enter path or folder name:
+FileChooser.pathLabelMnemonic=80
 FileChooser.filterLabelText=Filter
+FileChooser.filterLabelMnemonic=82
 FileChooser.foldersLabelText=Folders
+FileChooser.foldersLabelMnemonic=76
 FileChooser.filesLabelText=Files
+FileChooser.filesLabelMnemonic=73
 FileChooser.enterFileNameLabelText=Enter file name:
+FileChooser.enterFileNameLabelMnemonic=78
 FileChooser.enterFolderNameLabelText=Enter folder name:
 
 FileChooser.cancelButtonToolTipText=Abort file chooser dialog.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -27,10 +27,15 @@
 FileChooser.updateButtonText=Aktualisieren
 FileChooser.helpButtonText=Hilfe
 FileChooser.pathLabelText=Pfad- oder Ordnernamen eingeben:
+FileChooser.pathLabelMnemonic=80
 FileChooser.filterLabelText=Filter
+FileChooser.filterLabelMnemonic=82
 FileChooser.foldersLabelText=Ordner
+FileChooser.foldersLabelMnemonic=76
 FileChooser.filesLabelText=Dateien
+FileChooser.filesLabelMnemonic=73
 FileChooser.enterFileNameLabelText=Dateinamen eingeben:
+FileChooser.enterFileNameLabelMnemonic=78
 FileChooser.enterFolderNameLabelText=Ordnernamen eingeben:
 
 FileChooser.cancelButtonToolTipText=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -27,10 +27,15 @@
 FileChooser.updateButtonText=Actualizar
 FileChooser.helpButtonText=Ayuda
 FileChooser.pathLabelText=Introducir nombre de la ruta de acceso o carpeta:
+FileChooser.pathLabelMnemonic=80
 FileChooser.filterLabelText=Filtro
+FileChooser.filterLabelMnemonic=82
 FileChooser.foldersLabelText=Carpetas
+FileChooser.foldersLabelMnemonic=76
 FileChooser.filesLabelText=Archivos
+FileChooser.filesLabelMnemonic=73
 FileChooser.enterFileNameLabelText=Introducir nombre de archivo:
+FileChooser.enterFileNameLabelMnemonic=78
 FileChooser.enterFolderNameLabelText=Introducir nombre de carpeta:
 
 FileChooser.cancelButtonToolTipText=Abortar cuadro de di\u00E1logo del selector de archivos.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -27,10 +27,15 @@
 FileChooser.updateButtonText=Mettre \u00E0 jour
 FileChooser.helpButtonText=Aide
 FileChooser.pathLabelText=Entrez le chemin ou le nom du dossier :
+FileChooser.pathLabelMnemonic=80
 FileChooser.filterLabelText=Filtre
+FileChooser.filterLabelMnemonic=82
 FileChooser.foldersLabelText=Dossiers
+FileChooser.foldersLabelMnemonic=76
 FileChooser.filesLabelText=Fichiers
+FileChooser.filesLabelMnemonic=73
 FileChooser.enterFileNameLabelText=Entrez le nom du fichier :
+FileChooser.enterFileNameLabelMnemonic=78
 FileChooser.enterFolderNameLabelText=Entrez le nom du dossier :
 
 FileChooser.cancelButtonToolTipText=Ferme la bo\u00EEte de dialogue du s\u00E9lecteur de fichiers.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -27,10 +27,15 @@
 FileChooser.updateButtonText=Aggiorna
 FileChooser.helpButtonText=?
 FileChooser.pathLabelText=Percorso o nome cartella:
+FileChooser.pathLabelMnemonic=80
 FileChooser.filterLabelText=Filtro
+FileChooser.filterLabelMnemonic=82
 FileChooser.foldersLabelText=Cartelle
+FileChooser.foldersLabelMnemonic=76
 FileChooser.filesLabelText=File
+FileChooser.filesLabelMnemonic=73
 FileChooser.enterFileNameLabelText=Nome file:
+FileChooser.enterFileNameLabelMnemonic=78
 FileChooser.enterFolderNameLabelText=Nome cartella:
 
 FileChooser.cancelButtonToolTipText=Chiude la finestra di dialogo di selezione file.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ja.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ja.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -27,10 +27,15 @@
 FileChooser.updateButtonText=\u66F4\u65B0
 FileChooser.helpButtonText=\u30D8\u30EB\u30D7
 FileChooser.pathLabelText=\u30D1\u30B9\u307E\u305F\u306F\u30D5\u30A9\u30EB\u30C0\u540D\u3092\u5165\u529B:
+FileChooser.pathLabelMnemonic=80
 FileChooser.filterLabelText=\u30D5\u30A3\u30EB\u30BF
+FileChooser.filterLabelMnemonic=82
 FileChooser.foldersLabelText=\u30D5\u30A9\u30EB\u30C0
+FileChooser.foldersLabelMnemonic=76
 FileChooser.filesLabelText=\u30D5\u30A1\u30A4\u30EB
+FileChooser.filesLabelMnemonic=73
 FileChooser.enterFileNameLabelText=\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u5165\u529B:
+FileChooser.enterFileNameLabelMnemonic=78
 FileChooser.enterFolderNameLabelText=\u30D5\u30A9\u30EB\u30C0\u540D\u3092\u5165\u529B:
 
 FileChooser.cancelButtonToolTipText=\u30D5\u30A1\u30A4\u30EB\u30FB\u30C1\u30E5\u30FC\u30B6\u30FB\u30C0\u30A4\u30A2\u30ED\u30B0\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -27,10 +27,15 @@
 FileChooser.updateButtonText=\uAC31\uC2E0
 FileChooser.helpButtonText=\uB3C4\uC6C0\uB9D0
 FileChooser.pathLabelText=\uACBD\uB85C \uB610\uB294 \uD3F4\uB354 \uC774\uB984 \uC785\uB825:
+FileChooser.pathLabelMnemonic=80
 FileChooser.filterLabelText=\uD544\uD130
+FileChooser.filterLabelMnemonic=82
 FileChooser.foldersLabelText=\uD3F4\uB354
+FileChooser.foldersLabelMnemonic=76
 FileChooser.filesLabelText=\uD30C\uC77C
+FileChooser.filesLabelMnemonic=73
 FileChooser.enterFileNameLabelText=\uD30C\uC77C \uC774\uB984 \uC785\uB825:
+FileChooser.enterFileNameLabelMnemonic=78
 FileChooser.enterFolderNameLabelText=\uD3F4\uB354 \uC774\uB984 \uC785\uB825:
 
 FileChooser.cancelButtonToolTipText=\uD30C\uC77C \uC120\uD0DD\uAE30 \uB300\uD654\uC0C1\uC790\uB97C \uC911\uB2E8\uD569\uB2C8\uB2E4.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -27,10 +27,15 @@
 FileChooser.updateButtonText=Atualizar
 FileChooser.helpButtonText=Ajuda
 FileChooser.pathLabelText=Informar caminho ou nome da pasta:
+FileChooser.pathLabelMnemonic=80
 FileChooser.filterLabelText=Filtro
+FileChooser.filterLabelMnemonic=82
 FileChooser.foldersLabelText=Pastas
+FileChooser.foldersLabelMnemonic=76
 FileChooser.filesLabelText=Arquivos
+FileChooser.filesLabelMnemonic=73
 FileChooser.enterFileNameLabelText=Informar nome do arquivo:
+FileChooser.enterFileNameLabelMnemonic=78
 FileChooser.enterFolderNameLabelText=Informar nome da pasta:
 
 FileChooser.cancelButtonToolTipText=Abortar caixa de di\u00E1logo do seletor de arquivos.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -27,10 +27,15 @@
 FileChooser.updateButtonText=Uppdatera
 FileChooser.helpButtonText=Hj\u00E4lp
 FileChooser.pathLabelText=Ange s\u00F6kv\u00E4g eller mappnamn:
+FileChooser.pathLabelMnemonic=80
 FileChooser.filterLabelText=Filter
+FileChooser.filterLabelMnemonic=82
 FileChooser.foldersLabelText=Mappar
+FileChooser.foldersLabelMnemonic=76
 FileChooser.filesLabelText=Filer
+FileChooser.filesLabelMnemonic=73
 FileChooser.enterFileNameLabelText=Ange filnamn:
+FileChooser.enterFileNameLabelMnemonic=78
 FileChooser.enterFolderNameLabelText=Ange ett mappnamn:
 
 FileChooser.cancelButtonToolTipText=Avbryt dialogrutan Filv\u00E4ljare.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -27,10 +27,15 @@
 FileChooser.updateButtonText=\u66F4\u65B0
 FileChooser.helpButtonText=\u5E2E\u52A9
 FileChooser.pathLabelText=\u952E\u5165\u8DEF\u5F84\u6216\u6587\u4EF6\u5939\u540D: 
+FileChooser.pathLabelMnemonic=80
 FileChooser.filterLabelText=\u7B5B\u9009\u5668
+FileChooser.filterLabelMnemonic=82
 FileChooser.foldersLabelText=\u6587\u4EF6\u5939
+FileChooser.foldersLabelMnemonic=76
 FileChooser.filesLabelText=\u6587\u4EF6
+FileChooser.filesLabelMnemonic=73
 FileChooser.enterFileNameLabelText=\u952E\u5165\u6587\u4EF6\u540D: 
+FileChooser.enterFileNameLabelMnemonic=78
 FileChooser.enterFolderNameLabelText=\u8F93\u5165\u6587\u4EF6\u5939\u540D:
 
 FileChooser.cancelButtonToolTipText=\u4E2D\u6B62\u6587\u4EF6\u9009\u62E9\u5668\u5BF9\u8BDD\u6846\u3002
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_TW.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_TW.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -27,10 +27,15 @@
 FileChooser.updateButtonText=\u66F4\u65B0
 FileChooser.helpButtonText=\u8AAA\u660E
 FileChooser.pathLabelText=\u8F38\u5165\u8DEF\u5F91\u6216\u8CC7\u6599\u593E\u540D\u7A31:
+FileChooser.pathLabelMnemonic=80
 FileChooser.filterLabelText=\u7BE9\u9078
+FileChooser.filterLabelMnemonic=82
 FileChooser.foldersLabelText=\u8CC7\u6599\u593E
+FileChooser.foldersLabelMnemonic=76
 FileChooser.filesLabelText=\u6A94\u6848
+FileChooser.filesLabelMnemonic=73
 FileChooser.enterFileNameLabelText=\u8F38\u5165\u6A94\u6848\u540D\u7A31:
+FileChooser.enterFileNameLabelMnemonic=78
 FileChooser.enterFolderNameLabelText=\u8F38\u5165\u8CC7\u6599\u593E\u540D\u7A31:
 
 FileChooser.cancelButtonToolTipText=\u4E2D\u6B62\u6A94\u6848\u9078\u64C7\u5668\u5C0D\u8A71\u65B9\u584A\u3002
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Fri Sep 23 23:29:56 2011 -0700
@@ -528,16 +528,16 @@
 
         Locale l = fc.getLocale();
 
-        lookInLabelMnemonic = UIManager.getInt("FileChooser.lookInLabelMnemonic");
+        lookInLabelMnemonic = getMnemonic("FileChooser.lookInLabelMnemonic", l);
         lookInLabelText = UIManager.getString("FileChooser.lookInLabelText",l);
         saveInLabelText = UIManager.getString("FileChooser.saveInLabelText",l);
 
-        fileNameLabelMnemonic = UIManager.getInt("FileChooser.fileNameLabelMnemonic");
+        fileNameLabelMnemonic = getMnemonic("FileChooser.fileNameLabelMnemonic", l);
         fileNameLabelText = UIManager.getString("FileChooser.fileNameLabelText",l);
-        folderNameLabelMnemonic = UIManager.getInt("FileChooser.folderNameLabelMnemonic");
+        folderNameLabelMnemonic = getMnemonic("FileChooser.folderNameLabelMnemonic", l);
         folderNameLabelText = UIManager.getString("FileChooser.folderNameLabelText",l);
 
-        filesOfTypeLabelMnemonic = UIManager.getInt("FileChooser.filesOfTypeLabelMnemonic");
+        filesOfTypeLabelMnemonic = getMnemonic("FileChooser.filesOfTypeLabelMnemonic", l);
         filesOfTypeLabelText = UIManager.getString("FileChooser.filesOfTypeLabelText",l);
 
         upFolderToolTipText =  UIManager.getString("FileChooser.upFolderToolTipText",l);
@@ -550,6 +550,10 @@
         viewMenuButtonAccessibleName = UIManager.getString("FileChooser.viewMenuButtonAccessibleName",l);
     }
 
+    private Integer getMnemonic(String key, Locale l) {
+        return SwingUtilities2.getUIDefaultsInt(key, l);
+    }
+
     protected void installListeners(JFileChooser fc) {
         super.installListeners(fc);
         ActionMap actionMap = getActionMap();
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Fri Sep 23 23:29:56 2011 -0700
@@ -770,9 +770,6 @@
                                                                "icons/NewFolder.gif"),
             "FileChooser.useSystemExtensionHiding", Boolean.TRUE,
 
-            "FileChooser.lookInLabelMnemonic", Integer.valueOf(KeyEvent.VK_I),
-            "FileChooser.fileNameLabelMnemonic", Integer.valueOf(KeyEvent.VK_N),
-            "FileChooser.filesOfTypeLabelMnemonic", Integer.valueOf(KeyEvent.VK_T),
             "FileChooser.usesSingleFilePane", Boolean.TRUE,
             "FileChooser.noPlacesBar", new DesktopProperty("win.comdlg.noPlacesBar",
                                                            Boolean.FALSE),
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Look in:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Save in:
 FileChooser.fileNameLabelText=File name:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Folder name:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Files of type:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Up One Level
 FileChooser.upFolderAccessibleName=Up
 FileChooser.homeFolderToolTipText=Home
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Suchen in:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Speichern in:
 FileChooser.fileNameLabelText=Dateiname:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Ordnername:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Dateityp:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Eine Ebene h\u00F6her
 FileChooser.upFolderAccessibleName=Nach oben
 FileChooser.homeFolderToolTipText=Home
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Buscar en:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Guardar en:
 FileChooser.fileNameLabelText=Nombre de Archivo:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Nombre de la Carpeta:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Archivos de Tipo:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Subir un Nivel
 FileChooser.upFolderAccessibleName=Arriba
 FileChooser.homeFolderToolTipText=Inicio
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Rechercher dans :
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Enregistrer dans :
 FileChooser.fileNameLabelText=Nom du fichier :
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Nom du dossier :
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Fichiers de type :
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Remonte d'un niveau.
 FileChooser.upFolderAccessibleName=Monter
 FileChooser.homeFolderToolTipText=R\u00E9pertoire d'origine
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Cerca in:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Salva in:
 FileChooser.fileNameLabelText=Nome file:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Nome della cartella:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Tipo file:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Cartella superiore
 FileChooser.upFolderAccessibleName=Superiore
 FileChooser.homeFolderToolTipText=Home
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=\u53C2\u7167:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=\u4FDD\u5B58:
 FileChooser.fileNameLabelText=\u30D5\u30A1\u30A4\u30EB\u540D:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=\u30D5\u30A9\u30EB\u30C0\u540D:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=1\u30EC\u30D9\u30EB\u4E0A\u3078
 FileChooser.upFolderAccessibleName=\u4E0A\u3078
 FileChooser.homeFolderToolTipText=\u30DB\u30FC\u30E0
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=\uAC80\uC0C9 \uC704\uCE58:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=\uC800\uC7A5 \uC704\uCE58:
 FileChooser.fileNameLabelText=\uD30C\uC77C \uC774\uB984:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=\uD3F4\uB354 \uC774\uB984:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=\uD30C\uC77C \uC720\uD615:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=\uD55C \uB808\uBCA8 \uC704\uB85C
 FileChooser.upFolderAccessibleName=\uC704\uB85C
 FileChooser.homeFolderToolTipText=\uD648
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Consultar em:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Salvar em:
 FileChooser.fileNameLabelText=Nome do arquivo:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Nome da pasta:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Arquivos do tipo:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Um N\u00EDvel Acima
 FileChooser.upFolderAccessibleName=Acima
 FileChooser.homeFolderToolTipText=In\u00EDcio
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Leta i:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Spara i:
 FileChooser.fileNameLabelText=Filnamn:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Mapp:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Filformat:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Upp en niv\u00E5
 FileChooser.upFolderAccessibleName=Upp
 FileChooser.homeFolderToolTipText=Hem
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=\u67E5\u770B: 
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=\u4FDD\u5B58: 
 FileChooser.fileNameLabelText=\u6587\u4EF6\u540D: 
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=\u6587\u4EF6\u5939\u540D: 
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=\u6587\u4EF6\u7C7B\u578B: 
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=\u5411\u4E0A\u4E00\u7EA7
 FileChooser.upFolderAccessibleName=\u5411\u4E0A
 FileChooser.homeFolderToolTipText=\u4E3B\u76EE\u5F55
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_TW.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_TW.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=\u67E5\u8A62:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=\u5132\u5B58\u65BC: 
 FileChooser.fileNameLabelText=\u6A94\u6848\u540D\u7A31:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=\u8CC7\u6599\u593E\u540D\u7A31:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=\u6A94\u6848\u985E\u578B:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=\u5F80\u4E0A\u4E00\u5C64
 FileChooser.upFolderAccessibleName=\u5F80\u4E0A
 FileChooser.homeFolderToolTipText=\u4E3B\u76EE\u9304
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Look In:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Save In:
 FileChooser.fileNameLabelText=File Name:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Folder name:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Files of Type:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Up One Level
 FileChooser.upFolderAccessibleName=Up
 FileChooser.homeFolderToolTipText=Home
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_de.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_de.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Suchen in:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Speichern in:
 FileChooser.fileNameLabelText=Dateiname:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Ordnername:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Dateityp:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Eine Ebene h\u00F6her
 FileChooser.upFolderAccessibleName=Nach oben
 FileChooser.homeFolderToolTipText=Home
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_es.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_es.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Buscar en:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Guardar en:
 FileChooser.fileNameLabelText=Nombre de Archivo:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Nombre de la Carpeta:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Archivos de Tipo:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Subir un Nivel
 FileChooser.upFolderAccessibleName=Arriba
 FileChooser.homeFolderToolTipText=Inicio
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_fr.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_fr.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Rechercher dans :
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Enregistrer dans :
 FileChooser.fileNameLabelText=Nom du fichier :
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Nom du dossier :
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Fichiers de type :
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Remonte d'un niveau.
 FileChooser.upFolderAccessibleName=Monter
 FileChooser.homeFolderToolTipText=R\u00E9pertoire d'origine
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_it.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_it.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Cerca in:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Salva in:
 FileChooser.fileNameLabelText=Nome file:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Nome della cartella:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Tipo file:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Cartella superiore
 FileChooser.upFolderAccessibleName=Superiore
 FileChooser.homeFolderToolTipText=Home
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ja.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ja.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=\u53C2\u7167:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=\u4FDD\u5B58:
 FileChooser.fileNameLabelText=\u30D5\u30A1\u30A4\u30EB\u540D:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=\u30D5\u30A9\u30EB\u30C0\u540D:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=1\u30EC\u30D9\u30EB\u4E0A\u3078
 FileChooser.upFolderAccessibleName=\u4E0A\u3078
 FileChooser.homeFolderToolTipText=\u30DB\u30FC\u30E0
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=\uAC80\uC0C9 \uC704\uCE58:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=\uC800\uC7A5 \uC704\uCE58:
 FileChooser.fileNameLabelText=\uD30C\uC77C \uC774\uB984:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=\uD3F4\uB354 \uC774\uB984:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=\uD30C\uC77C \uC720\uD615:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=\uD55C \uB808\uBCA8 \uC704\uB85C
 FileChooser.upFolderAccessibleName=\uC704\uB85C
 FileChooser.homeFolderToolTipText=\uD648
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_pt_BR.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_pt_BR.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Consultar Em:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Salvar Em:
 FileChooser.fileNameLabelText=Nome do Arquivo:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Nome da pasta:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Arquivos do Tipo:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Um N\u00EDvel Acima
 FileChooser.upFolderAccessibleName=Acima
 FileChooser.homeFolderToolTipText=In\u00EDcio
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=Leta i:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=Spara i:
 FileChooser.fileNameLabelText=Filnamn:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=Mapp:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=Filformat:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=Upp en niv\u00E5
 FileChooser.upFolderAccessibleName=Upp
 FileChooser.homeFolderToolTipText=Hem
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=\u67E5\u770B:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=\u4FDD\u5B58:
 FileChooser.fileNameLabelText=\u6587\u4EF6\u540D:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=\u6587\u4EF6\u5939\u540D:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=\u6587\u4EF6\u7C7B\u578B:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=\u5411\u4E0A\u4E00\u7EA7
 FileChooser.upFolderAccessibleName=\u5411\u4E0A
 FileChooser.homeFolderToolTipText=\u4E3B\u76EE\u5F55
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties	Fri Sep 23 23:29:56 2011 -0700
@@ -19,10 +19,14 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabelText=\u67E5\u8A62:
+FileChooser.lookInLabelMnemonic=73
 FileChooser.saveInLabelText=\u5132\u5B58\u65BC:
 FileChooser.fileNameLabelText=\u6A94\u6848\u540D\u7A31:
+FileChooser.fileNameLabelMnemonic=78
 FileChooser.folderNameLabelText=\u8CC7\u6599\u593E\u540D\u7A31:
+FileChooser.folderNameLabelMnemonic=78
 FileChooser.filesOfTypeLabelText=\u6A94\u6848\u985E\u578B:
+FileChooser.filesOfTypeLabelMnemonic=84
 FileChooser.upFolderToolTipText=\u5F80\u4E0A\u4E00\u5C64
 FileChooser.upFolderAccessibleName=\u5F80\u4E0A
 FileChooser.homeFolderToolTipText=\u4E3B\u76EE\u9304
--- a/jdk/src/share/classes/java/awt/Component.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/java/awt/Component.java	Fri Sep 23 23:29:56 2011 -0700
@@ -7909,7 +7909,7 @@
                 res = toFocus.requestFocusInWindow(CausedFocusEvent.Cause.TRAVERSAL_BACKWARD);
             }
         }
-        if (!res) {
+        if (clearOnFailure && !res) {
             if (focusLog.isLoggable(PlatformLogger.FINER)) {
                 focusLog.finer("clear global focus owner");
             }
--- a/jdk/src/share/classes/java/lang/VirtualMachineError.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/java/lang/VirtualMachineError.java	Fri Sep 23 23:29:56 2011 -0700
@@ -3,7 +3,7 @@
  * 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, asP
+ * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this
  * particular file as subject to the "Classpath" exception as provided
  * by Oracle in the LICENSE file that accompanied this code.
--- a/jdk/src/share/classes/javax/swing/AbstractButton.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/javax/swing/AbstractButton.java	Fri Sep 23 23:29:56 2011 -0700
@@ -981,6 +981,7 @@
      * @param exception the message to use in the
      *        {@code IllegalArgumentException} that is thrown for an invalid
      *        value
+     * @return the {@code key} argument
      * @exception IllegalArgumentException if key is not one of the legal
      *            values listed above
      * @see #setHorizontalTextPosition
@@ -1011,6 +1012,7 @@
      * @param exception the message to use in the
      *        {@code IllegalArgumentException} that is thrown for an invalid
      *        value
+     * @return the {@code key} argument
      * @exception IllegalArgumentException if key is not one of the legal
      *            values listed above
      */
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Fri Sep 23 23:29:56 2011 -0700
@@ -1153,10 +1153,15 @@
                 if (shellFolder.isLink()) {
                     File linkedTo = shellFolder.getLinkLocation();
 
-                    if (linkedTo != null && fc.isTraversable(linkedTo)) {
-                        dir = linkedTo;
+                    // If linkedTo is null we try to use dir
+                    if (linkedTo != null) {
+                        if (fc.isTraversable(linkedTo)) {
+                            dir = linkedTo;
+                        } else {
+                            return;
+                        }
                     } else {
-                        return;
+                        dir = shellFolder;
                     }
                 }
             } catch (FileNotFoundException ex) {
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Fri Sep 23 23:29:56 2011 -0700
@@ -461,16 +461,16 @@
 
         Locale l = fc.getLocale();
 
-        lookInLabelMnemonic = UIManager.getInt("FileChooser.lookInLabelMnemonic");
+        lookInLabelMnemonic = getMnemonic("FileChooser.lookInLabelMnemonic", l);
         lookInLabelText = UIManager.getString("FileChooser.lookInLabelText",l);
         saveInLabelText = UIManager.getString("FileChooser.saveInLabelText",l);
 
-        fileNameLabelMnemonic = UIManager.getInt("FileChooser.fileNameLabelMnemonic");
+        fileNameLabelMnemonic = getMnemonic("FileChooser.fileNameLabelMnemonic", l);
         fileNameLabelText = UIManager.getString("FileChooser.fileNameLabelText",l);
-        folderNameLabelMnemonic = UIManager.getInt("FileChooser.folderNameLabelMnemonic");
+        folderNameLabelMnemonic = getMnemonic("FileChooser.folderNameLabelMnemonic", l);
         folderNameLabelText = UIManager.getString("FileChooser.folderNameLabelText",l);
 
-        filesOfTypeLabelMnemonic = UIManager.getInt("FileChooser.filesOfTypeLabelMnemonic");
+        filesOfTypeLabelMnemonic = getMnemonic("FileChooser.filesOfTypeLabelMnemonic", l);
         filesOfTypeLabelText = UIManager.getString("FileChooser.filesOfTypeLabelText",l);
 
         upFolderToolTipText =  UIManager.getString("FileChooser.upFolderToolTipText",l);
@@ -489,6 +489,10 @@
         detailsViewButtonAccessibleName = UIManager.getString("FileChooser.detailsViewButtonAccessibleName",l);
     }
 
+    private Integer getMnemonic(String key, Locale l) {
+        return SwingUtilities2.getUIDefaultsInt(key, l);
+    }
+
     protected void installListeners(JFileChooser fc) {
         super.installListeners(fc);
         ActionMap actionMap = getActionMap();
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Fri Sep 23 23:29:56 2011 -0700
@@ -844,9 +844,6 @@
             "FileChooser.newFolderIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserNewFolderIcon"),
             "FileChooser.upFolderIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserUpFolderIcon"),
 
-            "FileChooser.lookInLabelMnemonic", new Integer(KeyEvent.VK_I),
-            "FileChooser.fileNameLabelMnemonic", new Integer(KeyEvent.VK_N),
-            "FileChooser.filesOfTypeLabelMnemonic", new Integer(KeyEvent.VK_T),
             "FileChooser.usesSingleFilePane", Boolean.TRUE,
             "FileChooser.ancestorInputMap",
                new UIDefaults.LazyInputMap(new Object[] {
--- a/jdk/src/share/classes/sun/awt/FontConfiguration.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java	Fri Sep 23 23:29:56 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -266,11 +266,20 @@
     private File findFontConfigFile(String javaLib) {
         String baseName = javaLib + File.separator + "fontconfig";
         File configFile;
+        String osMajorVersion = null;
         if (osVersion != null && osName != null) {
             configFile = findImpl(baseName + "." + osName + "." + osVersion);
             if (configFile != null) {
                 return configFile;
             }
+            int decimalPointIndex = osVersion.indexOf(".");
+            if (decimalPointIndex != -1) {
+                osMajorVersion = osVersion.substring(0, osVersion.indexOf("."));
+                configFile = findImpl(baseName + "." + osName + "." + osMajorVersion);
+                if (configFile != null) {
+                    return configFile;
+                }
+            }
         }
         if (osName != null) {
             configFile = findImpl(baseName + "." + osName);
@@ -283,6 +292,12 @@
             if (configFile != null) {
                 return configFile;
             }
+            if (osMajorVersion != null) {
+                configFile = findImpl(baseName + "." + osMajorVersion);
+                if (configFile != null) {
+                    return configFile;
+                }
+            }
         }
         foundOsSpecificFile = false;
 
--- a/jdk/src/solaris/native/sun/awt/fontpath.c	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/solaris/native/sun/awt/fontpath.c	Fri Sep 23 23:29:56 2011 -0700
@@ -1191,8 +1191,16 @@
 
             fontformat = NULL;
             (*FcPatternGetString)(fontPattern, FC_FONTFORMAT, 0, &fontformat);
-            if (fontformat != NULL && strcmp((char*)fontformat, "TrueType")
-                != 0) {
+            /* We only want TrueType fonts but some Linuxes still depend
+             * on Type 1 fonts for some Locale support, so we'll allow
+             * them there.
+             */
+            if (fontformat != NULL
+                && (strcmp((char*)fontformat, "TrueType") != 0)
+#ifdef __linux__
+                && (strcmp((char*)fontformat, "Type 1") != 0)
+#endif
+             ) {
                 continue;
             }
             result = (*FcPatternGetCharSet)(fontPattern,
--- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp	Fri Sep 23 14:24:04 2011 +0100
+++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp	Fri Sep 23 23:29:56 2011 -0700
@@ -153,6 +153,11 @@
             break;
         }
         case WM_DESTROY: {
+            HIMC hIMC = ::ImmGetContext(hdlg);
+            if (hIMC != NULL) {
+                ::ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
+            }
+
             WNDPROC lpfnWndProc = (WNDPROC)(::GetProp(parent, NativeDialogWndProcProp));
             ComCtl32Util::GetInstance().UnsubclassHWND(parent,
                                                        FileDialogWndProc,
--- a/langtools/.hgtags	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/.hgtags	Fri Sep 23 23:29:56 2011 -0700
@@ -125,3 +125,5 @@
 e9f118c2bd3c4690d8d2e6b108b5bad7e226634c jdk8-b01
 b3c059de2a61fc122c99d555cdd8b85f112393c1 jdk8-b02
 f497fac86cf9ada4801ecaf49eb0d2307a2b61c8 jdk8-b03
+5df63fd8fa64741e829281ee6febe9954932841b jdk8-b04
+5304c2a17d4b001e365a8f0163082dc375f1abab jdk8-b05
--- a/langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Fri Sep 23 23:29:56 2011 -0700
@@ -37,6 +37,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
@@ -51,6 +52,7 @@
 import com.sun.source.util.TaskListener;
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.JCDiagnostic;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -146,7 +148,7 @@
             return fo;
     }
 
-    <T> DiagnosticListener<T> wrap(DiagnosticListener<T> dl) {
+    <T /*super JavaFileOject*/> DiagnosticListener<T> wrap(DiagnosticListener<T> dl) {
         if (isTrusted(dl))
             return dl;
         return new WrappedDiagnosticListener<T>(dl);
@@ -158,6 +160,16 @@
         return new WrappedTaskListener(tl);
     }
 
+    @SuppressWarnings("unchecked")
+    private <T> Diagnostic<T> unwrap(final Diagnostic<T> diagnostic) {
+        if (diagnostic instanceof JCDiagnostic) {
+            JCDiagnostic d = (JCDiagnostic) diagnostic;
+            return (Diagnostic<T>) new DiagnosticSourceUnwrapper(d);
+        } else {
+            return diagnostic;
+        }
+    }
+
     protected boolean isTrusted(Object o) {
         Class<?> c = o.getClass();
         Boolean trusted = trustedClasses.get(c);
@@ -534,7 +546,7 @@
         }
     }
 
-    protected class WrappedDiagnosticListener<T> implements DiagnosticListener<T> {
+    protected class WrappedDiagnosticListener<T /*super JavaFileObject*/> implements DiagnosticListener<T> {
         protected DiagnosticListener<T> clientDiagnosticListener;
         WrappedDiagnosticListener(DiagnosticListener<T> clientDiagnosticListener) {
             clientDiagnosticListener.getClass(); // null check
@@ -544,7 +556,7 @@
         @Override
         public void report(Diagnostic<? extends T> diagnostic) {
             try {
-                clientDiagnosticListener.report(diagnostic);
+                clientDiagnosticListener.report(unwrap(diagnostic));
             } catch (ClientCodeException e) {
                 throw e;
             } catch (RuntimeException e) {
@@ -555,6 +567,54 @@
         }
     }
 
+    public class DiagnosticSourceUnwrapper implements Diagnostic<JavaFileObject> {
+        public final JCDiagnostic d;
+
+        DiagnosticSourceUnwrapper(JCDiagnostic d) {
+            this.d = d;
+        }
+
+        public Diagnostic.Kind getKind() {
+            return d.getKind();
+        }
+
+        public JavaFileObject getSource() {
+            return unwrap(d.getSource());
+        }
+
+        public long getPosition() {
+            return d.getPosition();
+        }
+
+        public long getStartPosition() {
+            return d.getStartPosition();
+        }
+
+        public long getEndPosition() {
+            return d.getEndPosition();
+        }
+
+        public long getLineNumber() {
+            return d.getLineNumber();
+        }
+
+        public long getColumnNumber() {
+            return d.getColumnNumber();
+        }
+
+        public String getCode() {
+            return d.getCode();
+        }
+
+        public String getMessage(Locale locale) {
+            return d.getMessage(locale);
+        }
+
+        public String toString() {
+            return d.toString();
+        }
+    }
+
     protected class WrappedTaskListener implements TaskListener {
         protected TaskListener clientTaskListener;
         WrappedTaskListener(TaskListener clientTaskListener) {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Sep 23 23:29:56 2011 -0700
@@ -269,10 +269,12 @@
 
     // <editor-fold defaultstate="collapsed" desc="isConvertible">
     /**
-     * Is t a subtype of or convertiable via boxing/unboxing
-     * convertions to s?
+     * Is t a subtype of or convertible via boxing/unboxing
+     * conversion to s?
      */
     public boolean isConvertible(Type t, Type s, Warner warn) {
+        if (t.tag == ERROR)
+            return true;
         boolean tPrimitive = t.isPrimitive();
         boolean sPrimitive = s.isPrimitive();
         if (tPrimitive == sPrimitive) {
@@ -2117,6 +2119,8 @@
             }
         }
 
+        List<TypeSymbol> seenTypes = List.nil();
+
         /** members closure visitor methods **/
 
         public CompoundScope visitType(Type t, Boolean skipInterface) {
@@ -2125,21 +2129,33 @@
 
         @Override
         public CompoundScope visitClassType(ClassType t, Boolean skipInterface) {
-            ClassSymbol csym = (ClassSymbol)t.tsym;
-            Entry e = _map.get(csym);
-            if (e == null || !e.matches(skipInterface)) {
-                CompoundScope membersClosure = new CompoundScope(csym);
-                if (!skipInterface) {
-                    for (Type i : interfaces(t)) {
-                        membersClosure.addSubScope(visit(i, skipInterface));
+            if (seenTypes.contains(t.tsym)) {
+                //this is possible when an interface is implemented in multiple
+                //superclasses, or when a classs hierarchy is circular - in such
+                //cases we don't need to recurse (empty scope is returned)
+                return new CompoundScope(t.tsym);
+            }
+            try {
+                seenTypes = seenTypes.prepend(t.tsym);
+                ClassSymbol csym = (ClassSymbol)t.tsym;
+                Entry e = _map.get(csym);
+                if (e == null || !e.matches(skipInterface)) {
+                    CompoundScope membersClosure = new CompoundScope(csym);
+                    if (!skipInterface) {
+                        for (Type i : interfaces(t)) {
+                            membersClosure.addSubScope(visit(i, skipInterface));
+                        }
                     }
+                    membersClosure.addSubScope(visit(supertype(t), skipInterface));
+                    membersClosure.addSubScope(csym.members());
+                    e = new Entry(skipInterface, membersClosure);
+                    _map.put(csym, e);
                 }
-                membersClosure.addSubScope(visit(supertype(t), skipInterface));
-                membersClosure.addSubScope(csym.members());
-                e = new Entry(skipInterface, membersClosure);
-                _map.put(csym, e);
+                return e.compoundScope;
             }
-            return e.compoundScope;
+            finally {
+                seenTypes = seenTypes.tail;
+            }
         }
 
         @Override
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Sep 23 23:29:56 2011 -0700
@@ -594,7 +594,15 @@
             lintEnv = lintEnv.next;
 
         // Having found the enclosing lint value, we can initialize the lint value for this class
-        env.info.lint = lintEnv.info.lint.augment(env.info.enclVar.attributes_field, env.info.enclVar.flags());
+        // ... but ...
+        // There's a problem with evaluating annotations in the right order, such that
+        // env.info.enclVar.attributes_field might not yet have been evaluated, and so might be
+        // null. In that case, calling augment will throw an NPE. To avoid this, for now we
+        // revert to the jdk 6 behavior and ignore the (unevaluated) attributes.
+        if (env.info.enclVar.attributes_field == null)
+            env.info.lint = lintEnv.info.lint;
+        else
+            env.info.lint = lintEnv.info.lint.augment(env.info.enclVar.attributes_field, env.info.enclVar.flags());
 
         Lint prevLint = chk.setLint(env.info.lint);
         JavaFileObject prevSource = log.useSource(env.toplevel.sourcefile);
--- a/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Fri Sep 23 23:29:56 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,6 +98,7 @@
 
     @Override
     public OutputStream openOutputStream() throws IOException {
+        fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return new FileOutputStream(file);
     }
@@ -128,6 +129,7 @@
 
     @Override
     public Writer openWriter() throws IOException {
+        fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return new OutputStreamWriter(new FileOutputStream(file), fileManager.getEncodingName());
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Sep 23 23:29:56 2011 -0700
@@ -1689,6 +1689,8 @@
         // outer instance of a super(...) call appears as first parameter).
         genArgs(tree.args,
                 TreeInfo.symbol(tree.meth).externalType(types).getParameterTypes());
+        code.statBegin(tree.pos);
+        code.markStatBegin();
         result = m.invoke();
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Fri Sep 23 23:29:56 2011 -0700
@@ -205,6 +205,7 @@
 
     @Override
     public OutputStream openOutputStream() throws IOException {
+        fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return Files.newOutputStream(path);
     }
@@ -241,6 +242,7 @@
 
     @Override
     public Writer openWriter() throws IOException {
+        fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return new OutputStreamWriter(Files.newOutputStream(path), fileManager.getEncodingName());
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Sep 23 23:29:56 2011 -0700
@@ -27,15 +27,15 @@
 
 import java.util.*;
 
+import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.tree.*;
-import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 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.util.ListBuffer.lb;
 import static com.sun.tools.javac.parser.Token.*;
 
 /** The parser maps a token sequence into an abstract syntax
@@ -254,26 +254,44 @@
     }
 
     private JCErroneous syntaxError(int pos, String key, Token... args) {
-        return syntaxError(pos, null, key, args);
+        return syntaxError(pos, List.<JCTree>nil(), 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));
+        JCErroneous err = F.at(pos).Erroneous(errs);
+        reportSyntaxError(err, key, (Object[])args);
+        if (errs != null) {
+            JCTree last = errs.last();
+            if (last != null)
+                storeEnd(last, pos);
+        }
+        return toP(err);
     }
 
     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.
+     * Report a syntax using the given the position parameter and arguments,
+     * unless one was already reported at the same position.
      */
     private void reportSyntaxError(int pos, String key, Object... args) {
+        JCDiagnostic.DiagnosticPosition diag = new JCDiagnostic.SimpleDiagnosticPosition(pos);
+        reportSyntaxError(diag, key, args);
+    }
+
+    /**
+     * Report a syntax error using the given DiagnosticPosition object and
+     * arguments, unless one was already reported at the same position.
+     */
+    private void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) {
+        int pos = diagPos.getPreferredPosition();
         if (pos > S.errPos() || pos == Position.NOPOS) {
-            if (S.token() == EOF)
-                error(pos, "premature.eof");
-            else
-                error(pos, key, args);
+            if (S.token() == EOF) {
+                error(diagPos, "premature.eof");
+            } else {
+                error(diagPos, key, args);
+            }
         }
         S.errPos(pos);
         if (S.pos() == errorPos)
@@ -311,7 +329,7 @@
     /** Report an illegal start of expression/type error at given position.
      */
     JCExpression illegal(int pos) {
-        setErrorEndPos(S.pos());
+        setErrorEndPos(pos);
         if ((mode & EXPR) != 0)
             return syntaxError(pos, "illegal.start.of.expr");
         else
@@ -340,7 +358,7 @@
      *  indexed by the tree nodes they refer to.
      *  defined only if option flag keepDocComment is set.
      */
-    Map<JCTree, String> docComments;
+    private final Map<JCTree, String> docComments;
 
     /** Make an entry into docComments hashtable,
      *  provided flag keepDocComments is set and given doc comment is non-null.
@@ -462,6 +480,10 @@
         return t;
     }
 
+    JCExpression literal(Name prefix) {
+        return literal(prefix, S.pos());
+    }
+
     /**
      * Literal =
      *     INTLITERAL
@@ -474,8 +496,7 @@
      *   | FALSE
      *   | NULL
      */
-    JCExpression literal(Name prefix) {
-        int pos = S.pos();
+    JCExpression literal(Name prefix, int pos) {
         JCExpression t = errorTree;
         switch (S.token()) {
         case INTLITERAL:
@@ -869,7 +890,7 @@
                     (S.token() == INTLITERAL || S.token() == LONGLITERAL) &&
                     S.radix() == 10) {
                     mode = EXPR;
-                    t = literal(names.hyphen);
+                    t = literal(names.hyphen, pos);
                 } else {
                     t = term3();
                     return F.at(pos).Unary(unoptag(token), t);
@@ -1267,15 +1288,17 @@
                 case GTGT:
                     S.token(GT);
                     break;
+                case GT:
+                    S.nextToken();
+                    break;
                 default:
-                    accept(GT);
+                    args.append(syntaxError(S.pos(), "expected", GT));
                     break;
                 }
                 return args.toList();
             }
         } else {
-            syntaxError(S.pos(), "expected", LT);
-            return List.nil();
+            return List.<JCExpression>of(syntaxError(S.pos(), "expected", LT));
         }
     }
 
@@ -1300,12 +1323,12 @@
             return F.at(pos).Wildcard(t, bound);
         } 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));
+            JCErroneous err = F.at(pos).Erroneous(List.<JCTree>of(wc, id));
+            reportSyntaxError(err, "expected3", GT, EXTENDS, SUPER);
+            return err;
         } else {
             TypeBoundKind t = toP(F.at(pos).TypeBoundKind(BoundKind.UNBOUND));
             return toP(F.at(pos).Wildcard(t, null));
@@ -1391,7 +1414,7 @@
         while (S.token() == DOT) {
             if (diamondFound) {
                 //cannot select after a diamond
-                illegal(S.pos());
+                illegal();
             }
             int pos = S.pos();
             S.nextToken();
@@ -1419,15 +1442,16 @@
                     pos = typeArgs.head.pos;
                 }
                 setErrorEndPos(S.prevEndPos());
-                reportSyntaxError(pos, "cannot.create.array.with.type.arguments");
-                return toP(F.at(newpos).Erroneous(typeArgs.prepend(e)));
+                JCErroneous err = F.at(pos).Erroneous(typeArgs.prepend(e));
+                reportSyntaxError(err, "cannot.create.array.with.type.arguments");
+                return toP(err);
             }
             return e;
         } else if (S.token() == LPAREN) {
             return classCreatorRest(newpos, null, typeArgs, t);
         } else {
-            reportSyntaxError(S.pos(), "expected2",
-                               LPAREN, LBRACKET);
+            setErrorEndPos(S.pos());
+            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)));
         }
@@ -1457,7 +1481,8 @@
             if (S.token() == LBRACE) {
                 return arrayInitializer(newpos, elemtype);
             } else {
-                return syntaxError(S.pos(), "array.dimension.missing");
+                JCExpression t = toP(F.at(newpos).NewArray(elemtype, List.<JCExpression>nil(), null));
+                return syntaxError(S.pos(), List.<JCTree>of(t), "array.dimension.missing");
             }
         } else {
             ListBuffer<JCExpression> dims = new ListBuffer<JCExpression>();
@@ -1843,7 +1868,7 @@
 
     /** CatchClause     = CATCH "(" FormalParameter ")" Block
      */
-    JCCatch catchClause() {
+    protected JCCatch catchClause() {
         int pos = S.pos();
         accept(CATCH);
         accept(LPAREN);
@@ -1973,7 +1998,7 @@
     JCModifiers modifiersOpt() {
         return modifiersOpt(null);
     }
-    JCModifiers modifiersOpt(JCModifiers partial) {
+    protected JCModifiers modifiersOpt(JCModifiers partial) {
         long flags;
         ListBuffer<JCAnnotation> annotations = new ListBuffer<JCAnnotation>();
         int pos;
@@ -2006,6 +2031,7 @@
             case SYNCHRONIZED: flag = Flags.SYNCHRONIZED; break;
             case STRICTFP    : flag = Flags.STRICTFP; break;
             case MONKEYS_AT  : flag = Flags.ANNOTATION; break;
+            case ERROR       : flag = 0; S.nextToken(); break;
             default: break loop;
             }
             if ((flags & flag) != 0) error(S.pos(), "repeated.modifier");
@@ -2219,9 +2245,12 @@
 
     /** Resource = VariableModifiersOpt Type VariableDeclaratorId = Expression
      */
-    JCTree resource() {
-        return variableDeclaratorRest(S.pos(), optFinal(Flags.FINAL),
-                                      parseType(), ident(), true, null);
+    protected JCTree resource() {
+        JCModifiers optFinal = optFinal(Flags.FINAL);
+        JCExpression type = parseType();
+        int pos = S.pos();
+        Name ident = ident();
+        return variableDeclaratorRest(pos, optFinal, type, ident, true, null);
     }
 
     /** CompilationUnit = [ { "@" Annotation } PACKAGE Qualident ";"] {ImportDeclaration} {TypeDeclaration}
@@ -2568,7 +2597,7 @@
      *    | ModifiersOpt Type Ident
      *      ( ConstantDeclaratorsRest | InterfaceMethodDeclaratorRest ";" )
      */
-    List<JCTree> classOrInterfaceBodyDeclaration(Name className, boolean isInterface) {
+    protected List<JCTree> classOrInterfaceBodyDeclaration(Name className, boolean isInterface) {
         if (S.token() == SEMI) {
             S.nextToken();
             return List.<JCTree>nil();
@@ -2770,7 +2799,7 @@
     /** FormalParameter = { FINAL | '@' Annotation } Type VariableDeclaratorId
      *  LastFormalParameter = { FINAL | '@' Annotation } Type '...' Ident | FormalParameter
      */
-    JCVariableDecl formalParameter() {
+    protected JCVariableDecl formalParameter() {
         JCModifiers mods = optFinal(Flags.PARAMETER);
         JCExpression type = parseType();
         if (S.token() == ELLIPSIS) {
@@ -2788,6 +2817,10 @@
         log.error(DiagnosticFlag.SYNTAX, pos, key, args);
     }
 
+    void error(DiagnosticPosition pos, String key, Object ... args) {
+        log.error(DiagnosticFlag.SYNTAX, pos, key, args);
+    }
+
     void warning(int pos, String key, Object ... args) {
         log.warning(pos, key, args);
     }
@@ -2807,8 +2840,9 @@
         case JCTree.ERRONEOUS:
             return t;
         default:
-            error(t.pos, "not.stmt");
-            return F.at(t.pos).Erroneous(List.<JCTree>of(t));
+            JCExpression ret = F.at(t.pos).Erroneous(List.<JCTree>of(t));
+            error(ret, "not.stmt");
+            return ret;
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Fri Sep 23 23:29:56 2011 -0700
@@ -982,8 +982,16 @@
     }
 
     /** Sets the current token.
+     * This method is primarily used to update the token stream when the
+     * parser is handling the end of nested type arguments such as
+     * {@code List<List<String>>} and needs to disambiguate between
+     * repeated use of ">" and relation operators such as ">>" and ">>>". Noting
+     * that this does not handle arbitrary tokens containing Unicode escape
+     * sequences.
      */
     public void token(Token token) {
+        pos += this.token.name.length() - token.name.length();
+        prevEndPos = pos;
         this.token = token;
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java	Fri Sep 23 23:29:56 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,6 +96,19 @@
 
     /** Report an error, unless another error was already reported at same
      *  source position.
+     *  @param flag   A flag to set on the diagnostic
+     *  @param pos    The source position at which to report the error.
+     *  @param key    The key for the localized error message.
+     *  @param args   Fields of the error message.
+     */
+    public void error(DiagnosticFlag flag, DiagnosticPosition pos, String key, Object ... args) {
+        JCDiagnostic d = diags.error(source, pos, key, args);
+        d.setFlag(flag);
+        report(d);
+    }
+
+    /** Report an error, unless another error was already reported at same
+     *  source position.
      *  @param pos    The source position at which to report the error.
      *  @param key    The key for the localized error message.
      *  @param args   Fields of the error message.
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Fri Sep 23 23:29:56 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -322,16 +322,46 @@
 
     // <editor-fold defaultstate="collapsed" desc="Content cache">
     public CharBuffer getCachedContent(JavaFileObject file) {
-        SoftReference<CharBuffer> r = contentCache.get(file);
-        return (r == null ? null : r.get());
+        ContentCacheEntry e = contentCache.get(file);
+        if (e == null)
+            return null;
+
+        if (!e.isValid(file)) {
+            contentCache.remove(file);
+            return null;
+        }
+
+        return e.getValue();
     }
 
     public void cache(JavaFileObject file, CharBuffer cb) {
-        contentCache.put(file, new SoftReference<CharBuffer>(cb));
+        contentCache.put(file, new ContentCacheEntry(file, cb));
+    }
+
+    public void flushCache(JavaFileObject file) {
+        contentCache.remove(file);
     }
 
-    protected final Map<JavaFileObject, SoftReference<CharBuffer>> contentCache
-            = new HashMap<JavaFileObject, SoftReference<CharBuffer>>();
+    protected final Map<JavaFileObject, ContentCacheEntry> contentCache
+            = new HashMap<JavaFileObject, ContentCacheEntry>();
+
+    protected static class ContentCacheEntry {
+        final long timestamp;
+        final SoftReference<CharBuffer> ref;
+
+        ContentCacheEntry(JavaFileObject file, CharBuffer cb) {
+            this.timestamp = file.getLastModified();
+            this.ref = new SoftReference<CharBuffer>(cb);
+        }
+
+        boolean isValid(JavaFileObject file) {
+            return timestamp == file.getLastModified();
+        }
+
+        CharBuffer getValue() {
+            return ref.get();
+        }
+    }
     // </editor-fold>
 
     public static Kind getKind(String name) {
--- a/langtools/src/share/classes/javax/tools/JavaCompiler.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/src/share/classes/javax/tools/JavaCompiler.java	Fri Sep 23 23:29:56 2011 -0700
@@ -26,10 +26,8 @@
 package javax.tools;
 
 import java.io.File;
-import java.io.InputStream;
 import java.io.Writer;
 import java.nio.charset.Charset;
-import java.util.List;
 import java.util.Locale;
 import java.util.concurrent.Callable;
 import javax.annotation.processing.Processor;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/7079713/TestCircularClassfile.java	Fri Sep 23 23:29:56 2011 -0700
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7079713
+ * @summary javac hangs when compiling a class that references a cyclically inherited class
+ * @run main TestCircularClassfile
+ */
+
+import java.io.*;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+import com.sun.source.util.JavacTask;
+
+public class TestCircularClassfile {
+
+    enum SourceKind {
+        A_EXTENDS_B("class B {} class A extends B { void m() {} }"),
+        B_EXTENDS_A("class A { void m() {} } class B extends A {}");
+
+        String sourceStr;
+
+        private SourceKind(String sourceStr) {
+            this.sourceStr = sourceStr;
+        }
+
+        SimpleJavaFileObject getSource() {
+            return new SimpleJavaFileObject(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE) {
+                @Override
+                public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+                    return sourceStr;
+                }
+            };
+        }
+    }
+
+    enum TestKind {
+        REPLACE_A("A.class"),
+        REPLACE_B("B.class");
+
+        String targetClass;
+
+        private TestKind(String targetClass) {
+            this.targetClass = targetClass;
+        }
+    }
+
+    enum ClientKind {
+        METHOD_CALL1("A a = null; a.m();"),
+        METHOD_CALL2("B b = null; b.m();"),
+        CONSTR_CALL1("new A();"),
+        CONSTR_CALL2("new B();"),
+        ASSIGN1("A a = null; B b = a;"),
+        ASSIGN2("B b = null; A a = b;");
+
+        String mainMethod;
+
+        private ClientKind(String mainMethod) {
+            this.mainMethod = mainMethod;
+        }
+
+        SimpleJavaFileObject getSource() {
+            return new SimpleJavaFileObject(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE) {
+                @Override
+                public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+                    return "class Test { public static void main(String[] args) { #M } }"
+                            .replace("#M", mainMethod);
+                }
+            };
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+        int count = 0;
+        for (SourceKind sk1 : SourceKind.values()) {
+            for (SourceKind sk2 : SourceKind.values()) {
+                for (TestKind tk : TestKind.values()) {
+                    for (ClientKind ck : ClientKind.values()) {
+                        new TestCircularClassfile("sub_"+count++, sk1, sk2, tk, ck).check(comp, fm);
+                    }
+                }
+            }
+        }
+    }
+
+    static String workDir = System.getProperty("user.dir");
+
+    String destPath;
+    SourceKind sk1;
+    SourceKind sk2;
+    TestKind tk;
+    ClientKind ck;
+
+    TestCircularClassfile(String destPath, SourceKind sk1, SourceKind sk2, TestKind tk, ClientKind ck) {
+        this.destPath = destPath;
+        this.sk1 = sk1;
+        this.sk2 = sk2;
+        this.tk = tk;
+        this.ck = ck;
+    }
+
+    void check(JavaCompiler comp, StandardJavaFileManager fm) throws Exception {
+        //step 1: compile first source code in the test subfolder
+        File destDir = new File(workDir, destPath); destDir.mkdir();
+        //output dir must be set explicitly as we are sharing the fm (see bug 7026941)
+        fm.setLocation(javax.tools.StandardLocation.CLASS_OUTPUT, Arrays.asList(destDir));
+        JavacTask ct = (JavacTask)comp.getTask(null, fm, null,
+                null, null, Arrays.asList(sk1.getSource()));
+        ct.generate();
+
+        //step 2: compile second source code in a temp folder
+        File tmpDir = new File(destDir, "tmp"); tmpDir.mkdir();
+        //output dir must be set explicitly as we are sharing the fm (see bug 7026941)
+        fm.setLocation(javax.tools.StandardLocation.CLASS_OUTPUT, Arrays.asList(tmpDir));
+        ct = (JavacTask)comp.getTask(null, fm, null,
+                null, null, Arrays.asList(sk2.getSource()));
+        ct.generate();
+
+        //step 3: move a classfile from the temp folder to the test subfolder
+        File fileToMove = new File(tmpDir, tk.targetClass);
+        File target = new File(destDir, tk.targetClass);
+        target.delete();
+        boolean success = fileToMove.renameTo(target);
+
+        if (!success) {
+            throw new AssertionError("error when moving file " + tk.targetClass);
+        }
+
+        //step 4: compile the client class against the classes in the test subfolder
+        //input/output dir must be set explicitly as we are sharing the fm (see bug 7026941)
+        fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(destDir));
+        fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(destDir));
+        ct = (JavacTask)comp.getTask(null, fm, null,
+                null, null, Arrays.asList(ck.getSource()));
+
+        ct.generate();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/7085024/T7085024.java	Fri Sep 23 23:29:56 2011 -0700
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7085024
+ * @summary internal error; cannot instantiate Foo
+ * @compile/fail/ref=T7085024.out -XDrawDiagnostics T7085024.java
+ */
+
+class T7085024 {
+    T7085024 (boolean ret) { } //internal error goes away if constructor accepts a reference type
+
+    T7085024 f = new T7085024((NonExistentClass) null );
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/7085024/T7085024.out	Fri Sep 23 23:29:56 2011 -0700
@@ -0,0 +1,2 @@
+T7085024.java:11:32: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, T7085024, null)
+1 error
--- a/langtools/test/tools/javac/TryWithResources/BadTwr.out	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/test/tools/javac/TryWithResources/BadTwr.out	Fri Sep 23 23:29:56 2011 -0700
@@ -1,5 +1,5 @@
-BadTwr.java:13:39: compiler.err.already.defined: r1, main(java.lang.String...)
-BadTwr.java:18:13: compiler.err.already.defined: args, main(java.lang.String...)
+BadTwr.java:13:46: compiler.err.already.defined: r1, main(java.lang.String...)
+BadTwr.java:18:20: compiler.err.already.defined: args, main(java.lang.String...)
 BadTwr.java:21:13: compiler.err.cant.assign.val.to.final.var: thatsIt
-BadTwr.java:26:17: compiler.err.already.defined: name, main(java.lang.String...)
+BadTwr.java:26:24: compiler.err.already.defined: name, main(java.lang.String...)
 4 errors
--- a/langtools/test/tools/javac/TryWithResources/DuplicateResourceDecl.out	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/test/tools/javac/TryWithResources/DuplicateResourceDecl.out	Fri Sep 23 23:29:56 2011 -0700
@@ -1,2 +1,2 @@
-DuplicateResourceDecl.java:12:45: compiler.err.already.defined: c, main(java.lang.String[])
+DuplicateResourceDecl.java:12:56: compiler.err.already.defined: c, main(java.lang.String[])
 1 error
--- a/langtools/test/tools/javac/TryWithResources/ResourceInterface.out	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/test/tools/javac/TryWithResources/ResourceInterface.out	Fri Sep 23 23:29:56 2011 -0700
@@ -1,2 +1,2 @@
-ResourceInterface.java:38:13: compiler.err.unreported.exception.implicit.close: ResourceInterface.E1, r2
+ResourceInterface.java:38:23: compiler.err.unreported.exception.implicit.close: ResourceInterface.E1, r2
 1 error
--- a/langtools/test/tools/javac/TryWithResources/TwrFlow.out	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/test/tools/javac/TryWithResources/TwrFlow.out	Fri Sep 23 23:29:56 2011 -0700
@@ -1,3 +1,3 @@
 TwrFlow.java:14:11: compiler.err.except.never.thrown.in.try: java.io.IOException
-TwrFlow.java:12:13: compiler.err.unreported.exception.implicit.close: CustomCloseException, twrFlow
+TwrFlow.java:12:21: compiler.err.unreported.exception.implicit.close: CustomCloseException, twrFlow
 2 errors
--- a/langtools/test/tools/javac/TryWithResources/TwrLint.out	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/test/tools/javac/TryWithResources/TwrLint.out	Fri Sep 23 23:29:56 2011 -0700
@@ -1,3 +1,3 @@
 TwrLint.java:14:15: compiler.warn.try.explicit.close.call
-TwrLint.java:13:13: compiler.warn.try.resource.not.referenced: r3
+TwrLint.java:13:21: compiler.warn.try.resource.not.referenced: r3
 2 warnings
--- a/langtools/test/tools/javac/TryWithResources/TwrOnNonResource.out	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/test/tools/javac/TryWithResources/TwrOnNonResource.out	Fri Sep 23 23:29:56 2011 -0700
@@ -1,4 +1,4 @@
-TwrOnNonResource.java:12:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
-TwrOnNonResource.java:15:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
-TwrOnNonResource.java:18:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:12:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:15:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:18:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
 3 errors
--- a/langtools/test/tools/javac/TryWithResources/UnusedResourcesTest.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/test/tools/javac/TryWithResources/UnusedResourcesTest.java	Fri Sep 23 23:29:56 2011 -0700
@@ -28,6 +28,7 @@
  */
 
 import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.ClientCodeWrapper;
 import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.util.JCDiagnostic;
 import java.net.URI;
@@ -236,7 +237,7 @@
         public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
             if (diagnostic.getKind() == Diagnostic.Kind.WARNING &&
                     diagnostic.getCode().contains("try.resource.not.referenced")) {
-                String varName = ((JCDiagnostic)diagnostic).getArgs()[0].toString();
+                String varName = unwrap(diagnostic).getArgs()[0].toString();
                 if (varName.equals(TwrStmt.TWR1.resourceName)) {
                     unused_r1 = true;
                 } else if (varName.equals(TwrStmt.TWR2.resourceName)) {
@@ -246,5 +247,13 @@
                 }
             }
         }
+
+        private JCDiagnostic unwrap(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic instanceof JCDiagnostic)
+                return (JCDiagnostic) diagnostic;
+            if (diagnostic instanceof ClientCodeWrapper.DiagnosticSourceUnwrapper)
+                return ((ClientCodeWrapper.DiagnosticSourceUnwrapper)diagnostic).d;
+            throw new IllegalArgumentException();
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/T7043371.java	Fri Sep 23 23:29:56 2011 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7043371
+ * @summary javac7 fails with NPE during compilation
+ * @compile T7043371.java
+ */
+
+@interface Anno {
+    String value();
+}
+
+class B {
+    @Anno(value=A.a)
+    public static final int b = 0;
+}
+
+class A {
+    @Deprecated
+    public static final String a = "a";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/T7073477.java	Fri Sep 23 23:29:56 2011 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7073477
+ * @summary NPE in com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue
+ * @compile T7073477.java
+ */
+
+@SuppressWarnings(T7073477A.S)
+class T7073477 {
+}
+
+class T7073477A {
+  @SuppressWarnings("")
+  static final String S = "";
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/api/7086261/T7086261.java	Fri Sep 23 23:29:56 2011 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 20011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7086261
+ * @summary javac doesn't report error as expected, it only reports ClientCodeWrapper$DiagnosticSourceUnwrapper
+ */
+
+import javax.tools.*;
+
+import com.sun.tools.javac.api.ClientCodeWrapper.DiagnosticSourceUnwrapper;
+import com.sun.tools.javac.util.JCDiagnostic;
+
+import java.net.URI;
+import java.util.Arrays;
+
+import static javax.tools.StandardLocation.*;
+import static javax.tools.JavaFileObject.Kind.*;
+
+
+public class T7086261 {
+
+    static class ErroneousSource extends SimpleJavaFileObject {
+        public ErroneousSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+        }
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return "class Test { NonexistentClass c = null; }";
+        }
+    }
+
+    static class DiagnosticChecker implements DiagnosticListener<javax.tools.JavaFileObject> {
+        public void report(Diagnostic message) {
+            if (!(message instanceof DiagnosticSourceUnwrapper)) {
+                throw new AssertionError("Wrapped diagnostic expected!");
+            }
+            String actual = message.toString();
+            JCDiagnostic jd = (JCDiagnostic)((DiagnosticSourceUnwrapper)message).d;
+            String expected = jd.toString();
+            if (!actual.equals(expected)) {
+                throw new AssertionError("expected = " + expected + "\nfound = " + actual);
+            }
+        }
+    };
+
+    void test() throws Throwable {
+        JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
+        JavaFileManager jfm = javac.getStandardFileManager(null, null, null);
+        JavaCompiler.CompilationTask task =
+                javac.getTask(null, jfm, new DiagnosticChecker(), null, null, Arrays.asList(new ErroneousSource()));
+        task.call();
+    }
+
+    public static void main(String[] args) throws Throwable {
+        new T7086261().test();
+    }
+}
--- a/langtools/test/tools/javac/diags/Example.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/test/tools/javac/diags/Example.java	Fri Sep 23 23:29:56 2011 -0700
@@ -21,10 +21,12 @@
  * questions.
  */
 
-import com.sun.tools.javac.file.JavacFileManager;
 import java.io.*;
+import java.net.URL;
+import java.net.URLClassLoader;
 import java.util.*;
 import java.util.regex.*;
+import javax.annotation.processing.Processor;
 import javax.tools.Diagnostic;
 import javax.tools.DiagnosticCollector;
 import javax.tools.JavaCompiler;
@@ -37,12 +39,11 @@
 // import com.sun.tools.javac.Main
 // import com.sun.tools.javac.main.Main
 
+import com.sun.tools.javac.api.ClientCodeWrapper;
+import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.JavacMessages;
 import com.sun.tools.javac.util.JCDiagnostic;
-import java.net.URL;
-import java.net.URLClassLoader;
-import javax.annotation.processing.Processor;
 
 /**
  * Class to handle example code designed to illustrate javac diagnostic messages.
@@ -397,7 +398,7 @@
 
             if (keys != null) {
                 for (Diagnostic<? extends JavaFileObject> d: dc.getDiagnostics()) {
-                    scanForKeys((JCDiagnostic) d, keys);
+                    scanForKeys(unwrap(d), keys);
                 }
             }
 
@@ -418,6 +419,14 @@
             for (JCDiagnostic sd: d.getSubdiagnostics())
                 scanForKeys(sd, keys);
         }
+
+        private JCDiagnostic unwrap(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic instanceof JCDiagnostic)
+                return (JCDiagnostic) diagnostic;
+            if (diagnostic instanceof ClientCodeWrapper.DiagnosticSourceUnwrapper)
+                return ((ClientCodeWrapper.DiagnosticSourceUnwrapper)diagnostic).d;
+            throw new IllegalArgumentException();
+        }
     }
 
     /**
--- a/langtools/test/tools/javac/diags/examples/EmptyCharLiteral.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/test/tools/javac/diags/examples/EmptyCharLiteral.java	Fri Sep 23 23:29:56 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
 
 // key: compiler.err.empty.char.lit
 // key: compiler.err.unclosed.char.lit
-// key: compiler.err.expected
 // key: compiler.err.premature.eof
 
 class X {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/file/T7068451.java	Fri Sep 23 23:29:56 2011 -0700
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7068451
+ * @summary Regression: javac compiles fixed sources against previous,
+ *              not current, version of generated sources
+ */
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Filer;
+import javax.annotation.processing.Messager;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaCompiler.CompilationTask;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+public class T7068451 {
+    public static void main(String[] args) throws Exception {
+        new T7068451().run();
+    }
+
+    void run() throws Exception {
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        System.err.println("using " + compiler.getClass() + " from " + compiler.getClass().getProtectionDomain().getCodeSource());
+
+        File tmp = new File("tmp");
+        tmp.mkdir();
+        for (File f: tmp.listFiles())
+            f.delete();
+
+        File input = writeFile(tmp, "X.java", "package p; class X { { p.C.first(); } }");
+
+        List<String> opts = Arrays.asList(
+                "-s", tmp.getPath(),
+                "-d", tmp.getPath(),
+                "-XprintRounds");
+
+        System.err.println();
+        System.err.println("FIRST compilation");
+        System.err.println();
+
+        CompilationTask task = compiler.getTask(null, null, null, opts, null,
+                compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
+        task.setProcessors(Collections.singleton(new Proc("first")));
+        check("compilation", task.call());
+
+        writeFile(tmp, "X.java", "package p; class X { { p.C.second(); } }");
+
+        //Thread.sleep(2000);
+
+        System.err.println();
+        System.err.println("SECOND compilation");
+        System.err.println();
+
+        task = compiler.getTask(null, null, null, opts, null,
+                compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
+        task.setProcessors(Collections.singleton(new Proc("second")));
+        check("compilation", task.call());
+
+        //Thread.sleep(2000);
+
+        System.err.println();
+        System.err.println("SECOND compilation, REPEATED");
+        System.err.println();
+
+        task = compiler.getTask(null, null, null, opts, null,
+                compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
+        task.setProcessors(Collections.singleton(new Proc("second")));
+        check("compilation", task.call());
+    }
+
+    void check(String msg, boolean ok) {
+        System.err.println(msg + ": " + (ok ? "ok" : "failed"));
+        if (!ok)
+            throw new AssertionError(msg);
+    }
+
+    static File writeFile(File base, String path, String body) throws IOException {
+        File f = new File(base, path);
+        FileWriter out = new FileWriter(f);
+        out.write(body);
+        out.close();
+        System.err.println("wrote " + path + ": " + body);
+        return f;
+    }
+
+    @SupportedAnnotationTypes("*")
+    private static class Proc extends AbstractProcessor {
+        final String m;
+        Proc(String m) {
+            this.m = m;
+        }
+
+        int count;
+        @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            if (roundEnv.processingOver() || count++ > 0) {
+                return false;
+            }
+
+            Filer filer = processingEnv.getFiler();
+            Messager messager = processingEnv.getMessager();
+
+            System.err.println("running Proc");
+            try {
+                int len = filer.getResource(StandardLocation.SOURCE_OUTPUT, "p", "C.java").getCharContent(false).length();
+                messager.printMessage(Kind.NOTE, "C.java: found previous content of length " + len);
+            } catch (FileNotFoundException x) {
+                messager.printMessage(Kind.NOTE, "C.java: not previously there");
+            } catch (IOException x) {
+                messager.printMessage(Kind.ERROR, "while reading: " + x);
+            }
+
+            try {
+                String body = "package p; public class C { public static void " + m + "() {} }";
+                Writer w = filer.createSourceFile("p.C").openWriter();
+                w.write(body);
+                w.close();
+                messager.printMessage(Kind.NOTE, "C.java: wrote new content: " + body);
+            } catch (IOException x) {
+                messager.printMessage(Kind.ERROR, "while writing: " + x);
+            }
+
+            return true;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/jvm/T7024096.java	Fri Sep 23 23:29:56 2011 -0700
@@ -0,0 +1,31 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 7024096
+ * @summary Stack trace has invalid line numbers
+ * @author Bruce Chapman
+ * @compile T7024096.java
+ * @run main T7024096
+ */
+
+public class T7024096 {
+    private static final int START = 14; // starting line number for the test
+    public static void main(String[] args) {
+        T7024096 m = new T7024096();
+        m.nest(START);
+        m.nest(START + 1, m.nest(START + 1), m.nest(START + 1),
+            m.nest(START + 2),
+            m.nest(START + 3, m.nest(START + 3)));
+    }
+
+    public T7024096 nest(int expectedline, T7024096... args) {
+        Exception e = new Exception("expected line#: " + expectedline);
+        int myline = e.getStackTrace()[1].getLineNumber();
+        if( myline != expectedline) {
+            throw new RuntimeException("Incorrect line number " +
+                    "expected: " + expectedline +
+                    ", got: " + myline, e);
+        }
+        System.out.format("Got expected line number %d correct %n", myline);
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/parser/netbeans/JavacParserTest.java	Fri Sep 23 23:29:56 2011 -0700
@@ -0,0 +1,716 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7073631
+ * @summary tests error and diagnostics positions
+ * @author  jan.lahoda@oracle.com
+ */
+
+import com.sun.source.tree.BinaryTree;
+import com.sun.source.tree.BlockTree;
+import com.sun.source.tree.ClassTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.ExpressionStatementTree;
+import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.MethodInvocationTree;
+import com.sun.source.tree.MethodTree;
+import com.sun.source.tree.ModifiersTree;
+import com.sun.source.tree.StatementTree;
+import com.sun.source.tree.Tree;
+import com.sun.source.tree.Tree.Kind;
+import com.sun.source.tree.VariableTree;
+import com.sun.source.tree.WhileLoopTree;
+import com.sun.source.util.SourcePositions;
+import com.sun.source.util.TreeScanner;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.tree.JCTree;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class JavacParserTest extends TestCase {
+    final JavaCompiler tool;
+    public JavacParserTest(String testName) {
+        tool = ToolProvider.getSystemJavaCompiler();
+        System.out.println("java.home=" + System.getProperty("java.home"));
+    }
+
+    static class MyFileObject extends SimpleJavaFileObject {
+
+        private String text;
+
+        public MyFileObject(String text) {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            this.text = text;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return text;
+        }
+    }
+
+    public void testPositionForSuperConstructorCalls() throws IOException {
+        assert tool != null;
+
+        String code = "package test; public class Test {public Test() {super();}}";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        SourcePositions pos = Trees.instance(ct).getSourcePositions();
+
+        MethodTree method =
+                (MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0);
+        ExpressionStatementTree es =
+                (ExpressionStatementTree) method.getBody().getStatements().get(0);
+
+        assertEquals("testPositionForSuperConstructorCalls",
+                72 - 24, pos.getStartPosition(cut, es));
+        assertEquals("testPositionForSuperConstructorCalls",
+                80 - 24, pos.getEndPosition(cut, es));
+
+        MethodInvocationTree mit = (MethodInvocationTree) es.getExpression();
+
+        assertEquals("testPositionForSuperConstructorCalls",
+                72 - 24, pos.getStartPosition(cut, mit));
+        assertEquals("testPositionForSuperConstructorCalls",
+                79 - 24, pos.getEndPosition(cut, mit));
+
+        assertEquals("testPositionForSuperConstructorCalls",
+                72 - 24, pos.getStartPosition(cut, mit.getMethodSelect()));
+        assertEquals("testPositionForSuperConstructorCalls",
+                77 - 24, pos.getEndPosition(cut, mit.getMethodSelect()));
+
+    }
+
+    public void testPositionForEnumModifiers() throws IOException {
+
+        String code = "package test; public enum Test {A;}";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        SourcePositions pos = Trees.instance(ct).getSourcePositions();
+
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        ModifiersTree mt = clazz.getModifiers();
+
+        assertEquals("testPositionForEnumModifiers",
+                38 - 24, pos.getStartPosition(cut, mt));
+        assertEquals("testPositionForEnumModifiers",
+                44 - 24, pos.getEndPosition(cut, mt));
+    }
+
+    public void testNewClassWithEnclosing() throws IOException {
+
+
+        String code = "package test; class Test { " +
+                "class d {} private void method() { " +
+                "Object o = Test.this.new d(); } }";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        SourcePositions pos = Trees.instance(ct).getSourcePositions();
+
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        ExpressionTree est =
+                ((VariableTree) ((MethodTree) clazz.getMembers().get(1)).getBody().getStatements().get(0)).getInitializer();
+
+        assertEquals("testNewClassWithEnclosing",
+                97 - 24, pos.getStartPosition(cut, est));
+        assertEquals("testNewClassWithEnclosing",
+                114 - 24, pos.getEndPosition(cut, est));
+    }
+
+    public void testPreferredPositionForBinaryOp() throws IOException {
+
+        String code = "package test; public class Test {" +
+                "private void test() {" +
+                "Object o = null; boolean b = o != null && o instanceof String;" +
+                "} private Test() {}}";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        MethodTree method = (MethodTree) clazz.getMembers().get(0);
+        VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1);
+        BinaryTree cond = (BinaryTree) condSt.getInitializer();
+
+        JCTree condJC = (JCTree) cond;
+
+        assertEquals("testNewClassWithEnclosing",
+                117 - 24, condJC.pos);
+    }
+
+    public void testPositionBrokenSource126732a() throws IOException {
+        String[] commands = new String[]{
+            "return Runnable()",
+            "do { } while (true)",
+            "throw UnsupportedOperationException()",
+            "assert true",
+            "1 + 1",};
+
+        for (String command : commands) {
+
+            String code = "package test;\n"
+                    + "public class Test {\n"
+                    + "    public static void test() {\n"
+                    + "        " + command + " {\n"
+                    + "                new Runnable() {\n"
+                    + "        };\n"
+                    + "    }\n"
+                    + "}";
+            JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null,
+                    null, null, Arrays.asList(new MyFileObject(code)));
+            CompilationUnitTree cut = ct.parse().iterator().next();
+
+            ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+            MethodTree method = (MethodTree) clazz.getMembers().get(0);
+            List<? extends StatementTree> statements =
+                    method.getBody().getStatements();
+
+            StatementTree ret = statements.get(0);
+            StatementTree block = statements.get(1);
+
+            Trees t = Trees.instance(ct);
+            int len = code.indexOf(command + " {") + (command + " ").length();
+            assertEquals(command, len,
+                    t.getSourcePositions().getEndPosition(cut, ret));
+            assertEquals(command, len,
+                    t.getSourcePositions().getStartPosition(cut, block));
+        }
+    }
+
+    public void testPositionBrokenSource126732b() throws IOException {
+        String[] commands = new String[]{
+            "break",
+            "break A",
+            "continue ",
+            "continue A",};
+
+        for (String command : commands) {
+
+            String code = "package test;\n"
+                    + "public class Test {\n"
+                    + "    public static void test() {\n"
+                    + "        while (true) {\n"
+                    + "            " + command + " {\n"
+                    + "                new Runnable() {\n"
+                    + "        };\n"
+                    + "        }\n"
+                    + "    }\n"
+                    + "}";
+
+            JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null,
+                    null, null, Arrays.asList(new MyFileObject(code)));
+            CompilationUnitTree cut = ct.parse().iterator().next();
+
+            ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+            MethodTree method = (MethodTree) clazz.getMembers().get(0);
+            List<? extends StatementTree> statements =
+                    ((BlockTree) ((WhileLoopTree) method.getBody().getStatements().get(0)).getStatement()).getStatements();
+
+            StatementTree ret = statements.get(0);
+            StatementTree block = statements.get(1);
+
+            Trees t = Trees.instance(ct);
+            int len = code.indexOf(command + " {") + (command + " ").length();
+            assertEquals(command, len,
+                    t.getSourcePositions().getEndPosition(cut, ret));
+            assertEquals(command, len,
+                    t.getSourcePositions().getStartPosition(cut, block));
+        }
+    }
+
+    public void testErrorRecoveryForEnhancedForLoop142381() throws IOException {
+
+        String code = "package test; class Test { " +
+                "private void method() { " +
+                "java.util.Set<String> s = null; for (a : s) {} } }";
+
+        final List<Diagnostic<? extends JavaFileObject>> errors =
+                new LinkedList<Diagnostic<? extends JavaFileObject>>();
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
+                new DiagnosticListener<JavaFileObject>() {
+            public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+                errors.add(diagnostic);
+            }
+        }, null, null, Arrays.asList(new MyFileObject(code)));
+
+        CompilationUnitTree cut = ct.parse().iterator().next();
+
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        StatementTree forStatement =
+                ((MethodTree) clazz.getMembers().get(0)).getBody().getStatements().get(1);
+
+        assertEquals("testErrorRecoveryForEnhancedForLoop142381",
+                Kind.ENHANCED_FOR_LOOP, forStatement.getKind());
+        assertFalse("testErrorRecoveryForEnhancedForLoop142381", errors.isEmpty());
+    }
+
+    public void testPositionAnnotationNoPackage187551() throws IOException {
+
+        String code = "\n@interface Test {}";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        Trees t = Trees.instance(ct);
+
+        assertEquals("testPositionAnnotationNoPackage187551",
+                1, t.getSourcePositions().getStartPosition(cut, clazz));
+    }
+
+    public void testPositionsSane() throws IOException {
+        performPositionsSanityTest("package test; class Test { " +
+                "private void method() { " +
+                "java.util.List<? extends java.util.List<? extends String>> l; " +
+                "} }");
+        performPositionsSanityTest("package test; class Test { " +
+                "private void method() { " +
+                "java.util.List<? super java.util.List<? super String>> l; " +
+                "} }");
+        performPositionsSanityTest("package test; class Test { " +
+                "private void method() { " +
+                "java.util.List<? super java.util.List<?>> l; } }");
+    }
+
+    private void performPositionsSanityTest(String code) throws IOException {
+
+        final List<Diagnostic<? extends JavaFileObject>> errors =
+                new LinkedList<Diagnostic<? extends JavaFileObject>>();
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
+                new DiagnosticListener<JavaFileObject>() {
+
+            public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+                errors.add(diagnostic);
+            }
+        }, null, null, Arrays.asList(new MyFileObject(code)));
+
+        final CompilationUnitTree cut = ct.parse().iterator().next();
+        final Trees trees = Trees.instance(ct);
+
+        new TreeScanner<Void, Void>() {
+
+            private long parentStart = 0;
+            private long parentEnd = Integer.MAX_VALUE;
+
+            @Override
+            public Void scan(Tree node, Void p) {
+                if (node == null) {
+                    return null;
+                }
+
+                long start = trees.getSourcePositions().getStartPosition(cut, node);
+
+                if (start == (-1)) {
+                    return null; //synthetic tree
+                }
+                assertTrue(node.toString() + ":" + start + "/" + parentStart,
+                        parentStart <= start);
+
+                long prevParentStart = parentStart;
+
+                parentStart = start;
+
+                long end = trees.getSourcePositions().getEndPosition(cut, node);
+
+                assertTrue(node.toString() + ":" + end + "/" + parentEnd,
+                        end <= parentEnd);
+
+                long prevParentEnd = parentEnd;
+
+                parentEnd = end;
+
+                super.scan(node, p);
+
+                parentStart = prevParentStart;
+                parentEnd = prevParentEnd;
+
+                return null;
+            }
+
+            private void assertTrue(String message, boolean b) {
+                if (!b) fail(message);
+            }
+        }.scan(cut, null);
+    }
+
+    public void testCorrectWilcardPositions() throws IOException {
+        performWildcardPositionsTest("package test; import java.util.List; " +
+                "class Test { private void method() { List<? extends List<? extends String>> l; } }",
+
+                Arrays.asList("List<? extends List<? extends String>> l;",
+                "List<? extends List<? extends String>>",
+                "List",
+                "? extends List<? extends String>",
+                "List<? extends String>",
+                "List",
+                "? extends String",
+                "String"));
+        performWildcardPositionsTest("package test; import java.util.List; " +
+                "class Test { private void method() { List<? super List<? super String>> l; } }",
+
+                Arrays.asList("List<? super List<? super String>> l;",
+                "List<? super List<? super String>>",
+                "List",
+                "? super List<? super String>",
+                "List<? super String>",
+                "List",
+                "? super String",
+                "String"));
+        performWildcardPositionsTest("package test; import java.util.List; " +
+                "class Test { private void method() { List<? super List<?>> l; } }",
+
+                Arrays.asList("List<? super List<?>> l;",
+                "List<? super List<?>>",
+                "List",
+                "? super List<?>",
+                "List<?>",
+                "List",
+                "?"));
+        performWildcardPositionsTest("package test; import java.util.List; " +
+                "class Test { private void method() { " +
+                "List<? extends List<? extends List<? extends String>>> l; } }",
+
+                Arrays.asList("List<? extends List<? extends List<? extends String>>> l;",
+                "List<? extends List<? extends List<? extends String>>>",
+                "List",
+                "? extends List<? extends List<? extends String>>",
+                "List<? extends List<? extends String>>",
+                "List",
+                "? extends List<? extends String>",
+                "List<? extends String>",
+                "List",
+                "? extends String",
+                "String"));
+        performWildcardPositionsTest("package test; import java.util.List; " +
+                "class Test { private void method() { " +
+                "List<? extends List<? extends List<? extends String   >>> l; } }",
+                Arrays.asList("List<? extends List<? extends List<? extends String   >>> l;",
+                "List<? extends List<? extends List<? extends String   >>>",
+                "List",
+                "? extends List<? extends List<? extends String   >>",
+                "List<? extends List<? extends String   >>",
+                "List",
+                "? extends List<? extends String   >",
+                "List<? extends String   >",
+                "List",
+                "? extends String",
+                "String"));
+    }
+
+    public void performWildcardPositionsTest(final String code,
+            List<String> golden) throws IOException {
+
+        final List<Diagnostic<? extends JavaFileObject>> errors =
+                new LinkedList<Diagnostic<? extends JavaFileObject>>();
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
+                new DiagnosticListener<JavaFileObject>() {
+                    public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+                        errors.add(diagnostic);
+                    }
+                }, null, null, Arrays.asList(new MyFileObject(code)));
+
+        final CompilationUnitTree cut = ct.parse().iterator().next();
+        final List<String> content = new LinkedList<String>();
+        final Trees trees = Trees.instance(ct);
+
+        new TreeScanner<Void, Void>() {
+            @Override
+            public Void scan(Tree node, Void p) {
+                if (node == null) {
+                    return null;
+                }
+                long start = trees.getSourcePositions().getStartPosition(cut, node);
+
+                if (start == (-1)) {
+                    return null; //synthetic tree
+                }
+                long end = trees.getSourcePositions().getEndPosition(cut, node);
+                String s = code.substring((int) start, (int) end);
+                content.add(s);
+
+                return super.scan(node, p);
+            }
+        }.scan(((MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0)).getBody().getStatements().get(0), null);
+
+        assertEquals("performWildcardPositionsTest",golden.toString(),
+                content.toString());
+    }
+
+    public void testStartPositionForMethodWithoutModifiers() throws IOException {
+
+        String code = "package t; class Test { <T> void t() {} }";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        MethodTree mt = (MethodTree) clazz.getMembers().get(0);
+        Trees t = Trees.instance(ct);
+        int start = (int) t.getSourcePositions().getStartPosition(cut, mt);
+        int end = (int) t.getSourcePositions().getEndPosition(cut, mt);
+
+        assertEquals("testStartPositionForMethodWithoutModifiers",
+                "<T> void t() {}", code.substring(start, end));
+    }
+
+    public void testStartPositionEnumConstantInit() throws IOException {
+
+        String code = "package t; enum Test { AAA; }";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        VariableTree enumAAA = (VariableTree) clazz.getMembers().get(0);
+        Trees t = Trees.instance(ct);
+        int start = (int) t.getSourcePositions().getStartPosition(cut,
+                enumAAA.getInitializer());
+
+        assertEquals("testStartPositionEnumConstantInit", -1, start);
+    }
+
+    public void testVariableInIfThen1() throws IOException {
+
+        String code = "package t; class Test { " +
+                "private static void t(String name) { " +
+                "if (name != null) String nn = name.trim(); } }";
+
+        DiagnosticCollector<JavaFileObject> coll =
+                new DiagnosticCollector<JavaFileObject>();
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        ct.parse();
+
+        List<String> codes = new LinkedList<String>();
+
+        for (Diagnostic<? extends JavaFileObject> d : coll.getDiagnostics()) {
+            codes.add(d.getCode());
+        }
+
+        assertEquals("testVariableInIfThen1",
+                Arrays.<String>asList("compiler.err.variable.not.allowed"),
+                codes);
+    }
+
+    public void testVariableInIfThen2() throws IOException {
+
+        String code = "package t; class Test { " +
+                "private static void t(String name) { " +
+                "if (name != null) class X {} } }";
+        DiagnosticCollector<JavaFileObject> coll =
+                new DiagnosticCollector<JavaFileObject>();
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        ct.parse();
+
+        List<String> codes = new LinkedList<String>();
+
+        for (Diagnostic<? extends JavaFileObject> d : coll.getDiagnostics()) {
+            codes.add(d.getCode());
+        }
+
+        assertEquals("testVariableInIfThen2",
+                Arrays.<String>asList("compiler.err.class.not.allowed"), codes);
+    }
+
+    public void testVariableInIfThen3() throws IOException {
+
+        String code = "package t; class Test { "+
+                "private static void t(String name) { " +
+                "if (name != null) abstract } }";
+        DiagnosticCollector<JavaFileObject> coll =
+                new DiagnosticCollector<JavaFileObject>();
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        ct.parse();
+
+        List<String> codes = new LinkedList<String>();
+
+        for (Diagnostic<? extends JavaFileObject> d : coll.getDiagnostics()) {
+            codes.add(d.getCode());
+        }
+
+        assertEquals("testVariableInIfThen3",
+                Arrays.<String>asList("compiler.err.illegal.start.of.expr"),
+                codes);
+    }
+
+    //see javac bug #6882235, NB bug #98234:
+    public void testMissingExponent() throws IOException {
+
+        String code = "\nclass Test { { System.err.println(0e); } }";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        assertNotNull(ct.parse().iterator().next());
+    }
+
+    public void testTryResourcePos() throws IOException {
+
+        final String code = "package t; class Test { " +
+                "{ try (java.io.InputStream in = null) { } } }";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+
+        new TreeScanner<Void, Void>() {
+            @Override
+            public Void visitVariable(VariableTree node, Void p) {
+                if ("in".contentEquals(node.getName())) {
+                    JCTree.JCVariableDecl var = (JCTree.JCVariableDecl) node;
+                    System.out.println(node.getName() + "," + var.pos);
+                    assertEquals("testTryResourcePos", "in = null) { } } }",
+                            code.substring(var.pos));
+                }
+                return super.visitVariable(node, p);
+            }
+        }.scan(cut, null);
+    }
+
+    public void testVarPos() throws IOException {
+
+        final String code = "package t; class Test { " +
+                "{ java.io.InputStream in = null; } }";
+
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+                null, Arrays.asList(new MyFileObject(code)));
+        CompilationUnitTree cut = ct.parse().iterator().next();
+
+        new TreeScanner<Void, Void>() {
+
+            @Override
+            public Void visitVariable(VariableTree node, Void p) {
+                if ("in".contentEquals(node.getName())) {
+                    JCTree.JCVariableDecl var = (JCTree.JCVariableDecl) node;
+                    assertEquals("testVarPos","in = null; } }",
+                            code.substring(var.pos));
+                }
+                return super.visitVariable(node, p);
+            }
+        }.scan(cut, null);
+    }
+
+    void testsNotWorking() throws IOException {
+
+        // Fails with nb-javac, needs further investigation
+        testPositionBrokenSource126732a();
+        testPositionBrokenSource126732b();
+
+        // Fails, these tests yet to be addressed
+        testVariableInIfThen1();
+        testVariableInIfThen2();
+        testPositionForEnumModifiers();
+        testStartPositionEnumConstantInit();
+    }
+    void testPositions() throws IOException {
+        testPositionsSane();
+        testCorrectWilcardPositions();
+        testPositionAnnotationNoPackage187551();
+        testPositionForSuperConstructorCalls();
+        testPreferredPositionForBinaryOp();
+        testStartPositionForMethodWithoutModifiers();
+        testVarPos();
+        testVariableInIfThen3();
+        testTryResourcePos();
+    }
+
+    public static void main(String... args) throws IOException {
+        JavacParserTest jpt = new JavacParserTest("JavacParserTest");
+        jpt.testPositions();
+        System.out.println("PASS");
+    }
+}
+
+abstract class TestCase {
+
+    void assertEquals(String message, int i, int pos) {
+        if (i != pos) {
+            fail(message);
+        }
+    }
+
+    void assertFalse(String message, boolean empty) {
+        throw new UnsupportedOperationException("Not yet implemented");
+    }
+
+    void assertEquals(String message, int i, long l) {
+        if (i != l) {
+            fail(message + ":" + i + ":" + l);
+        }
+    }
+
+    void assertEquals(String message, Object o1, Object o2) {
+        System.out.println(o1);
+        System.out.println(o2);
+        if (o1 != null && o2 != null && !o1.equals(o2)) {
+            fail(message);
+        }
+        if (o1 == null && o2 != null) {
+            fail(message);
+        }
+    }
+
+    void assertNotNull(Object o) {
+        if (o == null) {
+            fail();
+        }
+    }
+
+    void fail() {
+        fail("test failed");
+    }
+
+    void fail(String message) {
+        throw new RuntimeException(message);
+    }
+}
--- a/langtools/test/tools/javac/processing/errors/TestSuppression.java	Fri Sep 23 14:24:04 2011 +0100
+++ b/langtools/test/tools/javac/processing/errors/TestSuppression.java	Fri Sep 23 23:29:56 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
 import javax.tools.*;
 
 import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.ClientCodeWrapper;
 import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.util.JCDiagnostic;
 
@@ -171,7 +172,7 @@
 
         public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
             System.err.println((++total) + ": "
-                    + "resolveError:" + isResolveError((JCDiagnostic) diagnostic) + "\n"
+                    + "resolveError:" + isResolveError(unwrap(diagnostic)) + "\n"
                     + diagnostic);
             Diagnostic.Kind dk = diagnostic.getKind();
             Integer c = counts.get(dk);
@@ -181,6 +182,14 @@
         private static boolean isResolveError(JCDiagnostic d) {
             return d.isFlagSet(RESOLVE_ERROR);
         }
+
+        private JCDiagnostic unwrap(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic instanceof JCDiagnostic)
+                return (JCDiagnostic) diagnostic;
+            if (diagnostic instanceof ClientCodeWrapper.DiagnosticSourceUnwrapper)
+                return ((ClientCodeWrapper.DiagnosticSourceUnwrapper)diagnostic).d;
+            throw new IllegalArgumentException();
+        }
     }
 
     @SupportedAnnotationTypes("*")