Package javax.lang.model.type

Examples of javax.lang.model.type.TypeVariable.asElement()


        assert type != null;
        if (type.getKind() != TypeKind.TYPEVAR) {
            return false;
        }
        TypeVariable var = (TypeVariable) type;
        TypeParameterElement parameter = (TypeParameterElement) var.asElement();
        if (hasKindMatched(environment, parameter) == false) {
            return false;
        }
        Element parent = parameter.getEnclosingElement();
        // MEMO Eclipse JDT returns null for "TypeParameterElement.enclosingElement."
View Full Code Here


            if (fbound) {
                DeclaredType type = (DeclaredType)tpe.getBounds().get(0);
                if (type.asElement() != element)
                    throw error("%s != %s", type.asElement(), element);
                TypeVariable tv = (TypeVariable)type.getTypeArguments().get(0);
                if (tv.asElement() != tpe)
                    throw error("%s != %s", tv.asElement(), tpe);
            }
        }
        public boolean process(Set<? extends TypeElement> annotations,
                               RoundEnvironment roundEnv) {
View Full Code Here

                DeclaredType type = (DeclaredType)tpe.getBounds().get(0);
                if (type.asElement() != element)
                    throw error("%s != %s", type.asElement(), element);
                TypeVariable tv = (TypeVariable)type.getTypeArguments().get(0);
                if (tv.asElement() != tpe)
                    throw error("%s != %s", tv.asElement(), tpe);
            }
        }
        public boolean process(Set<? extends TypeElement> annotations,
                               RoundEnvironment roundEnv) {
            test(processingEnv.getElementUtils().getTypeElement("Test1"), false);
View Full Code Here

      assertFalse(typeMirrorSet.add(captureTwo));
      // Reminder: captureOne is Map<?#123 extends T, ?#456 super U>
      TypeVariable extendsT = (TypeVariable) captureOne.getTypeArguments().get(0);
      assertTrue(typeMirrorSet.add(extendsT));
      assertTrue(typeMirrorSet.add(extendsT.getLowerBound()))// NoType
      for (TypeMirror bound : ((TypeParameterElement) extendsT.asElement()).getBounds()) {
        assertTrue(typeMirrorSet.add(bound));
      }
      TypeVariable superU = (TypeVariable) captureOne.getTypeArguments().get(1);
      assertTrue(typeMirrorSet.add(superU));
      assertFalse(typeMirrorSet.add(superU.getLowerBound()))// We already added U
View Full Code Here

        ArrayType arrayType = (ArrayType) typeMirror;
        return new ArrayTypeM(getTypeM(arrayType.getComponentType()));
      case TYPEVAR:
        if (typeMirror instanceof TypeVariable) {
          TypeVariable typeVar = (TypeVariable) typeMirror;
          return getTypeVariableM((TypeParameterElement) typeVar.asElement());
        } else {
          throw new UnresolvedTypeException(String.format("Expected TypeVariable for %s (%s)", typeMirror, typeMirror
              .getClass().getName()));
        }
      case ERROR:
View Full Code Here

        if (typeArg.getKind() == TypeKind.DECLARED) {
          TypeM typeArgElemTypeM = getTypeM(typeArg);
          result.withTypeParameter(typeArgElemTypeM);
        } else if (typeArg.getKind() == TypeKind.TYPEVAR) {
          TypeVariable typeVar = (TypeVariable) typeArg;
          TypeParameterElement typeParamElem = (TypeParameterElement) typeVar.asElement();
          TypeVariableM var = getTypeVariableM(typeParamElem);
          result.withTypeParameter(var);
        }
      }
    }
View Full Code Here

            if (fbound) {
                DeclaredType type = (DeclaredType)tpe.getBounds().get(0);
                if (type.asElement() != element)
                    throw error("%s != %s", type.asElement(), element);
                TypeVariable tv = (TypeVariable)type.getTypeArguments().get(0);
                if (tv.asElement() != tpe)
                    throw error("%s != %s", tv.asElement(), tpe);
            }
        }
        public boolean process(Set<? extends TypeElement> annotations,
                               RoundEnvironment roundEnv) {
View Full Code Here

                DeclaredType type = (DeclaredType)tpe.getBounds().get(0);
                if (type.asElement() != element)
                    throw error("%s != %s", type.asElement(), element);
                TypeVariable tv = (TypeVariable)type.getTypeArguments().get(0);
                if (tv.asElement() != tpe)
                    throw error("%s != %s", tv.asElement(), tpe);
            }
        }
        public boolean process(Set<? extends TypeElement> annotations,
                               RoundEnvironment roundEnv) {
            test(processingEnv.getElementUtils().getTypeElement("Test1"), false);
View Full Code Here

              throw PROVIDER_FACTORY_NO_PUBLIC_CTOR.failure(env.get(key.getElement()), implementationElt.getQualifiedName());
            }
          }
          else if (env.isAssignable(implementationTM, rawProviderTM)) {
            TypeVariable T = (TypeVariable)providerTM.getTypeArguments().get(0);
            TypeMirror resolved = env.asMemberOf(implementationTM, T.asElement());
            if (env.isAssignable(resolved, valueTM)) {
              // OK
            }
            else {
              throw PROVIDER_NOT_ASSIGNABLE.failure(
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.