当前位置: 首页>>代码示例>>Java>>正文


Java EndPosTable类代码示例

本文整理汇总了Java中com.sun.tools.javac.tree.EndPosTable的典型用法代码示例。如果您正苦于以下问题:Java EndPosTable类的具体用法?Java EndPosTable怎么用?Java EndPosTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EndPosTable类属于com.sun.tools.javac.tree包,在下文中一共展示了EndPosTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: analyzePackageName

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
private static void analyzePackageName(
    CompilationUnitTree cut, Source src, EndPosTable endPosTable) {
  ExpressionTree packageExpr = cut.getPackageName();
  if (isNull(packageExpr)) {
    src.setPackageName("");
  } else {
    src.setPackageName(packageExpr.toString());
  }
  if (packageExpr instanceof JCTree.JCIdent) {
    JCTree.JCIdent ident = (JCTree.JCIdent) packageExpr;
    int startPos = ident.getPreferredPosition();
    int endPos = ident.getEndPosition(endPosTable);
    Range range = Range.create(src, startPos + 1, endPos);
    long pkgLine = range.begin.line;
    src.setPackageStartLine(pkgLine);
  }
}
 
开发者ID:mopemope,项目名称:meghanada-server,代码行数:18,代码来源:TreeAnalyzer.java

示例2: TranslatePositionsVisitor

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
public TranslatePositionsVisitor (final MethodTree changedMethod, final EndPosTable endPos, final int delta) {
    assert changedMethod != null;
    assert endPos != null;
    this.changedMethod = changedMethod;
    this.endPos = endPos;
    this.delta = delta;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:TranslatePositionsVisitor.java

示例3: Info

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:TreePosTest.java

示例4: analyzeCompilationUnitTree

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
private static void analyzeCompilationUnitTree(SourceContext context, CompilationUnitTree cut) {

    Source src = context.getSource();
    log.trace("file={}", src.getFile());
    EndPosTable endPosTable = ((JCTree.JCCompilationUnit) cut).endPositions;
    context.setEndPosTable(endPosTable);

    analyzePackageName(cut, src, endPosTable);

    analyzeImports(cut, src, endPosTable);

    try {

      for (Tree td : cut.getTypeDecls()) {
        // start class
        if (td instanceof JCTree.JCClassDecl) {
          analyzeTopLevelClass(context, (JCTree.JCClassDecl) td);
        } else if (td instanceof JCTree.JCSkip) {
          // skip
        } else if (td instanceof JCTree.JCErroneous) {
          // skip erroneous
        } else {
          log.warn("unknown td={} {}", td, td.getClass());
        }
      }
    } catch (IOException e) {
      log.catching(e);
      throw new UncheckedIOException(e);
    }
  }
 
开发者ID:mopemope,项目名称:meghanada-server,代码行数:31,代码来源:TreeAnalyzer.java

示例5: getReplacements

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
@Override
public Set<Replacement> getReplacements(EndPosTable endPositions) {
  if (endPositions == null) {
    throw new IllegalArgumentException(
        "Cannot produce correct replacements without endPositions.");
  }
  Replacements replacements = new Replacements();
  for (FixOperation fix : fixes) {
    replacements.add(fix.getReplacement(endPositions));
  }
  return replacements.descending();
}
 
开发者ID:google,项目名称:error-prone,代码行数:13,代码来源:SuggestedFix.java

示例6: JavacErrorDescriptionListener

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
private JavacErrorDescriptionListener(
    Log log, EndPosTable endPositions, JavaFileObject sourceFile, boolean dontUseErrors) {
  this.log = log;
  this.sourceFile = sourceFile;
  this.dontUseErrors = dontUseErrors;
  checkNotNull(endPositions);
  try {
    CharSequence sourceFileContent = sourceFile.getCharContent(true);
    fixToAppliedFix = fix -> AppliedFix.fromSource(sourceFileContent, endPositions).apply(fix);
  } catch (IOException e) {
    throw new IOError(e);
  }
}
 
开发者ID:google,项目名称:error-prone,代码行数:14,代码来源:JavacErrorDescriptionListener.java

示例7: stubPackage

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
/**
 * A helper method to create a stubbed package JCExpression.
 *
 * @param endPos the end position of the package JCExpression
 * @return a new package JCExpression stub
 */
private static JCExpression stubPackage(int endPos) {
  // TODO(b/67738557): consolidate helpers for creating fake trees
  return new JCExpression() {
    @Override
    public Tag getTag() {
      throw new UnsupportedOperationException();
    }

    @Override
    public void accept(Visitor visitor) {
      throw new UnsupportedOperationException();
    }

    @Override
    public Kind getKind() {
      throw new UnsupportedOperationException();
    }

    @Override
    public <R, D> R accept(TreeVisitor<R, D> treeVisitor, D d) {
      throw new UnsupportedOperationException();
    }

    @Override
    public int getStartPosition() {
      return endPos;
    }

    @Override
    public int getEndPosition(EndPosTable endPosTable) {
      return endPos;
    }
  };
}
 
开发者ID:google,项目名称:error-prone,代码行数:41,代码来源:ImportStatementsTest.java

示例8: getMap

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static Map<JCTree, Integer> getMap(EndPosTable table) {
  try {
    return (Map<JCTree, Integer>) END_POS_MAP_FIELD.get(table);
  } catch (Exception e) {
    throw new LinkageError(e.getMessage());
  }
}
 
开发者ID:diy1,项目名称:error-prone-aspirator,代码行数:9,代码来源:EndPosMap8.java

示例9: fromCompilationUnit

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
public static EndPosMap8 fromCompilationUnit(JCCompilationUnit compilationUnit) {
  EndPosTable table = compilationUnit.endPositions;

  if (Util.isEmptyEndPosTable(table)) {
    return null;
  }

  if (Util.isSimpleEndPosTable(table)) {
    return new EndPosMap8(table, Util.getMap(table));
  }

  throw new IllegalStateException();
}
 
开发者ID:diy1,项目名称:error-prone-aspirator,代码行数:14,代码来源:EndPosMap8.java

示例10: replace

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
@Override
public void replace(Tree source, String newSource) {
  changed();
  finish();
  final EndPosTable endPosTable = ((JCCompilationUnit) cup).endPositions;
  final int endPos = TreeInfo.getEndPos((JCTree) source, endPosTable);
  final int startPos = TreeInfo.getStartPos((JCTree) source);
  sources.requestOverwrite(cup, startPos, endPos, newSource);
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:10,代码来源:DefaultInjectionResolver.java

示例11: CRTable

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
/** Constructor
 */
public CRTable(JCTree.JCMethodDecl tree, EndPosTable endPosTable) {
    this.methodTree = tree;
    this.endPosTable = endPosTable;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:CRTable.java

示例12: getEndPosition

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
@Override
public int getEndPosition(EndPosTable endPosTable) {
    Assert.error();
    return -1;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:DeferredLintHandler.java

示例13: getEndPosition

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
public int getEndPosition(EndPosTable endPosTable) {
    return pos;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:JCDiagnostic.java

示例14: getEndPosTable

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
public EndPosTable getEndPosTable() {
    return endPosTable;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:DiagnosticSource.java

示例15: setEndPosTable

import com.sun.tools.javac.tree.EndPosTable; //导入依赖的package包/类
public void setEndPosTable(EndPosTable t) {
    if (endPosTable != null && endPosTable != t)
        throw new IllegalStateException("endPosTable already set");
    endPosTable = t;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:DiagnosticSource.java


注:本文中的com.sun.tools.javac.tree.EndPosTable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。