APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.javac.processing

public Class PrintingProcessor

extends AbstractProcessor
Class Inheritance
Annotations
@SupportedAnnotationTypes:*
@SupportedSourceVersion:RELEASE_27
Imports
javax.annotation.processing.*, javax.lang.model.*, javax.lang.model.element.*, javax.lang.model.type.*, javax.lang.model.util.*, java.io.PrintWriter, .Writer, java.util.*, java.util.stream.Collectors, com.sun.tools.javac.util.DefinedBy, .DefinedBy.Api, .StringUtils

A processor which prints out elements. Used to implement the -Xprint option; the included visitor class is used to implement Elements.printElements.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
PrintingProcessor.PrintingElementVisitor

Used for the -Xprint option and called by Elements.printElements

Field Summary

Modifier and TypeField and Description
pack-priv PrintWriter
Inherited from javax.annotation.processing.AbstractProcessor:
processingEnv

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
process(Set<? extends TypeElement> tes, RoundEnvironment renv)

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
Inherited from javax.annotation.processing.AbstractProcessor:
getCompletionsgetSupportedAnnotationTypesgetSupportedOptionsgetSupportedSourceVersioninitisInitialized

Field Detail

writerback to summary
pack-priv PrintWriter writer

Constructor Detail

PrintingProcessorback to summary
public PrintingProcessor()

Method Detail

processback to summary
public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv)

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.

Annotations
@Override
@DefinedBy:ANNOTATION_PROCESSING
setWriterback to summary
public void setWriter(Writer w)
com.sun.tools.javac.processing back to summary

public Class PrintingProcessor.PrintingElementVisitor

extends SimpleElementVisitor14<PrintingProcessor.PrintingElementVisitor, Boolean>
Class Inheritance

Used for the -Xprint option and called by Elements.printElements

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
pack-priv final Elements
pack-priv int
private static final String[]
pack-priv final PrintWriter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private String
protected PrintingProcessor.PrintingElementVisitor
defaultAction(Element e, Boolean newLine)

Overrides javax.lang.model.util.SimpleElementVisitor6.defaultAction.

The default action for visit methods.

public void
private void
private boolean

Returns:

true if this type is either not java.lang.Object, or is annotated, and hence needs to be included in the output, even for cases where there's implicit java.lang.Object type.
isImportantType
(TypeMirror
the type to check.
type
)

Returns true if this type is either not java.lang.Object, or is annotated, and hence needs to be included in the output, even for cases where there's implicit java.lang.Object type.

private void
private void
private void
private boolean
private void
private void
private void
private void
private void
private void
private String
public PrintingProcessor.PrintingElementVisitor
public PrintingProcessor.PrintingElementVisitor
public PrintingProcessor.PrintingElementVisitor
public PrintingProcessor.PrintingElementVisitor
public PrintingProcessor.PrintingElementVisitor
public PrintingProcessor.PrintingElementVisitor
public PrintingProcessor.PrintingElementVisitor

Field Detail

elementUtilsback to summary
pack-priv final Elements elementUtils
indentationback to summary
pack-priv int indentation
spacesback to summary
private static final String[] spaces
writerback to summary
pack-priv final PrintWriter writer

Constructor Detail

PrintingElementVisitorback to summary
public PrintingElementVisitor(Writer w, Elements elementUtils)

Method Detail

annotationsToStringback to summary
private String annotationsToString(Element e)
defaultActionback to summary
protected PrintingProcessor.PrintingElementVisitor defaultAction(Element e, Boolean newLine)

Overrides javax.lang.model.util.SimpleElementVisitor6.defaultAction.

Doc from javax.lang.model.util.SimpleElementVisitor6.defaultAction.

The default action for visit methods.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
flushback to summary
public void flush()
indentback to summary
private void indent()
isImportantTypeback to summary
private boolean isImportantType(TypeMirror type)

Returns true if this type is either not java.lang.Object, or is annotated, and hence needs to be included in the output, even for cases where there's implicit java.lang.Object type.

Parameters
type:TypeMirror

the type to check.

Returns:boolean

true if this type is either not java.lang.Object, or is annotated, and hence needs to be included in the output, even for cases where there's implicit java.lang.Object type.

printAnnotationsback to summary
private void printAnnotations(Element e)
printDirectiveback to summary
private void printDirective(ModuleElement.Directive directive)
printDocCommentback to summary
private void printDocComment(Element e)
printedContainerAnnotationback to summary
private boolean printedContainerAnnotation(Element e, AnnotationMirror annotationMirror)
printFormalTypeParametersback to summary
private void printFormalTypeParameters(Parameterizable e, boolean pad)
printInterfacesback to summary
private void printInterfaces(TypeElement e)
printModifiersback to summary
private void printModifiers(Element e)
printParametersback to summary
private void printParameters(ExecutableElement e)
printPermittedSubclassesback to summary
private void printPermittedSubclasses(TypeElement e)
printThrowsback to summary
private void printThrows(ExecutableElement e)
printTypeVariableBoundsIfNeededback to summary
private String printTypeVariableBoundsIfNeeded(TypeParameterElement tpe)
visitExecutableback to summary
public PrintingProcessor.PrintingElementVisitor visitExecutable(ExecutableElement e, Boolean p)

Overrides javax.lang.model.util.SimpleElementVisitor6.visitExecutable.

Implements javax.lang.model.element.ElementVisitor.visitExecutable.

Doc from javax.lang.model.util.SimpleElementVisitor6.visitExecutable.

Visits an executable element.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitModuleback to summary
public PrintingProcessor.PrintingElementVisitor visitModule(ModuleElement e, Boolean p)

Overrides javax.lang.model.util.SimpleElementVisitor9.visitModule.

Overrides default javax.lang.model.element.ElementVisitor.visitModule.

Doc from javax.lang.model.util.SimpleElementVisitor9.visitModule.

Visits a module element.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitPackageback to summary
public PrintingProcessor.PrintingElementVisitor visitPackage(PackageElement e, Boolean p)

Overrides javax.lang.model.util.SimpleElementVisitor6.visitPackage.

Implements javax.lang.model.element.ElementVisitor.visitPackage.

Doc from javax.lang.model.util.SimpleElementVisitor6.visitPackage.

Visits a package element.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitRecordComponentback to summary
public PrintingProcessor.PrintingElementVisitor visitRecordComponent(RecordComponentElement e, Boolean p)

Overrides javax.lang.model.util.SimpleElementVisitor14.visitRecordComponent.

Overrides default javax.lang.model.element.ElementVisitor.visitRecordComponent.

Doc from javax.lang.model.util.SimpleElementVisitor14.visitRecordComponent.

Visits a record component element.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitTypeback to summary
public PrintingProcessor.PrintingElementVisitor visitType(TypeElement e, Boolean p)

Overrides javax.lang.model.util.SimpleElementVisitor6.visitType.

Implements javax.lang.model.element.ElementVisitor.visitType.

Doc from javax.lang.model.util.SimpleElementVisitor6.visitType.

Visits a type element.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitTypeParameterback to summary
public PrintingProcessor.PrintingElementVisitor visitTypeParameter(TypeParameterElement e, Boolean p)

Overrides javax.lang.model.util.SimpleElementVisitor6.visitTypeParameter.

Implements javax.lang.model.element.ElementVisitor.visitTypeParameter.

Doc from javax.lang.model.util.SimpleElementVisitor6.visitTypeParameter.

Visits a type parameter element.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitVariableback to summary
public PrintingProcessor.PrintingElementVisitor visitVariable(VariableElement e, Boolean newLine)

Overrides javax.lang.model.util.SimpleElementVisitor7.visitVariable.

Implements javax.lang.model.element.ElementVisitor.visitVariable.

Doc from javax.lang.model.util.SimpleElementVisitor7.visitVariable.

Visits a variable element.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
com.sun.tools.javac.processing back to summary

private Class PrintingProcessor.PrintingElementVisitor.PrintDirective

extends Object
implements ModuleElement.DirectiveVisitor<Void, Void>
Class Inheritance
  • java.lang.Object
  • com.sun.tools.javac.processing.PrintingProcessor.PrintingElementVisitor.PrintDirective
All Implemented Interfaces
javax.lang.model.element.ModuleElement.DirectiveVisitor

Field Summary

Modifier and TypeField and Description
private final PrintWriter

Constructor Summary

AccessConstructor and Description
pack-priv

Field Detail

writerback to summary
private final PrintWriter writer

Constructor Detail

PrintDirectiveback to summary
pack-priv PrintDirective(PrintWriter writer)

Method Detail

printModuleListback to summary
private void printModuleList(List<? extends ModuleElement> modules)
printNameableListback to summary
private void printNameableList(List<? extends QualifiedNameable> nameables)
visitExportsback to summary
public Void visitExports(ModuleElement.ExportsDirective d, Void p)

Implements javax.lang.model.element.ModuleElement.DirectiveVisitor.visitExports.

Doc from javax.lang.model.element.ModuleElement.DirectiveVisitor.visitExports.

Visits an exports directive.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitOpensback to summary
public Void visitOpens(ModuleElement.OpensDirective d, Void p)

Implements javax.lang.model.element.ModuleElement.DirectiveVisitor.visitOpens.

Doc from javax.lang.model.element.ModuleElement.DirectiveVisitor.visitOpens.

Visits an opens directive.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitProvidesback to summary
public Void visitProvides(ModuleElement.ProvidesDirective d, Void p)

Implements javax.lang.model.element.ModuleElement.DirectiveVisitor.visitProvides.

Doc from javax.lang.model.element.ModuleElement.DirectiveVisitor.visitProvides.

Visits a provides directive.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitRequiresback to summary
public Void visitRequires(ModuleElement.RequiresDirective d, Void p)

Implements javax.lang.model.element.ModuleElement.DirectiveVisitor.visitRequires.

Doc from javax.lang.model.element.ModuleElement.DirectiveVisitor.visitRequires.

Visits a requires directive.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitUsesback to summary
public Void visitUses(ModuleElement.UsesDirective d, Void p)

Implements javax.lang.model.element.ModuleElement.DirectiveVisitor.visitUses.

Doc from javax.lang.model.element.ModuleElement.DirectiveVisitor.visitUses.

Visits a uses directive.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL