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