Top Description Inners Fields Constructors Methods
org.jruby.anno

public Class AnnotationBinder

extends AbstractProcessor
Class Inheritance
Annotations
@SupportedAnnotationTypes:JRubyMethod
Imports
java.io.ByteArrayOutputStream, .File, .FileOutputStream, .FileWriter, .IOException, .PrintStream, java.util.*, java.util.stream.Collectors, javax.annotation.processing.AbstractProcessor, .ProcessingEnvironment, .RoundEnvironment, .SupportedAnnotationTypes, javax.lang.model.SourceVersion, javax.lang.model.element.*, javax.lang.model.type.MirroredTypesException, .TypeMirror, javax.lang.model.util.ElementFilter, .Types, org.jruby.util.CodegenUtils

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 and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final List<CharSequence>
private static final boolean
private PrintStream
public static final String
public static final String
private Types
Inherited from javax.annotation.processing.AbstractProcessor:
processingEnv

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addSubclassNames(List<String> classAndSubs, JRubyClass classAnno)

private static int
calculateActualRequired(ExecutableElement method, int paramsLength, int optional, boolean rest, boolean isStatic, boolean hasContext, boolean hasBlock)

public static void
private void
defineMethodOnClass(String methodVar, String classVar, final String[] names, final String[] aliases, ExecutableElement md)

public void
emitIndexCode(int bits, String names, String format)

protected void
public void
private void
generateMethodAddCalls(ExecutableElement md, final boolean meta, final boolean module, String[] names, String[] aliases)

private static CharSequence
public static String
public SourceVersion
private static AnnotationBinder.ParametersInfo
identifyParameters(List<? extends VariableElement> parameters)

public synchronized void
init(ProcessingEnvironment
environment to access facilities the tool framework provides to the processor
processingEnv
)

Overrides javax.annotation.processing.AbstractProcessor.init.

Implements javax.annotation.processing.Processor.init.

Initializes the processor with the processing environment.

private static StringBuilder
join(final Object... vals)

private static StringBuilder
join(final String sep, final Iterable<?> names)

public boolean
process(Set<? extends TypeElement>
the annotation interfaces requested to be processed
typeElements
,
RoundEnvironment
environment for information about the current and prior round
roundEnvironment
)

Implements abstract javax.annotation.processing.AbstractProcessor.process.

Implements javax.annotation.processing.Processor.process.

Processes a set of annotation interfaces on root elements originating from the prior round and returns whether or not these annotation interfaces are claimed by this processor.

public void
public void
public void
public void
private static CharSequence
quote(final Object name)

private static void
Inherited from javax.annotation.processing.AbstractProcessor:
getCompletionsgetSupportedAnnotationTypesgetSupportedOptionsisInitialized

Field Detail

classNamesback to summary
private final List<CharSequence> classNames
DEBUGback to summary
private static final boolean DEBUG
outback to summary
private PrintStream out
POPULATOR_SUFFIXback to summary
public static final String POPULATOR_SUFFIX
SRC_GEN_DIRback to summary
public static final String SRC_GEN_DIR
typesback to summary
private Types types

Constructor Detail

AnnotationBinderback to summary
public AnnotationBinder()

Method Detail

addSubclassNamesback to summary
public void addSubclassNames(List<String> classAndSubs, JRubyClass classAnno)
calculateActualRequiredback to summary
private static int calculateActualRequired(ExecutableElement method, int paramsLength, int optional, boolean rest, boolean isStatic, boolean hasContext, boolean hasBlock)
checkForThrowsback to summary
public static void checkForThrows(TypeElement type, ExecutableElement method)
defineMethodOnClassback to summary
private void defineMethodOnClass(String methodVar, String classVar, final String[] names, final String[] aliases, ExecutableElement md)
emitIndexCodeback to summary
public void emitIndexCode(int bits, String names, String format)
gatherMappingsback to summary
protected void gatherMappings(Map<CharSequence, List<ExecutableElement>> methods, Map<CharSequence, CharSequence> mappings)
generateMethodAddCallsback to summary
public void generateMethodAddCalls(ExecutableElement md, JRubyMethod anno)
generateMethodAddCallsback to summary
private void generateMethodAddCalls(ExecutableElement md, final boolean meta, final boolean module, String[] names, String[] aliases)
getActualQualifiedNameback to summary
private static CharSequence getActualQualifiedName(TypeElement elem)
getBaseNameback to summary
public static String getBaseName(String[] names, ExecutableElement md)
getSupportedSourceVersionback to summary
public SourceVersion getSupportedSourceVersion()

Overrides javax.annotation.processing.AbstractProcessor.getSupportedSourceVersion.

Implements javax.annotation.processing.Processor.getSupportedSourceVersion.

Doc from javax.annotation.processing.AbstractProcessor.getSupportedSourceVersion.

Returns the latest source version supported by this annotation processor.

Returns:SourceVersion

the latest source version supported by this annotation processor

Annotations
@Override
identifyParametersback to summary
private static AnnotationBinder.ParametersInfo identifyParameters(List<? extends VariableElement> parameters)
initback to summary
public synchronized void init(ProcessingEnvironment processingEnv)

Overrides javax.annotation.processing.AbstractProcessor.init.

Implements javax.annotation.processing.Processor.init.

Doc from javax.annotation.processing.AbstractProcessor.init.

Initializes the processor with the processing environment.

Parameters
processingEnv:ProcessingEnvironment

environment to access facilities the tool framework provides to the processor

Annotations
@Override
joinback to summary
private static StringBuilder join(final Object... vals)
joinback to summary
private static StringBuilder join(final String sep, final Iterable<?> names)
processback to summary
public boolean process(Set<? extends TypeElement> typeElements, RoundEnvironment roundEnvironment)

Implements abstract javax.annotation.processing.AbstractProcessor.process.

Implements javax.annotation.processing.Processor.process.

Doc from javax.annotation.processing.AbstractProcessor.process.

Processes a set of annotation interfaces on root elements originating from the prior round and returns whether or not these annotation interfaces are claimed by this processor. If true is returned, the annotation interfaces are claimed and subsequent processors will not be asked to process them; if false is returned, the annotation interfaces are unclaimed and subsequent processors may be asked to process them. A processor may always return the same boolean value or may vary the result based on its own chosen criteria.

The input set will be empty if the processor supports "*" and the root elements have no annotations. A Processor must gracefully handle an empty set of annotations.

Parameters
typeElements:Set<? extends TypeElement>

the annotation interfaces requested to be processed

roundEnvironment:RoundEnvironment

environment for information about the current and prior round

Returns:boolean

Doc from javax.annotation.processing.Processor.process.

whether or not the set of annotation interfaces are claimed by this processor

Annotations
@Override
processMethodDeclarationback to summary
public void processMethodDeclaration(ExecutableElement method)
processMethodDeclarationMultiback to summary
public void processMethodDeclarationMulti(ExecutableElement method)
processMethodDeclarationsback to summary
public void processMethodDeclarations(Map<CharSequence, List<ExecutableElement>> declarations)
processTypeback to summary
public void processType(TypeElement cd)
Annotations
@SuppressWarnings:deprecation
quoteback to summary
private static CharSequence quote(final Object name)
warnback to summary
private static void warn(CharSequence msg)
org.jruby.anno back to summary

private Class AnnotationBinder.ParametersInfo

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final boolean
pack-priv final boolean
pack-priv final String

Constructor Summary

AccessConstructor and Description
pack-priv
ParametersInfo(String name, boolean hasContext, boolean hasBlock)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hasBlockback to summary
pack-priv final boolean hasBlock
hasContextback to summary
pack-priv final boolean hasContext
typeDeclback to summary
pack-priv final String typeDecl

Constructor Detail

ParametersInfoback to summary
pack-priv ParametersInfo(String name, boolean hasContext, boolean hasBlock)