예제 #1
0
    @NotNull
    @Override
    public List<TypeParameterDescriptor> getParameters() {
      if (parameters == null) {
        JetClassLikeInfo classInfo = declarationProvider.getOwnerInfo();
        List<JetTypeParameter> typeParameters = classInfo.getTypeParameters();
        parameters = new ArrayList<TypeParameterDescriptor>(typeParameters.size());

        for (int i = 0; i < typeParameters.size(); i++) {
          parameters.add(
              new LazyTypeParameterDescriptor(
                  resolveSession, LazyClassDescriptor.this, typeParameters.get(i), i));
        }
      }
      return parameters;
    }
예제 #2
0
 private void findAndDisconnectLoopsInTypeHierarchy(List<JetType> supertypes) {
   for (Iterator<JetType> iterator = supertypes.iterator(); iterator.hasNext(); ) {
     JetType supertype = iterator.next();
     if (isReachable(supertype.getConstructor(), this, new HashSet<TypeConstructor>())) {
       iterator.remove();
     }
   }
 }
예제 #3
0
  private static Collection<ClassDescriptor> getClassOrObjectDescriptorsByFqName(
      NamespaceDescriptor packageDescriptor, FqName path, boolean includeObjectDeclarations) {
    if (path.isRoot()) {
      return Collections.emptyList();
    }

    Collection<JetScope> scopes = Arrays.asList(packageDescriptor.getMemberScope());

    List<Name> names = path.pathSegments();
    if (names.size() > 1) {
      for (Name subName : path.pathSegments().subList(0, names.size() - 1)) {
        Collection<JetScope> tempScopes = Lists.newArrayList();
        for (JetScope scope : scopes) {
          ClassifierDescriptor classifier = scope.getClassifier(subName);
          if (classifier instanceof ClassDescriptorBase) {
            ClassDescriptorBase classDescriptor = (ClassDescriptorBase) classifier;
            tempScopes.add(classDescriptor.getUnsubstitutedInnerClassesScope());
          }
        }
        scopes = tempScopes;
      }
    }

    Name shortName = path.shortName();
    Collection<ClassDescriptor> resultClassifierDescriptors = Lists.newArrayList();
    for (JetScope scope : scopes) {
      ClassifierDescriptor classifier = scope.getClassifier(shortName);
      if (classifier instanceof ClassDescriptor) {
        resultClassifierDescriptors.add((ClassDescriptor) classifier);
      }
      if (includeObjectDeclarations) {
        ClassDescriptor objectDescriptor = scope.getObjectDescriptor(shortName);
        if (objectDescriptor != null) {
          resultClassifierDescriptors.add(objectDescriptor);
        }
      }
    }

    return resultClassifierDescriptors;
  }