Package com.google.gwt.core.ext.typeinfo

Examples of com.google.gwt.core.ext.typeinfo.JGenericType


  }

  @Override
  public MetaTypeVariable[] getTypeParameters() {
    final List<MetaTypeVariable> typeVariables = new ArrayList<MetaTypeVariable>();
    final JGenericType genericType = getEnclosedMetaObject().isGenericType();

    if (genericType != null) {
      for (final JTypeParameter typeParameter : genericType.getTypeParameters()) {
        typeVariables.add(new GWTTypeVariable(oracle, typeParameter));
      }
    }

    return typeVariables.toArray(new MetaTypeVariable[typeVariables.size()]);
View Full Code Here


    JArrayType typeArgAsArray = typeArg.isArray();
    if (typeArgAsArray != null) {
      JTypeParameter parameterOfTypeArgArray = typeArgAsArray.getLeafType().isTypeParameter();
      if (parameterOfTypeArgArray != null) {
        JGenericType declaringClass = parameterOfTypeArgArray.getDeclaringClass();
        if (declaringClass != null) {
          TypeParameterFlowInfo flowInfoForArrayParam =
              getFlowInfo(declaringClass, parameterOfTypeArgArray.getOrdinal());
          TypeParameterFlowInfo otherFlowInfo = getFlowInfo(baseType, paramIndex);
          if (otherFlowInfo.getExposure() >= 0
View Full Code Here

      if (maybeInstantiable(logger, subtypeBase, problems)) {
        /*
         * Convert the generic type into a parameterization that only includes
         * wildcards.
         */
        JGenericType isGeneric = subtype.isGenericType();
        if (isGeneric != null) {
          subtype = isGeneric.asParameterizedByWildcards();
        } else {
          assert (subtype instanceof JRealClassType);
        }

        possiblyInstantiableTypes.add(subtype);
View Full Code Here

    private void computeIndirectExposureCauses() {
      // TODO(spoon): this only needs to consider immediate subtypes, not all
      // subtypes
      JClassType[] subtypes = baseType.getSubtypes();
      for (JClassType subtype : subtypes) {
        JGenericType isGeneric = subtype.isGenericType();
        if (isGeneric == null) {
          // Only generic types can cause a type parameter to be exposed
          continue;
        }

        // any problems should already have been captured by our caller, so we
        // make a throw-away ProblemReport here.
        if (!SerializableTypeOracleBuilder.shouldConsiderFieldsForSerialization(subtype,
            typeFilter, new ProblemReport())) {
          continue;
        }

        JParameterizedType asParameterizationOf = subtype.asParameterizationOf(baseType);
        Set<JTypeParameter> paramsUsed = new LinkedHashSet<JTypeParameter>();
        SerializableTypeOracleBuilder.recordTypeParametersIn(
            asParameterizationOf.getTypeArgs()[ordinal], paramsUsed);

        for (JTypeParameter paramUsed : paramsUsed) {
          recordCausesExposure(isGeneric, paramUsed.getOrdinal(), 0);
        }
      }

      JClassType type = baseType;
      while (type != null) {
        if (SerializableTypeOracleBuilder.shouldConsiderFieldsForSerialization(type, typeFilter,
            new ProblemReport())) {
          JField[] fields = type.getFields();
          for (JField field : fields) {
            if (!SerializableTypeOracleBuilder.shouldConsiderForSerialization(TreeLogger.NULL,
                true, field)) {
              continue;
            }

            JParameterizedType isParameterized = field.getType().getLeafType().isParameterized();
            if (isParameterized == null) {
              continue;
            }

            JClassType[] typeArgs = isParameterized.getTypeArgs();
            for (int i = 0; i < typeArgs.length; ++i) {
              if (referencesTypeParameter(typeArgs[i], getTypeParameter())) {
                JGenericType genericFieldType = isParameterized.getBaseType();
                recordCausesExposure(genericFieldType, i, 0);
                JArrayType typeArgIsArray = typeArgs[i].isArray();
                if (typeArgIsArray != null && typeArgIsArray.getLeafType() == getTypeParameter()) {
                  int dims = typeArgIsArray.getRank();
                  recordCausesExposure(genericFieldType, i, dims);
View Full Code Here

  }

  @Override
  public MetaTypeVariable[] getTypeParameters() {
    final List<MetaTypeVariable> typeVariables = new ArrayList<MetaTypeVariable>();
    final JGenericType genericType = getEnclosedMetaObject().isGenericType();

    if (genericType != null) {
      for (final JTypeParameter typeParameter : genericType.getTypeParameters()) {
        typeVariables.add(new GWTTypeVariable(oracle, typeParameter));
      }
    }

    return typeVariables.toArray(new MetaTypeVariable[typeVariables.size()]);
View Full Code Here

    return getAnnotation(annotation) != null;
  }

  @Override
  public MetaType getGenericType() {
    final JGenericType genericType = field.getType().isGenericType();
    if (genericType != null) {
      return new GWTGenericDeclaration(oracle, genericType);
    }
    return null;
  }
View Full Code Here

  }

  @Override
  public MetaTypeVariable[] getTypeParameters() {
    final List<MetaTypeVariable> typeVariables = new ArrayList<MetaTypeVariable>();
    final JGenericType genericType = getEnclosedMetaObject().isGenericType();

    if (genericType != null) {
      for (final JTypeParameter typeParameter : genericType.getTypeParameters()) {
        typeVariables.add(new GWTTypeVariable(oracle, typeParameter));
      }
    }

    return typeVariables.toArray(new MetaTypeVariable[typeVariables.size()]);
View Full Code Here

    return getAnnotation(annotation) != null;
  }

  @Override
  public MetaType getGenericType() {
    JGenericType genericType = field.getType().isGenericType();
    if (genericType != null) {
      return new GWTGenericDeclaration(genericType);
    }
    return null;
  }
View Full Code Here

  }

  @Override
  public MetaTypeVariable[] getTypeParameters() {
    List<MetaTypeVariable> typeVariables = new ArrayList<MetaTypeVariable>();
    JGenericType genericType = getEnclosedMetaObject().isGenericType();

    if (genericType != null) {
      for (JTypeParameter typeParameter : genericType.getTypeParameters()) {
        typeVariables.add(new GWTTypeVariable(typeParameter));
      }
    }

    return typeVariables.toArray(new MetaTypeVariable[typeVariables.size()]);
View Full Code Here

    return MetaClassFactory.get(method.getEnclosingType());
  }

  @Override
  public MetaType getGenericReturnType() {
    JGenericType type = method.getReturnType().isGenericType();
    if (type != null) {
      return new GWTGenericDeclaration(type);
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.core.ext.typeinfo.JGenericType

Copyright © 2018 www.massapicom. 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.