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

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


    JPackage pkg = typeOracle.getOrCreatePackage(jpkgName);
    boolean isLocalType = binding instanceof LocalTypeBinding;
    boolean isIntf = TypeDeclaration.kind(typeDecl.modifiers) == TypeDeclaration.INTERFACE_DECL;
    boolean isAnnotation = TypeDeclaration.kind(typeDecl.modifiers) == TypeDeclaration.ANNOTATION_TYPE_DECL;

    JRealClassType resultType;
    if (isAnnotation) {
      resultType = new JAnnotationType(typeOracle, pkg, enclosingType,
          isLocalType, className, isIntf);
    } else if (maybeGeneric(typeDecl, enclosingType)) {
      // Go through and create declarations for each of the type parameters on
      // the generic class or method
      JTypeParameter[] jtypeParameters = declareTypeParameters(typeDecl.typeParameters);

      JGenericType jgenericType = new JGenericType(typeOracle, pkg,
          enclosingType, isLocalType, className, isIntf, jtypeParameters);

      resultType = jgenericType;
    } else if (binding.isEnum()) {
      resultType = new JEnumType(typeOracle, pkg, enclosingType, isLocalType,
          className, isIntf);
    } else {
      resultType = new JRealClassType(typeOracle, pkg, enclosingType,
          isLocalType, className, isIntf);
    }

    /*
     * Declare type parameters for all methods; we must do this during the first
     * pass.
     */
    if (typeDecl.methods != null) {
      for (AbstractMethodDeclaration method : typeDecl.methods) {
        declareTypeParameters(method.typeParameters());
      }
    }

    /*
     * Add modifiers since these are needed for
     * TypeOracle.getParameterizedType's error checking code.
     */
    resultType.addModifierBits(Shared.bindingToModifierBits(binding));
    return resultType;
  }
View Full Code Here


    }

    if (binding instanceof BinaryTypeBinding) {
      // Try a binary lookup.
      String binaryName = String.valueOf(binding.constantPoolName());
      JRealClassType realClassType = binaryMapper.get(binaryName);
      if (realClassType != null) {
        return realClassType;
      }
    }
View Full Code Here

    if (isPackageInfoTypeName(qname)) {
      return resolvePackage(logger, clazz);
    }

    // Just resolve the type.
    JRealClassType jtype = (JRealClassType) resolveType(logger, binding);
    if (jtype == null) {
      // Failed to resolve.
      //
      return false;
    }

    /*
     * Modifiers were added during processType since getParameterizedType
     * depends on them being set.
     */

    // Try to resolve annotations, ignore any that fail.
    Map<Class<? extends java.lang.annotation.Annotation>, java.lang.annotation.Annotation> declaredAnnotations = newAnnotationMap();
    resolveAnnotations(logger, clazz.annotations, declaredAnnotations);
    jtype.addAnnotations(declaredAnnotations);

    // Resolve bounds for type parameters on generic types. Note that this
    // step does not apply to type parameters on generic methods; that
    // occurs during the method resolution stage.
    JGenericType jGenericType = jtype.isGenericType();
    if (jGenericType != null
        && !resolveBoundsForTypeParameters(logger, jtype.isGenericType(),
            clazz.typeParameters)) {
      // Failed to resolve
      return false;
    }

    // Resolve superclass (for classes only).
    //
    if (jtype.isInterface() == null) {
      ReferenceBinding superclassRef = binding.superclass;
      assert superclassRef != null
          || "java.lang.Object".equals(jtype.getQualifiedSourceName());
      if (superclassRef != null) {
        JClassType jsuperClass = (JClassType) resolveType(logger, superclassRef);
        assert jsuperClass != null;
        jtype.setSuperclass(jsuperClass);
      }
    }

    // Resolve superinterfaces.
    //
    ReferenceBinding[] superintfRefs = binding.superInterfaces;
    for (int i = 0; i < superintfRefs.length; i++) {
      ReferenceBinding superintfRef = superintfRefs[i];
      JClassType jinterface = (JClassType) resolveType(logger, superintfRef);
      if (jinterface == null) {
        // Failed to resolve.
        //
        return false;
      }
      jtype.addImplementedInterface(jinterface);
    }

    // Resolve fields.
    //
    FieldDeclaration[] fields = clazz.fields;
View Full Code Here

    if (typeWild != null) {
      endVisit(typeWild);
      return;
    }

    JRealClassType typeReal = (JRealClassType) type;
    endVisit(typeReal);
  }
View Full Code Here

    for (String sourceTypeName : typeSignatures.keySet()) {
      JClassType sourceType = oracle.findType(sourceTypeName);
      if (sourceType == null || !(sourceType instanceof JRealClassType)) {
        return false;
      }
      JRealClassType sourceRealType = (JRealClassType) sourceType;
     
      String signature = sourceRealType.getTypeStrongHash();
      if (!signature.equals(typeSignatures.get(sourceTypeName))) {
        return false;
      }
    }
   
View Full Code Here

      }
      Map<String, String> typeSignatures = new HashMap<String, String>();
      for (JClassType type : types) {
        String typeName = type.getQualifiedSourceName();
        if (type instanceof JRealClassType) {
          JRealClassType sourceRealType = (JRealClassType) type;
          String typeSignature = sourceRealType.getTypeStrongHash();
          typeSignatures.put(typeName, typeSignature);
        } else {
          typeSignatures.put(typeName, "");
        }
      }
View Full Code Here

   * Returns <code>true</code> if this type or one of its subtypes is
   * instantiable relative to a known base type.
   */
  private boolean checkSubtypes(TreeLogger logger, JClassType originalType,
      Set<JClassType> instSubtypes, TypePath path, ProblemReport problems) {
    JRealClassType baseType = getBaseType(originalType);
    TreeLogger computationLogger =
        logger.branch(TreeLogger.DEBUG, "Finding possibly instantiable subtypes");
    List<JClassType> candidates =
        getPossiblyInstantiableSubtypes(computationLogger, baseType, problems);
    boolean anySubtypes = false;
View Full Code Here

      assert leafType.isPrimitive() != null;
      markArrayTypesInstantiable(leafType, array.getRank(), path);
      return;
    }

    JRealClassType baseClass = getBaseType(leafType.isClassOrInterface());

    TreeLogger covariantArrayLogger =
        logger.branch(TreeLogger.DEBUG, "Covariant array types:");

    Set<JClassType> instantiableTypes = leafTic.instantiableTypes;
View Full Code Here

    if (typeWild != null) {
      endVisit(typeWild);
      return;
    }

    JRealClassType typeReal = (JRealClassType) type;
    endVisit(typeReal);
  }
View Full Code Here

        logger.log(TreeLogger.TRACE,
            "Found previously dependent type that's no longer present: " + sourceTypeName);
        return false;
      }
      assert sourceType instanceof JRealClassType;
      JRealClassType sourceRealType = (JRealClassType) sourceType;
     
      if (sourceRealType.getLastModifiedTime() != typeLastModifiedTimes.get(sourceTypeName)) {
        logger.log(TreeLogger.TRACE, "Found dependent type that has changed: " + sourceTypeName);
        return false;
      }
    }
   
View Full Code Here

TOP

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

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.