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

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


                requestor, problemFactory, outputMap);
        try {
            compiler.compile(sourceUnits.toArray(new ICompilationUnit[sourceUnits.size()]));
        } catch (Throwable t) {
            if (client != null) {
                CompilationUnitDeclaration currentUnit = compiler.getCurrentUnit();
                if (currentUnit == null || currentUnit.getFileName() == null) {
                    client.log(t, "ECJ compiler crashed");
                } else {
                    client.log(t, "ECJ compiler crashed processing %1$s",
                            new String(currentUnit.getFileName()));
                }
            } else {
                t.printStackTrace();
            }
        }
View Full Code Here


        String code = context.getContents();
        if (code == null) {
            return null;
        }

        CompilationUnitDeclaration unit = getParsedUnit(context, code);
        try {
            EcjTreeConverter converter = new EcjTreeConverter();
            converter.visit(code, unit);
            List<? extends Node> nodes = converter.getAll();
View Full Code Here

            @NonNull String code) {
        ICompilationUnit sourceUnit = null;
        if (mSourceUnits != null && mCompiled != null) {
            sourceUnit = mSourceUnits.get(context.file);
            if (sourceUnit != null) {
                CompilationUnitDeclaration unit = mCompiled.get(sourceUnit);
                if (unit != null) {
                    return unit;
                }
            }
        }
View Full Code Here

  private static CompilationUnitDeclaration parseJava(String javaSource) {
    CodeSnippetParsingUtil parsingUtil = new CodeSnippetParsingUtil();
    CompilerOptions options = new CompilerOptions();
    options.complianceLevel = ClassFileConstants.JDK1_5;
    options.sourceLevel = ClassFileConstants.JDK1_5;
    CompilationUnitDeclaration unit = parsingUtil.parseCompilationUnit(
        javaSource.toString().toCharArray(), options.getMap(), true);
    if (unit.compilationResult().hasProblems()) {
      return null;
    }
    return unit;
  }
View Full Code Here

   * @return array of argument names or null if no source is available
   */
  public synchronized String[] getArguments(JAbstractMethod method) {
    JClassType type = method.getEnclosingType();
    JClassType topType = getTopmostType(type);
    CompilationUnitDeclaration cud = getCudForTopLevelType(topType);
    if (cud == null) {
      return null;
    }
    TypeDeclaration jdtType = findType(cud, type.getQualifiedBinaryName());
    if (jdtType == null) {
View Full Code Here

   * @param topType top-level JClassType
   * @return CUD instance or null if no source found
   */
  private synchronized CompilationUnitDeclaration getCudForTopLevelType(
      JClassType topType) {
    CompilationUnitDeclaration cud = null;
    if (cudCache.containsKey(topType)) {
      SoftReference<CompilationUnitDeclaration> cudRef = cudCache.get(topType);
      if (cudRef != null) {
        cud = cudRef.get();
      }
View Full Code Here

  public static void reportRebindProblem(MessageSendSite site, String message) {
    MessageSend messageSend = site.messageSend;
    Scope scope = site.scope;
    // Safe since CUS.referenceContext is set in its constructor.
    CompilationUnitDeclaration cud = scope.compilationUnitScope().referenceContext;
    GWTProblem.recordError(messageSend, cud, message, null);
  }
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.jdt.internal.compiler.parser.Parser#endParse(int)
     */
    @Override
    protected CompilationUnitDeclaration endParse(int act) {
        CompilationUnitDeclaration unit = super.endParse(act);
        if (unit.comments == null) {
            pushOnCommentsStack(0, scanner.commentPtr);
            unit.comments = getCommentsPositions();
        }
        return unit;
View Full Code Here

        return null;
    }

    @Override
    public JavaStructureNode createStructureTree() {
        CompilationUnitDeclaration cu = fCompilation.getCompilationUnit();
        JavaStructureNode node = new JavaStructureNode(Type.CU, null, null, cu);
        cu.traverse(new JavaStructureTreeBuilder(node), (CompilationUnitScope) null);
        return node;
    }
View Full Code Here

        assertThat(changedMethod.getRight().getName(), is("method()"));
    }

    private JavaStructureNode createStructureTree(String source) {
        JavaCompilation compilation = CompilationUtils.compileSource(source);
        CompilationUnitDeclaration cu = compilation.getCompilationUnit();
        JavaStructureNode root = new JavaStructureNode(Type.CU, null, null, cu);
        cu.traverse(new JavaStructureTreeBuilder(root), (CompilationUnitScope) null);
        return root;
    }
View Full Code Here

TOP

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

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.