所有修饰符所在类[Modifier]为如下:
package java.lang.reflect;
import java.security.AccessController;
import sun.reflect.LangReflectAccess;
import sun.reflect.ReflectionFactory;
/**
* The Modifier class provides {@code static} methods and
* constants to decode class and member access modifiers. The sets of
* modifiers are represented as integers with distinct bit positions
* representing different modifiers. The values for the constants
* representing the modifiers are taken from the tables in sections 4.1, 4.4, 4.5, and 4.7 of
* The Java™ Virtual Machine Specification.
*
* @see Class#getModifiers()
* @see Member#getModifiers()
*
* @author Nakul Saraiya
* @author Kenneth Russell
*/
public class Modifier {
//...
}
/*
* Access modifier flag constants from tables 4.1, 4.4, 4.5, and 4.7 of
* The Java™ Virtual Machine Specification
*/
public static final int PUBLIC = 0x00000001;
public static final int PRIVATE = 0x00000002;
public static final int PROTECTED = 0x00000004;
public static final int STATIC = 0x00000008;
public static final int FINAL = 0x00000010;
public static final int SYNCHRONIZED = 0x00000020;
public static final int VOLATILE = 0x00000040;
public static final int TRANSIENT = 0x00000080;
public static final int NATIVE = 0x00000100;
public static final int INTERFACE = 0x00000200;
public static final int ABSTRACT = 0x00000400;
public static final int STRICT = 0x00000800;
// Bits not (yet) exposed in the public API either because they
// have different meanings for fields and methods and there is no
// way to distinguish between the two in this class, or because
// they are not Java programming language keywords
static final int BRIDGE = 0x00000040;
static final int VARARGS = 0x00000080;
static final int SYNTHETIC = 0x00001000;
static final int ANNOTATION = 0x00002000;
static final int ENUM = 0x00004000;
static final int MANDATED = 0x00008000;
static boolean isSynthetic(int mod) {
return (mod & SYNTHETIC) != 0;
}
/**
* The Java source modifiers that can be applied to a class.
* @jls 8.1.1 Class Modifiers
*/
private static final int CLASS_MODIFIERS =
Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
Modifier.ABSTRACT | Modifier.STATIC | Modifier.FINAL |
Modifier.STRICT;
/**
* The Java source modifiers that can be applied to an interface.
* @jls 9.1.1 Interface Modifiers
*/
private static final int INTERFACE_MODIFIERS =
Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
Modifier.ABSTRACT | Modifier.STATIC | Modifier.STRICT;
/**
* The Java source modifiers that can be applied to a constructor.
* @jls 8.8.3 Constructor Modifiers
*/
private static final int CONSTRUCTOR_MODIFIERS =
Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE;
/**
* The Java source modifiers that can be applied to a method.
* @jls8.4.3 Method Modifiers
*/
private static final int METHOD_MODIFIERS =
Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
Modifier.ABSTRACT | Modifier.STATIC | Modifier.FINAL |
Modifier.SYNCHRONIZED | Modifier.NATIVE | Modifier.STRICT;
/**
* The Java source modifiers that can be applied to a field.
* @jls 8.3.1 Field Modifiers
*/
private static final int FIELD_MODIFIERS =
Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
Modifier.STATIC | Modifier.FINAL | Modifier.TRANSIENT |
Modifier.VOLATILE;
/**
* The Java source modifiers that can be applied to a method or constructor parameter.
* @jls 8.4.1 Formal Parameters
*/
private static final int PARAMETER_MODIFIERS =
Modifier.FINAL;
/**
*
*/
static final int ACCESS_MODIFIERS =
Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE;
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
有问题请联系QQ:765120845
欢迎关注微信公众号 【阿龙学堂】,更多编程基础知识及机器学习学习内容