id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
---|---|---|---|---|---|---|---|---|---|---|---|
5,400 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java
|
DocImpl.readHTMLDocumentation
|
String readHTMLDocumentation(InputStream input, FileObject filename) throws IOException {
byte[] filecontents = new byte[input.available()];
try {
DataInputStream dataIn = new DataInputStream(input);
dataIn.readFully(filecontents);
} finally {
input.close();
}
String encoding = env.getEncoding();
String rawDoc = (encoding!=null)
? new String(filecontents, encoding)
: new String(filecontents);
Pattern bodyPat = Pattern.compile("(?is).*<body\\b[^>]*>(.*)</body\\b.*");
Matcher m = bodyPat.matcher(rawDoc);
if (m.matches()) {
return m.group(1);
} else {
String key = rawDoc.matches("(?is).*<body\\b.*")
? "javadoc.End_body_missing_from_html_file"
: "javadoc.Body_missing_from_html_file";
env.error(SourcePositionImpl.make(filename, Position.NOPOS, null), key);
return "";
}
}
|
java
|
String readHTMLDocumentation(InputStream input, FileObject filename) throws IOException {
byte[] filecontents = new byte[input.available()];
try {
DataInputStream dataIn = new DataInputStream(input);
dataIn.readFully(filecontents);
} finally {
input.close();
}
String encoding = env.getEncoding();
String rawDoc = (encoding!=null)
? new String(filecontents, encoding)
: new String(filecontents);
Pattern bodyPat = Pattern.compile("(?is).*<body\\b[^>]*>(.*)</body\\b.*");
Matcher m = bodyPat.matcher(rawDoc);
if (m.matches()) {
return m.group(1);
} else {
String key = rawDoc.matches("(?is).*<body\\b.*")
? "javadoc.End_body_missing_from_html_file"
: "javadoc.Body_missing_from_html_file";
env.error(SourcePositionImpl.make(filename, Position.NOPOS, null), key);
return "";
}
}
|
[
"String",
"readHTMLDocumentation",
"(",
"InputStream",
"input",
",",
"FileObject",
"filename",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"filecontents",
"=",
"new",
"byte",
"[",
"input",
".",
"available",
"(",
")",
"]",
";",
"try",
"{",
"DataInputStream",
"dataIn",
"=",
"new",
"DataInputStream",
"(",
"input",
")",
";",
"dataIn",
".",
"readFully",
"(",
"filecontents",
")",
";",
"}",
"finally",
"{",
"input",
".",
"close",
"(",
")",
";",
"}",
"String",
"encoding",
"=",
"env",
".",
"getEncoding",
"(",
")",
";",
"String",
"rawDoc",
"=",
"(",
"encoding",
"!=",
"null",
")",
"?",
"new",
"String",
"(",
"filecontents",
",",
"encoding",
")",
":",
"new",
"String",
"(",
"filecontents",
")",
";",
"Pattern",
"bodyPat",
"=",
"Pattern",
".",
"compile",
"(",
"\"(?is).*<body\\\\b[^>]*>(.*)</body\\\\b.*\"",
")",
";",
"Matcher",
"m",
"=",
"bodyPat",
".",
"matcher",
"(",
"rawDoc",
")",
";",
"if",
"(",
"m",
".",
"matches",
"(",
")",
")",
"{",
"return",
"m",
".",
"group",
"(",
"1",
")",
";",
"}",
"else",
"{",
"String",
"key",
"=",
"rawDoc",
".",
"matches",
"(",
"\"(?is).*<body\\\\b.*\"",
")",
"?",
"\"javadoc.End_body_missing_from_html_file\"",
":",
"\"javadoc.Body_missing_from_html_file\"",
";",
"env",
".",
"error",
"(",
"SourcePositionImpl",
".",
"make",
"(",
"filename",
",",
"Position",
".",
"NOPOS",
",",
"null",
")",
",",
"key",
")",
";",
"return",
"\"\"",
";",
"}",
"}"
] |
Utility for subclasses which read HTML documentation files.
|
[
"Utility",
"for",
"subclasses",
"which",
"read",
"HTML",
"documentation",
"files",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java#L214-L237
|
5,401 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java
|
DocImpl.setTreePath
|
void setTreePath(TreePath treePath) {
this.treePath = treePath;
documentation = getCommentText(treePath);
comment = null;
}
|
java
|
void setTreePath(TreePath treePath) {
this.treePath = treePath;
documentation = getCommentText(treePath);
comment = null;
}
|
[
"void",
"setTreePath",
"(",
"TreePath",
"treePath",
")",
"{",
"this",
".",
"treePath",
"=",
"treePath",
";",
"documentation",
"=",
"getCommentText",
"(",
"treePath",
")",
";",
"comment",
"=",
"null",
";",
"}"
] |
Set the full unprocessed text of the comment and tree path.
|
[
"Set",
"the",
"full",
"unprocessed",
"text",
"of",
"the",
"comment",
"and",
"tree",
"path",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java#L262-L266
|
5,402 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java
|
JavacTypes.validateTypeNotIn
|
private void validateTypeNotIn(TypeMirror t, Set<TypeKind> invalidKinds) {
if (invalidKinds.contains(t.getKind()))
throw new IllegalArgumentException(t.toString());
}
|
java
|
private void validateTypeNotIn(TypeMirror t, Set<TypeKind> invalidKinds) {
if (invalidKinds.contains(t.getKind()))
throw new IllegalArgumentException(t.toString());
}
|
[
"private",
"void",
"validateTypeNotIn",
"(",
"TypeMirror",
"t",
",",
"Set",
"<",
"TypeKind",
">",
"invalidKinds",
")",
"{",
"if",
"(",
"invalidKinds",
".",
"contains",
"(",
"t",
".",
"getKind",
"(",
")",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"t",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Throws an IllegalArgumentException if a type's kind is one of a set.
|
[
"Throws",
"an",
"IllegalArgumentException",
"if",
"a",
"type",
"s",
"kind",
"is",
"one",
"of",
"a",
"set",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java#L310-L313
|
5,403 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java
|
JavacTypes.cast
|
private static <T> T cast(Class<T> clazz, Object o) {
if (! clazz.isInstance(o))
throw new IllegalArgumentException(o.toString());
return clazz.cast(o);
}
|
java
|
private static <T> T cast(Class<T> clazz, Object o) {
if (! clazz.isInstance(o))
throw new IllegalArgumentException(o.toString());
return clazz.cast(o);
}
|
[
"private",
"static",
"<",
"T",
">",
"T",
"cast",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"clazz",
".",
"isInstance",
"(",
"o",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"o",
".",
"toString",
"(",
")",
")",
";",
"return",
"clazz",
".",
"cast",
"(",
"o",
")",
";",
"}"
] |
Returns an object cast to the specified type.
@throws NullPointerException if the object is {@code null}
@throws IllegalArgumentException if the object is of the wrong type
|
[
"Returns",
"an",
"object",
"cast",
"to",
"the",
"specified",
"type",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java#L320-L324
|
5,404 |
subinkrishna/CircularImageView
|
circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java
|
CircularImageView.setBorderWidth
|
public final void setBorderWidth(int unit,
int size) {
if (size < 0) {
throw new IllegalArgumentException("Border width cannot be less than zero.");
}
int scaledSize = (int) TypedValue.applyDimension(unit, size, getResources().getDisplayMetrics());
setBorderInternal(scaledSize, mBorderColor, true);
}
|
java
|
public final void setBorderWidth(int unit,
int size) {
if (size < 0) {
throw new IllegalArgumentException("Border width cannot be less than zero.");
}
int scaledSize = (int) TypedValue.applyDimension(unit, size, getResources().getDisplayMetrics());
setBorderInternal(scaledSize, mBorderColor, true);
}
|
[
"public",
"final",
"void",
"setBorderWidth",
"(",
"int",
"unit",
",",
"int",
"size",
")",
"{",
"if",
"(",
"size",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Border width cannot be less than zero.\"",
")",
";",
"}",
"int",
"scaledSize",
"=",
"(",
"int",
")",
"TypedValue",
".",
"applyDimension",
"(",
"unit",
",",
"size",
",",
"getResources",
"(",
")",
".",
"getDisplayMetrics",
"(",
")",
")",
";",
"setBorderInternal",
"(",
"scaledSize",
",",
"mBorderColor",
",",
"true",
")",
";",
"}"
] |
Sets the border width.
@param unit The desired dimension unit.
@param size
|
[
"Sets",
"the",
"border",
"width",
"."
] |
b3033a79f4f831c0a7c2567cc52f63b8410198a2
|
https://github.com/subinkrishna/CircularImageView/blob/b3033a79f4f831c0a7c2567cc52f63b8410198a2/circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java#L337-L345
|
5,405 |
subinkrishna/CircularImageView
|
circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java
|
CircularImageView.setPlaceholder
|
public final void setPlaceholder(String text) {
if (!text.equalsIgnoreCase(mText)) {
setPlaceholderTextInternal(text, mTextColor, mTextSize, true);
}
}
|
java
|
public final void setPlaceholder(String text) {
if (!text.equalsIgnoreCase(mText)) {
setPlaceholderTextInternal(text, mTextColor, mTextSize, true);
}
}
|
[
"public",
"final",
"void",
"setPlaceholder",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"!",
"text",
".",
"equalsIgnoreCase",
"(",
"mText",
")",
")",
"{",
"setPlaceholderTextInternal",
"(",
"text",
",",
"mTextColor",
",",
"mTextSize",
",",
"true",
")",
";",
"}",
"}"
] |
Sets the placeholder text.
@param text
|
[
"Sets",
"the",
"placeholder",
"text",
"."
] |
b3033a79f4f831c0a7c2567cc52f63b8410198a2
|
https://github.com/subinkrishna/CircularImageView/blob/b3033a79f4f831c0a7c2567cc52f63b8410198a2/circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java#L380-L384
|
5,406 |
subinkrishna/CircularImageView
|
circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java
|
CircularImageView.setPlaceholderTextSize
|
public final void setPlaceholderTextSize(int unit,
int size) {
if (size < 0) {
throw new IllegalArgumentException("Text size cannot be less than zero.");
}
int scaledSize = (int) TypedValue.applyDimension(unit, size, getResources().getDisplayMetrics());
setPlaceholderTextInternal(mText, mTextColor, scaledSize, true);
}
|
java
|
public final void setPlaceholderTextSize(int unit,
int size) {
if (size < 0) {
throw new IllegalArgumentException("Text size cannot be less than zero.");
}
int scaledSize = (int) TypedValue.applyDimension(unit, size, getResources().getDisplayMetrics());
setPlaceholderTextInternal(mText, mTextColor, scaledSize, true);
}
|
[
"public",
"final",
"void",
"setPlaceholderTextSize",
"(",
"int",
"unit",
",",
"int",
"size",
")",
"{",
"if",
"(",
"size",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Text size cannot be less than zero.\"",
")",
";",
"}",
"int",
"scaledSize",
"=",
"(",
"int",
")",
"TypedValue",
".",
"applyDimension",
"(",
"unit",
",",
"size",
",",
"getResources",
"(",
")",
".",
"getDisplayMetrics",
"(",
")",
")",
";",
"setPlaceholderTextInternal",
"(",
"mText",
",",
"mTextColor",
",",
"scaledSize",
",",
"true",
")",
";",
"}"
] |
Sets the placeholder text size.
@param unit The desired dimension unit.
@param size
|
[
"Sets",
"the",
"placeholder",
"text",
"size",
"."
] |
b3033a79f4f831c0a7c2567cc52f63b8410198a2
|
https://github.com/subinkrishna/CircularImageView/blob/b3033a79f4f831c0a7c2567cc52f63b8410198a2/circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java#L392-L400
|
5,407 |
subinkrishna/CircularImageView
|
circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java
|
CircularImageView.setShadowRadius
|
public void setShadowRadius(float radius) {
if (radius < 0) {
throw new IllegalArgumentException("Shadow radius cannot be less than zero.");
}
if (radius != mShadowRadius) {
setShadowInternal(radius, mShadowColor, true);
}
}
|
java
|
public void setShadowRadius(float radius) {
if (radius < 0) {
throw new IllegalArgumentException("Shadow radius cannot be less than zero.");
}
if (radius != mShadowRadius) {
setShadowInternal(radius, mShadowColor, true);
}
}
|
[
"public",
"void",
"setShadowRadius",
"(",
"float",
"radius",
")",
"{",
"if",
"(",
"radius",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Shadow radius cannot be less than zero.\"",
")",
";",
"}",
"if",
"(",
"radius",
"!=",
"mShadowRadius",
")",
"{",
"setShadowInternal",
"(",
"radius",
",",
"mShadowColor",
",",
"true",
")",
";",
"}",
"}"
] |
Sets shadow radius
@param radius
|
[
"Sets",
"shadow",
"radius"
] |
b3033a79f4f831c0a7c2567cc52f63b8410198a2
|
https://github.com/subinkrishna/CircularImageView/blob/b3033a79f4f831c0a7c2567cc52f63b8410198a2/circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java#L448-L456
|
5,408 |
subinkrishna/CircularImageView
|
circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java
|
CircularImageView.allowCheckStateShadow
|
public void allowCheckStateShadow(boolean allow) {
if (allow != mAllowCheckStateShadow) {
mAllowCheckStateShadow = allow;
setShadowInternal(mShadowRadius, mShadowColor, true);
}
}
|
java
|
public void allowCheckStateShadow(boolean allow) {
if (allow != mAllowCheckStateShadow) {
mAllowCheckStateShadow = allow;
setShadowInternal(mShadowRadius, mShadowColor, true);
}
}
|
[
"public",
"void",
"allowCheckStateShadow",
"(",
"boolean",
"allow",
")",
"{",
"if",
"(",
"allow",
"!=",
"mAllowCheckStateShadow",
")",
"{",
"mAllowCheckStateShadow",
"=",
"allow",
";",
"setShadowInternal",
"(",
"mShadowRadius",
",",
"mShadowColor",
",",
"true",
")",
";",
"}",
"}"
] |
Allow shadow when in checked state.
@param allow
|
[
"Allow",
"shadow",
"when",
"in",
"checked",
"state",
"."
] |
b3033a79f4f831c0a7c2567cc52f63b8410198a2
|
https://github.com/subinkrishna/CircularImageView/blob/b3033a79f4f831c0a7c2567cc52f63b8410198a2/circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java#L474-L479
|
5,409 |
subinkrishna/CircularImageView
|
circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java
|
CircularImageView.formatPlaceholderText
|
protected String formatPlaceholderText(String text) {
String formattedText = (null != text) ? text.trim() : null;
int length = (null != formattedText) ? formattedText.length() : 0;
if (length > 0) {
return formattedText.substring(0, Math.min(2, length)).toUpperCase(Locale.getDefault());
}
return null;
}
|
java
|
protected String formatPlaceholderText(String text) {
String formattedText = (null != text) ? text.trim() : null;
int length = (null != formattedText) ? formattedText.length() : 0;
if (length > 0) {
return formattedText.substring(0, Math.min(2, length)).toUpperCase(Locale.getDefault());
}
return null;
}
|
[
"protected",
"String",
"formatPlaceholderText",
"(",
"String",
"text",
")",
"{",
"String",
"formattedText",
"=",
"(",
"null",
"!=",
"text",
")",
"?",
"text",
".",
"trim",
"(",
")",
":",
"null",
";",
"int",
"length",
"=",
"(",
"null",
"!=",
"formattedText",
")",
"?",
"formattedText",
".",
"length",
"(",
")",
":",
"0",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"return",
"formattedText",
".",
"substring",
"(",
"0",
",",
"Math",
".",
"min",
"(",
"2",
",",
"length",
")",
")",
".",
"toUpperCase",
"(",
"Locale",
".",
"getDefault",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Default implementation of the placeholder text formatting.
@param text
@return
|
[
"Default",
"implementation",
"of",
"the",
"placeholder",
"text",
"formatting",
"."
] |
b3033a79f4f831c0a7c2567cc52f63b8410198a2
|
https://github.com/subinkrishna/CircularImageView/blob/b3033a79f4f831c0a7c2567cc52f63b8410198a2/circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java#L487-L494
|
5,410 |
subinkrishna/CircularImageView
|
circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java
|
CircularImageView.drawCheckedState
|
protected void drawCheckedState(Canvas canvas, int w, int h) {
int x = w / 2;
int y = h / 2;
canvas.drawCircle(x, y,
mRadius - (mShadowRadius * 1.5f),
mCheckedBackgroundPaint);
canvas.save();
int shortStrokeHeight = (int) (mLongStrokeHeight * .4f);
int halfH = (int) (mLongStrokeHeight * .5f);
int offset = (int)(shortStrokeHeight * .3f);
int sx = x + offset;
int sy = y - offset;
mPath.reset();
mPath.moveTo(sx, sy - halfH);
mPath.lineTo(sx, sy + halfH); // draw long stroke
mPath.moveTo(sx + (getCheckMarkStrokeWidthInPixels() * .5f), sy + halfH);
mPath.lineTo(sx - shortStrokeHeight, sy + halfH); // draw short stroke
// Rotates the canvas to draw an angled check mark
canvas.rotate(45f, x, y);
canvas.drawPath(mPath, mCheckMarkPaint);
// Restore the canvas to previously saved state
canvas.restore();
}
|
java
|
protected void drawCheckedState(Canvas canvas, int w, int h) {
int x = w / 2;
int y = h / 2;
canvas.drawCircle(x, y,
mRadius - (mShadowRadius * 1.5f),
mCheckedBackgroundPaint);
canvas.save();
int shortStrokeHeight = (int) (mLongStrokeHeight * .4f);
int halfH = (int) (mLongStrokeHeight * .5f);
int offset = (int)(shortStrokeHeight * .3f);
int sx = x + offset;
int sy = y - offset;
mPath.reset();
mPath.moveTo(sx, sy - halfH);
mPath.lineTo(sx, sy + halfH); // draw long stroke
mPath.moveTo(sx + (getCheckMarkStrokeWidthInPixels() * .5f), sy + halfH);
mPath.lineTo(sx - shortStrokeHeight, sy + halfH); // draw short stroke
// Rotates the canvas to draw an angled check mark
canvas.rotate(45f, x, y);
canvas.drawPath(mPath, mCheckMarkPaint);
// Restore the canvas to previously saved state
canvas.restore();
}
|
[
"protected",
"void",
"drawCheckedState",
"(",
"Canvas",
"canvas",
",",
"int",
"w",
",",
"int",
"h",
")",
"{",
"int",
"x",
"=",
"w",
"/",
"2",
";",
"int",
"y",
"=",
"h",
"/",
"2",
";",
"canvas",
".",
"drawCircle",
"(",
"x",
",",
"y",
",",
"mRadius",
"-",
"(",
"mShadowRadius",
"*",
"1.5f",
")",
",",
"mCheckedBackgroundPaint",
")",
";",
"canvas",
".",
"save",
"(",
")",
";",
"int",
"shortStrokeHeight",
"=",
"(",
"int",
")",
"(",
"mLongStrokeHeight",
"*",
".4f",
")",
";",
"int",
"halfH",
"=",
"(",
"int",
")",
"(",
"mLongStrokeHeight",
"*",
".5f",
")",
";",
"int",
"offset",
"=",
"(",
"int",
")",
"(",
"shortStrokeHeight",
"*",
".3f",
")",
";",
"int",
"sx",
"=",
"x",
"+",
"offset",
";",
"int",
"sy",
"=",
"y",
"-",
"offset",
";",
"mPath",
".",
"reset",
"(",
")",
";",
"mPath",
".",
"moveTo",
"(",
"sx",
",",
"sy",
"-",
"halfH",
")",
";",
"mPath",
".",
"lineTo",
"(",
"sx",
",",
"sy",
"+",
"halfH",
")",
";",
"// draw long stroke",
"mPath",
".",
"moveTo",
"(",
"sx",
"+",
"(",
"getCheckMarkStrokeWidthInPixels",
"(",
")",
"*",
".5f",
")",
",",
"sy",
"+",
"halfH",
")",
";",
"mPath",
".",
"lineTo",
"(",
"sx",
"-",
"shortStrokeHeight",
",",
"sy",
"+",
"halfH",
")",
";",
"// draw short stroke",
"// Rotates the canvas to draw an angled check mark",
"canvas",
".",
"rotate",
"(",
"45f",
",",
"x",
",",
"y",
")",
";",
"canvas",
".",
"drawPath",
"(",
"mPath",
",",
"mCheckMarkPaint",
")",
";",
"// Restore the canvas to previously saved state",
"canvas",
".",
"restore",
"(",
")",
";",
"}"
] |
Draws the checked state.
@param canvas
@param w
@param h
|
[
"Draws",
"the",
"checked",
"state",
"."
] |
b3033a79f4f831c0a7c2567cc52f63b8410198a2
|
https://github.com/subinkrishna/CircularImageView/blob/b3033a79f4f831c0a7c2567cc52f63b8410198a2/circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java#L592-L617
|
5,411 |
subinkrishna/CircularImageView
|
circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java
|
CircularImageView.updateBitmapShader
|
private void updateBitmapShader() {
Drawable drawable = getDrawable();
Bitmap bitmap = null;
if ((null != drawable) && (drawable instanceof BitmapDrawable)) {
bitmap = ((BitmapDrawable) drawable).getBitmap();
}
// Clear the shader & abort is the new bitmap is null
if (null == bitmap) {
mBitmapPaint.setShader(null);
return;
}
int bitmapWidth = bitmap.getWidth();
int bitmapHeight = bitmap.getHeight();
float x = 0, y = 0;
int diameter = mRadius * 2;
// Offset takes the border width in to account when calculating the the scale
int borderWidth = shouldDrawBorder() ? mBorderWidth : 0;
int offset = (borderWidth > 0) ? (borderWidth * 2) : 0;
// Consider shadow too
offset += mShadowRadius * 1.5f;
float scale = (float) (diameter - offset) / (float) Math.min(bitmapHeight, bitmapWidth);
x = (mWidth - bitmapWidth * scale) * 0.5f;
y = (mHeight - bitmapHeight * scale) * 0.5f;
// Apply scale and translation to matrix
Matrix matrix = new Matrix();
matrix.setScale(scale, scale);
matrix.postTranslate(Math.round(x), Math.round(y));
// Create the BitmapShader and apply the Matrix
BitmapShader shader = new BitmapShader(bitmap,
Shader.TileMode.CLAMP,
Shader.TileMode.CLAMP);
shader.setLocalMatrix(matrix);
mBitmapPaint.setShader(shader);
}
|
java
|
private void updateBitmapShader() {
Drawable drawable = getDrawable();
Bitmap bitmap = null;
if ((null != drawable) && (drawable instanceof BitmapDrawable)) {
bitmap = ((BitmapDrawable) drawable).getBitmap();
}
// Clear the shader & abort is the new bitmap is null
if (null == bitmap) {
mBitmapPaint.setShader(null);
return;
}
int bitmapWidth = bitmap.getWidth();
int bitmapHeight = bitmap.getHeight();
float x = 0, y = 0;
int diameter = mRadius * 2;
// Offset takes the border width in to account when calculating the the scale
int borderWidth = shouldDrawBorder() ? mBorderWidth : 0;
int offset = (borderWidth > 0) ? (borderWidth * 2) : 0;
// Consider shadow too
offset += mShadowRadius * 1.5f;
float scale = (float) (diameter - offset) / (float) Math.min(bitmapHeight, bitmapWidth);
x = (mWidth - bitmapWidth * scale) * 0.5f;
y = (mHeight - bitmapHeight * scale) * 0.5f;
// Apply scale and translation to matrix
Matrix matrix = new Matrix();
matrix.setScale(scale, scale);
matrix.postTranslate(Math.round(x), Math.round(y));
// Create the BitmapShader and apply the Matrix
BitmapShader shader = new BitmapShader(bitmap,
Shader.TileMode.CLAMP,
Shader.TileMode.CLAMP);
shader.setLocalMatrix(matrix);
mBitmapPaint.setShader(shader);
}
|
[
"private",
"void",
"updateBitmapShader",
"(",
")",
"{",
"Drawable",
"drawable",
"=",
"getDrawable",
"(",
")",
";",
"Bitmap",
"bitmap",
"=",
"null",
";",
"if",
"(",
"(",
"null",
"!=",
"drawable",
")",
"&&",
"(",
"drawable",
"instanceof",
"BitmapDrawable",
")",
")",
"{",
"bitmap",
"=",
"(",
"(",
"BitmapDrawable",
")",
"drawable",
")",
".",
"getBitmap",
"(",
")",
";",
"}",
"// Clear the shader & abort is the new bitmap is null",
"if",
"(",
"null",
"==",
"bitmap",
")",
"{",
"mBitmapPaint",
".",
"setShader",
"(",
"null",
")",
";",
"return",
";",
"}",
"int",
"bitmapWidth",
"=",
"bitmap",
".",
"getWidth",
"(",
")",
";",
"int",
"bitmapHeight",
"=",
"bitmap",
".",
"getHeight",
"(",
")",
";",
"float",
"x",
"=",
"0",
",",
"y",
"=",
"0",
";",
"int",
"diameter",
"=",
"mRadius",
"*",
"2",
";",
"// Offset takes the border width in to account when calculating the the scale",
"int",
"borderWidth",
"=",
"shouldDrawBorder",
"(",
")",
"?",
"mBorderWidth",
":",
"0",
";",
"int",
"offset",
"=",
"(",
"borderWidth",
">",
"0",
")",
"?",
"(",
"borderWidth",
"*",
"2",
")",
":",
"0",
";",
"// Consider shadow too",
"offset",
"+=",
"mShadowRadius",
"*",
"1.5f",
";",
"float",
"scale",
"=",
"(",
"float",
")",
"(",
"diameter",
"-",
"offset",
")",
"/",
"(",
"float",
")",
"Math",
".",
"min",
"(",
"bitmapHeight",
",",
"bitmapWidth",
")",
";",
"x",
"=",
"(",
"mWidth",
"-",
"bitmapWidth",
"*",
"scale",
")",
"*",
"0.5f",
";",
"y",
"=",
"(",
"mHeight",
"-",
"bitmapHeight",
"*",
"scale",
")",
"*",
"0.5f",
";",
"// Apply scale and translation to matrix",
"Matrix",
"matrix",
"=",
"new",
"Matrix",
"(",
")",
";",
"matrix",
".",
"setScale",
"(",
"scale",
",",
"scale",
")",
";",
"matrix",
".",
"postTranslate",
"(",
"Math",
".",
"round",
"(",
"x",
")",
",",
"Math",
".",
"round",
"(",
"y",
")",
")",
";",
"// Create the BitmapShader and apply the Matrix",
"BitmapShader",
"shader",
"=",
"new",
"BitmapShader",
"(",
"bitmap",
",",
"Shader",
".",
"TileMode",
".",
"CLAMP",
",",
"Shader",
".",
"TileMode",
".",
"CLAMP",
")",
";",
"shader",
".",
"setLocalMatrix",
"(",
"matrix",
")",
";",
"mBitmapPaint",
".",
"setShader",
"(",
"shader",
")",
";",
"}"
] |
Updates BitmapShader to draw the bitmap in CENTER_CROP mode.
|
[
"Updates",
"BitmapShader",
"to",
"draw",
"the",
"bitmap",
"in",
"CENTER_CROP",
"mode",
"."
] |
b3033a79f4f831c0a7c2567cc52f63b8410198a2
|
https://github.com/subinkrishna/CircularImageView/blob/b3033a79f4f831c0a7c2567cc52f63b8410198a2/circularimageview/src/main/java/com/subinkrishna/widget/CircularImageView.java#L622-L660
|
5,412 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java
|
JavacTrees.getOriginalType
|
@Override @DefinedBy(Api.COMPILER_TREE)
public TypeMirror getOriginalType(javax.lang.model.type.ErrorType errorType) {
if (errorType instanceof com.sun.tools.javac.code.Type.ErrorType) {
return ((com.sun.tools.javac.code.Type.ErrorType)errorType).getOriginalType();
}
return com.sun.tools.javac.code.Type.noType;
}
|
java
|
@Override @DefinedBy(Api.COMPILER_TREE)
public TypeMirror getOriginalType(javax.lang.model.type.ErrorType errorType) {
if (errorType instanceof com.sun.tools.javac.code.Type.ErrorType) {
return ((com.sun.tools.javac.code.Type.ErrorType)errorType).getOriginalType();
}
return com.sun.tools.javac.code.Type.noType;
}
|
[
"@",
"Override",
"@",
"DefinedBy",
"(",
"Api",
".",
"COMPILER_TREE",
")",
"public",
"TypeMirror",
"getOriginalType",
"(",
"javax",
".",
"lang",
".",
"model",
".",
"type",
".",
"ErrorType",
"errorType",
")",
"{",
"if",
"(",
"errorType",
"instanceof",
"com",
".",
"sun",
".",
"tools",
".",
"javac",
".",
"code",
".",
"Type",
".",
"ErrorType",
")",
"{",
"return",
"(",
"(",
"com",
".",
"sun",
".",
"tools",
".",
"javac",
".",
"code",
".",
"Type",
".",
"ErrorType",
")",
"errorType",
")",
".",
"getOriginalType",
"(",
")",
";",
"}",
"return",
"com",
".",
"sun",
".",
"tools",
".",
"javac",
".",
"code",
".",
"Type",
".",
"noType",
";",
"}"
] |
Returns the original type from the ErrorType object.
@param errorType The errorType for which we want to get the original type.
@return TypeMirror corresponding to the original type, replaced by the ErrorType.
noType (type.tag == NONE) is returned if there is no original type.
|
[
"Returns",
"the",
"original",
"type",
"from",
"the",
"ErrorType",
"object",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java#L1083-L1090
|
5,413 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java
|
JavacTrees.printMessage
|
@Override @DefinedBy(Api.COMPILER_TREE)
public void printMessage(Diagnostic.Kind kind, CharSequence msg,
com.sun.source.tree.Tree t,
com.sun.source.tree.CompilationUnitTree root) {
printMessage(kind, msg, ((JCTree) t).pos(), root);
}
|
java
|
@Override @DefinedBy(Api.COMPILER_TREE)
public void printMessage(Diagnostic.Kind kind, CharSequence msg,
com.sun.source.tree.Tree t,
com.sun.source.tree.CompilationUnitTree root) {
printMessage(kind, msg, ((JCTree) t).pos(), root);
}
|
[
"@",
"Override",
"@",
"DefinedBy",
"(",
"Api",
".",
"COMPILER_TREE",
")",
"public",
"void",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
"kind",
",",
"CharSequence",
"msg",
",",
"com",
".",
"sun",
".",
"source",
".",
"tree",
".",
"Tree",
"t",
",",
"com",
".",
"sun",
".",
"source",
".",
"tree",
".",
"CompilationUnitTree",
"root",
")",
"{",
"printMessage",
"(",
"kind",
",",
"msg",
",",
"(",
"(",
"JCTree",
")",
"t",
")",
".",
"pos",
"(",
")",
",",
"root",
")",
";",
"}"
] |
Prints a message of the specified kind at the location of the
tree within the provided compilation unit
@param kind the kind of message
@param msg the message, or an empty string if none
@param t the tree to use as a position hint
@param root the compilation unit that contains tree
|
[
"Prints",
"a",
"message",
"of",
"the",
"specified",
"kind",
"at",
"the",
"location",
"of",
"the",
"tree",
"within",
"the",
"provided",
"compilation",
"unit"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java#L1101-L1106
|
5,414 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java
|
ArgumentAttr.setResult
|
void setResult(JCExpression tree, Type type) {
result = type;
if (env.info.isSpeculative) {
//if we are in a speculative branch we can save the type in the tree itself
//as there's no risk of polluting the original tree.
tree.type = result;
}
}
|
java
|
void setResult(JCExpression tree, Type type) {
result = type;
if (env.info.isSpeculative) {
//if we are in a speculative branch we can save the type in the tree itself
//as there's no risk of polluting the original tree.
tree.type = result;
}
}
|
[
"void",
"setResult",
"(",
"JCExpression",
"tree",
",",
"Type",
"type",
")",
"{",
"result",
"=",
"type",
";",
"if",
"(",
"env",
".",
"info",
".",
"isSpeculative",
")",
"{",
"//if we are in a speculative branch we can save the type in the tree itself",
"//as there's no risk of polluting the original tree.",
"tree",
".",
"type",
"=",
"result",
";",
"}",
"}"
] |
Set the results of method attribution.
|
[
"Set",
"the",
"results",
"of",
"method",
"attribution",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java#L131-L138
|
5,415 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java
|
ArgumentAttr.attribArg
|
Type attribArg(JCTree tree, Env<AttrContext> env) {
Env<AttrContext> prevEnv = this.env;
try {
this.env = env;
tree.accept(this);
return result;
} finally {
this.env = prevEnv;
}
}
|
java
|
Type attribArg(JCTree tree, Env<AttrContext> env) {
Env<AttrContext> prevEnv = this.env;
try {
this.env = env;
tree.accept(this);
return result;
} finally {
this.env = prevEnv;
}
}
|
[
"Type",
"attribArg",
"(",
"JCTree",
"tree",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"Env",
"<",
"AttrContext",
">",
"prevEnv",
"=",
"this",
".",
"env",
";",
"try",
"{",
"this",
".",
"env",
"=",
"env",
";",
"tree",
".",
"accept",
"(",
"this",
")",
";",
"return",
"result",
";",
"}",
"finally",
"{",
"this",
".",
"env",
"=",
"prevEnv",
";",
"}",
"}"
] |
Main entry point for attributing an argument with given tree and attribution environment.
|
[
"Main",
"entry",
"point",
"for",
"attributing",
"an",
"argument",
"with",
"given",
"tree",
"and",
"attribution",
"environment",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java#L189-L198
|
5,416 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java
|
ArgumentAttr.processArg
|
@SuppressWarnings("unchecked")
<T extends JCExpression, Z extends ArgumentType<T>> void processArg(T that, Function<T, Z> argumentTypeFactory) {
UniquePos pos = new UniquePos(that);
processArg(that, () -> {
T speculativeTree = (T)deferredAttr.attribSpeculative(that, env, attr.new MethodAttrInfo() {
@Override
protected boolean needsArgumentAttr(JCTree tree) {
return !new UniquePos(tree).equals(pos);
}
});
return argumentTypeFactory.apply(speculativeTree);
});
}
|
java
|
@SuppressWarnings("unchecked")
<T extends JCExpression, Z extends ArgumentType<T>> void processArg(T that, Function<T, Z> argumentTypeFactory) {
UniquePos pos = new UniquePos(that);
processArg(that, () -> {
T speculativeTree = (T)deferredAttr.attribSpeculative(that, env, attr.new MethodAttrInfo() {
@Override
protected boolean needsArgumentAttr(JCTree tree) {
return !new UniquePos(tree).equals(pos);
}
});
return argumentTypeFactory.apply(speculativeTree);
});
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"<",
"T",
"extends",
"JCExpression",
",",
"Z",
"extends",
"ArgumentType",
"<",
"T",
">",
">",
"void",
"processArg",
"(",
"T",
"that",
",",
"Function",
"<",
"T",
",",
"Z",
">",
"argumentTypeFactory",
")",
"{",
"UniquePos",
"pos",
"=",
"new",
"UniquePos",
"(",
"that",
")",
";",
"processArg",
"(",
"that",
",",
"(",
")",
"->",
"{",
"T",
"speculativeTree",
"=",
"(",
"T",
")",
"deferredAttr",
".",
"attribSpeculative",
"(",
"that",
",",
"env",
",",
"attr",
".",
"new",
"MethodAttrInfo",
"(",
")",
"{",
"@",
"Override",
"protected",
"boolean",
"needsArgumentAttr",
"(",
"JCTree",
"tree",
")",
"{",
"return",
"!",
"new",
"UniquePos",
"(",
"tree",
")",
".",
"equals",
"(",
"pos",
")",
";",
"}",
"}",
")",
";",
"return",
"argumentTypeFactory",
".",
"apply",
"(",
"speculativeTree",
")",
";",
"}",
")",
";",
"}"
] |
Process a method argument; this method takes care of performing a speculative pass over the
argument tree and calling a well-defined entry point to build the argument type associated
with such tree.
|
[
"Process",
"a",
"method",
"argument",
";",
"this",
"method",
"takes",
"care",
"of",
"performing",
"a",
"speculative",
"pass",
"over",
"the",
"argument",
"tree",
"and",
"calling",
"a",
"well",
"-",
"defined",
"entry",
"point",
"to",
"build",
"the",
"argument",
"type",
"associated",
"with",
"such",
"tree",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java#L212-L224
|
5,417 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java
|
ModuleInfoBuilder.descriptors
|
public Stream<ModuleDescriptor> descriptors() {
return automaticToNormalModule.entrySet().stream()
.map(Map.Entry::getValue)
.map(Module::descriptor);
}
|
java
|
public Stream<ModuleDescriptor> descriptors() {
return automaticToNormalModule.entrySet().stream()
.map(Map.Entry::getValue)
.map(Module::descriptor);
}
|
[
"public",
"Stream",
"<",
"ModuleDescriptor",
">",
"descriptors",
"(",
")",
"{",
"return",
"automaticToNormalModule",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"Map",
".",
"Entry",
"::",
"getValue",
")",
".",
"map",
"(",
"Module",
"::",
"descriptor",
")",
";",
"}"
] |
Returns the stream of resulting ModuleDescriptors
|
[
"Returns",
"the",
"stream",
"of",
"resulting",
"ModuleDescriptors"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java#L177-L181
|
5,418 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java
|
ModuleInfoBuilder.computeRequiresTransitive
|
private Map<Archive, Set<Archive>> computeRequiresTransitive()
throws IOException
{
// parse the input modules
dependencyFinder.parseExportedAPIs(automaticModules().stream());
return dependencyFinder.dependences();
}
|
java
|
private Map<Archive, Set<Archive>> computeRequiresTransitive()
throws IOException
{
// parse the input modules
dependencyFinder.parseExportedAPIs(automaticModules().stream());
return dependencyFinder.dependences();
}
|
[
"private",
"Map",
"<",
"Archive",
",",
"Set",
"<",
"Archive",
">",
">",
"computeRequiresTransitive",
"(",
")",
"throws",
"IOException",
"{",
"// parse the input modules",
"dependencyFinder",
".",
"parseExportedAPIs",
"(",
"automaticModules",
"(",
")",
".",
"stream",
"(",
")",
")",
";",
"return",
"dependencyFinder",
".",
"dependences",
"(",
")",
";",
"}"
] |
Compute 'requires transitive' dependences by analyzing API dependencies
|
[
"Compute",
"requires",
"transitive",
"dependences",
"by",
"analyzing",
"API",
"dependencies"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java#L277-L284
|
5,419 |
google/error-prone-javac
|
make/tools/propertiesparser/gen/ClassGenerator.java
|
ClassGenerator.indent
|
String indent(String s, int level) {
return Stream.of(s.split("\n"))
.map(sub -> INDENT_STRING.substring(0, level * INDENT_WIDTH) + sub)
.collect(Collectors.joining("\n"));
}
|
java
|
String indent(String s, int level) {
return Stream.of(s.split("\n"))
.map(sub -> INDENT_STRING.substring(0, level * INDENT_WIDTH) + sub)
.collect(Collectors.joining("\n"));
}
|
[
"String",
"indent",
"(",
"String",
"s",
",",
"int",
"level",
")",
"{",
"return",
"Stream",
".",
"of",
"(",
"s",
".",
"split",
"(",
"\"\\n\"",
")",
")",
".",
"map",
"(",
"sub",
"->",
"INDENT_STRING",
".",
"substring",
"(",
"0",
",",
"level",
"*",
"INDENT_WIDTH",
")",
"+",
"sub",
")",
".",
"collect",
"(",
"Collectors",
".",
"joining",
"(",
"\"\\n\"",
")",
")",
";",
"}"
] |
Indent a string to a given level.
|
[
"Indent",
"a",
"string",
"to",
"a",
"given",
"level",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/gen/ClassGenerator.java#L184-L188
|
5,420 |
google/error-prone-javac
|
make/tools/propertiesparser/gen/ClassGenerator.java
|
ClassGenerator.packageName
|
String packageName(File file) {
String path = file.getAbsolutePath();
int begin = path.lastIndexOf(File.separatorChar + "com" + File.separatorChar);
String packagePath = path.substring(begin + 1, path.lastIndexOf(File.separatorChar));
String packageName = packagePath.replace(File.separatorChar, '.');
return packageName;
}
|
java
|
String packageName(File file) {
String path = file.getAbsolutePath();
int begin = path.lastIndexOf(File.separatorChar + "com" + File.separatorChar);
String packagePath = path.substring(begin + 1, path.lastIndexOf(File.separatorChar));
String packageName = packagePath.replace(File.separatorChar, '.');
return packageName;
}
|
[
"String",
"packageName",
"(",
"File",
"file",
")",
"{",
"String",
"path",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
";",
"int",
"begin",
"=",
"path",
".",
"lastIndexOf",
"(",
"File",
".",
"separatorChar",
"+",
"\"com\"",
"+",
"File",
".",
"separatorChar",
")",
";",
"String",
"packagePath",
"=",
"path",
".",
"substring",
"(",
"begin",
"+",
"1",
",",
"path",
".",
"lastIndexOf",
"(",
"File",
".",
"separatorChar",
")",
")",
";",
"String",
"packageName",
"=",
"packagePath",
".",
"replace",
"(",
"File",
".",
"separatorChar",
",",
"'",
"'",
")",
";",
"return",
"packageName",
";",
"}"
] |
Retrieve package part of given file object.
|
[
"Retrieve",
"package",
"part",
"of",
"given",
"file",
"object",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/gen/ClassGenerator.java#L193-L199
|
5,421 |
google/error-prone-javac
|
make/tools/propertiesparser/gen/ClassGenerator.java
|
ClassGenerator.toplevelName
|
public static String toplevelName(File file) {
return Stream.of(file.getName().split("\\."))
.map(s -> Character.toUpperCase(s.charAt(0)) + s.substring(1))
.collect(Collectors.joining(""));
}
|
java
|
public static String toplevelName(File file) {
return Stream.of(file.getName().split("\\."))
.map(s -> Character.toUpperCase(s.charAt(0)) + s.substring(1))
.collect(Collectors.joining(""));
}
|
[
"public",
"static",
"String",
"toplevelName",
"(",
"File",
"file",
")",
"{",
"return",
"Stream",
".",
"of",
"(",
"file",
".",
"getName",
"(",
")",
".",
"split",
"(",
"\"\\\\.\"",
")",
")",
".",
"map",
"(",
"s",
"->",
"Character",
".",
"toUpperCase",
"(",
"s",
".",
"charAt",
"(",
"0",
")",
")",
"+",
"s",
".",
"substring",
"(",
"1",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"joining",
"(",
"\"\"",
")",
")",
";",
"}"
] |
Form the name of the toplevel factory class.
|
[
"Form",
"the",
"name",
"of",
"the",
"toplevel",
"factory",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/gen/ClassGenerator.java#L204-L208
|
5,422 |
google/error-prone-javac
|
make/tools/propertiesparser/gen/ClassGenerator.java
|
ClassGenerator.generateImports
|
List<String> generateImports(Set<String> importedTypes) {
List<String> importDecls = new ArrayList<>();
for (String it : importedTypes) {
importDecls.add(StubKind.IMPORT.format(it));
}
return importDecls;
}
|
java
|
List<String> generateImports(Set<String> importedTypes) {
List<String> importDecls = new ArrayList<>();
for (String it : importedTypes) {
importDecls.add(StubKind.IMPORT.format(it));
}
return importDecls;
}
|
[
"List",
"<",
"String",
">",
"generateImports",
"(",
"Set",
"<",
"String",
">",
"importedTypes",
")",
"{",
"List",
"<",
"String",
">",
"importDecls",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"it",
":",
"importedTypes",
")",
"{",
"importDecls",
".",
"add",
"(",
"StubKind",
".",
"IMPORT",
".",
"format",
"(",
"it",
")",
")",
";",
"}",
"return",
"importDecls",
";",
"}"
] |
Generate a list of import declarations given a set of imported types.
|
[
"Generate",
"a",
"list",
"of",
"import",
"declarations",
"given",
"a",
"set",
"of",
"imported",
"types",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/gen/ClassGenerator.java#L213-L219
|
5,423 |
google/error-prone-javac
|
make/tools/propertiesparser/gen/ClassGenerator.java
|
ClassGenerator.argDecls
|
List<String> argDecls(List<String> types, List<String> args) {
List<String> argNames = new ArrayList<>();
for (int i = 0 ; i < types.size() ; i++) {
argNames.add(types.get(i) + " " + args.get(i));
}
return argNames;
}
|
java
|
List<String> argDecls(List<String> types, List<String> args) {
List<String> argNames = new ArrayList<>();
for (int i = 0 ; i < types.size() ; i++) {
argNames.add(types.get(i) + " " + args.get(i));
}
return argNames;
}
|
[
"List",
"<",
"String",
">",
"argDecls",
"(",
"List",
"<",
"String",
">",
"types",
",",
"List",
"<",
"String",
">",
"args",
")",
"{",
"List",
"<",
"String",
">",
"argNames",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"argNames",
".",
"add",
"(",
"types",
".",
"get",
"(",
"i",
")",
"+",
"\" \"",
"+",
"args",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"return",
"argNames",
";",
"}"
] |
Generate a formal parameter list given a list of types and names.
|
[
"Generate",
"a",
"formal",
"parameter",
"list",
"given",
"a",
"list",
"of",
"types",
"and",
"names",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/gen/ClassGenerator.java#L275-L281
|
5,424 |
google/error-prone-javac
|
make/tools/propertiesparser/gen/ClassGenerator.java
|
ClassGenerator.argNames
|
List<String> argNames(int size) {
List<String> argNames = new ArrayList<>();
for (int i = 0 ; i < size ; i++) {
argNames.add(StubKind.FACTORY_METHOD_ARG.format(i));
}
return argNames;
}
|
java
|
List<String> argNames(int size) {
List<String> argNames = new ArrayList<>();
for (int i = 0 ; i < size ; i++) {
argNames.add(StubKind.FACTORY_METHOD_ARG.format(i));
}
return argNames;
}
|
[
"List",
"<",
"String",
">",
"argNames",
"(",
"int",
"size",
")",
"{",
"List",
"<",
"String",
">",
"argNames",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"argNames",
".",
"add",
"(",
"StubKind",
".",
"FACTORY_METHOD_ARG",
".",
"format",
"(",
"i",
")",
")",
";",
"}",
"return",
"argNames",
";",
"}"
] |
Generate a list of formal parameter names given a size.
|
[
"Generate",
"a",
"list",
"of",
"formal",
"parameter",
"names",
"given",
"a",
"size",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/gen/ClassGenerator.java#L286-L292
|
5,425 |
google/error-prone-javac
|
make/tools/propertiesparser/gen/ClassGenerator.java
|
ClassGenerator.needsSuppressWarnings
|
boolean needsSuppressWarnings(List<MessageType> msgTypes) {
return msgTypes.stream().anyMatch(t -> t.accept(suppressWarningsVisitor, null));
}
|
java
|
boolean needsSuppressWarnings(List<MessageType> msgTypes) {
return msgTypes.stream().anyMatch(t -> t.accept(suppressWarningsVisitor, null));
}
|
[
"boolean",
"needsSuppressWarnings",
"(",
"List",
"<",
"MessageType",
">",
"msgTypes",
")",
"{",
"return",
"msgTypes",
".",
"stream",
"(",
")",
".",
"anyMatch",
"(",
"t",
"->",
"t",
".",
"accept",
"(",
"suppressWarningsVisitor",
",",
"null",
")",
")",
";",
"}"
] |
See if any of the parsed types in the given list needs warning suppression.
|
[
"See",
"if",
"any",
"of",
"the",
"parsed",
"types",
"in",
"the",
"given",
"list",
"needs",
"warning",
"suppression",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/gen/ClassGenerator.java#L328-L330
|
5,426 |
google/error-prone-javac
|
make/tools/propertiesparser/gen/ClassGenerator.java
|
ClassGenerator.importedTypes
|
Set<String> importedTypes(List<MessageType> msgTypes) {
Set<String> imports = new TreeSet<>();
msgTypes.forEach(t -> t.accept(importVisitor, imports));
return imports;
}
|
java
|
Set<String> importedTypes(List<MessageType> msgTypes) {
Set<String> imports = new TreeSet<>();
msgTypes.forEach(t -> t.accept(importVisitor, imports));
return imports;
}
|
[
"Set",
"<",
"String",
">",
"importedTypes",
"(",
"List",
"<",
"MessageType",
">",
"msgTypes",
")",
"{",
"Set",
"<",
"String",
">",
"imports",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"msgTypes",
".",
"forEach",
"(",
"t",
"->",
"t",
".",
"accept",
"(",
"importVisitor",
",",
"imports",
")",
")",
";",
"return",
"imports",
";",
"}"
] |
Retrieve a list of types that need to be imported, so that the factory body can refer
to the types in the given list using simple names.
|
[
"Retrieve",
"a",
"list",
"of",
"types",
"that",
"need",
"to",
"be",
"imported",
"so",
"that",
"the",
"factory",
"body",
"can",
"refer",
"to",
"the",
"types",
"in",
"the",
"given",
"list",
"using",
"simple",
"names",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/gen/ClassGenerator.java#L364-L368
|
5,427 |
google/error-prone-javac
|
make/tools/propertiesparser/gen/ClassGenerator.java
|
ClassGenerator.normalizeTypes
|
List<List<MessageType>> normalizeTypes(int idx, List<MessageType> msgTypes) {
if (msgTypes.size() == idx) return Collections.singletonList(Collections.emptyList());
MessageType head = msgTypes.get(idx);
List<List<MessageType>> buf = new ArrayList<>();
for (MessageType alternative : head.accept(normalizeVisitor, null)) {
for (List<MessageType> rest : normalizeTypes(idx + 1, msgTypes)) {
List<MessageType> temp = new ArrayList<>(rest);
temp.add(0, alternative);
buf.add(temp);
}
}
return buf;
}
|
java
|
List<List<MessageType>> normalizeTypes(int idx, List<MessageType> msgTypes) {
if (msgTypes.size() == idx) return Collections.singletonList(Collections.emptyList());
MessageType head = msgTypes.get(idx);
List<List<MessageType>> buf = new ArrayList<>();
for (MessageType alternative : head.accept(normalizeVisitor, null)) {
for (List<MessageType> rest : normalizeTypes(idx + 1, msgTypes)) {
List<MessageType> temp = new ArrayList<>(rest);
temp.add(0, alternative);
buf.add(temp);
}
}
return buf;
}
|
[
"List",
"<",
"List",
"<",
"MessageType",
">",
">",
"normalizeTypes",
"(",
"int",
"idx",
",",
"List",
"<",
"MessageType",
">",
"msgTypes",
")",
"{",
"if",
"(",
"msgTypes",
".",
"size",
"(",
")",
"==",
"idx",
")",
"return",
"Collections",
".",
"singletonList",
"(",
"Collections",
".",
"emptyList",
"(",
")",
")",
";",
"MessageType",
"head",
"=",
"msgTypes",
".",
"get",
"(",
"idx",
")",
";",
"List",
"<",
"List",
"<",
"MessageType",
">",
">",
"buf",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"MessageType",
"alternative",
":",
"head",
".",
"accept",
"(",
"normalizeVisitor",
",",
"null",
")",
")",
"{",
"for",
"(",
"List",
"<",
"MessageType",
">",
"rest",
":",
"normalizeTypes",
"(",
"idx",
"+",
"1",
",",
"msgTypes",
")",
")",
"{",
"List",
"<",
"MessageType",
">",
"temp",
"=",
"new",
"ArrayList",
"<>",
"(",
"rest",
")",
";",
"temp",
".",
"add",
"(",
"0",
",",
"alternative",
")",
";",
"buf",
".",
"add",
"(",
"temp",
")",
";",
"}",
"}",
"return",
"buf",
";",
"}"
] |
Normalize parsed types in a comment line. If one or more types in the line contains alternatives,
this routine generate a list of 'overloaded' normalized signatures.
|
[
"Normalize",
"parsed",
"types",
"in",
"a",
"comment",
"line",
".",
"If",
"one",
"or",
"more",
"types",
"in",
"the",
"line",
"contains",
"alternatives",
"this",
"routine",
"generate",
"a",
"list",
"of",
"overloaded",
"normalized",
"signatures",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/tools/propertiesparser/gen/ClassGenerator.java#L403-L415
|
5,428 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.lookupClass
|
public ClassDocImpl lookupClass(String name) {
ClassSymbol c = getClassSymbol(name);
if (c != null) {
return getClassDoc(c);
} else {
return null;
}
}
|
java
|
public ClassDocImpl lookupClass(String name) {
ClassSymbol c = getClassSymbol(name);
if (c != null) {
return getClassDoc(c);
} else {
return null;
}
}
|
[
"public",
"ClassDocImpl",
"lookupClass",
"(",
"String",
"name",
")",
"{",
"ClassSymbol",
"c",
"=",
"getClassSymbol",
"(",
"name",
")",
";",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"return",
"getClassDoc",
"(",
"c",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
Look up ClassDoc by qualified name.
|
[
"Look",
"up",
"ClassDoc",
"by",
"qualified",
"name",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L178-L185
|
5,429 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.setLocale
|
public void setLocale(String localeName) {
// create locale specifics
doclocale = new DocLocale(this, localeName, breakiterator);
// update Messager if locale has changed.
messager.setLocale(doclocale.locale);
}
|
java
|
public void setLocale(String localeName) {
// create locale specifics
doclocale = new DocLocale(this, localeName, breakiterator);
// update Messager if locale has changed.
messager.setLocale(doclocale.locale);
}
|
[
"public",
"void",
"setLocale",
"(",
"String",
"localeName",
")",
"{",
"// create locale specifics",
"doclocale",
"=",
"new",
"DocLocale",
"(",
"this",
",",
"localeName",
",",
"breakiterator",
")",
";",
"// update Messager if locale has changed.",
"messager",
".",
"setLocale",
"(",
"doclocale",
".",
"locale",
")",
";",
"}"
] |
Set the locale.
|
[
"Set",
"the",
"locale",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L246-L251
|
5,430 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.shouldDocument
|
public boolean shouldDocument(VarSymbol sym) {
long mod = sym.flags();
if ((mod & Flags.SYNTHETIC) != 0) {
return false;
}
return showAccess.checkModifier(translateModifiers(mod));
}
|
java
|
public boolean shouldDocument(VarSymbol sym) {
long mod = sym.flags();
if ((mod & Flags.SYNTHETIC) != 0) {
return false;
}
return showAccess.checkModifier(translateModifiers(mod));
}
|
[
"public",
"boolean",
"shouldDocument",
"(",
"VarSymbol",
"sym",
")",
"{",
"long",
"mod",
"=",
"sym",
".",
"flags",
"(",
")",
";",
"if",
"(",
"(",
"mod",
"&",
"Flags",
".",
"SYNTHETIC",
")",
"!=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"return",
"showAccess",
".",
"checkModifier",
"(",
"translateModifiers",
"(",
"mod",
")",
")",
";",
"}"
] |
Check whether this member should be documented.
|
[
"Check",
"whether",
"this",
"member",
"should",
"be",
"documented",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L254-L262
|
5,431 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.shouldDocument
|
public boolean shouldDocument(ClassSymbol sym) {
return
(sym.flags_field&Flags.SYNTHETIC) == 0 && // no synthetics
(docClasses || getClassDoc(sym).tree != null) &&
isVisible(sym);
}
|
java
|
public boolean shouldDocument(ClassSymbol sym) {
return
(sym.flags_field&Flags.SYNTHETIC) == 0 && // no synthetics
(docClasses || getClassDoc(sym).tree != null) &&
isVisible(sym);
}
|
[
"public",
"boolean",
"shouldDocument",
"(",
"ClassSymbol",
"sym",
")",
"{",
"return",
"(",
"sym",
".",
"flags_field",
"&",
"Flags",
".",
"SYNTHETIC",
")",
"==",
"0",
"&&",
"// no synthetics",
"(",
"docClasses",
"||",
"getClassDoc",
"(",
"sym",
")",
".",
"tree",
"!=",
"null",
")",
"&&",
"isVisible",
"(",
"sym",
")",
";",
"}"
] |
check whether this class should be documented.
|
[
"check",
"whether",
"this",
"class",
"should",
"be",
"documented",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L276-L281
|
5,432 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.getPackageDoc
|
public PackageDocImpl getPackageDoc(PackageSymbol pack) {
PackageDocImpl result = packageMap.get(pack);
if (result != null) return result;
result = new PackageDocImpl(this, pack);
packageMap.put(pack, result);
return result;
}
|
java
|
public PackageDocImpl getPackageDoc(PackageSymbol pack) {
PackageDocImpl result = packageMap.get(pack);
if (result != null) return result;
result = new PackageDocImpl(this, pack);
packageMap.put(pack, result);
return result;
}
|
[
"public",
"PackageDocImpl",
"getPackageDoc",
"(",
"PackageSymbol",
"pack",
")",
"{",
"PackageDocImpl",
"result",
"=",
"packageMap",
".",
"get",
"(",
"pack",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"return",
"result",
";",
"result",
"=",
"new",
"PackageDocImpl",
"(",
"this",
",",
"pack",
")",
";",
"packageMap",
".",
"put",
"(",
"pack",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Return the PackageDoc of this package symbol.
|
[
"Return",
"the",
"PackageDoc",
"of",
"this",
"package",
"symbol",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L569-L575
|
5,433 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.getFieldDoc
|
public FieldDocImpl getFieldDoc(VarSymbol var) {
FieldDocImpl result = fieldMap.get(var);
if (result != null) return result;
result = new FieldDocImpl(this, var);
fieldMap.put(var, result);
return result;
}
|
java
|
public FieldDocImpl getFieldDoc(VarSymbol var) {
FieldDocImpl result = fieldMap.get(var);
if (result != null) return result;
result = new FieldDocImpl(this, var);
fieldMap.put(var, result);
return result;
}
|
[
"public",
"FieldDocImpl",
"getFieldDoc",
"(",
"VarSymbol",
"var",
")",
"{",
"FieldDocImpl",
"result",
"=",
"fieldMap",
".",
"get",
"(",
"var",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"return",
"result",
";",
"result",
"=",
"new",
"FieldDocImpl",
"(",
"this",
",",
"var",
")",
";",
"fieldMap",
".",
"put",
"(",
"var",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Return the FieldDoc of this var symbol.
|
[
"Return",
"the",
"FieldDoc",
"of",
"this",
"var",
"symbol",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L636-L642
|
5,434 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.makeFieldDoc
|
protected void makeFieldDoc(VarSymbol var, TreePath treePath) {
FieldDocImpl result = fieldMap.get(var);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result = new FieldDocImpl(this, var, treePath);
fieldMap.put(var, result);
}
}
|
java
|
protected void makeFieldDoc(VarSymbol var, TreePath treePath) {
FieldDocImpl result = fieldMap.get(var);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result = new FieldDocImpl(this, var, treePath);
fieldMap.put(var, result);
}
}
|
[
"protected",
"void",
"makeFieldDoc",
"(",
"VarSymbol",
"var",
",",
"TreePath",
"treePath",
")",
"{",
"FieldDocImpl",
"result",
"=",
"fieldMap",
".",
"get",
"(",
"var",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"if",
"(",
"treePath",
"!=",
"null",
")",
"result",
".",
"setTreePath",
"(",
"treePath",
")",
";",
"}",
"else",
"{",
"result",
"=",
"new",
"FieldDocImpl",
"(",
"this",
",",
"var",
",",
"treePath",
")",
";",
"fieldMap",
".",
"put",
"(",
"var",
",",
"result",
")",
";",
"}",
"}"
] |
Create a FieldDoc for a var symbol.
|
[
"Create",
"a",
"FieldDoc",
"for",
"a",
"var",
"symbol",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L646-L654
|
5,435 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.makeMethodDoc
|
protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) {
MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result = new MethodDocImpl(this, meth, treePath);
methodMap.put(meth, result);
}
}
|
java
|
protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) {
MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result = new MethodDocImpl(this, meth, treePath);
methodMap.put(meth, result);
}
}
|
[
"protected",
"void",
"makeMethodDoc",
"(",
"MethodSymbol",
"meth",
",",
"TreePath",
"treePath",
")",
"{",
"MethodDocImpl",
"result",
"=",
"(",
"MethodDocImpl",
")",
"methodMap",
".",
"get",
"(",
"meth",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"if",
"(",
"treePath",
"!=",
"null",
")",
"result",
".",
"setTreePath",
"(",
"treePath",
")",
";",
"}",
"else",
"{",
"result",
"=",
"new",
"MethodDocImpl",
"(",
"this",
",",
"meth",
",",
"treePath",
")",
";",
"methodMap",
".",
"put",
"(",
"meth",
",",
"result",
")",
";",
"}",
"}"
] |
Create a MethodDoc for this MethodSymbol.
Should be called only on symbols representing methods.
|
[
"Create",
"a",
"MethodDoc",
"for",
"this",
"MethodSymbol",
".",
"Should",
"be",
"called",
"only",
"on",
"symbols",
"representing",
"methods",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L661-L669
|
5,436 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.getMethodDoc
|
public MethodDocImpl getMethodDoc(MethodSymbol meth) {
assert !meth.isConstructor() : "not expecting a constructor symbol";
MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
if (result != null) return result;
result = new MethodDocImpl(this, meth);
methodMap.put(meth, result);
return result;
}
|
java
|
public MethodDocImpl getMethodDoc(MethodSymbol meth) {
assert !meth.isConstructor() : "not expecting a constructor symbol";
MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
if (result != null) return result;
result = new MethodDocImpl(this, meth);
methodMap.put(meth, result);
return result;
}
|
[
"public",
"MethodDocImpl",
"getMethodDoc",
"(",
"MethodSymbol",
"meth",
")",
"{",
"assert",
"!",
"meth",
".",
"isConstructor",
"(",
")",
":",
"\"not expecting a constructor symbol\"",
";",
"MethodDocImpl",
"result",
"=",
"(",
"MethodDocImpl",
")",
"methodMap",
".",
"get",
"(",
"meth",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"return",
"result",
";",
"result",
"=",
"new",
"MethodDocImpl",
"(",
"this",
",",
"meth",
")",
";",
"methodMap",
".",
"put",
"(",
"meth",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Return the MethodDoc for a MethodSymbol.
Should be called only on symbols representing methods.
|
[
"Return",
"the",
"MethodDoc",
"for",
"a",
"MethodSymbol",
".",
"Should",
"be",
"called",
"only",
"on",
"symbols",
"representing",
"methods",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L675-L682
|
5,437 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.makeConstructorDoc
|
protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) {
ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result = new ConstructorDocImpl(this, meth, treePath);
methodMap.put(meth, result);
}
}
|
java
|
protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) {
ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result = new ConstructorDocImpl(this, meth, treePath);
methodMap.put(meth, result);
}
}
|
[
"protected",
"void",
"makeConstructorDoc",
"(",
"MethodSymbol",
"meth",
",",
"TreePath",
"treePath",
")",
"{",
"ConstructorDocImpl",
"result",
"=",
"(",
"ConstructorDocImpl",
")",
"methodMap",
".",
"get",
"(",
"meth",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"if",
"(",
"treePath",
"!=",
"null",
")",
"result",
".",
"setTreePath",
"(",
"treePath",
")",
";",
"}",
"else",
"{",
"result",
"=",
"new",
"ConstructorDocImpl",
"(",
"this",
",",
"meth",
",",
"treePath",
")",
";",
"methodMap",
".",
"put",
"(",
"meth",
",",
"result",
")",
";",
"}",
"}"
] |
Create the ConstructorDoc for a MethodSymbol.
Should be called only on symbols representing constructors.
|
[
"Create",
"the",
"ConstructorDoc",
"for",
"a",
"MethodSymbol",
".",
"Should",
"be",
"called",
"only",
"on",
"symbols",
"representing",
"constructors",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L688-L696
|
5,438 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.getConstructorDoc
|
public ConstructorDocImpl getConstructorDoc(MethodSymbol meth) {
assert meth.isConstructor() : "expecting a constructor symbol";
ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
if (result != null) return result;
result = new ConstructorDocImpl(this, meth);
methodMap.put(meth, result);
return result;
}
|
java
|
public ConstructorDocImpl getConstructorDoc(MethodSymbol meth) {
assert meth.isConstructor() : "expecting a constructor symbol";
ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
if (result != null) return result;
result = new ConstructorDocImpl(this, meth);
methodMap.put(meth, result);
return result;
}
|
[
"public",
"ConstructorDocImpl",
"getConstructorDoc",
"(",
"MethodSymbol",
"meth",
")",
"{",
"assert",
"meth",
".",
"isConstructor",
"(",
")",
":",
"\"expecting a constructor symbol\"",
";",
"ConstructorDocImpl",
"result",
"=",
"(",
"ConstructorDocImpl",
")",
"methodMap",
".",
"get",
"(",
"meth",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"return",
"result",
";",
"result",
"=",
"new",
"ConstructorDocImpl",
"(",
"this",
",",
"meth",
")",
";",
"methodMap",
".",
"put",
"(",
"meth",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Return the ConstructorDoc for a MethodSymbol.
Should be called only on symbols representing constructors.
|
[
"Return",
"the",
"ConstructorDoc",
"for",
"a",
"MethodSymbol",
".",
"Should",
"be",
"called",
"only",
"on",
"symbols",
"representing",
"constructors",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L702-L709
|
5,439 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.makeAnnotationTypeElementDoc
|
protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath treePath) {
AnnotationTypeElementDocImpl result =
(AnnotationTypeElementDocImpl)methodMap.get(meth);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result =
new AnnotationTypeElementDocImpl(this, meth, treePath);
methodMap.put(meth, result);
}
}
|
java
|
protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath treePath) {
AnnotationTypeElementDocImpl result =
(AnnotationTypeElementDocImpl)methodMap.get(meth);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result =
new AnnotationTypeElementDocImpl(this, meth, treePath);
methodMap.put(meth, result);
}
}
|
[
"protected",
"void",
"makeAnnotationTypeElementDoc",
"(",
"MethodSymbol",
"meth",
",",
"TreePath",
"treePath",
")",
"{",
"AnnotationTypeElementDocImpl",
"result",
"=",
"(",
"AnnotationTypeElementDocImpl",
")",
"methodMap",
".",
"get",
"(",
"meth",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"if",
"(",
"treePath",
"!=",
"null",
")",
"result",
".",
"setTreePath",
"(",
"treePath",
")",
";",
"}",
"else",
"{",
"result",
"=",
"new",
"AnnotationTypeElementDocImpl",
"(",
"this",
",",
"meth",
",",
"treePath",
")",
";",
"methodMap",
".",
"put",
"(",
"meth",
",",
"result",
")",
";",
"}",
"}"
] |
Create the AnnotationTypeElementDoc for a MethodSymbol.
Should be called only on symbols representing annotation type elements.
|
[
"Create",
"the",
"AnnotationTypeElementDoc",
"for",
"a",
"MethodSymbol",
".",
"Should",
"be",
"called",
"only",
"on",
"symbols",
"representing",
"annotation",
"type",
"elements",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L715-L725
|
5,440 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.getAnnotationTypeElementDoc
|
public AnnotationTypeElementDocImpl getAnnotationTypeElementDoc(
MethodSymbol meth) {
AnnotationTypeElementDocImpl result =
(AnnotationTypeElementDocImpl)methodMap.get(meth);
if (result != null) return result;
result = new AnnotationTypeElementDocImpl(this, meth);
methodMap.put(meth, result);
return result;
}
|
java
|
public AnnotationTypeElementDocImpl getAnnotationTypeElementDoc(
MethodSymbol meth) {
AnnotationTypeElementDocImpl result =
(AnnotationTypeElementDocImpl)methodMap.get(meth);
if (result != null) return result;
result = new AnnotationTypeElementDocImpl(this, meth);
methodMap.put(meth, result);
return result;
}
|
[
"public",
"AnnotationTypeElementDocImpl",
"getAnnotationTypeElementDoc",
"(",
"MethodSymbol",
"meth",
")",
"{",
"AnnotationTypeElementDocImpl",
"result",
"=",
"(",
"AnnotationTypeElementDocImpl",
")",
"methodMap",
".",
"get",
"(",
"meth",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"return",
"result",
";",
"result",
"=",
"new",
"AnnotationTypeElementDocImpl",
"(",
"this",
",",
"meth",
")",
";",
"methodMap",
".",
"put",
"(",
"meth",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Return the AnnotationTypeElementDoc for a MethodSymbol.
Should be called only on symbols representing annotation type elements.
|
[
"Return",
"the",
"AnnotationTypeElementDoc",
"for",
"a",
"MethodSymbol",
".",
"Should",
"be",
"called",
"only",
"on",
"symbols",
"representing",
"annotation",
"type",
"elements",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L731-L740
|
5,441 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
|
DocEnv.translateModifiers
|
static int translateModifiers(long flags) {
int result = 0;
if ((flags & Flags.ABSTRACT) != 0)
result |= Modifier.ABSTRACT;
if ((flags & Flags.FINAL) != 0)
result |= Modifier.FINAL;
if ((flags & Flags.INTERFACE) != 0)
result |= Modifier.INTERFACE;
if ((flags & Flags.NATIVE) != 0)
result |= Modifier.NATIVE;
if ((flags & Flags.PRIVATE) != 0)
result |= Modifier.PRIVATE;
if ((flags & Flags.PROTECTED) != 0)
result |= Modifier.PROTECTED;
if ((flags & Flags.PUBLIC) != 0)
result |= Modifier.PUBLIC;
if ((flags & Flags.STATIC) != 0)
result |= Modifier.STATIC;
if ((flags & Flags.SYNCHRONIZED) != 0)
result |= Modifier.SYNCHRONIZED;
if ((flags & Flags.TRANSIENT) != 0)
result |= Modifier.TRANSIENT;
if ((flags & Flags.VOLATILE) != 0)
result |= Modifier.VOLATILE;
return result;
}
|
java
|
static int translateModifiers(long flags) {
int result = 0;
if ((flags & Flags.ABSTRACT) != 0)
result |= Modifier.ABSTRACT;
if ((flags & Flags.FINAL) != 0)
result |= Modifier.FINAL;
if ((flags & Flags.INTERFACE) != 0)
result |= Modifier.INTERFACE;
if ((flags & Flags.NATIVE) != 0)
result |= Modifier.NATIVE;
if ((flags & Flags.PRIVATE) != 0)
result |= Modifier.PRIVATE;
if ((flags & Flags.PROTECTED) != 0)
result |= Modifier.PROTECTED;
if ((flags & Flags.PUBLIC) != 0)
result |= Modifier.PUBLIC;
if ((flags & Flags.STATIC) != 0)
result |= Modifier.STATIC;
if ((flags & Flags.SYNCHRONIZED) != 0)
result |= Modifier.SYNCHRONIZED;
if ((flags & Flags.TRANSIENT) != 0)
result |= Modifier.TRANSIENT;
if ((flags & Flags.VOLATILE) != 0)
result |= Modifier.VOLATILE;
return result;
}
|
[
"static",
"int",
"translateModifiers",
"(",
"long",
"flags",
")",
"{",
"int",
"result",
"=",
"0",
";",
"if",
"(",
"(",
"flags",
"&",
"Flags",
".",
"ABSTRACT",
")",
"!=",
"0",
")",
"result",
"|=",
"Modifier",
".",
"ABSTRACT",
";",
"if",
"(",
"(",
"flags",
"&",
"Flags",
".",
"FINAL",
")",
"!=",
"0",
")",
"result",
"|=",
"Modifier",
".",
"FINAL",
";",
"if",
"(",
"(",
"flags",
"&",
"Flags",
".",
"INTERFACE",
")",
"!=",
"0",
")",
"result",
"|=",
"Modifier",
".",
"INTERFACE",
";",
"if",
"(",
"(",
"flags",
"&",
"Flags",
".",
"NATIVE",
")",
"!=",
"0",
")",
"result",
"|=",
"Modifier",
".",
"NATIVE",
";",
"if",
"(",
"(",
"flags",
"&",
"Flags",
".",
"PRIVATE",
")",
"!=",
"0",
")",
"result",
"|=",
"Modifier",
".",
"PRIVATE",
";",
"if",
"(",
"(",
"flags",
"&",
"Flags",
".",
"PROTECTED",
")",
"!=",
"0",
")",
"result",
"|=",
"Modifier",
".",
"PROTECTED",
";",
"if",
"(",
"(",
"flags",
"&",
"Flags",
".",
"PUBLIC",
")",
"!=",
"0",
")",
"result",
"|=",
"Modifier",
".",
"PUBLIC",
";",
"if",
"(",
"(",
"flags",
"&",
"Flags",
".",
"STATIC",
")",
"!=",
"0",
")",
"result",
"|=",
"Modifier",
".",
"STATIC",
";",
"if",
"(",
"(",
"flags",
"&",
"Flags",
".",
"SYNCHRONIZED",
")",
"!=",
"0",
")",
"result",
"|=",
"Modifier",
".",
"SYNCHRONIZED",
";",
"if",
"(",
"(",
"flags",
"&",
"Flags",
".",
"TRANSIENT",
")",
"!=",
"0",
")",
"result",
"|=",
"Modifier",
".",
"TRANSIENT",
";",
"if",
"(",
"(",
"flags",
"&",
"Flags",
".",
"VOLATILE",
")",
"!=",
"0",
")",
"result",
"|=",
"Modifier",
".",
"VOLATILE",
";",
"return",
"result",
";",
"}"
] |
Convert modifier bits from private coding used by
the compiler to that of java.lang.reflect.Modifier.
|
[
"Convert",
"modifier",
"bits",
"from",
"private",
"coding",
"used",
"by",
"the",
"compiler",
"to",
"that",
"of",
"java",
".",
"lang",
".",
"reflect",
".",
"Modifier",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L801-L826
|
5,442 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java
|
Analyzer.analyzeIfNeeded
|
void analyzeIfNeeded(JCTree tree, Env<AttrContext> env) {
if (!analyzerModes.isEmpty() &&
!env.info.isSpeculative &&
TreeInfo.isStatement(tree)) {
JCStatement stmt = (JCStatement)tree;
analyze(stmt, env);
}
}
|
java
|
void analyzeIfNeeded(JCTree tree, Env<AttrContext> env) {
if (!analyzerModes.isEmpty() &&
!env.info.isSpeculative &&
TreeInfo.isStatement(tree)) {
JCStatement stmt = (JCStatement)tree;
analyze(stmt, env);
}
}
|
[
"void",
"analyzeIfNeeded",
"(",
"JCTree",
"tree",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"if",
"(",
"!",
"analyzerModes",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"env",
".",
"info",
".",
"isSpeculative",
"&&",
"TreeInfo",
".",
"isStatement",
"(",
"tree",
")",
")",
"{",
"JCStatement",
"stmt",
"=",
"(",
"JCStatement",
")",
"tree",
";",
"analyze",
"(",
"stmt",
",",
"env",
")",
";",
"}",
"}"
] |
Analyze an AST node if needed.
|
[
"Analyze",
"an",
"AST",
"node",
"if",
"needed",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java#L340-L347
|
5,443 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java
|
Analyzer.analyze
|
void analyze(JCStatement statement, Env<AttrContext> env) {
AnalysisContext context = new AnalysisContext();
StatementScanner statementScanner = new StatementScanner(context);
statementScanner.scan(statement);
if (!context.treesToAnalyzer.isEmpty()) {
//add a block to hoist potential dangling variable declarations
JCBlock fakeBlock = make.Block(SYNTHETIC, List.of(statement));
TreeMapper treeMapper = new TreeMapper(context);
//TODO: to further refine the analysis, try all rewriting combinations
deferredAttr.attribSpeculative(fakeBlock, env, attr.statInfo, treeMapper,
t -> new AnalyzeDeferredDiagHandler(context),
argumentAttr.withLocalCacheContext());
context.treeMap.entrySet().forEach(e -> {
context.treesToAnalyzer.get(e.getKey())
.process(e.getKey(), e.getValue(), context.errors.nonEmpty());
});
}
}
|
java
|
void analyze(JCStatement statement, Env<AttrContext> env) {
AnalysisContext context = new AnalysisContext();
StatementScanner statementScanner = new StatementScanner(context);
statementScanner.scan(statement);
if (!context.treesToAnalyzer.isEmpty()) {
//add a block to hoist potential dangling variable declarations
JCBlock fakeBlock = make.Block(SYNTHETIC, List.of(statement));
TreeMapper treeMapper = new TreeMapper(context);
//TODO: to further refine the analysis, try all rewriting combinations
deferredAttr.attribSpeculative(fakeBlock, env, attr.statInfo, treeMapper,
t -> new AnalyzeDeferredDiagHandler(context),
argumentAttr.withLocalCacheContext());
context.treeMap.entrySet().forEach(e -> {
context.treesToAnalyzer.get(e.getKey())
.process(e.getKey(), e.getValue(), context.errors.nonEmpty());
});
}
}
|
[
"void",
"analyze",
"(",
"JCStatement",
"statement",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"AnalysisContext",
"context",
"=",
"new",
"AnalysisContext",
"(",
")",
";",
"StatementScanner",
"statementScanner",
"=",
"new",
"StatementScanner",
"(",
"context",
")",
";",
"statementScanner",
".",
"scan",
"(",
"statement",
")",
";",
"if",
"(",
"!",
"context",
".",
"treesToAnalyzer",
".",
"isEmpty",
"(",
")",
")",
"{",
"//add a block to hoist potential dangling variable declarations",
"JCBlock",
"fakeBlock",
"=",
"make",
".",
"Block",
"(",
"SYNTHETIC",
",",
"List",
".",
"of",
"(",
"statement",
")",
")",
";",
"TreeMapper",
"treeMapper",
"=",
"new",
"TreeMapper",
"(",
"context",
")",
";",
"//TODO: to further refine the analysis, try all rewriting combinations",
"deferredAttr",
".",
"attribSpeculative",
"(",
"fakeBlock",
",",
"env",
",",
"attr",
".",
"statInfo",
",",
"treeMapper",
",",
"t",
"->",
"new",
"AnalyzeDeferredDiagHandler",
"(",
"context",
")",
",",
"argumentAttr",
".",
"withLocalCacheContext",
"(",
")",
")",
";",
"context",
".",
"treeMap",
".",
"entrySet",
"(",
")",
".",
"forEach",
"(",
"e",
"->",
"{",
"context",
".",
"treesToAnalyzer",
".",
"get",
"(",
"e",
".",
"getKey",
"(",
")",
")",
".",
"process",
"(",
"e",
".",
"getKey",
"(",
")",
",",
"e",
".",
"getValue",
"(",
")",
",",
"context",
".",
"errors",
".",
"nonEmpty",
"(",
")",
")",
";",
"}",
")",
";",
"}",
"}"
] |
Analyze an AST node; this involves collecting a list of all the nodes that needs rewriting,
and speculatively type-check the rewritten code to compare results against previously attributed code.
|
[
"Analyze",
"an",
"AST",
"node",
";",
"this",
"involves",
"collecting",
"a",
"list",
"of",
"all",
"the",
"nodes",
"that",
"needs",
"rewriting",
"and",
"speculatively",
"type",
"-",
"check",
"the",
"rewritten",
"code",
"to",
"compare",
"results",
"against",
"previously",
"attributed",
"code",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java#L353-L373
|
5,444 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
|
ClassDocImpl.isOrdinaryClass
|
@Override
public boolean isOrdinaryClass() {
if (isEnum() || isInterface() || isAnnotationType()) {
return false;
}
for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
if (t.tsym == env.syms.errorType.tsym ||
t.tsym == env.syms.exceptionType.tsym) {
return false;
}
}
return true;
}
|
java
|
@Override
public boolean isOrdinaryClass() {
if (isEnum() || isInterface() || isAnnotationType()) {
return false;
}
for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
if (t.tsym == env.syms.errorType.tsym ||
t.tsym == env.syms.exceptionType.tsym) {
return false;
}
}
return true;
}
|
[
"@",
"Override",
"public",
"boolean",
"isOrdinaryClass",
"(",
")",
"{",
"if",
"(",
"isEnum",
"(",
")",
"||",
"isInterface",
"(",
")",
"||",
"isAnnotationType",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"Type",
"t",
"=",
"type",
";",
"t",
".",
"hasTag",
"(",
"CLASS",
")",
";",
"t",
"=",
"env",
".",
"types",
".",
"supertype",
"(",
"t",
")",
")",
"{",
"if",
"(",
"t",
".",
"tsym",
"==",
"env",
".",
"syms",
".",
"errorType",
".",
"tsym",
"||",
"t",
".",
"tsym",
"==",
"env",
".",
"syms",
".",
"exceptionType",
".",
"tsym",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Return true if this is a ordinary class,
not an enumeration, exception, an error, or an interface.
|
[
"Return",
"true",
"if",
"this",
"is",
"a",
"ordinary",
"class",
"not",
"an",
"enumeration",
"exception",
"an",
"error",
"or",
"an",
"interface",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L167-L179
|
5,445 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
|
ClassDocImpl.isThrowable
|
public boolean isThrowable() {
if (isEnum() || isInterface() || isAnnotationType()) {
return false;
}
for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
if (t.tsym == env.syms.throwableType.tsym) {
return true;
}
}
return false;
}
|
java
|
public boolean isThrowable() {
if (isEnum() || isInterface() || isAnnotationType()) {
return false;
}
for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
if (t.tsym == env.syms.throwableType.tsym) {
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"isThrowable",
"(",
")",
"{",
"if",
"(",
"isEnum",
"(",
")",
"||",
"isInterface",
"(",
")",
"||",
"isAnnotationType",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"Type",
"t",
"=",
"type",
";",
"t",
".",
"hasTag",
"(",
"CLASS",
")",
";",
"t",
"=",
"env",
".",
"types",
".",
"supertype",
"(",
"t",
")",
")",
"{",
"if",
"(",
"t",
".",
"tsym",
"==",
"env",
".",
"syms",
".",
"throwableType",
".",
"tsym",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Return true if this is a throwable class
|
[
"Return",
"true",
"if",
"this",
"is",
"a",
"throwable",
"class"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L236-L246
|
5,446 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
|
ClassDocImpl.isIncluded
|
public boolean isIncluded() {
if (isIncluded) {
return true;
}
if (env.shouldDocument(tsym)) {
// Class is nameable from top-level and
// the class and all enclosing classes
// pass the modifier filter.
if (containingPackage().isIncluded()) {
return isIncluded=true;
}
ClassDoc outer = containingClass();
if (outer != null && outer.isIncluded()) {
return isIncluded=true;
}
}
return false;
}
|
java
|
public boolean isIncluded() {
if (isIncluded) {
return true;
}
if (env.shouldDocument(tsym)) {
// Class is nameable from top-level and
// the class and all enclosing classes
// pass the modifier filter.
if (containingPackage().isIncluded()) {
return isIncluded=true;
}
ClassDoc outer = containingClass();
if (outer != null && outer.isIncluded()) {
return isIncluded=true;
}
}
return false;
}
|
[
"public",
"boolean",
"isIncluded",
"(",
")",
"{",
"if",
"(",
"isIncluded",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"env",
".",
"shouldDocument",
"(",
"tsym",
")",
")",
"{",
"// Class is nameable from top-level and",
"// the class and all enclosing classes",
"// pass the modifier filter.",
"if",
"(",
"containingPackage",
"(",
")",
".",
"isIncluded",
"(",
")",
")",
"{",
"return",
"isIncluded",
"=",
"true",
";",
"}",
"ClassDoc",
"outer",
"=",
"containingClass",
"(",
")",
";",
"if",
"(",
"outer",
"!=",
"null",
"&&",
"outer",
".",
"isIncluded",
"(",
")",
")",
"{",
"return",
"isIncluded",
"=",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Return true if this class is included in the active set.
A ClassDoc is included iff either it is specified on the
commandline, or if it's containing package is specified
on the command line, or if it is a member class of an
included class.
|
[
"Return",
"true",
"if",
"this",
"class",
"is",
"included",
"in",
"the",
"active",
"set",
".",
"A",
"ClassDoc",
"is",
"included",
"iff",
"either",
"it",
"is",
"specified",
"on",
"the",
"commandline",
"or",
"if",
"it",
"s",
"containing",
"package",
"is",
"specified",
"on",
"the",
"command",
"line",
"or",
"if",
"it",
"is",
"a",
"member",
"class",
"of",
"an",
"included",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L270-L287
|
5,447 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
|
ClassDocImpl.containingPackage
|
@Override
public PackageDoc containingPackage() {
PackageDocImpl p = env.getPackageDoc(tsym.packge());
if (p.setDocPath == false) {
FileObject docPath;
try {
Location location = env.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
docPath = env.fileManager.getFileForInput(
location, p.qualifiedName(), "package.html");
} catch (IOException e) {
docPath = null;
}
if (docPath == null) {
// fall back on older semantics of looking in same directory as
// source file for this class
SourcePosition po = position();
if (env.fileManager instanceof StandardJavaFileManager &&
po instanceof SourcePositionImpl) {
URI uri = ((SourcePositionImpl) po).filename.toUri();
if ("file".equals(uri.getScheme())) {
File f = new File(uri);
File dir = f.getParentFile();
if (dir != null) {
File pf = new File(dir, "package.html");
if (pf.exists()) {
StandardJavaFileManager sfm = (StandardJavaFileManager) env.fileManager;
docPath = sfm.getJavaFileObjects(pf).iterator().next();
}
}
}
}
}
p.setDocPath(docPath);
}
return p;
}
|
java
|
@Override
public PackageDoc containingPackage() {
PackageDocImpl p = env.getPackageDoc(tsym.packge());
if (p.setDocPath == false) {
FileObject docPath;
try {
Location location = env.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
docPath = env.fileManager.getFileForInput(
location, p.qualifiedName(), "package.html");
} catch (IOException e) {
docPath = null;
}
if (docPath == null) {
// fall back on older semantics of looking in same directory as
// source file for this class
SourcePosition po = position();
if (env.fileManager instanceof StandardJavaFileManager &&
po instanceof SourcePositionImpl) {
URI uri = ((SourcePositionImpl) po).filename.toUri();
if ("file".equals(uri.getScheme())) {
File f = new File(uri);
File dir = f.getParentFile();
if (dir != null) {
File pf = new File(dir, "package.html");
if (pf.exists()) {
StandardJavaFileManager sfm = (StandardJavaFileManager) env.fileManager;
docPath = sfm.getJavaFileObjects(pf).iterator().next();
}
}
}
}
}
p.setDocPath(docPath);
}
return p;
}
|
[
"@",
"Override",
"public",
"PackageDoc",
"containingPackage",
"(",
")",
"{",
"PackageDocImpl",
"p",
"=",
"env",
".",
"getPackageDoc",
"(",
"tsym",
".",
"packge",
"(",
")",
")",
";",
"if",
"(",
"p",
".",
"setDocPath",
"==",
"false",
")",
"{",
"FileObject",
"docPath",
";",
"try",
"{",
"Location",
"location",
"=",
"env",
".",
"fileManager",
".",
"hasLocation",
"(",
"StandardLocation",
".",
"SOURCE_PATH",
")",
"?",
"StandardLocation",
".",
"SOURCE_PATH",
":",
"StandardLocation",
".",
"CLASS_PATH",
";",
"docPath",
"=",
"env",
".",
"fileManager",
".",
"getFileForInput",
"(",
"location",
",",
"p",
".",
"qualifiedName",
"(",
")",
",",
"\"package.html\"",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"docPath",
"=",
"null",
";",
"}",
"if",
"(",
"docPath",
"==",
"null",
")",
"{",
"// fall back on older semantics of looking in same directory as",
"// source file for this class",
"SourcePosition",
"po",
"=",
"position",
"(",
")",
";",
"if",
"(",
"env",
".",
"fileManager",
"instanceof",
"StandardJavaFileManager",
"&&",
"po",
"instanceof",
"SourcePositionImpl",
")",
"{",
"URI",
"uri",
"=",
"(",
"(",
"SourcePositionImpl",
")",
"po",
")",
".",
"filename",
".",
"toUri",
"(",
")",
";",
"if",
"(",
"\"file\"",
".",
"equals",
"(",
"uri",
".",
"getScheme",
"(",
")",
")",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"uri",
")",
";",
"File",
"dir",
"=",
"f",
".",
"getParentFile",
"(",
")",
";",
"if",
"(",
"dir",
"!=",
"null",
")",
"{",
"File",
"pf",
"=",
"new",
"File",
"(",
"dir",
",",
"\"package.html\"",
")",
";",
"if",
"(",
"pf",
".",
"exists",
"(",
")",
")",
"{",
"StandardJavaFileManager",
"sfm",
"=",
"(",
"StandardJavaFileManager",
")",
"env",
".",
"fileManager",
";",
"docPath",
"=",
"sfm",
".",
"getJavaFileObjects",
"(",
"pf",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"}",
"}",
"}",
"}",
"}",
"p",
".",
"setDocPath",
"(",
"docPath",
")",
";",
"}",
"return",
"p",
";",
"}"
] |
Return the package that this class is contained in.
|
[
"Return",
"the",
"package",
"that",
"this",
"class",
"is",
"contained",
"in",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L292-L332
|
5,448 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
|
ClassDocImpl.superclass
|
public ClassDoc superclass() {
if (isInterface() || isAnnotationType()) return null;
if (tsym == env.syms.objectType.tsym) return null;
ClassSymbol c = (ClassSymbol)env.types.supertype(type).tsym;
if (c == null || c == tsym) c = (ClassSymbol)env.syms.objectType.tsym;
return env.getClassDoc(c);
}
|
java
|
public ClassDoc superclass() {
if (isInterface() || isAnnotationType()) return null;
if (tsym == env.syms.objectType.tsym) return null;
ClassSymbol c = (ClassSymbol)env.types.supertype(type).tsym;
if (c == null || c == tsym) c = (ClassSymbol)env.syms.objectType.tsym;
return env.getClassDoc(c);
}
|
[
"public",
"ClassDoc",
"superclass",
"(",
")",
"{",
"if",
"(",
"isInterface",
"(",
")",
"||",
"isAnnotationType",
"(",
")",
")",
"return",
"null",
";",
"if",
"(",
"tsym",
"==",
"env",
".",
"syms",
".",
"objectType",
".",
"tsym",
")",
"return",
"null",
";",
"ClassSymbol",
"c",
"=",
"(",
"ClassSymbol",
")",
"env",
".",
"types",
".",
"supertype",
"(",
"type",
")",
".",
"tsym",
";",
"if",
"(",
"c",
"==",
"null",
"||",
"c",
"==",
"tsym",
")",
"c",
"=",
"(",
"ClassSymbol",
")",
"env",
".",
"syms",
".",
"objectType",
".",
"tsym",
";",
"return",
"env",
".",
"getClassDoc",
"(",
"c",
")",
";",
"}"
] |
Return the superclass of this class
@return the ClassDocImpl for the superclass of this class, null
if there is no superclass.
|
[
"Return",
"the",
"superclass",
"of",
"this",
"class"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L502-L508
|
5,449 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
|
ClassDocImpl.subclassOf
|
public boolean subclassOf(ClassDoc cd) {
return tsym.isSubClass(((ClassDocImpl)cd).tsym, env.types);
}
|
java
|
public boolean subclassOf(ClassDoc cd) {
return tsym.isSubClass(((ClassDocImpl)cd).tsym, env.types);
}
|
[
"public",
"boolean",
"subclassOf",
"(",
"ClassDoc",
"cd",
")",
"{",
"return",
"tsym",
".",
"isSubClass",
"(",
"(",
"(",
"ClassDocImpl",
")",
"cd",
")",
".",
"tsym",
",",
"env",
".",
"types",
")",
";",
"}"
] |
Test whether this class is a subclass of the specified class.
@param cd the candidate superclass.
@return true if cd is a superclass of this class.
|
[
"Test",
"whether",
"this",
"class",
"is",
"a",
"subclass",
"of",
"the",
"specified",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L530-L532
|
5,450 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
|
ClassDocImpl.interfaces
|
public ClassDoc[] interfaces() {
ListBuffer<ClassDocImpl> ta = new ListBuffer<>();
for (Type t : env.types.interfaces(type)) {
ta.append(env.getClassDoc((ClassSymbol)t.tsym));
}
//### Cache ta here?
return ta.toArray(new ClassDocImpl[ta.length()]);
}
|
java
|
public ClassDoc[] interfaces() {
ListBuffer<ClassDocImpl> ta = new ListBuffer<>();
for (Type t : env.types.interfaces(type)) {
ta.append(env.getClassDoc((ClassSymbol)t.tsym));
}
//### Cache ta here?
return ta.toArray(new ClassDocImpl[ta.length()]);
}
|
[
"public",
"ClassDoc",
"[",
"]",
"interfaces",
"(",
")",
"{",
"ListBuffer",
"<",
"ClassDocImpl",
">",
"ta",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"for",
"(",
"Type",
"t",
":",
"env",
".",
"types",
".",
"interfaces",
"(",
"type",
")",
")",
"{",
"ta",
".",
"append",
"(",
"env",
".",
"getClassDoc",
"(",
"(",
"ClassSymbol",
")",
"t",
".",
"tsym",
")",
")",
";",
"}",
"//### Cache ta here?",
"return",
"ta",
".",
"toArray",
"(",
"new",
"ClassDocImpl",
"[",
"ta",
".",
"length",
"(",
")",
"]",
")",
";",
"}"
] |
Return interfaces implemented by this class or interfaces
extended by this interface.
@return An array of ClassDocImpl representing the interfaces.
Return an empty array if there are no interfaces.
|
[
"Return",
"interfaces",
"implemented",
"by",
"this",
"class",
"or",
"interfaces",
"extended",
"by",
"this",
"interface",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L541-L548
|
5,451 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
|
ClassDocImpl.interfaceTypes
|
public com.sun.javadoc.Type[] interfaceTypes() {
//### Cache result here?
return TypeMaker.getTypes(env, env.types.interfaces(type));
}
|
java
|
public com.sun.javadoc.Type[] interfaceTypes() {
//### Cache result here?
return TypeMaker.getTypes(env, env.types.interfaces(type));
}
|
[
"public",
"com",
".",
"sun",
".",
"javadoc",
".",
"Type",
"[",
"]",
"interfaceTypes",
"(",
")",
"{",
"//### Cache result here?",
"return",
"TypeMaker",
".",
"getTypes",
"(",
"env",
",",
"env",
".",
"types",
".",
"interfaces",
"(",
"type",
")",
")",
";",
"}"
] |
Return interfaces implemented by this class or interfaces extended
by this interface. Includes only directly-declared interfaces, not
inherited interfaces.
Return an empty array if there are no interfaces.
|
[
"Return",
"interfaces",
"implemented",
"by",
"this",
"class",
"or",
"interfaces",
"extended",
"by",
"this",
"interface",
".",
"Includes",
"only",
"directly",
"-",
"declared",
"interfaces",
"not",
"inherited",
"interfaces",
".",
"Return",
"an",
"empty",
"array",
"if",
"there",
"are",
"no",
"interfaces",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L556-L559
|
5,452 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
|
ClassDocImpl.importedClasses
|
@Deprecated
public ClassDoc[] importedClasses() {
// information is not available for binary classfiles
if (tsym.sourcefile == null) return new ClassDoc[0];
ListBuffer<ClassDocImpl> importedClasses = new ListBuffer<>();
Env<AttrContext> compenv = env.enter.getEnv(tsym);
if (compenv == null) return new ClassDocImpl[0];
Name asterisk = tsym.name.table.names.asterisk;
for (JCTree t : compenv.toplevel.defs) {
if (t.hasTag(IMPORT)) {
JCTree imp = ((JCImport) t).qualid;
if ((TreeInfo.name(imp) != asterisk) &&
imp.type.tsym.kind.matches(KindSelector.TYP)) {
importedClasses.append(
env.getClassDoc((ClassSymbol)imp.type.tsym));
}
}
}
return importedClasses.toArray(new ClassDocImpl[importedClasses.length()]);
}
|
java
|
@Deprecated
public ClassDoc[] importedClasses() {
// information is not available for binary classfiles
if (tsym.sourcefile == null) return new ClassDoc[0];
ListBuffer<ClassDocImpl> importedClasses = new ListBuffer<>();
Env<AttrContext> compenv = env.enter.getEnv(tsym);
if (compenv == null) return new ClassDocImpl[0];
Name asterisk = tsym.name.table.names.asterisk;
for (JCTree t : compenv.toplevel.defs) {
if (t.hasTag(IMPORT)) {
JCTree imp = ((JCImport) t).qualid;
if ((TreeInfo.name(imp) != asterisk) &&
imp.type.tsym.kind.matches(KindSelector.TYP)) {
importedClasses.append(
env.getClassDoc((ClassSymbol)imp.type.tsym));
}
}
}
return importedClasses.toArray(new ClassDocImpl[importedClasses.length()]);
}
|
[
"@",
"Deprecated",
"public",
"ClassDoc",
"[",
"]",
"importedClasses",
"(",
")",
"{",
"// information is not available for binary classfiles",
"if",
"(",
"tsym",
".",
"sourcefile",
"==",
"null",
")",
"return",
"new",
"ClassDoc",
"[",
"0",
"]",
";",
"ListBuffer",
"<",
"ClassDocImpl",
">",
"importedClasses",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"Env",
"<",
"AttrContext",
">",
"compenv",
"=",
"env",
".",
"enter",
".",
"getEnv",
"(",
"tsym",
")",
";",
"if",
"(",
"compenv",
"==",
"null",
")",
"return",
"new",
"ClassDocImpl",
"[",
"0",
"]",
";",
"Name",
"asterisk",
"=",
"tsym",
".",
"name",
".",
"table",
".",
"names",
".",
"asterisk",
";",
"for",
"(",
"JCTree",
"t",
":",
"compenv",
".",
"toplevel",
".",
"defs",
")",
"{",
"if",
"(",
"t",
".",
"hasTag",
"(",
"IMPORT",
")",
")",
"{",
"JCTree",
"imp",
"=",
"(",
"(",
"JCImport",
")",
"t",
")",
".",
"qualid",
";",
"if",
"(",
"(",
"TreeInfo",
".",
"name",
"(",
"imp",
")",
"!=",
"asterisk",
")",
"&&",
"imp",
".",
"type",
".",
"tsym",
".",
"kind",
".",
"matches",
"(",
"KindSelector",
".",
"TYP",
")",
")",
"{",
"importedClasses",
".",
"append",
"(",
"env",
".",
"getClassDoc",
"(",
"(",
"ClassSymbol",
")",
"imp",
".",
"type",
".",
"tsym",
")",
")",
";",
"}",
"}",
"}",
"return",
"importedClasses",
".",
"toArray",
"(",
"new",
"ClassDocImpl",
"[",
"importedClasses",
".",
"length",
"(",
")",
"]",
")",
";",
"}"
] |
Get the list of classes declared as imported.
These are called "single-type-import declarations" in the JLS.
This method is deprecated in the ClassDoc interface.
@return an array of ClassDocImpl representing the imported classes.
@deprecated Import declarations are implementation details that
should not be exposed here. In addition, not all imported
classes are imported through single-type-import declarations.
|
[
"Get",
"the",
"list",
"of",
"classes",
"declared",
"as",
"imported",
".",
"These",
"are",
"called",
"single",
"-",
"type",
"-",
"import",
"declarations",
"in",
"the",
"JLS",
".",
"This",
"method",
"is",
"deprecated",
"in",
"the",
"ClassDoc",
"interface",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L1094-L1117
|
5,453 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
|
ClassDocImpl.importedPackages
|
@Deprecated
public PackageDoc[] importedPackages() {
// information is not available for binary classfiles
if (tsym.sourcefile == null) return new PackageDoc[0];
ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<>();
//### Add the implicit "import java.lang.*" to the result
Names names = tsym.name.table.names;
importedPackages.append(env.getPackageDoc(env.syms.enterPackage(env.syms.java_base, names.java_lang)));
Env<AttrContext> compenv = env.enter.getEnv(tsym);
if (compenv == null) return new PackageDocImpl[0];
for (JCTree t : compenv.toplevel.defs) {
if (t.hasTag(IMPORT)) {
JCTree imp = ((JCImport) t).qualid;
if (TreeInfo.name(imp) == names.asterisk) {
JCFieldAccess sel = (JCFieldAccess)imp;
Symbol s = sel.selected.type.tsym;
PackageDocImpl pdoc = env.getPackageDoc(s.packge());
if (!importedPackages.contains(pdoc))
importedPackages.append(pdoc);
}
}
}
return importedPackages.toArray(new PackageDocImpl[importedPackages.length()]);
}
|
java
|
@Deprecated
public PackageDoc[] importedPackages() {
// information is not available for binary classfiles
if (tsym.sourcefile == null) return new PackageDoc[0];
ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<>();
//### Add the implicit "import java.lang.*" to the result
Names names = tsym.name.table.names;
importedPackages.append(env.getPackageDoc(env.syms.enterPackage(env.syms.java_base, names.java_lang)));
Env<AttrContext> compenv = env.enter.getEnv(tsym);
if (compenv == null) return new PackageDocImpl[0];
for (JCTree t : compenv.toplevel.defs) {
if (t.hasTag(IMPORT)) {
JCTree imp = ((JCImport) t).qualid;
if (TreeInfo.name(imp) == names.asterisk) {
JCFieldAccess sel = (JCFieldAccess)imp;
Symbol s = sel.selected.type.tsym;
PackageDocImpl pdoc = env.getPackageDoc(s.packge());
if (!importedPackages.contains(pdoc))
importedPackages.append(pdoc);
}
}
}
return importedPackages.toArray(new PackageDocImpl[importedPackages.length()]);
}
|
[
"@",
"Deprecated",
"public",
"PackageDoc",
"[",
"]",
"importedPackages",
"(",
")",
"{",
"// information is not available for binary classfiles",
"if",
"(",
"tsym",
".",
"sourcefile",
"==",
"null",
")",
"return",
"new",
"PackageDoc",
"[",
"0",
"]",
";",
"ListBuffer",
"<",
"PackageDocImpl",
">",
"importedPackages",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"//### Add the implicit \"import java.lang.*\" to the result",
"Names",
"names",
"=",
"tsym",
".",
"name",
".",
"table",
".",
"names",
";",
"importedPackages",
".",
"append",
"(",
"env",
".",
"getPackageDoc",
"(",
"env",
".",
"syms",
".",
"enterPackage",
"(",
"env",
".",
"syms",
".",
"java_base",
",",
"names",
".",
"java_lang",
")",
")",
")",
";",
"Env",
"<",
"AttrContext",
">",
"compenv",
"=",
"env",
".",
"enter",
".",
"getEnv",
"(",
"tsym",
")",
";",
"if",
"(",
"compenv",
"==",
"null",
")",
"return",
"new",
"PackageDocImpl",
"[",
"0",
"]",
";",
"for",
"(",
"JCTree",
"t",
":",
"compenv",
".",
"toplevel",
".",
"defs",
")",
"{",
"if",
"(",
"t",
".",
"hasTag",
"(",
"IMPORT",
")",
")",
"{",
"JCTree",
"imp",
"=",
"(",
"(",
"JCImport",
")",
"t",
")",
".",
"qualid",
";",
"if",
"(",
"TreeInfo",
".",
"name",
"(",
"imp",
")",
"==",
"names",
".",
"asterisk",
")",
"{",
"JCFieldAccess",
"sel",
"=",
"(",
"JCFieldAccess",
")",
"imp",
";",
"Symbol",
"s",
"=",
"sel",
".",
"selected",
".",
"type",
".",
"tsym",
";",
"PackageDocImpl",
"pdoc",
"=",
"env",
".",
"getPackageDoc",
"(",
"s",
".",
"packge",
"(",
")",
")",
";",
"if",
"(",
"!",
"importedPackages",
".",
"contains",
"(",
"pdoc",
")",
")",
"importedPackages",
".",
"append",
"(",
"pdoc",
")",
";",
"}",
"}",
"}",
"return",
"importedPackages",
".",
"toArray",
"(",
"new",
"PackageDocImpl",
"[",
"importedPackages",
".",
"length",
"(",
")",
"]",
")",
";",
"}"
] |
Get the list of packages declared as imported.
These are called "type-import-on-demand declarations" in the JLS.
This method is deprecated in the ClassDoc interface.
@return an array of PackageDocImpl representing the imported packages.
###NOTE: the syntax supports importing all inner classes from a class as well.
@deprecated Import declarations are implementation details that
should not be exposed here. In addition, this method's
return type does not allow for all type-import-on-demand
declarations to be returned.
|
[
"Get",
"the",
"list",
"of",
"packages",
"declared",
"as",
"imported",
".",
"These",
"are",
"called",
"type",
"-",
"import",
"-",
"on",
"-",
"demand",
"declarations",
"in",
"the",
"JLS",
".",
"This",
"method",
"is",
"deprecated",
"in",
"the",
"ClassDoc",
"interface",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L1132-L1160
|
5,454 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
|
ClassDocImpl.serializationMethods
|
public MethodDoc[] serializationMethods() {
if (serializedForm == null) {
serializedForm = new SerializedForm(env, tsym, this);
}
//### Clone this?
return serializedForm.methods();
}
|
java
|
public MethodDoc[] serializationMethods() {
if (serializedForm == null) {
serializedForm = new SerializedForm(env, tsym, this);
}
//### Clone this?
return serializedForm.methods();
}
|
[
"public",
"MethodDoc",
"[",
"]",
"serializationMethods",
"(",
")",
"{",
"if",
"(",
"serializedForm",
"==",
"null",
")",
"{",
"serializedForm",
"=",
"new",
"SerializedForm",
"(",
"env",
",",
"tsym",
",",
"this",
")",
";",
"}",
"//### Clone this?",
"return",
"serializedForm",
".",
"methods",
"(",
")",
";",
"}"
] |
Return the serialization methods for this class.
@return an array of <code>MethodDocImpl</code> that represents
the serialization methods for this class.
|
[
"Return",
"the",
"serialization",
"methods",
"for",
"this",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L1258-L1264
|
5,455 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexBuilder.java
|
IndexBuilder.addModulesToIndexMap
|
protected void addModulesToIndexMap() {
for (ModuleElement mdle : configuration.modules) {
String mdleName = mdle.getQualifiedName().toString();
char ch = (mdleName.length() == 0)
? '*'
: Character.toUpperCase(mdleName.charAt(0));
Character unicode = ch;
SortedSet<Element> list = indexmap.computeIfAbsent(unicode,
c -> new TreeSet<>(comparator));
list.add(mdle);
}
}
|
java
|
protected void addModulesToIndexMap() {
for (ModuleElement mdle : configuration.modules) {
String mdleName = mdle.getQualifiedName().toString();
char ch = (mdleName.length() == 0)
? '*'
: Character.toUpperCase(mdleName.charAt(0));
Character unicode = ch;
SortedSet<Element> list = indexmap.computeIfAbsent(unicode,
c -> new TreeSet<>(comparator));
list.add(mdle);
}
}
|
[
"protected",
"void",
"addModulesToIndexMap",
"(",
")",
"{",
"for",
"(",
"ModuleElement",
"mdle",
":",
"configuration",
".",
"modules",
")",
"{",
"String",
"mdleName",
"=",
"mdle",
".",
"getQualifiedName",
"(",
")",
".",
"toString",
"(",
")",
";",
"char",
"ch",
"=",
"(",
"mdleName",
".",
"length",
"(",
")",
"==",
"0",
")",
"?",
"'",
"'",
":",
"Character",
".",
"toUpperCase",
"(",
"mdleName",
".",
"charAt",
"(",
"0",
")",
")",
";",
"Character",
"unicode",
"=",
"ch",
";",
"SortedSet",
"<",
"Element",
">",
"list",
"=",
"indexmap",
".",
"computeIfAbsent",
"(",
"unicode",
",",
"c",
"->",
"new",
"TreeSet",
"<>",
"(",
"comparator",
")",
")",
";",
"list",
".",
"add",
"(",
"mdle",
")",
";",
"}",
"}"
] |
Add all the modules to index map.
|
[
"Add",
"all",
"the",
"modules",
"to",
"index",
"map",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexBuilder.java#L200-L211
|
5,456 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexBuilder.java
|
IndexBuilder.shouldAddToIndexMap
|
protected boolean shouldAddToIndexMap(Element element) {
if (utils.isHidden(element)) {
return false;
}
if (utils.isPackage(element))
// Do not add to index map if -nodeprecated option is set and the
// package is marked as deprecated.
return !(noDeprecated && configuration.utils.isDeprecated(element));
else
// Do not add to index map if -nodeprecated option is set and if the
// element is marked as deprecated or the containing package is marked as
// deprecated.
return !(noDeprecated &&
(configuration.utils.isDeprecated(element) ||
configuration.utils.isDeprecated(utils.containingPackage(element))));
}
|
java
|
protected boolean shouldAddToIndexMap(Element element) {
if (utils.isHidden(element)) {
return false;
}
if (utils.isPackage(element))
// Do not add to index map if -nodeprecated option is set and the
// package is marked as deprecated.
return !(noDeprecated && configuration.utils.isDeprecated(element));
else
// Do not add to index map if -nodeprecated option is set and if the
// element is marked as deprecated or the containing package is marked as
// deprecated.
return !(noDeprecated &&
(configuration.utils.isDeprecated(element) ||
configuration.utils.isDeprecated(utils.containingPackage(element))));
}
|
[
"protected",
"boolean",
"shouldAddToIndexMap",
"(",
"Element",
"element",
")",
"{",
"if",
"(",
"utils",
".",
"isHidden",
"(",
"element",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"utils",
".",
"isPackage",
"(",
"element",
")",
")",
"// Do not add to index map if -nodeprecated option is set and the",
"// package is marked as deprecated.",
"return",
"!",
"(",
"noDeprecated",
"&&",
"configuration",
".",
"utils",
".",
"isDeprecated",
"(",
"element",
")",
")",
";",
"else",
"// Do not add to index map if -nodeprecated option is set and if the",
"// element is marked as deprecated or the containing package is marked as",
"// deprecated.",
"return",
"!",
"(",
"noDeprecated",
"&&",
"(",
"configuration",
".",
"utils",
".",
"isDeprecated",
"(",
"element",
")",
"||",
"configuration",
".",
"utils",
".",
"isDeprecated",
"(",
"utils",
".",
"containingPackage",
"(",
"element",
")",
")",
")",
")",
";",
"}"
] |
Should this element be added to the index map?
|
[
"Should",
"this",
"element",
"be",
"added",
"to",
"the",
"index",
"map?"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexBuilder.java#L216-L232
|
5,457 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexBuilder.java
|
IndexBuilder.getMemberList
|
public List<? extends Element> getMemberList(Character index) {
SortedSet<Element> set = indexmap.get(index);
if (set == null)
return null;
List<Element> out = new ArrayList<>();
out.addAll(set);
return out;
}
|
java
|
public List<? extends Element> getMemberList(Character index) {
SortedSet<Element> set = indexmap.get(index);
if (set == null)
return null;
List<Element> out = new ArrayList<>();
out.addAll(set);
return out;
}
|
[
"public",
"List",
"<",
"?",
"extends",
"Element",
">",
"getMemberList",
"(",
"Character",
"index",
")",
"{",
"SortedSet",
"<",
"Element",
">",
"set",
"=",
"indexmap",
".",
"get",
"(",
"index",
")",
";",
"if",
"(",
"set",
"==",
"null",
")",
"return",
"null",
";",
"List",
"<",
"Element",
">",
"out",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"out",
".",
"addAll",
"(",
"set",
")",
";",
"return",
"out",
";",
"}"
] |
Return the sorted list of members, for passed Unicode Character.
@param index index Unicode character.
@return List member list for specific Unicode character.
|
[
"Return",
"the",
"sorted",
"list",
"of",
"members",
"for",
"passed",
"Unicode",
"Character",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexBuilder.java#L249-L256
|
5,458 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
|
AllClassesFrameWriter.buildAllClassesFile
|
protected void buildAllClassesFile(boolean wantFrames) throws IOException {
String label = configuration.getText("doclet.All_Classes");
Content body = getBody(false, getWindowTitle(label));
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
HtmlStyle.bar, allclassesLabel);
body.addContent(heading);
Content ul = new HtmlTree(HtmlTag.UL);
// Generate the class links and add it to the tdFont tree.
addAllClasses(ul, wantFrames);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN(HtmlStyle.indexContainer, ul)
: HtmlTree.DIV(HtmlStyle.indexContainer, ul);
body.addContent(htmlTree);
printHtmlDocument(null, false, body);
}
|
java
|
protected void buildAllClassesFile(boolean wantFrames) throws IOException {
String label = configuration.getText("doclet.All_Classes");
Content body = getBody(false, getWindowTitle(label));
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
HtmlStyle.bar, allclassesLabel);
body.addContent(heading);
Content ul = new HtmlTree(HtmlTag.UL);
// Generate the class links and add it to the tdFont tree.
addAllClasses(ul, wantFrames);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN(HtmlStyle.indexContainer, ul)
: HtmlTree.DIV(HtmlStyle.indexContainer, ul);
body.addContent(htmlTree);
printHtmlDocument(null, false, body);
}
|
[
"protected",
"void",
"buildAllClassesFile",
"(",
"boolean",
"wantFrames",
")",
"throws",
"IOException",
"{",
"String",
"label",
"=",
"configuration",
".",
"getText",
"(",
"\"doclet.All_Classes\"",
")",
";",
"Content",
"body",
"=",
"getBody",
"(",
"false",
",",
"getWindowTitle",
"(",
"label",
")",
")",
";",
"Content",
"heading",
"=",
"HtmlTree",
".",
"HEADING",
"(",
"HtmlConstants",
".",
"TITLE_HEADING",
",",
"HtmlStyle",
".",
"bar",
",",
"allclassesLabel",
")",
";",
"body",
".",
"addContent",
"(",
"heading",
")",
";",
"Content",
"ul",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"UL",
")",
";",
"// Generate the class links and add it to the tdFont tree.",
"addAllClasses",
"(",
"ul",
",",
"wantFrames",
")",
";",
"HtmlTree",
"htmlTree",
"=",
"(",
"configuration",
".",
"allowTag",
"(",
"HtmlTag",
".",
"MAIN",
")",
")",
"?",
"HtmlTree",
".",
"MAIN",
"(",
"HtmlStyle",
".",
"indexContainer",
",",
"ul",
")",
":",
"HtmlTree",
".",
"DIV",
"(",
"HtmlStyle",
".",
"indexContainer",
",",
"ul",
")",
";",
"body",
".",
"addContent",
"(",
"htmlTree",
")",
";",
"printHtmlDocument",
"(",
"null",
",",
"false",
",",
"body",
")",
";",
"}"
] |
Print all the classes in the file.
@param wantFrames True if we want frames.
|
[
"Print",
"all",
"the",
"classes",
"in",
"the",
"file",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java#L114-L128
|
5,459 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java
|
Messager.instance0
|
public static Messager instance0(Context context) {
Log instance = context.get(logKey);
if (instance == null || !(instance instanceof Messager))
throw new InternalError("no messager instance!");
return (Messager)instance;
}
|
java
|
public static Messager instance0(Context context) {
Log instance = context.get(logKey);
if (instance == null || !(instance instanceof Messager))
throw new InternalError("no messager instance!");
return (Messager)instance;
}
|
[
"public",
"static",
"Messager",
"instance0",
"(",
"Context",
"context",
")",
"{",
"Log",
"instance",
"=",
"context",
".",
"get",
"(",
"logKey",
")",
";",
"if",
"(",
"instance",
"==",
"null",
"||",
"!",
"(",
"instance",
"instanceof",
"Messager",
")",
")",
"throw",
"new",
"InternalError",
"(",
"\"no messager instance!\"",
")",
";",
"return",
"(",
"Messager",
")",
"instance",
";",
"}"
] |
Get the current messager, which is also the compiler log.
|
[
"Get",
"the",
"current",
"messager",
"which",
"is",
"also",
"the",
"compiler",
"log",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java#L61-L66
|
5,460 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java
|
Messager.getText
|
String getText(String key, Object... args) {
return messages.getLocalizedString(locale, key, args);
}
|
java
|
String getText(String key, Object... args) {
return messages.getLocalizedString(locale, key, args);
}
|
[
"String",
"getText",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"messages",
".",
"getLocalizedString",
"(",
"locale",
",",
"key",
",",
"args",
")",
";",
"}"
] |
get and format message string from resource
@param key selects message from resource
@param args arguments for the message
|
[
"get",
"and",
"format",
"message",
"string",
"from",
"resource"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java#L140-L142
|
5,461 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java
|
Messager.printWarning
|
public void printWarning(SourcePosition pos, String msg) {
if (diagListener != null) {
report(DiagnosticType.WARNING, pos, msg);
return;
}
if (nwarnings < MaxWarnings) {
String prefix = (pos == null) ? programName : pos.toString();
PrintWriter warnWriter = getWriter(WriterKind.WARNING);
warnWriter.println(prefix + ": " + getText("javadoc.warning") +" - " + msg);
warnWriter.flush();
nwarnings++;
}
}
|
java
|
public void printWarning(SourcePosition pos, String msg) {
if (diagListener != null) {
report(DiagnosticType.WARNING, pos, msg);
return;
}
if (nwarnings < MaxWarnings) {
String prefix = (pos == null) ? programName : pos.toString();
PrintWriter warnWriter = getWriter(WriterKind.WARNING);
warnWriter.println(prefix + ": " + getText("javadoc.warning") +" - " + msg);
warnWriter.flush();
nwarnings++;
}
}
|
[
"public",
"void",
"printWarning",
"(",
"SourcePosition",
"pos",
",",
"String",
"msg",
")",
"{",
"if",
"(",
"diagListener",
"!=",
"null",
")",
"{",
"report",
"(",
"DiagnosticType",
".",
"WARNING",
",",
"pos",
",",
"msg",
")",
";",
"return",
";",
"}",
"if",
"(",
"nwarnings",
"<",
"MaxWarnings",
")",
"{",
"String",
"prefix",
"=",
"(",
"pos",
"==",
"null",
")",
"?",
"programName",
":",
"pos",
".",
"toString",
"(",
")",
";",
"PrintWriter",
"warnWriter",
"=",
"getWriter",
"(",
"WriterKind",
".",
"WARNING",
")",
";",
"warnWriter",
".",
"println",
"(",
"prefix",
"+",
"\": \"",
"+",
"getText",
"(",
"\"javadoc.warning\"",
")",
"+",
"\" - \"",
"+",
"msg",
")",
";",
"warnWriter",
".",
"flush",
"(",
")",
";",
"nwarnings",
"++",
";",
"}",
"}"
] |
Print warning message, increment warning count.
Part of DocErrorReporter.
@param pos the position where the error occurs
@param msg message to print
|
[
"Print",
"warning",
"message",
"increment",
"warning",
"count",
".",
"Part",
"of",
"DocErrorReporter",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java#L194-L207
|
5,462 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Pool.java
|
Pool.get
|
public int get(Object o) {
Integer n = indices.get(o);
return n == null ? -1 : n.intValue();
}
|
java
|
public int get(Object o) {
Integer n = indices.get(o);
return n == null ? -1 : n.intValue();
}
|
[
"public",
"int",
"get",
"(",
"Object",
"o",
")",
"{",
"Integer",
"n",
"=",
"indices",
".",
"get",
"(",
"o",
")",
";",
"return",
"n",
"==",
"null",
"?",
"-",
"1",
":",
"n",
".",
"intValue",
"(",
")",
";",
"}"
] |
Return the given object's index in the pool,
or -1 if object is not in there.
|
[
"Return",
"the",
"given",
"object",
"s",
"index",
"in",
"the",
"pool",
"or",
"-",
"1",
"if",
"object",
"is",
"not",
"in",
"there",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Pool.java#L152-L155
|
5,463 |
google/error-prone-javac
|
src/java.compiler/share/classes/javax/tools/ToolProvider.java
|
ToolProvider.getSystemTool
|
private static <T> T getSystemTool(Class<T> clazz, String moduleName, String className) {
if (useLegacy) {
try {
return Class.forName(className, true, ClassLoader.getSystemClassLoader()).
asSubclass(clazz).getConstructor().newInstance();
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
try {
ServiceLoader<T> sl = ServiceLoader.load(clazz, ClassLoader.getSystemClassLoader());
for (Iterator<T> iter = sl.iterator(); iter.hasNext(); ) {
T tool = iter.next();
if (matches(tool, moduleName))
return tool;
}
} catch (ServiceConfigurationError e) {
throw new Error(e);
}
return null;
}
|
java
|
private static <T> T getSystemTool(Class<T> clazz, String moduleName, String className) {
if (useLegacy) {
try {
return Class.forName(className, true, ClassLoader.getSystemClassLoader()).
asSubclass(clazz).getConstructor().newInstance();
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
try {
ServiceLoader<T> sl = ServiceLoader.load(clazz, ClassLoader.getSystemClassLoader());
for (Iterator<T> iter = sl.iterator(); iter.hasNext(); ) {
T tool = iter.next();
if (matches(tool, moduleName))
return tool;
}
} catch (ServiceConfigurationError e) {
throw new Error(e);
}
return null;
}
|
[
"private",
"static",
"<",
"T",
">",
"T",
"getSystemTool",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"moduleName",
",",
"String",
"className",
")",
"{",
"if",
"(",
"useLegacy",
")",
"{",
"try",
"{",
"return",
"Class",
".",
"forName",
"(",
"className",
",",
"true",
",",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
")",
".",
"asSubclass",
"(",
"clazz",
")",
".",
"getConstructor",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"ReflectiveOperationException",
"e",
")",
"{",
"throw",
"new",
"Error",
"(",
"e",
")",
";",
"}",
"}",
"try",
"{",
"ServiceLoader",
"<",
"T",
">",
"sl",
"=",
"ServiceLoader",
".",
"load",
"(",
"clazz",
",",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
")",
";",
"for",
"(",
"Iterator",
"<",
"T",
">",
"iter",
"=",
"sl",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"T",
"tool",
"=",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"matches",
"(",
"tool",
",",
"moduleName",
")",
")",
"return",
"tool",
";",
"}",
"}",
"catch",
"(",
"ServiceConfigurationError",
"e",
")",
"{",
"throw",
"new",
"Error",
"(",
"e",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Get an instance of a system tool using the service loader.
@implNote By default, this returns the implementation in the specified module.
For limited backward compatibility, if this code is run on an older version
of the Java platform that does not support modules, this method will
try and create an instance of the named class. Note that implies the
class must be available on the system class path.
@param <T> the interface of the tool
@param clazz the interface of the tool
@param moduleName the name of the module containing the desired implementation
@param className the class name of the desired implementation
@return the specified implementation of the tool
|
[
"Get",
"an",
"instance",
"of",
"a",
"system",
"tool",
"using",
"the",
"service",
"loader",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/tools/ToolProvider.java#L128-L149
|
5,464 |
google/error-prone-javac
|
src/java.compiler/share/classes/javax/tools/ToolProvider.java
|
ToolProvider.matches
|
private static <T> boolean matches(T tool, String moduleName) {
PrivilegedAction<Boolean> pa = () -> {
// for now, use reflection to implement
// return moduleName.equals(tool.getClass().getModule().getName());
try {
Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
Object toolModule = getModuleMethod.invoke(tool.getClass());
Method getNameMethod = toolModule.getClass().getDeclaredMethod("getName");
String toolModuleName = (String) getNameMethod.invoke(toolModule);
return moduleName.equals(toolModuleName);
} catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
return false;
}
};
return AccessController.doPrivileged(pa);
}
|
java
|
private static <T> boolean matches(T tool, String moduleName) {
PrivilegedAction<Boolean> pa = () -> {
// for now, use reflection to implement
// return moduleName.equals(tool.getClass().getModule().getName());
try {
Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
Object toolModule = getModuleMethod.invoke(tool.getClass());
Method getNameMethod = toolModule.getClass().getDeclaredMethod("getName");
String toolModuleName = (String) getNameMethod.invoke(toolModule);
return moduleName.equals(toolModuleName);
} catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
return false;
}
};
return AccessController.doPrivileged(pa);
}
|
[
"private",
"static",
"<",
"T",
">",
"boolean",
"matches",
"(",
"T",
"tool",
",",
"String",
"moduleName",
")",
"{",
"PrivilegedAction",
"<",
"Boolean",
">",
"pa",
"=",
"(",
")",
"->",
"{",
"// for now, use reflection to implement",
"// return moduleName.equals(tool.getClass().getModule().getName());",
"try",
"{",
"Method",
"getModuleMethod",
"=",
"Class",
".",
"class",
".",
"getDeclaredMethod",
"(",
"\"getModule\"",
")",
";",
"Object",
"toolModule",
"=",
"getModuleMethod",
".",
"invoke",
"(",
"tool",
".",
"getClass",
"(",
")",
")",
";",
"Method",
"getNameMethod",
"=",
"toolModule",
".",
"getClass",
"(",
")",
".",
"getDeclaredMethod",
"(",
"\"getName\"",
")",
";",
"String",
"toolModuleName",
"=",
"(",
"String",
")",
"getNameMethod",
".",
"invoke",
"(",
"toolModule",
")",
";",
"return",
"moduleName",
".",
"equals",
"(",
"toolModuleName",
")",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"|",
"NoSuchMethodException",
"|",
"IllegalAccessException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
";",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"pa",
")",
";",
"}"
] |
Determine if this is the desired tool instance.
@param <T> the interface of the tool
@param tool the instance of the tool
@param moduleName the name of the module containing the desired implementation
@return true if and only if the tool matches the specified criteria
|
[
"Determine",
"if",
"this",
"is",
"the",
"desired",
"tool",
"instance",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/tools/ToolProvider.java#L158-L173
|
5,465 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java
|
ModuleSummaryBuilder.getInstance
|
public static ModuleSummaryBuilder getInstance(Context context,
ModuleElement mdle, ModuleSummaryWriter moduleWriter) {
return new ModuleSummaryBuilder(context, mdle, moduleWriter);
}
|
java
|
public static ModuleSummaryBuilder getInstance(Context context,
ModuleElement mdle, ModuleSummaryWriter moduleWriter) {
return new ModuleSummaryBuilder(context, mdle, moduleWriter);
}
|
[
"public",
"static",
"ModuleSummaryBuilder",
"getInstance",
"(",
"Context",
"context",
",",
"ModuleElement",
"mdle",
",",
"ModuleSummaryWriter",
"moduleWriter",
")",
"{",
"return",
"new",
"ModuleSummaryBuilder",
"(",
"context",
",",
"mdle",
",",
"moduleWriter",
")",
";",
"}"
] |
Construct a new ModuleSummaryBuilder.
@param context the build context.
@param mdle the module being documented.
@param moduleWriter the doclet specific writer that will output the
result.
@return an instance of a ModuleSummaryBuilder.
|
[
"Construct",
"a",
"new",
"ModuleSummaryBuilder",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java#L99-L102
|
5,466 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java
|
ModuleSummaryBuilder.buildModuleDoc
|
public void buildModuleDoc(XMLNode node, Content contentTree) throws DocletException {
contentTree = moduleWriter.getModuleHeader(mdle.getQualifiedName().toString());
buildChildren(node, contentTree);
moduleWriter.addModuleFooter(contentTree);
moduleWriter.printDocument(contentTree);
utils.copyDirectory(mdle, DocPaths.moduleSummary(mdle));
}
|
java
|
public void buildModuleDoc(XMLNode node, Content contentTree) throws DocletException {
contentTree = moduleWriter.getModuleHeader(mdle.getQualifiedName().toString());
buildChildren(node, contentTree);
moduleWriter.addModuleFooter(contentTree);
moduleWriter.printDocument(contentTree);
utils.copyDirectory(mdle, DocPaths.moduleSummary(mdle));
}
|
[
"public",
"void",
"buildModuleDoc",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"throws",
"DocletException",
"{",
"contentTree",
"=",
"moduleWriter",
".",
"getModuleHeader",
"(",
"mdle",
".",
"getQualifiedName",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"buildChildren",
"(",
"node",
",",
"contentTree",
")",
";",
"moduleWriter",
".",
"addModuleFooter",
"(",
"contentTree",
")",
";",
"moduleWriter",
".",
"printDocument",
"(",
"contentTree",
")",
";",
"utils",
".",
"copyDirectory",
"(",
"mdle",
",",
"DocPaths",
".",
"moduleSummary",
"(",
"mdle",
")",
")",
";",
"}"
] |
Build the module documentation.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the documentation will be added
@throws DocletException if there is a problem while building the documentation
|
[
"Build",
"the",
"module",
"documentation",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java#L133-L139
|
5,467 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java
|
ModuleSummaryBuilder.buildContent
|
public void buildContent(XMLNode node, Content contentTree) throws DocletException {
Content moduleContentTree = moduleWriter.getContentHeader();
buildChildren(node, moduleContentTree);
moduleWriter.addModuleContent(contentTree, moduleContentTree);
}
|
java
|
public void buildContent(XMLNode node, Content contentTree) throws DocletException {
Content moduleContentTree = moduleWriter.getContentHeader();
buildChildren(node, moduleContentTree);
moduleWriter.addModuleContent(contentTree, moduleContentTree);
}
|
[
"public",
"void",
"buildContent",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"throws",
"DocletException",
"{",
"Content",
"moduleContentTree",
"=",
"moduleWriter",
".",
"getContentHeader",
"(",
")",
";",
"buildChildren",
"(",
"node",
",",
"moduleContentTree",
")",
";",
"moduleWriter",
".",
"addModuleContent",
"(",
"contentTree",
",",
"moduleContentTree",
")",
";",
"}"
] |
Build the content for the module doc.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the module contents
will be added
@throws DocletException if there is a problem while building the documentation
|
[
"Build",
"the",
"content",
"for",
"the",
"module",
"doc",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java#L149-L153
|
5,468 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java
|
ModuleSummaryBuilder.buildSummary
|
public void buildSummary(XMLNode node, Content moduleContentTree) throws DocletException {
Content summaryContentTree = moduleWriter.getSummaryHeader();
buildChildren(node, summaryContentTree);
moduleContentTree.addContent(moduleWriter.getSummaryTree(summaryContentTree));
}
|
java
|
public void buildSummary(XMLNode node, Content moduleContentTree) throws DocletException {
Content summaryContentTree = moduleWriter.getSummaryHeader();
buildChildren(node, summaryContentTree);
moduleContentTree.addContent(moduleWriter.getSummaryTree(summaryContentTree));
}
|
[
"public",
"void",
"buildSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"moduleContentTree",
")",
"throws",
"DocletException",
"{",
"Content",
"summaryContentTree",
"=",
"moduleWriter",
".",
"getSummaryHeader",
"(",
")",
";",
"buildChildren",
"(",
"node",
",",
"summaryContentTree",
")",
";",
"moduleContentTree",
".",
"addContent",
"(",
"moduleWriter",
".",
"getSummaryTree",
"(",
"summaryContentTree",
")",
")",
";",
"}"
] |
Build the module summary.
@param node the XML element that specifies which components to document
@param moduleContentTree the module content tree to which the summaries will
be added
@throws DocletException if there is a problem while building the documentation
|
[
"Build",
"the",
"module",
"summary",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java#L163-L167
|
5,469 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java
|
ModuleSummaryBuilder.buildModuleDescription
|
public void buildModuleDescription(XMLNode node, Content moduleContentTree) {
if (!configuration.nocomment) {
moduleWriter.addModuleDescription(moduleContentTree);
}
}
|
java
|
public void buildModuleDescription(XMLNode node, Content moduleContentTree) {
if (!configuration.nocomment) {
moduleWriter.addModuleDescription(moduleContentTree);
}
}
|
[
"public",
"void",
"buildModuleDescription",
"(",
"XMLNode",
"node",
",",
"Content",
"moduleContentTree",
")",
"{",
"if",
"(",
"!",
"configuration",
".",
"nocomment",
")",
"{",
"moduleWriter",
".",
"addModuleDescription",
"(",
"moduleContentTree",
")",
";",
"}",
"}"
] |
Build the description for the module.
@param node the XML element that specifies which components to document
@param moduleContentTree the tree to which the module description will
be added
|
[
"Build",
"the",
"description",
"for",
"the",
"module",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java#L207-L211
|
5,470 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
|
SerializedFormBuilder.buildClassContent
|
public void buildClassContent(XMLNode node, Content classTree) throws DocletException {
Content classContentTree = writer.getClassContentHeader();
buildChildren(node, classContentTree);
classTree.addContent(classContentTree);
}
|
java
|
public void buildClassContent(XMLNode node, Content classTree) throws DocletException {
Content classContentTree = writer.getClassContentHeader();
buildChildren(node, classContentTree);
classTree.addContent(classContentTree);
}
|
[
"public",
"void",
"buildClassContent",
"(",
"XMLNode",
"node",
",",
"Content",
"classTree",
")",
"throws",
"DocletException",
"{",
"Content",
"classContentTree",
"=",
"writer",
".",
"getClassContentHeader",
"(",
")",
";",
"buildChildren",
"(",
"node",
",",
"classContentTree",
")",
";",
"classTree",
".",
"addContent",
"(",
"classContentTree",
")",
";",
"}"
] |
Build the summaries for the methods and fields.
@param node the XML element that specifies which components to document
@param classTree content tree to which the documentation will be added
@throws DocletException if there is a problem while building the documentation
|
[
"Build",
"the",
"summaries",
"for",
"the",
"methods",
"and",
"fields",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L274-L278
|
5,471 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
|
SerializedFormBuilder.buildMethodSubHeader
|
public void buildMethodSubHeader(XMLNode node, Content methodsContentTree) {
methodWriter.addMemberHeader((ExecutableElement)currentMember, methodsContentTree);
}
|
java
|
public void buildMethodSubHeader(XMLNode node, Content methodsContentTree) {
methodWriter.addMemberHeader((ExecutableElement)currentMember, methodsContentTree);
}
|
[
"public",
"void",
"buildMethodSubHeader",
"(",
"XMLNode",
"node",
",",
"Content",
"methodsContentTree",
")",
"{",
"methodWriter",
".",
"addMemberHeader",
"(",
"(",
"ExecutableElement",
")",
"currentMember",
",",
"methodsContentTree",
")",
";",
"}"
] |
Build the method sub header.
@param node the XML element that specifies which components to document
@param methodsContentTree content tree to which the documentation will be added
|
[
"Build",
"the",
"method",
"sub",
"header",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L322-L324
|
5,472 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
|
SerializedFormBuilder.buildDeprecatedMethodInfo
|
public void buildDeprecatedMethodInfo(XMLNode node, Content methodsContentTree) {
methodWriter.addDeprecatedMemberInfo((ExecutableElement)currentMember, methodsContentTree);
}
|
java
|
public void buildDeprecatedMethodInfo(XMLNode node, Content methodsContentTree) {
methodWriter.addDeprecatedMemberInfo((ExecutableElement)currentMember, methodsContentTree);
}
|
[
"public",
"void",
"buildDeprecatedMethodInfo",
"(",
"XMLNode",
"node",
",",
"Content",
"methodsContentTree",
")",
"{",
"methodWriter",
".",
"addDeprecatedMemberInfo",
"(",
"(",
"ExecutableElement",
")",
"currentMember",
",",
"methodsContentTree",
")",
";",
"}"
] |
Build the deprecated method description.
@param node the XML element that specifies which components to document
@param methodsContentTree content tree to which the documentation will be added
|
[
"Build",
"the",
"deprecated",
"method",
"description",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L332-L334
|
5,473 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
|
SerializedFormBuilder.buildMethodInfo
|
public void buildMethodInfo(XMLNode node, Content methodsContentTree) throws DocletException {
if(configuration.nocomment){
return;
}
buildChildren(node, methodsContentTree);
}
|
java
|
public void buildMethodInfo(XMLNode node, Content methodsContentTree) throws DocletException {
if(configuration.nocomment){
return;
}
buildChildren(node, methodsContentTree);
}
|
[
"public",
"void",
"buildMethodInfo",
"(",
"XMLNode",
"node",
",",
"Content",
"methodsContentTree",
")",
"throws",
"DocletException",
"{",
"if",
"(",
"configuration",
".",
"nocomment",
")",
"{",
"return",
";",
"}",
"buildChildren",
"(",
"node",
",",
"methodsContentTree",
")",
";",
"}"
] |
Build the information for the method.
@param node the XML element that specifies which components to document
@param methodsContentTree content tree to which the documentation will be added
@throws DocletException if there is a problem while building the documentation
|
[
"Build",
"the",
"information",
"for",
"the",
"method",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L343-L348
|
5,474 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
|
SerializedFormBuilder.serialInclude
|
public static boolean serialInclude(Utils utils, Element element) {
if (element == null) {
return false;
}
return utils.isClass(element)
? serialClassInclude(utils, (TypeElement)element)
: serialDocInclude(utils, element);
}
|
java
|
public static boolean serialInclude(Utils utils, Element element) {
if (element == null) {
return false;
}
return utils.isClass(element)
? serialClassInclude(utils, (TypeElement)element)
: serialDocInclude(utils, element);
}
|
[
"public",
"static",
"boolean",
"serialInclude",
"(",
"Utils",
"utils",
",",
"Element",
"element",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"utils",
".",
"isClass",
"(",
"element",
")",
"?",
"serialClassInclude",
"(",
"utils",
",",
"(",
"TypeElement",
")",
"element",
")",
":",
"serialDocInclude",
"(",
"utils",
",",
"element",
")",
";",
"}"
] |
Returns true if the given Element should be included
in the serialized form.
@param utils the utils object
@param element the Element object to check for serializability
@return true if the element should be included in the serial form
|
[
"Returns",
"true",
"if",
"the",
"given",
"Element",
"should",
"be",
"included",
"in",
"the",
"serialized",
"form",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L555-L562
|
5,475 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
|
SerializedFormBuilder.serialClassInclude
|
private static boolean serialClassInclude(Utils utils, TypeElement te) {
if (utils.isEnum(te)) {
return false;
}
if (utils.isSerializable(te)) {
if (!utils.getSerialTrees(te).isEmpty()) {
return serialDocInclude(utils, te);
} else if (utils.isPublic(te) || utils.isProtected(te)) {
return true;
} else {
return false;
}
}
return false;
}
|
java
|
private static boolean serialClassInclude(Utils utils, TypeElement te) {
if (utils.isEnum(te)) {
return false;
}
if (utils.isSerializable(te)) {
if (!utils.getSerialTrees(te).isEmpty()) {
return serialDocInclude(utils, te);
} else if (utils.isPublic(te) || utils.isProtected(te)) {
return true;
} else {
return false;
}
}
return false;
}
|
[
"private",
"static",
"boolean",
"serialClassInclude",
"(",
"Utils",
"utils",
",",
"TypeElement",
"te",
")",
"{",
"if",
"(",
"utils",
".",
"isEnum",
"(",
"te",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"utils",
".",
"isSerializable",
"(",
"te",
")",
")",
"{",
"if",
"(",
"!",
"utils",
".",
"getSerialTrees",
"(",
"te",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"serialDocInclude",
"(",
"utils",
",",
"te",
")",
";",
"}",
"else",
"if",
"(",
"utils",
".",
"isPublic",
"(",
"te",
")",
"||",
"utils",
".",
"isProtected",
"(",
"te",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns true if the given TypeElement should be included
in the serialized form.
@param te the TypeElement object to check for serializability.
|
[
"Returns",
"true",
"if",
"the",
"given",
"TypeElement",
"should",
"be",
"included",
"in",
"the",
"serialized",
"form",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L570-L584
|
5,476 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
|
SerializedFormBuilder.serialDocInclude
|
private static boolean serialDocInclude(Utils utils, Element element) {
if (utils.isEnum(element)) {
return false;
}
List<? extends DocTree> serial = utils.getSerialTrees(element);
if (!serial.isEmpty()) {
CommentHelper ch = utils.getCommentHelper(element);
String serialtext = Utils.toLowerCase(ch.getText(serial.get(0)));
if (serialtext.contains("exclude")) {
return false;
} else if (serialtext.contains("include")) {
return true;
}
}
return true;
}
|
java
|
private static boolean serialDocInclude(Utils utils, Element element) {
if (utils.isEnum(element)) {
return false;
}
List<? extends DocTree> serial = utils.getSerialTrees(element);
if (!serial.isEmpty()) {
CommentHelper ch = utils.getCommentHelper(element);
String serialtext = Utils.toLowerCase(ch.getText(serial.get(0)));
if (serialtext.contains("exclude")) {
return false;
} else if (serialtext.contains("include")) {
return true;
}
}
return true;
}
|
[
"private",
"static",
"boolean",
"serialDocInclude",
"(",
"Utils",
"utils",
",",
"Element",
"element",
")",
"{",
"if",
"(",
"utils",
".",
"isEnum",
"(",
"element",
")",
")",
"{",
"return",
"false",
";",
"}",
"List",
"<",
"?",
"extends",
"DocTree",
">",
"serial",
"=",
"utils",
".",
"getSerialTrees",
"(",
"element",
")",
";",
"if",
"(",
"!",
"serial",
".",
"isEmpty",
"(",
")",
")",
"{",
"CommentHelper",
"ch",
"=",
"utils",
".",
"getCommentHelper",
"(",
"element",
")",
";",
"String",
"serialtext",
"=",
"Utils",
".",
"toLowerCase",
"(",
"ch",
".",
"getText",
"(",
"serial",
".",
"get",
"(",
"0",
")",
")",
")",
";",
"if",
"(",
"serialtext",
".",
"contains",
"(",
"\"exclude\"",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"serialtext",
".",
"contains",
"(",
"\"include\"",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Return true if the given Element should be included
in the serialized form.
@param element the Element to check for serializability.
|
[
"Return",
"true",
"if",
"the",
"given",
"Element",
"should",
"be",
"included",
"in",
"the",
"serialized",
"form",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L592-L607
|
5,477 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/InverseDepsAnalyzer.java
|
InverseDepsAnalyzer.inverseDependences
|
public Set<Deque<Archive>> inverseDependences() throws IOException {
// create a new dependency finder to do the analysis
DependencyFinder dependencyFinder = new DependencyFinder(configuration, DEFAULT_FILTER);
try {
// parse all archives in unnamed module to get compile-time dependences
Stream<Archive> archives =
Stream.concat(configuration.initialArchives().stream(),
configuration.classPathArchives().stream());
if (apiOnly) {
dependencyFinder.parseExportedAPIs(archives);
} else {
dependencyFinder.parse(archives);
}
Graph.Builder<Archive> builder = new Graph.Builder<>();
// include all target nodes
targets().forEach(builder::addNode);
// transpose the module graph
configuration.getModules().values().stream()
.forEach(m -> {
builder.addNode(m);
m.descriptor().requires().stream()
.map(Requires::name)
.map(configuration::findModule) // must be present
.forEach(v -> builder.addEdge(v.get(), m));
});
// add the dependences from the analysis
Map<Archive, Set<Archive>> dependences = dependencyFinder.dependences();
dependences.entrySet().stream()
.forEach(e -> {
Archive u = e.getKey();
builder.addNode(u);
e.getValue().forEach(v -> builder.addEdge(v, u));
});
// transposed dependence graph.
Graph<Archive> graph = builder.build();
trace("targets: %s%n", targets());
// Traverse from the targets and find all paths
// rebuild a graph with all nodes that depends on targets
// targets directly and indirectly
return targets().stream()
.map(t -> findPaths(graph, t))
.flatMap(Set::stream)
.collect(Collectors.toSet());
} finally {
dependencyFinder.shutdown();
}
}
|
java
|
public Set<Deque<Archive>> inverseDependences() throws IOException {
// create a new dependency finder to do the analysis
DependencyFinder dependencyFinder = new DependencyFinder(configuration, DEFAULT_FILTER);
try {
// parse all archives in unnamed module to get compile-time dependences
Stream<Archive> archives =
Stream.concat(configuration.initialArchives().stream(),
configuration.classPathArchives().stream());
if (apiOnly) {
dependencyFinder.parseExportedAPIs(archives);
} else {
dependencyFinder.parse(archives);
}
Graph.Builder<Archive> builder = new Graph.Builder<>();
// include all target nodes
targets().forEach(builder::addNode);
// transpose the module graph
configuration.getModules().values().stream()
.forEach(m -> {
builder.addNode(m);
m.descriptor().requires().stream()
.map(Requires::name)
.map(configuration::findModule) // must be present
.forEach(v -> builder.addEdge(v.get(), m));
});
// add the dependences from the analysis
Map<Archive, Set<Archive>> dependences = dependencyFinder.dependences();
dependences.entrySet().stream()
.forEach(e -> {
Archive u = e.getKey();
builder.addNode(u);
e.getValue().forEach(v -> builder.addEdge(v, u));
});
// transposed dependence graph.
Graph<Archive> graph = builder.build();
trace("targets: %s%n", targets());
// Traverse from the targets and find all paths
// rebuild a graph with all nodes that depends on targets
// targets directly and indirectly
return targets().stream()
.map(t -> findPaths(graph, t))
.flatMap(Set::stream)
.collect(Collectors.toSet());
} finally {
dependencyFinder.shutdown();
}
}
|
[
"public",
"Set",
"<",
"Deque",
"<",
"Archive",
">",
">",
"inverseDependences",
"(",
")",
"throws",
"IOException",
"{",
"// create a new dependency finder to do the analysis",
"DependencyFinder",
"dependencyFinder",
"=",
"new",
"DependencyFinder",
"(",
"configuration",
",",
"DEFAULT_FILTER",
")",
";",
"try",
"{",
"// parse all archives in unnamed module to get compile-time dependences",
"Stream",
"<",
"Archive",
">",
"archives",
"=",
"Stream",
".",
"concat",
"(",
"configuration",
".",
"initialArchives",
"(",
")",
".",
"stream",
"(",
")",
",",
"configuration",
".",
"classPathArchives",
"(",
")",
".",
"stream",
"(",
")",
")",
";",
"if",
"(",
"apiOnly",
")",
"{",
"dependencyFinder",
".",
"parseExportedAPIs",
"(",
"archives",
")",
";",
"}",
"else",
"{",
"dependencyFinder",
".",
"parse",
"(",
"archives",
")",
";",
"}",
"Graph",
".",
"Builder",
"<",
"Archive",
">",
"builder",
"=",
"new",
"Graph",
".",
"Builder",
"<>",
"(",
")",
";",
"// include all target nodes",
"targets",
"(",
")",
".",
"forEach",
"(",
"builder",
"::",
"addNode",
")",
";",
"// transpose the module graph",
"configuration",
".",
"getModules",
"(",
")",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"forEach",
"(",
"m",
"->",
"{",
"builder",
".",
"addNode",
"(",
"m",
")",
";",
"m",
".",
"descriptor",
"(",
")",
".",
"requires",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"Requires",
"::",
"name",
")",
".",
"map",
"(",
"configuration",
"::",
"findModule",
")",
"// must be present",
".",
"forEach",
"(",
"v",
"->",
"builder",
".",
"addEdge",
"(",
"v",
".",
"get",
"(",
")",
",",
"m",
")",
")",
";",
"}",
")",
";",
"// add the dependences from the analysis",
"Map",
"<",
"Archive",
",",
"Set",
"<",
"Archive",
">",
">",
"dependences",
"=",
"dependencyFinder",
".",
"dependences",
"(",
")",
";",
"dependences",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"forEach",
"(",
"e",
"->",
"{",
"Archive",
"u",
"=",
"e",
".",
"getKey",
"(",
")",
";",
"builder",
".",
"addNode",
"(",
"u",
")",
";",
"e",
".",
"getValue",
"(",
")",
".",
"forEach",
"(",
"v",
"->",
"builder",
".",
"addEdge",
"(",
"v",
",",
"u",
")",
")",
";",
"}",
")",
";",
"// transposed dependence graph.",
"Graph",
"<",
"Archive",
">",
"graph",
"=",
"builder",
".",
"build",
"(",
")",
";",
"trace",
"(",
"\"targets: %s%n\"",
",",
"targets",
"(",
")",
")",
";",
"// Traverse from the targets and find all paths",
"// rebuild a graph with all nodes that depends on targets",
"// targets directly and indirectly",
"return",
"targets",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"t",
"->",
"findPaths",
"(",
"graph",
",",
"t",
")",
")",
".",
"flatMap",
"(",
"Set",
"::",
"stream",
")",
".",
"collect",
"(",
"Collectors",
".",
"toSet",
"(",
")",
")",
";",
"}",
"finally",
"{",
"dependencyFinder",
".",
"shutdown",
"(",
")",
";",
"}",
"}"
] |
Finds all inverse transitive dependencies using the given requires set
as the targets, if non-empty. If the given requires set is empty,
use the archives depending the packages specified in -regex or -p options.
|
[
"Finds",
"all",
"inverse",
"transitive",
"dependencies",
"using",
"the",
"given",
"requires",
"set",
"as",
"the",
"targets",
"if",
"non",
"-",
"empty",
".",
"If",
"the",
"given",
"requires",
"set",
"is",
"empty",
"use",
"the",
"archives",
"depending",
"the",
"packages",
"specified",
"in",
"-",
"regex",
"or",
"-",
"p",
"options",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/InverseDepsAnalyzer.java#L125-L176
|
5,478 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/InverseDepsAnalyzer.java
|
InverseDepsAnalyzer.findPaths
|
private Set<Deque<Archive>> findPaths(Graph<Archive> graph, Archive target) {
// path is in reversed order
Deque<Archive> path = new LinkedList<>();
path.push(target);
Set<Edge<Archive>> visited = new HashSet<>();
Deque<Edge<Archive>> deque = new LinkedList<>();
deque.addAll(graph.edgesFrom(target));
if (deque.isEmpty()) {
return makePaths(path).collect(Collectors.toSet());
}
Set<Deque<Archive>> allPaths = new HashSet<>();
while (!deque.isEmpty()) {
Edge<Archive> edge = deque.pop();
if (visited.contains(edge))
continue;
Archive node = edge.v;
path.addLast(node);
visited.add(edge);
Set<Edge<Archive>> unvisitedDeps = graph.edgesFrom(node)
.stream()
.filter(e -> !visited.contains(e))
.collect(Collectors.toSet());
trace("visiting %s %s (%s)%n", edge, path, unvisitedDeps);
if (unvisitedDeps.isEmpty()) {
makePaths(path).forEach(allPaths::add);
path.removeLast();
}
// push unvisited adjacent edges
unvisitedDeps.stream().forEach(deque::push);
// when the adjacent edges of a node are visited, pop it from the path
while (!path.isEmpty()) {
if (visited.containsAll(graph.edgesFrom(path.peekLast())))
path.removeLast();
else
break;
}
}
return allPaths;
}
|
java
|
private Set<Deque<Archive>> findPaths(Graph<Archive> graph, Archive target) {
// path is in reversed order
Deque<Archive> path = new LinkedList<>();
path.push(target);
Set<Edge<Archive>> visited = new HashSet<>();
Deque<Edge<Archive>> deque = new LinkedList<>();
deque.addAll(graph.edgesFrom(target));
if (deque.isEmpty()) {
return makePaths(path).collect(Collectors.toSet());
}
Set<Deque<Archive>> allPaths = new HashSet<>();
while (!deque.isEmpty()) {
Edge<Archive> edge = deque.pop();
if (visited.contains(edge))
continue;
Archive node = edge.v;
path.addLast(node);
visited.add(edge);
Set<Edge<Archive>> unvisitedDeps = graph.edgesFrom(node)
.stream()
.filter(e -> !visited.contains(e))
.collect(Collectors.toSet());
trace("visiting %s %s (%s)%n", edge, path, unvisitedDeps);
if (unvisitedDeps.isEmpty()) {
makePaths(path).forEach(allPaths::add);
path.removeLast();
}
// push unvisited adjacent edges
unvisitedDeps.stream().forEach(deque::push);
// when the adjacent edges of a node are visited, pop it from the path
while (!path.isEmpty()) {
if (visited.containsAll(graph.edgesFrom(path.peekLast())))
path.removeLast();
else
break;
}
}
return allPaths;
}
|
[
"private",
"Set",
"<",
"Deque",
"<",
"Archive",
">",
">",
"findPaths",
"(",
"Graph",
"<",
"Archive",
">",
"graph",
",",
"Archive",
"target",
")",
"{",
"// path is in reversed order",
"Deque",
"<",
"Archive",
">",
"path",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"path",
".",
"push",
"(",
"target",
")",
";",
"Set",
"<",
"Edge",
"<",
"Archive",
">",
">",
"visited",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"Deque",
"<",
"Edge",
"<",
"Archive",
">",
">",
"deque",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"deque",
".",
"addAll",
"(",
"graph",
".",
"edgesFrom",
"(",
"target",
")",
")",
";",
"if",
"(",
"deque",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"makePaths",
"(",
"path",
")",
".",
"collect",
"(",
"Collectors",
".",
"toSet",
"(",
")",
")",
";",
"}",
"Set",
"<",
"Deque",
"<",
"Archive",
">",
">",
"allPaths",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"while",
"(",
"!",
"deque",
".",
"isEmpty",
"(",
")",
")",
"{",
"Edge",
"<",
"Archive",
">",
"edge",
"=",
"deque",
".",
"pop",
"(",
")",
";",
"if",
"(",
"visited",
".",
"contains",
"(",
"edge",
")",
")",
"continue",
";",
"Archive",
"node",
"=",
"edge",
".",
"v",
";",
"path",
".",
"addLast",
"(",
"node",
")",
";",
"visited",
".",
"add",
"(",
"edge",
")",
";",
"Set",
"<",
"Edge",
"<",
"Archive",
">",
">",
"unvisitedDeps",
"=",
"graph",
".",
"edgesFrom",
"(",
"node",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"e",
"->",
"!",
"visited",
".",
"contains",
"(",
"e",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toSet",
"(",
")",
")",
";",
"trace",
"(",
"\"visiting %s %s (%s)%n\"",
",",
"edge",
",",
"path",
",",
"unvisitedDeps",
")",
";",
"if",
"(",
"unvisitedDeps",
".",
"isEmpty",
"(",
")",
")",
"{",
"makePaths",
"(",
"path",
")",
".",
"forEach",
"(",
"allPaths",
"::",
"add",
")",
";",
"path",
".",
"removeLast",
"(",
")",
";",
"}",
"// push unvisited adjacent edges",
"unvisitedDeps",
".",
"stream",
"(",
")",
".",
"forEach",
"(",
"deque",
"::",
"push",
")",
";",
"// when the adjacent edges of a node are visited, pop it from the path",
"while",
"(",
"!",
"path",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"visited",
".",
"containsAll",
"(",
"graph",
".",
"edgesFrom",
"(",
"path",
".",
"peekLast",
"(",
")",
")",
")",
")",
"path",
".",
"removeLast",
"(",
")",
";",
"else",
"break",
";",
"}",
"}",
"return",
"allPaths",
";",
"}"
] |
Returns all paths reachable from the given targets.
|
[
"Returns",
"all",
"paths",
"reachable",
"from",
"the",
"given",
"targets",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/InverseDepsAnalyzer.java#L181-L231
|
5,479 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/InverseDepsAnalyzer.java
|
InverseDepsAnalyzer.makePaths
|
private Stream<Deque<Archive>> makePaths(Deque<Archive> path) {
Set<Archive> nodes = endPoints.get(path.peekFirst());
if (nodes == null || nodes.isEmpty()) {
return Stream.of(new LinkedList<>(path));
} else {
return nodes.stream().map(n -> {
Deque<Archive> newPath = new LinkedList<>();
newPath.addFirst(n);
newPath.addAll(path);
return newPath;
});
}
}
|
java
|
private Stream<Deque<Archive>> makePaths(Deque<Archive> path) {
Set<Archive> nodes = endPoints.get(path.peekFirst());
if (nodes == null || nodes.isEmpty()) {
return Stream.of(new LinkedList<>(path));
} else {
return nodes.stream().map(n -> {
Deque<Archive> newPath = new LinkedList<>();
newPath.addFirst(n);
newPath.addAll(path);
return newPath;
});
}
}
|
[
"private",
"Stream",
"<",
"Deque",
"<",
"Archive",
">",
">",
"makePaths",
"(",
"Deque",
"<",
"Archive",
">",
"path",
")",
"{",
"Set",
"<",
"Archive",
">",
"nodes",
"=",
"endPoints",
".",
"get",
"(",
"path",
".",
"peekFirst",
"(",
")",
")",
";",
"if",
"(",
"nodes",
"==",
"null",
"||",
"nodes",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Stream",
".",
"of",
"(",
"new",
"LinkedList",
"<>",
"(",
"path",
")",
")",
";",
"}",
"else",
"{",
"return",
"nodes",
".",
"stream",
"(",
")",
".",
"map",
"(",
"n",
"->",
"{",
"Deque",
"<",
"Archive",
">",
"newPath",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"newPath",
".",
"addFirst",
"(",
"n",
")",
";",
"newPath",
".",
"addAll",
"(",
"path",
")",
";",
"return",
"newPath",
";",
"}",
")",
";",
"}",
"}"
] |
Prepend end point to the path
|
[
"Prepend",
"end",
"point",
"to",
"the",
"path"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/InverseDepsAnalyzer.java#L236-L248
|
5,480 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java
|
DocLint.run
|
public void run(String... args) throws BadArgs, IOException {
PrintWriter out = new PrintWriter(System.out);
try {
run(out, args);
} finally {
out.flush();
}
}
|
java
|
public void run(String... args) throws BadArgs, IOException {
PrintWriter out = new PrintWriter(System.out);
try {
run(out, args);
} finally {
out.flush();
}
}
|
[
"public",
"void",
"run",
"(",
"String",
"...",
"args",
")",
"throws",
"BadArgs",
",",
"IOException",
"{",
"PrintWriter",
"out",
"=",
"new",
"PrintWriter",
"(",
"System",
".",
"out",
")",
";",
"try",
"{",
"run",
"(",
"out",
",",
"args",
")",
";",
"}",
"finally",
"{",
"out",
".",
"flush",
"(",
")",
";",
"}",
"}"
] |
Simple API entry point.
@param args Options and operands for doclint
@throws BadArgs if an error is detected in any args
@throws IOException if there are problems with any of the file arguments
|
[
"Simple",
"API",
"entry",
"point",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java#L123-L130
|
5,481 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
|
PackageWriterImpl.getNavLinkClassUse
|
@Override
protected Content getNavLinkClassUse() {
Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
contents.useLabel, "", "");
Content li = HtmlTree.LI(useLink);
return li;
}
|
java
|
@Override
protected Content getNavLinkClassUse() {
Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
contents.useLabel, "", "");
Content li = HtmlTree.LI(useLink);
return li;
}
|
[
"@",
"Override",
"protected",
"Content",
"getNavLinkClassUse",
"(",
")",
"{",
"Content",
"useLink",
"=",
"getHyperLink",
"(",
"DocPaths",
".",
"PACKAGE_USE",
",",
"contents",
".",
"useLabel",
",",
"\"\"",
",",
"\"\"",
")",
";",
"Content",
"li",
"=",
"HtmlTree",
".",
"LI",
"(",
"useLink",
")",
";",
"return",
"li",
";",
"}"
] |
Get "Use" link for this pacakge in the navigation bar.
@return a content tree for the class use link
|
[
"Get",
"Use",
"link",
"for",
"this",
"pacakge",
"in",
"the",
"navigation",
"bar",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java#L311-L317
|
5,482 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
|
PackageWriterImpl.getNavLinkPackage
|
@Override
protected Content getNavLinkPackage() {
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.packageLabel);
return li;
}
|
java
|
@Override
protected Content getNavLinkPackage() {
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.packageLabel);
return li;
}
|
[
"@",
"Override",
"protected",
"Content",
"getNavLinkPackage",
"(",
")",
"{",
"Content",
"li",
"=",
"HtmlTree",
".",
"LI",
"(",
"HtmlStyle",
".",
"navBarCell1Rev",
",",
"contents",
".",
"packageLabel",
")",
";",
"return",
"li",
";",
"}"
] |
Highlight "Package" in the navigation bar, as this is the package page.
@return a content tree for the package link
|
[
"Highlight",
"Package",
"in",
"the",
"navigation",
"bar",
"as",
"this",
"is",
"the",
"package",
"page",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java#L387-L391
|
5,483 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.hard
|
@Override
public void hard(String format, Object... args) {
rawout(prefix(format), args);
}
|
java
|
@Override
public void hard(String format, Object... args) {
rawout(prefix(format), args);
}
|
[
"@",
"Override",
"public",
"void",
"hard",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"rawout",
"(",
"prefix",
"(",
"format",
")",
",",
"args",
")",
";",
"}"
] |
Must show command output
@param format printf format
@param args printf args
|
[
"Must",
"show",
"command",
"output"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L667-L670
|
5,484 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.getResourceString
|
String getResourceString(String key) {
if (outputRB == null) {
try {
outputRB = ResourceBundle.getBundle(L10N_RB_NAME, locale);
} catch (MissingResourceException mre) {
error("Cannot find ResourceBundle: %s for locale: %s", L10N_RB_NAME, locale);
return "";
}
}
String s;
try {
s = outputRB.getString(key);
} catch (MissingResourceException mre) {
error("Missing resource: %s in %s", key, L10N_RB_NAME);
return "";
}
return s;
}
|
java
|
String getResourceString(String key) {
if (outputRB == null) {
try {
outputRB = ResourceBundle.getBundle(L10N_RB_NAME, locale);
} catch (MissingResourceException mre) {
error("Cannot find ResourceBundle: %s for locale: %s", L10N_RB_NAME, locale);
return "";
}
}
String s;
try {
s = outputRB.getString(key);
} catch (MissingResourceException mre) {
error("Missing resource: %s in %s", key, L10N_RB_NAME);
return "";
}
return s;
}
|
[
"String",
"getResourceString",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"outputRB",
"==",
"null",
")",
"{",
"try",
"{",
"outputRB",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"L10N_RB_NAME",
",",
"locale",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
"mre",
")",
"{",
"error",
"(",
"\"Cannot find ResourceBundle: %s for locale: %s\"",
",",
"L10N_RB_NAME",
",",
"locale",
")",
";",
"return",
"\"\"",
";",
"}",
"}",
"String",
"s",
";",
"try",
"{",
"s",
"=",
"outputRB",
".",
"getString",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
"mre",
")",
"{",
"error",
"(",
"\"Missing resource: %s in %s\"",
",",
"key",
",",
"L10N_RB_NAME",
")",
";",
"return",
"\"\"",
";",
"}",
"return",
"s",
";",
"}"
] |
Resource bundle look-up
@param key the resource key
|
[
"Resource",
"bundle",
"look",
"-",
"up"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L709-L726
|
5,485 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.hardmsg
|
@Override
public void hardmsg(String key, Object... args) {
hard(messageFormat(key, args));
}
|
java
|
@Override
public void hardmsg(String key, Object... args) {
hard(messageFormat(key, args));
}
|
[
"@",
"Override",
"public",
"void",
"hardmsg",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"hard",
"(",
"messageFormat",
"(",
"key",
",",
"args",
")",
")",
";",
"}"
] |
Print using resource bundle look-up, MessageFormat, and add prefix and
postfix
@param key the resource key
@param args
|
[
"Print",
"using",
"resource",
"bundle",
"look",
"-",
"up",
"MessageFormat",
"and",
"add",
"prefix",
"and",
"postfix"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L799-L802
|
5,486 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.errormsg
|
@Override
public void errormsg(String key, Object... args) {
if (isRunningInteractive()) {
rawout(prefixError(messageFormat(key, args)));
} else {
startmsg(key, args);
}
}
|
java
|
@Override
public void errormsg(String key, Object... args) {
if (isRunningInteractive()) {
rawout(prefixError(messageFormat(key, args)));
} else {
startmsg(key, args);
}
}
|
[
"@",
"Override",
"public",
"void",
"errormsg",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isRunningInteractive",
"(",
")",
")",
"{",
"rawout",
"(",
"prefixError",
"(",
"messageFormat",
"(",
"key",
",",
"args",
")",
")",
")",
";",
"}",
"else",
"{",
"startmsg",
"(",
"key",
",",
"args",
")",
";",
"}",
"}"
] |
Print error using resource bundle look-up, MessageFormat, and add prefix
and postfix
@param key the resource key
@param args
|
[
"Print",
"error",
"using",
"resource",
"bundle",
"look",
"-",
"up",
"MessageFormat",
"and",
"add",
"prefix",
"and",
"postfix"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L811-L818
|
5,487 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.startmsg
|
void startmsg(String key, Object... args) {
cmderr.println(messageFormat(key, args));
}
|
java
|
void startmsg(String key, Object... args) {
cmderr.println(messageFormat(key, args));
}
|
[
"void",
"startmsg",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"cmderr",
".",
"println",
"(",
"messageFormat",
"(",
"key",
",",
"args",
")",
")",
";",
"}"
] |
Print command-line error using resource bundle look-up, MessageFormat
@param key the resource key
@param args
|
[
"Print",
"command",
"-",
"line",
"error",
"using",
"resource",
"bundle",
"look",
"-",
"up",
"MessageFormat"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L826-L828
|
5,488 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.start
|
public void start(String[] args) throws Exception {
OptionParserCommandLine commandLineArgs = new OptionParserCommandLine();
options = commandLineArgs.parse(args);
if (options == null) {
// Abort
return;
}
startup = commandLineArgs.startup();
// initialize editor settings
configEditor();
// initialize JShell instance
try {
resetState();
} catch (IllegalStateException ex) {
// Display just the cause (not a exception backtrace)
cmderr.println(ex.getMessage());
//abort
return;
}
// Read replay history from last jshell session into previous history
replayableHistoryPrevious = ReplayableHistory.fromPrevious(prefs);
// load snippet/command files given on command-line
for (String loadFile : commandLineArgs.nonOptions()) {
runFile(loadFile, "jshell");
}
// if we survived that...
if (regenerateOnDeath) {
// initialize the predefined feedback modes
initFeedback(commandLineArgs.feedbackMode());
}
// check again, as feedback setting could have failed
if (regenerateOnDeath) {
// if we haven't died, and the feedback mode wants fluff, print welcome
if (feedback.shouldDisplayCommandFluff()) {
hardmsg("jshell.msg.welcome", version());
}
// Be sure history is always saved so that user code isn't lost
Thread shutdownHook = new Thread() {
@Override
public void run() {
replayableHistory.storeHistory(prefs);
}
};
Runtime.getRuntime().addShutdownHook(shutdownHook);
// execute from user input
try (IOContext in = new ConsoleIOContext(this, cmdin, console)) {
while (regenerateOnDeath) {
if (!live) {
resetState();
}
run(in);
}
} finally {
replayableHistory.storeHistory(prefs);
closeState();
try {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
} catch (Exception ex) {
// ignore, this probably caused by VM aready being shutdown
// and this is the last act anyhow
}
}
}
closeState();
}
|
java
|
public void start(String[] args) throws Exception {
OptionParserCommandLine commandLineArgs = new OptionParserCommandLine();
options = commandLineArgs.parse(args);
if (options == null) {
// Abort
return;
}
startup = commandLineArgs.startup();
// initialize editor settings
configEditor();
// initialize JShell instance
try {
resetState();
} catch (IllegalStateException ex) {
// Display just the cause (not a exception backtrace)
cmderr.println(ex.getMessage());
//abort
return;
}
// Read replay history from last jshell session into previous history
replayableHistoryPrevious = ReplayableHistory.fromPrevious(prefs);
// load snippet/command files given on command-line
for (String loadFile : commandLineArgs.nonOptions()) {
runFile(loadFile, "jshell");
}
// if we survived that...
if (regenerateOnDeath) {
// initialize the predefined feedback modes
initFeedback(commandLineArgs.feedbackMode());
}
// check again, as feedback setting could have failed
if (regenerateOnDeath) {
// if we haven't died, and the feedback mode wants fluff, print welcome
if (feedback.shouldDisplayCommandFluff()) {
hardmsg("jshell.msg.welcome", version());
}
// Be sure history is always saved so that user code isn't lost
Thread shutdownHook = new Thread() {
@Override
public void run() {
replayableHistory.storeHistory(prefs);
}
};
Runtime.getRuntime().addShutdownHook(shutdownHook);
// execute from user input
try (IOContext in = new ConsoleIOContext(this, cmdin, console)) {
while (regenerateOnDeath) {
if (!live) {
resetState();
}
run(in);
}
} finally {
replayableHistory.storeHistory(prefs);
closeState();
try {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
} catch (Exception ex) {
// ignore, this probably caused by VM aready being shutdown
// and this is the last act anyhow
}
}
}
closeState();
}
|
[
"public",
"void",
"start",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"OptionParserCommandLine",
"commandLineArgs",
"=",
"new",
"OptionParserCommandLine",
"(",
")",
";",
"options",
"=",
"commandLineArgs",
".",
"parse",
"(",
"args",
")",
";",
"if",
"(",
"options",
"==",
"null",
")",
"{",
"// Abort",
"return",
";",
"}",
"startup",
"=",
"commandLineArgs",
".",
"startup",
"(",
")",
";",
"// initialize editor settings",
"configEditor",
"(",
")",
";",
"// initialize JShell instance",
"try",
"{",
"resetState",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"ex",
")",
"{",
"// Display just the cause (not a exception backtrace)",
"cmderr",
".",
"println",
"(",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"//abort",
"return",
";",
"}",
"// Read replay history from last jshell session into previous history",
"replayableHistoryPrevious",
"=",
"ReplayableHistory",
".",
"fromPrevious",
"(",
"prefs",
")",
";",
"// load snippet/command files given on command-line",
"for",
"(",
"String",
"loadFile",
":",
"commandLineArgs",
".",
"nonOptions",
"(",
")",
")",
"{",
"runFile",
"(",
"loadFile",
",",
"\"jshell\"",
")",
";",
"}",
"// if we survived that...",
"if",
"(",
"regenerateOnDeath",
")",
"{",
"// initialize the predefined feedback modes",
"initFeedback",
"(",
"commandLineArgs",
".",
"feedbackMode",
"(",
")",
")",
";",
"}",
"// check again, as feedback setting could have failed",
"if",
"(",
"regenerateOnDeath",
")",
"{",
"// if we haven't died, and the feedback mode wants fluff, print welcome",
"if",
"(",
"feedback",
".",
"shouldDisplayCommandFluff",
"(",
")",
")",
"{",
"hardmsg",
"(",
"\"jshell.msg.welcome\"",
",",
"version",
"(",
")",
")",
";",
"}",
"// Be sure history is always saved so that user code isn't lost",
"Thread",
"shutdownHook",
"=",
"new",
"Thread",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"replayableHistory",
".",
"storeHistory",
"(",
"prefs",
")",
";",
"}",
"}",
";",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"addShutdownHook",
"(",
"shutdownHook",
")",
";",
"// execute from user input",
"try",
"(",
"IOContext",
"in",
"=",
"new",
"ConsoleIOContext",
"(",
"this",
",",
"cmdin",
",",
"console",
")",
")",
"{",
"while",
"(",
"regenerateOnDeath",
")",
"{",
"if",
"(",
"!",
"live",
")",
"{",
"resetState",
"(",
")",
";",
"}",
"run",
"(",
"in",
")",
";",
"}",
"}",
"finally",
"{",
"replayableHistory",
".",
"storeHistory",
"(",
"prefs",
")",
";",
"closeState",
"(",
")",
";",
"try",
"{",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"removeShutdownHook",
"(",
"shutdownHook",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"// ignore, this probably caused by VM aready being shutdown",
"// and this is the last act anyhow",
"}",
"}",
"}",
"closeState",
"(",
")",
";",
"}"
] |
The entry point into the JShell tool.
@param args the command-line arguments
@throws Exception catastrophic fatal exception
|
[
"The",
"entry",
"point",
"into",
"the",
"JShell",
"tool",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L879-L943
|
5,489 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.snippetCompletion
|
private CompletionProvider snippetCompletion(Supplier<Stream<? extends Snippet>> snippetsSupplier) {
return (prefix, cursor, anchor) -> {
anchor[0] = 0;
int space = prefix.lastIndexOf(' ');
Set<String> prior = new HashSet<>(Arrays.asList(prefix.split(" ")));
if (prior.contains("-all") || prior.contains("-history")) {
return Collections.emptyList();
}
String argPrefix = prefix.substring(space + 1);
return snippetsSupplier.get()
.filter(k -> !prior.contains(String.valueOf(k.id()))
&& (!(k instanceof DeclarationSnippet)
|| !prior.contains(((DeclarationSnippet) k).name())))
.flatMap(k -> (k instanceof DeclarationSnippet)
? Stream.of(String.valueOf(k.id()) + " ", ((DeclarationSnippet) k).name() + " ")
: Stream.of(String.valueOf(k.id()) + " "))
.filter(k -> k.startsWith(argPrefix))
.map(ArgSuggestion::new)
.collect(Collectors.toList());
};
}
|
java
|
private CompletionProvider snippetCompletion(Supplier<Stream<? extends Snippet>> snippetsSupplier) {
return (prefix, cursor, anchor) -> {
anchor[0] = 0;
int space = prefix.lastIndexOf(' ');
Set<String> prior = new HashSet<>(Arrays.asList(prefix.split(" ")));
if (prior.contains("-all") || prior.contains("-history")) {
return Collections.emptyList();
}
String argPrefix = prefix.substring(space + 1);
return snippetsSupplier.get()
.filter(k -> !prior.contains(String.valueOf(k.id()))
&& (!(k instanceof DeclarationSnippet)
|| !prior.contains(((DeclarationSnippet) k).name())))
.flatMap(k -> (k instanceof DeclarationSnippet)
? Stream.of(String.valueOf(k.id()) + " ", ((DeclarationSnippet) k).name() + " ")
: Stream.of(String.valueOf(k.id()) + " "))
.filter(k -> k.startsWith(argPrefix))
.map(ArgSuggestion::new)
.collect(Collectors.toList());
};
}
|
[
"private",
"CompletionProvider",
"snippetCompletion",
"(",
"Supplier",
"<",
"Stream",
"<",
"?",
"extends",
"Snippet",
">",
">",
"snippetsSupplier",
")",
"{",
"return",
"(",
"prefix",
",",
"cursor",
",",
"anchor",
")",
"->",
"{",
"anchor",
"[",
"0",
"]",
"=",
"0",
";",
"int",
"space",
"=",
"prefix",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"Set",
"<",
"String",
">",
"prior",
"=",
"new",
"HashSet",
"<>",
"(",
"Arrays",
".",
"asList",
"(",
"prefix",
".",
"split",
"(",
"\" \"",
")",
")",
")",
";",
"if",
"(",
"prior",
".",
"contains",
"(",
"\"-all\"",
")",
"||",
"prior",
".",
"contains",
"(",
"\"-history\"",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"String",
"argPrefix",
"=",
"prefix",
".",
"substring",
"(",
"space",
"+",
"1",
")",
";",
"return",
"snippetsSupplier",
".",
"get",
"(",
")",
".",
"filter",
"(",
"k",
"->",
"!",
"prior",
".",
"contains",
"(",
"String",
".",
"valueOf",
"(",
"k",
".",
"id",
"(",
")",
")",
")",
"&&",
"(",
"!",
"(",
"k",
"instanceof",
"DeclarationSnippet",
")",
"||",
"!",
"prior",
".",
"contains",
"(",
"(",
"(",
"DeclarationSnippet",
")",
"k",
")",
".",
"name",
"(",
")",
")",
")",
")",
".",
"flatMap",
"(",
"k",
"->",
"(",
"k",
"instanceof",
"DeclarationSnippet",
")",
"?",
"Stream",
".",
"of",
"(",
"String",
".",
"valueOf",
"(",
"k",
".",
"id",
"(",
")",
")",
"+",
"\" \"",
",",
"(",
"(",
"DeclarationSnippet",
")",
"k",
")",
".",
"name",
"(",
")",
"+",
"\" \"",
")",
":",
"Stream",
".",
"of",
"(",
"String",
".",
"valueOf",
"(",
"k",
".",
"id",
"(",
")",
")",
"+",
"\" \"",
")",
")",
".",
"filter",
"(",
"k",
"->",
"k",
".",
"startsWith",
"(",
"argPrefix",
")",
")",
".",
"map",
"(",
"ArgSuggestion",
"::",
"new",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"}",
";",
"}"
] |
Completion based on snippet supplier
|
[
"Completion",
"based",
"on",
"snippet",
"supplier"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L1409-L1429
|
5,490 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.helpCompletion
|
private CompletionProvider helpCompletion() {
return (code, cursor, anchor) -> {
List<Suggestion> result;
int pastSpace = code.indexOf(' ') + 1; // zero if no space
if (pastSpace == 0) {
// initially suggest commands (with slash) and subjects,
// however, if their subject starts without slash, include
// commands without slash
boolean noslash = code.length() > 0 && !code.startsWith("/");
result = new FixedCompletionProvider(commands.values().stream()
.filter(cmd -> cmd.kind.showInHelp || cmd.kind == CommandKind.HELP_SUBJECT)
.map(c -> ((noslash && c.command.startsWith("/"))
? c.command.substring(1)
: c.command) + " ")
.toArray(String[]::new))
.completionSuggestions(code, cursor, anchor);
} else if (code.startsWith("/se") || code.startsWith("se")) {
result = new FixedCompletionProvider(SET_SUBCOMMANDS)
.completionSuggestions(code.substring(pastSpace), cursor - pastSpace, anchor);
} else {
result = Collections.emptyList();
}
anchor[0] += pastSpace;
return result;
};
}
|
java
|
private CompletionProvider helpCompletion() {
return (code, cursor, anchor) -> {
List<Suggestion> result;
int pastSpace = code.indexOf(' ') + 1; // zero if no space
if (pastSpace == 0) {
// initially suggest commands (with slash) and subjects,
// however, if their subject starts without slash, include
// commands without slash
boolean noslash = code.length() > 0 && !code.startsWith("/");
result = new FixedCompletionProvider(commands.values().stream()
.filter(cmd -> cmd.kind.showInHelp || cmd.kind == CommandKind.HELP_SUBJECT)
.map(c -> ((noslash && c.command.startsWith("/"))
? c.command.substring(1)
: c.command) + " ")
.toArray(String[]::new))
.completionSuggestions(code, cursor, anchor);
} else if (code.startsWith("/se") || code.startsWith("se")) {
result = new FixedCompletionProvider(SET_SUBCOMMANDS)
.completionSuggestions(code.substring(pastSpace), cursor - pastSpace, anchor);
} else {
result = Collections.emptyList();
}
anchor[0] += pastSpace;
return result;
};
}
|
[
"private",
"CompletionProvider",
"helpCompletion",
"(",
")",
"{",
"return",
"(",
"code",
",",
"cursor",
",",
"anchor",
")",
"->",
"{",
"List",
"<",
"Suggestion",
">",
"result",
";",
"int",
"pastSpace",
"=",
"code",
".",
"indexOf",
"(",
"'",
"'",
")",
"+",
"1",
";",
"// zero if no space",
"if",
"(",
"pastSpace",
"==",
"0",
")",
"{",
"// initially suggest commands (with slash) and subjects,",
"// however, if their subject starts without slash, include",
"// commands without slash",
"boolean",
"noslash",
"=",
"code",
".",
"length",
"(",
")",
">",
"0",
"&&",
"!",
"code",
".",
"startsWith",
"(",
"\"/\"",
")",
";",
"result",
"=",
"new",
"FixedCompletionProvider",
"(",
"commands",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"cmd",
"->",
"cmd",
".",
"kind",
".",
"showInHelp",
"||",
"cmd",
".",
"kind",
"==",
"CommandKind",
".",
"HELP_SUBJECT",
")",
".",
"map",
"(",
"c",
"->",
"(",
"(",
"noslash",
"&&",
"c",
".",
"command",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"?",
"c",
".",
"command",
".",
"substring",
"(",
"1",
")",
":",
"c",
".",
"command",
")",
"+",
"\" \"",
")",
".",
"toArray",
"(",
"String",
"[",
"]",
"::",
"new",
")",
")",
".",
"completionSuggestions",
"(",
"code",
",",
"cursor",
",",
"anchor",
")",
";",
"}",
"else",
"if",
"(",
"code",
".",
"startsWith",
"(",
"\"/se\"",
")",
"||",
"code",
".",
"startsWith",
"(",
"\"se\"",
")",
")",
"{",
"result",
"=",
"new",
"FixedCompletionProvider",
"(",
"SET_SUBCOMMANDS",
")",
".",
"completionSuggestions",
"(",
"code",
".",
"substring",
"(",
"pastSpace",
")",
",",
"cursor",
"-",
"pastSpace",
",",
"anchor",
")",
";",
"}",
"else",
"{",
"result",
"=",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"anchor",
"[",
"0",
"]",
"+=",
"pastSpace",
";",
"return",
"result",
";",
"}",
";",
"}"
] |
Completion of help, commands and subjects
|
[
"Completion",
"of",
"help",
"commands",
"and",
"subjects"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L1447-L1472
|
5,491 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.subCommand
|
String subCommand(String cmd, ArgTokenizer at, String[] subs) {
at.allowedOptions("-retain");
String sub = at.next();
if (sub == null) {
// No sub-command was given
return at.hasOption("-retain")
? "_retain"
: "_blank";
}
String[] matches = Arrays.stream(subs)
.filter(s -> s.startsWith(sub))
.toArray(String[]::new);
if (matches.length == 0) {
// There are no matching sub-commands
errormsg("jshell.err.arg", cmd, sub);
fluffmsg("jshell.msg.use.one.of", Arrays.stream(subs)
.collect(Collectors.joining(", "))
);
return null;
}
if (matches.length > 1) {
// More than one sub-command matches the initial characters provided
errormsg("jshell.err.sub.ambiguous", cmd, sub);
fluffmsg("jshell.msg.use.one.of", Arrays.stream(matches)
.collect(Collectors.joining(", "))
);
return null;
}
return matches[0];
}
|
java
|
String subCommand(String cmd, ArgTokenizer at, String[] subs) {
at.allowedOptions("-retain");
String sub = at.next();
if (sub == null) {
// No sub-command was given
return at.hasOption("-retain")
? "_retain"
: "_blank";
}
String[] matches = Arrays.stream(subs)
.filter(s -> s.startsWith(sub))
.toArray(String[]::new);
if (matches.length == 0) {
// There are no matching sub-commands
errormsg("jshell.err.arg", cmd, sub);
fluffmsg("jshell.msg.use.one.of", Arrays.stream(subs)
.collect(Collectors.joining(", "))
);
return null;
}
if (matches.length > 1) {
// More than one sub-command matches the initial characters provided
errormsg("jshell.err.sub.ambiguous", cmd, sub);
fluffmsg("jshell.msg.use.one.of", Arrays.stream(matches)
.collect(Collectors.joining(", "))
);
return null;
}
return matches[0];
}
|
[
"String",
"subCommand",
"(",
"String",
"cmd",
",",
"ArgTokenizer",
"at",
",",
"String",
"[",
"]",
"subs",
")",
"{",
"at",
".",
"allowedOptions",
"(",
"\"-retain\"",
")",
";",
"String",
"sub",
"=",
"at",
".",
"next",
"(",
")",
";",
"if",
"(",
"sub",
"==",
"null",
")",
"{",
"// No sub-command was given",
"return",
"at",
".",
"hasOption",
"(",
"\"-retain\"",
")",
"?",
"\"_retain\"",
":",
"\"_blank\"",
";",
"}",
"String",
"[",
"]",
"matches",
"=",
"Arrays",
".",
"stream",
"(",
"subs",
")",
".",
"filter",
"(",
"s",
"->",
"s",
".",
"startsWith",
"(",
"sub",
")",
")",
".",
"toArray",
"(",
"String",
"[",
"]",
"::",
"new",
")",
";",
"if",
"(",
"matches",
".",
"length",
"==",
"0",
")",
"{",
"// There are no matching sub-commands",
"errormsg",
"(",
"\"jshell.err.arg\"",
",",
"cmd",
",",
"sub",
")",
";",
"fluffmsg",
"(",
"\"jshell.msg.use.one.of\"",
",",
"Arrays",
".",
"stream",
"(",
"subs",
")",
".",
"collect",
"(",
"Collectors",
".",
"joining",
"(",
"\", \"",
")",
")",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"matches",
".",
"length",
">",
"1",
")",
"{",
"// More than one sub-command matches the initial characters provided",
"errormsg",
"(",
"\"jshell.err.sub.ambiguous\"",
",",
"cmd",
",",
"sub",
")",
";",
"fluffmsg",
"(",
"\"jshell.msg.use.one.of\"",
",",
"Arrays",
".",
"stream",
"(",
"matches",
")",
".",
"collect",
"(",
"Collectors",
".",
"joining",
"(",
"\", \"",
")",
")",
")",
";",
"return",
"null",
";",
"}",
"return",
"matches",
"[",
"0",
"]",
";",
"}"
] |
Return null on error
|
[
"Return",
"null",
"on",
"error"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L1801-L1830
|
5,492 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.nonEmptyStream
|
@SafeVarargs
private static <T extends Snippet> Stream<T> nonEmptyStream(Supplier<Stream<T>> supplier,
SnippetPredicate<T>... filters) {
for (SnippetPredicate<T> filt : filters) {
Iterator<T> iterator = supplier.get().filter(filt).iterator();
if (iterator.hasNext()) {
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false);
}
}
return null;
}
|
java
|
@SafeVarargs
private static <T extends Snippet> Stream<T> nonEmptyStream(Supplier<Stream<T>> supplier,
SnippetPredicate<T>... filters) {
for (SnippetPredicate<T> filt : filters) {
Iterator<T> iterator = supplier.get().filter(filt).iterator();
if (iterator.hasNext()) {
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false);
}
}
return null;
}
|
[
"@",
"SafeVarargs",
"private",
"static",
"<",
"T",
"extends",
"Snippet",
">",
"Stream",
"<",
"T",
">",
"nonEmptyStream",
"(",
"Supplier",
"<",
"Stream",
"<",
"T",
">",
">",
"supplier",
",",
"SnippetPredicate",
"<",
"T",
">",
"...",
"filters",
")",
"{",
"for",
"(",
"SnippetPredicate",
"<",
"T",
">",
"filt",
":",
"filters",
")",
"{",
"Iterator",
"<",
"T",
">",
"iterator",
"=",
"supplier",
".",
"get",
"(",
")",
".",
"filter",
"(",
"filt",
")",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"StreamSupport",
".",
"stream",
"(",
"Spliterators",
".",
"spliteratorUnknownSize",
"(",
"iterator",
",",
"0",
")",
",",
"false",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Apply filters to a stream until one that is non-empty is found.
Adapted from Stuart Marks
@param supplier Supply the Snippet stream to filter
@param filters Filters to attempt
@return The non-empty filtered Stream, or null
|
[
"Apply",
"filters",
"to",
"a",
"stream",
"until",
"one",
"that",
"is",
"non",
"-",
"empty",
"is",
"found",
".",
"Adapted",
"from",
"Stuart",
"Marks"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L2207-L2217
|
5,493 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.argsToSnippets
|
private <T extends Snippet> Stream<T> argsToSnippets(Supplier<Stream<T>> snippetSupplier,
List<String> args) {
Stream<T> result = null;
for (String arg : args) {
// Find the best match
Stream<T> st = layeredSnippetSearch(snippetSupplier, arg);
if (st == null) {
Stream<Snippet> est = layeredSnippetSearch(state::snippets, arg);
if (est == null) {
errormsg("jshell.err.no.such.snippets", arg);
} else {
errormsg("jshell.err.the.snippet.cannot.be.used.with.this.command",
arg, est.findFirst().get().source());
}
return null;
}
if (result == null) {
result = st;
} else {
result = Stream.concat(result, st);
}
}
return result;
}
|
java
|
private <T extends Snippet> Stream<T> argsToSnippets(Supplier<Stream<T>> snippetSupplier,
List<String> args) {
Stream<T> result = null;
for (String arg : args) {
// Find the best match
Stream<T> st = layeredSnippetSearch(snippetSupplier, arg);
if (st == null) {
Stream<Snippet> est = layeredSnippetSearch(state::snippets, arg);
if (est == null) {
errormsg("jshell.err.no.such.snippets", arg);
} else {
errormsg("jshell.err.the.snippet.cannot.be.used.with.this.command",
arg, est.findFirst().get().source());
}
return null;
}
if (result == null) {
result = st;
} else {
result = Stream.concat(result, st);
}
}
return result;
}
|
[
"private",
"<",
"T",
"extends",
"Snippet",
">",
"Stream",
"<",
"T",
">",
"argsToSnippets",
"(",
"Supplier",
"<",
"Stream",
"<",
"T",
">",
">",
"snippetSupplier",
",",
"List",
"<",
"String",
">",
"args",
")",
"{",
"Stream",
"<",
"T",
">",
"result",
"=",
"null",
";",
"for",
"(",
"String",
"arg",
":",
"args",
")",
"{",
"// Find the best match",
"Stream",
"<",
"T",
">",
"st",
"=",
"layeredSnippetSearch",
"(",
"snippetSupplier",
",",
"arg",
")",
";",
"if",
"(",
"st",
"==",
"null",
")",
"{",
"Stream",
"<",
"Snippet",
">",
"est",
"=",
"layeredSnippetSearch",
"(",
"state",
"::",
"snippets",
",",
"arg",
")",
";",
"if",
"(",
"est",
"==",
"null",
")",
"{",
"errormsg",
"(",
"\"jshell.err.no.such.snippets\"",
",",
"arg",
")",
";",
"}",
"else",
"{",
"errormsg",
"(",
"\"jshell.err.the.snippet.cannot.be.used.with.this.command\"",
",",
"arg",
",",
"est",
".",
"findFirst",
"(",
")",
".",
"get",
"(",
")",
".",
"source",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"st",
";",
"}",
"else",
"{",
"result",
"=",
"Stream",
".",
"concat",
"(",
"result",
",",
"st",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Convert user arguments to a Stream of snippets referenced by those
arguments.
@param snippetSupplier the base list of possible snippets
@param args the user's argument to the command, maybe be the empty list
@return a Stream of referenced snippets or null if no matches to specific
arg
|
[
"Convert",
"user",
"arguments",
"to",
"a",
"Stream",
"of",
"snippets",
"referenced",
"by",
"those",
"arguments",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L2292-L2315
|
5,494 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.builtInEdit
|
private boolean builtInEdit(String initialText,
Consumer<String> saveHandler, Consumer<String> errorHandler) {
try {
ServiceLoader<BuildInEditorProvider> sl
= ServiceLoader.load(BuildInEditorProvider.class);
// Find the highest ranking provider
BuildInEditorProvider provider = null;
for (BuildInEditorProvider p : sl) {
if (provider == null || p.rank() > provider.rank()) {
provider = p;
}
}
if (provider != null) {
provider.edit(getResourceString("jshell.label.editpad"),
initialText, saveHandler, errorHandler);
return true;
} else {
errormsg("jshell.err.no.builtin.editor");
}
} catch (RuntimeException ex) {
errormsg("jshell.err.cant.launch.editor", ex);
}
fluffmsg("jshell.msg.try.set.editor");
return false;
}
|
java
|
private boolean builtInEdit(String initialText,
Consumer<String> saveHandler, Consumer<String> errorHandler) {
try {
ServiceLoader<BuildInEditorProvider> sl
= ServiceLoader.load(BuildInEditorProvider.class);
// Find the highest ranking provider
BuildInEditorProvider provider = null;
for (BuildInEditorProvider p : sl) {
if (provider == null || p.rank() > provider.rank()) {
provider = p;
}
}
if (provider != null) {
provider.edit(getResourceString("jshell.label.editpad"),
initialText, saveHandler, errorHandler);
return true;
} else {
errormsg("jshell.err.no.builtin.editor");
}
} catch (RuntimeException ex) {
errormsg("jshell.err.cant.launch.editor", ex);
}
fluffmsg("jshell.msg.try.set.editor");
return false;
}
|
[
"private",
"boolean",
"builtInEdit",
"(",
"String",
"initialText",
",",
"Consumer",
"<",
"String",
">",
"saveHandler",
",",
"Consumer",
"<",
"String",
">",
"errorHandler",
")",
"{",
"try",
"{",
"ServiceLoader",
"<",
"BuildInEditorProvider",
">",
"sl",
"=",
"ServiceLoader",
".",
"load",
"(",
"BuildInEditorProvider",
".",
"class",
")",
";",
"// Find the highest ranking provider",
"BuildInEditorProvider",
"provider",
"=",
"null",
";",
"for",
"(",
"BuildInEditorProvider",
"p",
":",
"sl",
")",
"{",
"if",
"(",
"provider",
"==",
"null",
"||",
"p",
".",
"rank",
"(",
")",
">",
"provider",
".",
"rank",
"(",
")",
")",
"{",
"provider",
"=",
"p",
";",
"}",
"}",
"if",
"(",
"provider",
"!=",
"null",
")",
"{",
"provider",
".",
"edit",
"(",
"getResourceString",
"(",
"\"jshell.label.editpad\"",
")",
",",
"initialText",
",",
"saveHandler",
",",
"errorHandler",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"errormsg",
"(",
"\"jshell.err.no.builtin.editor\"",
")",
";",
"}",
"}",
"catch",
"(",
"RuntimeException",
"ex",
")",
"{",
"errormsg",
"(",
"\"jshell.err.cant.launch.editor\"",
",",
"ex",
")",
";",
"}",
"fluffmsg",
"(",
"\"jshell.msg.try.set.editor\"",
")",
";",
"return",
"false",
";",
"}"
] |
start the built-in editor
|
[
"start",
"the",
"built",
"-",
"in",
"editor"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L2438-L2462
|
5,495 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
|
JShellTool.readResource
|
static String readResource(String name) throws IOException {
// Attempt to find the file as a resource
String spec = String.format(BUILTIN_FILE_PATH_FORMAT, name);
try (InputStream in = JShellTool.class.getResourceAsStream(spec);
BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
return reader.lines().collect(Collectors.joining("\n", "", "\n"));
}
}
|
java
|
static String readResource(String name) throws IOException {
// Attempt to find the file as a resource
String spec = String.format(BUILTIN_FILE_PATH_FORMAT, name);
try (InputStream in = JShellTool.class.getResourceAsStream(spec);
BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
return reader.lines().collect(Collectors.joining("\n", "", "\n"));
}
}
|
[
"static",
"String",
"readResource",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"// Attempt to find the file as a resource",
"String",
"spec",
"=",
"String",
".",
"format",
"(",
"BUILTIN_FILE_PATH_FORMAT",
",",
"name",
")",
";",
"try",
"(",
"InputStream",
"in",
"=",
"JShellTool",
".",
"class",
".",
"getResourceAsStream",
"(",
"spec",
")",
";",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"in",
")",
")",
")",
"{",
"return",
"reader",
".",
"lines",
"(",
")",
".",
"collect",
"(",
"Collectors",
".",
"joining",
"(",
"\"\\n\"",
",",
"\"\"",
",",
"\"\\n\"",
")",
")",
";",
"}",
"}"
] |
Read a built-in file from resources
|
[
"Read",
"a",
"built",
"-",
"in",
"file",
"from",
"resources"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L2582-L2590
|
5,496 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PubAPIs.java
|
PubAPIs.getPubapis
|
public Map<String, PubApi> getPubapis(Collection<JavaFileObject> explicitJFOs, boolean explicits) {
// Maps ":java.lang" to a package level pub api (with only types on top level)
Map<String, PubApi> result = new HashMap<>();
for (ClassSymbol cs : publicApiPerClass.keySet()) {
boolean amongExplicits = explicitJFOs.contains(cs.sourcefile);
if (explicits != amongExplicits)
continue;
String pkg = ":" + cs.packge().fullname;
PubApi currentPubApi = result.getOrDefault(pkg, new PubApi());
result.put(pkg, PubApi.mergeTypes(currentPubApi, publicApiPerClass.get(cs)));
}
return result;
}
|
java
|
public Map<String, PubApi> getPubapis(Collection<JavaFileObject> explicitJFOs, boolean explicits) {
// Maps ":java.lang" to a package level pub api (with only types on top level)
Map<String, PubApi> result = new HashMap<>();
for (ClassSymbol cs : publicApiPerClass.keySet()) {
boolean amongExplicits = explicitJFOs.contains(cs.sourcefile);
if (explicits != amongExplicits)
continue;
String pkg = ":" + cs.packge().fullname;
PubApi currentPubApi = result.getOrDefault(pkg, new PubApi());
result.put(pkg, PubApi.mergeTypes(currentPubApi, publicApiPerClass.get(cs)));
}
return result;
}
|
[
"public",
"Map",
"<",
"String",
",",
"PubApi",
">",
"getPubapis",
"(",
"Collection",
"<",
"JavaFileObject",
">",
"explicitJFOs",
",",
"boolean",
"explicits",
")",
"{",
"// Maps \":java.lang\" to a package level pub api (with only types on top level)",
"Map",
"<",
"String",
",",
"PubApi",
">",
"result",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"ClassSymbol",
"cs",
":",
"publicApiPerClass",
".",
"keySet",
"(",
")",
")",
"{",
"boolean",
"amongExplicits",
"=",
"explicitJFOs",
".",
"contains",
"(",
"cs",
".",
"sourcefile",
")",
";",
"if",
"(",
"explicits",
"!=",
"amongExplicits",
")",
"continue",
";",
"String",
"pkg",
"=",
"\":\"",
"+",
"cs",
".",
"packge",
"(",
")",
".",
"fullname",
";",
"PubApi",
"currentPubApi",
"=",
"result",
".",
"getOrDefault",
"(",
"pkg",
",",
"new",
"PubApi",
"(",
")",
")",
";",
"result",
".",
"put",
"(",
"pkg",
",",
"PubApi",
".",
"mergeTypes",
"(",
"currentPubApi",
",",
"publicApiPerClass",
".",
"get",
"(",
"cs",
")",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Convert the map from class names to their pubapi to a map
from package names to their pubapi.
|
[
"Convert",
"the",
"map",
"from",
"class",
"names",
"to",
"their",
"pubapi",
"to",
"a",
"map",
"from",
"package",
"names",
"to",
"their",
"pubapi",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PubAPIs.java#L75-L91
|
5,497 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PubAPIs.java
|
PubAPIs.visitPubapi
|
@SuppressWarnings("deprecation")
public void visitPubapi(Element e) {
// Skip anonymous classes for now
if (e == null)
return;
PubapiVisitor v = new PubapiVisitor();
v.visit(e);
publicApiPerClass.put((ClassSymbol) e, v.getCollectedPubApi());
}
|
java
|
@SuppressWarnings("deprecation")
public void visitPubapi(Element e) {
// Skip anonymous classes for now
if (e == null)
return;
PubapiVisitor v = new PubapiVisitor();
v.visit(e);
publicApiPerClass.put((ClassSymbol) e, v.getCollectedPubApi());
}
|
[
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"void",
"visitPubapi",
"(",
"Element",
"e",
")",
"{",
"// Skip anonymous classes for now",
"if",
"(",
"e",
"==",
"null",
")",
"return",
";",
"PubapiVisitor",
"v",
"=",
"new",
"PubapiVisitor",
"(",
")",
";",
"v",
".",
"visit",
"(",
"e",
")",
";",
"publicApiPerClass",
".",
"put",
"(",
"(",
"ClassSymbol",
")",
"e",
",",
"v",
".",
"getCollectedPubApi",
"(",
")",
")",
";",
"}"
] |
Visit the api of a class and construct a pubapi and
store it into the pubapi_perclass map.
|
[
"Visit",
"the",
"api",
"of",
"a",
"class",
"and",
"construct",
"a",
"pubapi",
"and",
"store",
"it",
"into",
"the",
"pubapi_perclass",
"map",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PubAPIs.java#L97-L107
|
5,498 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
|
ClassWriter.flagNames
|
public static String flagNames(long flags) {
StringBuilder sbuf = new StringBuilder();
int i = 0;
long f = flags & StandardFlags;
while (f != 0) {
if ((f & 1) != 0) {
sbuf.append(" ");
sbuf.append(flagName[i]);
}
f = f >> 1;
i++;
}
return sbuf.toString();
}
|
java
|
public static String flagNames(long flags) {
StringBuilder sbuf = new StringBuilder();
int i = 0;
long f = flags & StandardFlags;
while (f != 0) {
if ((f & 1) != 0) {
sbuf.append(" ");
sbuf.append(flagName[i]);
}
f = f >> 1;
i++;
}
return sbuf.toString();
}
|
[
"public",
"static",
"String",
"flagNames",
"(",
"long",
"flags",
")",
"{",
"StringBuilder",
"sbuf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"long",
"f",
"=",
"flags",
"&",
"StandardFlags",
";",
"while",
"(",
"f",
"!=",
"0",
")",
"{",
"if",
"(",
"(",
"f",
"&",
"1",
")",
"!=",
"0",
")",
"{",
"sbuf",
".",
"append",
"(",
"\" \"",
")",
";",
"sbuf",
".",
"append",
"(",
"flagName",
"[",
"i",
"]",
")",
";",
"}",
"f",
"=",
"f",
">>",
"1",
";",
"i",
"++",
";",
"}",
"return",
"sbuf",
".",
"toString",
"(",
")",
";",
"}"
] |
Return flags as a string, separated by " ".
|
[
"Return",
"flags",
"as",
"a",
"string",
"separated",
"by",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java#L221-L234
|
5,499 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
|
ClassWriter.putChar
|
void putChar(ByteBuffer buf, int op, int x) {
buf.elems[op ] = (byte)((x >> 8) & 0xFF);
buf.elems[op+1] = (byte)((x ) & 0xFF);
}
|
java
|
void putChar(ByteBuffer buf, int op, int x) {
buf.elems[op ] = (byte)((x >> 8) & 0xFF);
buf.elems[op+1] = (byte)((x ) & 0xFF);
}
|
[
"void",
"putChar",
"(",
"ByteBuffer",
"buf",
",",
"int",
"op",
",",
"int",
"x",
")",
"{",
"buf",
".",
"elems",
"[",
"op",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
">>",
"8",
")",
"&",
"0xFF",
")",
";",
"buf",
".",
"elems",
"[",
"op",
"+",
"1",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
")",
"&",
"0xFF",
")",
";",
"}"
] |
Write a character into given byte buffer;
byte buffer will not be grown.
|
[
"Write",
"a",
"character",
"into",
"given",
"byte",
"buffer",
";",
"byte",
"buffer",
"will",
"not",
"be",
"grown",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java#L248-L251
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.