Package org.jruby.anno
Class AnnotationBinder
java.lang.Object
javax.annotation.processing.AbstractProcessor
org.jruby.anno.AnnotationBinder
- All Implemented Interfaces:
Processor
@SupportedAnnotationTypes("org.jruby.anno.JRubyMethod")
public class AnnotationBinder
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<CharSequence>private static final booleanprivate PrintStreamstatic final Stringstatic final Stringprivate TypesFields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSubclassNames(List<String> classAndSubs, JRubyClass classAnno) private static intcalculateActualRequired(ExecutableElement method, int paramsLength, int optional, boolean rest, boolean isStatic, boolean hasContext, boolean hasBlock) static voidcheckForThrows(TypeElement type, ExecutableElement method) private voiddefineMethodOnClass(String methodVar, String classVar, String[] names, String[] aliases, ExecutableElement md) voidemitIndexCode(int bits, String names, String format) protected voidgatherMappings(Map<CharSequence, List<ExecutableElement>> methods, Map<CharSequence, CharSequence> mappings) private voidgenerateMethodAddCalls(ExecutableElement md, boolean meta, boolean module, String[] names, String[] aliases) voidprivate static CharSequencestatic StringgetBaseName(String[] names, ExecutableElement md) private static AnnotationBinder.ParametersInfoidentifyParameters(List<? extends VariableElement> parameters) voidinit(ProcessingEnvironment processingEnv) private static StringBuilderprivate static StringBuilderbooleanprocess(Set<? extends TypeElement> typeElements, RoundEnvironment roundEnvironment) voidvoidvoidprocessMethodDeclarations(Map<CharSequence, List<ExecutableElement>> declarations) voidprivate static CharSequenceprivate static voidwarn(CharSequence msg) Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, isInitialized
-
Field Details
-
POPULATOR_SUFFIX
- See Also:
-
SRC_GEN_DIR
- See Also:
-
classNames
-
out
-
types
-
DEBUG
private static final boolean DEBUG- See Also:
-
-
Constructor Details
-
AnnotationBinder
public AnnotationBinder()
-
-
Method Details
-
init
- Specified by:
initin interfaceProcessor- Overrides:
initin classAbstractProcessor
-
process
- Specified by:
processin interfaceProcessor- Specified by:
processin classAbstractProcessor
-
getSupportedSourceVersion
- Specified by:
getSupportedSourceVersionin interfaceProcessor- Overrides:
getSupportedSourceVersionin classAbstractProcessor
-
processType
-
addSubclassNames
-
gatherMappings
protected void gatherMappings(Map<CharSequence, List<ExecutableElement>> methods, Map<CharSequence, CharSequence> mappings) -
emitIndexCode
-
processMethodDeclarations
-
processMethodDeclaration
-
processMethodDeclarationMulti
-
identifyParameters
private static AnnotationBinder.ParametersInfo identifyParameters(List<? extends VariableElement> parameters) -
getActualQualifiedName
-
join
-
join
-
quote
-
calculateActualRequired
private static int calculateActualRequired(ExecutableElement method, int paramsLength, int optional, boolean rest, boolean isStatic, boolean hasContext, boolean hasBlock) -
generateMethodAddCalls
-
generateMethodAddCalls
private void generateMethodAddCalls(ExecutableElement md, boolean meta, boolean module, String[] names, String[] aliases) -
defineMethodOnClass
private void defineMethodOnClass(String methodVar, String classVar, String[] names, String[] aliases, ExecutableElement md) -
checkForThrows
-
getBaseName
-
warn
-