Examples of JGenericType


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

    }
    return type;
  }

  private void resolveGenerics() {
    JGenericType genericType = returnTypeRef[0].isGenericType();
    if (genericType != null) {
      int actual = args.size();
      JClassType[] typeArgs = new JClassType[actual];
      for (int i = 0; i < actual; ++i) {
        JType type = args.get(i)[0];
View Full Code Here

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

   * @param type
   * @return original type or its raw type if it is generic
   */
  private static JType possiblySubstituteRawType(JType type) {
    if (type != null) {
      JGenericType genericType = type.isGenericType();
      if (genericType != null) {
        type = genericType.getRawType();
      }
    }
    return type;
  }
View Full Code Here

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

      resultType = newEnumType(pkg, enclosingTypeName, className);
    } else {
      JTypeParameter[] typeParams = getTypeParametersForClass(classData);
      if ((typeParams != null && typeParams.length > 0)
          || nonStaticInsideGeneric(classData, enclosingClassData)) {
        resultType = new JGenericType(typeOracle, pkg, enclosingTypeName,
            className, isIntf, typeParams);
      } else {
        resultType = newRealClassType(pkg, enclosingTypeName, className,
            isIntf);
      }
View Full Code Here

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

        if (enclosingType.isGenericType() != null
            && (classData.getAccess() & (Opcodes.ACC_STATIC | Opcodes.ACC_INTERFACE)) != 0) {
          // If the inner class doesn't have access to it's enclosing type's
          // type variables, the enclosign type must be the raw type instead
          // of the generic type.
          JGenericType genericType = enclosingType.isGenericType();
          setEnclosingType(type, genericType.getRawType());
        } else {
          setEnclosingType(type, enclosingType);
        }
      }
    }
View Full Code Here

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

  public void pushEnclosingScopes(JClassType type) {
    if (type == null) {
      return;
    }
    pushEnclosingScopes(type.getEnclosingType());
    JGenericType genericType = type.isGenericType();
    if (genericType != null) {
      pushScope(genericType.getTypeParameters());
    }
  }
View Full Code Here

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

  }

  @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

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

    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,
                context, 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

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

    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

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

      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

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

  /**
   * Returns HashMap&lt;String, ResourcePrototype&gt;.
   */
  private JParameterizedType getHashMapStringResource(TypeOracle typeOracle) {
    JGenericType hashMap = (JGenericType) typeOracle.findType(HashMap.class.getName());
    assert hashMap != null;
    JClassType string = typeOracle.findType(String.class.getName());
    assert string != null;
    JClassType resourcePrototype = typeOracle.findType(ResourcePrototype.class.getName());
    assert resourcePrototype != null;
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.