Examples of JRealClassType


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

        CollectClassData cv = classMap.get(internalName);
        if (cv == null) {
          // ignore classes that were skipped earlier
          continue;
        }
        JRealClassType type = createType(compiledClass, unresolvedTypes);
        if (type != null) {
          if (unit instanceof SourceFileCompilationUnit) {
            SourceFileCompilationUnit sourceUnit = (SourceFileCompilationUnit) unit;
            Resource sourceFile = sourceUnit.getSourceFile();
            typeOracle.addSourceReference(type, sourceFile);
          }
          binaryMapper.put(internalName, type);
          classMapType.put(type, cv);
        }
      }
    }

    // Hook up enclosing types
    TreeLogger branch = logger.branch(TreeLogger.SPAM,
        "Resolving enclosing classes");
    for (Iterator<JRealClassType> it = unresolvedTypes.iterator(); it.hasNext();) {
      JRealClassType type = it.next();
      if (!resolveEnclosingClass(branch, type)) {
        // already logged why it failed, don't try and use it further
        it.remove();
      }
    }

    // Resolve unresolved types.
    for (JRealClassType type : unresolvedTypes) {
      branch = logger.branch(TreeLogger.SPAM, "Resolving "
          + type.getQualifiedSourceName());
      if (!resolveClass(branch, type)) {
        // already logged why it failed
        // TODO: should we do anything else here?
      }
    }
View Full Code Here

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

  private JRealClassType createType(CompiledClass compiledClass,
      CollectClassData classData, CollectClassData enclosingClassData) {
    int access = classData.getAccess();
    String qname = compiledClass.getSourceName();
    String className = Shared.getShortName(qname);
    JRealClassType resultType = null;
    String jpkgName = compiledClass.getPackageName();
    JPackage pkg = typeOracle.getOrCreatePackage(jpkgName);
    boolean isIntf = (access & Opcodes.ACC_INTERFACE) != 0;
    boolean isLocalType = classData.hasNoExternalName();
    String enclosingTypeName = null;
    if (enclosingClassData != null) {
      enclosingTypeName = InternalName.toSourceName(InternalName.getClassName(enclosingClassData.getName()));
    }
    if ((access & Opcodes.ACC_ANNOTATION) != 0) {
      resultType = new JAnnotationType(typeOracle, pkg, enclosingTypeName,
          false, className, true);
    } else if ((access & Opcodes.ACC_ENUM) != 0) {
      resultType = new JEnumType(typeOracle, pkg, enclosingTypeName,
          isLocalType, className, isIntf);
    } else {
      JTypeParameter[] typeParams = getTypeParametersForClass(classData);
      if ((typeParams != null && typeParams.length > 0)
          || nonStaticInsideGeneric(classData, enclosingClassData)) {
        resultType = new JGenericType(typeOracle, pkg, enclosingTypeName,
            isLocalType, className, isIntf, typeParams);
      } else {
        resultType = new JRealClassType(typeOracle, pkg, enclosingTypeName,
            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(mapBits(ASM_TO_SHARED_MODIFIERS, access));
    if (isIntf) {
      // Always add implicit modifiers on interfaces.
      resultType.addModifierBits(Shared.MOD_STATIC | Shared.MOD_ABSTRACT);
    }

    return resultType;
  }
View Full Code Here

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

      if (enclosingClassData == null) {
        // if our enclosing class was skipped, skip this one too
        return null;
      }
    }
    JRealClassType realClassType = createType(compiledClass, classData,
        enclosingClassData);
    unresolvedTypes.add(realClassType);
    return realClassType;
  }
View Full Code Here

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

    }
    // Find our enclosing class and set it
    CollectClassData classData = classMapType.get(type);
    assert classData != null;
    String outerClass = classData.getOuterClass();
    JRealClassType enclosingType = null;
    if (outerClass != null) {
      enclosingType = binaryMapper.get(outerClass);
      // Ensure enclosing classes are resolved
      if (enclosingType != null) {
        if (!resolveEnclosingClass(logger, enclosingType)) {
          return false;
        }
        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();
          type.setEnclosingType(genericType.getRawType());
        } else {
          type.setEnclosingType(enclosingType);
        }
      }
View Full Code Here

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

  private JRealClassType resolveObject(Type type) {
    assert type.getSort() == Type.OBJECT;
    String className = type.getInternalName();
    assert Name.isInternalName(className);
    JRealClassType classType = binaryMapper.get(className);
    return classType;
  }
View Full Code Here

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

      case Type.VOID:
        return JPrimitiveType.VOID;
      case Type.ARRAY:
        return resolveArray(type);
      case Type.OBJECT:
        JRealClassType resolvedType = resolveObject(type);
        return possiblySubstituteRawType(resolvedType);
      default:
        assert false : "Unexpected type " + type;
        return null;
    }
View Full Code Here

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

  @Override
  public void visitClassType(String internalName) {
    assert Name.isInternalName(internalName);
    outerClass = enclosingClass;
    JRealClassType classType = binaryMapper.get(internalName);
    // TODO(jat): failures here are likely binary-only annotations or local
    // classes that have been elided from TypeOracle -- what should we do in
    // those cases?  Currently we log an error and replace them with Object,
    // but we may can do something better.
    boolean resolveSuccess = classType == null ? false
View Full Code Here

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

    // Perform a shallow pass to establish identity for new and old types.
    for (CompilationUnit unit : units) {
      switch (unit.getState()) {
        case GRAVEYARD:
          for (CompiledClass compiledClass : unit.getCompiledClasses()) {
            JRealClassType type = compiledClass.getRealClassType();
            assert (type != null);
            type.resurrect();
            binaryMapper.put(compiledClass.getInternalName(), type);
          }
          break;
        case COMPILED:
          for (CompiledClass compiledClass : unit.getCompiledClasses()) {
            JRealClassType type = createType(compiledClass);
            binaryMapper.put(compiledClass.getInternalName(), type);
          }
          break;
        case CHECKED:
          for (CompiledClass compiledClass : unit.getCompiledClasses()) {
            JRealClassType type = compiledClass.getRealClassType();
            assert (type != null);
            binaryMapper.put(compiledClass.getInternalName(), type);
          }
          break;
      }
View Full Code Here

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

    return AnnotationProxyFactory.create(clazz,
        Maps.normalize(identifierToValue));
  }

  private JRealClassType createType(CompiledClass compiledClass) {
    JRealClassType realClassType = compiledClass.getRealClassType();
    if (realClassType == null) {
      JRealClassType enclosingType = null;
      CompiledClass enclosingClass = compiledClass.getEnclosingClass();
      if (enclosingClass != null) {
        enclosingType = enclosingClass.getRealClassType();
        if (enclosingType == null) {
          enclosingType = createType(enclosingClass);
View Full Code Here

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
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.