Exemplo n.º 1
0
  private boolean isVisible(MethodDeclaration method) {
    boolean samePackage = isLocal(ASTHelper.getOutermostTypeDeclarationOf(method).getPackage());

    if (samePackage && !method.getModifiers().isPrivate()) {
      return true;
    }
    if (method.getModifiers().isPublic() || method.getModifiers().isProtected()) {
      return true;
    }

    return false;
  }
Exemplo n.º 2
0
  public TypeDeclarationArray getChildren(boolean onlyDirect) {
    TypeDeclarationArray result = new TypeDeclarationArrayImpl();
    Project project = ASTHelper.getProjectOf(_localType);
    Hashtable knownSubTypes = new Hashtable();
    Hashtable finishedTypes = new Hashtable();

    for (PackageIterator pkgIt = project.getPackages().getIterator(); pkgIt.hasNext(); ) {
      for (TypeDeclarationIterator typeIt = pkgIt.getNext().getTypes().getIterator();
          typeIt.hasNext(); ) {
        checkForSubType(typeIt.getNext(), knownSubTypes, finishedTypes, !onlyDirect);
      }
    }
    for (Enumeration en = knownSubTypes.elements(); en.hasMoreElements(); ) {
      result.add((TypeDeclaration) en.nextElement());
    }
    return result;
  }
Exemplo n.º 3
0
  public static boolean areUnRelated(TypeDeclaration typeA, TypeDeclaration typeB) {
    if ((typeA == null) || (typeB == null)) {
      return false;
    }

    // same type
    if (typeA.equals(typeB)) {
      return false;
    }

    // both are defined in same compilation unit
    if (ASTHelper.isInSameCompilationUnit(typeA, typeB)) {
      return false;
    }

    // typeA is child of typeB or vice versa
    if (InheritanceAnalyzer.areRelated(typeA, typeB)) {
      return false;
    }

    return true;
  }
Exemplo n.º 4
0
 /** Returns true if all features of type are visible (particulary private features). */
 public boolean isLocal(TypeDeclaration type) {
   return getLocalType().equals(type) || ASTHelper.isDefinedInSameType(getLocalType(), type);
 }