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