|
@@ -7,79 +7,224 @@
|
|
|
package net.ranides.assira.reflection;
|
|
package net.ranides.assira.reflection;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * This enum represents attributes of any IElement (class, field, method, etc)
|
|
|
|
|
+ *
|
|
|
|
|
+ * Each enum contains two int bitmasks: first one is used by IAttributes, second one is
|
|
|
|
|
+ * bitmask used by java reflection API.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Most of the time we tried to use identical mask values for both fields.
|
|
|
*
|
|
*
|
|
|
* @author Ranides Atterwim {@literal <ranides@gmail.com>}
|
|
* @author Ranides Atterwim {@literal <ranides@gmail.com>}
|
|
|
*/
|
|
*/
|
|
|
|
|
+@SuppressWarnings("JavadocReference")
|
|
|
public enum IAttribute {
|
|
public enum IAttribute {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#PUBLIC}
|
|
|
|
|
+ */
|
|
|
PUBLIC (0x0000_0001),
|
|
PUBLIC (0x0000_0001),
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#PRIVATE}
|
|
|
|
|
+ */
|
|
|
PRIVATE (0x0000_0002),
|
|
PRIVATE (0x0000_0002),
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#PROTECTED}
|
|
|
|
|
+ */
|
|
|
PROTECTED (0x0000_0004),
|
|
PROTECTED (0x0000_0004),
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#STATIC}
|
|
|
|
|
+ */
|
|
|
STATIC (0x0000_0008),
|
|
STATIC (0x0000_0008),
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#FINAL}
|
|
|
|
|
+ */
|
|
|
FINAL (0x0000_0010),
|
|
FINAL (0x0000_0010),
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#SYNCHRONIZED}
|
|
|
|
|
+ */
|
|
|
SYNCHRONIZED (0x0000_0020),
|
|
SYNCHRONIZED (0x0000_0020),
|
|
|
|
|
|
|
|
- VOLATILE (0x0000_0040), // special: must be field (conflict with BRIDGE)
|
|
|
|
|
-
|
|
|
|
|
- TRANSIENT (0x0000_0080), // special: must be field (conflict with VARARGS)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#VOLATILE}
|
|
|
|
|
+ *
|
|
|
|
|
+ * Warning: java reflection API uses the same value for BRIGDE.
|
|
|
|
|
+ * This attribute is allowed only for IField
|
|
|
|
|
+ */
|
|
|
|
|
+ VOLATILE (0x0000_0040),
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#TRANSIENT}
|
|
|
|
|
+ *
|
|
|
|
|
+ * Warning: java reflection API uses the same value for VARARGS.
|
|
|
|
|
+ * This attribute is allowed only for IField
|
|
|
|
|
+ */
|
|
|
|
|
+ TRANSIENT (0x0000_0080),
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#NATIVE}
|
|
|
|
|
+ */
|
|
|
NATIVE (0x0000_0100),
|
|
NATIVE (0x0000_0100),
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#INTERFACE}
|
|
|
|
|
+ */
|
|
|
INTERFACE (0x0000_0200),
|
|
INTERFACE (0x0000_0200),
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#ABSTRACT}
|
|
|
|
|
+ */
|
|
|
ABSTRACT (0x0000_0400),
|
|
ABSTRACT (0x0000_0400),
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#STRICT}
|
|
|
|
|
+ */
|
|
|
STRICT (0x0000_0800),
|
|
STRICT (0x0000_0800),
|
|
|
|
|
|
|
|
- BRIDGE (0x0100_0000, 0x0000_0040), // special: must be method (conflict with VOLATILE)
|
|
|
|
|
-
|
|
|
|
|
- VARARGS (0x0200_0000, 0x0000_0080), // special: must be method (conflict with TRANSIENT)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#BRIDGE}
|
|
|
|
|
+ *
|
|
|
|
|
+ * Warning: java reflection API uses the same value for VOLATILE.
|
|
|
|
|
+ * This attribute is allowed only for IMethod
|
|
|
|
|
+ */
|
|
|
|
|
+ BRIDGE (0x0100_0000, 0x0000_0040),
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#VARARGS}
|
|
|
|
|
+ *
|
|
|
|
|
+ * Warning: java reflection API uses the same value for TRANSIENT.
|
|
|
|
|
+ * This attribute is allowed only for IMethod
|
|
|
|
|
+ */
|
|
|
|
|
+ VARARGS (0x0200_0000, 0x0000_0080),
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#SYNTHETIC}
|
|
|
|
|
+ */
|
|
|
SYNTHETIC (0x0000_1000),
|
|
SYNTHETIC (0x0000_1000),
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#ANNOTATION}
|
|
|
|
|
+ */
|
|
|
ANNOTATION (0x0000_2000),
|
|
ANNOTATION (0x0000_2000),
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#ENUM}
|
|
|
|
|
+ */
|
|
|
ENUM (0x0000_4000),
|
|
ENUM (0x0000_4000),
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is standard reflective attribute: {@link java.lang.reflect.Modifier#MANDATED}
|
|
|
|
|
+ */
|
|
|
MANDATED (0x0000_8000),
|
|
MANDATED (0x0000_8000),
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is non standard attribute: it means that IElement has package scope
|
|
|
|
|
+ * Allowed for class, methods and fields.
|
|
|
|
|
+ */
|
|
|
PACKAGE (0x0400_0000, 0), // special: !(public | protected | private)
|
|
PACKAGE (0x0400_0000, 0), // special: !(public | protected | private)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This non standard attribute: it means that IElement is generic
|
|
|
|
|
+ * Allowed for class, methods and fields.
|
|
|
|
|
+ */
|
|
|
PARAMETERIZED (0x1000_0000, 0), // special: is generic class
|
|
PARAMETERIZED (0x1000_0000, 0), // special: is generic class
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is non standard attribute:
|
|
|
|
|
+ * it means that IElement is declared inside "this" class (not inherited from parent class).
|
|
|
|
|
+ *
|
|
|
|
|
+ * Allowed for inner classes, methods and fields.
|
|
|
|
|
+ * Used by IHints to filter out inherited members.
|
|
|
|
|
+ */
|
|
|
DECLARED (0x4000_0000, 0), // special: used in IClass to disable deep scan
|
|
DECLARED (0x4000_0000, 0), // special: used in IClass to disable deep scan
|
|
|
-
|
|
|
|
|
- LAMBDA (0x8000_0000, 0), // special: used in IMethod
|
|
|
|
|
-
|
|
|
|
|
- ANY (0x0020_0000, 0), // special: used only by AHints for deep scan of declared fields/methods/classes
|
|
|
|
|
|
|
|
|
|
- ARRAY (0x0001_0000, 0), // special: traits
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This non standard attribute: it means that IMethod is labmda expression
|
|
|
|
|
+ */
|
|
|
|
|
+ LAMBDA (0x8000_0000, 0),
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is non standard attribute:
|
|
|
|
|
+ * it means that IElement is declared or inherited.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Allowed for inner classes, methods and fields.
|
|
|
|
|
+ * Used by IHints to include inherited members.
|
|
|
|
|
+ */
|
|
|
|
|
+ ANY (0x0020_0000, 0), // special: used only by AHints for deep scan of declared fields/methods/classes
|
|
|
|
|
|
|
|
- PRIMITIVE (0x0002_0000, 0), // special: traits
|
|
|
|
|
-
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is type trait: it means that IClass is array
|
|
|
|
|
+ */
|
|
|
|
|
+ ARRAY (0x0001_0000, 0),
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is type trait: it means that IClass is primitive type
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see net.ranides.assira.reflection.util.ClassTraits#isPrimitive
|
|
|
|
|
+ */
|
|
|
|
|
+ PRIMITIVE (0x0002_0000, 0),
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is type trait: it means that IClass is numerical type
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see net.ranides.assira.reflection.util.ClassTraits#isNumber
|
|
|
|
|
+ */
|
|
|
NUMBER (0x2000_0000, 0), // special: traits
|
|
NUMBER (0x2000_0000, 0), // special: traits
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is type trait: it means that IClass is integer type
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see net.ranides.assira.reflection.util.ClassTraits#isInteger
|
|
|
|
|
+ */
|
|
|
INTEGER (0x0040_0000, 0), // special: traits
|
|
INTEGER (0x0040_0000, 0), // special: traits
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is type trait: it means that IClass is boxed type
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see net.ranides.assira.reflection.util.ClassTraits#isBoxed
|
|
|
|
|
+ */
|
|
|
BOXED (0x0004_0000, 0), // special: traits
|
|
BOXED (0x0004_0000, 0), // special: traits
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is type trait: it means that IClass is void type
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see net.ranides.assira.reflection.util.ClassTraits#isVoid
|
|
|
|
|
+ */
|
|
|
VOID (0x0008_0000, 0), // special: traits
|
|
VOID (0x0008_0000, 0), // special: traits
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is type trait: it means that IClass is boolean type
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see net.ranides.assira.reflection.util.ClassTraits#isBool
|
|
|
|
|
+ */
|
|
|
BOOLEAN (0x0010_0000, 0), // special: traits
|
|
BOOLEAN (0x0010_0000, 0), // special: traits
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This is non standard attribute:
|
|
|
|
|
+ * it means that IElement does not represent "real reflective" object,
|
|
|
|
|
+ * but contains only information about name and signature (more or less)
|
|
|
|
|
+ *
|
|
|
|
|
+ * Allowed for classes and methods.
|
|
|
|
|
+ */
|
|
|
SYMBOLIC (0x0800_0000),
|
|
SYMBOLIC (0x0800_0000),
|
|
|
|
|
|
|
|
//RESERVED (0x00800000),
|
|
//RESERVED (0x00800000),
|
|
|
|
|
|
|
|
;
|
|
;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This field is bitmask used by IAttributes container
|
|
|
|
|
+ */
|
|
|
final int mask;
|
|
final int mask;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * This field represents bitmask compatible with {@link java.lang.reflect.Modifier}
|
|
|
|
|
+ * Obviously returned mask does not contain non-standard attributes.
|
|
|
|
|
+ */
|
|
|
final int reflective;
|
|
final int reflective;
|
|
|
|
|
|
|
|
IAttribute(int mask) {
|
|
IAttribute(int mask) {
|