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,200
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
Start.checkOneArg
private void checkOneArg(List<String> args, int index) throws OptionException { if ((index + 1) >= args.size() || args.get(index + 1).startsWith("-d")) { String text = messager.getText("main.requires_argument", args.get(index)); throw new OptionException(CMDERR, this::usage, text); } }
java
private void checkOneArg(List<String> args, int index) throws OptionException { if ((index + 1) >= args.size() || args.get(index + 1).startsWith("-d")) { String text = messager.getText("main.requires_argument", args.get(index)); throw new OptionException(CMDERR, this::usage, text); } }
[ "private", "void", "checkOneArg", "(", "List", "<", "String", ">", "args", ",", "int", "index", ")", "throws", "OptionException", "{", "if", "(", "(", "index", "+", "1", ")", ">=", "args", ".", "size", "(", ")", "||", "args", ".", "get", "(", "index", "+", "1", ")", ".", "startsWith", "(", "\"-d\"", ")", ")", "{", "String", "text", "=", "messager", ".", "getText", "(", "\"main.requires_argument\"", ",", "args", ".", "get", "(", "index", ")", ")", ";", "throw", "new", "OptionException", "(", "CMDERR", ",", "this", "::", "usage", ",", "text", ")", ";", "}", "}" ]
Check the one arg option. Error and exit if one argument is not provided.
[ "Check", "the", "one", "arg", "option", ".", "Error", "and", "exit", "if", "one", "argument", "is", "not", "provided", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java#L870-L875
5,201
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ThrowsTagImpl.java
ThrowsTagImpl.exception
public ClassDoc exception() { ClassDocImpl exceptionClass; if (!(holder instanceof ExecutableMemberDoc)) { exceptionClass = null; } else { ExecutableMemberDocImpl emd = (ExecutableMemberDocImpl)holder; ClassDocImpl con = (ClassDocImpl)emd.containingClass(); exceptionClass = (ClassDocImpl)con.findClass(exceptionName); } return exceptionClass; }
java
public ClassDoc exception() { ClassDocImpl exceptionClass; if (!(holder instanceof ExecutableMemberDoc)) { exceptionClass = null; } else { ExecutableMemberDocImpl emd = (ExecutableMemberDocImpl)holder; ClassDocImpl con = (ClassDocImpl)emd.containingClass(); exceptionClass = (ClassDocImpl)con.findClass(exceptionName); } return exceptionClass; }
[ "public", "ClassDoc", "exception", "(", ")", "{", "ClassDocImpl", "exceptionClass", ";", "if", "(", "!", "(", "holder", "instanceof", "ExecutableMemberDoc", ")", ")", "{", "exceptionClass", "=", "null", ";", "}", "else", "{", "ExecutableMemberDocImpl", "emd", "=", "(", "ExecutableMemberDocImpl", ")", "holder", ";", "ClassDocImpl", "con", "=", "(", "ClassDocImpl", ")", "emd", ".", "containingClass", "(", ")", ";", "exceptionClass", "=", "(", "ClassDocImpl", ")", "con", ".", "findClass", "(", "exceptionName", ")", ";", "}", "return", "exceptionClass", ";", "}" ]
Return the exception as a ClassDocImpl.
[ "Return", "the", "exception", "as", "a", "ClassDocImpl", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ThrowsTagImpl.java#L81-L91
5,202
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/JShell.java
JShell.varValue
public String varValue(VarSnippet snippet) throws IllegalStateException { checkIfAlive(); checkValidSnippet(snippet); if (snippet.status() != Status.VALID) { throw new IllegalArgumentException( messageFormat("jshell.exc.var.not.valid", snippet, snippet.status())); } String value; try { value = executionControl().varValue(snippet.classFullName(), snippet.name()); } catch (EngineTerminationException ex) { throw new IllegalStateException(ex.getMessage()); } catch (ExecutionControlException ex) { debug(ex, "In varValue()"); return "[" + ex.getMessage() + "]"; } return expunge(value); }
java
public String varValue(VarSnippet snippet) throws IllegalStateException { checkIfAlive(); checkValidSnippet(snippet); if (snippet.status() != Status.VALID) { throw new IllegalArgumentException( messageFormat("jshell.exc.var.not.valid", snippet, snippet.status())); } String value; try { value = executionControl().varValue(snippet.classFullName(), snippet.name()); } catch (EngineTerminationException ex) { throw new IllegalStateException(ex.getMessage()); } catch (ExecutionControlException ex) { debug(ex, "In varValue()"); return "[" + ex.getMessage() + "]"; } return expunge(value); }
[ "public", "String", "varValue", "(", "VarSnippet", "snippet", ")", "throws", "IllegalStateException", "{", "checkIfAlive", "(", ")", ";", "checkValidSnippet", "(", "snippet", ")", ";", "if", "(", "snippet", ".", "status", "(", ")", "!=", "Status", ".", "VALID", ")", "{", "throw", "new", "IllegalArgumentException", "(", "messageFormat", "(", "\"jshell.exc.var.not.valid\"", ",", "snippet", ",", "snippet", ".", "status", "(", ")", ")", ")", ";", "}", "String", "value", ";", "try", "{", "value", "=", "executionControl", "(", ")", ".", "varValue", "(", "snippet", ".", "classFullName", "(", ")", ",", "snippet", ".", "name", "(", ")", ")", ";", "}", "catch", "(", "EngineTerminationException", "ex", ")", "{", "throw", "new", "IllegalStateException", "(", "ex", ".", "getMessage", "(", ")", ")", ";", "}", "catch", "(", "ExecutionControlException", "ex", ")", "{", "debug", "(", "ex", ",", "\"In varValue()\"", ")", ";", "return", "\"[\"", "+", "ex", ".", "getMessage", "(", ")", "+", "\"]\"", ";", "}", "return", "expunge", "(", "value", ")", ";", "}" ]
Get the current value of a variable. @param snippet the variable Snippet whose value is queried. @return the current value of the variable referenced by snippet. @throws IllegalStateException if this {@code JShell} instance is closed. @throws IllegalArgumentException if the snippet is not associated with this {@code JShell} instance. @throws IllegalArgumentException if the variable's status is anything but {@link jdk.jshell.Snippet.Status#VALID}.
[ "Get", "the", "current", "value", "of", "a", "variable", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/JShell.java#L700-L717
5,203
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/JShell.java
JShell.checkValidSnippet
private Snippet checkValidSnippet(Snippet sn) { if (sn == null) { throw new NullPointerException(messageFormat("jshell.exc.null")); } else { if (sn.key().state() != this) { throw new IllegalArgumentException(messageFormat("jshell.exc.alien")); } return sn; } }
java
private Snippet checkValidSnippet(Snippet sn) { if (sn == null) { throw new NullPointerException(messageFormat("jshell.exc.null")); } else { if (sn.key().state() != this) { throw new IllegalArgumentException(messageFormat("jshell.exc.alien")); } return sn; } }
[ "private", "Snippet", "checkValidSnippet", "(", "Snippet", "sn", ")", "{", "if", "(", "sn", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "messageFormat", "(", "\"jshell.exc.null\"", ")", ")", ";", "}", "else", "{", "if", "(", "sn", ".", "key", "(", ")", ".", "state", "(", ")", "!=", "this", ")", "{", "throw", "new", "IllegalArgumentException", "(", "messageFormat", "(", "\"jshell.exc.alien\"", ")", ")", ";", "}", "return", "sn", ";", "}", "}" ]
Check a Snippet parameter coming from the API user @param sn the Snippet to check @throws NullPointerException if Snippet parameter is null @throws IllegalArgumentException if Snippet is not from this JShell @return the input Snippet (for chained calls)
[ "Check", "a", "Snippet", "parameter", "coming", "from", "the", "API", "user" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/JShell.java#L878-L887
5,204
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleGraphBuilder.java
ModuleGraphBuilder.reduced
public Graph<Module> reduced() { Graph<Module> graph = build(); // transitive reduction Graph<Module> newGraph = buildGraph(graph.edges()).reduce(); if (DEBUG) { PrintWriter log = new PrintWriter(System.err); System.err.println("before transitive reduction: "); graph.printGraph(log); System.err.println("after transitive reduction: "); newGraph.printGraph(log); } return newGraph; }
java
public Graph<Module> reduced() { Graph<Module> graph = build(); // transitive reduction Graph<Module> newGraph = buildGraph(graph.edges()).reduce(); if (DEBUG) { PrintWriter log = new PrintWriter(System.err); System.err.println("before transitive reduction: "); graph.printGraph(log); System.err.println("after transitive reduction: "); newGraph.printGraph(log); } return newGraph; }
[ "public", "Graph", "<", "Module", ">", "reduced", "(", ")", "{", "Graph", "<", "Module", ">", "graph", "=", "build", "(", ")", ";", "// transitive reduction", "Graph", "<", "Module", ">", "newGraph", "=", "buildGraph", "(", "graph", ".", "edges", "(", ")", ")", ".", "reduce", "(", ")", ";", "if", "(", "DEBUG", ")", "{", "PrintWriter", "log", "=", "new", "PrintWriter", "(", "System", ".", "err", ")", ";", "System", ".", "err", ".", "println", "(", "\"before transitive reduction: \"", ")", ";", "graph", ".", "printGraph", "(", "log", ")", ";", "System", ".", "err", ".", "println", "(", "\"after transitive reduction: \"", ")", ";", "newGraph", ".", "printGraph", "(", "log", ")", ";", "}", "return", "newGraph", ";", "}" ]
Apply transitive reduction on the resulting graph
[ "Apply", "transitive", "reduction", "on", "the", "resulting", "graph" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleGraphBuilder.java#L62-L76
5,205
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleGraphBuilder.java
ModuleGraphBuilder.buildGraph
private Graph<Module> buildGraph(Map<Module, Set<Module>> edges) { Graph.Builder<Module> builder = new Graph.Builder<>(); Set<Module> visited = new HashSet<>(); Deque<Module> deque = new LinkedList<>(); edges.entrySet().stream().forEach(e -> { Module m = e.getKey(); deque.add(m); e.getValue().stream().forEach(v -> { deque.add(v); builder.addEdge(m, v); }); }); // read requires transitive from ModuleDescriptor Module source; while ((source = deque.poll()) != null) { if (visited.contains(source)) continue; visited.add(source); builder.addNode(source); Module from = source; requiresTransitive(from).forEach(m -> { deque.add(m); builder.addEdge(from, m); }); } return builder.build(); }
java
private Graph<Module> buildGraph(Map<Module, Set<Module>> edges) { Graph.Builder<Module> builder = new Graph.Builder<>(); Set<Module> visited = new HashSet<>(); Deque<Module> deque = new LinkedList<>(); edges.entrySet().stream().forEach(e -> { Module m = e.getKey(); deque.add(m); e.getValue().stream().forEach(v -> { deque.add(v); builder.addEdge(m, v); }); }); // read requires transitive from ModuleDescriptor Module source; while ((source = deque.poll()) != null) { if (visited.contains(source)) continue; visited.add(source); builder.addNode(source); Module from = source; requiresTransitive(from).forEach(m -> { deque.add(m); builder.addEdge(from, m); }); } return builder.build(); }
[ "private", "Graph", "<", "Module", ">", "buildGraph", "(", "Map", "<", "Module", ",", "Set", "<", "Module", ">", ">", "edges", ")", "{", "Graph", ".", "Builder", "<", "Module", ">", "builder", "=", "new", "Graph", ".", "Builder", "<>", "(", ")", ";", "Set", "<", "Module", ">", "visited", "=", "new", "HashSet", "<>", "(", ")", ";", "Deque", "<", "Module", ">", "deque", "=", "new", "LinkedList", "<>", "(", ")", ";", "edges", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "forEach", "(", "e", "->", "{", "Module", "m", "=", "e", ".", "getKey", "(", ")", ";", "deque", ".", "add", "(", "m", ")", ";", "e", ".", "getValue", "(", ")", ".", "stream", "(", ")", ".", "forEach", "(", "v", "->", "{", "deque", ".", "add", "(", "v", ")", ";", "builder", ".", "addEdge", "(", "m", ",", "v", ")", ";", "}", ")", ";", "}", ")", ";", "// read requires transitive from ModuleDescriptor", "Module", "source", ";", "while", "(", "(", "source", "=", "deque", ".", "poll", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "visited", ".", "contains", "(", "source", ")", ")", "continue", ";", "visited", ".", "add", "(", "source", ")", ";", "builder", ".", "addNode", "(", "source", ")", ";", "Module", "from", "=", "source", ";", "requiresTransitive", "(", "from", ")", ".", "forEach", "(", "m", "->", "{", "deque", ".", "add", "(", "m", ")", ";", "builder", ".", "addEdge", "(", "from", ",", "m", ")", ";", "}", ")", ";", "}", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Build a graph of module from the given dependences. It transitively includes all implied read edges.
[ "Build", "a", "graph", "of", "module", "from", "the", "given", "dependences", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleGraphBuilder.java#L88-L116
5,206
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/IntHashTable.java
IntHashTable.lookup
public int lookup(Object key, int hash) { Object node; int hash1 = hash ^ (hash >>> 15); int hash2 = (hash ^ (hash << 6)) | 1; //ensure coprimeness int deleted = -1; for (int i = hash1 & mask;; i = (i + hash2) & mask) { node = objs[i]; if (node == key) return i; if (node == null) return deleted >= 0 ? deleted : i; if (node == DELETED && deleted < 0) deleted = i; } }
java
public int lookup(Object key, int hash) { Object node; int hash1 = hash ^ (hash >>> 15); int hash2 = (hash ^ (hash << 6)) | 1; //ensure coprimeness int deleted = -1; for (int i = hash1 & mask;; i = (i + hash2) & mask) { node = objs[i]; if (node == key) return i; if (node == null) return deleted >= 0 ? deleted : i; if (node == DELETED && deleted < 0) deleted = i; } }
[ "public", "int", "lookup", "(", "Object", "key", ",", "int", "hash", ")", "{", "Object", "node", ";", "int", "hash1", "=", "hash", "^", "(", "hash", ">>>", "15", ")", ";", "int", "hash2", "=", "(", "hash", "^", "(", "hash", "<<", "6", ")", ")", "|", "1", ";", "//ensure coprimeness", "int", "deleted", "=", "-", "1", ";", "for", "(", "int", "i", "=", "hash1", "&", "mask", ";", ";", "i", "=", "(", "i", "+", "hash2", ")", "&", "mask", ")", "{", "node", "=", "objs", "[", "i", "]", ";", "if", "(", "node", "==", "key", ")", "return", "i", ";", "if", "(", "node", "==", "null", ")", "return", "deleted", ">=", "0", "?", "deleted", ":", "i", ";", "if", "(", "node", "==", "DELETED", "&&", "deleted", "<", "0", ")", "deleted", "=", "i", ";", "}", "}" ]
Find either the index of a key's value, or the index of an available space. @param key The key to whose value you want to find. @param hash The hash code of this key. @return Either the index of the key's value, or an index pointing to unoccupied space.
[ "Find", "either", "the", "index", "of", "a", "key", "s", "value", "or", "the", "index", "of", "an", "available", "space", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/IntHashTable.java#L89-L103
5,207
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/IntHashTable.java
IntHashTable.getFromIndex
public int getFromIndex(int index) { Object node = objs[index]; return node == null || node == DELETED ? -1 : ints[index]; }
java
public int getFromIndex(int index) { Object node = objs[index]; return node == null || node == DELETED ? -1 : ints[index]; }
[ "public", "int", "getFromIndex", "(", "int", "index", ")", "{", "Object", "node", "=", "objs", "[", "index", "]", ";", "return", "node", "==", "null", "||", "node", "==", "DELETED", "?", "-", "1", ":", "ints", "[", "index", "]", ";", "}" ]
Return the value stored at the specified index in the table. @param index The index to inspect, as returned from {@link #lookup} @return A non-negative integer if the index contains a non-null value, or -1 if it does.
[ "Return", "the", "value", "stored", "at", "the", "specified", "index", "in", "the", "table", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/IntHashTable.java#L123-L126
5,208
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/IntHashTable.java
IntHashTable.putAtIndex
public int putAtIndex(Object key, int value, int index) { Object old = objs[index]; if (old == null || old == DELETED) { objs[index] = key; ints[index] = value; if (old != DELETED) num_bindings++; if (3 * num_bindings >= 2 * objs.length) rehash(); return -1; } else { // update existing mapping int oldValue = ints[index]; ints[index] = value; return oldValue; } }
java
public int putAtIndex(Object key, int value, int index) { Object old = objs[index]; if (old == null || old == DELETED) { objs[index] = key; ints[index] = value; if (old != DELETED) num_bindings++; if (3 * num_bindings >= 2 * objs.length) rehash(); return -1; } else { // update existing mapping int oldValue = ints[index]; ints[index] = value; return oldValue; } }
[ "public", "int", "putAtIndex", "(", "Object", "key", ",", "int", "value", ",", "int", "index", ")", "{", "Object", "old", "=", "objs", "[", "index", "]", ";", "if", "(", "old", "==", "null", "||", "old", "==", "DELETED", ")", "{", "objs", "[", "index", "]", "=", "key", ";", "ints", "[", "index", "]", "=", "value", ";", "if", "(", "old", "!=", "DELETED", ")", "num_bindings", "++", ";", "if", "(", "3", "*", "num_bindings", ">=", "2", "*", "objs", ".", "length", ")", "rehash", "(", ")", ";", "return", "-", "1", ";", "}", "else", "{", "// update existing mapping", "int", "oldValue", "=", "ints", "[", "index", "]", ";", "ints", "[", "index", "]", "=", "value", ";", "return", "oldValue", ";", "}", "}" ]
Associates the specified key with the specified value in this map. @param key key with which the specified value is to be associated. @param value value to be associated with the specified key. @param index the index at which to place this binding, as returned from {@link #lookup}. @return previous value associated with specified key, or -1 if there was no mapping for key.
[ "Associates", "the", "specified", "key", "with", "the", "specified", "value", "in", "this", "map", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/IntHashTable.java#L138-L153
5,209
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/IntHashTable.java
IntHashTable.rehash
protected void rehash() { Object[] oldObjsTable = objs; int[] oldIntsTable = ints; int oldCapacity = oldObjsTable.length; int newCapacity = oldCapacity << 1; Object[] newObjTable = new Object[newCapacity]; int[] newIntTable = new int[newCapacity]; int newMask = newCapacity - 1; objs = newObjTable; ints = newIntTable; mask = newMask; num_bindings = 0; // this is recomputed below Object key; for (int i = oldIntsTable.length; --i >= 0;) { key = oldObjsTable[i]; if (key != null && key != DELETED) putAtIndex(key, oldIntsTable[i], lookup(key, hash(key))); } }
java
protected void rehash() { Object[] oldObjsTable = objs; int[] oldIntsTable = ints; int oldCapacity = oldObjsTable.length; int newCapacity = oldCapacity << 1; Object[] newObjTable = new Object[newCapacity]; int[] newIntTable = new int[newCapacity]; int newMask = newCapacity - 1; objs = newObjTable; ints = newIntTable; mask = newMask; num_bindings = 0; // this is recomputed below Object key; for (int i = oldIntsTable.length; --i >= 0;) { key = oldObjsTable[i]; if (key != null && key != DELETED) putAtIndex(key, oldIntsTable[i], lookup(key, hash(key))); } }
[ "protected", "void", "rehash", "(", ")", "{", "Object", "[", "]", "oldObjsTable", "=", "objs", ";", "int", "[", "]", "oldIntsTable", "=", "ints", ";", "int", "oldCapacity", "=", "oldObjsTable", ".", "length", ";", "int", "newCapacity", "=", "oldCapacity", "<<", "1", ";", "Object", "[", "]", "newObjTable", "=", "new", "Object", "[", "newCapacity", "]", ";", "int", "[", "]", "newIntTable", "=", "new", "int", "[", "newCapacity", "]", ";", "int", "newMask", "=", "newCapacity", "-", "1", ";", "objs", "=", "newObjTable", ";", "ints", "=", "newIntTable", ";", "mask", "=", "newMask", ";", "num_bindings", "=", "0", ";", "// this is recomputed below", "Object", "key", ";", "for", "(", "int", "i", "=", "oldIntsTable", ".", "length", ";", "--", "i", ">=", "0", ";", ")", "{", "key", "=", "oldObjsTable", "[", "i", "]", ";", "if", "(", "key", "!=", "null", "&&", "key", "!=", "DELETED", ")", "putAtIndex", "(", "key", ",", "oldIntsTable", "[", "i", "]", ",", "lookup", "(", "key", ",", "hash", "(", "key", ")", ")", ")", ";", "}", "}" ]
Expand the hash table when it exceeds the load factor. Rehash the existing objects.
[ "Expand", "the", "hash", "table", "when", "it", "exceeds", "the", "load", "factor", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/IntHashTable.java#L169-L187
5,210
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Todo.java
Todo.instance
public static Todo instance(Context context) { Todo instance = context.get(todoKey); if (instance == null) instance = new Todo(context); return instance; }
java
public static Todo instance(Context context) { Todo instance = context.get(todoKey); if (instance == null) instance = new Todo(context); return instance; }
[ "public", "static", "Todo", "instance", "(", "Context", "context", ")", "{", "Todo", "instance", "=", "context", ".", "get", "(", "todoKey", ")", ";", "if", "(", "instance", "==", "null", ")", "instance", "=", "new", "Todo", "(", "context", ")", ";", "return", "instance", ";", "}" ]
Get the Todo instance for this context.
[ "Get", "the", "Todo", "instance", "for", "this", "context", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Todo.java#L51-L56
5,211
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Todo.java
Todo.retainFiles
public void retainFiles(Collection<? extends JavaFileObject> sourceFiles) { for (Iterator<Env<AttrContext>> it = contents.iterator(); it.hasNext(); ) { Env<AttrContext> env = it.next(); if (!sourceFiles.contains(env.toplevel.sourcefile)) { if (contentsByFile != null) removeByFile(env); it.remove(); } } }
java
public void retainFiles(Collection<? extends JavaFileObject> sourceFiles) { for (Iterator<Env<AttrContext>> it = contents.iterator(); it.hasNext(); ) { Env<AttrContext> env = it.next(); if (!sourceFiles.contains(env.toplevel.sourcefile)) { if (contentsByFile != null) removeByFile(env); it.remove(); } } }
[ "public", "void", "retainFiles", "(", "Collection", "<", "?", "extends", "JavaFileObject", ">", "sourceFiles", ")", "{", "for", "(", "Iterator", "<", "Env", "<", "AttrContext", ">", ">", "it", "=", "contents", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Env", "<", "AttrContext", ">", "env", "=", "it", ".", "next", "(", ")", ";", "if", "(", "!", "sourceFiles", ".", "contains", "(", "env", ".", "toplevel", ".", "sourcefile", ")", ")", "{", "if", "(", "contentsByFile", "!=", "null", ")", "removeByFile", "(", "env", ")", ";", "it", ".", "remove", "(", ")", ";", "}", "}", "}" ]
Removes all unattributed classes except those belonging to the given collection of files. @param sourceFiles The source files of the classes to keep.
[ "Removes", "all", "unattributed", "classes", "except", "those", "belonging", "to", "the", "given", "collection", "of", "files", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Todo.java#L93-L101
5,212
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java
UnicodeReader.putChar
protected void putChar(char ch, boolean scan) { sbuf = ArrayUtils.ensureCapacity(sbuf, sp); sbuf[sp++] = ch; if (scan) scanChar(); }
java
protected void putChar(char ch, boolean scan) { sbuf = ArrayUtils.ensureCapacity(sbuf, sp); sbuf[sp++] = ch; if (scan) scanChar(); }
[ "protected", "void", "putChar", "(", "char", "ch", ",", "boolean", "scan", ")", "{", "sbuf", "=", "ArrayUtils", ".", "ensureCapacity", "(", "sbuf", ",", "sp", ")", ";", "sbuf", "[", "sp", "++", "]", "=", "ch", ";", "if", "(", "scan", ")", "scanChar", "(", ")", ";", "}" ]
Append a character to sbuf.
[ "Append", "a", "character", "to", "sbuf", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java#L131-L136
5,213
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java
UnicodeReader.peekSurrogates
protected int peekSurrogates() { if (surrogatesSupported && Character.isHighSurrogate(ch)) { char high = ch; int prevBP = bp; scanChar(); char low = ch; ch = high; bp = prevBP; if (Character.isLowSurrogate(low)) { return Character.toCodePoint(high, low); } } return -1; }
java
protected int peekSurrogates() { if (surrogatesSupported && Character.isHighSurrogate(ch)) { char high = ch; int prevBP = bp; scanChar(); char low = ch; ch = high; bp = prevBP; if (Character.isLowSurrogate(low)) { return Character.toCodePoint(high, low); } } return -1; }
[ "protected", "int", "peekSurrogates", "(", ")", "{", "if", "(", "surrogatesSupported", "&&", "Character", ".", "isHighSurrogate", "(", "ch", ")", ")", "{", "char", "high", "=", "ch", ";", "int", "prevBP", "=", "bp", ";", "scanChar", "(", ")", ";", "char", "low", "=", "ch", ";", "ch", "=", "high", ";", "bp", "=", "prevBP", ";", "if", "(", "Character", ".", "isLowSurrogate", "(", "low", ")", ")", "{", "return", "Character", ".", "toCodePoint", "(", "high", ",", "low", ")", ";", "}", "}", "return", "-", "1", ";", "}" ]
Scan surrogate pairs. If 'ch' is a high surrogate and the next character is a low surrogate, returns the code point constructed from these surrogates. Otherwise, returns -1. This method will not consume any of the characters.
[ "Scan", "surrogate", "pairs", ".", "If", "ch", "is", "a", "high", "surrogate", "and", "the", "next", "character", "is", "a", "low", "surrogate", "returns", "the", "code", "point", "constructed", "from", "these", "surrogates", ".", "Otherwise", "returns", "-", "1", ".", "This", "method", "will", "not", "consume", "any", "of", "the", "characters", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java#L204-L222
5,214
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
AbstractMemberWriter.getHead
protected Content getHead(Element member) { Content memberContent = new StringContent(name(member)); Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent); return heading; }
java
protected Content getHead(Element member) { Content memberContent = new StringContent(name(member)); Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent); return heading; }
[ "protected", "Content", "getHead", "(", "Element", "member", ")", "{", "Content", "memberContent", "=", "new", "StringContent", "(", "name", "(", "member", ")", ")", ";", "Content", "heading", "=", "HtmlTree", ".", "HEADING", "(", "HtmlConstants", ".", "MEMBER_HEADING", ",", "memberContent", ")", ";", "return", "heading", ";", "}" ]
Get the header for the section. @param member the member being documented. @return a header content for the section.
[ "Get", "the", "header", "for", "the", "section", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java#L385-L389
5,215
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
AbstractMemberWriter.showTabs
public boolean showTabs() { int value; for (MethodTypes type : EnumSet.allOf(MethodTypes.class)) { value = type.tableTabs().value(); if ((value & methodTypesOr) == value) { methodTypes.add(type); } } boolean showTabs = methodTypes.size() > 1; if (showTabs) { methodTypes.add(MethodTypes.ALL); } return showTabs; }
java
public boolean showTabs() { int value; for (MethodTypes type : EnumSet.allOf(MethodTypes.class)) { value = type.tableTabs().value(); if ((value & methodTypesOr) == value) { methodTypes.add(type); } } boolean showTabs = methodTypes.size() > 1; if (showTabs) { methodTypes.add(MethodTypes.ALL); } return showTabs; }
[ "public", "boolean", "showTabs", "(", ")", "{", "int", "value", ";", "for", "(", "MethodTypes", "type", ":", "EnumSet", ".", "allOf", "(", "MethodTypes", ".", "class", ")", ")", "{", "value", "=", "type", ".", "tableTabs", "(", ")", ".", "value", "(", ")", ";", "if", "(", "(", "value", "&", "methodTypesOr", ")", "==", "value", ")", "{", "methodTypes", ".", "add", "(", "type", ")", ";", "}", "}", "boolean", "showTabs", "=", "methodTypes", ".", "size", "(", ")", ">", "1", ";", "if", "(", "showTabs", ")", "{", "methodTypes", ".", "add", "(", "MethodTypes", ".", "ALL", ")", ";", "}", "return", "showTabs", ";", "}" ]
Generate the method types set and return true if the method summary table needs to show tabs. @return true if the table should show tabs
[ "Generate", "the", "method", "types", "set", "and", "return", "true", "if", "the", "method", "summary", "table", "needs", "to", "show", "tabs", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java#L568-L581
5,216
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
AbstractMemberWriter.setSummaryColumnStyleAndScope
public void setSummaryColumnStyleAndScope(HtmlTree thTree) { thTree.addStyle(HtmlStyle.colSecond); thTree.addAttr(HtmlAttr.SCOPE, "row"); }
java
public void setSummaryColumnStyleAndScope(HtmlTree thTree) { thTree.addStyle(HtmlStyle.colSecond); thTree.addAttr(HtmlAttr.SCOPE, "row"); }
[ "public", "void", "setSummaryColumnStyleAndScope", "(", "HtmlTree", "thTree", ")", "{", "thTree", ".", "addStyle", "(", "HtmlStyle", ".", "colSecond", ")", ";", "thTree", ".", "addAttr", "(", "HtmlAttr", ".", "SCOPE", ",", "\"row\"", ")", ";", "}" ]
Set the style and scope attribute for the summary column. @param thTree the column for which the style and scope attribute will be set
[ "Set", "the", "style", "and", "scope", "attribute", "for", "the", "summary", "column", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java#L588-L591
5,217
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.removeArgsNotAffectingState
static String[] removeArgsNotAffectingState(String[] args) { String[] out = new String[args.length]; int j = 0; for (int i = 0; i<args.length; ++i) { if (args[i].equals("-j")) { // Just skip it and skip following value i++; } else if (args[i].startsWith("--server:")) { // Just skip it. } else if (args[i].startsWith("--log=")) { // Just skip it. } else if (args[i].equals("--compare-found-sources")) { // Just skip it and skip verify file name i++; } else { // Copy argument. out[j] = args[i]; j++; } } String[] ret = new String[j]; System.arraycopy(out, 0, ret, 0, j); return ret; }
java
static String[] removeArgsNotAffectingState(String[] args) { String[] out = new String[args.length]; int j = 0; for (int i = 0; i<args.length; ++i) { if (args[i].equals("-j")) { // Just skip it and skip following value i++; } else if (args[i].startsWith("--server:")) { // Just skip it. } else if (args[i].startsWith("--log=")) { // Just skip it. } else if (args[i].equals("--compare-found-sources")) { // Just skip it and skip verify file name i++; } else { // Copy argument. out[j] = args[i]; j++; } } String[] ret = new String[j]; System.arraycopy(out, 0, ret, 0, j); return ret; }
[ "static", "String", "[", "]", "removeArgsNotAffectingState", "(", "String", "[", "]", "args", ")", "{", "String", "[", "]", "out", "=", "new", "String", "[", "args", ".", "length", "]", ";", "int", "j", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "++", "i", ")", "{", "if", "(", "args", "[", "i", "]", ".", "equals", "(", "\"-j\"", ")", ")", "{", "// Just skip it and skip following value", "i", "++", ";", "}", "else", "if", "(", "args", "[", "i", "]", ".", "startsWith", "(", "\"--server:\"", ")", ")", "{", "// Just skip it.", "}", "else", "if", "(", "args", "[", "i", "]", ".", "startsWith", "(", "\"--log=\"", ")", ")", "{", "// Just skip it.", "}", "else", "if", "(", "args", "[", "i", "]", ".", "equals", "(", "\"--compare-found-sources\"", ")", ")", "{", "// Just skip it and skip verify file name", "i", "++", ";", "}", "else", "{", "// Copy argument.", "out", "[", "j", "]", "=", "args", "[", "i", "]", ";", "j", "++", ";", "}", "}", "String", "[", "]", "ret", "=", "new", "String", "[", "j", "]", ";", "System", ".", "arraycopy", "(", "out", ",", "0", ",", "ret", ",", "0", ",", "j", ")", ";", "return", "ret", ";", "}" ]
Remove args not affecting the state.
[ "Remove", "args", "not", "affecting", "the", "state", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L168-L191
5,218
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.findAllArtifacts
public void findAllArtifacts() { binArtifacts = findAllFiles(binDir); gensrcArtifacts = findAllFiles(gensrcDir); headerArtifacts = findAllFiles(headerDir); }
java
public void findAllArtifacts() { binArtifacts = findAllFiles(binDir); gensrcArtifacts = findAllFiles(gensrcDir); headerArtifacts = findAllFiles(headerDir); }
[ "public", "void", "findAllArtifacts", "(", ")", "{", "binArtifacts", "=", "findAllFiles", "(", "binDir", ")", ";", "gensrcArtifacts", "=", "findAllFiles", "(", "gensrcDir", ")", ";", "headerArtifacts", "=", "findAllFiles", "(", "headerDir", ")", ";", "}" ]
Find all artifacts that exists on disk.
[ "Find", "all", "artifacts", "that", "exists", "on", "disk", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L214-L218
5,219
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.fetchPrevArtifacts
private Map<String,File> fetchPrevArtifacts(String pkg) { Package p = prev.packages().get(pkg); if (p != null) { return p.artifacts(); } return new HashMap<>(); }
java
private Map<String,File> fetchPrevArtifacts(String pkg) { Package p = prev.packages().get(pkg); if (p != null) { return p.artifacts(); } return new HashMap<>(); }
[ "private", "Map", "<", "String", ",", "File", ">", "fetchPrevArtifacts", "(", "String", "pkg", ")", "{", "Package", "p", "=", "prev", ".", "packages", "(", ")", ".", "get", "(", "pkg", ")", ";", "if", "(", "p", "!=", "null", ")", "{", "return", "p", ".", "artifacts", "(", ")", ";", "}", "return", "new", "HashMap", "<>", "(", ")", ";", "}" ]
Lookup the artifacts generated for this package in the previous build.
[ "Lookup", "the", "artifacts", "generated", "for", "this", "package", "in", "the", "previous", "build", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L223-L229
5,220
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.deleteClassArtifactsInTaintedPackages
public void deleteClassArtifactsInTaintedPackages() { for (String pkg : taintedPackages) { Map<String,File> arts = fetchPrevArtifacts(pkg); for (File f : arts.values()) { if (f.exists() && f.getName().endsWith(".class")) { f.delete(); } } } }
java
public void deleteClassArtifactsInTaintedPackages() { for (String pkg : taintedPackages) { Map<String,File> arts = fetchPrevArtifacts(pkg); for (File f : arts.values()) { if (f.exists() && f.getName().endsWith(".class")) { f.delete(); } } } }
[ "public", "void", "deleteClassArtifactsInTaintedPackages", "(", ")", "{", "for", "(", "String", "pkg", ":", "taintedPackages", ")", "{", "Map", "<", "String", ",", "File", ">", "arts", "=", "fetchPrevArtifacts", "(", "pkg", ")", ";", "for", "(", "File", "f", ":", "arts", ".", "values", "(", ")", ")", "{", "if", "(", "f", ".", "exists", "(", ")", "&&", "f", ".", "getName", "(", ")", ".", "endsWith", "(", "\".class\"", ")", ")", "{", "f", ".", "delete", "(", ")", ";", "}", "}", "}", "}" ]
Delete all prev artifacts in the currently tainted packages.
[ "Delete", "all", "prev", "artifacts", "in", "the", "currently", "tainted", "packages", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L234-L243
5,221
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.taintPackage
public void taintPackage(String name, String because) { if (!taintedPackages.contains(name)) { if (because != null) Log.debug("Tainting "+Util.justPackageName(name)+" because "+because); // It has not been tainted before. taintedPackages.add(name); needsSaving(); Package nowp = now.packages().get(name); if (nowp != null) { for (String d : nowp.dependents()) { taintPackage(d, because); } } } }
java
public void taintPackage(String name, String because) { if (!taintedPackages.contains(name)) { if (because != null) Log.debug("Tainting "+Util.justPackageName(name)+" because "+because); // It has not been tainted before. taintedPackages.add(name); needsSaving(); Package nowp = now.packages().get(name); if (nowp != null) { for (String d : nowp.dependents()) { taintPackage(d, because); } } } }
[ "public", "void", "taintPackage", "(", "String", "name", ",", "String", "because", ")", "{", "if", "(", "!", "taintedPackages", ".", "contains", "(", "name", ")", ")", "{", "if", "(", "because", "!=", "null", ")", "Log", ".", "debug", "(", "\"Tainting \"", "+", "Util", ".", "justPackageName", "(", "name", ")", "+", "\" because \"", "+", "because", ")", ";", "// It has not been tainted before.", "taintedPackages", ".", "add", "(", "name", ")", ";", "needsSaving", "(", ")", ";", "Package", "nowp", "=", "now", ".", "packages", "(", ")", ".", "get", "(", "name", ")", ";", "if", "(", "nowp", "!=", "null", ")", "{", "for", "(", "String", "d", ":", "nowp", ".", "dependents", "(", ")", ")", "{", "taintPackage", "(", "d", ",", "because", ")", ";", "}", "}", "}", "}" ]
Mark a java package as tainted, ie it needs recompilation.
[ "Mark", "a", "java", "package", "as", "tainted", "ie", "it", "needs", "recompilation", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L389-L402
5,222
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.checkSourceStatus
public void checkSourceStatus(boolean check_gensrc) { removedSources = calculateRemovedSources(); for (Source s : removedSources) { if (!s.isGenerated() || check_gensrc) { taintPackage(s.pkg().name(), "source "+s.name()+" was removed"); } } addedSources = calculateAddedSources(); for (Source s : addedSources) { String msg = null; if (isIncremental()) { // When building from scratch, there is no point // printing "was added" for every file since all files are added. // However for an incremental build it makes sense. msg = "source "+s.name()+" was added"; } if (!s.isGenerated() || check_gensrc) { taintPackage(s.pkg().name(), msg); } } modifiedSources = calculateModifiedSources(); for (Source s : modifiedSources) { if (!s.isGenerated() || check_gensrc) { taintPackage(s.pkg().name(), "source "+s.name()+" was modified"); } } }
java
public void checkSourceStatus(boolean check_gensrc) { removedSources = calculateRemovedSources(); for (Source s : removedSources) { if (!s.isGenerated() || check_gensrc) { taintPackage(s.pkg().name(), "source "+s.name()+" was removed"); } } addedSources = calculateAddedSources(); for (Source s : addedSources) { String msg = null; if (isIncremental()) { // When building from scratch, there is no point // printing "was added" for every file since all files are added. // However for an incremental build it makes sense. msg = "source "+s.name()+" was added"; } if (!s.isGenerated() || check_gensrc) { taintPackage(s.pkg().name(), msg); } } modifiedSources = calculateModifiedSources(); for (Source s : modifiedSources) { if (!s.isGenerated() || check_gensrc) { taintPackage(s.pkg().name(), "source "+s.name()+" was modified"); } } }
[ "public", "void", "checkSourceStatus", "(", "boolean", "check_gensrc", ")", "{", "removedSources", "=", "calculateRemovedSources", "(", ")", ";", "for", "(", "Source", "s", ":", "removedSources", ")", "{", "if", "(", "!", "s", ".", "isGenerated", "(", ")", "||", "check_gensrc", ")", "{", "taintPackage", "(", "s", ".", "pkg", "(", ")", ".", "name", "(", ")", ",", "\"source \"", "+", "s", ".", "name", "(", ")", "+", "\" was removed\"", ")", ";", "}", "}", "addedSources", "=", "calculateAddedSources", "(", ")", ";", "for", "(", "Source", "s", ":", "addedSources", ")", "{", "String", "msg", "=", "null", ";", "if", "(", "isIncremental", "(", ")", ")", "{", "// When building from scratch, there is no point", "// printing \"was added\" for every file since all files are added.", "// However for an incremental build it makes sense.", "msg", "=", "\"source \"", "+", "s", ".", "name", "(", ")", "+", "\" was added\"", ";", "}", "if", "(", "!", "s", ".", "isGenerated", "(", ")", "||", "check_gensrc", ")", "{", "taintPackage", "(", "s", ".", "pkg", "(", ")", ".", "name", "(", ")", ",", "msg", ")", ";", "}", "}", "modifiedSources", "=", "calculateModifiedSources", "(", ")", ";", "for", "(", "Source", "s", ":", "modifiedSources", ")", "{", "if", "(", "!", "s", ".", "isGenerated", "(", ")", "||", "check_gensrc", ")", "{", "taintPackage", "(", "s", ".", "pkg", "(", ")", ".", "name", "(", ")", ",", "\"source \"", "+", "s", ".", "name", "(", ")", "+", "\" was modified\"", ")", ";", "}", "}", "}" ]
Go through all sources and check which have been removed, added or modified and taint the corresponding packages.
[ "Go", "through", "all", "sources", "and", "check", "which", "have", "been", "removed", "added", "or", "modified", "and", "taint", "the", "corresponding", "packages", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L423-L451
5,223
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.getJavaSuffixRule
public Map<String,Transformer> getJavaSuffixRule() { Map<String,Transformer> sr = new HashMap<>(); sr.put(".java", compileJavaPackages); return sr; }
java
public Map<String,Transformer> getJavaSuffixRule() { Map<String,Transformer> sr = new HashMap<>(); sr.put(".java", compileJavaPackages); return sr; }
[ "public", "Map", "<", "String", ",", "Transformer", ">", "getJavaSuffixRule", "(", ")", "{", "Map", "<", "String", ",", "Transformer", ">", "sr", "=", "new", "HashMap", "<>", "(", ")", ";", "sr", ".", "put", "(", "\".java\"", ",", "compileJavaPackages", ")", ";", "return", "sr", ";", "}" ]
Acquire the compile_java_packages suffix rule for .java files.
[ "Acquire", "the", "compile_java_packages", "suffix", "rule", "for", ".", "java", "files", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L456-L460
5,224
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.taintPackagesThatMissArtifacts
public void taintPackagesThatMissArtifacts() { for (Package pkg : prev.packages().values()) { for (File f : pkg.artifacts().values()) { if (!f.exists()) { // Hmm, the artifact on disk does not exist! Someone has removed it.... // Lets rebuild the package. taintPackage(pkg.name(), ""+f+" is missing."); } } } }
java
public void taintPackagesThatMissArtifacts() { for (Package pkg : prev.packages().values()) { for (File f : pkg.artifacts().values()) { if (!f.exists()) { // Hmm, the artifact on disk does not exist! Someone has removed it.... // Lets rebuild the package. taintPackage(pkg.name(), ""+f+" is missing."); } } } }
[ "public", "void", "taintPackagesThatMissArtifacts", "(", ")", "{", "for", "(", "Package", "pkg", ":", "prev", ".", "packages", "(", ")", ".", "values", "(", ")", ")", "{", "for", "(", "File", "f", ":", "pkg", ".", "artifacts", "(", ")", ".", "values", "(", ")", ")", "{", "if", "(", "!", "f", ".", "exists", "(", ")", ")", "{", "// Hmm, the artifact on disk does not exist! Someone has removed it....", "// Lets rebuild the package.", "taintPackage", "(", "pkg", ".", "name", "(", ")", ",", "\"\"", "+", "f", "+", "\" is missing.\"", ")", ";", "}", "}", "}", "}" ]
If artifacts have gone missing, force a recompile of the packages they belong to.
[ "If", "artifacts", "have", "gone", "missing", "force", "a", "recompile", "of", "the", "packages", "they", "belong", "to", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L467-L477
5,225
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.taintPackagesDependingOnChangedClasspathPackages
public void taintPackagesDependingOnChangedClasspathPackages() throws IOException { // 1. Collect fully qualified names of all interesting classpath dependencies Set<String> fqDependencies = new HashSet<>(); for (Package pkg : prev.packages().values()) { // Check if this package was compiled. If it's presence is recorded // because it was on the class path and we needed to save it's // public api, it's not a candidate for tainting. if (pkg.sources().isEmpty()) continue; pkg.typeClasspathDependencies().values().forEach(fqDependencies::addAll); } // 2. Extract the public APIs from the on disk .class files // (Reason for doing step 1 in a separate phase is to avoid extracting // public APIs of the same class twice.) PubApiExtractor pubApiExtractor = new PubApiExtractor(options); Map<String, PubApi> onDiskPubApi = new HashMap<>(); for (String cpDep : fqDependencies) { onDiskPubApi.put(cpDep, pubApiExtractor.getPubApi(cpDep)); } pubApiExtractor.close(); // 3. Compare them with the public APIs as of last compilation (loaded from javac_state) nextPkg: for (Package pkg : prev.packages().values()) { // Check if this package was compiled. If it's presence is recorded // because it was on the class path and we needed to save it's // public api, it's not a candidate for tainting. if (pkg.sources().isEmpty()) continue; Set<String> cpDepsOfThisPkg = new HashSet<>(); for (Set<String> cpDeps : pkg.typeClasspathDependencies().values()) cpDepsOfThisPkg.addAll(cpDeps); for (String fqDep : cpDepsOfThisPkg) { String depPkg = ":" + fqDep.substring(0, fqDep.lastIndexOf('.')); PubApi prevPkgApi = prev.packages().get(depPkg).getPubApi(); // This PubApi directly lists the members of the class, // i.e. [ MEMBER1, MEMBER2, ... ] PubApi prevDepApi = prevPkgApi.types.get(fqDep).pubApi; // In order to dive *into* the class, we need to add // .types.get(fqDep).pubApi below. PubApi currentDepApi = onDiskPubApi.get(fqDep).types.get(fqDep).pubApi; if (!currentDepApi.isBackwardCompatibleWith(prevDepApi)) { List<String> apiDiff = currentDepApi.diff(prevDepApi); taintPackage(pkg.name(), "depends on classpath " + "package which has an updated package api: " + String.join("\n", apiDiff)); //Log.debug("========================================"); //Log.debug("------ PREV API ------------------------"); //prevDepApi.asListOfStrings().forEach(Log::debug); //Log.debug("------ CURRENT API ---------------------"); //currentDepApi.asListOfStrings().forEach(Log::debug); //Log.debug("========================================"); continue nextPkg; } } } }
java
public void taintPackagesDependingOnChangedClasspathPackages() throws IOException { // 1. Collect fully qualified names of all interesting classpath dependencies Set<String> fqDependencies = new HashSet<>(); for (Package pkg : prev.packages().values()) { // Check if this package was compiled. If it's presence is recorded // because it was on the class path and we needed to save it's // public api, it's not a candidate for tainting. if (pkg.sources().isEmpty()) continue; pkg.typeClasspathDependencies().values().forEach(fqDependencies::addAll); } // 2. Extract the public APIs from the on disk .class files // (Reason for doing step 1 in a separate phase is to avoid extracting // public APIs of the same class twice.) PubApiExtractor pubApiExtractor = new PubApiExtractor(options); Map<String, PubApi> onDiskPubApi = new HashMap<>(); for (String cpDep : fqDependencies) { onDiskPubApi.put(cpDep, pubApiExtractor.getPubApi(cpDep)); } pubApiExtractor.close(); // 3. Compare them with the public APIs as of last compilation (loaded from javac_state) nextPkg: for (Package pkg : prev.packages().values()) { // Check if this package was compiled. If it's presence is recorded // because it was on the class path and we needed to save it's // public api, it's not a candidate for tainting. if (pkg.sources().isEmpty()) continue; Set<String> cpDepsOfThisPkg = new HashSet<>(); for (Set<String> cpDeps : pkg.typeClasspathDependencies().values()) cpDepsOfThisPkg.addAll(cpDeps); for (String fqDep : cpDepsOfThisPkg) { String depPkg = ":" + fqDep.substring(0, fqDep.lastIndexOf('.')); PubApi prevPkgApi = prev.packages().get(depPkg).getPubApi(); // This PubApi directly lists the members of the class, // i.e. [ MEMBER1, MEMBER2, ... ] PubApi prevDepApi = prevPkgApi.types.get(fqDep).pubApi; // In order to dive *into* the class, we need to add // .types.get(fqDep).pubApi below. PubApi currentDepApi = onDiskPubApi.get(fqDep).types.get(fqDep).pubApi; if (!currentDepApi.isBackwardCompatibleWith(prevDepApi)) { List<String> apiDiff = currentDepApi.diff(prevDepApi); taintPackage(pkg.name(), "depends on classpath " + "package which has an updated package api: " + String.join("\n", apiDiff)); //Log.debug("========================================"); //Log.debug("------ PREV API ------------------------"); //prevDepApi.asListOfStrings().forEach(Log::debug); //Log.debug("------ CURRENT API ---------------------"); //currentDepApi.asListOfStrings().forEach(Log::debug); //Log.debug("========================================"); continue nextPkg; } } } }
[ "public", "void", "taintPackagesDependingOnChangedClasspathPackages", "(", ")", "throws", "IOException", "{", "// 1. Collect fully qualified names of all interesting classpath dependencies", "Set", "<", "String", ">", "fqDependencies", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "Package", "pkg", ":", "prev", ".", "packages", "(", ")", ".", "values", "(", ")", ")", "{", "// Check if this package was compiled. If it's presence is recorded", "// because it was on the class path and we needed to save it's", "// public api, it's not a candidate for tainting.", "if", "(", "pkg", ".", "sources", "(", ")", ".", "isEmpty", "(", ")", ")", "continue", ";", "pkg", ".", "typeClasspathDependencies", "(", ")", ".", "values", "(", ")", ".", "forEach", "(", "fqDependencies", "::", "addAll", ")", ";", "}", "// 2. Extract the public APIs from the on disk .class files", "// (Reason for doing step 1 in a separate phase is to avoid extracting", "// public APIs of the same class twice.)", "PubApiExtractor", "pubApiExtractor", "=", "new", "PubApiExtractor", "(", "options", ")", ";", "Map", "<", "String", ",", "PubApi", ">", "onDiskPubApi", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "String", "cpDep", ":", "fqDependencies", ")", "{", "onDiskPubApi", ".", "put", "(", "cpDep", ",", "pubApiExtractor", ".", "getPubApi", "(", "cpDep", ")", ")", ";", "}", "pubApiExtractor", ".", "close", "(", ")", ";", "// 3. Compare them with the public APIs as of last compilation (loaded from javac_state)", "nextPkg", ":", "for", "(", "Package", "pkg", ":", "prev", ".", "packages", "(", ")", ".", "values", "(", ")", ")", "{", "// Check if this package was compiled. If it's presence is recorded", "// because it was on the class path and we needed to save it's", "// public api, it's not a candidate for tainting.", "if", "(", "pkg", ".", "sources", "(", ")", ".", "isEmpty", "(", ")", ")", "continue", ";", "Set", "<", "String", ">", "cpDepsOfThisPkg", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "Set", "<", "String", ">", "cpDeps", ":", "pkg", ".", "typeClasspathDependencies", "(", ")", ".", "values", "(", ")", ")", "cpDepsOfThisPkg", ".", "addAll", "(", "cpDeps", ")", ";", "for", "(", "String", "fqDep", ":", "cpDepsOfThisPkg", ")", "{", "String", "depPkg", "=", "\":\"", "+", "fqDep", ".", "substring", "(", "0", ",", "fqDep", ".", "lastIndexOf", "(", "'", "'", ")", ")", ";", "PubApi", "prevPkgApi", "=", "prev", ".", "packages", "(", ")", ".", "get", "(", "depPkg", ")", ".", "getPubApi", "(", ")", ";", "// This PubApi directly lists the members of the class,", "// i.e. [ MEMBER1, MEMBER2, ... ]", "PubApi", "prevDepApi", "=", "prevPkgApi", ".", "types", ".", "get", "(", "fqDep", ")", ".", "pubApi", ";", "// In order to dive *into* the class, we need to add", "// .types.get(fqDep).pubApi below.", "PubApi", "currentDepApi", "=", "onDiskPubApi", ".", "get", "(", "fqDep", ")", ".", "types", ".", "get", "(", "fqDep", ")", ".", "pubApi", ";", "if", "(", "!", "currentDepApi", ".", "isBackwardCompatibleWith", "(", "prevDepApi", ")", ")", "{", "List", "<", "String", ">", "apiDiff", "=", "currentDepApi", ".", "diff", "(", "prevDepApi", ")", ";", "taintPackage", "(", "pkg", ".", "name", "(", ")", ",", "\"depends on classpath \"", "+", "\"package which has an updated package api: \"", "+", "String", ".", "join", "(", "\"\\n\"", ",", "apiDiff", ")", ")", ";", "//Log.debug(\"========================================\");", "//Log.debug(\"------ PREV API ------------------------\");", "//prevDepApi.asListOfStrings().forEach(Log::debug);", "//Log.debug(\"------ CURRENT API ---------------------\");", "//currentDepApi.asListOfStrings().forEach(Log::debug);", "//Log.debug(\"========================================\");", "continue", "nextPkg", ";", "}", "}", "}", "}" ]
Compare the javac_state recorded public apis of packages on the classpath with the actual public apis on the classpath.
[ "Compare", "the", "javac_state", "recorded", "public", "apis", "of", "packages", "on", "the", "classpath", "with", "the", "actual", "public", "apis", "on", "the", "classpath", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L508-L573
5,226
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.removeSuperfluousArtifacts
public void removeSuperfluousArtifacts(Set<String> recentlyCompiled) { // Nothing to do, if nothing was recompiled. if (recentlyCompiled.size() == 0) return; for (String pkg : now.packages().keySet()) { // If this package has not been recompiled, skip the check. if (!recentlyCompiled.contains(pkg)) continue; Collection<File> arts = now.artifacts().values(); for (File f : fetchPrevArtifacts(pkg).values()) { if (!arts.contains(f)) { Log.debug("Removing "+f.getPath()+" since it is now superfluous!"); if (f.exists()) f.delete(); } } } }
java
public void removeSuperfluousArtifacts(Set<String> recentlyCompiled) { // Nothing to do, if nothing was recompiled. if (recentlyCompiled.size() == 0) return; for (String pkg : now.packages().keySet()) { // If this package has not been recompiled, skip the check. if (!recentlyCompiled.contains(pkg)) continue; Collection<File> arts = now.artifacts().values(); for (File f : fetchPrevArtifacts(pkg).values()) { if (!arts.contains(f)) { Log.debug("Removing "+f.getPath()+" since it is now superfluous!"); if (f.exists()) f.delete(); } } } }
[ "public", "void", "removeSuperfluousArtifacts", "(", "Set", "<", "String", ">", "recentlyCompiled", ")", "{", "// Nothing to do, if nothing was recompiled.", "if", "(", "recentlyCompiled", ".", "size", "(", ")", "==", "0", ")", "return", ";", "for", "(", "String", "pkg", ":", "now", ".", "packages", "(", ")", ".", "keySet", "(", ")", ")", "{", "// If this package has not been recompiled, skip the check.", "if", "(", "!", "recentlyCompiled", ".", "contains", "(", "pkg", ")", ")", "continue", ";", "Collection", "<", "File", ">", "arts", "=", "now", ".", "artifacts", "(", ")", ".", "values", "(", ")", ";", "for", "(", "File", "f", ":", "fetchPrevArtifacts", "(", "pkg", ")", ".", "values", "(", ")", ")", "{", "if", "(", "!", "arts", ".", "contains", "(", "f", ")", ")", "{", "Log", ".", "debug", "(", "\"Removing \"", "+", "f", ".", "getPath", "(", ")", "+", "\" since it is now superfluous!\"", ")", ";", "if", "(", "f", ".", "exists", "(", ")", ")", "f", ".", "delete", "(", ")", ";", "}", "}", "}", "}" ]
Remove artifacts that are no longer produced when compiling!
[ "Remove", "artifacts", "that", "are", "no", "longer", "produced", "when", "compiling!" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L613-L628
5,227
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.calculateRemovedSources
private Set<Source> calculateRemovedSources() { Set<Source> removed = new HashSet<>(); for (String src : prev.sources().keySet()) { if (now.sources().get(src) == null) { removed.add(prev.sources().get(src)); } } return removed; }
java
private Set<Source> calculateRemovedSources() { Set<Source> removed = new HashSet<>(); for (String src : prev.sources().keySet()) { if (now.sources().get(src) == null) { removed.add(prev.sources().get(src)); } } return removed; }
[ "private", "Set", "<", "Source", ">", "calculateRemovedSources", "(", ")", "{", "Set", "<", "Source", ">", "removed", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "String", "src", ":", "prev", ".", "sources", "(", ")", ".", "keySet", "(", ")", ")", "{", "if", "(", "now", ".", "sources", "(", ")", ".", "get", "(", "src", ")", "==", "null", ")", "{", "removed", ".", "add", "(", "prev", ".", "sources", "(", ")", ".", "get", "(", "src", ")", ")", ";", "}", "}", "return", "removed", ";", "}" ]
Return those files belonging to prev, but not now.
[ "Return", "those", "files", "belonging", "to", "prev", "but", "not", "now", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L633-L641
5,228
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.calculateAddedSources
private Set<Source> calculateAddedSources() { Set<Source> added = new HashSet<>(); for (String src : now.sources().keySet()) { if (prev.sources().get(src) == null) { added.add(now.sources().get(src)); } } return added; }
java
private Set<Source> calculateAddedSources() { Set<Source> added = new HashSet<>(); for (String src : now.sources().keySet()) { if (prev.sources().get(src) == null) { added.add(now.sources().get(src)); } } return added; }
[ "private", "Set", "<", "Source", ">", "calculateAddedSources", "(", ")", "{", "Set", "<", "Source", ">", "added", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "String", "src", ":", "now", ".", "sources", "(", ")", ".", "keySet", "(", ")", ")", "{", "if", "(", "prev", ".", "sources", "(", ")", ".", "get", "(", "src", ")", "==", "null", ")", "{", "added", ".", "add", "(", "now", ".", "sources", "(", ")", ".", "get", "(", "src", ")", ")", ";", "}", "}", "return", "added", ";", "}" ]
Return those files belonging to now, but not prev.
[ "Return", "those", "files", "belonging", "to", "now", "but", "not", "prev", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L646-L654
5,229
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.calculateModifiedSources
private Set<Source> calculateModifiedSources() { Set<Source> modified = new HashSet<>(); for (String src : now.sources().keySet()) { Source n = now.sources().get(src); Source t = prev.sources().get(src); if (prev.sources().get(src) != null) { if (t != null) { if (n.lastModified() > t.lastModified()) { modified.add(n); } else if (n.lastModified() < t.lastModified()) { modified.add(n); Log.warn("The source file "+n.name()+" timestamp has moved backwards in time."); } } } } return modified; }
java
private Set<Source> calculateModifiedSources() { Set<Source> modified = new HashSet<>(); for (String src : now.sources().keySet()) { Source n = now.sources().get(src); Source t = prev.sources().get(src); if (prev.sources().get(src) != null) { if (t != null) { if (n.lastModified() > t.lastModified()) { modified.add(n); } else if (n.lastModified() < t.lastModified()) { modified.add(n); Log.warn("The source file "+n.name()+" timestamp has moved backwards in time."); } } } } return modified; }
[ "private", "Set", "<", "Source", ">", "calculateModifiedSources", "(", ")", "{", "Set", "<", "Source", ">", "modified", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "String", "src", ":", "now", ".", "sources", "(", ")", ".", "keySet", "(", ")", ")", "{", "Source", "n", "=", "now", ".", "sources", "(", ")", ".", "get", "(", "src", ")", ";", "Source", "t", "=", "prev", ".", "sources", "(", ")", ".", "get", "(", "src", ")", ";", "if", "(", "prev", ".", "sources", "(", ")", ".", "get", "(", "src", ")", "!=", "null", ")", "{", "if", "(", "t", "!=", "null", ")", "{", "if", "(", "n", ".", "lastModified", "(", ")", ">", "t", ".", "lastModified", "(", ")", ")", "{", "modified", ".", "add", "(", "n", ")", ";", "}", "else", "if", "(", "n", ".", "lastModified", "(", ")", "<", "t", ".", "lastModified", "(", ")", ")", "{", "modified", ".", "add", "(", "n", ")", ";", "Log", ".", "warn", "(", "\"The source file \"", "+", "n", ".", "name", "(", ")", "+", "\" timestamp has moved backwards in time.\"", ")", ";", "}", "}", "}", "}", "return", "modified", ";", "}" ]
Return those files where the timestamp is newer. If a source file timestamp suddenly is older than what is known about it in javac_state, then consider it modified, but print a warning!
[ "Return", "those", "files", "where", "the", "timestamp", "is", "newer", ".", "If", "a", "source", "file", "timestamp", "suddenly", "is", "older", "than", "what", "is", "known", "about", "it", "in", "javac_state", "then", "consider", "it", "modified", "but", "print", "a", "warning!" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L662-L679
5,230
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.findAllFiles
private static Set<File> findAllFiles(File dir) { Set<File> foundFiles = new HashSet<>(); if (dir == null) { return foundFiles; } recurse(dir, foundFiles); return foundFiles; }
java
private static Set<File> findAllFiles(File dir) { Set<File> foundFiles = new HashSet<>(); if (dir == null) { return foundFiles; } recurse(dir, foundFiles); return foundFiles; }
[ "private", "static", "Set", "<", "File", ">", "findAllFiles", "(", "File", "dir", ")", "{", "Set", "<", "File", ">", "foundFiles", "=", "new", "HashSet", "<>", "(", ")", ";", "if", "(", "dir", "==", "null", ")", "{", "return", "foundFiles", ";", "}", "recurse", "(", "dir", ",", "foundFiles", ")", ";", "return", "foundFiles", ";", "}" ]
Utility method to recursively find all files below a directory.
[ "Utility", "method", "to", "recursively", "find", "all", "files", "below", "a", "directory", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L882-L889
5,231
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.compareWithMakefileList
public void compareWithMakefileList(File makefileSourceList) throws ProblemException { // If we are building on win32 using for example cygwin the paths in the // makefile source list // might be /cygdrive/c/.... which does not match c:\.... // We need to adjust our calculated sources to be identical, if // necessary. boolean mightNeedRewriting = File.pathSeparatorChar == ';'; if (makefileSourceList == null) return; Set<String> calculatedSources = new HashSet<>(); Set<String> listedSources = new HashSet<>(); // Create a set of filenames with full paths. for (Source s : now.sources().values()) { // Don't include link only sources when comparing sources to compile if (!s.isLinkedOnly()) { String path = s.file().getPath(); if (mightNeedRewriting) path = Util.normalizeDriveLetter(path); calculatedSources.add(path); } } // Read in the file and create another set of filenames with full paths. try(BufferedReader in = new BufferedReader(new FileReader(makefileSourceList))) { for (;;) { String l = in.readLine(); if (l==null) break; l = l.trim(); if (mightNeedRewriting) { if (l.indexOf(":") == 1 && l.indexOf("\\") == 2) { // Everything a-ok, the format is already C:\foo\bar } else if (l.indexOf(":") == 1 && l.indexOf("/") == 2) { // The format is C:/foo/bar, rewrite into the above format. l = l.replaceAll("/","\\\\"); } else if (l.charAt(0) == '/' && l.indexOf("/",1) != -1) { // The format might be: /cygdrive/c/foo/bar, rewrite into the above format. // Do not hardcode the name cygdrive here. int slash = l.indexOf("/",1); l = l.replaceAll("/","\\\\"); l = ""+l.charAt(slash+1)+":"+l.substring(slash+2); } if (Character.isLowerCase(l.charAt(0))) { l = Character.toUpperCase(l.charAt(0))+l.substring(1); } } listedSources.add(l); } } catch (FileNotFoundException | NoSuchFileException e) { throw new ProblemException("Could not open "+makefileSourceList.getPath()+" since it does not exist!"); } catch (IOException e) { throw new ProblemException("Could not read "+makefileSourceList.getPath()); } for (String s : listedSources) { if (!calculatedSources.contains(s)) { throw new ProblemException("The makefile listed source "+s+" was not calculated by the smart javac wrapper!"); } } for (String s : calculatedSources) { if (!listedSources.contains(s)) { throw new ProblemException("The smart javac wrapper calculated source "+s+" was not listed by the makefiles!"); } } }
java
public void compareWithMakefileList(File makefileSourceList) throws ProblemException { // If we are building on win32 using for example cygwin the paths in the // makefile source list // might be /cygdrive/c/.... which does not match c:\.... // We need to adjust our calculated sources to be identical, if // necessary. boolean mightNeedRewriting = File.pathSeparatorChar == ';'; if (makefileSourceList == null) return; Set<String> calculatedSources = new HashSet<>(); Set<String> listedSources = new HashSet<>(); // Create a set of filenames with full paths. for (Source s : now.sources().values()) { // Don't include link only sources when comparing sources to compile if (!s.isLinkedOnly()) { String path = s.file().getPath(); if (mightNeedRewriting) path = Util.normalizeDriveLetter(path); calculatedSources.add(path); } } // Read in the file and create another set of filenames with full paths. try(BufferedReader in = new BufferedReader(new FileReader(makefileSourceList))) { for (;;) { String l = in.readLine(); if (l==null) break; l = l.trim(); if (mightNeedRewriting) { if (l.indexOf(":") == 1 && l.indexOf("\\") == 2) { // Everything a-ok, the format is already C:\foo\bar } else if (l.indexOf(":") == 1 && l.indexOf("/") == 2) { // The format is C:/foo/bar, rewrite into the above format. l = l.replaceAll("/","\\\\"); } else if (l.charAt(0) == '/' && l.indexOf("/",1) != -1) { // The format might be: /cygdrive/c/foo/bar, rewrite into the above format. // Do not hardcode the name cygdrive here. int slash = l.indexOf("/",1); l = l.replaceAll("/","\\\\"); l = ""+l.charAt(slash+1)+":"+l.substring(slash+2); } if (Character.isLowerCase(l.charAt(0))) { l = Character.toUpperCase(l.charAt(0))+l.substring(1); } } listedSources.add(l); } } catch (FileNotFoundException | NoSuchFileException e) { throw new ProblemException("Could not open "+makefileSourceList.getPath()+" since it does not exist!"); } catch (IOException e) { throw new ProblemException("Could not read "+makefileSourceList.getPath()); } for (String s : listedSources) { if (!calculatedSources.contains(s)) { throw new ProblemException("The makefile listed source "+s+" was not calculated by the smart javac wrapper!"); } } for (String s : calculatedSources) { if (!listedSources.contains(s)) { throw new ProblemException("The smart javac wrapper calculated source "+s+" was not listed by the makefiles!"); } } }
[ "public", "void", "compareWithMakefileList", "(", "File", "makefileSourceList", ")", "throws", "ProblemException", "{", "// If we are building on win32 using for example cygwin the paths in the", "// makefile source list", "// might be /cygdrive/c/.... which does not match c:\\....", "// We need to adjust our calculated sources to be identical, if", "// necessary.", "boolean", "mightNeedRewriting", "=", "File", ".", "pathSeparatorChar", "==", "'", "'", ";", "if", "(", "makefileSourceList", "==", "null", ")", "return", ";", "Set", "<", "String", ">", "calculatedSources", "=", "new", "HashSet", "<>", "(", ")", ";", "Set", "<", "String", ">", "listedSources", "=", "new", "HashSet", "<>", "(", ")", ";", "// Create a set of filenames with full paths.", "for", "(", "Source", "s", ":", "now", ".", "sources", "(", ")", ".", "values", "(", ")", ")", "{", "// Don't include link only sources when comparing sources to compile", "if", "(", "!", "s", ".", "isLinkedOnly", "(", ")", ")", "{", "String", "path", "=", "s", ".", "file", "(", ")", ".", "getPath", "(", ")", ";", "if", "(", "mightNeedRewriting", ")", "path", "=", "Util", ".", "normalizeDriveLetter", "(", "path", ")", ";", "calculatedSources", ".", "add", "(", "path", ")", ";", "}", "}", "// Read in the file and create another set of filenames with full paths.", "try", "(", "BufferedReader", "in", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "makefileSourceList", ")", ")", ")", "{", "for", "(", ";", ";", ")", "{", "String", "l", "=", "in", ".", "readLine", "(", ")", ";", "if", "(", "l", "==", "null", ")", "break", ";", "l", "=", "l", ".", "trim", "(", ")", ";", "if", "(", "mightNeedRewriting", ")", "{", "if", "(", "l", ".", "indexOf", "(", "\":\"", ")", "==", "1", "&&", "l", ".", "indexOf", "(", "\"\\\\\"", ")", "==", "2", ")", "{", "// Everything a-ok, the format is already C:\\foo\\bar", "}", "else", "if", "(", "l", ".", "indexOf", "(", "\":\"", ")", "==", "1", "&&", "l", ".", "indexOf", "(", "\"/\"", ")", "==", "2", ")", "{", "// The format is C:/foo/bar, rewrite into the above format.", "l", "=", "l", ".", "replaceAll", "(", "\"/\"", ",", "\"\\\\\\\\\"", ")", ";", "}", "else", "if", "(", "l", ".", "charAt", "(", "0", ")", "==", "'", "'", "&&", "l", ".", "indexOf", "(", "\"/\"", ",", "1", ")", "!=", "-", "1", ")", "{", "// The format might be: /cygdrive/c/foo/bar, rewrite into the above format.", "// Do not hardcode the name cygdrive here.", "int", "slash", "=", "l", ".", "indexOf", "(", "\"/\"", ",", "1", ")", ";", "l", "=", "l", ".", "replaceAll", "(", "\"/\"", ",", "\"\\\\\\\\\"", ")", ";", "l", "=", "\"\"", "+", "l", ".", "charAt", "(", "slash", "+", "1", ")", "+", "\":\"", "+", "l", ".", "substring", "(", "slash", "+", "2", ")", ";", "}", "if", "(", "Character", ".", "isLowerCase", "(", "l", ".", "charAt", "(", "0", ")", ")", ")", "{", "l", "=", "Character", ".", "toUpperCase", "(", "l", ".", "charAt", "(", "0", ")", ")", "+", "l", ".", "substring", "(", "1", ")", ";", "}", "}", "listedSources", ".", "add", "(", "l", ")", ";", "}", "}", "catch", "(", "FileNotFoundException", "|", "NoSuchFileException", "e", ")", "{", "throw", "new", "ProblemException", "(", "\"Could not open \"", "+", "makefileSourceList", ".", "getPath", "(", ")", "+", "\" since it does not exist!\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "ProblemException", "(", "\"Could not read \"", "+", "makefileSourceList", ".", "getPath", "(", ")", ")", ";", "}", "for", "(", "String", "s", ":", "listedSources", ")", "{", "if", "(", "!", "calculatedSources", ".", "contains", "(", "s", ")", ")", "{", "throw", "new", "ProblemException", "(", "\"The makefile listed source \"", "+", "s", "+", "\" was not calculated by the smart javac wrapper!\"", ")", ";", "}", "}", "for", "(", "String", "s", ":", "calculatedSources", ")", "{", "if", "(", "!", "listedSources", ".", "contains", "(", "s", ")", ")", "{", "throw", "new", "ProblemException", "(", "\"The smart javac wrapper calculated source \"", "+", "s", "+", "\" was not listed by the makefiles!\"", ")", ";", "}", "}", "}" ]
Compare the calculate source list, with an explicit list, usually supplied from the makefile. Used to detect bugs where the makefile and sjavac have different opinions on which files should be compiled.
[ "Compare", "the", "calculate", "source", "list", "with", "an", "explicit", "list", "usually", "supplied", "from", "the", "makefile", ".", "Used", "to", "detect", "bugs", "where", "the", "makefile", "and", "sjavac", "have", "different", "opinions", "on", "which", "files", "should", "be", "compiled", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L906-L973
5,232
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/Eval.java
Eval.eval
List<SnippetEvent> eval(String userSource) throws IllegalStateException { List<SnippetEvent> allEvents = new ArrayList<>(); for (Snippet snip : sourceToSnippets(userSource)) { if (snip.kind() == Kind.ERRONEOUS) { state.maps.installSnippet(snip); allEvents.add(new SnippetEvent( snip, Status.NONEXISTENT, Status.REJECTED, false, null, null, null)); } else { allEvents.addAll(declare(snip, snip.syntheticDiags())); } } return allEvents; }
java
List<SnippetEvent> eval(String userSource) throws IllegalStateException { List<SnippetEvent> allEvents = new ArrayList<>(); for (Snippet snip : sourceToSnippets(userSource)) { if (snip.kind() == Kind.ERRONEOUS) { state.maps.installSnippet(snip); allEvents.add(new SnippetEvent( snip, Status.NONEXISTENT, Status.REJECTED, false, null, null, null)); } else { allEvents.addAll(declare(snip, snip.syntheticDiags())); } } return allEvents; }
[ "List", "<", "SnippetEvent", ">", "eval", "(", "String", "userSource", ")", "throws", "IllegalStateException", "{", "List", "<", "SnippetEvent", ">", "allEvents", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Snippet", "snip", ":", "sourceToSnippets", "(", "userSource", ")", ")", "{", "if", "(", "snip", ".", "kind", "(", ")", "==", "Kind", ".", "ERRONEOUS", ")", "{", "state", ".", "maps", ".", "installSnippet", "(", "snip", ")", ";", "allEvents", ".", "add", "(", "new", "SnippetEvent", "(", "snip", ",", "Status", ".", "NONEXISTENT", ",", "Status", ".", "REJECTED", ",", "false", ",", "null", ",", "null", ",", "null", ")", ")", ";", "}", "else", "{", "allEvents", ".", "addAll", "(", "declare", "(", "snip", ",", "snip", ".", "syntheticDiags", "(", ")", ")", ")", ";", "}", "}", "return", "allEvents", ";", "}" ]
Evaluates a snippet of source. @param userSource the source of the snippet @return the list of primary and update events @throws IllegalStateException
[ "Evaluates", "a", "snippet", "of", "source", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/Eval.java#L109-L122
5,233
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java
AbstractLog.useSource
public JavaFileObject useSource(JavaFileObject file) { JavaFileObject prev = (source == null ? null : source.getFile()); source = getSource(file); return prev; }
java
public JavaFileObject useSource(JavaFileObject file) { JavaFileObject prev = (source == null ? null : source.getFile()); source = getSource(file); return prev; }
[ "public", "JavaFileObject", "useSource", "(", "JavaFileObject", "file", ")", "{", "JavaFileObject", "prev", "=", "(", "source", "==", "null", "?", "null", ":", "source", ".", "getFile", "(", ")", ")", ";", "source", "=", "getSource", "(", "file", ")", ";", "return", "prev", ";", "}" ]
Re-assign source, returning previous setting.
[ "Re", "-", "assign", "source", "returning", "previous", "setting", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java#L70-L74
5,234
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java
AbstractLog.mandatoryWarning
public void mandatoryWarning(LintCategory lc, DiagnosticPosition pos, Warning warningKey) { report(diags.mandatoryWarning(lc, source, pos, warningKey)); }
java
public void mandatoryWarning(LintCategory lc, DiagnosticPosition pos, Warning warningKey) { report(diags.mandatoryWarning(lc, source, pos, warningKey)); }
[ "public", "void", "mandatoryWarning", "(", "LintCategory", "lc", ",", "DiagnosticPosition", "pos", ",", "Warning", "warningKey", ")", "{", "report", "(", "diags", ".", "mandatoryWarning", "(", "lc", ",", "source", ",", "pos", ",", "warningKey", ")", ")", ";", "}" ]
Report a warning. @param lc The lint category for the diagnostic @param pos The source position at which to report the warning. @param warningKey The key for the localized warning message.
[ "Report", "a", "warning", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java#L317-L319
5,235
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java
Utils.toProgramElementDocArray
public ProgramElementDoc[] toProgramElementDocArray(List<ProgramElementDoc> list) { ProgramElementDoc[] pgmarr = new ProgramElementDoc[list.size()]; for (int i = 0; i < list.size(); i++) { pgmarr[i] = list.get(i); } return pgmarr; }
java
public ProgramElementDoc[] toProgramElementDocArray(List<ProgramElementDoc> list) { ProgramElementDoc[] pgmarr = new ProgramElementDoc[list.size()]; for (int i = 0; i < list.size(); i++) { pgmarr[i] = list.get(i); } return pgmarr; }
[ "public", "ProgramElementDoc", "[", "]", "toProgramElementDocArray", "(", "List", "<", "ProgramElementDoc", ">", "list", ")", "{", "ProgramElementDoc", "[", "]", "pgmarr", "=", "new", "ProgramElementDoc", "[", "list", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "{", "pgmarr", "[", "i", "]", "=", "list", ".", "get", "(", "i", ")", ";", "}", "return", "pgmarr", ";", "}" ]
Return the list of ProgramElementDoc objects as Array.
[ "Return", "the", "list", "of", "ProgramElementDoc", "objects", "as", "Array", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java#L93-L99
5,236
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java
Utils.getPackageName
public String getPackageName(PackageDoc packageDoc) { return packageDoc == null || packageDoc.name().length() == 0 ? DocletConstants.DEFAULT_PACKAGE_NAME : packageDoc.name(); }
java
public String getPackageName(PackageDoc packageDoc) { return packageDoc == null || packageDoc.name().length() == 0 ? DocletConstants.DEFAULT_PACKAGE_NAME : packageDoc.name(); }
[ "public", "String", "getPackageName", "(", "PackageDoc", "packageDoc", ")", "{", "return", "packageDoc", "==", "null", "||", "packageDoc", ".", "name", "(", ")", ".", "length", "(", ")", "==", "0", "?", "DocletConstants", ".", "DEFAULT_PACKAGE_NAME", ":", "packageDoc", ".", "name", "(", ")", ";", "}" ]
Given a package, return its name. @param packageDoc the package to check. @return the name of the given package.
[ "Given", "a", "package", "return", "its", "name", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java#L398-L401
5,237
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java
Utils.getPackageFileHeadName
public String getPackageFileHeadName(PackageDoc packageDoc) { return packageDoc == null || packageDoc.name().length() == 0 ? DocletConstants.DEFAULT_PACKAGE_FILE_NAME : packageDoc.name(); }
java
public String getPackageFileHeadName(PackageDoc packageDoc) { return packageDoc == null || packageDoc.name().length() == 0 ? DocletConstants.DEFAULT_PACKAGE_FILE_NAME : packageDoc.name(); }
[ "public", "String", "getPackageFileHeadName", "(", "PackageDoc", "packageDoc", ")", "{", "return", "packageDoc", "==", "null", "||", "packageDoc", ".", "name", "(", ")", ".", "length", "(", ")", "==", "0", "?", "DocletConstants", ".", "DEFAULT_PACKAGE_FILE_NAME", ":", "packageDoc", ".", "name", "(", ")", ";", "}" ]
Given a package, return its file name without the extension. @param packageDoc the package to check. @return the file name of the given package.
[ "Given", "a", "package", "return", "its", "file", "name", "without", "the", "extension", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java#L408-L411
5,238
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java
Utils.replaceTabs
public String replaceTabs(Configuration configuration, String text) { if (!text.contains("\t")) return text; final int tabLength = configuration.sourcetab; final String whitespace = configuration.tabSpaces; final int textLength = text.length(); StringBuilder result = new StringBuilder(textLength); int pos = 0; int lineLength = 0; for (int i = 0; i < textLength; i++) { char ch = text.charAt(i); switch (ch) { case '\n': case '\r': lineLength = 0; break; case '\t': result.append(text, pos, i); int spaceCount = tabLength - lineLength % tabLength; result.append(whitespace, 0, spaceCount); lineLength += spaceCount; pos = i + 1; break; default: lineLength++; } } result.append(text, pos, textLength); return result.toString(); }
java
public String replaceTabs(Configuration configuration, String text) { if (!text.contains("\t")) return text; final int tabLength = configuration.sourcetab; final String whitespace = configuration.tabSpaces; final int textLength = text.length(); StringBuilder result = new StringBuilder(textLength); int pos = 0; int lineLength = 0; for (int i = 0; i < textLength; i++) { char ch = text.charAt(i); switch (ch) { case '\n': case '\r': lineLength = 0; break; case '\t': result.append(text, pos, i); int spaceCount = tabLength - lineLength % tabLength; result.append(whitespace, 0, spaceCount); lineLength += spaceCount; pos = i + 1; break; default: lineLength++; } } result.append(text, pos, textLength); return result.toString(); }
[ "public", "String", "replaceTabs", "(", "Configuration", "configuration", ",", "String", "text", ")", "{", "if", "(", "!", "text", ".", "contains", "(", "\"\\t\"", ")", ")", "return", "text", ";", "final", "int", "tabLength", "=", "configuration", ".", "sourcetab", ";", "final", "String", "whitespace", "=", "configuration", ".", "tabSpaces", ";", "final", "int", "textLength", "=", "text", ".", "length", "(", ")", ";", "StringBuilder", "result", "=", "new", "StringBuilder", "(", "textLength", ")", ";", "int", "pos", "=", "0", ";", "int", "lineLength", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "textLength", ";", "i", "++", ")", "{", "char", "ch", "=", "text", ".", "charAt", "(", "i", ")", ";", "switch", "(", "ch", ")", "{", "case", "'", "'", ":", "case", "'", "'", ":", "lineLength", "=", "0", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "text", ",", "pos", ",", "i", ")", ";", "int", "spaceCount", "=", "tabLength", "-", "lineLength", "%", "tabLength", ";", "result", ".", "append", "(", "whitespace", ",", "0", ",", "spaceCount", ")", ";", "lineLength", "+=", "spaceCount", ";", "pos", "=", "i", "+", "1", ";", "break", ";", "default", ":", "lineLength", "++", ";", "}", "}", "result", ".", "append", "(", "text", ",", "pos", ",", "textLength", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Replace all tabs in a string with the appropriate number of spaces. The string may be a multi-line string. @param configuration the doclet configuration defining the setting for the tab length. @param text the text for which the tabs should be expanded @return the text with all tabs expanded
[ "Replace", "all", "tabs", "in", "a", "string", "with", "the", "appropriate", "number", "of", "spaces", ".", "The", "string", "may", "be", "a", "multi", "-", "line", "string", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java#L606-L635
5,239
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialMethodWriter.java
HtmlSerialMethodWriter.getSerializableMethods
public Content getSerializableMethods(String heading, Content serializableMethodContent) { Content headingContent = new StringContent(heading); Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, headingContent); Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading); li.addContent(serializableMethodContent); return li; }
java
public Content getSerializableMethods(String heading, Content serializableMethodContent) { Content headingContent = new StringContent(heading); Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, headingContent); Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading); li.addContent(serializableMethodContent); return li; }
[ "public", "Content", "getSerializableMethods", "(", "String", "heading", ",", "Content", "serializableMethodContent", ")", "{", "Content", "headingContent", "=", "new", "StringContent", "(", "heading", ")", ";", "Content", "serialHeading", "=", "HtmlTree", ".", "HEADING", "(", "HtmlConstants", ".", "SERIALIZED_MEMBER_HEADING", ",", "headingContent", ")", ";", "Content", "li", "=", "HtmlTree", ".", "LI", "(", "HtmlStyle", ".", "blockList", ",", "serialHeading", ")", ";", "li", ".", "addContent", "(", "serializableMethodContent", ")", ";", "return", "li", ";", "}" ]
Add serializable methods. @param heading the heading for the section @param serializableMethodContent the tree to be added to the serializable methods content tree @return a content tree for the serializable methods content
[ "Add", "serializable", "methods", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialMethodWriter.java#L96-L103
5,240
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java
Extern.isExternal
public boolean isExternal(ProgramElementDoc doc) { if (packageToItemMap == null) { return false; } return packageToItemMap.get(doc.containingPackage().name()) != null; }
java
public boolean isExternal(ProgramElementDoc doc) { if (packageToItemMap == null) { return false; } return packageToItemMap.get(doc.containingPackage().name()) != null; }
[ "public", "boolean", "isExternal", "(", "ProgramElementDoc", "doc", ")", "{", "if", "(", "packageToItemMap", "==", "null", ")", "{", "return", "false", ";", "}", "return", "packageToItemMap", ".", "get", "(", "doc", ".", "containingPackage", "(", ")", ".", "name", "(", ")", ")", "!=", "null", ";", "}" ]
Determine if a doc item is externally documented. @param doc A ProgramElementDoc.
[ "Determine", "if", "a", "doc", "item", "is", "externally", "documented", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java#L132-L137
5,241
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterImpl.java
ParameterImpl.typeName
public String typeName() { return (type instanceof ClassDoc || type instanceof TypeVariable) ? type.typeName() // omit formal type params or bounds : type.toString(); }
java
public String typeName() { return (type instanceof ClassDoc || type instanceof TypeVariable) ? type.typeName() // omit formal type params or bounds : type.toString(); }
[ "public", "String", "typeName", "(", ")", "{", "return", "(", "type", "instanceof", "ClassDoc", "||", "type", "instanceof", "TypeVariable", ")", "?", "type", ".", "typeName", "(", ")", "// omit formal type params or bounds", ":", "type", ".", "toString", "(", ")", ";", "}" ]
Get type name of this parameter. For example if parameter is the short 'index', returns "short".
[ "Get", "type", "name", "of", "this", "parameter", ".", "For", "example", "if", "parameter", "is", "the", "short", "index", "returns", "short", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterImpl.java#L81-L85
5,242
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterImpl.java
ParameterImpl.annotations
public AnnotationDesc[] annotations() { AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()]; int i = 0; for (Attribute.Compound a : sym.getRawAttributes()) { res[i++] = new AnnotationDescImpl(env, a); } return res; }
java
public AnnotationDesc[] annotations() { AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()]; int i = 0; for (Attribute.Compound a : sym.getRawAttributes()) { res[i++] = new AnnotationDescImpl(env, a); } return res; }
[ "public", "AnnotationDesc", "[", "]", "annotations", "(", ")", "{", "AnnotationDesc", "res", "[", "]", "=", "new", "AnnotationDesc", "[", "sym", ".", "getRawAttributes", "(", ")", ".", "length", "(", ")", "]", ";", "int", "i", "=", "0", ";", "for", "(", "Attribute", ".", "Compound", "a", ":", "sym", ".", "getRawAttributes", "(", ")", ")", "{", "res", "[", "i", "++", "]", "=", "new", "AnnotationDescImpl", "(", "env", ",", "a", ")", ";", "}", "return", "res", ";", "}" ]
Get the annotations of this parameter. Return an empty array if there are none.
[ "Get", "the", "annotations", "of", "this", "parameter", ".", "Return", "an", "empty", "array", "if", "there", "are", "none", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterImpl.java#L102-L109
5,243
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.isStatic
protected static boolean isStatic(Env<AttrContext> env) { return env.outer != null && env.info.staticLevel > env.outer.info.staticLevel; }
java
protected static boolean isStatic(Env<AttrContext> env) { return env.outer != null && env.info.staticLevel > env.outer.info.staticLevel; }
[ "protected", "static", "boolean", "isStatic", "(", "Env", "<", "AttrContext", ">", "env", ")", "{", "return", "env", ".", "outer", "!=", "null", "&&", "env", ".", "info", ".", "staticLevel", ">", "env", ".", "outer", ".", "info", ".", "staticLevel", ";", "}" ]
An environment is "static" if its static level is greater than the one of its outer environment
[ "An", "environment", "is", "static", "if", "its", "static", "level", "is", "greater", "than", "the", "one", "of", "its", "outer", "environment" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L278-L280
5,244
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.isInitializer
static boolean isInitializer(Env<AttrContext> env) { Symbol owner = env.info.scope.owner; return owner.isConstructor() || owner.owner.kind == TYP && (owner.kind == VAR || owner.kind == MTH && (owner.flags() & BLOCK) != 0) && (owner.flags() & STATIC) == 0; }
java
static boolean isInitializer(Env<AttrContext> env) { Symbol owner = env.info.scope.owner; return owner.isConstructor() || owner.owner.kind == TYP && (owner.kind == VAR || owner.kind == MTH && (owner.flags() & BLOCK) != 0) && (owner.flags() & STATIC) == 0; }
[ "static", "boolean", "isInitializer", "(", "Env", "<", "AttrContext", ">", "env", ")", "{", "Symbol", "owner", "=", "env", ".", "info", ".", "scope", ".", "owner", ";", "return", "owner", ".", "isConstructor", "(", ")", "||", "owner", ".", "owner", ".", "kind", "==", "TYP", "&&", "(", "owner", ".", "kind", "==", "VAR", "||", "owner", ".", "kind", "==", "MTH", "&&", "(", "owner", ".", "flags", "(", ")", "&", "BLOCK", ")", "!=", "0", ")", "&&", "(", "owner", ".", "flags", "(", ")", "&", "STATIC", ")", "==", "0", ";", "}" ]
An environment is an "initializer" if it is a constructor or an instance initializer.
[ "An", "environment", "is", "an", "initializer", "if", "it", "is", "a", "constructor", "or", "an", "instance", "initializer", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L285-L292
5,245
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.isAccessible
public boolean isAccessible(Env<AttrContext> env, TypeSymbol c) { return isAccessible(env, c, false); }
java
public boolean isAccessible(Env<AttrContext> env, TypeSymbol c) { return isAccessible(env, c, false); }
[ "public", "boolean", "isAccessible", "(", "Env", "<", "AttrContext", ">", "env", ",", "TypeSymbol", "c", ")", "{", "return", "isAccessible", "(", "env", ",", "c", ",", "false", ")", ";", "}" ]
Is class accessible in given evironment? @param env The current environment. @param c The class whose accessibility is checked.
[ "Is", "class", "accessible", "in", "given", "evironment?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L298-L300
5,246
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.isInnerSubClass
private boolean isInnerSubClass(ClassSymbol c, Symbol base) { while (c != null && !c.isSubClass(base, types)) { c = c.owner.enclClass(); } return c != null; }
java
private boolean isInnerSubClass(ClassSymbol c, Symbol base) { while (c != null && !c.isSubClass(base, types)) { c = c.owner.enclClass(); } return c != null; }
[ "private", "boolean", "isInnerSubClass", "(", "ClassSymbol", "c", ",", "Symbol", "base", ")", "{", "while", "(", "c", "!=", "null", "&&", "!", "c", ".", "isSubClass", "(", "base", ",", "types", ")", ")", "{", "c", "=", "c", ".", "owner", ".", "enclClass", "(", ")", ";", "}", "return", "c", "!=", "null", ";", "}" ]
Is given class a subclass of given base class, or an inner class of a subclass? Return null if no such class exists. @param c The class which is the subclass or is contained in it. @param base The base class
[ "Is", "given", "class", "a", "subclass", "of", "given", "base", "class", "or", "an", "inner", "class", "of", "a", "subclass?", "Return", "null", "if", "no", "such", "class", "exists", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L365-L370
5,247
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.isAccessible
public boolean isAccessible(Env<AttrContext> env, Type site, Symbol sym) { return isAccessible(env, site, sym, false); }
java
public boolean isAccessible(Env<AttrContext> env, Type site, Symbol sym) { return isAccessible(env, site, sym, false); }
[ "public", "boolean", "isAccessible", "(", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Symbol", "sym", ")", "{", "return", "isAccessible", "(", "env", ",", "site", ",", "sym", ",", "false", ")", ";", "}" ]
Is symbol accessible as a member of given type in given environment? @param env The current environment. @param site The type of which the tested symbol is regarded as a member. @param sym The symbol.
[ "Is", "symbol", "accessible", "as", "a", "member", "of", "given", "type", "in", "given", "environment?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L388-L390
5,248
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.isProtectedAccessible
private boolean isProtectedAccessible(Symbol sym, ClassSymbol c, Type site) { Type newSite = site.hasTag(TYPEVAR) ? site.getUpperBound() : site; while (c != null && !(c.isSubClass(sym.owner, types) && (c.flags() & INTERFACE) == 0 && // In JLS 2e 6.6.2.1, the subclass restriction applies // only to instance fields and methods -- types are excluded // regardless of whether they are declared 'static' or not. ((sym.flags() & STATIC) != 0 || sym.kind == TYP || newSite.tsym.isSubClass(c, types)))) c = c.owner.enclClass(); return c != null; }
java
private boolean isProtectedAccessible(Symbol sym, ClassSymbol c, Type site) { Type newSite = site.hasTag(TYPEVAR) ? site.getUpperBound() : site; while (c != null && !(c.isSubClass(sym.owner, types) && (c.flags() & INTERFACE) == 0 && // In JLS 2e 6.6.2.1, the subclass restriction applies // only to instance fields and methods -- types are excluded // regardless of whether they are declared 'static' or not. ((sym.flags() & STATIC) != 0 || sym.kind == TYP || newSite.tsym.isSubClass(c, types)))) c = c.owner.enclClass(); return c != null; }
[ "private", "boolean", "isProtectedAccessible", "(", "Symbol", "sym", ",", "ClassSymbol", "c", ",", "Type", "site", ")", "{", "Type", "newSite", "=", "site", ".", "hasTag", "(", "TYPEVAR", ")", "?", "site", ".", "getUpperBound", "(", ")", ":", "site", ";", "while", "(", "c", "!=", "null", "&&", "!", "(", "c", ".", "isSubClass", "(", "sym", ".", "owner", ",", "types", ")", "&&", "(", "c", ".", "flags", "(", ")", "&", "INTERFACE", ")", "==", "0", "&&", "// In JLS 2e 6.6.2.1, the subclass restriction applies", "// only to instance fields and methods -- types are excluded", "// regardless of whether they are declared 'static' or not.", "(", "(", "sym", ".", "flags", "(", ")", "&", "STATIC", ")", "!=", "0", "||", "sym", ".", "kind", "==", "TYP", "||", "newSite", ".", "tsym", ".", "isSubClass", "(", "c", ",", "types", ")", ")", ")", ")", "c", "=", "c", ".", "owner", ".", "enclClass", "(", ")", ";", "return", "c", "!=", "null", ";", "}" ]
Is given protected symbol accessible if it is selected from given site and the selection takes place in given class? @param sym The symbol with protected access @param c The class where the access takes place @site The type of the qualifier
[ "Is", "given", "protected", "symbol", "accessible", "if", "it", "is", "selected", "from", "given", "site", "and", "the", "selection", "takes", "place", "in", "given", "class?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L467-L479
5,249
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.checkAccessibleType
void checkAccessibleType(Env<AttrContext> env, Type t) { accessibilityChecker.visit(t, env); }
java
void checkAccessibleType(Env<AttrContext> env, Type t) { accessibilityChecker.visit(t, env); }
[ "void", "checkAccessibleType", "(", "Env", "<", "AttrContext", ">", "env", ",", "Type", "t", ")", "{", "accessibilityChecker", ".", "visit", "(", "t", ",", "env", ")", ";", "}" ]
Performs a recursive scan of a type looking for accessibility problems from current attribution environment
[ "Performs", "a", "recursive", "scan", "of", "a", "type", "looking", "for", "accessibility", "problems", "from", "current", "attribution", "environment" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L485-L487
5,250
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.instantiate
Type instantiate(Env<AttrContext> env, Type site, Symbol m, ResultInfo resultInfo, List<Type> argtypes, List<Type> typeargtypes, boolean allowBoxing, boolean useVarargs, Warner warn) { try { return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes, allowBoxing, useVarargs, warn); } catch (InapplicableMethodException ex) { return null; } }
java
Type instantiate(Env<AttrContext> env, Type site, Symbol m, ResultInfo resultInfo, List<Type> argtypes, List<Type> typeargtypes, boolean allowBoxing, boolean useVarargs, Warner warn) { try { return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes, allowBoxing, useVarargs, warn); } catch (InapplicableMethodException ex) { return null; } }
[ "Type", "instantiate", "(", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Symbol", "m", ",", "ResultInfo", "resultInfo", ",", "List", "<", "Type", ">", "argtypes", ",", "List", "<", "Type", ">", "typeargtypes", ",", "boolean", "allowBoxing", ",", "boolean", "useVarargs", ",", "Warner", "warn", ")", "{", "try", "{", "return", "rawInstantiate", "(", "env", ",", "site", ",", "m", ",", "resultInfo", ",", "argtypes", ",", "typeargtypes", ",", "allowBoxing", ",", "useVarargs", ",", "warn", ")", ";", "}", "catch", "(", "InapplicableMethodException", "ex", ")", "{", "return", "null", ";", "}", "}" ]
Same but returns null instead throwing a NoInstanceException
[ "Same", "but", "returns", "null", "instead", "throwing", "a", "NoInstanceException" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L653-L668
5,251
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.findField
Symbol findField(Env<AttrContext> env, Type site, Name name, TypeSymbol c) { while (c.type.hasTag(TYPEVAR)) c = c.type.getUpperBound().tsym; Symbol bestSoFar = varNotFound; Symbol sym; for (Symbol s : c.members().getSymbolsByName(name)) { if (s.kind == VAR && (s.flags_field & SYNTHETIC) == 0) { return isAccessible(env, site, s) ? s : new AccessError(env, site, s); } } Type st = types.supertype(c.type); if (st != null && (st.hasTag(CLASS) || st.hasTag(TYPEVAR))) { sym = findField(env, site, name, st.tsym); bestSoFar = bestOf(bestSoFar, sym); } for (List<Type> l = types.interfaces(c.type); bestSoFar.kind != AMBIGUOUS && l.nonEmpty(); l = l.tail) { sym = findField(env, site, name, l.head.tsym); if (bestSoFar.exists() && sym.exists() && sym.owner != bestSoFar.owner) bestSoFar = new AmbiguityError(bestSoFar, sym); else bestSoFar = bestOf(bestSoFar, sym); } return bestSoFar; }
java
Symbol findField(Env<AttrContext> env, Type site, Name name, TypeSymbol c) { while (c.type.hasTag(TYPEVAR)) c = c.type.getUpperBound().tsym; Symbol bestSoFar = varNotFound; Symbol sym; for (Symbol s : c.members().getSymbolsByName(name)) { if (s.kind == VAR && (s.flags_field & SYNTHETIC) == 0) { return isAccessible(env, site, s) ? s : new AccessError(env, site, s); } } Type st = types.supertype(c.type); if (st != null && (st.hasTag(CLASS) || st.hasTag(TYPEVAR))) { sym = findField(env, site, name, st.tsym); bestSoFar = bestOf(bestSoFar, sym); } for (List<Type> l = types.interfaces(c.type); bestSoFar.kind != AMBIGUOUS && l.nonEmpty(); l = l.tail) { sym = findField(env, site, name, l.head.tsym); if (bestSoFar.exists() && sym.exists() && sym.owner != bestSoFar.owner) bestSoFar = new AmbiguityError(bestSoFar, sym); else bestSoFar = bestOf(bestSoFar, sym); } return bestSoFar; }
[ "Symbol", "findField", "(", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Name", "name", ",", "TypeSymbol", "c", ")", "{", "while", "(", "c", ".", "type", ".", "hasTag", "(", "TYPEVAR", ")", ")", "c", "=", "c", ".", "type", ".", "getUpperBound", "(", ")", ".", "tsym", ";", "Symbol", "bestSoFar", "=", "varNotFound", ";", "Symbol", "sym", ";", "for", "(", "Symbol", "s", ":", "c", ".", "members", "(", ")", ".", "getSymbolsByName", "(", "name", ")", ")", "{", "if", "(", "s", ".", "kind", "==", "VAR", "&&", "(", "s", ".", "flags_field", "&", "SYNTHETIC", ")", "==", "0", ")", "{", "return", "isAccessible", "(", "env", ",", "site", ",", "s", ")", "?", "s", ":", "new", "AccessError", "(", "env", ",", "site", ",", "s", ")", ";", "}", "}", "Type", "st", "=", "types", ".", "supertype", "(", "c", ".", "type", ")", ";", "if", "(", "st", "!=", "null", "&&", "(", "st", ".", "hasTag", "(", "CLASS", ")", "||", "st", ".", "hasTag", "(", "TYPEVAR", ")", ")", ")", "{", "sym", "=", "findField", "(", "env", ",", "site", ",", "name", ",", "st", ".", "tsym", ")", ";", "bestSoFar", "=", "bestOf", "(", "bestSoFar", ",", "sym", ")", ";", "}", "for", "(", "List", "<", "Type", ">", "l", "=", "types", ".", "interfaces", "(", "c", ".", "type", ")", ";", "bestSoFar", ".", "kind", "!=", "AMBIGUOUS", "&&", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", ".", "tail", ")", "{", "sym", "=", "findField", "(", "env", ",", "site", ",", "name", ",", "l", ".", "head", ".", "tsym", ")", ";", "if", "(", "bestSoFar", ".", "exists", "(", ")", "&&", "sym", ".", "exists", "(", ")", "&&", "sym", ".", "owner", "!=", "bestSoFar", ".", "owner", ")", "bestSoFar", "=", "new", "AmbiguityError", "(", "bestSoFar", ",", "sym", ")", ";", "else", "bestSoFar", "=", "bestOf", "(", "bestSoFar", ",", "sym", ")", ";", "}", "return", "bestSoFar", ";", "}" ]
Find field. Synthetic fields are always skipped. @param env The current environment. @param site The original type from where the selection takes place. @param name The name of the field. @param c The class to search for the field. This is always a superclass or implemented interface of site's class.
[ "Find", "field", ".", "Synthetic", "fields", "are", "always", "skipped", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L1419-L1449
5,252
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveInternalField
public VarSymbol resolveInternalField(DiagnosticPosition pos, Env<AttrContext> env, Type site, Name name) { Symbol sym = findField(env, site, name, site.tsym); if (sym.kind == VAR) return (VarSymbol)sym; else throw new FatalError( diags.fragment("fatal.err.cant.locate.field", name)); }
java
public VarSymbol resolveInternalField(DiagnosticPosition pos, Env<AttrContext> env, Type site, Name name) { Symbol sym = findField(env, site, name, site.tsym); if (sym.kind == VAR) return (VarSymbol)sym; else throw new FatalError( diags.fragment("fatal.err.cant.locate.field", name)); }
[ "public", "VarSymbol", "resolveInternalField", "(", "DiagnosticPosition", "pos", ",", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Name", "name", ")", "{", "Symbol", "sym", "=", "findField", "(", "env", ",", "site", ",", "name", ",", "site", ".", "tsym", ")", ";", "if", "(", "sym", ".", "kind", "==", "VAR", ")", "return", "(", "VarSymbol", ")", "sym", ";", "else", "throw", "new", "FatalError", "(", "diags", ".", "fragment", "(", "\"fatal.err.cant.locate.field\"", ",", "name", ")", ")", ";", "}" ]
Resolve a field identifier, throw a fatal error if not found. @param pos The position to use for error reporting. @param env The environment current at the method invocation. @param site The type of the qualifying expression, in which identifier is searched. @param name The identifier's name.
[ "Resolve", "a", "field", "identifier", "throw", "a", "fatal", "error", "if", "not", "found", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L1458-L1465
5,253
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.findVar
Symbol findVar(Env<AttrContext> env, Name name) { Symbol bestSoFar = varNotFound; Env<AttrContext> env1 = env; boolean staticOnly = false; while (env1.outer != null) { Symbol sym = null; if (isStatic(env1)) staticOnly = true; for (Symbol s : env1.info.scope.getSymbolsByName(name)) { if (s.kind == VAR && (s.flags_field & SYNTHETIC) == 0) { sym = s; break; } } if (sym == null) { sym = findField(env1, env1.enclClass.sym.type, name, env1.enclClass.sym); } if (sym.exists()) { if (staticOnly && sym.kind == VAR && sym.owner.kind == TYP && (sym.flags() & STATIC) == 0) return new StaticError(sym); else return sym; } else { bestSoFar = bestOf(bestSoFar, sym); } if ((env1.enclClass.sym.flags() & STATIC) != 0) staticOnly = true; env1 = env1.outer; } Symbol sym = findField(env, syms.predefClass.type, name, syms.predefClass); if (sym.exists()) return sym; if (bestSoFar.exists()) return bestSoFar; Symbol origin = null; for (Scope sc : new Scope[] { env.toplevel.namedImportScope, env.toplevel.starImportScope }) { for (Symbol currentSymbol : sc.getSymbolsByName(name)) { if (currentSymbol.kind != VAR) continue; // invariant: sym.kind == Symbol.Kind.VAR if (!bestSoFar.kind.isResolutionError() && currentSymbol.owner != bestSoFar.owner) return new AmbiguityError(bestSoFar, currentSymbol); else if (!bestSoFar.kind.betterThan(VAR)) { origin = sc.getOrigin(currentSymbol).owner; bestSoFar = isAccessible(env, origin.type, currentSymbol) ? currentSymbol : new AccessError(env, origin.type, currentSymbol); } } if (bestSoFar.exists()) break; } if (bestSoFar.kind == VAR && bestSoFar.owner.type != origin.type) return bestSoFar.clone(origin); else return bestSoFar; }
java
Symbol findVar(Env<AttrContext> env, Name name) { Symbol bestSoFar = varNotFound; Env<AttrContext> env1 = env; boolean staticOnly = false; while (env1.outer != null) { Symbol sym = null; if (isStatic(env1)) staticOnly = true; for (Symbol s : env1.info.scope.getSymbolsByName(name)) { if (s.kind == VAR && (s.flags_field & SYNTHETIC) == 0) { sym = s; break; } } if (sym == null) { sym = findField(env1, env1.enclClass.sym.type, name, env1.enclClass.sym); } if (sym.exists()) { if (staticOnly && sym.kind == VAR && sym.owner.kind == TYP && (sym.flags() & STATIC) == 0) return new StaticError(sym); else return sym; } else { bestSoFar = bestOf(bestSoFar, sym); } if ((env1.enclClass.sym.flags() & STATIC) != 0) staticOnly = true; env1 = env1.outer; } Symbol sym = findField(env, syms.predefClass.type, name, syms.predefClass); if (sym.exists()) return sym; if (bestSoFar.exists()) return bestSoFar; Symbol origin = null; for (Scope sc : new Scope[] { env.toplevel.namedImportScope, env.toplevel.starImportScope }) { for (Symbol currentSymbol : sc.getSymbolsByName(name)) { if (currentSymbol.kind != VAR) continue; // invariant: sym.kind == Symbol.Kind.VAR if (!bestSoFar.kind.isResolutionError() && currentSymbol.owner != bestSoFar.owner) return new AmbiguityError(bestSoFar, currentSymbol); else if (!bestSoFar.kind.betterThan(VAR)) { origin = sc.getOrigin(currentSymbol).owner; bestSoFar = isAccessible(env, origin.type, currentSymbol) ? currentSymbol : new AccessError(env, origin.type, currentSymbol); } } if (bestSoFar.exists()) break; } if (bestSoFar.kind == VAR && bestSoFar.owner.type != origin.type) return bestSoFar.clone(origin); else return bestSoFar; }
[ "Symbol", "findVar", "(", "Env", "<", "AttrContext", ">", "env", ",", "Name", "name", ")", "{", "Symbol", "bestSoFar", "=", "varNotFound", ";", "Env", "<", "AttrContext", ">", "env1", "=", "env", ";", "boolean", "staticOnly", "=", "false", ";", "while", "(", "env1", ".", "outer", "!=", "null", ")", "{", "Symbol", "sym", "=", "null", ";", "if", "(", "isStatic", "(", "env1", ")", ")", "staticOnly", "=", "true", ";", "for", "(", "Symbol", "s", ":", "env1", ".", "info", ".", "scope", ".", "getSymbolsByName", "(", "name", ")", ")", "{", "if", "(", "s", ".", "kind", "==", "VAR", "&&", "(", "s", ".", "flags_field", "&", "SYNTHETIC", ")", "==", "0", ")", "{", "sym", "=", "s", ";", "break", ";", "}", "}", "if", "(", "sym", "==", "null", ")", "{", "sym", "=", "findField", "(", "env1", ",", "env1", ".", "enclClass", ".", "sym", ".", "type", ",", "name", ",", "env1", ".", "enclClass", ".", "sym", ")", ";", "}", "if", "(", "sym", ".", "exists", "(", ")", ")", "{", "if", "(", "staticOnly", "&&", "sym", ".", "kind", "==", "VAR", "&&", "sym", ".", "owner", ".", "kind", "==", "TYP", "&&", "(", "sym", ".", "flags", "(", ")", "&", "STATIC", ")", "==", "0", ")", "return", "new", "StaticError", "(", "sym", ")", ";", "else", "return", "sym", ";", "}", "else", "{", "bestSoFar", "=", "bestOf", "(", "bestSoFar", ",", "sym", ")", ";", "}", "if", "(", "(", "env1", ".", "enclClass", ".", "sym", ".", "flags", "(", ")", "&", "STATIC", ")", "!=", "0", ")", "staticOnly", "=", "true", ";", "env1", "=", "env1", ".", "outer", ";", "}", "Symbol", "sym", "=", "findField", "(", "env", ",", "syms", ".", "predefClass", ".", "type", ",", "name", ",", "syms", ".", "predefClass", ")", ";", "if", "(", "sym", ".", "exists", "(", ")", ")", "return", "sym", ";", "if", "(", "bestSoFar", ".", "exists", "(", ")", ")", "return", "bestSoFar", ";", "Symbol", "origin", "=", "null", ";", "for", "(", "Scope", "sc", ":", "new", "Scope", "[", "]", "{", "env", ".", "toplevel", ".", "namedImportScope", ",", "env", ".", "toplevel", ".", "starImportScope", "}", ")", "{", "for", "(", "Symbol", "currentSymbol", ":", "sc", ".", "getSymbolsByName", "(", "name", ")", ")", "{", "if", "(", "currentSymbol", ".", "kind", "!=", "VAR", ")", "continue", ";", "// invariant: sym.kind == Symbol.Kind.VAR", "if", "(", "!", "bestSoFar", ".", "kind", ".", "isResolutionError", "(", ")", "&&", "currentSymbol", ".", "owner", "!=", "bestSoFar", ".", "owner", ")", "return", "new", "AmbiguityError", "(", "bestSoFar", ",", "currentSymbol", ")", ";", "else", "if", "(", "!", "bestSoFar", ".", "kind", ".", "betterThan", "(", "VAR", ")", ")", "{", "origin", "=", "sc", ".", "getOrigin", "(", "currentSymbol", ")", ".", "owner", ";", "bestSoFar", "=", "isAccessible", "(", "env", ",", "origin", ".", "type", ",", "currentSymbol", ")", "?", "currentSymbol", ":", "new", "AccessError", "(", "env", ",", "origin", ".", "type", ",", "currentSymbol", ")", ";", "}", "}", "if", "(", "bestSoFar", ".", "exists", "(", ")", ")", "break", ";", "}", "if", "(", "bestSoFar", ".", "kind", "==", "VAR", "&&", "bestSoFar", ".", "owner", ".", "type", "!=", "origin", ".", "type", ")", "return", "bestSoFar", ".", "clone", "(", "origin", ")", ";", "else", "return", "bestSoFar", ";", "}" ]
Find unqualified variable or field with given name. Synthetic fields always skipped. @param env The current environment. @param name The name of the variable or field.
[ "Find", "unqualified", "variable", "or", "field", "with", "given", "name", ".", "Synthetic", "fields", "always", "skipped", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L1472-L1531
5,254
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.findInheritedMemberType
Symbol findInheritedMemberType(Env<AttrContext> env, Type site, Name name, TypeSymbol c) { Symbol bestSoFar = typeNotFound; Symbol sym; Type st = types.supertype(c.type); if (st != null && st.hasTag(CLASS)) { sym = findMemberType(env, site, name, st.tsym); bestSoFar = bestOf(bestSoFar, sym); } for (List<Type> l = types.interfaces(c.type); bestSoFar.kind != AMBIGUOUS && l.nonEmpty(); l = l.tail) { sym = findMemberType(env, site, name, l.head.tsym); if (!bestSoFar.kind.isResolutionError() && !sym.kind.isResolutionError() && sym.owner != bestSoFar.owner) bestSoFar = new AmbiguityError(bestSoFar, sym); else bestSoFar = bestOf(bestSoFar, sym); } return bestSoFar; }
java
Symbol findInheritedMemberType(Env<AttrContext> env, Type site, Name name, TypeSymbol c) { Symbol bestSoFar = typeNotFound; Symbol sym; Type st = types.supertype(c.type); if (st != null && st.hasTag(CLASS)) { sym = findMemberType(env, site, name, st.tsym); bestSoFar = bestOf(bestSoFar, sym); } for (List<Type> l = types.interfaces(c.type); bestSoFar.kind != AMBIGUOUS && l.nonEmpty(); l = l.tail) { sym = findMemberType(env, site, name, l.head.tsym); if (!bestSoFar.kind.isResolutionError() && !sym.kind.isResolutionError() && sym.owner != bestSoFar.owner) bestSoFar = new AmbiguityError(bestSoFar, sym); else bestSoFar = bestOf(bestSoFar, sym); } return bestSoFar; }
[ "Symbol", "findInheritedMemberType", "(", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Name", "name", ",", "TypeSymbol", "c", ")", "{", "Symbol", "bestSoFar", "=", "typeNotFound", ";", "Symbol", "sym", ";", "Type", "st", "=", "types", ".", "supertype", "(", "c", ".", "type", ")", ";", "if", "(", "st", "!=", "null", "&&", "st", ".", "hasTag", "(", "CLASS", ")", ")", "{", "sym", "=", "findMemberType", "(", "env", ",", "site", ",", "name", ",", "st", ".", "tsym", ")", ";", "bestSoFar", "=", "bestOf", "(", "bestSoFar", ",", "sym", ")", ";", "}", "for", "(", "List", "<", "Type", ">", "l", "=", "types", ".", "interfaces", "(", "c", ".", "type", ")", ";", "bestSoFar", ".", "kind", "!=", "AMBIGUOUS", "&&", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", ".", "tail", ")", "{", "sym", "=", "findMemberType", "(", "env", ",", "site", ",", "name", ",", "l", ".", "head", ".", "tsym", ")", ";", "if", "(", "!", "bestSoFar", ".", "kind", ".", "isResolutionError", "(", ")", "&&", "!", "sym", ".", "kind", ".", "isResolutionError", "(", ")", "&&", "sym", ".", "owner", "!=", "bestSoFar", ".", "owner", ")", "bestSoFar", "=", "new", "AmbiguityError", "(", "bestSoFar", ",", "sym", ")", ";", "else", "bestSoFar", "=", "bestOf", "(", "bestSoFar", ",", "sym", ")", ";", "}", "return", "bestSoFar", ";", "}" ]
Find a member type inherited from a superclass or interface. @param env The current environment. @param site The original type from where the selection takes place. @param name The type's name. @param c The class to search for the member type. This is always a superclass or implemented interface of site's class.
[ "Find", "a", "member", "type", "inherited", "from", "a", "superclass", "or", "interface", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2187-L2210
5,255
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.findMemberType
Symbol findMemberType(Env<AttrContext> env, Type site, Name name, TypeSymbol c) { Symbol sym = findImmediateMemberType(env, site, name, c); if (sym != typeNotFound) return sym; return findInheritedMemberType(env, site, name, c); }
java
Symbol findMemberType(Env<AttrContext> env, Type site, Name name, TypeSymbol c) { Symbol sym = findImmediateMemberType(env, site, name, c); if (sym != typeNotFound) return sym; return findInheritedMemberType(env, site, name, c); }
[ "Symbol", "findMemberType", "(", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Name", "name", ",", "TypeSymbol", "c", ")", "{", "Symbol", "sym", "=", "findImmediateMemberType", "(", "env", ",", "site", ",", "name", ",", "c", ")", ";", "if", "(", "sym", "!=", "typeNotFound", ")", "return", "sym", ";", "return", "findInheritedMemberType", "(", "env", ",", "site", ",", "name", ",", "c", ")", ";", "}" ]
Find qualified member type. @param env The current environment. @param site The original type from where the selection takes place. @param name The type's name. @param c The class to search for the member type. This is always a superclass or implemented interface of site's class.
[ "Find", "qualified", "member", "type", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2221-L2232
5,256
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.findType
Symbol findType(Env<AttrContext> env, Name name) { if (name == names.empty) return typeNotFound; // do not allow inadvertent "lookup" of anonymous types Symbol bestSoFar = typeNotFound; Symbol sym; boolean staticOnly = false; for (Env<AttrContext> env1 = env; env1.outer != null; env1 = env1.outer) { if (isStatic(env1)) staticOnly = true; // First, look for a type variable and the first member type final Symbol tyvar = findTypeVar(env1, name, staticOnly); sym = findImmediateMemberType(env1, env1.enclClass.sym.type, name, env1.enclClass.sym); // Return the type variable if we have it, and have no // immediate member, OR the type variable is for a method. if (tyvar != typeNotFound) { if (env.baseClause || sym == typeNotFound || (tyvar.kind == TYP && tyvar.exists() && tyvar.owner.kind == MTH)) { return tyvar; } } // If the environment is a class def, finish up, // otherwise, do the entire findMemberType if (sym == typeNotFound) sym = findInheritedMemberType(env1, env1.enclClass.sym.type, name, env1.enclClass.sym); if (staticOnly && sym.kind == TYP && sym.type.hasTag(CLASS) && sym.type.getEnclosingType().hasTag(CLASS) && env1.enclClass.sym.type.isParameterized() && sym.type.getEnclosingType().isParameterized()) return new StaticError(sym); else if (sym.exists()) return sym; else bestSoFar = bestOf(bestSoFar, sym); JCClassDecl encl = env1.baseClause ? (JCClassDecl)env1.tree : env1.enclClass; if ((encl.sym.flags() & STATIC) != 0) staticOnly = true; } if (!env.tree.hasTag(IMPORT)) { sym = findGlobalType(env, env.toplevel.namedImportScope, name, namedImportScopeRecovery); if (sym.exists()) return sym; else bestSoFar = bestOf(bestSoFar, sym); sym = findGlobalType(env, env.toplevel.packge.members(), name, noRecovery); if (sym.exists()) return sym; else bestSoFar = bestOf(bestSoFar, sym); sym = findGlobalType(env, env.toplevel.starImportScope, name, starImportScopeRecovery); if (sym.exists()) return sym; else bestSoFar = bestOf(bestSoFar, sym); } return bestSoFar; }
java
Symbol findType(Env<AttrContext> env, Name name) { if (name == names.empty) return typeNotFound; // do not allow inadvertent "lookup" of anonymous types Symbol bestSoFar = typeNotFound; Symbol sym; boolean staticOnly = false; for (Env<AttrContext> env1 = env; env1.outer != null; env1 = env1.outer) { if (isStatic(env1)) staticOnly = true; // First, look for a type variable and the first member type final Symbol tyvar = findTypeVar(env1, name, staticOnly); sym = findImmediateMemberType(env1, env1.enclClass.sym.type, name, env1.enclClass.sym); // Return the type variable if we have it, and have no // immediate member, OR the type variable is for a method. if (tyvar != typeNotFound) { if (env.baseClause || sym == typeNotFound || (tyvar.kind == TYP && tyvar.exists() && tyvar.owner.kind == MTH)) { return tyvar; } } // If the environment is a class def, finish up, // otherwise, do the entire findMemberType if (sym == typeNotFound) sym = findInheritedMemberType(env1, env1.enclClass.sym.type, name, env1.enclClass.sym); if (staticOnly && sym.kind == TYP && sym.type.hasTag(CLASS) && sym.type.getEnclosingType().hasTag(CLASS) && env1.enclClass.sym.type.isParameterized() && sym.type.getEnclosingType().isParameterized()) return new StaticError(sym); else if (sym.exists()) return sym; else bestSoFar = bestOf(bestSoFar, sym); JCClassDecl encl = env1.baseClause ? (JCClassDecl)env1.tree : env1.enclClass; if ((encl.sym.flags() & STATIC) != 0) staticOnly = true; } if (!env.tree.hasTag(IMPORT)) { sym = findGlobalType(env, env.toplevel.namedImportScope, name, namedImportScopeRecovery); if (sym.exists()) return sym; else bestSoFar = bestOf(bestSoFar, sym); sym = findGlobalType(env, env.toplevel.packge.members(), name, noRecovery); if (sym.exists()) return sym; else bestSoFar = bestOf(bestSoFar, sym); sym = findGlobalType(env, env.toplevel.starImportScope, name, starImportScopeRecovery); if (sym.exists()) return sym; else bestSoFar = bestOf(bestSoFar, sym); } return bestSoFar; }
[ "Symbol", "findType", "(", "Env", "<", "AttrContext", ">", "env", ",", "Name", "name", ")", "{", "if", "(", "name", "==", "names", ".", "empty", ")", "return", "typeNotFound", ";", "// do not allow inadvertent \"lookup\" of anonymous types", "Symbol", "bestSoFar", "=", "typeNotFound", ";", "Symbol", "sym", ";", "boolean", "staticOnly", "=", "false", ";", "for", "(", "Env", "<", "AttrContext", ">", "env1", "=", "env", ";", "env1", ".", "outer", "!=", "null", ";", "env1", "=", "env1", ".", "outer", ")", "{", "if", "(", "isStatic", "(", "env1", ")", ")", "staticOnly", "=", "true", ";", "// First, look for a type variable and the first member type", "final", "Symbol", "tyvar", "=", "findTypeVar", "(", "env1", ",", "name", ",", "staticOnly", ")", ";", "sym", "=", "findImmediateMemberType", "(", "env1", ",", "env1", ".", "enclClass", ".", "sym", ".", "type", ",", "name", ",", "env1", ".", "enclClass", ".", "sym", ")", ";", "// Return the type variable if we have it, and have no", "// immediate member, OR the type variable is for a method.", "if", "(", "tyvar", "!=", "typeNotFound", ")", "{", "if", "(", "env", ".", "baseClause", "||", "sym", "==", "typeNotFound", "||", "(", "tyvar", ".", "kind", "==", "TYP", "&&", "tyvar", ".", "exists", "(", ")", "&&", "tyvar", ".", "owner", ".", "kind", "==", "MTH", ")", ")", "{", "return", "tyvar", ";", "}", "}", "// If the environment is a class def, finish up,", "// otherwise, do the entire findMemberType", "if", "(", "sym", "==", "typeNotFound", ")", "sym", "=", "findInheritedMemberType", "(", "env1", ",", "env1", ".", "enclClass", ".", "sym", ".", "type", ",", "name", ",", "env1", ".", "enclClass", ".", "sym", ")", ";", "if", "(", "staticOnly", "&&", "sym", ".", "kind", "==", "TYP", "&&", "sym", ".", "type", ".", "hasTag", "(", "CLASS", ")", "&&", "sym", ".", "type", ".", "getEnclosingType", "(", ")", ".", "hasTag", "(", "CLASS", ")", "&&", "env1", ".", "enclClass", ".", "sym", ".", "type", ".", "isParameterized", "(", ")", "&&", "sym", ".", "type", ".", "getEnclosingType", "(", ")", ".", "isParameterized", "(", ")", ")", "return", "new", "StaticError", "(", "sym", ")", ";", "else", "if", "(", "sym", ".", "exists", "(", ")", ")", "return", "sym", ";", "else", "bestSoFar", "=", "bestOf", "(", "bestSoFar", ",", "sym", ")", ";", "JCClassDecl", "encl", "=", "env1", ".", "baseClause", "?", "(", "JCClassDecl", ")", "env1", ".", "tree", ":", "env1", ".", "enclClass", ";", "if", "(", "(", "encl", ".", "sym", ".", "flags", "(", ")", "&", "STATIC", ")", "!=", "0", ")", "staticOnly", "=", "true", ";", "}", "if", "(", "!", "env", ".", "tree", ".", "hasTag", "(", "IMPORT", ")", ")", "{", "sym", "=", "findGlobalType", "(", "env", ",", "env", ".", "toplevel", ".", "namedImportScope", ",", "name", ",", "namedImportScopeRecovery", ")", ";", "if", "(", "sym", ".", "exists", "(", ")", ")", "return", "sym", ";", "else", "bestSoFar", "=", "bestOf", "(", "bestSoFar", ",", "sym", ")", ";", "sym", "=", "findGlobalType", "(", "env", ",", "env", ".", "toplevel", ".", "packge", ".", "members", "(", ")", ",", "name", ",", "noRecovery", ")", ";", "if", "(", "sym", ".", "exists", "(", ")", ")", "return", "sym", ";", "else", "bestSoFar", "=", "bestOf", "(", "bestSoFar", ",", "sym", ")", ";", "sym", "=", "findGlobalType", "(", "env", ",", "env", ".", "toplevel", ".", "starImportScope", ",", "name", ",", "starImportScopeRecovery", ")", ";", "if", "(", "sym", ".", "exists", "(", ")", ")", "return", "sym", ";", "else", "bestSoFar", "=", "bestOf", "(", "bestSoFar", ",", "sym", ")", ";", "}", "return", "bestSoFar", ";", "}" ]
Find an unqualified type symbol. @param env The current environment. @param name The type's name.
[ "Find", "an", "unqualified", "type", "symbol", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2269-L2327
5,257
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.accessMethod
Symbol accessMethod(Symbol sym, DiagnosticPosition pos, Symbol location, Type site, Name name, boolean qualified, List<Type> argtypes, List<Type> typeargtypes) { return accessInternal(sym, pos, location, site, name, qualified, argtypes, typeargtypes, methodLogResolveHelper); }
java
Symbol accessMethod(Symbol sym, DiagnosticPosition pos, Symbol location, Type site, Name name, boolean qualified, List<Type> argtypes, List<Type> typeargtypes) { return accessInternal(sym, pos, location, site, name, qualified, argtypes, typeargtypes, methodLogResolveHelper); }
[ "Symbol", "accessMethod", "(", "Symbol", "sym", ",", "DiagnosticPosition", "pos", ",", "Symbol", "location", ",", "Type", "site", ",", "Name", "name", ",", "boolean", "qualified", ",", "List", "<", "Type", ">", "argtypes", ",", "List", "<", "Type", ">", "typeargtypes", ")", "{", "return", "accessInternal", "(", "sym", ",", "pos", ",", "location", ",", "site", ",", "name", ",", "qualified", ",", "argtypes", ",", "typeargtypes", ",", "methodLogResolveHelper", ")", ";", "}" ]
Variant of the generalized access routine, to be used for generating method resolution diagnostics
[ "Variant", "of", "the", "generalized", "access", "routine", "to", "be", "used", "for", "generating", "method", "resolution", "diagnostics" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2458-L2467
5,258
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.accessBase
Symbol accessBase(Symbol sym, DiagnosticPosition pos, Symbol location, Type site, Name name, boolean qualified) { return accessInternal(sym, pos, location, site, name, qualified, List.nil(), null, basicLogResolveHelper); }
java
Symbol accessBase(Symbol sym, DiagnosticPosition pos, Symbol location, Type site, Name name, boolean qualified) { return accessInternal(sym, pos, location, site, name, qualified, List.nil(), null, basicLogResolveHelper); }
[ "Symbol", "accessBase", "(", "Symbol", "sym", ",", "DiagnosticPosition", "pos", ",", "Symbol", "location", ",", "Type", "site", ",", "Name", "name", ",", "boolean", "qualified", ")", "{", "return", "accessInternal", "(", "sym", ",", "pos", ",", "location", ",", "site", ",", "name", ",", "qualified", ",", "List", ".", "nil", "(", ")", ",", "null", ",", "basicLogResolveHelper", ")", ";", "}" ]
Variant of the generalized access routine, to be used for generating variable, type resolution diagnostics
[ "Variant", "of", "the", "generalized", "access", "routine", "to", "be", "used", "for", "generating", "variable", "type", "resolution", "diagnostics" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2485-L2492
5,259
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.checkNonAbstract
void checkNonAbstract(DiagnosticPosition pos, Symbol sym) { if ((sym.flags() & ABSTRACT) != 0 && (sym.flags() & DEFAULT) == 0) log.error(pos, "abstract.cant.be.accessed.directly", kindName(sym), sym, sym.location()); }
java
void checkNonAbstract(DiagnosticPosition pos, Symbol sym) { if ((sym.flags() & ABSTRACT) != 0 && (sym.flags() & DEFAULT) == 0) log.error(pos, "abstract.cant.be.accessed.directly", kindName(sym), sym, sym.location()); }
[ "void", "checkNonAbstract", "(", "DiagnosticPosition", "pos", ",", "Symbol", "sym", ")", "{", "if", "(", "(", "sym", ".", "flags", "(", ")", "&", "ABSTRACT", ")", "!=", "0", "&&", "(", "sym", ".", "flags", "(", ")", "&", "DEFAULT", ")", "==", "0", ")", "log", ".", "error", "(", "pos", ",", "\"abstract.cant.be.accessed.directly\"", ",", "kindName", "(", "sym", ")", ",", "sym", ",", "sym", ".", "location", "(", ")", ")", ";", "}" ]
Check that sym is not an abstract method.
[ "Check", "that", "sym", "is", "not", "an", "abstract", "method", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2554-L2558
5,260
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveQualifiedMethod
Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { return resolveQualifiedMethod(pos, env, site.tsym, site, name, argtypes, typeargtypes); }
java
Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { return resolveQualifiedMethod(pos, env, site.tsym, site, name, argtypes, typeargtypes); }
[ "Symbol", "resolveQualifiedMethod", "(", "DiagnosticPosition", "pos", ",", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Name", "name", ",", "List", "<", "Type", ">", "argtypes", ",", "List", "<", "Type", ">", "typeargtypes", ")", "{", "return", "resolveQualifiedMethod", "(", "pos", ",", "env", ",", "site", ".", "tsym", ",", "site", ",", "name", ",", "argtypes", ",", "typeargtypes", ")", ";", "}" ]
Resolve a qualified method identifier @param pos The position to use for error reporting. @param env The environment current at the method invocation. @param site The type of the qualifying expression, in which identifier is searched. @param name The identifier's name. @param argtypes The types of the invocation's value arguments. @param typeargtypes The types of the invocation's type arguments.
[ "Resolve", "a", "qualified", "method", "identifier" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2610-L2614
5,261
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveInternalMethod
public MethodSymbol resolveInternalMethod(DiagnosticPosition pos, Env<AttrContext> env, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { MethodResolutionContext resolveContext = new MethodResolutionContext(); resolveContext.internalResolution = true; Symbol sym = resolveQualifiedMethod(resolveContext, pos, env, site.tsym, site, name, argtypes, typeargtypes); if (sym.kind == MTH) return (MethodSymbol)sym; else throw new FatalError( diags.fragment("fatal.err.cant.locate.meth", name)); }
java
public MethodSymbol resolveInternalMethod(DiagnosticPosition pos, Env<AttrContext> env, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { MethodResolutionContext resolveContext = new MethodResolutionContext(); resolveContext.internalResolution = true; Symbol sym = resolveQualifiedMethod(resolveContext, pos, env, site.tsym, site, name, argtypes, typeargtypes); if (sym.kind == MTH) return (MethodSymbol)sym; else throw new FatalError( diags.fragment("fatal.err.cant.locate.meth", name)); }
[ "public", "MethodSymbol", "resolveInternalMethod", "(", "DiagnosticPosition", "pos", ",", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Name", "name", ",", "List", "<", "Type", ">", "argtypes", ",", "List", "<", "Type", ">", "typeargtypes", ")", "{", "MethodResolutionContext", "resolveContext", "=", "new", "MethodResolutionContext", "(", ")", ";", "resolveContext", ".", "internalResolution", "=", "true", ";", "Symbol", "sym", "=", "resolveQualifiedMethod", "(", "resolveContext", ",", "pos", ",", "env", ",", "site", ".", "tsym", ",", "site", ",", "name", ",", "argtypes", ",", "typeargtypes", ")", ";", "if", "(", "sym", ".", "kind", "==", "MTH", ")", "return", "(", "MethodSymbol", ")", "sym", ";", "else", "throw", "new", "FatalError", "(", "diags", ".", "fragment", "(", "\"fatal.err.cant.locate.meth\"", ",", "name", ")", ")", ";", "}" ]
Resolve a qualified method identifier, throw a fatal error if not found. @param pos The position to use for error reporting. @param env The environment current at the method invocation. @param site The type of the qualifying expression, in which identifier is searched. @param name The identifier's name. @param argtypes The types of the invocation's value arguments. @param typeargtypes The types of the invocation's type arguments.
[ "Resolve", "a", "qualified", "method", "identifier", "throw", "a", "fatal", "error", "if", "not", "found", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2694-L2706
5,262
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveConstructor
Symbol resolveConstructor(DiagnosticPosition pos, Env<AttrContext> env, Type site, List<Type> argtypes, List<Type> typeargtypes) { return resolveConstructor(new MethodResolutionContext(), pos, env, site, argtypes, typeargtypes); }
java
Symbol resolveConstructor(DiagnosticPosition pos, Env<AttrContext> env, Type site, List<Type> argtypes, List<Type> typeargtypes) { return resolveConstructor(new MethodResolutionContext(), pos, env, site, argtypes, typeargtypes); }
[ "Symbol", "resolveConstructor", "(", "DiagnosticPosition", "pos", ",", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "List", "<", "Type", ">", "argtypes", ",", "List", "<", "Type", ">", "typeargtypes", ")", "{", "return", "resolveConstructor", "(", "new", "MethodResolutionContext", "(", ")", ",", "pos", ",", "env", ",", "site", ",", "argtypes", ",", "typeargtypes", ")", ";", "}" ]
Resolve constructor. @param pos The position to use for error reporting. @param env The environment current at the constructor invocation. @param site The type of class for which a constructor is searched. @param argtypes The types of the constructor invocation's value arguments. @param typeargtypes The types of the constructor invocation's type arguments.
[ "Resolve", "constructor", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2717-L2723
5,263
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveInternalConstructor
public MethodSymbol resolveInternalConstructor(DiagnosticPosition pos, Env<AttrContext> env, Type site, List<Type> argtypes, List<Type> typeargtypes) { MethodResolutionContext resolveContext = new MethodResolutionContext(); resolveContext.internalResolution = true; Symbol sym = resolveConstructor(resolveContext, pos, env, site, argtypes, typeargtypes); if (sym.kind == MTH) return (MethodSymbol)sym; else throw new FatalError( diags.fragment("fatal.err.cant.locate.ctor", site)); }
java
public MethodSymbol resolveInternalConstructor(DiagnosticPosition pos, Env<AttrContext> env, Type site, List<Type> argtypes, List<Type> typeargtypes) { MethodResolutionContext resolveContext = new MethodResolutionContext(); resolveContext.internalResolution = true; Symbol sym = resolveConstructor(resolveContext, pos, env, site, argtypes, typeargtypes); if (sym.kind == MTH) return (MethodSymbol)sym; else throw new FatalError( diags.fragment("fatal.err.cant.locate.ctor", site)); }
[ "public", "MethodSymbol", "resolveInternalConstructor", "(", "DiagnosticPosition", "pos", ",", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "List", "<", "Type", ">", "argtypes", ",", "List", "<", "Type", ">", "typeargtypes", ")", "{", "MethodResolutionContext", "resolveContext", "=", "new", "MethodResolutionContext", "(", ")", ";", "resolveContext", ".", "internalResolution", "=", "true", ";", "Symbol", "sym", "=", "resolveConstructor", "(", "resolveContext", ",", "pos", ",", "env", ",", "site", ",", "argtypes", ",", "typeargtypes", ")", ";", "if", "(", "sym", ".", "kind", "==", "MTH", ")", "return", "(", "MethodSymbol", ")", "sym", ";", "else", "throw", "new", "FatalError", "(", "diags", ".", "fragment", "(", "\"fatal.err.cant.locate.ctor\"", ",", "site", ")", ")", ";", "}" ]
Resolve a constructor, throw a fatal error if not found. @param pos The position to use for error reporting. @param env The environment current at the method invocation. @param site The type to be constructed. @param argtypes The types of the invocation's value arguments. @param typeargtypes The types of the invocation's type arguments.
[ "Resolve", "a", "constructor", "throw", "a", "fatal", "error", "if", "not", "found", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2748-L2758
5,264
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveSelf
Symbol resolveSelf(DiagnosticPosition pos, Env<AttrContext> env, TypeSymbol c, Name name) { Env<AttrContext> env1 = env; boolean staticOnly = false; while (env1.outer != null) { if (isStatic(env1)) staticOnly = true; if (env1.enclClass.sym == c) { Symbol sym = env1.info.scope.findFirst(name); if (sym != null) { if (staticOnly) sym = new StaticError(sym); return accessBase(sym, pos, env.enclClass.sym.type, name, true); } } if ((env1.enclClass.sym.flags() & STATIC) != 0) staticOnly = true; env1 = env1.outer; } if (c.isInterface() && name == names._super && !isStatic(env) && types.isDirectSuperInterface(c, env.enclClass.sym)) { //this might be a default super call if one of the superinterfaces is 'c' for (Type t : pruneInterfaces(env.enclClass.type)) { if (t.tsym == c) { env.info.defaultSuperCallSite = t; return new VarSymbol(0, names._super, types.asSuper(env.enclClass.type, c), env.enclClass.sym); } } //find a direct super type that is a subtype of 'c' for (Type i : types.directSupertypes(env.enclClass.type)) { if (i.tsym.isSubClass(c, types) && i.tsym != c) { log.error(pos, "illegal.default.super.call", c, diags.fragment("redundant.supertype", c, i)); return syms.errSymbol; } } Assert.error(); } log.error(pos, "not.encl.class", c); return syms.errSymbol; }
java
Symbol resolveSelf(DiagnosticPosition pos, Env<AttrContext> env, TypeSymbol c, Name name) { Env<AttrContext> env1 = env; boolean staticOnly = false; while (env1.outer != null) { if (isStatic(env1)) staticOnly = true; if (env1.enclClass.sym == c) { Symbol sym = env1.info.scope.findFirst(name); if (sym != null) { if (staticOnly) sym = new StaticError(sym); return accessBase(sym, pos, env.enclClass.sym.type, name, true); } } if ((env1.enclClass.sym.flags() & STATIC) != 0) staticOnly = true; env1 = env1.outer; } if (c.isInterface() && name == names._super && !isStatic(env) && types.isDirectSuperInterface(c, env.enclClass.sym)) { //this might be a default super call if one of the superinterfaces is 'c' for (Type t : pruneInterfaces(env.enclClass.type)) { if (t.tsym == c) { env.info.defaultSuperCallSite = t; return new VarSymbol(0, names._super, types.asSuper(env.enclClass.type, c), env.enclClass.sym); } } //find a direct super type that is a subtype of 'c' for (Type i : types.directSupertypes(env.enclClass.type)) { if (i.tsym.isSubClass(c, types) && i.tsym != c) { log.error(pos, "illegal.default.super.call", c, diags.fragment("redundant.supertype", c, i)); return syms.errSymbol; } } Assert.error(); } log.error(pos, "not.encl.class", c); return syms.errSymbol; }
[ "Symbol", "resolveSelf", "(", "DiagnosticPosition", "pos", ",", "Env", "<", "AttrContext", ">", "env", ",", "TypeSymbol", "c", ",", "Name", "name", ")", "{", "Env", "<", "AttrContext", ">", "env1", "=", "env", ";", "boolean", "staticOnly", "=", "false", ";", "while", "(", "env1", ".", "outer", "!=", "null", ")", "{", "if", "(", "isStatic", "(", "env1", ")", ")", "staticOnly", "=", "true", ";", "if", "(", "env1", ".", "enclClass", ".", "sym", "==", "c", ")", "{", "Symbol", "sym", "=", "env1", ".", "info", ".", "scope", ".", "findFirst", "(", "name", ")", ";", "if", "(", "sym", "!=", "null", ")", "{", "if", "(", "staticOnly", ")", "sym", "=", "new", "StaticError", "(", "sym", ")", ";", "return", "accessBase", "(", "sym", ",", "pos", ",", "env", ".", "enclClass", ".", "sym", ".", "type", ",", "name", ",", "true", ")", ";", "}", "}", "if", "(", "(", "env1", ".", "enclClass", ".", "sym", ".", "flags", "(", ")", "&", "STATIC", ")", "!=", "0", ")", "staticOnly", "=", "true", ";", "env1", "=", "env1", ".", "outer", ";", "}", "if", "(", "c", ".", "isInterface", "(", ")", "&&", "name", "==", "names", ".", "_super", "&&", "!", "isStatic", "(", "env", ")", "&&", "types", ".", "isDirectSuperInterface", "(", "c", ",", "env", ".", "enclClass", ".", "sym", ")", ")", "{", "//this might be a default super call if one of the superinterfaces is 'c'", "for", "(", "Type", "t", ":", "pruneInterfaces", "(", "env", ".", "enclClass", ".", "type", ")", ")", "{", "if", "(", "t", ".", "tsym", "==", "c", ")", "{", "env", ".", "info", ".", "defaultSuperCallSite", "=", "t", ";", "return", "new", "VarSymbol", "(", "0", ",", "names", ".", "_super", ",", "types", ".", "asSuper", "(", "env", ".", "enclClass", ".", "type", ",", "c", ")", ",", "env", ".", "enclClass", ".", "sym", ")", ";", "}", "}", "//find a direct super type that is a subtype of 'c'", "for", "(", "Type", "i", ":", "types", ".", "directSupertypes", "(", "env", ".", "enclClass", ".", "type", ")", ")", "{", "if", "(", "i", ".", "tsym", ".", "isSubClass", "(", "c", ",", "types", ")", "&&", "i", ".", "tsym", "!=", "c", ")", "{", "log", ".", "error", "(", "pos", ",", "\"illegal.default.super.call\"", ",", "c", ",", "diags", ".", "fragment", "(", "\"redundant.supertype\"", ",", "c", ",", "i", ")", ")", ";", "return", "syms", ".", "errSymbol", ";", "}", "}", "Assert", ".", "error", "(", ")", ";", "}", "log", ".", "error", "(", "pos", ",", "\"not.encl.class\"", ",", "c", ")", ";", "return", "syms", ".", "errSymbol", ";", "}" ]
Resolve `c.name' where name == this or name == super. @param pos The position to use for error reporting. @param env The environment current at the expression. @param c The qualifier. @param name The identifier's name.
[ "Resolve", "c", ".", "name", "where", "name", "==", "this", "or", "name", "==", "super", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L3509-L3551
5,265
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveSelfContaining
Symbol resolveSelfContaining(DiagnosticPosition pos, Env<AttrContext> env, Symbol member, boolean isSuperCall) { Symbol sym = resolveSelfContainingInternal(env, member, isSuperCall); if (sym == null) { log.error(pos, "encl.class.required", member); return syms.errSymbol; } else { return accessBase(sym, pos, env.enclClass.sym.type, sym.name, true); } }
java
Symbol resolveSelfContaining(DiagnosticPosition pos, Env<AttrContext> env, Symbol member, boolean isSuperCall) { Symbol sym = resolveSelfContainingInternal(env, member, isSuperCall); if (sym == null) { log.error(pos, "encl.class.required", member); return syms.errSymbol; } else { return accessBase(sym, pos, env.enclClass.sym.type, sym.name, true); } }
[ "Symbol", "resolveSelfContaining", "(", "DiagnosticPosition", "pos", ",", "Env", "<", "AttrContext", ">", "env", ",", "Symbol", "member", ",", "boolean", "isSuperCall", ")", "{", "Symbol", "sym", "=", "resolveSelfContainingInternal", "(", "env", ",", "member", ",", "isSuperCall", ")", ";", "if", "(", "sym", "==", "null", ")", "{", "log", ".", "error", "(", "pos", ",", "\"encl.class.required\"", ",", "member", ")", ";", "return", "syms", ".", "errSymbol", ";", "}", "else", "{", "return", "accessBase", "(", "sym", ",", "pos", ",", "env", ".", "enclClass", ".", "sym", ".", "type", ",", "sym", ".", "name", ",", "true", ")", ";", "}", "}" ]
Resolve `c.this' for an enclosing class c that contains the named member. @param pos The position to use for error reporting. @param env The environment current at the expression. @param member The member that must be contained in the result.
[ "Resolve", "c", ".", "this", "for", "an", "enclosing", "class", "c", "that", "contains", "the", "named", "member", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L3577-L3588
5,266
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveImplicitThis
Type resolveImplicitThis(DiagnosticPosition pos, Env<AttrContext> env, Type t) { return resolveImplicitThis(pos, env, t, false); }
java
Type resolveImplicitThis(DiagnosticPosition pos, Env<AttrContext> env, Type t) { return resolveImplicitThis(pos, env, t, false); }
[ "Type", "resolveImplicitThis", "(", "DiagnosticPosition", "pos", ",", "Env", "<", "AttrContext", ">", "env", ",", "Type", "t", ")", "{", "return", "resolveImplicitThis", "(", "pos", ",", "env", ",", "t", ",", "false", ")", ";", "}" ]
Resolve an appropriate implicit this instance for t's container. JLS 8.8.5.1 and 15.9.2
[ "Resolve", "an", "appropriate", "implicit", "this", "instance", "for", "t", "s", "container", ".", "JLS", "8", ".", "8", ".", "5", ".", "1", "and", "15", ".", "9", ".", "2" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L3626-L3628
5,267
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.logAccessErrorInternal
public void logAccessErrorInternal(Env<AttrContext> env, JCTree tree, Type type) { AccessError error = new AccessError(env, env.enclClass.type, type.tsym); logResolveError(error, tree.pos(), env.enclClass.sym, env.enclClass.type, null, null, null); }
java
public void logAccessErrorInternal(Env<AttrContext> env, JCTree tree, Type type) { AccessError error = new AccessError(env, env.enclClass.type, type.tsym); logResolveError(error, tree.pos(), env.enclClass.sym, env.enclClass.type, null, null, null); }
[ "public", "void", "logAccessErrorInternal", "(", "Env", "<", "AttrContext", ">", "env", ",", "JCTree", "tree", ",", "Type", "type", ")", "{", "AccessError", "error", "=", "new", "AccessError", "(", "env", ",", "env", ".", "enclClass", ".", "type", ",", "type", ".", "tsym", ")", ";", "logResolveError", "(", "error", ",", "tree", ".", "pos", "(", ")", ",", "env", ".", "enclClass", ".", "sym", ",", "env", ".", "enclClass", ".", "type", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
used by TransTypes when checking target type of synthetic cast
[ "used", "by", "TransTypes", "when", "checking", "target", "type", "of", "synthetic", "cast" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L3644-L3647
5,268
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java
VisibleMemberMap.getLeafClassMembers
public List<ProgramElementDoc> getLeafClassMembers(Configuration configuration) { List<ProgramElementDoc> result = getMembersFor(classdoc); result.addAll(getInheritedPackagePrivateMethods(configuration)); return result; }
java
public List<ProgramElementDoc> getLeafClassMembers(Configuration configuration) { List<ProgramElementDoc> result = getMembersFor(classdoc); result.addAll(getInheritedPackagePrivateMethods(configuration)); return result; }
[ "public", "List", "<", "ProgramElementDoc", ">", "getLeafClassMembers", "(", "Configuration", "configuration", ")", "{", "List", "<", "ProgramElementDoc", ">", "result", "=", "getMembersFor", "(", "classdoc", ")", ";", "result", ".", "addAll", "(", "getInheritedPackagePrivateMethods", "(", "configuration", ")", ")", ";", "return", "result", ";", "}" ]
Return the visible members of the class being mapped. Also append at the end of the list members that are inherited by inaccessible parents. We document these members in the child because the parent is not documented. @param configuration the current configuration of the doclet.
[ "Return", "the", "visible", "members", "of", "the", "class", "being", "mapped", ".", "Also", "append", "at", "the", "end", "of", "the", "list", "members", "that", "are", "inherited", "by", "inaccessible", "parents", ".", "We", "document", "these", "members", "in", "the", "child", "because", "the", "parent", "is", "not", "documented", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java#L195-L199
5,269
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java
VisibleMemberMap.getMembersFor
public List<ProgramElementDoc> getMembersFor(ClassDoc cd) { ClassMembers clmembers = classMap.get(cd); if (clmembers == null) { return new ArrayList<>(); } return clmembers.getMembers(); }
java
public List<ProgramElementDoc> getMembersFor(ClassDoc cd) { ClassMembers clmembers = classMap.get(cd); if (clmembers == null) { return new ArrayList<>(); } return clmembers.getMembers(); }
[ "public", "List", "<", "ProgramElementDoc", ">", "getMembersFor", "(", "ClassDoc", "cd", ")", "{", "ClassMembers", "clmembers", "=", "classMap", ".", "get", "(", "cd", ")", ";", "if", "(", "clmembers", "==", "null", ")", "{", "return", "new", "ArrayList", "<>", "(", ")", ";", "}", "return", "clmembers", ".", "getMembers", "(", ")", ";", "}" ]
Retrn the list of members for the given class. @param cd the class to retrieve the list of visible members for. @return the list of members for the given class.
[ "Retrn", "the", "list", "of", "members", "for", "the", "given", "class", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java#L208-L214
5,270
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
HtmlDocWriter.getDocLink
public DocLink getDocLink(SectionName sectionName, String where) { return DocLink.fragment(sectionName.getName() + getName(where)); }
java
public DocLink getDocLink(SectionName sectionName, String where) { return DocLink.fragment(sectionName.getName() + getName(where)); }
[ "public", "DocLink", "getDocLink", "(", "SectionName", "sectionName", ",", "String", "where", ")", "{", "return", "DocLink", ".", "fragment", "(", "sectionName", ".", "getName", "(", ")", "+", "getName", "(", "where", ")", ")", ";", "}" ]
Get the link. @param sectionName The section name combined with where to which the link will be created. @param where The fragment combined with sectionName to which the link will be created. @return a DocLink object for the hyper link
[ "Get", "the", "link", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java#L155-L157
5,271
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
HtmlDocWriter.getName
public String getName(String name) { StringBuilder sb = new StringBuilder(); char ch; /* The HTML 4 spec at http://www.w3.org/TR/html4/types.html#h-6.2 mentions * that the name/id should begin with a letter followed by other valid characters. * The HTML 5 spec (draft) is more permissive on names/ids where the only restriction * is that it should be at least one character long and should not contain spaces. * The spec draft is @ http://www.w3.org/html/wg/drafts/html/master/dom.html#the-id-attribute. * * For HTML 4, we need to check for non-characters at the beginning of the name and * substitute it accordingly, "_" and "$" can appear at the beginning of a member name. * The method substitutes "$" with "Z:Z:D" and will prefix "_" with "Z:Z". */ for (int i = 0; i < name.length(); i++) { ch = name.charAt(i); switch (ch) { case '(': case ')': case '<': case '>': case ',': sb.append('-'); break; case ' ': case '[': break; case ']': sb.append(":A"); break; // Any appearance of $ needs to be substituted with ":D" and not with hyphen // since a field name "P$$ and a method P(), both valid member names, can end // up as "P--". A member name beginning with $ needs to be substituted with // "Z:Z:D". case '$': if (i == 0) sb.append("Z:Z"); sb.append(":D"); break; // A member name beginning with _ needs to be prefixed with "Z:Z" since valid anchor // names can only begin with a letter. case '_': if (i == 0) sb.append("Z:Z"); sb.append(ch); break; default: sb.append(ch); } } return sb.toString(); }
java
public String getName(String name) { StringBuilder sb = new StringBuilder(); char ch; /* The HTML 4 spec at http://www.w3.org/TR/html4/types.html#h-6.2 mentions * that the name/id should begin with a letter followed by other valid characters. * The HTML 5 spec (draft) is more permissive on names/ids where the only restriction * is that it should be at least one character long and should not contain spaces. * The spec draft is @ http://www.w3.org/html/wg/drafts/html/master/dom.html#the-id-attribute. * * For HTML 4, we need to check for non-characters at the beginning of the name and * substitute it accordingly, "_" and "$" can appear at the beginning of a member name. * The method substitutes "$" with "Z:Z:D" and will prefix "_" with "Z:Z". */ for (int i = 0; i < name.length(); i++) { ch = name.charAt(i); switch (ch) { case '(': case ')': case '<': case '>': case ',': sb.append('-'); break; case ' ': case '[': break; case ']': sb.append(":A"); break; // Any appearance of $ needs to be substituted with ":D" and not with hyphen // since a field name "P$$ and a method P(), both valid member names, can end // up as "P--". A member name beginning with $ needs to be substituted with // "Z:Z:D". case '$': if (i == 0) sb.append("Z:Z"); sb.append(":D"); break; // A member name beginning with _ needs to be prefixed with "Z:Z" since valid anchor // names can only begin with a letter. case '_': if (i == 0) sb.append("Z:Z"); sb.append(ch); break; default: sb.append(ch); } } return sb.toString(); }
[ "public", "String", "getName", "(", "String", "name", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "char", "ch", ";", "/* The HTML 4 spec at http://www.w3.org/TR/html4/types.html#h-6.2 mentions\n * that the name/id should begin with a letter followed by other valid characters.\n * The HTML 5 spec (draft) is more permissive on names/ids where the only restriction\n * is that it should be at least one character long and should not contain spaces.\n * The spec draft is @ http://www.w3.org/html/wg/drafts/html/master/dom.html#the-id-attribute.\n *\n * For HTML 4, we need to check for non-characters at the beginning of the name and\n * substitute it accordingly, \"_\" and \"$\" can appear at the beginning of a member name.\n * The method substitutes \"$\" with \"Z:Z:D\" and will prefix \"_\" with \"Z:Z\".\n */", "for", "(", "int", "i", "=", "0", ";", "i", "<", "name", ".", "length", "(", ")", ";", "i", "++", ")", "{", "ch", "=", "name", ".", "charAt", "(", "i", ")", ";", "switch", "(", "ch", ")", "{", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "sb", ".", "append", "(", "'", "'", ")", ";", "break", ";", "case", "'", "'", ":", "case", "'", "'", ":", "break", ";", "case", "'", "'", ":", "sb", ".", "append", "(", "\":A\"", ")", ";", "break", ";", "// Any appearance of $ needs to be substituted with \":D\" and not with hyphen", "// since a field name \"P$$ and a method P(), both valid member names, can end", "// up as \"P--\". A member name beginning with $ needs to be substituted with", "// \"Z:Z:D\".", "case", "'", "'", ":", "if", "(", "i", "==", "0", ")", "sb", ".", "append", "(", "\"Z:Z\"", ")", ";", "sb", ".", "append", "(", "\":D\"", ")", ";", "break", ";", "// A member name beginning with _ needs to be prefixed with \"Z:Z\" since valid anchor", "// names can only begin with a letter.", "case", "'", "'", ":", "if", "(", "i", "==", "0", ")", "sb", ".", "append", "(", "\"Z:Z\"", ")", ";", "sb", ".", "append", "(", "ch", ")", ";", "break", ";", "default", ":", "sb", ".", "append", "(", "ch", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Convert the name to a valid HTML name. @param name the name that needs to be converted to valid HTML name. @return a valid HTML name string.
[ "Convert", "the", "name", "to", "a", "valid", "HTML", "name", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java#L165-L215
5,272
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
HtmlDocWriter.getPkgName
public String getPkgName(ClassDoc cd) { String pkgName = cd.containingPackage().name(); if (pkgName.length() > 0) { pkgName += "."; return pkgName; } return ""; }
java
public String getPkgName(ClassDoc cd) { String pkgName = cd.containingPackage().name(); if (pkgName.length() > 0) { pkgName += "."; return pkgName; } return ""; }
[ "public", "String", "getPkgName", "(", "ClassDoc", "cd", ")", "{", "String", "pkgName", "=", "cd", ".", "containingPackage", "(", ")", ".", "name", "(", ")", ";", "if", "(", "pkgName", ".", "length", "(", ")", ">", "0", ")", "{", "pkgName", "+=", "\".\"", ";", "return", "pkgName", ";", "}", "return", "\"\"", ";", "}" ]
Get the name of the package, this class is in. @param cd ClassDoc.
[ "Get", "the", "name", "of", "the", "package", "this", "class", "is", "in", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java#L292-L299
5,273
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
HtmlDocWriter.printFramesDocument
public void printFramesDocument(String title, ConfigurationImpl configuration, HtmlTree body) throws IOException { Content htmlDocType = configuration.isOutputHtml5() ? DocType.HTML5 : DocType.TRANSITIONAL; Content htmlComment = new Comment(configuration.getText("doclet.New_Page")); Content head = new HtmlTree(HtmlTag.HEAD); head.addContent(getGeneratedBy(!configuration.notimestamp)); Content windowTitle = HtmlTree.TITLE(new StringContent(title)); head.addContent(windowTitle); Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE, (configuration.charset.length() > 0) ? configuration.charset : HtmlConstants.HTML_DEFAULT_CHARSET); head.addContent(meta); head.addContent(getStyleSheetProperties(configuration)); head.addContent(getFramesJavaScript()); Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body); Content htmlDocument = new HtmlDocument(htmlDocType, htmlComment, htmlTree); write(htmlDocument); }
java
public void printFramesDocument(String title, ConfigurationImpl configuration, HtmlTree body) throws IOException { Content htmlDocType = configuration.isOutputHtml5() ? DocType.HTML5 : DocType.TRANSITIONAL; Content htmlComment = new Comment(configuration.getText("doclet.New_Page")); Content head = new HtmlTree(HtmlTag.HEAD); head.addContent(getGeneratedBy(!configuration.notimestamp)); Content windowTitle = HtmlTree.TITLE(new StringContent(title)); head.addContent(windowTitle); Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE, (configuration.charset.length() > 0) ? configuration.charset : HtmlConstants.HTML_DEFAULT_CHARSET); head.addContent(meta); head.addContent(getStyleSheetProperties(configuration)); head.addContent(getFramesJavaScript()); Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body); Content htmlDocument = new HtmlDocument(htmlDocType, htmlComment, htmlTree); write(htmlDocument); }
[ "public", "void", "printFramesDocument", "(", "String", "title", ",", "ConfigurationImpl", "configuration", ",", "HtmlTree", "body", ")", "throws", "IOException", "{", "Content", "htmlDocType", "=", "configuration", ".", "isOutputHtml5", "(", ")", "?", "DocType", ".", "HTML5", ":", "DocType", ".", "TRANSITIONAL", ";", "Content", "htmlComment", "=", "new", "Comment", "(", "configuration", ".", "getText", "(", "\"doclet.New_Page\"", ")", ")", ";", "Content", "head", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "HEAD", ")", ";", "head", ".", "addContent", "(", "getGeneratedBy", "(", "!", "configuration", ".", "notimestamp", ")", ")", ";", "Content", "windowTitle", "=", "HtmlTree", ".", "TITLE", "(", "new", "StringContent", "(", "title", ")", ")", ";", "head", ".", "addContent", "(", "windowTitle", ")", ";", "Content", "meta", "=", "HtmlTree", ".", "META", "(", "\"Content-Type\"", ",", "CONTENT_TYPE", ",", "(", "configuration", ".", "charset", ".", "length", "(", ")", ">", "0", ")", "?", "configuration", ".", "charset", ":", "HtmlConstants", ".", "HTML_DEFAULT_CHARSET", ")", ";", "head", ".", "addContent", "(", "meta", ")", ";", "head", ".", "addContent", "(", "getStyleSheetProperties", "(", "configuration", ")", ")", ";", "head", ".", "addContent", "(", "getFramesJavaScript", "(", ")", ")", ";", "Content", "htmlTree", "=", "HtmlTree", ".", "HTML", "(", "configuration", ".", "getLocale", "(", ")", ".", "getLanguage", "(", ")", ",", "head", ",", "body", ")", ";", "Content", "htmlDocument", "=", "new", "HtmlDocument", "(", "htmlDocType", ",", "htmlComment", ",", "htmlTree", ")", ";", "write", "(", "htmlDocument", ")", ";", "}" ]
Print the frames version of the Html file header. Called only when generating an HTML frames file. @param title Title of this HTML document @param configuration the configuration object @param body the body content tree to be added to the HTML document
[ "Print", "the", "frames", "version", "of", "the", "Html", "file", "header", ".", "Called", "only", "when", "generating", "an", "HTML", "frames", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java#L313-L334
5,274
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
RichDiagnosticFormatter.instance
public static RichDiagnosticFormatter instance(Context context) { RichDiagnosticFormatter instance = context.get(RichDiagnosticFormatter.class); if (instance == null) instance = new RichDiagnosticFormatter(context); return instance; }
java
public static RichDiagnosticFormatter instance(Context context) { RichDiagnosticFormatter instance = context.get(RichDiagnosticFormatter.class); if (instance == null) instance = new RichDiagnosticFormatter(context); return instance; }
[ "public", "static", "RichDiagnosticFormatter", "instance", "(", "Context", "context", ")", "{", "RichDiagnosticFormatter", "instance", "=", "context", ".", "get", "(", "RichDiagnosticFormatter", ".", "class", ")", ";", "if", "(", "instance", "==", "null", ")", "instance", "=", "new", "RichDiagnosticFormatter", "(", "context", ")", ";", "return", "instance", ";", "}" ]
Get the DiagnosticFormatter instance for this context.
[ "Get", "the", "DiagnosticFormatter", "instance", "for", "this", "context", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java#L89-L94
5,275
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
RichDiagnosticFormatter.getWhereClauses
protected List<JCDiagnostic> getWhereClauses() { List<JCDiagnostic> clauses = List.nil(); for (WhereClauseKind kind : WhereClauseKind.values()) { List<JCDiagnostic> lines = List.nil(); for (Map.Entry<Type, JCDiagnostic> entry : whereClauses.get(kind).entrySet()) { lines = lines.prepend(entry.getValue()); } if (!lines.isEmpty()) { String key = kind.key(); if (lines.size() > 1) key += ".1"; JCDiagnostic d = diags.fragment(key, whereClauses.get(kind).keySet()); d = new JCDiagnostic.MultilineDiagnostic(d, lines.reverse()); clauses = clauses.prepend(d); } } return clauses.reverse(); }
java
protected List<JCDiagnostic> getWhereClauses() { List<JCDiagnostic> clauses = List.nil(); for (WhereClauseKind kind : WhereClauseKind.values()) { List<JCDiagnostic> lines = List.nil(); for (Map.Entry<Type, JCDiagnostic> entry : whereClauses.get(kind).entrySet()) { lines = lines.prepend(entry.getValue()); } if (!lines.isEmpty()) { String key = kind.key(); if (lines.size() > 1) key += ".1"; JCDiagnostic d = diags.fragment(key, whereClauses.get(kind).keySet()); d = new JCDiagnostic.MultilineDiagnostic(d, lines.reverse()); clauses = clauses.prepend(d); } } return clauses.reverse(); }
[ "protected", "List", "<", "JCDiagnostic", ">", "getWhereClauses", "(", ")", "{", "List", "<", "JCDiagnostic", ">", "clauses", "=", "List", ".", "nil", "(", ")", ";", "for", "(", "WhereClauseKind", "kind", ":", "WhereClauseKind", ".", "values", "(", ")", ")", "{", "List", "<", "JCDiagnostic", ">", "lines", "=", "List", ".", "nil", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "Type", ",", "JCDiagnostic", ">", "entry", ":", "whereClauses", ".", "get", "(", "kind", ")", ".", "entrySet", "(", ")", ")", "{", "lines", "=", "lines", ".", "prepend", "(", "entry", ".", "getValue", "(", ")", ")", ";", "}", "if", "(", "!", "lines", ".", "isEmpty", "(", ")", ")", "{", "String", "key", "=", "kind", ".", "key", "(", ")", ";", "if", "(", "lines", ".", "size", "(", ")", ">", "1", ")", "key", "+=", "\".1\"", ";", "JCDiagnostic", "d", "=", "diags", ".", "fragment", "(", "key", ",", "whereClauses", ".", "get", "(", "kind", ")", ".", "keySet", "(", ")", ")", ";", "d", "=", "new", "JCDiagnostic", ".", "MultilineDiagnostic", "(", "d", ",", "lines", ".", "reverse", "(", ")", ")", ";", "clauses", "=", "clauses", ".", "prepend", "(", "d", ")", ";", "}", "}", "return", "clauses", ".", "reverse", "(", ")", ";", "}" ]
Build a list of multiline diagnostics containing detailed info about type-variables, captured types, and intersection types @return where clause list
[ "Build", "a", "list", "of", "multiline", "diagnostics", "containing", "detailed", "info", "about", "type", "-", "variables", "captured", "types", "and", "intersection", "types" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java#L204-L221
5,276
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java
TreeWriter.getTreeHeader
protected HtmlTree getTreeHeader() { String title = configuration.getText("doclet.Window_Class_Hierarchy"); HtmlTree bodyTree = getBody(true, getWindowTitle(title)); HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) ? HtmlTree.HEADER() : bodyTree; addTop(htmlTree); addNavLinks(true, htmlTree); if (configuration.allowTag(HtmlTag.HEADER)) { bodyTree.addContent(htmlTree); } return bodyTree; }
java
protected HtmlTree getTreeHeader() { String title = configuration.getText("doclet.Window_Class_Hierarchy"); HtmlTree bodyTree = getBody(true, getWindowTitle(title)); HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) ? HtmlTree.HEADER() : bodyTree; addTop(htmlTree); addNavLinks(true, htmlTree); if (configuration.allowTag(HtmlTag.HEADER)) { bodyTree.addContent(htmlTree); } return bodyTree; }
[ "protected", "HtmlTree", "getTreeHeader", "(", ")", "{", "String", "title", "=", "configuration", ".", "getText", "(", "\"doclet.Window_Class_Hierarchy\"", ")", ";", "HtmlTree", "bodyTree", "=", "getBody", "(", "true", ",", "getWindowTitle", "(", "title", ")", ")", ";", "HtmlTree", "htmlTree", "=", "(", "configuration", ".", "allowTag", "(", "HtmlTag", ".", "HEADER", ")", ")", "?", "HtmlTree", ".", "HEADER", "(", ")", ":", "bodyTree", ";", "addTop", "(", "htmlTree", ")", ";", "addNavLinks", "(", "true", ",", "htmlTree", ")", ";", "if", "(", "configuration", ".", "allowTag", "(", "HtmlTag", ".", "HEADER", ")", ")", "{", "bodyTree", ".", "addContent", "(", "htmlTree", ")", ";", "}", "return", "bodyTree", ";", "}" ]
Get the tree header. @return a content tree for the tree header
[ "Get", "the", "tree", "header", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java#L181-L193
5,277
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java
ReplParser.parseCompilationUnit
@Override public JCCompilationUnit parseCompilationUnit() { Token firstToken = token; JCModifiers mods = null; boolean seenImport = false; boolean seenPackage = false; ListBuffer<JCTree> defs = new ListBuffer<>(); if (token.kind == MONKEYS_AT) { mods = modifiersOpt(); } boolean firstTypeDecl = true; while (token.kind != EOF) { if (token.pos > 0 && token.pos <= endPosTable.errorEndPos) { // error recovery skip(true, false, false, false); if (token.kind == EOF) { break; } } if (mods == null && token.kind == IMPORT) { seenImport = true; defs.append(importDeclaration()); } else { Comment docComment = token.comment(CommentStyle.JAVADOC); if (firstTypeDecl && !seenImport && !seenPackage) { docComment = firstToken.comment(CommentStyle.JAVADOC); } List<? extends JCTree> udefs = replUnit(mods, docComment); // if (def instanceof JCExpressionStatement) // def = ((JCExpressionStatement)def).expr; for (JCTree def : udefs) { defs.append(def); } mods = null; firstTypeDecl = false; } break; // Remove to process more than one snippet } List<JCTree> rdefs = defs.toList(); class ReplUnit extends JCCompilationUnit { public ReplUnit(List<JCTree> defs) { super(defs); } } JCCompilationUnit toplevel = new ReplUnit(rdefs); if (rdefs.isEmpty()) { storeEnd(toplevel, S.prevToken().endPos); } toplevel.lineMap = S.getLineMap(); this.endPosTable.setParser(null); // remove reference to parser toplevel.endPositions = this.endPosTable; return toplevel; }
java
@Override public JCCompilationUnit parseCompilationUnit() { Token firstToken = token; JCModifiers mods = null; boolean seenImport = false; boolean seenPackage = false; ListBuffer<JCTree> defs = new ListBuffer<>(); if (token.kind == MONKEYS_AT) { mods = modifiersOpt(); } boolean firstTypeDecl = true; while (token.kind != EOF) { if (token.pos > 0 && token.pos <= endPosTable.errorEndPos) { // error recovery skip(true, false, false, false); if (token.kind == EOF) { break; } } if (mods == null && token.kind == IMPORT) { seenImport = true; defs.append(importDeclaration()); } else { Comment docComment = token.comment(CommentStyle.JAVADOC); if (firstTypeDecl && !seenImport && !seenPackage) { docComment = firstToken.comment(CommentStyle.JAVADOC); } List<? extends JCTree> udefs = replUnit(mods, docComment); // if (def instanceof JCExpressionStatement) // def = ((JCExpressionStatement)def).expr; for (JCTree def : udefs) { defs.append(def); } mods = null; firstTypeDecl = false; } break; // Remove to process more than one snippet } List<JCTree> rdefs = defs.toList(); class ReplUnit extends JCCompilationUnit { public ReplUnit(List<JCTree> defs) { super(defs); } } JCCompilationUnit toplevel = new ReplUnit(rdefs); if (rdefs.isEmpty()) { storeEnd(toplevel, S.prevToken().endPos); } toplevel.lineMap = S.getLineMap(); this.endPosTable.setParser(null); // remove reference to parser toplevel.endPositions = this.endPosTable; return toplevel; }
[ "@", "Override", "public", "JCCompilationUnit", "parseCompilationUnit", "(", ")", "{", "Token", "firstToken", "=", "token", ";", "JCModifiers", "mods", "=", "null", ";", "boolean", "seenImport", "=", "false", ";", "boolean", "seenPackage", "=", "false", ";", "ListBuffer", "<", "JCTree", ">", "defs", "=", "new", "ListBuffer", "<>", "(", ")", ";", "if", "(", "token", ".", "kind", "==", "MONKEYS_AT", ")", "{", "mods", "=", "modifiersOpt", "(", ")", ";", "}", "boolean", "firstTypeDecl", "=", "true", ";", "while", "(", "token", ".", "kind", "!=", "EOF", ")", "{", "if", "(", "token", ".", "pos", ">", "0", "&&", "token", ".", "pos", "<=", "endPosTable", ".", "errorEndPos", ")", "{", "// error recovery", "skip", "(", "true", ",", "false", ",", "false", ",", "false", ")", ";", "if", "(", "token", ".", "kind", "==", "EOF", ")", "{", "break", ";", "}", "}", "if", "(", "mods", "==", "null", "&&", "token", ".", "kind", "==", "IMPORT", ")", "{", "seenImport", "=", "true", ";", "defs", ".", "append", "(", "importDeclaration", "(", ")", ")", ";", "}", "else", "{", "Comment", "docComment", "=", "token", ".", "comment", "(", "CommentStyle", ".", "JAVADOC", ")", ";", "if", "(", "firstTypeDecl", "&&", "!", "seenImport", "&&", "!", "seenPackage", ")", "{", "docComment", "=", "firstToken", ".", "comment", "(", "CommentStyle", ".", "JAVADOC", ")", ";", "}", "List", "<", "?", "extends", "JCTree", ">", "udefs", "=", "replUnit", "(", "mods", ",", "docComment", ")", ";", "// if (def instanceof JCExpressionStatement)", "// def = ((JCExpressionStatement)def).expr;", "for", "(", "JCTree", "def", ":", "udefs", ")", "{", "defs", ".", "append", "(", "def", ")", ";", "}", "mods", "=", "null", ";", "firstTypeDecl", "=", "false", ";", "}", "break", ";", "// Remove to process more than one snippet", "}", "List", "<", "JCTree", ">", "rdefs", "=", "defs", ".", "toList", "(", ")", ";", "class", "ReplUnit", "extends", "JCCompilationUnit", "{", "public", "ReplUnit", "(", "List", "<", "JCTree", ">", "defs", ")", "{", "super", "(", "defs", ")", ";", "}", "}", "JCCompilationUnit", "toplevel", "=", "new", "ReplUnit", "(", "rdefs", ")", ";", "if", "(", "rdefs", ".", "isEmpty", "(", ")", ")", "{", "storeEnd", "(", "toplevel", ",", "S", ".", "prevToken", "(", ")", ".", "endPos", ")", ";", "}", "toplevel", ".", "lineMap", "=", "S", ".", "getLineMap", "(", ")", ";", "this", ".", "endPosTable", ".", "setParser", "(", "null", ")", ";", "// remove reference to parser", "toplevel", ".", "endPositions", "=", "this", ".", "endPosTable", ";", "return", "toplevel", ";", "}" ]
As faithful a clone of the overridden method as possible while still achieving the goal of allowing the parse of a stand-alone snippet. As a result, some variables are assigned and never used, tests are always true, loops don't, etc. This is to allow easy transition as the underlying method changes. @return a snippet wrapped in a compilation unit
[ "As", "faithful", "a", "clone", "of", "the", "overridden", "method", "as", "possible", "while", "still", "achieving", "the", "goal", "of", "allowing", "the", "parse", "of", "a", "stand", "-", "alone", "snippet", ".", "As", "a", "result", "some", "variables", "are", "assigned", "and", "never", "used", "tests", "are", "always", "true", "loops", "don", "t", "etc", ".", "This", "is", "to", "allow", "easy", "transition", "as", "the", "underlying", "method", "changes", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java#L89-L143
5,278
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
AbstractTreeWriter.addPartialInfo
protected void addPartialInfo(ClassDoc cd, Content contentTree) { addPreQualifiedStrongClassLink(LinkInfoImpl.Kind.TREE, cd, contentTree); }
java
protected void addPartialInfo(ClassDoc cd, Content contentTree) { addPreQualifiedStrongClassLink(LinkInfoImpl.Kind.TREE, cd, contentTree); }
[ "protected", "void", "addPartialInfo", "(", "ClassDoc", "cd", ",", "Content", "contentTree", ")", "{", "addPreQualifiedStrongClassLink", "(", "LinkInfoImpl", ".", "Kind", ".", "TREE", ",", "cd", ",", "contentTree", ")", ";", "}" ]
Add information about the class kind, if it's a "class" or "interface". @param cd the class being documented @param contentTree the content tree to which the information will be added
[ "Add", "information", "about", "the", "class", "kind", "if", "it", "s", "a", "class", "or", "interface", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java#L179-L181
5,279
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
AbstractTreeWriter.getNavLinkTree
protected Content getNavLinkTree() { Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, treeLabel); return li; }
java
protected Content getNavLinkTree() { Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, treeLabel); return li; }
[ "protected", "Content", "getNavLinkTree", "(", ")", "{", "Content", "li", "=", "HtmlTree", ".", "LI", "(", "HtmlStyle", ".", "navBarCell1Rev", ",", "treeLabel", ")", ";", "return", "li", ";", "}" ]
Get the tree label for the navigation bar. @return a content tree for the tree label
[ "Get", "the", "tree", "label", "for", "the", "navigation", "bar", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java#L188-L191
5,280
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.enterMember
private void enterMember(ClassSymbol c, Symbol sym) { // Synthetic members are not entered -- reason lost to history (optimization?). // Lambda methods must be entered because they may have inner classes (which reference them) if ((sym.flags_field & (SYNTHETIC|BRIDGE)) != SYNTHETIC || sym.name.startsWith(names.lambda)) c.members_field.enter(sym); }
java
private void enterMember(ClassSymbol c, Symbol sym) { // Synthetic members are not entered -- reason lost to history (optimization?). // Lambda methods must be entered because they may have inner classes (which reference them) if ((sym.flags_field & (SYNTHETIC|BRIDGE)) != SYNTHETIC || sym.name.startsWith(names.lambda)) c.members_field.enter(sym); }
[ "private", "void", "enterMember", "(", "ClassSymbol", "c", ",", "Symbol", "sym", ")", "{", "// Synthetic members are not entered -- reason lost to history (optimization?).", "// Lambda methods must be entered because they may have inner classes (which reference them)", "if", "(", "(", "sym", ".", "flags_field", "&", "(", "SYNTHETIC", "|", "BRIDGE", ")", ")", "!=", "SYNTHETIC", "||", "sym", ".", "name", ".", "startsWith", "(", "names", ".", "lambda", ")", ")", "c", ".", "members_field", ".", "enter", "(", "sym", ")", ";", "}" ]
Add member to class unless it is synthetic.
[ "Add", "member", "to", "class", "unless", "it", "is", "synthetic", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L263-L268
5,281
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.getInt
int getInt(int bp) { return ((buf[bp] & 0xFF) << 24) + ((buf[bp+1] & 0xFF) << 16) + ((buf[bp+2] & 0xFF) << 8) + (buf[bp+3] & 0xFF); }
java
int getInt(int bp) { return ((buf[bp] & 0xFF) << 24) + ((buf[bp+1] & 0xFF) << 16) + ((buf[bp+2] & 0xFF) << 8) + (buf[bp+3] & 0xFF); }
[ "int", "getInt", "(", "int", "bp", ")", "{", "return", "(", "(", "buf", "[", "bp", "]", "&", "0xFF", ")", "<<", "24", ")", "+", "(", "(", "buf", "[", "bp", "+", "1", "]", "&", "0xFF", ")", "<<", "16", ")", "+", "(", "(", "buf", "[", "bp", "+", "2", "]", "&", "0xFF", ")", "<<", "8", ")", "+", "(", "buf", "[", "bp", "+", "3", "]", "&", "0xFF", ")", ";", "}" ]
Extract an integer at position bp from buf.
[ "Extract", "an", "integer", "at", "position", "bp", "from", "buf", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L325-L331
5,282
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.getLong
long getLong(int bp) { DataInputStream bufin = new DataInputStream(new ByteArrayInputStream(buf, bp, 8)); try { return bufin.readLong(); } catch (IOException e) { throw new AssertionError(e); } }
java
long getLong(int bp) { DataInputStream bufin = new DataInputStream(new ByteArrayInputStream(buf, bp, 8)); try { return bufin.readLong(); } catch (IOException e) { throw new AssertionError(e); } }
[ "long", "getLong", "(", "int", "bp", ")", "{", "DataInputStream", "bufin", "=", "new", "DataInputStream", "(", "new", "ByteArrayInputStream", "(", "buf", ",", "bp", ",", "8", ")", ")", ";", "try", "{", "return", "bufin", ".", "readLong", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "AssertionError", "(", "e", ")", ";", "}", "}" ]
Extract a long integer at position bp from buf.
[ "Extract", "a", "long", "integer", "at", "position", "bp", "from", "buf", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L336-L344
5,283
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.getFloat
float getFloat(int bp) { DataInputStream bufin = new DataInputStream(new ByteArrayInputStream(buf, bp, 4)); try { return bufin.readFloat(); } catch (IOException e) { throw new AssertionError(e); } }
java
float getFloat(int bp) { DataInputStream bufin = new DataInputStream(new ByteArrayInputStream(buf, bp, 4)); try { return bufin.readFloat(); } catch (IOException e) { throw new AssertionError(e); } }
[ "float", "getFloat", "(", "int", "bp", ")", "{", "DataInputStream", "bufin", "=", "new", "DataInputStream", "(", "new", "ByteArrayInputStream", "(", "buf", ",", "bp", ",", "4", ")", ")", ";", "try", "{", "return", "bufin", ".", "readFloat", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "AssertionError", "(", "e", ")", ";", "}", "}" ]
Extract a float at position bp from buf.
[ "Extract", "a", "float", "at", "position", "bp", "from", "buf", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L348-L356
5,284
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.getDouble
double getDouble(int bp) { DataInputStream bufin = new DataInputStream(new ByteArrayInputStream(buf, bp, 8)); try { return bufin.readDouble(); } catch (IOException e) { throw new AssertionError(e); } }
java
double getDouble(int bp) { DataInputStream bufin = new DataInputStream(new ByteArrayInputStream(buf, bp, 8)); try { return bufin.readDouble(); } catch (IOException e) { throw new AssertionError(e); } }
[ "double", "getDouble", "(", "int", "bp", ")", "{", "DataInputStream", "bufin", "=", "new", "DataInputStream", "(", "new", "ByteArrayInputStream", "(", "buf", ",", "bp", ",", "8", ")", ")", ";", "try", "{", "return", "bufin", ".", "readDouble", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "AssertionError", "(", "e", ")", ";", "}", "}" ]
Extract a double at position bp from buf.
[ "Extract", "a", "double", "at", "position", "bp", "from", "buf", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L360-L368
5,285
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readPool
Object readPool(int i) { Object result = poolObj[i]; if (result != null) return result; int index = poolIdx[i]; if (index == 0) return null; byte tag = buf[index]; switch (tag) { case CONSTANT_Utf8: poolObj[i] = names.fromUtf(buf, index + 3, getChar(index + 1)); break; case CONSTANT_Unicode: throw badClassFile("unicode.str.not.supported"); case CONSTANT_Class: poolObj[i] = readClassOrType(getChar(index + 1)); break; case CONSTANT_String: // FIXME: (footprint) do not use toString here poolObj[i] = readName(getChar(index + 1)).toString(); break; case CONSTANT_Fieldref: { ClassSymbol owner = readClassSymbol(getChar(index + 1)); NameAndType nt = readNameAndType(getChar(index + 3)); poolObj[i] = new VarSymbol(0, nt.name, nt.uniqueType.type, owner); break; } case CONSTANT_Methodref: case CONSTANT_InterfaceMethodref: { ClassSymbol owner = readClassSymbol(getChar(index + 1)); NameAndType nt = readNameAndType(getChar(index + 3)); poolObj[i] = new MethodSymbol(0, nt.name, nt.uniqueType.type, owner); break; } case CONSTANT_NameandType: poolObj[i] = new NameAndType( readName(getChar(index + 1)), readType(getChar(index + 3)), types); break; case CONSTANT_Integer: poolObj[i] = getInt(index + 1); break; case CONSTANT_Float: poolObj[i] = Float.valueOf(getFloat(index + 1)); break; case CONSTANT_Long: poolObj[i] = Long.valueOf(getLong(index + 1)); break; case CONSTANT_Double: poolObj[i] = Double.valueOf(getDouble(index + 1)); break; case CONSTANT_MethodHandle: skipBytes(4); break; case CONSTANT_MethodType: skipBytes(3); break; case CONSTANT_InvokeDynamic: skipBytes(5); break; case CONSTANT_Module: case CONSTANT_Package: // this is temporary for now: treat as a simple reference to the underlying Utf8. poolObj[i] = readName(getChar(index + 1)); break; default: throw badClassFile("bad.const.pool.tag", Byte.toString(tag)); } return poolObj[i]; }
java
Object readPool(int i) { Object result = poolObj[i]; if (result != null) return result; int index = poolIdx[i]; if (index == 0) return null; byte tag = buf[index]; switch (tag) { case CONSTANT_Utf8: poolObj[i] = names.fromUtf(buf, index + 3, getChar(index + 1)); break; case CONSTANT_Unicode: throw badClassFile("unicode.str.not.supported"); case CONSTANT_Class: poolObj[i] = readClassOrType(getChar(index + 1)); break; case CONSTANT_String: // FIXME: (footprint) do not use toString here poolObj[i] = readName(getChar(index + 1)).toString(); break; case CONSTANT_Fieldref: { ClassSymbol owner = readClassSymbol(getChar(index + 1)); NameAndType nt = readNameAndType(getChar(index + 3)); poolObj[i] = new VarSymbol(0, nt.name, nt.uniqueType.type, owner); break; } case CONSTANT_Methodref: case CONSTANT_InterfaceMethodref: { ClassSymbol owner = readClassSymbol(getChar(index + 1)); NameAndType nt = readNameAndType(getChar(index + 3)); poolObj[i] = new MethodSymbol(0, nt.name, nt.uniqueType.type, owner); break; } case CONSTANT_NameandType: poolObj[i] = new NameAndType( readName(getChar(index + 1)), readType(getChar(index + 3)), types); break; case CONSTANT_Integer: poolObj[i] = getInt(index + 1); break; case CONSTANT_Float: poolObj[i] = Float.valueOf(getFloat(index + 1)); break; case CONSTANT_Long: poolObj[i] = Long.valueOf(getLong(index + 1)); break; case CONSTANT_Double: poolObj[i] = Double.valueOf(getDouble(index + 1)); break; case CONSTANT_MethodHandle: skipBytes(4); break; case CONSTANT_MethodType: skipBytes(3); break; case CONSTANT_InvokeDynamic: skipBytes(5); break; case CONSTANT_Module: case CONSTANT_Package: // this is temporary for now: treat as a simple reference to the underlying Utf8. poolObj[i] = readName(getChar(index + 1)); break; default: throw badClassFile("bad.const.pool.tag", Byte.toString(tag)); } return poolObj[i]; }
[ "Object", "readPool", "(", "int", "i", ")", "{", "Object", "result", "=", "poolObj", "[", "i", "]", ";", "if", "(", "result", "!=", "null", ")", "return", "result", ";", "int", "index", "=", "poolIdx", "[", "i", "]", ";", "if", "(", "index", "==", "0", ")", "return", "null", ";", "byte", "tag", "=", "buf", "[", "index", "]", ";", "switch", "(", "tag", ")", "{", "case", "CONSTANT_Utf8", ":", "poolObj", "[", "i", "]", "=", "names", ".", "fromUtf", "(", "buf", ",", "index", "+", "3", ",", "getChar", "(", "index", "+", "1", ")", ")", ";", "break", ";", "case", "CONSTANT_Unicode", ":", "throw", "badClassFile", "(", "\"unicode.str.not.supported\"", ")", ";", "case", "CONSTANT_Class", ":", "poolObj", "[", "i", "]", "=", "readClassOrType", "(", "getChar", "(", "index", "+", "1", ")", ")", ";", "break", ";", "case", "CONSTANT_String", ":", "// FIXME: (footprint) do not use toString here", "poolObj", "[", "i", "]", "=", "readName", "(", "getChar", "(", "index", "+", "1", ")", ")", ".", "toString", "(", ")", ";", "break", ";", "case", "CONSTANT_Fieldref", ":", "{", "ClassSymbol", "owner", "=", "readClassSymbol", "(", "getChar", "(", "index", "+", "1", ")", ")", ";", "NameAndType", "nt", "=", "readNameAndType", "(", "getChar", "(", "index", "+", "3", ")", ")", ";", "poolObj", "[", "i", "]", "=", "new", "VarSymbol", "(", "0", ",", "nt", ".", "name", ",", "nt", ".", "uniqueType", ".", "type", ",", "owner", ")", ";", "break", ";", "}", "case", "CONSTANT_Methodref", ":", "case", "CONSTANT_InterfaceMethodref", ":", "{", "ClassSymbol", "owner", "=", "readClassSymbol", "(", "getChar", "(", "index", "+", "1", ")", ")", ";", "NameAndType", "nt", "=", "readNameAndType", "(", "getChar", "(", "index", "+", "3", ")", ")", ";", "poolObj", "[", "i", "]", "=", "new", "MethodSymbol", "(", "0", ",", "nt", ".", "name", ",", "nt", ".", "uniqueType", ".", "type", ",", "owner", ")", ";", "break", ";", "}", "case", "CONSTANT_NameandType", ":", "poolObj", "[", "i", "]", "=", "new", "NameAndType", "(", "readName", "(", "getChar", "(", "index", "+", "1", ")", ")", ",", "readType", "(", "getChar", "(", "index", "+", "3", ")", ")", ",", "types", ")", ";", "break", ";", "case", "CONSTANT_Integer", ":", "poolObj", "[", "i", "]", "=", "getInt", "(", "index", "+", "1", ")", ";", "break", ";", "case", "CONSTANT_Float", ":", "poolObj", "[", "i", "]", "=", "Float", ".", "valueOf", "(", "getFloat", "(", "index", "+", "1", ")", ")", ";", "break", ";", "case", "CONSTANT_Long", ":", "poolObj", "[", "i", "]", "=", "Long", ".", "valueOf", "(", "getLong", "(", "index", "+", "1", ")", ")", ";", "break", ";", "case", "CONSTANT_Double", ":", "poolObj", "[", "i", "]", "=", "Double", ".", "valueOf", "(", "getDouble", "(", "index", "+", "1", ")", ")", ";", "break", ";", "case", "CONSTANT_MethodHandle", ":", "skipBytes", "(", "4", ")", ";", "break", ";", "case", "CONSTANT_MethodType", ":", "skipBytes", "(", "3", ")", ";", "break", ";", "case", "CONSTANT_InvokeDynamic", ":", "skipBytes", "(", "5", ")", ";", "break", ";", "case", "CONSTANT_Module", ":", "case", "CONSTANT_Package", ":", "// this is temporary for now: treat as a simple reference to the underlying Utf8.", "poolObj", "[", "i", "]", "=", "readName", "(", "getChar", "(", "index", "+", "1", ")", ")", ";", "break", ";", "default", ":", "throw", "badClassFile", "(", "\"bad.const.pool.tag\"", ",", "Byte", ".", "toString", "(", "tag", ")", ")", ";", "}", "return", "poolObj", "[", "i", "]", ";", "}" ]
Read constant pool entry at start address i, use pool as a cache.
[ "Read", "constant", "pool", "entry", "at", "start", "address", "i", "use", "pool", "as", "a", "cache", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L424-L493
5,286
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readType
Type readType(int i) { int index = poolIdx[i]; return sigToType(buf, index + 3, getChar(index + 1)); }
java
Type readType(int i) { int index = poolIdx[i]; return sigToType(buf, index + 3, getChar(index + 1)); }
[ "Type", "readType", "(", "int", "i", ")", "{", "int", "index", "=", "poolIdx", "[", "i", "]", ";", "return", "sigToType", "(", "buf", ",", "index", "+", "3", ",", "getChar", "(", "index", "+", "1", ")", ")", ";", "}" ]
Read signature and convert to type.
[ "Read", "signature", "and", "convert", "to", "type", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L497-L500
5,287
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readClassOrType
Object readClassOrType(int i) { int index = poolIdx[i]; int len = getChar(index + 1); int start = index + 3; Assert.check(buf[start] == '[' || buf[start + len - 1] != ';'); // by the above assertion, the following test can be // simplified to (buf[start] == '[') return (buf[start] == '[' || buf[start + len - 1] == ';') ? (Object)sigToType(buf, start, len) : (Object)enterClass(names.fromUtf(internalize(buf, start, len))); }
java
Object readClassOrType(int i) { int index = poolIdx[i]; int len = getChar(index + 1); int start = index + 3; Assert.check(buf[start] == '[' || buf[start + len - 1] != ';'); // by the above assertion, the following test can be // simplified to (buf[start] == '[') return (buf[start] == '[' || buf[start + len - 1] == ';') ? (Object)sigToType(buf, start, len) : (Object)enterClass(names.fromUtf(internalize(buf, start, len))); }
[ "Object", "readClassOrType", "(", "int", "i", ")", "{", "int", "index", "=", "poolIdx", "[", "i", "]", ";", "int", "len", "=", "getChar", "(", "index", "+", "1", ")", ";", "int", "start", "=", "index", "+", "3", ";", "Assert", ".", "check", "(", "buf", "[", "start", "]", "==", "'", "'", "||", "buf", "[", "start", "+", "len", "-", "1", "]", "!=", "'", "'", ")", ";", "// by the above assertion, the following test can be", "// simplified to (buf[start] == '[')", "return", "(", "buf", "[", "start", "]", "==", "'", "'", "||", "buf", "[", "start", "+", "len", "-", "1", "]", "==", "'", "'", ")", "?", "(", "Object", ")", "sigToType", "(", "buf", ",", "start", ",", "len", ")", ":", "(", "Object", ")", "enterClass", "(", "names", ".", "fromUtf", "(", "internalize", "(", "buf", ",", "start", ",", "len", ")", ")", ")", ";", "}" ]
If name is an array type or class signature, return the corresponding type; otherwise return a ClassSymbol with given name.
[ "If", "name", "is", "an", "array", "type", "or", "class", "signature", "return", "the", "corresponding", "type", ";", "otherwise", "return", "a", "ClassSymbol", "with", "given", "name", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L505-L516
5,288
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readTypeParams
List<Type> readTypeParams(int i) { int index = poolIdx[i]; return sigToTypeParams(buf, index + 3, getChar(index + 1)); }
java
List<Type> readTypeParams(int i) { int index = poolIdx[i]; return sigToTypeParams(buf, index + 3, getChar(index + 1)); }
[ "List", "<", "Type", ">", "readTypeParams", "(", "int", "i", ")", "{", "int", "index", "=", "poolIdx", "[", "i", "]", ";", "return", "sigToTypeParams", "(", "buf", ",", "index", "+", "3", ",", "getChar", "(", "index", "+", "1", ")", ")", ";", "}" ]
Read signature and convert to type parameters.
[ "Read", "signature", "and", "convert", "to", "type", "parameters", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L520-L523
5,289
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readClassSymbol
ClassSymbol readClassSymbol(int i) { Object obj = readPool(i); if (obj != null && !(obj instanceof ClassSymbol)) throw badClassFile("bad.const.pool.entry", currentClassFile.toString(), "CONSTANT_Class_info", i); return (ClassSymbol)obj; }
java
ClassSymbol readClassSymbol(int i) { Object obj = readPool(i); if (obj != null && !(obj instanceof ClassSymbol)) throw badClassFile("bad.const.pool.entry", currentClassFile.toString(), "CONSTANT_Class_info", i); return (ClassSymbol)obj; }
[ "ClassSymbol", "readClassSymbol", "(", "int", "i", ")", "{", "Object", "obj", "=", "readPool", "(", "i", ")", ";", "if", "(", "obj", "!=", "null", "&&", "!", "(", "obj", "instanceof", "ClassSymbol", ")", ")", "throw", "badClassFile", "(", "\"bad.const.pool.entry\"", ",", "currentClassFile", ".", "toString", "(", ")", ",", "\"CONSTANT_Class_info\"", ",", "i", ")", ";", "return", "(", "ClassSymbol", ")", "obj", ";", "}" ]
Read class entry.
[ "Read", "class", "entry", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L527-L534
5,290
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readName
Name readName(int i) { Object obj = readPool(i); if (obj != null && !(obj instanceof Name)) throw badClassFile("bad.const.pool.entry", currentClassFile.toString(), "CONSTANT_Utf8_info or CONSTANT_String_info", i); return (Name)obj; }
java
Name readName(int i) { Object obj = readPool(i); if (obj != null && !(obj instanceof Name)) throw badClassFile("bad.const.pool.entry", currentClassFile.toString(), "CONSTANT_Utf8_info or CONSTANT_String_info", i); return (Name)obj; }
[ "Name", "readName", "(", "int", "i", ")", "{", "Object", "obj", "=", "readPool", "(", "i", ")", ";", "if", "(", "obj", "!=", "null", "&&", "!", "(", "obj", "instanceof", "Name", ")", ")", "throw", "badClassFile", "(", "\"bad.const.pool.entry\"", ",", "currentClassFile", ".", "toString", "(", ")", ",", "\"CONSTANT_Utf8_info or CONSTANT_String_info\"", ",", "i", ")", ";", "return", "(", "Name", ")", "obj", ";", "}" ]
Read name.
[ "Read", "name", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L555-L562
5,291
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readNameAndType
NameAndType readNameAndType(int i) { Object obj = readPool(i); if (obj != null && !(obj instanceof NameAndType)) throw badClassFile("bad.const.pool.entry", currentClassFile.toString(), "CONSTANT_NameAndType_info", i); return (NameAndType)obj; }
java
NameAndType readNameAndType(int i) { Object obj = readPool(i); if (obj != null && !(obj instanceof NameAndType)) throw badClassFile("bad.const.pool.entry", currentClassFile.toString(), "CONSTANT_NameAndType_info", i); return (NameAndType)obj; }
[ "NameAndType", "readNameAndType", "(", "int", "i", ")", "{", "Object", "obj", "=", "readPool", "(", "i", ")", ";", "if", "(", "obj", "!=", "null", "&&", "!", "(", "obj", "instanceof", "NameAndType", ")", ")", "throw", "badClassFile", "(", "\"bad.const.pool.entry\"", ",", "currentClassFile", ".", "toString", "(", ")", ",", "\"CONSTANT_NameAndType_info\"", ",", "i", ")", ";", "return", "(", "NameAndType", ")", "obj", ";", "}" ]
Read name and type.
[ "Read", "name", "and", "type", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L566-L573
5,292
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readModuleFlags
Set<ModuleFlags> readModuleFlags(int flags) { Set<ModuleFlags> set = EnumSet.noneOf(ModuleFlags.class); for (ModuleFlags f : ModuleFlags.values()) { if ((flags & f.value) != 0) set.add(f); } return set; }
java
Set<ModuleFlags> readModuleFlags(int flags) { Set<ModuleFlags> set = EnumSet.noneOf(ModuleFlags.class); for (ModuleFlags f : ModuleFlags.values()) { if ((flags & f.value) != 0) set.add(f); } return set; }
[ "Set", "<", "ModuleFlags", ">", "readModuleFlags", "(", "int", "flags", ")", "{", "Set", "<", "ModuleFlags", ">", "set", "=", "EnumSet", ".", "noneOf", "(", "ModuleFlags", ".", "class", ")", ";", "for", "(", "ModuleFlags", "f", ":", "ModuleFlags", ".", "values", "(", ")", ")", "{", "if", "(", "(", "flags", "&", "f", ".", "value", ")", "!=", "0", ")", "set", ".", "add", "(", "f", ")", ";", "}", "return", "set", ";", "}" ]
Read module_flags.
[ "Read", "module_flags", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L585-L592
5,293
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readModuleResolutionFlags
Set<ModuleResolutionFlags> readModuleResolutionFlags(int flags) { Set<ModuleResolutionFlags> set = EnumSet.noneOf(ModuleResolutionFlags.class); for (ModuleResolutionFlags f : ModuleResolutionFlags.values()) { if ((flags & f.value) != 0) set.add(f); } return set; }
java
Set<ModuleResolutionFlags> readModuleResolutionFlags(int flags) { Set<ModuleResolutionFlags> set = EnumSet.noneOf(ModuleResolutionFlags.class); for (ModuleResolutionFlags f : ModuleResolutionFlags.values()) { if ((flags & f.value) != 0) set.add(f); } return set; }
[ "Set", "<", "ModuleResolutionFlags", ">", "readModuleResolutionFlags", "(", "int", "flags", ")", "{", "Set", "<", "ModuleResolutionFlags", ">", "set", "=", "EnumSet", ".", "noneOf", "(", "ModuleResolutionFlags", ".", "class", ")", ";", "for", "(", "ModuleResolutionFlags", "f", ":", "ModuleResolutionFlags", ".", "values", "(", ")", ")", "{", "if", "(", "(", "flags", "&", "f", ".", "value", ")", "!=", "0", ")", "set", ".", "add", "(", "f", ")", ";", "}", "return", "set", ";", "}" ]
Read resolution_flags.
[ "Read", "resolution_flags", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L596-L603
5,294
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readExportsFlags
Set<ExportsFlag> readExportsFlags(int flags) { Set<ExportsFlag> set = EnumSet.noneOf(ExportsFlag.class); for (ExportsFlag f: ExportsFlag.values()) { if ((flags & f.value) != 0) set.add(f); } return set; }
java
Set<ExportsFlag> readExportsFlags(int flags) { Set<ExportsFlag> set = EnumSet.noneOf(ExportsFlag.class); for (ExportsFlag f: ExportsFlag.values()) { if ((flags & f.value) != 0) set.add(f); } return set; }
[ "Set", "<", "ExportsFlag", ">", "readExportsFlags", "(", "int", "flags", ")", "{", "Set", "<", "ExportsFlag", ">", "set", "=", "EnumSet", ".", "noneOf", "(", "ExportsFlag", ".", "class", ")", ";", "for", "(", "ExportsFlag", "f", ":", "ExportsFlag", ".", "values", "(", ")", ")", "{", "if", "(", "(", "flags", "&", "f", ".", "value", ")", "!=", "0", ")", "set", ".", "add", "(", "f", ")", ";", "}", "return", "set", ";", "}" ]
Read exports_flags.
[ "Read", "exports_flags", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L607-L614
5,295
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readOpensFlags
Set<OpensFlag> readOpensFlags(int flags) { Set<OpensFlag> set = EnumSet.noneOf(OpensFlag.class); for (OpensFlag f: OpensFlag.values()) { if ((flags & f.value) != 0) set.add(f); } return set; }
java
Set<OpensFlag> readOpensFlags(int flags) { Set<OpensFlag> set = EnumSet.noneOf(OpensFlag.class); for (OpensFlag f: OpensFlag.values()) { if ((flags & f.value) != 0) set.add(f); } return set; }
[ "Set", "<", "OpensFlag", ">", "readOpensFlags", "(", "int", "flags", ")", "{", "Set", "<", "OpensFlag", ">", "set", "=", "EnumSet", ".", "noneOf", "(", "OpensFlag", ".", "class", ")", ";", "for", "(", "OpensFlag", "f", ":", "OpensFlag", ".", "values", "(", ")", ")", "{", "if", "(", "(", "flags", "&", "f", ".", "value", ")", "!=", "0", ")", "set", ".", "add", "(", "f", ")", ";", "}", "return", "set", ";", "}" ]
Read opens_flags.
[ "Read", "opens_flags", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L618-L625
5,296
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.readRequiresFlags
Set<RequiresFlag> readRequiresFlags(int flags) { Set<RequiresFlag> set = EnumSet.noneOf(RequiresFlag.class); for (RequiresFlag f: RequiresFlag.values()) { if ((flags & f.value) != 0) set.add(f); } return set; }
java
Set<RequiresFlag> readRequiresFlags(int flags) { Set<RequiresFlag> set = EnumSet.noneOf(RequiresFlag.class); for (RequiresFlag f: RequiresFlag.values()) { if ((flags & f.value) != 0) set.add(f); } return set; }
[ "Set", "<", "RequiresFlag", ">", "readRequiresFlags", "(", "int", "flags", ")", "{", "Set", "<", "RequiresFlag", ">", "set", "=", "EnumSet", ".", "noneOf", "(", "RequiresFlag", ".", "class", ")", ";", "for", "(", "RequiresFlag", "f", ":", "RequiresFlag", ".", "values", "(", ")", ")", "{", "if", "(", "(", "flags", "&", "f", ".", "value", ")", "!=", "0", ")", "set", ".", "add", "(", "f", ")", ";", "}", "return", "set", ";", "}" ]
Read requires_flags.
[ "Read", "requires_flags", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L629-L636
5,297
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.sigToType
Type sigToType(byte[] sig, int offset, int len) { signature = sig; sigp = offset; siglimit = offset + len; return sigToType(); }
java
Type sigToType(byte[] sig, int offset, int len) { signature = sig; sigp = offset; siglimit = offset + len; return sigToType(); }
[ "Type", "sigToType", "(", "byte", "[", "]", "sig", ",", "int", "offset", ",", "int", "len", ")", "{", "signature", "=", "sig", ";", "sigp", "=", "offset", ";", "siglimit", "=", "offset", "+", "len", ";", "return", "sigToType", "(", ")", ";", "}" ]
Convert signature to type, where signature is a byte array segment.
[ "Convert", "signature", "to", "type", "where", "signature", "is", "a", "byte", "array", "segment", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L652-L657
5,298
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.sigToType
Type sigToType() { switch ((char) signature[sigp]) { case 'T': sigp++; int start = sigp; while (signature[sigp] != ';') sigp++; sigp++; return sigEnterPhase ? Type.noType : findTypeVar(names.fromUtf(signature, start, sigp - 1 - start)); case '+': { sigp++; Type t = sigToType(); return new WildcardType(t, BoundKind.EXTENDS, syms.boundClass); } case '*': sigp++; return new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass); case '-': { sigp++; Type t = sigToType(); return new WildcardType(t, BoundKind.SUPER, syms.boundClass); } case 'B': sigp++; return syms.byteType; case 'C': sigp++; return syms.charType; case 'D': sigp++; return syms.doubleType; case 'F': sigp++; return syms.floatType; case 'I': sigp++; return syms.intType; case 'J': sigp++; return syms.longType; case 'L': { // int oldsigp = sigp; Type t = classSigToType(); if (sigp < siglimit && signature[sigp] == '.') throw badClassFile("deprecated inner class signature syntax " + "(please recompile from source)"); /* System.err.println(" decoded " + new String(signature, oldsigp, sigp-oldsigp) + " => " + t + " outer " + t.outer()); */ return t; } case 'S': sigp++; return syms.shortType; case 'V': sigp++; return syms.voidType; case 'Z': sigp++; return syms.booleanType; case '[': sigp++; return new ArrayType(sigToType(), syms.arrayClass); case '(': sigp++; List<Type> argtypes = sigToTypes(')'); Type restype = sigToType(); List<Type> thrown = List.nil(); while (signature[sigp] == '^') { sigp++; thrown = thrown.prepend(sigToType()); } // if there is a typevar in the throws clause we should state it. for (List<Type> l = thrown; l.nonEmpty(); l = l.tail) { if (l.head.hasTag(TYPEVAR)) { l.head.tsym.flags_field |= THROWS; } } return new MethodType(argtypes, restype, thrown.reverse(), syms.methodClass); case '<': typevars = typevars.dup(currentOwner); Type poly = new ForAll(sigToTypeParams(), sigToType()); typevars = typevars.leave(); return poly; default: throw badClassFile("bad.signature", Convert.utf2string(signature, sigp, 10)); } }
java
Type sigToType() { switch ((char) signature[sigp]) { case 'T': sigp++; int start = sigp; while (signature[sigp] != ';') sigp++; sigp++; return sigEnterPhase ? Type.noType : findTypeVar(names.fromUtf(signature, start, sigp - 1 - start)); case '+': { sigp++; Type t = sigToType(); return new WildcardType(t, BoundKind.EXTENDS, syms.boundClass); } case '*': sigp++; return new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass); case '-': { sigp++; Type t = sigToType(); return new WildcardType(t, BoundKind.SUPER, syms.boundClass); } case 'B': sigp++; return syms.byteType; case 'C': sigp++; return syms.charType; case 'D': sigp++; return syms.doubleType; case 'F': sigp++; return syms.floatType; case 'I': sigp++; return syms.intType; case 'J': sigp++; return syms.longType; case 'L': { // int oldsigp = sigp; Type t = classSigToType(); if (sigp < siglimit && signature[sigp] == '.') throw badClassFile("deprecated inner class signature syntax " + "(please recompile from source)"); /* System.err.println(" decoded " + new String(signature, oldsigp, sigp-oldsigp) + " => " + t + " outer " + t.outer()); */ return t; } case 'S': sigp++; return syms.shortType; case 'V': sigp++; return syms.voidType; case 'Z': sigp++; return syms.booleanType; case '[': sigp++; return new ArrayType(sigToType(), syms.arrayClass); case '(': sigp++; List<Type> argtypes = sigToTypes(')'); Type restype = sigToType(); List<Type> thrown = List.nil(); while (signature[sigp] == '^') { sigp++; thrown = thrown.prepend(sigToType()); } // if there is a typevar in the throws clause we should state it. for (List<Type> l = thrown; l.nonEmpty(); l = l.tail) { if (l.head.hasTag(TYPEVAR)) { l.head.tsym.flags_field |= THROWS; } } return new MethodType(argtypes, restype, thrown.reverse(), syms.methodClass); case '<': typevars = typevars.dup(currentOwner); Type poly = new ForAll(sigToTypeParams(), sigToType()); typevars = typevars.leave(); return poly; default: throw badClassFile("bad.signature", Convert.utf2string(signature, sigp, 10)); } }
[ "Type", "sigToType", "(", ")", "{", "switch", "(", "(", "char", ")", "signature", "[", "sigp", "]", ")", "{", "case", "'", "'", ":", "sigp", "++", ";", "int", "start", "=", "sigp", ";", "while", "(", "signature", "[", "sigp", "]", "!=", "'", "'", ")", "sigp", "++", ";", "sigp", "++", ";", "return", "sigEnterPhase", "?", "Type", ".", "noType", ":", "findTypeVar", "(", "names", ".", "fromUtf", "(", "signature", ",", "start", ",", "sigp", "-", "1", "-", "start", ")", ")", ";", "case", "'", "'", ":", "{", "sigp", "++", ";", "Type", "t", "=", "sigToType", "(", ")", ";", "return", "new", "WildcardType", "(", "t", ",", "BoundKind", ".", "EXTENDS", ",", "syms", ".", "boundClass", ")", ";", "}", "case", "'", "'", ":", "sigp", "++", ";", "return", "new", "WildcardType", "(", "syms", ".", "objectType", ",", "BoundKind", ".", "UNBOUND", ",", "syms", ".", "boundClass", ")", ";", "case", "'", "'", ":", "{", "sigp", "++", ";", "Type", "t", "=", "sigToType", "(", ")", ";", "return", "new", "WildcardType", "(", "t", ",", "BoundKind", ".", "SUPER", ",", "syms", ".", "boundClass", ")", ";", "}", "case", "'", "'", ":", "sigp", "++", ";", "return", "syms", ".", "byteType", ";", "case", "'", "'", ":", "sigp", "++", ";", "return", "syms", ".", "charType", ";", "case", "'", "'", ":", "sigp", "++", ";", "return", "syms", ".", "doubleType", ";", "case", "'", "'", ":", "sigp", "++", ";", "return", "syms", ".", "floatType", ";", "case", "'", "'", ":", "sigp", "++", ";", "return", "syms", ".", "intType", ";", "case", "'", "'", ":", "sigp", "++", ";", "return", "syms", ".", "longType", ";", "case", "'", "'", ":", "{", "// int oldsigp = sigp;", "Type", "t", "=", "classSigToType", "(", ")", ";", "if", "(", "sigp", "<", "siglimit", "&&", "signature", "[", "sigp", "]", "==", "'", "'", ")", "throw", "badClassFile", "(", "\"deprecated inner class signature syntax \"", "+", "\"(please recompile from source)\"", ")", ";", "/*\n System.err.println(\" decoded \" +\n new String(signature, oldsigp, sigp-oldsigp) +\n \" => \" + t + \" outer \" + t.outer());\n */", "return", "t", ";", "}", "case", "'", "'", ":", "sigp", "++", ";", "return", "syms", ".", "shortType", ";", "case", "'", "'", ":", "sigp", "++", ";", "return", "syms", ".", "voidType", ";", "case", "'", "'", ":", "sigp", "++", ";", "return", "syms", ".", "booleanType", ";", "case", "'", "'", ":", "sigp", "++", ";", "return", "new", "ArrayType", "(", "sigToType", "(", ")", ",", "syms", ".", "arrayClass", ")", ";", "case", "'", "'", ":", "sigp", "++", ";", "List", "<", "Type", ">", "argtypes", "=", "sigToTypes", "(", "'", "'", ")", ";", "Type", "restype", "=", "sigToType", "(", ")", ";", "List", "<", "Type", ">", "thrown", "=", "List", ".", "nil", "(", ")", ";", "while", "(", "signature", "[", "sigp", "]", "==", "'", "'", ")", "{", "sigp", "++", ";", "thrown", "=", "thrown", ".", "prepend", "(", "sigToType", "(", ")", ")", ";", "}", "// if there is a typevar in the throws clause we should state it.", "for", "(", "List", "<", "Type", ">", "l", "=", "thrown", ";", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", ".", "tail", ")", "{", "if", "(", "l", ".", "head", ".", "hasTag", "(", "TYPEVAR", ")", ")", "{", "l", ".", "head", ".", "tsym", ".", "flags_field", "|=", "THROWS", ";", "}", "}", "return", "new", "MethodType", "(", "argtypes", ",", "restype", ",", "thrown", ".", "reverse", "(", ")", ",", "syms", ".", "methodClass", ")", ";", "case", "'", "'", ":", "typevars", "=", "typevars", ".", "dup", "(", "currentOwner", ")", ";", "Type", "poly", "=", "new", "ForAll", "(", "sigToTypeParams", "(", ")", ",", "sigToType", "(", ")", ")", ";", "typevars", "=", "typevars", ".", "leave", "(", ")", ";", "return", "poly", ";", "default", ":", "throw", "badClassFile", "(", "\"bad.signature\"", ",", "Convert", ".", "utf2string", "(", "signature", ",", "sigp", ",", "10", ")", ")", ";", "}", "}" ]
Convert signature to type, where signature is implicit.
[ "Convert", "signature", "to", "type", "where", "signature", "is", "implicit", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L661-L757
5,299
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.sigToTypeParams
List<Type> sigToTypeParams(byte[] sig, int offset, int len) { signature = sig; sigp = offset; siglimit = offset + len; return sigToTypeParams(); }
java
List<Type> sigToTypeParams(byte[] sig, int offset, int len) { signature = sig; sigp = offset; siglimit = offset + len; return sigToTypeParams(); }
[ "List", "<", "Type", ">", "sigToTypeParams", "(", "byte", "[", "]", "sig", ",", "int", "offset", ",", "int", "len", ")", "{", "signature", "=", "sig", ";", "sigp", "=", "offset", ";", "siglimit", "=", "offset", "+", "len", ";", "return", "sigToTypeParams", "(", ")", ";", "}" ]
Convert signature to type parameters, where signature is a byte array segment.
[ "Convert", "signature", "to", "type", "parameters", "where", "signature", "is", "a", "byte", "array", "segment", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L885-L890