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
|
---|---|---|---|---|---|---|---|---|---|---|---|
4,900 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java
|
ModulePackageIndexFrameWriter.addAllModulesLink
|
protected void addAllModulesLink(Content ul) {
Content linkContent = getHyperLink(DocPaths.MODULE_OVERVIEW_FRAME,
contents.allModulesLabel, "", "packageListFrame");
Content li = HtmlTree.LI(linkContent);
ul.addContent(li);
}
|
java
|
protected void addAllModulesLink(Content ul) {
Content linkContent = getHyperLink(DocPaths.MODULE_OVERVIEW_FRAME,
contents.allModulesLabel, "", "packageListFrame");
Content li = HtmlTree.LI(linkContent);
ul.addContent(li);
}
|
[
"protected",
"void",
"addAllModulesLink",
"(",
"Content",
"ul",
")",
"{",
"Content",
"linkContent",
"=",
"getHyperLink",
"(",
"DocPaths",
".",
"MODULE_OVERVIEW_FRAME",
",",
"contents",
".",
"allModulesLabel",
",",
"\"\"",
",",
"\"packageListFrame\"",
")",
";",
"Content",
"li",
"=",
"HtmlTree",
".",
"LI",
"(",
"linkContent",
")",
";",
"ul",
".",
"addContent",
"(",
"li",
")",
";",
"}"
] |
Adds "All Modules" link for the top of the left-hand frame page to the
documentation tree.
@param ul the Content object to which the all modules link should be added
|
[
"Adds",
"All",
"Modules",
"link",
"for",
"the",
"top",
"of",
"the",
"left",
"-",
"hand",
"frame",
"page",
"to",
"the",
"documentation",
"tree",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java#L215-L220
|
4,901 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/GraphUtils.java
|
GraphUtils.tarjan
|
public static <D, N extends TarjanNode<D, N>> List<? extends List<? extends N>> tarjan(Iterable<? extends N> nodes) {
Tarjan<D, N> tarjan = new Tarjan<>();
return tarjan.findSCC(nodes);
}
|
java
|
public static <D, N extends TarjanNode<D, N>> List<? extends List<? extends N>> tarjan(Iterable<? extends N> nodes) {
Tarjan<D, N> tarjan = new Tarjan<>();
return tarjan.findSCC(nodes);
}
|
[
"public",
"static",
"<",
"D",
",",
"N",
"extends",
"TarjanNode",
"<",
"D",
",",
"N",
">",
">",
"List",
"<",
"?",
"extends",
"List",
"<",
"?",
"extends",
"N",
">",
">",
"tarjan",
"(",
"Iterable",
"<",
"?",
"extends",
"N",
">",
"nodes",
")",
"{",
"Tarjan",
"<",
"D",
",",
"N",
">",
"tarjan",
"=",
"new",
"Tarjan",
"<>",
"(",
")",
";",
"return",
"tarjan",
".",
"findSCC",
"(",
"nodes",
")",
";",
"}"
] |
Tarjan's algorithm to determine strongly connected components of a
directed graph in linear time. Works on TarjanNode.
|
[
"Tarjan",
"s",
"algorithm",
"to",
"determine",
"strongly",
"connected",
"components",
"of",
"a",
"directed",
"graph",
"in",
"linear",
"time",
".",
"Works",
"on",
"TarjanNode",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/GraphUtils.java#L153-L156
|
4,902 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java
|
ByteBuffer.appendByte
|
public void appendByte(int b) {
elems = ArrayUtils.ensureCapacity(elems, length);
elems[length++] = (byte)b;
}
|
java
|
public void appendByte(int b) {
elems = ArrayUtils.ensureCapacity(elems, length);
elems[length++] = (byte)b;
}
|
[
"public",
"void",
"appendByte",
"(",
"int",
"b",
")",
"{",
"elems",
"=",
"ArrayUtils",
".",
"ensureCapacity",
"(",
"elems",
",",
"length",
")",
";",
"elems",
"[",
"length",
"++",
"]",
"=",
"(",
"byte",
")",
"b",
";",
"}"
] |
Append byte to this buffer.
|
[
"Append",
"byte",
"to",
"this",
"buffer",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java#L65-L68
|
4,903 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java
|
ByteBuffer.appendBytes
|
public void appendBytes(byte[] bs, int start, int len) {
elems = ArrayUtils.ensureCapacity(elems, length + len);
System.arraycopy(bs, start, elems, length, len);
length += len;
}
|
java
|
public void appendBytes(byte[] bs, int start, int len) {
elems = ArrayUtils.ensureCapacity(elems, length + len);
System.arraycopy(bs, start, elems, length, len);
length += len;
}
|
[
"public",
"void",
"appendBytes",
"(",
"byte",
"[",
"]",
"bs",
",",
"int",
"start",
",",
"int",
"len",
")",
"{",
"elems",
"=",
"ArrayUtils",
".",
"ensureCapacity",
"(",
"elems",
",",
"length",
"+",
"len",
")",
";",
"System",
".",
"arraycopy",
"(",
"bs",
",",
"start",
",",
"elems",
",",
"length",
",",
"len",
")",
";",
"length",
"+=",
"len",
";",
"}"
] |
Append `len' bytes from byte array,
starting at given `start' offset.
|
[
"Append",
"len",
"bytes",
"from",
"byte",
"array",
"starting",
"at",
"given",
"start",
"offset",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java#L73-L77
|
4,904 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java
|
ByteBuffer.appendChar
|
public void appendChar(int x) {
elems = ArrayUtils.ensureCapacity(elems, length + 1);
elems[length ] = (byte)((x >> 8) & 0xFF);
elems[length+1] = (byte)((x ) & 0xFF);
length = length + 2;
}
|
java
|
public void appendChar(int x) {
elems = ArrayUtils.ensureCapacity(elems, length + 1);
elems[length ] = (byte)((x >> 8) & 0xFF);
elems[length+1] = (byte)((x ) & 0xFF);
length = length + 2;
}
|
[
"public",
"void",
"appendChar",
"(",
"int",
"x",
")",
"{",
"elems",
"=",
"ArrayUtils",
".",
"ensureCapacity",
"(",
"elems",
",",
"length",
"+",
"1",
")",
";",
"elems",
"[",
"length",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
">>",
"8",
")",
"&",
"0xFF",
")",
";",
"elems",
"[",
"length",
"+",
"1",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
")",
"&",
"0xFF",
")",
";",
"length",
"=",
"length",
"+",
"2",
";",
"}"
] |
Append a character as a two byte number.
|
[
"Append",
"a",
"character",
"as",
"a",
"two",
"byte",
"number",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java#L87-L92
|
4,905 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java
|
ByteBuffer.appendInt
|
public void appendInt(int x) {
elems = ArrayUtils.ensureCapacity(elems, length + 3);
elems[length ] = (byte)((x >> 24) & 0xFF);
elems[length+1] = (byte)((x >> 16) & 0xFF);
elems[length+2] = (byte)((x >> 8) & 0xFF);
elems[length+3] = (byte)((x ) & 0xFF);
length = length + 4;
}
|
java
|
public void appendInt(int x) {
elems = ArrayUtils.ensureCapacity(elems, length + 3);
elems[length ] = (byte)((x >> 24) & 0xFF);
elems[length+1] = (byte)((x >> 16) & 0xFF);
elems[length+2] = (byte)((x >> 8) & 0xFF);
elems[length+3] = (byte)((x ) & 0xFF);
length = length + 4;
}
|
[
"public",
"void",
"appendInt",
"(",
"int",
"x",
")",
"{",
"elems",
"=",
"ArrayUtils",
".",
"ensureCapacity",
"(",
"elems",
",",
"length",
"+",
"3",
")",
";",
"elems",
"[",
"length",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
">>",
"24",
")",
"&",
"0xFF",
")",
";",
"elems",
"[",
"length",
"+",
"1",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
">>",
"16",
")",
"&",
"0xFF",
")",
";",
"elems",
"[",
"length",
"+",
"2",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
">>",
"8",
")",
"&",
"0xFF",
")",
";",
"elems",
"[",
"length",
"+",
"3",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
")",
"&",
"0xFF",
")",
";",
"length",
"=",
"length",
"+",
"4",
";",
"}"
] |
Append an integer as a four byte number.
|
[
"Append",
"an",
"integer",
"as",
"a",
"four",
"byte",
"number",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java#L96-L103
|
4,906 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java
|
ByteBuffer.appendLong
|
public void appendLong(long x) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream(8);
DataOutputStream bufout = new DataOutputStream(buffer);
try {
bufout.writeLong(x);
appendBytes(buffer.toByteArray(), 0, 8);
} catch (IOException e) {
throw new AssertionError("write");
}
}
|
java
|
public void appendLong(long x) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream(8);
DataOutputStream bufout = new DataOutputStream(buffer);
try {
bufout.writeLong(x);
appendBytes(buffer.toByteArray(), 0, 8);
} catch (IOException e) {
throw new AssertionError("write");
}
}
|
[
"public",
"void",
"appendLong",
"(",
"long",
"x",
")",
"{",
"ByteArrayOutputStream",
"buffer",
"=",
"new",
"ByteArrayOutputStream",
"(",
"8",
")",
";",
"DataOutputStream",
"bufout",
"=",
"new",
"DataOutputStream",
"(",
"buffer",
")",
";",
"try",
"{",
"bufout",
".",
"writeLong",
"(",
"x",
")",
";",
"appendBytes",
"(",
"buffer",
".",
"toByteArray",
"(",
")",
",",
"0",
",",
"8",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"write\"",
")",
";",
"}",
"}"
] |
Append a long as an eight byte number.
|
[
"Append",
"a",
"long",
"as",
"an",
"eight",
"byte",
"number",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java#L107-L116
|
4,907 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java
|
ByteBuffer.appendFloat
|
public void appendFloat(float x) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream(4);
DataOutputStream bufout = new DataOutputStream(buffer);
try {
bufout.writeFloat(x);
appendBytes(buffer.toByteArray(), 0, 4);
} catch (IOException e) {
throw new AssertionError("write");
}
}
|
java
|
public void appendFloat(float x) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream(4);
DataOutputStream bufout = new DataOutputStream(buffer);
try {
bufout.writeFloat(x);
appendBytes(buffer.toByteArray(), 0, 4);
} catch (IOException e) {
throw new AssertionError("write");
}
}
|
[
"public",
"void",
"appendFloat",
"(",
"float",
"x",
")",
"{",
"ByteArrayOutputStream",
"buffer",
"=",
"new",
"ByteArrayOutputStream",
"(",
"4",
")",
";",
"DataOutputStream",
"bufout",
"=",
"new",
"DataOutputStream",
"(",
"buffer",
")",
";",
"try",
"{",
"bufout",
".",
"writeFloat",
"(",
"x",
")",
";",
"appendBytes",
"(",
"buffer",
".",
"toByteArray",
"(",
")",
",",
"0",
",",
"4",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"write\"",
")",
";",
"}",
"}"
] |
Append a float as a four byte number.
|
[
"Append",
"a",
"float",
"as",
"a",
"four",
"byte",
"number",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java#L120-L129
|
4,908 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java
|
ByteBuffer.appendDouble
|
public void appendDouble(double x) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream(8);
DataOutputStream bufout = new DataOutputStream(buffer);
try {
bufout.writeDouble(x);
appendBytes(buffer.toByteArray(), 0, 8);
} catch (IOException e) {
throw new AssertionError("write");
}
}
|
java
|
public void appendDouble(double x) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream(8);
DataOutputStream bufout = new DataOutputStream(buffer);
try {
bufout.writeDouble(x);
appendBytes(buffer.toByteArray(), 0, 8);
} catch (IOException e) {
throw new AssertionError("write");
}
}
|
[
"public",
"void",
"appendDouble",
"(",
"double",
"x",
")",
"{",
"ByteArrayOutputStream",
"buffer",
"=",
"new",
"ByteArrayOutputStream",
"(",
"8",
")",
";",
"DataOutputStream",
"bufout",
"=",
"new",
"DataOutputStream",
"(",
"buffer",
")",
";",
"try",
"{",
"bufout",
".",
"writeDouble",
"(",
"x",
")",
";",
"appendBytes",
"(",
"buffer",
".",
"toByteArray",
"(",
")",
",",
"0",
",",
"8",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"write\"",
")",
";",
"}",
"}"
] |
Append a double as a eight byte number.
|
[
"Append",
"a",
"double",
"as",
"a",
"eight",
"byte",
"number",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java#L133-L142
|
4,909 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java
|
ByteBuffer.appendName
|
public void appendName(Name name) {
appendBytes(name.getByteArray(), name.getByteOffset(), name.getByteLength());
}
|
java
|
public void appendName(Name name) {
appendBytes(name.getByteArray(), name.getByteOffset(), name.getByteLength());
}
|
[
"public",
"void",
"appendName",
"(",
"Name",
"name",
")",
"{",
"appendBytes",
"(",
"name",
".",
"getByteArray",
"(",
")",
",",
"name",
".",
"getByteOffset",
"(",
")",
",",
"name",
".",
"getByteLength",
"(",
")",
")",
";",
"}"
] |
Append a name.
|
[
"Append",
"a",
"name",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java#L146-L148
|
4,910 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
|
ClassMap.visitClassDef
|
public void visitClassDef(JCClassDecl tree) {
classdefs.put(tree.sym, tree);
super.visitClassDef(tree);
}
|
java
|
public void visitClassDef(JCClassDecl tree) {
classdefs.put(tree.sym, tree);
super.visitClassDef(tree);
}
|
[
"public",
"void",
"visitClassDef",
"(",
"JCClassDecl",
"tree",
")",
"{",
"classdefs",
".",
"put",
"(",
"tree",
".",
"sym",
",",
"tree",
")",
";",
"super",
".",
"visitClassDef",
"(",
"tree",
")",
";",
"}"
] |
All encountered class defs are entered into classdefs table.
|
[
"All",
"encountered",
"class",
"defs",
"are",
"entered",
"into",
"classdefs",
"table",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java#L188-L191
|
4,911 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
|
FreeVarCollector.addFreeVar
|
private void addFreeVar(VarSymbol v) {
for (List<VarSymbol> l = fvs; l.nonEmpty(); l = l.tail)
if (l.head == v) return;
fvs = fvs.prepend(v);
}
|
java
|
private void addFreeVar(VarSymbol v) {
for (List<VarSymbol> l = fvs; l.nonEmpty(); l = l.tail)
if (l.head == v) return;
fvs = fvs.prepend(v);
}
|
[
"private",
"void",
"addFreeVar",
"(",
"VarSymbol",
"v",
")",
"{",
"for",
"(",
"List",
"<",
"VarSymbol",
">",
"l",
"=",
"fvs",
";",
"l",
".",
"nonEmpty",
"(",
")",
";",
"l",
"=",
"l",
".",
"tail",
")",
"if",
"(",
"l",
".",
"head",
"==",
"v",
")",
"return",
";",
"fvs",
"=",
"fvs",
".",
"prepend",
"(",
"v",
")",
";",
"}"
] |
Add free variable to fvs list unless it is already there.
|
[
"Add",
"free",
"variable",
"to",
"fvs",
"list",
"unless",
"it",
"is",
"already",
"there",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java#L290-L294
|
4,912 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
|
FreeVarCollector.visitSelect
|
public void visitSelect(JCFieldAccess tree) {
if ((tree.name == names._this || tree.name == names._super) &&
tree.selected.type.tsym != clazz &&
outerThisStack.head != null)
visitSymbol(outerThisStack.head);
super.visitSelect(tree);
}
|
java
|
public void visitSelect(JCFieldAccess tree) {
if ((tree.name == names._this || tree.name == names._super) &&
tree.selected.type.tsym != clazz &&
outerThisStack.head != null)
visitSymbol(outerThisStack.head);
super.visitSelect(tree);
}
|
[
"public",
"void",
"visitSelect",
"(",
"JCFieldAccess",
"tree",
")",
"{",
"if",
"(",
"(",
"tree",
".",
"name",
"==",
"names",
".",
"_this",
"||",
"tree",
".",
"name",
"==",
"names",
".",
"_super",
")",
"&&",
"tree",
".",
"selected",
".",
"type",
".",
"tsym",
"!=",
"clazz",
"&&",
"outerThisStack",
".",
"head",
"!=",
"null",
")",
"visitSymbol",
"(",
"outerThisStack",
".",
"head",
")",
";",
"super",
".",
"visitSelect",
"(",
"tree",
")",
";",
"}"
] |
If tree refers to a qualified this or super expression
for anything but the current class, add the outer this
stack as a free variable.
|
[
"If",
"tree",
"refers",
"to",
"a",
"qualified",
"this",
"or",
"super",
"expression",
"for",
"anything",
"but",
"the",
"current",
"class",
"add",
"the",
"outer",
"this",
"stack",
"as",
"a",
"free",
"variable",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java#L341-L347
|
4,913 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
|
EnumMapping.translate
|
void translate() {
make.at(pos.getStartPosition());
JCClassDecl owner = classDef((ClassSymbol)mapVar.owner);
// synthetic static final int[] $SwitchMap$Color = new int[Color.values().length];
MethodSymbol valuesMethod = lookupMethod(pos,
names.values,
forEnum.type,
List.nil());
JCExpression size = make // Color.values().length
.Select(make.App(make.QualIdent(valuesMethod)),
syms.lengthVar);
JCExpression mapVarInit = make
.NewArray(make.Type(syms.intType), List.of(size), null)
.setType(new ArrayType(syms.intType, syms.arrayClass));
// try { $SwitchMap$Color[red.ordinal()] = 1; } catch (java.lang.NoSuchFieldError ex) {}
ListBuffer<JCStatement> stmts = new ListBuffer<>();
Symbol ordinalMethod = lookupMethod(pos,
names.ordinal,
forEnum.type,
List.nil());
List<JCCatch> catcher = List.<JCCatch>nil()
.prepend(make.Catch(make.VarDef(new VarSymbol(PARAMETER, names.ex,
syms.noSuchFieldErrorType,
syms.noSymbol),
null),
make.Block(0, List.nil())));
for (Map.Entry<VarSymbol,Integer> e : values.entrySet()) {
VarSymbol enumerator = e.getKey();
Integer mappedValue = e.getValue();
JCExpression assign = make
.Assign(make.Indexed(mapVar,
make.App(make.Select(make.QualIdent(enumerator),
ordinalMethod))),
make.Literal(mappedValue))
.setType(syms.intType);
JCStatement exec = make.Exec(assign);
JCStatement _try = make.Try(make.Block(0, List.of(exec)), catcher, null);
stmts.append(_try);
}
owner.defs = owner.defs
.prepend(make.Block(STATIC, stmts.toList()))
.prepend(make.VarDef(mapVar, mapVarInit));
}
|
java
|
void translate() {
make.at(pos.getStartPosition());
JCClassDecl owner = classDef((ClassSymbol)mapVar.owner);
// synthetic static final int[] $SwitchMap$Color = new int[Color.values().length];
MethodSymbol valuesMethod = lookupMethod(pos,
names.values,
forEnum.type,
List.nil());
JCExpression size = make // Color.values().length
.Select(make.App(make.QualIdent(valuesMethod)),
syms.lengthVar);
JCExpression mapVarInit = make
.NewArray(make.Type(syms.intType), List.of(size), null)
.setType(new ArrayType(syms.intType, syms.arrayClass));
// try { $SwitchMap$Color[red.ordinal()] = 1; } catch (java.lang.NoSuchFieldError ex) {}
ListBuffer<JCStatement> stmts = new ListBuffer<>();
Symbol ordinalMethod = lookupMethod(pos,
names.ordinal,
forEnum.type,
List.nil());
List<JCCatch> catcher = List.<JCCatch>nil()
.prepend(make.Catch(make.VarDef(new VarSymbol(PARAMETER, names.ex,
syms.noSuchFieldErrorType,
syms.noSymbol),
null),
make.Block(0, List.nil())));
for (Map.Entry<VarSymbol,Integer> e : values.entrySet()) {
VarSymbol enumerator = e.getKey();
Integer mappedValue = e.getValue();
JCExpression assign = make
.Assign(make.Indexed(mapVar,
make.App(make.Select(make.QualIdent(enumerator),
ordinalMethod))),
make.Literal(mappedValue))
.setType(syms.intType);
JCStatement exec = make.Exec(assign);
JCStatement _try = make.Try(make.Block(0, List.of(exec)), catcher, null);
stmts.append(_try);
}
owner.defs = owner.defs
.prepend(make.Block(STATIC, stmts.toList()))
.prepend(make.VarDef(mapVar, mapVarInit));
}
|
[
"void",
"translate",
"(",
")",
"{",
"make",
".",
"at",
"(",
"pos",
".",
"getStartPosition",
"(",
")",
")",
";",
"JCClassDecl",
"owner",
"=",
"classDef",
"(",
"(",
"ClassSymbol",
")",
"mapVar",
".",
"owner",
")",
";",
"// synthetic static final int[] $SwitchMap$Color = new int[Color.values().length];",
"MethodSymbol",
"valuesMethod",
"=",
"lookupMethod",
"(",
"pos",
",",
"names",
".",
"values",
",",
"forEnum",
".",
"type",
",",
"List",
".",
"nil",
"(",
")",
")",
";",
"JCExpression",
"size",
"=",
"make",
"// Color.values().length",
".",
"Select",
"(",
"make",
".",
"App",
"(",
"make",
".",
"QualIdent",
"(",
"valuesMethod",
")",
")",
",",
"syms",
".",
"lengthVar",
")",
";",
"JCExpression",
"mapVarInit",
"=",
"make",
".",
"NewArray",
"(",
"make",
".",
"Type",
"(",
"syms",
".",
"intType",
")",
",",
"List",
".",
"of",
"(",
"size",
")",
",",
"null",
")",
".",
"setType",
"(",
"new",
"ArrayType",
"(",
"syms",
".",
"intType",
",",
"syms",
".",
"arrayClass",
")",
")",
";",
"// try { $SwitchMap$Color[red.ordinal()] = 1; } catch (java.lang.NoSuchFieldError ex) {}",
"ListBuffer",
"<",
"JCStatement",
">",
"stmts",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"Symbol",
"ordinalMethod",
"=",
"lookupMethod",
"(",
"pos",
",",
"names",
".",
"ordinal",
",",
"forEnum",
".",
"type",
",",
"List",
".",
"nil",
"(",
")",
")",
";",
"List",
"<",
"JCCatch",
">",
"catcher",
"=",
"List",
".",
"<",
"JCCatch",
">",
"nil",
"(",
")",
".",
"prepend",
"(",
"make",
".",
"Catch",
"(",
"make",
".",
"VarDef",
"(",
"new",
"VarSymbol",
"(",
"PARAMETER",
",",
"names",
".",
"ex",
",",
"syms",
".",
"noSuchFieldErrorType",
",",
"syms",
".",
"noSymbol",
")",
",",
"null",
")",
",",
"make",
".",
"Block",
"(",
"0",
",",
"List",
".",
"nil",
"(",
")",
")",
")",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"VarSymbol",
",",
"Integer",
">",
"e",
":",
"values",
".",
"entrySet",
"(",
")",
")",
"{",
"VarSymbol",
"enumerator",
"=",
"e",
".",
"getKey",
"(",
")",
";",
"Integer",
"mappedValue",
"=",
"e",
".",
"getValue",
"(",
")",
";",
"JCExpression",
"assign",
"=",
"make",
".",
"Assign",
"(",
"make",
".",
"Indexed",
"(",
"mapVar",
",",
"make",
".",
"App",
"(",
"make",
".",
"Select",
"(",
"make",
".",
"QualIdent",
"(",
"enumerator",
")",
",",
"ordinalMethod",
")",
")",
")",
",",
"make",
".",
"Literal",
"(",
"mappedValue",
")",
")",
".",
"setType",
"(",
"syms",
".",
"intType",
")",
";",
"JCStatement",
"exec",
"=",
"make",
".",
"Exec",
"(",
"assign",
")",
";",
"JCStatement",
"_try",
"=",
"make",
".",
"Try",
"(",
"make",
".",
"Block",
"(",
"0",
",",
"List",
".",
"of",
"(",
"exec",
")",
")",
",",
"catcher",
",",
"null",
")",
";",
"stmts",
".",
"append",
"(",
"_try",
")",
";",
"}",
"owner",
".",
"defs",
"=",
"owner",
".",
"defs",
".",
"prepend",
"(",
"make",
".",
"Block",
"(",
"STATIC",
",",
"stmts",
".",
"toList",
"(",
")",
")",
")",
".",
"prepend",
"(",
"make",
".",
"VarDef",
"(",
"mapVar",
",",
"mapVarInit",
")",
")",
";",
"}"
] |
generate the field initializer for the map
|
[
"generate",
"the",
"field",
"initializer",
"for",
"the",
"map"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java#L490-L535
|
4,914 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/ReferenceParser.java
|
ReferenceParser.parse
|
public Reference parse(String sig) throws ParseException {
// Break sig apart into qualifiedExpr member paramTypes.
JCTree qualExpr;
Name member;
List<JCTree> paramTypes;
Log.DeferredDiagnosticHandler deferredDiagnosticHandler
= new Log.DeferredDiagnosticHandler(fac.log);
try {
int hash = sig.indexOf("#");
int lparen = sig.indexOf("(", hash + 1);
if (hash == -1) {
if (lparen == -1) {
qualExpr = parseType(sig);
member = null;
} else {
qualExpr = null;
member = parseMember(sig.substring(0, lparen));
}
} else {
qualExpr = (hash == 0) ? null : parseType(sig.substring(0, hash));
if (lparen == -1)
member = parseMember(sig.substring(hash + 1));
else
member = parseMember(sig.substring(hash + 1, lparen));
}
if (lparen < 0) {
paramTypes = null;
} else {
int rparen = sig.indexOf(")", lparen);
if (rparen != sig.length() - 1)
throw new ParseException("dc.ref.bad.parens");
paramTypes = parseParams(sig.substring(lparen + 1, rparen));
}
if (!deferredDiagnosticHandler.getDiagnostics().isEmpty())
throw new ParseException("dc.ref.syntax.error");
} finally {
fac.log.popDiagnosticHandler(deferredDiagnosticHandler);
}
return new Reference(qualExpr, member, paramTypes);
}
|
java
|
public Reference parse(String sig) throws ParseException {
// Break sig apart into qualifiedExpr member paramTypes.
JCTree qualExpr;
Name member;
List<JCTree> paramTypes;
Log.DeferredDiagnosticHandler deferredDiagnosticHandler
= new Log.DeferredDiagnosticHandler(fac.log);
try {
int hash = sig.indexOf("#");
int lparen = sig.indexOf("(", hash + 1);
if (hash == -1) {
if (lparen == -1) {
qualExpr = parseType(sig);
member = null;
} else {
qualExpr = null;
member = parseMember(sig.substring(0, lparen));
}
} else {
qualExpr = (hash == 0) ? null : parseType(sig.substring(0, hash));
if (lparen == -1)
member = parseMember(sig.substring(hash + 1));
else
member = parseMember(sig.substring(hash + 1, lparen));
}
if (lparen < 0) {
paramTypes = null;
} else {
int rparen = sig.indexOf(")", lparen);
if (rparen != sig.length() - 1)
throw new ParseException("dc.ref.bad.parens");
paramTypes = parseParams(sig.substring(lparen + 1, rparen));
}
if (!deferredDiagnosticHandler.getDiagnostics().isEmpty())
throw new ParseException("dc.ref.syntax.error");
} finally {
fac.log.popDiagnosticHandler(deferredDiagnosticHandler);
}
return new Reference(qualExpr, member, paramTypes);
}
|
[
"public",
"Reference",
"parse",
"(",
"String",
"sig",
")",
"throws",
"ParseException",
"{",
"// Break sig apart into qualifiedExpr member paramTypes.",
"JCTree",
"qualExpr",
";",
"Name",
"member",
";",
"List",
"<",
"JCTree",
">",
"paramTypes",
";",
"Log",
".",
"DeferredDiagnosticHandler",
"deferredDiagnosticHandler",
"=",
"new",
"Log",
".",
"DeferredDiagnosticHandler",
"(",
"fac",
".",
"log",
")",
";",
"try",
"{",
"int",
"hash",
"=",
"sig",
".",
"indexOf",
"(",
"\"#\"",
")",
";",
"int",
"lparen",
"=",
"sig",
".",
"indexOf",
"(",
"\"(\"",
",",
"hash",
"+",
"1",
")",
";",
"if",
"(",
"hash",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"lparen",
"==",
"-",
"1",
")",
"{",
"qualExpr",
"=",
"parseType",
"(",
"sig",
")",
";",
"member",
"=",
"null",
";",
"}",
"else",
"{",
"qualExpr",
"=",
"null",
";",
"member",
"=",
"parseMember",
"(",
"sig",
".",
"substring",
"(",
"0",
",",
"lparen",
")",
")",
";",
"}",
"}",
"else",
"{",
"qualExpr",
"=",
"(",
"hash",
"==",
"0",
")",
"?",
"null",
":",
"parseType",
"(",
"sig",
".",
"substring",
"(",
"0",
",",
"hash",
")",
")",
";",
"if",
"(",
"lparen",
"==",
"-",
"1",
")",
"member",
"=",
"parseMember",
"(",
"sig",
".",
"substring",
"(",
"hash",
"+",
"1",
")",
")",
";",
"else",
"member",
"=",
"parseMember",
"(",
"sig",
".",
"substring",
"(",
"hash",
"+",
"1",
",",
"lparen",
")",
")",
";",
"}",
"if",
"(",
"lparen",
"<",
"0",
")",
"{",
"paramTypes",
"=",
"null",
";",
"}",
"else",
"{",
"int",
"rparen",
"=",
"sig",
".",
"indexOf",
"(",
"\")\"",
",",
"lparen",
")",
";",
"if",
"(",
"rparen",
"!=",
"sig",
".",
"length",
"(",
")",
"-",
"1",
")",
"throw",
"new",
"ParseException",
"(",
"\"dc.ref.bad.parens\"",
")",
";",
"paramTypes",
"=",
"parseParams",
"(",
"sig",
".",
"substring",
"(",
"lparen",
"+",
"1",
",",
"rparen",
")",
")",
";",
"}",
"if",
"(",
"!",
"deferredDiagnosticHandler",
".",
"getDiagnostics",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"throw",
"new",
"ParseException",
"(",
"\"dc.ref.syntax.error\"",
")",
";",
"}",
"finally",
"{",
"fac",
".",
"log",
".",
"popDiagnosticHandler",
"(",
"deferredDiagnosticHandler",
")",
";",
"}",
"return",
"new",
"Reference",
"(",
"qualExpr",
",",
"member",
",",
"paramTypes",
")",
";",
"}"
] |
Parse a reference to an API element as may be found in doc comment.
@param sig the signature to be parsed
@return a {@code Reference} object containing the result of parsing the signature
@throws ParseException if there is an error while parsing the signature
|
[
"Parse",
"a",
"reference",
"to",
"an",
"API",
"element",
"as",
"may",
"be",
"found",
"in",
"doc",
"comment",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/ReferenceParser.java#L90-L136
|
4,915 |
google/error-prone-javac
|
src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java
|
ElementFilter.listFilter
|
private static <D extends Directive> List<D> listFilter(Iterable<? extends Directive> directives,
DirectiveKind directiveKind,
Class<D> clazz) {
List<D> list = new ArrayList<>();
for (Directive d : directives) {
if (d.getKind() == directiveKind)
list.add(clazz.cast(d));
}
return list;
}
|
java
|
private static <D extends Directive> List<D> listFilter(Iterable<? extends Directive> directives,
DirectiveKind directiveKind,
Class<D> clazz) {
List<D> list = new ArrayList<>();
for (Directive d : directives) {
if (d.getKind() == directiveKind)
list.add(clazz.cast(d));
}
return list;
}
|
[
"private",
"static",
"<",
"D",
"extends",
"Directive",
">",
"List",
"<",
"D",
">",
"listFilter",
"(",
"Iterable",
"<",
"?",
"extends",
"Directive",
">",
"directives",
",",
"DirectiveKind",
"directiveKind",
",",
"Class",
"<",
"D",
">",
"clazz",
")",
"{",
"List",
"<",
"D",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Directive",
"d",
":",
"directives",
")",
"{",
"if",
"(",
"d",
".",
"getKind",
"(",
")",
"==",
"directiveKind",
")",
"list",
".",
"add",
"(",
"clazz",
".",
"cast",
"(",
"d",
")",
")",
";",
"}",
"return",
"list",
";",
"}"
] |
Assumes directiveKind and D are sensible.
|
[
"Assumes",
"directiveKind",
"and",
"D",
"are",
"sensible",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L296-L305
|
4,916 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
|
PackageTreeWriter.addLinkToMainTree
|
protected void addLinkToMainTree(Content div) {
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
getResource("doclet.Package_Hierarchies"));
div.addContent(span);
HtmlTree ul = new HtmlTree (HtmlTag.UL);
ul.addStyle(HtmlStyle.horizontal);
ul.addContent(getNavLinkMainTree(configuration.getText("doclet.All_Packages")));
div.addContent(ul);
}
|
java
|
protected void addLinkToMainTree(Content div) {
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
getResource("doclet.Package_Hierarchies"));
div.addContent(span);
HtmlTree ul = new HtmlTree (HtmlTag.UL);
ul.addStyle(HtmlStyle.horizontal);
ul.addContent(getNavLinkMainTree(configuration.getText("doclet.All_Packages")));
div.addContent(ul);
}
|
[
"protected",
"void",
"addLinkToMainTree",
"(",
"Content",
"div",
")",
"{",
"Content",
"span",
"=",
"HtmlTree",
".",
"SPAN",
"(",
"HtmlStyle",
".",
"packageHierarchyLabel",
",",
"getResource",
"(",
"\"doclet.Package_Hierarchies\"",
")",
")",
";",
"div",
".",
"addContent",
"(",
"span",
")",
";",
"HtmlTree",
"ul",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"UL",
")",
";",
"ul",
".",
"addStyle",
"(",
"HtmlStyle",
".",
"horizontal",
")",
";",
"ul",
".",
"addContent",
"(",
"getNavLinkMainTree",
"(",
"configuration",
".",
"getText",
"(",
"\"doclet.All_Packages\"",
")",
")",
")",
";",
"div",
".",
"addContent",
"(",
"ul",
")",
";",
"}"
] |
Add a link to the tree for all the packages.
@param div the content tree to which the link will be added
|
[
"Add",
"a",
"link",
"to",
"the",
"tree",
"for",
"all",
"the",
"packages",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java#L176-L184
|
4,917 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
|
PackageTreeWriter.getNavLinkPackage
|
protected Content getNavLinkPackage() {
Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
packageLabel);
Content li = HtmlTree.LI(linkContent);
return li;
}
|
java
|
protected Content getNavLinkPackage() {
Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
packageLabel);
Content li = HtmlTree.LI(linkContent);
return li;
}
|
[
"protected",
"Content",
"getNavLinkPackage",
"(",
")",
"{",
"Content",
"linkContent",
"=",
"getHyperLink",
"(",
"DocPaths",
".",
"PACKAGE_SUMMARY",
",",
"packageLabel",
")",
";",
"Content",
"li",
"=",
"HtmlTree",
".",
"LI",
"(",
"linkContent",
")",
";",
"return",
"li",
";",
"}"
] |
Get link to the package summary page for the package of this tree.
@return a content tree for the package link
|
[
"Get",
"link",
"to",
"the",
"package",
"summary",
"page",
"for",
"the",
"package",
"of",
"this",
"tree",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java#L219-L224
|
4,918 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java
|
DocFile.createFileForDirectory
|
public static DocFile createFileForDirectory(Configuration configuration, String file) {
return DocFileFactory.getFactory(configuration).createFileForDirectory(file);
}
|
java
|
public static DocFile createFileForDirectory(Configuration configuration, String file) {
return DocFileFactory.getFactory(configuration).createFileForDirectory(file);
}
|
[
"public",
"static",
"DocFile",
"createFileForDirectory",
"(",
"Configuration",
"configuration",
",",
"String",
"file",
")",
"{",
"return",
"DocFileFactory",
".",
"getFactory",
"(",
"configuration",
")",
".",
"createFileForDirectory",
"(",
"file",
")",
";",
"}"
] |
Create a DocFile for a directory.
|
[
"Create",
"a",
"DocFile",
"for",
"a",
"directory",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java#L59-L61
|
4,919 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java
|
DocFile.createFileForInput
|
public static DocFile createFileForInput(Configuration configuration, String file) {
return DocFileFactory.getFactory(configuration).createFileForInput(file);
}
|
java
|
public static DocFile createFileForInput(Configuration configuration, String file) {
return DocFileFactory.getFactory(configuration).createFileForInput(file);
}
|
[
"public",
"static",
"DocFile",
"createFileForInput",
"(",
"Configuration",
"configuration",
",",
"String",
"file",
")",
"{",
"return",
"DocFileFactory",
".",
"getFactory",
"(",
"configuration",
")",
".",
"createFileForInput",
"(",
"file",
")",
";",
"}"
] |
Create a DocFile for a file that will be opened for reading.
|
[
"Create",
"a",
"DocFile",
"for",
"a",
"file",
"that",
"will",
"be",
"opened",
"for",
"reading",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java#L64-L66
|
4,920 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java
|
DocFile.createFileForOutput
|
public static DocFile createFileForOutput(Configuration configuration, DocPath path) {
return DocFileFactory.getFactory(configuration).createFileForOutput(path);
}
|
java
|
public static DocFile createFileForOutput(Configuration configuration, DocPath path) {
return DocFileFactory.getFactory(configuration).createFileForOutput(path);
}
|
[
"public",
"static",
"DocFile",
"createFileForOutput",
"(",
"Configuration",
"configuration",
",",
"DocPath",
"path",
")",
"{",
"return",
"DocFileFactory",
".",
"getFactory",
"(",
"configuration",
")",
".",
"createFileForOutput",
"(",
"path",
")",
";",
"}"
] |
Create a DocFile for a file that will be opened for writing.
|
[
"Create",
"a",
"DocFile",
"for",
"a",
"file",
"that",
"will",
"be",
"opened",
"for",
"writing",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java#L69-L71
|
4,921 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java
|
DocFile.list
|
public static Iterable<DocFile> list(Configuration configuration, Location location, DocPath path) {
return DocFileFactory.getFactory(configuration).list(location, path);
}
|
java
|
public static Iterable<DocFile> list(Configuration configuration, Location location, DocPath path) {
return DocFileFactory.getFactory(configuration).list(location, path);
}
|
[
"public",
"static",
"Iterable",
"<",
"DocFile",
">",
"list",
"(",
"Configuration",
"configuration",
",",
"Location",
"location",
",",
"DocPath",
"path",
")",
"{",
"return",
"DocFileFactory",
".",
"getFactory",
"(",
"configuration",
")",
".",
"list",
"(",
"location",
",",
"path",
")",
";",
"}"
] |
List the directories and files found in subdirectories along the
elements of the given location.
@param configuration the doclet configuration
@param location currently, only {@link StandardLocation#SOURCE_PATH} is supported.
@param path the subdirectory of the directories of the location for which to
list files
|
[
"List",
"the",
"directories",
"and",
"files",
"found",
"in",
"subdirectories",
"along",
"the",
"elements",
"of",
"the",
"given",
"location",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java#L95-L97
|
4,922 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.addInterfaces
|
void addInterfaces(Deque<String> intfs, ClassFile cf)
throws ConstantPoolException {
int count = cf.interfaces.length;
for (int i = 0; i < count; i++) {
intfs.addLast(cf.getInterfaceName(i));
}
}
|
java
|
void addInterfaces(Deque<String> intfs, ClassFile cf)
throws ConstantPoolException {
int count = cf.interfaces.length;
for (int i = 0; i < count; i++) {
intfs.addLast(cf.getInterfaceName(i));
}
}
|
[
"void",
"addInterfaces",
"(",
"Deque",
"<",
"String",
">",
"intfs",
",",
"ClassFile",
"cf",
")",
"throws",
"ConstantPoolException",
"{",
"int",
"count",
"=",
"cf",
".",
"interfaces",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"intfs",
".",
"addLast",
"(",
"cf",
".",
"getInterfaceName",
"(",
"i",
")",
")",
";",
"}",
"}"
] |
Adds all interfaces from this class to the deque of interfaces.
@param intfs the deque of interfaces
@param cf the ClassFile of this class
@throws ConstantPoolException if a constant pool entry cannot be found
|
[
"Adds",
"all",
"interfaces",
"from",
"this",
"class",
"to",
"the",
"deque",
"of",
"interfaces",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L294-L300
|
4,923 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.resolveMember
|
String resolveMember(
ClassFile cf, String startClassName, String findName, String findDesc,
boolean resolveMethod, boolean checkStartClass)
throws ConstantPoolException {
ClassFile startClass;
if (cf.getName().equals(startClassName)) {
startClass = cf;
} else {
startClass = finder.find(startClassName);
if (startClass == null) {
errorNoClass(startClassName);
return startClassName;
}
}
// follow super_class until it's 0, meaning we've reached Object
// accumulate interfaces of superclasses as we go along
ClassFile curClass = startClass;
Deque<String> intfs = new ArrayDeque<>();
while (true) {
if ((checkStartClass || curClass != startClass) &&
isMemberPresent(curClass, findName, findDesc, resolveMethod)) {
break;
}
if (curClass.super_class == 0) { // reached Object
curClass = null;
break;
}
String superName = curClass.getSuperclassName();
curClass = finder.find(superName);
if (curClass == null) {
errorNoClass(superName);
break;
}
addInterfaces(intfs, curClass);
}
// search interfaces: add all interfaces and superinterfaces to queue
// search until it's empty
if (curClass == null) {
addInterfaces(intfs, startClass);
while (intfs.size() > 0) {
String intf = intfs.removeFirst();
curClass = finder.find(intf);
if (curClass == null) {
errorNoClass(intf);
break;
}
if (isMemberPresent(curClass, findName, findDesc, resolveMethod)) {
break;
}
addInterfaces(intfs, curClass);
}
}
if (curClass == null) {
if (checkStartClass) {
errorNoMethod(startClassName, findName, findDesc);
return startClassName;
} else {
// TODO: refactor this
// checkStartClass == false means we're checking for overrides
// so not being able to resolve a method simply means there's
// no overriding, which isn't an error
return null;
}
} else {
String foundClassName = curClass.getName();
return foundClassName;
}
}
|
java
|
String resolveMember(
ClassFile cf, String startClassName, String findName, String findDesc,
boolean resolveMethod, boolean checkStartClass)
throws ConstantPoolException {
ClassFile startClass;
if (cf.getName().equals(startClassName)) {
startClass = cf;
} else {
startClass = finder.find(startClassName);
if (startClass == null) {
errorNoClass(startClassName);
return startClassName;
}
}
// follow super_class until it's 0, meaning we've reached Object
// accumulate interfaces of superclasses as we go along
ClassFile curClass = startClass;
Deque<String> intfs = new ArrayDeque<>();
while (true) {
if ((checkStartClass || curClass != startClass) &&
isMemberPresent(curClass, findName, findDesc, resolveMethod)) {
break;
}
if (curClass.super_class == 0) { // reached Object
curClass = null;
break;
}
String superName = curClass.getSuperclassName();
curClass = finder.find(superName);
if (curClass == null) {
errorNoClass(superName);
break;
}
addInterfaces(intfs, curClass);
}
// search interfaces: add all interfaces and superinterfaces to queue
// search until it's empty
if (curClass == null) {
addInterfaces(intfs, startClass);
while (intfs.size() > 0) {
String intf = intfs.removeFirst();
curClass = finder.find(intf);
if (curClass == null) {
errorNoClass(intf);
break;
}
if (isMemberPresent(curClass, findName, findDesc, resolveMethod)) {
break;
}
addInterfaces(intfs, curClass);
}
}
if (curClass == null) {
if (checkStartClass) {
errorNoMethod(startClassName, findName, findDesc);
return startClassName;
} else {
// TODO: refactor this
// checkStartClass == false means we're checking for overrides
// so not being able to resolve a method simply means there's
// no overriding, which isn't an error
return null;
}
} else {
String foundClassName = curClass.getName();
return foundClassName;
}
}
|
[
"String",
"resolveMember",
"(",
"ClassFile",
"cf",
",",
"String",
"startClassName",
",",
"String",
"findName",
",",
"String",
"findDesc",
",",
"boolean",
"resolveMethod",
",",
"boolean",
"checkStartClass",
")",
"throws",
"ConstantPoolException",
"{",
"ClassFile",
"startClass",
";",
"if",
"(",
"cf",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"startClassName",
")",
")",
"{",
"startClass",
"=",
"cf",
";",
"}",
"else",
"{",
"startClass",
"=",
"finder",
".",
"find",
"(",
"startClassName",
")",
";",
"if",
"(",
"startClass",
"==",
"null",
")",
"{",
"errorNoClass",
"(",
"startClassName",
")",
";",
"return",
"startClassName",
";",
"}",
"}",
"// follow super_class until it's 0, meaning we've reached Object",
"// accumulate interfaces of superclasses as we go along",
"ClassFile",
"curClass",
"=",
"startClass",
";",
"Deque",
"<",
"String",
">",
"intfs",
"=",
"new",
"ArrayDeque",
"<>",
"(",
")",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"(",
"checkStartClass",
"||",
"curClass",
"!=",
"startClass",
")",
"&&",
"isMemberPresent",
"(",
"curClass",
",",
"findName",
",",
"findDesc",
",",
"resolveMethod",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"curClass",
".",
"super_class",
"==",
"0",
")",
"{",
"// reached Object",
"curClass",
"=",
"null",
";",
"break",
";",
"}",
"String",
"superName",
"=",
"curClass",
".",
"getSuperclassName",
"(",
")",
";",
"curClass",
"=",
"finder",
".",
"find",
"(",
"superName",
")",
";",
"if",
"(",
"curClass",
"==",
"null",
")",
"{",
"errorNoClass",
"(",
"superName",
")",
";",
"break",
";",
"}",
"addInterfaces",
"(",
"intfs",
",",
"curClass",
")",
";",
"}",
"// search interfaces: add all interfaces and superinterfaces to queue",
"// search until it's empty",
"if",
"(",
"curClass",
"==",
"null",
")",
"{",
"addInterfaces",
"(",
"intfs",
",",
"startClass",
")",
";",
"while",
"(",
"intfs",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"String",
"intf",
"=",
"intfs",
".",
"removeFirst",
"(",
")",
";",
"curClass",
"=",
"finder",
".",
"find",
"(",
"intf",
")",
";",
"if",
"(",
"curClass",
"==",
"null",
")",
"{",
"errorNoClass",
"(",
"intf",
")",
";",
"break",
";",
"}",
"if",
"(",
"isMemberPresent",
"(",
"curClass",
",",
"findName",
",",
"findDesc",
",",
"resolveMethod",
")",
")",
"{",
"break",
";",
"}",
"addInterfaces",
"(",
"intfs",
",",
"curClass",
")",
";",
"}",
"}",
"if",
"(",
"curClass",
"==",
"null",
")",
"{",
"if",
"(",
"checkStartClass",
")",
"{",
"errorNoMethod",
"(",
"startClassName",
",",
"findName",
",",
"findDesc",
")",
";",
"return",
"startClassName",
";",
"}",
"else",
"{",
"// TODO: refactor this",
"// checkStartClass == false means we're checking for overrides",
"// so not being able to resolve a method simply means there's",
"// no overriding, which isn't an error",
"return",
"null",
";",
"}",
"}",
"else",
"{",
"String",
"foundClassName",
"=",
"curClass",
".",
"getName",
"(",
")",
";",
"return",
"foundClassName",
";",
"}",
"}"
] |
Resolves a member by searching this class and all its superclasses and
implemented interfaces.
TODO: handles a few too many cases; needs cleanup.
TODO: refine error handling
@param cf the ClassFile of this class
@param startClassName the name of the class at which to start searching
@param findName the member name to search for
@param findDesc the method descriptor to search for (ignored for fields)
@param resolveMethod true if resolving a method, false if resolving a field
@param checkStartClass true if the start class should be searched, false if
it should be skipped
@return the name of the class where the member resolved, or null
@throws ConstantPoolException if a constant pool entry cannot be found
|
[
"Resolves",
"a",
"member",
"by",
"searching",
"this",
"class",
"and",
"all",
"its",
"superclasses",
"and",
"implemented",
"interfaces",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L320-L397
|
4,924 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.checkSuper
|
void checkSuper(ClassFile cf) throws ConstantPoolException {
String sname = cf.getSuperclassName();
DeprData dd = db.getTypeDeprecated(sname);
if (dd != null) {
printType("scan.out.extends", cf, sname, dd.isForRemoval());
}
}
|
java
|
void checkSuper(ClassFile cf) throws ConstantPoolException {
String sname = cf.getSuperclassName();
DeprData dd = db.getTypeDeprecated(sname);
if (dd != null) {
printType("scan.out.extends", cf, sname, dd.isForRemoval());
}
}
|
[
"void",
"checkSuper",
"(",
"ClassFile",
"cf",
")",
"throws",
"ConstantPoolException",
"{",
"String",
"sname",
"=",
"cf",
".",
"getSuperclassName",
"(",
")",
";",
"DeprData",
"dd",
"=",
"db",
".",
"getTypeDeprecated",
"(",
"sname",
")",
";",
"if",
"(",
"dd",
"!=",
"null",
")",
"{",
"printType",
"(",
"\"scan.out.extends\"",
",",
"cf",
",",
"sname",
",",
"dd",
".",
"isForRemoval",
"(",
")",
")",
";",
"}",
"}"
] |
Checks the superclass of this class.
@param cf the ClassFile of this class
@throws ConstantPoolException if a constant pool entry cannot be found
|
[
"Checks",
"the",
"superclass",
"of",
"this",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L405-L411
|
4,925 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.checkInterfaces
|
void checkInterfaces(ClassFile cf) throws ConstantPoolException {
int ni = cf.interfaces.length;
for (int i = 0; i < ni; i++) {
String iname = cf.getInterfaceName(i);
DeprData dd = db.getTypeDeprecated(iname);
if (dd != null) {
printType("scan.out.implements", cf, iname, dd.isForRemoval());
}
}
}
|
java
|
void checkInterfaces(ClassFile cf) throws ConstantPoolException {
int ni = cf.interfaces.length;
for (int i = 0; i < ni; i++) {
String iname = cf.getInterfaceName(i);
DeprData dd = db.getTypeDeprecated(iname);
if (dd != null) {
printType("scan.out.implements", cf, iname, dd.isForRemoval());
}
}
}
|
[
"void",
"checkInterfaces",
"(",
"ClassFile",
"cf",
")",
"throws",
"ConstantPoolException",
"{",
"int",
"ni",
"=",
"cf",
".",
"interfaces",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ni",
";",
"i",
"++",
")",
"{",
"String",
"iname",
"=",
"cf",
".",
"getInterfaceName",
"(",
"i",
")",
";",
"DeprData",
"dd",
"=",
"db",
".",
"getTypeDeprecated",
"(",
"iname",
")",
";",
"if",
"(",
"dd",
"!=",
"null",
")",
"{",
"printType",
"(",
"\"scan.out.implements\"",
",",
"cf",
",",
"iname",
",",
"dd",
".",
"isForRemoval",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
Checks the interfaces of this class.
@param cf the ClassFile of this class
@throws ConstantPoolException if a constant pool entry cannot be found
|
[
"Checks",
"the",
"interfaces",
"of",
"this",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L419-L428
|
4,926 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.checkClasses
|
void checkClasses(ClassFile cf, CPEntries entries) throws ConstantPoolException {
for (ConstantPool.CONSTANT_Class_info ci : entries.classes) {
String name = nameFromRefType(ci.getName());
if (name != null) {
DeprData dd = db.getTypeDeprecated(name);
if (dd != null) {
printType("scan.out.usesclass", cf, name, dd.isForRemoval());
}
}
}
}
|
java
|
void checkClasses(ClassFile cf, CPEntries entries) throws ConstantPoolException {
for (ConstantPool.CONSTANT_Class_info ci : entries.classes) {
String name = nameFromRefType(ci.getName());
if (name != null) {
DeprData dd = db.getTypeDeprecated(name);
if (dd != null) {
printType("scan.out.usesclass", cf, name, dd.isForRemoval());
}
}
}
}
|
[
"void",
"checkClasses",
"(",
"ClassFile",
"cf",
",",
"CPEntries",
"entries",
")",
"throws",
"ConstantPoolException",
"{",
"for",
"(",
"ConstantPool",
".",
"CONSTANT_Class_info",
"ci",
":",
"entries",
".",
"classes",
")",
"{",
"String",
"name",
"=",
"nameFromRefType",
"(",
"ci",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"DeprData",
"dd",
"=",
"db",
".",
"getTypeDeprecated",
"(",
"name",
")",
";",
"if",
"(",
"dd",
"!=",
"null",
")",
"{",
"printType",
"(",
"\"scan.out.usesclass\"",
",",
"cf",
",",
"name",
",",
"dd",
".",
"isForRemoval",
"(",
")",
")",
";",
"}",
"}",
"}",
"}"
] |
Checks Class_info entries in the constant pool.
@param cf the ClassFile of this class
@param entries constant pool entries collected from this class
@throws ConstantPoolException if a constant pool entry cannot be found
|
[
"Checks",
"Class_info",
"entries",
"in",
"the",
"constant",
"pool",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L437-L447
|
4,927 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.checkMethodRef
|
void checkMethodRef(ClassFile cf,
String clname,
CONSTANT_NameAndType_info nti,
String msgKey) throws ConstantPoolException {
String name = nti.getName();
String type = nti.getType();
clname = nameFromRefType(clname);
if (clname != null) {
clname = resolveMember(cf, clname, name, type, true, true);
DeprData dd = db.getMethodDeprecated(clname, name, type);
if (dd != null) {
printMethod(msgKey, cf, clname, name, type, dd.isForRemoval());
}
}
}
|
java
|
void checkMethodRef(ClassFile cf,
String clname,
CONSTANT_NameAndType_info nti,
String msgKey) throws ConstantPoolException {
String name = nti.getName();
String type = nti.getType();
clname = nameFromRefType(clname);
if (clname != null) {
clname = resolveMember(cf, clname, name, type, true, true);
DeprData dd = db.getMethodDeprecated(clname, name, type);
if (dd != null) {
printMethod(msgKey, cf, clname, name, type, dd.isForRemoval());
}
}
}
|
[
"void",
"checkMethodRef",
"(",
"ClassFile",
"cf",
",",
"String",
"clname",
",",
"CONSTANT_NameAndType_info",
"nti",
",",
"String",
"msgKey",
")",
"throws",
"ConstantPoolException",
"{",
"String",
"name",
"=",
"nti",
".",
"getName",
"(",
")",
";",
"String",
"type",
"=",
"nti",
".",
"getType",
"(",
")",
";",
"clname",
"=",
"nameFromRefType",
"(",
"clname",
")",
";",
"if",
"(",
"clname",
"!=",
"null",
")",
"{",
"clname",
"=",
"resolveMember",
"(",
"cf",
",",
"clname",
",",
"name",
",",
"type",
",",
"true",
",",
"true",
")",
";",
"DeprData",
"dd",
"=",
"db",
".",
"getMethodDeprecated",
"(",
"clname",
",",
"name",
",",
"type",
")",
";",
"if",
"(",
"dd",
"!=",
"null",
")",
"{",
"printMethod",
"(",
"msgKey",
",",
"cf",
",",
"clname",
",",
"name",
",",
"type",
",",
"dd",
".",
"isForRemoval",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
Checks methods referred to from the constant pool.
@param cf the ClassFile of this class
@param clname the class name
@param nti the NameAndType_info from a MethodRef or InterfaceMethodRef entry
@param msgKey message key for localization
@throws ConstantPoolException if a constant pool entry cannot be found
|
[
"Checks",
"methods",
"referred",
"to",
"from",
"the",
"constant",
"pool",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L458-L472
|
4,928 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.checkFieldRef
|
void checkFieldRef(ClassFile cf,
ConstantPool.CONSTANT_Fieldref_info fri) throws ConstantPoolException {
String clname = nameFromRefType(fri.getClassName());
CONSTANT_NameAndType_info nti = fri.getNameAndTypeInfo();
String name = nti.getName();
String type = nti.getType();
if (clname != null) {
clname = resolveMember(cf, clname, name, type, false, true);
DeprData dd = db.getFieldDeprecated(clname, name);
if (dd != null) {
printField("scan.out.usesfield", cf, clname, name, dd.isForRemoval());
}
}
}
|
java
|
void checkFieldRef(ClassFile cf,
ConstantPool.CONSTANT_Fieldref_info fri) throws ConstantPoolException {
String clname = nameFromRefType(fri.getClassName());
CONSTANT_NameAndType_info nti = fri.getNameAndTypeInfo();
String name = nti.getName();
String type = nti.getType();
if (clname != null) {
clname = resolveMember(cf, clname, name, type, false, true);
DeprData dd = db.getFieldDeprecated(clname, name);
if (dd != null) {
printField("scan.out.usesfield", cf, clname, name, dd.isForRemoval());
}
}
}
|
[
"void",
"checkFieldRef",
"(",
"ClassFile",
"cf",
",",
"ConstantPool",
".",
"CONSTANT_Fieldref_info",
"fri",
")",
"throws",
"ConstantPoolException",
"{",
"String",
"clname",
"=",
"nameFromRefType",
"(",
"fri",
".",
"getClassName",
"(",
")",
")",
";",
"CONSTANT_NameAndType_info",
"nti",
"=",
"fri",
".",
"getNameAndTypeInfo",
"(",
")",
";",
"String",
"name",
"=",
"nti",
".",
"getName",
"(",
")",
";",
"String",
"type",
"=",
"nti",
".",
"getType",
"(",
")",
";",
"if",
"(",
"clname",
"!=",
"null",
")",
"{",
"clname",
"=",
"resolveMember",
"(",
"cf",
",",
"clname",
",",
"name",
",",
"type",
",",
"false",
",",
"true",
")",
";",
"DeprData",
"dd",
"=",
"db",
".",
"getFieldDeprecated",
"(",
"clname",
",",
"name",
")",
";",
"if",
"(",
"dd",
"!=",
"null",
")",
"{",
"printField",
"(",
"\"scan.out.usesfield\"",
",",
"cf",
",",
"clname",
",",
"name",
",",
"dd",
".",
"isForRemoval",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
Checks fields referred to from the constant pool.
@param cf the ClassFile of this class
@throws ConstantPoolException if a constant pool entry cannot be found
|
[
"Checks",
"fields",
"referred",
"to",
"from",
"the",
"constant",
"pool",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L480-L494
|
4,929 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.checkFields
|
void checkFields(ClassFile cf) throws ConstantPoolException {
for (Field f : cf.fields) {
String type = nameFromDescType(cf.constant_pool.getUTF8Value(f.descriptor.index));
if (type != null) {
DeprData dd = db.getTypeDeprecated(type);
if (dd != null) {
printHasField(cf, f.getName(cf.constant_pool), type, dd.isForRemoval());
}
}
}
}
|
java
|
void checkFields(ClassFile cf) throws ConstantPoolException {
for (Field f : cf.fields) {
String type = nameFromDescType(cf.constant_pool.getUTF8Value(f.descriptor.index));
if (type != null) {
DeprData dd = db.getTypeDeprecated(type);
if (dd != null) {
printHasField(cf, f.getName(cf.constant_pool), type, dd.isForRemoval());
}
}
}
}
|
[
"void",
"checkFields",
"(",
"ClassFile",
"cf",
")",
"throws",
"ConstantPoolException",
"{",
"for",
"(",
"Field",
"f",
":",
"cf",
".",
"fields",
")",
"{",
"String",
"type",
"=",
"nameFromDescType",
"(",
"cf",
".",
"constant_pool",
".",
"getUTF8Value",
"(",
"f",
".",
"descriptor",
".",
"index",
")",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"DeprData",
"dd",
"=",
"db",
".",
"getTypeDeprecated",
"(",
"type",
")",
";",
"if",
"(",
"dd",
"!=",
"null",
")",
"{",
"printHasField",
"(",
"cf",
",",
"f",
".",
"getName",
"(",
"cf",
".",
"constant_pool",
")",
",",
"type",
",",
"dd",
".",
"isForRemoval",
"(",
")",
")",
";",
"}",
"}",
"}",
"}"
] |
Checks the fields declared in this class.
@param cf the ClassFile of this class
@throws ConstantPoolException if a constant pool entry cannot be found
|
[
"Checks",
"the",
"fields",
"declared",
"in",
"this",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L502-L512
|
4,930 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.checkMethods
|
void checkMethods(ClassFile cf) throws ConstantPoolException {
for (Method m : cf.methods) {
String mname = m.getName(cf.constant_pool);
String desc = cf.constant_pool.getUTF8Value(m.descriptor.index);
MethodSig sig = MethodSig.fromDesc(desc);
DeprData dd;
for (String parm : sig.getParameters()) {
parm = nameFromDescType(parm);
if (parm != null) {
dd = db.getTypeDeprecated(parm);
if (dd != null) {
printHasMethodParmType(cf, mname, parm, dd.isForRemoval());
}
}
}
String ret = nameFromDescType(sig.getReturnType());
if (ret != null) {
dd = db.getTypeDeprecated(ret);
if (dd != null) {
printHasMethodRetType(cf, mname, ret, dd.isForRemoval());
}
}
// check overrides
String overridden = resolveMember(cf, cf.getName(), mname, desc, true, false);
if (overridden != null) {
dd = db.getMethodDeprecated(overridden, mname, desc);
if (dd != null) {
printHasOverriddenMethod(cf, overridden, mname, desc, dd.isForRemoval());
}
}
}
}
|
java
|
void checkMethods(ClassFile cf) throws ConstantPoolException {
for (Method m : cf.methods) {
String mname = m.getName(cf.constant_pool);
String desc = cf.constant_pool.getUTF8Value(m.descriptor.index);
MethodSig sig = MethodSig.fromDesc(desc);
DeprData dd;
for (String parm : sig.getParameters()) {
parm = nameFromDescType(parm);
if (parm != null) {
dd = db.getTypeDeprecated(parm);
if (dd != null) {
printHasMethodParmType(cf, mname, parm, dd.isForRemoval());
}
}
}
String ret = nameFromDescType(sig.getReturnType());
if (ret != null) {
dd = db.getTypeDeprecated(ret);
if (dd != null) {
printHasMethodRetType(cf, mname, ret, dd.isForRemoval());
}
}
// check overrides
String overridden = resolveMember(cf, cf.getName(), mname, desc, true, false);
if (overridden != null) {
dd = db.getMethodDeprecated(overridden, mname, desc);
if (dd != null) {
printHasOverriddenMethod(cf, overridden, mname, desc, dd.isForRemoval());
}
}
}
}
|
[
"void",
"checkMethods",
"(",
"ClassFile",
"cf",
")",
"throws",
"ConstantPoolException",
"{",
"for",
"(",
"Method",
"m",
":",
"cf",
".",
"methods",
")",
"{",
"String",
"mname",
"=",
"m",
".",
"getName",
"(",
"cf",
".",
"constant_pool",
")",
";",
"String",
"desc",
"=",
"cf",
".",
"constant_pool",
".",
"getUTF8Value",
"(",
"m",
".",
"descriptor",
".",
"index",
")",
";",
"MethodSig",
"sig",
"=",
"MethodSig",
".",
"fromDesc",
"(",
"desc",
")",
";",
"DeprData",
"dd",
";",
"for",
"(",
"String",
"parm",
":",
"sig",
".",
"getParameters",
"(",
")",
")",
"{",
"parm",
"=",
"nameFromDescType",
"(",
"parm",
")",
";",
"if",
"(",
"parm",
"!=",
"null",
")",
"{",
"dd",
"=",
"db",
".",
"getTypeDeprecated",
"(",
"parm",
")",
";",
"if",
"(",
"dd",
"!=",
"null",
")",
"{",
"printHasMethodParmType",
"(",
"cf",
",",
"mname",
",",
"parm",
",",
"dd",
".",
"isForRemoval",
"(",
")",
")",
";",
"}",
"}",
"}",
"String",
"ret",
"=",
"nameFromDescType",
"(",
"sig",
".",
"getReturnType",
"(",
")",
")",
";",
"if",
"(",
"ret",
"!=",
"null",
")",
"{",
"dd",
"=",
"db",
".",
"getTypeDeprecated",
"(",
"ret",
")",
";",
"if",
"(",
"dd",
"!=",
"null",
")",
"{",
"printHasMethodRetType",
"(",
"cf",
",",
"mname",
",",
"ret",
",",
"dd",
".",
"isForRemoval",
"(",
")",
")",
";",
"}",
"}",
"// check overrides",
"String",
"overridden",
"=",
"resolveMember",
"(",
"cf",
",",
"cf",
".",
"getName",
"(",
")",
",",
"mname",
",",
"desc",
",",
"true",
",",
"false",
")",
";",
"if",
"(",
"overridden",
"!=",
"null",
")",
"{",
"dd",
"=",
"db",
".",
"getMethodDeprecated",
"(",
"overridden",
",",
"mname",
",",
"desc",
")",
";",
"if",
"(",
"dd",
"!=",
"null",
")",
"{",
"printHasOverriddenMethod",
"(",
"cf",
",",
"overridden",
",",
"mname",
",",
"desc",
",",
"dd",
".",
"isForRemoval",
"(",
")",
")",
";",
"}",
"}",
"}",
"}"
] |
Checks the methods declared in this class.
@param cf the ClassFile object of this class
@throws ConstantPoolException if a constant pool entry cannot be found
|
[
"Checks",
"the",
"methods",
"declared",
"in",
"this",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L520-L554
|
4,931 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.processClass
|
void processClass(ClassFile cf) throws ConstantPoolException {
if (verbose) {
out.println(Messages.get("scan.process.class", cf.getName()));
}
CPEntries entries = CPEntries.loadFrom(cf);
checkSuper(cf);
checkInterfaces(cf);
checkClasses(cf, entries);
for (ConstantPool.CONSTANT_Methodref_info mri : entries.methodRefs) {
String clname = mri.getClassName();
CONSTANT_NameAndType_info nti = mri.getNameAndTypeInfo();
checkMethodRef(cf, clname, nti, "scan.out.usesmethod");
}
for (ConstantPool.CONSTANT_InterfaceMethodref_info imri : entries.intfMethodRefs) {
String clname = imri.getClassName();
CONSTANT_NameAndType_info nti = imri.getNameAndTypeInfo();
checkMethodRef(cf, clname, nti, "scan.out.usesintfmethod");
}
for (ConstantPool.CONSTANT_Fieldref_info fri : entries.fieldRefs) {
checkFieldRef(cf, fri);
}
checkFields(cf);
checkMethods(cf);
}
|
java
|
void processClass(ClassFile cf) throws ConstantPoolException {
if (verbose) {
out.println(Messages.get("scan.process.class", cf.getName()));
}
CPEntries entries = CPEntries.loadFrom(cf);
checkSuper(cf);
checkInterfaces(cf);
checkClasses(cf, entries);
for (ConstantPool.CONSTANT_Methodref_info mri : entries.methodRefs) {
String clname = mri.getClassName();
CONSTANT_NameAndType_info nti = mri.getNameAndTypeInfo();
checkMethodRef(cf, clname, nti, "scan.out.usesmethod");
}
for (ConstantPool.CONSTANT_InterfaceMethodref_info imri : entries.intfMethodRefs) {
String clname = imri.getClassName();
CONSTANT_NameAndType_info nti = imri.getNameAndTypeInfo();
checkMethodRef(cf, clname, nti, "scan.out.usesintfmethod");
}
for (ConstantPool.CONSTANT_Fieldref_info fri : entries.fieldRefs) {
checkFieldRef(cf, fri);
}
checkFields(cf);
checkMethods(cf);
}
|
[
"void",
"processClass",
"(",
"ClassFile",
"cf",
")",
"throws",
"ConstantPoolException",
"{",
"if",
"(",
"verbose",
")",
"{",
"out",
".",
"println",
"(",
"Messages",
".",
"get",
"(",
"\"scan.process.class\"",
",",
"cf",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"CPEntries",
"entries",
"=",
"CPEntries",
".",
"loadFrom",
"(",
"cf",
")",
";",
"checkSuper",
"(",
"cf",
")",
";",
"checkInterfaces",
"(",
"cf",
")",
";",
"checkClasses",
"(",
"cf",
",",
"entries",
")",
";",
"for",
"(",
"ConstantPool",
".",
"CONSTANT_Methodref_info",
"mri",
":",
"entries",
".",
"methodRefs",
")",
"{",
"String",
"clname",
"=",
"mri",
".",
"getClassName",
"(",
")",
";",
"CONSTANT_NameAndType_info",
"nti",
"=",
"mri",
".",
"getNameAndTypeInfo",
"(",
")",
";",
"checkMethodRef",
"(",
"cf",
",",
"clname",
",",
"nti",
",",
"\"scan.out.usesmethod\"",
")",
";",
"}",
"for",
"(",
"ConstantPool",
".",
"CONSTANT_InterfaceMethodref_info",
"imri",
":",
"entries",
".",
"intfMethodRefs",
")",
"{",
"String",
"clname",
"=",
"imri",
".",
"getClassName",
"(",
")",
";",
"CONSTANT_NameAndType_info",
"nti",
"=",
"imri",
".",
"getNameAndTypeInfo",
"(",
")",
";",
"checkMethodRef",
"(",
"cf",
",",
"clname",
",",
"nti",
",",
"\"scan.out.usesintfmethod\"",
")",
";",
"}",
"for",
"(",
"ConstantPool",
".",
"CONSTANT_Fieldref_info",
"fri",
":",
"entries",
".",
"fieldRefs",
")",
"{",
"checkFieldRef",
"(",
"cf",
",",
"fri",
")",
";",
"}",
"checkFields",
"(",
"cf",
")",
";",
"checkMethods",
"(",
"cf",
")",
";",
"}"
] |
Processes a single class file.
@param cf the ClassFile of the class
@throws ConstantPoolException if a constant pool entry cannot be found
|
[
"Processes",
"a",
"single",
"class",
"file",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L562-L591
|
4,932 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.scanJar
|
public boolean scanJar(String jarname) {
try (JarFile jf = new JarFile(jarname)) {
out.println(Messages.get("scan.head.jar", jarname));
finder.addJar(jarname);
Enumeration<JarEntry> entries = jf.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
String name = entry.getName();
if (name.endsWith(".class")
&& !name.endsWith("package-info.class")
&& !name.endsWith("module-info.class")) {
processClass(ClassFile.read(jf.getInputStream(entry)));
}
}
return true;
} catch (NoSuchFileException nsfe) {
errorNoFile(jarname);
} catch (IOException | ConstantPoolException ex) {
errorException(ex);
}
return false;
}
|
java
|
public boolean scanJar(String jarname) {
try (JarFile jf = new JarFile(jarname)) {
out.println(Messages.get("scan.head.jar", jarname));
finder.addJar(jarname);
Enumeration<JarEntry> entries = jf.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
String name = entry.getName();
if (name.endsWith(".class")
&& !name.endsWith("package-info.class")
&& !name.endsWith("module-info.class")) {
processClass(ClassFile.read(jf.getInputStream(entry)));
}
}
return true;
} catch (NoSuchFileException nsfe) {
errorNoFile(jarname);
} catch (IOException | ConstantPoolException ex) {
errorException(ex);
}
return false;
}
|
[
"public",
"boolean",
"scanJar",
"(",
"String",
"jarname",
")",
"{",
"try",
"(",
"JarFile",
"jf",
"=",
"new",
"JarFile",
"(",
"jarname",
")",
")",
"{",
"out",
".",
"println",
"(",
"Messages",
".",
"get",
"(",
"\"scan.head.jar\"",
",",
"jarname",
")",
")",
";",
"finder",
".",
"addJar",
"(",
"jarname",
")",
";",
"Enumeration",
"<",
"JarEntry",
">",
"entries",
"=",
"jf",
".",
"entries",
"(",
")",
";",
"while",
"(",
"entries",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"JarEntry",
"entry",
"=",
"entries",
".",
"nextElement",
"(",
")",
";",
"String",
"name",
"=",
"entry",
".",
"getName",
"(",
")",
";",
"if",
"(",
"name",
".",
"endsWith",
"(",
"\".class\"",
")",
"&&",
"!",
"name",
".",
"endsWith",
"(",
"\"package-info.class\"",
")",
"&&",
"!",
"name",
".",
"endsWith",
"(",
"\"module-info.class\"",
")",
")",
"{",
"processClass",
"(",
"ClassFile",
".",
"read",
"(",
"jf",
".",
"getInputStream",
"(",
"entry",
")",
")",
")",
";",
"}",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"NoSuchFileException",
"nsfe",
")",
"{",
"errorNoFile",
"(",
"jarname",
")",
";",
"}",
"catch",
"(",
"IOException",
"|",
"ConstantPoolException",
"ex",
")",
"{",
"errorException",
"(",
"ex",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Scans a jar file for uses of deprecated APIs.
@param jarname the jar file to process
@return true on success, false on failure
|
[
"Scans",
"a",
"jar",
"file",
"for",
"uses",
"of",
"deprecated",
"APIs",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L599-L620
|
4,933 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.scanDir
|
public boolean scanDir(String dirname) {
Path base = Paths.get(dirname);
int baseCount = base.getNameCount();
finder.addDir(dirname);
try (Stream<Path> paths = Files.walk(Paths.get(dirname))) {
List<Path> classes =
paths.filter(p -> p.getNameCount() > baseCount)
.filter(path -> path.toString().endsWith(".class"))
.filter(path -> !path.toString().endsWith("package-info.class"))
.filter(path -> !path.toString().endsWith("module-info.class"))
.collect(Collectors.toList());
out.println(Messages.get("scan.head.dir", dirname));
for (Path p : classes) {
processClass(ClassFile.read(p));
}
return true;
} catch (IOException | ConstantPoolException ex) {
errorException(ex);
return false;
}
}
|
java
|
public boolean scanDir(String dirname) {
Path base = Paths.get(dirname);
int baseCount = base.getNameCount();
finder.addDir(dirname);
try (Stream<Path> paths = Files.walk(Paths.get(dirname))) {
List<Path> classes =
paths.filter(p -> p.getNameCount() > baseCount)
.filter(path -> path.toString().endsWith(".class"))
.filter(path -> !path.toString().endsWith("package-info.class"))
.filter(path -> !path.toString().endsWith("module-info.class"))
.collect(Collectors.toList());
out.println(Messages.get("scan.head.dir", dirname));
for (Path p : classes) {
processClass(ClassFile.read(p));
}
return true;
} catch (IOException | ConstantPoolException ex) {
errorException(ex);
return false;
}
}
|
[
"public",
"boolean",
"scanDir",
"(",
"String",
"dirname",
")",
"{",
"Path",
"base",
"=",
"Paths",
".",
"get",
"(",
"dirname",
")",
";",
"int",
"baseCount",
"=",
"base",
".",
"getNameCount",
"(",
")",
";",
"finder",
".",
"addDir",
"(",
"dirname",
")",
";",
"try",
"(",
"Stream",
"<",
"Path",
">",
"paths",
"=",
"Files",
".",
"walk",
"(",
"Paths",
".",
"get",
"(",
"dirname",
")",
")",
")",
"{",
"List",
"<",
"Path",
">",
"classes",
"=",
"paths",
".",
"filter",
"(",
"p",
"->",
"p",
".",
"getNameCount",
"(",
")",
">",
"baseCount",
")",
".",
"filter",
"(",
"path",
"->",
"path",
".",
"toString",
"(",
")",
".",
"endsWith",
"(",
"\".class\"",
")",
")",
".",
"filter",
"(",
"path",
"->",
"!",
"path",
".",
"toString",
"(",
")",
".",
"endsWith",
"(",
"\"package-info.class\"",
")",
")",
".",
"filter",
"(",
"path",
"->",
"!",
"path",
".",
"toString",
"(",
")",
".",
"endsWith",
"(",
"\"module-info.class\"",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"out",
".",
"println",
"(",
"Messages",
".",
"get",
"(",
"\"scan.head.dir\"",
",",
"dirname",
")",
")",
";",
"for",
"(",
"Path",
"p",
":",
"classes",
")",
"{",
"processClass",
"(",
"ClassFile",
".",
"read",
"(",
"p",
")",
")",
";",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"IOException",
"|",
"ConstantPoolException",
"ex",
")",
"{",
"errorException",
"(",
"ex",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Scans class files in the named directory hierarchy for uses of deprecated APIs.
@param dirname the directory hierarchy to process
@return true on success, false on failure
|
[
"Scans",
"class",
"files",
"in",
"the",
"named",
"directory",
"hierarchy",
"for",
"uses",
"of",
"deprecated",
"APIs",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L628-L650
|
4,934 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.processClassName
|
public boolean processClassName(String className) {
try {
ClassFile cf = finder.find(className);
if (cf == null) {
errorNoClass(className);
return false;
} else {
processClass(cf);
return true;
}
} catch (ConstantPoolException ex) {
errorException(ex);
return false;
}
}
|
java
|
public boolean processClassName(String className) {
try {
ClassFile cf = finder.find(className);
if (cf == null) {
errorNoClass(className);
return false;
} else {
processClass(cf);
return true;
}
} catch (ConstantPoolException ex) {
errorException(ex);
return false;
}
}
|
[
"public",
"boolean",
"processClassName",
"(",
"String",
"className",
")",
"{",
"try",
"{",
"ClassFile",
"cf",
"=",
"finder",
".",
"find",
"(",
"className",
")",
";",
"if",
"(",
"cf",
"==",
"null",
")",
"{",
"errorNoClass",
"(",
"className",
")",
";",
"return",
"false",
";",
"}",
"else",
"{",
"processClass",
"(",
"cf",
")",
";",
"return",
"true",
";",
"}",
"}",
"catch",
"(",
"ConstantPoolException",
"ex",
")",
"{",
"errorException",
"(",
"ex",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Scans the named class for uses of deprecated APIs.
@param className the class to scan
@return true on success, false on failure
|
[
"Scans",
"the",
"named",
"class",
"for",
"uses",
"of",
"deprecated",
"APIs",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L658-L672
|
4,935 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
|
Scan.processClassFile
|
public boolean processClassFile(String fileName) {
Path path = Paths.get(fileName);
try {
ClassFile cf = ClassFile.read(path);
processClass(cf);
return true;
} catch (NoSuchFileException nsfe) {
errorNoFile(fileName);
} catch (IOException | ConstantPoolException ex) {
errorException(ex);
}
return false;
}
|
java
|
public boolean processClassFile(String fileName) {
Path path = Paths.get(fileName);
try {
ClassFile cf = ClassFile.read(path);
processClass(cf);
return true;
} catch (NoSuchFileException nsfe) {
errorNoFile(fileName);
} catch (IOException | ConstantPoolException ex) {
errorException(ex);
}
return false;
}
|
[
"public",
"boolean",
"processClassFile",
"(",
"String",
"fileName",
")",
"{",
"Path",
"path",
"=",
"Paths",
".",
"get",
"(",
"fileName",
")",
";",
"try",
"{",
"ClassFile",
"cf",
"=",
"ClassFile",
".",
"read",
"(",
"path",
")",
";",
"processClass",
"(",
"cf",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"NoSuchFileException",
"nsfe",
")",
"{",
"errorNoFile",
"(",
"fileName",
")",
";",
"}",
"catch",
"(",
"IOException",
"|",
"ConstantPoolException",
"ex",
")",
"{",
"errorException",
"(",
"ex",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Scans the named class file for uses of deprecated APIs.
@param fileName the class file to scan
@return true on success, false on failure
|
[
"Scans",
"the",
"named",
"class",
"file",
"for",
"uses",
"of",
"deprecated",
"APIs",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L680-L692
|
4,936 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java
|
ClassUseMapper.subclasses
|
private Collection<TypeElement> subclasses(TypeElement te) {
Collection<TypeElement> ret = classToSubclass.get(te);
if (ret == null) {
ret = new TreeSet<>(utils.makeClassUseComparator());
Set<TypeElement> subs = classtree.subClasses(te);
if (subs != null) {
ret.addAll(subs);
for (TypeElement sub : subs) {
ret.addAll(subclasses(sub));
}
}
addAll(classToSubclass, te, ret);
}
return ret;
}
|
java
|
private Collection<TypeElement> subclasses(TypeElement te) {
Collection<TypeElement> ret = classToSubclass.get(te);
if (ret == null) {
ret = new TreeSet<>(utils.makeClassUseComparator());
Set<TypeElement> subs = classtree.subClasses(te);
if (subs != null) {
ret.addAll(subs);
for (TypeElement sub : subs) {
ret.addAll(subclasses(sub));
}
}
addAll(classToSubclass, te, ret);
}
return ret;
}
|
[
"private",
"Collection",
"<",
"TypeElement",
">",
"subclasses",
"(",
"TypeElement",
"te",
")",
"{",
"Collection",
"<",
"TypeElement",
">",
"ret",
"=",
"classToSubclass",
".",
"get",
"(",
"te",
")",
";",
"if",
"(",
"ret",
"==",
"null",
")",
"{",
"ret",
"=",
"new",
"TreeSet",
"<>",
"(",
"utils",
".",
"makeClassUseComparator",
"(",
")",
")",
";",
"Set",
"<",
"TypeElement",
">",
"subs",
"=",
"classtree",
".",
"subClasses",
"(",
"te",
")",
";",
"if",
"(",
"subs",
"!=",
"null",
")",
"{",
"ret",
".",
"addAll",
"(",
"subs",
")",
";",
"for",
"(",
"TypeElement",
"sub",
":",
"subs",
")",
"{",
"ret",
".",
"addAll",
"(",
"subclasses",
"(",
"sub",
")",
")",
";",
"}",
"}",
"addAll",
"(",
"classToSubclass",
",",
"te",
",",
"ret",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Return all subClasses of a class AND fill-in classToSubclass map.
|
[
"Return",
"all",
"subClasses",
"of",
"a",
"class",
"AND",
"fill",
"-",
"in",
"classToSubclass",
"map",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java#L278-L292
|
4,937 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java
|
ClassUseMapper.subinterfaces
|
private Collection<TypeElement> subinterfaces(TypeElement te) {
Collection<TypeElement> ret = classToSubinterface.get(te);
if (ret == null) {
ret = new TreeSet<>(utils.makeClassUseComparator());
Set<TypeElement> subs = classtree.subInterfaces(te);
if (subs != null) {
ret.addAll(subs);
for (TypeElement sub : subs) {
ret.addAll(subinterfaces(sub));
}
}
addAll(classToSubinterface, te, ret);
}
return ret;
}
|
java
|
private Collection<TypeElement> subinterfaces(TypeElement te) {
Collection<TypeElement> ret = classToSubinterface.get(te);
if (ret == null) {
ret = new TreeSet<>(utils.makeClassUseComparator());
Set<TypeElement> subs = classtree.subInterfaces(te);
if (subs != null) {
ret.addAll(subs);
for (TypeElement sub : subs) {
ret.addAll(subinterfaces(sub));
}
}
addAll(classToSubinterface, te, ret);
}
return ret;
}
|
[
"private",
"Collection",
"<",
"TypeElement",
">",
"subinterfaces",
"(",
"TypeElement",
"te",
")",
"{",
"Collection",
"<",
"TypeElement",
">",
"ret",
"=",
"classToSubinterface",
".",
"get",
"(",
"te",
")",
";",
"if",
"(",
"ret",
"==",
"null",
")",
"{",
"ret",
"=",
"new",
"TreeSet",
"<>",
"(",
"utils",
".",
"makeClassUseComparator",
"(",
")",
")",
";",
"Set",
"<",
"TypeElement",
">",
"subs",
"=",
"classtree",
".",
"subInterfaces",
"(",
"te",
")",
";",
"if",
"(",
"subs",
"!=",
"null",
")",
"{",
"ret",
".",
"addAll",
"(",
"subs",
")",
";",
"for",
"(",
"TypeElement",
"sub",
":",
"subs",
")",
"{",
"ret",
".",
"addAll",
"(",
"subinterfaces",
"(",
"sub",
")",
")",
";",
"}",
"}",
"addAll",
"(",
"classToSubinterface",
",",
"te",
",",
"ret",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Return all subInterfaces of an interface AND fill-in classToSubinterface map.
|
[
"Return",
"all",
"subInterfaces",
"of",
"an",
"interface",
"AND",
"fill",
"-",
"in",
"classToSubinterface",
"map",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java#L297-L311
|
4,938 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java
|
ClassUseMapper.mapTypeParameters
|
private <T extends Element> void mapTypeParameters(final Map<TypeElement, List<T>> map,
Element element, final T holder) {
SimpleElementVisitor9<Void, Void> elementVisitor
= new SimpleElementVisitor9<Void, Void>() {
private void addParameters(TypeParameterElement e) {
for (TypeMirror type : utils.getBounds(e)) {
addTypeParameterToMap(map, type, holder);
}
}
@Override
public Void visitType(TypeElement e, Void p) {
for (TypeParameterElement param : e.getTypeParameters()) {
addParameters(param);
}
return null;
}
@Override
public Void visitExecutable(ExecutableElement e, Void p) {
for (TypeParameterElement param : e.getTypeParameters()) {
addParameters(param);
}
return null;
}
@Override
protected Void defaultAction(Element e, Void p) {
mapTypeParameters(map, e.asType(), holder);
return null;
}
@Override
public Void visitTypeParameter(TypeParameterElement e, Void p) {
addParameters(e);
return null;
}
};
elementVisitor.visit(element);
}
|
java
|
private <T extends Element> void mapTypeParameters(final Map<TypeElement, List<T>> map,
Element element, final T holder) {
SimpleElementVisitor9<Void, Void> elementVisitor
= new SimpleElementVisitor9<Void, Void>() {
private void addParameters(TypeParameterElement e) {
for (TypeMirror type : utils.getBounds(e)) {
addTypeParameterToMap(map, type, holder);
}
}
@Override
public Void visitType(TypeElement e, Void p) {
for (TypeParameterElement param : e.getTypeParameters()) {
addParameters(param);
}
return null;
}
@Override
public Void visitExecutable(ExecutableElement e, Void p) {
for (TypeParameterElement param : e.getTypeParameters()) {
addParameters(param);
}
return null;
}
@Override
protected Void defaultAction(Element e, Void p) {
mapTypeParameters(map, e.asType(), holder);
return null;
}
@Override
public Void visitTypeParameter(TypeParameterElement e, Void p) {
addParameters(e);
return null;
}
};
elementVisitor.visit(element);
}
|
[
"private",
"<",
"T",
"extends",
"Element",
">",
"void",
"mapTypeParameters",
"(",
"final",
"Map",
"<",
"TypeElement",
",",
"List",
"<",
"T",
">",
">",
"map",
",",
"Element",
"element",
",",
"final",
"T",
"holder",
")",
"{",
"SimpleElementVisitor9",
"<",
"Void",
",",
"Void",
">",
"elementVisitor",
"=",
"new",
"SimpleElementVisitor9",
"<",
"Void",
",",
"Void",
">",
"(",
")",
"{",
"private",
"void",
"addParameters",
"(",
"TypeParameterElement",
"e",
")",
"{",
"for",
"(",
"TypeMirror",
"type",
":",
"utils",
".",
"getBounds",
"(",
"e",
")",
")",
"{",
"addTypeParameterToMap",
"(",
"map",
",",
"type",
",",
"holder",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"Void",
"visitType",
"(",
"TypeElement",
"e",
",",
"Void",
"p",
")",
"{",
"for",
"(",
"TypeParameterElement",
"param",
":",
"e",
".",
"getTypeParameters",
"(",
")",
")",
"{",
"addParameters",
"(",
"param",
")",
";",
"}",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"Void",
"visitExecutable",
"(",
"ExecutableElement",
"e",
",",
"Void",
"p",
")",
"{",
"for",
"(",
"TypeParameterElement",
"param",
":",
"e",
".",
"getTypeParameters",
"(",
")",
")",
"{",
"addParameters",
"(",
"param",
")",
";",
"}",
"return",
"null",
";",
"}",
"@",
"Override",
"protected",
"Void",
"defaultAction",
"(",
"Element",
"e",
",",
"Void",
"p",
")",
"{",
"mapTypeParameters",
"(",
"map",
",",
"e",
".",
"asType",
"(",
")",
",",
"holder",
")",
";",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"Void",
"visitTypeParameter",
"(",
"TypeParameterElement",
"e",
",",
"Void",
"p",
")",
"{",
"addParameters",
"(",
"e",
")",
";",
"return",
"null",
";",
"}",
"}",
";",
"elementVisitor",
".",
"visit",
"(",
"element",
")",
";",
"}"
] |
Map the TypeElements to the members that use them as type parameters.
@param map the map the insert the information into.
@param element the te whose type parameters are being checked.
@param holder the holder that owns the type parameters.
|
[
"Map",
"the",
"TypeElements",
"to",
"the",
"members",
"that",
"use",
"them",
"as",
"type",
"parameters",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java#L477-L518
|
4,939 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java
|
ClassUseMapper.mapAnnotations
|
private <T extends Element> void mapAnnotations(final Map<TypeElement, List<T>> map,
Element e, final T holder) {
new SimpleElementVisitor9<Void, Void>() {
void addAnnotations(Element e) {
for (AnnotationMirror a : e.getAnnotationMirrors()) {
add(map, (TypeElement) a.getAnnotationType().asElement(), holder);
}
}
@Override
public Void visitPackage(PackageElement e, Void p) {
for (AnnotationMirror a : e.getAnnotationMirrors()) {
refList(map, a.getAnnotationType().asElement()).add(holder);
}
return null;
}
@Override
protected Void defaultAction(Element e, Void p) {
addAnnotations(e);
return null;
}
}.visit(e);
}
|
java
|
private <T extends Element> void mapAnnotations(final Map<TypeElement, List<T>> map,
Element e, final T holder) {
new SimpleElementVisitor9<Void, Void>() {
void addAnnotations(Element e) {
for (AnnotationMirror a : e.getAnnotationMirrors()) {
add(map, (TypeElement) a.getAnnotationType().asElement(), holder);
}
}
@Override
public Void visitPackage(PackageElement e, Void p) {
for (AnnotationMirror a : e.getAnnotationMirrors()) {
refList(map, a.getAnnotationType().asElement()).add(holder);
}
return null;
}
@Override
protected Void defaultAction(Element e, Void p) {
addAnnotations(e);
return null;
}
}.visit(e);
}
|
[
"private",
"<",
"T",
"extends",
"Element",
">",
"void",
"mapAnnotations",
"(",
"final",
"Map",
"<",
"TypeElement",
",",
"List",
"<",
"T",
">",
">",
"map",
",",
"Element",
"e",
",",
"final",
"T",
"holder",
")",
"{",
"new",
"SimpleElementVisitor9",
"<",
"Void",
",",
"Void",
">",
"(",
")",
"{",
"void",
"addAnnotations",
"(",
"Element",
"e",
")",
"{",
"for",
"(",
"AnnotationMirror",
"a",
":",
"e",
".",
"getAnnotationMirrors",
"(",
")",
")",
"{",
"add",
"(",
"map",
",",
"(",
"TypeElement",
")",
"a",
".",
"getAnnotationType",
"(",
")",
".",
"asElement",
"(",
")",
",",
"holder",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"Void",
"visitPackage",
"(",
"PackageElement",
"e",
",",
"Void",
"p",
")",
"{",
"for",
"(",
"AnnotationMirror",
"a",
":",
"e",
".",
"getAnnotationMirrors",
"(",
")",
")",
"{",
"refList",
"(",
"map",
",",
"a",
".",
"getAnnotationType",
"(",
")",
".",
"asElement",
"(",
")",
")",
".",
"add",
"(",
"holder",
")",
";",
"}",
"return",
"null",
";",
"}",
"@",
"Override",
"protected",
"Void",
"defaultAction",
"(",
"Element",
"e",
",",
"Void",
"p",
")",
"{",
"addAnnotations",
"(",
"e",
")",
";",
"return",
"null",
";",
"}",
"}",
".",
"visit",
"(",
"e",
")",
";",
"}"
] |
Map the AnnotationType to the members that use them as type parameters.
@param map the map the insert the information into.
@param element whose type parameters are being checked.
@param holder the holder that owns the type parameters.
|
[
"Map",
"the",
"AnnotationType",
"to",
"the",
"members",
"that",
"use",
"them",
"as",
"type",
"parameters",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java#L557-L581
|
4,940 |
google/error-prone-javac
|
make/tools/propertiesparser/parser/Message.java
|
Message.getMessageInfo
|
public MessageInfo getMessageInfo() {
if (messageInfo == null) {
MessageLine l = firstLine.prev;
if (l != null && l.isInfo())
messageInfo = new MessageInfo(l.text);
else
messageInfo = MessageInfo.dummyInfo;
}
return messageInfo;
}
|
java
|
public MessageInfo getMessageInfo() {
if (messageInfo == null) {
MessageLine l = firstLine.prev;
if (l != null && l.isInfo())
messageInfo = new MessageInfo(l.text);
else
messageInfo = MessageInfo.dummyInfo;
}
return messageInfo;
}
|
[
"public",
"MessageInfo",
"getMessageInfo",
"(",
")",
"{",
"if",
"(",
"messageInfo",
"==",
"null",
")",
"{",
"MessageLine",
"l",
"=",
"firstLine",
".",
"prev",
";",
"if",
"(",
"l",
"!=",
"null",
"&&",
"l",
".",
"isInfo",
"(",
")",
")",
"messageInfo",
"=",
"new",
"MessageInfo",
"(",
"l",
".",
"text",
")",
";",
"else",
"messageInfo",
"=",
"MessageInfo",
".",
"dummyInfo",
";",
"}",
"return",
"messageInfo",
";",
"}"
] |
Get the Info object for this message. It may be empty if there
if no comment preceding the property specification.
|
[
"Get",
"the",
"Info",
"object",
"for",
"this",
"message",
".",
"It",
"may",
"be",
"empty",
"if",
"there",
"if",
"no",
"comment",
"preceding",
"the",
"property",
"specification",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/parser/Message.java#L47-L56
|
4,941 |
google/error-prone-javac
|
make/tools/propertiesparser/parser/Message.java
|
Message.getLines
|
public List<MessageLine> getLines(boolean includeAllPrecedingComments) {
List<MessageLine> lines = new ArrayList<>();
MessageLine l = firstLine;
if (includeAllPrecedingComments) {
// scan back to find end of prev message
while (l.prev != null && l.prev.isEmptyOrComment())
l = l.prev;
// skip leading blank lines
while (l.text.isEmpty())
l = l.next;
} else {
if (l.prev != null && l.prev.isInfo())
l = l.prev;
}
// include any preceding lines
for ( ; l != firstLine; l = l.next)
lines.add(l);
// include message lines
for (l = firstLine; l != null && l.hasContinuation(); l = l.next)
lines.add(l);
lines.add(l);
// include trailing blank line if present
l = l.next;
if (l != null && l.text.isEmpty())
lines.add(l);
return lines;
}
|
java
|
public List<MessageLine> getLines(boolean includeAllPrecedingComments) {
List<MessageLine> lines = new ArrayList<>();
MessageLine l = firstLine;
if (includeAllPrecedingComments) {
// scan back to find end of prev message
while (l.prev != null && l.prev.isEmptyOrComment())
l = l.prev;
// skip leading blank lines
while (l.text.isEmpty())
l = l.next;
} else {
if (l.prev != null && l.prev.isInfo())
l = l.prev;
}
// include any preceding lines
for ( ; l != firstLine; l = l.next)
lines.add(l);
// include message lines
for (l = firstLine; l != null && l.hasContinuation(); l = l.next)
lines.add(l);
lines.add(l);
// include trailing blank line if present
l = l.next;
if (l != null && l.text.isEmpty())
lines.add(l);
return lines;
}
|
[
"public",
"List",
"<",
"MessageLine",
">",
"getLines",
"(",
"boolean",
"includeAllPrecedingComments",
")",
"{",
"List",
"<",
"MessageLine",
">",
"lines",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"MessageLine",
"l",
"=",
"firstLine",
";",
"if",
"(",
"includeAllPrecedingComments",
")",
"{",
"// scan back to find end of prev message",
"while",
"(",
"l",
".",
"prev",
"!=",
"null",
"&&",
"l",
".",
"prev",
".",
"isEmptyOrComment",
"(",
")",
")",
"l",
"=",
"l",
".",
"prev",
";",
"// skip leading blank lines",
"while",
"(",
"l",
".",
"text",
".",
"isEmpty",
"(",
")",
")",
"l",
"=",
"l",
".",
"next",
";",
"}",
"else",
"{",
"if",
"(",
"l",
".",
"prev",
"!=",
"null",
"&&",
"l",
".",
"prev",
".",
"isInfo",
"(",
")",
")",
"l",
"=",
"l",
".",
"prev",
";",
"}",
"// include any preceding lines",
"for",
"(",
";",
"l",
"!=",
"firstLine",
";",
"l",
"=",
"l",
".",
"next",
")",
"lines",
".",
"(",
"l",
")",
";",
"// include message lines",
"for",
"(",
"l",
"=",
"firstLine",
";",
"l",
"!=",
"null",
"&&",
"l",
".",
"hasContinuation",
"(",
")",
";",
"l",
"=",
"l",
".",
"next",
")",
"lines",
".",
"(",
"l",
")",
";",
"lines",
".",
"add",
"(",
"l",
")",
";",
"// include trailing blank line if present",
"l",
"=",
"l",
".",
"next",
";",
"if",
"(",
"l",
"!=",
"null",
"&&",
"l",
".",
"text",
".",
"isEmpty",
"(",
")",
")",
"lines",
".",
"add",
"(",
"l",
")",
";",
"return",
"lines",
";",
"}"
] |
Get all the lines pertaining to this message.
|
[
"Get",
"all",
"the",
"lines",
"pertaining",
"to",
"this",
"message",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/parser/Message.java#L61-L91
|
4,942 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java
|
LinkFactory.getTypeParameterLinks
|
public Content getTypeParameterLinks(LinkInfo linkInfo, boolean isClassLabel) {
Content links = newContent();
Type[] vars;
if (linkInfo.executableMemberDoc != null) {
vars = linkInfo.executableMemberDoc.typeParameters();
} else if (linkInfo.type != null &&
linkInfo.type.asParameterizedType() != null){
vars = linkInfo.type.asParameterizedType().typeArguments();
} else if (linkInfo.classDoc != null){
vars = linkInfo.classDoc.typeParameters();
} else {
//Nothing to document.
return links;
}
if (((linkInfo.includeTypeInClassLinkLabel && isClassLabel) ||
(linkInfo.includeTypeAsSepLink && ! isClassLabel)
)
&& vars.length > 0) {
links.addContent("<");
for (int i = 0; i < vars.length; i++) {
if (i > 0) {
links.addContent(",");
}
links.addContent(getTypeParameterLink(linkInfo, vars[i]));
}
links.addContent(">");
}
return links;
}
|
java
|
public Content getTypeParameterLinks(LinkInfo linkInfo, boolean isClassLabel) {
Content links = newContent();
Type[] vars;
if (linkInfo.executableMemberDoc != null) {
vars = linkInfo.executableMemberDoc.typeParameters();
} else if (linkInfo.type != null &&
linkInfo.type.asParameterizedType() != null){
vars = linkInfo.type.asParameterizedType().typeArguments();
} else if (linkInfo.classDoc != null){
vars = linkInfo.classDoc.typeParameters();
} else {
//Nothing to document.
return links;
}
if (((linkInfo.includeTypeInClassLinkLabel && isClassLabel) ||
(linkInfo.includeTypeAsSepLink && ! isClassLabel)
)
&& vars.length > 0) {
links.addContent("<");
for (int i = 0; i < vars.length; i++) {
if (i > 0) {
links.addContent(",");
}
links.addContent(getTypeParameterLink(linkInfo, vars[i]));
}
links.addContent(">");
}
return links;
}
|
[
"public",
"Content",
"getTypeParameterLinks",
"(",
"LinkInfo",
"linkInfo",
",",
"boolean",
"isClassLabel",
")",
"{",
"Content",
"links",
"=",
"newContent",
"(",
")",
";",
"Type",
"[",
"]",
"vars",
";",
"if",
"(",
"linkInfo",
".",
"executableMemberDoc",
"!=",
"null",
")",
"{",
"vars",
"=",
"linkInfo",
".",
"executableMemberDoc",
".",
"typeParameters",
"(",
")",
";",
"}",
"else",
"if",
"(",
"linkInfo",
".",
"type",
"!=",
"null",
"&&",
"linkInfo",
".",
"type",
".",
"asParameterizedType",
"(",
")",
"!=",
"null",
")",
"{",
"vars",
"=",
"linkInfo",
".",
"type",
".",
"asParameterizedType",
"(",
")",
".",
"typeArguments",
"(",
")",
";",
"}",
"else",
"if",
"(",
"linkInfo",
".",
"classDoc",
"!=",
"null",
")",
"{",
"vars",
"=",
"linkInfo",
".",
"classDoc",
".",
"typeParameters",
"(",
")",
";",
"}",
"else",
"{",
"//Nothing to document.",
"return",
"links",
";",
"}",
"if",
"(",
"(",
"(",
"linkInfo",
".",
"includeTypeInClassLinkLabel",
"&&",
"isClassLabel",
")",
"||",
"(",
"linkInfo",
".",
"includeTypeAsSepLink",
"&&",
"!",
"isClassLabel",
")",
")",
"&&",
"vars",
".",
"length",
">",
"0",
")",
"{",
"links",
".",
"addContent",
"(",
"\"<\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vars",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"links",
".",
"addContent",
"(",
"\",\"",
")",
";",
"}",
"links",
".",
"addContent",
"(",
"getTypeParameterLink",
"(",
"linkInfo",
",",
"vars",
"[",
"i",
"]",
")",
")",
";",
"}",
"links",
".",
"addContent",
"(",
"\">\"",
")",
";",
"}",
"return",
"links",
";",
"}"
] |
Return the links to the type parameters.
@param linkInfo the information about the link to construct.
@param isClassLabel true if this is a class label. False if it is
the type parameters portion of the link.
@return the links to the type parameters.
|
[
"Return",
"the",
"links",
"to",
"the",
"type",
"parameters",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java#L217-L245
|
4,943 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SerialFieldTagImpl.java
|
SerialFieldTagImpl.fieldTypeDoc
|
public ClassDoc fieldTypeDoc() {
if (fieldTypeDoc == null && containingClass != null) {
fieldTypeDoc = containingClass.findClass(fieldType);
}
return fieldTypeDoc;
}
|
java
|
public ClassDoc fieldTypeDoc() {
if (fieldTypeDoc == null && containingClass != null) {
fieldTypeDoc = containingClass.findClass(fieldType);
}
return fieldTypeDoc;
}
|
[
"public",
"ClassDoc",
"fieldTypeDoc",
"(",
")",
"{",
"if",
"(",
"fieldTypeDoc",
"==",
"null",
"&&",
"containingClass",
"!=",
"null",
")",
"{",
"fieldTypeDoc",
"=",
"containingClass",
".",
"findClass",
"(",
"fieldType",
")",
";",
"}",
"return",
"fieldTypeDoc",
";",
"}"
] |
Return the ClassDocImpl for field type.
@returns null if no ClassDocImpl for field type is visible from
containingClass context.
|
[
"Return",
"the",
"ClassDocImpl",
"for",
"field",
"type",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SerialFieldTagImpl.java#L205-L210
|
4,944 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SerialFieldTagImpl.java
|
SerialFieldTagImpl.description
|
public String description() {
if (description.length() == 0 && matchingField != null) {
//check for javadoc comment of corresponding field.
Comment comment = matchingField.comment();
if (comment != null) {
return comment.commentText();
}
}
return description;
}
|
java
|
public String description() {
if (description.length() == 0 && matchingField != null) {
//check for javadoc comment of corresponding field.
Comment comment = matchingField.comment();
if (comment != null) {
return comment.commentText();
}
}
return description;
}
|
[
"public",
"String",
"description",
"(",
")",
"{",
"if",
"(",
"description",
".",
"length",
"(",
")",
"==",
"0",
"&&",
"matchingField",
"!=",
"null",
")",
"{",
"//check for javadoc comment of corresponding field.",
"Comment",
"comment",
"=",
"matchingField",
".",
"comment",
"(",
")",
";",
"if",
"(",
"comment",
"!=",
"null",
")",
"{",
"return",
"comment",
".",
"commentText",
"(",
")",
";",
"}",
"}",
"return",
"description",
";",
"}"
] |
Return the field comment. If there is no serialField comment, return
javadoc comment of corresponding FieldDocImpl.
|
[
"Return",
"the",
"field",
"comment",
".",
"If",
"there",
"is",
"no",
"serialField",
"comment",
"return",
"javadoc",
"comment",
"of",
"corresponding",
"FieldDocImpl",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SerialFieldTagImpl.java#L225-L235
|
4,945 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
|
HelpWriter.getNavLinkHelp
|
@Override
protected Content getNavLinkHelp() {
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, helpLabel);
return li;
}
|
java
|
@Override
protected Content getNavLinkHelp() {
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, helpLabel);
return li;
}
|
[
"@",
"Override",
"protected",
"Content",
"getNavLinkHelp",
"(",
")",
"{",
"Content",
"li",
"=",
"HtmlTree",
".",
"LI",
"(",
"HtmlStyle",
".",
"navBarCell1Rev",
",",
"helpLabel",
")",
";",
"return",
"li",
";",
"}"
] |
Get the help label.
@return a content tree for the help label
|
[
"Get",
"the",
"help",
"label",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java#L438-L442
|
4,946 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java
|
Kinds.kindName
|
public static KindName kindName(Symbol sym) {
switch (sym.getKind()) {
case PACKAGE:
return KindName.PACKAGE;
case ENUM:
return KindName.ENUM;
case ANNOTATION_TYPE:
case CLASS:
return KindName.CLASS;
case INTERFACE:
return KindName.INTERFACE;
case TYPE_PARAMETER:
return KindName.TYPEVAR;
case ENUM_CONSTANT:
case FIELD:
case PARAMETER:
case LOCAL_VARIABLE:
case EXCEPTION_PARAMETER:
case RESOURCE_VARIABLE:
return KindName.VAR;
case CONSTRUCTOR:
return KindName.CONSTRUCTOR;
case METHOD:
return KindName.METHOD;
case STATIC_INIT:
return KindName.STATIC_INIT;
case INSTANCE_INIT:
return KindName.INSTANCE_INIT;
default:
throw new AssertionError("Unexpected kind: "+sym.getKind());
}
}
|
java
|
public static KindName kindName(Symbol sym) {
switch (sym.getKind()) {
case PACKAGE:
return KindName.PACKAGE;
case ENUM:
return KindName.ENUM;
case ANNOTATION_TYPE:
case CLASS:
return KindName.CLASS;
case INTERFACE:
return KindName.INTERFACE;
case TYPE_PARAMETER:
return KindName.TYPEVAR;
case ENUM_CONSTANT:
case FIELD:
case PARAMETER:
case LOCAL_VARIABLE:
case EXCEPTION_PARAMETER:
case RESOURCE_VARIABLE:
return KindName.VAR;
case CONSTRUCTOR:
return KindName.CONSTRUCTOR;
case METHOD:
return KindName.METHOD;
case STATIC_INIT:
return KindName.STATIC_INIT;
case INSTANCE_INIT:
return KindName.INSTANCE_INIT;
default:
throw new AssertionError("Unexpected kind: "+sym.getKind());
}
}
|
[
"public",
"static",
"KindName",
"kindName",
"(",
"Symbol",
"sym",
")",
"{",
"switch",
"(",
"sym",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"PACKAGE",
":",
"return",
"KindName",
".",
"PACKAGE",
";",
"case",
"ENUM",
":",
"return",
"KindName",
".",
"ENUM",
";",
"case",
"ANNOTATION_TYPE",
":",
"case",
"CLASS",
":",
"return",
"KindName",
".",
"CLASS",
";",
"case",
"INTERFACE",
":",
"return",
"KindName",
".",
"INTERFACE",
";",
"case",
"TYPE_PARAMETER",
":",
"return",
"KindName",
".",
"TYPEVAR",
";",
"case",
"ENUM_CONSTANT",
":",
"case",
"FIELD",
":",
"case",
"PARAMETER",
":",
"case",
"LOCAL_VARIABLE",
":",
"case",
"EXCEPTION_PARAMETER",
":",
"case",
"RESOURCE_VARIABLE",
":",
"return",
"KindName",
".",
"VAR",
";",
"case",
"CONSTRUCTOR",
":",
"return",
"KindName",
".",
"CONSTRUCTOR",
";",
"case",
"METHOD",
":",
"return",
"KindName",
".",
"METHOD",
";",
"case",
"STATIC_INIT",
":",
"return",
"KindName",
".",
"STATIC_INIT",
";",
"case",
"INSTANCE_INIT",
":",
"return",
"KindName",
".",
"INSTANCE_INIT",
";",
"default",
":",
"throw",
"new",
"AssertionError",
"(",
"\"Unexpected kind: \"",
"+",
"sym",
".",
"getKind",
"(",
")",
")",
";",
"}",
"}"
] |
A KindName representing a given symbol
|
[
"A",
"KindName",
"representing",
"a",
"given",
"symbol"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java#L269-L308
|
4,947 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
|
SubWriterHolderWriter.getContentHeader
|
public Content getContentHeader() {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.contentContainer);
return div;
}
|
java
|
public Content getContentHeader() {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.contentContainer);
return div;
}
|
[
"public",
"Content",
"getContentHeader",
"(",
")",
"{",
"HtmlTree",
"div",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"DIV",
")",
";",
"div",
".",
"addStyle",
"(",
"HtmlStyle",
".",
"contentContainer",
")",
";",
"return",
"div",
";",
"}"
] |
Get the document content header tree
@return a content tree the document content header
|
[
"Get",
"the",
"document",
"content",
"header",
"tree"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java#L264-L268
|
4,948 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
|
SubWriterHolderWriter.addClassContentTree
|
public void addClassContentTree(Content contentTree, Content classContentTree) {
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(classContentTree);
contentTree.addContent(mainTree);
} else {
contentTree.addContent(classContentTree);
}
}
|
java
|
public void addClassContentTree(Content contentTree, Content classContentTree) {
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(classContentTree);
contentTree.addContent(mainTree);
} else {
contentTree.addContent(classContentTree);
}
}
|
[
"public",
"void",
"addClassContentTree",
"(",
"Content",
"contentTree",
",",
"Content",
"classContentTree",
")",
"{",
"if",
"(",
"configuration",
".",
"allowTag",
"(",
"HtmlTag",
".",
"MAIN",
")",
")",
"{",
"mainTree",
".",
"addContent",
"(",
"classContentTree",
")",
";",
"contentTree",
".",
"addContent",
"(",
"mainTree",
")",
";",
"}",
"else",
"{",
"contentTree",
".",
"addContent",
"(",
"classContentTree",
")",
";",
"}",
"}"
] |
Add the class content tree.
@param contentTree content tree to which the class content will be added
@param classContentTree class content tree which will be added to the content tree
|
[
"Add",
"the",
"class",
"content",
"tree",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java#L276-L283
|
4,949 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
|
SubWriterHolderWriter.addMemberTree
|
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(memberTree));
memberSummaryTree.addContent(htmlTree);
} else {
memberSummaryTree.addContent(getMemberTree(memberTree));
}
}
|
java
|
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(memberTree));
memberSummaryTree.addContent(htmlTree);
} else {
memberSummaryTree.addContent(getMemberTree(memberTree));
}
}
|
[
"public",
"void",
"addMemberTree",
"(",
"Content",
"memberSummaryTree",
",",
"Content",
"memberTree",
")",
"{",
"if",
"(",
"configuration",
".",
"allowTag",
"(",
"HtmlTag",
".",
"SECTION",
")",
")",
"{",
"HtmlTree",
"htmlTree",
"=",
"HtmlTree",
".",
"SECTION",
"(",
"getMemberTree",
"(",
"memberTree",
")",
")",
";",
"memberSummaryTree",
".",
"addContent",
"(",
"htmlTree",
")",
";",
"}",
"else",
"{",
"memberSummaryTree",
".",
"addContent",
"(",
"getMemberTree",
"(",
"memberTree",
")",
")",
";",
"}",
"}"
] |
Add the member tree.
@param memberSummaryTree the content tree representing the member summary
@param memberTree the content tree representing the member
|
[
"Add",
"the",
"member",
"tree",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java#L312-L319
|
4,950 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TagImpl.java
|
TagImpl.divideAtWhite
|
String[] divideAtWhite() {
String[] sa = new String[2];
int len = text.length();
// if no white space found
sa[0] = text;
sa[1] = "";
for (int inx = 0; inx < len; ++inx) {
char ch = text.charAt(inx);
if (Character.isWhitespace(ch)) {
sa[0] = text.substring(0, inx);
for (; inx < len; ++inx) {
ch = text.charAt(inx);
if (!Character.isWhitespace(ch)) {
sa[1] = text.substring(inx, len);
break;
}
}
break;
}
}
return sa;
}
|
java
|
String[] divideAtWhite() {
String[] sa = new String[2];
int len = text.length();
// if no white space found
sa[0] = text;
sa[1] = "";
for (int inx = 0; inx < len; ++inx) {
char ch = text.charAt(inx);
if (Character.isWhitespace(ch)) {
sa[0] = text.substring(0, inx);
for (; inx < len; ++inx) {
ch = text.charAt(inx);
if (!Character.isWhitespace(ch)) {
sa[1] = text.substring(inx, len);
break;
}
}
break;
}
}
return sa;
}
|
[
"String",
"[",
"]",
"divideAtWhite",
"(",
")",
"{",
"String",
"[",
"]",
"sa",
"=",
"new",
"String",
"[",
"2",
"]",
";",
"int",
"len",
"=",
"text",
".",
"length",
"(",
")",
";",
"// if no white space found",
"sa",
"[",
"0",
"]",
"=",
"text",
";",
"sa",
"[",
"1",
"]",
"=",
"\"\"",
";",
"for",
"(",
"int",
"inx",
"=",
"0",
";",
"inx",
"<",
"len",
";",
"++",
"inx",
")",
"{",
"char",
"ch",
"=",
"text",
".",
"charAt",
"(",
"inx",
")",
";",
"if",
"(",
"Character",
".",
"isWhitespace",
"(",
"ch",
")",
")",
"{",
"sa",
"[",
"0",
"]",
"=",
"text",
".",
"substring",
"(",
"0",
",",
"inx",
")",
";",
"for",
"(",
";",
"inx",
"<",
"len",
";",
"++",
"inx",
")",
"{",
"ch",
"=",
"text",
".",
"charAt",
"(",
"inx",
")",
";",
"if",
"(",
"!",
"Character",
".",
"isWhitespace",
"(",
"ch",
")",
")",
"{",
"sa",
"[",
"1",
"]",
"=",
"text",
".",
"substring",
"(",
"inx",
",",
"len",
")",
";",
"break",
";",
"}",
"}",
"break",
";",
"}",
"}",
"return",
"sa",
";",
"}"
] |
for use by subclasses which have two part tag text.
|
[
"for",
"use",
"by",
"subclasses",
"which",
"have",
"two",
"part",
"tag",
"text",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TagImpl.java#L112-L133
|
4,951 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TagImpl.java
|
TagImpl.firstSentenceTags
|
public Tag[] firstSentenceTags() {
if (firstSentence == null) {
//Parse all sentences first to avoid duplicate warnings.
inlineTags();
try {
docenv().setSilent(true);
firstSentence = Comment.firstSentenceTags(holder, text);
} finally {
docenv().setSilent(false);
}
}
return firstSentence;
}
|
java
|
public Tag[] firstSentenceTags() {
if (firstSentence == null) {
//Parse all sentences first to avoid duplicate warnings.
inlineTags();
try {
docenv().setSilent(true);
firstSentence = Comment.firstSentenceTags(holder, text);
} finally {
docenv().setSilent(false);
}
}
return firstSentence;
}
|
[
"public",
"Tag",
"[",
"]",
"firstSentenceTags",
"(",
")",
"{",
"if",
"(",
"firstSentence",
"==",
"null",
")",
"{",
"//Parse all sentences first to avoid duplicate warnings.",
"inlineTags",
"(",
")",
";",
"try",
"{",
"docenv",
"(",
")",
".",
"setSilent",
"(",
"true",
")",
";",
"firstSentence",
"=",
"Comment",
".",
"firstSentenceTags",
"(",
"holder",
",",
"text",
")",
";",
"}",
"finally",
"{",
"docenv",
"(",
")",
".",
"setSilent",
"(",
"false",
")",
";",
"}",
"}",
"return",
"firstSentence",
";",
"}"
] |
Return array of tags for the first sentence in the doc comment text.
|
[
"Return",
"array",
"of",
"tags",
"for",
"the",
"first",
"sentence",
"in",
"the",
"doc",
"comment",
"text",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TagImpl.java#L168-L180
|
4,952 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java
|
ExecutableMemberDocImpl.thrownExceptions
|
public ClassDoc[] thrownExceptions() {
ListBuffer<ClassDocImpl> l = new ListBuffer<>();
for (Type ex : sym.type.getThrownTypes()) {
ex = env.types.erasure(ex);
//### Will these casts succeed in the face of static semantic
//### errors in the documented code?
ClassDocImpl cdi = env.getClassDoc((ClassSymbol)ex.tsym);
if (cdi != null) l.append(cdi);
}
return l.toArray(new ClassDocImpl[l.length()]);
}
|
java
|
public ClassDoc[] thrownExceptions() {
ListBuffer<ClassDocImpl> l = new ListBuffer<>();
for (Type ex : sym.type.getThrownTypes()) {
ex = env.types.erasure(ex);
//### Will these casts succeed in the face of static semantic
//### errors in the documented code?
ClassDocImpl cdi = env.getClassDoc((ClassSymbol)ex.tsym);
if (cdi != null) l.append(cdi);
}
return l.toArray(new ClassDocImpl[l.length()]);
}
|
[
"public",
"ClassDoc",
"[",
"]",
"thrownExceptions",
"(",
")",
"{",
"ListBuffer",
"<",
"ClassDocImpl",
">",
"l",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"for",
"(",
"Type",
"ex",
":",
"sym",
".",
"type",
".",
"getThrownTypes",
"(",
")",
")",
"{",
"ex",
"=",
"env",
".",
"types",
".",
"erasure",
"(",
"ex",
")",
";",
"//### Will these casts succeed in the face of static semantic",
"//### errors in the documented code?",
"ClassDocImpl",
"cdi",
"=",
"env",
".",
"getClassDoc",
"(",
"(",
"ClassSymbol",
")",
"ex",
".",
"tsym",
")",
";",
"if",
"(",
"cdi",
"!=",
"null",
")",
"l",
".",
"append",
"(",
"cdi",
")",
";",
"}",
"return",
"l",
".",
"toArray",
"(",
"new",
"ClassDocImpl",
"[",
"l",
".",
"length",
"(",
")",
"]",
")",
";",
"}"
] |
Return exceptions this method or constructor throws.
@return an array of ClassDoc[] representing the exceptions
thrown by this method.
|
[
"Return",
"exceptions",
"this",
"method",
"or",
"constructor",
"throws",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java#L158-L168
|
4,953 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java
|
ExecutableMemberDocImpl.parameters
|
public Parameter[] parameters() {
// generate the parameters on the fly: they're not cached
List<VarSymbol> params = sym.params();
Parameter result[] = new Parameter[params.length()];
int i = 0;
for (VarSymbol param : params) {
result[i++] = new ParameterImpl(env, param);
}
return result;
}
|
java
|
public Parameter[] parameters() {
// generate the parameters on the fly: they're not cached
List<VarSymbol> params = sym.params();
Parameter result[] = new Parameter[params.length()];
int i = 0;
for (VarSymbol param : params) {
result[i++] = new ParameterImpl(env, param);
}
return result;
}
|
[
"public",
"Parameter",
"[",
"]",
"parameters",
"(",
")",
"{",
"// generate the parameters on the fly: they're not cached",
"List",
"<",
"VarSymbol",
">",
"params",
"=",
"sym",
".",
"params",
"(",
")",
";",
"Parameter",
"result",
"[",
"]",
"=",
"new",
"Parameter",
"[",
"params",
".",
"length",
"(",
")",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"VarSymbol",
"param",
":",
"params",
")",
"{",
"result",
"[",
"i",
"++",
"]",
"=",
"new",
"ParameterImpl",
"(",
"env",
",",
"param",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Get argument information.
@see ParameterImpl
@return an array of ParameterImpl, one element per argument
in the order the arguments are present.
|
[
"Get",
"argument",
"information",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java#L187-L197
|
4,954 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java
|
ExecutableMemberDocImpl.receiverType
|
public com.sun.javadoc.Type receiverType() {
Type recvtype = sym.type.asMethodType().recvtype;
return (recvtype != null) ? TypeMaker.getType(env, recvtype, false, true) : null;
}
|
java
|
public com.sun.javadoc.Type receiverType() {
Type recvtype = sym.type.asMethodType().recvtype;
return (recvtype != null) ? TypeMaker.getType(env, recvtype, false, true) : null;
}
|
[
"public",
"com",
".",
"sun",
".",
"javadoc",
".",
"Type",
"receiverType",
"(",
")",
"{",
"Type",
"recvtype",
"=",
"sym",
".",
"type",
".",
"asMethodType",
"(",
")",
".",
"recvtype",
";",
"return",
"(",
"recvtype",
"!=",
"null",
")",
"?",
"TypeMaker",
".",
"getType",
"(",
"env",
",",
"recvtype",
",",
"false",
",",
"true",
")",
":",
"null",
";",
"}"
] |
Get the receiver type of this executable element.
@return the receiver type of this executable element.
@since 1.8
|
[
"Get",
"the",
"receiver",
"type",
"of",
"this",
"executable",
"element",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java#L205-L208
|
4,955 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java
|
ExecutableMemberDocImpl.typeParameters
|
public TypeVariable[] typeParameters() {
if (env.legacyDoclet) {
return new TypeVariable[0];
}
TypeVariable res[] = new TypeVariable[sym.type.getTypeArguments().length()];
TypeMaker.getTypes(env, sym.type.getTypeArguments(), res);
return res;
}
|
java
|
public TypeVariable[] typeParameters() {
if (env.legacyDoclet) {
return new TypeVariable[0];
}
TypeVariable res[] = new TypeVariable[sym.type.getTypeArguments().length()];
TypeMaker.getTypes(env, sym.type.getTypeArguments(), res);
return res;
}
|
[
"public",
"TypeVariable",
"[",
"]",
"typeParameters",
"(",
")",
"{",
"if",
"(",
"env",
".",
"legacyDoclet",
")",
"{",
"return",
"new",
"TypeVariable",
"[",
"0",
"]",
";",
"}",
"TypeVariable",
"res",
"[",
"]",
"=",
"new",
"TypeVariable",
"[",
"sym",
".",
"type",
".",
"getTypeArguments",
"(",
")",
".",
"length",
"(",
")",
"]",
";",
"TypeMaker",
".",
"getTypes",
"(",
"env",
",",
"sym",
".",
"type",
".",
"getTypeArguments",
"(",
")",
",",
"res",
")",
";",
"return",
"res",
";",
"}"
] |
Return the formal type parameters of this method or constructor.
Return an empty array if there are none.
|
[
"Return",
"the",
"formal",
"type",
"parameters",
"of",
"this",
"method",
"or",
"constructor",
".",
"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/ExecutableMemberDocImpl.java#L214-L221
|
4,956 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java
|
ConstantsSummaryBuilder.buildConstantMembers
|
public void buildConstantMembers(XMLNode node, Content classConstantTree) {
new ConstantFieldBuilder(currentClass).buildMembersSummary(node, classConstantTree);
}
|
java
|
public void buildConstantMembers(XMLNode node, Content classConstantTree) {
new ConstantFieldBuilder(currentClass).buildMembersSummary(node, classConstantTree);
}
|
[
"public",
"void",
"buildConstantMembers",
"(",
"XMLNode",
"node",
",",
"Content",
"classConstantTree",
")",
"{",
"new",
"ConstantFieldBuilder",
"(",
"currentClass",
")",
".",
"buildMembersSummary",
"(",
"node",
",",
"classConstantTree",
")",
";",
"}"
] |
Build the summary of constant members in the class.
@param node the XML element that specifies which components to document
@param classConstantTree the tree to which the constant members table
will be added
|
[
"Build",
"the",
"summary",
"of",
"constant",
"members",
"in",
"the",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java#L246-L248
|
4,957 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/OptionHelper.java
|
OptionHelper.traverse
|
void traverse(String[] args) {
try {
args = CommandLine.parse(args); // Detect @file and load it as a command line.
} catch (java.io.IOException e) {
throw new IllegalArgumentException("Problem reading @"+e.getMessage());
}
ArgumentIterator argIter = new ArgumentIterator(Arrays.asList(args));
nextArg:
while (argIter.hasNext()) {
String arg = argIter.next();
if (arg.startsWith("-")) {
for (Option opt : Option.values()) {
if (opt.processCurrent(argIter, this))
continue nextArg;
}
javacArg(arg);
// Does this javac argument take an argument? If so, don't
// let it pass on to sjavac as a source root directory.
for (com.sun.tools.javac.main.Option javacOpt : com.sun.tools.javac.main.Option.values()) {
if (javacOpt.matches(arg)) {
boolean takesArgument = javacOpt.hasArg();
boolean separateToken = !arg.contains(":") && !arg.contains("=");
if (takesArgument && separateToken)
javacArg(argIter.next());
}
}
} else {
sourceRoots(Arrays.asList(Paths.get(arg)));
}
}
}
|
java
|
void traverse(String[] args) {
try {
args = CommandLine.parse(args); // Detect @file and load it as a command line.
} catch (java.io.IOException e) {
throw new IllegalArgumentException("Problem reading @"+e.getMessage());
}
ArgumentIterator argIter = new ArgumentIterator(Arrays.asList(args));
nextArg:
while (argIter.hasNext()) {
String arg = argIter.next();
if (arg.startsWith("-")) {
for (Option opt : Option.values()) {
if (opt.processCurrent(argIter, this))
continue nextArg;
}
javacArg(arg);
// Does this javac argument take an argument? If so, don't
// let it pass on to sjavac as a source root directory.
for (com.sun.tools.javac.main.Option javacOpt : com.sun.tools.javac.main.Option.values()) {
if (javacOpt.matches(arg)) {
boolean takesArgument = javacOpt.hasArg();
boolean separateToken = !arg.contains(":") && !arg.contains("=");
if (takesArgument && separateToken)
javacArg(argIter.next());
}
}
} else {
sourceRoots(Arrays.asList(Paths.get(arg)));
}
}
}
|
[
"void",
"traverse",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"args",
"=",
"CommandLine",
".",
"parse",
"(",
"args",
")",
";",
"// Detect @file and load it as a command line.",
"}",
"catch",
"(",
"java",
".",
"io",
".",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Problem reading @\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"ArgumentIterator",
"argIter",
"=",
"new",
"ArgumentIterator",
"(",
"Arrays",
".",
"asList",
"(",
"args",
")",
")",
";",
"nextArg",
":",
"while",
"(",
"argIter",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"arg",
"=",
"argIter",
".",
"next",
"(",
")",
";",
"if",
"(",
"arg",
".",
"startsWith",
"(",
"\"-\"",
")",
")",
"{",
"for",
"(",
"Option",
"opt",
":",
"Option",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"opt",
".",
"processCurrent",
"(",
"argIter",
",",
"this",
")",
")",
"continue",
"nextArg",
";",
"}",
"javacArg",
"(",
"arg",
")",
";",
"// Does this javac argument take an argument? If so, don't",
"// let it pass on to sjavac as a source root directory.",
"for",
"(",
"com",
".",
"sun",
".",
"tools",
".",
"javac",
".",
"main",
".",
"Option",
"javacOpt",
":",
"com",
".",
"sun",
".",
"tools",
".",
"javac",
".",
"main",
".",
"Option",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"javacOpt",
".",
"matches",
"(",
"arg",
")",
")",
"{",
"boolean",
"takesArgument",
"=",
"javacOpt",
".",
"hasArg",
"(",
")",
";",
"boolean",
"separateToken",
"=",
"!",
"arg",
".",
"contains",
"(",
"\":\"",
")",
"&&",
"!",
"arg",
".",
"contains",
"(",
"\"=\"",
")",
";",
"if",
"(",
"takesArgument",
"&&",
"separateToken",
")",
"javacArg",
"(",
"argIter",
".",
"next",
"(",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"sourceRoots",
"(",
"Arrays",
".",
"asList",
"(",
"Paths",
".",
"get",
"(",
"arg",
")",
")",
")",
";",
"}",
"}",
"}"
] |
Traverses an array of arguments and performs the appropriate callbacks.
@param args the arguments to traverse.
|
[
"Traverses",
"an",
"array",
"of",
"arguments",
"and",
"performs",
"the",
"appropriate",
"callbacks",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/OptionHelper.java#L119-L154
|
4,958 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java
|
Start.begin
|
public int begin(String... argv) {
boolean ok = begin(null, argv, Collections.emptySet());
return ok ? 0 : 1;
}
|
java
|
public int begin(String... argv) {
boolean ok = begin(null, argv, Collections.emptySet());
return ok ? 0 : 1;
}
|
[
"public",
"int",
"begin",
"(",
"String",
"...",
"argv",
")",
"{",
"boolean",
"ok",
"=",
"begin",
"(",
"null",
",",
"argv",
",",
"Collections",
".",
"emptySet",
"(",
")",
")",
";",
"return",
"ok",
"?",
"0",
":",
"1",
";",
"}"
] |
Main program - external wrapper
|
[
"Main",
"program",
"-",
"external",
"wrapper"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java#L223-L226
|
4,959 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java
|
Start.setDocletInvoker
|
private void setDocletInvoker(Class<?> docletClass, JavaFileManager fileManager, String[] argv) {
boolean exportInternalAPI = false;
String docletClassName = null;
String docletPath = null;
// Parse doclet specifying arguments
for (int i = 0 ; i < argv.length ; i++) {
String arg = argv[i];
if (arg.equals(ToolOption.DOCLET.opt)) {
oneArg(argv, i++);
if (docletClassName != null) {
usageError("main.more_than_one_doclet_specified_0_and_1",
docletClassName, argv[i]);
}
docletClassName = argv[i];
} else if (arg.equals(ToolOption.DOCLETPATH.opt)) {
oneArg(argv, i++);
if (docletPath == null) {
docletPath = argv[i];
} else {
docletPath += File.pathSeparator + argv[i];
}
} else if (arg.equals("-XDaccessInternalAPI")) {
exportInternalAPI = true;
}
}
if (docletClass != null) {
// TODO, check no -doclet, -docletpath
docletInvoker = new DocletInvoker(messager, docletClass, apiMode, exportInternalAPI);
} else {
if (docletClassName == null) {
docletClassName = defaultDocletClassName;
}
// attempt to find doclet
docletInvoker = new DocletInvoker(messager, fileManager,
docletClassName, docletPath,
docletParentClassLoader,
apiMode,
exportInternalAPI);
}
}
|
java
|
private void setDocletInvoker(Class<?> docletClass, JavaFileManager fileManager, String[] argv) {
boolean exportInternalAPI = false;
String docletClassName = null;
String docletPath = null;
// Parse doclet specifying arguments
for (int i = 0 ; i < argv.length ; i++) {
String arg = argv[i];
if (arg.equals(ToolOption.DOCLET.opt)) {
oneArg(argv, i++);
if (docletClassName != null) {
usageError("main.more_than_one_doclet_specified_0_and_1",
docletClassName, argv[i]);
}
docletClassName = argv[i];
} else if (arg.equals(ToolOption.DOCLETPATH.opt)) {
oneArg(argv, i++);
if (docletPath == null) {
docletPath = argv[i];
} else {
docletPath += File.pathSeparator + argv[i];
}
} else if (arg.equals("-XDaccessInternalAPI")) {
exportInternalAPI = true;
}
}
if (docletClass != null) {
// TODO, check no -doclet, -docletpath
docletInvoker = new DocletInvoker(messager, docletClass, apiMode, exportInternalAPI);
} else {
if (docletClassName == null) {
docletClassName = defaultDocletClassName;
}
// attempt to find doclet
docletInvoker = new DocletInvoker(messager, fileManager,
docletClassName, docletPath,
docletParentClassLoader,
apiMode,
exportInternalAPI);
}
}
|
[
"private",
"void",
"setDocletInvoker",
"(",
"Class",
"<",
"?",
">",
"docletClass",
",",
"JavaFileManager",
"fileManager",
",",
"String",
"[",
"]",
"argv",
")",
"{",
"boolean",
"exportInternalAPI",
"=",
"false",
";",
"String",
"docletClassName",
"=",
"null",
";",
"String",
"docletPath",
"=",
"null",
";",
"// Parse doclet specifying arguments",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"argv",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"arg",
"=",
"argv",
"[",
"i",
"]",
";",
"if",
"(",
"arg",
".",
"equals",
"(",
"ToolOption",
".",
"DOCLET",
".",
"opt",
")",
")",
"{",
"oneArg",
"(",
"argv",
",",
"i",
"++",
")",
";",
"if",
"(",
"docletClassName",
"!=",
"null",
")",
"{",
"usageError",
"(",
"\"main.more_than_one_doclet_specified_0_and_1\"",
",",
"docletClassName",
",",
"argv",
"[",
"i",
"]",
")",
";",
"}",
"docletClassName",
"=",
"argv",
"[",
"i",
"]",
";",
"}",
"else",
"if",
"(",
"arg",
".",
"equals",
"(",
"ToolOption",
".",
"DOCLETPATH",
".",
"opt",
")",
")",
"{",
"oneArg",
"(",
"argv",
",",
"i",
"++",
")",
";",
"if",
"(",
"docletPath",
"==",
"null",
")",
"{",
"docletPath",
"=",
"argv",
"[",
"i",
"]",
";",
"}",
"else",
"{",
"docletPath",
"+=",
"File",
".",
"pathSeparator",
"+",
"argv",
"[",
"i",
"]",
";",
"}",
"}",
"else",
"if",
"(",
"arg",
".",
"equals",
"(",
"\"-XDaccessInternalAPI\"",
")",
")",
"{",
"exportInternalAPI",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"docletClass",
"!=",
"null",
")",
"{",
"// TODO, check no -doclet, -docletpath",
"docletInvoker",
"=",
"new",
"DocletInvoker",
"(",
"messager",
",",
"docletClass",
",",
"apiMode",
",",
"exportInternalAPI",
")",
";",
"}",
"else",
"{",
"if",
"(",
"docletClassName",
"==",
"null",
")",
"{",
"docletClassName",
"=",
"defaultDocletClassName",
";",
"}",
"// attempt to find doclet",
"docletInvoker",
"=",
"new",
"DocletInvoker",
"(",
"messager",
",",
"fileManager",
",",
"docletClassName",
",",
"docletPath",
",",
"docletParentClassLoader",
",",
"apiMode",
",",
"exportInternalAPI",
")",
";",
"}",
"}"
] |
Init the doclet invoker.
The doclet class may be given explicitly, or via the -doclet option in
argv.
If the doclet class is not given explicitly, it will be loaded from
the file manager's DOCLET_PATH location, if available, or via the
-doclet path option in argv.
@param docletClass The doclet class. May be null.
@param fileManager The file manager used to get the class loader to load
the doclet class if required. May be null.
@param argv Args containing -doclet and -docletpath, in case they are required.
|
[
"Init",
"the",
"doclet",
"invoker",
".",
"The",
"doclet",
"class",
"may",
"be",
"given",
"explicitly",
"or",
"via",
"the",
"-",
"doclet",
"option",
"in",
"argv",
".",
"If",
"the",
"doclet",
"class",
"is",
"not",
"given",
"explicitly",
"it",
"will",
"be",
"loaded",
"from",
"the",
"file",
"manager",
"s",
"DOCLET_PATH",
"location",
"if",
"available",
"or",
"via",
"the",
"-",
"doclet",
"path",
"option",
"in",
"argv",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java#L480-L522
|
4,960 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java
|
Start.oneArg
|
private void oneArg(String[] args, int index) {
if ((index + 1) < args.length) {
setOption(args[index], args[index+1]);
} else {
usageError("main.requires_argument", args[index]);
}
}
|
java
|
private void oneArg(String[] args, int index) {
if ((index + 1) < args.length) {
setOption(args[index], args[index+1]);
} else {
usageError("main.requires_argument", args[index]);
}
}
|
[
"private",
"void",
"oneArg",
"(",
"String",
"[",
"]",
"args",
",",
"int",
"index",
")",
"{",
"if",
"(",
"(",
"index",
"+",
"1",
")",
"<",
"args",
".",
"length",
")",
"{",
"setOption",
"(",
"args",
"[",
"index",
"]",
",",
"args",
"[",
"index",
"+",
"1",
"]",
")",
";",
"}",
"else",
"{",
"usageError",
"(",
"\"main.requires_argument\"",
",",
"args",
"[",
"index",
"]",
")",
";",
"}",
"}"
] |
Set one arg option.
Error and exit if one argument is not provided.
|
[
"Set",
"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/com/sun/tools/javadoc/main/Start.java#L528-L534
|
4,961 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java
|
Start.setOption
|
private void setOption(String opt, String argument) {
String[] option = { opt, argument };
options.append(option);
}
|
java
|
private void setOption(String opt, String argument) {
String[] option = { opt, argument };
options.append(option);
}
|
[
"private",
"void",
"setOption",
"(",
"String",
"opt",
",",
"String",
"argument",
")",
"{",
"String",
"[",
"]",
"option",
"=",
"{",
"opt",
",",
"argument",
"}",
";",
"options",
".",
"append",
"(",
"option",
")",
";",
"}"
] |
indicate an option with one argument was given.
|
[
"indicate",
"an",
"option",
"with",
"one",
"argument",
"was",
"given",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java#L553-L556
|
4,962 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java
|
Start.setOption
|
private void setOption(String opt, List<String> arguments) {
String[] args = new String[arguments.length() + 1];
int k = 0;
args[k++] = opt;
for (List<String> i = arguments; i.nonEmpty(); i=i.tail) {
args[k++] = i.head;
}
options.append(args);
}
|
java
|
private void setOption(String opt, List<String> arguments) {
String[] args = new String[arguments.length() + 1];
int k = 0;
args[k++] = opt;
for (List<String> i = arguments; i.nonEmpty(); i=i.tail) {
args[k++] = i.head;
}
options.append(args);
}
|
[
"private",
"void",
"setOption",
"(",
"String",
"opt",
",",
"List",
"<",
"String",
">",
"arguments",
")",
"{",
"String",
"[",
"]",
"args",
"=",
"new",
"String",
"[",
"arguments",
".",
"length",
"(",
")",
"+",
"1",
"]",
";",
"int",
"k",
"=",
"0",
";",
"args",
"[",
"k",
"++",
"]",
"=",
"opt",
";",
"for",
"(",
"List",
"<",
"String",
">",
"i",
"=",
"arguments",
";",
"i",
".",
"nonEmpty",
"(",
")",
";",
"i",
"=",
"i",
".",
"tail",
")",
"{",
"args",
"[",
"k",
"++",
"]",
"=",
"i",
".",
"head",
";",
"}",
"options",
".",
"append",
"(",
"args",
")",
";",
"}"
] |
indicate an option with the specified list of arguments was given.
|
[
"indicate",
"an",
"option",
"with",
"the",
"specified",
"list",
"of",
"arguments",
"was",
"given",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java#L561-L569
|
4,963 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
|
Annotate.flush
|
public void flush() {
if (annotationsBlocked()) return;
if (isFlushing()) return;
startFlushing();
try {
while (q.nonEmpty()) {
q.next().run();
}
while (typesQ.nonEmpty()) {
typesQ.next().run();
}
while (afterTypesQ.nonEmpty()) {
afterTypesQ.next().run();
}
while (validateQ.nonEmpty()) {
validateQ.next().run();
}
} finally {
doneFlushing();
}
}
|
java
|
public void flush() {
if (annotationsBlocked()) return;
if (isFlushing()) return;
startFlushing();
try {
while (q.nonEmpty()) {
q.next().run();
}
while (typesQ.nonEmpty()) {
typesQ.next().run();
}
while (afterTypesQ.nonEmpty()) {
afterTypesQ.next().run();
}
while (validateQ.nonEmpty()) {
validateQ.next().run();
}
} finally {
doneFlushing();
}
}
|
[
"public",
"void",
"flush",
"(",
")",
"{",
"if",
"(",
"annotationsBlocked",
"(",
")",
")",
"return",
";",
"if",
"(",
"isFlushing",
"(",
")",
")",
"return",
";",
"startFlushing",
"(",
")",
";",
"try",
"{",
"while",
"(",
"q",
".",
"nonEmpty",
"(",
")",
")",
"{",
"q",
".",
"next",
"(",
")",
".",
"run",
"(",
")",
";",
"}",
"while",
"(",
"typesQ",
".",
"nonEmpty",
"(",
")",
")",
"{",
"typesQ",
".",
"next",
"(",
")",
".",
"run",
"(",
")",
";",
"}",
"while",
"(",
"afterTypesQ",
".",
"nonEmpty",
"(",
")",
")",
"{",
"afterTypesQ",
".",
"next",
"(",
")",
".",
"run",
"(",
")",
";",
"}",
"while",
"(",
"validateQ",
".",
"nonEmpty",
"(",
")",
")",
"{",
"validateQ",
".",
"next",
"(",
")",
".",
"run",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"doneFlushing",
"(",
")",
";",
"}",
"}"
] |
Flush all annotation queues
|
[
"Flush",
"all",
"annotation",
"queues"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L177-L198
|
4,964 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
|
Annotate.annotateLater
|
public void annotateLater(List<JCAnnotation> annotations, Env<AttrContext> localEnv,
Symbol s, DiagnosticPosition deferPos)
{
if (annotations.isEmpty()) {
return;
}
s.resetAnnotations(); // mark Annotations as incomplete for now
normal(() -> {
// Packages are unusual, in that they are the only type of declaration that can legally appear
// more than once in a compilation, and in all cases refer to the same underlying symbol.
// This means they are the only kind of declaration that syntactically may have multiple sets
// of annotations, each on a different package declaration, even though that is ultimately
// forbidden by JLS 8 section 7.4.
// The corollary here is that all of the annotations on a package symbol may have already
// been handled, meaning that the set of annotations pending completion is now empty.
Assert.check(s.kind == PCK || s.annotationsPendingCompletion());
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
DiagnosticPosition prevLintPos =
deferPos != null
? deferredLintHandler.setPos(deferPos)
: deferredLintHandler.immediate();
Lint prevLint = deferPos != null ? null : chk.setLint(lint);
try {
if (s.hasAnnotations() && annotations.nonEmpty())
log.error(annotations.head.pos, "already.annotated", Kinds.kindName(s), s);
Assert.checkNonNull(s, "Symbol argument to actualEnterAnnotations is null");
// false is passed as fifth parameter since annotateLater is
// never called for a type parameter
annotateNow(s, annotations, localEnv, false, false);
} finally {
if (prevLint != null)
chk.setLint(prevLint);
deferredLintHandler.setPos(prevLintPos);
log.useSource(prev);
}
});
validate(() -> { //validate annotations
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
try {
chk.validateAnnotations(annotations, s);
} finally {
log.useSource(prev);
}
});
}
|
java
|
public void annotateLater(List<JCAnnotation> annotations, Env<AttrContext> localEnv,
Symbol s, DiagnosticPosition deferPos)
{
if (annotations.isEmpty()) {
return;
}
s.resetAnnotations(); // mark Annotations as incomplete for now
normal(() -> {
// Packages are unusual, in that they are the only type of declaration that can legally appear
// more than once in a compilation, and in all cases refer to the same underlying symbol.
// This means they are the only kind of declaration that syntactically may have multiple sets
// of annotations, each on a different package declaration, even though that is ultimately
// forbidden by JLS 8 section 7.4.
// The corollary here is that all of the annotations on a package symbol may have already
// been handled, meaning that the set of annotations pending completion is now empty.
Assert.check(s.kind == PCK || s.annotationsPendingCompletion());
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
DiagnosticPosition prevLintPos =
deferPos != null
? deferredLintHandler.setPos(deferPos)
: deferredLintHandler.immediate();
Lint prevLint = deferPos != null ? null : chk.setLint(lint);
try {
if (s.hasAnnotations() && annotations.nonEmpty())
log.error(annotations.head.pos, "already.annotated", Kinds.kindName(s), s);
Assert.checkNonNull(s, "Symbol argument to actualEnterAnnotations is null");
// false is passed as fifth parameter since annotateLater is
// never called for a type parameter
annotateNow(s, annotations, localEnv, false, false);
} finally {
if (prevLint != null)
chk.setLint(prevLint);
deferredLintHandler.setPos(prevLintPos);
log.useSource(prev);
}
});
validate(() -> { //validate annotations
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
try {
chk.validateAnnotations(annotations, s);
} finally {
log.useSource(prev);
}
});
}
|
[
"public",
"void",
"annotateLater",
"(",
"List",
"<",
"JCAnnotation",
">",
"annotations",
",",
"Env",
"<",
"AttrContext",
">",
"localEnv",
",",
"Symbol",
"s",
",",
"DiagnosticPosition",
"deferPos",
")",
"{",
"if",
"(",
"annotations",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"s",
".",
"resetAnnotations",
"(",
")",
";",
"// mark Annotations as incomplete for now",
"normal",
"(",
"(",
")",
"->",
"{",
"// Packages are unusual, in that they are the only type of declaration that can legally appear",
"// more than once in a compilation, and in all cases refer to the same underlying symbol.",
"// This means they are the only kind of declaration that syntactically may have multiple sets",
"// of annotations, each on a different package declaration, even though that is ultimately",
"// forbidden by JLS 8 section 7.4.",
"// The corollary here is that all of the annotations on a package symbol may have already",
"// been handled, meaning that the set of annotations pending completion is now empty.",
"Assert",
".",
"check",
"(",
"s",
".",
"kind",
"==",
"PCK",
"||",
"s",
".",
"annotationsPendingCompletion",
"(",
")",
")",
";",
"JavaFileObject",
"prev",
"=",
"log",
".",
"useSource",
"(",
"localEnv",
".",
"toplevel",
".",
"sourcefile",
")",
";",
"DiagnosticPosition",
"prevLintPos",
"=",
"deferPos",
"!=",
"null",
"?",
"deferredLintHandler",
".",
"setPos",
"(",
"deferPos",
")",
":",
"deferredLintHandler",
".",
"immediate",
"(",
")",
";",
"Lint",
"prevLint",
"=",
"deferPos",
"!=",
"null",
"?",
"null",
":",
"chk",
".",
"setLint",
"(",
"lint",
")",
";",
"try",
"{",
"if",
"(",
"s",
".",
"hasAnnotations",
"(",
")",
"&&",
"annotations",
".",
"nonEmpty",
"(",
")",
")",
"log",
".",
"error",
"(",
"annotations",
".",
"head",
".",
"pos",
",",
"\"already.annotated\"",
",",
"Kinds",
".",
"kindName",
"(",
"s",
")",
",",
"s",
")",
";",
"Assert",
".",
"checkNonNull",
"(",
"s",
",",
"\"Symbol argument to actualEnterAnnotations is null\"",
")",
";",
"// false is passed as fifth parameter since annotateLater is",
"// never called for a type parameter",
"annotateNow",
"(",
"s",
",",
"annotations",
",",
"localEnv",
",",
"false",
",",
"false",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"prevLint",
"!=",
"null",
")",
"chk",
".",
"setLint",
"(",
"prevLint",
")",
";",
"deferredLintHandler",
".",
"setPos",
"(",
"prevLintPos",
")",
";",
"log",
".",
"useSource",
"(",
"prev",
")",
";",
"}",
"}",
")",
";",
"validate",
"(",
"(",
")",
"->",
"{",
"//validate annotations",
"JavaFileObject",
"prev",
"=",
"log",
".",
"useSource",
"(",
"localEnv",
".",
"toplevel",
".",
"sourcefile",
")",
";",
"try",
"{",
"chk",
".",
"validateAnnotations",
"(",
"annotations",
",",
"s",
")",
";",
"}",
"finally",
"{",
"log",
".",
"useSource",
"(",
"prev",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Queue annotations for later attribution and entering. This is probably the method you are looking for.
@param annotations the list of JCAnnotations to attribute and enter
@param localEnv the enclosing env
@param s ths Symbol on which to enter the annotations
@param deferPos report errors here
|
[
"Queue",
"annotations",
"for",
"later",
"attribution",
"and",
"entering",
".",
"This",
"is",
"probably",
"the",
"method",
"you",
"are",
"looking",
"for",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L228-L277
|
4,965 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
|
Annotate.annotateDefaultValueLater
|
public void annotateDefaultValueLater(JCExpression defaultValue, Env<AttrContext> localEnv,
MethodSymbol m, DiagnosticPosition deferPos)
{
normal(() -> {
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
DiagnosticPosition prevLintPos = deferredLintHandler.setPos(deferPos);
try {
enterDefaultValue(defaultValue, localEnv, m);
} finally {
deferredLintHandler.setPos(prevLintPos);
log.useSource(prev);
}
});
validate(() -> { //validate annotations
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
try {
// if default value is an annotation, check it is a well-formed
// annotation value (e.g. no duplicate values, no missing values, etc.)
chk.validateAnnotationTree(defaultValue);
} finally {
log.useSource(prev);
}
});
}
|
java
|
public void annotateDefaultValueLater(JCExpression defaultValue, Env<AttrContext> localEnv,
MethodSymbol m, DiagnosticPosition deferPos)
{
normal(() -> {
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
DiagnosticPosition prevLintPos = deferredLintHandler.setPos(deferPos);
try {
enterDefaultValue(defaultValue, localEnv, m);
} finally {
deferredLintHandler.setPos(prevLintPos);
log.useSource(prev);
}
});
validate(() -> { //validate annotations
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
try {
// if default value is an annotation, check it is a well-formed
// annotation value (e.g. no duplicate values, no missing values, etc.)
chk.validateAnnotationTree(defaultValue);
} finally {
log.useSource(prev);
}
});
}
|
[
"public",
"void",
"annotateDefaultValueLater",
"(",
"JCExpression",
"defaultValue",
",",
"Env",
"<",
"AttrContext",
">",
"localEnv",
",",
"MethodSymbol",
"m",
",",
"DiagnosticPosition",
"deferPos",
")",
"{",
"normal",
"(",
"(",
")",
"->",
"{",
"JavaFileObject",
"prev",
"=",
"log",
".",
"useSource",
"(",
"localEnv",
".",
"toplevel",
".",
"sourcefile",
")",
";",
"DiagnosticPosition",
"prevLintPos",
"=",
"deferredLintHandler",
".",
"setPos",
"(",
"deferPos",
")",
";",
"try",
"{",
"enterDefaultValue",
"(",
"defaultValue",
",",
"localEnv",
",",
"m",
")",
";",
"}",
"finally",
"{",
"deferredLintHandler",
".",
"setPos",
"(",
"prevLintPos",
")",
";",
"log",
".",
"useSource",
"(",
"prev",
")",
";",
"}",
"}",
")",
";",
"validate",
"(",
"(",
")",
"->",
"{",
"//validate annotations",
"JavaFileObject",
"prev",
"=",
"log",
".",
"useSource",
"(",
"localEnv",
".",
"toplevel",
".",
"sourcefile",
")",
";",
"try",
"{",
"// if default value is an annotation, check it is a well-formed",
"// annotation value (e.g. no duplicate values, no missing values, etc.)",
"chk",
".",
"validateAnnotationTree",
"(",
"defaultValue",
")",
";",
"}",
"finally",
"{",
"log",
".",
"useSource",
"(",
"prev",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Queue processing of an attribute default value.
|
[
"Queue",
"processing",
"of",
"an",
"attribute",
"default",
"value",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L281-L305
|
4,966 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
|
Annotate.enterDefaultValue
|
private void enterDefaultValue(JCExpression defaultValue,
Env<AttrContext> localEnv, MethodSymbol m) {
m.defaultValue = attributeAnnotationValue(m.type.getReturnType(), defaultValue, localEnv);
}
|
java
|
private void enterDefaultValue(JCExpression defaultValue,
Env<AttrContext> localEnv, MethodSymbol m) {
m.defaultValue = attributeAnnotationValue(m.type.getReturnType(), defaultValue, localEnv);
}
|
[
"private",
"void",
"enterDefaultValue",
"(",
"JCExpression",
"defaultValue",
",",
"Env",
"<",
"AttrContext",
">",
"localEnv",
",",
"MethodSymbol",
"m",
")",
"{",
"m",
".",
"defaultValue",
"=",
"attributeAnnotationValue",
"(",
"m",
".",
"type",
".",
"getReturnType",
"(",
")",
",",
"defaultValue",
",",
"localEnv",
")",
";",
"}"
] |
Enter a default value for an annotation element.
|
[
"Enter",
"a",
"default",
"value",
"for",
"an",
"annotation",
"element",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L308-L311
|
4,967 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
|
Annotate.attributeAnnotationValues
|
private List<Pair<MethodSymbol, Attribute>> attributeAnnotationValues(JCAnnotation a,
Type expected, Env<AttrContext> env)
{
// The annotation might have had its type attributed (but not
// checked) by attr.attribAnnotationTypes during MemberEnter,
// in which case we do not need to do it again.
Type at = (a.annotationType.type != null ?
a.annotationType.type : attr.attribType(a.annotationType, env));
a.type = chk.checkType(a.annotationType.pos(), at, expected);
boolean isError = a.type.isErroneous();
if (!a.type.tsym.isAnnotationType() && !isError) {
log.error(a.annotationType.pos(),
"not.annotation.type", a.type.toString());
isError = true;
}
// List of name=value pairs (or implicit "value=" if size 1)
List<JCExpression> args = a.args;
boolean elidedValue = false;
// special case: elided "value=" assumed
if (args.length() == 1 && !args.head.hasTag(ASSIGN)) {
args.head = make.at(args.head.pos).
Assign(make.Ident(names.value), args.head);
elidedValue = true;
}
ListBuffer<Pair<MethodSymbol,Attribute>> buf = new ListBuffer<>();
for (List<JCExpression> tl = args; tl.nonEmpty(); tl = tl.tail) {
Pair<MethodSymbol, Attribute> p = attributeAnnotationNameValuePair(tl.head, a.type, isError, env, elidedValue);
if (p != null && !p.fst.type.isErroneous())
buf.append(p);
}
return buf.toList();
}
|
java
|
private List<Pair<MethodSymbol, Attribute>> attributeAnnotationValues(JCAnnotation a,
Type expected, Env<AttrContext> env)
{
// The annotation might have had its type attributed (but not
// checked) by attr.attribAnnotationTypes during MemberEnter,
// in which case we do not need to do it again.
Type at = (a.annotationType.type != null ?
a.annotationType.type : attr.attribType(a.annotationType, env));
a.type = chk.checkType(a.annotationType.pos(), at, expected);
boolean isError = a.type.isErroneous();
if (!a.type.tsym.isAnnotationType() && !isError) {
log.error(a.annotationType.pos(),
"not.annotation.type", a.type.toString());
isError = true;
}
// List of name=value pairs (or implicit "value=" if size 1)
List<JCExpression> args = a.args;
boolean elidedValue = false;
// special case: elided "value=" assumed
if (args.length() == 1 && !args.head.hasTag(ASSIGN)) {
args.head = make.at(args.head.pos).
Assign(make.Ident(names.value), args.head);
elidedValue = true;
}
ListBuffer<Pair<MethodSymbol,Attribute>> buf = new ListBuffer<>();
for (List<JCExpression> tl = args; tl.nonEmpty(); tl = tl.tail) {
Pair<MethodSymbol, Attribute> p = attributeAnnotationNameValuePair(tl.head, a.type, isError, env, elidedValue);
if (p != null && !p.fst.type.isErroneous())
buf.append(p);
}
return buf.toList();
}
|
[
"private",
"List",
"<",
"Pair",
"<",
"MethodSymbol",
",",
"Attribute",
">",
">",
"attributeAnnotationValues",
"(",
"JCAnnotation",
"a",
",",
"Type",
"expected",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"// The annotation might have had its type attributed (but not",
"// checked) by attr.attribAnnotationTypes during MemberEnter,",
"// in which case we do not need to do it again.",
"Type",
"at",
"=",
"(",
"a",
".",
"annotationType",
".",
"type",
"!=",
"null",
"?",
"a",
".",
"annotationType",
".",
"type",
":",
"attr",
".",
"attribType",
"(",
"a",
".",
"annotationType",
",",
"env",
")",
")",
";",
"a",
".",
"type",
"=",
"chk",
".",
"checkType",
"(",
"a",
".",
"annotationType",
".",
"pos",
"(",
")",
",",
"at",
",",
"expected",
")",
";",
"boolean",
"isError",
"=",
"a",
".",
"type",
".",
"isErroneous",
"(",
")",
";",
"if",
"(",
"!",
"a",
".",
"type",
".",
"tsym",
".",
"isAnnotationType",
"(",
")",
"&&",
"!",
"isError",
")",
"{",
"log",
".",
"error",
"(",
"a",
".",
"annotationType",
".",
"pos",
"(",
")",
",",
"\"not.annotation.type\"",
",",
"a",
".",
"type",
".",
"toString",
"(",
")",
")",
";",
"isError",
"=",
"true",
";",
"}",
"// List of name=value pairs (or implicit \"value=\" if size 1)",
"List",
"<",
"JCExpression",
">",
"args",
"=",
"a",
".",
"args",
";",
"boolean",
"elidedValue",
"=",
"false",
";",
"// special case: elided \"value=\" assumed",
"if",
"(",
"args",
".",
"length",
"(",
")",
"==",
"1",
"&&",
"!",
"args",
".",
"head",
".",
"hasTag",
"(",
"ASSIGN",
")",
")",
"{",
"args",
".",
"head",
"=",
"make",
".",
"at",
"(",
"args",
".",
"head",
".",
"pos",
")",
".",
"Assign",
"(",
"make",
".",
"Ident",
"(",
"names",
".",
"value",
")",
",",
"args",
".",
"head",
")",
";",
"elidedValue",
"=",
"true",
";",
"}",
"ListBuffer",
"<",
"Pair",
"<",
"MethodSymbol",
",",
"Attribute",
">",
">",
"buf",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"for",
"(",
"List",
"<",
"JCExpression",
">",
"tl",
"=",
"args",
";",
"tl",
".",
"nonEmpty",
"(",
")",
";",
"tl",
"=",
"tl",
".",
"tail",
")",
"{",
"Pair",
"<",
"MethodSymbol",
",",
"Attribute",
">",
"p",
"=",
"attributeAnnotationNameValuePair",
"(",
"tl",
".",
"head",
",",
"a",
".",
"type",
",",
"isError",
",",
"env",
",",
"elidedValue",
")",
";",
"if",
"(",
"p",
"!=",
"null",
"&&",
"!",
"p",
".",
"fst",
".",
"type",
".",
"isErroneous",
"(",
")",
")",
"buf",
".",
"append",
"(",
"p",
")",
";",
"}",
"return",
"buf",
".",
"toList",
"(",
")",
";",
"}"
] |
Attribute annotation elements creating a list of pairs of the Symbol representing that
element and the value of that element as an Attribute.
|
[
"Attribute",
"annotation",
"elements",
"creating",
"a",
"list",
"of",
"pairs",
"of",
"the",
"Symbol",
"representing",
"that",
"element",
"and",
"the",
"value",
"of",
"that",
"element",
"as",
"an",
"Attribute",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L444-L479
|
4,968 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
|
Annotate.attributeAnnotationValue
|
private Attribute attributeAnnotationValue(Type expectedElementType, JCExpression tree,
Env<AttrContext> env)
{
//first, try completing the symbol for the annotation value - if acompletion
//error is thrown, we should recover gracefully, and display an
//ordinary resolution diagnostic.
try {
expectedElementType.tsym.complete();
} catch(CompletionFailure e) {
log.error(tree.pos(), "cant.resolve", Kinds.kindName(e.sym), e.sym);
expectedElementType = syms.errType;
}
if (expectedElementType.hasTag(ARRAY)) {
return getAnnotationArrayValue(expectedElementType, tree, env);
}
//error recovery
if (tree.hasTag(NEWARRAY)) {
if (!expectedElementType.isErroneous())
log.error(tree.pos(), "annotation.value.not.allowable.type");
JCNewArray na = (JCNewArray)tree;
if (na.elemtype != null) {
log.error(na.elemtype.pos(), "new.not.allowed.in.annotation");
}
for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
attributeAnnotationValue(syms.errType,
l.head,
env);
}
return new Attribute.Error(syms.errType);
}
if (expectedElementType.tsym.isAnnotationType()) {
if (tree.hasTag(ANNOTATION)) {
return attributeAnnotation((JCAnnotation)tree, expectedElementType, env);
} else {
log.error(tree.pos(), "annotation.value.must.be.annotation");
expectedElementType = syms.errType;
}
}
//error recovery
if (tree.hasTag(ANNOTATION)) {
if (!expectedElementType.isErroneous())
log.error(tree.pos(), "annotation.not.valid.for.type", expectedElementType);
attributeAnnotation((JCAnnotation)tree, syms.errType, env);
return new Attribute.Error(((JCAnnotation)tree).annotationType.type);
}
if (expectedElementType.isPrimitive() ||
(types.isSameType(expectedElementType, syms.stringType) && !expectedElementType.hasTag(TypeTag.ERROR))) {
return getAnnotationPrimitiveValue(expectedElementType, tree, env);
}
if (expectedElementType.tsym == syms.classType.tsym) {
return getAnnotationClassValue(expectedElementType, tree, env);
}
if (expectedElementType.hasTag(CLASS) &&
(expectedElementType.tsym.flags() & Flags.ENUM) != 0) {
return getAnnotationEnumValue(expectedElementType, tree, env);
}
//error recovery:
if (!expectedElementType.isErroneous())
log.error(tree.pos(), "annotation.value.not.allowable.type");
return new Attribute.Error(attr.attribExpr(tree, env, expectedElementType));
}
|
java
|
private Attribute attributeAnnotationValue(Type expectedElementType, JCExpression tree,
Env<AttrContext> env)
{
//first, try completing the symbol for the annotation value - if acompletion
//error is thrown, we should recover gracefully, and display an
//ordinary resolution diagnostic.
try {
expectedElementType.tsym.complete();
} catch(CompletionFailure e) {
log.error(tree.pos(), "cant.resolve", Kinds.kindName(e.sym), e.sym);
expectedElementType = syms.errType;
}
if (expectedElementType.hasTag(ARRAY)) {
return getAnnotationArrayValue(expectedElementType, tree, env);
}
//error recovery
if (tree.hasTag(NEWARRAY)) {
if (!expectedElementType.isErroneous())
log.error(tree.pos(), "annotation.value.not.allowable.type");
JCNewArray na = (JCNewArray)tree;
if (na.elemtype != null) {
log.error(na.elemtype.pos(), "new.not.allowed.in.annotation");
}
for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
attributeAnnotationValue(syms.errType,
l.head,
env);
}
return new Attribute.Error(syms.errType);
}
if (expectedElementType.tsym.isAnnotationType()) {
if (tree.hasTag(ANNOTATION)) {
return attributeAnnotation((JCAnnotation)tree, expectedElementType, env);
} else {
log.error(tree.pos(), "annotation.value.must.be.annotation");
expectedElementType = syms.errType;
}
}
//error recovery
if (tree.hasTag(ANNOTATION)) {
if (!expectedElementType.isErroneous())
log.error(tree.pos(), "annotation.not.valid.for.type", expectedElementType);
attributeAnnotation((JCAnnotation)tree, syms.errType, env);
return new Attribute.Error(((JCAnnotation)tree).annotationType.type);
}
if (expectedElementType.isPrimitive() ||
(types.isSameType(expectedElementType, syms.stringType) && !expectedElementType.hasTag(TypeTag.ERROR))) {
return getAnnotationPrimitiveValue(expectedElementType, tree, env);
}
if (expectedElementType.tsym == syms.classType.tsym) {
return getAnnotationClassValue(expectedElementType, tree, env);
}
if (expectedElementType.hasTag(CLASS) &&
(expectedElementType.tsym.flags() & Flags.ENUM) != 0) {
return getAnnotationEnumValue(expectedElementType, tree, env);
}
//error recovery:
if (!expectedElementType.isErroneous())
log.error(tree.pos(), "annotation.value.not.allowable.type");
return new Attribute.Error(attr.attribExpr(tree, env, expectedElementType));
}
|
[
"private",
"Attribute",
"attributeAnnotationValue",
"(",
"Type",
"expectedElementType",
",",
"JCExpression",
"tree",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"//first, try completing the symbol for the annotation value - if acompletion",
"//error is thrown, we should recover gracefully, and display an",
"//ordinary resolution diagnostic.",
"try",
"{",
"expectedElementType",
".",
"tsym",
".",
"complete",
"(",
")",
";",
"}",
"catch",
"(",
"CompletionFailure",
"e",
")",
"{",
"log",
".",
"error",
"(",
"tree",
".",
"pos",
"(",
")",
",",
"\"cant.resolve\"",
",",
"Kinds",
".",
"kindName",
"(",
"e",
".",
"sym",
")",
",",
"e",
".",
"sym",
")",
";",
"expectedElementType",
"=",
"syms",
".",
"errType",
";",
"}",
"if",
"(",
"expectedElementType",
".",
"hasTag",
"(",
"ARRAY",
")",
")",
"{",
"return",
"getAnnotationArrayValue",
"(",
"expectedElementType",
",",
"tree",
",",
"env",
")",
";",
"}",
"//error recovery",
"if",
"(",
"tree",
".",
"hasTag",
"(",
"NEWARRAY",
")",
")",
"{",
"if",
"(",
"!",
"expectedElementType",
".",
"isErroneous",
"(",
")",
")",
"log",
".",
"error",
"(",
"tree",
".",
"pos",
"(",
")",
",",
"\"annotation.value.not.allowable.type\"",
")",
";",
"JCNewArray",
"na",
"=",
"(",
"JCNewArray",
")",
"tree",
";",
"if",
"(",
"na",
".",
"elemtype",
"!=",
"null",
")",
"{",
"log",
".",
"error",
"(",
"na",
".",
"elemtype",
".",
"pos",
"(",
")",
",",
"\"new.not.allowed.in.annotation\"",
")",
";",
"}",
"for",
"(",
"List",
"<",
"JCExpression",
">",
"l",
"=",
"na",
".",
"elems",
";",
"l",
".",
"nonEmpty",
"(",
")",
";",
"l",
"=",
"l",
".",
"tail",
")",
"{",
"attributeAnnotationValue",
"(",
"syms",
".",
"errType",
",",
"l",
".",
"head",
",",
"env",
")",
";",
"}",
"return",
"new",
"Attribute",
".",
"Error",
"(",
"syms",
".",
"errType",
")",
";",
"}",
"if",
"(",
"expectedElementType",
".",
"tsym",
".",
"isAnnotationType",
"(",
")",
")",
"{",
"if",
"(",
"tree",
".",
"hasTag",
"(",
"ANNOTATION",
")",
")",
"{",
"return",
"attributeAnnotation",
"(",
"(",
"JCAnnotation",
")",
"tree",
",",
"expectedElementType",
",",
"env",
")",
";",
"}",
"else",
"{",
"log",
".",
"error",
"(",
"tree",
".",
"pos",
"(",
")",
",",
"\"annotation.value.must.be.annotation\"",
")",
";",
"expectedElementType",
"=",
"syms",
".",
"errType",
";",
"}",
"}",
"//error recovery",
"if",
"(",
"tree",
".",
"hasTag",
"(",
"ANNOTATION",
")",
")",
"{",
"if",
"(",
"!",
"expectedElementType",
".",
"isErroneous",
"(",
")",
")",
"log",
".",
"error",
"(",
"tree",
".",
"pos",
"(",
")",
",",
"\"annotation.not.valid.for.type\"",
",",
"expectedElementType",
")",
";",
"attributeAnnotation",
"(",
"(",
"JCAnnotation",
")",
"tree",
",",
"syms",
".",
"errType",
",",
"env",
")",
";",
"return",
"new",
"Attribute",
".",
"Error",
"(",
"(",
"(",
"JCAnnotation",
")",
"tree",
")",
".",
"annotationType",
".",
"type",
")",
";",
"}",
"if",
"(",
"expectedElementType",
".",
"isPrimitive",
"(",
")",
"||",
"(",
"types",
".",
"isSameType",
"(",
"expectedElementType",
",",
"syms",
".",
"stringType",
")",
"&&",
"!",
"expectedElementType",
".",
"hasTag",
"(",
"TypeTag",
".",
"ERROR",
")",
")",
")",
"{",
"return",
"getAnnotationPrimitiveValue",
"(",
"expectedElementType",
",",
"tree",
",",
"env",
")",
";",
"}",
"if",
"(",
"expectedElementType",
".",
"tsym",
"==",
"syms",
".",
"classType",
".",
"tsym",
")",
"{",
"return",
"getAnnotationClassValue",
"(",
"expectedElementType",
",",
"tree",
",",
"env",
")",
";",
"}",
"if",
"(",
"expectedElementType",
".",
"hasTag",
"(",
"CLASS",
")",
"&&",
"(",
"expectedElementType",
".",
"tsym",
".",
"flags",
"(",
")",
"&",
"Flags",
".",
"ENUM",
")",
"!=",
"0",
")",
"{",
"return",
"getAnnotationEnumValue",
"(",
"expectedElementType",
",",
"tree",
",",
"env",
")",
";",
"}",
"//error recovery:",
"if",
"(",
"!",
"expectedElementType",
".",
"isErroneous",
"(",
")",
")",
"log",
".",
"error",
"(",
"tree",
".",
"pos",
"(",
")",
",",
"\"annotation.value.not.allowable.type\"",
")",
";",
"return",
"new",
"Attribute",
".",
"Error",
"(",
"attr",
".",
"attribExpr",
"(",
"tree",
",",
"env",
",",
"expectedElementType",
")",
")",
";",
"}"
] |
Attribute an annotation element value
|
[
"Attribute",
"an",
"annotation",
"element",
"value"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L517-L586
|
4,969 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
|
Annotate.filterSame
|
private Type filterSame(Type t, Type s) {
if (t == null || s == null) {
return t;
}
return types.isSameType(t, s) ? null : t;
}
|
java
|
private Type filterSame(Type t, Type s) {
if (t == null || s == null) {
return t;
}
return types.isSameType(t, s) ? null : t;
}
|
[
"private",
"Type",
"filterSame",
"(",
"Type",
"t",
",",
"Type",
"s",
")",
"{",
"if",
"(",
"t",
"==",
"null",
"||",
"s",
"==",
"null",
")",
"{",
"return",
"t",
";",
"}",
"return",
"types",
".",
"isSameType",
"(",
"t",
",",
"s",
")",
"?",
"null",
":",
"t",
";",
"}"
] |
returns null if t is same as 's', returns 't' otherwise
|
[
"returns",
"null",
"if",
"t",
"is",
"same",
"as",
"s",
"returns",
"t",
"otherwise"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L828-L834
|
4,970 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
|
Annotate.extractContainingType
|
private Type extractContainingType(Attribute.Compound ca,
DiagnosticPosition pos,
TypeSymbol annoDecl)
{
// The next three checks check that the Repeatable annotation
// on the declaration of the annotation type that is repeating is
// valid.
// Repeatable must have at least one element
if (ca.values.isEmpty()) {
log.error(pos, "invalid.repeatable.annotation", annoDecl);
return null;
}
Pair<MethodSymbol,Attribute> p = ca.values.head;
Name name = p.fst.name;
if (name != names.value) { // should contain only one element, named "value"
log.error(pos, "invalid.repeatable.annotation", annoDecl);
return null;
}
if (!(p.snd instanceof Attribute.Class)) { // check that the value of "value" is an Attribute.Class
log.error(pos, "invalid.repeatable.annotation", annoDecl);
return null;
}
return ((Attribute.Class)p.snd).getValue();
}
|
java
|
private Type extractContainingType(Attribute.Compound ca,
DiagnosticPosition pos,
TypeSymbol annoDecl)
{
// The next three checks check that the Repeatable annotation
// on the declaration of the annotation type that is repeating is
// valid.
// Repeatable must have at least one element
if (ca.values.isEmpty()) {
log.error(pos, "invalid.repeatable.annotation", annoDecl);
return null;
}
Pair<MethodSymbol,Attribute> p = ca.values.head;
Name name = p.fst.name;
if (name != names.value) { // should contain only one element, named "value"
log.error(pos, "invalid.repeatable.annotation", annoDecl);
return null;
}
if (!(p.snd instanceof Attribute.Class)) { // check that the value of "value" is an Attribute.Class
log.error(pos, "invalid.repeatable.annotation", annoDecl);
return null;
}
return ((Attribute.Class)p.snd).getValue();
}
|
[
"private",
"Type",
"extractContainingType",
"(",
"Attribute",
".",
"Compound",
"ca",
",",
"DiagnosticPosition",
"pos",
",",
"TypeSymbol",
"annoDecl",
")",
"{",
"// The next three checks check that the Repeatable annotation",
"// on the declaration of the annotation type that is repeating is",
"// valid.",
"// Repeatable must have at least one element",
"if",
"(",
"ca",
".",
"values",
".",
"isEmpty",
"(",
")",
")",
"{",
"log",
".",
"error",
"(",
"pos",
",",
"\"invalid.repeatable.annotation\"",
",",
"annoDecl",
")",
";",
"return",
"null",
";",
"}",
"Pair",
"<",
"MethodSymbol",
",",
"Attribute",
">",
"p",
"=",
"ca",
".",
"values",
".",
"head",
";",
"Name",
"name",
"=",
"p",
".",
"fst",
".",
"name",
";",
"if",
"(",
"name",
"!=",
"names",
".",
"value",
")",
"{",
"// should contain only one element, named \"value\"",
"log",
".",
"error",
"(",
"pos",
",",
"\"invalid.repeatable.annotation\"",
",",
"annoDecl",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"(",
"p",
".",
"snd",
"instanceof",
"Attribute",
".",
"Class",
")",
")",
"{",
"// check that the value of \"value\" is an Attribute.Class",
"log",
".",
"error",
"(",
"pos",
",",
"\"invalid.repeatable.annotation\"",
",",
"annoDecl",
")",
";",
"return",
"null",
";",
"}",
"return",
"(",
"(",
"Attribute",
".",
"Class",
")",
"p",
".",
"snd",
")",
".",
"getValue",
"(",
")",
";",
"}"
] |
Extract the actual Type to be used for a containing annotation.
|
[
"Extract",
"the",
"actual",
"Type",
"to",
"be",
"used",
"for",
"a",
"containing",
"annotation",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L837-L862
|
4,971 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
|
Annotate.enterTypeAnnotations
|
public void enterTypeAnnotations(List<JCAnnotation> annotations, Env<AttrContext> env,
Symbol s, DiagnosticPosition deferPos, boolean isTypeParam)
{
Assert.checkNonNull(s, "Symbol argument to actualEnterTypeAnnotations is nul/");
JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
DiagnosticPosition prevLintPos = null;
if (deferPos != null) {
prevLintPos = deferredLintHandler.setPos(deferPos);
}
try {
annotateNow(s, annotations, env, true, isTypeParam);
} finally {
if (prevLintPos != null)
deferredLintHandler.setPos(prevLintPos);
log.useSource(prev);
}
}
|
java
|
public void enterTypeAnnotations(List<JCAnnotation> annotations, Env<AttrContext> env,
Symbol s, DiagnosticPosition deferPos, boolean isTypeParam)
{
Assert.checkNonNull(s, "Symbol argument to actualEnterTypeAnnotations is nul/");
JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
DiagnosticPosition prevLintPos = null;
if (deferPos != null) {
prevLintPos = deferredLintHandler.setPos(deferPos);
}
try {
annotateNow(s, annotations, env, true, isTypeParam);
} finally {
if (prevLintPos != null)
deferredLintHandler.setPos(prevLintPos);
log.useSource(prev);
}
}
|
[
"public",
"void",
"enterTypeAnnotations",
"(",
"List",
"<",
"JCAnnotation",
">",
"annotations",
",",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"Symbol",
"s",
",",
"DiagnosticPosition",
"deferPos",
",",
"boolean",
"isTypeParam",
")",
"{",
"Assert",
".",
"checkNonNull",
"(",
"s",
",",
"\"Symbol argument to actualEnterTypeAnnotations is nul/\"",
")",
";",
"JavaFileObject",
"prev",
"=",
"log",
".",
"useSource",
"(",
"env",
".",
"toplevel",
".",
"sourcefile",
")",
";",
"DiagnosticPosition",
"prevLintPos",
"=",
"null",
";",
"if",
"(",
"deferPos",
"!=",
"null",
")",
"{",
"prevLintPos",
"=",
"deferredLintHandler",
".",
"setPos",
"(",
"deferPos",
")",
";",
"}",
"try",
"{",
"annotateNow",
"(",
"s",
",",
"annotations",
",",
"env",
",",
"true",
",",
"isTypeParam",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"prevLintPos",
"!=",
"null",
")",
"deferredLintHandler",
".",
"setPos",
"(",
"prevLintPos",
")",
";",
"log",
".",
"useSource",
"(",
"prev",
")",
";",
"}",
"}"
] |
Attribute the list of annotations and enter them onto s.
|
[
"Attribute",
"the",
"list",
"of",
"annotations",
"and",
"enter",
"them",
"onto",
"s",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L959-L976
|
4,972 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
|
Annotate.queueScanTreeAndTypeAnnotate
|
public void queueScanTreeAndTypeAnnotate(JCTree tree, Env<AttrContext> env, Symbol sym,
DiagnosticPosition deferPos)
{
Assert.checkNonNull(sym);
normal(() -> tree.accept(new TypeAnnotate(env, sym, deferPos)));
}
|
java
|
public void queueScanTreeAndTypeAnnotate(JCTree tree, Env<AttrContext> env, Symbol sym,
DiagnosticPosition deferPos)
{
Assert.checkNonNull(sym);
normal(() -> tree.accept(new TypeAnnotate(env, sym, deferPos)));
}
|
[
"public",
"void",
"queueScanTreeAndTypeAnnotate",
"(",
"JCTree",
"tree",
",",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"Symbol",
"sym",
",",
"DiagnosticPosition",
"deferPos",
")",
"{",
"Assert",
".",
"checkNonNull",
"(",
"sym",
")",
";",
"normal",
"(",
"(",
")",
"->",
"tree",
".",
"accept",
"(",
"new",
"TypeAnnotate",
"(",
"env",
",",
"sym",
",",
"deferPos",
")",
")",
")",
";",
"}"
] |
Enqueue tree for scanning of type annotations, attaching to the Symbol sym.
|
[
"Enqueue",
"tree",
"for",
"scanning",
"of",
"type",
"annotations",
"attaching",
"to",
"the",
"Symbol",
"sym",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L981-L986
|
4,973 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.instance
|
public static Log instance(Context context) {
Log instance = context.get(logKey);
if (instance == null)
instance = new Log(context);
return instance;
}
|
java
|
public static Log instance(Context context) {
Log instance = context.get(logKey);
if (instance == null)
instance = new Log(context);
return instance;
}
|
[
"public",
"static",
"Log",
"instance",
"(",
"Context",
"context",
")",
"{",
"Log",
"instance",
"=",
"context",
".",
"get",
"(",
"logKey",
")",
";",
"if",
"(",
"instance",
"==",
"null",
")",
"instance",
"=",
"new",
"Log",
"(",
"context",
")",
";",
"return",
"instance",
";",
"}"
] |
Get the Log instance for this context.
|
[
"Get",
"the",
"Log",
"instance",
"for",
"this",
"context",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L231-L236
|
4,974 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.preRegister
|
public static void preRegister(Context context, PrintWriter w) {
context.put(Log.class, (Context.Factory<Log>) (c -> new Log(c, w)));
}
|
java
|
public static void preRegister(Context context, PrintWriter w) {
context.put(Log.class, (Context.Factory<Log>) (c -> new Log(c, w)));
}
|
[
"public",
"static",
"void",
"preRegister",
"(",
"Context",
"context",
",",
"PrintWriter",
"w",
")",
"{",
"context",
".",
"put",
"(",
"Log",
".",
"class",
",",
"(",
"Context",
".",
"Factory",
"<",
"Log",
">",
")",
"(",
"c",
"->",
"new",
"Log",
"(",
"c",
",",
"w",
")",
")",
")",
";",
"}"
] |
Register a Context.Factory to create a Log.
|
[
"Register",
"a",
"Context",
".",
"Factory",
"to",
"create",
"a",
"Log",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L241-L243
|
4,975 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.initWriters
|
private static Map<WriterKind, PrintWriter> initWriters(Context context) {
PrintWriter out = context.get(outKey);
PrintWriter err = context.get(errKey);
if (out == null && err == null) {
out = new PrintWriter(System.out, true);
err = new PrintWriter(System.err, true);
return initWriters(out, err);
} else if (out == null || err == null) {
PrintWriter pw = (out != null) ? out : err;
return initWriters(pw, pw);
} else {
return initWriters(out, err);
}
}
|
java
|
private static Map<WriterKind, PrintWriter> initWriters(Context context) {
PrintWriter out = context.get(outKey);
PrintWriter err = context.get(errKey);
if (out == null && err == null) {
out = new PrintWriter(System.out, true);
err = new PrintWriter(System.err, true);
return initWriters(out, err);
} else if (out == null || err == null) {
PrintWriter pw = (out != null) ? out : err;
return initWriters(pw, pw);
} else {
return initWriters(out, err);
}
}
|
[
"private",
"static",
"Map",
"<",
"WriterKind",
",",
"PrintWriter",
">",
"initWriters",
"(",
"Context",
"context",
")",
"{",
"PrintWriter",
"out",
"=",
"context",
".",
"get",
"(",
"outKey",
")",
";",
"PrintWriter",
"err",
"=",
"context",
".",
"get",
"(",
"errKey",
")",
";",
"if",
"(",
"out",
"==",
"null",
"&&",
"err",
"==",
"null",
")",
"{",
"out",
"=",
"new",
"PrintWriter",
"(",
"System",
".",
"out",
",",
"true",
")",
";",
"err",
"=",
"new",
"PrintWriter",
"(",
"System",
".",
"err",
",",
"true",
")",
";",
"return",
"initWriters",
"(",
"out",
",",
"err",
")",
";",
"}",
"else",
"if",
"(",
"out",
"==",
"null",
"||",
"err",
"==",
"null",
")",
"{",
"PrintWriter",
"pw",
"=",
"(",
"out",
"!=",
"null",
")",
"?",
"out",
":",
"err",
";",
"return",
"initWriters",
"(",
"pw",
",",
"pw",
")",
";",
"}",
"else",
"{",
"return",
"initWriters",
"(",
"out",
",",
"err",
")",
";",
"}",
"}"
] |
Initialize a map of writers based on values found in the context
@param context the context in which to find writers to use
@return a map of writers
|
[
"Initialize",
"a",
"map",
"of",
"writers",
"based",
"on",
"values",
"found",
"in",
"the",
"context"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L262-L275
|
4,976 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.initWriters
|
private static Map<WriterKind, PrintWriter> initWriters(PrintWriter out, PrintWriter err) {
Map<WriterKind, PrintWriter> writers = new EnumMap<>(WriterKind.class);
writers.put(WriterKind.ERROR, err);
writers.put(WriterKind.WARNING, err);
writers.put(WriterKind.NOTICE, err);
writers.put(WriterKind.STDOUT, out);
writers.put(WriterKind.STDERR, err);
return writers;
}
|
java
|
private static Map<WriterKind, PrintWriter> initWriters(PrintWriter out, PrintWriter err) {
Map<WriterKind, PrintWriter> writers = new EnumMap<>(WriterKind.class);
writers.put(WriterKind.ERROR, err);
writers.put(WriterKind.WARNING, err);
writers.put(WriterKind.NOTICE, err);
writers.put(WriterKind.STDOUT, out);
writers.put(WriterKind.STDERR, err);
return writers;
}
|
[
"private",
"static",
"Map",
"<",
"WriterKind",
",",
"PrintWriter",
">",
"initWriters",
"(",
"PrintWriter",
"out",
",",
"PrintWriter",
"err",
")",
"{",
"Map",
"<",
"WriterKind",
",",
"PrintWriter",
">",
"writers",
"=",
"new",
"EnumMap",
"<>",
"(",
"WriterKind",
".",
"class",
")",
";",
"writers",
".",
"put",
"(",
"WriterKind",
".",
"ERROR",
",",
"err",
")",
";",
"writers",
".",
"put",
"(",
"WriterKind",
".",
"WARNING",
",",
"err",
")",
";",
"writers",
".",
"put",
"(",
"WriterKind",
".",
"NOTICE",
",",
"err",
")",
";",
"writers",
".",
"put",
"(",
"WriterKind",
".",
"STDOUT",
",",
"out",
")",
";",
"writers",
".",
"put",
"(",
"WriterKind",
".",
"STDERR",
",",
"err",
")",
";",
"return",
"writers",
";",
"}"
] |
Initialize a writer map for a stream for normal output, and a stream for diagnostics.
@param out a stream to be used for normal output
@param err a stream to be used for diagnostic messages, such as errors, warnings, etc
@return a map of writers
|
[
"Initialize",
"a",
"writer",
"map",
"for",
"a",
"stream",
"for",
"normal",
"output",
"and",
"a",
"stream",
"for",
"diagnostics",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L299-L309
|
4,977 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.initWriters
|
@Deprecated
private static Map<WriterKind, PrintWriter> initWriters(PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) {
Map<WriterKind, PrintWriter> writers = new EnumMap<>(WriterKind.class);
writers.put(WriterKind.ERROR, errWriter);
writers.put(WriterKind.WARNING, warnWriter);
writers.put(WriterKind.NOTICE, noticeWriter);
writers.put(WriterKind.STDOUT, noticeWriter);
writers.put(WriterKind.STDERR, errWriter);
return writers;
}
|
java
|
@Deprecated
private static Map<WriterKind, PrintWriter> initWriters(PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) {
Map<WriterKind, PrintWriter> writers = new EnumMap<>(WriterKind.class);
writers.put(WriterKind.ERROR, errWriter);
writers.put(WriterKind.WARNING, warnWriter);
writers.put(WriterKind.NOTICE, noticeWriter);
writers.put(WriterKind.STDOUT, noticeWriter);
writers.put(WriterKind.STDERR, errWriter);
return writers;
}
|
[
"@",
"Deprecated",
"private",
"static",
"Map",
"<",
"WriterKind",
",",
"PrintWriter",
">",
"initWriters",
"(",
"PrintWriter",
"errWriter",
",",
"PrintWriter",
"warnWriter",
",",
"PrintWriter",
"noticeWriter",
")",
"{",
"Map",
"<",
"WriterKind",
",",
"PrintWriter",
">",
"writers",
"=",
"new",
"EnumMap",
"<>",
"(",
"WriterKind",
".",
"class",
")",
";",
"writers",
".",
"put",
"(",
"WriterKind",
".",
"ERROR",
",",
"errWriter",
")",
";",
"writers",
".",
"put",
"(",
"WriterKind",
".",
"WARNING",
",",
"warnWriter",
")",
";",
"writers",
".",
"put",
"(",
"WriterKind",
".",
"NOTICE",
",",
"noticeWriter",
")",
";",
"writers",
".",
"put",
"(",
"WriterKind",
".",
"STDOUT",
",",
"noticeWriter",
")",
";",
"writers",
".",
"put",
"(",
"WriterKind",
".",
"STDERR",
",",
"errWriter",
")",
";",
"return",
"writers",
";",
"}"
] |
Initialize a writer map with different streams for different types of diagnostics.
@param errWriter a stream for writing error messages
@param warnWriter a stream for writing warning messages
@param noticeWriter a stream for writing notice messages
@return a map of writers
@deprecated This method exists to support a supported but now deprecated javadoc entry point.
|
[
"Initialize",
"a",
"writer",
"map",
"with",
"different",
"streams",
"for",
"different",
"types",
"of",
"diagnostics",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L332-L343
|
4,978 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.popDiagnosticHandler
|
public void popDiagnosticHandler(DiagnosticHandler h) {
Assert.check(diagnosticHandler == h);
diagnosticHandler = h.prev;
}
|
java
|
public void popDiagnosticHandler(DiagnosticHandler h) {
Assert.check(diagnosticHandler == h);
diagnosticHandler = h.prev;
}
|
[
"public",
"void",
"popDiagnosticHandler",
"(",
"DiagnosticHandler",
"h",
")",
"{",
"Assert",
".",
"check",
"(",
"diagnosticHandler",
"==",
"h",
")",
";",
"diagnosticHandler",
"=",
"h",
".",
"prev",
";",
"}"
] |
Replace the specified diagnostic handler with the
handler that was current at the time this handler was created.
The given handler must be the currently installed handler;
it must be specified explicitly for clarity and consistency checking.
|
[
"Replace",
"the",
"specified",
"diagnostic",
"handler",
"with",
"the",
"handler",
"that",
"was",
"current",
"at",
"the",
"time",
"this",
"handler",
"was",
"created",
".",
"The",
"given",
"handler",
"must",
"be",
"the",
"currently",
"installed",
"handler",
";",
"it",
"must",
"be",
"specified",
"explicitly",
"for",
"clarity",
"and",
"consistency",
"checking",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L479-L482
|
4,979 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.shouldReport
|
protected boolean shouldReport(JavaFileObject file, int pos) {
if (file == null)
return true;
Pair<JavaFileObject,Integer> coords = new Pair<>(file, pos);
boolean shouldReport = !recorded.contains(coords);
if (shouldReport)
recorded.add(coords);
return shouldReport;
}
|
java
|
protected boolean shouldReport(JavaFileObject file, int pos) {
if (file == null)
return true;
Pair<JavaFileObject,Integer> coords = new Pair<>(file, pos);
boolean shouldReport = !recorded.contains(coords);
if (shouldReport)
recorded.add(coords);
return shouldReport;
}
|
[
"protected",
"boolean",
"shouldReport",
"(",
"JavaFileObject",
"file",
",",
"int",
"pos",
")",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"return",
"true",
";",
"Pair",
"<",
"JavaFileObject",
",",
"Integer",
">",
"coords",
"=",
"new",
"Pair",
"<>",
"(",
"file",
",",
"pos",
")",
";",
"boolean",
"shouldReport",
"=",
"!",
"recorded",
".",
"contains",
"(",
"coords",
")",
";",
"if",
"(",
"shouldReport",
")",
"recorded",
".",
"add",
"(",
"coords",
")",
";",
"return",
"shouldReport",
";",
"}"
] |
Returns true if an error needs to be reported for a given
source name and pos.
|
[
"Returns",
"true",
"if",
"an",
"error",
"needs",
"to",
"be",
"reported",
"for",
"a",
"given",
"source",
"name",
"and",
"pos",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L499-L508
|
4,980 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.shouldReport
|
private boolean shouldReport(JCDiagnostic d) {
JavaFileObject file = d.getSource();
if (file == null)
return true;
if (!shouldReport(file, d.getIntPosition()))
return false;
if (!d.isFlagSet(DiagnosticFlag.SOURCE_LEVEL))
return true;
Pair<JavaFileObject, String> coords = new Pair<>(file, d.getCode());
boolean shouldReport = !recordedSourceLevelErrors.contains(coords);
if (shouldReport)
recordedSourceLevelErrors.add(coords);
return shouldReport;
}
|
java
|
private boolean shouldReport(JCDiagnostic d) {
JavaFileObject file = d.getSource();
if (file == null)
return true;
if (!shouldReport(file, d.getIntPosition()))
return false;
if (!d.isFlagSet(DiagnosticFlag.SOURCE_LEVEL))
return true;
Pair<JavaFileObject, String> coords = new Pair<>(file, d.getCode());
boolean shouldReport = !recordedSourceLevelErrors.contains(coords);
if (shouldReport)
recordedSourceLevelErrors.add(coords);
return shouldReport;
}
|
[
"private",
"boolean",
"shouldReport",
"(",
"JCDiagnostic",
"d",
")",
"{",
"JavaFileObject",
"file",
"=",
"d",
".",
"getSource",
"(",
")",
";",
"if",
"(",
"file",
"==",
"null",
")",
"return",
"true",
";",
"if",
"(",
"!",
"shouldReport",
"(",
"file",
",",
"d",
".",
"getIntPosition",
"(",
")",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"d",
".",
"isFlagSet",
"(",
"DiagnosticFlag",
".",
"SOURCE_LEVEL",
")",
")",
"return",
"true",
";",
"Pair",
"<",
"JavaFileObject",
",",
"String",
">",
"coords",
"=",
"new",
"Pair",
"<>",
"(",
"file",
",",
"d",
".",
"getCode",
"(",
")",
")",
";",
"boolean",
"shouldReport",
"=",
"!",
"recordedSourceLevelErrors",
".",
"contains",
"(",
"coords",
")",
";",
"if",
"(",
"shouldReport",
")",
"recordedSourceLevelErrors",
".",
"add",
"(",
"coords",
")",
";",
"return",
"shouldReport",
";",
"}"
] |
Returns true if a diagnostics needs to be reported.
|
[
"Returns",
"true",
"if",
"a",
"diagnostics",
"needs",
"to",
"be",
"reported",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L512-L529
|
4,981 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.prompt
|
public void prompt() {
if (promptOnError) {
System.err.println(localize("resume.abort"));
try {
while (true) {
switch (System.in.read()) {
case 'a': case 'A':
System.exit(-1);
return;
case 'r': case 'R':
return;
case 'x': case 'X':
throw new AssertionError("user abort");
default:
}
}
} catch (IOException e) {}
}
}
|
java
|
public void prompt() {
if (promptOnError) {
System.err.println(localize("resume.abort"));
try {
while (true) {
switch (System.in.read()) {
case 'a': case 'A':
System.exit(-1);
return;
case 'r': case 'R':
return;
case 'x': case 'X':
throw new AssertionError("user abort");
default:
}
}
} catch (IOException e) {}
}
}
|
[
"public",
"void",
"prompt",
"(",
")",
"{",
"if",
"(",
"promptOnError",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"localize",
"(",
"\"resume.abort\"",
")",
")",
";",
"try",
"{",
"while",
"(",
"true",
")",
"{",
"switch",
"(",
"System",
".",
"in",
".",
"read",
"(",
")",
")",
"{",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"System",
".",
"exit",
"(",
"-",
"1",
")",
";",
"return",
";",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"return",
";",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"throw",
"new",
"AssertionError",
"(",
"\"user abort\"",
")",
";",
"default",
":",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"}"
] |
Prompt user after an error.
|
[
"Prompt",
"user",
"after",
"an",
"error",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L533-L551
|
4,982 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.printErrLine
|
private void printErrLine(int pos, PrintWriter writer) {
String line = (source == null ? null : source.getLine(pos));
if (line == null)
return;
int col = source.getColumnNumber(pos, false);
printRawLines(writer, line);
for (int i = 0; i < col - 1; i++) {
writer.print((line.charAt(i) == '\t') ? "\t" : " ");
}
writer.println("^");
writer.flush();
}
|
java
|
private void printErrLine(int pos, PrintWriter writer) {
String line = (source == null ? null : source.getLine(pos));
if (line == null)
return;
int col = source.getColumnNumber(pos, false);
printRawLines(writer, line);
for (int i = 0; i < col - 1; i++) {
writer.print((line.charAt(i) == '\t') ? "\t" : " ");
}
writer.println("^");
writer.flush();
}
|
[
"private",
"void",
"printErrLine",
"(",
"int",
"pos",
",",
"PrintWriter",
"writer",
")",
"{",
"String",
"line",
"=",
"(",
"source",
"==",
"null",
"?",
"null",
":",
"source",
".",
"getLine",
"(",
"pos",
")",
")",
";",
"if",
"(",
"line",
"==",
"null",
")",
"return",
";",
"int",
"col",
"=",
"source",
".",
"getColumnNumber",
"(",
"pos",
",",
"false",
")",
";",
"printRawLines",
"(",
"writer",
",",
"line",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"col",
"-",
"1",
";",
"i",
"++",
")",
"{",
"writer",
".",
"print",
"(",
"(",
"line",
".",
"charAt",
"(",
"i",
")",
"==",
"'",
"'",
")",
"?",
"\"\\t\"",
":",
"\" \"",
")",
";",
"}",
"writer",
".",
"println",
"(",
"\"^\"",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"}"
] |
Print the faulty source code line and point to the error.
@param pos Buffer index of the error position, must be on current line
|
[
"Print",
"the",
"faulty",
"source",
"code",
"line",
"and",
"point",
"to",
"the",
"error",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L556-L568
|
4,983 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.strictWarning
|
public void strictWarning(DiagnosticPosition pos, String key, Object ... args) {
writeDiagnostic(diags.warning(null, source, pos, key, args));
nwarnings++;
}
|
java
|
public void strictWarning(DiagnosticPosition pos, String key, Object ... args) {
writeDiagnostic(diags.warning(null, source, pos, key, args));
nwarnings++;
}
|
[
"public",
"void",
"strictWarning",
"(",
"DiagnosticPosition",
"pos",
",",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"writeDiagnostic",
"(",
"diags",
".",
"warning",
"(",
"null",
",",
"source",
",",
"pos",
",",
"key",
",",
"args",
")",
")",
";",
"nwarnings",
"++",
";",
"}"
] |
Report a warning that cannot be suppressed.
@param pos The source position at which to report the warning.
@param key The key for the localized warning message.
@param args Fields of the warning message.
|
[
"Report",
"a",
"warning",
"that",
"cannot",
"be",
"suppressed",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L645-L648
|
4,984 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
|
Log.writeDiagnostic
|
protected void writeDiagnostic(JCDiagnostic diag) {
if (diagListener != null) {
diagListener.report(diag);
return;
}
PrintWriter writer = getWriterForDiagnosticType(diag.getType());
printRawLines(writer, diagFormatter.format(diag, messages.getCurrentLocale()));
if (promptOnError) {
switch (diag.getType()) {
case ERROR:
case WARNING:
prompt();
}
}
if (dumpOnError)
new RuntimeException().printStackTrace(writer);
writer.flush();
}
|
java
|
protected void writeDiagnostic(JCDiagnostic diag) {
if (diagListener != null) {
diagListener.report(diag);
return;
}
PrintWriter writer = getWriterForDiagnosticType(diag.getType());
printRawLines(writer, diagFormatter.format(diag, messages.getCurrentLocale()));
if (promptOnError) {
switch (diag.getType()) {
case ERROR:
case WARNING:
prompt();
}
}
if (dumpOnError)
new RuntimeException().printStackTrace(writer);
writer.flush();
}
|
[
"protected",
"void",
"writeDiagnostic",
"(",
"JCDiagnostic",
"diag",
")",
"{",
"if",
"(",
"diagListener",
"!=",
"null",
")",
"{",
"diagListener",
".",
"report",
"(",
"diag",
")",
";",
"return",
";",
"}",
"PrintWriter",
"writer",
"=",
"getWriterForDiagnosticType",
"(",
"diag",
".",
"getType",
"(",
")",
")",
";",
"printRawLines",
"(",
"writer",
",",
"diagFormatter",
".",
"format",
"(",
"diag",
",",
"messages",
".",
"getCurrentLocale",
"(",
")",
")",
")",
";",
"if",
"(",
"promptOnError",
")",
"{",
"switch",
"(",
"diag",
".",
"getType",
"(",
")",
")",
"{",
"case",
"ERROR",
":",
"case",
"WARNING",
":",
"prompt",
"(",
")",
";",
"}",
"}",
"if",
"(",
"dumpOnError",
")",
"new",
"RuntimeException",
"(",
")",
".",
"printStackTrace",
"(",
"writer",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"}"
] |
Write out a diagnostic.
|
[
"Write",
"out",
"a",
"diagnostic",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L710-L732
|
4,985 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Env.java
|
Env.dup
|
public Env<A> dup(JCTree tree, A info) {
return dupto(new Env<>(tree, info));
}
|
java
|
public Env<A> dup(JCTree tree, A info) {
return dupto(new Env<>(tree, info));
}
|
[
"public",
"Env",
"<",
"A",
">",
"dup",
"(",
"JCTree",
"tree",
",",
"A",
"info",
")",
"{",
"return",
"dupto",
"(",
"new",
"Env",
"<>",
"(",
"tree",
",",
"info",
")",
")",
";",
"}"
] |
Duplicate this environment, updating with given tree and info,
and copying all other fields.
|
[
"Duplicate",
"this",
"environment",
"updating",
"with",
"given",
"tree",
"and",
"info",
"and",
"copying",
"all",
"other",
"fields",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Env.java#L94-L96
|
4,986 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Env.java
|
Env.dupto
|
public Env<A> dupto(Env<A> that) {
that.next = this;
that.outer = this.outer;
that.toplevel = this.toplevel;
that.enclClass = this.enclClass;
that.enclMethod = this.enclMethod;
return that;
}
|
java
|
public Env<A> dupto(Env<A> that) {
that.next = this;
that.outer = this.outer;
that.toplevel = this.toplevel;
that.enclClass = this.enclClass;
that.enclMethod = this.enclMethod;
return that;
}
|
[
"public",
"Env",
"<",
"A",
">",
"dupto",
"(",
"Env",
"<",
"A",
">",
"that",
")",
"{",
"that",
".",
"next",
"=",
"this",
";",
"that",
".",
"outer",
"=",
"this",
".",
"outer",
";",
"that",
".",
"toplevel",
"=",
"this",
".",
"toplevel",
";",
"that",
".",
"enclClass",
"=",
"this",
".",
"enclClass",
";",
"that",
".",
"enclMethod",
"=",
"this",
".",
"enclMethod",
";",
"return",
"that",
";",
"}"
] |
Duplicate this environment into a given Environment,
using its tree and info, and copying all other fields.
|
[
"Duplicate",
"this",
"environment",
"into",
"a",
"given",
"Environment",
"using",
"its",
"tree",
"and",
"info",
"and",
"copying",
"all",
"other",
"fields",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Env.java#L101-L108
|
4,987 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Env.java
|
Env.enclosing
|
public Env<A> enclosing(JCTree.Tag tag) {
Env<A> env1 = this;
while (env1 != null && !env1.tree.hasTag(tag)) env1 = env1.next;
return env1;
}
|
java
|
public Env<A> enclosing(JCTree.Tag tag) {
Env<A> env1 = this;
while (env1 != null && !env1.tree.hasTag(tag)) env1 = env1.next;
return env1;
}
|
[
"public",
"Env",
"<",
"A",
">",
"enclosing",
"(",
"JCTree",
".",
"Tag",
"tag",
")",
"{",
"Env",
"<",
"A",
">",
"env1",
"=",
"this",
";",
"while",
"(",
"env1",
"!=",
"null",
"&&",
"!",
"env1",
".",
"tree",
".",
"hasTag",
"(",
"tag",
")",
")",
"env1",
"=",
"env1",
".",
"next",
";",
"return",
"env1",
";",
"}"
] |
Return closest enclosing environment which points to a tree with given tag.
|
[
"Return",
"closest",
"enclosing",
"environment",
"which",
"points",
"to",
"a",
"tree",
"with",
"given",
"tag",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Env.java#L119-L123
|
4,988 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
|
Arguments.instance
|
public static Arguments instance(Context context) {
Arguments instance = context.get(argsKey);
if (instance == null) {
instance = new Arguments(context);
}
return instance;
}
|
java
|
public static Arguments instance(Context context) {
Arguments instance = context.get(argsKey);
if (instance == null) {
instance = new Arguments(context);
}
return instance;
}
|
[
"public",
"static",
"Arguments",
"instance",
"(",
"Context",
"context",
")",
"{",
"Arguments",
"instance",
"=",
"context",
".",
"get",
"(",
"argsKey",
")",
";",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"instance",
"=",
"new",
"Arguments",
"(",
"context",
")",
";",
"}",
"return",
"instance",
";",
"}"
] |
Gets the Arguments instance for this context.
@param context the content
@return the Arguments instance for this context.
|
[
"Gets",
"the",
"Arguments",
"instance",
"for",
"this",
"context",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java#L109-L115
|
4,989 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
|
Arguments.init
|
public void init(String ownName, String... args) {
this.ownName = ownName;
errorMode = ErrorMode.LOG;
files = new LinkedHashSet<>();
deferredFileManagerOptions = new LinkedHashMap<>();
fileObjects = null;
classNames = new LinkedHashSet<>();
processArgs(List.from(args), Option.getJavaCompilerOptions(), cmdLineHelper, true, false);
if (errors) {
log.printLines(PrefixKind.JAVAC, "msg.usage", ownName);
}
}
|
java
|
public void init(String ownName, String... args) {
this.ownName = ownName;
errorMode = ErrorMode.LOG;
files = new LinkedHashSet<>();
deferredFileManagerOptions = new LinkedHashMap<>();
fileObjects = null;
classNames = new LinkedHashSet<>();
processArgs(List.from(args), Option.getJavaCompilerOptions(), cmdLineHelper, true, false);
if (errors) {
log.printLines(PrefixKind.JAVAC, "msg.usage", ownName);
}
}
|
[
"public",
"void",
"init",
"(",
"String",
"ownName",
",",
"String",
"...",
"args",
")",
"{",
"this",
".",
"ownName",
"=",
"ownName",
";",
"errorMode",
"=",
"ErrorMode",
".",
"LOG",
";",
"files",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"deferredFileManagerOptions",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"fileObjects",
"=",
"null",
";",
"classNames",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"processArgs",
"(",
"List",
".",
"from",
"(",
"args",
")",
",",
"Option",
".",
"getJavaCompilerOptions",
"(",
")",
",",
"cmdLineHelper",
",",
"true",
",",
"false",
")",
";",
"if",
"(",
"errors",
")",
"{",
"log",
".",
"printLines",
"(",
"PrefixKind",
".",
"JAVAC",
",",
"\"msg.usage\"",
",",
"ownName",
")",
";",
"}",
"}"
] |
Initializes this Args instance with a set of command line args.
The args will be processed in conjunction with the full set of
command line options, including -help, -version etc.
The args may also contain class names and filenames.
Any errors during this call, and later during validate, will be reported
to the log.
@param ownName the name of this tool; used to prefix messages
@param args the args to be processed
|
[
"Initializes",
"this",
"Args",
"instance",
"with",
"a",
"set",
"of",
"command",
"line",
"args",
".",
"The",
"args",
"will",
"be",
"processed",
"in",
"conjunction",
"with",
"the",
"full",
"set",
"of",
"command",
"line",
"options",
"including",
"-",
"help",
"-",
"version",
"etc",
".",
"The",
"args",
"may",
"also",
"contain",
"class",
"names",
"and",
"filenames",
".",
"Any",
"errors",
"during",
"this",
"call",
"and",
"later",
"during",
"validate",
"will",
"be",
"reported",
"to",
"the",
"log",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java#L186-L197
|
4,990 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
|
Arguments.init
|
public void init(String ownName,
Iterable<String> options,
Iterable<String> classNames,
Iterable<? extends JavaFileObject> files) {
this.ownName = ownName;
this.classNames = toSet(classNames);
this.fileObjects = toSet(files);
this.files = null;
errorMode = ErrorMode.ILLEGAL_ARGUMENT;
if (options != null) {
processArgs(toList(options), Option.getJavacToolOptions(), apiHelper, false, true);
}
errorMode = ErrorMode.ILLEGAL_STATE;
}
|
java
|
public void init(String ownName,
Iterable<String> options,
Iterable<String> classNames,
Iterable<? extends JavaFileObject> files) {
this.ownName = ownName;
this.classNames = toSet(classNames);
this.fileObjects = toSet(files);
this.files = null;
errorMode = ErrorMode.ILLEGAL_ARGUMENT;
if (options != null) {
processArgs(toList(options), Option.getJavacToolOptions(), apiHelper, false, true);
}
errorMode = ErrorMode.ILLEGAL_STATE;
}
|
[
"public",
"void",
"init",
"(",
"String",
"ownName",
",",
"Iterable",
"<",
"String",
">",
"options",
",",
"Iterable",
"<",
"String",
">",
"classNames",
",",
"Iterable",
"<",
"?",
"extends",
"JavaFileObject",
">",
"files",
")",
"{",
"this",
".",
"ownName",
"=",
"ownName",
";",
"this",
".",
"classNames",
"=",
"toSet",
"(",
"classNames",
")",
";",
"this",
".",
"fileObjects",
"=",
"toSet",
"(",
"files",
")",
";",
"this",
".",
"files",
"=",
"null",
";",
"errorMode",
"=",
"ErrorMode",
".",
"ILLEGAL_ARGUMENT",
";",
"if",
"(",
"options",
"!=",
"null",
")",
"{",
"processArgs",
"(",
"toList",
"(",
"options",
")",
",",
"Option",
".",
"getJavacToolOptions",
"(",
")",
",",
"apiHelper",
",",
"false",
",",
"true",
")",
";",
"}",
"errorMode",
"=",
"ErrorMode",
".",
"ILLEGAL_STATE",
";",
"}"
] |
Initializes this Args instance with the parameters for a JavacTask.
The options will be processed in conjunction with the restricted set
of tool options, which does not include -help, -version, etc,
nor does it include classes and filenames, which should be specified
separately.
File manager options are handled directly by the file manager.
Any errors found while processing individual args will be reported
via IllegalArgumentException.
Any subsequent errors during validate will be reported via IllegalStateException.
@param ownName the name of this tool; used to prefix messages
@param options the options to be processed
@param classNames the classes to be subject to annotation processing
@param files the files to be compiled
|
[
"Initializes",
"this",
"Args",
"instance",
"with",
"the",
"parameters",
"for",
"a",
"JavacTask",
".",
"The",
"options",
"will",
"be",
"processed",
"in",
"conjunction",
"with",
"the",
"restricted",
"set",
"of",
"tool",
"options",
"which",
"does",
"not",
"include",
"-",
"help",
"-",
"version",
"etc",
"nor",
"does",
"it",
"include",
"classes",
"and",
"filenames",
"which",
"should",
"be",
"specified",
"separately",
".",
"File",
"manager",
"options",
"are",
"handled",
"directly",
"by",
"the",
"file",
"manager",
".",
"Any",
"errors",
"found",
"while",
"processing",
"individual",
"args",
"will",
"be",
"reported",
"via",
"IllegalArgumentException",
".",
"Any",
"subsequent",
"errors",
"during",
"validate",
"will",
"be",
"reported",
"via",
"IllegalStateException",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java#L236-L249
|
4,991 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
|
Arguments.getFileObjects
|
public Set<JavaFileObject> getFileObjects() {
if (fileObjects == null) {
fileObjects = new LinkedHashSet<>();
}
if (files != null) {
JavacFileManager jfm = (JavacFileManager) getFileManager();
for (JavaFileObject fo: jfm.getJavaFileObjectsFromPaths(files))
fileObjects.add(fo);
}
return fileObjects;
}
|
java
|
public Set<JavaFileObject> getFileObjects() {
if (fileObjects == null) {
fileObjects = new LinkedHashSet<>();
}
if (files != null) {
JavacFileManager jfm = (JavacFileManager) getFileManager();
for (JavaFileObject fo: jfm.getJavaFileObjectsFromPaths(files))
fileObjects.add(fo);
}
return fileObjects;
}
|
[
"public",
"Set",
"<",
"JavaFileObject",
">",
"getFileObjects",
"(",
")",
"{",
"if",
"(",
"fileObjects",
"==",
"null",
")",
"{",
"fileObjects",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"}",
"if",
"(",
"files",
"!=",
"null",
")",
"{",
"JavacFileManager",
"jfm",
"=",
"(",
"JavacFileManager",
")",
"getFileManager",
"(",
")",
";",
"for",
"(",
"JavaFileObject",
"fo",
":",
"jfm",
".",
"getJavaFileObjectsFromPaths",
"(",
"files",
")",
")",
"fileObjects",
".",
"(",
"fo",
")",
";",
"}",
"return",
"fileObjects",
";",
"}"
] |
Gets the files to be compiled.
@return the files to be compiled
|
[
"Gets",
"the",
"files",
"to",
"be",
"compiled",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java#L266-L276
|
4,992 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
|
Arguments.processArgs
|
private boolean processArgs(Iterable<String> args,
Set<Option> allowableOpts, OptionHelper helper,
boolean allowOperands, boolean checkFileManager) {
if (!doProcessArgs(args, allowableOpts, helper, allowOperands, checkFileManager))
return false;
if (!handleReleaseOptions(extra -> doProcessArgs(extra, allowableOpts, helper, allowOperands, checkFileManager)))
return false;
options.notifyListeners();
return true;
}
|
java
|
private boolean processArgs(Iterable<String> args,
Set<Option> allowableOpts, OptionHelper helper,
boolean allowOperands, boolean checkFileManager) {
if (!doProcessArgs(args, allowableOpts, helper, allowOperands, checkFileManager))
return false;
if (!handleReleaseOptions(extra -> doProcessArgs(extra, allowableOpts, helper, allowOperands, checkFileManager)))
return false;
options.notifyListeners();
return true;
}
|
[
"private",
"boolean",
"processArgs",
"(",
"Iterable",
"<",
"String",
">",
"args",
",",
"Set",
"<",
"Option",
">",
"allowableOpts",
",",
"OptionHelper",
"helper",
",",
"boolean",
"allowOperands",
",",
"boolean",
"checkFileManager",
")",
"{",
"if",
"(",
"!",
"doProcessArgs",
"(",
"args",
",",
"allowableOpts",
",",
"helper",
",",
"allowOperands",
",",
"checkFileManager",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"handleReleaseOptions",
"(",
"extra",
"->",
"doProcessArgs",
"(",
"extra",
",",
"allowableOpts",
",",
"helper",
",",
"allowOperands",
",",
"checkFileManager",
")",
")",
")",
"return",
"false",
";",
"options",
".",
"notifyListeners",
"(",
")",
";",
"return",
"true",
";",
"}"
] |
Processes strings containing options and operands.
@param args the strings to be processed
@param allowableOpts the set of option declarations that are applicable
@param helper a help for use by Option.process
@param allowOperands whether or not to check for files and classes
@param checkFileManager whether or not to check if the file manager can handle
options which are not recognized by any of allowableOpts
@return true if all the strings were successfully processed; false otherwise
@throws IllegalArgumentException if a problem occurs and errorMode is set to
ILLEGAL_ARGUMENT
|
[
"Processes",
"strings",
"containing",
"options",
"and",
"operands",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java#L364-L376
|
4,993 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
|
Arguments.isEmpty
|
public boolean isEmpty() {
return ((files == null) || files.isEmpty())
&& ((fileObjects == null) || fileObjects.isEmpty())
&& (classNames == null || classNames.isEmpty());
}
|
java
|
public boolean isEmpty() {
return ((files == null) || files.isEmpty())
&& ((fileObjects == null) || fileObjects.isEmpty())
&& (classNames == null || classNames.isEmpty());
}
|
[
"public",
"boolean",
"isEmpty",
"(",
")",
"{",
"return",
"(",
"(",
"files",
"==",
"null",
")",
"||",
"files",
".",
"isEmpty",
"(",
")",
")",
"&&",
"(",
"(",
"fileObjects",
"==",
"null",
")",
"||",
"fileObjects",
".",
"isEmpty",
"(",
")",
")",
"&&",
"(",
"classNames",
"==",
"null",
"||",
"classNames",
".",
"isEmpty",
"(",
")",
")",
";",
"}"
] |
Returns true if there are no files or classes specified for use.
@return true if there are no files or classes specified for use
|
[
"Returns",
"true",
"if",
"there",
"are",
"no",
"files",
"or",
"classes",
"specified",
"for",
"use",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java#L792-L796
|
4,994 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
|
Arguments.getPluginOpts
|
public Set<List<String>> getPluginOpts() {
String plugins = options.get(Option.PLUGIN);
if (plugins == null)
return Collections.emptySet();
Set<List<String>> pluginOpts = new LinkedHashSet<>();
for (String plugin: plugins.split("\\x00")) {
pluginOpts.add(List.from(plugin.split("\\s+")));
}
return Collections.unmodifiableSet(pluginOpts);
}
|
java
|
public Set<List<String>> getPluginOpts() {
String plugins = options.get(Option.PLUGIN);
if (plugins == null)
return Collections.emptySet();
Set<List<String>> pluginOpts = new LinkedHashSet<>();
for (String plugin: plugins.split("\\x00")) {
pluginOpts.add(List.from(plugin.split("\\s+")));
}
return Collections.unmodifiableSet(pluginOpts);
}
|
[
"public",
"Set",
"<",
"List",
"<",
"String",
">",
">",
"getPluginOpts",
"(",
")",
"{",
"String",
"plugins",
"=",
"options",
".",
"get",
"(",
"Option",
".",
"PLUGIN",
")",
";",
"if",
"(",
"plugins",
"==",
"null",
")",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"Set",
"<",
"List",
"<",
"String",
">",
">",
"pluginOpts",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"plugin",
":",
"plugins",
".",
"split",
"(",
"\"\\\\x00\"",
")",
")",
"{",
"pluginOpts",
".",
"add",
"(",
"List",
".",
"from",
"(",
"plugin",
".",
"split",
"(",
"\"\\\\s+\"",
")",
")",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableSet",
"(",
"pluginOpts",
")",
";",
"}"
] |
Gets any options specifying plugins to be run.
@return options for plugins
|
[
"Gets",
"any",
"options",
"specifying",
"plugins",
"to",
"be",
"run",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java#L815-L825
|
4,995 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java
|
Options.isUnset
|
public boolean isUnset(Option option, String value) {
return (values.get(option.primaryName + value) == null);
}
|
java
|
public boolean isUnset(Option option, String value) {
return (values.get(option.primaryName + value) == null);
}
|
[
"public",
"boolean",
"isUnset",
"(",
"Option",
"option",
",",
"String",
"value",
")",
"{",
"return",
"(",
"values",
".",
"get",
"(",
"option",
".",
"primaryName",
"+",
"value",
")",
"==",
"null",
")",
";",
"}"
] |
Check if the value for a choice option has not been set to a specific value.
|
[
"Check",
"if",
"the",
"value",
"for",
"a",
"choice",
"option",
"has",
"not",
"been",
"set",
"to",
"a",
"specific",
"value",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java#L144-L146
|
4,996 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Name.java
|
Name.append
|
public Name append(Name n) {
int len = getByteLength();
byte[] bs = new byte[len + n.getByteLength()];
getBytes(bs, 0);
n.getBytes(bs, len);
return table.fromUtf(bs, 0, bs.length);
}
|
java
|
public Name append(Name n) {
int len = getByteLength();
byte[] bs = new byte[len + n.getByteLength()];
getBytes(bs, 0);
n.getBytes(bs, len);
return table.fromUtf(bs, 0, bs.length);
}
|
[
"public",
"Name",
"append",
"(",
"Name",
"n",
")",
"{",
"int",
"len",
"=",
"getByteLength",
"(",
")",
";",
"byte",
"[",
"]",
"bs",
"=",
"new",
"byte",
"[",
"len",
"+",
"n",
".",
"getByteLength",
"(",
")",
"]",
";",
"getBytes",
"(",
"bs",
",",
"0",
")",
";",
"n",
".",
"getBytes",
"(",
"bs",
",",
"len",
")",
";",
"return",
"table",
".",
"fromUtf",
"(",
"bs",
",",
"0",
",",
"bs",
".",
"length",
")",
";",
"}"
] |
Return the concatenation of this name and name `n'.
|
[
"Return",
"the",
"concatenation",
"of",
"this",
"name",
"and",
"name",
"n",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Name.java#L78-L84
|
4,997 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Name.java
|
Name.lastIndexOf
|
public int lastIndexOf(byte b) {
byte[] bytes = getByteArray();
int offset = getByteOffset();
int i = getByteLength() - 1;
while (i >= 0 && bytes[offset + i] != b) i--;
return i;
}
|
java
|
public int lastIndexOf(byte b) {
byte[] bytes = getByteArray();
int offset = getByteOffset();
int i = getByteLength() - 1;
while (i >= 0 && bytes[offset + i] != b) i--;
return i;
}
|
[
"public",
"int",
"lastIndexOf",
"(",
"byte",
"b",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"getByteArray",
"(",
")",
";",
"int",
"offset",
"=",
"getByteOffset",
"(",
")",
";",
"int",
"i",
"=",
"getByteLength",
"(",
")",
"-",
"1",
";",
"while",
"(",
"i",
">=",
"0",
"&&",
"bytes",
"[",
"offset",
"+",
"i",
"]",
"!=",
"b",
")",
"i",
"--",
";",
"return",
"i",
";",
"}"
] |
Returns last occurrence of byte b in this name, -1 if not found.
|
[
"Returns",
"last",
"occurrence",
"of",
"byte",
"b",
"in",
"this",
"name",
"-",
"1",
"if",
"not",
"found",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Name.java#L112-L118
|
4,998 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Name.java
|
Name.subName
|
public Name subName(int start, int end) {
if (end < start) end = start;
return table.fromUtf(getByteArray(), getByteOffset() + start, end - start);
}
|
java
|
public Name subName(int start, int end) {
if (end < start) end = start;
return table.fromUtf(getByteArray(), getByteOffset() + start, end - start);
}
|
[
"public",
"Name",
"subName",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"if",
"(",
"end",
"<",
"start",
")",
"end",
"=",
"start",
";",
"return",
"table",
".",
"fromUtf",
"(",
"getByteArray",
"(",
")",
",",
"getByteOffset",
"(",
")",
"+",
"start",
",",
"end",
"-",
"start",
")",
";",
"}"
] |
Returns the sub-name starting at position start, up to and
excluding position end.
|
[
"Returns",
"the",
"sub",
"-",
"name",
"starting",
"at",
"position",
"start",
"up",
"to",
"and",
"excluding",
"position",
"end",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Name.java#L143-L146
|
4,999 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Name.java
|
Name.getBytes
|
public void getBytes(byte cs[], int start) {
System.arraycopy(getByteArray(), getByteOffset(), cs, start, getByteLength());
}
|
java
|
public void getBytes(byte cs[], int start) {
System.arraycopy(getByteArray(), getByteOffset(), cs, start, getByteLength());
}
|
[
"public",
"void",
"getBytes",
"(",
"byte",
"cs",
"[",
"]",
",",
"int",
"start",
")",
"{",
"System",
".",
"arraycopy",
"(",
"getByteArray",
"(",
")",
",",
"getByteOffset",
"(",
")",
",",
"cs",
",",
"start",
",",
"getByteLength",
"(",
")",
")",
";",
"}"
] |
Copy all bytes of this name to buffer cs, starting at start.
|
[
"Copy",
"all",
"bytes",
"of",
"this",
"name",
"to",
"buffer",
"cs",
"starting",
"at",
"start",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Name.java#L178-L180
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.