javax.lang.model.element.VariableElement Java Examples
The following examples show how to use
javax.lang.model.element.VariableElement.
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: ElementUtilities.java From netbeans with Apache License 2.0 | 6 votes |
private boolean isHidden(Element member, List<? extends Element> members, Elements elements, Types types) { for (ListIterator<? extends Element> it = members.listIterator(); it.hasNext();) { Element hider = it.next(); if (hider == member) return true; if (hider.getSimpleName().contentEquals(member.getSimpleName())) { if (elements.hides(member, hider)) { it.remove(); } else { if (member instanceof VariableElement && hider instanceof VariableElement && (!member.getKind().isField() || hider.getKind().isField())) return true; TypeMirror memberType = member.asType(); TypeMirror hiderType = hider.asType(); if (memberType.getKind() == TypeKind.EXECUTABLE && hiderType.getKind() == TypeKind.EXECUTABLE) { if (types.isSubsignature((ExecutableType)hiderType, (ExecutableType)memberType)) return true; } else { return false; } } } } return false; }
Example #2
Source File: NPECheck.java From netbeans with Apache License 2.0 | 6 votes |
/** * Records continuation to the exception handler if a throwable is raised. * Optimization: the resumeOnExceptionHandler must contain an entry for the * throwable and/or its superclass. If not, then no enclosing catch handler * is interested in the Throwable and no state snapshot is necessary. * * @param thrown thrown exception type */ private void recordResumeOnExceptionHandler(TypeMirror thrown, Map<VariableElement, State> variable2State) { TypeMirror curT = thrown; do { if (curT == null || curT.getKind() != TypeKind.DECLARED) return; DeclaredType dtt = (DeclaredType)curT; // hack; getSuperclass may provide different type instance for the same element. thrown = dtt.asElement().asType(); Map<VariableElement, State> r = resumeOnExceptionHandler.get(thrown); if (r != null) { mergeInto(r, variable2State); break; } TypeElement tel = (TypeElement)dtt.asElement(); if (tel == throwableEl) { break; } curT = tel.getSuperclass(); } while (curT != null); }
Example #3
Source File: NPECheck.java From netbeans with Apache License 2.0 | 6 votes |
@Override public State visitInstanceOf(InstanceOfTree node, Void p) { super.visitInstanceOf(node, p); Element e = info.getTrees().getElement(new TreePath(getCurrentPath(), node.getExpression())); if (isVariableElement(e)) { boolean setState = false; State currentState = variable2State.get((VariableElement) e); if (currentState == null) { setState = !getStateFromAnnotations(info, e).isNotNull(); } else { setState = !variable2State.get((VariableElement) e).isNotNull(); } if (setState) { variable2State.put((VariableElement) e, not ? State.INSTANCE_OF_FALSE : State.INSTANCE_OF_TRUE); } } return null; }
Example #4
Source File: GraphBuilder.java From j2objc with Apache License 2.0 | 6 votes |
private void followFields(DeclaredType type, TypeNode node) { TypeElement element = (TypeElement) type.asElement(); for (VariableElement field : ElementUtil.getDeclaredFields(element)) { TypeMirror fieldType = getElementType(typeUtil.asMemberOf(type, field)); TypeNode target = getOrCreateNode(fieldType); String fieldName = ElementUtil.getName(field); if (target != null && !whitelist.containsField(node, fieldName) && !whitelist.containsType(target) && !ElementUtil.isStatic(field) // Exclude self-referential fields. (likely linked DS or delegate pattern) && !typeUtil.isAssignable(type, fieldType) && !isWeakReference(field) && !isRetainedWithField(field)) { addEdge(Edge.newFieldEdge(node, target, fieldName)); } } }
Example #5
Source File: GeneratedClassMapperProcessor.java From pandroid with Apache License 2.0 | 6 votes |
private void extractInjectMethod(TypeElement typeElement) { ComponentBlock currentBlock = new ComponentBlock(typeElement.asType()); for (Element content : typeElement.getEnclosedElements()) { if (content.getKind().equals(ElementKind.METHOD) && content.getSimpleName().toString().startsWith("inject")) { ExecutableElement method = (ExecutableElement) content; if (method.getParameters().size() == 1) { VariableElement variableElement = method.getParameters().get(0); TypeMirror paramType = mTypesUtils.erasure(variableElement.asType()); currentBlock.injects.add(new InjectBlock(paramType)); } } } if (!currentBlock.injects.isEmpty()) componentBlocks.add(currentBlock); }
Example #6
Source File: InjectionPointParameterAnalyzer.java From netbeans with Apache License 2.0 | 6 votes |
private void checkName( ExecutableElement element, VariableElement var, WebBeansModel model, Result result) { AnnotationMirror annotation = AnnotationUtil.getAnnotationMirror( var , AnnotationUtil.NAMED, model.getCompilationController()); if ( annotation!= null){ result.addNotification( Severity.WARNING , var, element , model, NbBundle.getMessage(InjectionPointAnalyzer.class, "WARN_NamedInjectionPoint")); // NOI18N if ( annotation.getElementValues().size() == 0 ){ result.addError(var, element, model, NbBundle.getMessage( InjectionPointParameterAnalyzer.class, "ERR_ParameterNamedInjectionPoint")); // NOI18N } } }
Example #7
Source File: _RetoucheUtil.java From netbeans with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") public static ElementHandle<VariableElement> getFieldHandle(JavaSource javaSource, final String className, final String fieldType, final String fieldName) throws IOException { final ElementHandle[] result = new ElementHandle[1]; javaSource.runUserActionTask(new Task<CompilationController>() { @Override public void run(CompilationController controller) throws IOException { controller.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED); TypeElement typeElement = controller.getElements().getTypeElement(className); for (VariableElement variable : ElementFilter.fieldsIn(typeElement.getEnclosedElements())) { if (variable.getSimpleName().contentEquals(fieldName) && fieldType.equals(getTypeName(controller, variable.asType()))) { result[0] = ElementHandle.create(variable); return; } } } }, true); return result[0]; }
Example #8
Source File: TypeModeler.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public static TypeMirror getHolderValueType(TypeMirror type, TypeElement defHolder, ProcessingEnvironment env) { TypeElement typeElement = getDeclaration(type); if (typeElement == null) return null; if (isSubElement(typeElement, defHolder)) { if (type.getKind().equals(TypeKind.DECLARED)) { Collection<? extends TypeMirror> argTypes = ((DeclaredType) type).getTypeArguments(); if (argTypes.size() == 1) { return argTypes.iterator().next(); } else if (argTypes.isEmpty()) { VariableElement member = getValueMember(typeElement); if (member != null) { return member.asType(); } } } } return null; }
Example #9
Source File: IdxPropertyPattern.java From netbeans with Apache License 2.0 | 6 votes |
public IdxPropertyPattern(PatternAnalyser analyser, ExecutableElement getterMethod, ExecutableElement setterMethod, ExecutableElement indexedGetterMethod, ExecutableElement indexedSetterMethod, VariableElement estimatedField, TypeMirror type, TypeMirror indexedType, String name) throws IntrospectionException { super( analyser, getterMethod, setterMethod, estimatedField, type, name ); this.indexedGetterMethod = indexedGetterMethod == null ? null : ElementHandle.create(indexedGetterMethod); this.indexedSetterMethod = indexedSetterMethod == null ? null : ElementHandle.create(indexedSetterMethod); this.indexedType = TypeMirrorHandle.create(indexedType); this.indexedTypeName = typeAsString(indexedType); }
Example #10
Source File: InjectFieldValidator.java From dagger2-sample with Apache License 2.0 | 6 votes |
@Override public ValidationReport<VariableElement> validate(VariableElement fieldElement) { ValidationReport.Builder<VariableElement> builder = ValidationReport.Builder.about(fieldElement); Set<Modifier> modifiers = fieldElement.getModifiers(); if (modifiers.contains(FINAL)) { builder.addItem(FINAL_INJECT_FIELD, fieldElement); } if (modifiers.contains(PRIVATE)) { builder.addItem(PRIVATE_INJECT_FIELD, fieldElement); } ImmutableSet<? extends AnnotationMirror> qualifiers = getQualifiers(fieldElement); if (qualifiers.size() > 1) { for (AnnotationMirror qualifier : qualifiers) { builder.addItem(MULTIPLE_QUALIFIERS, fieldElement, qualifier); } } return builder.build(); }
Example #11
Source File: TypeImplementationGenerator.java From j2objc with Apache License 2.0 | 6 votes |
private String getJniFunctionSignature(FunctionDeclaration function) { StringBuilder sb = new StringBuilder(); sb.append(nameTable.getJniType(function.getReturnType().getTypeMirror())); sb.append(' '); sb.append(function.getJniSignature()).append('('); sb.append("JNIEnv *_env_"); if (Modifier.isStatic(function.getModifiers())) { sb.append(", jclass _cls_"); } if (!function.getParameters().isEmpty()) { sb.append(", "); } for (Iterator<SingleVariableDeclaration> iter = function.getParameters().iterator(); iter.hasNext(); ) { VariableElement var = iter.next().getVariableElement(); String paramType = nameTable.getJniType(var.asType()); sb.append(paramType + ' ' + nameTable.getVariableBaseName(var)); if (iter.hasNext()) { sb.append(", "); } } sb.append(')'); return sb.toString(); }
Example #12
Source File: ElementNode.java From netbeans with Apache License 2.0 | 5 votes |
private static String createHtmlHeader(boolean deprecated, ExecutableElement e) { StringBuilder sb = new StringBuilder(); sb.append("<html>"); if (deprecated) sb.append("<s>"); if (e.getKind() == ElementKind.CONSTRUCTOR) { sb.append(e.getEnclosingElement().getSimpleName()); } else { sb.append(e.getSimpleName()); } if (deprecated) sb.append("</s>"); sb.append("("); // NOI18N for(Iterator<? extends VariableElement> it = e.getParameters().iterator(); it.hasNext(); ) { VariableElement param = it.next(); if (!it.hasNext() && e.isVarArgs() && param.asType().getKind() == TypeKind.ARRAY) { sb.append(translateToHTML(print(((ArrayType) param.asType()).getComponentType()))); sb.append("..."); } else { sb.append(translateToHTML(print(param.asType()))); } sb.append(" "); // NOI18N sb.append(param.getSimpleName()); if (it.hasNext()) { sb.append(", "); // NOI18N } } sb.append(")"); // NOI18N if ( e.getKind() != ElementKind.CONSTRUCTOR ) { TypeMirror rt = e.getReturnType(); if ( rt.getKind() != TypeKind.VOID ) { sb.append(" : "); // NOI18N sb.append(translateToHTML(print(e.getReturnType()))); } } return sb.toString(); }
Example #13
Source File: JNIWriter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
String signature(ExecutableElement e) { StringBuilder sb = new StringBuilder("("); String sep = ""; for (VariableElement p: e.getParameters()) { sb.append(sep); sb.append(types.erasure(p.asType()).toString()); sep = ","; } sb.append(")"); return sb.toString(); }
Example #14
Source File: AnnotationsAnalyzer.java From netbeans with Apache License 2.0 | 5 votes |
private void checkMethods( TypeElement element, boolean isDecorator, CdiAnalysisResult result ) { CompilationInfo compInfo = result.getInfo(); List<ExecutableElement> methods = ElementFilter.methodsIn( element.getEnclosedElements()); for (ExecutableElement method : methods) { boolean isProducer = AnnotationUtil.hasAnnotation(method, AnnotationUtil.PRODUCES_FQN, compInfo); boolean isDisposer = false; boolean isObserver = false; List<? extends VariableElement> parameters = method.getParameters(); for (VariableElement param : parameters) { if ( AnnotationUtil.hasAnnotation( param , AnnotationUtil.DISPOSES_FQN, compInfo)) { isDisposer = true; break; } if ( AnnotationUtil.hasAnnotation( param , AnnotationUtil.OBSERVES_FQN, compInfo)) { isObserver = true; break; } } if ( isProducer || isDisposer || isObserver ){ result.addError( element, NbBundle.getMessage( AnnotationsAnalyzer.class, getMethodErrorKey(isDecorator, isProducer, isDisposer) , method.getSimpleName().toString())); break; } } }
Example #15
Source File: Utils.java From paperparcel with Apache License 2.0 | 5 votes |
/** If {@code type} has a {@code Parcelable.Creator} field instance, return it. */ @Nullable static VariableElement findCreator(Elements elements, Types types, TypeMirror type) { if (type.getKind() != TypeKind.DECLARED) { return null; } DeclaredType declaredType = (DeclaredType) type; TypeElement typeElement = (TypeElement) declaredType.asElement(); return findCreator(elements, types, typeElement); }
Example #16
Source File: OptionProcessor.java From bazel with Apache License 2.0 | 5 votes |
/** * Check that the option lists at least one effect, and that no nonsensical combinations are * listed, such as having a known effect listed with UNKNOWN. */ private void checkEffectTagRationality(VariableElement optionField) throws OptionProcessorException { Option annotation = optionField.getAnnotation(Option.class); OptionEffectTag[] effectTags = annotation.effectTags(); // Check that there is at least one OptionEffectTag listed. if (effectTags.length < 1) { throw new OptionProcessorException( optionField, "Option does not list at least one OptionEffectTag. If the option has no effect, " + "please be explicit and add NO_OP. Otherwise, add a tag representing its effect."); } else if (effectTags.length > 1) { // If there are more than 1 tag, make sure that NO_OP and UNKNOWN is not one of them. // These don't make sense if other effects are listed. ImmutableList<OptionEffectTag> tags = ImmutableList.copyOf(effectTags); if (tags.contains(OptionEffectTag.UNKNOWN)) { throw new OptionProcessorException( optionField, "Option includes UNKNOWN with other, known, effects. Please remove UNKNOWN from " + "the list."); } if (tags.contains(OptionEffectTag.NO_OP)) { throw new OptionProcessorException( optionField, "Option includes NO_OP with other effects. This doesn't make much sense. Please " + "remove NO_OP or the actual effects from the list, whichever is correct."); } } }
Example #17
Source File: ProcessUtils.java From Freezer with Apache License 2.0 | 5 votes |
public static Element getIdField(Element element) { for (VariableElement e : getFields(element)) { if (isIdField(e)) { return e; } } return null; }
Example #18
Source File: HtmlSerialFieldWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Add the description text for this member. * * @param field the field to document. * @param contentTree the tree to which the deprecated info will be added */ public void addMemberDescription(VariableElement field, Content contentTree) { if (!utils.getFullBody(field).isEmpty()) { writer.addInlineComment(field, contentTree); } List<? extends DocTree> tags = utils.getBlockTags(field, DocTree.Kind.SERIAL); if (!tags.isEmpty()) { writer.addInlineComment(field, tags.get(0), contentTree); } }
Example #19
Source File: ViewModelSpecFieldPlugin.java From squidb with Apache License 2.0 | 5 votes |
@Override protected PropertyGenerator getPropertyGenerator(VariableElement field, DeclaredTypeName fieldType) { Alias alias = field.getAnnotation(Alias.class); if (alias != null) { SqlUtils.checkIdentifier(alias.value().trim(), "view column name", modelSpec, field, utils); } return super.getPropertyGenerator(field, fieldType); }
Example #20
Source File: SerializedFormBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Build the serial UID information for the given class. * * @param node the XML element that specifies which components to document * @param classTree content tree to which the serial UID information will be added */ public void buildSerialUIDInfo(XMLNode node, Content classTree) { Content serialUidTree = writer.getSerialUIDInfoHeader(); for (Element e : utils.getFieldsUnfiltered(currentTypeElement)) { VariableElement field = (VariableElement)e; if (field.getSimpleName().toString().compareTo(SERIAL_VERSION_UID) == 0 && field.getConstantValue() != null) { writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER, utils.constantValueExpresion(field), serialUidTree); break; } } classTree.addContent(serialUidTree); }
Example #21
Source File: AutoReducerProcessingStep.java From reductor with Apache License 2.0 | 5 votes |
private void emitActionCreator(StringReducerElement reducerElement, String packageName) throws IOException { TypeSpec.Builder actionCreatorBuilder = TypeSpec.interfaceBuilder(reducerElement.getSimpleName() + "Actions") .addModifiers(Modifier.PUBLIC) .addAnnotation(ActionCreator.class); boolean hasActions = false; for (ReduceAction action : reducerElement.actions) { if (!action.generateActionCreator) continue; hasActions = true; final List<VariableElement> args = action.args; String fieldName = action.action.replaceAll(" +", "_").toUpperCase(); actionCreatorBuilder.addField(FieldSpec.builder(String.class, fieldName) .addModifiers(Modifier.FINAL, Modifier.STATIC, Modifier.PUBLIC) .initializer("\"$L\"", action.action) .build()); MethodSpec.Builder actionCreatorMethodBuilder = MethodSpec.methodBuilder(action.getMethodName()) .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT) .addAnnotation(AnnotationSpec.builder(ActionCreator.Action.class) .addMember("value", "$N", fieldName) .build()) .returns(Action.class); if (!args.isEmpty()) { for (VariableElement arg : args) { actionCreatorMethodBuilder.addParameter(TypeName.get(arg.asType()), arg.getSimpleName().toString()); } } actionCreatorBuilder.addMethod(actionCreatorMethodBuilder.build()); } if (hasActions) { JavaFile.builder(packageName, actionCreatorBuilder.build()) .skipJavaLangImports(true) .addFileComment(createGeneratedFileComment()) .build() .writeTo(env.getFiler()); } }
Example #22
Source File: SrcFinder.java From netbeans with Apache License 2.0 | 5 votes |
private static boolean compareTypes(CompilationController ctrl, List<TypeMirror> types, List<? extends VariableElement> params) { if (types.size() != params.size()) { return false; } Iterator<? extends VariableElement> itParams = params.iterator(); Iterator<TypeMirror> itTypes = types.iterator(); while (itParams.hasNext()) { VariableElement varEl = itParams.next(); TypeMirror paramType = varEl.asType(); TypeMirror type = itTypes.next(); // check types are the same kind if (type.getKind() != paramType.getKind()) { return false; } // check elements since javadoc ignores generics if (type.getKind() == TypeKind.DECLARED) { Element paramElm = ((DeclaredType) paramType).asElement(); Element typeElm = ((DeclaredType) type).asElement(); if (paramElm != typeElm) { return false; } } else if (!ctrl.getTypes().isSameType(type, paramType)) { // arrays, primitives return false; } } return true; }
Example #23
Source File: RetroWeiboProcessor.java From SimpleWeibo with Apache License 2.0 | 5 votes |
public List<String> buildQueryMaps(ExecutableElement method) { List<String> queryMaps = new ArrayList<String>(); List<? extends VariableElement> parameters = method.getParameters(); for (VariableElement parameter : parameters) { retroweibo.RetroWeibo.QueryMap queryMap = parameter .getAnnotation(retroweibo.RetroWeibo.QueryMap.class); if (queryMap == null) { continue; } queryMaps.add(parameter.getSimpleName().toString()); } return queryMaps; }
Example #24
Source File: NilCheckResolver.java From j2objc with Apache License 2.0 | 5 votes |
private void addSafeVars(Set<VariableElement> vars) { if (scope != null && vars != null) { for (VariableElement var : vars) { scope.vars.put(var, true); } } }
Example #25
Source File: WebServiceVisitor.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected boolean isValidOneWayMethod(ExecutableElement method, TypeElement typeElement) { boolean valid = true; if (!(method.getReturnType().accept(NO_TYPE_VISITOR, null))) { // this is an error, cannot be OneWay and have a return type builder.processError(WebserviceapMessages.WEBSERVICEAP_ONEWAY_OPERATION_CANNOT_HAVE_RETURN_TYPE(typeElement.getQualifiedName(), method.toString()), method); valid = false; } VariableElement outParam = getOutParameter(method); if (outParam != null) { builder.processError(WebserviceapMessages.WEBSERVICEAP_ONEWAY_AND_OUT(typeElement.getQualifiedName(), method.toString()), outParam); valid = false; } if (!isDocLitWrapped() && soapStyle.equals(SOAPStyle.DOCUMENT)) { int inCnt = getModeParameterCount(method, WebParam.Mode.IN); if (inCnt != 1) { builder.processError(WebserviceapMessages.WEBSERVICEAP_ONEWAY_AND_NOT_ONE_IN(typeElement.getQualifiedName(), method.toString()), method); valid = false; } } for (TypeMirror thrownType : method.getThrownTypes()) { TypeElement thrownElement = (TypeElement) ((DeclaredType) thrownType).asElement(); if (builder.isServiceException(thrownType)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_ONEWAY_OPERATION_CANNOT_DECLARE_EXCEPTIONS( typeElement.getQualifiedName(), method.toString(), thrownElement.getQualifiedName()), method); valid = false; } } return valid; }
Example #26
Source File: JavaCompilerImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public J2SJAXBModel bind( Collection<Reference> rootClasses, Map<QName,Reference> additionalElementDecls, String defaultNamespaceRemap, ProcessingEnvironment env) { ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder = new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>( InlineAnnotationReaderImpl.theInstance, new ApNavigator(env), Collections.<TypeElement, TypeElement>emptyMap(), defaultNamespaceRemap ); builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager())); for ( Reference ref : rootClasses ) { TypeMirror t = ref.type; XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class); XmlList xl = ref.annotations.getAnnotation(XmlList.class); builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl)); } TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link(); if(r==null) return null; if(additionalElementDecls==null) additionalElementDecls = Collections.emptyMap(); else { // fool proof check for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) { if(e.getKey()==null) throw new IllegalArgumentException("nulls in additionalElementDecls"); } } return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls)); }
Example #27
Source File: ColumnElement.java From Ollie with Apache License 2.0 | 5 votes |
public ColumnElement(Registry registry, TypeElement enclosingType, VariableElement element) { this.element = element; this.column = element.getAnnotation(Column.class); this.enclosingType = enclosingType; this.deserializedType = registry.getElements().getTypeElement(element.asType().toString()); final TypeAdapterElement typeAdapterElement = registry.getTypeAdapterElement(deserializedType); final TypeElement modelElement = registry.getElements().getTypeElement("ollie.Model"); final DeclaredType modelType = registry.getTypes().getDeclaredType(modelElement); isModel = registry.getTypes().isAssignable(element.asType(), modelType); if (isModel) { final Table table = deserializedType.getAnnotation(Table.class); serializedType = registry.getElements().getTypeElement(Long.class.getName()); modelTableName = table.value(); } else if (typeAdapterElement != null) { serializedType = typeAdapterElement.getSerializedType(); } else { serializedType = deserializedType; } this.sqlType = SQL_TYPE_MAP.get(getSerializedQualifiedName()); List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors(); for (AnnotationMirror annotationMirror : annotationMirrors) { try { Class annotationClass = Class.forName(annotationMirror.getAnnotationType().toString()); annotations.put(annotationClass, element.getAnnotation(annotationClass)); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }
Example #28
Source File: InjectionPointParameterAnalyzer.java From netbeans with Apache License 2.0 | 5 votes |
private TypeMirror getParameterType( VariableElement var, ExecutableElement element, TypeElement parent , CompilationController controller ) { ExecutableType method = (ExecutableType)controller.getTypes().asMemberOf( (DeclaredType)parent.asType(), element); List<? extends TypeMirror> parameterTypes = method.getParameterTypes(); List<? extends VariableElement> parameters = element.getParameters(); int paramIndex = parameters.indexOf(var); return parameterTypes.get(paramIndex); }
Example #29
Source File: VisibleMemberMap.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void addToPropertiesMap(ExecutableElement setter, ExecutableElement getter, ExecutableElement propertyMethod, VariableElement field) { if (field == null || utils.getDocCommentTree(field) == null) { addToPropertiesMap(setter, propertyMethod); addToPropertiesMap(getter, propertyMethod); addToPropertiesMap(propertyMethod, propertyMethod); } else { addToPropertiesMap(getter, field); addToPropertiesMap(setter, field); addToPropertiesMap(propertyMethod, field); } }
Example #30
Source File: ColumnElementResolvingTypeVisitor.java From droitatedDB with Apache License 2.0 | 5 votes |
@Override public VariableElement visitVariable(final VariableElement e, final Void p) { if (e.getAnnotation(Column.class) != null) { return e; } else { return null; } }