Java Code Examples for javax.annotation.processing.ProcessingEnvironment#getMessager()

The following examples show how to use javax.annotation.processing.ProcessingEnvironment#getMessager() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SPIProcessor.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void init(ProcessingEnvironment env) {
    this.processingEnv = env;
    this.filer = env.getFiler();
    this.discoveredExtensions = new ArrayList<>();
    this.discoveredBindings = new ArrayList<>();
    this.discoveredBeanFactories = new ArrayList<>();
    this.categoryClasses = new ArrayList<>();
    this.subsystemDeclararions = new ArrayList<>();
    this.requiredResourcesDeclarations = new ArrayList<>();
    this.searchIndexDeclarations = new ArrayList<>();
    this.bootstrapOperations = new ArrayList<>();
    this.runtimeExtensions = new ArrayList<>();
    this.nameTokens = new HashSet<>();

    moduleConfigs = new ArrayList<ModuleConfig>();
    moduleConfigs.add(new ModuleConfig(filer, "App_base.gwt.xml.tmpl", "App.gwt.xml"));
    moduleConfigs.add(new ModuleConfig(filer, "App_WF.gwt.xml.tmpl", "App_WF.gwt.xml"));
    moduleConfigs.add(new ModuleConfig(filer, "App_WF_full.gwt.xml.tmpl", "App_WF_full.gwt.xml"));
    moduleConfigs.add(new ModuleConfig(filer, "App_WF_dev.gwt.xml.tmpl", "App_WF_dev.gwt.xml"));
    moduleConfigs.add(new ModuleConfig(filer, "App_RH.gwt.xml.tmpl", "App_RH.gwt.xml"));
    moduleConfigs.add(new ModuleConfig(filer, "App_RH_dev.gwt.xml.tmpl", "App_RH_dev.gwt.xml"));

    env.getMessager();
    parseGwtProperties();
}
 
Example 2
Source File: TableProcessor.java    From wellsql with MIT License 5 votes vote down vote up
@Override
public void init(ProcessingEnvironment processingEnv) {
    super.init(processingEnv);
    filer = processingEnv.getFiler();
    messager = processingEnv.getMessager();
    Utils.init(processingEnv);
}
 
Example 3
Source File: TreeBackedProcessingEnvironment.java    From buck with Apache License 2.0 5 votes vote down vote up
public TreeBackedProcessingEnvironment(
    FrontendOnlyJavacTask task, ProcessingEnvironment javacProcessingEnvironment) {
  this.task = task;
  this.javacProcessingEnvironment = javacProcessingEnvironment;
  messager = new TreeBackedMessager(task, javacProcessingEnvironment.getMessager());
  filer = new TreeBackedFiler(task, javacProcessingEnvironment.getFiler());

  options.putAll(javacProcessingEnvironment.getOptions());
  options.put("com.facebook.buck.java.generating_abi", "true");
}
 
Example 4
Source File: RetrofitServiceProcessor.java    From kaif-android with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
  super.init(processingEnv);
  elementUtils = processingEnv.getElementUtils();
  filer = processingEnv.getFiler();
  messager = processingEnv.getMessager();
}
 
Example 5
Source File: ConverterProcessor.java    From AndServer with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
    mFiler = processingEnv.getFiler();
    mElements = processingEnv.getElementUtils();
    mLog = new Logger(processingEnv.getMessager());

    mContext = TypeName.get(mElements.getTypeElement(Constants.CONTEXT_TYPE).asType());
    mOnRegisterType = TypeName.get(mElements.getTypeElement(Constants.ON_REGISTER_TYPE).asType());
    mRegisterType = TypeName.get(mElements.getTypeElement(Constants.REGISTER_TYPE).asType());

    mConverter = TypeName.get(mElements.getTypeElement(Constants.CONVERTER_TYPE).asType());

    mString = TypeName.get(String.class);
}
 
Example 6
Source File: DispatcherProcessor.java    From EasyRouter with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
    super.init(processingEnv);
    mMessager = processingEnv.getMessager();
    mFiler = processingEnv.getFiler();
    elementUtils = processingEnv.getElementUtils();
    set = new HashSet<String>();

    Map<String, String> options = processingEnv.getOptions();
    if (MapUtils.isNotEmpty(options)) {
        moduleName = options.get(CompilerConstant.KEY_MODULE_NAME);
        set.add(moduleName);
    }
}
 
Example 7
Source File: XmlProcessor.java    From tikxml with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
  super.init(processingEnv);
  messager = processingEnv.getMessager();
  filer = processingEnv.getFiler();
  elementUtils = processingEnv.getElementUtils();
  typeUtils = processingEnv.getTypeUtils();
  annotationDetector = new DefaultAnnotationDetector(elementUtils, typeUtils);
}
 
Example 8
Source File: AftermathProcessor.java    From Aftermath with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
    super.init(processingEnv);
    filer = processingEnv.getFiler();
    messager = processingEnv.getMessager();
    elementUtils = processingEnv.getElementUtils();
}
 
Example 9
Source File: AutoBundleProcessor.java    From AutoBundle with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
    super.init(processingEnv);
    filer = processingEnv.getFiler();
    messager = processingEnv.getMessager();
    elementUtils = processingEnv.getElementUtils();
    typeUtils = processingEnv.getTypeUtils();
}
 
Example 10
Source File: AutoFactoryProcessor.java    From auto with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
  super.init(processingEnv);
  elements = processingEnv.getElementUtils();
  types = processingEnv.getTypeUtils();
  messager = processingEnv.getMessager();
  providedChecker = new ProvidedChecker(messager);
  declarationFactory = new AutoFactoryDeclaration.Factory(elements, messager);
  factoryDescriptorGenerator =
      new FactoryDescriptorGenerator(messager, types, declarationFactory);
}
 
Example 11
Source File: AnnotationParser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init(ProcessingEnvironment processingEnv) {
    super.init(processingEnv);
    this.processingEnv = processingEnv;
    errorListener = new ErrorReceiverImpl(
            processingEnv.getMessager(),
            processingEnv.getOptions().containsKey(Const.DEBUG_OPTION.getValue())
    );
}
 
Example 12
Source File: AnnotationParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init(ProcessingEnvironment processingEnv) {
    super.init(processingEnv);
    this.processingEnv = processingEnv;
    errorListener = new ErrorReceiverImpl(
            processingEnv.getMessager(),
            processingEnv.getOptions().containsKey(Const.DEBUG_OPTION.getValue())
    );
}
 
Example 13
Source File: AutoMatterProcessor.java    From auto-matter with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void init(final ProcessingEnvironment processingEnv) {
  super.init(processingEnv);
  filer = processingEnv.getFiler();
  elements = processingEnv.getElementUtils();
  types = processingEnv.getTypeUtils();
  this.messager = processingEnv.getMessager();
}
 
Example 14
Source File: RxEventBusProcessor.java    From RxEventBus with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized void init(ProcessingEnvironment processingEnvironment) {
    super.init(processingEnvironment);
    mMessager = processingEnvironment.getMessager();
}
 
Example 15
Source File: EntityAnnotationProcessor.java    From droitatedDB with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized void init(final ProcessingEnvironment processingEnv) {
	super.init(processingEnv);
	messager = processingEnv.getMessager();
	androidManifestAccess = new AndroidManifestAccess(processingEnv);
}
 
Example 16
Source File: LoadProc.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void init(ProcessingEnvironment pe) {
    super.init(pe);
    elements = pe.getElementUtils();
    messager = pe.getMessager();
}
 
Example 17
Source File: ValueParser.java    From dataenum with Apache License 2.0 4 votes vote down vote up
static Value parse(Element element, ProcessingEnvironment processingEnv) {
  Messager messager = processingEnv.getMessager();

  if (element.getKind() != ElementKind.METHOD) {
    messager.printMessage(
        Diagnostic.Kind.ERROR,
        String.format(
            "Value specs must be methods, found %s: %s",
            element.getKind().toString().toLowerCase(), element),
        element);
    return null;
  }

  ExecutableElement methodElement = (ExecutableElement) element;
  if (!isValueSpecMarker(methodElement.getReturnType(), processingEnv)) {
    messager.printMessage(
        Diagnostic.Kind.ERROR,
        String.format(
            "Value specs must return dataenum_case, found %s: %s",
            methodElement.getReturnType(), element),
        element);
    return null;
  }

  if (methodElement.getTypeParameters().size() != 0) {
    messager.printMessage(
        Diagnostic.Kind.ERROR,
        String.format(
            "Type parameters must be specified on the top-level interface, found: %s", element),
        element);
    return null;
  }

  if (methodElement.isVarArgs()) {
    messager.printMessage(
        Diagnostic.Kind.ERROR,
        String.format("Vararg parameters not permitted: %s", element),
        element);
    return null;
  }

  List<Parameter> parameters = new ArrayList<>();
  for (VariableElement parameterElement : methodElement.getParameters()) {
    String parameterName = parameterElement.getSimpleName().toString();
    TypeName parameterType = TypeName.get(parameterElement.asType());

    boolean nullable = isAnnotationPresent(parameterElement, ValueParser::isNullableAnnotation);
    boolean redacted = isAnnotationPresent(parameterElement, ValueParser::isRedactedAnnotation);
    Element parameterTypeElement =
        processingEnv.getTypeUtils().asElement(parameterElement.asType());
    boolean isEnum =
        parameterTypeElement != null && parameterTypeElement.getKind() == ElementKind.ENUM;

    parameters.add(new Parameter(parameterName, parameterType, nullable, redacted, isEnum));
  }

  String javadoc = processingEnv.getElementUtils().getDocComment(element);

  if (javadoc != null) {
    javadoc = javadoc.trim();
  }

  String valueSimpleName = methodElement.getSimpleName().toString();
  return new Value(
      valueSimpleName, javadoc, parameters, parseMethodAnnotations(methodElement, messager));
}
 
Example 18
Source File: ErrorReceiverImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public ErrorReceiverImpl(ProcessingEnvironment env) {
    this(env.getMessager());
}
 
Example 19
Source File: ParcelerModule.java    From parceler with Apache License 2.0 4 votes vote down vote up
@Provides
@Singleton
public Logger getLogger(ProcessingEnvironment processingEnvironment, @Named(DEBUG) boolean debug){
    return new MessagerLogger(getLogPreprend(), processingEnvironment.getMessager(), debug);
}
 
Example 20
Source File: ErrorReceiverImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public ErrorReceiverImpl(ProcessingEnvironment env) {
    this(env.getMessager());
}