Package org.eclipse.jdt.internal.compiler.ast

Examples of org.eclipse.jdt.internal.compiler.ast.TypeDeclaration


   * TypeParameters (i.e, it is a generic type or method), then the
   * TypeParameters are mapped into JTypeParameters.
   */
  private JRealClassType createType(CompiledClass compiledClass,
      JRealClassType enclosingType) {
    TypeDeclaration typeDecl = compiledClass.getTypeDeclaration();
    SourceTypeBinding binding = typeDecl.binding;
    assert (binding.constantPoolName() != null);

    String qname = compiledClass.getSourceName();
    String className = Shared.getShortName(qname);
View Full Code Here


  /**
   * TODO: log real errors, replacing GenerateJavaScriptAST?
   */
  private static void collectJsniMethods(TreeLogger logger, String loc,
      String source, CompiledClass compiledClass, JsProgram program) {
    TypeDeclaration typeDecl = compiledClass.getTypeDeclaration();
    int[] lineEnds = typeDecl.compilationResult.getLineSeparatorPositions();
    List<JsniMethod> jsniMethods = new ArrayList<JsniMethod>();
    String enclosingType = compiledClass.getBinaryName().replace('/', '.');
    AbstractMethodDeclaration[] methods = typeDecl.methods;
    if (methods != null) {
View Full Code Here

   * @return type declaration or null if not found
   */
  private static TypeDeclaration findType(CompilationUnitDeclaration unit,
      String binaryName) {
    List<char[]> classChain = getClassChain(binaryName);
    TypeDeclaration curType = findType(unit.types, classChain.get(0));
    for (int i = 1; i < classChain.size(); ++i) {
      if (curType == null) {
        return null;
      }
      curType = findType(curType.memberTypes, classChain.get(i));
View Full Code Here

    JClassType topType = getTopmostType(type);
    CompilationUnitDeclaration cud = getCudForTopLevelType(topType);
    if (cud == null) {
      return null;
    }
    TypeDeclaration jdtType = findType(cud, type.getQualifiedBinaryName());
    if (jdtType == null) {
      // TODO(jat): any thing else to do here?
      return null;
    }
    AbstractMethodDeclaration jdtMethod = findMethod(jdtType, method);
View Full Code Here

        return root;
    }

    private Node convertClassDeclaration(String className, String sourceCode) {
        JavaCompilation compilation = CompilationUtils.compileSource(sourceCode);
        TypeDeclaration type = CompilationUtils.findType(compilation.getCompilationUnit(), className);
        Node root = new Node(JavaEntityType.CLASS, className);
        root.setEntity(new SourceCodeEntity(className, JavaEntityType.CLASS, new SourceRange(
                type.declarationSourceStart,
                type.declarationSourceEnd)));
        sDeclarationConverter.initialize(root, compilation.getScanner());
        type.traverse(sDeclarationConverter, (ClassScope) null);
        return root;
    }
View Full Code Here

        method.traverse(getDeclarationconverter(), (ClassScope) null);
    }

    private void convertClass(String name) {
        createRootNode(JavaEntityType.METHOD_DECLARATION, name);
        TypeDeclaration type = CompilationUtils.findType(fCompilation.getCompilationUnit(), name);
        type.traverse(getDeclarationconverter(), (CompilationUnitScope) null);
    }
View Full Code Here

                createSourceRange(node.getASTNode()));
    }

    private SourceRange createSourceRange(ASTNode astNode) {
        if (astNode instanceof TypeDeclaration) {
            TypeDeclaration type = (TypeDeclaration) astNode;
            return new SourceRange(type.declarationSourceStart, type.declarationSourceEnd);
        }
        if (astNode instanceof AbstractMethodDeclaration) {
            AbstractMethodDeclaration method = (AbstractMethodDeclaration) astNode;
            return new SourceRange(method.declarationSourceStart, method.declarationSourceEnd);
View Full Code Here

    CompilationUnitDeclaration cud = new CompilationUnitDeclaration(null,
        compilationResult, 1);
    LookupEnvironment lookupEnvironment = createMockLookupEnvironment();
    cud.scope = new CompilationUnitScope(cud, lookupEnvironment);

    TypeDeclaration typeDeclaration = new TypeDeclaration(compilationResult);
    typeDeclaration.scope = new ClassScope(cud.scope, null);
    typeDeclaration.staticInitializerScope = new MethodScope(
        typeDeclaration.scope, null, false);
    cud.types = new TypeDeclaration[] {typeDeclaration};
View Full Code Here

      TreeLogger cudLogger = logger.branch(TreeLogger.SPAM,
          "Processing types in compilation unit: " + unit.getDisplayLocation());
      Set<CompiledClass> compiledClasses = unit.getCompiledClasses();
      for (CompiledClass compiledClass : compiledClasses) {
        if (unresolvedTypes.remove(compiledClass.getRealClassType())) {
          TypeDeclaration typeDeclaration = compiledClass.getTypeDeclaration();
          if (!resolveTypeDeclaration(cudLogger, unit.getSource(),
              typeDeclaration)) {
            logger.log(TreeLogger.WARN,
                "Unexpectedly unable to fully resolve type "
                    + compiledClass.getSourceName());
View Full Code Here

   * TypeParameters (i.e, it is a generic type or method), then the
   * TypeParameters are mapped into JTypeParameters.
   */
  private JRealClassType createType(CompiledClass compiledClass,
      JRealClassType enclosingType) {
    TypeDeclaration typeDecl = compiledClass.getTypeDeclaration();
    SourceTypeBinding binding = typeDecl.binding;
    assert (binding.constantPoolName() != null);

    String qname = compiledClass.getSourceName();
    String className = Shared.getShortName(qname);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.TypeDeclaration

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.