id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
5,700
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
ClassUseWriter.getNavLinkClass
protected Content getNavLinkClass() { Content linkContent = getLink(new LinkInfoImpl( configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc) .label(configuration.getText("doclet.Class"))); Content li = HtmlTree.LI(linkContent); return li; }
java
protected Content getNavLinkClass() { Content linkContent = getLink(new LinkInfoImpl( configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc) .label(configuration.getText("doclet.Class"))); Content li = HtmlTree.LI(linkContent); return li; }
[ "protected", "Content", "getNavLinkClass", "(", ")", "{", "Content", "linkContent", "=", "getLink", "(", "new", "LinkInfoImpl", "(", "configuration", ",", "LinkInfoImpl", ".", "Kind", ".", "CLASS_USE_HEADER", ",", "classdoc", ")", ".", "label", "(", "configuration", ".", "getText", "(", "\"doclet.Class\"", ")", ")", ")", ";", "Content", "li", "=", "HtmlTree", ".", "LI", "(", "linkContent", ")", ";", "return", "li", ";", "}" ]
Get class page link. @return a content tree for the class page link
[ "Get", "class", "page", "link", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java#L520-L526
5,701
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java
ClassBuilder.getInstance
public static ClassBuilder getInstance(Context context, TypeElement typeElement, ClassWriter writer) { return new ClassBuilder(context, typeElement, writer); }
java
public static ClassBuilder getInstance(Context context, TypeElement typeElement, ClassWriter writer) { return new ClassBuilder(context, typeElement, writer); }
[ "public", "static", "ClassBuilder", "getInstance", "(", "Context", "context", ",", "TypeElement", "typeElement", ",", "ClassWriter", "writer", ")", "{", "return", "new", "ClassBuilder", "(", "context", ",", "typeElement", ",", "writer", ")", ";", "}" ]
Constructs a new ClassBuilder. @param context the build context @param typeElement the class being documented. @param writer the doclet specific writer. @return the new ClassBuilder
[ "Constructs", "a", "new", "ClassBuilder", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java#L115-L118
5,702
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java
ClassBuilder.copyDocFiles
private void copyDocFiles() throws DocFileIOException { PackageElement containingPackage = utils.containingPackage(typeElement); if((configuration.packages == null || !configuration.packages.contains(containingPackage)) && !containingPackagesSeen.contains(containingPackage)) { //Only copy doc files dir if the containing package is not //documented AND if we have not documented a class from the same //package already. Otherwise, we are making duplicate copies. utils.copyDocFiles(containingPackage); containingPackagesSeen.add(containingPackage); } }
java
private void copyDocFiles() throws DocFileIOException { PackageElement containingPackage = utils.containingPackage(typeElement); if((configuration.packages == null || !configuration.packages.contains(containingPackage)) && !containingPackagesSeen.contains(containingPackage)) { //Only copy doc files dir if the containing package is not //documented AND if we have not documented a class from the same //package already. Otherwise, we are making duplicate copies. utils.copyDocFiles(containingPackage); containingPackagesSeen.add(containingPackage); } }
[ "private", "void", "copyDocFiles", "(", ")", "throws", "DocFileIOException", "{", "PackageElement", "containingPackage", "=", "utils", ".", "containingPackage", "(", "typeElement", ")", ";", "if", "(", "(", "configuration", ".", "packages", "==", "null", "||", "!", "configuration", ".", "packages", ".", "contains", "(", "containingPackage", ")", ")", "&&", "!", "containingPackagesSeen", ".", "contains", "(", "containingPackage", ")", ")", "{", "//Only copy doc files dir if the containing package is not", "//documented AND if we have not documented a class from the same", "//package already. Otherwise, we are making duplicate copies.", "utils", ".", "copyDocFiles", "(", "containingPackage", ")", ";", "containingPackagesSeen", ".", "add", "(", "containingPackage", ")", ";", "}", "}" ]
Copy the doc files. @throws DocFileIOException if there is a problem while copying the files
[ "Copy", "the", "doc", "files", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java#L280-L291
5,703
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Pretty.java
Pretty.parms
static String parms(String types) { int[] pos = new int[] { 0 }; StringBuilder sb = new StringBuilder(); boolean first = true; String t; while ((t = desc(types, pos)) != null) { if (first) { first = false; } else { sb.append(','); } sb.append(t); } return sb.toString(); }
java
static String parms(String types) { int[] pos = new int[] { 0 }; StringBuilder sb = new StringBuilder(); boolean first = true; String t; while ((t = desc(types, pos)) != null) { if (first) { first = false; } else { sb.append(','); } sb.append(t); } return sb.toString(); }
[ "static", "String", "parms", "(", "String", "types", ")", "{", "int", "[", "]", "pos", "=", "new", "int", "[", "]", "{", "0", "}", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "boolean", "first", "=", "true", ";", "String", "t", ";", "while", "(", "(", "t", "=", "desc", "(", "types", ",", "pos", ")", ")", "!=", "null", ")", "{", "if", "(", "first", ")", "{", "first", "=", "false", ";", "}", "else", "{", "sb", ".", "append", "(", "'", "'", ")", ";", "}", "sb", ".", "append", "(", "t", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Converts a series of type descriptors into a comma-separated, readable string. This is used for the parameter types of a method descriptor. @param types the parameter types @return the readable string
[ "Converts", "a", "series", "of", "type", "descriptors", "into", "a", "comma", "-", "separated", "readable", "string", ".", "This", "is", "used", "for", "the", "parameter", "types", "of", "a", "method", "descriptor", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Pretty.java#L180-L198
5,704
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Pretty.java
Pretty.print
public static String print(DeprData dd) { StringBuilder sb = new StringBuilder(); sb.append(depr(dd.since, dd.forRemoval)) .append(' '); switch (dd.kind) { case ANNOTATION_TYPE: sb.append("@interface "); sb.append(unslashify(dd.typeName)); break; case CLASS: sb.append("class "); sb.append(unslashify(dd.typeName)); break; case ENUM: sb.append("enum "); sb.append(unslashify(dd.typeName)); break; case INTERFACE: sb.append("interface "); sb.append(unslashify(dd.typeName)); break; case ENUM_CONSTANT: case FIELD: sb.append(unslashify(dd.typeName)) .append('.') .append(dd.nameSig); break; case CONSTRUCTOR: Matcher cons = DESC_PAT.matcher(dd.nameSig); sb.append(unslashify(dd.typeName)); if (cons.matches()) { sb.append('(') .append(parms(cons.group("args"))) .append(')'); } else { sb.append('.') .append(dd.nameSig); } break; case METHOD: Matcher meth = DESC_PAT.matcher(dd.nameSig); if (meth.matches()) { sb.append(desc(meth.group("return"))) .append(' ') .append(unslashify(dd.typeName)) .append('.') .append(meth.group("name")) .append('(') .append(parms(meth.group("args"))) .append(')'); } else { sb.append(unslashify(dd.typeName)) .append('.') .append(dd.nameSig); } break; } return sb.toString(); }
java
public static String print(DeprData dd) { StringBuilder sb = new StringBuilder(); sb.append(depr(dd.since, dd.forRemoval)) .append(' '); switch (dd.kind) { case ANNOTATION_TYPE: sb.append("@interface "); sb.append(unslashify(dd.typeName)); break; case CLASS: sb.append("class "); sb.append(unslashify(dd.typeName)); break; case ENUM: sb.append("enum "); sb.append(unslashify(dd.typeName)); break; case INTERFACE: sb.append("interface "); sb.append(unslashify(dd.typeName)); break; case ENUM_CONSTANT: case FIELD: sb.append(unslashify(dd.typeName)) .append('.') .append(dd.nameSig); break; case CONSTRUCTOR: Matcher cons = DESC_PAT.matcher(dd.nameSig); sb.append(unslashify(dd.typeName)); if (cons.matches()) { sb.append('(') .append(parms(cons.group("args"))) .append(')'); } else { sb.append('.') .append(dd.nameSig); } break; case METHOD: Matcher meth = DESC_PAT.matcher(dd.nameSig); if (meth.matches()) { sb.append(desc(meth.group("return"))) .append(' ') .append(unslashify(dd.typeName)) .append('.') .append(meth.group("name")) .append('(') .append(parms(meth.group("args"))) .append(')'); } else { sb.append(unslashify(dd.typeName)) .append('.') .append(dd.nameSig); } break; } return sb.toString(); }
[ "public", "static", "String", "print", "(", "DeprData", "dd", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "depr", "(", "dd", ".", "since", ",", "dd", ".", "forRemoval", ")", ")", ".", "append", "(", "'", "'", ")", ";", "switch", "(", "dd", ".", "kind", ")", "{", "case", "ANNOTATION_TYPE", ":", "sb", ".", "append", "(", "\"@interface \"", ")", ";", "sb", ".", "append", "(", "unslashify", "(", "dd", ".", "typeName", ")", ")", ";", "break", ";", "case", "CLASS", ":", "sb", ".", "append", "(", "\"class \"", ")", ";", "sb", ".", "append", "(", "unslashify", "(", "dd", ".", "typeName", ")", ")", ";", "break", ";", "case", "ENUM", ":", "sb", ".", "append", "(", "\"enum \"", ")", ";", "sb", ".", "append", "(", "unslashify", "(", "dd", ".", "typeName", ")", ")", ";", "break", ";", "case", "INTERFACE", ":", "sb", ".", "append", "(", "\"interface \"", ")", ";", "sb", ".", "append", "(", "unslashify", "(", "dd", ".", "typeName", ")", ")", ";", "break", ";", "case", "ENUM_CONSTANT", ":", "case", "FIELD", ":", "sb", ".", "append", "(", "unslashify", "(", "dd", ".", "typeName", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "dd", ".", "nameSig", ")", ";", "break", ";", "case", "CONSTRUCTOR", ":", "Matcher", "cons", "=", "DESC_PAT", ".", "matcher", "(", "dd", ".", "nameSig", ")", ";", "sb", ".", "append", "(", "unslashify", "(", "dd", ".", "typeName", ")", ")", ";", "if", "(", "cons", ".", "matches", "(", ")", ")", "{", "sb", ".", "append", "(", "'", "'", ")", ".", "append", "(", "parms", "(", "cons", ".", "group", "(", "\"args\"", ")", ")", ")", ".", "append", "(", "'", "'", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "'", "'", ")", ".", "append", "(", "dd", ".", "nameSig", ")", ";", "}", "break", ";", "case", "METHOD", ":", "Matcher", "meth", "=", "DESC_PAT", ".", "matcher", "(", "dd", ".", "nameSig", ")", ";", "if", "(", "meth", ".", "matches", "(", ")", ")", "{", "sb", ".", "append", "(", "desc", "(", "meth", ".", "group", "(", "\"return\"", ")", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "unslashify", "(", "dd", ".", "typeName", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "meth", ".", "group", "(", "\"name\"", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "parms", "(", "meth", ".", "group", "(", "\"args\"", ")", ")", ")", ".", "append", "(", "'", "'", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "unslashify", "(", "dd", ".", "typeName", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "dd", ".", "nameSig", ")", ";", "}", "break", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Pretty-prints the data contained in the given DeprData object. @param dd the deprecation data object @return the formatted string
[ "Pretty", "-", "prints", "the", "data", "contained", "in", "the", "given", "DeprData", "object", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Pretty.java#L212-L273
5,705
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java
Startup.show
String show(boolean isRetained) { String cmd = "/set start " + (isRetained ? "-retain " : ""); if (isDefault()) { return cmd + "-default\n"; } else if (isEmpty()) { return cmd + "-none\n"; } else { return entries.stream() .map(sue -> sue.name) .collect(joining(" ", cmd, "\n")); } }
java
String show(boolean isRetained) { String cmd = "/set start " + (isRetained ? "-retain " : ""); if (isDefault()) { return cmd + "-default\n"; } else if (isEmpty()) { return cmd + "-none\n"; } else { return entries.stream() .map(sue -> sue.name) .collect(joining(" ", cmd, "\n")); } }
[ "String", "show", "(", "boolean", "isRetained", ")", "{", "String", "cmd", "=", "\"/set start \"", "+", "(", "isRetained", "?", "\"-retain \"", ":", "\"\"", ")", ";", "if", "(", "isDefault", "(", ")", ")", "{", "return", "cmd", "+", "\"-default\\n\"", ";", "}", "else", "if", "(", "isEmpty", "(", ")", ")", "{", "return", "cmd", "+", "\"-none\\n\"", ";", "}", "else", "{", "return", "entries", ".", "stream", "(", ")", ".", "map", "(", "sue", "->", "sue", ".", "name", ")", ".", "collect", "(", "joining", "(", "\" \"", ",", "cmd", ",", "\"\\n\"", ")", ")", ";", "}", "}" ]
show commands to re-create
[ "show", "commands", "to", "re", "-", "create" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java#L185-L196
5,706
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java
Startup.readFile
private static StartupEntry readFile(String filename, String context, MessageHandler mh) { if (filename != null) { try { byte[] encoded = Files.readAllBytes(toPathResolvingUserHome(filename)); return new StartupEntry(false, filename, new String(encoded), LocalDateTime.now().format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM))); } catch (AccessDeniedException e) { mh.errormsg("jshell.err.file.not.accessible", context, filename, e.getMessage()); } catch (NoSuchFileException e) { String resource = getResource(filename); if (resource != null) { // Not found as file, but found as resource return new StartupEntry(true, filename, resource); } mh.errormsg("jshell.err.file.not.found", context, filename); } catch (Exception e) { mh.errormsg("jshell.err.file.exception", context, filename, e); } } else { mh.errormsg("jshell.err.file.filename", context); } return null; }
java
private static StartupEntry readFile(String filename, String context, MessageHandler mh) { if (filename != null) { try { byte[] encoded = Files.readAllBytes(toPathResolvingUserHome(filename)); return new StartupEntry(false, filename, new String(encoded), LocalDateTime.now().format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM))); } catch (AccessDeniedException e) { mh.errormsg("jshell.err.file.not.accessible", context, filename, e.getMessage()); } catch (NoSuchFileException e) { String resource = getResource(filename); if (resource != null) { // Not found as file, but found as resource return new StartupEntry(true, filename, resource); } mh.errormsg("jshell.err.file.not.found", context, filename); } catch (Exception e) { mh.errormsg("jshell.err.file.exception", context, filename, e); } } else { mh.errormsg("jshell.err.file.filename", context); } return null; }
[ "private", "static", "StartupEntry", "readFile", "(", "String", "filename", ",", "String", "context", ",", "MessageHandler", "mh", ")", "{", "if", "(", "filename", "!=", "null", ")", "{", "try", "{", "byte", "[", "]", "encoded", "=", "Files", ".", "readAllBytes", "(", "toPathResolvingUserHome", "(", "filename", ")", ")", ";", "return", "new", "StartupEntry", "(", "false", ",", "filename", ",", "new", "String", "(", "encoded", ")", ",", "LocalDateTime", ".", "now", "(", ")", ".", "format", "(", "DateTimeFormatter", ".", "ofLocalizedDateTime", "(", "FormatStyle", ".", "MEDIUM", ")", ")", ")", ";", "}", "catch", "(", "AccessDeniedException", "e", ")", "{", "mh", ".", "errormsg", "(", "\"jshell.err.file.not.accessible\"", ",", "context", ",", "filename", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "catch", "(", "NoSuchFileException", "e", ")", "{", "String", "resource", "=", "getResource", "(", "filename", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "// Not found as file, but found as resource", "return", "new", "StartupEntry", "(", "true", ",", "filename", ",", "resource", ")", ";", "}", "mh", ".", "errormsg", "(", "\"jshell.err.file.not.found\"", ",", "context", ",", "filename", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "mh", ".", "errormsg", "(", "\"jshell.err.file.exception\"", ",", "context", ",", "filename", ",", "e", ")", ";", "}", "}", "else", "{", "mh", ".", "errormsg", "(", "\"jshell.err.file.filename\"", ",", "context", ")", ";", "}", "return", "null", ";", "}" ]
Read a external file or a resource. @param filename file/resource to access @param context printable non-natural language context for errors @param mh handler for error messages @return file as startup entry, or null when error (message has been printed)
[ "Read", "a", "external", "file", "or", "a", "resource", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java#L294-L317
5,707
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.isConstructor
public static boolean isConstructor(JCTree tree) { if (tree.hasTag(METHODDEF)) { Name name = ((JCMethodDecl) tree).name; return name == name.table.names.init; } else { return false; } }
java
public static boolean isConstructor(JCTree tree) { if (tree.hasTag(METHODDEF)) { Name name = ((JCMethodDecl) tree).name; return name == name.table.names.init; } else { return false; } }
[ "public", "static", "boolean", "isConstructor", "(", "JCTree", "tree", ")", "{", "if", "(", "tree", ".", "hasTag", "(", "METHODDEF", ")", ")", "{", "Name", "name", "=", "(", "(", "JCMethodDecl", ")", "tree", ")", ".", "name", ";", "return", "name", "==", "name", ".", "table", ".", "names", ".", "init", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Is tree a constructor declaration?
[ "Is", "tree", "a", "constructor", "declaration?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L74-L81
5,708
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.hasConstructors
public static boolean hasConstructors(List<JCTree> trees) { for (List<JCTree> l = trees; l.nonEmpty(); l = l.tail) if (isConstructor(l.head)) return true; return false; }
java
public static boolean hasConstructors(List<JCTree> trees) { for (List<JCTree> l = trees; l.nonEmpty(); l = l.tail) if (isConstructor(l.head)) return true; return false; }
[ "public", "static", "boolean", "hasConstructors", "(", "List", "<", "JCTree", ">", "trees", ")", "{", "for", "(", "List", "<", "JCTree", ">", "l", "=", "trees", ";", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", ".", "tail", ")", "if", "(", "isConstructor", "(", "l", ".", "head", ")", ")", "return", "true", ";", "return", "false", ";", "}" ]
Is there a constructor declaration in the given list of trees?
[ "Is", "there", "a", "constructor", "declaration", "in", "the", "given", "list", "of", "trees?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L93-L97
5,709
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.isSyntheticInit
public static boolean isSyntheticInit(JCTree stat) { if (stat.hasTag(EXEC)) { JCExpressionStatement exec = (JCExpressionStatement)stat; if (exec.expr.hasTag(ASSIGN)) { JCAssign assign = (JCAssign)exec.expr; if (assign.lhs.hasTag(SELECT)) { JCFieldAccess select = (JCFieldAccess)assign.lhs; if (select.sym != null && (select.sym.flags() & SYNTHETIC) != 0) { Name selected = name(select.selected); if (selected != null && selected == selected.table.names._this) return true; } } } } return false; }
java
public static boolean isSyntheticInit(JCTree stat) { if (stat.hasTag(EXEC)) { JCExpressionStatement exec = (JCExpressionStatement)stat; if (exec.expr.hasTag(ASSIGN)) { JCAssign assign = (JCAssign)exec.expr; if (assign.lhs.hasTag(SELECT)) { JCFieldAccess select = (JCFieldAccess)assign.lhs; if (select.sym != null && (select.sym.flags() & SYNTHETIC) != 0) { Name selected = name(select.selected); if (selected != null && selected == selected.table.names._this) return true; } } } } return false; }
[ "public", "static", "boolean", "isSyntheticInit", "(", "JCTree", "stat", ")", "{", "if", "(", "stat", ".", "hasTag", "(", "EXEC", ")", ")", "{", "JCExpressionStatement", "exec", "=", "(", "JCExpressionStatement", ")", "stat", ";", "if", "(", "exec", ".", "expr", ".", "hasTag", "(", "ASSIGN", ")", ")", "{", "JCAssign", "assign", "=", "(", "JCAssign", ")", "exec", ".", "expr", ";", "if", "(", "assign", ".", "lhs", ".", "hasTag", "(", "SELECT", ")", ")", "{", "JCFieldAccess", "select", "=", "(", "JCFieldAccess", ")", "assign", ".", "lhs", ";", "if", "(", "select", ".", "sym", "!=", "null", "&&", "(", "select", ".", "sym", ".", "flags", "(", ")", "&", "SYNTHETIC", ")", "!=", "0", ")", "{", "Name", "selected", "=", "name", "(", "select", ".", "selected", ")", ";", "if", "(", "selected", "!=", "null", "&&", "selected", "==", "selected", ".", "table", ".", "names", ".", "_this", ")", "return", "true", ";", "}", "}", "}", "}", "return", "false", ";", "}" ]
Is statement an initializer for a synthetic field?
[ "Is", "statement", "an", "initializer", "for", "a", "synthetic", "field?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L105-L122
5,710
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.calledMethodName
public static Name calledMethodName(JCTree tree) { if (tree.hasTag(EXEC)) { JCExpressionStatement exec = (JCExpressionStatement)tree; if (exec.expr.hasTag(APPLY)) { Name mname = TreeInfo.name(((JCMethodInvocation) exec.expr).meth); return mname; } } return null; }
java
public static Name calledMethodName(JCTree tree) { if (tree.hasTag(EXEC)) { JCExpressionStatement exec = (JCExpressionStatement)tree; if (exec.expr.hasTag(APPLY)) { Name mname = TreeInfo.name(((JCMethodInvocation) exec.expr).meth); return mname; } } return null; }
[ "public", "static", "Name", "calledMethodName", "(", "JCTree", "tree", ")", "{", "if", "(", "tree", ".", "hasTag", "(", "EXEC", ")", ")", "{", "JCExpressionStatement", "exec", "=", "(", "JCExpressionStatement", ")", "tree", ";", "if", "(", "exec", ".", "expr", ".", "hasTag", "(", "APPLY", ")", ")", "{", "Name", "mname", "=", "TreeInfo", ".", "name", "(", "(", "(", "JCMethodInvocation", ")", "exec", ".", "expr", ")", ".", "meth", ")", ";", "return", "mname", ";", "}", "}", "return", "null", ";", "}" ]
If the expression is a method call, return the method name, null otherwise.
[ "If", "the", "expression", "is", "a", "method", "call", "return", "the", "method", "name", "null", "otherwise", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L126-L135
5,711
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.isSelfCall
public static boolean isSelfCall(JCTree tree) { Name name = calledMethodName(tree); if (name != null) { Names names = name.table.names; return name==names._this || name==names._super; } else { return false; } }
java
public static boolean isSelfCall(JCTree tree) { Name name = calledMethodName(tree); if (name != null) { Names names = name.table.names; return name==names._this || name==names._super; } else { return false; } }
[ "public", "static", "boolean", "isSelfCall", "(", "JCTree", "tree", ")", "{", "Name", "name", "=", "calledMethodName", "(", "tree", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "Names", "names", "=", "name", ".", "table", ".", "names", ";", "return", "name", "==", "names", ".", "_this", "||", "name", "==", "names", ".", "_super", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Is this a call to this or super?
[ "Is", "this", "a", "call", "to", "this", "or", "super?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L139-L147
5,712
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.isSuperCall
public static boolean isSuperCall(JCTree tree) { Name name = calledMethodName(tree); if (name != null) { Names names = name.table.names; return name==names._super; } else { return false; } }
java
public static boolean isSuperCall(JCTree tree) { Name name = calledMethodName(tree); if (name != null) { Names names = name.table.names; return name==names._super; } else { return false; } }
[ "public", "static", "boolean", "isSuperCall", "(", "JCTree", "tree", ")", "{", "Name", "name", "=", "calledMethodName", "(", "tree", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "Names", "names", "=", "name", ".", "table", ".", "names", ";", "return", "name", "==", "names", ".", "_super", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Is this a call to super?
[ "Is", "this", "a", "call", "to", "super?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L151-L159
5,713
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.firstConstructorCall
public static JCMethodInvocation firstConstructorCall(JCTree tree) { if (!tree.hasTag(METHODDEF)) return null; JCMethodDecl md = (JCMethodDecl) tree; Names names = md.name.table.names; if (md.name != names.init) return null; if (md.body == null) return null; List<JCStatement> stats = md.body.stats; // Synthetic initializations can appear before the super call. while (stats.nonEmpty() && isSyntheticInit(stats.head)) stats = stats.tail; if (stats.isEmpty()) return null; if (!stats.head.hasTag(EXEC)) return null; JCExpressionStatement exec = (JCExpressionStatement) stats.head; if (!exec.expr.hasTag(APPLY)) return null; return (JCMethodInvocation)exec.expr; }
java
public static JCMethodInvocation firstConstructorCall(JCTree tree) { if (!tree.hasTag(METHODDEF)) return null; JCMethodDecl md = (JCMethodDecl) tree; Names names = md.name.table.names; if (md.name != names.init) return null; if (md.body == null) return null; List<JCStatement> stats = md.body.stats; // Synthetic initializations can appear before the super call. while (stats.nonEmpty() && isSyntheticInit(stats.head)) stats = stats.tail; if (stats.isEmpty()) return null; if (!stats.head.hasTag(EXEC)) return null; JCExpressionStatement exec = (JCExpressionStatement) stats.head; if (!exec.expr.hasTag(APPLY)) return null; return (JCMethodInvocation)exec.expr; }
[ "public", "static", "JCMethodInvocation", "firstConstructorCall", "(", "JCTree", "tree", ")", "{", "if", "(", "!", "tree", ".", "hasTag", "(", "METHODDEF", ")", ")", "return", "null", ";", "JCMethodDecl", "md", "=", "(", "JCMethodDecl", ")", "tree", ";", "Names", "names", "=", "md", ".", "name", ".", "table", ".", "names", ";", "if", "(", "md", ".", "name", "!=", "names", ".", "init", ")", "return", "null", ";", "if", "(", "md", ".", "body", "==", "null", ")", "return", "null", ";", "List", "<", "JCStatement", ">", "stats", "=", "md", ".", "body", ".", "stats", ";", "// Synthetic initializations can appear before the super call.", "while", "(", "stats", ".", "nonEmpty", "(", ")", "&&", "isSyntheticInit", "(", "stats", ".", "head", ")", ")", "stats", "=", "stats", ".", "tail", ";", "if", "(", "stats", ".", "isEmpty", "(", ")", ")", "return", "null", ";", "if", "(", "!", "stats", ".", "head", ".", "hasTag", "(", "EXEC", ")", ")", "return", "null", ";", "JCExpressionStatement", "exec", "=", "(", "JCExpressionStatement", ")", "stats", ".", "head", ";", "if", "(", "!", "exec", ".", "expr", ".", "hasTag", "(", "APPLY", ")", ")", "return", "null", ";", "return", "(", "JCMethodInvocation", ")", "exec", ".", "expr", ";", "}" ]
Return the first call in a constructor definition.
[ "Return", "the", "first", "call", "in", "a", "constructor", "definition", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L172-L187
5,714
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.isDiamond
public static boolean isDiamond(JCTree tree) { switch(tree.getTag()) { case TYPEAPPLY: return ((JCTypeApply)tree).getTypeArguments().isEmpty(); case NEWCLASS: return isDiamond(((JCNewClass)tree).clazz); case ANNOTATED_TYPE: return isDiamond(((JCAnnotatedType)tree).underlyingType); default: return false; } }
java
public static boolean isDiamond(JCTree tree) { switch(tree.getTag()) { case TYPEAPPLY: return ((JCTypeApply)tree).getTypeArguments().isEmpty(); case NEWCLASS: return isDiamond(((JCNewClass)tree).clazz); case ANNOTATED_TYPE: return isDiamond(((JCAnnotatedType)tree).underlyingType); default: return false; } }
[ "public", "static", "boolean", "isDiamond", "(", "JCTree", "tree", ")", "{", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "TYPEAPPLY", ":", "return", "(", "(", "JCTypeApply", ")", "tree", ")", ".", "getTypeArguments", "(", ")", ".", "isEmpty", "(", ")", ";", "case", "NEWCLASS", ":", "return", "isDiamond", "(", "(", "(", "JCNewClass", ")", "tree", ")", ".", "clazz", ")", ";", "case", "ANNOTATED_TYPE", ":", "return", "isDiamond", "(", "(", "(", "JCAnnotatedType", ")", "tree", ")", ".", "underlyingType", ")", ";", "default", ":", "return", "false", ";", "}", "}" ]
Return true if a tree represents a diamond new expr.
[ "Return", "true", "if", "a", "tree", "represents", "a", "diamond", "new", "expr", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L190-L197
5,715
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.isAnonymousDiamond
public static boolean isAnonymousDiamond(JCTree tree) { switch(tree.getTag()) { case NEWCLASS: { JCNewClass nc = (JCNewClass)tree; return nc.def != null && isDiamond(nc.clazz); } case ANNOTATED_TYPE: return isAnonymousDiamond(((JCAnnotatedType)tree).underlyingType); default: return false; } }
java
public static boolean isAnonymousDiamond(JCTree tree) { switch(tree.getTag()) { case NEWCLASS: { JCNewClass nc = (JCNewClass)tree; return nc.def != null && isDiamond(nc.clazz); } case ANNOTATED_TYPE: return isAnonymousDiamond(((JCAnnotatedType)tree).underlyingType); default: return false; } }
[ "public", "static", "boolean", "isAnonymousDiamond", "(", "JCTree", "tree", ")", "{", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "NEWCLASS", ":", "{", "JCNewClass", "nc", "=", "(", "JCNewClass", ")", "tree", ";", "return", "nc", ".", "def", "!=", "null", "&&", "isDiamond", "(", "nc", ".", "clazz", ")", ";", "}", "case", "ANNOTATED_TYPE", ":", "return", "isAnonymousDiamond", "(", "(", "(", "JCAnnotatedType", ")", "tree", ")", ".", "underlyingType", ")", ";", "default", ":", "return", "false", ";", "}", "}" ]
Return true if the given tree represents a type elided anonymous class instance creation.
[ "Return", "true", "if", "the", "given", "tree", "represents", "a", "type", "elided", "anonymous", "class", "instance", "creation", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L200-L209
5,716
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.setPolyKind
public static void setPolyKind(JCTree tree, PolyKind pkind) { switch (tree.getTag()) { case APPLY: ((JCMethodInvocation)tree).polyKind = pkind; break; case NEWCLASS: ((JCNewClass)tree).polyKind = pkind; break; case REFERENCE: ((JCMemberReference)tree).refPolyKind = pkind; break; default: throw new AssertionError("Unexpected tree: " + tree); } }
java
public static void setPolyKind(JCTree tree, PolyKind pkind) { switch (tree.getTag()) { case APPLY: ((JCMethodInvocation)tree).polyKind = pkind; break; case NEWCLASS: ((JCNewClass)tree).polyKind = pkind; break; case REFERENCE: ((JCMemberReference)tree).refPolyKind = pkind; break; default: throw new AssertionError("Unexpected tree: " + tree); } }
[ "public", "static", "void", "setPolyKind", "(", "JCTree", "tree", ",", "PolyKind", "pkind", ")", "{", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "APPLY", ":", "(", "(", "JCMethodInvocation", ")", "tree", ")", ".", "polyKind", "=", "pkind", ";", "break", ";", "case", "NEWCLASS", ":", "(", "(", "JCNewClass", ")", "tree", ")", ".", "polyKind", "=", "pkind", ";", "break", ";", "case", "REFERENCE", ":", "(", "(", "JCMemberReference", ")", "tree", ")", ".", "refPolyKind", "=", "pkind", ";", "break", ";", "default", ":", "throw", "new", "AssertionError", "(", "\"Unexpected tree: \"", "+", "tree", ")", ";", "}", "}" ]
set 'polyKind' on given tree
[ "set", "polyKind", "on", "given", "tree" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L221-L235
5,717
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.setVarargsElement
public static void setVarargsElement(JCTree tree, Type varargsElement) { switch (tree.getTag()) { case APPLY: ((JCMethodInvocation)tree).varargsElement = varargsElement; break; case NEWCLASS: ((JCNewClass)tree).varargsElement = varargsElement; break; case REFERENCE: ((JCMemberReference)tree).varargsElement = varargsElement; break; default: throw new AssertionError("Unexpected tree: " + tree); } }
java
public static void setVarargsElement(JCTree tree, Type varargsElement) { switch (tree.getTag()) { case APPLY: ((JCMethodInvocation)tree).varargsElement = varargsElement; break; case NEWCLASS: ((JCNewClass)tree).varargsElement = varargsElement; break; case REFERENCE: ((JCMemberReference)tree).varargsElement = varargsElement; break; default: throw new AssertionError("Unexpected tree: " + tree); } }
[ "public", "static", "void", "setVarargsElement", "(", "JCTree", "tree", ",", "Type", "varargsElement", ")", "{", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "APPLY", ":", "(", "(", "JCMethodInvocation", ")", "tree", ")", ".", "varargsElement", "=", "varargsElement", ";", "break", ";", "case", "NEWCLASS", ":", "(", "(", "JCNewClass", ")", "tree", ")", ".", "varargsElement", "=", "varargsElement", ";", "break", ";", "case", "REFERENCE", ":", "(", "(", "JCMemberReference", ")", "tree", ")", ".", "varargsElement", "=", "varargsElement", ";", "break", ";", "default", ":", "throw", "new", "AssertionError", "(", "\"Unexpected tree: \"", "+", "tree", ")", ";", "}", "}" ]
set 'varargsElement' on given tree
[ "set", "varargsElement", "on", "given", "tree" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L238-L252
5,718
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.isExpressionStatement
public static boolean isExpressionStatement(JCExpression tree) { switch(tree.getTag()) { case PREINC: case PREDEC: case POSTINC: case POSTDEC: case ASSIGN: case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG: case SL_ASG: case SR_ASG: case USR_ASG: case PLUS_ASG: case MINUS_ASG: case MUL_ASG: case DIV_ASG: case MOD_ASG: case APPLY: case NEWCLASS: case ERRONEOUS: return true; default: return false; } }
java
public static boolean isExpressionStatement(JCExpression tree) { switch(tree.getTag()) { case PREINC: case PREDEC: case POSTINC: case POSTDEC: case ASSIGN: case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG: case SL_ASG: case SR_ASG: case USR_ASG: case PLUS_ASG: case MINUS_ASG: case MUL_ASG: case DIV_ASG: case MOD_ASG: case APPLY: case NEWCLASS: case ERRONEOUS: return true; default: return false; } }
[ "public", "static", "boolean", "isExpressionStatement", "(", "JCExpression", "tree", ")", "{", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "PREINC", ":", "case", "PREDEC", ":", "case", "POSTINC", ":", "case", "POSTDEC", ":", "case", "ASSIGN", ":", "case", "BITOR_ASG", ":", "case", "BITXOR_ASG", ":", "case", "BITAND_ASG", ":", "case", "SL_ASG", ":", "case", "SR_ASG", ":", "case", "USR_ASG", ":", "case", "PLUS_ASG", ":", "case", "MINUS_ASG", ":", "case", "MUL_ASG", ":", "case", "DIV_ASG", ":", "case", "MOD_ASG", ":", "case", "APPLY", ":", "case", "NEWCLASS", ":", "case", "ERRONEOUS", ":", "return", "true", ";", "default", ":", "return", "false", ";", "}", "}" ]
Return true if the tree corresponds to an expression statement
[ "Return", "true", "if", "the", "tree", "corresponds", "to", "an", "expression", "statement" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L255-L270
5,719
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.isStatement
public static boolean isStatement(JCTree tree) { return (tree instanceof JCStatement) && !tree.hasTag(CLASSDEF) && !tree.hasTag(Tag.BLOCK) && !tree.hasTag(METHODDEF); }
java
public static boolean isStatement(JCTree tree) { return (tree instanceof JCStatement) && !tree.hasTag(CLASSDEF) && !tree.hasTag(Tag.BLOCK) && !tree.hasTag(METHODDEF); }
[ "public", "static", "boolean", "isStatement", "(", "JCTree", "tree", ")", "{", "return", "(", "tree", "instanceof", "JCStatement", ")", "&&", "!", "tree", ".", "hasTag", "(", "CLASSDEF", ")", "&&", "!", "tree", ".", "hasTag", "(", "Tag", ".", "BLOCK", ")", "&&", "!", "tree", ".", "hasTag", "(", "METHODDEF", ")", ";", "}" ]
Return true if the tree corresponds to a statement
[ "Return", "true", "if", "the", "tree", "corresponds", "to", "a", "statement" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L273-L278
5,720
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.isStaticSelector
public static boolean isStaticSelector(JCTree base, Names names) { if (base == null) return false; switch (base.getTag()) { case IDENT: JCIdent id = (JCIdent)base; return id.name != names._this && id.name != names._super && isStaticSym(base); case SELECT: return isStaticSym(base) && isStaticSelector(((JCFieldAccess)base).selected, names); case TYPEAPPLY: case TYPEARRAY: return true; case ANNOTATED_TYPE: return isStaticSelector(((JCAnnotatedType)base).underlyingType, names); default: return false; } }
java
public static boolean isStaticSelector(JCTree base, Names names) { if (base == null) return false; switch (base.getTag()) { case IDENT: JCIdent id = (JCIdent)base; return id.name != names._this && id.name != names._super && isStaticSym(base); case SELECT: return isStaticSym(base) && isStaticSelector(((JCFieldAccess)base).selected, names); case TYPEAPPLY: case TYPEARRAY: return true; case ANNOTATED_TYPE: return isStaticSelector(((JCAnnotatedType)base).underlyingType, names); default: return false; } }
[ "public", "static", "boolean", "isStaticSelector", "(", "JCTree", "base", ",", "Names", "names", ")", "{", "if", "(", "base", "==", "null", ")", "return", "false", ";", "switch", "(", "base", ".", "getTag", "(", ")", ")", "{", "case", "IDENT", ":", "JCIdent", "id", "=", "(", "JCIdent", ")", "base", ";", "return", "id", ".", "name", "!=", "names", ".", "_this", "&&", "id", ".", "name", "!=", "names", ".", "_super", "&&", "isStaticSym", "(", "base", ")", ";", "case", "SELECT", ":", "return", "isStaticSym", "(", "base", ")", "&&", "isStaticSelector", "(", "(", "(", "JCFieldAccess", ")", "base", ")", ".", "selected", ",", "names", ")", ";", "case", "TYPEAPPLY", ":", "case", "TYPEARRAY", ":", "return", "true", ";", "case", "ANNOTATED_TYPE", ":", "return", "isStaticSelector", "(", "(", "(", "JCAnnotatedType", ")", "base", ")", ".", "underlyingType", ",", "names", ")", ";", "default", ":", "return", "false", ";", "}", "}" ]
Return true if the AST corresponds to a static select of the kind A.B
[ "Return", "true", "if", "the", "AST", "corresponds", "to", "a", "static", "select", "of", "the", "kind", "A", ".", "B" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L283-L303
5,721
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.isNull
public static boolean isNull(JCTree tree) { if (!tree.hasTag(LITERAL)) return false; JCLiteral lit = (JCLiteral) tree; return (lit.typetag == BOT); }
java
public static boolean isNull(JCTree tree) { if (!tree.hasTag(LITERAL)) return false; JCLiteral lit = (JCLiteral) tree; return (lit.typetag == BOT); }
[ "public", "static", "boolean", "isNull", "(", "JCTree", "tree", ")", "{", "if", "(", "!", "tree", ".", "hasTag", "(", "LITERAL", ")", ")", "return", "false", ";", "JCLiteral", "lit", "=", "(", "JCLiteral", ")", "tree", ";", "return", "(", "lit", ".", "typetag", "==", "BOT", ")", ";", "}" ]
Return true if a tree represents the null literal.
[ "Return", "true", "if", "a", "tree", "represents", "the", "null", "literal", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L311-L316
5,722
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.isInAnnotation
public static boolean isInAnnotation(Env<?> env, JCTree tree) { TreePath tp = TreePath.getPath(env.toplevel, tree); if (tp != null) { for (Tree t : tp) { if (t.getKind() == Tree.Kind.ANNOTATION) return true; } } return false; }
java
public static boolean isInAnnotation(Env<?> env, JCTree tree) { TreePath tp = TreePath.getPath(env.toplevel, tree); if (tp != null) { for (Tree t : tp) { if (t.getKind() == Tree.Kind.ANNOTATION) return true; } } return false; }
[ "public", "static", "boolean", "isInAnnotation", "(", "Env", "<", "?", ">", "env", ",", "JCTree", "tree", ")", "{", "TreePath", "tp", "=", "TreePath", ".", "getPath", "(", "env", ".", "toplevel", ",", "tree", ")", ";", "if", "(", "tp", "!=", "null", ")", "{", "for", "(", "Tree", "t", ":", "tp", ")", "{", "if", "(", "t", ".", "getKind", "(", ")", "==", "Tree", ".", "Kind", ".", "ANNOTATION", ")", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Return true iff this tree is a child of some annotation.
[ "Return", "true", "iff", "this", "tree", "is", "a", "child", "of", "some", "annotation", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L319-L328
5,723
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.firstStatPos
public static int firstStatPos(JCTree tree) { if (tree.hasTag(BLOCK) && ((JCBlock) tree).stats.nonEmpty()) return ((JCBlock) tree).stats.head.pos; else return tree.pos; }
java
public static int firstStatPos(JCTree tree) { if (tree.hasTag(BLOCK) && ((JCBlock) tree).stats.nonEmpty()) return ((JCBlock) tree).stats.head.pos; else return tree.pos; }
[ "public", "static", "int", "firstStatPos", "(", "JCTree", "tree", ")", "{", "if", "(", "tree", ".", "hasTag", "(", "BLOCK", ")", "&&", "(", "(", "JCBlock", ")", "tree", ")", ".", "stats", ".", "nonEmpty", "(", ")", ")", "return", "(", "(", "JCBlock", ")", "tree", ")", ".", "stats", ".", "head", ".", "pos", ";", "else", "return", "tree", ".", "pos", ";", "}" ]
The position of the first statement in a block, or the position of the block itself if it is empty.
[ "The", "position", "of", "the", "first", "statement", "in", "a", "block", "or", "the", "position", "of", "the", "block", "itself", "if", "it", "is", "empty", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L347-L352
5,724
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.endPos
public static int endPos(JCTree tree) { if (tree.hasTag(BLOCK) && ((JCBlock) tree).endpos != Position.NOPOS) return ((JCBlock) tree).endpos; else if (tree.hasTag(SYNCHRONIZED)) return endPos(((JCSynchronized) tree).body); else if (tree.hasTag(TRY)) { JCTry t = (JCTry) tree; return endPos((t.finalizer != null) ? t.finalizer : (t.catchers.nonEmpty() ? t.catchers.last().body : t.body)); } else return tree.pos; }
java
public static int endPos(JCTree tree) { if (tree.hasTag(BLOCK) && ((JCBlock) tree).endpos != Position.NOPOS) return ((JCBlock) tree).endpos; else if (tree.hasTag(SYNCHRONIZED)) return endPos(((JCSynchronized) tree).body); else if (tree.hasTag(TRY)) { JCTry t = (JCTry) tree; return endPos((t.finalizer != null) ? t.finalizer : (t.catchers.nonEmpty() ? t.catchers.last().body : t.body)); } else return tree.pos; }
[ "public", "static", "int", "endPos", "(", "JCTree", "tree", ")", "{", "if", "(", "tree", ".", "hasTag", "(", "BLOCK", ")", "&&", "(", "(", "JCBlock", ")", "tree", ")", ".", "endpos", "!=", "Position", ".", "NOPOS", ")", "return", "(", "(", "JCBlock", ")", "tree", ")", ".", "endpos", ";", "else", "if", "(", "tree", ".", "hasTag", "(", "SYNCHRONIZED", ")", ")", "return", "endPos", "(", "(", "(", "JCSynchronized", ")", "tree", ")", ".", "body", ")", ";", "else", "if", "(", "tree", ".", "hasTag", "(", "TRY", ")", ")", "{", "JCTry", "t", "=", "(", "JCTry", ")", "tree", ";", "return", "endPos", "(", "(", "t", ".", "finalizer", "!=", "null", ")", "?", "t", ".", "finalizer", ":", "(", "t", ".", "catchers", ".", "nonEmpty", "(", ")", "?", "t", ".", "catchers", ".", "last", "(", ")", ".", "body", ":", "t", ".", "body", ")", ")", ";", "}", "else", "return", "tree", ".", "pos", ";", "}" ]
The end position of given tree, if it is a block with defined endpos.
[ "The", "end", "position", "of", "given", "tree", "if", "it", "is", "a", "block", "with", "defined", "endpos", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L357-L368
5,725
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.diagEndPos
public static DiagnosticPosition diagEndPos(final JCTree tree) { final int endPos = TreeInfo.endPos(tree); return new DiagnosticPosition() { public JCTree getTree() { return tree; } public int getStartPosition() { return TreeInfo.getStartPos(tree); } public int getPreferredPosition() { return endPos; } public int getEndPosition(EndPosTable endPosTable) { return TreeInfo.getEndPos(tree, endPosTable); } }; }
java
public static DiagnosticPosition diagEndPos(final JCTree tree) { final int endPos = TreeInfo.endPos(tree); return new DiagnosticPosition() { public JCTree getTree() { return tree; } public int getStartPosition() { return TreeInfo.getStartPos(tree); } public int getPreferredPosition() { return endPos; } public int getEndPosition(EndPosTable endPosTable) { return TreeInfo.getEndPos(tree, endPosTable); } }; }
[ "public", "static", "DiagnosticPosition", "diagEndPos", "(", "final", "JCTree", "tree", ")", "{", "final", "int", "endPos", "=", "TreeInfo", ".", "endPos", "(", "tree", ")", ";", "return", "new", "DiagnosticPosition", "(", ")", "{", "public", "JCTree", "getTree", "(", ")", "{", "return", "tree", ";", "}", "public", "int", "getStartPosition", "(", ")", "{", "return", "TreeInfo", ".", "getStartPos", "(", "tree", ")", ";", "}", "public", "int", "getPreferredPosition", "(", ")", "{", "return", "endPos", ";", "}", "public", "int", "getEndPosition", "(", "EndPosTable", "endPosTable", ")", "{", "return", "TreeInfo", ".", "getEndPos", "(", "tree", ",", "endPosTable", ")", ";", "}", "}", ";", "}" ]
A DiagnosticPosition with the preferred position set to the end position of given tree, if it is a block with defined endpos.
[ "A", "DiagnosticPosition", "with", "the", "preferred", "position", "set", "to", "the", "end", "position", "of", "given", "tree", "if", "it", "is", "a", "block", "with", "defined", "endpos", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L571-L581
5,726
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.referencedStatement
public static JCTree referencedStatement(JCLabeledStatement tree) { JCTree t = tree; do t = ((JCLabeledStatement) t).body; while (t.hasTag(LABELLED)); switch (t.getTag()) { case DOLOOP: case WHILELOOP: case FORLOOP: case FOREACHLOOP: case SWITCH: return t; default: return tree; } }
java
public static JCTree referencedStatement(JCLabeledStatement tree) { JCTree t = tree; do t = ((JCLabeledStatement) t).body; while (t.hasTag(LABELLED)); switch (t.getTag()) { case DOLOOP: case WHILELOOP: case FORLOOP: case FOREACHLOOP: case SWITCH: return t; default: return tree; } }
[ "public", "static", "JCTree", "referencedStatement", "(", "JCLabeledStatement", "tree", ")", "{", "JCTree", "t", "=", "tree", ";", "do", "t", "=", "(", "(", "JCLabeledStatement", ")", "t", ")", ".", "body", ";", "while", "(", "t", ".", "hasTag", "(", "LABELLED", ")", ")", ";", "switch", "(", "t", ".", "getTag", "(", ")", ")", "{", "case", "DOLOOP", ":", "case", "WHILELOOP", ":", "case", "FORLOOP", ":", "case", "FOREACHLOOP", ":", "case", "SWITCH", ":", "return", "t", ";", "default", ":", "return", "tree", ";", "}", "}" ]
Return the statement referenced by a label. If the label refers to a loop or switch, return that switch otherwise return the labelled statement itself
[ "Return", "the", "statement", "referenced", "by", "a", "label", ".", "If", "the", "label", "refers", "to", "a", "loop", "or", "switch", "return", "that", "switch", "otherwise", "return", "the", "labelled", "statement", "itself" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L695-L705
5,727
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.name
public static Name name(JCTree tree) { switch (tree.getTag()) { case IDENT: return ((JCIdent) tree).name; case SELECT: return ((JCFieldAccess) tree).name; case TYPEAPPLY: return name(((JCTypeApply) tree).clazz); default: return null; } }
java
public static Name name(JCTree tree) { switch (tree.getTag()) { case IDENT: return ((JCIdent) tree).name; case SELECT: return ((JCFieldAccess) tree).name; case TYPEAPPLY: return name(((JCTypeApply) tree).clazz); default: return null; } }
[ "public", "static", "Name", "name", "(", "JCTree", "tree", ")", "{", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "IDENT", ":", "return", "(", "(", "JCIdent", ")", "tree", ")", ".", "name", ";", "case", "SELECT", ":", "return", "(", "(", "JCFieldAccess", ")", "tree", ")", ".", "name", ";", "case", "TYPEAPPLY", ":", "return", "name", "(", "(", "(", "JCTypeApply", ")", "tree", ")", ".", "clazz", ")", ";", "default", ":", "return", "null", ";", "}", "}" ]
If this tree is an identifier or a field or a parameterized type, return its name, otherwise return null.
[ "If", "this", "tree", "is", "an", "identifier", "or", "a", "field", "or", "a", "parameterized", "type", "return", "its", "name", "otherwise", "return", "null", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L737-L748
5,728
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.fullName
public static Name fullName(JCTree tree) { tree = skipParens(tree); switch (tree.getTag()) { case IDENT: return ((JCIdent) tree).name; case SELECT: Name sname = fullName(((JCFieldAccess) tree).selected); return sname == null ? null : sname.append('.', name(tree)); default: return null; } }
java
public static Name fullName(JCTree tree) { tree = skipParens(tree); switch (tree.getTag()) { case IDENT: return ((JCIdent) tree).name; case SELECT: Name sname = fullName(((JCFieldAccess) tree).selected); return sname == null ? null : sname.append('.', name(tree)); default: return null; } }
[ "public", "static", "Name", "fullName", "(", "JCTree", "tree", ")", "{", "tree", "=", "skipParens", "(", "tree", ")", ";", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "IDENT", ":", "return", "(", "(", "JCIdent", ")", "tree", ")", ".", "name", ";", "case", "SELECT", ":", "Name", "sname", "=", "fullName", "(", "(", "(", "JCFieldAccess", ")", "tree", ")", ".", "selected", ")", ";", "return", "sname", "==", "null", "?", "null", ":", "sname", ".", "append", "(", "'", "'", ",", "name", "(", "tree", ")", ")", ";", "default", ":", "return", "null", ";", "}", "}" ]
If this tree is a qualified identifier, its return fully qualified name, otherwise return null.
[ "If", "this", "tree", "is", "a", "qualified", "identifier", "its", "return", "fully", "qualified", "name", "otherwise", "return", "null", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L753-L764
5,729
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.symbol
public static Symbol symbol(JCTree tree) { tree = skipParens(tree); switch (tree.getTag()) { case IDENT: return ((JCIdent) tree).sym; case SELECT: return ((JCFieldAccess) tree).sym; case TYPEAPPLY: return symbol(((JCTypeApply) tree).clazz); case ANNOTATED_TYPE: return symbol(((JCAnnotatedType) tree).underlyingType); case REFERENCE: return ((JCMemberReference) tree).sym; default: return null; } }
java
public static Symbol symbol(JCTree tree) { tree = skipParens(tree); switch (tree.getTag()) { case IDENT: return ((JCIdent) tree).sym; case SELECT: return ((JCFieldAccess) tree).sym; case TYPEAPPLY: return symbol(((JCTypeApply) tree).clazz); case ANNOTATED_TYPE: return symbol(((JCAnnotatedType) tree).underlyingType); case REFERENCE: return ((JCMemberReference) tree).sym; default: return null; } }
[ "public", "static", "Symbol", "symbol", "(", "JCTree", "tree", ")", "{", "tree", "=", "skipParens", "(", "tree", ")", ";", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "IDENT", ":", "return", "(", "(", "JCIdent", ")", "tree", ")", ".", "sym", ";", "case", "SELECT", ":", "return", "(", "(", "JCFieldAccess", ")", "tree", ")", ".", "sym", ";", "case", "TYPEAPPLY", ":", "return", "symbol", "(", "(", "(", "JCTypeApply", ")", "tree", ")", ".", "clazz", ")", ";", "case", "ANNOTATED_TYPE", ":", "return", "symbol", "(", "(", "(", "JCAnnotatedType", ")", "tree", ")", ".", "underlyingType", ")", ";", "case", "REFERENCE", ":", "return", "(", "(", "JCMemberReference", ")", "tree", ")", ".", "sym", ";", "default", ":", "return", "null", ";", "}", "}" ]
If this tree is an identifier or a field, return its symbol, otherwise return null.
[ "If", "this", "tree", "is", "an", "identifier", "or", "a", "field", "return", "its", "symbol", "otherwise", "return", "null", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L830-L846
5,730
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.nonstaticSelect
public static boolean nonstaticSelect(JCTree tree) { tree = skipParens(tree); if (!tree.hasTag(SELECT)) return false; JCFieldAccess s = (JCFieldAccess) tree; Symbol e = symbol(s.selected); return e == null || (e.kind != PCK && e.kind != TYP); }
java
public static boolean nonstaticSelect(JCTree tree) { tree = skipParens(tree); if (!tree.hasTag(SELECT)) return false; JCFieldAccess s = (JCFieldAccess) tree; Symbol e = symbol(s.selected); return e == null || (e.kind != PCK && e.kind != TYP); }
[ "public", "static", "boolean", "nonstaticSelect", "(", "JCTree", "tree", ")", "{", "tree", "=", "skipParens", "(", "tree", ")", ";", "if", "(", "!", "tree", ".", "hasTag", "(", "SELECT", ")", ")", "return", "false", ";", "JCFieldAccess", "s", "=", "(", "JCFieldAccess", ")", "tree", ";", "Symbol", "e", "=", "symbol", "(", "s", ".", "selected", ")", ";", "return", "e", "==", "null", "||", "(", "e", ".", "kind", "!=", "PCK", "&&", "e", ".", "kind", "!=", "TYP", ")", ";", "}" ]
Return true if this is a nonstatic selection.
[ "Return", "true", "if", "this", "is", "a", "nonstatic", "selection", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L849-L855
5,731
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.setSymbol
public static void setSymbol(JCTree tree, Symbol sym) { tree = skipParens(tree); switch (tree.getTag()) { case IDENT: ((JCIdent) tree).sym = sym; break; case SELECT: ((JCFieldAccess) tree).sym = sym; break; default: } }
java
public static void setSymbol(JCTree tree, Symbol sym) { tree = skipParens(tree); switch (tree.getTag()) { case IDENT: ((JCIdent) tree).sym = sym; break; case SELECT: ((JCFieldAccess) tree).sym = sym; break; default: } }
[ "public", "static", "void", "setSymbol", "(", "JCTree", "tree", ",", "Symbol", "sym", ")", "{", "tree", "=", "skipParens", "(", "tree", ")", ";", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "IDENT", ":", "(", "(", "JCIdent", ")", "tree", ")", ".", "sym", "=", "sym", ";", "break", ";", "case", "SELECT", ":", "(", "(", "JCFieldAccess", ")", "tree", ")", ".", "sym", "=", "sym", ";", "break", ";", "default", ":", "}", "}" ]
If this tree is an identifier or a field, set its symbol, otherwise skip.
[ "If", "this", "tree", "is", "an", "identifier", "or", "a", "field", "set", "its", "symbol", "otherwise", "skip", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L859-L868
5,732
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.flags
public static long flags(JCTree tree) { switch (tree.getTag()) { case VARDEF: return ((JCVariableDecl) tree).mods.flags; case METHODDEF: return ((JCMethodDecl) tree).mods.flags; case CLASSDEF: return ((JCClassDecl) tree).mods.flags; case BLOCK: return ((JCBlock) tree).flags; default: return 0; } }
java
public static long flags(JCTree tree) { switch (tree.getTag()) { case VARDEF: return ((JCVariableDecl) tree).mods.flags; case METHODDEF: return ((JCMethodDecl) tree).mods.flags; case CLASSDEF: return ((JCClassDecl) tree).mods.flags; case BLOCK: return ((JCBlock) tree).flags; default: return 0; } }
[ "public", "static", "long", "flags", "(", "JCTree", "tree", ")", "{", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "VARDEF", ":", "return", "(", "(", "JCVariableDecl", ")", "tree", ")", ".", "mods", ".", "flags", ";", "case", "METHODDEF", ":", "return", "(", "(", "JCMethodDecl", ")", "tree", ")", ".", "mods", ".", "flags", ";", "case", "CLASSDEF", ":", "return", "(", "(", "JCClassDecl", ")", "tree", ")", ".", "mods", ".", "flags", ";", "case", "BLOCK", ":", "return", "(", "(", "JCBlock", ")", "tree", ")", ".", "flags", ";", "default", ":", "return", "0", ";", "}", "}" ]
If this tree is a declaration or a block, return its flags field, otherwise return 0.
[ "If", "this", "tree", "is", "a", "declaration", "or", "a", "block", "return", "its", "flags", "field", "otherwise", "return", "0", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L873-L886
5,733
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.opPrec
public static int opPrec(JCTree.Tag op) { switch(op) { case POS: case NEG: case NOT: case COMPL: case PREINC: case PREDEC: return prefixPrec; case POSTINC: case POSTDEC: case NULLCHK: return postfixPrec; case ASSIGN: return assignPrec; case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG: case SL_ASG: case SR_ASG: case USR_ASG: case PLUS_ASG: case MINUS_ASG: case MUL_ASG: case DIV_ASG: case MOD_ASG: return assignopPrec; case OR: return orPrec; case AND: return andPrec; case EQ: case NE: return eqPrec; case LT: case GT: case LE: case GE: return ordPrec; case BITOR: return bitorPrec; case BITXOR: return bitxorPrec; case BITAND: return bitandPrec; case SL: case SR: case USR: return shiftPrec; case PLUS: case MINUS: return addPrec; case MUL: case DIV: case MOD: return mulPrec; case TYPETEST: return ordPrec; default: throw new AssertionError(); } }
java
public static int opPrec(JCTree.Tag op) { switch(op) { case POS: case NEG: case NOT: case COMPL: case PREINC: case PREDEC: return prefixPrec; case POSTINC: case POSTDEC: case NULLCHK: return postfixPrec; case ASSIGN: return assignPrec; case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG: case SL_ASG: case SR_ASG: case USR_ASG: case PLUS_ASG: case MINUS_ASG: case MUL_ASG: case DIV_ASG: case MOD_ASG: return assignopPrec; case OR: return orPrec; case AND: return andPrec; case EQ: case NE: return eqPrec; case LT: case GT: case LE: case GE: return ordPrec; case BITOR: return bitorPrec; case BITXOR: return bitxorPrec; case BITAND: return bitandPrec; case SL: case SR: case USR: return shiftPrec; case PLUS: case MINUS: return addPrec; case MUL: case DIV: case MOD: return mulPrec; case TYPETEST: return ordPrec; default: throw new AssertionError(); } }
[ "public", "static", "int", "opPrec", "(", "JCTree", ".", "Tag", "op", ")", "{", "switch", "(", "op", ")", "{", "case", "POS", ":", "case", "NEG", ":", "case", "NOT", ":", "case", "COMPL", ":", "case", "PREINC", ":", "case", "PREDEC", ":", "return", "prefixPrec", ";", "case", "POSTINC", ":", "case", "POSTDEC", ":", "case", "NULLCHK", ":", "return", "postfixPrec", ";", "case", "ASSIGN", ":", "return", "assignPrec", ";", "case", "BITOR_ASG", ":", "case", "BITXOR_ASG", ":", "case", "BITAND_ASG", ":", "case", "SL_ASG", ":", "case", "SR_ASG", ":", "case", "USR_ASG", ":", "case", "PLUS_ASG", ":", "case", "MINUS_ASG", ":", "case", "MUL_ASG", ":", "case", "DIV_ASG", ":", "case", "MOD_ASG", ":", "return", "assignopPrec", ";", "case", "OR", ":", "return", "orPrec", ";", "case", "AND", ":", "return", "andPrec", ";", "case", "EQ", ":", "case", "NE", ":", "return", "eqPrec", ";", "case", "LT", ":", "case", "GT", ":", "case", "LE", ":", "case", "GE", ":", "return", "ordPrec", ";", "case", "BITOR", ":", "return", "bitorPrec", ";", "case", "BITXOR", ":", "return", "bitxorPrec", ";", "case", "BITAND", ":", "return", "bitandPrec", ";", "case", "SL", ":", "case", "SR", ":", "case", "USR", ":", "return", "shiftPrec", ";", "case", "PLUS", ":", "case", "MINUS", ":", "return", "addPrec", ";", "case", "MUL", ":", "case", "DIV", ":", "case", "MOD", ":", "return", "mulPrec", ";", "case", "TYPETEST", ":", "return", "ordPrec", ";", "default", ":", "throw", "new", "AssertionError", "(", ")", ";", "}", "}" ]
Map operators to their precedence levels.
[ "Map", "operators", "to", "their", "precedence", "levels", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L929-L974
5,734
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java
TreeInfo.typeIn
public static JCExpression typeIn(JCExpression tree) { switch (tree.getTag()) { case ANNOTATED_TYPE: return ((JCAnnotatedType)tree).underlyingType; case IDENT: /* simple names */ case TYPEIDENT: /* primitive name */ case SELECT: /* qualified name */ case TYPEARRAY: /* array types */ case WILDCARD: /* wild cards */ case TYPEPARAMETER: /* type parameters */ case TYPEAPPLY: /* parameterized types */ case ERRONEOUS: /* error tree TODO: needed for BadCast JSR308 test case. Better way? */ return tree; default: throw new AssertionError("Unexpected type tree: " + tree); } }
java
public static JCExpression typeIn(JCExpression tree) { switch (tree.getTag()) { case ANNOTATED_TYPE: return ((JCAnnotatedType)tree).underlyingType; case IDENT: /* simple names */ case TYPEIDENT: /* primitive name */ case SELECT: /* qualified name */ case TYPEARRAY: /* array types */ case WILDCARD: /* wild cards */ case TYPEPARAMETER: /* type parameters */ case TYPEAPPLY: /* parameterized types */ case ERRONEOUS: /* error tree TODO: needed for BadCast JSR308 test case. Better way? */ return tree; default: throw new AssertionError("Unexpected type tree: " + tree); } }
[ "public", "static", "JCExpression", "typeIn", "(", "JCExpression", "tree", ")", "{", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "ANNOTATED_TYPE", ":", "return", "(", "(", "JCAnnotatedType", ")", "tree", ")", ".", "underlyingType", ";", "case", "IDENT", ":", "/* simple names */", "case", "TYPEIDENT", ":", "/* primitive name */", "case", "SELECT", ":", "/* qualified name */", "case", "TYPEARRAY", ":", "/* array types */", "case", "WILDCARD", ":", "/* wild cards */", "case", "TYPEPARAMETER", ":", "/* type parameters */", "case", "TYPEAPPLY", ":", "/* parameterized types */", "case", "ERRONEOUS", ":", "/* error tree TODO: needed for BadCast JSR308 test case. Better way? */", "return", "tree", ";", "default", ":", "throw", "new", "AssertionError", "(", "\"Unexpected type tree: \"", "+", "tree", ")", ";", "}", "}" ]
Returns the underlying type of the tree if it is an annotated type, or the tree itself otherwise.
[ "Returns", "the", "underlying", "type", "of", "the", "tree", "if", "it", "is", "an", "annotated", "type", "or", "the", "tree", "itself", "otherwise", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L1099-L1115
5,735
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
Configuration.tokenize
private String[] tokenize(String s, char separator, int maxTokens) { List<String> tokens = new ArrayList<>(); StringBuilder token = new StringBuilder (); boolean prevIsEscapeChar = false; for (int i = 0; i < s.length(); i += Character.charCount(i)) { int currentChar = s.codePointAt(i); if (prevIsEscapeChar) { // Case 1: escaped character token.appendCodePoint(currentChar); prevIsEscapeChar = false; } else if (currentChar == separator && tokens.size() < maxTokens-1) { // Case 2: separator tokens.add(token.toString()); token = new StringBuilder(); } else if (currentChar == '\\') { // Case 3: escape character prevIsEscapeChar = true; } else { // Case 4: regular character token.appendCodePoint(currentChar); } } if (token.length() > 0) { tokens.add(token.toString()); } return tokens.toArray(new String[] {}); }
java
private String[] tokenize(String s, char separator, int maxTokens) { List<String> tokens = new ArrayList<>(); StringBuilder token = new StringBuilder (); boolean prevIsEscapeChar = false; for (int i = 0; i < s.length(); i += Character.charCount(i)) { int currentChar = s.codePointAt(i); if (prevIsEscapeChar) { // Case 1: escaped character token.appendCodePoint(currentChar); prevIsEscapeChar = false; } else if (currentChar == separator && tokens.size() < maxTokens-1) { // Case 2: separator tokens.add(token.toString()); token = new StringBuilder(); } else if (currentChar == '\\') { // Case 3: escape character prevIsEscapeChar = true; } else { // Case 4: regular character token.appendCodePoint(currentChar); } } if (token.length() > 0) { tokens.add(token.toString()); } return tokens.toArray(new String[] {}); }
[ "private", "String", "[", "]", "tokenize", "(", "String", "s", ",", "char", "separator", ",", "int", "maxTokens", ")", "{", "List", "<", "String", ">", "tokens", "=", "new", "ArrayList", "<>", "(", ")", ";", "StringBuilder", "token", "=", "new", "StringBuilder", "(", ")", ";", "boolean", "prevIsEscapeChar", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "i", "+=", "Character", ".", "charCount", "(", "i", ")", ")", "{", "int", "currentChar", "=", "s", ".", "codePointAt", "(", "i", ")", ";", "if", "(", "prevIsEscapeChar", ")", "{", "// Case 1: escaped character", "token", ".", "appendCodePoint", "(", "currentChar", ")", ";", "prevIsEscapeChar", "=", "false", ";", "}", "else", "if", "(", "currentChar", "==", "separator", "&&", "tokens", ".", "size", "(", ")", "<", "maxTokens", "-", "1", ")", "{", "// Case 2: separator", "tokens", ".", "add", "(", "token", ".", "toString", "(", ")", ")", ";", "token", "=", "new", "StringBuilder", "(", ")", ";", "}", "else", "if", "(", "currentChar", "==", "'", "'", ")", "{", "// Case 3: escape character", "prevIsEscapeChar", "=", "true", ";", "}", "else", "{", "// Case 4: regular character", "token", ".", "appendCodePoint", "(", "currentChar", ")", ";", "}", "}", "if", "(", "token", ".", "length", "(", ")", ">", "0", ")", "{", "tokens", ".", "add", "(", "token", ".", "toString", "(", ")", ")", ";", "}", "return", "tokens", ".", "toArray", "(", "new", "String", "[", "]", "{", "}", ")", ";", "}" ]
Given a string, return an array of tokens. The separator can be escaped with the '\' character. The '\' character may also be escaped by the '\' character. @param s the string to tokenize. @param separator the separator char. @param maxTokens the maximum number of tokens returned. If the max is reached, the remaining part of s is appended to the end of the last token. @return an array of tokens.
[ "Given", "a", "string", "return", "an", "array", "of", "tokens", ".", "The", "separator", "can", "be", "escaped", "with", "the", "\\", "character", ".", "The", "\\", "character", "may", "also", "be", "escaped", "by", "the", "\\", "character", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java#L547-L573
5,736
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
Configuration.addTrailingFileSep
public static String addTrailingFileSep(String path) { String fs = System.getProperty("file.separator"); String dblfs = fs + fs; int indexDblfs; while ((indexDblfs = path.indexOf(dblfs, 1)) >= 0) { path = path.substring(0, indexDblfs) + path.substring(indexDblfs + fs.length()); } if (!path.endsWith(fs)) path += fs; return path; }
java
public static String addTrailingFileSep(String path) { String fs = System.getProperty("file.separator"); String dblfs = fs + fs; int indexDblfs; while ((indexDblfs = path.indexOf(dblfs, 1)) >= 0) { path = path.substring(0, indexDblfs) + path.substring(indexDblfs + fs.length()); } if (!path.endsWith(fs)) path += fs; return path; }
[ "public", "static", "String", "addTrailingFileSep", "(", "String", "path", ")", "{", "String", "fs", "=", "System", ".", "getProperty", "(", "\"file.separator\"", ")", ";", "String", "dblfs", "=", "fs", "+", "fs", ";", "int", "indexDblfs", ";", "while", "(", "(", "indexDblfs", "=", "path", ".", "indexOf", "(", "dblfs", ",", "1", ")", ")", ">=", "0", ")", "{", "path", "=", "path", ".", "substring", "(", "0", ",", "indexDblfs", ")", "+", "path", ".", "substring", "(", "indexDblfs", "+", "fs", ".", "length", "(", ")", ")", ";", "}", "if", "(", "!", "path", ".", "endsWith", "(", "fs", ")", ")", "path", "+=", "fs", ";", "return", "path", ";", "}" ]
Add a trailing file separator, if not found. Remove superfluous file separators if any. Preserve the front double file separator for UNC paths. @param path Path under consideration. @return String Properly constructed path string.
[ "Add", "a", "trailing", "file", "separator", "if", "not", "found", ".", "Remove", "superfluous", "file", "separators", "if", "any", ".", "Preserve", "the", "front", "double", "file", "separator", "for", "UNC", "paths", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java#L592-L603
5,737
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
Configuration.checkOutputFileEncoding
private boolean checkOutputFileEncoding(String docencoding, DocErrorReporter reporter) { OutputStream ost= new ByteArrayOutputStream(); OutputStreamWriter osw = null; try { osw = new OutputStreamWriter(ost, docencoding); } catch (UnsupportedEncodingException exc) { reporter.printError(getText("doclet.Encoding_not_supported", docencoding)); return false; } finally { try { if (osw != null) { osw.close(); } } catch (IOException exc) { } } return true; }
java
private boolean checkOutputFileEncoding(String docencoding, DocErrorReporter reporter) { OutputStream ost= new ByteArrayOutputStream(); OutputStreamWriter osw = null; try { osw = new OutputStreamWriter(ost, docencoding); } catch (UnsupportedEncodingException exc) { reporter.printError(getText("doclet.Encoding_not_supported", docencoding)); return false; } finally { try { if (osw != null) { osw.close(); } } catch (IOException exc) { } } return true; }
[ "private", "boolean", "checkOutputFileEncoding", "(", "String", "docencoding", ",", "DocErrorReporter", "reporter", ")", "{", "OutputStream", "ost", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "OutputStreamWriter", "osw", "=", "null", ";", "try", "{", "osw", "=", "new", "OutputStreamWriter", "(", "ost", ",", "docencoding", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "exc", ")", "{", "reporter", ".", "printError", "(", "getText", "(", "\"doclet.Encoding_not_supported\"", ",", "docencoding", ")", ")", ";", "return", "false", ";", "}", "finally", "{", "try", "{", "if", "(", "osw", "!=", "null", ")", "{", "osw", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "IOException", "exc", ")", "{", "}", "}", "return", "true", ";", "}" ]
Check the validity of the given Source or Output File encoding on this platform. @param docencoding output file encoding. @param reporter used to report errors.
[ "Check", "the", "validity", "of", "the", "given", "Source", "or", "Output", "File", "encoding", "on", "this", "platform", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java#L649-L668
5,738
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
Configuration.shouldExcludeQualifier
public boolean shouldExcludeQualifier(String qualifier){ if (excludedQualifiers.contains("all") || excludedQualifiers.contains(qualifier) || excludedQualifiers.contains(qualifier + ".*")) { return true; } else { int index = -1; while ((index = qualifier.indexOf(".", index + 1)) != -1) { if (excludedQualifiers.contains(qualifier.substring(0, index + 1) + "*")) { return true; } } return false; } }
java
public boolean shouldExcludeQualifier(String qualifier){ if (excludedQualifiers.contains("all") || excludedQualifiers.contains(qualifier) || excludedQualifiers.contains(qualifier + ".*")) { return true; } else { int index = -1; while ((index = qualifier.indexOf(".", index + 1)) != -1) { if (excludedQualifiers.contains(qualifier.substring(0, index + 1) + "*")) { return true; } } return false; } }
[ "public", "boolean", "shouldExcludeQualifier", "(", "String", "qualifier", ")", "{", "if", "(", "excludedQualifiers", ".", "contains", "(", "\"all\"", ")", "||", "excludedQualifiers", ".", "contains", "(", "qualifier", ")", "||", "excludedQualifiers", ".", "contains", "(", "qualifier", "+", "\".*\"", ")", ")", "{", "return", "true", ";", "}", "else", "{", "int", "index", "=", "-", "1", ";", "while", "(", "(", "index", "=", "qualifier", ".", "indexOf", "(", "\".\"", ",", "index", "+", "1", ")", ")", "!=", "-", "1", ")", "{", "if", "(", "excludedQualifiers", ".", "contains", "(", "qualifier", ".", "substring", "(", "0", ",", "index", "+", "1", ")", "+", "\"*\"", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "}" ]
Return true if the given qualifier should be excluded and false otherwise. @param qualifier the qualifier to check.
[ "Return", "true", "if", "the", "given", "qualifier", "should", "be", "excluded", "and", "false", "otherwise", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java#L687-L701
5,739
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
Configuration.isGeneratedDoc
public boolean isGeneratedDoc(ClassDoc cd) { if (!nodeprecated) { return true; } return !(utils.isDeprecated(cd) || utils.isDeprecated(cd.containingPackage())); }
java
public boolean isGeneratedDoc(ClassDoc cd) { if (!nodeprecated) { return true; } return !(utils.isDeprecated(cd) || utils.isDeprecated(cd.containingPackage())); }
[ "public", "boolean", "isGeneratedDoc", "(", "ClassDoc", "cd", ")", "{", "if", "(", "!", "nodeprecated", ")", "{", "return", "true", ";", "}", "return", "!", "(", "utils", ".", "isDeprecated", "(", "cd", ")", "||", "utils", ".", "isDeprecated", "(", "cd", ".", "containingPackage", "(", ")", ")", ")", ";", "}" ]
Return true if the ClassDoc element is getting documented, depending upon -nodeprecated option and the deprecation information. Return true if -nodeprecated is not used. Return false if -nodeprecated is used and if either ClassDoc element is deprecated or the containing package is deprecated. @param cd the ClassDoc for which the page generation is checked
[ "Return", "true", "if", "the", "ClassDoc", "element", "is", "getting", "documented", "depending", "upon", "-", "nodeprecated", "option", "and", "the", "deprecation", "information", ".", "Return", "true", "if", "-", "nodeprecated", "is", "not", "used", ".", "Return", "false", "if", "-", "nodeprecated", "is", "used", "and", "if", "either", "ClassDoc", "element", "is", "deprecated", "or", "the", "containing", "package", "is", "deprecated", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java#L841-L846
5,740
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
Configuration.getBuilderXML
public InputStream getBuilderXML() throws IOException { return builderXMLPath == null ? Configuration.class.getResourceAsStream(DEFAULT_BUILDER_XML) : DocFile.createFileForInput(this, builderXMLPath).openInputStream(); }
java
public InputStream getBuilderXML() throws IOException { return builderXMLPath == null ? Configuration.class.getResourceAsStream(DEFAULT_BUILDER_XML) : DocFile.createFileForInput(this, builderXMLPath).openInputStream(); }
[ "public", "InputStream", "getBuilderXML", "(", ")", "throws", "IOException", "{", "return", "builderXMLPath", "==", "null", "?", "Configuration", ".", "class", ".", "getResourceAsStream", "(", "DEFAULT_BUILDER_XML", ")", ":", "DocFile", ".", "createFileForInput", "(", "this", ",", "builderXMLPath", ")", ".", "openInputStream", "(", ")", ";", "}" ]
Return the input stream to the builder XML. @return the input steam to the builder XML. @throws FileNotFoundException when the given XML file cannot be found.
[ "Return", "the", "input", "stream", "to", "the", "builder", "XML", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java#L860-L864
5,741
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.instance
public static JavaCompiler instance(Context context) { JavaCompiler instance = context.get(compilerKey); if (instance == null) instance = new JavaCompiler(context); return instance; }
java
public static JavaCompiler instance(Context context) { JavaCompiler instance = context.get(compilerKey); if (instance == null) instance = new JavaCompiler(context); return instance; }
[ "public", "static", "JavaCompiler", "instance", "(", "Context", "context", ")", "{", "JavaCompiler", "instance", "=", "context", ".", "get", "(", "compilerKey", ")", ";", "if", "(", "instance", "==", "null", ")", "instance", "=", "new", "JavaCompiler", "(", "context", ")", ";", "return", "instance", ";", "}" ]
Get the JavaCompiler instance for this context.
[ "Get", "the", "JavaCompiler", "instance", "for", "this", "context", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L109-L114
5,742
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.readSource
public CharSequence readSource(JavaFileObject filename) { try { inputFiles.add(filename); return filename.getCharContent(false); } catch (IOException e) { log.error("error.reading.file", filename, JavacFileManager.getMessage(e)); return null; } }
java
public CharSequence readSource(JavaFileObject filename) { try { inputFiles.add(filename); return filename.getCharContent(false); } catch (IOException e) { log.error("error.reading.file", filename, JavacFileManager.getMessage(e)); return null; } }
[ "public", "CharSequence", "readSource", "(", "JavaFileObject", "filename", ")", "{", "try", "{", "inputFiles", ".", "add", "(", "filename", ")", ";", "return", "filename", ".", "getCharContent", "(", "false", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "log", ".", "error", "(", "\"error.reading.file\"", ",", "filename", ",", "JavacFileManager", ".", "getMessage", "(", "e", ")", ")", ";", "return", "null", ";", "}", "}" ]
Try to open input stream with given name. Report an error if this fails. @param filename The file name of the input stream to be opened.
[ "Try", "to", "open", "input", "stream", "with", "given", "name", ".", "Report", "an", "error", "if", "this", "fails", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L596-L604
5,743
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.parse
protected JCCompilationUnit parse(JavaFileObject filename, CharSequence content) { long msec = now(); JCCompilationUnit tree = make.TopLevel(List.nil()); if (content != null) { if (verbose) { log.printVerbose("parsing.started", filename); } if (!taskListener.isEmpty()) { TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename); taskListener.started(e); keepComments = true; genEndPos = true; } Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo, filename.isNameCompatible("module-info", Kind.SOURCE)); tree = parser.parseCompilationUnit(); if (verbose) { log.printVerbose("parsing.done", Long.toString(elapsed(msec))); } } tree.sourcefile = filename; if (content != null && !taskListener.isEmpty()) { TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, tree); taskListener.finished(e); } return tree; }
java
protected JCCompilationUnit parse(JavaFileObject filename, CharSequence content) { long msec = now(); JCCompilationUnit tree = make.TopLevel(List.nil()); if (content != null) { if (verbose) { log.printVerbose("parsing.started", filename); } if (!taskListener.isEmpty()) { TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename); taskListener.started(e); keepComments = true; genEndPos = true; } Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo, filename.isNameCompatible("module-info", Kind.SOURCE)); tree = parser.parseCompilationUnit(); if (verbose) { log.printVerbose("parsing.done", Long.toString(elapsed(msec))); } } tree.sourcefile = filename; if (content != null && !taskListener.isEmpty()) { TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, tree); taskListener.finished(e); } return tree; }
[ "protected", "JCCompilationUnit", "parse", "(", "JavaFileObject", "filename", ",", "CharSequence", "content", ")", "{", "long", "msec", "=", "now", "(", ")", ";", "JCCompilationUnit", "tree", "=", "make", ".", "TopLevel", "(", "List", ".", "nil", "(", ")", ")", ";", "if", "(", "content", "!=", "null", ")", "{", "if", "(", "verbose", ")", "{", "log", ".", "printVerbose", "(", "\"parsing.started\"", ",", "filename", ")", ";", "}", "if", "(", "!", "taskListener", ".", "isEmpty", "(", ")", ")", "{", "TaskEvent", "e", "=", "new", "TaskEvent", "(", "TaskEvent", ".", "Kind", ".", "PARSE", ",", "filename", ")", ";", "taskListener", ".", "started", "(", "e", ")", ";", "keepComments", "=", "true", ";", "genEndPos", "=", "true", ";", "}", "Parser", "parser", "=", "parserFactory", ".", "newParser", "(", "content", ",", "keepComments", "(", ")", ",", "genEndPos", ",", "lineDebugInfo", ",", "filename", ".", "isNameCompatible", "(", "\"module-info\"", ",", "Kind", ".", "SOURCE", ")", ")", ";", "tree", "=", "parser", ".", "parseCompilationUnit", "(", ")", ";", "if", "(", "verbose", ")", "{", "log", ".", "printVerbose", "(", "\"parsing.done\"", ",", "Long", ".", "toString", "(", "elapsed", "(", "msec", ")", ")", ")", ";", "}", "}", "tree", ".", "sourcefile", "=", "filename", ";", "if", "(", "content", "!=", "null", "&&", "!", "taskListener", ".", "isEmpty", "(", ")", ")", "{", "TaskEvent", "e", "=", "new", "TaskEvent", "(", "TaskEvent", ".", "Kind", ".", "PARSE", ",", "tree", ")", ";", "taskListener", ".", "finished", "(", "e", ")", ";", "}", "return", "tree", ";", "}" ]
Parse contents of input stream. @param filename The name of the file from which input stream comes. @param content The characters to be parsed.
[ "Parse", "contents", "of", "input", "stream", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L610-L639
5,744
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.genCode
JavaFileObject genCode(Env<AttrContext> env, JCClassDecl cdef) throws IOException { try { if (gen.genClass(env, cdef) && (errorCount() == 0)) return writer.writeClass(cdef.sym); } catch (ClassWriter.PoolOverflow ex) { log.error(cdef.pos(), "limit.pool"); } catch (ClassWriter.StringOverflow ex) { log.error(cdef.pos(), "limit.string.overflow", ex.value.substring(0, 20)); } catch (CompletionFailure ex) { chk.completionError(cdef.pos(), ex); } return null; }
java
JavaFileObject genCode(Env<AttrContext> env, JCClassDecl cdef) throws IOException { try { if (gen.genClass(env, cdef) && (errorCount() == 0)) return writer.writeClass(cdef.sym); } catch (ClassWriter.PoolOverflow ex) { log.error(cdef.pos(), "limit.pool"); } catch (ClassWriter.StringOverflow ex) { log.error(cdef.pos(), "limit.string.overflow", ex.value.substring(0, 20)); } catch (CompletionFailure ex) { chk.completionError(cdef.pos(), ex); } return null; }
[ "JavaFileObject", "genCode", "(", "Env", "<", "AttrContext", ">", "env", ",", "JCClassDecl", "cdef", ")", "throws", "IOException", "{", "try", "{", "if", "(", "gen", ".", "genClass", "(", "env", ",", "cdef", ")", "&&", "(", "errorCount", "(", ")", "==", "0", ")", ")", "return", "writer", ".", "writeClass", "(", "cdef", ".", "sym", ")", ";", "}", "catch", "(", "ClassWriter", ".", "PoolOverflow", "ex", ")", "{", "log", ".", "error", "(", "cdef", ".", "pos", "(", ")", ",", "\"limit.pool\"", ")", ";", "}", "catch", "(", "ClassWriter", ".", "StringOverflow", "ex", ")", "{", "log", ".", "error", "(", "cdef", ".", "pos", "(", ")", ",", "\"limit.string.overflow\"", ",", "ex", ".", "value", ".", "substring", "(", "0", ",", "20", ")", ")", ";", "}", "catch", "(", "CompletionFailure", "ex", ")", "{", "chk", ".", "completionError", "(", "cdef", ".", "pos", "(", ")", ",", "ex", ")", ";", "}", "return", "null", ";", "}" ]
Generate code and emit a class file for a given class @param env The attribution environment of the outermost class containing this class. @param cdef The class definition from which code is generated.
[ "Generate", "code", "and", "emit", "a", "class", "file", "for", "a", "given", "class" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L740-L753
5,745
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.readSourceFile
public void readSourceFile(JCCompilationUnit tree, ClassSymbol c) throws CompletionFailure { if (completionFailureName == c.fullname) { throw new CompletionFailure(c, "user-selected completion failure by class name"); } JavaFileObject filename = c.classfile; JavaFileObject prev = log.useSource(filename); if (tree == null) { try { tree = parse(filename, filename.getCharContent(false)); } catch (IOException e) { log.error("error.reading.file", filename, JavacFileManager.getMessage(e)); tree = make.TopLevel(List.<JCTree>nil()); } finally { log.useSource(prev); } } if (!taskListener.isEmpty()) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, tree); taskListener.started(e); } // Process module declarations. // If module resolution fails, ignore trees, and if trying to // complete a specific symbol, throw CompletionFailure. // Note that if module resolution failed, we may not even // have enough modules available to access java.lang, and // so risk getting FatalError("no.java.lang") from MemberEnter. if (!modules.enter(List.of(tree), c)) { throw new CompletionFailure(c, diags.fragment("cant.resolve.modules")); } enter.complete(List.of(tree), c); if (!taskListener.isEmpty()) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, tree); taskListener.finished(e); } if (enter.getEnv(c) == null) { boolean isPkgInfo = tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE); boolean isModuleInfo = tree.sourcefile.isNameCompatible("module-info", JavaFileObject.Kind.SOURCE); if (isModuleInfo) { if (enter.getEnv(tree.modle) == null) { JCDiagnostic diag = diagFactory.fragment("file.does.not.contain.module"); throw new ClassFinder.BadClassFile(c, filename, diag, diagFactory); } } else if (isPkgInfo) { if (enter.getEnv(tree.packge) == null) { JCDiagnostic diag = diagFactory.fragment("file.does.not.contain.package", c.location()); throw new ClassFinder.BadClassFile(c, filename, diag, diagFactory); } } else { JCDiagnostic diag = diagFactory.fragment("file.doesnt.contain.class", c.getQualifiedName()); throw new ClassFinder.BadClassFile(c, filename, diag, diagFactory); } } implicitSourceFilesRead = true; }
java
public void readSourceFile(JCCompilationUnit tree, ClassSymbol c) throws CompletionFailure { if (completionFailureName == c.fullname) { throw new CompletionFailure(c, "user-selected completion failure by class name"); } JavaFileObject filename = c.classfile; JavaFileObject prev = log.useSource(filename); if (tree == null) { try { tree = parse(filename, filename.getCharContent(false)); } catch (IOException e) { log.error("error.reading.file", filename, JavacFileManager.getMessage(e)); tree = make.TopLevel(List.<JCTree>nil()); } finally { log.useSource(prev); } } if (!taskListener.isEmpty()) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, tree); taskListener.started(e); } // Process module declarations. // If module resolution fails, ignore trees, and if trying to // complete a specific symbol, throw CompletionFailure. // Note that if module resolution failed, we may not even // have enough modules available to access java.lang, and // so risk getting FatalError("no.java.lang") from MemberEnter. if (!modules.enter(List.of(tree), c)) { throw new CompletionFailure(c, diags.fragment("cant.resolve.modules")); } enter.complete(List.of(tree), c); if (!taskListener.isEmpty()) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, tree); taskListener.finished(e); } if (enter.getEnv(c) == null) { boolean isPkgInfo = tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE); boolean isModuleInfo = tree.sourcefile.isNameCompatible("module-info", JavaFileObject.Kind.SOURCE); if (isModuleInfo) { if (enter.getEnv(tree.modle) == null) { JCDiagnostic diag = diagFactory.fragment("file.does.not.contain.module"); throw new ClassFinder.BadClassFile(c, filename, diag, diagFactory); } } else if (isPkgInfo) { if (enter.getEnv(tree.packge) == null) { JCDiagnostic diag = diagFactory.fragment("file.does.not.contain.package", c.location()); throw new ClassFinder.BadClassFile(c, filename, diag, diagFactory); } } else { JCDiagnostic diag = diagFactory.fragment("file.doesnt.contain.class", c.getQualifiedName()); throw new ClassFinder.BadClassFile(c, filename, diag, diagFactory); } } implicitSourceFilesRead = true; }
[ "public", "void", "readSourceFile", "(", "JCCompilationUnit", "tree", ",", "ClassSymbol", "c", ")", "throws", "CompletionFailure", "{", "if", "(", "completionFailureName", "==", "c", ".", "fullname", ")", "{", "throw", "new", "CompletionFailure", "(", "c", ",", "\"user-selected completion failure by class name\"", ")", ";", "}", "JavaFileObject", "filename", "=", "c", ".", "classfile", ";", "JavaFileObject", "prev", "=", "log", ".", "useSource", "(", "filename", ")", ";", "if", "(", "tree", "==", "null", ")", "{", "try", "{", "tree", "=", "parse", "(", "filename", ",", "filename", ".", "getCharContent", "(", "false", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "log", ".", "error", "(", "\"error.reading.file\"", ",", "filename", ",", "JavacFileManager", ".", "getMessage", "(", "e", ")", ")", ";", "tree", "=", "make", ".", "TopLevel", "(", "List", ".", "<", "JCTree", ">", "nil", "(", ")", ")", ";", "}", "finally", "{", "log", ".", "useSource", "(", "prev", ")", ";", "}", "}", "if", "(", "!", "taskListener", ".", "isEmpty", "(", ")", ")", "{", "TaskEvent", "e", "=", "new", "TaskEvent", "(", "TaskEvent", ".", "Kind", ".", "ENTER", ",", "tree", ")", ";", "taskListener", ".", "started", "(", "e", ")", ";", "}", "// Process module declarations.", "// If module resolution fails, ignore trees, and if trying to", "// complete a specific symbol, throw CompletionFailure.", "// Note that if module resolution failed, we may not even", "// have enough modules available to access java.lang, and", "// so risk getting FatalError(\"no.java.lang\") from MemberEnter.", "if", "(", "!", "modules", ".", "enter", "(", "List", ".", "of", "(", "tree", ")", ",", "c", ")", ")", "{", "throw", "new", "CompletionFailure", "(", "c", ",", "diags", ".", "fragment", "(", "\"cant.resolve.modules\"", ")", ")", ";", "}", "enter", ".", "complete", "(", "List", ".", "of", "(", "tree", ")", ",", "c", ")", ";", "if", "(", "!", "taskListener", ".", "isEmpty", "(", ")", ")", "{", "TaskEvent", "e", "=", "new", "TaskEvent", "(", "TaskEvent", ".", "Kind", ".", "ENTER", ",", "tree", ")", ";", "taskListener", ".", "finished", "(", "e", ")", ";", "}", "if", "(", "enter", ".", "getEnv", "(", "c", ")", "==", "null", ")", "{", "boolean", "isPkgInfo", "=", "tree", ".", "sourcefile", ".", "isNameCompatible", "(", "\"package-info\"", ",", "JavaFileObject", ".", "Kind", ".", "SOURCE", ")", ";", "boolean", "isModuleInfo", "=", "tree", ".", "sourcefile", ".", "isNameCompatible", "(", "\"module-info\"", ",", "JavaFileObject", ".", "Kind", ".", "SOURCE", ")", ";", "if", "(", "isModuleInfo", ")", "{", "if", "(", "enter", ".", "getEnv", "(", "tree", ".", "modle", ")", "==", "null", ")", "{", "JCDiagnostic", "diag", "=", "diagFactory", ".", "fragment", "(", "\"file.does.not.contain.module\"", ")", ";", "throw", "new", "ClassFinder", ".", "BadClassFile", "(", "c", ",", "filename", ",", "diag", ",", "diagFactory", ")", ";", "}", "}", "else", "if", "(", "isPkgInfo", ")", "{", "if", "(", "enter", ".", "getEnv", "(", "tree", ".", "packge", ")", "==", "null", ")", "{", "JCDiagnostic", "diag", "=", "diagFactory", ".", "fragment", "(", "\"file.does.not.contain.package\"", ",", "c", ".", "location", "(", ")", ")", ";", "throw", "new", "ClassFinder", ".", "BadClassFile", "(", "c", ",", "filename", ",", "diag", ",", "diagFactory", ")", ";", "}", "}", "else", "{", "JCDiagnostic", "diag", "=", "diagFactory", ".", "fragment", "(", "\"file.doesnt.contain.class\"", ",", "c", ".", "getQualifiedName", "(", ")", ")", ";", "throw", "new", "ClassFinder", ".", "BadClassFile", "(", "c", ",", "filename", ",", "diag", ",", "diagFactory", ")", ";", "}", "}", "implicitSourceFilesRead", "=", "true", ";", "}" ]
Compile a ClassSymbol from source, optionally using the given compilation unit as the source tree. @param tree the compilation unit in which the given ClassSymbol resides, or null if should be parsed from source @param c the ClassSymbol to complete
[ "Compile", "a", "ClassSymbol", "from", "source", "optionally", "using", "the", "given", "compilation", "unit", "as", "the", "source", "tree", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L792-L861
5,746
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.parseFiles
public List<JCCompilationUnit> parseFiles(Iterable<JavaFileObject> fileObjects) { if (shouldStop(CompileState.PARSE)) return List.nil(); //parse all files ListBuffer<JCCompilationUnit> trees = new ListBuffer<>(); Set<JavaFileObject> filesSoFar = new HashSet<>(); for (JavaFileObject fileObject : fileObjects) { if (!filesSoFar.contains(fileObject)) { filesSoFar.add(fileObject); trees.append(parse(fileObject)); } } return trees.toList(); }
java
public List<JCCompilationUnit> parseFiles(Iterable<JavaFileObject> fileObjects) { if (shouldStop(CompileState.PARSE)) return List.nil(); //parse all files ListBuffer<JCCompilationUnit> trees = new ListBuffer<>(); Set<JavaFileObject> filesSoFar = new HashSet<>(); for (JavaFileObject fileObject : fileObjects) { if (!filesSoFar.contains(fileObject)) { filesSoFar.add(fileObject); trees.append(parse(fileObject)); } } return trees.toList(); }
[ "public", "List", "<", "JCCompilationUnit", ">", "parseFiles", "(", "Iterable", "<", "JavaFileObject", ">", "fileObjects", ")", "{", "if", "(", "shouldStop", "(", "CompileState", ".", "PARSE", ")", ")", "return", "List", ".", "nil", "(", ")", ";", "//parse all files", "ListBuffer", "<", "JCCompilationUnit", ">", "trees", "=", "new", "ListBuffer", "<>", "(", ")", ";", "Set", "<", "JavaFileObject", ">", "filesSoFar", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "JavaFileObject", "fileObject", ":", "fileObjects", ")", "{", "if", "(", "!", "filesSoFar", ".", "contains", "(", "fileObject", ")", ")", "{", "filesSoFar", ".", "add", "(", "fileObject", ")", ";", "trees", ".", "append", "(", "parse", "(", "fileObject", ")", ")", ";", "}", "}", "return", "trees", ".", "toList", "(", ")", ";", "}" ]
Parses a list of files.
[ "Parses", "a", "list", "of", "files", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L1002-L1016
5,747
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.initProcessAnnotations
public void initProcessAnnotations(Iterable<? extends Processor> processors, Collection<? extends JavaFileObject> initialFiles, Collection<String> initialClassNames) { // Process annotations if processing is not disabled and there // is at least one Processor available. if (options.isSet(PROC, "none")) { processAnnotations = false; } else if (procEnvImpl == null) { procEnvImpl = JavacProcessingEnvironment.instance(context); procEnvImpl.setProcessors(processors); processAnnotations = procEnvImpl.atLeastOneProcessor(); if (processAnnotations) { options.put("parameters", "parameters"); reader.saveParameterNames = true; keepComments = true; genEndPos = true; if (!taskListener.isEmpty()) taskListener.started(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING)); deferredDiagnosticHandler = new Log.DeferredDiagnosticHandler(log); procEnvImpl.getFiler().setInitialState(initialFiles, initialClassNames); } else { // free resources procEnvImpl.close(); } } }
java
public void initProcessAnnotations(Iterable<? extends Processor> processors, Collection<? extends JavaFileObject> initialFiles, Collection<String> initialClassNames) { // Process annotations if processing is not disabled and there // is at least one Processor available. if (options.isSet(PROC, "none")) { processAnnotations = false; } else if (procEnvImpl == null) { procEnvImpl = JavacProcessingEnvironment.instance(context); procEnvImpl.setProcessors(processors); processAnnotations = procEnvImpl.atLeastOneProcessor(); if (processAnnotations) { options.put("parameters", "parameters"); reader.saveParameterNames = true; keepComments = true; genEndPos = true; if (!taskListener.isEmpty()) taskListener.started(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING)); deferredDiagnosticHandler = new Log.DeferredDiagnosticHandler(log); procEnvImpl.getFiler().setInitialState(initialFiles, initialClassNames); } else { // free resources procEnvImpl.close(); } } }
[ "public", "void", "initProcessAnnotations", "(", "Iterable", "<", "?", "extends", "Processor", ">", "processors", ",", "Collection", "<", "?", "extends", "JavaFileObject", ">", "initialFiles", ",", "Collection", "<", "String", ">", "initialClassNames", ")", "{", "// Process annotations if processing is not disabled and there", "// is at least one Processor available.", "if", "(", "options", ".", "isSet", "(", "PROC", ",", "\"none\"", ")", ")", "{", "processAnnotations", "=", "false", ";", "}", "else", "if", "(", "procEnvImpl", "==", "null", ")", "{", "procEnvImpl", "=", "JavacProcessingEnvironment", ".", "instance", "(", "context", ")", ";", "procEnvImpl", ".", "setProcessors", "(", "processors", ")", ";", "processAnnotations", "=", "procEnvImpl", ".", "atLeastOneProcessor", "(", ")", ";", "if", "(", "processAnnotations", ")", "{", "options", ".", "put", "(", "\"parameters\"", ",", "\"parameters\"", ")", ";", "reader", ".", "saveParameterNames", "=", "true", ";", "keepComments", "=", "true", ";", "genEndPos", "=", "true", ";", "if", "(", "!", "taskListener", ".", "isEmpty", "(", ")", ")", "taskListener", ".", "started", "(", "new", "TaskEvent", "(", "TaskEvent", ".", "Kind", ".", "ANNOTATION_PROCESSING", ")", ")", ";", "deferredDiagnosticHandler", "=", "new", "Log", ".", "DeferredDiagnosticHandler", "(", "log", ")", ";", "procEnvImpl", ".", "getFiler", "(", ")", ".", "setInitialState", "(", "initialFiles", ",", "initialClassNames", ")", ";", "}", "else", "{", "// free resources", "procEnvImpl", ".", "close", "(", ")", ";", "}", "}", "}" ]
Check if we should process annotations. If so, and if no scanner is yet registered, then set up the DocCommentScanner to catch doc comments, and set keepComments so the parser records them in the compilation unit. @param processors user provided annotation processors to bypass discovery, {@code null} means that no processors were provided
[ "Check", "if", "we", "should", "process", "annotations", ".", "If", "so", "and", "if", "no", "scanner", "is", "yet", "registered", "then", "set", "up", "the", "DocCommentScanner", "to", "catch", "doc", "comments", "and", "set", "keepComments", "so", "the", "parser", "records", "them", "in", "the", "compilation", "unit", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L1114-L1139
5,748
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.processAnnotations
public void processAnnotations(List<JCCompilationUnit> roots, Collection<String> classnames) { if (shouldStop(CompileState.PROCESS)) { // Errors were encountered. // Unless all the errors are resolve errors, the errors were parse errors // or other errors during enter which cannot be fixed by running // any annotation processors. if (unrecoverableError()) { deferredDiagnosticHandler.reportDeferredDiagnostics(); log.popDiagnosticHandler(deferredDiagnosticHandler); return ; } } // ASSERT: processAnnotations and procEnvImpl should have been set up by // by initProcessAnnotations // NOTE: The !classnames.isEmpty() checks should be refactored to Main. if (!processAnnotations) { // If there are no annotation processors present, and // annotation processing is to occur with compilation, // emit a warning. if (options.isSet(PROC, "only")) { log.warning("proc.proc-only.requested.no.procs"); todo.clear(); } // If not processing annotations, classnames must be empty if (!classnames.isEmpty()) { log.error("proc.no.explicit.annotation.processing.requested", classnames); } Assert.checkNull(deferredDiagnosticHandler); return ; // continue regular compilation } Assert.checkNonNull(deferredDiagnosticHandler); try { List<ClassSymbol> classSymbols = List.nil(); List<PackageSymbol> pckSymbols = List.nil(); if (!classnames.isEmpty()) { // Check for explicit request for annotation // processing if (!explicitAnnotationProcessingRequested()) { log.error("proc.no.explicit.annotation.processing.requested", classnames); deferredDiagnosticHandler.reportDeferredDiagnostics(); log.popDiagnosticHandler(deferredDiagnosticHandler); return ; // TODO: Will this halt compilation? } else { boolean errors = false; for (String nameStr : classnames) { Symbol sym = resolveBinaryNameOrIdent(nameStr); if (sym == null || (sym.kind == PCK && !processPcks) || sym.kind == ABSENT_TYP) { if (sym != silentFail) log.error(Errors.ProcCantFindClass(nameStr)); errors = true; continue; } try { if (sym.kind == PCK) sym.complete(); if (sym.exists()) { if (sym.kind == PCK) pckSymbols = pckSymbols.prepend((PackageSymbol)sym); else classSymbols = classSymbols.prepend((ClassSymbol)sym); continue; } Assert.check(sym.kind == PCK); log.warning(Warnings.ProcPackageDoesNotExist(nameStr)); pckSymbols = pckSymbols.prepend((PackageSymbol)sym); } catch (CompletionFailure e) { log.error(Errors.ProcCantFindClass(nameStr)); errors = true; continue; } } if (errors) { deferredDiagnosticHandler.reportDeferredDiagnostics(); log.popDiagnosticHandler(deferredDiagnosticHandler); return ; } } } try { annotationProcessingOccurred = procEnvImpl.doProcessing(roots, classSymbols, pckSymbols, deferredDiagnosticHandler); // doProcessing will have handled deferred diagnostics } finally { procEnvImpl.close(); } } catch (CompletionFailure ex) { log.error("cant.access", ex.sym, ex.getDetailValue()); if (deferredDiagnosticHandler != null) { deferredDiagnosticHandler.reportDeferredDiagnostics(); log.popDiagnosticHandler(deferredDiagnosticHandler); } } }
java
public void processAnnotations(List<JCCompilationUnit> roots, Collection<String> classnames) { if (shouldStop(CompileState.PROCESS)) { // Errors were encountered. // Unless all the errors are resolve errors, the errors were parse errors // or other errors during enter which cannot be fixed by running // any annotation processors. if (unrecoverableError()) { deferredDiagnosticHandler.reportDeferredDiagnostics(); log.popDiagnosticHandler(deferredDiagnosticHandler); return ; } } // ASSERT: processAnnotations and procEnvImpl should have been set up by // by initProcessAnnotations // NOTE: The !classnames.isEmpty() checks should be refactored to Main. if (!processAnnotations) { // If there are no annotation processors present, and // annotation processing is to occur with compilation, // emit a warning. if (options.isSet(PROC, "only")) { log.warning("proc.proc-only.requested.no.procs"); todo.clear(); } // If not processing annotations, classnames must be empty if (!classnames.isEmpty()) { log.error("proc.no.explicit.annotation.processing.requested", classnames); } Assert.checkNull(deferredDiagnosticHandler); return ; // continue regular compilation } Assert.checkNonNull(deferredDiagnosticHandler); try { List<ClassSymbol> classSymbols = List.nil(); List<PackageSymbol> pckSymbols = List.nil(); if (!classnames.isEmpty()) { // Check for explicit request for annotation // processing if (!explicitAnnotationProcessingRequested()) { log.error("proc.no.explicit.annotation.processing.requested", classnames); deferredDiagnosticHandler.reportDeferredDiagnostics(); log.popDiagnosticHandler(deferredDiagnosticHandler); return ; // TODO: Will this halt compilation? } else { boolean errors = false; for (String nameStr : classnames) { Symbol sym = resolveBinaryNameOrIdent(nameStr); if (sym == null || (sym.kind == PCK && !processPcks) || sym.kind == ABSENT_TYP) { if (sym != silentFail) log.error(Errors.ProcCantFindClass(nameStr)); errors = true; continue; } try { if (sym.kind == PCK) sym.complete(); if (sym.exists()) { if (sym.kind == PCK) pckSymbols = pckSymbols.prepend((PackageSymbol)sym); else classSymbols = classSymbols.prepend((ClassSymbol)sym); continue; } Assert.check(sym.kind == PCK); log.warning(Warnings.ProcPackageDoesNotExist(nameStr)); pckSymbols = pckSymbols.prepend((PackageSymbol)sym); } catch (CompletionFailure e) { log.error(Errors.ProcCantFindClass(nameStr)); errors = true; continue; } } if (errors) { deferredDiagnosticHandler.reportDeferredDiagnostics(); log.popDiagnosticHandler(deferredDiagnosticHandler); return ; } } } try { annotationProcessingOccurred = procEnvImpl.doProcessing(roots, classSymbols, pckSymbols, deferredDiagnosticHandler); // doProcessing will have handled deferred diagnostics } finally { procEnvImpl.close(); } } catch (CompletionFailure ex) { log.error("cant.access", ex.sym, ex.getDetailValue()); if (deferredDiagnosticHandler != null) { deferredDiagnosticHandler.reportDeferredDiagnostics(); log.popDiagnosticHandler(deferredDiagnosticHandler); } } }
[ "public", "void", "processAnnotations", "(", "List", "<", "JCCompilationUnit", ">", "roots", ",", "Collection", "<", "String", ">", "classnames", ")", "{", "if", "(", "shouldStop", "(", "CompileState", ".", "PROCESS", ")", ")", "{", "// Errors were encountered.", "// Unless all the errors are resolve errors, the errors were parse errors", "// or other errors during enter which cannot be fixed by running", "// any annotation processors.", "if", "(", "unrecoverableError", "(", ")", ")", "{", "deferredDiagnosticHandler", ".", "reportDeferredDiagnostics", "(", ")", ";", "log", ".", "popDiagnosticHandler", "(", "deferredDiagnosticHandler", ")", ";", "return", ";", "}", "}", "// ASSERT: processAnnotations and procEnvImpl should have been set up by", "// by initProcessAnnotations", "// NOTE: The !classnames.isEmpty() checks should be refactored to Main.", "if", "(", "!", "processAnnotations", ")", "{", "// If there are no annotation processors present, and", "// annotation processing is to occur with compilation,", "// emit a warning.", "if", "(", "options", ".", "isSet", "(", "PROC", ",", "\"only\"", ")", ")", "{", "log", ".", "warning", "(", "\"proc.proc-only.requested.no.procs\"", ")", ";", "todo", ".", "clear", "(", ")", ";", "}", "// If not processing annotations, classnames must be empty", "if", "(", "!", "classnames", ".", "isEmpty", "(", ")", ")", "{", "log", ".", "error", "(", "\"proc.no.explicit.annotation.processing.requested\"", ",", "classnames", ")", ";", "}", "Assert", ".", "checkNull", "(", "deferredDiagnosticHandler", ")", ";", "return", ";", "// continue regular compilation", "}", "Assert", ".", "checkNonNull", "(", "deferredDiagnosticHandler", ")", ";", "try", "{", "List", "<", "ClassSymbol", ">", "classSymbols", "=", "List", ".", "nil", "(", ")", ";", "List", "<", "PackageSymbol", ">", "pckSymbols", "=", "List", ".", "nil", "(", ")", ";", "if", "(", "!", "classnames", ".", "isEmpty", "(", ")", ")", "{", "// Check for explicit request for annotation", "// processing", "if", "(", "!", "explicitAnnotationProcessingRequested", "(", ")", ")", "{", "log", ".", "error", "(", "\"proc.no.explicit.annotation.processing.requested\"", ",", "classnames", ")", ";", "deferredDiagnosticHandler", ".", "reportDeferredDiagnostics", "(", ")", ";", "log", ".", "popDiagnosticHandler", "(", "deferredDiagnosticHandler", ")", ";", "return", ";", "// TODO: Will this halt compilation?", "}", "else", "{", "boolean", "errors", "=", "false", ";", "for", "(", "String", "nameStr", ":", "classnames", ")", "{", "Symbol", "sym", "=", "resolveBinaryNameOrIdent", "(", "nameStr", ")", ";", "if", "(", "sym", "==", "null", "||", "(", "sym", ".", "kind", "==", "PCK", "&&", "!", "processPcks", ")", "||", "sym", ".", "kind", "==", "ABSENT_TYP", ")", "{", "if", "(", "sym", "!=", "silentFail", ")", "log", ".", "error", "(", "Errors", ".", "ProcCantFindClass", "(", "nameStr", ")", ")", ";", "errors", "=", "true", ";", "continue", ";", "}", "try", "{", "if", "(", "sym", ".", "kind", "==", "PCK", ")", "sym", ".", "complete", "(", ")", ";", "if", "(", "sym", ".", "exists", "(", ")", ")", "{", "if", "(", "sym", ".", "kind", "==", "PCK", ")", "pckSymbols", "=", "pckSymbols", ".", "prepend", "(", "(", "PackageSymbol", ")", "sym", ")", ";", "else", "classSymbols", "=", "classSymbols", ".", "prepend", "(", "(", "ClassSymbol", ")", "sym", ")", ";", "continue", ";", "}", "Assert", ".", "check", "(", "sym", ".", "kind", "==", "PCK", ")", ";", "log", ".", "warning", "(", "Warnings", ".", "ProcPackageDoesNotExist", "(", "nameStr", ")", ")", ";", "pckSymbols", "=", "pckSymbols", ".", "prepend", "(", "(", "PackageSymbol", ")", "sym", ")", ";", "}", "catch", "(", "CompletionFailure", "e", ")", "{", "log", ".", "error", "(", "Errors", ".", "ProcCantFindClass", "(", "nameStr", ")", ")", ";", "errors", "=", "true", ";", "continue", ";", "}", "}", "if", "(", "errors", ")", "{", "deferredDiagnosticHandler", ".", "reportDeferredDiagnostics", "(", ")", ";", "log", ".", "popDiagnosticHandler", "(", "deferredDiagnosticHandler", ")", ";", "return", ";", "}", "}", "}", "try", "{", "annotationProcessingOccurred", "=", "procEnvImpl", ".", "doProcessing", "(", "roots", ",", "classSymbols", ",", "pckSymbols", ",", "deferredDiagnosticHandler", ")", ";", "// doProcessing will have handled deferred diagnostics", "}", "finally", "{", "procEnvImpl", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "CompletionFailure", "ex", ")", "{", "log", ".", "error", "(", "\"cant.access\"", ",", "ex", ".", "sym", ",", "ex", ".", "getDetailValue", "(", ")", ")", ";", "if", "(", "deferredDiagnosticHandler", "!=", "null", ")", "{", "deferredDiagnosticHandler", ".", "reportDeferredDiagnostics", "(", ")", ";", "log", ".", "popDiagnosticHandler", "(", "deferredDiagnosticHandler", ")", ";", "}", "}", "}" ]
or determined to be transient, and therefore suppressed.
[ "or", "determined", "to", "be", "transient", "and", "therefore", "suppressed", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L1156-L1261
5,749
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.attribute
public Queue<Env<AttrContext>> attribute(Queue<Env<AttrContext>> envs) { ListBuffer<Env<AttrContext>> results = new ListBuffer<>(); while (!envs.isEmpty()) results.append(attribute(envs.remove())); return stopIfError(CompileState.ATTR, results); }
java
public Queue<Env<AttrContext>> attribute(Queue<Env<AttrContext>> envs) { ListBuffer<Env<AttrContext>> results = new ListBuffer<>(); while (!envs.isEmpty()) results.append(attribute(envs.remove())); return stopIfError(CompileState.ATTR, results); }
[ "public", "Queue", "<", "Env", "<", "AttrContext", ">", ">", "attribute", "(", "Queue", "<", "Env", "<", "AttrContext", ">", ">", "envs", ")", "{", "ListBuffer", "<", "Env", "<", "AttrContext", ">>", "results", "=", "new", "ListBuffer", "<>", "(", ")", ";", "while", "(", "!", "envs", ".", "isEmpty", "(", ")", ")", "results", ".", "append", "(", "attribute", "(", "envs", ".", "remove", "(", ")", ")", ")", ";", "return", "stopIfError", "(", "CompileState", ".", "ATTR", ",", "results", ")", ";", "}" ]
Attribute a list of parse trees, such as found on the "todo" list. Note that attributing classes may cause additional files to be parsed and entered via the SourceCompleter. Attribution of the entries in the list does not stop if any errors occur. @return a list of environments for attribute classes.
[ "Attribute", "a", "list", "of", "parse", "trees", "such", "as", "found", "on", "the", "todo", "list", ".", "Note", "that", "attributing", "classes", "may", "cause", "additional", "files", "to", "be", "parsed", "and", "entered", "via", "the", "SourceCompleter", ".", "Attribution", "of", "the", "entries", "in", "the", "list", "does", "not", "stop", "if", "any", "errors", "occur", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L1299-L1304
5,750
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.attribute
public Env<AttrContext> attribute(Env<AttrContext> env) { if (compileStates.isDone(env, CompileState.ATTR)) return env; if (verboseCompilePolicy) printNote("[attribute " + env.enclClass.sym + "]"); if (verbose) log.printVerbose("checking.attribution", env.enclClass.sym); if (!taskListener.isEmpty()) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym); taskListener.started(e); } JavaFileObject prev = log.useSource( env.enclClass.sym.sourcefile != null ? env.enclClass.sym.sourcefile : env.toplevel.sourcefile); try { attr.attrib(env); if (errorCount() > 0 && !shouldStop(CompileState.ATTR)) { //if in fail-over mode, ensure that AST expression nodes //are correctly initialized (e.g. they have a type/symbol) attr.postAttr(env.tree); } compileStates.put(env, CompileState.ATTR); } finally { log.useSource(prev); } return env; }
java
public Env<AttrContext> attribute(Env<AttrContext> env) { if (compileStates.isDone(env, CompileState.ATTR)) return env; if (verboseCompilePolicy) printNote("[attribute " + env.enclClass.sym + "]"); if (verbose) log.printVerbose("checking.attribution", env.enclClass.sym); if (!taskListener.isEmpty()) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym); taskListener.started(e); } JavaFileObject prev = log.useSource( env.enclClass.sym.sourcefile != null ? env.enclClass.sym.sourcefile : env.toplevel.sourcefile); try { attr.attrib(env); if (errorCount() > 0 && !shouldStop(CompileState.ATTR)) { //if in fail-over mode, ensure that AST expression nodes //are correctly initialized (e.g. they have a type/symbol) attr.postAttr(env.tree); } compileStates.put(env, CompileState.ATTR); } finally { log.useSource(prev); } return env; }
[ "public", "Env", "<", "AttrContext", ">", "attribute", "(", "Env", "<", "AttrContext", ">", "env", ")", "{", "if", "(", "compileStates", ".", "isDone", "(", "env", ",", "CompileState", ".", "ATTR", ")", ")", "return", "env", ";", "if", "(", "verboseCompilePolicy", ")", "printNote", "(", "\"[attribute \"", "+", "env", ".", "enclClass", ".", "sym", "+", "\"]\"", ")", ";", "if", "(", "verbose", ")", "log", ".", "printVerbose", "(", "\"checking.attribution\"", ",", "env", ".", "enclClass", ".", "sym", ")", ";", "if", "(", "!", "taskListener", ".", "isEmpty", "(", ")", ")", "{", "TaskEvent", "e", "=", "new", "TaskEvent", "(", "TaskEvent", ".", "Kind", ".", "ANALYZE", ",", "env", ".", "toplevel", ",", "env", ".", "enclClass", ".", "sym", ")", ";", "taskListener", ".", "started", "(", "e", ")", ";", "}", "JavaFileObject", "prev", "=", "log", ".", "useSource", "(", "env", ".", "enclClass", ".", "sym", ".", "sourcefile", "!=", "null", "?", "env", ".", "enclClass", ".", "sym", ".", "sourcefile", ":", "env", ".", "toplevel", ".", "sourcefile", ")", ";", "try", "{", "attr", ".", "attrib", "(", "env", ")", ";", "if", "(", "errorCount", "(", ")", ">", "0", "&&", "!", "shouldStop", "(", "CompileState", ".", "ATTR", ")", ")", "{", "//if in fail-over mode, ensure that AST expression nodes", "//are correctly initialized (e.g. they have a type/symbol)", "attr", ".", "postAttr", "(", "env", ".", "tree", ")", ";", "}", "compileStates", ".", "put", "(", "env", ",", "CompileState", ".", "ATTR", ")", ";", "}", "finally", "{", "log", ".", "useSource", "(", "prev", ")", ";", "}", "return", "env", ";", "}" ]
Attribute a parse tree. @return the attributed parse tree
[ "Attribute", "a", "parse", "tree", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L1310-L1342
5,751
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.flow
public Queue<Env<AttrContext>> flow(Queue<Env<AttrContext>> envs) { ListBuffer<Env<AttrContext>> results = new ListBuffer<>(); for (Env<AttrContext> env: envs) { flow(env, results); } return stopIfError(CompileState.FLOW, results); }
java
public Queue<Env<AttrContext>> flow(Queue<Env<AttrContext>> envs) { ListBuffer<Env<AttrContext>> results = new ListBuffer<>(); for (Env<AttrContext> env: envs) { flow(env, results); } return stopIfError(CompileState.FLOW, results); }
[ "public", "Queue", "<", "Env", "<", "AttrContext", ">", ">", "flow", "(", "Queue", "<", "Env", "<", "AttrContext", ">", ">", "envs", ")", "{", "ListBuffer", "<", "Env", "<", "AttrContext", ">>", "results", "=", "new", "ListBuffer", "<>", "(", ")", ";", "for", "(", "Env", "<", "AttrContext", ">", "env", ":", "envs", ")", "{", "flow", "(", "env", ",", "results", ")", ";", "}", "return", "stopIfError", "(", "CompileState", ".", "FLOW", ",", "results", ")", ";", "}" ]
Perform dataflow checks on attributed parse trees. These include checks for definite assignment and unreachable statements. If any errors occur, an empty list will be returned. @return the list of attributed parse trees
[ "Perform", "dataflow", "checks", "on", "attributed", "parse", "trees", ".", "These", "include", "checks", "for", "definite", "assignment", "and", "unreachable", "statements", ".", "If", "any", "errors", "occur", "an", "empty", "list", "will", "be", "returned", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L1350-L1356
5,752
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.generate
public void generate(Queue<Pair<Env<AttrContext>, JCClassDecl>> queue) { generate(queue, null); }
java
public void generate(Queue<Pair<Env<AttrContext>, JCClassDecl>> queue) { generate(queue, null); }
[ "public", "void", "generate", "(", "Queue", "<", "Pair", "<", "Env", "<", "AttrContext", ">", ",", "JCClassDecl", ">", ">", "queue", ")", "{", "generate", "(", "queue", ",", "null", ")", ";", "}" ]
Generates the source or class file for a list of classes. The decision to generate a source file or a class file is based upon the compiler's options. Generation stops if an error occurs while writing files.
[ "Generates", "the", "source", "or", "class", "file", "for", "a", "list", "of", "classes", ".", "The", "decision", "to", "generate", "a", "source", "file", "or", "a", "class", "file", "is", "based", "upon", "the", "compiler", "s", "options", ".", "Generation", "stops", "if", "an", "error", "occurs", "while", "writing", "files", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L1588-L1590
5,753
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.printCount
public void printCount(String kind, int count) { if (count != 0) { String key; if (count == 1) key = "count." + kind; else key = "count." + kind + ".plural"; log.printLines(WriterKind.ERROR, key, String.valueOf(count)); log.flush(Log.WriterKind.ERROR); } }
java
public void printCount(String kind, int count) { if (count != 0) { String key; if (count == 1) key = "count." + kind; else key = "count." + kind + ".plural"; log.printLines(WriterKind.ERROR, key, String.valueOf(count)); log.flush(Log.WriterKind.ERROR); } }
[ "public", "void", "printCount", "(", "String", "kind", ",", "int", "count", ")", "{", "if", "(", "count", "!=", "0", ")", "{", "String", "key", ";", "if", "(", "count", "==", "1", ")", "key", "=", "\"count.\"", "+", "kind", ";", "else", "key", "=", "\"count.\"", "+", "kind", "+", "\".plural\"", ";", "log", ".", "printLines", "(", "WriterKind", ".", "ERROR", ",", "key", ",", "String", ".", "valueOf", "(", "count", ")", ")", ";", "log", ".", "flush", "(", "Log", ".", "WriterKind", ".", "ERROR", ")", ";", "}", "}" ]
Print numbers of errors and warnings.
[ "Print", "numbers", "of", "errors", "and", "warnings", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L1815-L1825
5,754
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
AbstractModuleIndexWriter.buildModulePackagesIndexFile
protected void buildModulePackagesIndexFile(String title, boolean includeScript, ModuleElement mdle) throws DocFileIOException { String windowOverview = configuration.getText(title); Content body = getBody(includeScript, getWindowTitle(windowOverview)); addNavigationBarHeader(body); addOverviewHeader(body); addModulePackagesIndex(body, mdle); addOverview(body); addNavigationBarFooter(body); printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle), includeScript, body); }
java
protected void buildModulePackagesIndexFile(String title, boolean includeScript, ModuleElement mdle) throws DocFileIOException { String windowOverview = configuration.getText(title); Content body = getBody(includeScript, getWindowTitle(windowOverview)); addNavigationBarHeader(body); addOverviewHeader(body); addModulePackagesIndex(body, mdle); addOverview(body); addNavigationBarFooter(body); printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle), includeScript, body); }
[ "protected", "void", "buildModulePackagesIndexFile", "(", "String", "title", ",", "boolean", "includeScript", ",", "ModuleElement", "mdle", ")", "throws", "DocFileIOException", "{", "String", "windowOverview", "=", "configuration", ".", "getText", "(", "title", ")", ";", "Content", "body", "=", "getBody", "(", "includeScript", ",", "getWindowTitle", "(", "windowOverview", ")", ")", ";", "addNavigationBarHeader", "(", "body", ")", ";", "addOverviewHeader", "(", "body", ")", ";", "addModulePackagesIndex", "(", "body", ",", "mdle", ")", ";", "addOverview", "(", "body", ")", ";", "addNavigationBarFooter", "(", "body", ")", ";", "printHtmlDocument", "(", "configuration", ".", "metakeywords", ".", "getOverviewMetaKeywords", "(", "title", ",", "configuration", ".", "doctitle", ")", ",", "includeScript", ",", "body", ")", ";", "}" ]
Generate and prints the contents in the module packages index file. Call appropriate methods from the sub-class in order to generate Frame or Non Frame format. @param title the title of the window. @param includeScript boolean set true if windowtitle script is to be included @param mdle the name of the module being documented @throws DocFileIOException if there is an exception building the module packages index file
[ "Generate", "and", "prints", "the", "contents", "in", "the", "module", "packages", "index", "file", ".", "Call", "appropriate", "methods", "from", "the", "sub", "-", "class", "in", "order", "to", "generate", "Frame", "or", "Non", "Frame", "format", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java#L151-L162
5,755
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
AbstractModuleIndexWriter.addIndex
protected void addIndex(Content body) { addIndexContents(configuration.modules, "doclet.Module_Summary", configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Module_Summary"), configuration.getText("doclet.modules")), body); }
java
protected void addIndex(Content body) { addIndexContents(configuration.modules, "doclet.Module_Summary", configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Module_Summary"), configuration.getText("doclet.modules")), body); }
[ "protected", "void", "addIndex", "(", "Content", "body", ")", "{", "addIndexContents", "(", "configuration", ".", "modules", ",", "\"doclet.Module_Summary\"", ",", "configuration", ".", "getText", "(", "\"doclet.Member_Table_Summary\"", ",", "configuration", ".", "getText", "(", "\"doclet.Module_Summary\"", ")", ",", "configuration", ".", "getText", "(", "\"doclet.modules\"", ")", ")", ",", "body", ")", ";", "}" ]
Adds the frame or non-frame module index to the documentation tree. @param body the document tree to which the index will be added
[ "Adds", "the", "frame", "or", "non", "-", "frame", "module", "index", "to", "the", "documentation", "tree", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java#L176-L181
5,756
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
AbstractModuleIndexWriter.addModulePackagesIndex
protected void addModulePackagesIndex(Content body, ModuleElement mdle) { addModulePackagesIndexContents("doclet.Module_Summary", configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Module_Summary"), configuration.getText("doclet.modules")), body, mdle); }
java
protected void addModulePackagesIndex(Content body, ModuleElement mdle) { addModulePackagesIndexContents("doclet.Module_Summary", configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Module_Summary"), configuration.getText("doclet.modules")), body, mdle); }
[ "protected", "void", "addModulePackagesIndex", "(", "Content", "body", ",", "ModuleElement", "mdle", ")", "{", "addModulePackagesIndexContents", "(", "\"doclet.Module_Summary\"", ",", "configuration", ".", "getText", "(", "\"doclet.Member_Table_Summary\"", ",", "configuration", ".", "getText", "(", "\"doclet.Module_Summary\"", ")", ",", "configuration", ".", "getText", "(", "\"doclet.modules\"", ")", ")", ",", "body", ",", "mdle", ")", ";", "}" ]
Adds the frame or non-frame module packages index to the documentation tree. @param body the document tree to which the index will be added @param mdle the module being documented
[ "Adds", "the", "frame", "or", "non", "-", "frame", "module", "packages", "index", "to", "the", "documentation", "tree", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java#L189-L194
5,757
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
AbstractModuleIndexWriter.addIndexContents
protected void addIndexContents(Collection<ModuleElement> modules, String text, String tableSummary, Content body) { HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV)) ? HtmlTree.NAV() : new HtmlTree(HtmlTag.DIV); htmlTree.addStyle(HtmlStyle.indexNav); HtmlTree ul = new HtmlTree(HtmlTag.UL); addAllClassesLink(ul); addAllPackagesLink(ul); htmlTree.addContent(ul); body.addContent(htmlTree); addModulesList(modules, text, tableSummary, body); }
java
protected void addIndexContents(Collection<ModuleElement> modules, String text, String tableSummary, Content body) { HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV)) ? HtmlTree.NAV() : new HtmlTree(HtmlTag.DIV); htmlTree.addStyle(HtmlStyle.indexNav); HtmlTree ul = new HtmlTree(HtmlTag.UL); addAllClassesLink(ul); addAllPackagesLink(ul); htmlTree.addContent(ul); body.addContent(htmlTree); addModulesList(modules, text, tableSummary, body); }
[ "protected", "void", "addIndexContents", "(", "Collection", "<", "ModuleElement", ">", "modules", ",", "String", "text", ",", "String", "tableSummary", ",", "Content", "body", ")", "{", "HtmlTree", "htmlTree", "=", "(", "configuration", ".", "allowTag", "(", "HtmlTag", ".", "NAV", ")", ")", "?", "HtmlTree", ".", "NAV", "(", ")", ":", "new", "HtmlTree", "(", "HtmlTag", ".", "DIV", ")", ";", "htmlTree", ".", "addStyle", "(", "HtmlStyle", ".", "indexNav", ")", ";", "HtmlTree", "ul", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "UL", ")", ";", "addAllClassesLink", "(", "ul", ")", ";", "addAllPackagesLink", "(", "ul", ")", ";", "htmlTree", ".", "addContent", "(", "ul", ")", ";", "body", ".", "addContent", "(", "htmlTree", ")", ";", "addModulesList", "(", "modules", ",", "text", ",", "tableSummary", ",", "body", ")", ";", "}" ]
Adds module index contents. Call appropriate methods from the sub-classes. Adds it to the body HtmlTree @param modules the modules to be documented @param text string which will be used as the heading @param tableSummary summary for the table @param body the document tree to which the index contents will be added
[ "Adds", "module", "index", "contents", ".", "Call", "appropriate", "methods", "from", "the", "sub", "-", "classes", ".", "Adds", "it", "to", "the", "body", "HtmlTree" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java#L205-L217
5,758
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
AbstractModuleIndexWriter.addModulePackagesIndexContents
protected void addModulePackagesIndexContents(String text, String tableSummary, Content body, ModuleElement mdle) { HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV)) ? HtmlTree.NAV() : new HtmlTree(HtmlTag.DIV); htmlTree.addStyle(HtmlStyle.indexNav); HtmlTree ul = new HtmlTree(HtmlTag.UL); addAllClassesLink(ul); addAllPackagesLink(ul); addAllModulesLink(ul); htmlTree.addContent(ul); body.addContent(htmlTree); addModulePackagesList(modules, text, tableSummary, body, mdle); }
java
protected void addModulePackagesIndexContents(String text, String tableSummary, Content body, ModuleElement mdle) { HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV)) ? HtmlTree.NAV() : new HtmlTree(HtmlTag.DIV); htmlTree.addStyle(HtmlStyle.indexNav); HtmlTree ul = new HtmlTree(HtmlTag.UL); addAllClassesLink(ul); addAllPackagesLink(ul); addAllModulesLink(ul); htmlTree.addContent(ul); body.addContent(htmlTree); addModulePackagesList(modules, text, tableSummary, body, mdle); }
[ "protected", "void", "addModulePackagesIndexContents", "(", "String", "text", ",", "String", "tableSummary", ",", "Content", "body", ",", "ModuleElement", "mdle", ")", "{", "HtmlTree", "htmlTree", "=", "(", "configuration", ".", "allowTag", "(", "HtmlTag", ".", "NAV", ")", ")", "?", "HtmlTree", ".", "NAV", "(", ")", ":", "new", "HtmlTree", "(", "HtmlTag", ".", "DIV", ")", ";", "htmlTree", ".", "addStyle", "(", "HtmlStyle", ".", "indexNav", ")", ";", "HtmlTree", "ul", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "UL", ")", ";", "addAllClassesLink", "(", "ul", ")", ";", "addAllPackagesLink", "(", "ul", ")", ";", "addAllModulesLink", "(", "ul", ")", ";", "htmlTree", ".", "addContent", "(", "ul", ")", ";", "body", ".", "addContent", "(", "htmlTree", ")", ";", "addModulePackagesList", "(", "modules", ",", "text", ",", "tableSummary", ",", "body", ",", "mdle", ")", ";", "}" ]
Adds module packages index contents. Call appropriate methods from the sub-classes. Adds it to the body HtmlTree @param text string which will be used as the heading @param tableSummary summary for the table @param body the document tree to which the index contents will be added @param mdle the module being documented
[ "Adds", "module", "packages", "index", "contents", ".", "Call", "appropriate", "methods", "from", "the", "sub", "-", "classes", ".", "Adds", "it", "to", "the", "body", "HtmlTree" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java#L228-L241
5,759
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java
HtmlDocWriter.getEnclosingPackageName
public String getEnclosingPackageName(TypeElement te) { PackageElement encl = configuration.utils.containingPackage(te); return (encl.isUnnamed()) ? "" : (encl.getQualifiedName() + "."); }
java
public String getEnclosingPackageName(TypeElement te) { PackageElement encl = configuration.utils.containingPackage(te); return (encl.isUnnamed()) ? "" : (encl.getQualifiedName() + "."); }
[ "public", "String", "getEnclosingPackageName", "(", "TypeElement", "te", ")", "{", "PackageElement", "encl", "=", "configuration", ".", "utils", ".", "containingPackage", "(", "te", ")", ";", "return", "(", "encl", ".", "isUnnamed", "(", ")", ")", "?", "\"\"", ":", "(", "encl", ".", "getQualifiedName", "(", ")", "+", "\".\"", ")", ";", "}" ]
Get the enclosed name of the package @param te TypeElement @return the name
[ "Get", "the", "enclosed", "name", "of", "the", "package" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java#L306-L310
5,760
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java
ModuleIndexFrameWriter.generate
public static void generate(ConfigurationImpl configuration) throws DocFileIOException { DocPath filename = DocPaths.MODULE_OVERVIEW_FRAME; ModuleIndexFrameWriter modulegen = new ModuleIndexFrameWriter(configuration, filename); modulegen.buildModuleIndexFile("doclet.Window_Overview", false); }
java
public static void generate(ConfigurationImpl configuration) throws DocFileIOException { DocPath filename = DocPaths.MODULE_OVERVIEW_FRAME; ModuleIndexFrameWriter modulegen = new ModuleIndexFrameWriter(configuration, filename); modulegen.buildModuleIndexFile("doclet.Window_Overview", false); }
[ "public", "static", "void", "generate", "(", "ConfigurationImpl", "configuration", ")", "throws", "DocFileIOException", "{", "DocPath", "filename", "=", "DocPaths", ".", "MODULE_OVERVIEW_FRAME", ";", "ModuleIndexFrameWriter", "modulegen", "=", "new", "ModuleIndexFrameWriter", "(", "configuration", ",", "filename", ")", ";", "modulegen", ".", "buildModuleIndexFile", "(", "\"doclet.Window_Overview\"", ",", "false", ")", ";", "}" ]
Generate the module index file named "module-overview-frame.html". @throws DocFileIOException @param configuration the configuration object
[ "Generate", "the", "module", "index", "file", "named", "module", "-", "overview", "-", "frame", ".", "html", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java#L76-L80
5,761
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java
ModuleIndexFrameWriter.getModuleLink
protected Content getModuleLink(ModuleElement mdle) { Content moduleLinkContent; Content mdlLabel = new StringContent(mdle.getQualifiedName()); moduleLinkContent = getModuleFramesHyperLink(mdle, mdlLabel, "packageListFrame"); Content li = HtmlTree.LI(moduleLinkContent); return li; }
java
protected Content getModuleLink(ModuleElement mdle) { Content moduleLinkContent; Content mdlLabel = new StringContent(mdle.getQualifiedName()); moduleLinkContent = getModuleFramesHyperLink(mdle, mdlLabel, "packageListFrame"); Content li = HtmlTree.LI(moduleLinkContent); return li; }
[ "protected", "Content", "getModuleLink", "(", "ModuleElement", "mdle", ")", "{", "Content", "moduleLinkContent", ";", "Content", "mdlLabel", "=", "new", "StringContent", "(", "mdle", ".", "getQualifiedName", "(", ")", ")", ";", "moduleLinkContent", "=", "getModuleFramesHyperLink", "(", "mdle", ",", "mdlLabel", ",", "\"packageListFrame\"", ")", ";", "Content", "li", "=", "HtmlTree", ".", "LI", "(", "moduleLinkContent", ")", ";", "return", "li", ";", "}" ]
Returns each module name as a separate link. @param mdle the module being documented @return content for the module link
[ "Returns", "each", "module", "name", "as", "a", "separate", "link", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java#L107-L113
5,762
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
MemberSummaryBuilder.members
public SortedSet<Element> members(VisibleMemberMap.Kind kind) { TreeSet<Element> out = new TreeSet<>(comparator); out.addAll(getVisibleMemberMap(kind).getLeafMembers()); return out; }
java
public SortedSet<Element> members(VisibleMemberMap.Kind kind) { TreeSet<Element> out = new TreeSet<>(comparator); out.addAll(getVisibleMemberMap(kind).getLeafMembers()); return out; }
[ "public", "SortedSet", "<", "Element", ">", "members", "(", "VisibleMemberMap", ".", "Kind", "kind", ")", "{", "TreeSet", "<", "Element", ">", "out", "=", "new", "TreeSet", "<>", "(", "comparator", ")", ";", "out", ".", "addAll", "(", "getVisibleMemberMap", "(", "kind", ")", ".", "getLeafMembers", "(", ")", ")", ";", "return", "out", ";", "}" ]
Returns a list of methods that will be documented for the given class. This information can be used for doclet specific documentation generation. @param kind the kind of elements to return. @return a list of methods that will be documented. @see VisibleMemberMap
[ "Returns", "a", "list", "of", "methods", "that", "will", "be", "documented", "for", "the", "given", "class", ".", "This", "information", "can", "be", "used", "for", "doclet", "specific", "documentation", "generation", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java#L178-L182
5,763
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/FieldDocImpl.java
FieldDocImpl.constantValue
public Object constantValue() { Object result = sym.getConstValue(); if (result != null && sym.type.hasTag(BOOLEAN)) // javac represents false and true as Integers 0 and 1 result = Boolean.valueOf(((Integer)result).intValue() != 0); return result; }
java
public Object constantValue() { Object result = sym.getConstValue(); if (result != null && sym.type.hasTag(BOOLEAN)) // javac represents false and true as Integers 0 and 1 result = Boolean.valueOf(((Integer)result).intValue() != 0); return result; }
[ "public", "Object", "constantValue", "(", ")", "{", "Object", "result", "=", "sym", ".", "getConstValue", "(", ")", ";", "if", "(", "result", "!=", "null", "&&", "sym", ".", "type", ".", "hasTag", "(", "BOOLEAN", ")", ")", "// javac represents false and true as Integers 0 and 1", "result", "=", "Boolean", ".", "valueOf", "(", "(", "(", "Integer", ")", "result", ")", ".", "intValue", "(", ")", "!=", "0", ")", ";", "return", "result", ";", "}" ]
Get the value of a constant field. @return the value of a constant field. The value is automatically wrapped in an object if it has a primitive type. If the field is not constant, returns null.
[ "Get", "the", "value", "of", "a", "constant", "field", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/FieldDocImpl.java#L102-L108
5,764
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/FieldDocImpl.java
FieldDocImpl.constantValueExpression
static String constantValueExpression(Object cb) { if (cb == null) return null; if (cb instanceof Character) return sourceForm(((Character)cb).charValue()); if (cb instanceof Byte) return sourceForm(((Byte)cb).byteValue()); if (cb instanceof String) return sourceForm((String)cb); if (cb instanceof Double) return sourceForm(((Double)cb).doubleValue(), 'd'); if (cb instanceof Float) return sourceForm(((Float)cb).doubleValue(), 'f'); if (cb instanceof Long) return cb + "L"; return cb.toString(); // covers int, short }
java
static String constantValueExpression(Object cb) { if (cb == null) return null; if (cb instanceof Character) return sourceForm(((Character)cb).charValue()); if (cb instanceof Byte) return sourceForm(((Byte)cb).byteValue()); if (cb instanceof String) return sourceForm((String)cb); if (cb instanceof Double) return sourceForm(((Double)cb).doubleValue(), 'd'); if (cb instanceof Float) return sourceForm(((Float)cb).doubleValue(), 'f'); if (cb instanceof Long) return cb + "L"; return cb.toString(); // covers int, short }
[ "static", "String", "constantValueExpression", "(", "Object", "cb", ")", "{", "if", "(", "cb", "==", "null", ")", "return", "null", ";", "if", "(", "cb", "instanceof", "Character", ")", "return", "sourceForm", "(", "(", "(", "Character", ")", "cb", ")", ".", "charValue", "(", ")", ")", ";", "if", "(", "cb", "instanceof", "Byte", ")", "return", "sourceForm", "(", "(", "(", "Byte", ")", "cb", ")", ".", "byteValue", "(", ")", ")", ";", "if", "(", "cb", "instanceof", "String", ")", "return", "sourceForm", "(", "(", "String", ")", "cb", ")", ";", "if", "(", "cb", "instanceof", "Double", ")", "return", "sourceForm", "(", "(", "(", "Double", ")", "cb", ")", ".", "doubleValue", "(", ")", ",", "'", "'", ")", ";", "if", "(", "cb", "instanceof", "Float", ")", "return", "sourceForm", "(", "(", "(", "Float", ")", "cb", ")", ".", "doubleValue", "(", ")", ",", "'", "'", ")", ";", "if", "(", "cb", "instanceof", "Long", ")", "return", "cb", "+", "\"L\"", ";", "return", "cb", ".", "toString", "(", ")", ";", "// covers int, short", "}" ]
A static version of the above.
[ "A", "static", "version", "of", "the", "above", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/FieldDocImpl.java#L125-L134
5,765
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/processing/ServiceProxy.java
ServiceProxy.parse
private static boolean parse(Class<?> service, URL u) throws ServiceConfigurationError { InputStream in = null; BufferedReader r = null; try { in = u.openStream(); r = new BufferedReader(new InputStreamReader(in, "utf-8")); int lc = 1; String ln; while ((ln = r.readLine()) != null) { int ci = ln.indexOf('#'); if (ci >= 0) ln = ln.substring(0, ci); ln = ln.trim(); int n = ln.length(); if (n != 0) { if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0)) fail(service, u, lc, "Illegal configuration-file syntax"); int cp = ln.codePointAt(0); if (!Character.isJavaIdentifierStart(cp)) fail(service, u, lc, "Illegal provider-class name: " + ln); for (int i = Character.charCount(cp); i < n; i += Character.charCount(cp)) { cp = ln.codePointAt(i); if (!Character.isJavaIdentifierPart(cp) && (cp != '.')) fail(service, u, lc, "Illegal provider-class name: " + ln); } return true; } } } catch (FileNotFoundException x) { return false; } catch (IOException x) { fail(service, ": " + x); } finally { try { if (r != null) r.close(); } catch (IOException y) { fail(service, ": " + y); } try { if (in != null) in.close(); } catch (IOException y) { fail(service, ": " + y); } } return false; }
java
private static boolean parse(Class<?> service, URL u) throws ServiceConfigurationError { InputStream in = null; BufferedReader r = null; try { in = u.openStream(); r = new BufferedReader(new InputStreamReader(in, "utf-8")); int lc = 1; String ln; while ((ln = r.readLine()) != null) { int ci = ln.indexOf('#'); if (ci >= 0) ln = ln.substring(0, ci); ln = ln.trim(); int n = ln.length(); if (n != 0) { if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0)) fail(service, u, lc, "Illegal configuration-file syntax"); int cp = ln.codePointAt(0); if (!Character.isJavaIdentifierStart(cp)) fail(service, u, lc, "Illegal provider-class name: " + ln); for (int i = Character.charCount(cp); i < n; i += Character.charCount(cp)) { cp = ln.codePointAt(i); if (!Character.isJavaIdentifierPart(cp) && (cp != '.')) fail(service, u, lc, "Illegal provider-class name: " + ln); } return true; } } } catch (FileNotFoundException x) { return false; } catch (IOException x) { fail(service, ": " + x); } finally { try { if (r != null) r.close(); } catch (IOException y) { fail(service, ": " + y); } try { if (in != null) in.close(); } catch (IOException y) { fail(service, ": " + y); } } return false; }
[ "private", "static", "boolean", "parse", "(", "Class", "<", "?", ">", "service", ",", "URL", "u", ")", "throws", "ServiceConfigurationError", "{", "InputStream", "in", "=", "null", ";", "BufferedReader", "r", "=", "null", ";", "try", "{", "in", "=", "u", ".", "openStream", "(", ")", ";", "r", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "in", ",", "\"utf-8\"", ")", ")", ";", "int", "lc", "=", "1", ";", "String", "ln", ";", "while", "(", "(", "ln", "=", "r", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "int", "ci", "=", "ln", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "ci", ">=", "0", ")", "ln", "=", "ln", ".", "substring", "(", "0", ",", "ci", ")", ";", "ln", "=", "ln", ".", "trim", "(", ")", ";", "int", "n", "=", "ln", ".", "length", "(", ")", ";", "if", "(", "n", "!=", "0", ")", "{", "if", "(", "(", "ln", ".", "indexOf", "(", "'", "'", ")", ">=", "0", ")", "||", "(", "ln", ".", "indexOf", "(", "'", "'", ")", ">=", "0", ")", ")", "fail", "(", "service", ",", "u", ",", "lc", ",", "\"Illegal configuration-file syntax\"", ")", ";", "int", "cp", "=", "ln", ".", "codePointAt", "(", "0", ")", ";", "if", "(", "!", "Character", ".", "isJavaIdentifierStart", "(", "cp", ")", ")", "fail", "(", "service", ",", "u", ",", "lc", ",", "\"Illegal provider-class name: \"", "+", "ln", ")", ";", "for", "(", "int", "i", "=", "Character", ".", "charCount", "(", "cp", ")", ";", "i", "<", "n", ";", "i", "+=", "Character", ".", "charCount", "(", "cp", ")", ")", "{", "cp", "=", "ln", ".", "codePointAt", "(", "i", ")", ";", "if", "(", "!", "Character", ".", "isJavaIdentifierPart", "(", "cp", ")", "&&", "(", "cp", "!=", "'", "'", ")", ")", "fail", "(", "service", ",", "u", ",", "lc", ",", "\"Illegal provider-class name: \"", "+", "ln", ")", ";", "}", "return", "true", ";", "}", "}", "}", "catch", "(", "FileNotFoundException", "x", ")", "{", "return", "false", ";", "}", "catch", "(", "IOException", "x", ")", "{", "fail", "(", "service", ",", "\": \"", "+", "x", ")", ";", "}", "finally", "{", "try", "{", "if", "(", "r", "!=", "null", ")", "r", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "y", ")", "{", "fail", "(", "service", ",", "\": \"", "+", "y", ")", ";", "}", "try", "{", "if", "(", "in", "!=", "null", ")", "in", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "y", ")", "{", "fail", "(", "service", ",", "\": \"", "+", "y", ")", ";", "}", "}", "return", "false", ";", "}" ]
Parse the content of the given URL as a provider-configuration file. @param service The service class for which providers are being sought; used to construct error detail strings @param u The URL naming the configuration file to be parsed @return true if the name of a service is found @throws ServiceConfigurationError If an I/O error occurs while reading from the given URL, or if a configuration-file format error is detected
[ "Parse", "the", "content", "of", "the", "given", "URL", "as", "a", "provider", "-", "configuration", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/ServiceProxy.java#L84-L128
5,766
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/processing/ServiceProxy.java
ServiceProxy.hasService
public static boolean hasService(Class<?> service, URL[] urls) throws ServiceConfigurationError { for (URL url: urls) { try { String fullName = prefix + service.getName(); URL u = new URL(url, fullName); boolean found = parse(service, u); if (found) return true; } catch (MalformedURLException e) { // should not happen; ignore it if it does } } return false; }
java
public static boolean hasService(Class<?> service, URL[] urls) throws ServiceConfigurationError { for (URL url: urls) { try { String fullName = prefix + service.getName(); URL u = new URL(url, fullName); boolean found = parse(service, u); if (found) return true; } catch (MalformedURLException e) { // should not happen; ignore it if it does } } return false; }
[ "public", "static", "boolean", "hasService", "(", "Class", "<", "?", ">", "service", ",", "URL", "[", "]", "urls", ")", "throws", "ServiceConfigurationError", "{", "for", "(", "URL", "url", ":", "urls", ")", "{", "try", "{", "String", "fullName", "=", "prefix", "+", "service", ".", "getName", "(", ")", ";", "URL", "u", "=", "new", "URL", "(", "url", ",", "fullName", ")", ";", "boolean", "found", "=", "parse", "(", "service", ",", "u", ")", ";", "if", "(", "found", ")", "return", "true", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "// should not happen; ignore it if it does", "}", "}", "return", "false", ";", "}" ]
Return true if a description for at least one service is found in the service configuration files in the given URLs.
[ "Return", "true", "if", "a", "description", "for", "at", "least", "one", "service", "is", "found", "in", "the", "service", "configuration", "files", "in", "the", "given", "URLs", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/ServiceProxy.java#L134-L148
5,767
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java
RawDiagnosticFormatter.formatDiagnostic
public String formatDiagnostic(JCDiagnostic d, Locale l) { try { StringBuilder buf = new StringBuilder(); if (d.getPosition() != Position.NOPOS) { buf.append(formatSource(d, false, null)); buf.append(':'); buf.append(formatPosition(d, LINE, null)); buf.append(':'); buf.append(formatPosition(d, COLUMN, null)); buf.append(':'); } else if (d.getSource() != null && d.getSource().getKind() == JavaFileObject.Kind.CLASS) { buf.append(formatSource(d, false, null)); buf.append(":-:-:"); } else buf.append('-'); buf.append(' '); buf.append(formatMessage(d, null)); if (displaySource(d)) { buf.append("\n"); buf.append(formatSourceLine(d, 0)); } return buf.toString(); } catch (Exception e) { //e.printStackTrace(); return null; } }
java
public String formatDiagnostic(JCDiagnostic d, Locale l) { try { StringBuilder buf = new StringBuilder(); if (d.getPosition() != Position.NOPOS) { buf.append(formatSource(d, false, null)); buf.append(':'); buf.append(formatPosition(d, LINE, null)); buf.append(':'); buf.append(formatPosition(d, COLUMN, null)); buf.append(':'); } else if (d.getSource() != null && d.getSource().getKind() == JavaFileObject.Kind.CLASS) { buf.append(formatSource(d, false, null)); buf.append(":-:-:"); } else buf.append('-'); buf.append(' '); buf.append(formatMessage(d, null)); if (displaySource(d)) { buf.append("\n"); buf.append(formatSourceLine(d, 0)); } return buf.toString(); } catch (Exception e) { //e.printStackTrace(); return null; } }
[ "public", "String", "formatDiagnostic", "(", "JCDiagnostic", "d", ",", "Locale", "l", ")", "{", "try", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "d", ".", "getPosition", "(", ")", "!=", "Position", ".", "NOPOS", ")", "{", "buf", ".", "append", "(", "formatSource", "(", "d", ",", "false", ",", "null", ")", ")", ";", "buf", ".", "append", "(", "'", "'", ")", ";", "buf", ".", "append", "(", "formatPosition", "(", "d", ",", "LINE", ",", "null", ")", ")", ";", "buf", ".", "append", "(", "'", "'", ")", ";", "buf", ".", "append", "(", "formatPosition", "(", "d", ",", "COLUMN", ",", "null", ")", ")", ";", "buf", ".", "append", "(", "'", "'", ")", ";", "}", "else", "if", "(", "d", ".", "getSource", "(", ")", "!=", "null", "&&", "d", ".", "getSource", "(", ")", ".", "getKind", "(", ")", "==", "JavaFileObject", ".", "Kind", ".", "CLASS", ")", "{", "buf", ".", "append", "(", "formatSource", "(", "d", ",", "false", ",", "null", ")", ")", ";", "buf", ".", "append", "(", "\":-:-:\"", ")", ";", "}", "else", "buf", ".", "append", "(", "'", "'", ")", ";", "buf", ".", "append", "(", "'", "'", ")", ";", "buf", ".", "append", "(", "formatMessage", "(", "d", ",", "null", ")", ")", ";", "if", "(", "displaySource", "(", "d", ")", ")", "{", "buf", ".", "append", "(", "\"\\n\"", ")", ";", "buf", ".", "append", "(", "formatSourceLine", "(", "d", ",", "0", ")", ")", ";", "}", "return", "buf", ".", "toString", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "//e.printStackTrace();", "return", "null", ";", "}", "}" ]
provide common default formats
[ "provide", "common", "default", "formats" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java#L66-L95
5,768
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.zero
public static int zero(int tc) { switch(tc) { case INTcode: case BYTEcode: case SHORTcode: case CHARcode: return iconst_0; case LONGcode: return lconst_0; case FLOATcode: return fconst_0; case DOUBLEcode: return dconst_0; default: throw new AssertionError("zero"); } }
java
public static int zero(int tc) { switch(tc) { case INTcode: case BYTEcode: case SHORTcode: case CHARcode: return iconst_0; case LONGcode: return lconst_0; case FLOATcode: return fconst_0; case DOUBLEcode: return dconst_0; default: throw new AssertionError("zero"); } }
[ "public", "static", "int", "zero", "(", "int", "tc", ")", "{", "switch", "(", "tc", ")", "{", "case", "INTcode", ":", "case", "BYTEcode", ":", "case", "SHORTcode", ":", "case", "CHARcode", ":", "return", "iconst_0", ";", "case", "LONGcode", ":", "return", "lconst_0", ";", "case", "FLOATcode", ":", "return", "fconst_0", ";", "case", "DOUBLEcode", ":", "return", "dconst_0", ";", "default", ":", "throw", "new", "AssertionError", "(", "\"zero\"", ")", ";", "}", "}" ]
The opcode that loads a zero constant of a given type code. @param tc The given type code (@see ByteCode).
[ "The", "opcode", "that", "loads", "a", "zero", "constant", "of", "a", "given", "type", "code", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L177-L190
5,769
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.makeRef
int makeRef(DiagnosticPosition pos, Type type) { checkDimension(pos, type); if (type.isAnnotated()) { return pool.put((Object)type); } else { return pool.put(type.hasTag(CLASS) ? (Object)type.tsym : (Object)type); } }
java
int makeRef(DiagnosticPosition pos, Type type) { checkDimension(pos, type); if (type.isAnnotated()) { return pool.put((Object)type); } else { return pool.put(type.hasTag(CLASS) ? (Object)type.tsym : (Object)type); } }
[ "int", "makeRef", "(", "DiagnosticPosition", "pos", ",", "Type", "type", ")", "{", "checkDimension", "(", "pos", ",", "type", ")", ";", "if", "(", "type", ".", "isAnnotated", "(", ")", ")", "{", "return", "pool", ".", "put", "(", "(", "Object", ")", "type", ")", ";", "}", "else", "{", "return", "pool", ".", "put", "(", "type", ".", "hasTag", "(", "CLASS", ")", "?", "(", "Object", ")", "type", ".", "tsym", ":", "(", "Object", ")", "type", ")", ";", "}", "}" ]
Insert a reference to given type in the constant pool, checking for an array with too many dimensions; return the reference's index. @param type The type for which a reference is inserted.
[ "Insert", "a", "reference", "to", "given", "type", "in", "the", "constant", "pool", "checking", "for", "an", "array", "with", "too", "many", "dimensions", ";", "return", "the", "reference", "s", "index", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L252-L259
5,770
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.checkDimension
private void checkDimension(DiagnosticPosition pos, Type t) { switch (t.getTag()) { case METHOD: checkDimension(pos, t.getReturnType()); for (List<Type> args = t.getParameterTypes(); args.nonEmpty(); args = args.tail) checkDimension(pos, args.head); break; case ARRAY: if (types.dimensions(t) > ClassFile.MAX_DIMENSIONS) { log.error(pos, "limit.dimensions"); nerrs++; } break; default: break; } }
java
private void checkDimension(DiagnosticPosition pos, Type t) { switch (t.getTag()) { case METHOD: checkDimension(pos, t.getReturnType()); for (List<Type> args = t.getParameterTypes(); args.nonEmpty(); args = args.tail) checkDimension(pos, args.head); break; case ARRAY: if (types.dimensions(t) > ClassFile.MAX_DIMENSIONS) { log.error(pos, "limit.dimensions"); nerrs++; } break; default: break; } }
[ "private", "void", "checkDimension", "(", "DiagnosticPosition", "pos", ",", "Type", "t", ")", "{", "switch", "(", "t", ".", "getTag", "(", ")", ")", "{", "case", "METHOD", ":", "checkDimension", "(", "pos", ",", "t", ".", "getReturnType", "(", ")", ")", ";", "for", "(", "List", "<", "Type", ">", "args", "=", "t", ".", "getParameterTypes", "(", ")", ";", "args", ".", "nonEmpty", "(", ")", ";", "args", "=", "args", ".", "tail", ")", "checkDimension", "(", "pos", ",", "args", ".", "head", ")", ";", "break", ";", "case", "ARRAY", ":", "if", "(", "types", ".", "dimensions", "(", "t", ")", ">", "ClassFile", ".", "MAX_DIMENSIONS", ")", "{", "log", ".", "error", "(", "pos", ",", "\"limit.dimensions\"", ")", ";", "nerrs", "++", ";", "}", "break", ";", "default", ":", "break", ";", "}", "}" ]
Check if the given type is an array with too many dimensions.
[ "Check", "if", "the", "given", "type", "is", "an", "array", "with", "too", "many", "dimensions", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L263-L279
5,771
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.makeTemp
LocalItem makeTemp(Type type) { VarSymbol v = new VarSymbol(Flags.SYNTHETIC, names.empty, type, env.enclMethod.sym); code.newLocal(v); return items.makeLocalItem(v); }
java
LocalItem makeTemp(Type type) { VarSymbol v = new VarSymbol(Flags.SYNTHETIC, names.empty, type, env.enclMethod.sym); code.newLocal(v); return items.makeLocalItem(v); }
[ "LocalItem", "makeTemp", "(", "Type", "type", ")", "{", "VarSymbol", "v", "=", "new", "VarSymbol", "(", "Flags", ".", "SYNTHETIC", ",", "names", ".", "empty", ",", "type", ",", "env", ".", "enclMethod", ".", "sym", ")", ";", "code", ".", "newLocal", "(", "v", ")", ";", "return", "items", ".", "makeLocalItem", "(", "v", ")", ";", "}" ]
Create a tempory variable. @param type The variable's type.
[ "Create", "a", "tempory", "variable", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L284-L291
5,772
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.callMethod
void callMethod(DiagnosticPosition pos, Type site, Name name, List<Type> argtypes, boolean isStatic) { Symbol msym = rs. resolveInternalMethod(pos, attrEnv, site, name, argtypes, null); if (isStatic) items.makeStaticItem(msym).invoke(); else items.makeMemberItem(msym, name == names.init).invoke(); }
java
void callMethod(DiagnosticPosition pos, Type site, Name name, List<Type> argtypes, boolean isStatic) { Symbol msym = rs. resolveInternalMethod(pos, attrEnv, site, name, argtypes, null); if (isStatic) items.makeStaticItem(msym).invoke(); else items.makeMemberItem(msym, name == names.init).invoke(); }
[ "void", "callMethod", "(", "DiagnosticPosition", "pos", ",", "Type", "site", ",", "Name", "name", ",", "List", "<", "Type", ">", "argtypes", ",", "boolean", "isStatic", ")", "{", "Symbol", "msym", "=", "rs", ".", "resolveInternalMethod", "(", "pos", ",", "attrEnv", ",", "site", ",", "name", ",", "argtypes", ",", "null", ")", ";", "if", "(", "isStatic", ")", "items", ".", "makeStaticItem", "(", "msym", ")", ".", "invoke", "(", ")", ";", "else", "items", ".", "makeMemberItem", "(", "msym", ",", "name", "==", "names", ".", "init", ")", ".", "invoke", "(", ")", ";", "}" ]
Generate code to call a non-private method or constructor. @param pos Position to be used for error reporting. @param site The type of which the method is a member. @param name The method's name. @param argtypes The method's argument types. @param isStatic A flag that indicates whether we call a static or instance method.
[ "Generate", "code", "to", "call", "a", "non", "-", "private", "method", "or", "constructor", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L301-L308
5,773
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.isAccessSuper
private boolean isAccessSuper(JCMethodDecl enclMethod) { return (enclMethod.mods.flags & SYNTHETIC) != 0 && isOddAccessName(enclMethod.name); }
java
private boolean isAccessSuper(JCMethodDecl enclMethod) { return (enclMethod.mods.flags & SYNTHETIC) != 0 && isOddAccessName(enclMethod.name); }
[ "private", "boolean", "isAccessSuper", "(", "JCMethodDecl", "enclMethod", ")", "{", "return", "(", "enclMethod", ".", "mods", ".", "flags", "&", "SYNTHETIC", ")", "!=", "0", "&&", "isOddAccessName", "(", "enclMethod", ".", "name", ")", ";", "}" ]
Is the given method definition an access method resulting from a qualified super? This is signified by an odd access code.
[ "Is", "the", "given", "method", "definition", "an", "access", "method", "resulting", "from", "a", "qualified", "super?", "This", "is", "signified", "by", "an", "odd", "access", "code", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L314-L318
5,774
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.genFinalizer
void genFinalizer(Env<GenContext> env) { if (code.isAlive() && env.info.finalize != null) env.info.finalize.gen(); }
java
void genFinalizer(Env<GenContext> env) { if (code.isAlive() && env.info.finalize != null) env.info.finalize.gen(); }
[ "void", "genFinalizer", "(", "Env", "<", "GenContext", ">", "env", ")", "{", "if", "(", "code", ".", "isAlive", "(", ")", "&&", "env", ".", "info", ".", "finalize", "!=", "null", ")", "env", ".", "info", ".", "finalize", ".", "gen", "(", ")", ";", "}" ]
Generate code to invoke the finalizer associated with given environment. Any calls to finalizers are appended to the environments `cont' chain. Mark beginning of gap in catch all range for finalizer.
[ "Generate", "code", "to", "invoke", "the", "finalizer", "associated", "with", "given", "environment", ".", "Any", "calls", "to", "finalizers", "are", "appended", "to", "the", "environments", "cont", "chain", ".", "Mark", "beginning", "of", "gap", "in", "catch", "all", "range", "for", "finalizer", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L337-L340
5,775
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.unwind
Env<GenContext> unwind(JCTree target, Env<GenContext> env) { Env<GenContext> env1 = env; while (true) { genFinalizer(env1); if (env1.tree == target) break; env1 = env1.next; } return env1; }
java
Env<GenContext> unwind(JCTree target, Env<GenContext> env) { Env<GenContext> env1 = env; while (true) { genFinalizer(env1); if (env1.tree == target) break; env1 = env1.next; } return env1; }
[ "Env", "<", "GenContext", ">", "unwind", "(", "JCTree", "target", ",", "Env", "<", "GenContext", ">", "env", ")", "{", "Env", "<", "GenContext", ">", "env1", "=", "env", ";", "while", "(", "true", ")", "{", "genFinalizer", "(", "env1", ")", ";", "if", "(", "env1", ".", "tree", "==", "target", ")", "break", ";", "env1", "=", "env1", ".", "next", ";", "}", "return", "env1", ";", "}" ]
Generate code to call all finalizers of structures aborted by a non-local exit. Return target environment of the non-local exit. @param target The tree representing the structure that's aborted @param env The environment current at the non-local exit.
[ "Generate", "code", "to", "call", "all", "finalizers", "of", "structures", "aborted", "by", "a", "non", "-", "local", "exit", ".", "Return", "target", "environment", "of", "the", "non", "-", "local", "exit", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L348-L356
5,776
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.endFinalizerGap
void endFinalizerGap(Env<GenContext> env) { if (env.info.gaps != null && env.info.gaps.length() % 2 == 1) env.info.gaps.append(code.curCP()); }
java
void endFinalizerGap(Env<GenContext> env) { if (env.info.gaps != null && env.info.gaps.length() % 2 == 1) env.info.gaps.append(code.curCP()); }
[ "void", "endFinalizerGap", "(", "Env", "<", "GenContext", ">", "env", ")", "{", "if", "(", "env", ".", "info", ".", "gaps", "!=", "null", "&&", "env", ".", "info", ".", "gaps", ".", "length", "(", ")", "%", "2", "==", "1", ")", "env", ".", "info", ".", "gaps", ".", "append", "(", "code", ".", "curCP", "(", ")", ")", ";", "}" ]
Mark end of gap in catch-all range for finalizer. @param env the environment which might contain the finalizer (if it does, env.info.gaps != null).
[ "Mark", "end", "of", "gap", "in", "catch", "-", "all", "range", "for", "finalizer", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L362-L365
5,777
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.endFinalizerGaps
void endFinalizerGaps(Env<GenContext> from, Env<GenContext> to) { Env<GenContext> last = null; while (last != to) { endFinalizerGap(from); last = from; from = from.next; } }
java
void endFinalizerGaps(Env<GenContext> from, Env<GenContext> to) { Env<GenContext> last = null; while (last != to) { endFinalizerGap(from); last = from; from = from.next; } }
[ "void", "endFinalizerGaps", "(", "Env", "<", "GenContext", ">", "from", ",", "Env", "<", "GenContext", ">", "to", ")", "{", "Env", "<", "GenContext", ">", "last", "=", "null", ";", "while", "(", "last", "!=", "to", ")", "{", "endFinalizerGap", "(", "from", ")", ";", "last", "=", "from", ";", "from", "=", "from", ".", "next", ";", "}", "}" ]
Mark end of all gaps in catch-all ranges for finalizers of environments lying between, and including to two environments. @param from the most deeply nested environment to mark @param to the least deeply nested environment to mark
[ "Mark", "end", "of", "all", "gaps", "in", "catch", "-", "all", "ranges", "for", "finalizers", "of", "environments", "lying", "between", "and", "including", "to", "two", "environments", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L372-L379
5,778
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.hasFinally
boolean hasFinally(JCTree target, Env<GenContext> env) { while (env.tree != target) { if (env.tree.hasTag(TRY) && env.info.finalize.hasFinalizer()) return true; env = env.next; } return false; }
java
boolean hasFinally(JCTree target, Env<GenContext> env) { while (env.tree != target) { if (env.tree.hasTag(TRY) && env.info.finalize.hasFinalizer()) return true; env = env.next; } return false; }
[ "boolean", "hasFinally", "(", "JCTree", "target", ",", "Env", "<", "GenContext", ">", "env", ")", "{", "while", "(", "env", ".", "tree", "!=", "target", ")", "{", "if", "(", "env", ".", "tree", ".", "hasTag", "(", "TRY", ")", "&&", "env", ".", "info", ".", "finalize", ".", "hasFinalizer", "(", ")", ")", "return", "true", ";", "env", "=", "env", ".", "next", ";", "}", "return", "false", ";", "}" ]
Do any of the structures aborted by a non-local exit have finalizers that require an empty stack? @param target The tree representing the structure that's aborted @param env The environment current at the non-local exit.
[ "Do", "any", "of", "the", "structures", "aborted", "by", "a", "non", "-", "local", "exit", "have", "finalizers", "that", "require", "an", "empty", "stack?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L386-L393
5,779
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.checkStringConstant
private void checkStringConstant(DiagnosticPosition pos, Object constValue) { if (nerrs != 0 || // only complain about a long string once constValue == null || !(constValue instanceof String) || ((String)constValue).length() < Pool.MAX_STRING_LENGTH) return; log.error(pos, "limit.string"); nerrs++; }
java
private void checkStringConstant(DiagnosticPosition pos, Object constValue) { if (nerrs != 0 || // only complain about a long string once constValue == null || !(constValue instanceof String) || ((String)constValue).length() < Pool.MAX_STRING_LENGTH) return; log.error(pos, "limit.string"); nerrs++; }
[ "private", "void", "checkStringConstant", "(", "DiagnosticPosition", "pos", ",", "Object", "constValue", ")", "{", "if", "(", "nerrs", "!=", "0", "||", "// only complain about a long string once", "constValue", "==", "null", "||", "!", "(", "constValue", "instanceof", "String", ")", "||", "(", "(", "String", ")", "constValue", ")", ".", "length", "(", ")", "<", "Pool", ".", "MAX_STRING_LENGTH", ")", "return", ";", "log", ".", "error", "(", "pos", ",", "\"limit.string\"", ")", ";", "nerrs", "++", ";", "}" ]
Check a constant value and report if it is a string that is too large.
[ "Check", "a", "constant", "value", "and", "report", "if", "it", "is", "a", "string", "that", "is", "too", "large", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L513-L521
5,780
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.genMethod
void genMethod(JCMethodDecl tree, Env<GenContext> env, boolean fatcode) { MethodSymbol meth = tree.sym; int extras = 0; // Count up extra parameters if (meth.isConstructor()) { extras++; if (meth.enclClass().isInner() && !meth.enclClass().isStatic()) { extras++; } } else if ((tree.mods.flags & STATIC) == 0) { extras++; } // System.err.println("Generating " + meth + " in " + meth.owner); //DEBUG if (Code.width(types.erasure(env.enclMethod.sym.type).getParameterTypes()) + extras > ClassFile.MAX_PARAMETERS) { log.error(tree.pos(), "limit.parameters"); nerrs++; } else if (tree.body != null) { // Create a new code structure and initialize it. int startpcCrt = initCode(tree, env, fatcode); try { genStat(tree.body, env); } catch (CodeSizeOverflow e) { // Failed due to code limit, try again with jsr/ret startpcCrt = initCode(tree, env, fatcode); genStat(tree.body, env); } if (code.state.stacksize != 0) { log.error(tree.body.pos(), "stack.sim.error", tree); throw new AssertionError(); } // If last statement could complete normally, insert a // return at the end. if (code.isAlive()) { code.statBegin(TreeInfo.endPos(tree.body)); if (env.enclMethod == null || env.enclMethod.sym.type.getReturnType().hasTag(VOID)) { code.emitop0(return_); } else { // sometime dead code seems alive (4415991); // generate a small loop instead int startpc = code.entryPoint(); CondItem c = items.makeCondItem(goto_); code.resolve(c.jumpTrue(), startpc); } } if (genCrt) code.crt.put(tree.body, CRT_BLOCK, startpcCrt, code.curCP()); code.endScopes(0); // If we exceeded limits, panic if (code.checkLimits(tree.pos(), log)) { nerrs++; return; } // If we generated short code but got a long jump, do it again // with fatCode = true. if (!fatcode && code.fatcode) genMethod(tree, env, true); // Clean up if(stackMap == StackMapFormat.JSR202) { code.lastFrame = null; code.frameBeforeLast = null; } // Compress exception table code.compressCatchTable(); // Fill in type annotation positions for exception parameters code.fillExceptionParameterPositions(); } }
java
void genMethod(JCMethodDecl tree, Env<GenContext> env, boolean fatcode) { MethodSymbol meth = tree.sym; int extras = 0; // Count up extra parameters if (meth.isConstructor()) { extras++; if (meth.enclClass().isInner() && !meth.enclClass().isStatic()) { extras++; } } else if ((tree.mods.flags & STATIC) == 0) { extras++; } // System.err.println("Generating " + meth + " in " + meth.owner); //DEBUG if (Code.width(types.erasure(env.enclMethod.sym.type).getParameterTypes()) + extras > ClassFile.MAX_PARAMETERS) { log.error(tree.pos(), "limit.parameters"); nerrs++; } else if (tree.body != null) { // Create a new code structure and initialize it. int startpcCrt = initCode(tree, env, fatcode); try { genStat(tree.body, env); } catch (CodeSizeOverflow e) { // Failed due to code limit, try again with jsr/ret startpcCrt = initCode(tree, env, fatcode); genStat(tree.body, env); } if (code.state.stacksize != 0) { log.error(tree.body.pos(), "stack.sim.error", tree); throw new AssertionError(); } // If last statement could complete normally, insert a // return at the end. if (code.isAlive()) { code.statBegin(TreeInfo.endPos(tree.body)); if (env.enclMethod == null || env.enclMethod.sym.type.getReturnType().hasTag(VOID)) { code.emitop0(return_); } else { // sometime dead code seems alive (4415991); // generate a small loop instead int startpc = code.entryPoint(); CondItem c = items.makeCondItem(goto_); code.resolve(c.jumpTrue(), startpc); } } if (genCrt) code.crt.put(tree.body, CRT_BLOCK, startpcCrt, code.curCP()); code.endScopes(0); // If we exceeded limits, panic if (code.checkLimits(tree.pos(), log)) { nerrs++; return; } // If we generated short code but got a long jump, do it again // with fatCode = true. if (!fatcode && code.fatcode) genMethod(tree, env, true); // Clean up if(stackMap == StackMapFormat.JSR202) { code.lastFrame = null; code.frameBeforeLast = null; } // Compress exception table code.compressCatchTable(); // Fill in type annotation positions for exception parameters code.fillExceptionParameterPositions(); } }
[ "void", "genMethod", "(", "JCMethodDecl", "tree", ",", "Env", "<", "GenContext", ">", "env", ",", "boolean", "fatcode", ")", "{", "MethodSymbol", "meth", "=", "tree", ".", "sym", ";", "int", "extras", "=", "0", ";", "// Count up extra parameters", "if", "(", "meth", ".", "isConstructor", "(", ")", ")", "{", "extras", "++", ";", "if", "(", "meth", ".", "enclClass", "(", ")", ".", "isInner", "(", ")", "&&", "!", "meth", ".", "enclClass", "(", ")", ".", "isStatic", "(", ")", ")", "{", "extras", "++", ";", "}", "}", "else", "if", "(", "(", "tree", ".", "mods", ".", "flags", "&", "STATIC", ")", "==", "0", ")", "{", "extras", "++", ";", "}", "// System.err.println(\"Generating \" + meth + \" in \" + meth.owner); //DEBUG", "if", "(", "Code", ".", "width", "(", "types", ".", "erasure", "(", "env", ".", "enclMethod", ".", "sym", ".", "type", ")", ".", "getParameterTypes", "(", ")", ")", "+", "extras", ">", "ClassFile", ".", "MAX_PARAMETERS", ")", "{", "log", ".", "error", "(", "tree", ".", "pos", "(", ")", ",", "\"limit.parameters\"", ")", ";", "nerrs", "++", ";", "}", "else", "if", "(", "tree", ".", "body", "!=", "null", ")", "{", "// Create a new code structure and initialize it.", "int", "startpcCrt", "=", "initCode", "(", "tree", ",", "env", ",", "fatcode", ")", ";", "try", "{", "genStat", "(", "tree", ".", "body", ",", "env", ")", ";", "}", "catch", "(", "CodeSizeOverflow", "e", ")", "{", "// Failed due to code limit, try again with jsr/ret", "startpcCrt", "=", "initCode", "(", "tree", ",", "env", ",", "fatcode", ")", ";", "genStat", "(", "tree", ".", "body", ",", "env", ")", ";", "}", "if", "(", "code", ".", "state", ".", "stacksize", "!=", "0", ")", "{", "log", ".", "error", "(", "tree", ".", "body", ".", "pos", "(", ")", ",", "\"stack.sim.error\"", ",", "tree", ")", ";", "throw", "new", "AssertionError", "(", ")", ";", "}", "// If last statement could complete normally, insert a", "// return at the end.", "if", "(", "code", ".", "isAlive", "(", ")", ")", "{", "code", ".", "statBegin", "(", "TreeInfo", ".", "endPos", "(", "tree", ".", "body", ")", ")", ";", "if", "(", "env", ".", "enclMethod", "==", "null", "||", "env", ".", "enclMethod", ".", "sym", ".", "type", ".", "getReturnType", "(", ")", ".", "hasTag", "(", "VOID", ")", ")", "{", "code", ".", "emitop0", "(", "return_", ")", ";", "}", "else", "{", "// sometime dead code seems alive (4415991);", "// generate a small loop instead", "int", "startpc", "=", "code", ".", "entryPoint", "(", ")", ";", "CondItem", "c", "=", "items", ".", "makeCondItem", "(", "goto_", ")", ";", "code", ".", "resolve", "(", "c", ".", "jumpTrue", "(", ")", ",", "startpc", ")", ";", "}", "}", "if", "(", "genCrt", ")", "code", ".", "crt", ".", "put", "(", "tree", ".", "body", ",", "CRT_BLOCK", ",", "startpcCrt", ",", "code", ".", "curCP", "(", ")", ")", ";", "code", ".", "endScopes", "(", "0", ")", ";", "// If we exceeded limits, panic", "if", "(", "code", ".", "checkLimits", "(", "tree", ".", "pos", "(", ")", ",", "log", ")", ")", "{", "nerrs", "++", ";", "return", ";", "}", "// If we generated short code but got a long jump, do it again", "// with fatCode = true.", "if", "(", "!", "fatcode", "&&", "code", ".", "fatcode", ")", "genMethod", "(", "tree", ",", "env", ",", "true", ")", ";", "// Clean up", "if", "(", "stackMap", "==", "StackMapFormat", ".", "JSR202", ")", "{", "code", ".", "lastFrame", "=", "null", ";", "code", ".", "frameBeforeLast", "=", "null", ";", "}", "// Compress exception table", "code", ".", "compressCatchTable", "(", ")", ";", "// Fill in type annotation positions for exception parameters", "code", ".", "fillExceptionParameterPositions", "(", ")", ";", "}", "}" ]
Generate code for a method. @param tree The tree representing the method definition. @param env The environment current for the method body. @param fatcode A flag that indicates whether all jumps are within 32K. We first invoke this method under the assumption that fatcode == false, i.e. all jumps are within 32K. If this fails, fatcode is set to true and we try again.
[ "Generate", "code", "for", "a", "method", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L874-L956
5,781
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.genLoop
private void genLoop(JCStatement loop, JCStatement body, JCExpression cond, List<JCExpressionStatement> step, boolean testFirst) { Env<GenContext> loopEnv = env.dup(loop, new GenContext()); int startpc = code.entryPoint(); if (testFirst) { //while or for loop CondItem c; if (cond != null) { code.statBegin(cond.pos); Assert.check(code.state.stacksize == 0); c = genCond(TreeInfo.skipParens(cond), CRT_FLOW_CONTROLLER); } else { c = items.makeCondItem(goto_); } Chain loopDone = c.jumpFalse(); code.resolve(c.trueJumps); Assert.check(code.state.stacksize == 0); genStat(body, loopEnv, CRT_STATEMENT | CRT_FLOW_TARGET); code.resolve(loopEnv.info.cont); genStats(step, loopEnv); code.resolve(code.branch(goto_), startpc); code.resolve(loopDone); } else { genStat(body, loopEnv, CRT_STATEMENT | CRT_FLOW_TARGET); code.resolve(loopEnv.info.cont); genStats(step, loopEnv); if (code.isAlive()) { CondItem c; if (cond != null) { code.statBegin(cond.pos); Assert.check(code.state.stacksize == 0); c = genCond(TreeInfo.skipParens(cond), CRT_FLOW_CONTROLLER); } else { c = items.makeCondItem(goto_); } code.resolve(c.jumpTrue(), startpc); Assert.check(code.state.stacksize == 0); code.resolve(c.falseJumps); } } Chain exit = loopEnv.info.exit; if (exit != null) { code.resolve(exit); exit.state.defined.excludeFrom(code.nextreg); } }
java
private void genLoop(JCStatement loop, JCStatement body, JCExpression cond, List<JCExpressionStatement> step, boolean testFirst) { Env<GenContext> loopEnv = env.dup(loop, new GenContext()); int startpc = code.entryPoint(); if (testFirst) { //while or for loop CondItem c; if (cond != null) { code.statBegin(cond.pos); Assert.check(code.state.stacksize == 0); c = genCond(TreeInfo.skipParens(cond), CRT_FLOW_CONTROLLER); } else { c = items.makeCondItem(goto_); } Chain loopDone = c.jumpFalse(); code.resolve(c.trueJumps); Assert.check(code.state.stacksize == 0); genStat(body, loopEnv, CRT_STATEMENT | CRT_FLOW_TARGET); code.resolve(loopEnv.info.cont); genStats(step, loopEnv); code.resolve(code.branch(goto_), startpc); code.resolve(loopDone); } else { genStat(body, loopEnv, CRT_STATEMENT | CRT_FLOW_TARGET); code.resolve(loopEnv.info.cont); genStats(step, loopEnv); if (code.isAlive()) { CondItem c; if (cond != null) { code.statBegin(cond.pos); Assert.check(code.state.stacksize == 0); c = genCond(TreeInfo.skipParens(cond), CRT_FLOW_CONTROLLER); } else { c = items.makeCondItem(goto_); } code.resolve(c.jumpTrue(), startpc); Assert.check(code.state.stacksize == 0); code.resolve(c.falseJumps); } } Chain exit = loopEnv.info.exit; if (exit != null) { code.resolve(exit); exit.state.defined.excludeFrom(code.nextreg); } }
[ "private", "void", "genLoop", "(", "JCStatement", "loop", ",", "JCStatement", "body", ",", "JCExpression", "cond", ",", "List", "<", "JCExpressionStatement", ">", "step", ",", "boolean", "testFirst", ")", "{", "Env", "<", "GenContext", ">", "loopEnv", "=", "env", ".", "dup", "(", "loop", ",", "new", "GenContext", "(", ")", ")", ";", "int", "startpc", "=", "code", ".", "entryPoint", "(", ")", ";", "if", "(", "testFirst", ")", "{", "//while or for loop", "CondItem", "c", ";", "if", "(", "cond", "!=", "null", ")", "{", "code", ".", "statBegin", "(", "cond", ".", "pos", ")", ";", "Assert", ".", "check", "(", "code", ".", "state", ".", "stacksize", "==", "0", ")", ";", "c", "=", "genCond", "(", "TreeInfo", ".", "skipParens", "(", "cond", ")", ",", "CRT_FLOW_CONTROLLER", ")", ";", "}", "else", "{", "c", "=", "items", ".", "makeCondItem", "(", "goto_", ")", ";", "}", "Chain", "loopDone", "=", "c", ".", "jumpFalse", "(", ")", ";", "code", ".", "resolve", "(", "c", ".", "trueJumps", ")", ";", "Assert", ".", "check", "(", "code", ".", "state", ".", "stacksize", "==", "0", ")", ";", "genStat", "(", "body", ",", "loopEnv", ",", "CRT_STATEMENT", "|", "CRT_FLOW_TARGET", ")", ";", "code", ".", "resolve", "(", "loopEnv", ".", "info", ".", "cont", ")", ";", "genStats", "(", "step", ",", "loopEnv", ")", ";", "code", ".", "resolve", "(", "code", ".", "branch", "(", "goto_", ")", ",", "startpc", ")", ";", "code", ".", "resolve", "(", "loopDone", ")", ";", "}", "else", "{", "genStat", "(", "body", ",", "loopEnv", ",", "CRT_STATEMENT", "|", "CRT_FLOW_TARGET", ")", ";", "code", ".", "resolve", "(", "loopEnv", ".", "info", ".", "cont", ")", ";", "genStats", "(", "step", ",", "loopEnv", ")", ";", "if", "(", "code", ".", "isAlive", "(", ")", ")", "{", "CondItem", "c", ";", "if", "(", "cond", "!=", "null", ")", "{", "code", ".", "statBegin", "(", "cond", ".", "pos", ")", ";", "Assert", ".", "check", "(", "code", ".", "state", ".", "stacksize", "==", "0", ")", ";", "c", "=", "genCond", "(", "TreeInfo", ".", "skipParens", "(", "cond", ")", ",", "CRT_FLOW_CONTROLLER", ")", ";", "}", "else", "{", "c", "=", "items", ".", "makeCondItem", "(", "goto_", ")", ";", "}", "code", ".", "resolve", "(", "c", ".", "jumpTrue", "(", ")", ",", "startpc", ")", ";", "Assert", ".", "check", "(", "code", ".", "state", ".", "stacksize", "==", "0", ")", ";", "code", ".", "resolve", "(", "c", ".", "falseJumps", ")", ";", "}", "}", "Chain", "exit", "=", "loopEnv", ".", "info", ".", "exit", ";", "if", "(", "exit", "!=", "null", ")", "{", "code", ".", "resolve", "(", "exit", ")", ";", "exit", ".", "state", ".", "defined", ".", "excludeFrom", "(", "code", ".", "nextreg", ")", ";", "}", "}" ]
Generate code for a loop. @param loop The tree representing the loop. @param body The loop's body. @param cond The loop's controling condition. @param step "Step" statements to be inserted at end of each iteration. @param testFirst True if the loop test belongs before the body.
[ "Generate", "code", "for", "a", "loop", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L1059-L1106
5,782
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.makeNewArray
Item makeNewArray(DiagnosticPosition pos, Type type, int ndims) { Type elemtype = types.elemtype(type); if (types.dimensions(type) > ClassFile.MAX_DIMENSIONS) { log.error(pos, "limit.dimensions"); nerrs++; } int elemcode = Code.arraycode(elemtype); if (elemcode == 0 || (elemcode == 1 && ndims == 1)) { code.emitAnewarray(makeRef(pos, elemtype), type); } else if (elemcode == 1) { code.emitMultianewarray(ndims, makeRef(pos, type), type); } else { code.emitNewarray(elemcode, type); } return items.makeStackItem(type); }
java
Item makeNewArray(DiagnosticPosition pos, Type type, int ndims) { Type elemtype = types.elemtype(type); if (types.dimensions(type) > ClassFile.MAX_DIMENSIONS) { log.error(pos, "limit.dimensions"); nerrs++; } int elemcode = Code.arraycode(elemtype); if (elemcode == 0 || (elemcode == 1 && ndims == 1)) { code.emitAnewarray(makeRef(pos, elemtype), type); } else if (elemcode == 1) { code.emitMultianewarray(ndims, makeRef(pos, type), type); } else { code.emitNewarray(elemcode, type); } return items.makeStackItem(type); }
[ "Item", "makeNewArray", "(", "DiagnosticPosition", "pos", ",", "Type", "type", ",", "int", "ndims", ")", "{", "Type", "elemtype", "=", "types", ".", "elemtype", "(", "type", ")", ";", "if", "(", "types", ".", "dimensions", "(", "type", ")", ">", "ClassFile", ".", "MAX_DIMENSIONS", ")", "{", "log", ".", "error", "(", "pos", ",", "\"limit.dimensions\"", ")", ";", "nerrs", "++", ";", "}", "int", "elemcode", "=", "Code", ".", "arraycode", "(", "elemtype", ")", ";", "if", "(", "elemcode", "==", "0", "||", "(", "elemcode", "==", "1", "&&", "ndims", "==", "1", ")", ")", "{", "code", ".", "emitAnewarray", "(", "makeRef", "(", "pos", ",", "elemtype", ")", ",", "type", ")", ";", "}", "else", "if", "(", "elemcode", "==", "1", ")", "{", "code", ".", "emitMultianewarray", "(", "ndims", ",", "makeRef", "(", "pos", ",", "type", ")", ",", "type", ")", ";", "}", "else", "{", "code", ".", "emitNewarray", "(", "elemcode", ",", "type", ")", ";", "}", "return", "items", ".", "makeStackItem", "(", "type", ")", ";", "}" ]
Generate code to create an array with given element type and number of dimensions.
[ "Generate", "code", "to", "create", "an", "array", "with", "given", "element", "type", "and", "number", "of", "dimensions", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L1760-L1775
5,783
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.completeBinop
Item completeBinop(JCTree lhs, JCTree rhs, OperatorSymbol operator) { MethodType optype = (MethodType)operator.type; int opcode = operator.opcode; if (opcode >= if_icmpeq && opcode <= if_icmple && rhs.type.constValue() instanceof Number && ((Number) rhs.type.constValue()).intValue() == 0) { opcode = opcode + (ifeq - if_icmpeq); } else if (opcode >= if_acmpeq && opcode <= if_acmpne && TreeInfo.isNull(rhs)) { opcode = opcode + (if_acmp_null - if_acmpeq); } else { // The expected type of the right operand is // the second parameter type of the operator, except for // shifts with long shiftcount, where we convert the opcode // to a short shift and the expected type to int. Type rtype = operator.erasure(types).getParameterTypes().tail.head; if (opcode >= ishll && opcode <= lushrl) { opcode = opcode + (ishl - ishll); rtype = syms.intType; } // Generate code for right operand and load. genExpr(rhs, rtype).load(); // If there are two consecutive opcode instructions, // emit the first now. if (opcode >= (1 << preShift)) { code.emitop0(opcode >> preShift); opcode = opcode & 0xFF; } } if (opcode >= ifeq && opcode <= if_acmpne || opcode == if_acmp_null || opcode == if_acmp_nonnull) { return items.makeCondItem(opcode); } else { code.emitop0(opcode); return items.makeStackItem(optype.restype); } }
java
Item completeBinop(JCTree lhs, JCTree rhs, OperatorSymbol operator) { MethodType optype = (MethodType)operator.type; int opcode = operator.opcode; if (opcode >= if_icmpeq && opcode <= if_icmple && rhs.type.constValue() instanceof Number && ((Number) rhs.type.constValue()).intValue() == 0) { opcode = opcode + (ifeq - if_icmpeq); } else if (opcode >= if_acmpeq && opcode <= if_acmpne && TreeInfo.isNull(rhs)) { opcode = opcode + (if_acmp_null - if_acmpeq); } else { // The expected type of the right operand is // the second parameter type of the operator, except for // shifts with long shiftcount, where we convert the opcode // to a short shift and the expected type to int. Type rtype = operator.erasure(types).getParameterTypes().tail.head; if (opcode >= ishll && opcode <= lushrl) { opcode = opcode + (ishl - ishll); rtype = syms.intType; } // Generate code for right operand and load. genExpr(rhs, rtype).load(); // If there are two consecutive opcode instructions, // emit the first now. if (opcode >= (1 << preShift)) { code.emitop0(opcode >> preShift); opcode = opcode & 0xFF; } } if (opcode >= ifeq && opcode <= if_acmpne || opcode == if_acmp_null || opcode == if_acmp_nonnull) { return items.makeCondItem(opcode); } else { code.emitop0(opcode); return items.makeStackItem(optype.restype); } }
[ "Item", "completeBinop", "(", "JCTree", "lhs", ",", "JCTree", "rhs", ",", "OperatorSymbol", "operator", ")", "{", "MethodType", "optype", "=", "(", "MethodType", ")", "operator", ".", "type", ";", "int", "opcode", "=", "operator", ".", "opcode", ";", "if", "(", "opcode", ">=", "if_icmpeq", "&&", "opcode", "<=", "if_icmple", "&&", "rhs", ".", "type", ".", "constValue", "(", ")", "instanceof", "Number", "&&", "(", "(", "Number", ")", "rhs", ".", "type", ".", "constValue", "(", ")", ")", ".", "intValue", "(", ")", "==", "0", ")", "{", "opcode", "=", "opcode", "+", "(", "ifeq", "-", "if_icmpeq", ")", ";", "}", "else", "if", "(", "opcode", ">=", "if_acmpeq", "&&", "opcode", "<=", "if_acmpne", "&&", "TreeInfo", ".", "isNull", "(", "rhs", ")", ")", "{", "opcode", "=", "opcode", "+", "(", "if_acmp_null", "-", "if_acmpeq", ")", ";", "}", "else", "{", "// The expected type of the right operand is", "// the second parameter type of the operator, except for", "// shifts with long shiftcount, where we convert the opcode", "// to a short shift and the expected type to int.", "Type", "rtype", "=", "operator", ".", "erasure", "(", "types", ")", ".", "getParameterTypes", "(", ")", ".", "tail", ".", "head", ";", "if", "(", "opcode", ">=", "ishll", "&&", "opcode", "<=", "lushrl", ")", "{", "opcode", "=", "opcode", "+", "(", "ishl", "-", "ishll", ")", ";", "rtype", "=", "syms", ".", "intType", ";", "}", "// Generate code for right operand and load.", "genExpr", "(", "rhs", ",", "rtype", ")", ".", "load", "(", ")", ";", "// If there are two consecutive opcode instructions,", "// emit the first now.", "if", "(", "opcode", ">=", "(", "1", "<<", "preShift", ")", ")", "{", "code", ".", "emitop0", "(", "opcode", ">>", "preShift", ")", ";", "opcode", "=", "opcode", "&", "0xFF", ";", "}", "}", "if", "(", "opcode", ">=", "ifeq", "&&", "opcode", "<=", "if_acmpne", "||", "opcode", "==", "if_acmp_null", "||", "opcode", "==", "if_acmp_nonnull", ")", "{", "return", "items", ".", "makeCondItem", "(", "opcode", ")", ";", "}", "else", "{", "code", ".", "emitop0", "(", "opcode", ")", ";", "return", "items", ".", "makeStackItem", "(", "optype", ".", "restype", ")", ";", "}", "}" ]
Complete generating code for operation, with left operand already on stack. @param lhs The tree representing the left operand. @param rhs The tree representing the right operand. @param operator The operator symbol.
[ "Complete", "generating", "code", "for", "operation", "with", "left", "operand", "already", "on", "stack", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L1953-L1989
5,784
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.genClass
public boolean genClass(Env<AttrContext> env, JCClassDecl cdef) { try { attrEnv = env; ClassSymbol c = cdef.sym; this.toplevel = env.toplevel; this.endPosTable = toplevel.endPositions; c.pool = pool; pool.reset(); /* method normalizeDefs() can add references to external classes into the constant pool */ cdef.defs = normalizeDefs(cdef.defs, c); generateReferencesToPrunedTree(c, pool); Env<GenContext> localEnv = new Env<>(cdef, new GenContext()); localEnv.toplevel = env.toplevel; localEnv.enclClass = cdef; for (List<JCTree> l = cdef.defs; l.nonEmpty(); l = l.tail) { genDef(l.head, localEnv); } if (pool.numEntries() > Pool.MAX_ENTRIES) { log.error(cdef.pos(), "limit.pool"); nerrs++; } if (nerrs != 0) { // if errors, discard code for (List<JCTree> l = cdef.defs; l.nonEmpty(); l = l.tail) { if (l.head.hasTag(METHODDEF)) ((JCMethodDecl) l.head).sym.code = null; } } cdef.defs = List.nil(); // discard trees return nerrs == 0; } finally { // note: this method does NOT support recursion. attrEnv = null; this.env = null; toplevel = null; endPosTable = null; nerrs = 0; } }
java
public boolean genClass(Env<AttrContext> env, JCClassDecl cdef) { try { attrEnv = env; ClassSymbol c = cdef.sym; this.toplevel = env.toplevel; this.endPosTable = toplevel.endPositions; c.pool = pool; pool.reset(); /* method normalizeDefs() can add references to external classes into the constant pool */ cdef.defs = normalizeDefs(cdef.defs, c); generateReferencesToPrunedTree(c, pool); Env<GenContext> localEnv = new Env<>(cdef, new GenContext()); localEnv.toplevel = env.toplevel; localEnv.enclClass = cdef; for (List<JCTree> l = cdef.defs; l.nonEmpty(); l = l.tail) { genDef(l.head, localEnv); } if (pool.numEntries() > Pool.MAX_ENTRIES) { log.error(cdef.pos(), "limit.pool"); nerrs++; } if (nerrs != 0) { // if errors, discard code for (List<JCTree> l = cdef.defs; l.nonEmpty(); l = l.tail) { if (l.head.hasTag(METHODDEF)) ((JCMethodDecl) l.head).sym.code = null; } } cdef.defs = List.nil(); // discard trees return nerrs == 0; } finally { // note: this method does NOT support recursion. attrEnv = null; this.env = null; toplevel = null; endPosTable = null; nerrs = 0; } }
[ "public", "boolean", "genClass", "(", "Env", "<", "AttrContext", ">", "env", ",", "JCClassDecl", "cdef", ")", "{", "try", "{", "attrEnv", "=", "env", ";", "ClassSymbol", "c", "=", "cdef", ".", "sym", ";", "this", ".", "toplevel", "=", "env", ".", "toplevel", ";", "this", ".", "endPosTable", "=", "toplevel", ".", "endPositions", ";", "c", ".", "pool", "=", "pool", ";", "pool", ".", "reset", "(", ")", ";", "/* method normalizeDefs() can add references to external classes into the constant pool\n */", "cdef", ".", "defs", "=", "normalizeDefs", "(", "cdef", ".", "defs", ",", "c", ")", ";", "generateReferencesToPrunedTree", "(", "c", ",", "pool", ")", ";", "Env", "<", "GenContext", ">", "localEnv", "=", "new", "Env", "<>", "(", "cdef", ",", "new", "GenContext", "(", ")", ")", ";", "localEnv", ".", "toplevel", "=", "env", ".", "toplevel", ";", "localEnv", ".", "enclClass", "=", "cdef", ";", "for", "(", "List", "<", "JCTree", ">", "l", "=", "cdef", ".", "defs", ";", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", ".", "tail", ")", "{", "genDef", "(", "l", ".", "head", ",", "localEnv", ")", ";", "}", "if", "(", "pool", ".", "numEntries", "(", ")", ">", "Pool", ".", "MAX_ENTRIES", ")", "{", "log", ".", "error", "(", "cdef", ".", "pos", "(", ")", ",", "\"limit.pool\"", ")", ";", "nerrs", "++", ";", "}", "if", "(", "nerrs", "!=", "0", ")", "{", "// if errors, discard code", "for", "(", "List", "<", "JCTree", ">", "l", "=", "cdef", ".", "defs", ";", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", ".", "tail", ")", "{", "if", "(", "l", ".", "head", ".", "hasTag", "(", "METHODDEF", ")", ")", "(", "(", "JCMethodDecl", ")", "l", ".", "head", ")", ".", "sym", ".", "code", "=", "null", ";", "}", "}", "cdef", ".", "defs", "=", "List", ".", "nil", "(", ")", ";", "// discard trees", "return", "nerrs", "==", "0", ";", "}", "finally", "{", "// note: this method does NOT support recursion.", "attrEnv", "=", "null", ";", "this", ".", "env", "=", "null", ";", "toplevel", "=", "null", ";", "endPosTable", "=", "null", ";", "nerrs", "=", "0", ";", "}", "}" ]
Generate code for a class definition. @param env The attribution environment that belongs to the outermost class containing this class definition. We need this for resolving some additional symbols. @param cdef The tree representing the class definition. @return True if code is generated with no errors.
[ "Generate", "code", "for", "a", "class", "definition", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L2154-L2194
5,785
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/Trees.java
Trees.instance
public static Trees instance(CompilationTask task) { String taskClassName = task.getClass().getName(); if (!taskClassName.equals("com.sun.tools.javac.api.JavacTaskImpl") && !taskClassName.equals("com.sun.tools.javac.api.BasicJavacTask")) throw new IllegalArgumentException(); return getJavacTrees(CompilationTask.class, task); }
java
public static Trees instance(CompilationTask task) { String taskClassName = task.getClass().getName(); if (!taskClassName.equals("com.sun.tools.javac.api.JavacTaskImpl") && !taskClassName.equals("com.sun.tools.javac.api.BasicJavacTask")) throw new IllegalArgumentException(); return getJavacTrees(CompilationTask.class, task); }
[ "public", "static", "Trees", "instance", "(", "CompilationTask", "task", ")", "{", "String", "taskClassName", "=", "task", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "if", "(", "!", "taskClassName", ".", "equals", "(", "\"com.sun.tools.javac.api.JavacTaskImpl\"", ")", "&&", "!", "taskClassName", ".", "equals", "(", "\"com.sun.tools.javac.api.BasicJavacTask\"", ")", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "return", "getJavacTrees", "(", "CompilationTask", ".", "class", ",", "task", ")", ";", "}" ]
Returns a Trees object for a given CompilationTask. @param task the compilation task for which to get the Trees object @throws IllegalArgumentException if the task does not support the Trees API. @return the Trees object
[ "Returns", "a", "Trees", "object", "for", "a", "given", "CompilationTask", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/Trees.java#L61-L67
5,786
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java
JdiInitiator.listenTarget
private VirtualMachine listenTarget(int port, List<String> remoteVMOptions) { ListeningConnector listener = (ListeningConnector) connector; // Files to collection to output of a start-up failure File crashErrorFile = createTempFile("error"); File crashOutputFile = createTempFile("output"); try { // Start listening, get the JDI connection address String addr = listener.startListening(connectorArgs); debug("Listening at address: " + addr); // Launch the RemoteAgent requesting a connection on that address String javaHome = System.getProperty("java.home"); List<String> args = new ArrayList<>(); args.add(javaHome == null ? "java" : javaHome + File.separator + "bin" + File.separator + "java"); args.add("-agentlib:jdwp=transport=" + connector.transport().name() + ",address=" + addr); args.addAll(remoteVMOptions); args.add(remoteAgent); args.add("" + port); ProcessBuilder pb = new ProcessBuilder(args); pb.redirectError(crashErrorFile); pb.redirectOutput(crashOutputFile); process = pb.start(); // Accept the connection from the remote agent vm = timedVirtualMachineCreation(() -> listener.accept(connectorArgs), () -> process.waitFor()); try { listener.stopListening(connectorArgs); } catch (IOException | IllegalConnectorArgumentsException ex) { // ignore } crashErrorFile.delete(); crashOutputFile.delete(); return vm; } catch (Throwable ex) { if (process != null) { process.destroyForcibly(); } try { listener.stopListening(connectorArgs); } catch (IOException | IllegalConnectorArgumentsException iex) { // ignore } String text = readFile(crashErrorFile) + readFile(crashOutputFile); crashErrorFile.delete(); crashOutputFile.delete(); if (text.isEmpty()) { throw reportLaunchFail(ex, "listen"); } else { throw new IllegalArgumentException(text); } } }
java
private VirtualMachine listenTarget(int port, List<String> remoteVMOptions) { ListeningConnector listener = (ListeningConnector) connector; // Files to collection to output of a start-up failure File crashErrorFile = createTempFile("error"); File crashOutputFile = createTempFile("output"); try { // Start listening, get the JDI connection address String addr = listener.startListening(connectorArgs); debug("Listening at address: " + addr); // Launch the RemoteAgent requesting a connection on that address String javaHome = System.getProperty("java.home"); List<String> args = new ArrayList<>(); args.add(javaHome == null ? "java" : javaHome + File.separator + "bin" + File.separator + "java"); args.add("-agentlib:jdwp=transport=" + connector.transport().name() + ",address=" + addr); args.addAll(remoteVMOptions); args.add(remoteAgent); args.add("" + port); ProcessBuilder pb = new ProcessBuilder(args); pb.redirectError(crashErrorFile); pb.redirectOutput(crashOutputFile); process = pb.start(); // Accept the connection from the remote agent vm = timedVirtualMachineCreation(() -> listener.accept(connectorArgs), () -> process.waitFor()); try { listener.stopListening(connectorArgs); } catch (IOException | IllegalConnectorArgumentsException ex) { // ignore } crashErrorFile.delete(); crashOutputFile.delete(); return vm; } catch (Throwable ex) { if (process != null) { process.destroyForcibly(); } try { listener.stopListening(connectorArgs); } catch (IOException | IllegalConnectorArgumentsException iex) { // ignore } String text = readFile(crashErrorFile) + readFile(crashOutputFile); crashErrorFile.delete(); crashOutputFile.delete(); if (text.isEmpty()) { throw reportLaunchFail(ex, "listen"); } else { throw new IllegalArgumentException(text); } } }
[ "private", "VirtualMachine", "listenTarget", "(", "int", "port", ",", "List", "<", "String", ">", "remoteVMOptions", ")", "{", "ListeningConnector", "listener", "=", "(", "ListeningConnector", ")", "connector", ";", "// Files to collection to output of a start-up failure", "File", "crashErrorFile", "=", "createTempFile", "(", "\"error\"", ")", ";", "File", "crashOutputFile", "=", "createTempFile", "(", "\"output\"", ")", ";", "try", "{", "// Start listening, get the JDI connection address", "String", "addr", "=", "listener", ".", "startListening", "(", "connectorArgs", ")", ";", "debug", "(", "\"Listening at address: \"", "+", "addr", ")", ";", "// Launch the RemoteAgent requesting a connection on that address", "String", "javaHome", "=", "System", ".", "getProperty", "(", "\"java.home\"", ")", ";", "List", "<", "String", ">", "args", "=", "new", "ArrayList", "<>", "(", ")", ";", "args", ".", "add", "(", "javaHome", "==", "null", "?", "\"java\"", ":", "javaHome", "+", "File", ".", "separator", "+", "\"bin\"", "+", "File", ".", "separator", "+", "\"java\"", ")", ";", "args", ".", "add", "(", "\"-agentlib:jdwp=transport=\"", "+", "connector", ".", "transport", "(", ")", ".", "name", "(", ")", "+", "\",address=\"", "+", "addr", ")", ";", "args", ".", "addAll", "(", "remoteVMOptions", ")", ";", "args", ".", "add", "(", "remoteAgent", ")", ";", "args", ".", "add", "(", "\"\"", "+", "port", ")", ";", "ProcessBuilder", "pb", "=", "new", "ProcessBuilder", "(", "args", ")", ";", "pb", ".", "redirectError", "(", "crashErrorFile", ")", ";", "pb", ".", "redirectOutput", "(", "crashOutputFile", ")", ";", "process", "=", "pb", ".", "start", "(", ")", ";", "// Accept the connection from the remote agent", "vm", "=", "timedVirtualMachineCreation", "(", "(", ")", "->", "listener", ".", "accept", "(", "connectorArgs", ")", ",", "(", ")", "->", "process", ".", "waitFor", "(", ")", ")", ";", "try", "{", "listener", ".", "stopListening", "(", "connectorArgs", ")", ";", "}", "catch", "(", "IOException", "|", "IllegalConnectorArgumentsException", "ex", ")", "{", "// ignore", "}", "crashErrorFile", ".", "delete", "(", ")", ";", "crashOutputFile", ".", "delete", "(", ")", ";", "return", "vm", ";", "}", "catch", "(", "Throwable", "ex", ")", "{", "if", "(", "process", "!=", "null", ")", "{", "process", ".", "destroyForcibly", "(", ")", ";", "}", "try", "{", "listener", ".", "stopListening", "(", "connectorArgs", ")", ";", "}", "catch", "(", "IOException", "|", "IllegalConnectorArgumentsException", "iex", ")", "{", "// ignore", "}", "String", "text", "=", "readFile", "(", "crashErrorFile", ")", "+", "readFile", "(", "crashOutputFile", ")", ";", "crashErrorFile", ".", "delete", "(", ")", ";", "crashOutputFile", ".", "delete", "(", ")", ";", "if", "(", "text", ".", "isEmpty", "(", ")", ")", "{", "throw", "reportLaunchFail", "(", "ex", ",", "\"listen\"", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "text", ")", ";", "}", "}", "}" ]
Directly launch the remote agent and connect JDI to it with a ListeningConnector.
[ "Directly", "launch", "the", "remote", "agent", "and", "connect", "JDI", "to", "it", "with", "a", "ListeningConnector", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java#L149-L204
5,787
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java
JdiInitiator.launchArgs
private Map<String, String> launchArgs(int port, String remoteVMOptions) { Map<String, String> argumentName2Value = new HashMap<>(); argumentName2Value.put("main", remoteAgent + " " + port); argumentName2Value.put("options", remoteVMOptions); return argumentName2Value; }
java
private Map<String, String> launchArgs(int port, String remoteVMOptions) { Map<String, String> argumentName2Value = new HashMap<>(); argumentName2Value.put("main", remoteAgent + " " + port); argumentName2Value.put("options", remoteVMOptions); return argumentName2Value; }
[ "private", "Map", "<", "String", ",", "String", ">", "launchArgs", "(", "int", "port", ",", "String", "remoteVMOptions", ")", "{", "Map", "<", "String", ",", "String", ">", "argumentName2Value", "=", "new", "HashMap", "<>", "(", ")", ";", "argumentName2Value", ".", "put", "(", "\"main\"", ",", "remoteAgent", "+", "\" \"", "+", "port", ")", ";", "argumentName2Value", ".", "put", "(", "\"options\"", ",", "remoteVMOptions", ")", ";", "return", "argumentName2Value", ";", "}" ]
The JShell specific Connector args for the LaunchingConnector. @param portthe socket port for (non-JDI) commands @param remoteVMOptions any user requested VM options @return the argument map
[ "The", "JShell", "specific", "Connector", "args", "for", "the", "LaunchingConnector", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java#L291-L296
5,788
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
Main.doClassNames
boolean doClassNames(Collection<String> classNames) throws IOException { if (verbose) { out.println("List of classes to process:"); classNames.forEach(out::println); out.println("End of class list."); } // TODO: not sure this is necessary... if (fm instanceof JavacFileManager) { ((JavacFileManager)fm).setSymbolFileEnabled(false); } fm.setLocation(StandardLocation.CLASS_PATH, classPath); if (!bootClassPath.isEmpty()) { fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, bootClassPath); } if (!systemModules.isEmpty()) { fm.setLocation(StandardLocation.SYSTEM_MODULES, systemModules); } LoadProc proc = new LoadProc(); JavaCompiler.CompilationTask task = compiler.getTask(null, fm, this, options, classNames, null); task.setProcessors(List.of(proc)); boolean r = task.call(); if (r) { if (forRemoval) { deprList = proc.getDeprecations().stream() .filter(DeprData::isForRemoval) .collect(toList()); } else { deprList = proc.getDeprecations(); } } return r; }
java
boolean doClassNames(Collection<String> classNames) throws IOException { if (verbose) { out.println("List of classes to process:"); classNames.forEach(out::println); out.println("End of class list."); } // TODO: not sure this is necessary... if (fm instanceof JavacFileManager) { ((JavacFileManager)fm).setSymbolFileEnabled(false); } fm.setLocation(StandardLocation.CLASS_PATH, classPath); if (!bootClassPath.isEmpty()) { fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, bootClassPath); } if (!systemModules.isEmpty()) { fm.setLocation(StandardLocation.SYSTEM_MODULES, systemModules); } LoadProc proc = new LoadProc(); JavaCompiler.CompilationTask task = compiler.getTask(null, fm, this, options, classNames, null); task.setProcessors(List.of(proc)); boolean r = task.call(); if (r) { if (forRemoval) { deprList = proc.getDeprecations().stream() .filter(DeprData::isForRemoval) .collect(toList()); } else { deprList = proc.getDeprecations(); } } return r; }
[ "boolean", "doClassNames", "(", "Collection", "<", "String", ">", "classNames", ")", "throws", "IOException", "{", "if", "(", "verbose", ")", "{", "out", ".", "println", "(", "\"List of classes to process:\"", ")", ";", "classNames", ".", "forEach", "(", "out", "::", "println", ")", ";", "out", ".", "println", "(", "\"End of class list.\"", ")", ";", "}", "// TODO: not sure this is necessary...", "if", "(", "fm", "instanceof", "JavacFileManager", ")", "{", "(", "(", "JavacFileManager", ")", "fm", ")", ".", "setSymbolFileEnabled", "(", "false", ")", ";", "}", "fm", ".", "setLocation", "(", "StandardLocation", ".", "CLASS_PATH", ",", "classPath", ")", ";", "if", "(", "!", "bootClassPath", ".", "isEmpty", "(", ")", ")", "{", "fm", ".", "setLocation", "(", "StandardLocation", ".", "PLATFORM_CLASS_PATH", ",", "bootClassPath", ")", ";", "}", "if", "(", "!", "systemModules", ".", "isEmpty", "(", ")", ")", "{", "fm", ".", "setLocation", "(", "StandardLocation", ".", "SYSTEM_MODULES", ",", "systemModules", ")", ";", "}", "LoadProc", "proc", "=", "new", "LoadProc", "(", ")", ";", "JavaCompiler", ".", "CompilationTask", "task", "=", "compiler", ".", "getTask", "(", "null", ",", "fm", ",", "this", ",", "options", ",", "classNames", ",", "null", ")", ";", "task", ".", "setProcessors", "(", "List", ".", "of", "(", "proc", ")", ")", ";", "boolean", "r", "=", "task", ".", "call", "(", ")", ";", "if", "(", "r", ")", "{", "if", "(", "forRemoval", ")", "{", "deprList", "=", "proc", ".", "getDeprecations", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "DeprData", "::", "isForRemoval", ")", ".", "collect", "(", "toList", "(", ")", ")", ";", "}", "else", "{", "deprList", "=", "proc", ".", "getDeprecations", "(", ")", ";", "}", "}", "return", "r", ";", "}" ]
Processes a collection of class names. Names should fully qualified names in the form "pkg.pkg.pkg.classname". @param classNames collection of fully qualified classnames to process @return true for success, false for failure @throws IOException if an I/O error occurs
[ "Processes", "a", "collection", "of", "class", "names", ".", "Names", "should", "fully", "qualified", "names", "in", "the", "form", "pkg", ".", "pkg", ".", "pkg", ".", "classname", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L129-L165
5,789
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
Main.processDirectory
boolean processDirectory(String dirname, Collection<String> classNames) throws IOException { if (!Files.isDirectory(Paths.get(dirname))) { err.printf("%s: not a directory%n", dirname); return false; } classPath.add(0, new File(dirname)); if (classNames.isEmpty()) { Path base = Paths.get(dirname); int baseCount = base.getNameCount(); try (Stream<Path> paths = Files.walk(base)) { Stream<String> files = paths.filter(p -> p.getNameCount() > baseCount) .map(p -> p.subpath(baseCount, p.getNameCount())) .map(Path::toString); return doFileNames(files); } } else { return doClassNames(classNames); } }
java
boolean processDirectory(String dirname, Collection<String> classNames) throws IOException { if (!Files.isDirectory(Paths.get(dirname))) { err.printf("%s: not a directory%n", dirname); return false; } classPath.add(0, new File(dirname)); if (classNames.isEmpty()) { Path base = Paths.get(dirname); int baseCount = base.getNameCount(); try (Stream<Path> paths = Files.walk(base)) { Stream<String> files = paths.filter(p -> p.getNameCount() > baseCount) .map(p -> p.subpath(baseCount, p.getNameCount())) .map(Path::toString); return doFileNames(files); } } else { return doClassNames(classNames); } }
[ "boolean", "processDirectory", "(", "String", "dirname", ",", "Collection", "<", "String", ">", "classNames", ")", "throws", "IOException", "{", "if", "(", "!", "Files", ".", "isDirectory", "(", "Paths", ".", "get", "(", "dirname", ")", ")", ")", "{", "err", ".", "printf", "(", "\"%s: not a directory%n\"", ",", "dirname", ")", ";", "return", "false", ";", "}", "classPath", ".", "add", "(", "0", ",", "new", "File", "(", "dirname", ")", ")", ";", "if", "(", "classNames", ".", "isEmpty", "(", ")", ")", "{", "Path", "base", "=", "Paths", ".", "get", "(", "dirname", ")", ";", "int", "baseCount", "=", "base", ".", "getNameCount", "(", ")", ";", "try", "(", "Stream", "<", "Path", ">", "paths", "=", "Files", ".", "walk", "(", "base", ")", ")", "{", "Stream", "<", "String", ">", "files", "=", "paths", ".", "filter", "(", "p", "->", "p", ".", "getNameCount", "(", ")", ">", "baseCount", ")", ".", "map", "(", "p", "->", "p", ".", "subpath", "(", "baseCount", ",", "p", ".", "getNameCount", "(", ")", ")", ")", ".", "map", "(", "Path", "::", "toString", ")", ";", "return", "doFileNames", "(", "files", ")", ";", "}", "}", "else", "{", "return", "doClassNames", "(", "classNames", ")", ";", "}", "}" ]
Processes named class files in the given directory. The directory should be the root of a package hierarchy. If classNames is empty, walks the directory hierarchy to find all classes. @param dirname the name of the directory to process @param classNames the names of classes to process @return true for success, false for failure @throws IOException if an I/O error occurs
[ "Processes", "named", "class", "files", "in", "the", "given", "directory", ".", "The", "directory", "should", "be", "the", "root", "of", "a", "package", "hierarchy", ".", "If", "classNames", "is", "empty", "walks", "the", "directory", "hierarchy", "to", "find", "all", "classes", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L233-L254
5,790
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
Main.doJarFile
boolean doJarFile(String jarname) throws IOException { try (JarFile jf = new JarFile(jarname)) { Stream<String> files = jf.stream() .map(JarEntry::getName); return doFileNames(files); } }
java
boolean doJarFile(String jarname) throws IOException { try (JarFile jf = new JarFile(jarname)) { Stream<String> files = jf.stream() .map(JarEntry::getName); return doFileNames(files); } }
[ "boolean", "doJarFile", "(", "String", "jarname", ")", "throws", "IOException", "{", "try", "(", "JarFile", "jf", "=", "new", "JarFile", "(", "jarname", ")", ")", "{", "Stream", "<", "String", ">", "files", "=", "jf", ".", "stream", "(", ")", ".", "map", "(", "JarEntry", "::", "getName", ")", ";", "return", "doFileNames", "(", "files", ")", ";", "}", "}" ]
Processes all class files in the given jar file. @param jarname the name of the jar file to process @return true for success, false for failure @throws IOException if an I/O error occurs
[ "Processes", "all", "class", "files", "in", "the", "given", "jar", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L263-L270
5,791
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
Main.processJarFile
boolean processJarFile(String jarname, Collection<String> classNames) throws IOException { classPath.add(0, new File(jarname)); if (classNames.isEmpty()) { return doJarFile(jarname); } else { return doClassNames(classNames); } }
java
boolean processJarFile(String jarname, Collection<String> classNames) throws IOException { classPath.add(0, new File(jarname)); if (classNames.isEmpty()) { return doJarFile(jarname); } else { return doClassNames(classNames); } }
[ "boolean", "processJarFile", "(", "String", "jarname", ",", "Collection", "<", "String", ">", "classNames", ")", "throws", "IOException", "{", "classPath", ".", "add", "(", "0", ",", "new", "File", "(", "jarname", ")", ")", ";", "if", "(", "classNames", ".", "isEmpty", "(", ")", ")", "{", "return", "doJarFile", "(", "jarname", ")", ";", "}", "else", "{", "return", "doClassNames", "(", "classNames", ")", ";", "}", "}" ]
Processes named class files from the given jar file, or all classes if classNames is empty. @param jarname the name of the jar file to process @param classNames the names of classes to process @return true for success, false for failure @throws IOException if an I/O error occurs
[ "Processes", "named", "class", "files", "from", "the", "given", "jar", "file", "or", "all", "classes", "if", "classNames", "is", "empty", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L281-L289
5,792
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
Main.processOldJdk
boolean processOldJdk(String jdkHome, Collection<String> classNames) throws IOException { String RTJAR = jdkHome + "/jre/lib/rt.jar"; String CSJAR = jdkHome + "/jre/lib/charsets.jar"; bootClassPath.add(0, new File(RTJAR)); bootClassPath.add(1, new File(CSJAR)); options.add("-source"); options.add("8"); if (classNames.isEmpty()) { return doJarFile(RTJAR); } else { return doClassNames(classNames); } }
java
boolean processOldJdk(String jdkHome, Collection<String> classNames) throws IOException { String RTJAR = jdkHome + "/jre/lib/rt.jar"; String CSJAR = jdkHome + "/jre/lib/charsets.jar"; bootClassPath.add(0, new File(RTJAR)); bootClassPath.add(1, new File(CSJAR)); options.add("-source"); options.add("8"); if (classNames.isEmpty()) { return doJarFile(RTJAR); } else { return doClassNames(classNames); } }
[ "boolean", "processOldJdk", "(", "String", "jdkHome", ",", "Collection", "<", "String", ">", "classNames", ")", "throws", "IOException", "{", "String", "RTJAR", "=", "jdkHome", "+", "\"/jre/lib/rt.jar\"", ";", "String", "CSJAR", "=", "jdkHome", "+", "\"/jre/lib/charsets.jar\"", ";", "bootClassPath", ".", "add", "(", "0", ",", "new", "File", "(", "RTJAR", ")", ")", ";", "bootClassPath", ".", "add", "(", "1", ",", "new", "File", "(", "CSJAR", ")", ")", ";", "options", ".", "add", "(", "\"-source\"", ")", ";", "options", ".", "add", "(", "\"8\"", ")", ";", "if", "(", "classNames", ".", "isEmpty", "(", ")", ")", "{", "return", "doJarFile", "(", "RTJAR", ")", ";", "}", "else", "{", "return", "doClassNames", "(", "classNames", ")", ";", "}", "}" ]
Processes named class files from rt.jar of a JDK version 7 or 8. If classNames is empty, processes all classes. @param jdkHome the path to the "home" of the JDK to process @param classNames the names of classes to process @return true for success, false for failure @throws IOException if an I/O error occurs
[ "Processes", "named", "class", "files", "from", "rt", ".", "jar", "of", "a", "JDK", "version", "7", "or", "8", ".", "If", "classNames", "is", "empty", "processes", "all", "classes", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L300-L314
5,793
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
Main.processJdk9
boolean processJdk9(String jdkHome, Collection<String> classes) throws IOException { systemModules.add(new File(jdkHome)); return doClassNames(classes); }
java
boolean processJdk9(String jdkHome, Collection<String> classes) throws IOException { systemModules.add(new File(jdkHome)); return doClassNames(classes); }
[ "boolean", "processJdk9", "(", "String", "jdkHome", ",", "Collection", "<", "String", ">", "classes", ")", "throws", "IOException", "{", "systemModules", ".", "add", "(", "new", "File", "(", "jdkHome", ")", ")", ";", "return", "doClassNames", "(", "classes", ")", ";", "}" ]
Processes listed classes given a JDK 9 home.
[ "Processes", "listed", "classes", "given", "a", "JDK", "9", "home", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L319-L322
5,794
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
Main.processRelease
boolean processRelease(String release, Collection<String> classes) throws IOException { options.addAll(List.of("--release", release)); if (release.equals("9")) { List<String> rootMods = List.of("java.se", "java.se.ee"); TraverseProc proc = new TraverseProc(rootMods); JavaCompiler.CompilationTask task = compiler.getTask(null, fm, this, // options List.of("--add-modules", String.join(",", rootMods)), // classes List.of("java.lang.Object"), null); task.setProcessors(List.of(proc)); if (!task.call()) { return false; } Map<PackageElement, List<TypeElement>> types = proc.getPublicTypes(); options.add("--add-modules"); options.add(String.join(",", rootMods)); return doClassNames( types.values().stream() .flatMap(List::stream) .map(TypeElement::toString) .collect(toList())); } else { // TODO: kind of a hack... // Create a throwaway compilation task with options "--release N" // which has the side effect of setting the file manager's // PLATFORM_CLASS_PATH to the right value. JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager fm = compiler.getStandardFileManager(this, null, StandardCharsets.UTF_8); JavaCompiler.CompilationTask task = compiler.getTask(null, fm, this, List.of("--release", release), null, null); List<Path> paths = new ArrayList<>(); for (Path p : fm.getLocationAsPaths(StandardLocation.PLATFORM_CLASS_PATH)) { try (Stream<Path> str = Files.walk(p)) { str.forEachOrdered(paths::add); } } options.add("-Xlint:-options"); return doClassNames( paths.stream() .filter(path -> path.toString().endsWith(".sig")) .map(path -> path.subpath(1, path.getNameCount())) .map(Path::toString) .map(s -> s.replaceAll("\\.sig$", "")) .map(s -> s.replace('/', '.')) .collect(toList())); } }
java
boolean processRelease(String release, Collection<String> classes) throws IOException { options.addAll(List.of("--release", release)); if (release.equals("9")) { List<String> rootMods = List.of("java.se", "java.se.ee"); TraverseProc proc = new TraverseProc(rootMods); JavaCompiler.CompilationTask task = compiler.getTask(null, fm, this, // options List.of("--add-modules", String.join(",", rootMods)), // classes List.of("java.lang.Object"), null); task.setProcessors(List.of(proc)); if (!task.call()) { return false; } Map<PackageElement, List<TypeElement>> types = proc.getPublicTypes(); options.add("--add-modules"); options.add(String.join(",", rootMods)); return doClassNames( types.values().stream() .flatMap(List::stream) .map(TypeElement::toString) .collect(toList())); } else { // TODO: kind of a hack... // Create a throwaway compilation task with options "--release N" // which has the side effect of setting the file manager's // PLATFORM_CLASS_PATH to the right value. JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager fm = compiler.getStandardFileManager(this, null, StandardCharsets.UTF_8); JavaCompiler.CompilationTask task = compiler.getTask(null, fm, this, List.of("--release", release), null, null); List<Path> paths = new ArrayList<>(); for (Path p : fm.getLocationAsPaths(StandardLocation.PLATFORM_CLASS_PATH)) { try (Stream<Path> str = Files.walk(p)) { str.forEachOrdered(paths::add); } } options.add("-Xlint:-options"); return doClassNames( paths.stream() .filter(path -> path.toString().endsWith(".sig")) .map(path -> path.subpath(1, path.getNameCount())) .map(Path::toString) .map(s -> s.replaceAll("\\.sig$", "")) .map(s -> s.replace('/', '.')) .collect(toList())); } }
[ "boolean", "processRelease", "(", "String", "release", ",", "Collection", "<", "String", ">", "classes", ")", "throws", "IOException", "{", "options", ".", "addAll", "(", "List", ".", "of", "(", "\"--release\"", ",", "release", ")", ")", ";", "if", "(", "release", ".", "equals", "(", "\"9\"", ")", ")", "{", "List", "<", "String", ">", "rootMods", "=", "List", ".", "of", "(", "\"java.se\"", ",", "\"java.se.ee\"", ")", ";", "TraverseProc", "proc", "=", "new", "TraverseProc", "(", "rootMods", ")", ";", "JavaCompiler", ".", "CompilationTask", "task", "=", "compiler", ".", "getTask", "(", "null", ",", "fm", ",", "this", ",", "// options", "List", ".", "of", "(", "\"--add-modules\"", ",", "String", ".", "join", "(", "\",\"", ",", "rootMods", ")", ")", ",", "// classes", "List", ".", "of", "(", "\"java.lang.Object\"", ")", ",", "null", ")", ";", "task", ".", "setProcessors", "(", "List", ".", "of", "(", "proc", ")", ")", ";", "if", "(", "!", "task", ".", "call", "(", ")", ")", "{", "return", "false", ";", "}", "Map", "<", "PackageElement", ",", "List", "<", "TypeElement", ">", ">", "types", "=", "proc", ".", "getPublicTypes", "(", ")", ";", "options", ".", "add", "(", "\"--add-modules\"", ")", ";", "options", ".", "add", "(", "String", ".", "join", "(", "\",\"", ",", "rootMods", ")", ")", ";", "return", "doClassNames", "(", "types", ".", "values", "(", ")", ".", "stream", "(", ")", ".", "flatMap", "(", "List", "::", "stream", ")", ".", "map", "(", "TypeElement", "::", "toString", ")", ".", "collect", "(", "toList", "(", ")", ")", ")", ";", "}", "else", "{", "// TODO: kind of a hack...", "// Create a throwaway compilation task with options \"--release N\"", "// which has the side effect of setting the file manager's", "// PLATFORM_CLASS_PATH to the right value.", "JavaCompiler", "compiler", "=", "ToolProvider", ".", "getSystemJavaCompiler", "(", ")", ";", "StandardJavaFileManager", "fm", "=", "compiler", ".", "getStandardFileManager", "(", "this", ",", "null", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "JavaCompiler", ".", "CompilationTask", "task", "=", "compiler", ".", "getTask", "(", "null", ",", "fm", ",", "this", ",", "List", ".", "of", "(", "\"--release\"", ",", "release", ")", ",", "null", ",", "null", ")", ";", "List", "<", "Path", ">", "paths", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Path", "p", ":", "fm", ".", "getLocationAsPaths", "(", "StandardLocation", ".", "PLATFORM_CLASS_PATH", ")", ")", "{", "try", "(", "Stream", "<", "Path", ">", "str", "=", "Files", ".", "walk", "(", "p", ")", ")", "{", "str", ".", "forEachOrdered", "(", "paths", "::", "add", ")", ";", "}", "}", "options", ".", "add", "(", "\"-Xlint:-options\"", ")", ";", "return", "doClassNames", "(", "paths", ".", "stream", "(", ")", ".", "filter", "(", "path", "->", "path", ".", "toString", "(", ")", ".", "endsWith", "(", "\".sig\"", ")", ")", ".", "map", "(", "path", "->", "path", ".", "subpath", "(", "1", ",", "path", ".", "getNameCount", "(", ")", ")", ")", ".", "map", "(", "Path", "::", "toString", ")", ".", "map", "(", "s", "->", "s", ".", "replaceAll", "(", "\"\\\\.sig$\"", ",", "\"\"", ")", ")", ".", "map", "(", "s", "->", "s", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ")", ".", "collect", "(", "toList", "(", ")", ")", ")", ";", "}", "}" ]
Process classes from a particular JDK release, using only information in this JDK. @param release "6", "7", "8", or "9" @param classes collection of classes to process, may be empty @return success value
[ "Process", "classes", "from", "a", "particular", "JDK", "release", "using", "only", "information", "in", "this", "JDK", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L360-L413
5,795
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
Main.main
public static void main(String[] args) { System.exit(call(System.out, System.err, args) ? 0 : 1); }
java
public static void main(String[] args) { System.exit(call(System.out, System.err, args) ? 0 : 1); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "System", ".", "exit", "(", "call", "(", "System", ".", "out", ",", "System", ".", "err", ",", "args", ")", "?", "0", ":", "1", ")", ";", "}" ]
Calls the main entry point and exits the JVM with an exit status determined by the return status.
[ "Calls", "the", "main", "entry", "point", "and", "exits", "the", "JVM", "with", "an", "exit", "status", "determined", "by", "the", "return", "status", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L699-L701
5,796
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
AbstractIndexWriter.getNavLinkIndex
@Override protected Content getNavLinkIndex() { Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.indexLabel); return li; }
java
@Override protected Content getNavLinkIndex() { Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.indexLabel); return li; }
[ "@", "Override", "protected", "Content", "getNavLinkIndex", "(", ")", "{", "Content", "li", "=", "HtmlTree", ".", "LI", "(", "HtmlStyle", ".", "navBarCell1Rev", ",", "contents", ".", "indexLabel", ")", ";", "return", "li", ";", "}" ]
Get the index label for navigation bar. @return a content tree for the tree label
[ "Get", "the", "index", "label", "for", "navigation", "bar", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java#L94-L98
5,797
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
AbstractIndexWriter.addDescription
protected void addDescription(ModuleElement mdle, Content dlTree, SearchIndexItem si) { String moduleName = utils.getFullyQualifiedName(mdle); Content link = getModuleLink(mdle, new StringContent(moduleName)); si.setLabel(moduleName); si.setCategory(resources.getText("doclet.Modules")); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(contents.module_); dt.addContent(" " + moduleName); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(mdle, dd); dlTree.addContent(dd); }
java
protected void addDescription(ModuleElement mdle, Content dlTree, SearchIndexItem si) { String moduleName = utils.getFullyQualifiedName(mdle); Content link = getModuleLink(mdle, new StringContent(moduleName)); si.setLabel(moduleName); si.setCategory(resources.getText("doclet.Modules")); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(contents.module_); dt.addContent(" " + moduleName); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(mdle, dd); dlTree.addContent(dd); }
[ "protected", "void", "addDescription", "(", "ModuleElement", "mdle", ",", "Content", "dlTree", ",", "SearchIndexItem", "si", ")", "{", "String", "moduleName", "=", "utils", ".", "getFullyQualifiedName", "(", "mdle", ")", ";", "Content", "link", "=", "getModuleLink", "(", "mdle", ",", "new", "StringContent", "(", "moduleName", ")", ")", ";", "si", ".", "setLabel", "(", "moduleName", ")", ";", "si", ".", "setCategory", "(", "resources", ".", "getText", "(", "\"doclet.Modules\"", ")", ")", ";", "Content", "dt", "=", "HtmlTree", ".", "DT", "(", "link", ")", ";", "dt", ".", "addContent", "(", "\" - \"", ")", ";", "dt", ".", "addContent", "(", "contents", ".", "module_", ")", ";", "dt", ".", "addContent", "(", "\" \"", "+", "moduleName", ")", ";", "dlTree", ".", "addContent", "(", "dt", ")", ";", "Content", "dd", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "DD", ")", ";", "addSummaryComment", "(", "mdle", ",", "dd", ")", ";", "dlTree", ".", "addContent", "(", "dd", ")", ";", "}" ]
Add one line summary comment for the module. @param mdle the module to be documented @param dlTree the content tree to which the description will be added
[ "Add", "one", "line", "summary", "comment", "for", "the", "module", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java#L226-L239
5,798
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
JavacTaskImpl.analyze
public Iterable<? extends Element> analyze(Iterable<? extends Element> classes) { enter(null); // ensure all classes have been entered final ListBuffer<Element> results = new ListBuffer<>(); try { if (classes == null) { handleFlowResults(compiler.flow(compiler.attribute(compiler.todo)), results); } else { Filter f = new Filter() { @Override public void process(Env<AttrContext> env) { handleFlowResults(compiler.flow(compiler.attribute(env)), results); } }; f.run(compiler.todo, classes); } } finally { compiler.log.flush(); } return results; }
java
public Iterable<? extends Element> analyze(Iterable<? extends Element> classes) { enter(null); // ensure all classes have been entered final ListBuffer<Element> results = new ListBuffer<>(); try { if (classes == null) { handleFlowResults(compiler.flow(compiler.attribute(compiler.todo)), results); } else { Filter f = new Filter() { @Override public void process(Env<AttrContext> env) { handleFlowResults(compiler.flow(compiler.attribute(env)), results); } }; f.run(compiler.todo, classes); } } finally { compiler.log.flush(); } return results; }
[ "public", "Iterable", "<", "?", "extends", "Element", ">", "analyze", "(", "Iterable", "<", "?", "extends", "Element", ">", "classes", ")", "{", "enter", "(", "null", ")", ";", "// ensure all classes have been entered", "final", "ListBuffer", "<", "Element", ">", "results", "=", "new", "ListBuffer", "<>", "(", ")", ";", "try", "{", "if", "(", "classes", "==", "null", ")", "{", "handleFlowResults", "(", "compiler", ".", "flow", "(", "compiler", ".", "attribute", "(", "compiler", ".", "todo", ")", ")", ",", "results", ")", ";", "}", "else", "{", "Filter", "f", "=", "new", "Filter", "(", ")", "{", "@", "Override", "public", "void", "process", "(", "Env", "<", "AttrContext", ">", "env", ")", "{", "handleFlowResults", "(", "compiler", ".", "flow", "(", "compiler", ".", "attribute", "(", "env", ")", ")", ",", "results", ")", ";", "}", "}", ";", "f", ".", "run", "(", "compiler", ".", "todo", ",", "classes", ")", ";", "}", "}", "finally", "{", "compiler", ".", "log", ".", "flush", "(", ")", ";", "}", "return", "results", ";", "}" ]
wrap it here
[ "wrap", "it", "here" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java#L378-L398
5,799
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
JavacTaskImpl.parseType
public Type parseType(String expr, TypeElement scope) { if (expr == null || expr.equals("")) throw new IllegalArgumentException(); compiler = JavaCompiler.instance(context); JavaFileObject prev = compiler.log.useSource(null); ParserFactory parserFactory = ParserFactory.instance(context); Attr attr = Attr.instance(context); try { CharBuffer buf = CharBuffer.wrap((expr+"\u0000").toCharArray(), 0, expr.length()); Parser parser = parserFactory.newParser(buf, false, false, false); JCTree tree = parser.parseType(); return attr.attribType(tree, (Symbol.TypeSymbol)scope); } finally { compiler.log.useSource(prev); } }
java
public Type parseType(String expr, TypeElement scope) { if (expr == null || expr.equals("")) throw new IllegalArgumentException(); compiler = JavaCompiler.instance(context); JavaFileObject prev = compiler.log.useSource(null); ParserFactory parserFactory = ParserFactory.instance(context); Attr attr = Attr.instance(context); try { CharBuffer buf = CharBuffer.wrap((expr+"\u0000").toCharArray(), 0, expr.length()); Parser parser = parserFactory.newParser(buf, false, false, false); JCTree tree = parser.parseType(); return attr.attribType(tree, (Symbol.TypeSymbol)scope); } finally { compiler.log.useSource(prev); } }
[ "public", "Type", "parseType", "(", "String", "expr", ",", "TypeElement", "scope", ")", "{", "if", "(", "expr", "==", "null", "||", "expr", ".", "equals", "(", "\"\"", ")", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "compiler", "=", "JavaCompiler", ".", "instance", "(", "context", ")", ";", "JavaFileObject", "prev", "=", "compiler", ".", "log", ".", "useSource", "(", "null", ")", ";", "ParserFactory", "parserFactory", "=", "ParserFactory", ".", "instance", "(", "context", ")", ";", "Attr", "attr", "=", "Attr", ".", "instance", "(", "context", ")", ";", "try", "{", "CharBuffer", "buf", "=", "CharBuffer", ".", "wrap", "(", "(", "expr", "+", "\"\\u0000\"", ")", ".", "toCharArray", "(", ")", ",", "0", ",", "expr", ".", "length", "(", ")", ")", ";", "Parser", "parser", "=", "parserFactory", ".", "newParser", "(", "buf", ",", "false", ",", "false", ",", "false", ")", ";", "JCTree", "tree", "=", "parser", ".", "parseType", "(", ")", ";", "return", "attr", ".", "attribType", "(", "tree", ",", "(", "Symbol", ".", "TypeSymbol", ")", "scope", ")", ";", "}", "finally", "{", "compiler", ".", "log", ".", "useSource", "(", "prev", ")", ";", "}", "}" ]
For internal use only. This method will be removed without warning. @param expr the type expression to be analyzed @param scope the scope in which to analyze the type expression @return the type @throws IllegalArgumentException if the type expression of null or empty
[ "For", "internal", "use", "only", ".", "This", "method", "will", "be", "removed", "without", "warning", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java#L518-L533