Mon, 28 Feb 2011 13:42:24 -0800
7022711: compiler crash in try-with-resources
Reviewed-by: mcimadamore
duke@1 | 1 | /* |
ohair@798 | 2 | * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. |
duke@1 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 4 | * |
duke@1 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@1 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@1 | 7 | * published by the Free Software Foundation. |
duke@1 | 8 | * |
duke@1 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 13 | * accompanied this code). |
duke@1 | 14 | * |
duke@1 | 15 | * You should have received a copy of the GNU General Public License version |
duke@1 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 18 | * |
ohair@554 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 20 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 21 | * questions. |
duke@1 | 22 | */ |
duke@1 | 23 | |
duke@1 | 24 | /* |
duke@1 | 25 | * @test |
duke@1 | 26 | * @bug 4109894 4239646 4785453 |
duke@1 | 27 | * @summary Verify that class modifiers bits written into class |
duke@1 | 28 | * file are correct, including those within InnerClasses attributes. |
duke@1 | 29 | * @author John Rose (jrose). Entered as a regression test by Bill Maddox (maddox). |
duke@1 | 30 | * |
jjg@611 | 31 | * @compile/ref=ClassModifiers.out -XDdumpmodifiers=ci ClassModifiers.java |
duke@1 | 32 | * |
duke@1 | 33 | */ |
duke@1 | 34 | |
duke@1 | 35 | class T { |
duke@1 | 36 | //all "protected" type members are transformed to "public" |
duke@1 | 37 | //all "private" type members are transformed to package-scope |
duke@1 | 38 | //all "static" type members are transformed to non-static |
duke@1 | 39 | |
duke@1 | 40 | //a class is one of {,public,private,protected}x{,static}x{,abstract,final} |
duke@1 | 41 | //all of these 24 combinations are legal |
duke@1 | 42 | //all of these 24 combinations generate distinct InnerClasses modifiers |
duke@1 | 43 | //transformed class modifiers can be {,public}x{,abstract,final} |
duke@1 | 44 | //thus, each of the next 6 groups of 4 have identical transformed modifiers |
duke@1 | 45 | |
duke@1 | 46 | class iC{} |
duke@1 | 47 | static class iSC{} |
duke@1 | 48 | private class iVC{} |
duke@1 | 49 | static private class iSVC{} |
duke@1 | 50 | |
duke@1 | 51 | final class iFC{} |
duke@1 | 52 | static final class iSFC{} |
duke@1 | 53 | final private class iFVC{} |
duke@1 | 54 | static final private class iSFVC{} |
duke@1 | 55 | |
duke@1 | 56 | abstract class iAC{} |
duke@1 | 57 | static abstract class iSAC{} |
duke@1 | 58 | abstract private class iAVC{} |
duke@1 | 59 | static abstract private class iSAVC{} |
duke@1 | 60 | |
duke@1 | 61 | protected class iRC{} |
duke@1 | 62 | static protected class iSRC{} |
duke@1 | 63 | public class iUC{} |
duke@1 | 64 | static public class iSUC{} |
duke@1 | 65 | |
duke@1 | 66 | final protected class iFRC{} |
duke@1 | 67 | static final protected class iSFRC{} |
duke@1 | 68 | final public class iFUC{} |
duke@1 | 69 | static final public class iSFUC{} |
duke@1 | 70 | |
duke@1 | 71 | abstract protected class iARC{} |
duke@1 | 72 | static abstract protected class iSARC{} |
duke@1 | 73 | abstract public class iAUC{} |
duke@1 | 74 | static abstract public class iSAUC{} |
duke@1 | 75 | |
duke@1 | 76 | //all interface members are automatically "static" whether marked so or not |
duke@1 | 77 | //all interfaces are automatically "abstract" whether marked so or not |
duke@1 | 78 | //thus, interface modifiers are only distinguished by access permissions |
duke@1 | 79 | //thus, each of the next 4 groups of 4 classes have identical modifiers |
duke@1 | 80 | interface iI{} |
duke@1 | 81 | static interface iSI{} |
duke@1 | 82 | abstract interface iAI{} |
duke@1 | 83 | static abstract interface iSAI{} |
duke@1 | 84 | |
duke@1 | 85 | protected interface iRI{} |
duke@1 | 86 | static protected interface iSRI{} |
duke@1 | 87 | abstract protected interface iARI{} |
duke@1 | 88 | static abstract protected interface iSARI{} |
duke@1 | 89 | |
duke@1 | 90 | private interface iVI{} |
duke@1 | 91 | static private interface iSVI{} |
duke@1 | 92 | abstract private interface iAVI{} |
duke@1 | 93 | static abstract private interface iSAVI{} |
duke@1 | 94 | |
duke@1 | 95 | public interface iUI{} |
duke@1 | 96 | static public interface iSUI{} |
duke@1 | 97 | abstract public interface iAUI{} |
duke@1 | 98 | static abstract public interface iSAUI{} |
duke@1 | 99 | } |
duke@1 | 100 | |
duke@1 | 101 | interface U { |
duke@1 | 102 | //no members can be "protected" or "private" |
duke@1 | 103 | |
duke@1 | 104 | //all type members are automatically "public" whether marked so or not |
duke@1 | 105 | //all type members are automatically "static" whether marked so or not |
duke@1 | 106 | //thus, each of the next 3 groups of 4 classes have identical modifiers |
duke@1 | 107 | class jC{} |
duke@1 | 108 | static class jSC{} |
duke@1 | 109 | public class jUC{} |
duke@1 | 110 | static public class jSUC{} |
duke@1 | 111 | |
duke@1 | 112 | final class jFC{} |
duke@1 | 113 | static final class jSFC{} |
duke@1 | 114 | final public class jFUC{} |
duke@1 | 115 | static final public class jSFUC{} |
duke@1 | 116 | |
duke@1 | 117 | abstract class jAC{} |
duke@1 | 118 | static abstract class jSAC{} |
duke@1 | 119 | abstract public class jAUC{} |
duke@1 | 120 | static abstract public class jSAUC{} |
duke@1 | 121 | |
duke@1 | 122 | //all interface members are automatically "static" whether marked so or not |
duke@1 | 123 | //all interfaces are automatically "abstract" whether marked so or not |
duke@1 | 124 | //thus, all 8 of the following classes have identical modifiers: |
duke@1 | 125 | interface jI{} |
duke@1 | 126 | static interface jSI{} |
duke@1 | 127 | abstract interface jAI{} |
duke@1 | 128 | static abstract interface jSAI{} |
duke@1 | 129 | public interface jUI{} |
duke@1 | 130 | static public interface jSUI{} |
duke@1 | 131 | abstract public interface jAUI{} |
duke@1 | 132 | static abstract public interface jSAUI{} |
duke@1 | 133 | } |