@Test void testPreferredPositionForBinaryOp() throws IOException { String code = "package test; public class Test {" + "private void test() {" + "Object o = null; boolean b = o != null && o instanceof String;" + "} private Test() {}}"; CompilationUnitTree cut = getCompilationUnitTree(code); ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0); MethodTree method = (MethodTree) clazz.getMembers().get(0); VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1); BinaryTree cond = (BinaryTree) condSt.getInitializer(); JCTree condJC = (JCTree) cond; int condStartPos = code.indexOf("&&"); assertEquals("testPreferredPositionForBinaryOp", condStartPos, condJC.pos); }
@Override public void visitTry(JCTry tree) { print("try"); if (!tree.getResources().isEmpty()) { print(" ("); //XXX: space should be according to the code style! for (Iterator<? extends JCTree> it = tree.getResources().iterator(); it.hasNext();) { JCTree r = it.next(); //XXX: disabling copying of original text, as the ending ';' needs to be removed in some cases. oldTrees.remove(r); printPrecedingComments(r, false); printExpr(r, 0); printTrailingComments(r, false); if (it.hasNext()) print(";"); } print(") "); //XXX: space should be according to the code style! } printBlock(tree.body, cs.getOtherBracePlacement(), cs.spaceBeforeTryLeftBrace()); for (List < JCCatch > l = tree.catchers; l.nonEmpty(); l = l.tail) printStat(l.head); if (tree.finalizer != null) { printFinallyBlock(tree.finalizer); } }
/** * Rotate the list of dimension specifiers until all dimensions with type annotations appear in * source order. * <p> * <p>javac reorders dimension specifiers in method declarations with mixed-array notation, which * means that any type annotations don't appear in source order. * <p> * <p>For example, the type of {@code int @A [] f() @B [] {}} is parsed as {@code @B [] @A []}. * <p> * <p>This doesn't handle cases with un-annotated dimension specifiers, so the formatting logic * checks the token stream to figure out which side of the method name they appear on. */ private static Iterable<List<AnnotationTree>> reorderBySourcePosition( Deque<List<AnnotationTree>> dims) { int lastAnnotation = -1; int lastPos = -1; int idx = 0; for (List<AnnotationTree> dim : dims) { if (!dim.isEmpty()) { int pos = ((JCTree) dim.get(0)).getStartPosition(); if (pos < lastPos) { List<List<AnnotationTree>> list = new ArrayList<>(dims); Collections.rotate(list, -(lastAnnotation + 1)); return list; } lastPos = pos; lastAnnotation = idx; } idx++; } return dims; }
@Override public void visitApply(JCMethodInvocation tree) { boolean prevCheckThis = checkThis; try { Symbol meth = TreeInfo.symbol(tree.meth); Name methName = TreeInfo.name(tree.meth); if (meth != null && meth.name == names.init) { Symbol c = meth.owner; if (c.hasOuterInstance()) { checkThis = false; if (tree.meth.getTag() != JCTree.Tag.SELECT && (c.isLocal() || methName == names._this)) { checkThis(tree.meth.pos(), c.type.getEnclosingType().tsym); } } } super.visitApply(tree); } finally { checkThis = prevCheckThis; } }
@Override @DefinedBy(Api.COMPILER_TREE) public void finished(TaskEvent taskEvent) { List<AbstractCodingRulesAnalyzer> currentAnalyzers = this.analyzers.get(taskEvent.getKind()); if (currentAnalyzers != null) { TypeElement typeElem = taskEvent.getTypeElement(); Tree tree = trees.getTree(typeElem); if (tree != null) { JavaFileObject prevSource = log.currentSourceFile(); try { log.useSource(taskEvent.getCompilationUnit().getSourceFile()); for (AbstractCodingRulesAnalyzer analyzer : currentAnalyzers) { analyzer.treeVisitor.scan((JCTree)tree); } } finally { log.useSource(prevSource); } } } }
public JavacSourcePosition getSourcePosition(Element e, AnnotationMirror a) { Pair<JCTree, JCCompilationUnit> treeTop = getTreeAndTopLevel(e); if (treeTop == null) return null; JCTree tree = treeTop.fst; JCCompilationUnit toplevel = treeTop.snd; JavaFileObject sourcefile = toplevel.sourcefile; if (sourcefile == null) return null; JCTree annoTree = matchAnnoToTree(a, e, tree); if (annoTree == null) return null; return new JavacSourcePosition(sourcefile, annoTree.pos, toplevel.lineMap); }
public Element getElement(TreePath path) { JCTree tree = (JCTree) path.getLeaf(); Symbol sym = TreeInfo.symbolFor(tree); if (sym == null && TreeInfo.isDeclaration(tree)) { for (TreePath p = path; p != null; p = p.getParentPath()) { JCTree t = (JCTree) p.getLeaf(); if (t.getTag() == JCTree.CLASSDEF) { JCClassDecl ct = (JCClassDecl) t; if (ct.sym != null) { if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) { attr.attribClass(ct.pos(), ct.sym); sym = TreeInfo.symbolFor(tree); } break; } } } } return sym; }
void run(String code) throws IOException { String src = "public class Test {" + code + ";}"; JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null, null, Arrays.asList(new MyFileObject(src))); for (CompilationUnitTree cut : ct.parse()) { JCTree.JCVariableDecl var = (JCTree.JCVariableDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0); if (!code.equals(var.toString())) { System.err.println("Expected: " + code); System.err.println("Obtained: " + var.toString()); throw new RuntimeException("strings do not match!"); } } }
public JCTree getTree(Element element) { Symbol symbol = (Symbol) element; TypeSymbol enclosing = symbol.enclClass(); Env<AttrContext> env = enter.getEnv(enclosing); if (env == null) return null; JCClassDecl classNode = env.enclClass; if (classNode != null) { if (TreeInfo.symbolFor(classNode) == element) return classNode; for (JCTree node : classNode.getMembers()) if (TreeInfo.symbolFor(node) == element) return node; } return null; }
public List<int[]> gatherTreeSpans(File file, String content) throws IOException { JCCompilationUnit unit = read(file.toURI(), content); List<int[]> spans = new ArrayList<>(); new TreePathScanner<Void, Void>() { @Override public Void scan(Tree tree, Void p) { if (tree != null) { int start = ((JCTree) tree).getStartPosition(); int end = ((JCTree) tree).getEndPosition(unit.endPositions); spans.add(new int[] {start, end}); } return super.scan(tree, p); } }.scan(unit, null); return spans; }
/** * Resolves an {@link Element} from the {@link ElementHandle}. * @param compilationInfo representing the {@link javax.tools.CompilationTask} * in which the {@link Element} should be resolved. * @return resolved subclass of {@link Element} or null if the elment does not exist on * the classpath/sourcepath of {@link javax.tools.CompilationTask}. */ @SuppressWarnings ("unchecked") // NOI18N public @CheckForNull T resolve (@NonNull final CompilationInfo compilationInfo) { Parameters.notNull("compilationInfo", compilationInfo); // NOI18N ModuleElement module = compilationInfo.getFileObject() != null ? ((JCTree.JCCompilationUnit)compilationInfo.getCompilationUnit()).modle : null; T result = resolveImpl (module, compilationInfo.impl.getJavacTask()); if (result == null) { if (log.isLoggable(Level.INFO)) log.log(Level.INFO, "Cannot resolve: {0}", toString()); //NOI18N } else { if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Resolved element = {0}", result); } return result; }
private JCTree.JCClassDecl getClassDecl( Model model ) { JCTree.JCClassDecl classDecl = model.getClassDecl(); if( classDecl != null ) { return classDecl; } List<CompilationUnitTree> trees = new ArrayList<>(); JavaParser.instance().parseText( getSource( model ), trees, null, null, null ); if( trees.isEmpty() ) { return null; } classDecl = (JCTree.JCClassDecl)trees.get( 0 ).getTypeDecls().get( 0 ); model.setClassDecl( classDecl ); return classDecl; }
@Override public void visitLambda( JCTree.JCLambda tree ) { super.visitLambda( tree ); if( _tp.isGenerate() && !shouldProcessForGeneration() ) { // Don't process tree during GENERATE, unless the tree was generated e.g., a bridge method return; } tree.type = eraseStructureType( tree.type ); ArrayList<Type> types = new ArrayList<>(); for( Type target : tree.targets ) { types.add( eraseStructureType( target ) ); } tree.targets = List.from( types ); }
void run() throws Exception { Context context = new Context(); JavacFileManager.preRegister(context); Trees trees = JavacTrees.instance(context); StringWriter strOut = new StringWriter(); PrintWriter pw = new PrintWriter(strOut); DPrinter dprinter = new DPrinter(pw, trees); final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); JavacTask ct = (JavacTask)tool.getTask(null, null, null, null, null, Arrays.asList(new JavaSource())); Iterable<? extends CompilationUnitTree> elements = ct.parse(); ct.analyze(); Assert.check(elements.iterator().hasNext()); dprinter.treeTypes(true).printTree("", (JCTree)elements.iterator().next()); String output = strOut.toString(); Assert.check(!output.contains("java.lang.Object"), "there shouldn't be any type instantiated to Object"); }
@CheckForNull private static String getResourceName (@NullAllowed final CompilationUnitTree cu) { if (cu instanceof JCTree.JCCompilationUnit) { JavaFileObject jfo = ((JCTree.JCCompilationUnit)cu).sourcefile; if (jfo != null) { URI uri = jfo.toUri(); if (uri != null && uri.isAbsolute()) { try { FileObject fo = URLMapper.findFileObject(uri.toURL()); if (fo != null) { ClassPath cp = ClassPath.getClassPath(fo,ClassPath.SOURCE); if (cp != null) { return cp.getResourceName(fo,'.',false); } } } catch (MalformedURLException e) { Exceptions.printStackTrace(e); } } } } return null; }
/** * This form contains a special hack for if, so that `else' can be placed on the same * line as the statement block end. * If a block statement is generated instead of a single stat, a newline is appended unless `retainNewline' * is false. If statement print passes false when else part of the if is present. * * @param oldT old tree * @param newT new tree * @param elementBounds the old element bounds * @param parentKind parent statement's kind * @param retainNewline retain newline if block is generated * @return localpointer value */ private int diffTree(JCTree oldT, JCTree newT, int[] elementBounds, Kind parentKind, boolean retainNewline) { if (oldT.getKind() != newT.getKind() && newT.getKind() == Kind.BLOCK) { tokenSequence.move(getOldPos(oldT)); moveToSrcRelevant(tokenSequence, Direction.BACKWARD); tokenSequence.moveNext(); if (elementBounds[0] < tokenSequence.offset()) copyTo(elementBounds[0], tokenSequence.offset()); printer.printBlock(oldT, newT, parentKind); // ensure there's a newline if the replaced command ended with one. int localpointer = getCommentCorrectedEndPos(oldT); if (retainNewline && localpointer > 0 && origText.charAt(localpointer - 1) == '\n') { // NOI18N printer.newline(); } return localpointer; } else { // next statement can to seem redundant, but is not, see 117774 copyTo(elementBounds[0], elementBounds[0] = getCommentCorrectedBounds(oldT)[0]); return diffTree(oldT, newT, elementBounds); } }
Type cachedCapture(JCTree tree, Type t, boolean readOnly) { Type captured = captureTypeCache.get(tree); if (captured != null) { return captured; } Type result = types.capture(t); if (result != t && !readOnly) { // then t is a wildcard parameterized type captureTypeCache.put(tree, result); } return result; }
void testElement(Trees trees, Element e) { trees.getClass(); e.getClass(); System.err.println("testElement: " + e); Tree tree = trees.getTree(e); //System.err.println(tree); if (TreeInfo.symbolFor((JCTree)tree) != e) error("bad result from getTree"); TreePath path = trees.getPath(e); if (path == null) { error("getPath returned null"); return; } if (path.getLeaf() != tree) error("bad result from getPath"); Element e2 = trees.getElement(path); if (e2 == null) { error("getElement returned null"); return; } if (e2 != e) error("bad result from getElement"); // The TypeMirror is not available yet when annotation processing; // it is set up later during ANALYSE. TypeMirror t = trees.getTypeMirror(path); if (t != null && t.getKind() == TypeKind.DECLARED && ((DeclaredType)t).asElement() != e2) error("bad result from getTypeMirror"); for (AnnotationMirror m: e.getAnnotationMirrors()) { testAnnotation(trees, e, m); } }
public ReferenceTree Reference(ExpressionTree qualExpr, CharSequence member, List<? extends Tree> paramTypes) { com.sun.tools.javac.util.List<JCTree> paramTypesList = null; if (paramTypes != null) { ListBuffer<JCTree> lbl = new ListBuffer<>(); for (Tree t : paramTypes) { lbl.append((JCTree) t); } paramTypesList = lbl.toList(); } return docMake.at(NOPOS).newReferenceTree("", (JCExpression) qualExpr, member != null ? (Name) names.fromString(member.toString()) : null, paramTypesList); }
public String getDocComment(Element e) { // Our doc comment is contained in a map in our toplevel, // indexed by our tree. Find our enter environment, which gives // us our toplevel. It also gives us a tree that contains our // tree: walk it to find our tree. This is painful. Pair<JCTree, JCCompilationUnit> treeTop = getTreeAndTopLevel(e); if (treeTop == null) return null; JCTree tree = treeTop.fst; JCCompilationUnit toplevel = treeTop.snd; if (toplevel.docComments == null) return null; return toplevel.docComments.get(tree); }
public void printMethodSelect(JCMethodInvocation tree) { if (tree.meth.getTag() == JCTree.Tag.SELECT) { JCFieldAccess left = (JCFieldAccess)tree.meth; printExpr(left.selected); boolean wrapAfterDot = cs.wrapAfterDotInChainedMethodCalls(); if (wrapAfterDot) print('.'); if (left.selected.getTag() == JCTree.Tag.APPLY) { switch(cs.wrapChainedMethodCalls()) { case WRAP_IF_LONG: int rm = cs.getRightMargin(); int estWidth = left.name.length(); if (tree.typeargs.nonEmpty()) estWidth += widthEstimator.estimateWidth(tree.typeargs, rm - out.col - estWidth) + 2; estWidth += widthEstimator.estimateWidth(tree.args, rm - out.col - estWidth) + 2; if (estWidth + out.col <= rm) break; case WRAP_ALWAYS: newline(); toColExactly(out.leftMargin + cs.getContinuationIndentSize()); break; } } if (!wrapAfterDot) print('.'); if (tree.typeargs.nonEmpty()) printTypeArguments(tree.typeargs); print(left.name); } else { if (tree.typeargs.nonEmpty()) printTypeArguments(tree.typeargs); printExpr(tree.meth); } }
private Env<AttrContext> attribStatToTree(JCTree stat, Env<AttrContext>env, JCTree tree) { JavaFileObject prev = log.useSource(env.toplevel.sourcefile); try { return attr.attribStatToTree(stat, env, tree); } finally { log.useSource(prev); } }
@Override public void visitBinary(JCBinary tree) { int ownprec = TreeInfo.opPrec(tree.getTag()); Name opname = operators.operatorName(tree.getTag()); int col = out.col; printExpr(tree.lhs, ownprec); if(cs.spaceAroundBinaryOps()) print(' '); print(opname); boolean needsSpace = cs.spaceAroundBinaryOps() || (tree.getTag() == JCTree.Tag.PLUS && (tree.rhs.getTag() == JCTree.Tag.POS || tree.rhs.getTag() == JCTree.Tag.PREINC)) || (tree.getTag() == JCTree.Tag.MINUS && (tree.rhs.getTag() == JCTree.Tag.NEG || tree.rhs.getTag() == JCTree.Tag.PREDEC)); int rm = cs.getRightMargin(); switch(cs.wrapBinaryOps()) { case WRAP_IF_LONG: if (widthEstimator.estimateWidth(tree.rhs, rm - out.col) + out.col <= cs.getRightMargin()) { if(needsSpace) print(' '); break; } case WRAP_ALWAYS: newline(); toColExactly(cs.alignMultilineBinaryOp() ? col : out.leftMargin + cs.getContinuationIndentSize()); break; case WRAP_NEVER: if(needsSpace) print(' '); break; } printExpr(tree.rhs, ownprec + 1); }
private boolean checkPathAndPackage(Path dir, JCTree pkgName) { Iterator<String> pathIter = new ParentIterator(dir); Iterator<String> pkgIter = new EnclosingPkgIterator(pkgName); while (pathIter.hasNext() && pkgIter.hasNext()) { if (!pathIter.next().equals(pkgIter.next())) return false; } return !pkgIter.hasNext(); /*&& !pathIter.hasNext() See JDK-8059598 */ }
AnalysisContext(JCTree tree, Env<AttrContext> env) { this.tree = tree; this.env = attr.copyEnv(env); /* this is a temporary workaround that should be removed once we have a truly independent * clone operation */ if (tree.hasTag(VARDEF)) { // avoid redefinition clashes this.env.info.scope.remove(((JCVariableDecl)tree).sym); } }
/** * Returns the tree node and compilation unit corresponding to this * element, or null if they can't be found. */ private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) { Symbol sym = cast(Symbol.class, e); Env<AttrContext> enterEnv = getEnterEnv(sym); if (enterEnv == null) return null; JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree); if (tree == null || enterEnv.toplevel == null) return null; return new Pair<>(tree, enterEnv.toplevel); }
private static TypeMirror attributeTree(JavacTaskImpl jti, Tree tree, Scope scope, final List<Diagnostic<? extends JavaFileObject>> errors, @NullAllowed final Diagnostic.Kind filter) { Log log = Log.instance(jti.getContext()); JavaFileObject prev = log.useSource(new DummyJFO()); Enter enter = Enter.instance(jti.getContext()); Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(log) { private Diagnostic.Kind f = filter == null ? Diagnostic.Kind.ERROR : filter; @Override public void report(JCDiagnostic diag) { if (diag.getKind().compareTo(f) >= 0) { errors.add(diag); } } }; // ArgumentAttr argumentAttr = ArgumentAttr.instance(jti.getContext()); // ArgumentAttr.LocalCacheContext cacheContext = argumentAttr.withLocalCacheContext(); try { // enter.shadowTypeEnvs(true); Attr attr = Attr.instance(jti.getContext()); Env<AttrContext> env = ((JavacScope) scope).getEnv(); if (tree instanceof JCTree.JCExpression) { return attr.attribExpr((JCTree) tree,env, Type.noType); } return attr.attribStat((JCTree) tree,env); } finally { // cacheContext.leave(); log.useSource(prev); log.popDiagnosticHandler(discardHandler); // enter.shadowTypeEnvs(false); } }
public JCBlock reparseMethodBody(CompilationUnitTree topLevel, MethodTree methodToReparse, String newBodyText, int annonIndex, final Map<? super JCTree,? super LazyDocCommentTable.Entry> docComments) { CharBuffer buf = CharBuffer.wrap((newBodyText+"\u0000").toCharArray(), 0, newBodyText.length()); JavacParser parser = newParser(context, buf, ((JCBlock)methodToReparse.getBody()).pos, ((JCCompilationUnit)topLevel).endPositions); final JCStatement statement = parser.parseStatement(); NBParserFactory.assignAnonymousClassIndices(Names.instance(context), statement, Names.instance(context).empty, annonIndex); if (statement.getKind() == Tree.Kind.BLOCK) { if (docComments != null) { docComments.putAll(((LazyDocCommentTable) parser.getDocComments()).table); } return (JCBlock) statement; } return null; }
@Override protected JCTree methodDeclaratorRest(int pos, JCModifiers mods, JCExpression type, Name name, List<JCTypeParameter> typarams, boolean isInterface, boolean isVoid, Comment dc) { if (cancelService != null) { cancelService.abortIfCanceled(); } return super.methodDeclaratorRest(pos, mods, type, name, typarams, isInterface, isVoid, dc); }
private void printIndentedStat(JCTree tree, BracesGenerationStyle redundantBraces, boolean spaceBeforeLeftBrace, WrapStyle wrapStat) { if (fromOffset >= 0 && toOffset >= 0 && (TreeInfo.getStartPos(tree) < fromOffset || TreeInfo.getEndPos(tree, diffContext.origUnit.endPositions) > toOffset)) redundantBraces = BracesGenerationStyle.LEAVE_ALONE; switch(redundantBraces) { case GENERATE: printBlock(tree, cs.getOtherBracePlacement(), spaceBeforeLeftBrace); return; case ELIMINATE: while(tree instanceof JCBlock) { List<JCStatement> t = ((JCBlock) tree).stats; if(t.isEmpty() || t.tail.nonEmpty()) break; if (t.head instanceof JCVariableDecl) // bogus code has a variable declaration -- leave alone. break; printPrecedingComments(tree, true); tree = t.head; } case LEAVE_ALONE: if (tree instanceof JCBlock) { printBlock(tree, cs.getOtherBracePlacement(), spaceBeforeLeftBrace); return; } final int old = indent(); final JCTree toPrint = tree; wrapTree(wrapStat, spaceBeforeLeftBrace, out.leftMargin, new Runnable() { @Override public void run() { printStat(toPrint); undent(old); } }); } }
/** * Returns the tree for an annotation given a list of annotations * in which to search (recursively) and their corresponding trees. * Returns null if the tree cannot be found. */ private JCTree matchAnnoToTree(Attribute.Compound findme, List<Attribute.Compound> annos, List<JCAnnotation> trees) { for (Attribute.Compound anno : annos) { for (JCAnnotation tree : trees) { JCTree match = matchAnnoToTree(findme, anno, tree); if (match != null) return match; } } return null; }
Info(JCTree tree, EndPosTable endPosTable) { this.tree = tree; tag = tree.getTag(); start = TreeInfo.getStartPos(tree); pos = tree.pos; end = TreeInfo.getEndPos(tree, endPosTable); }
JCTree parseType(String s) throws ParseException { JavacParser p = fac.newParser(s, false, false, false); JCTree tree = p.parseType(); if (p.token().kind != TokenKind.EOF) throw new ParseException("dc.ref.unexpected.input"); return tree; }
private void printPrecedingComments(JCTree tree, boolean printWhitespace) { if (!precedingCommentsHandled.add(tree)) { return; } CommentSet commentSet = commentHandler.getComments(tree); java.util.List<Comment> pc = commentSet.getComments(CommentSet.RelativePosition.PRECEDING); DocCommentTree doc = tree2Doc.get(tree); if (!pc.isEmpty()) { Comment javadoc = null; for (Comment comment : pc) { if(comment.style() == Style.JAVADOC) { javadoc = comment; } } for (Comment c : pc) { if(doc != null && c == javadoc) { print((DCTree)doc); doc = null; } else { printComment(c, true, printWhitespace); } } } if(doc!=null) { print((DCTree)doc); } }
private void printInnerCommentsAsTrailing(JCTree tree, boolean printWhitespace) { if (innerCommentsHandled.contains(tree)) return ; CommentSet commentSet = commentHandler.getComments(tree); java.util.List<Comment> cl = commentSet.getComments(CommentSet.RelativePosition.INNER); innerCommentsHandled.add(tree); for (Comment comment : cl) { printComment(comment, true, printWhitespace); } }
@Override public void visitClassDef(JCTree.JCClassDecl jcClassDecl) { for (JCTree tree : jcClassDecl.defs) { if (tree instanceof ClassTree) { ClassTree classTree = (ClassTree) tree; String className = classTree.getSimpleName().toString(); if (supportedTypes.contains(className)) { ClassName rClassName = ClassName.get(rPackageName, "R", className); VarScanner scanner = new VarScanner(ids, rClassName, respectivePackageName); ((JCTree) classTree).accept(scanner); } } } }
public void testForLoop() throws IOException { List files = Arrays.asList(new JavaSource("")); JavacTool tool = JavacTool.create(); try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { JavacTask task = tool.getTask(null, fm, null, null, null, files); Iterable trees = task.parse(); CompilationUnitTree thisTree = (CompilationUnitTree)trees.iterator().next(); String thisSrc = prettyPrint((JCTree) thisTree); Assert.check(thisSrc.equals(JavaSource.source)); } }
/** Record all tree nodes found by scanner. */ @Override public void scan(JCTree tree) { if (tree == null) return; //System.err.println("FOUND: " + tree.getTag() + " " + trim(tree, 64)); found.add(tree); super.scan(tree); }
private JCTree.JCStatement buildBootstrapStaticBlock() { TreeMaker make = _javacJacker.getTreeMaker(); JavacElements javacElems = _javacJacker.getJavacElements(); JCTree.JCMethodInvocation bootstrapInitCall = make.Apply( List.nil(), memberAccess( make, javacElems, Bootstrap.class.getName() + ".init" ), List.nil() ); return make.Block( Modifier.STATIC, List.of( make.Exec( bootstrapInitCall ) ) ); }