aoqi@0: /* aoqi@0: * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: /* aoqi@0: * @test aoqi@0: * @bug 4109894 4239646 4785453 aoqi@0: * @summary Verify that class modifiers bits written into class aoqi@0: * file are correct, including those within InnerClasses attributes. aoqi@0: * @author John Rose (jrose). Entered as a regression test by Bill Maddox (maddox). aoqi@0: * aoqi@0: * @compile/ref=ClassModifiers.out -XDdumpmodifiers=ci ClassModifiers.java aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: class T { aoqi@0: //all "protected" type members are transformed to "public" aoqi@0: //all "private" type members are transformed to package-scope aoqi@0: //all "static" type members are transformed to non-static aoqi@0: aoqi@0: //a class is one of {,public,private,protected}x{,static}x{,abstract,final} aoqi@0: //all of these 24 combinations are legal aoqi@0: //all of these 24 combinations generate distinct InnerClasses modifiers aoqi@0: //transformed class modifiers can be {,public}x{,abstract,final} aoqi@0: //thus, each of the next 6 groups of 4 have identical transformed modifiers aoqi@0: aoqi@0: class iC{} aoqi@0: static class iSC{} aoqi@0: private class iVC{} aoqi@0: static private class iSVC{} aoqi@0: aoqi@0: final class iFC{} aoqi@0: static final class iSFC{} aoqi@0: final private class iFVC{} aoqi@0: static final private class iSFVC{} aoqi@0: aoqi@0: abstract class iAC{} aoqi@0: static abstract class iSAC{} aoqi@0: abstract private class iAVC{} aoqi@0: static abstract private class iSAVC{} aoqi@0: aoqi@0: protected class iRC{} aoqi@0: static protected class iSRC{} aoqi@0: public class iUC{} aoqi@0: static public class iSUC{} aoqi@0: aoqi@0: final protected class iFRC{} aoqi@0: static final protected class iSFRC{} aoqi@0: final public class iFUC{} aoqi@0: static final public class iSFUC{} aoqi@0: aoqi@0: abstract protected class iARC{} aoqi@0: static abstract protected class iSARC{} aoqi@0: abstract public class iAUC{} aoqi@0: static abstract public class iSAUC{} aoqi@0: aoqi@0: //all interface members are automatically "static" whether marked so or not aoqi@0: //all interfaces are automatically "abstract" whether marked so or not aoqi@0: //thus, interface modifiers are only distinguished by access permissions aoqi@0: //thus, each of the next 4 groups of 4 classes have identical modifiers aoqi@0: interface iI{} aoqi@0: static interface iSI{} aoqi@0: abstract interface iAI{} aoqi@0: static abstract interface iSAI{} aoqi@0: aoqi@0: protected interface iRI{} aoqi@0: static protected interface iSRI{} aoqi@0: abstract protected interface iARI{} aoqi@0: static abstract protected interface iSARI{} aoqi@0: aoqi@0: private interface iVI{} aoqi@0: static private interface iSVI{} aoqi@0: abstract private interface iAVI{} aoqi@0: static abstract private interface iSAVI{} aoqi@0: aoqi@0: public interface iUI{} aoqi@0: static public interface iSUI{} aoqi@0: abstract public interface iAUI{} aoqi@0: static abstract public interface iSAUI{} aoqi@0: } aoqi@0: aoqi@0: interface U { aoqi@0: //no members can be "protected" or "private" aoqi@0: aoqi@0: //all type members are automatically "public" whether marked so or not aoqi@0: //all type members are automatically "static" whether marked so or not aoqi@0: //thus, each of the next 3 groups of 4 classes have identical modifiers aoqi@0: class jC{} aoqi@0: static class jSC{} aoqi@0: public class jUC{} aoqi@0: static public class jSUC{} aoqi@0: aoqi@0: final class jFC{} aoqi@0: static final class jSFC{} aoqi@0: final public class jFUC{} aoqi@0: static final public class jSFUC{} aoqi@0: aoqi@0: abstract class jAC{} aoqi@0: static abstract class jSAC{} aoqi@0: abstract public class jAUC{} aoqi@0: static abstract public class jSAUC{} aoqi@0: aoqi@0: //all interface members are automatically "static" whether marked so or not aoqi@0: //all interfaces are automatically "abstract" whether marked so or not aoqi@0: //thus, all 8 of the following classes have identical modifiers: aoqi@0: interface jI{} aoqi@0: static interface jSI{} aoqi@0: abstract interface jAI{} aoqi@0: static abstract interface jSAI{} aoqi@0: public interface jUI{} aoqi@0: static public interface jSUI{} aoqi@0: abstract public interface jAUI{} aoqi@0: static abstract public interface jSAUI{} aoqi@0: }