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,100
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addJQueryFile
private void addJQueryFile(Content head, DocPath filePath) { HtmlTree jqyeryScriptFile = HtmlTree.SCRIPT( pathToRoot.resolve(DocPaths.JQUERY_FILES.resolve(filePath)).getPath()); head.addContent(jqyeryScriptFile); }
java
private void addJQueryFile(Content head, DocPath filePath) { HtmlTree jqyeryScriptFile = HtmlTree.SCRIPT( pathToRoot.resolve(DocPaths.JQUERY_FILES.resolve(filePath)).getPath()); head.addContent(jqyeryScriptFile); }
[ "private", "void", "addJQueryFile", "(", "Content", "head", ",", "DocPath", "filePath", ")", "{", "HtmlTree", "jqyeryScriptFile", "=", "HtmlTree", ".", "SCRIPT", "(", "pathToRoot", ".", "resolve", "(", "DocPaths", ".", "JQUERY_FILES", ".", "resolve", "(", "filePath", ")", ")", ".", "getPath", "(", ")", ")", ";", "head", ".", "addContent", "(", "jqyeryScriptFile", ")", ";", "}" ]
Add a link to the JQuery javascript file. @param head the content tree to which the files will be added @param filePath the DocPath of the file that needs to be added
[ "Add", "a", "link", "to", "the", "JQuery", "javascript", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1816-L1820
5,101
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addAnnotationInfo
public void addAnnotationInfo(PackageDoc packageDoc, Content htmltree) { addAnnotationInfo(packageDoc, packageDoc.annotations(), htmltree); }
java
public void addAnnotationInfo(PackageDoc packageDoc, Content htmltree) { addAnnotationInfo(packageDoc, packageDoc.annotations(), htmltree); }
[ "public", "void", "addAnnotationInfo", "(", "PackageDoc", "packageDoc", ",", "Content", "htmltree", ")", "{", "addAnnotationInfo", "(", "packageDoc", ",", "packageDoc", ".", "annotations", "(", ")", ",", "htmltree", ")", ";", "}" ]
Adds the annotatation types for the given packageDoc. @param packageDoc the package to write annotations for. @param htmltree the documentation tree to which the annotation info will be added
[ "Adds", "the", "annotatation", "types", "for", "the", "given", "packageDoc", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1838-L1840
5,102
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addAnnotationInfo
public boolean addAnnotationInfo(int indent, Doc doc, Parameter param, Content tree) { return addAnnotationInfo(indent, doc, param.annotations(), false, tree); }
java
public boolean addAnnotationInfo(int indent, Doc doc, Parameter param, Content tree) { return addAnnotationInfo(indent, doc, param.annotations(), false, tree); }
[ "public", "boolean", "addAnnotationInfo", "(", "int", "indent", ",", "Doc", "doc", ",", "Parameter", "param", ",", "Content", "tree", ")", "{", "return", "addAnnotationInfo", "(", "indent", ",", "doc", ",", "param", ".", "annotations", "(", ")", ",", "false", ",", "tree", ")", ";", "}" ]
Add the annotatation types for the given doc and parameter. @param indent the number of spaces to indent the parameters. @param doc the doc to write annotations for. @param param the parameter to write annotations for. @param tree the content tree to which the annotation types will be added
[ "Add", "the", "annotatation", "types", "for", "the", "given", "doc", "and", "parameter", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1873-L1876
5,103
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java
TreeScanner.scan
public R scan(Iterable<? extends Tree> nodes, P p) { R r = null; if (nodes != null) { boolean first = true; for (Tree node : nodes) { r = (first ? scan(node, p) : scanAndReduce(node, p, r)); first = false; } } return r; }
java
public R scan(Iterable<? extends Tree> nodes, P p) { R r = null; if (nodes != null) { boolean first = true; for (Tree node : nodes) { r = (first ? scan(node, p) : scanAndReduce(node, p, r)); first = false; } } return r; }
[ "public", "R", "scan", "(", "Iterable", "<", "?", "extends", "Tree", ">", "nodes", ",", "P", "p", ")", "{", "R", "r", "=", "null", ";", "if", "(", "nodes", "!=", "null", ")", "{", "boolean", "first", "=", "true", ";", "for", "(", "Tree", "node", ":", "nodes", ")", "{", "r", "=", "(", "first", "?", "scan", "(", "node", ",", "p", ")", ":", "scanAndReduce", "(", "node", ",", "p", ",", "r", ")", ")", ";", "first", "=", "false", ";", "}", "}", "return", "r", ";", "}" ]
Scans a sequence of nodes. @param nodes the nodes to be scanned @param p a parameter value to be passed to the visit method for each node @return the combined return value from the visit methods. The values are combined using the {@link #reduce reduce} method.
[ "Scans", "a", "sequence", "of", "nodes", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L100-L110
5,104
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/CSV.java
CSV.write
public static void write(PrintStream out, Object... objs) { out.println(Arrays.stream(objs) .map(Object::toString) .map(CSV::quote) .collect(Collectors.joining(","))); }
java
public static void write(PrintStream out, Object... objs) { out.println(Arrays.stream(objs) .map(Object::toString) .map(CSV::quote) .collect(Collectors.joining(","))); }
[ "public", "static", "void", "write", "(", "PrintStream", "out", ",", "Object", "...", "objs", ")", "{", "out", ".", "println", "(", "Arrays", ".", "stream", "(", "objs", ")", ".", "map", "(", "Object", "::", "toString", ")", ".", "map", "(", "CSV", "::", "quote", ")", ".", "collect", "(", "Collectors", ".", "joining", "(", "\",\"", ")", ")", ")", ";", "}" ]
Writes the objects' string representations to the output as a line of CSV. The objects are converted to String, quoted if necessary, joined with commas, and are written to the output followed by the line separator string. @param out the output destination @param objs the objects to write
[ "Writes", "the", "objects", "string", "representations", "to", "the", "output", "as", "a", "line", "of", "CSV", ".", "The", "objects", "are", "converted", "to", "String", "quoted", "if", "necessary", "joined", "with", "commas", "and", "are", "written", "to", "the", "output", "followed", "by", "the", "line", "separator", "string", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/CSV.java#L64-L69
5,105
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/CSV.java
CSV.split
public static List<String> split(String input) { List<String> result = new ArrayList<>(); StringBuilder cur = new StringBuilder(); State state = State.START_FIELD; for (int i = 0; i < input.length(); i++) { char ch = input.charAt(i); switch (ch) { case ',': switch (state) { case IN_QFIELD: cur.append(','); break; default: result.add(cur.toString()); cur.setLength(0); state = State.START_FIELD; break; } break; case '"': switch (state) { case START_FIELD: state = State.IN_QFIELD; break; case IN_QFIELD: state = State.END_QFIELD; break; case IN_FIELD: throw new CSVParseException("unexpected quote", input, i); case END_QFIELD: cur.append('"'); state = State.IN_QFIELD; break; } break; default: switch (state) { case START_FIELD: state = State.IN_FIELD; break; case IN_FIELD: case IN_QFIELD: break; case END_QFIELD: throw new CSVParseException("extra character after quoted string", input, i); } cur.append(ch); break; } } if (state == State.IN_QFIELD) { throw new CSVParseException("unclosed quote", input, input.length()); } result.add(cur.toString()); return result; }
java
public static List<String> split(String input) { List<String> result = new ArrayList<>(); StringBuilder cur = new StringBuilder(); State state = State.START_FIELD; for (int i = 0; i < input.length(); i++) { char ch = input.charAt(i); switch (ch) { case ',': switch (state) { case IN_QFIELD: cur.append(','); break; default: result.add(cur.toString()); cur.setLength(0); state = State.START_FIELD; break; } break; case '"': switch (state) { case START_FIELD: state = State.IN_QFIELD; break; case IN_QFIELD: state = State.END_QFIELD; break; case IN_FIELD: throw new CSVParseException("unexpected quote", input, i); case END_QFIELD: cur.append('"'); state = State.IN_QFIELD; break; } break; default: switch (state) { case START_FIELD: state = State.IN_FIELD; break; case IN_FIELD: case IN_QFIELD: break; case END_QFIELD: throw new CSVParseException("extra character after quoted string", input, i); } cur.append(ch); break; } } if (state == State.IN_QFIELD) { throw new CSVParseException("unclosed quote", input, input.length()); } result.add(cur.toString()); return result; }
[ "public", "static", "List", "<", "String", ">", "split", "(", "String", "input", ")", "{", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "StringBuilder", "cur", "=", "new", "StringBuilder", "(", ")", ";", "State", "state", "=", "State", ".", "START_FIELD", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "input", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "ch", "=", "input", ".", "charAt", "(", "i", ")", ";", "switch", "(", "ch", ")", "{", "case", "'", "'", ":", "switch", "(", "state", ")", "{", "case", "IN_QFIELD", ":", "cur", ".", "append", "(", "'", "'", ")", ";", "break", ";", "default", ":", "result", ".", "add", "(", "cur", ".", "toString", "(", ")", ")", ";", "cur", ".", "setLength", "(", "0", ")", ";", "state", "=", "State", ".", "START_FIELD", ";", "break", ";", "}", "break", ";", "case", "'", "'", ":", "switch", "(", "state", ")", "{", "case", "START_FIELD", ":", "state", "=", "State", ".", "IN_QFIELD", ";", "break", ";", "case", "IN_QFIELD", ":", "state", "=", "State", ".", "END_QFIELD", ";", "break", ";", "case", "IN_FIELD", ":", "throw", "new", "CSVParseException", "(", "\"unexpected quote\"", ",", "input", ",", "i", ")", ";", "case", "END_QFIELD", ":", "cur", ".", "append", "(", "'", "'", ")", ";", "state", "=", "State", ".", "IN_QFIELD", ";", "break", ";", "}", "break", ";", "default", ":", "switch", "(", "state", ")", "{", "case", "START_FIELD", ":", "state", "=", "State", ".", "IN_FIELD", ";", "break", ";", "case", "IN_FIELD", ":", "case", "IN_QFIELD", ":", "break", ";", "case", "END_QFIELD", ":", "throw", "new", "CSVParseException", "(", "\"extra character after quoted string\"", ",", "input", ",", "i", ")", ";", "}", "cur", ".", "append", "(", "ch", ")", ";", "break", ";", "}", "}", "if", "(", "state", "==", "State", ".", "IN_QFIELD", ")", "{", "throw", "new", "CSVParseException", "(", "\"unclosed quote\"", ",", "input", ",", "input", ".", "length", "(", ")", ")", ";", "}", "result", ".", "add", "(", "cur", ".", "toString", "(", ")", ")", ";", "return", "result", ";", "}" ]
Splits an input line into a list of strings, handling quoting. @param input the input line @return the resulting list of strings
[ "Splits", "an", "input", "line", "into", "a", "list", "of", "strings", "handling", "quoting", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/CSV.java#L87-L146
5,106
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java
Infer.doIncorporation
void doIncorporation(InferenceContext inferenceContext, Warner warn) throws InferenceException { try { boolean progress = true; int round = 0; while (progress && round < MAX_INCORPORATION_STEPS) { progress = false; for (Type t : inferenceContext.undetvars) { UndetVar uv = (UndetVar)t; if (!uv.incorporationActions.isEmpty()) { progress = true; uv.incorporationActions.removeFirst().apply(inferenceContext, warn); } } round++; } } finally { incorporationCache.clear(); } }
java
void doIncorporation(InferenceContext inferenceContext, Warner warn) throws InferenceException { try { boolean progress = true; int round = 0; while (progress && round < MAX_INCORPORATION_STEPS) { progress = false; for (Type t : inferenceContext.undetvars) { UndetVar uv = (UndetVar)t; if (!uv.incorporationActions.isEmpty()) { progress = true; uv.incorporationActions.removeFirst().apply(inferenceContext, warn); } } round++; } } finally { incorporationCache.clear(); } }
[ "void", "doIncorporation", "(", "InferenceContext", "inferenceContext", ",", "Warner", "warn", ")", "throws", "InferenceException", "{", "try", "{", "boolean", "progress", "=", "true", ";", "int", "round", "=", "0", ";", "while", "(", "progress", "&&", "round", "<", "MAX_INCORPORATION_STEPS", ")", "{", "progress", "=", "false", ";", "for", "(", "Type", "t", ":", "inferenceContext", ".", "undetvars", ")", "{", "UndetVar", "uv", "=", "(", "UndetVar", ")", "t", ";", "if", "(", "!", "uv", ".", "incorporationActions", ".", "isEmpty", "(", ")", ")", "{", "progress", "=", "true", ";", "uv", ".", "incorporationActions", ".", "removeFirst", "(", ")", ".", "apply", "(", "inferenceContext", ",", "warn", ")", ";", "}", "}", "round", "++", ";", "}", "}", "finally", "{", "incorporationCache", ".", "clear", "(", ")", ";", "}", "}" ]
Check bounds and perform incorporation.
[ "Check", "bounds", "and", "perform", "incorporation", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java#L1112-L1130
5,107
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java
Extern.isExternal
public boolean isExternal(Element element) { if (packageToItemMap == null) { return false; } PackageElement pe = configuration.utils.containingPackage(element); if (pe.isUnnamed()) { return false; } return packageToItemMap.get(configuration.utils.getPackageName(pe)) != null; }
java
public boolean isExternal(Element element) { if (packageToItemMap == null) { return false; } PackageElement pe = configuration.utils.containingPackage(element); if (pe.isUnnamed()) { return false; } return packageToItemMap.get(configuration.utils.getPackageName(pe)) != null; }
[ "public", "boolean", "isExternal", "(", "Element", "element", ")", "{", "if", "(", "packageToItemMap", "==", "null", ")", "{", "return", "false", ";", "}", "PackageElement", "pe", "=", "configuration", ".", "utils", ".", "containingPackage", "(", "element", ")", ";", "if", "(", "pe", ".", "isUnnamed", "(", ")", ")", "{", "return", "false", ";", "}", "return", "packageToItemMap", ".", "get", "(", "configuration", ".", "utils", ".", "getPackageName", "(", "pe", ")", ")", "!=", "null", ";", "}" ]
Determine if a element item is externally documented. @param element an Element. @return true if the element is externally documented
[ "Determine", "if", "a", "element", "item", "is", "externally", "documented", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java#L136-L145
5,108
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java
Extern.getExternalLink
public DocLink getExternalLink(String pkgName, DocPath relativepath, String filename) { return getExternalLink(pkgName, relativepath, filename, null); }
java
public DocLink getExternalLink(String pkgName, DocPath relativepath, String filename) { return getExternalLink(pkgName, relativepath, filename, null); }
[ "public", "DocLink", "getExternalLink", "(", "String", "pkgName", ",", "DocPath", "relativepath", ",", "String", "filename", ")", "{", "return", "getExternalLink", "(", "pkgName", ",", "relativepath", ",", "filename", ",", "null", ")", ";", "}" ]
Convert a link to be an external link if appropriate. @param pkgName The package name. @param relativepath The relative path. @param filename The link to convert. @return if external return converted link else return null
[ "Convert", "a", "link", "to", "be", "an", "external", "link", "if", "appropriate", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java#L155-L157
5,109
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java
Extern.findPackageItem
private Item findPackageItem(String pkgName) { if (packageToItemMap == null) { return null; } return packageToItemMap.get(pkgName); }
java
private Item findPackageItem(String pkgName) { if (packageToItemMap == null) { return null; } return packageToItemMap.get(pkgName); }
[ "private", "Item", "findPackageItem", "(", "String", "pkgName", ")", "{", "if", "(", "packageToItemMap", "==", "null", ")", "{", "return", "null", ";", "}", "return", "packageToItemMap", ".", "get", "(", "pkgName", ")", ";", "}" ]
Get the Extern Item object associated with this package name. @param pkgName Package name.
[ "Get", "the", "Extern", "Item", "object", "associated", "with", "this", "package", "name", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java#L222-L227
5,110
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java
Extern.readPackageListFromURL
private void readPackageListFromURL(String urlpath, URL pkglisturlpath) throws Fault { try { URL link = pkglisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL(); readPackageList(link.openStream(), urlpath, false); } catch (URISyntaxException | MalformedURLException exc) { throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc); } catch (IOException exc) { throw new Fault(configuration.getText("doclet.URL_error", pkglisturlpath.toString()), exc); } }
java
private void readPackageListFromURL(String urlpath, URL pkglisturlpath) throws Fault { try { URL link = pkglisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL(); readPackageList(link.openStream(), urlpath, false); } catch (URISyntaxException | MalformedURLException exc) { throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc); } catch (IOException exc) { throw new Fault(configuration.getText("doclet.URL_error", pkglisturlpath.toString()), exc); } }
[ "private", "void", "readPackageListFromURL", "(", "String", "urlpath", ",", "URL", "pkglisturlpath", ")", "throws", "Fault", "{", "try", "{", "URL", "link", "=", "pkglisturlpath", ".", "toURI", "(", ")", ".", "resolve", "(", "DocPaths", ".", "PACKAGE_LIST", ".", "getPath", "(", ")", ")", ".", "toURL", "(", ")", ";", "readPackageList", "(", "link", ".", "openStream", "(", ")", ",", "urlpath", ",", "false", ")", ";", "}", "catch", "(", "URISyntaxException", "|", "MalformedURLException", "exc", ")", "{", "throw", "new", "Fault", "(", "configuration", ".", "getText", "(", "\"doclet.MalformedURL\"", ",", "pkglisturlpath", ".", "toString", "(", ")", ")", ",", "exc", ")", ";", "}", "catch", "(", "IOException", "exc", ")", "{", "throw", "new", "Fault", "(", "configuration", ".", "getText", "(", "\"doclet.URL_error\"", ",", "pkglisturlpath", ".", "toString", "(", ")", ")", ",", "exc", ")", ";", "}", "}" ]
Fetch the URL and read the "package-list" file. @param urlpath Path to the packages. @param pkglisturlpath URL or the path to the "package-list" file.
[ "Fetch", "the", "URL", "and", "read", "the", "package", "-", "list", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java#L242-L252
5,111
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java
Extern.readPackageList
private void readPackageList(InputStream input, String path, boolean relative) throws IOException { try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) { StringBuilder strbuf = new StringBuilder(); int c; while ((c = in.read()) >= 0) { char ch = (char) c; if (ch == '\n' || ch == '\r') { if (strbuf.length() > 0) { String packname = strbuf.toString(); String packpath = path + packname.replace('.', '/') + '/'; Item ignore = new Item(packname, packpath, relative); strbuf.setLength(0); } } else { strbuf.append(ch); } } } }
java
private void readPackageList(InputStream input, String path, boolean relative) throws IOException { try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) { StringBuilder strbuf = new StringBuilder(); int c; while ((c = in.read()) >= 0) { char ch = (char) c; if (ch == '\n' || ch == '\r') { if (strbuf.length() > 0) { String packname = strbuf.toString(); String packpath = path + packname.replace('.', '/') + '/'; Item ignore = new Item(packname, packpath, relative); strbuf.setLength(0); } } else { strbuf.append(ch); } } } }
[ "private", "void", "readPackageList", "(", "InputStream", "input", ",", "String", "path", ",", "boolean", "relative", ")", "throws", "IOException", "{", "try", "(", "BufferedReader", "in", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "input", ")", ")", ")", "{", "StringBuilder", "strbuf", "=", "new", "StringBuilder", "(", ")", ";", "int", "c", ";", "while", "(", "(", "c", "=", "in", ".", "read", "(", ")", ")", ">=", "0", ")", "{", "char", "ch", "=", "(", "char", ")", "c", ";", "if", "(", "ch", "==", "'", "'", "||", "ch", "==", "'", "'", ")", "{", "if", "(", "strbuf", ".", "length", "(", ")", ">", "0", ")", "{", "String", "packname", "=", "strbuf", ".", "toString", "(", ")", ";", "String", "packpath", "=", "path", "+", "packname", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "'", "'", ";", "Item", "ignore", "=", "new", "Item", "(", "packname", ",", "packpath", ",", "relative", ")", ";", "strbuf", ".", "setLength", "(", "0", ")", ";", "}", "}", "else", "{", "strbuf", ".", "append", "(", "ch", ")", ";", "}", "}", "}", "}" ]
Read the file "package-list" and for each package name found, create Extern object and associate it with the package name in the map. @param input InputStream from the "package-list" file. @param path URL or the directory path to the packages. @param relative Is path relative? @throws IOException if there is a problem reading or closing the stream
[ "Read", "the", "file", "package", "-", "list", "and", "for", "each", "package", "name", "found", "create", "Extern", "object", "and", "associate", "it", "with", "the", "package", "name", "in", "the", "map", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java#L291-L311
5,112
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
TypeEnter.complete
@Override public void complete(Symbol sym) throws CompletionFailure { // Suppress some (recursive) MemberEnter invocations if (!completionEnabled) { // Re-install same completer for next time around and return. Assert.check((sym.flags() & Flags.COMPOUND) == 0); sym.completer = this; return; } try { annotate.blockAnnotations(); sym.flags_field |= UNATTRIBUTED; List<Env<AttrContext>> queue; dependencies.push((ClassSymbol) sym, CompletionCause.MEMBER_ENTER); try { queue = completeClass.completeEnvs(List.of(typeEnvs.get((ClassSymbol) sym))); } finally { dependencies.pop(); } if (!queue.isEmpty()) { Set<JCCompilationUnit> seen = new HashSet<>(); for (Env<AttrContext> env : queue) { if (env.toplevel.defs.contains(env.enclClass) && seen.add(env.toplevel)) { finishImports(env.toplevel, () -> {}); } } } } finally { annotate.unblockAnnotations(); } }
java
@Override public void complete(Symbol sym) throws CompletionFailure { // Suppress some (recursive) MemberEnter invocations if (!completionEnabled) { // Re-install same completer for next time around and return. Assert.check((sym.flags() & Flags.COMPOUND) == 0); sym.completer = this; return; } try { annotate.blockAnnotations(); sym.flags_field |= UNATTRIBUTED; List<Env<AttrContext>> queue; dependencies.push((ClassSymbol) sym, CompletionCause.MEMBER_ENTER); try { queue = completeClass.completeEnvs(List.of(typeEnvs.get((ClassSymbol) sym))); } finally { dependencies.pop(); } if (!queue.isEmpty()) { Set<JCCompilationUnit> seen = new HashSet<>(); for (Env<AttrContext> env : queue) { if (env.toplevel.defs.contains(env.enclClass) && seen.add(env.toplevel)) { finishImports(env.toplevel, () -> {}); } } } } finally { annotate.unblockAnnotations(); } }
[ "@", "Override", "public", "void", "complete", "(", "Symbol", "sym", ")", "throws", "CompletionFailure", "{", "// Suppress some (recursive) MemberEnter invocations", "if", "(", "!", "completionEnabled", ")", "{", "// Re-install same completer for next time around and return.", "Assert", ".", "check", "(", "(", "sym", ".", "flags", "(", ")", "&", "Flags", ".", "COMPOUND", ")", "==", "0", ")", ";", "sym", ".", "completer", "=", "this", ";", "return", ";", "}", "try", "{", "annotate", ".", "blockAnnotations", "(", ")", ";", "sym", ".", "flags_field", "|=", "UNATTRIBUTED", ";", "List", "<", "Env", "<", "AttrContext", ">", ">", "queue", ";", "dependencies", ".", "push", "(", "(", "ClassSymbol", ")", "sym", ",", "CompletionCause", ".", "MEMBER_ENTER", ")", ";", "try", "{", "queue", "=", "completeClass", ".", "completeEnvs", "(", "List", ".", "of", "(", "typeEnvs", ".", "get", "(", "(", "ClassSymbol", ")", "sym", ")", ")", ")", ";", "}", "finally", "{", "dependencies", ".", "pop", "(", ")", ";", "}", "if", "(", "!", "queue", ".", "isEmpty", "(", ")", ")", "{", "Set", "<", "JCCompilationUnit", ">", "seen", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "Env", "<", "AttrContext", ">", "env", ":", "queue", ")", "{", "if", "(", "env", ".", "toplevel", ".", "defs", ".", "contains", "(", "env", ".", "enclClass", ")", "&&", "seen", ".", "add", "(", "env", ".", "toplevel", ")", ")", "{", "finishImports", "(", "env", ".", "toplevel", ",", "(", ")", "->", "{", "}", ")", ";", "}", "}", "}", "}", "finally", "{", "annotate", ".", "unblockAnnotations", "(", ")", ";", "}", "}" ]
Complete entering a class. @param sym The symbol of the class to be completed.
[ "Complete", "entering", "a", "class", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java#L177-L212
5,113
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
TypeEnter.markDeprecated
public void markDeprecated(Symbol sym, List<JCAnnotation> annotations, Env<AttrContext> env) { // In general, we cannot fully process annotations yet, but we // can attribute the annotation types and then check to see if the // @Deprecated annotation is present. attr.attribAnnotationTypes(annotations, env); handleDeprecatedAnnotations(annotations, sym); }
java
public void markDeprecated(Symbol sym, List<JCAnnotation> annotations, Env<AttrContext> env) { // In general, we cannot fully process annotations yet, but we // can attribute the annotation types and then check to see if the // @Deprecated annotation is present. attr.attribAnnotationTypes(annotations, env); handleDeprecatedAnnotations(annotations, sym); }
[ "public", "void", "markDeprecated", "(", "Symbol", "sym", ",", "List", "<", "JCAnnotation", ">", "annotations", ",", "Env", "<", "AttrContext", ">", "env", ")", "{", "// In general, we cannot fully process annotations yet, but we", "// can attribute the annotation types and then check to see if the", "// @Deprecated annotation is present.", "attr", ".", "attribAnnotationTypes", "(", "annotations", ",", "env", ")", ";", "handleDeprecatedAnnotations", "(", "annotations", ",", "sym", ")", ";", "}" ]
Mark sym deprecated if annotations contain @Deprecated annotation.
[ "Mark", "sym", "deprecated", "if", "annotations", "contain" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java#L1121-L1127
5,114
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
TypeEnter.handleDeprecatedAnnotations
private void handleDeprecatedAnnotations(List<JCAnnotation> annotations, Symbol sym) { for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) { JCAnnotation a = al.head; if (a.annotationType.type == syms.deprecatedType) { sym.flags_field |= (Flags.DEPRECATED | Flags.DEPRECATED_ANNOTATION); a.args.stream() .filter(e -> e.hasTag(ASSIGN)) .map(e -> (JCAssign) e) .filter(assign -> TreeInfo.name(assign.lhs) == names.forRemoval) .findFirst() .ifPresent(assign -> { JCExpression rhs = TreeInfo.skipParens(assign.rhs); if (rhs.hasTag(LITERAL) && Boolean.TRUE.equals(((JCLiteral) rhs).getValue())) { sym.flags_field |= DEPRECATED_REMOVAL; } }); } } }
java
private void handleDeprecatedAnnotations(List<JCAnnotation> annotations, Symbol sym) { for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) { JCAnnotation a = al.head; if (a.annotationType.type == syms.deprecatedType) { sym.flags_field |= (Flags.DEPRECATED | Flags.DEPRECATED_ANNOTATION); a.args.stream() .filter(e -> e.hasTag(ASSIGN)) .map(e -> (JCAssign) e) .filter(assign -> TreeInfo.name(assign.lhs) == names.forRemoval) .findFirst() .ifPresent(assign -> { JCExpression rhs = TreeInfo.skipParens(assign.rhs); if (rhs.hasTag(LITERAL) && Boolean.TRUE.equals(((JCLiteral) rhs).getValue())) { sym.flags_field |= DEPRECATED_REMOVAL; } }); } } }
[ "private", "void", "handleDeprecatedAnnotations", "(", "List", "<", "JCAnnotation", ">", "annotations", ",", "Symbol", "sym", ")", "{", "for", "(", "List", "<", "JCAnnotation", ">", "al", "=", "annotations", ";", "!", "al", ".", "isEmpty", "(", ")", ";", "al", "=", "al", ".", "tail", ")", "{", "JCAnnotation", "a", "=", "al", ".", "head", ";", "if", "(", "a", ".", "annotationType", ".", "type", "==", "syms", ".", "deprecatedType", ")", "{", "sym", ".", "flags_field", "|=", "(", "Flags", ".", "DEPRECATED", "|", "Flags", ".", "DEPRECATED_ANNOTATION", ")", ";", "a", ".", "args", ".", "stream", "(", ")", ".", "filter", "(", "e", "->", "e", ".", "hasTag", "(", "ASSIGN", ")", ")", ".", "map", "(", "e", "->", "(", "JCAssign", ")", "e", ")", ".", "filter", "(", "assign", "->", "TreeInfo", ".", "name", "(", "assign", ".", "lhs", ")", "==", "names", ".", "forRemoval", ")", ".", "findFirst", "(", ")", ".", "ifPresent", "(", "assign", "->", "{", "JCExpression", "rhs", "=", "TreeInfo", ".", "skipParens", "(", "assign", ".", "rhs", ")", ";", "if", "(", "rhs", ".", "hasTag", "(", "LITERAL", ")", "&&", "Boolean", ".", "TRUE", ".", "equals", "(", "(", "(", "JCLiteral", ")", "rhs", ")", ".", "getValue", "(", ")", ")", ")", "{", "sym", ".", "flags_field", "|=", "DEPRECATED_REMOVAL", ";", "}", "}", ")", ";", "}", "}", "}" ]
If a list of annotations contains a reference to java.lang.Deprecated, set the DEPRECATED flag. If the annotation is marked forRemoval=true, also set DEPRECATED_REMOVAL.
[ "If", "a", "list", "of", "annotations", "contains", "a", "reference", "to", "java", ".", "lang", ".", "Deprecated", "set", "the", "DEPRECATED", "flag", ".", "If", "the", "annotation", "is", "marked", "forRemoval", "=", "true", "also", "set", "DEPRECATED_REMOVAL", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java#L1134-L1153
5,115
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java
ClassFileReader.newInstance
public static ClassFileReader newInstance(FileSystem fs, Path path) throws IOException { return new DirectoryReader(fs, path); }
java
public static ClassFileReader newInstance(FileSystem fs, Path path) throws IOException { return new DirectoryReader(fs, path); }
[ "public", "static", "ClassFileReader", "newInstance", "(", "FileSystem", "fs", ",", "Path", "path", ")", "throws", "IOException", "{", "return", "new", "DirectoryReader", "(", "fs", ",", "path", ")", ";", "}" ]
Returns a ClassFileReader instance of a given FileSystem and path. This method is used for reading classes from jrtfs.
[ "Returns", "a", "ClassFileReader", "instance", "of", "a", "given", "FileSystem", "and", "path", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java#L92-L94
5,116
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java
ClassFileReader.entries
public Set<String> entries() { Set<String> es = this.entries; if (es == null) { // lazily scan the entries this.entries = scan(); } return this.entries; }
java
public Set<String> entries() { Set<String> es = this.entries; if (es == null) { // lazily scan the entries this.entries = scan(); } return this.entries; }
[ "public", "Set", "<", "String", ">", "entries", "(", ")", "{", "Set", "<", "String", ">", "es", "=", "this", ".", "entries", ";", "if", "(", "es", "==", "null", ")", "{", "// lazily scan the entries", "this", ".", "entries", "=", "scan", "(", ")", ";", "}", "return", "this", ".", "entries", ";", "}" ]
Returns all entries in this archive.
[ "Returns", "all", "entries", "in", "this", "archive", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java#L119-L126
5,117
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java
ClassFileReader.getClassFile
public ClassFile getClassFile(String name) throws IOException { if (name.indexOf('.') > 0) { int i = name.lastIndexOf('.'); String pathname = name.replace('.', File.separatorChar) + ".class"; if (baseFileName.equals(pathname) || baseFileName.equals(pathname.substring(0, i) + "$" + pathname.substring(i+1, pathname.length()))) { return readClassFile(path); } } else { if (baseFileName.equals(name.replace('/', File.separatorChar) + ".class")) { return readClassFile(path); } } return null; }
java
public ClassFile getClassFile(String name) throws IOException { if (name.indexOf('.') > 0) { int i = name.lastIndexOf('.'); String pathname = name.replace('.', File.separatorChar) + ".class"; if (baseFileName.equals(pathname) || baseFileName.equals(pathname.substring(0, i) + "$" + pathname.substring(i+1, pathname.length()))) { return readClassFile(path); } } else { if (baseFileName.equals(name.replace('/', File.separatorChar) + ".class")) { return readClassFile(path); } } return null; }
[ "public", "ClassFile", "getClassFile", "(", "String", "name", ")", "throws", "IOException", "{", "if", "(", "name", ".", "indexOf", "(", "'", "'", ")", ">", "0", ")", "{", "int", "i", "=", "name", ".", "lastIndexOf", "(", "'", "'", ")", ";", "String", "pathname", "=", "name", ".", "replace", "(", "'", "'", ",", "File", ".", "separatorChar", ")", "+", "\".class\"", ";", "if", "(", "baseFileName", ".", "equals", "(", "pathname", ")", "||", "baseFileName", ".", "equals", "(", "pathname", ".", "substring", "(", "0", ",", "i", ")", "+", "\"$\"", "+", "pathname", ".", "substring", "(", "i", "+", "1", ",", "pathname", ".", "length", "(", ")", ")", ")", ")", "{", "return", "readClassFile", "(", "path", ")", ";", "}", "}", "else", "{", "if", "(", "baseFileName", ".", "equals", "(", "name", ".", "replace", "(", "'", "'", ",", "File", ".", "separatorChar", ")", "+", "\".class\"", ")", ")", "{", "return", "readClassFile", "(", "path", ")", ";", "}", "}", "return", "null", ";", "}" ]
Returns the ClassFile matching the given binary name or a fully-qualified class name.
[ "Returns", "the", "ClassFile", "matching", "the", "given", "binary", "name", "or", "a", "fully", "-", "qualified", "class", "name", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java#L132-L147
5,118
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsFilter.java
JdepsFilter.matches
public boolean matches(String cn) { if (includePattern == null) return true; if (includePattern != null) return includePattern.matcher(cn).matches(); return false; }
java
public boolean matches(String cn) { if (includePattern == null) return true; if (includePattern != null) return includePattern.matcher(cn).matches(); return false; }
[ "public", "boolean", "matches", "(", "String", "cn", ")", "{", "if", "(", "includePattern", "==", "null", ")", "return", "true", ";", "if", "(", "includePattern", "!=", "null", ")", "return", "includePattern", ".", "matcher", "(", "cn", ")", ".", "matches", "(", ")", ";", "return", "false", ";", "}" ]
Tests if the given class matches the pattern given in the -include option @param cn fully-qualified name
[ "Tests", "if", "the", "given", "class", "matches", "the", "pattern", "given", "in", "the", "-", "include", "option" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsFilter.java#L83-L91
5,119
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsFilter.java
JdepsFilter.matches
public boolean matches(Archive source) { if (includePattern != null) { return source.reader().entries().stream() .map(name -> name.replace('/', '.')) .filter(name -> !name.equals("module-info.class")) .anyMatch(this::matches); } return hasTargetFilter(); }
java
public boolean matches(Archive source) { if (includePattern != null) { return source.reader().entries().stream() .map(name -> name.replace('/', '.')) .filter(name -> !name.equals("module-info.class")) .anyMatch(this::matches); } return hasTargetFilter(); }
[ "public", "boolean", "matches", "(", "Archive", "source", ")", "{", "if", "(", "includePattern", "!=", "null", ")", "{", "return", "source", ".", "reader", "(", ")", ".", "entries", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "name", "->", "name", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ")", ".", "filter", "(", "name", "->", "!", "name", ".", "equals", "(", "\"module-info.class\"", ")", ")", ".", "anyMatch", "(", "this", "::", "matches", ")", ";", "}", "return", "hasTargetFilter", "(", ")", ";", "}" ]
Tests if the given source includes classes specified in -include option This method can be used to determine if the given source should eagerly be processed.
[ "Tests", "if", "the", "given", "source", "includes", "classes", "specified", "in", "-", "include", "option" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsFilter.java#L99-L107
5,120
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsFilter.java
JdepsFilter.accepts
@Override public boolean accepts(Location origin, Archive originArchive, Location target, Archive targetArchive) { if (findJDKInternals) { // accepts target that is JDK class but not exported Module module = targetArchive.getModule(); return originArchive != targetArchive && isJDKInternalPackage(module, target.getPackageName()); } else if (filterSameArchive) { // accepts origin and target that from different archive return originArchive != targetArchive; } return true; }
java
@Override public boolean accepts(Location origin, Archive originArchive, Location target, Archive targetArchive) { if (findJDKInternals) { // accepts target that is JDK class but not exported Module module = targetArchive.getModule(); return originArchive != targetArchive && isJDKInternalPackage(module, target.getPackageName()); } else if (filterSameArchive) { // accepts origin and target that from different archive return originArchive != targetArchive; } return true; }
[ "@", "Override", "public", "boolean", "accepts", "(", "Location", "origin", ",", "Archive", "originArchive", ",", "Location", "target", ",", "Archive", "targetArchive", ")", "{", "if", "(", "findJDKInternals", ")", "{", "// accepts target that is JDK class but not exported", "Module", "module", "=", "targetArchive", ".", "getModule", "(", ")", ";", "return", "originArchive", "!=", "targetArchive", "&&", "isJDKInternalPackage", "(", "module", ",", "target", ".", "getPackageName", "(", ")", ")", ";", "}", "else", "if", "(", "filterSameArchive", ")", "{", "// accepts origin and target that from different archive", "return", "originArchive", "!=", "targetArchive", ";", "}", "return", "true", ";", "}" ]
Filter depending on the containing archive or module
[ "Filter", "depending", "on", "the", "containing", "archive", "or", "module" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsFilter.java#L148-L161
5,121
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsFilter.java
JdepsFilter.isJDKInternalPackage
public boolean isJDKInternalPackage(Module module, String pn) { if (module.isJDKUnsupported()) { // its exported APIs are unsupported return true; } return module.isJDK() && !module.isExported(pn); }
java
public boolean isJDKInternalPackage(Module module, String pn) { if (module.isJDKUnsupported()) { // its exported APIs are unsupported return true; } return module.isJDK() && !module.isExported(pn); }
[ "public", "boolean", "isJDKInternalPackage", "(", "Module", "module", ",", "String", "pn", ")", "{", "if", "(", "module", ".", "isJDKUnsupported", "(", ")", ")", "{", "// its exported APIs are unsupported", "return", "true", ";", "}", "return", "module", ".", "isJDK", "(", ")", "&&", "!", "module", ".", "isExported", "(", "pn", ")", ";", "}" ]
Tests if the package is an internal package of the given module.
[ "Tests", "if", "the", "package", "is", "an", "internal", "package", "of", "the", "given", "module", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsFilter.java#L166-L173
5,122
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java
DepsAnalyzer.run
public boolean run(boolean compileTimeView, int maxDepth) throws IOException { try { // parse each packaged module or classpath archive if (apiOnly) { finder.parseExportedAPIs(rootArchives.stream()); } else { finder.parse(rootArchives.stream()); } archives.addAll(rootArchives); int depth = maxDepth > 0 ? maxDepth : Integer.MAX_VALUE; // transitive analysis if (depth > 1) { if (compileTimeView) transitiveArchiveDeps(depth-1); else transitiveDeps(depth-1); } Set<Archive> archives = archives(); // analyze the dependencies collected analyzer.run(archives, finder.locationToArchive()); if (writer != null) { writer.generateOutput(archives, analyzer); } } finally { finder.shutdown(); } return true; }
java
public boolean run(boolean compileTimeView, int maxDepth) throws IOException { try { // parse each packaged module or classpath archive if (apiOnly) { finder.parseExportedAPIs(rootArchives.stream()); } else { finder.parse(rootArchives.stream()); } archives.addAll(rootArchives); int depth = maxDepth > 0 ? maxDepth : Integer.MAX_VALUE; // transitive analysis if (depth > 1) { if (compileTimeView) transitiveArchiveDeps(depth-1); else transitiveDeps(depth-1); } Set<Archive> archives = archives(); // analyze the dependencies collected analyzer.run(archives, finder.locationToArchive()); if (writer != null) { writer.generateOutput(archives, analyzer); } } finally { finder.shutdown(); } return true; }
[ "public", "boolean", "run", "(", "boolean", "compileTimeView", ",", "int", "maxDepth", ")", "throws", "IOException", "{", "try", "{", "// parse each packaged module or classpath archive", "if", "(", "apiOnly", ")", "{", "finder", ".", "parseExportedAPIs", "(", "rootArchives", ".", "stream", "(", ")", ")", ";", "}", "else", "{", "finder", ".", "parse", "(", "rootArchives", ".", "stream", "(", ")", ")", ";", "}", "archives", ".", "addAll", "(", "rootArchives", ")", ";", "int", "depth", "=", "maxDepth", ">", "0", "?", "maxDepth", ":", "Integer", ".", "MAX_VALUE", ";", "// transitive analysis", "if", "(", "depth", ">", "1", ")", "{", "if", "(", "compileTimeView", ")", "transitiveArchiveDeps", "(", "depth", "-", "1", ")", ";", "else", "transitiveDeps", "(", "depth", "-", "1", ")", ";", "}", "Set", "<", "Archive", ">", "archives", "=", "archives", "(", ")", ";", "// analyze the dependencies collected", "analyzer", ".", "run", "(", "archives", ",", "finder", ".", "locationToArchive", "(", ")", ")", ";", "if", "(", "writer", "!=", "null", ")", "{", "writer", ".", "generateOutput", "(", "archives", ",", "analyzer", ")", ";", "}", "}", "finally", "{", "finder", ".", "shutdown", "(", ")", ";", "}", "return", "true", ";", "}" ]
Perform compile-time view or run-time view dependency analysis. @param compileTimeView @param maxDepth depth of recursive analysis. depth == 0 if -R is set
[ "Perform", "compile", "-", "time", "view", "or", "run", "-", "time", "view", "dependency", "analysis", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java#L123-L155
5,123
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java
DepsAnalyzer.archives
Set<Archive> archives() { if (filter.requiresFilter().isEmpty()) { return archives.stream() .filter(this::include) .filter(Archive::hasDependences) .collect(Collectors.toSet()); } else { // use the archives that have dependences and not specified in --require return archives.stream() .filter(this::include) .filter(source -> !filter.requiresFilter().contains(source.getName())) .filter(source -> source.getDependencies() .map(finder::locationToArchive) .anyMatch(a -> a != source)) .collect(Collectors.toSet()); } }
java
Set<Archive> archives() { if (filter.requiresFilter().isEmpty()) { return archives.stream() .filter(this::include) .filter(Archive::hasDependences) .collect(Collectors.toSet()); } else { // use the archives that have dependences and not specified in --require return archives.stream() .filter(this::include) .filter(source -> !filter.requiresFilter().contains(source.getName())) .filter(source -> source.getDependencies() .map(finder::locationToArchive) .anyMatch(a -> a != source)) .collect(Collectors.toSet()); } }
[ "Set", "<", "Archive", ">", "archives", "(", ")", "{", "if", "(", "filter", ".", "requiresFilter", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "return", "archives", ".", "stream", "(", ")", ".", "filter", "(", "this", "::", "include", ")", ".", "filter", "(", "Archive", "::", "hasDependences", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ";", "}", "else", "{", "// use the archives that have dependences and not specified in --require", "return", "archives", ".", "stream", "(", ")", ".", "filter", "(", "this", "::", "include", ")", ".", "filter", "(", "source", "->", "!", "filter", ".", "requiresFilter", "(", ")", ".", "contains", "(", "source", ".", "getName", "(", ")", ")", ")", ".", "filter", "(", "source", "->", "source", ".", "getDependencies", "(", ")", ".", "map", "(", "finder", "::", "locationToArchive", ")", ".", "anyMatch", "(", "a", "->", "a", "!=", "source", ")", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ";", "}", "}" ]
Returns the archives for reporting that has matching dependences. If --require is set, they should be excluded.
[ "Returns", "the", "archives", "for", "reporting", "that", "has", "matching", "dependences", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java#L162-L179
5,124
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java
DepsAnalyzer.dependences
Set<String> dependences() { return analyzer.archives().stream() .map(analyzer::dependences) .flatMap(Set::stream) .collect(Collectors.toSet()); }
java
Set<String> dependences() { return analyzer.archives().stream() .map(analyzer::dependences) .flatMap(Set::stream) .collect(Collectors.toSet()); }
[ "Set", "<", "String", ">", "dependences", "(", ")", "{", "return", "analyzer", ".", "archives", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "analyzer", "::", "dependences", ")", ".", "flatMap", "(", "Set", "::", "stream", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ";", "}" ]
Returns the dependences, either class name or package name as specified in the given verbose level.
[ "Returns", "the", "dependences", "either", "class", "name", "or", "package", "name", "as", "specified", "in", "the", "given", "verbose", "level", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java#L185-L190
5,125
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java
DepsAnalyzer.unresolvedArchives
private Set<Archive> unresolvedArchives(Stream<Location> locations) { return locations.filter(l -> !finder.isParsed(l)) .distinct() .map(configuration::findClass) .flatMap(Optional::stream) .collect(toSet()); }
java
private Set<Archive> unresolvedArchives(Stream<Location> locations) { return locations.filter(l -> !finder.isParsed(l)) .distinct() .map(configuration::findClass) .flatMap(Optional::stream) .collect(toSet()); }
[ "private", "Set", "<", "Archive", ">", "unresolvedArchives", "(", "Stream", "<", "Location", ">", "locations", ")", "{", "return", "locations", ".", "filter", "(", "l", "->", "!", "finder", ".", "isParsed", "(", "l", ")", ")", ".", "distinct", "(", ")", ".", "map", "(", "configuration", "::", "findClass", ")", ".", "flatMap", "(", "Optional", "::", "stream", ")", ".", "collect", "(", "toSet", "(", ")", ")", ";", "}" ]
Returns the archives that contains the given locations and not parsed and analyzed.
[ "Returns", "the", "archives", "that", "contains", "the", "given", "locations", "and", "not", "parsed", "and", "analyzed", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java#L196-L202
5,126
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java
DepsAnalyzer.moduleGraph
public Graph<Node> moduleGraph() { Graph.Builder<Node> builder = new Graph.Builder<>(); archives().stream() .forEach(m -> { Node u = new Node(m.getName(), Info.REQUIRES); builder.addNode(u); analyzer.requires(m) .map(req -> new Node(req.getName(), Info.REQUIRES)) .forEach(v -> builder.addEdge(u, v)); }); return builder.build(); }
java
public Graph<Node> moduleGraph() { Graph.Builder<Node> builder = new Graph.Builder<>(); archives().stream() .forEach(m -> { Node u = new Node(m.getName(), Info.REQUIRES); builder.addNode(u); analyzer.requires(m) .map(req -> new Node(req.getName(), Info.REQUIRES)) .forEach(v -> builder.addEdge(u, v)); }); return builder.build(); }
[ "public", "Graph", "<", "Node", ">", "moduleGraph", "(", ")", "{", "Graph", ".", "Builder", "<", "Node", ">", "builder", "=", "new", "Graph", ".", "Builder", "<>", "(", ")", ";", "archives", "(", ")", ".", "stream", "(", ")", ".", "forEach", "(", "m", "->", "{", "Node", "u", "=", "new", "Node", "(", "m", ".", "getName", "(", ")", ",", "Info", ".", "REQUIRES", ")", ";", "builder", ".", "addNode", "(", "u", ")", ";", "analyzer", ".", "requires", "(", "m", ")", ".", "map", "(", "req", "->", "new", "Node", "(", "req", ".", "getName", "(", ")", ",", "Info", ".", "REQUIRES", ")", ")", ".", "forEach", "(", "v", "->", "builder", ".", "addEdge", "(", "u", ",", "v", ")", ")", ";", "}", ")", ";", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Returns a graph of module dependences. Each Node represents a module and each edge is a dependence. No analysis on "requires transitive".
[ "Returns", "a", "graph", "of", "module", "dependences", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java#L343-L355
5,127
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java
DepsAnalyzer.dependenceGraph
public Graph<Node> dependenceGraph() { Graph.Builder<Node> builder = new Graph.Builder<>(); archives().stream() .map(analyzer.results::get) .filter(deps -> !deps.dependencies().isEmpty()) .flatMap(deps -> deps.dependencies().stream()) .forEach(d -> addEdge(builder, d)); return builder.build(); }
java
public Graph<Node> dependenceGraph() { Graph.Builder<Node> builder = new Graph.Builder<>(); archives().stream() .map(analyzer.results::get) .filter(deps -> !deps.dependencies().isEmpty()) .flatMap(deps -> deps.dependencies().stream()) .forEach(d -> addEdge(builder, d)); return builder.build(); }
[ "public", "Graph", "<", "Node", ">", "dependenceGraph", "(", ")", "{", "Graph", ".", "Builder", "<", "Node", ">", "builder", "=", "new", "Graph", ".", "Builder", "<>", "(", ")", ";", "archives", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "analyzer", ".", "results", "::", "get", ")", ".", "filter", "(", "deps", "->", "!", "deps", ".", "dependencies", "(", ")", ".", "isEmpty", "(", ")", ")", ".", "flatMap", "(", "deps", "->", "deps", ".", "dependencies", "(", ")", ".", "stream", "(", ")", ")", ".", "forEach", "(", "d", "->", "addEdge", "(", "builder", ",", "d", ")", ")", ";", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Returns a graph of dependences. Each Node represents a class or package per the specified verbose level. Each edge indicates
[ "Returns", "a", "graph", "of", "dependences", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java#L363-L372
5,128
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
AnnotationTypeWriterImpl.getNavLinkClassUse
protected Content getNavLinkClassUse() { Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), useLabel); Content li = HtmlTree.LI(linkContent); return li; }
java
protected Content getNavLinkClassUse() { Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), useLabel); Content li = HtmlTree.LI(linkContent); return li; }
[ "protected", "Content", "getNavLinkClassUse", "(", ")", "{", "Content", "linkContent", "=", "getHyperLink", "(", "DocPaths", ".", "CLASS_USE", ".", "resolve", "(", "filename", ")", ",", "useLabel", ")", ";", "Content", "li", "=", "HtmlTree", ".", "LI", "(", "linkContent", ")", ";", "return", "li", ";", "}" ]
Get the class use link. @return a content tree for the class use link
[ "Get", "the", "class", "use", "link", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java#L106-L110
5,129
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java
DeprecatedAPIListBuilder.buildDeprecatedAPIInfo
private void buildDeprecatedAPIInfo() { SortedSet<Element> rset = deprecatedMap.get(DeprElementKind.REMOVAL); SortedSet<ModuleElement> modules = configuration.modules; SortedSet<Element> mset = deprecatedMap.get(DeprElementKind.MODULE); for (Element me : modules) { if (utils.isDeprecatedForRemoval(me)) { rset.add(me); } if (utils.isDeprecated(me)) { mset.add(me); } } SortedSet<PackageElement> packages = configuration.packages; SortedSet<Element> pset = deprecatedMap.get(DeprElementKind.PACKAGE); for (Element pe : packages) { if (utils.isDeprecatedForRemoval(pe)) { rset.add(pe); } if (utils.isDeprecated(pe)) { pset.add(pe); } } for (Element e : configuration.getIncludedTypeElements()) { TypeElement te = (TypeElement)e; SortedSet<Element> eset; if (utils.isDeprecatedForRemoval(e)) { rset.add(e); } if (utils.isDeprecated(e)) { switch (e.getKind()) { case ANNOTATION_TYPE: eset = deprecatedMap.get(DeprElementKind.ANNOTATION_TYPE); eset.add(e); break; case CLASS: if (utils.isError(te)) { eset = deprecatedMap.get(DeprElementKind.ERROR); } else if (utils.isException(te)) { eset = deprecatedMap.get(DeprElementKind.EXCEPTION); } else { eset = deprecatedMap.get(DeprElementKind.CLASS); } eset.add(e); break; case INTERFACE: eset = deprecatedMap.get(DeprElementKind.INTERFACE); eset.add(e); break; case ENUM: eset = deprecatedMap.get(DeprElementKind.ENUM); eset.add(e); break; } } composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.FIELD), utils.getFields(te)); composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.METHOD), utils.getMethods(te)); composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.CONSTRUCTOR), utils.getConstructors(te)); if (utils.isEnum(e)) { composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.ENUM_CONSTANT), utils.getEnumConstants(te)); } if (utils.isAnnotationType(e)) { composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.ANNOTATION_TYPE_MEMBER), utils.getAnnotationMembers(te)); } } }
java
private void buildDeprecatedAPIInfo() { SortedSet<Element> rset = deprecatedMap.get(DeprElementKind.REMOVAL); SortedSet<ModuleElement> modules = configuration.modules; SortedSet<Element> mset = deprecatedMap.get(DeprElementKind.MODULE); for (Element me : modules) { if (utils.isDeprecatedForRemoval(me)) { rset.add(me); } if (utils.isDeprecated(me)) { mset.add(me); } } SortedSet<PackageElement> packages = configuration.packages; SortedSet<Element> pset = deprecatedMap.get(DeprElementKind.PACKAGE); for (Element pe : packages) { if (utils.isDeprecatedForRemoval(pe)) { rset.add(pe); } if (utils.isDeprecated(pe)) { pset.add(pe); } } for (Element e : configuration.getIncludedTypeElements()) { TypeElement te = (TypeElement)e; SortedSet<Element> eset; if (utils.isDeprecatedForRemoval(e)) { rset.add(e); } if (utils.isDeprecated(e)) { switch (e.getKind()) { case ANNOTATION_TYPE: eset = deprecatedMap.get(DeprElementKind.ANNOTATION_TYPE); eset.add(e); break; case CLASS: if (utils.isError(te)) { eset = deprecatedMap.get(DeprElementKind.ERROR); } else if (utils.isException(te)) { eset = deprecatedMap.get(DeprElementKind.EXCEPTION); } else { eset = deprecatedMap.get(DeprElementKind.CLASS); } eset.add(e); break; case INTERFACE: eset = deprecatedMap.get(DeprElementKind.INTERFACE); eset.add(e); break; case ENUM: eset = deprecatedMap.get(DeprElementKind.ENUM); eset.add(e); break; } } composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.FIELD), utils.getFields(te)); composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.METHOD), utils.getMethods(te)); composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.CONSTRUCTOR), utils.getConstructors(te)); if (utils.isEnum(e)) { composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.ENUM_CONSTANT), utils.getEnumConstants(te)); } if (utils.isAnnotationType(e)) { composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.ANNOTATION_TYPE_MEMBER), utils.getAnnotationMembers(te)); } } }
[ "private", "void", "buildDeprecatedAPIInfo", "(", ")", "{", "SortedSet", "<", "Element", ">", "rset", "=", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "REMOVAL", ")", ";", "SortedSet", "<", "ModuleElement", ">", "modules", "=", "configuration", ".", "modules", ";", "SortedSet", "<", "Element", ">", "mset", "=", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "MODULE", ")", ";", "for", "(", "Element", "me", ":", "modules", ")", "{", "if", "(", "utils", ".", "isDeprecatedForRemoval", "(", "me", ")", ")", "{", "rset", ".", "add", "(", "me", ")", ";", "}", "if", "(", "utils", ".", "isDeprecated", "(", "me", ")", ")", "{", "mset", ".", "add", "(", "me", ")", ";", "}", "}", "SortedSet", "<", "PackageElement", ">", "packages", "=", "configuration", ".", "packages", ";", "SortedSet", "<", "Element", ">", "pset", "=", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "PACKAGE", ")", ";", "for", "(", "Element", "pe", ":", "packages", ")", "{", "if", "(", "utils", ".", "isDeprecatedForRemoval", "(", "pe", ")", ")", "{", "rset", ".", "add", "(", "pe", ")", ";", "}", "if", "(", "utils", ".", "isDeprecated", "(", "pe", ")", ")", "{", "pset", ".", "add", "(", "pe", ")", ";", "}", "}", "for", "(", "Element", "e", ":", "configuration", ".", "getIncludedTypeElements", "(", ")", ")", "{", "TypeElement", "te", "=", "(", "TypeElement", ")", "e", ";", "SortedSet", "<", "Element", ">", "eset", ";", "if", "(", "utils", ".", "isDeprecatedForRemoval", "(", "e", ")", ")", "{", "rset", ".", "add", "(", "e", ")", ";", "}", "if", "(", "utils", ".", "isDeprecated", "(", "e", ")", ")", "{", "switch", "(", "e", ".", "getKind", "(", ")", ")", "{", "case", "ANNOTATION_TYPE", ":", "eset", "=", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "ANNOTATION_TYPE", ")", ";", "eset", ".", "add", "(", "e", ")", ";", "break", ";", "case", "CLASS", ":", "if", "(", "utils", ".", "isError", "(", "te", ")", ")", "{", "eset", "=", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "ERROR", ")", ";", "}", "else", "if", "(", "utils", ".", "isException", "(", "te", ")", ")", "{", "eset", "=", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "EXCEPTION", ")", ";", "}", "else", "{", "eset", "=", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "CLASS", ")", ";", "}", "eset", ".", "add", "(", "e", ")", ";", "break", ";", "case", "INTERFACE", ":", "eset", "=", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "INTERFACE", ")", ";", "eset", ".", "add", "(", "e", ")", ";", "break", ";", "case", "ENUM", ":", "eset", "=", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "ENUM", ")", ";", "eset", ".", "add", "(", "e", ")", ";", "break", ";", "}", "}", "composeDeprecatedList", "(", "rset", ",", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "FIELD", ")", ",", "utils", ".", "getFields", "(", "te", ")", ")", ";", "composeDeprecatedList", "(", "rset", ",", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "METHOD", ")", ",", "utils", ".", "getMethods", "(", "te", ")", ")", ";", "composeDeprecatedList", "(", "rset", ",", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "CONSTRUCTOR", ")", ",", "utils", ".", "getConstructors", "(", "te", ")", ")", ";", "if", "(", "utils", ".", "isEnum", "(", "e", ")", ")", "{", "composeDeprecatedList", "(", "rset", ",", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "ENUM_CONSTANT", ")", ",", "utils", ".", "getEnumConstants", "(", "te", ")", ")", ";", "}", "if", "(", "utils", ".", "isAnnotationType", "(", "e", ")", ")", "{", "composeDeprecatedList", "(", "rset", ",", "deprecatedMap", ".", "get", "(", "DeprElementKind", ".", "ANNOTATION_TYPE_MEMBER", ")", ",", "utils", ".", "getAnnotationMembers", "(", "te", ")", ")", ";", "}", "}", "}" ]
Build the sorted list of all the deprecated APIs in this run. Build separate lists for deprecated modules, packages, classes, constructors, methods and fields. @param configuration the current configuration of the doclet.
[ "Build", "the", "sorted", "list", "of", "all", "the", "deprecated", "APIs", "in", "this", "run", ".", "Build", "separate", "lists", "for", "deprecated", "modules", "packages", "classes", "constructors", "methods", "and", "fields", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java#L93-L163
5,130
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
ClassWriterImpl.getNavLinkPrevious
public Content getNavLinkPrevious() { Content li; if (prev != null) { Content prevLink = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS, prev) .label(prevclassLabel).strong(true)); li = HtmlTree.LI(prevLink); } else li = HtmlTree.LI(prevclassLabel); return li; }
java
public Content getNavLinkPrevious() { Content li; if (prev != null) { Content prevLink = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS, prev) .label(prevclassLabel).strong(true)); li = HtmlTree.LI(prevLink); } else li = HtmlTree.LI(prevclassLabel); return li; }
[ "public", "Content", "getNavLinkPrevious", "(", ")", "{", "Content", "li", ";", "if", "(", "prev", "!=", "null", ")", "{", "Content", "prevLink", "=", "getLink", "(", "new", "LinkInfoImpl", "(", "configuration", ",", "LinkInfoImpl", ".", "Kind", ".", "CLASS", ",", "prev", ")", ".", "label", "(", "prevclassLabel", ")", ".", "strong", "(", "true", ")", ")", ";", "li", "=", "HtmlTree", ".", "LI", "(", "prevLink", ")", ";", "}", "else", "li", "=", "HtmlTree", ".", "LI", "(", "prevclassLabel", ")", ";", "return", "li", ";", "}" ]
Get link to previous class. @return a content tree for the previous class link
[ "Get", "link", "to", "previous", "class", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java#L126-L137
5,131
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
ClassWriterImpl.getNavLinkNext
public Content getNavLinkNext() { Content li; if (next != null) { Content nextLink = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS, next) .label(nextclassLabel).strong(true)); li = HtmlTree.LI(nextLink); } else li = HtmlTree.LI(nextclassLabel); return li; }
java
public Content getNavLinkNext() { Content li; if (next != null) { Content nextLink = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS, next) .label(nextclassLabel).strong(true)); li = HtmlTree.LI(nextLink); } else li = HtmlTree.LI(nextclassLabel); return li; }
[ "public", "Content", "getNavLinkNext", "(", ")", "{", "Content", "li", ";", "if", "(", "next", "!=", "null", ")", "{", "Content", "nextLink", "=", "getLink", "(", "new", "LinkInfoImpl", "(", "configuration", ",", "LinkInfoImpl", ".", "Kind", ".", "CLASS", ",", "next", ")", ".", "label", "(", "nextclassLabel", ")", ".", "strong", "(", "true", ")", ")", ";", "li", "=", "HtmlTree", ".", "LI", "(", "nextLink", ")", ";", "}", "else", "li", "=", "HtmlTree", ".", "LI", "(", "nextclassLabel", ")", ";", "return", "li", ";", "}" ]
Get link to next class. @return a content tree for the next class link
[ "Get", "link", "to", "next", "class", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java#L144-L155
5,132
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
ClassWriterImpl.getClassInheritenceTree
private Content getClassInheritenceTree(Type type) { Type sup; HtmlTree classTreeUl = new HtmlTree(HtmlTag.UL); classTreeUl.addStyle(HtmlStyle.inheritance); Content liTree = null; do { sup = utils.getFirstVisibleSuperClass( type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(), configuration); if (sup != null) { HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.addStyle(HtmlStyle.inheritance); ul.addContent(getTreeForClassHelper(type)); if (liTree != null) ul.addContent(liTree); Content li = HtmlTree.LI(ul); liTree = li; type = sup; } else classTreeUl.addContent(getTreeForClassHelper(type)); } while (sup != null); if (liTree != null) classTreeUl.addContent(liTree); return classTreeUl; }
java
private Content getClassInheritenceTree(Type type) { Type sup; HtmlTree classTreeUl = new HtmlTree(HtmlTag.UL); classTreeUl.addStyle(HtmlStyle.inheritance); Content liTree = null; do { sup = utils.getFirstVisibleSuperClass( type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(), configuration); if (sup != null) { HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.addStyle(HtmlStyle.inheritance); ul.addContent(getTreeForClassHelper(type)); if (liTree != null) ul.addContent(liTree); Content li = HtmlTree.LI(ul); liTree = li; type = sup; } else classTreeUl.addContent(getTreeForClassHelper(type)); } while (sup != null); if (liTree != null) classTreeUl.addContent(liTree); return classTreeUl; }
[ "private", "Content", "getClassInheritenceTree", "(", "Type", "type", ")", "{", "Type", "sup", ";", "HtmlTree", "classTreeUl", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "UL", ")", ";", "classTreeUl", ".", "addStyle", "(", "HtmlStyle", ".", "inheritance", ")", ";", "Content", "liTree", "=", "null", ";", "do", "{", "sup", "=", "utils", ".", "getFirstVisibleSuperClass", "(", "type", "instanceof", "ClassDoc", "?", "(", "ClassDoc", ")", "type", ":", "type", ".", "asClassDoc", "(", ")", ",", "configuration", ")", ";", "if", "(", "sup", "!=", "null", ")", "{", "HtmlTree", "ul", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "UL", ")", ";", "ul", ".", "addStyle", "(", "HtmlStyle", ".", "inheritance", ")", ";", "ul", ".", "addContent", "(", "getTreeForClassHelper", "(", "type", ")", ")", ";", "if", "(", "liTree", "!=", "null", ")", "ul", ".", "addContent", "(", "liTree", ")", ";", "Content", "li", "=", "HtmlTree", ".", "LI", "(", "ul", ")", ";", "liTree", "=", "li", ";", "type", "=", "sup", ";", "}", "else", "classTreeUl", ".", "addContent", "(", "getTreeForClassHelper", "(", "type", ")", ")", ";", "}", "while", "(", "sup", "!=", "null", ")", ";", "if", "(", "liTree", "!=", "null", ")", "classTreeUl", ".", "addContent", "(", "liTree", ")", ";", "return", "classTreeUl", ";", "}" ]
Get the class hierarchy tree for the given class. @param type the class to print the hierarchy for @return a content tree for class inheritence
[ "Get", "the", "class", "hierarchy", "tree", "for", "the", "given", "class", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java#L333-L359
5,133
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java
AbstractPackageIndexWriter.addIndex
protected void addIndex(Content body) { addIndexContents(packages, "doclet.Package_Summary", configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Package_Summary"), configuration.getText("doclet.packages")), body); }
java
protected void addIndex(Content body) { addIndexContents(packages, "doclet.Package_Summary", configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Package_Summary"), configuration.getText("doclet.packages")), body); }
[ "protected", "void", "addIndex", "(", "Content", "body", ")", "{", "addIndexContents", "(", "packages", ",", "\"doclet.Package_Summary\"", ",", "configuration", ".", "getText", "(", "\"doclet.Member_Table_Summary\"", ",", "configuration", ".", "getText", "(", "\"doclet.Package_Summary\"", ")", ",", "configuration", ".", "getText", "(", "\"doclet.packages\"", ")", ")", ",", "body", ")", ";", "}" ]
Adds the frame or non-frame package index to the documentation tree. @param body the document tree to which the index will be added
[ "Adds", "the", "frame", "or", "non", "-", "frame", "package", "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/AbstractPackageIndexWriter.java#L138-L143
5,134
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java
AbstractPackageIndexWriter.addConfigurationTitle
protected void addConfigurationTitle(Content body) { if (configuration.doctitle.length() > 0) { Content title = new RawHtml(configuration.doctitle); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.title, title); Content div = HtmlTree.DIV(HtmlStyle.header, heading); body.addContent(div); } }
java
protected void addConfigurationTitle(Content body) { if (configuration.doctitle.length() > 0) { Content title = new RawHtml(configuration.doctitle); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.title, title); Content div = HtmlTree.DIV(HtmlStyle.header, heading); body.addContent(div); } }
[ "protected", "void", "addConfigurationTitle", "(", "Content", "body", ")", "{", "if", "(", "configuration", ".", "doctitle", ".", "length", "(", ")", ">", "0", ")", "{", "Content", "title", "=", "new", "RawHtml", "(", "configuration", ".", "doctitle", ")", ";", "Content", "heading", "=", "HtmlTree", ".", "HEADING", "(", "HtmlConstants", ".", "TITLE_HEADING", ",", "HtmlStyle", ".", "title", ",", "title", ")", ";", "Content", "div", "=", "HtmlTree", ".", "DIV", "(", "HtmlStyle", ".", "header", ",", "heading", ")", ";", "body", ".", "addContent", "(", "div", ")", ";", "}", "}" ]
Adds the doctitle to the documentation tree, if it is specified on the command line. @param body the document tree to which the title will be added
[ "Adds", "the", "doctitle", "to", "the", "documentation", "tree", "if", "it", "is", "specified", "on", "the", "command", "line", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java#L177-L185
5,135
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java
AbstractPackageIndexWriter.getNavLinkContents
@Override protected Content getNavLinkContents() { Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.overviewLabel); return li; }
java
@Override protected Content getNavLinkContents() { Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.overviewLabel); return li; }
[ "@", "Override", "protected", "Content", "getNavLinkContents", "(", ")", "{", "Content", "li", "=", "HtmlTree", ".", "LI", "(", "HtmlStyle", ".", "navBarCell1Rev", ",", "contents", ".", "overviewLabel", ")", ";", "return", "li", ";", "}" ]
Returns highlighted "Overview", in the navigation bar as this is the overview page. @return a Content object to be added to the documentation tree
[ "Returns", "highlighted", "Overview", "in", "the", "navigation", "bar", "as", "this", "is", "the", "overview", "page", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java#L193-L197
5,136
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java
Util.remoteInputOutput
public static ExecutionControl remoteInputOutput(InputStream input, OutputStream output, Map<String, OutputStream> outputStreamMap, Map<String, InputStream> inputStreamMap, BiFunction<ObjectInput, ObjectOutput, ExecutionControl> factory) throws IOException { ExecutionControl[] result = new ExecutionControl[1]; Map<String, OutputStream> augmentedStreamMap = new HashMap<>(outputStreamMap); ObjectOutput commandOut = new ObjectOutputStream(Util.multiplexingOutputStream("$command", output)); for (Entry<String, InputStream> e : inputStreamMap.entrySet()) { InputStream in = e.getValue(); OutputStream inTarget = Util.multiplexingOutputStream(e.getKey(), output); augmentedStreamMap.put("$" + e.getKey() + "-input-requested", new OutputStream() { @Override public void write(int b) throws IOException { //value ignored, just a trigger to read from the input try { int r = in.read(); if (r == (-1)) { inTarget.write(TAG_CLOSED); } else { inTarget.write(new byte[] {TAG_DATA, (byte) r}); } } catch (InterruptedIOException exc) { try { result[0].stop(); } catch (ExecutionControlException ex) { debug(ex, "$" + e.getKey() + "-input-requested.write"); } } catch (IOException exc) { byte[] message = exc.getMessage().getBytes("UTF-8"); inTarget.write(TAG_EXCEPTION); inTarget.write((message.length >> 0) & 0xFF); inTarget.write((message.length >> 8) & 0xFF); inTarget.write((message.length >> 16) & 0xFF); inTarget.write((message.length >> 24) & 0xFF); inTarget.write(message); } } }); } PipeInputStream commandIn = new PipeInputStream(); OutputStream commandInTarget = commandIn.createOutput(); augmentedStreamMap.put("$command", commandInTarget); new DemultiplexInput(input, augmentedStreamMap, Arrays.asList(commandInTarget)).start(); return result[0] = factory.apply(new ObjectInputStream(commandIn), commandOut); }
java
public static ExecutionControl remoteInputOutput(InputStream input, OutputStream output, Map<String, OutputStream> outputStreamMap, Map<String, InputStream> inputStreamMap, BiFunction<ObjectInput, ObjectOutput, ExecutionControl> factory) throws IOException { ExecutionControl[] result = new ExecutionControl[1]; Map<String, OutputStream> augmentedStreamMap = new HashMap<>(outputStreamMap); ObjectOutput commandOut = new ObjectOutputStream(Util.multiplexingOutputStream("$command", output)); for (Entry<String, InputStream> e : inputStreamMap.entrySet()) { InputStream in = e.getValue(); OutputStream inTarget = Util.multiplexingOutputStream(e.getKey(), output); augmentedStreamMap.put("$" + e.getKey() + "-input-requested", new OutputStream() { @Override public void write(int b) throws IOException { //value ignored, just a trigger to read from the input try { int r = in.read(); if (r == (-1)) { inTarget.write(TAG_CLOSED); } else { inTarget.write(new byte[] {TAG_DATA, (byte) r}); } } catch (InterruptedIOException exc) { try { result[0].stop(); } catch (ExecutionControlException ex) { debug(ex, "$" + e.getKey() + "-input-requested.write"); } } catch (IOException exc) { byte[] message = exc.getMessage().getBytes("UTF-8"); inTarget.write(TAG_EXCEPTION); inTarget.write((message.length >> 0) & 0xFF); inTarget.write((message.length >> 8) & 0xFF); inTarget.write((message.length >> 16) & 0xFF); inTarget.write((message.length >> 24) & 0xFF); inTarget.write(message); } } }); } PipeInputStream commandIn = new PipeInputStream(); OutputStream commandInTarget = commandIn.createOutput(); augmentedStreamMap.put("$command", commandInTarget); new DemultiplexInput(input, augmentedStreamMap, Arrays.asList(commandInTarget)).start(); return result[0] = factory.apply(new ObjectInputStream(commandIn), commandOut); }
[ "public", "static", "ExecutionControl", "remoteInputOutput", "(", "InputStream", "input", ",", "OutputStream", "output", ",", "Map", "<", "String", ",", "OutputStream", ">", "outputStreamMap", ",", "Map", "<", "String", ",", "InputStream", ">", "inputStreamMap", ",", "BiFunction", "<", "ObjectInput", ",", "ObjectOutput", ",", "ExecutionControl", ">", "factory", ")", "throws", "IOException", "{", "ExecutionControl", "[", "]", "result", "=", "new", "ExecutionControl", "[", "1", "]", ";", "Map", "<", "String", ",", "OutputStream", ">", "augmentedStreamMap", "=", "new", "HashMap", "<>", "(", "outputStreamMap", ")", ";", "ObjectOutput", "commandOut", "=", "new", "ObjectOutputStream", "(", "Util", ".", "multiplexingOutputStream", "(", "\"$command\"", ",", "output", ")", ")", ";", "for", "(", "Entry", "<", "String", ",", "InputStream", ">", "e", ":", "inputStreamMap", ".", "entrySet", "(", ")", ")", "{", "InputStream", "in", "=", "e", ".", "getValue", "(", ")", ";", "OutputStream", "inTarget", "=", "Util", ".", "multiplexingOutputStream", "(", "e", ".", "getKey", "(", ")", ",", "output", ")", ";", "augmentedStreamMap", ".", "put", "(", "\"$\"", "+", "e", ".", "getKey", "(", ")", "+", "\"-input-requested\"", ",", "new", "OutputStream", "(", ")", "{", "@", "Override", "public", "void", "write", "(", "int", "b", ")", "throws", "IOException", "{", "//value ignored, just a trigger to read from the input", "try", "{", "int", "r", "=", "in", ".", "read", "(", ")", ";", "if", "(", "r", "==", "(", "-", "1", ")", ")", "{", "inTarget", ".", "write", "(", "TAG_CLOSED", ")", ";", "}", "else", "{", "inTarget", ".", "write", "(", "new", "byte", "[", "]", "{", "TAG_DATA", ",", "(", "byte", ")", "r", "}", ")", ";", "}", "}", "catch", "(", "InterruptedIOException", "exc", ")", "{", "try", "{", "result", "[", "0", "]", ".", "stop", "(", ")", ";", "}", "catch", "(", "ExecutionControlException", "ex", ")", "{", "debug", "(", "ex", ",", "\"$\"", "+", "e", ".", "getKey", "(", ")", "+", "\"-input-requested.write\"", ")", ";", "}", "}", "catch", "(", "IOException", "exc", ")", "{", "byte", "[", "]", "message", "=", "exc", ".", "getMessage", "(", ")", ".", "getBytes", "(", "\"UTF-8\"", ")", ";", "inTarget", ".", "write", "(", "TAG_EXCEPTION", ")", ";", "inTarget", ".", "write", "(", "(", "message", ".", "length", ">>", "0", ")", "&", "0xFF", ")", ";", "inTarget", ".", "write", "(", "(", "message", ".", "length", ">>", "8", ")", "&", "0xFF", ")", ";", "inTarget", ".", "write", "(", "(", "message", ".", "length", ">>", "16", ")", "&", "0xFF", ")", ";", "inTarget", ".", "write", "(", "(", "message", ".", "length", ">>", "24", ")", "&", "0xFF", ")", ";", "inTarget", ".", "write", "(", "message", ")", ";", "}", "}", "}", ")", ";", "}", "PipeInputStream", "commandIn", "=", "new", "PipeInputStream", "(", ")", ";", "OutputStream", "commandInTarget", "=", "commandIn", ".", "createOutput", "(", ")", ";", "augmentedStreamMap", ".", "put", "(", "\"$command\"", ",", "commandInTarget", ")", ";", "new", "DemultiplexInput", "(", "input", ",", "augmentedStreamMap", ",", "Arrays", ".", "asList", "(", "commandInTarget", ")", ")", ".", "start", "(", ")", ";", "return", "result", "[", "0", "]", "=", "factory", ".", "apply", "(", "new", "ObjectInputStream", "(", "commandIn", ")", ",", "commandOut", ")", ";", "}" ]
Creates an ExecutionControl for given packetized input and output. The given InputStream is de-packetized, and content forwarded to ObjectInput and given OutputStreams. The ObjectOutput and values read from the given InputStream are packetized and sent to the given OutputStream. @param input the packetized input stream @param output the packetized output stream @param outputStreamMap a map between stream names and the output streams to forward. Names starting with '$' are reserved for internal use. @param inputStreamMap a map between stream names and the input streams to forward. Names starting with '$' are reserved for internal use. @param factory to create the ExecutionControl from ObjectInput and ObjectOutput. @return the created ExecutionControl @throws IOException if setting up the streams raised an exception
[ "Creates", "an", "ExecutionControl", "for", "given", "packetized", "input", "and", "output", ".", "The", "given", "InputStream", "is", "de", "-", "packetized", "and", "content", "forwarded", "to", "ObjectInput", "and", "given", "OutputStreams", ".", "The", "ObjectOutput", "and", "values", "read", "from", "the", "given", "InputStream", "are", "packetized", "and", "sent", "to", "the", "given", "OutputStream", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java#L159-L202
5,137
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java
RemoteExecutionControl.main
public static void main(String[] args) throws Exception { String loopBack = null; Socket socket = new Socket(loopBack, Integer.parseInt(args[0])); InputStream inStream = socket.getInputStream(); OutputStream outStream = socket.getOutputStream(); Map<String, Consumer<OutputStream>> outputs = new HashMap<>(); outputs.put("out", st -> System.setOut(new PrintStream(st, true))); outputs.put("err", st -> System.setErr(new PrintStream(st, true))); Map<String, Consumer<InputStream>> input = new HashMap<>(); input.put("in", System::setIn); forwardExecutionControlAndIO(new RemoteExecutionControl(), inStream, outStream, outputs, input); }
java
public static void main(String[] args) throws Exception { String loopBack = null; Socket socket = new Socket(loopBack, Integer.parseInt(args[0])); InputStream inStream = socket.getInputStream(); OutputStream outStream = socket.getOutputStream(); Map<String, Consumer<OutputStream>> outputs = new HashMap<>(); outputs.put("out", st -> System.setOut(new PrintStream(st, true))); outputs.put("err", st -> System.setErr(new PrintStream(st, true))); Map<String, Consumer<InputStream>> input = new HashMap<>(); input.put("in", System::setIn); forwardExecutionControlAndIO(new RemoteExecutionControl(), inStream, outStream, outputs, input); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "String", "loopBack", "=", "null", ";", "Socket", "socket", "=", "new", "Socket", "(", "loopBack", ",", "Integer", ".", "parseInt", "(", "args", "[", "0", "]", ")", ")", ";", "InputStream", "inStream", "=", "socket", ".", "getInputStream", "(", ")", ";", "OutputStream", "outStream", "=", "socket", ".", "getOutputStream", "(", ")", ";", "Map", "<", "String", ",", "Consumer", "<", "OutputStream", ">", ">", "outputs", "=", "new", "HashMap", "<>", "(", ")", ";", "outputs", ".", "put", "(", "\"out\"", ",", "st", "->", "System", ".", "setOut", "(", "new", "PrintStream", "(", "st", ",", "true", ")", ")", ")", ";", "outputs", ".", "put", "(", "\"err\"", ",", "st", "->", "System", ".", "setErr", "(", "new", "PrintStream", "(", "st", ",", "true", ")", ")", ")", ";", "Map", "<", "String", ",", "Consumer", "<", "InputStream", ">", ">", "input", "=", "new", "HashMap", "<>", "(", ")", ";", "input", ".", "put", "(", "\"in\"", ",", "System", "::", "setIn", ")", ";", "forwardExecutionControlAndIO", "(", "new", "RemoteExecutionControl", "(", ")", ",", "inStream", ",", "outStream", ",", "outputs", ",", "input", ")", ";", "}" ]
Launch the agent, connecting to the JShell-core over the socket specified in the command-line argument. @param args standard command-line arguments, expectation is the socket number is the only argument @throws Exception any unexpected exception
[ "Launch", "the", "agent", "connecting", "to", "the", "JShell", "-", "core", "over", "the", "socket", "specified", "in", "the", "command", "-", "line", "argument", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java#L60-L71
5,138
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java
RemoteExecutionControl.varValue
@Override public String varValue(String className, String varName) throws RunException, EngineTerminationException, InternalException { return super.varValue(className, varName); }
java
@Override public String varValue(String className, String varName) throws RunException, EngineTerminationException, InternalException { return super.varValue(className, varName); }
[ "@", "Override", "public", "String", "varValue", "(", "String", "className", ",", "String", "varName", ")", "throws", "RunException", ",", "EngineTerminationException", ",", "InternalException", "{", "return", "super", ".", "varValue", "(", "className", ",", "varName", ")", ";", "}" ]
Overridden only so this stack frame is seen
[ "Overridden", "only", "so", "this", "stack", "frame", "is", "seen" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java#L120-L123
5,139
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
TypeAnnotations.organizeTypeAnnotationsSignatures
public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) { annotate.afterTypes(() -> { JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile); try { new TypeAnnotationPositions(true).scan(tree); } finally { log.useSource(oldSource); } }); }
java
public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) { annotate.afterTypes(() -> { JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile); try { new TypeAnnotationPositions(true).scan(tree); } finally { log.useSource(oldSource); } }); }
[ "public", "void", "organizeTypeAnnotationsSignatures", "(", "final", "Env", "<", "AttrContext", ">", "env", ",", "final", "JCClassDecl", "tree", ")", "{", "annotate", ".", "afterTypes", "(", "(", ")", "->", "{", "JavaFileObject", "oldSource", "=", "log", ".", "useSource", "(", "env", ".", "toplevel", ".", "sourcefile", ")", ";", "try", "{", "new", "TypeAnnotationPositions", "(", "true", ")", ".", "scan", "(", "tree", ")", ";", "}", "finally", "{", "log", ".", "useSource", "(", "oldSource", ")", ";", "}", "}", ")", ";", "}" ]
Separate type annotations from declaration annotations and determine the correct positions for type annotations. This version only visits types in signatures and should be called from MemberEnter.
[ "Separate", "type", "annotations", "from", "declaration", "annotations", "and", "determine", "the", "correct", "positions", "for", "type", "annotations", ".", "This", "version", "only", "visits", "types", "in", "signatures", "and", "should", "be", "called", "from", "MemberEnter", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java#L118-L127
5,140
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/CompileStates.java
CompileStates.instance
public static CompileStates instance(Context context) { CompileStates instance = context.get(compileStatesKey); if (instance == null) { instance = new CompileStates(context); } return instance; }
java
public static CompileStates instance(Context context) { CompileStates instance = context.get(compileStatesKey); if (instance == null) { instance = new CompileStates(context); } return instance; }
[ "public", "static", "CompileStates", "instance", "(", "Context", "context", ")", "{", "CompileStates", "instance", "=", "context", ".", "get", "(", "compileStatesKey", ")", ";", "if", "(", "instance", "==", "null", ")", "{", "instance", "=", "new", "CompileStates", "(", "context", ")", ";", "}", "return", "instance", ";", "}" ]
Get the CompileStates instance for this context.
[ "Get", "the", "CompileStates", "instance", "for", "this", "context", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/CompileStates.java#L45-L51
5,141
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java
StringConcat.sharpestAccessible
Type sharpestAccessible(Type originalType) { if (originalType.hasTag(ARRAY)) { return types.makeArrayType(sharpestAccessible(types.elemtype(originalType))); } Type type = originalType; while (!rs.isAccessible(gen.getAttrEnv(), type.asElement())) { type = types.supertype(type); } return type; }
java
Type sharpestAccessible(Type originalType) { if (originalType.hasTag(ARRAY)) { return types.makeArrayType(sharpestAccessible(types.elemtype(originalType))); } Type type = originalType; while (!rs.isAccessible(gen.getAttrEnv(), type.asElement())) { type = types.supertype(type); } return type; }
[ "Type", "sharpestAccessible", "(", "Type", "originalType", ")", "{", "if", "(", "originalType", ".", "hasTag", "(", "ARRAY", ")", ")", "{", "return", "types", ".", "makeArrayType", "(", "sharpestAccessible", "(", "types", ".", "elemtype", "(", "originalType", ")", ")", ")", ";", "}", "Type", "type", "=", "originalType", ";", "while", "(", "!", "rs", ".", "isAccessible", "(", "gen", ".", "getAttrEnv", "(", ")", ",", "type", ".", "asElement", "(", ")", ")", ")", "{", "type", "=", "types", ".", "supertype", "(", "type", ")", ";", "}", "return", "type", ";", "}" ]
If the type is not accessible from current context, try to figure out the sharpest accessible supertype. @param originalType type to sharpen @return sharped type
[ "If", "the", "type", "is", "not", "accessible", "from", "current", "context", "try", "to", "figure", "out", "the", "sharpest", "accessible", "supertype", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java#L150-L160
5,142
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
Utils.isSubclassOf
public boolean isSubclassOf(TypeElement t1, TypeElement t2) { return typeUtils.isSubtype(t1.asType(), t2.asType()); }
java
public boolean isSubclassOf(TypeElement t1, TypeElement t2) { return typeUtils.isSubtype(t1.asType(), t2.asType()); }
[ "public", "boolean", "isSubclassOf", "(", "TypeElement", "t1", ",", "TypeElement", "t2", ")", "{", "return", "typeUtils", ".", "isSubtype", "(", "t1", ".", "asType", "(", ")", ",", "t2", ".", "asType", "(", ")", ")", ";", "}" ]
Test whether a class is a subclass of another class. @param t1 the candidate superclass. @param t2 the target @return true if t1 is a superclass of t2.
[ "Test", "whether", "a", "class", "is", "a", "subclass", "of", "another", "class", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L216-L218
5,143
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
Utils.copyDocFiles
public void copyDocFiles(PackageElement pe) throws DocFileIOException { Location sourceLoc = getLocationForPackage(pe); copyDirectory(sourceLoc, DocPath.forPackage(pe).resolve(DocPaths.DOC_FILES)); }
java
public void copyDocFiles(PackageElement pe) throws DocFileIOException { Location sourceLoc = getLocationForPackage(pe); copyDirectory(sourceLoc, DocPath.forPackage(pe).resolve(DocPaths.DOC_FILES)); }
[ "public", "void", "copyDocFiles", "(", "PackageElement", "pe", ")", "throws", "DocFileIOException", "{", "Location", "sourceLoc", "=", "getLocationForPackage", "(", "pe", ")", ";", "copyDirectory", "(", "sourceLoc", ",", "DocPath", ".", "forPackage", "(", "pe", ")", ".", "resolve", "(", "DocPaths", ".", "DOC_FILES", ")", ")", ";", "}" ]
Copy doc-files directory and its contents from the source package directory to the generated documentation directory. For example, given a package java.lang, this method will copy the doc-files directory, found in the package directory to the generated documentation hierarchy. @param pe the package containing the doc files to be copied @throws DocFileIOException if there is a problem while copying the documentation files
[ "Copy", "doc", "-", "files", "directory", "and", "its", "contents", "from", "the", "source", "package", "directory", "to", "the", "generated", "documentation", "directory", ".", "For", "example", "given", "a", "package", "java", ".", "lang", "this", "method", "will", "copy", "the", "doc", "-", "files", "directory", "found", "in", "the", "package", "directory", "to", "the", "generated", "documentation", "hierarchy", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L276-L279
5,144
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
Utils.copyDirectory
public void copyDirectory(PackageElement pe, DocPath dir) throws DocFileIOException { copyDirectory(getLocationForPackage(pe), dir); }
java
public void copyDirectory(PackageElement pe, DocPath dir) throws DocFileIOException { copyDirectory(getLocationForPackage(pe), dir); }
[ "public", "void", "copyDirectory", "(", "PackageElement", "pe", ",", "DocPath", "dir", ")", "throws", "DocFileIOException", "{", "copyDirectory", "(", "getLocationForPackage", "(", "pe", ")", ",", "dir", ")", ";", "}" ]
Copy the given directory contents from the source package directory to the generated documentation directory. For example, given a package java.lang, this method will copy the entire directory, to the generated documentation hierarchy. @param pe the package containing the directory to be copied @param dir the directory to be copied @throws DocFileIOException if there is a problem while copying the documentation files
[ "Copy", "the", "given", "directory", "contents", "from", "the", "source", "package", "directory", "to", "the", "generated", "documentation", "directory", ".", "For", "example", "given", "a", "package", "java", ".", "lang", "this", "method", "will", "copy", "the", "entire", "directory", "to", "the", "generated", "documentation", "hierarchy", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L292-L294
5,145
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
Utils.copyDirectory
public void copyDirectory(ModuleElement mdle, DocPath dir) throws DocFileIOException { copyDirectory(getLocationForModule(mdle), dir); }
java
public void copyDirectory(ModuleElement mdle, DocPath dir) throws DocFileIOException { copyDirectory(getLocationForModule(mdle), dir); }
[ "public", "void", "copyDirectory", "(", "ModuleElement", "mdle", ",", "DocPath", "dir", ")", "throws", "DocFileIOException", "{", "copyDirectory", "(", "getLocationForModule", "(", "mdle", ")", ",", "dir", ")", ";", "}" ]
Copy the given directory and its contents from the source module directory to the generated documentation directory. For example, given a package java.lang, this method will copy the entire directory, to the generated documentation hierarchy. @param mdle the module containing the directory to be copied @param dir the directory to be copied @throws DocFileIOException if there is a problem while copying the documentation files
[ "Copy", "the", "given", "directory", "and", "its", "contents", "from", "the", "source", "module", "directory", "to", "the", "generated", "documentation", "directory", ".", "For", "example", "given", "a", "package", "java", ".", "lang", "this", "method", "will", "copy", "the", "entire", "directory", "to", "the", "generated", "documentation", "hierarchy", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L308-L310
5,146
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
Utils.copyDirectory
public void copyDirectory(Location locn, DocPath dir) throws DocFileIOException { boolean first = true; for (DocFile f : DocFile.list(configuration, locn, dir)) { if (!f.isDirectory()) { continue; } DocFile srcdir = f; DocFile destdir = DocFile.createFileForOutput(configuration, dir); if (srcdir.isSameFile(destdir)) { continue; } for (DocFile srcfile: srcdir.list()) { DocFile destfile = destdir.resolve(srcfile.getName()); if (srcfile.isFile()) { if (destfile.exists() && !first) { messages.warning("doclet.Copy_Overwrite_warning", srcfile.getPath(), destdir.getPath()); } else { messages.notice("doclet.Copying_File_0_To_Dir_1", srcfile.getPath(), destdir.getPath()); destfile.copyFile(srcfile); } } else if (srcfile.isDirectory()) { if (configuration.copydocfilesubdirs && !configuration.shouldExcludeDocFileDir(srcfile.getName())) { copyDirectory(locn, dir.resolve(srcfile.getName())); } } } first = false; } }
java
public void copyDirectory(Location locn, DocPath dir) throws DocFileIOException { boolean first = true; for (DocFile f : DocFile.list(configuration, locn, dir)) { if (!f.isDirectory()) { continue; } DocFile srcdir = f; DocFile destdir = DocFile.createFileForOutput(configuration, dir); if (srcdir.isSameFile(destdir)) { continue; } for (DocFile srcfile: srcdir.list()) { DocFile destfile = destdir.resolve(srcfile.getName()); if (srcfile.isFile()) { if (destfile.exists() && !first) { messages.warning("doclet.Copy_Overwrite_warning", srcfile.getPath(), destdir.getPath()); } else { messages.notice("doclet.Copying_File_0_To_Dir_1", srcfile.getPath(), destdir.getPath()); destfile.copyFile(srcfile); } } else if (srcfile.isDirectory()) { if (configuration.copydocfilesubdirs && !configuration.shouldExcludeDocFileDir(srcfile.getName())) { copyDirectory(locn, dir.resolve(srcfile.getName())); } } } first = false; } }
[ "public", "void", "copyDirectory", "(", "Location", "locn", ",", "DocPath", "dir", ")", "throws", "DocFileIOException", "{", "boolean", "first", "=", "true", ";", "for", "(", "DocFile", "f", ":", "DocFile", ".", "list", "(", "configuration", ",", "locn", ",", "dir", ")", ")", "{", "if", "(", "!", "f", ".", "isDirectory", "(", ")", ")", "{", "continue", ";", "}", "DocFile", "srcdir", "=", "f", ";", "DocFile", "destdir", "=", "DocFile", ".", "createFileForOutput", "(", "configuration", ",", "dir", ")", ";", "if", "(", "srcdir", ".", "isSameFile", "(", "destdir", ")", ")", "{", "continue", ";", "}", "for", "(", "DocFile", "srcfile", ":", "srcdir", ".", "list", "(", ")", ")", "{", "DocFile", "destfile", "=", "destdir", ".", "resolve", "(", "srcfile", ".", "getName", "(", ")", ")", ";", "if", "(", "srcfile", ".", "isFile", "(", ")", ")", "{", "if", "(", "destfile", ".", "exists", "(", ")", "&&", "!", "first", ")", "{", "messages", ".", "warning", "(", "\"doclet.Copy_Overwrite_warning\"", ",", "srcfile", ".", "getPath", "(", ")", ",", "destdir", ".", "getPath", "(", ")", ")", ";", "}", "else", "{", "messages", ".", "notice", "(", "\"doclet.Copying_File_0_To_Dir_1\"", ",", "srcfile", ".", "getPath", "(", ")", ",", "destdir", ".", "getPath", "(", ")", ")", ";", "destfile", ".", "copyFile", "(", "srcfile", ")", ";", "}", "}", "else", "if", "(", "srcfile", ".", "isDirectory", "(", ")", ")", "{", "if", "(", "configuration", ".", "copydocfilesubdirs", "&&", "!", "configuration", ".", "shouldExcludeDocFileDir", "(", "srcfile", ".", "getName", "(", ")", ")", ")", "{", "copyDirectory", "(", "locn", ",", "dir", ".", "resolve", "(", "srcfile", ".", "getName", "(", ")", ")", ")", ";", "}", "}", "}", "first", "=", "false", ";", "}", "}" ]
Copy files from a doc path location to the output. @param locn the location from which to read files @param dir the directory to be copied @throws DocFileIOException if there is a problem copying the files
[ "Copy", "files", "from", "a", "doc", "path", "location", "to", "the", "output", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L320-L353
5,147
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
Utils.getReturnType
public TypeMirror getReturnType(ExecutableElement ee) { return ee.getKind() == CONSTRUCTOR ? null : ee.getReturnType(); }
java
public TypeMirror getReturnType(ExecutableElement ee) { return ee.getKind() == CONSTRUCTOR ? null : ee.getReturnType(); }
[ "public", "TypeMirror", "getReturnType", "(", "ExecutableElement", "ee", ")", "{", "return", "ee", ".", "getKind", "(", ")", "==", "CONSTRUCTOR", "?", "null", ":", "ee", ".", "getReturnType", "(", ")", ";", "}" ]
Returns the TypeMirror of the ExecutableElement for all methods, a null if constructor. @param ee the ExecutableElement @return
[ "Returns", "the", "TypeMirror", "of", "the", "ExecutableElement", "for", "all", "methods", "a", "null", "if", "constructor", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L847-L849
5,148
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
Utils.getDeclaredType
public TypeMirror getDeclaredType(Collection<TypeMirror> values, TypeElement enclosing, TypeMirror target) { TypeElement targetElement = asTypeElement(target); List<? extends TypeParameterElement> targetTypeArgs = targetElement.getTypeParameters(); if (targetTypeArgs.isEmpty()) { return target; } List<? extends TypeParameterElement> enclosingTypeArgs = enclosing.getTypeParameters(); List<TypeMirror> targetTypeArgTypes = new ArrayList<>(targetTypeArgs.size()); if (enclosingTypeArgs.isEmpty()) { for (TypeMirror te : values) { List<? extends TypeMirror> typeArguments = ((DeclaredType)te).getTypeArguments(); if (typeArguments.size() >= targetTypeArgs.size()) { for (int i = 0 ; i < targetTypeArgs.size(); i++) { targetTypeArgTypes.add(typeArguments.get(i)); } break; } } // we found no matches in the hierarchy if (targetTypeArgTypes.isEmpty()) { return target; } } else { if (targetTypeArgs.size() > enclosingTypeArgs.size()) { return target; } for (int i = 0; i < targetTypeArgs.size(); i++) { TypeParameterElement tpe = enclosingTypeArgs.get(i); targetTypeArgTypes.add(tpe.asType()); } } TypeMirror dt = typeUtils.getDeclaredType(targetElement, targetTypeArgTypes.toArray(new TypeMirror[targetTypeArgTypes.size()])); return dt; }
java
public TypeMirror getDeclaredType(Collection<TypeMirror> values, TypeElement enclosing, TypeMirror target) { TypeElement targetElement = asTypeElement(target); List<? extends TypeParameterElement> targetTypeArgs = targetElement.getTypeParameters(); if (targetTypeArgs.isEmpty()) { return target; } List<? extends TypeParameterElement> enclosingTypeArgs = enclosing.getTypeParameters(); List<TypeMirror> targetTypeArgTypes = new ArrayList<>(targetTypeArgs.size()); if (enclosingTypeArgs.isEmpty()) { for (TypeMirror te : values) { List<? extends TypeMirror> typeArguments = ((DeclaredType)te).getTypeArguments(); if (typeArguments.size() >= targetTypeArgs.size()) { for (int i = 0 ; i < targetTypeArgs.size(); i++) { targetTypeArgTypes.add(typeArguments.get(i)); } break; } } // we found no matches in the hierarchy if (targetTypeArgTypes.isEmpty()) { return target; } } else { if (targetTypeArgs.size() > enclosingTypeArgs.size()) { return target; } for (int i = 0; i < targetTypeArgs.size(); i++) { TypeParameterElement tpe = enclosingTypeArgs.get(i); targetTypeArgTypes.add(tpe.asType()); } } TypeMirror dt = typeUtils.getDeclaredType(targetElement, targetTypeArgTypes.toArray(new TypeMirror[targetTypeArgTypes.size()])); return dt; }
[ "public", "TypeMirror", "getDeclaredType", "(", "Collection", "<", "TypeMirror", ">", "values", ",", "TypeElement", "enclosing", ",", "TypeMirror", "target", ")", "{", "TypeElement", "targetElement", "=", "asTypeElement", "(", "target", ")", ";", "List", "<", "?", "extends", "TypeParameterElement", ">", "targetTypeArgs", "=", "targetElement", ".", "getTypeParameters", "(", ")", ";", "if", "(", "targetTypeArgs", ".", "isEmpty", "(", ")", ")", "{", "return", "target", ";", "}", "List", "<", "?", "extends", "TypeParameterElement", ">", "enclosingTypeArgs", "=", "enclosing", ".", "getTypeParameters", "(", ")", ";", "List", "<", "TypeMirror", ">", "targetTypeArgTypes", "=", "new", "ArrayList", "<>", "(", "targetTypeArgs", ".", "size", "(", ")", ")", ";", "if", "(", "enclosingTypeArgs", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "TypeMirror", "te", ":", "values", ")", "{", "List", "<", "?", "extends", "TypeMirror", ">", "typeArguments", "=", "(", "(", "DeclaredType", ")", "te", ")", ".", "getTypeArguments", "(", ")", ";", "if", "(", "typeArguments", ".", "size", "(", ")", ">=", "targetTypeArgs", ".", "size", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "targetTypeArgs", ".", "size", "(", ")", ";", "i", "++", ")", "{", "targetTypeArgTypes", ".", "add", "(", "typeArguments", ".", "get", "(", "i", ")", ")", ";", "}", "break", ";", "}", "}", "// we found no matches in the hierarchy", "if", "(", "targetTypeArgTypes", ".", "isEmpty", "(", ")", ")", "{", "return", "target", ";", "}", "}", "else", "{", "if", "(", "targetTypeArgs", ".", "size", "(", ")", ">", "enclosingTypeArgs", ".", "size", "(", ")", ")", "{", "return", "target", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "targetTypeArgs", ".", "size", "(", ")", ";", "i", "++", ")", "{", "TypeParameterElement", "tpe", "=", "enclosingTypeArgs", ".", "get", "(", "i", ")", ";", "targetTypeArgTypes", ".", "add", "(", "tpe", ".", "asType", "(", ")", ")", ";", "}", "}", "TypeMirror", "dt", "=", "typeUtils", ".", "getDeclaredType", "(", "targetElement", ",", "targetTypeArgTypes", ".", "toArray", "(", "new", "TypeMirror", "[", "targetTypeArgTypes", ".", "size", "(", ")", "]", ")", ")", ";", "return", "dt", ";", "}" ]
Finds the declaration of the enclosing's type parameter. @param values @param enclosing a TypeElement whose type arguments we desire @param target the TypeMirror of the type as described by the enclosing @return
[ "Finds", "the", "declaration", "of", "the", "enclosing", "s", "type", "parameter", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L934-L971
5,149
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
Utils.replaceText
public String replaceText(String originalStr, String oldStr, String newStr) { if (oldStr == null || newStr == null || oldStr.equals(newStr)) { return originalStr; } return originalStr.replace(oldStr, newStr); }
java
public String replaceText(String originalStr, String oldStr, String newStr) { if (oldStr == null || newStr == null || oldStr.equals(newStr)) { return originalStr; } return originalStr.replace(oldStr, newStr); }
[ "public", "String", "replaceText", "(", "String", "originalStr", ",", "String", "oldStr", ",", "String", "newStr", ")", "{", "if", "(", "oldStr", "==", "null", "||", "newStr", "==", "null", "||", "oldStr", ".", "equals", "(", "newStr", ")", ")", "{", "return", "originalStr", ";", "}", "return", "originalStr", ".", "replace", "(", "oldStr", ",", "newStr", ")", ";", "}" ]
Given a string, replace all occurrences of 'newStr' with 'oldStr'. @param originalStr the string to modify. @param oldStr the string to replace. @param newStr the string to insert in place of the old string.
[ "Given", "a", "string", "replace", "all", "occurrences", "of", "newStr", "with", "oldStr", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L1108-L1114
5,150
google/error-prone-javac
src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java
JavadocHelper.create
public static JavadocHelper create(JavacTask mainTask, Collection<? extends Path> sourceLocations) { StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null); try { fm.setLocationFromPaths(StandardLocation.SOURCE_PATH, sourceLocations); return new OnDemandJavadocHelper(mainTask, fm); } catch (IOException ex) { try { fm.close(); } catch (IOException closeEx) { } return new JavadocHelper() { @Override public String getResolvedDocComment(Element forElement) throws IOException { return null; } @Override public Element getSourceElement(Element forElement) throws IOException { return forElement; } @Override public void close() throws IOException {} }; } }
java
public static JavadocHelper create(JavacTask mainTask, Collection<? extends Path> sourceLocations) { StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null); try { fm.setLocationFromPaths(StandardLocation.SOURCE_PATH, sourceLocations); return new OnDemandJavadocHelper(mainTask, fm); } catch (IOException ex) { try { fm.close(); } catch (IOException closeEx) { } return new JavadocHelper() { @Override public String getResolvedDocComment(Element forElement) throws IOException { return null; } @Override public Element getSourceElement(Element forElement) throws IOException { return forElement; } @Override public void close() throws IOException {} }; } }
[ "public", "static", "JavadocHelper", "create", "(", "JavacTask", "mainTask", ",", "Collection", "<", "?", "extends", "Path", ">", "sourceLocations", ")", "{", "StandardJavaFileManager", "fm", "=", "compiler", ".", "getStandardFileManager", "(", "null", ",", "null", ",", "null", ")", ";", "try", "{", "fm", ".", "setLocationFromPaths", "(", "StandardLocation", ".", "SOURCE_PATH", ",", "sourceLocations", ")", ";", "return", "new", "OnDemandJavadocHelper", "(", "mainTask", ",", "fm", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "try", "{", "fm", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "closeEx", ")", "{", "}", "return", "new", "JavadocHelper", "(", ")", "{", "@", "Override", "public", "String", "getResolvedDocComment", "(", "Element", "forElement", ")", "throws", "IOException", "{", "return", "null", ";", "}", "@", "Override", "public", "Element", "getSourceElement", "(", "Element", "forElement", ")", "throws", "IOException", "{", "return", "forElement", ";", "}", "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "}", "}", ";", "}", "}" ]
Create the helper. @param mainTask JavacTask from which the further Elements originate @param sourceLocations paths where source files should be searched @return a JavadocHelper
[ "Create", "the", "helper", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java#L102-L125
5,151
google/error-prone-javac
make/tools/propertiesparser/parser/MessageInfo.java
MessageInfo.parseAlternative
MessageType parseAlternative(String text) { //try with custom types if (text.charAt(0) == '\'') { int end = text.indexOf('\'', 1); return new MessageType.CustomType(text.substring(1, end)); } //try with simple types for (SimpleType st : SimpleType.values()) { if (text.equals(st.kindName())) { return st; } } //try with compound types for (CompoundType.Kind ck : CompoundType.Kind.values()) { if (text.startsWith(ck.kindName)) { MessageType elemtype = parseAlternative(text.substring(ck.kindName.length() + 1).trim()); return new CompoundType(ck, elemtype); } } //try with union types for (UnionType.Kind uk : UnionType.Kind.values()) { if (text.startsWith(uk.kindName)) { return new UnionType(uk); } } //no match - report a warning System.err.println("WARNING - unrecognized type: " + text); return SimpleType.UNKNOWN; }
java
MessageType parseAlternative(String text) { //try with custom types if (text.charAt(0) == '\'') { int end = text.indexOf('\'', 1); return new MessageType.CustomType(text.substring(1, end)); } //try with simple types for (SimpleType st : SimpleType.values()) { if (text.equals(st.kindName())) { return st; } } //try with compound types for (CompoundType.Kind ck : CompoundType.Kind.values()) { if (text.startsWith(ck.kindName)) { MessageType elemtype = parseAlternative(text.substring(ck.kindName.length() + 1).trim()); return new CompoundType(ck, elemtype); } } //try with union types for (UnionType.Kind uk : UnionType.Kind.values()) { if (text.startsWith(uk.kindName)) { return new UnionType(uk); } } //no match - report a warning System.err.println("WARNING - unrecognized type: " + text); return SimpleType.UNKNOWN; }
[ "MessageType", "parseAlternative", "(", "String", "text", ")", "{", "//try with custom types", "if", "(", "text", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "int", "end", "=", "text", ".", "indexOf", "(", "'", "'", ",", "1", ")", ";", "return", "new", "MessageType", ".", "CustomType", "(", "text", ".", "substring", "(", "1", ",", "end", ")", ")", ";", "}", "//try with simple types", "for", "(", "SimpleType", "st", ":", "SimpleType", ".", "values", "(", ")", ")", "{", "if", "(", "text", ".", "equals", "(", "st", ".", "kindName", "(", ")", ")", ")", "{", "return", "st", ";", "}", "}", "//try with compound types", "for", "(", "CompoundType", ".", "Kind", "ck", ":", "CompoundType", ".", "Kind", ".", "values", "(", ")", ")", "{", "if", "(", "text", ".", "startsWith", "(", "ck", ".", "kindName", ")", ")", "{", "MessageType", "elemtype", "=", "parseAlternative", "(", "text", ".", "substring", "(", "ck", ".", "kindName", ".", "length", "(", ")", "+", "1", ")", ".", "trim", "(", ")", ")", ";", "return", "new", "CompoundType", "(", "ck", ",", "elemtype", ")", ";", "}", "}", "//try with union types", "for", "(", "UnionType", ".", "Kind", "uk", ":", "UnionType", ".", "Kind", ".", "values", "(", ")", ")", "{", "if", "(", "text", ".", "startsWith", "(", "uk", ".", "kindName", ")", ")", "{", "return", "new", "UnionType", "(", "uk", ")", ";", "}", "}", "//no match - report a warning", "System", ".", "err", ".", "println", "(", "\"WARNING - unrecognized type: \"", "+", "text", ")", ";", "return", "SimpleType", ".", "UNKNOWN", ";", "}" ]
Parse a subset of the type comment; valid matches are simple types, compound types, union types and custom types.
[ "Parse", "a", "subset", "of", "the", "type", "comment", ";", "valid", "matches", "are", "simple", "types", "compound", "types", "union", "types", "and", "custom", "types", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/parser/MessageInfo.java#L94-L122
5,152
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
LambdaToMethod.visitClassDef
@Override public void visitClassDef(JCClassDecl tree) { if (tree.sym.owner.kind == PCK) { //analyze class tree = analyzer.analyzeAndPreprocessClass(tree); } KlassInfo prevKlassInfo = kInfo; try { kInfo = new KlassInfo(tree); super.visitClassDef(tree); if (!kInfo.deserializeCases.isEmpty()) { int prevPos = make.pos; try { make.at(tree); kInfo.addMethod(makeDeserializeMethod(tree.sym)); } finally { make.at(prevPos); } } //add all translated instance methods here List<JCTree> newMethods = kInfo.appendedMethodList.toList(); tree.defs = tree.defs.appendList(newMethods); for (JCTree lambda : newMethods) { tree.sym.members().enter(((JCMethodDecl)lambda).sym); } result = tree; } finally { kInfo = prevKlassInfo; } }
java
@Override public void visitClassDef(JCClassDecl tree) { if (tree.sym.owner.kind == PCK) { //analyze class tree = analyzer.analyzeAndPreprocessClass(tree); } KlassInfo prevKlassInfo = kInfo; try { kInfo = new KlassInfo(tree); super.visitClassDef(tree); if (!kInfo.deserializeCases.isEmpty()) { int prevPos = make.pos; try { make.at(tree); kInfo.addMethod(makeDeserializeMethod(tree.sym)); } finally { make.at(prevPos); } } //add all translated instance methods here List<JCTree> newMethods = kInfo.appendedMethodList.toList(); tree.defs = tree.defs.appendList(newMethods); for (JCTree lambda : newMethods) { tree.sym.members().enter(((JCMethodDecl)lambda).sym); } result = tree; } finally { kInfo = prevKlassInfo; } }
[ "@", "Override", "public", "void", "visitClassDef", "(", "JCClassDecl", "tree", ")", "{", "if", "(", "tree", ".", "sym", ".", "owner", ".", "kind", "==", "PCK", ")", "{", "//analyze class", "tree", "=", "analyzer", ".", "analyzeAndPreprocessClass", "(", "tree", ")", ";", "}", "KlassInfo", "prevKlassInfo", "=", "kInfo", ";", "try", "{", "kInfo", "=", "new", "KlassInfo", "(", "tree", ")", ";", "super", ".", "visitClassDef", "(", "tree", ")", ";", "if", "(", "!", "kInfo", ".", "deserializeCases", ".", "isEmpty", "(", ")", ")", "{", "int", "prevPos", "=", "make", ".", "pos", ";", "try", "{", "make", ".", "at", "(", "tree", ")", ";", "kInfo", ".", "addMethod", "(", "makeDeserializeMethod", "(", "tree", ".", "sym", ")", ")", ";", "}", "finally", "{", "make", ".", "at", "(", "prevPos", ")", ";", "}", "}", "//add all translated instance methods here", "List", "<", "JCTree", ">", "newMethods", "=", "kInfo", ".", "appendedMethodList", ".", "toList", "(", ")", ";", "tree", ".", "defs", "=", "tree", ".", "defs", ".", "appendList", "(", "newMethods", ")", ";", "for", "(", "JCTree", "lambda", ":", "newMethods", ")", "{", "tree", ".", "sym", ".", "members", "(", ")", ".", "enter", "(", "(", "(", "JCMethodDecl", ")", "lambda", ")", ".", "sym", ")", ";", "}", "result", "=", "tree", ";", "}", "finally", "{", "kInfo", "=", "prevKlassInfo", ";", "}", "}" ]
Visit a class. Maintain the translatedMethodList across nested classes. Append the translatedMethodList to the class after it is translated. @param tree
[ "Visit", "a", "class", ".", "Maintain", "the", "translatedMethodList", "across", "nested", "classes", ".", "Append", "the", "translatedMethodList", "to", "the", "class", "after", "it", "is", "translated", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java#L235-L264
5,153
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
LambdaToMethod.apportionTypeAnnotations
private void apportionTypeAnnotations(JCLambda tree, Supplier<List<Attribute.TypeCompound>> source, Consumer<List<Attribute.TypeCompound>> owner, Consumer<List<Attribute.TypeCompound>> lambda) { ListBuffer<Attribute.TypeCompound> ownerTypeAnnos = new ListBuffer<>(); ListBuffer<Attribute.TypeCompound> lambdaTypeAnnos = new ListBuffer<>(); for (Attribute.TypeCompound tc : source.get()) { if (tc.position.onLambda == tree) { lambdaTypeAnnos.append(tc); } else { ownerTypeAnnos.append(tc); } } if (lambdaTypeAnnos.nonEmpty()) { owner.accept(ownerTypeAnnos.toList()); lambda.accept(lambdaTypeAnnos.toList()); } }
java
private void apportionTypeAnnotations(JCLambda tree, Supplier<List<Attribute.TypeCompound>> source, Consumer<List<Attribute.TypeCompound>> owner, Consumer<List<Attribute.TypeCompound>> lambda) { ListBuffer<Attribute.TypeCompound> ownerTypeAnnos = new ListBuffer<>(); ListBuffer<Attribute.TypeCompound> lambdaTypeAnnos = new ListBuffer<>(); for (Attribute.TypeCompound tc : source.get()) { if (tc.position.onLambda == tree) { lambdaTypeAnnos.append(tc); } else { ownerTypeAnnos.append(tc); } } if (lambdaTypeAnnos.nonEmpty()) { owner.accept(ownerTypeAnnos.toList()); lambda.accept(lambdaTypeAnnos.toList()); } }
[ "private", "void", "apportionTypeAnnotations", "(", "JCLambda", "tree", ",", "Supplier", "<", "List", "<", "Attribute", ".", "TypeCompound", ">", ">", "source", ",", "Consumer", "<", "List", "<", "Attribute", ".", "TypeCompound", ">", ">", "owner", ",", "Consumer", "<", "List", "<", "Attribute", ".", "TypeCompound", ">", ">", "lambda", ")", "{", "ListBuffer", "<", "Attribute", ".", "TypeCompound", ">", "ownerTypeAnnos", "=", "new", "ListBuffer", "<>", "(", ")", ";", "ListBuffer", "<", "Attribute", ".", "TypeCompound", ">", "lambdaTypeAnnos", "=", "new", "ListBuffer", "<>", "(", ")", ";", "for", "(", "Attribute", ".", "TypeCompound", "tc", ":", "source", ".", "get", "(", ")", ")", "{", "if", "(", "tc", ".", "position", ".", "onLambda", "==", "tree", ")", "{", "lambdaTypeAnnos", ".", "append", "(", "tc", ")", ";", "}", "else", "{", "ownerTypeAnnos", ".", "append", "(", "tc", ")", ";", "}", "}", "if", "(", "lambdaTypeAnnos", ".", "nonEmpty", "(", ")", ")", "{", "owner", ".", "accept", "(", "ownerTypeAnnos", ".", "toList", "(", ")", ")", ";", "lambda", ".", "accept", "(", "lambdaTypeAnnos", ".", "toList", "(", ")", ")", ";", "}", "}" ]
Reassign type annotations from the source that should really belong to the lambda
[ "Reassign", "type", "annotations", "from", "the", "source", "that", "should", "really", "belong", "to", "the", "lambda" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java#L379-L398
5,154
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
LambdaToMethod.visitReference
@Override public void visitReference(JCMemberReference tree) { ReferenceTranslationContext localContext = (ReferenceTranslationContext)context; //first determine the method symbol to be used to generate the sam instance //this is either the method reference symbol, or the bridged reference symbol Symbol refSym = localContext.isSignaturePolymorphic() ? localContext.sigPolySym : tree.sym; //the qualifying expression is treated as a special captured arg JCExpression init; switch(tree.kind) { case IMPLICIT_INNER: /** Inner :: new */ case SUPER: /** super :: instMethod */ init = makeThis( localContext.owner.enclClass().asType(), localContext.owner.enclClass()); break; case BOUND: /** Expr :: instMethod */ init = tree.getQualifierExpression(); init = attr.makeNullCheck(init); break; case UNBOUND: /** Type :: instMethod */ case STATIC: /** Type :: staticMethod */ case TOPLEVEL: /** Top level :: new */ case ARRAY_CTOR: /** ArrayType :: new */ init = null; break; default: throw new InternalError("Should not have an invalid kind"); } List<JCExpression> indy_args = init==null? List.nil() : translate(List.of(init), localContext.prev); //build a sam instance using an indy call to the meta-factory result = makeMetafactoryIndyCall(localContext, localContext.referenceKind(), refSym, indy_args); }
java
@Override public void visitReference(JCMemberReference tree) { ReferenceTranslationContext localContext = (ReferenceTranslationContext)context; //first determine the method symbol to be used to generate the sam instance //this is either the method reference symbol, or the bridged reference symbol Symbol refSym = localContext.isSignaturePolymorphic() ? localContext.sigPolySym : tree.sym; //the qualifying expression is treated as a special captured arg JCExpression init; switch(tree.kind) { case IMPLICIT_INNER: /** Inner :: new */ case SUPER: /** super :: instMethod */ init = makeThis( localContext.owner.enclClass().asType(), localContext.owner.enclClass()); break; case BOUND: /** Expr :: instMethod */ init = tree.getQualifierExpression(); init = attr.makeNullCheck(init); break; case UNBOUND: /** Type :: instMethod */ case STATIC: /** Type :: staticMethod */ case TOPLEVEL: /** Top level :: new */ case ARRAY_CTOR: /** ArrayType :: new */ init = null; break; default: throw new InternalError("Should not have an invalid kind"); } List<JCExpression> indy_args = init==null? List.nil() : translate(List.of(init), localContext.prev); //build a sam instance using an indy call to the meta-factory result = makeMetafactoryIndyCall(localContext, localContext.referenceKind(), refSym, indy_args); }
[ "@", "Override", "public", "void", "visitReference", "(", "JCMemberReference", "tree", ")", "{", "ReferenceTranslationContext", "localContext", "=", "(", "ReferenceTranslationContext", ")", "context", ";", "//first determine the method symbol to be used to generate the sam instance", "//this is either the method reference symbol, or the bridged reference symbol", "Symbol", "refSym", "=", "localContext", ".", "isSignaturePolymorphic", "(", ")", "?", "localContext", ".", "sigPolySym", ":", "tree", ".", "sym", ";", "//the qualifying expression is treated as a special captured arg", "JCExpression", "init", ";", "switch", "(", "tree", ".", "kind", ")", "{", "case", "IMPLICIT_INNER", ":", "/** Inner :: new */", "case", "SUPER", ":", "/** super :: instMethod */", "init", "=", "makeThis", "(", "localContext", ".", "owner", ".", "enclClass", "(", ")", ".", "asType", "(", ")", ",", "localContext", ".", "owner", ".", "enclClass", "(", ")", ")", ";", "break", ";", "case", "BOUND", ":", "/** Expr :: instMethod */", "init", "=", "tree", ".", "getQualifierExpression", "(", ")", ";", "init", "=", "attr", ".", "makeNullCheck", "(", "init", ")", ";", "break", ";", "case", "UNBOUND", ":", "/** Type :: instMethod */", "case", "STATIC", ":", "/** Type :: staticMethod */", "case", "TOPLEVEL", ":", "/** Top level :: new */", "case", "ARRAY_CTOR", ":", "/** ArrayType :: new */", "init", "=", "null", ";", "break", ";", "default", ":", "throw", "new", "InternalError", "(", "\"Should not have an invalid kind\"", ")", ";", "}", "List", "<", "JCExpression", ">", "indy_args", "=", "init", "==", "null", "?", "List", ".", "nil", "(", ")", ":", "translate", "(", "List", ".", "of", "(", "init", ")", ",", "localContext", ".", "prev", ")", ";", "//build a sam instance using an indy call to the meta-factory", "result", "=", "makeMetafactoryIndyCall", "(", "localContext", ",", "localContext", ".", "referenceKind", "(", ")", ",", "refSym", ",", "indy_args", ")", ";", "}" ]
Translate a method reference into an invokedynamic call to the meta-factory. @param tree
[ "Translate", "a", "method", "reference", "into", "an", "invokedynamic", "call", "to", "the", "meta", "-", "factory", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java#L413-L455
5,155
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
LambdaToMethod.visitIdent
@Override public void visitIdent(JCIdent tree) { if (context == null || !analyzer.lambdaIdentSymbolFilter(tree.sym)) { super.visitIdent(tree); } else { int prevPos = make.pos; try { make.at(tree); LambdaTranslationContext lambdaContext = (LambdaTranslationContext) context; JCTree ltree = lambdaContext.translate(tree); if (ltree != null) { result = ltree; } else { //access to untranslated symbols (i.e. compile-time constants, //members defined inside the lambda body, etc.) ) super.visitIdent(tree); } } finally { make.at(prevPos); } } }
java
@Override public void visitIdent(JCIdent tree) { if (context == null || !analyzer.lambdaIdentSymbolFilter(tree.sym)) { super.visitIdent(tree); } else { int prevPos = make.pos; try { make.at(tree); LambdaTranslationContext lambdaContext = (LambdaTranslationContext) context; JCTree ltree = lambdaContext.translate(tree); if (ltree != null) { result = ltree; } else { //access to untranslated symbols (i.e. compile-time constants, //members defined inside the lambda body, etc.) ) super.visitIdent(tree); } } finally { make.at(prevPos); } } }
[ "@", "Override", "public", "void", "visitIdent", "(", "JCIdent", "tree", ")", "{", "if", "(", "context", "==", "null", "||", "!", "analyzer", ".", "lambdaIdentSymbolFilter", "(", "tree", ".", "sym", ")", ")", "{", "super", ".", "visitIdent", "(", "tree", ")", ";", "}", "else", "{", "int", "prevPos", "=", "make", ".", "pos", ";", "try", "{", "make", ".", "at", "(", "tree", ")", ";", "LambdaTranslationContext", "lambdaContext", "=", "(", "LambdaTranslationContext", ")", "context", ";", "JCTree", "ltree", "=", "lambdaContext", ".", "translate", "(", "tree", ")", ";", "if", "(", "ltree", "!=", "null", ")", "{", "result", "=", "ltree", ";", "}", "else", "{", "//access to untranslated symbols (i.e. compile-time constants,", "//members defined inside the lambda body, etc.) )", "super", ".", "visitIdent", "(", "tree", ")", ";", "}", "}", "finally", "{", "make", ".", "at", "(", "prevPos", ")", ";", "}", "}", "}" ]
Translate identifiers within a lambda to the mapped identifier @param tree
[ "Translate", "identifiers", "within", "a", "lambda", "to", "the", "mapped", "identifier" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java#L461-L483
5,156
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
LambdaToMethod.visitSelect
@Override public void visitSelect(JCFieldAccess tree) { if (context == null || !analyzer.lambdaFieldAccessFilter(tree)) { super.visitSelect(tree); } else { int prevPos = make.pos; try { make.at(tree); LambdaTranslationContext lambdaContext = (LambdaTranslationContext) context; JCTree ltree = lambdaContext.translate(tree); if (ltree != null) { result = ltree; } else { super.visitSelect(tree); } } finally { make.at(prevPos); } } }
java
@Override public void visitSelect(JCFieldAccess tree) { if (context == null || !analyzer.lambdaFieldAccessFilter(tree)) { super.visitSelect(tree); } else { int prevPos = make.pos; try { make.at(tree); LambdaTranslationContext lambdaContext = (LambdaTranslationContext) context; JCTree ltree = lambdaContext.translate(tree); if (ltree != null) { result = ltree; } else { super.visitSelect(tree); } } finally { make.at(prevPos); } } }
[ "@", "Override", "public", "void", "visitSelect", "(", "JCFieldAccess", "tree", ")", "{", "if", "(", "context", "==", "null", "||", "!", "analyzer", ".", "lambdaFieldAccessFilter", "(", "tree", ")", ")", "{", "super", ".", "visitSelect", "(", "tree", ")", ";", "}", "else", "{", "int", "prevPos", "=", "make", ".", "pos", ";", "try", "{", "make", ".", "at", "(", "tree", ")", ";", "LambdaTranslationContext", "lambdaContext", "=", "(", "LambdaTranslationContext", ")", "context", ";", "JCTree", "ltree", "=", "lambdaContext", ".", "translate", "(", "tree", ")", ";", "if", "(", "ltree", "!=", "null", ")", "{", "result", "=", "ltree", ";", "}", "else", "{", "super", ".", "visitSelect", "(", "tree", ")", ";", "}", "}", "finally", "{", "make", ".", "at", "(", "prevPos", ")", ";", "}", "}", "}" ]
Translate qualified `this' references within a lambda to the mapped identifier @param tree
[ "Translate", "qualified", "this", "references", "within", "a", "lambda", "to", "the", "mapped", "identifier" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java#L489-L509
5,157
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
LambdaToMethod.makePrivateSyntheticMethod
private MethodSymbol makePrivateSyntheticMethod(long flags, Name name, Type type, Symbol owner) { return new MethodSymbol(flags | SYNTHETIC | PRIVATE, name, type, owner); }
java
private MethodSymbol makePrivateSyntheticMethod(long flags, Name name, Type type, Symbol owner) { return new MethodSymbol(flags | SYNTHETIC | PRIVATE, name, type, owner); }
[ "private", "MethodSymbol", "makePrivateSyntheticMethod", "(", "long", "flags", ",", "Name", "name", ",", "Type", "type", ",", "Symbol", "owner", ")", "{", "return", "new", "MethodSymbol", "(", "flags", "|", "SYNTHETIC", "|", "PRIVATE", ",", "name", ",", "type", ",", "owner", ")", ";", "}" ]
Create new synthetic method with given flags, name, type, owner
[ "Create", "new", "synthetic", "method", "with", "given", "flags", "name", "type", "owner" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java#L768-L770
5,158
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
LambdaToMethod.referenceKind
private int referenceKind(Symbol refSym) { if (refSym.isConstructor()) { return ClassFile.REF_newInvokeSpecial; } else { if (refSym.isStatic()) { return ClassFile.REF_invokeStatic; } else if ((refSym.flags() & PRIVATE) != 0) { return ClassFile.REF_invokeSpecial; } else if (refSym.enclClass().isInterface()) { return ClassFile.REF_invokeInterface; } else { return ClassFile.REF_invokeVirtual; } } }
java
private int referenceKind(Symbol refSym) { if (refSym.isConstructor()) { return ClassFile.REF_newInvokeSpecial; } else { if (refSym.isStatic()) { return ClassFile.REF_invokeStatic; } else if ((refSym.flags() & PRIVATE) != 0) { return ClassFile.REF_invokeSpecial; } else if (refSym.enclClass().isInterface()) { return ClassFile.REF_invokeInterface; } else { return ClassFile.REF_invokeVirtual; } } }
[ "private", "int", "referenceKind", "(", "Symbol", "refSym", ")", "{", "if", "(", "refSym", ".", "isConstructor", "(", ")", ")", "{", "return", "ClassFile", ".", "REF_newInvokeSpecial", ";", "}", "else", "{", "if", "(", "refSym", ".", "isStatic", "(", ")", ")", "{", "return", "ClassFile", ".", "REF_invokeStatic", ";", "}", "else", "if", "(", "(", "refSym", ".", "flags", "(", ")", "&", "PRIVATE", ")", "!=", "0", ")", "{", "return", "ClassFile", ".", "REF_invokeSpecial", ";", "}", "else", "if", "(", "refSym", ".", "enclClass", "(", ")", ".", "isInterface", "(", ")", ")", "{", "return", "ClassFile", ".", "REF_invokeInterface", ";", "}", "else", "{", "return", "ClassFile", ".", "REF_invokeVirtual", ";", "}", "}", "}" ]
Get the opcode associated with this method reference
[ "Get", "the", "opcode", "associated", "with", "this", "method", "reference" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java#L1171-L1185
5,159
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java
TaskFactory.parse
ParseTask parse(final String source) { ParseTask pt = state.taskFactory.new ParseTask(source, false); if (!pt.units().isEmpty() && pt.units().get(0).getKind() == Kind.EXPRESSION_STATEMENT && pt.getDiagnostics().hasOtherThanNotStatementErrors()) { // It failed, it may be an expression being incorrectly // parsed as having a leading type variable, example: a < b // Try forcing interpretation as an expression ParseTask ept = state.taskFactory.new ParseTask(source, true); if (!ept.getDiagnostics().hasOtherThanNotStatementErrors()) { return ept; } } return pt; }
java
ParseTask parse(final String source) { ParseTask pt = state.taskFactory.new ParseTask(source, false); if (!pt.units().isEmpty() && pt.units().get(0).getKind() == Kind.EXPRESSION_STATEMENT && pt.getDiagnostics().hasOtherThanNotStatementErrors()) { // It failed, it may be an expression being incorrectly // parsed as having a leading type variable, example: a < b // Try forcing interpretation as an expression ParseTask ept = state.taskFactory.new ParseTask(source, true); if (!ept.getDiagnostics().hasOtherThanNotStatementErrors()) { return ept; } } return pt; }
[ "ParseTask", "parse", "(", "final", "String", "source", ")", "{", "ParseTask", "pt", "=", "state", ".", "taskFactory", ".", "new", "ParseTask", "(", "source", ",", "false", ")", ";", "if", "(", "!", "pt", ".", "units", "(", ")", ".", "isEmpty", "(", ")", "&&", "pt", ".", "units", "(", ")", ".", "get", "(", "0", ")", ".", "getKind", "(", ")", "==", "Kind", ".", "EXPRESSION_STATEMENT", "&&", "pt", ".", "getDiagnostics", "(", ")", ".", "hasOtherThanNotStatementErrors", "(", ")", ")", "{", "// It failed, it may be an expression being incorrectly", "// parsed as having a leading type variable, example: a < b", "// Try forcing interpretation as an expression", "ParseTask", "ept", "=", "state", ".", "taskFactory", ".", "new", "ParseTask", "(", "source", ",", "true", ")", ";", "if", "(", "!", "ept", ".", "getDiagnostics", "(", ")", ".", "hasOtherThanNotStatementErrors", "(", ")", ")", "{", "return", "ept", ";", "}", "}", "return", "pt", ";", "}" ]
Parse a snippet and return our parse task handler
[ "Parse", "a", "snippet", "and", "return", "our", "parse", "task", "handler" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java#L105-L119
5,160
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java
InternalDebugControl.isDebugEnabled
public static boolean isDebugEnabled(JShell state, int flag) { if (debugMap == null) { return false; } Integer flags = debugMap.get(state); if (flags == null) { return false; } return (flags & flag) != 0; }
java
public static boolean isDebugEnabled(JShell state, int flag) { if (debugMap == null) { return false; } Integer flags = debugMap.get(state); if (flags == null) { return false; } return (flags & flag) != 0; }
[ "public", "static", "boolean", "isDebugEnabled", "(", "JShell", "state", ",", "int", "flag", ")", "{", "if", "(", "debugMap", "==", "null", ")", "{", "return", "false", ";", "}", "Integer", "flags", "=", "debugMap", ".", "get", "(", "state", ")", ";", "if", "(", "flags", "==", "null", ")", "{", "return", "false", ";", "}", "return", "(", "flags", "&", "flag", ")", "!=", "0", ";", "}" ]
Tests if any of the specified debug flags are enabled. @param state the JShell instance @param flag the {@code DBG_*} bits to check @return true if any of the flags are enabled
[ "Tests", "if", "any", "of", "the", "specified", "debug", "flags", "are", "enabled", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java#L110-L119
5,161
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java
InternalDebugControl.debug
public static void debug(JShell state, PrintStream err, int flags, String format, Object... args) { if (isDebugEnabled(state, flags)) { err.printf(format, args); } }
java
public static void debug(JShell state, PrintStream err, int flags, String format, Object... args) { if (isDebugEnabled(state, flags)) { err.printf(format, args); } }
[ "public", "static", "void", "debug", "(", "JShell", "state", ",", "PrintStream", "err", ",", "int", "flags", ",", "String", "format", ",", "Object", "...", "args", ")", "{", "if", "(", "isDebugEnabled", "(", "state", ",", "flags", ")", ")", "{", "err", ".", "printf", "(", "format", ",", "args", ")", ";", "}", "}" ]
Displays debug info if the specified debug flags are enabled. @param state the current JShell instance @param err the {@code PrintStream} to report on @param flags {@code DBG_*} flag bits to check @param format format string for the output @param args args for the format string
[ "Displays", "debug", "info", "if", "the", "specified", "debug", "flags", "are", "enabled", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java#L130-L134
5,162
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java
InternalDebugControl.debug
public static void debug(JShell state, PrintStream err, Exception ex, String where) { if (isDebugEnabled(state, 0xFFFFFFFF)) { err.printf("Fatal error: %s: %s\n", where, ex.getMessage()); ex.printStackTrace(err); } }
java
public static void debug(JShell state, PrintStream err, Exception ex, String where) { if (isDebugEnabled(state, 0xFFFFFFFF)) { err.printf("Fatal error: %s: %s\n", where, ex.getMessage()); ex.printStackTrace(err); } }
[ "public", "static", "void", "debug", "(", "JShell", "state", ",", "PrintStream", "err", ",", "Exception", "ex", ",", "String", "where", ")", "{", "if", "(", "isDebugEnabled", "(", "state", ",", "0xFFFFFFFF", ")", ")", "{", "err", ".", "printf", "(", "\"Fatal error: %s: %s\\n\"", ",", "where", ",", "ex", ".", "getMessage", "(", ")", ")", ";", "ex", ".", "printStackTrace", "(", "err", ")", ";", "}", "}" ]
Displays a fatal exception as debug info. @param state the current JShell instance @param err the {@code PrintStream} to report on @param ex the fatal Exception @param where additional context
[ "Displays", "a", "fatal", "exception", "as", "debug", "info", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java#L144-L149
5,163
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
ConstantsSummaryWriterImpl.addConstantMember
private void addConstantMember(FieldDoc member, HtmlTree trTree) { trTree.addContent(getTypeColumn(member)); trTree.addContent(getNameColumn(member)); trTree.addContent(getValue(member)); }
java
private void addConstantMember(FieldDoc member, HtmlTree trTree) { trTree.addContent(getTypeColumn(member)); trTree.addContent(getNameColumn(member)); trTree.addContent(getValue(member)); }
[ "private", "void", "addConstantMember", "(", "FieldDoc", "member", ",", "HtmlTree", "trTree", ")", "{", "trTree", ".", "addContent", "(", "getTypeColumn", "(", "member", ")", ")", ";", "trTree", ".", "addContent", "(", "getNameColumn", "(", "member", ")", ")", ";", "trTree", ".", "addContent", "(", "getValue", "(", "member", ")", ")", ";", "}" ]
Add the row for the constant summary table. @param member the field to be documented. @param trTree an htmltree object for the table row
[ "Add", "the", "row", "for", "the", "constant", "summary", "table", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java#L289-L293
5,164
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPath.java
DocPath.create
public static DocPath create(String p) { return (p == null) || p.isEmpty() ? empty : new DocPath(p); }
java
public static DocPath create(String p) { return (p == null) || p.isEmpty() ? empty : new DocPath(p); }
[ "public", "static", "DocPath", "create", "(", "String", "p", ")", "{", "return", "(", "p", "==", "null", ")", "||", "p", ".", "isEmpty", "(", ")", "?", "empty", ":", "new", "DocPath", "(", "p", ")", ";", "}" ]
Create a path from a string.
[ "Create", "a", "path", "from", "a", "string", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPath.java#L53-L55
5,165
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPath.java
DocPath.resolve
public DocPath resolve(String p) { if (p == null || p.isEmpty()) return this; if (path.isEmpty()) return new DocPath(p); return new DocPath(path + "/" + p); }
java
public DocPath resolve(String p) { if (p == null || p.isEmpty()) return this; if (path.isEmpty()) return new DocPath(p); return new DocPath(path + "/" + p); }
[ "public", "DocPath", "resolve", "(", "String", "p", ")", "{", "if", "(", "p", "==", "null", "||", "p", ".", "isEmpty", "(", ")", ")", "return", "this", ";", "if", "(", "path", ".", "isEmpty", "(", ")", ")", "return", "new", "DocPath", "(", "p", ")", ";", "return", "new", "DocPath", "(", "path", "+", "\"/\"", "+", "p", ")", ";", "}" ]
Return the path formed by appending the specified string to the current path.
[ "Return", "the", "path", "formed", "by", "appending", "the", "specified", "string", "to", "the", "current", "path", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPath.java#L142-L148
5,166
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPath.java
DocPath.resolve
public DocPath resolve(DocPath p) { if (p == null || p.isEmpty()) return this; if (path.isEmpty()) return p; return new DocPath(path + "/" + p.getPath()); }
java
public DocPath resolve(DocPath p) { if (p == null || p.isEmpty()) return this; if (path.isEmpty()) return p; return new DocPath(path + "/" + p.getPath()); }
[ "public", "DocPath", "resolve", "(", "DocPath", "p", ")", "{", "if", "(", "p", "==", "null", "||", "p", ".", "isEmpty", "(", ")", ")", "return", "this", ";", "if", "(", "path", ".", "isEmpty", "(", ")", ")", "return", "p", ";", "return", "new", "DocPath", "(", "path", "+", "\"/\"", "+", "p", ".", "getPath", "(", ")", ")", ";", "}" ]
Return the path by appending the specified path to the current path.
[ "Return", "the", "path", "by", "appending", "the", "specified", "path", "to", "the", "current", "path", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPath.java#L153-L159
5,167
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/ClassTracker.java
ClassTracker.setCurrentBytes
void setCurrentBytes(String className, byte[] bytes) { ClassInfo ci = get(className); ci.setCurrentBytes(bytes); }
java
void setCurrentBytes(String className, byte[] bytes) { ClassInfo ci = get(className); ci.setCurrentBytes(bytes); }
[ "void", "setCurrentBytes", "(", "String", "className", ",", "byte", "[", "]", "bytes", ")", "{", "ClassInfo", "ci", "=", "get", "(", "className", ")", ";", "ci", ".", "setCurrentBytes", "(", "bytes", ")", ";", "}" ]
Map a class name to the current compiled class bytes.
[ "Map", "a", "class", "name", "to", "the", "current", "compiled", "class", "bytes", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/ClassTracker.java#L122-L125
5,168
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolEnvironment.java
ToolEnvironment.loadClass
public TypeElement loadClass(String name) { try { Name nameImpl = names.fromString(name); ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl)); ClassSymbol c = finder.loadClass(mod != null ? mod : syms.errModule, nameImpl); return c; } catch (CompletionFailure ex) { chk.completionError(null, ex); return null; } }
java
public TypeElement loadClass(String name) { try { Name nameImpl = names.fromString(name); ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl)); ClassSymbol c = finder.loadClass(mod != null ? mod : syms.errModule, nameImpl); return c; } catch (CompletionFailure ex) { chk.completionError(null, ex); return null; } }
[ "public", "TypeElement", "loadClass", "(", "String", "name", ")", "{", "try", "{", "Name", "nameImpl", "=", "names", ".", "fromString", "(", "name", ")", ";", "ModuleSymbol", "mod", "=", "syms", ".", "inferModule", "(", "Convert", ".", "packagePart", "(", "nameImpl", ")", ")", ";", "ClassSymbol", "c", "=", "finder", ".", "loadClass", "(", "mod", "!=", "null", "?", "mod", ":", "syms", ".", "errModule", ",", "nameImpl", ")", ";", "return", "c", ";", "}", "catch", "(", "CompletionFailure", "ex", ")", "{", "chk", ".", "completionError", "(", "null", ",", "ex", ")", ";", "return", "null", ";", "}", "}" ]
Load a class by qualified name.
[ "Load", "a", "class", "by", "qualified", "name", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolEnvironment.java#L173-L183
5,169
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/api/MultiTaskListener.java
MultiTaskListener.instance
public static MultiTaskListener instance(Context context) { MultiTaskListener instance = context.get(taskListenerKey); if (instance == null) instance = new MultiTaskListener(context); return instance; }
java
public static MultiTaskListener instance(Context context) { MultiTaskListener instance = context.get(taskListenerKey); if (instance == null) instance = new MultiTaskListener(context); return instance; }
[ "public", "static", "MultiTaskListener", "instance", "(", "Context", "context", ")", "{", "MultiTaskListener", "instance", "=", "context", ".", "get", "(", "taskListenerKey", ")", ";", "if", "(", "instance", "==", "null", ")", "instance", "=", "new", "MultiTaskListener", "(", "context", ")", ";", "return", "instance", ";", "}" ]
Get the MultiTaskListener instance for this context.
[ "Get", "the", "MultiTaskListener", "instance", "for", "this", "context", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/api/MultiTaskListener.java#L54-L59
5,170
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java
BaseFileManager.handleOption
public boolean handleOption(Option option, String value) { switch (option) { case ENCODING: encodingName = value; return true; case MULTIRELEASE: multiReleaseValue = value; locations.setMultiReleaseValue(value); return true; default: return locations.handleOption(option, value); } }
java
public boolean handleOption(Option option, String value) { switch (option) { case ENCODING: encodingName = value; return true; case MULTIRELEASE: multiReleaseValue = value; locations.setMultiReleaseValue(value); return true; default: return locations.handleOption(option, value); } }
[ "public", "boolean", "handleOption", "(", "Option", "option", ",", "String", "value", ")", "{", "switch", "(", "option", ")", "{", "case", "ENCODING", ":", "encodingName", "=", "value", ";", "return", "true", ";", "case", "MULTIRELEASE", ":", "multiReleaseValue", "=", "value", ";", "locations", ".", "setMultiReleaseValue", "(", "value", ")", ";", "return", "true", ";", "default", ":", "return", "locations", ".", "handleOption", "(", "option", ",", "value", ")", ";", "}", "}" ]
Common back end for OptionHelper handleFileManagerOption. @param option the option whose value to be set @param value the value for the option @return true if successful, and false otherwise
[ "Common", "back", "end", "for", "OptionHelper", "handleFileManagerOption", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java#L257-L271
5,171
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java
BaseFileManager.handleOptions
public boolean handleOptions(Map<Option, String> map) { boolean ok = true; for (Map.Entry<Option, String> e: map.entrySet()) { try { ok = ok & handleOption(e.getKey(), e.getValue()); } catch (IllegalArgumentException ex) { log.error(Errors.IllegalArgumentForOption(e.getKey().getPrimaryName(), ex.getMessage())); ok = false; } } return ok; }
java
public boolean handleOptions(Map<Option, String> map) { boolean ok = true; for (Map.Entry<Option, String> e: map.entrySet()) { try { ok = ok & handleOption(e.getKey(), e.getValue()); } catch (IllegalArgumentException ex) { log.error(Errors.IllegalArgumentForOption(e.getKey().getPrimaryName(), ex.getMessage())); ok = false; } } return ok; }
[ "public", "boolean", "handleOptions", "(", "Map", "<", "Option", ",", "String", ">", "map", ")", "{", "boolean", "ok", "=", "true", ";", "for", "(", "Map", ".", "Entry", "<", "Option", ",", "String", ">", "e", ":", "map", ".", "entrySet", "(", ")", ")", "{", "try", "{", "ok", "=", "ok", "&", "handleOption", "(", "e", ".", "getKey", "(", ")", ",", "e", ".", "getValue", "(", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "ex", ")", "{", "log", ".", "error", "(", "Errors", ".", "IllegalArgumentForOption", "(", "e", ".", "getKey", "(", ")", ".", "getPrimaryName", "(", ")", ",", "ex", ".", "getMessage", "(", ")", ")", ")", ";", "ok", "=", "false", ";", "}", "}", "return", "ok", ";", "}" ]
Call handleOption for collection of options and corresponding values. @param map a collection of options and corresponding values @return true if all the calls are successful
[ "Call", "handleOption", "for", "collection", "of", "options", "and", "corresponding", "values", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java#L278-L289
5,172
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java
JCDiagnostic.getSource
@DefinedBy(Api.COMPILER) public JavaFileObject getSource() { if (source == null) return null; else return source.getFile(); }
java
@DefinedBy(Api.COMPILER) public JavaFileObject getSource() { if (source == null) return null; else return source.getFile(); }
[ "@", "DefinedBy", "(", "Api", ".", "COMPILER", ")", "public", "JavaFileObject", "getSource", "(", ")", "{", "if", "(", "source", "==", "null", ")", "return", "null", ";", "else", "return", "source", ".", "getFile", "(", ")", ";", "}" ]
Get the name of the source file referred to by this diagnostic. @return the name of the source referred to with this diagnostic, or null if none
[ "Get", "the", "name", "of", "the", "source", "file", "referred", "to", "by", "this", "diagnostic", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java#L639-L645
5,173
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java
JCDiagnostic.getLineNumber
@DefinedBy(Api.COMPILER) public long getLineNumber() { if (sourcePosition == null) { sourcePosition = new SourcePosition(); } return sourcePosition.getLineNumber(); }
java
@DefinedBy(Api.COMPILER) public long getLineNumber() { if (sourcePosition == null) { sourcePosition = new SourcePosition(); } return sourcePosition.getLineNumber(); }
[ "@", "DefinedBy", "(", "Api", ".", "COMPILER", ")", "public", "long", "getLineNumber", "(", ")", "{", "if", "(", "sourcePosition", "==", "null", ")", "{", "sourcePosition", "=", "new", "SourcePosition", "(", ")", ";", "}", "return", "sourcePosition", ".", "getLineNumber", "(", ")", ";", "}" ]
Get the line number within the source referred to by this diagnostic. @return the line number within the source referred to by this diagnostic
[ "Get", "the", "line", "number", "within", "the", "source", "referred", "to", "by", "this", "diagnostic", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java#L690-L696
5,174
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java
JCDiagnostic.getColumnNumber
@DefinedBy(Api.COMPILER) public long getColumnNumber() { if (sourcePosition == null) { sourcePosition = new SourcePosition(); } return sourcePosition.getColumnNumber(); }
java
@DefinedBy(Api.COMPILER) public long getColumnNumber() { if (sourcePosition == null) { sourcePosition = new SourcePosition(); } return sourcePosition.getColumnNumber(); }
[ "@", "DefinedBy", "(", "Api", ".", "COMPILER", ")", "public", "long", "getColumnNumber", "(", ")", "{", "if", "(", "sourcePosition", "==", "null", ")", "{", "sourcePosition", "=", "new", "SourcePosition", "(", ")", ";", "}", "return", "sourcePosition", ".", "getColumnNumber", "(", ")", ";", "}" ]
Get the column number within the line of source referred to by this diagnostic. @return the column number within the line of source referred to by this diagnostic
[ "Get", "the", "column", "number", "within", "the", "line", "of", "source", "referred", "to", "by", "this", "diagnostic", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java#L702-L708
5,175
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/MatchingUtils.java
MatchingUtils.isValidImportString
public static boolean isValidImportString(String s) { if (s.equals("*")) return true; boolean valid = true; String t = s; int index = t.indexOf('*'); if (index != -1) { // '*' must be last character... if (index == t.length() -1) { // ... any and preceding character must be '.' if ( index-1 >= 0 ) { valid = t.charAt(index-1) == '.'; // Strip off ".*$" for identifier checks t = t.substring(0, t.length()-2); } } else return false; } // Verify string is off the form (javaId \.)+ or javaId if (valid) { String[] javaIds = t.split("\\.", t.length()+2); for(String javaId: javaIds) valid &= SourceVersion.isIdentifier(javaId); } return valid; }
java
public static boolean isValidImportString(String s) { if (s.equals("*")) return true; boolean valid = true; String t = s; int index = t.indexOf('*'); if (index != -1) { // '*' must be last character... if (index == t.length() -1) { // ... any and preceding character must be '.' if ( index-1 >= 0 ) { valid = t.charAt(index-1) == '.'; // Strip off ".*$" for identifier checks t = t.substring(0, t.length()-2); } } else return false; } // Verify string is off the form (javaId \.)+ or javaId if (valid) { String[] javaIds = t.split("\\.", t.length()+2); for(String javaId: javaIds) valid &= SourceVersion.isIdentifier(javaId); } return valid; }
[ "public", "static", "boolean", "isValidImportString", "(", "String", "s", ")", "{", "if", "(", "s", ".", "equals", "(", "\"*\"", ")", ")", "return", "true", ";", "boolean", "valid", "=", "true", ";", "String", "t", "=", "s", ";", "int", "index", "=", "t", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "// '*' must be last character...", "if", "(", "index", "==", "t", ".", "length", "(", ")", "-", "1", ")", "{", "// ... any and preceding character must be '.'", "if", "(", "index", "-", "1", ">=", "0", ")", "{", "valid", "=", "t", ".", "charAt", "(", "index", "-", "1", ")", "==", "'", "'", ";", "// Strip off \".*$\" for identifier checks", "t", "=", "t", ".", "substring", "(", "0", ",", "t", ".", "length", "(", ")", "-", "2", ")", ";", "}", "}", "else", "return", "false", ";", "}", "// Verify string is off the form (javaId \\.)+ or javaId", "if", "(", "valid", ")", "{", "String", "[", "]", "javaIds", "=", "t", ".", "split", "(", "\"\\\\.\"", ",", "t", ".", "length", "(", ")", "+", "2", ")", ";", "for", "(", "String", "javaId", ":", "javaIds", ")", "valid", "&=", "SourceVersion", ".", "isIdentifier", "(", "javaId", ")", ";", "}", "return", "valid", ";", "}" ]
Return true if the argument string is a valid import-style string specifying claimed annotations; return false otherwise.
[ "Return", "true", "if", "the", "argument", "string", "is", "a", "valid", "import", "-", "style", "string", "specifying", "claimed", "annotations", ";", "return", "false", "otherwise", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MatchingUtils.java#L47-L75
5,176
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java
PackageSummaryBuilder.buildPackageDescription
public void buildPackageDescription(XMLNode node, Content packageContentTree) { if (configuration.nocomment) { return; } packageWriter.addPackageDescription(packageContentTree); }
java
public void buildPackageDescription(XMLNode node, Content packageContentTree) { if (configuration.nocomment) { return; } packageWriter.addPackageDescription(packageContentTree); }
[ "public", "void", "buildPackageDescription", "(", "XMLNode", "node", ",", "Content", "packageContentTree", ")", "{", "if", "(", "configuration", ".", "nocomment", ")", "{", "return", ";", "}", "packageWriter", ".", "addPackageDescription", "(", "packageContentTree", ")", ";", "}" ]
Build the description of the summary. @param node the XML element that specifies which components to document @param packageContentTree the tree to which the package description will be added
[ "Build", "the", "description", "of", "the", "summary", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java#L334-L339
5,177
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java
AbstractTreeWriter.addLevelInfo
protected void addLevelInfo(TypeElement parent, Collection<TypeElement> collection, boolean isEnum, Content contentTree) { if (!collection.isEmpty()) { Content ul = new HtmlTree(HtmlTag.UL); for (TypeElement local : collection) { HtmlTree li = new HtmlTree(HtmlTag.LI); li.addStyle(HtmlStyle.circle); addPartialInfo(local, li); addExtendsImplements(parent, local, li); addLevelInfo(local, classtree.directSubClasses(local, isEnum), isEnum, li); // Recurse ul.addContent(li); } contentTree.addContent(ul); } }
java
protected void addLevelInfo(TypeElement parent, Collection<TypeElement> collection, boolean isEnum, Content contentTree) { if (!collection.isEmpty()) { Content ul = new HtmlTree(HtmlTag.UL); for (TypeElement local : collection) { HtmlTree li = new HtmlTree(HtmlTag.LI); li.addStyle(HtmlStyle.circle); addPartialInfo(local, li); addExtendsImplements(parent, local, li); addLevelInfo(local, classtree.directSubClasses(local, isEnum), isEnum, li); // Recurse ul.addContent(li); } contentTree.addContent(ul); } }
[ "protected", "void", "addLevelInfo", "(", "TypeElement", "parent", ",", "Collection", "<", "TypeElement", ">", "collection", ",", "boolean", "isEnum", ",", "Content", "contentTree", ")", "{", "if", "(", "!", "collection", ".", "isEmpty", "(", ")", ")", "{", "Content", "ul", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "UL", ")", ";", "for", "(", "TypeElement", "local", ":", "collection", ")", "{", "HtmlTree", "li", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "LI", ")", ";", "li", ".", "addStyle", "(", "HtmlStyle", ".", "circle", ")", ";", "addPartialInfo", "(", "local", ",", "li", ")", ";", "addExtendsImplements", "(", "parent", ",", "local", ",", "li", ")", ";", "addLevelInfo", "(", "local", ",", "classtree", ".", "directSubClasses", "(", "local", ",", "isEnum", ")", ",", "isEnum", ",", "li", ")", ";", "// Recurse", "ul", ".", "addContent", "(", "li", ")", ";", "}", "contentTree", ".", "addContent", "(", "ul", ")", ";", "}", "}" ]
Add each level of the class tree. For each sub-class or sub-interface indents the next level information. Recurses itself to add sub-classes info. @param parent the superclass or superinterface of the sset @param collection a collection of the sub-classes at this level @param isEnum true if we are generating a tree for enums @param contentTree the content tree to which the level information will be added
[ "Add", "each", "level", "of", "the", "class", "tree", ".", "For", "each", "sub", "-", "class", "or", "sub", "-", "interface", "indents", "the", "next", "level", "information", ".", "Recurses", "itself", "to", "add", "sub", "-", "classes", "info", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java#L85-L100
5,178
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java
Gen.wrapWriter
protected PrintWriter wrapWriter(OutputStream o) throws Util.Exit { try { return new PrintWriter(new OutputStreamWriter(o, "ISO8859_1"), true); } catch (UnsupportedEncodingException use) { util.bug("encoding.iso8859_1.not.found"); return null; /* dead code */ } }
java
protected PrintWriter wrapWriter(OutputStream o) throws Util.Exit { try { return new PrintWriter(new OutputStreamWriter(o, "ISO8859_1"), true); } catch (UnsupportedEncodingException use) { util.bug("encoding.iso8859_1.not.found"); return null; /* dead code */ } }
[ "protected", "PrintWriter", "wrapWriter", "(", "OutputStream", "o", ")", "throws", "Util", ".", "Exit", "{", "try", "{", "return", "new", "PrintWriter", "(", "new", "OutputStreamWriter", "(", "o", ",", "\"ISO8859_1\"", ")", ",", "true", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "use", ")", "{", "util", ".", "bug", "(", "\"encoding.iso8859_1.not.found\"", ")", ";", "return", "null", ";", "/* dead code */", "}", "}" ]
We explicitly need to write ASCII files because that is what C compilers understand.
[ "We", "explicitly", "need", "to", "write", "ASCII", "files", "because", "that", "is", "what", "C", "compilers", "understand", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java#L141-L148
5,179
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java
Gen.run
public void run() throws IOException, ClassNotFoundException, Util.Exit { int i = 0; if (outFile != null) { /* Everything goes to one big file... */ ByteArrayOutputStream bout = new ByteArrayOutputStream(8192); writeFileTop(bout); /* only once */ for (TypeElement t: classes) { write(bout, t); } writeIfChanged(bout.toByteArray(), outFile); } else { /* Each class goes to its own file... */ for (TypeElement t: classes) { ByteArrayOutputStream bout = new ByteArrayOutputStream(8192); writeFileTop(bout); write(bout, t); writeIfChanged(bout.toByteArray(), getFileObject(t.getQualifiedName())); } } }
java
public void run() throws IOException, ClassNotFoundException, Util.Exit { int i = 0; if (outFile != null) { /* Everything goes to one big file... */ ByteArrayOutputStream bout = new ByteArrayOutputStream(8192); writeFileTop(bout); /* only once */ for (TypeElement t: classes) { write(bout, t); } writeIfChanged(bout.toByteArray(), outFile); } else { /* Each class goes to its own file... */ for (TypeElement t: classes) { ByteArrayOutputStream bout = new ByteArrayOutputStream(8192); writeFileTop(bout); write(bout, t); writeIfChanged(bout.toByteArray(), getFileObject(t.getQualifiedName())); } } }
[ "public", "void", "run", "(", ")", "throws", "IOException", ",", "ClassNotFoundException", ",", "Util", ".", "Exit", "{", "int", "i", "=", "0", ";", "if", "(", "outFile", "!=", "null", ")", "{", "/* Everything goes to one big file... */", "ByteArrayOutputStream", "bout", "=", "new", "ByteArrayOutputStream", "(", "8192", ")", ";", "writeFileTop", "(", "bout", ")", ";", "/* only once */", "for", "(", "TypeElement", "t", ":", "classes", ")", "{", "write", "(", "bout", ",", "t", ")", ";", "}", "writeIfChanged", "(", "bout", ".", "toByteArray", "(", ")", ",", "outFile", ")", ";", "}", "else", "{", "/* Each class goes to its own file... */", "for", "(", "TypeElement", "t", ":", "classes", ")", "{", "ByteArrayOutputStream", "bout", "=", "new", "ByteArrayOutputStream", "(", "8192", ")", ";", "writeFileTop", "(", "bout", ")", ";", "write", "(", "bout", ",", "t", ")", ";", "writeIfChanged", "(", "bout", ".", "toByteArray", "(", ")", ",", "getFileObject", "(", "t", ".", "getQualifiedName", "(", ")", ")", ")", ";", "}", "}", "}" ]
After initializing state of an instance, use this method to start processing. Buffer size chosen as an approximation from a single sampling of: expr `du -sk` / `ls *.h | wc -l`
[ "After", "initializing", "state", "of", "an", "instance", "use", "this", "method", "to", "start", "processing", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java#L157-L178
5,180
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java
Gen.getAllFields
List<VariableElement> getAllFields(TypeElement subclazz) { List<VariableElement> fields = new ArrayList<>(); TypeElement cd = null; Stack<TypeElement> s = new Stack<>(); cd = subclazz; while (true) { s.push(cd); TypeElement c = (TypeElement) (types.asElement(cd.getSuperclass())); if (c == null) break; cd = c; } while (!s.empty()) { cd = s.pop(); fields.addAll(ElementFilter.fieldsIn(cd.getEnclosedElements())); } return fields; }
java
List<VariableElement> getAllFields(TypeElement subclazz) { List<VariableElement> fields = new ArrayList<>(); TypeElement cd = null; Stack<TypeElement> s = new Stack<>(); cd = subclazz; while (true) { s.push(cd); TypeElement c = (TypeElement) (types.asElement(cd.getSuperclass())); if (c == null) break; cd = c; } while (!s.empty()) { cd = s.pop(); fields.addAll(ElementFilter.fieldsIn(cd.getEnclosedElements())); } return fields; }
[ "List", "<", "VariableElement", ">", "getAllFields", "(", "TypeElement", "subclazz", ")", "{", "List", "<", "VariableElement", ">", "fields", "=", "new", "ArrayList", "<>", "(", ")", ";", "TypeElement", "cd", "=", "null", ";", "Stack", "<", "TypeElement", ">", "s", "=", "new", "Stack", "<>", "(", ")", ";", "cd", "=", "subclazz", ";", "while", "(", "true", ")", "{", "s", ".", "push", "(", "cd", ")", ";", "TypeElement", "c", "=", "(", "TypeElement", ")", "(", "types", ".", "asElement", "(", "cd", ".", "getSuperclass", "(", ")", ")", ")", ";", "if", "(", "c", "==", "null", ")", "break", ";", "cd", "=", "c", ";", "}", "while", "(", "!", "s", ".", "empty", "(", ")", ")", "{", "cd", "=", "s", ".", "pop", "(", ")", ";", "fields", ".", "addAll", "(", "ElementFilter", ".", "fieldsIn", "(", "cd", ".", "getEnclosedElements", "(", ")", ")", ")", ";", "}", "return", "fields", ";", "}" ]
Including super classes' fields.
[ "Including", "super", "classes", "fields", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java#L348-L368
5,181
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java
Gen.signature
String signature(ExecutableElement e) { StringBuilder sb = new StringBuilder("("); String sep = ""; for (VariableElement p: e.getParameters()) { sb.append(sep); sb.append(types.erasure(p.asType()).toString()); sep = ","; } sb.append(")"); return sb.toString(); }
java
String signature(ExecutableElement e) { StringBuilder sb = new StringBuilder("("); String sep = ""; for (VariableElement p: e.getParameters()) { sb.append(sep); sb.append(types.erasure(p.asType()).toString()); sep = ","; } sb.append(")"); return sb.toString(); }
[ "String", "signature", "(", "ExecutableElement", "e", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"(\"", ")", ";", "String", "sep", "=", "\"\"", ";", "for", "(", "VariableElement", "p", ":", "e", ".", "getParameters", "(", ")", ")", "{", "sb", ".", "append", "(", "sep", ")", ";", "sb", ".", "append", "(", "types", ".", "erasure", "(", "p", ".", "asType", "(", ")", ")", ".", "toString", "(", ")", ")", ";", "sep", "=", "\",\"", ";", "}", "sb", ".", "append", "(", "\")\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
c.f. MethodDoc.signature
[ "c", ".", "f", ".", "MethodDoc", ".", "signature" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java#L371-L381
5,182
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java
Util.pkgNameOfClassName
public static String pkgNameOfClassName(String fqClassName) { int i = fqClassName.lastIndexOf('.'); String pkg = i == -1 ? "" : fqClassName.substring(0, i); return ":" + pkg; }
java
public static String pkgNameOfClassName(String fqClassName) { int i = fqClassName.lastIndexOf('.'); String pkg = i == -1 ? "" : fqClassName.substring(0, i); return ":" + pkg; }
[ "public", "static", "String", "pkgNameOfClassName", "(", "String", "fqClassName", ")", "{", "int", "i", "=", "fqClassName", ".", "lastIndexOf", "(", "'", "'", ")", ";", "String", "pkg", "=", "i", "==", "-", "1", "?", "\"\"", ":", "fqClassName", ".", "substring", "(", "0", ",", "i", ")", ";", "return", "\":\"", "+", "pkg", ";", "}" ]
Extract the package name from a fully qualified class name. Example: Given "pkg.subpkg.A" this method returns ":pkg.subpkg". Given "C" this method returns ":". @returns package name of the given class name
[ "Extract", "the", "package", "name", "from", "a", "fully", "qualified", "class", "name", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java#L123-L127
5,183
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java
Util.normalizeDriveLetter
public static String normalizeDriveLetter(String file) { if (file.length() > 2 && file.charAt(1) == ':') { return Character.toUpperCase(file.charAt(0)) + file.substring(1); } else if (file.length() > 3 && file.charAt(0) == '*' && file.charAt(2) == ':') { // Handle a wildcard * at the beginning of the string. return file.substring(0, 1) + Character.toUpperCase(file.charAt(1)) + file.substring(2); } return file; }
java
public static String normalizeDriveLetter(String file) { if (file.length() > 2 && file.charAt(1) == ':') { return Character.toUpperCase(file.charAt(0)) + file.substring(1); } else if (file.length() > 3 && file.charAt(0) == '*' && file.charAt(2) == ':') { // Handle a wildcard * at the beginning of the string. return file.substring(0, 1) + Character.toUpperCase(file.charAt(1)) + file.substring(2); } return file; }
[ "public", "static", "String", "normalizeDriveLetter", "(", "String", "file", ")", "{", "if", "(", "file", ".", "length", "(", ")", ">", "2", "&&", "file", ".", "charAt", "(", "1", ")", "==", "'", "'", ")", "{", "return", "Character", ".", "toUpperCase", "(", "file", ".", "charAt", "(", "0", ")", ")", "+", "file", ".", "substring", "(", "1", ")", ";", "}", "else", "if", "(", "file", ".", "length", "(", ")", ">", "3", "&&", "file", ".", "charAt", "(", "0", ")", "==", "'", "'", "&&", "file", ".", "charAt", "(", "2", ")", "==", "'", "'", ")", "{", "// Handle a wildcard * at the beginning of the string.", "return", "file", ".", "substring", "(", "0", ",", "1", ")", "+", "Character", ".", "toUpperCase", "(", "file", ".", "charAt", "(", "1", ")", ")", "+", "file", ".", "substring", "(", "2", ")", ";", "}", "return", "file", ";", "}" ]
Normalize windows drive letter paths to upper case to enable string comparison. @param file File name to normalize @return The normalized string if file has a drive letter at the beginning, otherwise the original string.
[ "Normalize", "windows", "drive", "letter", "paths", "to", "upper", "case", "to", "enable", "string", "comparison", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java#L174-L184
5,184
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java
Util.findServerSettings
public static String findServerSettings(String[] args) { for (String s : args) { if (s.startsWith("--server:")) { return s; } } return null; }
java
public static String findServerSettings(String[] args) { for (String s : args) { if (s.startsWith("--server:")) { return s; } } return null; }
[ "public", "static", "String", "findServerSettings", "(", "String", "[", "]", "args", ")", "{", "for", "(", "String", "s", ":", "args", ")", "{", "if", "(", "s", ".", "startsWith", "(", "\"--server:\"", ")", ")", "{", "return", "s", ";", "}", "}", "return", "null", ";", "}" ]
Locate the setting for the server properties.
[ "Locate", "the", "setting", "for", "the", "server", "properties", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java#L189-L196
5,185
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/Unit.java
Unit.setWrap
void setWrap(Collection<Unit> exceptUnit, Collection<Unit> plusUnfiltered) { if (isImport()) { si.setOuterWrap(state.outerMap.wrapImport(activeGuts, si)); } else { // Collect Units for be wrapped together. Just this except for overloaded methods List<Unit> units; if (snippet().kind() == Kind.METHOD) { String name = ((MethodSnippet) snippet()).name(); units = plusUnfiltered.stream() .filter(u -> u.snippet().kind() == Kind.METHOD && ((MethodSnippet) u.snippet()).name().equals(name)) .collect(toList()); } else { units = Collections.singletonList(this); } // Keys to exclude from imports Set<Key> except = exceptUnit.stream() .map(u -> u.snippet().key()) .collect(toSet()); // Snippets to add to imports Collection<Snippet> plus = plusUnfiltered.stream() .filter(u -> !units.contains(u)) .map(Unit::snippet) .collect(toList()); // Snippets to wrap in an outer List<Snippet> snippets = units.stream() .map(Unit::snippet) .collect(toList()); // Snippet wraps to wrap in an outer List<Wrap> wraps = units.stream() .map(u -> u.activeGuts) .collect(toList()); // Set the outer wrap for this snippet si.setOuterWrap(state.outerMap.wrapInClass(except, plus, snippets, wraps)); state.debug(DBG_WRAP, "++setWrap() %s\n%s\n", si, si.outerWrap().wrapped()); } }
java
void setWrap(Collection<Unit> exceptUnit, Collection<Unit> plusUnfiltered) { if (isImport()) { si.setOuterWrap(state.outerMap.wrapImport(activeGuts, si)); } else { // Collect Units for be wrapped together. Just this except for overloaded methods List<Unit> units; if (snippet().kind() == Kind.METHOD) { String name = ((MethodSnippet) snippet()).name(); units = plusUnfiltered.stream() .filter(u -> u.snippet().kind() == Kind.METHOD && ((MethodSnippet) u.snippet()).name().equals(name)) .collect(toList()); } else { units = Collections.singletonList(this); } // Keys to exclude from imports Set<Key> except = exceptUnit.stream() .map(u -> u.snippet().key()) .collect(toSet()); // Snippets to add to imports Collection<Snippet> plus = plusUnfiltered.stream() .filter(u -> !units.contains(u)) .map(Unit::snippet) .collect(toList()); // Snippets to wrap in an outer List<Snippet> snippets = units.stream() .map(Unit::snippet) .collect(toList()); // Snippet wraps to wrap in an outer List<Wrap> wraps = units.stream() .map(u -> u.activeGuts) .collect(toList()); // Set the outer wrap for this snippet si.setOuterWrap(state.outerMap.wrapInClass(except, plus, snippets, wraps)); state.debug(DBG_WRAP, "++setWrap() %s\n%s\n", si, si.outerWrap().wrapped()); } }
[ "void", "setWrap", "(", "Collection", "<", "Unit", ">", "exceptUnit", ",", "Collection", "<", "Unit", ">", "plusUnfiltered", ")", "{", "if", "(", "isImport", "(", ")", ")", "{", "si", ".", "setOuterWrap", "(", "state", ".", "outerMap", ".", "wrapImport", "(", "activeGuts", ",", "si", ")", ")", ";", "}", "else", "{", "// Collect Units for be wrapped together. Just this except for overloaded methods", "List", "<", "Unit", ">", "units", ";", "if", "(", "snippet", "(", ")", ".", "kind", "(", ")", "==", "Kind", ".", "METHOD", ")", "{", "String", "name", "=", "(", "(", "MethodSnippet", ")", "snippet", "(", ")", ")", ".", "name", "(", ")", ";", "units", "=", "plusUnfiltered", ".", "stream", "(", ")", ".", "filter", "(", "u", "->", "u", ".", "snippet", "(", ")", ".", "kind", "(", ")", "==", "Kind", ".", "METHOD", "&&", "(", "(", "MethodSnippet", ")", "u", ".", "snippet", "(", ")", ")", ".", "name", "(", ")", ".", "equals", "(", "name", ")", ")", ".", "collect", "(", "toList", "(", ")", ")", ";", "}", "else", "{", "units", "=", "Collections", ".", "singletonList", "(", "this", ")", ";", "}", "// Keys to exclude from imports", "Set", "<", "Key", ">", "except", "=", "exceptUnit", ".", "stream", "(", ")", ".", "map", "(", "u", "->", "u", ".", "snippet", "(", ")", ".", "key", "(", ")", ")", ".", "collect", "(", "toSet", "(", ")", ")", ";", "// Snippets to add to imports", "Collection", "<", "Snippet", ">", "plus", "=", "plusUnfiltered", ".", "stream", "(", ")", ".", "filter", "(", "u", "->", "!", "units", ".", "contains", "(", "u", ")", ")", ".", "map", "(", "Unit", "::", "snippet", ")", ".", "collect", "(", "toList", "(", ")", ")", ";", "// Snippets to wrap in an outer", "List", "<", "Snippet", ">", "snippets", "=", "units", ".", "stream", "(", ")", ".", "map", "(", "Unit", "::", "snippet", ")", ".", "collect", "(", "toList", "(", ")", ")", ";", "// Snippet wraps to wrap in an outer", "List", "<", "Wrap", ">", "wraps", "=", "units", ".", "stream", "(", ")", ".", "map", "(", "u", "->", "u", ".", "activeGuts", ")", ".", "collect", "(", "toList", "(", ")", ")", ";", "// Set the outer wrap for this snippet", "si", ".", "setOuterWrap", "(", "state", ".", "outerMap", ".", "wrapInClass", "(", "except", ",", "plus", ",", "snippets", ",", "wraps", ")", ")", ";", "state", ".", "debug", "(", "DBG_WRAP", ",", "\"++setWrap() %s\\n%s\\n\"", ",", "si", ",", "si", ".", "outerWrap", "(", ")", ".", "wrapped", "(", ")", ")", ";", "}", "}" ]
Set the outer wrap of our Snippet
[ "Set", "the", "outer", "wrap", "of", "our", "Snippet" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/Unit.java#L150-L187
5,186
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/Unit.java
Unit.corralIfNeeded
boolean corralIfNeeded(Collection<Unit> working) { if (isRecoverable() && si.corralled() != null) { activeGuts = si.corralled(); setWrap(working, working); return isAttemptingCorral = true; } return isAttemptingCorral = false; }
java
boolean corralIfNeeded(Collection<Unit> working) { if (isRecoverable() && si.corralled() != null) { activeGuts = si.corralled(); setWrap(working, working); return isAttemptingCorral = true; } return isAttemptingCorral = false; }
[ "boolean", "corralIfNeeded", "(", "Collection", "<", "Unit", ">", "working", ")", "{", "if", "(", "isRecoverable", "(", ")", "&&", "si", ".", "corralled", "(", ")", "!=", "null", ")", "{", "activeGuts", "=", "si", ".", "corralled", "(", ")", ";", "setWrap", "(", "working", ",", "working", ")", ";", "return", "isAttemptingCorral", "=", "true", ";", "}", "return", "isAttemptingCorral", "=", "false", ";", "}" ]
If it meets the conditions for corralling, install the corralled wrap @return true is the corralled wrap was installed
[ "If", "it", "meets", "the", "conditions", "for", "corralling", "install", "the", "corralled", "wrap" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/Unit.java#L216-L224
5,187
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/Unit.java
Unit.classesToLoad
Stream<ClassBytecodes> classesToLoad(List<String> classnames) { toRedefine = new ArrayList<>(); List<ClassBytecodes> toLoad = new ArrayList<>(); if (status.isDefined() && !isImport()) { // Classes should only be loaded/redefined if the compile left them // in a defined state. Imports do not have code and are not loaded. for (String cn : classnames) { ClassInfo ci = state.classTracker.get(cn); if (ci.isLoaded()) { if (ci.isCurrent()) { // nothing to do } else { toRedefine.add(ci); } } else { // If not loaded, add to the list of classes to load. toLoad.add(ci.toClassBytecodes()); dependenciesNeeded = true; } } } return toLoad.stream(); }
java
Stream<ClassBytecodes> classesToLoad(List<String> classnames) { toRedefine = new ArrayList<>(); List<ClassBytecodes> toLoad = new ArrayList<>(); if (status.isDefined() && !isImport()) { // Classes should only be loaded/redefined if the compile left them // in a defined state. Imports do not have code and are not loaded. for (String cn : classnames) { ClassInfo ci = state.classTracker.get(cn); if (ci.isLoaded()) { if (ci.isCurrent()) { // nothing to do } else { toRedefine.add(ci); } } else { // If not loaded, add to the list of classes to load. toLoad.add(ci.toClassBytecodes()); dependenciesNeeded = true; } } } return toLoad.stream(); }
[ "Stream", "<", "ClassBytecodes", ">", "classesToLoad", "(", "List", "<", "String", ">", "classnames", ")", "{", "toRedefine", "=", "new", "ArrayList", "<>", "(", ")", ";", "List", "<", "ClassBytecodes", ">", "toLoad", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "status", ".", "isDefined", "(", ")", "&&", "!", "isImport", "(", ")", ")", "{", "// Classes should only be loaded/redefined if the compile left them", "// in a defined state. Imports do not have code and are not loaded.", "for", "(", "String", "cn", ":", "classnames", ")", "{", "ClassInfo", "ci", "=", "state", ".", "classTracker", ".", "get", "(", "cn", ")", ";", "if", "(", "ci", ".", "isLoaded", "(", ")", ")", "{", "if", "(", "ci", ".", "isCurrent", "(", ")", ")", "{", "// nothing to do", "}", "else", "{", "toRedefine", ".", "add", "(", "ci", ")", ";", "}", "}", "else", "{", "// If not loaded, add to the list of classes to load.", "toLoad", ".", "add", "(", "ci", ".", "toClassBytecodes", "(", ")", ")", ";", "dependenciesNeeded", "=", "true", ";", "}", "}", "}", "return", "toLoad", ".", "stream", "(", ")", ";", "}" ]
Process the class information from the last compile. Requires loading of returned list. @return the list of classes to load
[ "Process", "the", "class", "information", "from", "the", "last", "compile", ".", "Requires", "loading", "of", "returned", "list", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/Unit.java#L277-L299
5,188
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/Unit.java
Unit.overwriteMatchingMethod
private Status overwriteMatchingMethod(MethodSnippet msi) { String qpt = msi.qualifiedParameterTypes(); List<MethodSnippet> matching = state.methods() .filter(sn -> sn != null && sn != msi && sn.status().isActive() && sn.name().equals(msi.name()) && qpt.equals(sn.qualifiedParameterTypes())) .collect(toList()); // Look through all methods for a method of the same name, with the // same computed qualified parameter types Status overwrittenStatus = null; for (MethodSnippet sn : matching) { overwrittenStatus = sn.status(); SnippetEvent se = new SnippetEvent( sn, overwrittenStatus, OVERWRITTEN, false, msi, null, null); sn.setOverwritten(); secondaryEvents.add(se); state.debug(DBG_EVNT, "Overwrite event #%d -- key: %s before: %s status: %s sig: %b cause: %s\n", secondaryEvents.size(), se.snippet(), se.previousStatus(), se.status(), se.isSignatureChange(), se.causeSnippet()); } return overwrittenStatus; }
java
private Status overwriteMatchingMethod(MethodSnippet msi) { String qpt = msi.qualifiedParameterTypes(); List<MethodSnippet> matching = state.methods() .filter(sn -> sn != null && sn != msi && sn.status().isActive() && sn.name().equals(msi.name()) && qpt.equals(sn.qualifiedParameterTypes())) .collect(toList()); // Look through all methods for a method of the same name, with the // same computed qualified parameter types Status overwrittenStatus = null; for (MethodSnippet sn : matching) { overwrittenStatus = sn.status(); SnippetEvent se = new SnippetEvent( sn, overwrittenStatus, OVERWRITTEN, false, msi, null, null); sn.setOverwritten(); secondaryEvents.add(se); state.debug(DBG_EVNT, "Overwrite event #%d -- key: %s before: %s status: %s sig: %b cause: %s\n", secondaryEvents.size(), se.snippet(), se.previousStatus(), se.status(), se.isSignatureChange(), se.causeSnippet()); } return overwrittenStatus; }
[ "private", "Status", "overwriteMatchingMethod", "(", "MethodSnippet", "msi", ")", "{", "String", "qpt", "=", "msi", ".", "qualifiedParameterTypes", "(", ")", ";", "List", "<", "MethodSnippet", ">", "matching", "=", "state", ".", "methods", "(", ")", ".", "filter", "(", "sn", "->", "sn", "!=", "null", "&&", "sn", "!=", "msi", "&&", "sn", ".", "status", "(", ")", ".", "isActive", "(", ")", "&&", "sn", ".", "name", "(", ")", ".", "equals", "(", "msi", ".", "name", "(", ")", ")", "&&", "qpt", ".", "equals", "(", "sn", ".", "qualifiedParameterTypes", "(", ")", ")", ")", ".", "collect", "(", "toList", "(", ")", ")", ";", "// Look through all methods for a method of the same name, with the", "// same computed qualified parameter types", "Status", "overwrittenStatus", "=", "null", ";", "for", "(", "MethodSnippet", "sn", ":", "matching", ")", "{", "overwrittenStatus", "=", "sn", ".", "status", "(", ")", ";", "SnippetEvent", "se", "=", "new", "SnippetEvent", "(", "sn", ",", "overwrittenStatus", ",", "OVERWRITTEN", ",", "false", ",", "msi", ",", "null", ",", "null", ")", ";", "sn", ".", "setOverwritten", "(", ")", ";", "secondaryEvents", ".", "add", "(", "se", ")", ";", "state", ".", "debug", "(", "DBG_EVNT", ",", "\"Overwrite event #%d -- key: %s before: %s status: %s sig: %b cause: %s\\n\"", ",", "secondaryEvents", ".", "size", "(", ")", ",", "se", ".", "snippet", "(", ")", ",", "se", ".", "previousStatus", "(", ")", ",", "se", ".", "status", "(", ")", ",", "se", ".", "isSignatureChange", "(", ")", ",", "se", ".", "causeSnippet", "(", ")", ")", ";", "}", "return", "overwrittenStatus", ";", "}" ]
types are the same. if so, consider it an overwrite replacement.
[ "types", "are", "the", "same", ".", "if", "so", "consider", "it", "an", "overwrite", "replacement", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/Unit.java#L418-L445
5,189
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java
Bits.dup
public Bits dup() { Assert.check(currentState != BitsState.UNKNOWN); Bits tmp = new Bits(); tmp.bits = dupBits(); currentState = BitsState.NORMAL; return tmp; }
java
public Bits dup() { Assert.check(currentState != BitsState.UNKNOWN); Bits tmp = new Bits(); tmp.bits = dupBits(); currentState = BitsState.NORMAL; return tmp; }
[ "public", "Bits", "dup", "(", ")", "{", "Assert", ".", "check", "(", "currentState", "!=", "BitsState", ".", "UNKNOWN", ")", ";", "Bits", "tmp", "=", "new", "Bits", "(", ")", ";", "tmp", ".", "bits", "=", "dupBits", "(", ")", ";", "currentState", "=", "BitsState", ".", "NORMAL", ";", "return", "tmp", ";", "}" ]
Return a copy of this set.
[ "Return", "a", "copy", "of", "this", "set", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java#L163-L169
5,190
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java
Bits.inclRange
public void inclRange(int start, int limit) { Assert.check(currentState != BitsState.UNKNOWN); sizeTo((limit >>> wordshift) + 1); for (int x = start; x < limit; x++) { bits[x >>> wordshift] = bits[x >>> wordshift] | (1 << (x & wordmask)); } currentState = BitsState.NORMAL; }
java
public void inclRange(int start, int limit) { Assert.check(currentState != BitsState.UNKNOWN); sizeTo((limit >>> wordshift) + 1); for (int x = start; x < limit; x++) { bits[x >>> wordshift] = bits[x >>> wordshift] | (1 << (x & wordmask)); } currentState = BitsState.NORMAL; }
[ "public", "void", "inclRange", "(", "int", "start", ",", "int", "limit", ")", "{", "Assert", ".", "check", "(", "currentState", "!=", "BitsState", ".", "UNKNOWN", ")", ";", "sizeTo", "(", "(", "limit", ">>>", "wordshift", ")", "+", "1", ")", ";", "for", "(", "int", "x", "=", "start", ";", "x", "<", "limit", ";", "x", "++", ")", "{", "bits", "[", "x", ">>>", "wordshift", "]", "=", "bits", "[", "x", ">>>", "wordshift", "]", "|", "(", "1", "<<", "(", "x", "&", "wordmask", ")", ")", ";", "}", "currentState", "=", "BitsState", ".", "NORMAL", ";", "}" ]
Include [start..limit) in this set.
[ "Include", "[", "start", "..", "limit", ")", "in", "this", "set", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java#L196-L204
5,191
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java
Bits.excl
public void excl(int x) { Assert.check(currentState != BitsState.UNKNOWN); Assert.check(x >= 0); sizeTo((x >>> wordshift) + 1); bits[x >>> wordshift] = bits[x >>> wordshift] & ~(1 << (x & wordmask)); currentState = BitsState.NORMAL; }
java
public void excl(int x) { Assert.check(currentState != BitsState.UNKNOWN); Assert.check(x >= 0); sizeTo((x >>> wordshift) + 1); bits[x >>> wordshift] = bits[x >>> wordshift] & ~(1 << (x & wordmask)); currentState = BitsState.NORMAL; }
[ "public", "void", "excl", "(", "int", "x", ")", "{", "Assert", ".", "check", "(", "currentState", "!=", "BitsState", ".", "UNKNOWN", ")", ";", "Assert", ".", "check", "(", "x", ">=", "0", ")", ";", "sizeTo", "(", "(", "x", ">>>", "wordshift", ")", "+", "1", ")", ";", "bits", "[", "x", ">>>", "wordshift", "]", "=", "bits", "[", "x", ">>>", "wordshift", "]", "&", "~", "(", "1", "<<", "(", "x", "&", "wordmask", ")", ")", ";", "currentState", "=", "BitsState", ".", "NORMAL", ";", "}" ]
Exclude x from this set.
[ "Exclude", "x", "from", "this", "set", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java#L219-L226
5,192
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java
Bits.isMember
public boolean isMember(int x) { Assert.check(currentState != BitsState.UNKNOWN); return 0 <= x && x < (bits.length << wordshift) && (bits[x >>> wordshift] & (1 << (x & wordmask))) != 0; }
java
public boolean isMember(int x) { Assert.check(currentState != BitsState.UNKNOWN); return 0 <= x && x < (bits.length << wordshift) && (bits[x >>> wordshift] & (1 << (x & wordmask))) != 0; }
[ "public", "boolean", "isMember", "(", "int", "x", ")", "{", "Assert", ".", "check", "(", "currentState", "!=", "BitsState", ".", "UNKNOWN", ")", ";", "return", "0", "<=", "x", "&&", "x", "<", "(", "bits", ".", "length", "<<", "wordshift", ")", "&&", "(", "bits", "[", "x", ">>>", "wordshift", "]", "&", "(", "1", "<<", "(", "x", "&", "wordmask", ")", ")", ")", "!=", "0", ";", "}" ]
Is x an element of this set?
[ "Is", "x", "an", "element", "of", "this", "set?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java#L230-L235
5,193
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java
Bits.diffSet
public Bits diffSet(Bits xs) { Assert.check(currentState != BitsState.UNKNOWN); for (int i = 0; i < bits.length; i++) { if (i < xs.bits.length) { bits[i] = bits[i] & ~xs.bits[i]; } } currentState = BitsState.NORMAL; return this; }
java
public Bits diffSet(Bits xs) { Assert.check(currentState != BitsState.UNKNOWN); for (int i = 0; i < bits.length; i++) { if (i < xs.bits.length) { bits[i] = bits[i] & ~xs.bits[i]; } } currentState = BitsState.NORMAL; return this; }
[ "public", "Bits", "diffSet", "(", "Bits", "xs", ")", "{", "Assert", ".", "check", "(", "currentState", "!=", "BitsState", ".", "UNKNOWN", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bits", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", "<", "xs", ".", "bits", ".", "length", ")", "{", "bits", "[", "i", "]", "=", "bits", "[", "i", "]", "&", "~", "xs", ".", "bits", "[", "i", "]", ";", "}", "}", "currentState", "=", "BitsState", ".", "NORMAL", ";", "return", "this", ";", "}" ]
this set = this set \ xs.
[ "this", "set", "=", "this", "set", "\\", "xs", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java#L268-L277
5,194
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java
Bits.xorSet
public Bits xorSet(Bits xs) { Assert.check(currentState != BitsState.UNKNOWN); sizeTo(xs.bits.length); for (int i = 0; i < xs.bits.length; i++) { bits[i] = bits[i] ^ xs.bits[i]; } currentState = BitsState.NORMAL; return this; }
java
public Bits xorSet(Bits xs) { Assert.check(currentState != BitsState.UNKNOWN); sizeTo(xs.bits.length); for (int i = 0; i < xs.bits.length; i++) { bits[i] = bits[i] ^ xs.bits[i]; } currentState = BitsState.NORMAL; return this; }
[ "public", "Bits", "xorSet", "(", "Bits", "xs", ")", "{", "Assert", ".", "check", "(", "currentState", "!=", "BitsState", ".", "UNKNOWN", ")", ";", "sizeTo", "(", "xs", ".", "bits", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "xs", ".", "bits", ".", "length", ";", "i", "++", ")", "{", "bits", "[", "i", "]", "=", "bits", "[", "i", "]", "^", "xs", ".", "bits", "[", "i", "]", ";", "}", "currentState", "=", "BitsState", ".", "NORMAL", ";", "return", "this", ";", "}" ]
this set = this set ^ xs.
[ "this", "set", "=", "this", "set", "^", "xs", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Bits.java#L281-L289
5,195
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java
VisibleMemberMap.getVisibleClasses
public SortedSet<TypeElement> getVisibleClasses() { SortedSet<TypeElement> vClasses = new TreeSet<>(comparator); vClasses.addAll(visibleClasses); return vClasses; }
java
public SortedSet<TypeElement> getVisibleClasses() { SortedSet<TypeElement> vClasses = new TreeSet<>(comparator); vClasses.addAll(visibleClasses); return vClasses; }
[ "public", "SortedSet", "<", "TypeElement", ">", "getVisibleClasses", "(", ")", "{", "SortedSet", "<", "TypeElement", ">", "vClasses", "=", "new", "TreeSet", "<>", "(", "comparator", ")", ";", "vClasses", ".", "addAll", "(", "visibleClasses", ")", ";", "return", "vClasses", ";", "}" ]
Return the list of visible classes in this map. @return the list of visible classes in this map.
[ "Return", "the", "list", "of", "visible", "classes", "in", "this", "map", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java#L169-L173
5,196
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java
VisibleMemberMap.getLeafMembers
public List<Element> getLeafMembers() { List<Element> result = new ArrayList<>(); result.addAll(classMap.get(typeElement).members); result.addAll(getInheritedPackagePrivateMethods()); return result; }
java
public List<Element> getLeafMembers() { List<Element> result = new ArrayList<>(); result.addAll(classMap.get(typeElement).members); result.addAll(getInheritedPackagePrivateMethods()); return result; }
[ "public", "List", "<", "Element", ">", "getLeafMembers", "(", ")", "{", "List", "<", "Element", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "result", ".", "addAll", "(", "classMap", ".", "get", "(", "typeElement", ")", ".", "members", ")", ";", "result", ".", "addAll", "(", "getInheritedPackagePrivateMethods", "(", ")", ")", ";", "return", "result", ";", "}" ]
Returns a list of visible enclosed members of the type being mapped. This list may also contain appended members, inherited by inaccessible super types. These members are documented in the subtype when the super type is not documented. @return a list of visible enclosed members
[ "Returns", "a", "list", "of", "visible", "enclosed", "members", "of", "the", "type", "being", "mapped", ".", "This", "list", "may", "also", "contain", "appended", "members", "inherited", "by", "inaccessible", "super", "types", ".", "These", "members", "are", "documented", "in", "the", "subtype", "when", "the", "super", "type", "is", "not", "documented", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java#L231-L236
5,197
emfjson/emfjson-jackson
src/main/java/org/emfjson/jackson/databind/deser/ReferenceEntries.java
ReferenceEntries.resolve
public void resolve(DatabindContext context, URIHandler handler) { for (ReferenceEntry entry : entries()) { entry.resolve(context, handler); } mapOfObjects.clear(); }
java
public void resolve(DatabindContext context, URIHandler handler) { for (ReferenceEntry entry : entries()) { entry.resolve(context, handler); } mapOfObjects.clear(); }
[ "public", "void", "resolve", "(", "DatabindContext", "context", ",", "URIHandler", "handler", ")", "{", "for", "(", "ReferenceEntry", "entry", ":", "entries", "(", ")", ")", "{", "entry", ".", "resolve", "(", "context", ",", "handler", ")", ";", "}", "mapOfObjects", ".", "clear", "(", ")", ";", "}" ]
Resolves all reference entries that have been collected during deserialization. @param context current deserialization context @param handler use for resolution of URIs
[ "Resolves", "all", "reference", "entries", "that", "have", "been", "collected", "during", "deserialization", "." ]
5f4488d1b07d499003351606cf76ee0c4ac39964
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/databind/deser/ReferenceEntries.java#L34-L39
5,198
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocLocale.java
DocLocale.englishLanguageFirstSentence
private String englishLanguageFirstSentence(String s) { if (s == null) { return null; } int len = s.length(); boolean period = false; for (int i = 0 ; i < len ; i++) { switch (s.charAt(i)) { case '.': period = true; break; case ' ': case '\t': case '\n': case '\r': case '\f': if (period) { return s.substring(0, i); } break; case '<': if (i > 0) { if (htmlSentenceTerminatorFound(s, i)) { return s.substring(0, i); } } break; default: period = false; } } return s; }
java
private String englishLanguageFirstSentence(String s) { if (s == null) { return null; } int len = s.length(); boolean period = false; for (int i = 0 ; i < len ; i++) { switch (s.charAt(i)) { case '.': period = true; break; case ' ': case '\t': case '\n': case '\r': case '\f': if (period) { return s.substring(0, i); } break; case '<': if (i > 0) { if (htmlSentenceTerminatorFound(s, i)) { return s.substring(0, i); } } break; default: period = false; } } return s; }
[ "private", "String", "englishLanguageFirstSentence", "(", "String", "s", ")", "{", "if", "(", "s", "==", "null", ")", "{", "return", "null", ";", "}", "int", "len", "=", "s", ".", "length", "(", ")", ";", "boolean", "period", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "switch", "(", "s", ".", "charAt", "(", "i", ")", ")", "{", "case", "'", "'", ":", "period", "=", "true", ";", "break", ";", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "if", "(", "period", ")", "{", "return", "s", ".", "substring", "(", "0", ",", "i", ")", ";", "}", "break", ";", "case", "'", "'", ":", "if", "(", "i", ">", "0", ")", "{", "if", "(", "htmlSentenceTerminatorFound", "(", "s", ",", "i", ")", ")", "{", "return", "s", ".", "substring", "(", "0", ",", "i", ")", ";", "}", "}", "break", ";", "default", ":", "period", "=", "false", ";", "}", "}", "return", "s", ";", "}" ]
Return the first sentence of a string, where a sentence ends with a period followed be white space.
[ "Return", "the", "first", "sentence", "of", "a", "string", "where", "a", "sentence", "ends", "with", "a", "period", "followed", "be", "white", "space", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocLocale.java#L195-L227
5,199
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
Start.begin
public boolean begin(Class<?> docletClass, Iterable<String> options, Iterable<? extends JavaFileObject> fileObjects) { this.docletClass = docletClass; List<String> opts = new ArrayList<>(); for (String opt: options) opts.add(opt); return begin(opts, fileObjects).isOK(); }
java
public boolean begin(Class<?> docletClass, Iterable<String> options, Iterable<? extends JavaFileObject> fileObjects) { this.docletClass = docletClass; List<String> opts = new ArrayList<>(); for (String opt: options) opts.add(opt); return begin(opts, fileObjects).isOK(); }
[ "public", "boolean", "begin", "(", "Class", "<", "?", ">", "docletClass", ",", "Iterable", "<", "String", ">", "options", ",", "Iterable", "<", "?", "extends", "JavaFileObject", ">", "fileObjects", ")", "{", "this", ".", "docletClass", "=", "docletClass", ";", "List", "<", "String", ">", "opts", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "opt", ":", "options", ")", "opts", ".", "(", "opt", ")", ";", "return", "begin", "(", "opts", ",", "fileObjects", ")", ".", "isOK", "(", ")", ";", "}" ]
Called by 199 API.
[ "Called", "by", "199", "API", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java#L344-L353