Java Code Examples for javax.annotation.processing.RoundEnvironment#getElementsAnnotatedWith()

The following examples show how to use javax.annotation.processing.RoundEnvironment#getElementsAnnotatedWith() . 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: ProcessorSourceContext.java    From jackdaw with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private static ProcessorSourceContext calculate(
    final RoundEnvironment roundEnv, final TypeElement annotation
) throws Exception {
    final String annotationName = annotation.getQualifiedName().toString();
    final Class<? extends Annotation> annotationClass =
        ReflectionUtils.getClass(annotationName);

    final Set<? extends Element> allElements = roundEnv.getElementsAnnotatedWith(annotation);
    final Collection<? extends Element> filteredElement =
        TypeUtils.filterWithAnnotation(allElements, annotationClass);

    final Collection<TypeElement> typeElements = TypeUtils.foldToTypeElements(filteredElement);
    final Collection<TypeElement> filteredTypeElements =
        TypeUtils.filterWithoutAnnotation(typeElements, JIgnore.class);

    final CodeGenerator generator = SourceCodeGeneratorRegistry.find(annotationName);
    final List<Pair<TypeElement, String>> classes = Lists.newArrayList();

    for (final TypeElement element : filteredTypeElements) {
        final String className = getClassName(generator, element);
        classes.add(Pair.of(element, className));
    }

    return new ProcessorSourceContext(annotationName, classes);
}
 
Example 2
Source File: RetroJsoupProcessor.java    From RxRetroJsoup with Apache License 2.0 6 votes vote down vote up
protected void processAnnotations(RoundEnvironment env) {
    for (Element element : env.getElementsAnnotatedWith(Select.class)) {
        if (isChildOfInterface(element)) {
            processSelect(element.getEnclosingElement());
        }
    }

    final Set<Element> jsoupAnnotatedField = new HashSet<>();
    jsoupAnnotatedField.addAll(env.getElementsAnnotatedWith(JsoupHref.class));
    jsoupAnnotatedField.addAll(env.getElementsAnnotatedWith(JsoupText.class));
    jsoupAnnotatedField.addAll(env.getElementsAnnotatedWith(JsoupSrc.class));
    jsoupAnnotatedField.addAll(env.getElementsAnnotatedWith(JsoupAttr.class));

    final Set<Element> jsoupModels = new HashSet<>();
    for (Element field : jsoupAnnotatedField) {
        jsoupModels.add(field.getEnclosingElement());
    }

    processJsoupModels(jsoupModels);
}
 
Example 3
Source File: BugtrackingRegistrationProcessor.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
    for (Element e : roundEnv.getElementsAnnotatedWith(BugtrackingConnector.Registration.class)) {
        Registration r = e.getAnnotation(BugtrackingConnector.Registration.class);
        if (r == null) {
            continue;
        }
        File f = layer(e).instanceFile("Services/Bugtracking", null, r, null);                   // NOI18N
        f.methodvalue("instanceCreate", DelegatingConnector.class.getName(), "create");          // NOI18N
        f.stringvalue("instanceOf", BugtrackingConnector.class.getName());                       // NOI18N
        f.instanceAttribute("delegate", BugtrackingConnector.class);                             // NOI18N
        f.bundlevalue("displayName", r.displayName());                                           // NOI18N
        f.bundlevalue("tooltip", r.tooltip());                                                   // NOI18N
        f.stringvalue("id", r.id());                                                             // NOI18N
        f.boolvalue("providesRepositoryManagement", r.providesRepositoryManagement());                                             // NOI18N
        if (!r.iconPath().isEmpty()) {
            f.bundlevalue("iconPath", r.iconPath());                                             // NOI18N
        }
        f.write();
    }
    return true;
}
 
Example 4
Source File: LVTHarness.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations,
    RoundEnvironment roundEnv) {
    if (roundEnv.processingOver())
        return true;

    TypeElement aliveRangeAnno = elements.getTypeElement("AliveRanges");

    if (!annotations.contains(aliveRangeAnno)) {
        error("no @AliveRanges annotation found in test class");
    }

    for (Element elem: roundEnv.getElementsAnnotatedWith(aliveRangeAnno)) {
        Annotation annotation = elem.getAnnotation(AliveRanges.class);
        aliveRangeMap.put(new ElementKey(elem), (AliveRanges)annotation);
    }
    return true;
}
 
Example 5
Source File: EntityAnnotationProcessor.java    From droitatedDB with Apache License 2.0 6 votes vote down vote up
private String getHookName(final RoundEnvironment roundEnv, Class<? extends Annotation> hookAnnotation, Class<?> hookInterface) {
	Set<? extends Element> annotated = roundEnv.getElementsAnnotatedWith(hookAnnotation);
	if (annotated.size() == 0) {
		return null;
	}
	if (annotated.size() > 1) {
           messager.printMessage(Kind.ERROR,
                   "Only one " + hookAnnotation.getCanonicalName() + " hook is allowed with the project", annotated.iterator().next());
		return null;
	}
	Element updateElement = annotated.iterator().next();
	TypeElement typeElement = updateElement.accept(new TypeResolvingVisitor(), null);
	boolean implementsDbUpdate = false;
	for (TypeMirror typeMirror : typeElement.getInterfaces()) {
		if (typeMirror.toString().equals(hookInterface.getCanonicalName())) {
			implementsDbUpdate = true;
		}
	}
	if (!implementsDbUpdate) {
           messager.printMessage(Kind.ERROR,
                   "The " + hookAnnotation + " hook has to implement the " + hookInterface.getCanonicalName() + " interface", updateElement);
		return null;
	}
	return typeElement.getQualifiedName().toString();
}
 
Example 6
Source File: ProcessorLastRound.java    From takari-lifecycle with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
  for (Element element : roundEnv.getElementsAnnotatedWith(Annotation.class)) {
    TypeElement cls = (TypeElement) element;
    types.add(cls.getQualifiedName().toString());
  }

  if (roundEnv.processingOver()) {
    try {
      FileObject resource = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", "types.lst");
      BufferedWriter w = new BufferedWriter(resource.openWriter());
      try {
        for (String type : types) {
          w.append(type);
          w.newLine();
        }
      } finally {
        w.close();
      }
    } catch (IOException e) {
      processingEnv.getMessager().printMessage(Kind.ERROR, "Could not create output " + e.getMessage());
    }
  }

  return false; // not "claimed" so multiple processors can be tested
}
 
Example 7
Source File: OptionProcessor.java    From bazel with Apache License 2.0 6 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
  for (Element annotatedElement : roundEnv.getElementsAnnotatedWith(Option.class)) {
    try {
      // Only fields are annotated with Option, this should already be checked by the
      // @Target(ElementType.FIELD) annotation.
      VariableElement optionField = (VariableElement) annotatedElement;

      checkModifiers(optionField);
      checkInOptionBase(optionField);
      checkOptionName(optionField);
      checkOldCategoriesAreNotUsed(optionField);
      checkExpansionOptions(optionField);
      checkConverter(optionField);
      checkEffectTagRationality(optionField);
      checkMetadataTagAndCategoryRationality(optionField);
      checkNoDefaultValueForMultipleOption(optionField);
    } catch (OptionProcessorException e) {
      error(e.getElementInError(), e.getMessage());
    }
  }
  // Claim all Option annotated fields.
  return true;
}
 
Example 8
Source File: LVTHarness.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations,
    RoundEnvironment roundEnv) {
    if (roundEnv.processingOver())
        return true;

    TypeElement aliveRangeAnno = elements.getTypeElement("AliveRanges");

    if (!annotations.contains(aliveRangeAnno)) {
        error("no @AliveRanges annotation found in test class");
    }

    for (Element elem: roundEnv.getElementsAnnotatedWith(aliveRangeAnno)) {
        Annotation annotation = elem.getAnnotation(AliveRanges.class);
        aliveRangeMap.put(new ElementKey(elem), (AliveRanges)annotation);
    }
    return true;
}
 
Example 9
Source File: BuilderProcessor.java    From customview-samples with Apache License 2.0 6 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    for (Element element : roundEnv.getElementsAnnotatedWith(Builder.class)) {
        if (element.getKind() != ElementKind.CLASS) {
            onError("Builder annotation can only be applied to class", element);
            return false;
        }

        String packageName = elementUtils.getPackageOf(element).getQualifiedName().toString();
        String elementName = element.getSimpleName().toString();
        ClassName builderClassName = ClassName.get(packageName, String.format("%sBuilder", elementName));

        TypeSpec typeSpec = createTypeSpec(element, builderClassName, elementName);

        JavaFile javaFile = JavaFile.builder(packageName, typeSpec).build();
        try {
            javaFile.writeTo(filer);
        } catch (IOException e) {
            onError("Failed to write java file: " + e.getMessage(), element);
        }
    }
    return true;
}
 
Example 10
Source File: ModelChecker.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (roundEnv.processingOver())
        return true;

    Trees trees = Trees.instance(processingEnv);

    TypeElement testAnno = elements.getTypeElement("Check");
    for (Element elem: roundEnv.getElementsAnnotatedWith(testAnno)) {
        TreePath p = trees.getPath(elem);
        new MulticatchParamTester(trees).scan(p, null);
    }
    return true;
}
 
Example 11
Source File: MethodCompletionProviderProcessor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
    for (Element element : roundEnv.getElementsAnnotatedWith(MethodCompletionProvider.Registration.class)) {
        layer(element)
                .instanceFile(CompletionProviders.METHOD_COMPLETION_PROVIDER_PATH, null, MethodCompletionProvider.class)
                .intvalue("position", element.getAnnotation(MethodCompletionProvider.Registration.class).position()) //NOI18N
                .write();
    }
    return true;
}
 
Example 12
Source File: AttributeAnnotationValidator.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
public void processAttributes(final RoundEnvironment roundEnv,
                              String elementName,
                              final boolean allowedNamed,
                              final boolean allowAbstractManagedTypes)
{

    TypeElement annotationElement = elementUtils.getTypeElement(elementName);

    for (Element e : roundEnv.getElementsAnnotatedWith(annotationElement))
    {
        checkAnnotationIsOnMethodInInterface(annotationElement, e);

        ExecutableElement methodElement = (ExecutableElement) e;

        checkInterfaceExtendsConfiguredObject(annotationElement, methodElement);
        checkMethodTakesNoArgs(annotationElement, methodElement);
        checkMethodName(annotationElement, methodElement);
        checkMethodReturnType(annotationElement, methodElement, allowedNamed, allowAbstractManagedTypes);

        checkTypeAgreesWithName(annotationElement, methodElement);

        if(MANAGED_ATTRIBUTE_CLASS_NAME.equals(elementName))
        {
            checkValidValuesPatternOnAppropriateTypes(methodElement);
        }
    }
}
 
Example 13
Source File: PathRecognizerRegistrationProcessor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
    for(Element e : roundEnv.getElementsAnnotatedWith(PathRecognizerRegistration.class)) {
        TypeElement cls = (TypeElement) e;
        PathRecognizerRegistration prr = cls.getAnnotation(PathRecognizerRegistration.class);

        String sourcePathIds = processIds(prr.sourcePathIds());
        String libraryPathIds = processIds(prr.libraryPathIds());
        String binaryLibraryPathIds = processIds(prr.binaryLibraryPathIds());
        String mimeTypes = processMts(prr.mimeTypes());

        if (mimeTypes != null && (sourcePathIds != null || libraryPathIds != null || binaryLibraryPathIds != null)) {
            final LayerBuilder lb = layer(cls);
            File f = instanceFile(lb,
                    "Services/Hidden/PathRecognizers", //NOI18N
                    makeFilesystemName(cls.getQualifiedName().toString()),
                    DefaultPathRecognizer.class,
                    "createInstance", //NOI18N
                    PathRecognizer.class);

            if (sourcePathIds != null) {
                f.stringvalue("sourcePathIds", sourcePathIds); //NOI18N
            }
            if (libraryPathIds != null) {
                f.stringvalue("libraryPathIds", libraryPathIds); //NOI18N
            }
            if (binaryLibraryPathIds != null) {
                f.stringvalue("binaryLibraryPathIds", binaryLibraryPathIds); //NOI18N
            }
            if (mimeTypes != null) {
                f.stringvalue("mimeTypes", mimeTypes); //NOI18N
            }

            f.write();
        }
    }
    return true;
}
 
Example 14
Source File: EncodableProcessor.java    From firebase-android-sdk with Apache License 2.0 5 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
  for (Element element : roundEnvironment.getElementsAnnotatedWith(Encodable.class)) {
    processClass(element);
  }
  return false;
}
 
Example 15
Source File: AbstractCommandSpecProcessor.java    From picocli with Apache License 2.0 5 votes vote down vote up
private void buildSpecs(RoundEnvironment roundEnv, Context context) {
    logger.fine("Building specs...");
    Set<? extends Element> explicitSpecs = roundEnv.getElementsAnnotatedWith(Spec.class);
    for (Element element : explicitSpecs) {
        buildSpec(element, context);
    }
}
 
Example 16
Source File: ArrayTypeToString.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
    for (TypeElement te : tes) {
        for (Element e : renv.getElementsAnnotatedWith(te)) {
            String s = ((VarSymbol) e).type.toString();

            // Normalize output by removing whitespace
            s = s.replaceAll("\\s", "");

            // Expected: "@Foo(0)java.lang.String@Foo(3)[]@Foo(2)[]@Foo(1)[]"
            processingEnv.getMessager().printMessage(Kind.NOTE, s);
        }
    }
    return true;
}
 
Example 17
Source File: HTMLViewProcessor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
    protected boolean handleProcess(Set<? extends TypeElement> set, RoundEnvironment re) throws LayerGenerationException {
        for (Element e : re.getElementsAnnotatedWith(OpenHTMLRegistration.class)) {
            OpenHTMLRegistration reg = e.getAnnotation(OpenHTMLRegistration.class);
            if (reg == null || e.getKind() != ElementKind.METHOD) {
                continue;
            }
            if (!e.getModifiers().contains(Modifier.STATIC)) {
                error("Method annotated by @OpenHTMLRegistration needs to be static", e);
            }
            if (!e.getModifiers().contains(Modifier.PUBLIC)) {
                error("Method annotated by @OpenHTMLRegistration needs to be public", e);
            }
            if (!((ExecutableElement)e).getParameters().isEmpty()) {
                error("Method annotated by @OpenHTMLRegistration should have no arguments", e);
            }
            if (!e.getEnclosingElement().getModifiers().contains(Modifier.PUBLIC)) {
                error("Method annotated by @OpenHTMLRegistration needs to be public in a public class", e);
            }
            
            ActionID aid = e.getAnnotation(ActionID.class);
            if (aid != null) {
                final LayerBuilder builder = layer(e);
                LayerBuilder.File actionFile = builder.
                        file("Actions/" + aid.category() + "/" + aid.id().replace('.', '-') + ".instance").
                        methodvalue("instanceCreate", "org.netbeans.modules.htmlui.Pages", "openAction");
                String abs = LayerBuilder.absolutizeResource(e, reg.url());
                try {
                    builder.validateResource(abs, e, reg, null, true);
                } catch (LayerGenerationException ex) {
                    if (System.getProperty("netbeans.home") != null) {
                        processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, "Cannot find resource " + abs, e);
                    } else {
                        throw ex;
                    }
                }
                actionFile.stringvalue("url", abs);
                if (!reg.iconBase().isEmpty()) {
                    actionFile.stringvalue("iconBase", reg.iconBase());
                }
                actionFile.stringvalue("method", e.getSimpleName().toString());
                actionFile.stringvalue("class", e.getEnclosingElement().asType().toString());
                String[] techIds = reg.techIds();
                for (int i = 0; i < techIds.length; i++) {
                    actionFile.stringvalue("techId." + i, techIds[i]);
                }
//                actionFile.instanceAttribute("component", TopComponent.class, reg, null);
//                if (reg.preferredID().length() > 0) {
//                    actionFile.stringvalue("preferredID", reg.preferredID());
//                }
                actionFile.bundlevalue("displayName", reg.displayName(), reg, "displayName");
                actionFile.write();
            } else {
                error("@OpenHTMLRegistration needs to be accompanied with @ActionID annotation", e);
            }
            
        }
        return true;
    }
 
Example 18
Source File: ModuleServiceProcessor.java    From FriendCircle with GNU General Public License v3.0 4 votes vote down vote up
private void scanClass(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
    //scan for service impl
    Set<? extends Element> elements = roundEnvironment.getElementsAnnotatedWith(ServiceImpl.class);

    for (Element element : elements) {
        //only get annotation for class type
        if (!(element instanceof TypeElement)) continue;

        if (element.getKind() != ElementKind.CLASS) {
            loge(TAG + " @ServiceImpl is only for class");
            continue;
        }

        if (!element.getModifiers().contains(Modifier.PUBLIC)) {
            loge(TAG + " @ServiceImpl is only for public class");
            continue;
        }

        TypeElement typeElement = (TypeElement) element;
        TypeMirror mirror = typeElement.asType();
        if (!(mirror.getKind() == TypeKind.DECLARED)) {
            continue;
        }

        // check interface
        List<? extends TypeMirror> superClassElement = mTypesUtil.directSupertypes(mirror);
        if (superClassElement == null || superClassElement.size() <= 0) continue;

        TypeMirror serviceInterfaceElement = null;
        for (TypeMirror typeMirror : superClassElement) {
            if (typeMirror.toString().startsWith(PACKAGE_NAME)) {
                serviceInterfaceElement = typeMirror;
                break;
            }
        }

        if (serviceInterfaceElement == null) {
            continue;
        }

        //get impl class full name
        TypeName classType = ClassName.get(serviceInterfaceElement);
        List<InnerAptInfo> aptInfos = null;
        if (mServiceImplMap.containsKey(classType)) {
            aptInfos = mServiceImplMap.get(classType);
        }
        if (aptInfos == null) {
            aptInfos = new ArrayList<>();
            mServiceImplMap.put(classType, aptInfos);
        }

        int tag = element.getAnnotation(ServiceImpl.class).value();

        InnerAptInfo innerAptInfo = new InnerAptInfo(typeElement, typeElement.getQualifiedName().toString(), tag);
        aptInfos.add(innerAptInfo);

    }

}
 
Example 19
Source File: StoreProcessor.java    From Iron with Apache License 2.0 4 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    for (TypeElement te : annotations) {
        for (Element element : roundEnv.getElementsAnnotatedWith(te)) {
            TypeElement classElement = (TypeElement) element;
            PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();

            //String classComment = processingEnv.getElementUtils().getDocComment(classElement);

            List<StoreEntry> prefList = new ArrayList<StoreEntry>();
            // Iterate over the fields of the class
            for (VariableElement variableElement : ElementFilter.fieldsIn(classElement.getEnclosedElements())) {
                if (variableElement.getModifiers().contains(Modifier.STATIC)) {
                    // Ignore constants
                    continue;
                }

                TypeMirror fieldType = variableElement.asType();

                String fieldDefaultValue = getDefaultValue(variableElement, fieldType);
                /*if (fieldDefaultValue == null) {
                    // Problem detected: halt
                    return true;
                }*/

                String fieldName = variableElement.getSimpleName().toString();

                boolean transaction = false;
                boolean async = false;
                boolean listener = false;
                boolean loader = false;

                Name fieldNameAnnot = variableElement.getAnnotation(Name.class);
                String keyName = getKeyName(fieldName, fieldNameAnnot);
                if(fieldNameAnnot != null) {
                    transaction = fieldNameAnnot.transaction();
                    listener = fieldNameAnnot.listener();
                    loader = fieldNameAnnot.loader();
                    async = fieldNameAnnot.async();
                }
                prefList.add(new StoreEntry(fieldName, keyName, fieldType.toString(), transaction,
                        listener, loader, async, fieldDefaultValue));
            }

            Map<String, Object> args = new HashMap<>();


            JavaFileObject javaFileObject;
            try {
                Store fieldStoreAnnot = element.getAnnotation(Store.class);
                // StoreWrapper
                javaFileObject = processingEnv.getFiler().createSourceFile(classElement.getQualifiedName() + SUFFIX_PREF_WRAPPER);
                Template template = getFreemarkerConfiguration().getTemplate("storewrapper.ftl");
                args.put("package", fieldStoreAnnot.value().length() > 0 ? fieldStoreAnnot.value() : packageElement.getQualifiedName());
                args.put("keyWrapperClassName", classElement.getSimpleName() + SUFFIX_PREF_WRAPPER);
                args.put("keyList", prefList);
                Writer writer = javaFileObject.openWriter();
                template.process(args, writer);
                IOUtils.closeQuietly(writer);

            } catch (Exception e) {
                processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR,
                        "En error occurred while generating Prefs code " + e.getClass() + e.getMessage(), element);
                e.printStackTrace();
                // Problem detected: halt
                return true;
            }
        }
    }
    return true;
}
 
Example 20
Source File: OnActivityResultProcessor.java    From OnActivityResult with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("PMD.CyclomaticComplexity") private void processAnnotatedExtraParameters(final RoundEnvironment environment, final AnnotatedMethodParameters annotatedParameters) {
    final Class<? extends Annotation> annotation = Extra.class;
    final Set<? extends Element> parameters = environment.getElementsAnnotatedWith(annotation);

    for (final Element parameter : parameters) {
        try {
            final ExecutableElement method = (ExecutableElement) parameter.getEnclosingElement();

            if (!Utils.isParameter(parameter)) {
                throw new OnActivityResultProcessingException(method, "@%s annotation must be on a method parameter", annotation.getSimpleName());
            }

            boolean didFindMatch = false;
            final AnnotatedParameter[] supportedAnnotatedParameters = AnnotatedParameter.values();

            final TypeMirror parameterTypeMirror = parameter.asType();
            final TypeName parameterType = TypeVariableName.get(parameterTypeMirror);

            for (final AnnotatedParameter annotatedParameter : supportedAnnotatedParameters) {
                if (annotatedParameter.type.equals(parameterType)) {
                    annotatedParameters.put(method, (VariableElement) parameter, annotatedParameter.createParameter(parameter));
                    didFindMatch = true;
                    break;
                }
            }

            if (!didFindMatch) {
                final boolean isImplementingParcelable = typeUtils.isAssignable(parameterTypeMirror, elementUtils.getTypeElement(AnnotatedParameter.PARCELABLE.type.toString()).asType());
                final boolean isImplementingSerializable = typeUtils.isAssignable(parameterTypeMirror, elementUtils.getTypeElement(AnnotatedParameter.SERIALIZABLE.type.toString()).asType());

                if (isImplementingParcelable) {
                    annotatedParameters.put(method, (VariableElement) parameter, AnnotatedParameter.PARCELABLE.createParameter(parameter));
                    didFindMatch = true;
                } else if (isImplementingSerializable) {
                    annotatedParameters.put(method, (VariableElement) parameter, AnnotatedParameter.SERIALIZABLE.createParameter(parameter));
                    didFindMatch = true;
                }
            }

            if (!didFindMatch) {
                throw new OnActivityResultProcessingException(method, "@%s parameter does not support type %s", annotation.getSimpleName(), parameterTypeMirror.toString());
            }
        } catch (final OnActivityResultProcessingException e) {
            e.printError(processingEnv);
        }
    }
}