boolean merge(ListBuffer<JCLiteral> litBuf, ListBuffer<JCExpression> opStack) { if (litBuf.isEmpty()) { return false; } else if (litBuf.size() == 1) { opStack.prepend(litBuf.first()); return false; } else { StringBuilder sb = new StringBuilder(); for (JCLiteral lit : litBuf) { sb.append(lit.getValue()); } JCExpression t = F.at(litBuf.first().getStartPosition()).Literal(TypeTag.CLASS, sb.toString()); storeEnd(t, litBuf.last().getEndPosition(endPosTable)); opStack.prepend(t); return true; } }
f.run(genList, classes); if (genList.isEmpty()) { compiler.reportDeferredDiagnostics(); cleanup();
f.run(genList, classes); if (genList.isEmpty()) { compiler.reportDeferredDiagnostics(); cleanup();
public void visitMethodDef(JCMethodDecl tree) { if (tree.body == null) return; Lint lintPrev = lint; lint = lint.augment(tree.sym); Assert.check(pendingExits.isEmpty()); try { alive = true; scanStat(tree.body); if (alive && !tree.sym.type.getReturnType().hasTag(VOID)) log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt"); List<PendingExit> exits = pendingExits.toList(); pendingExits = new ListBuffer<PendingExit>(); while (exits.nonEmpty()) { PendingExit exit = exits.head; exits = exits.tail; Assert.check(exit.tree.hasTag(RETURN)); } } finally { lint = lintPrev; } }
public void visitMethodDef(JCMethodDecl tree) { if (tree.body == null) return; Lint lintPrev = lint; lint = lint.augment(tree.sym); Assert.check(pendingExits.isEmpty()); try { alive = true; scanStat(tree.body); if (alive && !tree.sym.type.getReturnType().hasTag(VOID)) log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt"); List<PendingExit> exits = pendingExits.toList(); pendingExits = new ListBuffer<>(); while (exits.nonEmpty()) { PendingExit exit = exits.head; exits = exits.tail; Assert.check(exit.tree.hasTag(RETURN)); } } finally { lint = lintPrev; } }
f.run(genList, classes); if (genList.isEmpty()) { compiler.reportDeferredDiagnostics(); compiler.log.flush();
f.run(genList, classes); if (genList.isEmpty()) { compiler.reportDeferredDiagnostics(); compiler.log.flush();
private Type rewriteSupers(Type t) { if (!t.isParameterized()) return t; ListBuffer<Type> from = lb(); ListBuffer<Type> to = lb(); adaptSelf(t, from, to); if (from.isEmpty()) return t; ListBuffer<Type> rewrite = lb(); boolean changed = false; for (Type orig : to.toList()) { Type s = rewriteSupers(orig); if (s.isSuperBound() && !s.isExtendsBound()) { s = new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass); changed = true; } else if (s != orig) { s = new WildcardType(upperBound(s), BoundKind.EXTENDS, syms.boundClass); changed = true; } rewrite.append(s); } if (changed) return subst(t.tsym.type, from.toList(), rewrite.toList()); else return t; }
private Type rewriteSupers(Type t) { if (!t.isParameterized()) return t; ListBuffer<Type> from = lb(); ListBuffer<Type> to = lb(); adaptSelf(t, from, to); if (from.isEmpty()) return t; ListBuffer<Type> rewrite = lb(); boolean changed = false; for (Type orig : to.toList()) { Type s = rewriteSupers(orig); if (s.isSuperBound() && !s.isExtendsBound()) { s = new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass); changed = true; } else if (s != orig) { s = new WildcardType(upperBound(s), BoundKind.EXTENDS, syms.boundClass); changed = true; } rewrite.append(s); } if (changed) return subst(t.tsym.type, from.toList(), rewrite.toList()); else return t; }
private Type rewriteSupers(Type t) { if (!t.isParameterized()) return t; ListBuffer<Type> from = new ListBuffer<>(); ListBuffer<Type> to = new ListBuffer<>(); adaptSelf(t, from, to); if (from.isEmpty()) return t; ListBuffer<Type> rewrite = new ListBuffer<>(); boolean changed = false; for (Type orig : to.toList()) { Type s = rewriteSupers(orig); if (s.isSuperBound() && !s.isExtendsBound()) { s = new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass); changed = true; } else if (s != orig) { s = new WildcardType(upperBound(s), BoundKind.EXTENDS, syms.boundClass); changed = true; } rewrite.append(s); } if (changed) return subst(t.tsym.type, from.toList(), rewrite.toList()); else return t; }
private Type rewriteSupers(Type t) { if (!t.isParameterized()) return t; ListBuffer<Type> from = new ListBuffer<>(); ListBuffer<Type> to = new ListBuffer<>(); adaptSelf(t, from, to); if (from.isEmpty()) return t; ListBuffer<Type> rewrite = new ListBuffer<>(); boolean changed = false; for (Type orig : to.toList()) { Type s = rewriteSupers(orig); if (s.isSuperBound() && !s.isExtendsBound()) { s = new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass); changed = true; } else if (s != orig) { s = new WildcardType(wildUpperBound(s), BoundKind.EXTENDS, syms.boundClass); changed = true; } rewrite.append(s); } if (changed) return subst(t.tsym.type, from.toList(), rewrite.toList()); else return t; }
Assert.check(pendingExits.isEmpty());
Assert.check(pendingExits.isEmpty());
if (!consumedToplevelDoc) attach(toplevel, firstToken.comment(CommentStyle.JAVADOC)); if (defs.isEmpty()) storeEnd(toplevel, S.prevToken().endPos); if (keepDocComments)
assert pendingExits.isEmpty();