private void assertAllBindings(CompilationUnit astRoot) {
    List<AbstractTypeDeclaration> list = astRoot.types();
    for (int i = 0; i < list.size(); i++) {
      TypeDeclaration decl = (TypeDeclaration) list.get(i);
      assertTrue(decl.resolveBinding() != null);

      if (!decl.isInterface() && decl.getSuperclassType() != null) {
        assertTrue(decl.getSuperclassType().resolveBinding() != null);
      }
      List<Type> interfaces = decl.superInterfaceTypes();
      for (int j = 0; j < interfaces.size(); j++) {
        assertTrue(interfaces.get(j).resolveBinding() != null);
      }

      MethodDeclaration[] declarations = decl.getMethods();
      for (int k = 0; k < declarations.length; k++) {
        MethodDeclaration meth = declarations[k];
        assertTrue(meth.resolveBinding() != null);
        List<SingleVariableDeclaration> params = meth.parameters();
        for (int n = 0; n < params.size(); n++) {
          SingleVariableDeclaration arg = params.get(n);
          assertTrue(arg.resolveBinding() != null);
        }
        if (!meth.isConstructor()) {
          assertTrue(meth.getReturnType2().resolveBinding() != null);
        }
      }
    }
  }
示例#2
0
 public ITypeBinding getTypeBinding() {
   return fDeclaration.resolveBinding().getType();
 }