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