Package org.jruby.anno
Class IndyBinder
java.lang.Object
javax.annotation.processing.AbstractProcessor
org.jruby.anno.IndyBinder
- All Implemented Interfaces:
Processor
@SupportedAnnotationTypes("org.jruby.anno.JRubyMethod")
public class IndyBinder
extends AbstractProcessor
Annotation processor for generating "populators" to bind native Java methods as Ruby methods, and
to gather a list of classes seen during compilation that should have their invokers regenerated.
NOTE: This class must ONLY reference classes in the org.jruby.anno package, to avoid forcing
a transitive dependency on any runtime JRuby classes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intprivate final List<CharSequence>private static final booleanprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intstatic final intprivate SkinnyMethodAdapterstatic final Stringstatic final intstatic final intstatic final intstatic final StringFields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadaptHandle(ExecutableElementDescriptor executableElementDescriptor, int implClass) private voidaddCoreMethodMapping(TypeElement cls, Map<CharSequence, List<ExecutableElement>> complexNames) private voidaddSimpleMethodMappings(TypeElement cls, List<ExecutableElement> simpleNames) private static intcalculateActualRequired(ExecutableElement md, int paramsLength, int optional, boolean rest, boolean isStatic, boolean hasContext, boolean hasBlock) private static intcalculateHandleOffset(int paramsLength, int required, int optional, boolean rest, boolean isStatic, boolean hasContext, boolean hasBlock) private voiddefineMethodOnClass(int methodVar, int classVar, String[] names, String[] aliases, ExecutableElement md) voidemitIndexCode(Integer bits, String names, String methodName) static longencodeSignature(int pre, int opt, int post, int kwargs, int requiredKwargs, boolean rest, boolean restKwargs) voidgenerateMethodAddCalls(ExecutableElement md, JRubyMethod jrubyMethod) private static CharSequencestatic longbooleanprocess(Set<? extends TypeElement> typeElements, RoundEnvironment roundEnvironment) voidvoidvoidprocessMethodDeclarations(Map<CharSequence, List<ExecutableElement>> declarations) voidMethods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, init, isInitialized
-
Field Details
-
POPULATOR_SUFFIX
- See Also:
-
SRC_GEN_DIR
- See Also:
-
CLASS
public static final int CLASS- See Also:
-
BASEMETHOD
public static final int BASEMETHOD- See Also:
-
MODULEMETHOD
public static final int MODULEMETHOD- See Also:
-
RUNTIME
public static final int RUNTIME- See Also:
-
SINGLETONCLASS
public static final int SINGLETONCLASS- See Also:
-
RUBYMODULE
public static final int RUBYMODULE- See Also:
-
classNames
-
mv
-
DEBUG
private static final boolean DEBUG- See Also:
-
MAX_ENCODED_ARGS_EXPONENT
private static final int MAX_ENCODED_ARGS_EXPONENT- See Also:
-
MAX_ENCODED_ARGS_MASK
private static final int MAX_ENCODED_ARGS_MASK- See Also:
-
ENCODE_RESTKWARGS_SHIFT
private static final int ENCODE_RESTKWARGS_SHIFT- See Also:
-
ENCODE_REST_SHIFT
private static final int ENCODE_REST_SHIFT- See Also:
-
ENCODE_REQKWARGS_SHIFT
private static final int ENCODE_REQKWARGS_SHIFT- See Also:
-
ENCODE_KWARGS_SHIFT
private static final int ENCODE_KWARGS_SHIFT- See Also:
-
ENCODE_POST_SHIFT
private static final int ENCODE_POST_SHIFT- See Also:
-
ENCODE_OPT_SHIFT
private static final int ENCODE_OPT_SHIFT- See Also:
-
ENCODE_PRE_SHIFT
private static final int ENCODE_PRE_SHIFT- See Also:
-
-
Constructor Details
-
IndyBinder
public IndyBinder()
-
-
Method Details
-
process
- Specified by:
processin interfaceProcessor- Specified by:
processin classAbstractProcessor
-
getSupportedSourceVersion
- Specified by:
getSupportedSourceVersionin interfaceProcessor- Overrides:
getSupportedSourceVersionin classAbstractProcessor
-
processType
-
emitIndexCode
-
processMethodDeclarations
-
processMethodDeclaration
-
getEncodedSignature
-
processMethodDeclarationMulti
-
adaptHandle
-
addCoreMethodMapping
private void addCoreMethodMapping(TypeElement cls, Map<CharSequence, List<ExecutableElement>> complexNames) -
addSimpleMethodMappings
-
getActualQualifiedName
-
encodeSignature
public static long encodeSignature(int pre, int opt, int post, int kwargs, int requiredKwargs, boolean rest, boolean restKwargs) -
calculateActualRequired
private static int calculateActualRequired(ExecutableElement md, int paramsLength, int optional, boolean rest, boolean isStatic, boolean hasContext, boolean hasBlock) -
calculateHandleOffset
private static int calculateHandleOffset(int paramsLength, int required, int optional, boolean rest, boolean isStatic, boolean hasContext, boolean hasBlock) -
generateMethodAddCalls
-
defineMethodOnClass
private void defineMethodOnClass(int methodVar, int classVar, String[] names, String[] aliases, ExecutableElement md)
-