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,600 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java
|
JavacElements.nameToSymbol
|
private <S extends Symbol> S nameToSymbol(ModuleSymbol module, String nameStr, Class<S> clazz) {
Name name = names.fromString(nameStr);
// First check cache.
Symbol sym = (clazz == ClassSymbol.class)
? syms.getClass(module, name)
: syms.lookupPackage(module, name);
try {
if (sym == null)
sym = javaCompiler.resolveIdent(module, nameStr);
sym.complete();
return (sym.kind != ERR &&
sym.exists() &&
clazz.isInstance(sym) &&
name.equals(sym.getQualifiedName()))
? clazz.cast(sym)
: null;
} catch (CompletionFailure e) {
return null;
}
}
|
java
|
private <S extends Symbol> S nameToSymbol(ModuleSymbol module, String nameStr, Class<S> clazz) {
Name name = names.fromString(nameStr);
// First check cache.
Symbol sym = (clazz == ClassSymbol.class)
? syms.getClass(module, name)
: syms.lookupPackage(module, name);
try {
if (sym == null)
sym = javaCompiler.resolveIdent(module, nameStr);
sym.complete();
return (sym.kind != ERR &&
sym.exists() &&
clazz.isInstance(sym) &&
name.equals(sym.getQualifiedName()))
? clazz.cast(sym)
: null;
} catch (CompletionFailure e) {
return null;
}
}
|
[
"private",
"<",
"S",
"extends",
"Symbol",
">",
"S",
"nameToSymbol",
"(",
"ModuleSymbol",
"module",
",",
"String",
"nameStr",
",",
"Class",
"<",
"S",
">",
"clazz",
")",
"{",
"Name",
"name",
"=",
"names",
".",
"fromString",
"(",
"nameStr",
")",
";",
"// First check cache.",
"Symbol",
"sym",
"=",
"(",
"clazz",
"==",
"ClassSymbol",
".",
"class",
")",
"?",
"syms",
".",
"getClass",
"(",
"module",
",",
"name",
")",
":",
"syms",
".",
"lookupPackage",
"(",
"module",
",",
"name",
")",
";",
"try",
"{",
"if",
"(",
"sym",
"==",
"null",
")",
"sym",
"=",
"javaCompiler",
".",
"resolveIdent",
"(",
"module",
",",
"nameStr",
")",
";",
"sym",
".",
"complete",
"(",
")",
";",
"return",
"(",
"sym",
".",
"kind",
"!=",
"ERR",
"&&",
"sym",
".",
"exists",
"(",
")",
"&&",
"clazz",
".",
"isInstance",
"(",
"sym",
")",
"&&",
"name",
".",
"equals",
"(",
"sym",
".",
"getQualifiedName",
"(",
")",
")",
")",
"?",
"clazz",
".",
"cast",
"(",
"sym",
")",
":",
"null",
";",
"}",
"catch",
"(",
"CompletionFailure",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] |
Returns a symbol given the type's or package's canonical name,
or null if the name isn't found.
|
[
"Returns",
"a",
"symbol",
"given",
"the",
"type",
"s",
"or",
"package",
"s",
"canonical",
"name",
"or",
"null",
"if",
"the",
"name",
"isn",
"t",
"found",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java#L229-L251
|
5,601 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java
|
JavacElements.scanForAssign
|
private JCExpression scanForAssign(final MethodSymbol sym,
final JCTree tree) {
class TS extends TreeScanner {
JCExpression result = null;
public void scan(JCTree t) {
if (t != null && result == null)
t.accept(this);
}
public void visitAnnotation(JCAnnotation t) {
if (t == tree)
scan(t.args);
}
public void visitAssign(JCAssign t) {
if (t.lhs.hasTag(IDENT)) {
JCIdent ident = (JCIdent) t.lhs;
if (ident.sym == sym)
result = t.rhs;
}
}
}
TS scanner = new TS();
tree.accept(scanner);
return scanner.result;
}
|
java
|
private JCExpression scanForAssign(final MethodSymbol sym,
final JCTree tree) {
class TS extends TreeScanner {
JCExpression result = null;
public void scan(JCTree t) {
if (t != null && result == null)
t.accept(this);
}
public void visitAnnotation(JCAnnotation t) {
if (t == tree)
scan(t.args);
}
public void visitAssign(JCAssign t) {
if (t.lhs.hasTag(IDENT)) {
JCIdent ident = (JCIdent) t.lhs;
if (ident.sym == sym)
result = t.rhs;
}
}
}
TS scanner = new TS();
tree.accept(scanner);
return scanner.result;
}
|
[
"private",
"JCExpression",
"scanForAssign",
"(",
"final",
"MethodSymbol",
"sym",
",",
"final",
"JCTree",
"tree",
")",
"{",
"class",
"TS",
"extends",
"TreeScanner",
"{",
"JCExpression",
"result",
"=",
"null",
";",
"public",
"void",
"scan",
"(",
"JCTree",
"t",
")",
"{",
"if",
"(",
"t",
"!=",
"null",
"&&",
"result",
"==",
"null",
")",
"t",
".",
"accept",
"(",
"this",
")",
";",
"}",
"public",
"void",
"visitAnnotation",
"(",
"JCAnnotation",
"t",
")",
"{",
"if",
"(",
"t",
"==",
"tree",
")",
"scan",
"(",
"t",
".",
"args",
")",
";",
"}",
"public",
"void",
"visitAssign",
"(",
"JCAssign",
"t",
")",
"{",
"if",
"(",
"t",
".",
"lhs",
".",
"hasTag",
"(",
"IDENT",
")",
")",
"{",
"JCIdent",
"ident",
"=",
"(",
"JCIdent",
")",
"t",
".",
"lhs",
";",
"if",
"(",
"ident",
".",
"sym",
"==",
"sym",
")",
"result",
"=",
"t",
".",
"rhs",
";",
"}",
"}",
"}",
"TS",
"scanner",
"=",
"new",
"TS",
"(",
")",
";",
"tree",
".",
"accept",
"(",
"scanner",
")",
";",
"return",
"scanner",
".",
"result",
";",
"}"
] |
Scans for a JCAssign node with a LHS matching a given
symbol, and returns its RHS. Does not scan nested JCAnnotations.
|
[
"Scans",
"for",
"a",
"JCAssign",
"node",
"with",
"a",
"LHS",
"matching",
"a",
"given",
"symbol",
"and",
"returns",
"its",
"RHS",
".",
"Does",
"not",
"scan",
"nested",
"JCAnnotations",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java#L369-L392
|
5,602 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java
|
JavacElements.getTree
|
public JCTree getTree(Element e) {
Pair<JCTree, ?> treeTop = getTreeAndTopLevel(e);
return (treeTop != null) ? treeTop.fst : null;
}
|
java
|
public JCTree getTree(Element e) {
Pair<JCTree, ?> treeTop = getTreeAndTopLevel(e);
return (treeTop != null) ? treeTop.fst : null;
}
|
[
"public",
"JCTree",
"getTree",
"(",
"Element",
"e",
")",
"{",
"Pair",
"<",
"JCTree",
",",
"?",
">",
"treeTop",
"=",
"getTreeAndTopLevel",
"(",
"e",
")",
";",
"return",
"(",
"treeTop",
"!=",
"null",
")",
"?",
"treeTop",
".",
"fst",
":",
"null",
";",
"}"
] |
Returns the tree node corresponding to this element, or null
if none can be found.
|
[
"Returns",
"the",
"tree",
"node",
"corresponding",
"to",
"this",
"element",
"or",
"null",
"if",
"none",
"can",
"be",
"found",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java#L398-L401
|
5,603 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterizedTypeImpl.java
|
ParameterizedTypeImpl.typeArguments
|
public com.sun.javadoc.Type[] typeArguments() {
return TypeMaker.getTypes(env, type.getTypeArguments());
}
|
java
|
public com.sun.javadoc.Type[] typeArguments() {
return TypeMaker.getTypes(env, type.getTypeArguments());
}
|
[
"public",
"com",
".",
"sun",
".",
"javadoc",
".",
"Type",
"[",
"]",
"typeArguments",
"(",
")",
"{",
"return",
"TypeMaker",
".",
"getTypes",
"(",
"env",
",",
"type",
".",
"getTypeArguments",
"(",
")",
")",
";",
"}"
] |
Return the actual type arguments of this type.
|
[
"Return",
"the",
"actual",
"type",
"arguments",
"of",
"this",
"type",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterizedTypeImpl.java#L68-L70
|
5,604 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterizedTypeImpl.java
|
ParameterizedTypeImpl.superclassType
|
public com.sun.javadoc.Type superclassType() {
if (asClassDoc().isInterface()) {
return null;
}
Type sup = env.types.supertype(type);
return TypeMaker.getType(env,
(sup != type) ? sup : env.syms.objectType);
}
|
java
|
public com.sun.javadoc.Type superclassType() {
if (asClassDoc().isInterface()) {
return null;
}
Type sup = env.types.supertype(type);
return TypeMaker.getType(env,
(sup != type) ? sup : env.syms.objectType);
}
|
[
"public",
"com",
".",
"sun",
".",
"javadoc",
".",
"Type",
"superclassType",
"(",
")",
"{",
"if",
"(",
"asClassDoc",
"(",
")",
".",
"isInterface",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"Type",
"sup",
"=",
"env",
".",
"types",
".",
"supertype",
"(",
"type",
")",
";",
"return",
"TypeMaker",
".",
"getType",
"(",
"env",
",",
"(",
"sup",
"!=",
"type",
")",
"?",
"sup",
":",
"env",
".",
"syms",
".",
"objectType",
")",
";",
"}"
] |
Return the class type that is a direct supertype of this one.
Return null if this is an interface type.
|
[
"Return",
"the",
"class",
"type",
"that",
"is",
"a",
"direct",
"supertype",
"of",
"this",
"one",
".",
"Return",
"null",
"if",
"this",
"is",
"an",
"interface",
"type",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterizedTypeImpl.java#L76-L83
|
5,605 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterizedTypeImpl.java
|
ParameterizedTypeImpl.containingType
|
public com.sun.javadoc.Type containingType() {
if (type.getEnclosingType().hasTag(CLASS)) {
// This is the type of an inner class.
return TypeMaker.getType(env, type.getEnclosingType());
}
ClassSymbol enclosing = type.tsym.owner.enclClass();
if (enclosing != null) {
// Nested but not inner. Return the ClassDoc of the enclosing
// class or interface.
// See java.lang.reflect.ParameterizedType.getOwnerType().
return env.getClassDoc(enclosing);
}
return null;
}
|
java
|
public com.sun.javadoc.Type containingType() {
if (type.getEnclosingType().hasTag(CLASS)) {
// This is the type of an inner class.
return TypeMaker.getType(env, type.getEnclosingType());
}
ClassSymbol enclosing = type.tsym.owner.enclClass();
if (enclosing != null) {
// Nested but not inner. Return the ClassDoc of the enclosing
// class or interface.
// See java.lang.reflect.ParameterizedType.getOwnerType().
return env.getClassDoc(enclosing);
}
return null;
}
|
[
"public",
"com",
".",
"sun",
".",
"javadoc",
".",
"Type",
"containingType",
"(",
")",
"{",
"if",
"(",
"type",
".",
"getEnclosingType",
"(",
")",
".",
"hasTag",
"(",
"CLASS",
")",
")",
"{",
"// This is the type of an inner class.",
"return",
"TypeMaker",
".",
"getType",
"(",
"env",
",",
"type",
".",
"getEnclosingType",
"(",
")",
")",
";",
"}",
"ClassSymbol",
"enclosing",
"=",
"type",
".",
"tsym",
".",
"owner",
".",
"enclClass",
"(",
")",
";",
"if",
"(",
"enclosing",
"!=",
"null",
")",
"{",
"// Nested but not inner. Return the ClassDoc of the enclosing",
"// class or interface.",
"// See java.lang.reflect.ParameterizedType.getOwnerType().",
"return",
"env",
".",
"getClassDoc",
"(",
"enclosing",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Return the type that contains this type as a member.
Return null is this is a top-level type.
|
[
"Return",
"the",
"type",
"that",
"contains",
"this",
"type",
"as",
"a",
"member",
".",
"Return",
"null",
"is",
"this",
"is",
"a",
"top",
"-",
"level",
"type",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterizedTypeImpl.java#L98-L111
|
5,606 |
emfjson/emfjson-jackson
|
src/main/java/org/emfjson/jackson/utils/EObjects.java
|
EObjects.setOrAdd
|
public static void setOrAdd(EObject owner, EReference reference, Object value) {
if (value != null) {
if (reference.isMany()) {
@SuppressWarnings("unchecked")
Collection<EObject> values = (Collection<EObject>) owner.eGet(reference, false);
if (values != null && value instanceof EObject) {
values.add((EObject) value);
}
} else {
owner.eSet(reference, value);
}
}
}
|
java
|
public static void setOrAdd(EObject owner, EReference reference, Object value) {
if (value != null) {
if (reference.isMany()) {
@SuppressWarnings("unchecked")
Collection<EObject> values = (Collection<EObject>) owner.eGet(reference, false);
if (values != null && value instanceof EObject) {
values.add((EObject) value);
}
} else {
owner.eSet(reference, value);
}
}
}
|
[
"public",
"static",
"void",
"setOrAdd",
"(",
"EObject",
"owner",
",",
"EReference",
"reference",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"reference",
".",
"isMany",
"(",
")",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Collection",
"<",
"EObject",
">",
"values",
"=",
"(",
"Collection",
"<",
"EObject",
">",
")",
"owner",
".",
"eGet",
"(",
"reference",
",",
"false",
")",
";",
"if",
"(",
"values",
"!=",
"null",
"&&",
"value",
"instanceof",
"EObject",
")",
"{",
"values",
".",
"add",
"(",
"(",
"EObject",
")",
"value",
")",
";",
"}",
"}",
"else",
"{",
"owner",
".",
"eSet",
"(",
"reference",
",",
"value",
")",
";",
"}",
"}",
"}"
] |
Set or add a value to an object reference. The value must be
an EObject.
@param owner
@param reference
@param value
|
[
"Set",
"or",
"add",
"a",
"value",
"to",
"an",
"object",
"reference",
".",
"The",
"value",
"must",
"be",
"an",
"EObject",
"."
] |
5f4488d1b07d499003351606cf76ee0c4ac39964
|
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/utils/EObjects.java#L36-L48
|
5,607 |
emfjson/emfjson-jackson
|
src/main/java/org/emfjson/jackson/utils/EObjects.java
|
EObjects.isContainmentProxy
|
public static boolean isContainmentProxy(DatabindContext ctxt, EObject owner, EObject contained) {
if (contained.eIsProxy())
return true;
Resource ownerResource = EMFContext.getResource(ctxt, owner);
Resource containedResource = EMFContext.getResource(ctxt, contained);
return ownerResource != null && ownerResource != containedResource;
}
|
java
|
public static boolean isContainmentProxy(DatabindContext ctxt, EObject owner, EObject contained) {
if (contained.eIsProxy())
return true;
Resource ownerResource = EMFContext.getResource(ctxt, owner);
Resource containedResource = EMFContext.getResource(ctxt, contained);
return ownerResource != null && ownerResource != containedResource;
}
|
[
"public",
"static",
"boolean",
"isContainmentProxy",
"(",
"DatabindContext",
"ctxt",
",",
"EObject",
"owner",
",",
"EObject",
"contained",
")",
"{",
"if",
"(",
"contained",
".",
"eIsProxy",
"(",
")",
")",
"return",
"true",
";",
"Resource",
"ownerResource",
"=",
"EMFContext",
".",
"getResource",
"(",
"ctxt",
",",
"owner",
")",
";",
"Resource",
"containedResource",
"=",
"EMFContext",
".",
"getResource",
"(",
"ctxt",
",",
"contained",
")",
";",
"return",
"ownerResource",
"!=",
"null",
"&&",
"ownerResource",
"!=",
"containedResource",
";",
"}"
] |
Checks that the contained object is in a different resource than it's owner, making
it a contained proxy.
@param owner
@param contained
@return true if proxy
|
[
"Checks",
"that",
"the",
"contained",
"object",
"is",
"in",
"a",
"different",
"resource",
"than",
"it",
"s",
"owner",
"making",
"it",
"a",
"contained",
"proxy",
"."
] |
5f4488d1b07d499003351606cf76ee0c4ac39964
|
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/utils/EObjects.java#L58-L66
|
5,608 |
emfjson/emfjson-jackson
|
src/main/java/org/emfjson/jackson/utils/EObjects.java
|
EObjects.createEntry
|
@SuppressWarnings("unchecked")
public static EObject createEntry(String key, Object value, EClass type) {
if (type == EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY) {
final EObject entry = EcoreUtil.create(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY);
entry.eSet(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY__KEY, key);
entry.eSet(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY__VALUE, value);
return entry;
} else {
final BasicEMapEntry entry = new BasicEMapEntry<>();
entry.eSetClass(type);
entry.setKey(key);
entry.setValue(value);
return entry;
}
}
|
java
|
@SuppressWarnings("unchecked")
public static EObject createEntry(String key, Object value, EClass type) {
if (type == EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY) {
final EObject entry = EcoreUtil.create(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY);
entry.eSet(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY__KEY, key);
entry.eSet(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY__VALUE, value);
return entry;
} else {
final BasicEMapEntry entry = new BasicEMapEntry<>();
entry.eSetClass(type);
entry.setKey(key);
entry.setValue(value);
return entry;
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"EObject",
"createEntry",
"(",
"String",
"key",
",",
"Object",
"value",
",",
"EClass",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"EcorePackage",
".",
"Literals",
".",
"ESTRING_TO_STRING_MAP_ENTRY",
")",
"{",
"final",
"EObject",
"entry",
"=",
"EcoreUtil",
".",
"create",
"(",
"EcorePackage",
".",
"Literals",
".",
"ESTRING_TO_STRING_MAP_ENTRY",
")",
";",
"entry",
".",
"eSet",
"(",
"EcorePackage",
".",
"Literals",
".",
"ESTRING_TO_STRING_MAP_ENTRY__KEY",
",",
"key",
")",
";",
"entry",
".",
"eSet",
"(",
"EcorePackage",
".",
"Literals",
".",
"ESTRING_TO_STRING_MAP_ENTRY__VALUE",
",",
"value",
")",
";",
"return",
"entry",
";",
"}",
"else",
"{",
"final",
"BasicEMapEntry",
"entry",
"=",
"new",
"BasicEMapEntry",
"<>",
"(",
")",
";",
"entry",
".",
"eSetClass",
"(",
"type",
")",
";",
"entry",
".",
"setKey",
"(",
"key",
")",
";",
"entry",
".",
"setValue",
"(",
"value",
")",
";",
"return",
"entry",
";",
"}",
"}"
] |
Creates a map entry of type string, string.
@param key of entry
@param value of entry
@return entry
|
[
"Creates",
"a",
"map",
"entry",
"of",
"type",
"string",
"string",
"."
] |
5f4488d1b07d499003351606cf76ee0c4ac39964
|
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/utils/EObjects.java#L75-L95
|
5,609 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
|
DeprecatedListWriter.getNavLinkDeprecated
|
@Override
protected Content getNavLinkDeprecated() {
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.deprecatedLabel);
return li;
}
|
java
|
@Override
protected Content getNavLinkDeprecated() {
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.deprecatedLabel);
return li;
}
|
[
"@",
"Override",
"protected",
"Content",
"getNavLinkDeprecated",
"(",
")",
"{",
"Content",
"li",
"=",
"HtmlTree",
".",
"LI",
"(",
"HtmlStyle",
".",
"navBarCell1Rev",
",",
"contents",
".",
"deprecatedLabel",
")",
";",
"return",
"li",
";",
"}"
] |
Get the deprecated label.
@return a content tree for the deprecated label
|
[
"Get",
"the",
"deprecated",
"label",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java#L392-L396
|
5,610 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
|
MemberEnter.signature
|
Type signature(MethodSymbol msym,
List<JCTypeParameter> typarams,
List<JCVariableDecl> params,
JCTree res,
JCVariableDecl recvparam,
List<JCExpression> thrown,
Env<AttrContext> env) {
// Enter and attribute type parameters.
List<Type> tvars = enter.classEnter(typarams, env);
attr.attribTypeVariables(typarams, env);
// Enter and attribute value parameters.
ListBuffer<Type> argbuf = new ListBuffer<>();
for (List<JCVariableDecl> l = params; l.nonEmpty(); l = l.tail) {
memberEnter(l.head, env);
argbuf.append(l.head.vartype.type);
}
// Attribute result type, if one is given.
Type restype = res == null ? syms.voidType : attr.attribType(res, env);
// Attribute receiver type, if one is given.
Type recvtype;
if (recvparam!=null) {
memberEnter(recvparam, env);
recvtype = recvparam.vartype.type;
} else {
recvtype = null;
}
// Attribute thrown exceptions.
ListBuffer<Type> thrownbuf = new ListBuffer<>();
for (List<JCExpression> l = thrown; l.nonEmpty(); l = l.tail) {
Type exc = attr.attribType(l.head, env);
if (!exc.hasTag(TYPEVAR)) {
exc = chk.checkClassType(l.head.pos(), exc);
} else if (exc.tsym.owner == msym) {
//mark inference variables in 'throws' clause
exc.tsym.flags_field |= THROWS;
}
thrownbuf.append(exc);
}
MethodType mtype = new MethodType(argbuf.toList(),
restype,
thrownbuf.toList(),
syms.methodClass);
mtype.recvtype = recvtype;
return tvars.isEmpty() ? mtype : new ForAll(tvars, mtype);
}
|
java
|
Type signature(MethodSymbol msym,
List<JCTypeParameter> typarams,
List<JCVariableDecl> params,
JCTree res,
JCVariableDecl recvparam,
List<JCExpression> thrown,
Env<AttrContext> env) {
// Enter and attribute type parameters.
List<Type> tvars = enter.classEnter(typarams, env);
attr.attribTypeVariables(typarams, env);
// Enter and attribute value parameters.
ListBuffer<Type> argbuf = new ListBuffer<>();
for (List<JCVariableDecl> l = params; l.nonEmpty(); l = l.tail) {
memberEnter(l.head, env);
argbuf.append(l.head.vartype.type);
}
// Attribute result type, if one is given.
Type restype = res == null ? syms.voidType : attr.attribType(res, env);
// Attribute receiver type, if one is given.
Type recvtype;
if (recvparam!=null) {
memberEnter(recvparam, env);
recvtype = recvparam.vartype.type;
} else {
recvtype = null;
}
// Attribute thrown exceptions.
ListBuffer<Type> thrownbuf = new ListBuffer<>();
for (List<JCExpression> l = thrown; l.nonEmpty(); l = l.tail) {
Type exc = attr.attribType(l.head, env);
if (!exc.hasTag(TYPEVAR)) {
exc = chk.checkClassType(l.head.pos(), exc);
} else if (exc.tsym.owner == msym) {
//mark inference variables in 'throws' clause
exc.tsym.flags_field |= THROWS;
}
thrownbuf.append(exc);
}
MethodType mtype = new MethodType(argbuf.toList(),
restype,
thrownbuf.toList(),
syms.methodClass);
mtype.recvtype = recvtype;
return tvars.isEmpty() ? mtype : new ForAll(tvars, mtype);
}
|
[
"Type",
"signature",
"(",
"MethodSymbol",
"msym",
",",
"List",
"<",
"JCTypeParameter",
">",
"typarams",
",",
"List",
"<",
"JCVariableDecl",
">",
"params",
",",
"JCTree",
"res",
",",
"JCVariableDecl",
"recvparam",
",",
"List",
"<",
"JCExpression",
">",
"thrown",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"// Enter and attribute type parameters.",
"List",
"<",
"Type",
">",
"tvars",
"=",
"enter",
".",
"classEnter",
"(",
"typarams",
",",
"env",
")",
";",
"attr",
".",
"attribTypeVariables",
"(",
"typarams",
",",
"env",
")",
";",
"// Enter and attribute value parameters.",
"ListBuffer",
"<",
"Type",
">",
"argbuf",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"for",
"(",
"List",
"<",
"JCVariableDecl",
">",
"l",
"=",
"params",
";",
"l",
".",
"nonEmpty",
"(",
")",
";",
"l",
"=",
"l",
".",
"tail",
")",
"{",
"memberEnter",
"(",
"l",
".",
"head",
",",
"env",
")",
";",
"argbuf",
".",
"append",
"(",
"l",
".",
"head",
".",
"vartype",
".",
"type",
")",
";",
"}",
"// Attribute result type, if one is given.",
"Type",
"restype",
"=",
"res",
"==",
"null",
"?",
"syms",
".",
"voidType",
":",
"attr",
".",
"attribType",
"(",
"res",
",",
"env",
")",
";",
"// Attribute receiver type, if one is given.",
"Type",
"recvtype",
";",
"if",
"(",
"recvparam",
"!=",
"null",
")",
"{",
"memberEnter",
"(",
"recvparam",
",",
"env",
")",
";",
"recvtype",
"=",
"recvparam",
".",
"vartype",
".",
"type",
";",
"}",
"else",
"{",
"recvtype",
"=",
"null",
";",
"}",
"// Attribute thrown exceptions.",
"ListBuffer",
"<",
"Type",
">",
"thrownbuf",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"for",
"(",
"List",
"<",
"JCExpression",
">",
"l",
"=",
"thrown",
";",
"l",
".",
"nonEmpty",
"(",
")",
";",
"l",
"=",
"l",
".",
"tail",
")",
"{",
"Type",
"exc",
"=",
"attr",
".",
"attribType",
"(",
"l",
".",
"head",
",",
"env",
")",
";",
"if",
"(",
"!",
"exc",
".",
"hasTag",
"(",
"TYPEVAR",
")",
")",
"{",
"exc",
"=",
"chk",
".",
"checkClassType",
"(",
"l",
".",
"head",
".",
"pos",
"(",
")",
",",
"exc",
")",
";",
"}",
"else",
"if",
"(",
"exc",
".",
"tsym",
".",
"owner",
"==",
"msym",
")",
"{",
"//mark inference variables in 'throws' clause",
"exc",
".",
"tsym",
".",
"flags_field",
"|=",
"THROWS",
";",
"}",
"thrownbuf",
".",
"append",
"(",
"exc",
")",
";",
"}",
"MethodType",
"mtype",
"=",
"new",
"MethodType",
"(",
"argbuf",
".",
"toList",
"(",
")",
",",
"restype",
",",
"thrownbuf",
".",
"toList",
"(",
")",
",",
"syms",
".",
"methodClass",
")",
";",
"mtype",
".",
"recvtype",
"=",
"recvtype",
";",
"return",
"tvars",
".",
"isEmpty",
"(",
")",
"?",
"mtype",
":",
"new",
"ForAll",
"(",
"tvars",
",",
"mtype",
")",
";",
"}"
] |
Construct method type from method signature.
@param typarams The method's type parameters.
@param params The method's value parameters.
@param res The method's result type,
null if it is a constructor.
@param recvparam The method's receiver parameter,
null if none given; TODO: or already set here?
@param thrown The method's thrown exceptions.
@param env The method's (local) environment.
|
[
"Construct",
"method",
"type",
"from",
"method",
"signature",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java#L94-L144
|
5,611 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
|
MemberEnter.memberEnter
|
protected void memberEnter(JCTree tree, Env<AttrContext> env) {
Env<AttrContext> prevEnv = this.env;
try {
this.env = env;
tree.accept(this);
} catch (CompletionFailure ex) {
chk.completionError(tree.pos(), ex);
} finally {
this.env = prevEnv;
}
}
|
java
|
protected void memberEnter(JCTree tree, Env<AttrContext> env) {
Env<AttrContext> prevEnv = this.env;
try {
this.env = env;
tree.accept(this);
} catch (CompletionFailure ex) {
chk.completionError(tree.pos(), ex);
} finally {
this.env = prevEnv;
}
}
|
[
"protected",
"void",
"memberEnter",
"(",
"JCTree",
"tree",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"Env",
"<",
"AttrContext",
">",
"prevEnv",
"=",
"this",
".",
"env",
";",
"try",
"{",
"this",
".",
"env",
"=",
"env",
";",
"tree",
".",
"accept",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"CompletionFailure",
"ex",
")",
"{",
"chk",
".",
"completionError",
"(",
"tree",
".",
"pos",
"(",
")",
",",
"ex",
")",
";",
"}",
"finally",
"{",
"this",
".",
"env",
"=",
"prevEnv",
";",
"}",
"}"
] |
Enter field and method definitions and process import
clauses, catching any completion failure exceptions.
|
[
"Enter",
"field",
"and",
"method",
"definitions",
"and",
"process",
"import",
"clauses",
"catching",
"any",
"completion",
"failure",
"exceptions",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java#L157-L167
|
5,612 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
|
MemberEnter.memberEnter
|
void memberEnter(List<? extends JCTree> trees, Env<AttrContext> env) {
for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
memberEnter(l.head, env);
}
|
java
|
void memberEnter(List<? extends JCTree> trees, Env<AttrContext> env) {
for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
memberEnter(l.head, env);
}
|
[
"void",
"memberEnter",
"(",
"List",
"<",
"?",
"extends",
"JCTree",
">",
"trees",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"for",
"(",
"List",
"<",
"?",
"extends",
"JCTree",
">",
"l",
"=",
"trees",
";",
"l",
".",
"nonEmpty",
"(",
")",
";",
"l",
"=",
"l",
".",
"tail",
")",
"memberEnter",
"(",
"l",
".",
"head",
"",
",",
"env",
")",
";",
"}"
] |
Enter members from a list of trees.
|
[
"Enter",
"members",
"from",
"a",
"list",
"of",
"trees",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java#L171-L174
|
5,613 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
|
MemberEnter.methodEnv
|
Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) {
Env<AttrContext> localEnv =
env.dup(tree, env.info.dup(env.info.scope.dupUnshared(tree.sym)));
localEnv.enclMethod = tree;
if (tree.sym.type != null) {
//when this is called in the enter stage, there's no type to be set
localEnv.info.returnResult = attr.new ResultInfo(KindSelector.VAL,
tree.sym.type.getReturnType());
}
if ((tree.mods.flags & STATIC) != 0) localEnv.info.staticLevel++;
return localEnv;
}
|
java
|
Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) {
Env<AttrContext> localEnv =
env.dup(tree, env.info.dup(env.info.scope.dupUnshared(tree.sym)));
localEnv.enclMethod = tree;
if (tree.sym.type != null) {
//when this is called in the enter stage, there's no type to be set
localEnv.info.returnResult = attr.new ResultInfo(KindSelector.VAL,
tree.sym.type.getReturnType());
}
if ((tree.mods.flags & STATIC) != 0) localEnv.info.staticLevel++;
return localEnv;
}
|
[
"Env",
"<",
"AttrContext",
">",
"methodEnv",
"(",
"JCMethodDecl",
"tree",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"Env",
"<",
"AttrContext",
">",
"localEnv",
"=",
"env",
".",
"dup",
"(",
"tree",
",",
"env",
".",
"info",
".",
"dup",
"(",
"env",
".",
"info",
".",
"scope",
".",
"dupUnshared",
"(",
"tree",
".",
"sym",
")",
")",
")",
";",
"localEnv",
".",
"enclMethod",
"=",
"tree",
";",
"if",
"(",
"tree",
".",
"sym",
".",
"type",
"!=",
"null",
")",
"{",
"//when this is called in the enter stage, there's no type to be set",
"localEnv",
".",
"info",
".",
"returnResult",
"=",
"attr",
".",
"new",
"ResultInfo",
"(",
"KindSelector",
".",
"VAL",
",",
"tree",
".",
"sym",
".",
"type",
".",
"getReturnType",
"(",
")",
")",
";",
"}",
"if",
"(",
"(",
"tree",
".",
"mods",
".",
"flags",
"&",
"STATIC",
")",
"!=",
"0",
")",
"localEnv",
".",
"info",
".",
"staticLevel",
"++",
";",
"return",
"localEnv",
";",
"}"
] |
Create a fresh environment for method bodies.
@param tree The method definition.
@param env The environment current outside of the method definition.
|
[
"Create",
"a",
"fresh",
"environment",
"for",
"method",
"bodies",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java#L236-L247
|
5,614 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
|
MemberEnter.initEnv
|
Env<AttrContext> initEnv(JCVariableDecl tree, Env<AttrContext> env) {
Env<AttrContext> localEnv = env.dupto(new AttrContextEnv(tree, env.info.dup()));
if (tree.sym.owner.kind == TYP) {
localEnv.info.scope = env.info.scope.dupUnshared(tree.sym);
}
if ((tree.mods.flags & STATIC) != 0 ||
((env.enclClass.sym.flags() & INTERFACE) != 0 && env.enclMethod == null))
localEnv.info.staticLevel++;
return localEnv;
}
|
java
|
Env<AttrContext> initEnv(JCVariableDecl tree, Env<AttrContext> env) {
Env<AttrContext> localEnv = env.dupto(new AttrContextEnv(tree, env.info.dup()));
if (tree.sym.owner.kind == TYP) {
localEnv.info.scope = env.info.scope.dupUnshared(tree.sym);
}
if ((tree.mods.flags & STATIC) != 0 ||
((env.enclClass.sym.flags() & INTERFACE) != 0 && env.enclMethod == null))
localEnv.info.staticLevel++;
return localEnv;
}
|
[
"Env",
"<",
"AttrContext",
">",
"initEnv",
"(",
"JCVariableDecl",
"tree",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"Env",
"<",
"AttrContext",
">",
"localEnv",
"=",
"env",
".",
"dupto",
"(",
"new",
"AttrContextEnv",
"(",
"tree",
",",
"env",
".",
"info",
".",
"dup",
"(",
")",
")",
")",
";",
"if",
"(",
"tree",
".",
"sym",
".",
"owner",
".",
"kind",
"==",
"TYP",
")",
"{",
"localEnv",
".",
"info",
".",
"scope",
"=",
"env",
".",
"info",
".",
"scope",
".",
"dupUnshared",
"(",
"tree",
".",
"sym",
")",
";",
"}",
"if",
"(",
"(",
"tree",
".",
"mods",
".",
"flags",
"&",
"STATIC",
")",
"!=",
"0",
"||",
"(",
"(",
"env",
".",
"enclClass",
".",
"sym",
".",
"flags",
"(",
")",
"&",
"INTERFACE",
")",
"!=",
"0",
"&&",
"env",
".",
"enclMethod",
"==",
"null",
")",
")",
"localEnv",
".",
"info",
".",
"staticLevel",
"++",
";",
"return",
"localEnv",
";",
"}"
] |
Create a fresh environment for a variable's initializer.
If the variable is a field, the owner of the environment's scope
is be the variable itself, otherwise the owner is the method
enclosing the variable definition.
@param tree The variable definition.
@param env The environment current outside of the variable definition.
|
[
"Create",
"a",
"fresh",
"environment",
"for",
"a",
"variable",
"s",
"initializer",
".",
"If",
"the",
"variable",
"is",
"a",
"field",
"the",
"owner",
"of",
"the",
"environment",
"s",
"scope",
"is",
"be",
"the",
"variable",
"itself",
"otherwise",
"the",
"owner",
"is",
"the",
"method",
"enclosing",
"the",
"variable",
"definition",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java#L411-L420
|
5,615 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java
|
Convert.utf2chars
|
public static int utf2chars(byte[] src, int sindex,
char[] dst, int dindex,
int len) {
int i = sindex;
int j = dindex;
int limit = sindex + len;
while (i < limit) {
int b = src[i++] & 0xFF;
if (b >= 0xE0) {
b = (b & 0x0F) << 12;
b = b | (src[i++] & 0x3F) << 6;
b = b | (src[i++] & 0x3F);
} else if (b >= 0xC0) {
b = (b & 0x1F) << 6;
b = b | (src[i++] & 0x3F);
}
dst[j++] = (char)b;
}
return j;
}
|
java
|
public static int utf2chars(byte[] src, int sindex,
char[] dst, int dindex,
int len) {
int i = sindex;
int j = dindex;
int limit = sindex + len;
while (i < limit) {
int b = src[i++] & 0xFF;
if (b >= 0xE0) {
b = (b & 0x0F) << 12;
b = b | (src[i++] & 0x3F) << 6;
b = b | (src[i++] & 0x3F);
} else if (b >= 0xC0) {
b = (b & 0x1F) << 6;
b = b | (src[i++] & 0x3F);
}
dst[j++] = (char)b;
}
return j;
}
|
[
"public",
"static",
"int",
"utf2chars",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"sindex",
",",
"char",
"[",
"]",
"dst",
",",
"int",
"dindex",
",",
"int",
"len",
")",
"{",
"int",
"i",
"=",
"sindex",
";",
"int",
"j",
"=",
"dindex",
";",
"int",
"limit",
"=",
"sindex",
"+",
"len",
";",
"while",
"(",
"i",
"<",
"limit",
")",
"{",
"int",
"b",
"=",
"src",
"[",
"i",
"++",
"]",
"&",
"0xFF",
";",
"if",
"(",
"b",
">=",
"0xE0",
")",
"{",
"b",
"=",
"(",
"b",
"&",
"0x0F",
")",
"<<",
"12",
";",
"b",
"=",
"b",
"|",
"(",
"src",
"[",
"i",
"++",
"]",
"&",
"0x3F",
")",
"<<",
"6",
";",
"b",
"=",
"b",
"|",
"(",
"src",
"[",
"i",
"++",
"]",
"&",
"0x3F",
")",
";",
"}",
"else",
"if",
"(",
"b",
">=",
"0xC0",
")",
"{",
"b",
"=",
"(",
"b",
"&",
"0x1F",
")",
"<<",
"6",
";",
"b",
"=",
"b",
"|",
"(",
"src",
"[",
"i",
"++",
"]",
"&",
"0x3F",
")",
";",
"}",
"dst",
"[",
"j",
"++",
"]",
"=",
"(",
"char",
")",
"b",
";",
"}",
"return",
"j",
";",
"}"
] |
Convert `len' bytes from utf8 to characters.
Parameters are as in System.arraycopy
Return first index in `dst' past the last copied char.
@param src The array holding the bytes to convert.
@param sindex The start index from which bytes are converted.
@param dst The array holding the converted characters..
@param dindex The start index from which converted characters
are written.
@param len The maximum number of bytes to convert.
|
[
"Convert",
"len",
"bytes",
"from",
"utf8",
"to",
"characters",
".",
"Parameters",
"are",
"as",
"in",
"System",
".",
"arraycopy",
"Return",
"first",
"index",
"in",
"dst",
"past",
"the",
"last",
"copied",
"char",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java#L113-L132
|
5,616 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java
|
Convert.utf2chars
|
public static char[] utf2chars(byte[] src, int sindex, int len) {
char[] dst = new char[len];
int len1 = utf2chars(src, sindex, dst, 0, len);
char[] result = new char[len1];
System.arraycopy(dst, 0, result, 0, len1);
return result;
}
|
java
|
public static char[] utf2chars(byte[] src, int sindex, int len) {
char[] dst = new char[len];
int len1 = utf2chars(src, sindex, dst, 0, len);
char[] result = new char[len1];
System.arraycopy(dst, 0, result, 0, len1);
return result;
}
|
[
"public",
"static",
"char",
"[",
"]",
"utf2chars",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"sindex",
",",
"int",
"len",
")",
"{",
"char",
"[",
"]",
"dst",
"=",
"new",
"char",
"[",
"len",
"]",
";",
"int",
"len1",
"=",
"utf2chars",
"(",
"src",
",",
"sindex",
",",
"dst",
",",
"0",
",",
"len",
")",
";",
"char",
"[",
"]",
"result",
"=",
"new",
"char",
"[",
"len1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"dst",
",",
"0",
",",
"result",
",",
"0",
",",
"len1",
")",
";",
"return",
"result",
";",
"}"
] |
Return bytes in Utf8 representation as an array of characters.
@param src The array holding the bytes.
@param sindex The start index from which bytes are converted.
@param len The maximum number of bytes to convert.
|
[
"Return",
"bytes",
"in",
"Utf8",
"representation",
"as",
"an",
"array",
"of",
"characters",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java#L139-L145
|
5,617 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java
|
Convert.utf2string
|
public static String utf2string(byte[] src, int sindex, int len) {
char dst[] = new char[len];
int len1 = utf2chars(src, sindex, dst, 0, len);
return new String(dst, 0, len1);
}
|
java
|
public static String utf2string(byte[] src, int sindex, int len) {
char dst[] = new char[len];
int len1 = utf2chars(src, sindex, dst, 0, len);
return new String(dst, 0, len1);
}
|
[
"public",
"static",
"String",
"utf2string",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"sindex",
",",
"int",
"len",
")",
"{",
"char",
"dst",
"[",
"]",
"=",
"new",
"char",
"[",
"len",
"]",
";",
"int",
"len1",
"=",
"utf2chars",
"(",
"src",
",",
"sindex",
",",
"dst",
",",
"0",
",",
"len",
")",
";",
"return",
"new",
"String",
"(",
"dst",
",",
"0",
",",
"len1",
")",
";",
"}"
] |
Return bytes in Utf8 representation as a string.
@param src The array holding the bytes.
@param sindex The start index from which bytes are converted.
@param len The maximum number of bytes to convert.
|
[
"Return",
"bytes",
"in",
"Utf8",
"representation",
"as",
"a",
"string",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java#L160-L164
|
5,618 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java
|
Convert.chars2utf
|
public static int chars2utf(char[] src, int sindex,
byte[] dst, int dindex,
int len) {
int j = dindex;
int limit = sindex + len;
for (int i = sindex; i < limit; i++) {
char ch = src[i];
if (1 <= ch && ch <= 0x7F) {
dst[j++] = (byte)ch;
} else if (ch <= 0x7FF) {
dst[j++] = (byte)(0xC0 | (ch >> 6));
dst[j++] = (byte)(0x80 | (ch & 0x3F));
} else {
dst[j++] = (byte)(0xE0 | (ch >> 12));
dst[j++] = (byte)(0x80 | ((ch >> 6) & 0x3F));
dst[j++] = (byte)(0x80 | (ch & 0x3F));
}
}
return j;
}
|
java
|
public static int chars2utf(char[] src, int sindex,
byte[] dst, int dindex,
int len) {
int j = dindex;
int limit = sindex + len;
for (int i = sindex; i < limit; i++) {
char ch = src[i];
if (1 <= ch && ch <= 0x7F) {
dst[j++] = (byte)ch;
} else if (ch <= 0x7FF) {
dst[j++] = (byte)(0xC0 | (ch >> 6));
dst[j++] = (byte)(0x80 | (ch & 0x3F));
} else {
dst[j++] = (byte)(0xE0 | (ch >> 12));
dst[j++] = (byte)(0x80 | ((ch >> 6) & 0x3F));
dst[j++] = (byte)(0x80 | (ch & 0x3F));
}
}
return j;
}
|
[
"public",
"static",
"int",
"chars2utf",
"(",
"char",
"[",
"]",
"src",
",",
"int",
"sindex",
",",
"byte",
"[",
"]",
"dst",
",",
"int",
"dindex",
",",
"int",
"len",
")",
"{",
"int",
"j",
"=",
"dindex",
";",
"int",
"limit",
"=",
"sindex",
"+",
"len",
";",
"for",
"(",
"int",
"i",
"=",
"sindex",
";",
"i",
"<",
"limit",
";",
"i",
"++",
")",
"{",
"char",
"ch",
"=",
"src",
"[",
"i",
"]",
";",
"if",
"(",
"1",
"<=",
"ch",
"&&",
"ch",
"<=",
"0x7F",
")",
"{",
"dst",
"[",
"j",
"++",
"]",
"=",
"(",
"byte",
")",
"ch",
";",
"}",
"else",
"if",
"(",
"ch",
"<=",
"0x7FF",
")",
"{",
"dst",
"[",
"j",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"0xC0",
"|",
"(",
"ch",
">>",
"6",
")",
")",
";",
"dst",
"[",
"j",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"0x80",
"|",
"(",
"ch",
"&",
"0x3F",
")",
")",
";",
"}",
"else",
"{",
"dst",
"[",
"j",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"0xE0",
"|",
"(",
"ch",
">>",
"12",
")",
")",
";",
"dst",
"[",
"j",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"0x80",
"|",
"(",
"(",
"ch",
">>",
"6",
")",
"&",
"0x3F",
")",
")",
";",
"dst",
"[",
"j",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"0x80",
"|",
"(",
"ch",
"&",
"0x3F",
")",
")",
";",
"}",
"}",
"return",
"j",
";",
"}"
] |
Copy characters in source array to bytes in target array,
converting them to Utf8 representation.
The target array must be large enough to hold the result.
returns first index in `dst' past the last copied byte.
@param src The array holding the characters to convert.
@param sindex The start index from which characters are converted.
@param dst The array holding the converted characters..
@param dindex The start index from which converted bytes
are written.
@param len The maximum number of characters to convert.
|
[
"Copy",
"characters",
"in",
"source",
"array",
"to",
"bytes",
"in",
"target",
"array",
"converting",
"them",
"to",
"Utf8",
"representation",
".",
"The",
"target",
"array",
"must",
"be",
"large",
"enough",
"to",
"hold",
"the",
"result",
".",
"returns",
"first",
"index",
"in",
"dst",
"past",
"the",
"last",
"copied",
"byte",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java#L185-L204
|
5,619 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java
|
Convert.quote
|
public static String quote(String s) {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
buf.append(quote(s.charAt(i)));
}
return buf.toString();
}
|
java
|
public static String quote(String s) {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
buf.append(quote(s.charAt(i)));
}
return buf.toString();
}
|
[
"public",
"static",
"String",
"quote",
"(",
"String",
"s",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"buf",
".",
"append",
"(",
"quote",
"(",
"s",
".",
"charAt",
"(",
"i",
")",
")",
")",
";",
"}",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}"
] |
Escapes each character in a string that has an escape sequence or
is non-printable ASCII. Leaves non-ASCII characters alone.
|
[
"Escapes",
"each",
"character",
"in",
"a",
"string",
"that",
"has",
"an",
"escape",
"sequence",
"or",
"is",
"non",
"-",
"printable",
"ASCII",
".",
"Leaves",
"non",
"-",
"ASCII",
"characters",
"alone",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java#L237-L243
|
5,620 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java
|
Convert.quote
|
public static String quote(char ch) {
switch (ch) {
case '\b': return "\\b";
case '\f': return "\\f";
case '\n': return "\\n";
case '\r': return "\\r";
case '\t': return "\\t";
case '\'': return "\\'";
case '\"': return "\\\"";
case '\\': return "\\\\";
default:
return (isPrintableAscii(ch))
? String.valueOf(ch)
: String.format("\\u%04x", (int) ch);
}
}
|
java
|
public static String quote(char ch) {
switch (ch) {
case '\b': return "\\b";
case '\f': return "\\f";
case '\n': return "\\n";
case '\r': return "\\r";
case '\t': return "\\t";
case '\'': return "\\'";
case '\"': return "\\\"";
case '\\': return "\\\\";
default:
return (isPrintableAscii(ch))
? String.valueOf(ch)
: String.format("\\u%04x", (int) ch);
}
}
|
[
"public",
"static",
"String",
"quote",
"(",
"char",
"ch",
")",
"{",
"switch",
"(",
"ch",
")",
"{",
"case",
"'",
"'",
":",
"return",
"\"\\\\b\"",
";",
"case",
"'",
"'",
":",
"return",
"\"\\\\f\"",
";",
"case",
"'",
"'",
":",
"return",
"\"\\\\n\"",
";",
"case",
"'",
"'",
":",
"return",
"\"\\\\r\"",
";",
"case",
"'",
"'",
":",
"return",
"\"\\\\t\"",
";",
"case",
"'",
"'",
":",
"return",
"\"\\\\'\"",
";",
"case",
"'",
"'",
":",
"return",
"\"\\\\\\\"\"",
";",
"case",
"'",
"'",
":",
"return",
"\"\\\\\\\\\"",
";",
"default",
":",
"return",
"(",
"isPrintableAscii",
"(",
"ch",
")",
")",
"?",
"String",
".",
"valueOf",
"(",
"ch",
")",
":",
"String",
".",
"format",
"(",
"\"\\\\u%04x\"",
",",
"(",
"int",
")",
"ch",
")",
";",
"}",
"}"
] |
Escapes a character if it has an escape sequence or is
non-printable ASCII. Leaves non-ASCII characters alone.
|
[
"Escapes",
"a",
"character",
"if",
"it",
"has",
"an",
"escape",
"sequence",
"or",
"is",
"non",
"-",
"printable",
"ASCII",
".",
"Leaves",
"non",
"-",
"ASCII",
"characters",
"alone",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java#L249-L264
|
5,621 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java
|
Convert.escapeUnicode
|
public static String escapeUnicode(String s) {
int len = s.length();
int i = 0;
while (i < len) {
char ch = s.charAt(i);
if (ch > 255) {
StringBuilder buf = new StringBuilder();
buf.append(s.substring(0, i));
while (i < len) {
ch = s.charAt(i);
if (ch > 255) {
buf.append("\\u");
buf.append(Character.forDigit((ch >> 12) % 16, 16));
buf.append(Character.forDigit((ch >> 8) % 16, 16));
buf.append(Character.forDigit((ch >> 4) % 16, 16));
buf.append(Character.forDigit((ch ) % 16, 16));
} else {
buf.append(ch);
}
i++;
}
s = buf.toString();
} else {
i++;
}
}
return s;
}
|
java
|
public static String escapeUnicode(String s) {
int len = s.length();
int i = 0;
while (i < len) {
char ch = s.charAt(i);
if (ch > 255) {
StringBuilder buf = new StringBuilder();
buf.append(s.substring(0, i));
while (i < len) {
ch = s.charAt(i);
if (ch > 255) {
buf.append("\\u");
buf.append(Character.forDigit((ch >> 12) % 16, 16));
buf.append(Character.forDigit((ch >> 8) % 16, 16));
buf.append(Character.forDigit((ch >> 4) % 16, 16));
buf.append(Character.forDigit((ch ) % 16, 16));
} else {
buf.append(ch);
}
i++;
}
s = buf.toString();
} else {
i++;
}
}
return s;
}
|
[
"public",
"static",
"String",
"escapeUnicode",
"(",
"String",
"s",
")",
"{",
"int",
"len",
"=",
"s",
".",
"length",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"len",
")",
"{",
"char",
"ch",
"=",
"s",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"ch",
">",
"255",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buf",
".",
"append",
"(",
"s",
".",
"substring",
"(",
"0",
",",
"i",
")",
")",
";",
"while",
"(",
"i",
"<",
"len",
")",
"{",
"ch",
"=",
"s",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"ch",
">",
"255",
")",
"{",
"buf",
".",
"append",
"(",
"\"\\\\u\"",
")",
";",
"buf",
".",
"append",
"(",
"Character",
".",
"forDigit",
"(",
"(",
"ch",
">>",
"12",
")",
"%",
"16",
",",
"16",
")",
")",
";",
"buf",
".",
"append",
"(",
"Character",
".",
"forDigit",
"(",
"(",
"ch",
">>",
"8",
")",
"%",
"16",
",",
"16",
")",
")",
";",
"buf",
".",
"append",
"(",
"Character",
".",
"forDigit",
"(",
"(",
"ch",
">>",
"4",
")",
"%",
"16",
",",
"16",
")",
")",
";",
"buf",
".",
"append",
"(",
"Character",
".",
"forDigit",
"(",
"(",
"ch",
")",
"%",
"16",
",",
"16",
")",
")",
";",
"}",
"else",
"{",
"buf",
".",
"append",
"(",
"ch",
")",
";",
"}",
"i",
"++",
";",
"}",
"s",
"=",
"buf",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"i",
"++",
";",
"}",
"}",
"return",
"s",
";",
"}"
] |
Escape all unicode characters in string.
|
[
"Escape",
"all",
"unicode",
"characters",
"in",
"string",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java#L275-L302
|
5,622 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java
|
Convert.shortName
|
public static Name shortName(Name classname) {
return classname.subName(
classname.lastIndexOf((byte)'.') + 1, classname.getByteLength());
}
|
java
|
public static Name shortName(Name classname) {
return classname.subName(
classname.lastIndexOf((byte)'.') + 1, classname.getByteLength());
}
|
[
"public",
"static",
"Name",
"shortName",
"(",
"Name",
"classname",
")",
"{",
"return",
"classname",
".",
"subName",
"(",
"classname",
".",
"lastIndexOf",
"(",
"(",
"byte",
")",
"'",
"'",
")",
"+",
"1",
",",
"classname",
".",
"getByteLength",
"(",
")",
")",
";",
"}"
] |
Return the last part of a class name.
|
[
"Return",
"the",
"last",
"part",
"of",
"a",
"class",
"name",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java#L308-L311
|
5,623 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java
|
ValueTaglet.getVariableElement
|
private VariableElement getVariableElement(Element holder, Configuration config, DocTree tag) {
Utils utils = config.utils;
CommentHelper ch = utils.getCommentHelper(holder);
String signature = ch.getReferencedSignature(tag);
if (signature == null) { // no reference
//Base case: no label.
if (utils.isVariableElement(holder)) {
return (VariableElement)(holder);
} else {
// If the value tag does not specify a parameter which is a valid field and
// it is not used within the comments of a valid field, return null.
return null;
}
}
String[] sigValues = signature.split("#");
String memberName = null;
TypeElement te = null;
if (sigValues.length == 1) {
//Case 2: @value in same class.
if (utils.isExecutableElement(holder) || utils.isVariableElement(holder)) {
te = utils.getEnclosingTypeElement(holder);
} else if (utils.isTypeElement(holder)) {
te = utils.getTopMostContainingTypeElement(holder);
}
memberName = sigValues[0];
} else {
//Case 3: @value in different class.
Elements elements = config.docEnv.getElementUtils();
te = elements.getTypeElement(sigValues[0]);
memberName = sigValues[1];
}
if (te == null) {
return null;
}
for (Element field : utils.getFields(te)) {
if (utils.getSimpleName(field).equals(memberName)) {
return (VariableElement)field;
}
}
return null;
}
|
java
|
private VariableElement getVariableElement(Element holder, Configuration config, DocTree tag) {
Utils utils = config.utils;
CommentHelper ch = utils.getCommentHelper(holder);
String signature = ch.getReferencedSignature(tag);
if (signature == null) { // no reference
//Base case: no label.
if (utils.isVariableElement(holder)) {
return (VariableElement)(holder);
} else {
// If the value tag does not specify a parameter which is a valid field and
// it is not used within the comments of a valid field, return null.
return null;
}
}
String[] sigValues = signature.split("#");
String memberName = null;
TypeElement te = null;
if (sigValues.length == 1) {
//Case 2: @value in same class.
if (utils.isExecutableElement(holder) || utils.isVariableElement(holder)) {
te = utils.getEnclosingTypeElement(holder);
} else if (utils.isTypeElement(holder)) {
te = utils.getTopMostContainingTypeElement(holder);
}
memberName = sigValues[0];
} else {
//Case 3: @value in different class.
Elements elements = config.docEnv.getElementUtils();
te = elements.getTypeElement(sigValues[0]);
memberName = sigValues[1];
}
if (te == null) {
return null;
}
for (Element field : utils.getFields(te)) {
if (utils.getSimpleName(field).equals(memberName)) {
return (VariableElement)field;
}
}
return null;
}
|
[
"private",
"VariableElement",
"getVariableElement",
"(",
"Element",
"holder",
",",
"Configuration",
"config",
",",
"DocTree",
"tag",
")",
"{",
"Utils",
"utils",
"=",
"config",
".",
"utils",
";",
"CommentHelper",
"ch",
"=",
"utils",
".",
"getCommentHelper",
"(",
"holder",
")",
";",
"String",
"signature",
"=",
"ch",
".",
"getReferencedSignature",
"(",
"tag",
")",
";",
"if",
"(",
"signature",
"==",
"null",
")",
"{",
"// no reference",
"//Base case: no label.",
"if",
"(",
"utils",
".",
"isVariableElement",
"(",
"holder",
")",
")",
"{",
"return",
"(",
"VariableElement",
")",
"(",
"holder",
")",
";",
"}",
"else",
"{",
"// If the value tag does not specify a parameter which is a valid field and",
"// it is not used within the comments of a valid field, return null.",
"return",
"null",
";",
"}",
"}",
"String",
"[",
"]",
"sigValues",
"=",
"signature",
".",
"split",
"(",
"\"#\"",
")",
";",
"String",
"memberName",
"=",
"null",
";",
"TypeElement",
"te",
"=",
"null",
";",
"if",
"(",
"sigValues",
".",
"length",
"==",
"1",
")",
"{",
"//Case 2: @value in same class.",
"if",
"(",
"utils",
".",
"isExecutableElement",
"(",
"holder",
")",
"||",
"utils",
".",
"isVariableElement",
"(",
"holder",
")",
")",
"{",
"te",
"=",
"utils",
".",
"getEnclosingTypeElement",
"(",
"holder",
")",
";",
"}",
"else",
"if",
"(",
"utils",
".",
"isTypeElement",
"(",
"holder",
")",
")",
"{",
"te",
"=",
"utils",
".",
"getTopMostContainingTypeElement",
"(",
"holder",
")",
";",
"}",
"memberName",
"=",
"sigValues",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"//Case 3: @value in different class.",
"Elements",
"elements",
"=",
"config",
".",
"docEnv",
".",
"getElementUtils",
"(",
")",
";",
"te",
"=",
"elements",
".",
"getTypeElement",
"(",
"sigValues",
"[",
"0",
"]",
")",
";",
"memberName",
"=",
"sigValues",
"[",
"1",
"]",
";",
"}",
"if",
"(",
"te",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"Element",
"field",
":",
"utils",
".",
"getFields",
"(",
"te",
")",
")",
"{",
"if",
"(",
"utils",
".",
"getSimpleName",
"(",
"field",
")",
".",
"equals",
"(",
"memberName",
")",
")",
"{",
"return",
"(",
"VariableElement",
")",
"field",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Given the name of the field, return the corresponding VariableElement. Return null
due to invalid use of value tag if the name is null or empty string and if
the value tag is not used on a field.
@param holder the element holding the tag
@param config the current configuration of the doclet.
@param tag the value tag.
@return the corresponding VariableElement. If the name is null or empty string,
return field that the value tag was used in. Return null if the name is null
or empty string and if the value tag is not used on a field.
|
[
"Given",
"the",
"name",
"of",
"the",
"field",
"return",
"the",
"corresponding",
"VariableElement",
".",
"Return",
"null",
"due",
"to",
"invalid",
"use",
"of",
"value",
"tag",
"if",
"the",
"name",
"is",
"null",
"or",
"empty",
"string",
"and",
"if",
"the",
"value",
"tag",
"is",
"not",
"used",
"on",
"a",
"field",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java#L136-L178
|
5,624 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java
|
MemoryFileManager.list
|
@Override
public Iterable<JavaFileObject> list(JavaFileManager.Location location,
String packageName,
Set<JavaFileObject.Kind> kinds,
boolean recurse)
throws IOException {
Iterable<JavaFileObject> stdList = stdFileManager.list(location, packageName, kinds, recurse);
if (location==CLASS_PATH && packageName.equals("REPL")) {
// if the desired list is for our JShell package, lazily iterate over
// first the standard list then any generated classes.
return () -> new Iterator<JavaFileObject>() {
boolean stdDone = false;
Iterator<? extends JavaFileObject> it;
@Override
public boolean hasNext() {
if (it == null) {
it = stdList.iterator();
}
if (it.hasNext()) {
return true;
}
if (stdDone) {
return false;
} else {
stdDone = true;
it = generatedClasses().iterator();
return it.hasNext();
}
}
@Override
public JavaFileObject next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
return it.next();
}
};
} else {
return stdList;
}
}
|
java
|
@Override
public Iterable<JavaFileObject> list(JavaFileManager.Location location,
String packageName,
Set<JavaFileObject.Kind> kinds,
boolean recurse)
throws IOException {
Iterable<JavaFileObject> stdList = stdFileManager.list(location, packageName, kinds, recurse);
if (location==CLASS_PATH && packageName.equals("REPL")) {
// if the desired list is for our JShell package, lazily iterate over
// first the standard list then any generated classes.
return () -> new Iterator<JavaFileObject>() {
boolean stdDone = false;
Iterator<? extends JavaFileObject> it;
@Override
public boolean hasNext() {
if (it == null) {
it = stdList.iterator();
}
if (it.hasNext()) {
return true;
}
if (stdDone) {
return false;
} else {
stdDone = true;
it = generatedClasses().iterator();
return it.hasNext();
}
}
@Override
public JavaFileObject next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
return it.next();
}
};
} else {
return stdList;
}
}
|
[
"@",
"Override",
"public",
"Iterable",
"<",
"JavaFileObject",
">",
"list",
"(",
"JavaFileManager",
".",
"Location",
"location",
",",
"String",
"packageName",
",",
"Set",
"<",
"JavaFileObject",
".",
"Kind",
">",
"kinds",
",",
"boolean",
"recurse",
")",
"throws",
"IOException",
"{",
"Iterable",
"<",
"JavaFileObject",
">",
"stdList",
"=",
"stdFileManager",
".",
"list",
"(",
"location",
",",
"packageName",
",",
"kinds",
",",
"recurse",
")",
";",
"if",
"(",
"location",
"==",
"CLASS_PATH",
"&&",
"packageName",
".",
"equals",
"(",
"\"REPL\"",
")",
")",
"{",
"// if the desired list is for our JShell package, lazily iterate over",
"// first the standard list then any generated classes.",
"return",
"(",
")",
"->",
"new",
"Iterator",
"<",
"JavaFileObject",
">",
"(",
")",
"{",
"boolean",
"stdDone",
"=",
"false",
";",
"Iterator",
"<",
"?",
"extends",
"JavaFileObject",
">",
"it",
";",
"@",
"Override",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"if",
"(",
"it",
"==",
"null",
")",
"{",
"it",
"=",
"stdList",
".",
"iterator",
"(",
")",
";",
"}",
"if",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"stdDone",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"stdDone",
"=",
"true",
";",
"it",
"=",
"generatedClasses",
"(",
")",
".",
"iterator",
"(",
")",
";",
"return",
"it",
".",
"hasNext",
"(",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"JavaFileObject",
"next",
"(",
")",
"{",
"if",
"(",
"!",
"hasNext",
"(",
")",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"(",
")",
";",
"}",
"return",
"it",
".",
"next",
"(",
")",
";",
"}",
"}",
";",
"}",
"else",
"{",
"return",
"stdList",
";",
"}",
"}"
] |
Lists all file objects matching the given criteria in the given
location. List file objects in "subpackages" if recurse is
true.
<p>Note: even if the given location is unknown to this file
manager, it may not return {@code null}. Also, an unknown
location may not cause an exception.
@param location a location
@param packageName a package name
@param kinds return objects only of these kinds
@param recurse if true include "subpackages"
@return an Iterable of file objects matching the given criteria
@throws IOException if an I/O error occurred, or if {@link
#close} has been called and this file manager cannot be
reopened
@throws IllegalStateException if {@link #close} has been called
and this file manager cannot be reopened
|
[
"Lists",
"all",
"file",
"objects",
"matching",
"the",
"given",
"criteria",
"in",
"the",
"given",
"location",
".",
"List",
"file",
"objects",
"in",
"subpackages",
"if",
"recurse",
"is",
"true",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java#L225-L268
|
5,625 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java
|
MemoryFileManager.isSameFile
|
@Override
public boolean isSameFile(FileObject a, FileObject b) {
return stdFileManager.isSameFile(b, b);
}
|
java
|
@Override
public boolean isSameFile(FileObject a, FileObject b) {
return stdFileManager.isSameFile(b, b);
}
|
[
"@",
"Override",
"public",
"boolean",
"isSameFile",
"(",
"FileObject",
"a",
",",
"FileObject",
"b",
")",
"{",
"return",
"stdFileManager",
".",
"isSameFile",
"(",
"b",
",",
"b",
")",
";",
"}"
] |
Compares two file objects and return true if they represent the
same underlying object.
@param a a file object
@param b a file object
@return true if the given file objects represent the same
underlying object
@throws IllegalArgumentException if either of the arguments
were created with another file manager and this file manager
does not support foreign file objects
|
[
"Compares",
"two",
"file",
"objects",
"and",
"return",
"true",
"if",
"they",
"represent",
"the",
"same",
"underlying",
"object",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java#L306-L309
|
5,626 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java
|
MemoryFileManager.isSupportedOption
|
@Override
public int isSupportedOption(String option) {
proc.debug(DBG_FMGR, "isSupportedOption: %s\n", option);
return stdFileManager.isSupportedOption(option);
}
|
java
|
@Override
public int isSupportedOption(String option) {
proc.debug(DBG_FMGR, "isSupportedOption: %s\n", option);
return stdFileManager.isSupportedOption(option);
}
|
[
"@",
"Override",
"public",
"int",
"isSupportedOption",
"(",
"String",
"option",
")",
"{",
"proc",
".",
"debug",
"(",
"DBG_FMGR",
",",
"\"isSupportedOption: %s\\n\"",
",",
"option",
")",
";",
"return",
"stdFileManager",
".",
"isSupportedOption",
"(",
"option",
")",
";",
"}"
] |
Determines if the given option is supported and if so, the
number of arguments the option takes.
@param option an option
@return the number of arguments the given option takes or -1 if
the option is not supported
|
[
"Determines",
"if",
"the",
"given",
"option",
"is",
"supported",
"and",
"if",
"so",
"the",
"number",
"of",
"arguments",
"the",
"option",
"takes",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java#L319-L323
|
5,627 |
google/error-prone-javac
|
src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java
|
MemoryFileManager.hasLocation
|
@Override
public boolean hasLocation(JavaFileManager.Location location) {
proc.debug(DBG_FMGR, "hasLocation: location: %s\n", location);
return stdFileManager.hasLocation(location);
}
|
java
|
@Override
public boolean hasLocation(JavaFileManager.Location location) {
proc.debug(DBG_FMGR, "hasLocation: location: %s\n", location);
return stdFileManager.hasLocation(location);
}
|
[
"@",
"Override",
"public",
"boolean",
"hasLocation",
"(",
"JavaFileManager",
".",
"Location",
"location",
")",
"{",
"proc",
".",
"debug",
"(",
"DBG_FMGR",
",",
"\"hasLocation: location: %s\\n\"",
",",
"location",
")",
";",
"return",
"stdFileManager",
".",
"hasLocation",
"(",
"location",
")",
";",
"}"
] |
Determines if a location is known to this file manager.
@param location a location
@return true if the location is known
|
[
"Determines",
"if",
"a",
"location",
"is",
"known",
"to",
"this",
"file",
"manager",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java#L352-L356
|
5,628 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.reportSyntaxError
|
protected void reportSyntaxError(int pos, String key, Object... args) {
JCDiagnostic.DiagnosticPosition diag = new JCDiagnostic.SimpleDiagnosticPosition(pos);
reportSyntaxError(diag, key, args);
}
|
java
|
protected void reportSyntaxError(int pos, String key, Object... args) {
JCDiagnostic.DiagnosticPosition diag = new JCDiagnostic.SimpleDiagnosticPosition(pos);
reportSyntaxError(diag, key, args);
}
|
[
"protected",
"void",
"reportSyntaxError",
"(",
"int",
"pos",
",",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"JCDiagnostic",
".",
"DiagnosticPosition",
"diag",
"=",
"new",
"JCDiagnostic",
".",
"SimpleDiagnosticPosition",
"(",
"pos",
")",
";",
"reportSyntaxError",
"(",
"diag",
",",
"key",
",",
"args",
")",
";",
"}"
] |
Report a syntax using the given the position parameter and arguments,
unless one was already reported at the same position.
|
[
"Report",
"a",
"syntax",
"using",
"the",
"given",
"the",
"position",
"parameter",
"and",
"arguments",
"unless",
"one",
"was",
"already",
"reported",
"at",
"the",
"same",
"position",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L460-L463
|
5,629 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.syntaxError
|
protected JCErroneous syntaxError(String key, TokenKind arg) {
return syntaxError(token.pos, key, arg);
}
|
java
|
protected JCErroneous syntaxError(String key, TokenKind arg) {
return syntaxError(token.pos, key, arg);
}
|
[
"protected",
"JCErroneous",
"syntaxError",
"(",
"String",
"key",
",",
"TokenKind",
"arg",
")",
"{",
"return",
"syntaxError",
"(",
"token",
".",
"pos",
",",
"key",
",",
"arg",
")",
";",
"}"
] |
Generate a syntax error at current position unless one was
already reported at the same position.
|
[
"Generate",
"a",
"syntax",
"error",
"at",
"current",
"position",
"unless",
"one",
"was",
"already",
"reported",
"at",
"the",
"same",
"position",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L499-L501
|
5,630 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.accept
|
public void accept(TokenKind tk) {
if (token.kind == tk) {
nextToken();
} else {
setErrorEndPos(token.pos);
reportSyntaxError(S.prevToken().endPos, "expected", tk);
}
}
|
java
|
public void accept(TokenKind tk) {
if (token.kind == tk) {
nextToken();
} else {
setErrorEndPos(token.pos);
reportSyntaxError(S.prevToken().endPos, "expected", tk);
}
}
|
[
"public",
"void",
"accept",
"(",
"TokenKind",
"tk",
")",
"{",
"if",
"(",
"token",
".",
"kind",
"==",
"tk",
")",
"{",
"nextToken",
"(",
")",
";",
"}",
"else",
"{",
"setErrorEndPos",
"(",
"token",
".",
"pos",
")",
";",
"reportSyntaxError",
"(",
"S",
".",
"prevToken",
"(",
")",
".",
"endPos",
",",
"\"expected\"",
",",
"tk",
")",
";",
"}",
"}"
] |
If next input token matches given token, skip it, otherwise report
an error.
|
[
"If",
"next",
"input",
"token",
"matches",
"given",
"token",
"skip",
"it",
"otherwise",
"report",
"an",
"error",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L506-L513
|
5,631 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.makeOp
|
private JCExpression makeOp(int pos,
TokenKind topOp,
JCExpression od1,
JCExpression od2)
{
if (topOp == INSTANCEOF) {
return F.at(pos).TypeTest(od1, od2);
} else {
return F.at(pos).Binary(optag(topOp), od1, od2);
}
}
|
java
|
private JCExpression makeOp(int pos,
TokenKind topOp,
JCExpression od1,
JCExpression od2)
{
if (topOp == INSTANCEOF) {
return F.at(pos).TypeTest(od1, od2);
} else {
return F.at(pos).Binary(optag(topOp), od1, od2);
}
}
|
[
"private",
"JCExpression",
"makeOp",
"(",
"int",
"pos",
",",
"TokenKind",
"topOp",
",",
"JCExpression",
"od1",
",",
"JCExpression",
"od2",
")",
"{",
"if",
"(",
"topOp",
"==",
"INSTANCEOF",
")",
"{",
"return",
"F",
".",
"at",
"(",
"pos",
")",
".",
"TypeTest",
"(",
"od1",
",",
"od2",
")",
";",
"}",
"else",
"{",
"return",
"F",
".",
"at",
"(",
"pos",
")",
".",
"Binary",
"(",
"optag",
"(",
"topOp",
")",
",",
"od1",
",",
"od2",
")",
";",
"}",
"}"
] |
Construct a binary or type test node.
|
[
"Construct",
"a",
"binary",
"or",
"type",
"test",
"node",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L983-L993
|
5,632 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.foldStrings
|
protected JCExpression foldStrings(JCExpression tree) {
if (!allowStringFolding)
return tree;
ListBuffer<JCExpression> opStack = new ListBuffer<>();
ListBuffer<JCLiteral> litBuf = new ListBuffer<>();
boolean needsFolding = false;
JCExpression curr = tree;
while (true) {
if (curr.hasTag(JCTree.Tag.PLUS)) {
JCBinary op = (JCBinary)curr;
needsFolding |= foldIfNeeded(op.rhs, litBuf, opStack, false);
curr = op.lhs;
} else {
needsFolding |= foldIfNeeded(curr, litBuf, opStack, true);
break; //last one!
}
}
if (needsFolding) {
List<JCExpression> ops = opStack.toList();
JCExpression res = ops.head;
for (JCExpression op : ops.tail) {
res = F.at(op.getStartPosition()).Binary(optag(TokenKind.PLUS), res, op);
storeEnd(res, getEndPos(op));
}
return res;
} else {
return tree;
}
}
|
java
|
protected JCExpression foldStrings(JCExpression tree) {
if (!allowStringFolding)
return tree;
ListBuffer<JCExpression> opStack = new ListBuffer<>();
ListBuffer<JCLiteral> litBuf = new ListBuffer<>();
boolean needsFolding = false;
JCExpression curr = tree;
while (true) {
if (curr.hasTag(JCTree.Tag.PLUS)) {
JCBinary op = (JCBinary)curr;
needsFolding |= foldIfNeeded(op.rhs, litBuf, opStack, false);
curr = op.lhs;
} else {
needsFolding |= foldIfNeeded(curr, litBuf, opStack, true);
break; //last one!
}
}
if (needsFolding) {
List<JCExpression> ops = opStack.toList();
JCExpression res = ops.head;
for (JCExpression op : ops.tail) {
res = F.at(op.getStartPosition()).Binary(optag(TokenKind.PLUS), res, op);
storeEnd(res, getEndPos(op));
}
return res;
} else {
return tree;
}
}
|
[
"protected",
"JCExpression",
"foldStrings",
"(",
"JCExpression",
"tree",
")",
"{",
"if",
"(",
"!",
"allowStringFolding",
")",
"return",
"tree",
";",
"ListBuffer",
"<",
"JCExpression",
">",
"opStack",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"ListBuffer",
"<",
"JCLiteral",
">",
"litBuf",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"boolean",
"needsFolding",
"=",
"false",
";",
"JCExpression",
"curr",
"=",
"tree",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"curr",
".",
"hasTag",
"(",
"JCTree",
".",
"Tag",
".",
"PLUS",
")",
")",
"{",
"JCBinary",
"op",
"=",
"(",
"JCBinary",
")",
"curr",
";",
"needsFolding",
"|=",
"foldIfNeeded",
"(",
"op",
".",
"rhs",
",",
"litBuf",
",",
"opStack",
",",
"false",
")",
";",
"curr",
"=",
"op",
".",
"lhs",
";",
"}",
"else",
"{",
"needsFolding",
"|=",
"foldIfNeeded",
"(",
"curr",
",",
"litBuf",
",",
"opStack",
",",
"true",
")",
";",
"break",
";",
"//last one!",
"}",
"}",
"if",
"(",
"needsFolding",
")",
"{",
"List",
"<",
"JCExpression",
">",
"ops",
"=",
"opStack",
".",
"toList",
"(",
")",
";",
"JCExpression",
"res",
"=",
"ops",
".",
"head",
";",
"for",
"(",
"JCExpression",
"op",
":",
"ops",
".",
"tail",
")",
"{",
"res",
"=",
"F",
".",
"at",
"(",
"op",
".",
"getStartPosition",
"(",
")",
")",
".",
"Binary",
"(",
"optag",
"(",
"TokenKind",
".",
"PLUS",
")",
",",
"res",
",",
"op",
")",
";",
"storeEnd",
"(",
"res",
",",
"getEndPos",
"(",
"op",
")",
")",
";",
"}",
"return",
"res",
";",
"}",
"else",
"{",
"return",
"tree",
";",
"}",
"}"
] |
If tree is a concatenation of string literals, replace it
by a single literal representing the concatenated string.
|
[
"If",
"tree",
"is",
"a",
"concatenation",
"of",
"string",
"literals",
"replace",
"it",
"by",
"a",
"single",
"literal",
"representing",
"the",
"concatenated",
"string",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L997-L1025
|
5,633 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.basicType
|
JCPrimitiveTypeTree basicType() {
JCPrimitiveTypeTree t = to(F.at(token.pos).TypeIdent(typetag(token.kind)));
nextToken();
return t;
}
|
java
|
JCPrimitiveTypeTree basicType() {
JCPrimitiveTypeTree t = to(F.at(token.pos).TypeIdent(typetag(token.kind)));
nextToken();
return t;
}
|
[
"JCPrimitiveTypeTree",
"basicType",
"(",
")",
"{",
"JCPrimitiveTypeTree",
"t",
"=",
"to",
"(",
"F",
".",
"at",
"(",
"token",
".",
"pos",
")",
".",
"TypeIdent",
"(",
"typetag",
"(",
"token",
".",
"kind",
")",
")",
")",
";",
"nextToken",
"(",
")",
";",
"return",
"t",
";",
"}"
] |
BasicType = BYTE | SHORT | CHAR | INT | LONG | FLOAT | DOUBLE | BOOLEAN
|
[
"BasicType",
"=",
"BYTE",
"|",
"SHORT",
"|",
"CHAR",
"|",
"INT",
"|",
"LONG",
"|",
"FLOAT",
"|",
"DOUBLE",
"|",
"BOOLEAN"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L1794-L1798
|
5,634 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.bracketsSuffix
|
JCExpression bracketsSuffix(JCExpression t) {
if ((mode & EXPR) != 0 && token.kind == DOT) {
mode = EXPR;
int pos = token.pos;
nextToken();
accept(CLASS);
if (token.pos == endPosTable.errorEndPos) {
// error recovery
Name name;
if (LAX_IDENTIFIER.accepts(token.kind)) {
name = token.name();
nextToken();
} else {
name = names.error;
}
t = F.at(pos).Erroneous(List.<JCTree>of(toP(F.at(pos).Select(t, name))));
} else {
Tag tag = t.getTag();
// Type annotations are illegal on class literals. Annotated non array class literals
// are complained about directly in term3(), Here check for type annotations on dimensions
// taking care to handle some interior dimension(s) being annotated.
if ((tag == TYPEARRAY && TreeInfo.containsTypeAnnotation(t)) || tag == ANNOTATED_TYPE)
syntaxError("no.annotations.on.dot.class");
t = toP(F.at(pos).Select(t, names._class));
}
} else if ((mode & TYPE) != 0) {
if (token.kind != COLCOL) {
mode = TYPE;
}
} else if (token.kind != COLCOL) {
syntaxError(token.pos, "dot.class.expected");
}
return t;
}
|
java
|
JCExpression bracketsSuffix(JCExpression t) {
if ((mode & EXPR) != 0 && token.kind == DOT) {
mode = EXPR;
int pos = token.pos;
nextToken();
accept(CLASS);
if (token.pos == endPosTable.errorEndPos) {
// error recovery
Name name;
if (LAX_IDENTIFIER.accepts(token.kind)) {
name = token.name();
nextToken();
} else {
name = names.error;
}
t = F.at(pos).Erroneous(List.<JCTree>of(toP(F.at(pos).Select(t, name))));
} else {
Tag tag = t.getTag();
// Type annotations are illegal on class literals. Annotated non array class literals
// are complained about directly in term3(), Here check for type annotations on dimensions
// taking care to handle some interior dimension(s) being annotated.
if ((tag == TYPEARRAY && TreeInfo.containsTypeAnnotation(t)) || tag == ANNOTATED_TYPE)
syntaxError("no.annotations.on.dot.class");
t = toP(F.at(pos).Select(t, names._class));
}
} else if ((mode & TYPE) != 0) {
if (token.kind != COLCOL) {
mode = TYPE;
}
} else if (token.kind != COLCOL) {
syntaxError(token.pos, "dot.class.expected");
}
return t;
}
|
[
"JCExpression",
"bracketsSuffix",
"(",
"JCExpression",
"t",
")",
"{",
"if",
"(",
"(",
"mode",
"&",
"EXPR",
")",
"!=",
"0",
"&&",
"token",
".",
"kind",
"==",
"DOT",
")",
"{",
"mode",
"=",
"EXPR",
";",
"int",
"pos",
"=",
"token",
".",
"pos",
";",
"nextToken",
"(",
")",
";",
"accept",
"(",
"CLASS",
")",
";",
"if",
"(",
"token",
".",
"pos",
"==",
"endPosTable",
".",
"errorEndPos",
")",
"{",
"// error recovery",
"Name",
"name",
";",
"if",
"(",
"LAX_IDENTIFIER",
".",
"accepts",
"(",
"token",
".",
"kind",
")",
")",
"{",
"name",
"=",
"token",
".",
"name",
"(",
")",
";",
"nextToken",
"(",
")",
";",
"}",
"else",
"{",
"name",
"=",
"names",
".",
"error",
";",
"}",
"t",
"=",
"F",
".",
"at",
"(",
"pos",
")",
".",
"Erroneous",
"(",
"List",
".",
"<",
"JCTree",
">",
"of",
"(",
"toP",
"(",
"F",
".",
"at",
"(",
"pos",
")",
".",
"Select",
"(",
"t",
",",
"name",
")",
")",
")",
")",
";",
"}",
"else",
"{",
"Tag",
"tag",
"=",
"t",
".",
"getTag",
"(",
")",
";",
"// Type annotations are illegal on class literals. Annotated non array class literals",
"// are complained about directly in term3(), Here check for type annotations on dimensions",
"// taking care to handle some interior dimension(s) being annotated.",
"if",
"(",
"(",
"tag",
"==",
"TYPEARRAY",
"&&",
"TreeInfo",
".",
"containsTypeAnnotation",
"(",
"t",
")",
")",
"||",
"tag",
"==",
"ANNOTATED_TYPE",
")",
"syntaxError",
"(",
"\"no.annotations.on.dot.class\"",
")",
";",
"t",
"=",
"toP",
"(",
"F",
".",
"at",
"(",
"pos",
")",
".",
"Select",
"(",
"t",
",",
"names",
".",
"_class",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"(",
"mode",
"&",
"TYPE",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"token",
".",
"kind",
"!=",
"COLCOL",
")",
"{",
"mode",
"=",
"TYPE",
";",
"}",
"}",
"else",
"if",
"(",
"token",
".",
"kind",
"!=",
"COLCOL",
")",
"{",
"syntaxError",
"(",
"token",
".",
"pos",
",",
"\"dot.class.expected\"",
")",
";",
"}",
"return",
"t",
";",
"}"
] |
BracketsSuffixExpr = "." CLASS
BracketsSuffixType =
|
[
"BracketsSuffixExpr",
"=",
".",
"CLASS",
"BracketsSuffixType",
"="
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L2003-L2036
|
5,635 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.variableInitializer
|
public JCExpression variableInitializer() {
return token.kind == LBRACE ? arrayInitializer(token.pos, null) : parseExpression();
}
|
java
|
public JCExpression variableInitializer() {
return token.kind == LBRACE ? arrayInitializer(token.pos, null) : parseExpression();
}
|
[
"public",
"JCExpression",
"variableInitializer",
"(",
")",
"{",
"return",
"token",
".",
"kind",
"==",
"LBRACE",
"?",
"arrayInitializer",
"(",
"token",
".",
"pos",
",",
"null",
")",
":",
"parseExpression",
"(",
")",
";",
"}"
] |
VariableInitializer = ArrayInitializer | Expression
|
[
"VariableInitializer",
"=",
"ArrayInitializer",
"|",
"Expression"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L2291-L2293
|
5,636 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.forUpdate
|
List<JCExpressionStatement> forUpdate() {
return moreStatementExpressions(token.pos,
parseExpression(),
new ListBuffer<JCExpressionStatement>()).toList();
}
|
java
|
List<JCExpressionStatement> forUpdate() {
return moreStatementExpressions(token.pos,
parseExpression(),
new ListBuffer<JCExpressionStatement>()).toList();
}
|
[
"List",
"<",
"JCExpressionStatement",
">",
"forUpdate",
"(",
")",
"{",
"return",
"moreStatementExpressions",
"(",
"token",
".",
"pos",
",",
"parseExpression",
"(",
")",
",",
"new",
"ListBuffer",
"<",
"JCExpressionStatement",
">",
"(",
")",
")",
".",
"toList",
"(",
")",
";",
"}"
] |
ForUpdate = StatementExpression MoreStatementExpressions
|
[
"ForUpdate",
"=",
"StatementExpression",
"MoreStatementExpressions"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L2768-L2772
|
5,637 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.annotationFieldValue
|
JCExpression annotationFieldValue() {
if (LAX_IDENTIFIER.accepts(token.kind)) {
mode = EXPR;
JCExpression t1 = term1();
if (t1.hasTag(IDENT) && token.kind == EQ) {
int pos = token.pos;
accept(EQ);
JCExpression v = annotationValue();
return toP(F.at(pos).Assign(t1, v));
} else {
return t1;
}
}
return annotationValue();
}
|
java
|
JCExpression annotationFieldValue() {
if (LAX_IDENTIFIER.accepts(token.kind)) {
mode = EXPR;
JCExpression t1 = term1();
if (t1.hasTag(IDENT) && token.kind == EQ) {
int pos = token.pos;
accept(EQ);
JCExpression v = annotationValue();
return toP(F.at(pos).Assign(t1, v));
} else {
return t1;
}
}
return annotationValue();
}
|
[
"JCExpression",
"annotationFieldValue",
"(",
")",
"{",
"if",
"(",
"LAX_IDENTIFIER",
".",
"accepts",
"(",
"token",
".",
"kind",
")",
")",
"{",
"mode",
"=",
"EXPR",
";",
"JCExpression",
"t1",
"=",
"term1",
"(",
")",
";",
"if",
"(",
"t1",
".",
"hasTag",
"(",
"IDENT",
")",
"&&",
"token",
".",
"kind",
"==",
"EQ",
")",
"{",
"int",
"pos",
"=",
"token",
".",
"pos",
";",
"accept",
"(",
"EQ",
")",
";",
"JCExpression",
"v",
"=",
"annotationValue",
"(",
")",
";",
"return",
"toP",
"(",
"F",
".",
"at",
"(",
"pos",
")",
".",
"Assign",
"(",
"t1",
",",
"v",
")",
")",
";",
"}",
"else",
"{",
"return",
"t1",
";",
"}",
"}",
"return",
"annotationValue",
"(",
")",
";",
"}"
] |
AnnotationFieldValue = AnnotationValue
| Identifier "=" AnnotationValue
|
[
"AnnotationFieldValue",
"=",
"AnnotationValue",
"|",
"Identifier",
"=",
"AnnotationValue"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L2922-L2936
|
5,638 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.variableDeclarator
|
JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc) {
return variableDeclaratorRest(token.pos, mods, type, ident(), reqInit, dc);
}
|
java
|
JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc) {
return variableDeclaratorRest(token.pos, mods, type, ident(), reqInit, dc);
}
|
[
"JCVariableDecl",
"variableDeclarator",
"(",
"JCModifiers",
"mods",
",",
"JCExpression",
"type",
",",
"boolean",
"reqInit",
",",
"Comment",
"dc",
")",
"{",
"return",
"variableDeclaratorRest",
"(",
"token",
".",
"pos",
",",
"mods",
",",
"type",
",",
"ident",
"(",
")",
",",
"reqInit",
",",
"dc",
")",
";",
"}"
] |
VariableDeclarator = Ident VariableDeclaratorRest
ConstantDeclarator = Ident ConstantDeclaratorRest
|
[
"VariableDeclarator",
"=",
"Ident",
"VariableDeclaratorRest",
"ConstantDeclarator",
"=",
"Ident",
"ConstantDeclaratorRest"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3007-L3009
|
5,639 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.variableDeclaratorId
|
JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) {
return variableDeclaratorId(mods, type, false);
}
|
java
|
JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) {
return variableDeclaratorId(mods, type, false);
}
|
[
"JCVariableDecl",
"variableDeclaratorId",
"(",
"JCModifiers",
"mods",
",",
"JCExpression",
"type",
")",
"{",
"return",
"variableDeclaratorId",
"(",
"mods",
",",
"type",
",",
"false",
")",
";",
"}"
] |
VariableDeclaratorId = Ident BracketsOpt
|
[
"VariableDeclaratorId",
"=",
"Ident",
"BracketsOpt"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3034-L3036
|
5,640 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.resource
|
protected JCTree resource() {
int startPos = token.pos;
if (token.kind == FINAL || token.kind == MONKEYS_AT) {
JCModifiers mods = optFinal(Flags.FINAL);
JCExpression t = parseType();
return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
}
JCExpression t = term(EXPR | TYPE);
if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
JCModifiers mods = toP(F.at(startPos).Modifiers(Flags.FINAL));
return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
} else {
checkVariableInTryWithResources(startPos);
if (!t.hasTag(IDENT) && !t.hasTag(SELECT)) {
log.error(t.pos(), "try.with.resources.expr.needs.var");
}
return t;
}
}
|
java
|
protected JCTree resource() {
int startPos = token.pos;
if (token.kind == FINAL || token.kind == MONKEYS_AT) {
JCModifiers mods = optFinal(Flags.FINAL);
JCExpression t = parseType();
return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
}
JCExpression t = term(EXPR | TYPE);
if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
JCModifiers mods = toP(F.at(startPos).Modifiers(Flags.FINAL));
return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
} else {
checkVariableInTryWithResources(startPos);
if (!t.hasTag(IDENT) && !t.hasTag(SELECT)) {
log.error(t.pos(), "try.with.resources.expr.needs.var");
}
return t;
}
}
|
[
"protected",
"JCTree",
"resource",
"(",
")",
"{",
"int",
"startPos",
"=",
"token",
".",
"pos",
";",
"if",
"(",
"token",
".",
"kind",
"==",
"FINAL",
"||",
"token",
".",
"kind",
"==",
"MONKEYS_AT",
")",
"{",
"JCModifiers",
"mods",
"=",
"optFinal",
"(",
"Flags",
".",
"FINAL",
")",
";",
"JCExpression",
"t",
"=",
"parseType",
"(",
")",
";",
"return",
"variableDeclaratorRest",
"(",
"token",
".",
"pos",
",",
"mods",
",",
"t",
",",
"ident",
"(",
")",
",",
"true",
",",
"null",
")",
";",
"}",
"JCExpression",
"t",
"=",
"term",
"(",
"EXPR",
"|",
"TYPE",
")",
";",
"if",
"(",
"(",
"lastmode",
"&",
"TYPE",
")",
"!=",
"0",
"&&",
"LAX_IDENTIFIER",
".",
"accepts",
"(",
"token",
".",
"kind",
")",
")",
"{",
"JCModifiers",
"mods",
"=",
"toP",
"(",
"F",
".",
"at",
"(",
"startPos",
")",
".",
"Modifiers",
"(",
"Flags",
".",
"FINAL",
")",
")",
";",
"return",
"variableDeclaratorRest",
"(",
"token",
".",
"pos",
",",
"mods",
",",
"t",
",",
"ident",
"(",
")",
",",
"true",
",",
"null",
")",
";",
"}",
"else",
"{",
"checkVariableInTryWithResources",
"(",
"startPos",
")",
";",
"if",
"(",
"!",
"t",
".",
"hasTag",
"(",
"IDENT",
")",
"&&",
"!",
"t",
".",
"hasTag",
"(",
"SELECT",
")",
")",
"{",
"log",
".",
"error",
"(",
"t",
".",
"pos",
"(",
")",
",",
"\"try.with.resources.expr.needs.var\"",
")",
";",
"}",
"return",
"t",
";",
"}",
"}"
] |
Resource = VariableModifiersOpt Type VariableDeclaratorId "=" Expression
| Expression
|
[
"Resource",
"=",
"VariableModifiersOpt",
"Type",
"VariableDeclaratorId",
"=",
"Expression",
"|",
"Expression"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3093-L3112
|
5,641 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.typeDeclaration
|
JCTree typeDeclaration(JCModifiers mods, Comment docComment) {
int pos = token.pos;
if (mods == null && token.kind == SEMI) {
nextToken();
return toP(F.at(pos).Skip());
} else {
return classOrInterfaceOrEnumDeclaration(modifiersOpt(mods), docComment);
}
}
|
java
|
JCTree typeDeclaration(JCModifiers mods, Comment docComment) {
int pos = token.pos;
if (mods == null && token.kind == SEMI) {
nextToken();
return toP(F.at(pos).Skip());
} else {
return classOrInterfaceOrEnumDeclaration(modifiersOpt(mods), docComment);
}
}
|
[
"JCTree",
"typeDeclaration",
"(",
"JCModifiers",
"mods",
",",
"Comment",
"docComment",
")",
"{",
"int",
"pos",
"=",
"token",
".",
"pos",
";",
"if",
"(",
"mods",
"==",
"null",
"&&",
"token",
".",
"kind",
"==",
"SEMI",
")",
"{",
"nextToken",
"(",
")",
";",
"return",
"toP",
"(",
"F",
".",
"at",
"(",
"pos",
")",
".",
"Skip",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"classOrInterfaceOrEnumDeclaration",
"(",
"modifiersOpt",
"(",
"mods",
")",
",",
"docComment",
")",
";",
"}",
"}"
] |
TypeDeclaration = ClassOrInterfaceOrEnumDeclaration
| ";"
|
[
"TypeDeclaration",
"=",
"ClassOrInterfaceOrEnumDeclaration",
"|",
";"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3335-L3343
|
5,642 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.checkExprStat
|
protected JCExpression checkExprStat(JCExpression t) {
if (!TreeInfo.isExpressionStatement(t)) {
JCExpression ret = F.at(t.pos).Erroneous(List.<JCTree>of(t));
error(ret, "not.stmt");
return ret;
} else {
return t;
}
}
|
java
|
protected JCExpression checkExprStat(JCExpression t) {
if (!TreeInfo.isExpressionStatement(t)) {
JCExpression ret = F.at(t.pos).Erroneous(List.<JCTree>of(t));
error(ret, "not.stmt");
return ret;
} else {
return t;
}
}
|
[
"protected",
"JCExpression",
"checkExprStat",
"(",
"JCExpression",
"t",
")",
"{",
"if",
"(",
"!",
"TreeInfo",
".",
"isExpressionStatement",
"(",
"t",
")",
")",
"{",
"JCExpression",
"ret",
"=",
"F",
".",
"at",
"(",
"t",
".",
"pos",
")",
".",
"Erroneous",
"(",
"List",
".",
"<",
"JCTree",
">",
"of",
"(",
"t",
")",
")",
";",
"error",
"(",
"ret",
",",
"\"not.stmt\"",
")",
";",
"return",
"ret",
";",
"}",
"else",
"{",
"return",
"t",
";",
"}",
"}"
] |
Check that given tree is a legal expression statement.
|
[
"Check",
"that",
"given",
"tree",
"is",
"a",
"legal",
"expression",
"statement",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3995-L4003
|
5,643 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.prec
|
static int prec(TokenKind token) {
JCTree.Tag oc = optag(token);
return (oc != NO_TAG) ? TreeInfo.opPrec(oc) : -1;
}
|
java
|
static int prec(TokenKind token) {
JCTree.Tag oc = optag(token);
return (oc != NO_TAG) ? TreeInfo.opPrec(oc) : -1;
}
|
[
"static",
"int",
"prec",
"(",
"TokenKind",
"token",
")",
"{",
"JCTree",
".",
"Tag",
"oc",
"=",
"optag",
"(",
"token",
")",
";",
"return",
"(",
"oc",
"!=",
"NO_TAG",
")",
"?",
"TreeInfo",
".",
"opPrec",
"(",
"oc",
")",
":",
"-",
"1",
";",
"}"
] |
Return precedence of operator represented by token,
-1 if token is not a binary operator. @see TreeInfo.opPrec
|
[
"Return",
"precedence",
"of",
"operator",
"represented",
"by",
"token",
"-",
"1",
"if",
"token",
"is",
"not",
"a",
"binary",
"operator",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L4008-L4011
|
5,644 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.earlier
|
static int earlier(int pos1, int pos2) {
if (pos1 == Position.NOPOS)
return pos2;
if (pos2 == Position.NOPOS)
return pos1;
return (pos1 < pos2 ? pos1 : pos2);
}
|
java
|
static int earlier(int pos1, int pos2) {
if (pos1 == Position.NOPOS)
return pos2;
if (pos2 == Position.NOPOS)
return pos1;
return (pos1 < pos2 ? pos1 : pos2);
}
|
[
"static",
"int",
"earlier",
"(",
"int",
"pos1",
",",
"int",
"pos2",
")",
"{",
"if",
"(",
"pos1",
"==",
"Position",
".",
"NOPOS",
")",
"return",
"pos2",
";",
"if",
"(",
"pos2",
"==",
"Position",
".",
"NOPOS",
")",
"return",
"pos1",
";",
"return",
"(",
"pos1",
"<",
"pos2",
"?",
"pos1",
":",
"pos2",
")",
";",
"}"
] |
Return the lesser of two positions, making allowance for either one
being unset.
|
[
"Return",
"the",
"lesser",
"of",
"two",
"positions",
"making",
"allowance",
"for",
"either",
"one",
"being",
"unset",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L4017-L4023
|
5,645 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.optag
|
static JCTree.Tag optag(TokenKind token) {
switch (token) {
case BARBAR:
return OR;
case AMPAMP:
return AND;
case BAR:
return BITOR;
case BAREQ:
return BITOR_ASG;
case CARET:
return BITXOR;
case CARETEQ:
return BITXOR_ASG;
case AMP:
return BITAND;
case AMPEQ:
return BITAND_ASG;
case EQEQ:
return JCTree.Tag.EQ;
case BANGEQ:
return NE;
case LT:
return JCTree.Tag.LT;
case GT:
return JCTree.Tag.GT;
case LTEQ:
return LE;
case GTEQ:
return GE;
case LTLT:
return SL;
case LTLTEQ:
return SL_ASG;
case GTGT:
return SR;
case GTGTEQ:
return SR_ASG;
case GTGTGT:
return USR;
case GTGTGTEQ:
return USR_ASG;
case PLUS:
return JCTree.Tag.PLUS;
case PLUSEQ:
return PLUS_ASG;
case SUB:
return MINUS;
case SUBEQ:
return MINUS_ASG;
case STAR:
return MUL;
case STAREQ:
return MUL_ASG;
case SLASH:
return DIV;
case SLASHEQ:
return DIV_ASG;
case PERCENT:
return MOD;
case PERCENTEQ:
return MOD_ASG;
case INSTANCEOF:
return TYPETEST;
default:
return NO_TAG;
}
}
|
java
|
static JCTree.Tag optag(TokenKind token) {
switch (token) {
case BARBAR:
return OR;
case AMPAMP:
return AND;
case BAR:
return BITOR;
case BAREQ:
return BITOR_ASG;
case CARET:
return BITXOR;
case CARETEQ:
return BITXOR_ASG;
case AMP:
return BITAND;
case AMPEQ:
return BITAND_ASG;
case EQEQ:
return JCTree.Tag.EQ;
case BANGEQ:
return NE;
case LT:
return JCTree.Tag.LT;
case GT:
return JCTree.Tag.GT;
case LTEQ:
return LE;
case GTEQ:
return GE;
case LTLT:
return SL;
case LTLTEQ:
return SL_ASG;
case GTGT:
return SR;
case GTGTEQ:
return SR_ASG;
case GTGTGT:
return USR;
case GTGTGTEQ:
return USR_ASG;
case PLUS:
return JCTree.Tag.PLUS;
case PLUSEQ:
return PLUS_ASG;
case SUB:
return MINUS;
case SUBEQ:
return MINUS_ASG;
case STAR:
return MUL;
case STAREQ:
return MUL_ASG;
case SLASH:
return DIV;
case SLASHEQ:
return DIV_ASG;
case PERCENT:
return MOD;
case PERCENTEQ:
return MOD_ASG;
case INSTANCEOF:
return TYPETEST;
default:
return NO_TAG;
}
}
|
[
"static",
"JCTree",
".",
"Tag",
"optag",
"(",
"TokenKind",
"token",
")",
"{",
"switch",
"(",
"token",
")",
"{",
"case",
"BARBAR",
":",
"return",
"OR",
";",
"case",
"AMPAMP",
":",
"return",
"AND",
";",
"case",
"BAR",
":",
"return",
"BITOR",
";",
"case",
"BAREQ",
":",
"return",
"BITOR_ASG",
";",
"case",
"CARET",
":",
"return",
"BITXOR",
";",
"case",
"CARETEQ",
":",
"return",
"BITXOR_ASG",
";",
"case",
"AMP",
":",
"return",
"BITAND",
";",
"case",
"AMPEQ",
":",
"return",
"BITAND_ASG",
";",
"case",
"EQEQ",
":",
"return",
"JCTree",
".",
"Tag",
".",
"EQ",
";",
"case",
"BANGEQ",
":",
"return",
"NE",
";",
"case",
"LT",
":",
"return",
"JCTree",
".",
"Tag",
".",
"LT",
";",
"case",
"GT",
":",
"return",
"JCTree",
".",
"Tag",
".",
"GT",
";",
"case",
"LTEQ",
":",
"return",
"LE",
";",
"case",
"GTEQ",
":",
"return",
"GE",
";",
"case",
"LTLT",
":",
"return",
"SL",
";",
"case",
"LTLTEQ",
":",
"return",
"SL_ASG",
";",
"case",
"GTGT",
":",
"return",
"SR",
";",
"case",
"GTGTEQ",
":",
"return",
"SR_ASG",
";",
"case",
"GTGTGT",
":",
"return",
"USR",
";",
"case",
"GTGTGTEQ",
":",
"return",
"USR_ASG",
";",
"case",
"PLUS",
":",
"return",
"JCTree",
".",
"Tag",
".",
"PLUS",
";",
"case",
"PLUSEQ",
":",
"return",
"PLUS_ASG",
";",
"case",
"SUB",
":",
"return",
"MINUS",
";",
"case",
"SUBEQ",
":",
"return",
"MINUS_ASG",
";",
"case",
"STAR",
":",
"return",
"MUL",
";",
"case",
"STAREQ",
":",
"return",
"MUL_ASG",
";",
"case",
"SLASH",
":",
"return",
"DIV",
";",
"case",
"SLASHEQ",
":",
"return",
"DIV_ASG",
";",
"case",
"PERCENT",
":",
"return",
"MOD",
";",
"case",
"PERCENTEQ",
":",
"return",
"MOD_ASG",
";",
"case",
"INSTANCEOF",
":",
"return",
"TYPETEST",
";",
"default",
":",
"return",
"NO_TAG",
";",
"}",
"}"
] |
Return operation tag of binary operator represented by token,
No_TAG if token is not a binary operator.
|
[
"Return",
"operation",
"tag",
"of",
"binary",
"operator",
"represented",
"by",
"token",
"No_TAG",
"if",
"token",
"is",
"not",
"a",
"binary",
"operator",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L4028-L4095
|
5,646 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.unoptag
|
static JCTree.Tag unoptag(TokenKind token) {
switch (token) {
case PLUS:
return POS;
case SUB:
return NEG;
case BANG:
return NOT;
case TILDE:
return COMPL;
case PLUSPLUS:
return PREINC;
case SUBSUB:
return PREDEC;
default:
return NO_TAG;
}
}
|
java
|
static JCTree.Tag unoptag(TokenKind token) {
switch (token) {
case PLUS:
return POS;
case SUB:
return NEG;
case BANG:
return NOT;
case TILDE:
return COMPL;
case PLUSPLUS:
return PREINC;
case SUBSUB:
return PREDEC;
default:
return NO_TAG;
}
}
|
[
"static",
"JCTree",
".",
"Tag",
"unoptag",
"(",
"TokenKind",
"token",
")",
"{",
"switch",
"(",
"token",
")",
"{",
"case",
"PLUS",
":",
"return",
"POS",
";",
"case",
"SUB",
":",
"return",
"NEG",
";",
"case",
"BANG",
":",
"return",
"NOT",
";",
"case",
"TILDE",
":",
"return",
"COMPL",
";",
"case",
"PLUSPLUS",
":",
"return",
"PREINC",
";",
"case",
"SUBSUB",
":",
"return",
"PREDEC",
";",
"default",
":",
"return",
"NO_TAG",
";",
"}",
"}"
] |
Return operation tag of unary operator represented by token,
No_TAG if token is not a binary operator.
|
[
"Return",
"operation",
"tag",
"of",
"unary",
"operator",
"represented",
"by",
"token",
"No_TAG",
"if",
"token",
"is",
"not",
"a",
"binary",
"operator",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L4100-L4117
|
5,647 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
|
JavacParser.typetag
|
static TypeTag typetag(TokenKind token) {
switch (token) {
case BYTE:
return TypeTag.BYTE;
case CHAR:
return TypeTag.CHAR;
case SHORT:
return TypeTag.SHORT;
case INT:
return TypeTag.INT;
case LONG:
return TypeTag.LONG;
case FLOAT:
return TypeTag.FLOAT;
case DOUBLE:
return TypeTag.DOUBLE;
case BOOLEAN:
return TypeTag.BOOLEAN;
default:
return TypeTag.NONE;
}
}
|
java
|
static TypeTag typetag(TokenKind token) {
switch (token) {
case BYTE:
return TypeTag.BYTE;
case CHAR:
return TypeTag.CHAR;
case SHORT:
return TypeTag.SHORT;
case INT:
return TypeTag.INT;
case LONG:
return TypeTag.LONG;
case FLOAT:
return TypeTag.FLOAT;
case DOUBLE:
return TypeTag.DOUBLE;
case BOOLEAN:
return TypeTag.BOOLEAN;
default:
return TypeTag.NONE;
}
}
|
[
"static",
"TypeTag",
"typetag",
"(",
"TokenKind",
"token",
")",
"{",
"switch",
"(",
"token",
")",
"{",
"case",
"BYTE",
":",
"return",
"TypeTag",
".",
"BYTE",
";",
"case",
"CHAR",
":",
"return",
"TypeTag",
".",
"CHAR",
";",
"case",
"SHORT",
":",
"return",
"TypeTag",
".",
"SHORT",
";",
"case",
"INT",
":",
"return",
"TypeTag",
".",
"INT",
";",
"case",
"LONG",
":",
"return",
"TypeTag",
".",
"LONG",
";",
"case",
"FLOAT",
":",
"return",
"TypeTag",
".",
"FLOAT",
";",
"case",
"DOUBLE",
":",
"return",
"TypeTag",
".",
"DOUBLE",
";",
"case",
"BOOLEAN",
":",
"return",
"TypeTag",
".",
"BOOLEAN",
";",
"default",
":",
"return",
"TypeTag",
".",
"NONE",
";",
"}",
"}"
] |
Return type tag of basic type represented by token,
NONE if token is not a basic type identifier.
|
[
"Return",
"type",
"tag",
"of",
"basic",
"type",
"represented",
"by",
"token",
"NONE",
"if",
"token",
"is",
"not",
"a",
"basic",
"type",
"identifier",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L4122-L4143
|
5,648 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Messages.java
|
Messages.get
|
public static String get(String key, Object... args) {
try {
String msg = MessageFormat.format(bundle.getString(key), args);
if (REPLACE_LINESEP) {
msg = msg.replace("\n", System.lineSeparator());
}
return msg;
} catch (MissingResourceException e) {
throw new InternalError("Missing message: " + key, e);
}
}
|
java
|
public static String get(String key, Object... args) {
try {
String msg = MessageFormat.format(bundle.getString(key), args);
if (REPLACE_LINESEP) {
msg = msg.replace("\n", System.lineSeparator());
}
return msg;
} catch (MissingResourceException e) {
throw new InternalError("Missing message: " + key, e);
}
}
|
[
"public",
"static",
"String",
"get",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"String",
"msg",
"=",
"MessageFormat",
".",
"format",
"(",
"bundle",
".",
"getString",
"(",
"key",
")",
",",
"args",
")",
";",
"if",
"(",
"REPLACE_LINESEP",
")",
"{",
"msg",
"=",
"msg",
".",
"replace",
"(",
"\"\\n\"",
",",
"System",
".",
"lineSeparator",
"(",
")",
")",
";",
"}",
"return",
"msg",
";",
"}",
"catch",
"(",
"MissingResourceException",
"e",
")",
"{",
"throw",
"new",
"InternalError",
"(",
"\"Missing message: \"",
"+",
"key",
",",
"e",
")",
";",
"}",
"}"
] |
Gets a message from the resource bundle. If necessary, translates "\n",
the line break string used in the message file, to the system-specific
line break string.
@param key the message key
@param args the message arguments
|
[
"Gets",
"a",
"message",
"from",
"the",
"resource",
"bundle",
".",
"If",
"necessary",
"translates",
"\\",
"n",
"the",
"line",
"break",
"string",
"used",
"in",
"the",
"message",
"file",
"to",
"the",
"system",
"-",
"specific",
"line",
"break",
"string",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Messages.java#L60-L70
|
5,649 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Resources.java
|
Resources.getText
|
public String getText(String key) throws MissingResourceException {
initBundles();
if (docletBundle.containsKey(key))
return docletBundle.getString(key);
return commonBundle.getString(key);
}
|
java
|
public String getText(String key) throws MissingResourceException {
initBundles();
if (docletBundle.containsKey(key))
return docletBundle.getString(key);
return commonBundle.getString(key);
}
|
[
"public",
"String",
"getText",
"(",
"String",
"key",
")",
"throws",
"MissingResourceException",
"{",
"initBundles",
"(",
")",
";",
"if",
"(",
"docletBundle",
".",
"containsKey",
"(",
"key",
")",
")",
"return",
"docletBundle",
".",
"getString",
"(",
"key",
")",
";",
"return",
"commonBundle",
".",
"getString",
"(",
"key",
")",
";",
"}"
] |
Gets the string for the given key from one of the doclet's
resource bundles.
The more specific bundle is checked first;
if it is not there, the common bundle is then checked.
@param key the key for the desired string
@return the string for the given key
@throws MissingResourceException if the key is not found in either
bundle.
|
[
"Gets",
"the",
"string",
"for",
"the",
"given",
"key",
"from",
"one",
"of",
"the",
"doclet",
"s",
"resource",
"bundles",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Resources.java#L79-L86
|
5,650 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Context.java
|
Context.put
|
public <T> void put(Key<T> key, Factory<T> fac) {
checkState(ht);
Object old = ht.put(key, fac);
if (old != null)
throw new AssertionError("duplicate context value");
checkState(ft);
ft.put(key, fac); // cannot be duplicate if unique in ht
}
|
java
|
public <T> void put(Key<T> key, Factory<T> fac) {
checkState(ht);
Object old = ht.put(key, fac);
if (old != null)
throw new AssertionError("duplicate context value");
checkState(ft);
ft.put(key, fac); // cannot be duplicate if unique in ht
}
|
[
"public",
"<",
"T",
">",
"void",
"put",
"(",
"Key",
"<",
"T",
">",
"key",
",",
"Factory",
"<",
"T",
">",
"fac",
")",
"{",
"checkState",
"(",
"ht",
")",
";",
"Object",
"old",
"=",
"ht",
".",
"put",
"(",
"key",
",",
"fac",
")",
";",
"if",
"(",
"old",
"!=",
"null",
")",
"throw",
"new",
"AssertionError",
"(",
"\"duplicate context value\"",
")",
";",
"checkState",
"(",
"ft",
")",
";",
"ft",
".",
"put",
"(",
"key",
",",
"fac",
")",
";",
"// cannot be duplicate if unique in ht",
"}"
] |
Set the factory for the key in this context.
|
[
"Set",
"the",
"factory",
"for",
"the",
"key",
"in",
"this",
"context",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Context.java#L125-L132
|
5,651 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Context.java
|
Context.put
|
public <T> void put(Key<T> key, T data) {
if (data instanceof Factory<?>)
throw new AssertionError("T extends Context.Factory");
checkState(ht);
Object old = ht.put(key, data);
if (old != null && !(old instanceof Factory<?>) && old != data && data != null)
throw new AssertionError("duplicate context value");
}
|
java
|
public <T> void put(Key<T> key, T data) {
if (data instanceof Factory<?>)
throw new AssertionError("T extends Context.Factory");
checkState(ht);
Object old = ht.put(key, data);
if (old != null && !(old instanceof Factory<?>) && old != data && data != null)
throw new AssertionError("duplicate context value");
}
|
[
"public",
"<",
"T",
">",
"void",
"put",
"(",
"Key",
"<",
"T",
">",
"key",
",",
"T",
"data",
")",
"{",
"if",
"(",
"data",
"instanceof",
"Factory",
"<",
"?",
">",
")",
"throw",
"new",
"AssertionError",
"(",
"\"T extends Context.Factory\"",
")",
";",
"checkState",
"(",
"ht",
")",
";",
"Object",
"old",
"=",
"ht",
".",
"put",
"(",
"key",
",",
"data",
")",
";",
"if",
"(",
"old",
"!=",
"null",
"&&",
"!",
"(",
"old",
"instanceof",
"Factory",
"<",
"?",
">",
")",
"&&",
"old",
"!=",
"data",
"&&",
"data",
"!=",
"null",
")",
"throw",
"new",
"AssertionError",
"(",
"\"duplicate context value\"",
")",
";",
"}"
] |
Set the value for the key in this context.
|
[
"Set",
"the",
"value",
"for",
"the",
"key",
"in",
"this",
"context",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Context.java#L135-L142
|
5,652 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ProgramElementDocImpl.java
|
ProgramElementDocImpl.modifierSpecifier
|
public int modifierSpecifier() {
int modifiers = getModifiers();
if (isMethod() && containingClass().isInterface())
// Remove the implicit abstract modifier.
return modifiers & ~Modifier.ABSTRACT;
return modifiers;
}
|
java
|
public int modifierSpecifier() {
int modifiers = getModifiers();
if (isMethod() && containingClass().isInterface())
// Remove the implicit abstract modifier.
return modifiers & ~Modifier.ABSTRACT;
return modifiers;
}
|
[
"public",
"int",
"modifierSpecifier",
"(",
")",
"{",
"int",
"modifiers",
"=",
"getModifiers",
"(",
")",
";",
"if",
"(",
"isMethod",
"(",
")",
"&&",
"containingClass",
"(",
")",
".",
"isInterface",
"(",
")",
")",
"// Remove the implicit abstract modifier.",
"return",
"modifiers",
"&",
"~",
"Modifier",
".",
"ABSTRACT",
";",
"return",
"modifiers",
";",
"}"
] |
Get the modifier specifier integer.
@see java.lang.reflect.Modifier
|
[
"Get",
"the",
"modifier",
"specifier",
"integer",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ProgramElementDocImpl.java#L134-L140
|
5,653 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/source/util/DocTrees.java
|
DocTrees.instance
|
public static DocTrees instance(ProcessingEnvironment env) {
if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment"))
throw new IllegalArgumentException();
return (DocTrees) getJavacTrees(ProcessingEnvironment.class, env);
}
|
java
|
public static DocTrees instance(ProcessingEnvironment env) {
if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment"))
throw new IllegalArgumentException();
return (DocTrees) getJavacTrees(ProcessingEnvironment.class, env);
}
|
[
"public",
"static",
"DocTrees",
"instance",
"(",
"ProcessingEnvironment",
"env",
")",
"{",
"if",
"(",
"!",
"env",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"com.sun.tools.javac.processing.JavacProcessingEnvironment\"",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"return",
"(",
"DocTrees",
")",
"getJavacTrees",
"(",
"ProcessingEnvironment",
".",
"class",
",",
"env",
")",
";",
"}"
] |
Returns a DocTrees object for a given ProcessingEnvironment.
@param env the processing environment for which to get the Trees object
@return the DocTrees object
@throws IllegalArgumentException if the env does not support the Trees API.
|
[
"Returns",
"a",
"DocTrees",
"object",
"for",
"a",
"given",
"ProcessingEnvironment",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTrees.java#L64-L68
|
5,654 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java
|
DependencyFinder.getDependences
|
Stream<Archive> getDependences(Archive source) {
return source.getDependencies()
.map(this::locationToArchive)
.filter(a -> a != source);
}
|
java
|
Stream<Archive> getDependences(Archive source) {
return source.getDependencies()
.map(this::locationToArchive)
.filter(a -> a != source);
}
|
[
"Stream",
"<",
"Archive",
">",
"getDependences",
"(",
"Archive",
"source",
")",
"{",
"return",
"source",
".",
"getDependencies",
"(",
")",
".",
"map",
"(",
"this",
"::",
"locationToArchive",
")",
".",
"filter",
"(",
"a",
"->",
"a",
"!=",
"source",
")",
";",
"}"
] |
Returns the modules of all dependencies found
|
[
"Returns",
"the",
"modules",
"of",
"all",
"dependencies",
"found"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java#L88-L92
|
5,655 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java
|
DependencyFinder.locationToArchive
|
Archive locationToArchive(Location location) {
return parsedClasses.containsKey(location)
? parsedClasses.get(location)
: configuration.findClass(location).orElse(NOT_FOUND);
}
|
java
|
Archive locationToArchive(Location location) {
return parsedClasses.containsKey(location)
? parsedClasses.get(location)
: configuration.findClass(location).orElse(NOT_FOUND);
}
|
[
"Archive",
"locationToArchive",
"(",
"Location",
"location",
")",
"{",
"return",
"parsedClasses",
".",
"containsKey",
"(",
"location",
")",
"?",
"parsedClasses",
".",
"get",
"(",
"location",
")",
":",
"configuration",
".",
"findClass",
"(",
"location",
")",
".",
"orElse",
"(",
"NOT_FOUND",
")",
";",
"}"
] |
Returns the location to archive map; or NOT_FOUND.
Location represents a parsed class.
|
[
"Returns",
"the",
"location",
"to",
"archive",
"map",
";",
"or",
"NOT_FOUND",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java#L99-L103
|
5,656 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java
|
DependencyFinder.dependences
|
Map<Archive, Set<Archive>> dependences() {
Map<Archive, Set<Archive>> map = new HashMap<>();
parsedArchives.values().stream()
.flatMap(Deque::stream)
.filter(a -> !a.isEmpty())
.forEach(source -> {
Set<Archive> deps = getDependences(source).collect(toSet());
if (!deps.isEmpty()) {
map.put(source, deps);
}
});
return map;
}
|
java
|
Map<Archive, Set<Archive>> dependences() {
Map<Archive, Set<Archive>> map = new HashMap<>();
parsedArchives.values().stream()
.flatMap(Deque::stream)
.filter(a -> !a.isEmpty())
.forEach(source -> {
Set<Archive> deps = getDependences(source).collect(toSet());
if (!deps.isEmpty()) {
map.put(source, deps);
}
});
return map;
}
|
[
"Map",
"<",
"Archive",
",",
"Set",
"<",
"Archive",
">",
">",
"dependences",
"(",
")",
"{",
"Map",
"<",
"Archive",
",",
"Set",
"<",
"Archive",
">",
">",
"map",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"parsedArchives",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"flatMap",
"(",
"Deque",
"::",
"stream",
")",
".",
"filter",
"(",
"a",
"->",
"!",
"a",
".",
"isEmpty",
"(",
")",
")",
".",
"forEach",
"(",
"source",
"->",
"{",
"Set",
"<",
"Archive",
">",
"deps",
"=",
"getDependences",
"(",
"source",
")",
".",
"collect",
"(",
"toSet",
"(",
")",
")",
";",
"if",
"(",
"!",
"deps",
".",
"isEmpty",
"(",
")",
")",
"{",
"map",
".",
"put",
"(",
"source",
",",
"deps",
")",
";",
"}",
"}",
")",
";",
"return",
"map",
";",
"}"
] |
Returns a map from an archive to its required archives
|
[
"Returns",
"a",
"map",
"from",
"an",
"archive",
"to",
"its",
"required",
"archives"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java#L108-L120
|
5,657 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java
|
DependencyFinder.parse
|
public Set<Location> parse(Stream<? extends Archive> archiveStream) {
archiveStream.forEach(archive -> parse(archive, CLASS_FINDER));
return waitForTasksCompleted();
}
|
java
|
public Set<Location> parse(Stream<? extends Archive> archiveStream) {
archiveStream.forEach(archive -> parse(archive, CLASS_FINDER));
return waitForTasksCompleted();
}
|
[
"public",
"Set",
"<",
"Location",
">",
"parse",
"(",
"Stream",
"<",
"?",
"extends",
"Archive",
">",
"archiveStream",
")",
"{",
"archiveStream",
".",
"forEach",
"(",
"archive",
"->",
"parse",
"(",
"archive",
",",
"CLASS_FINDER",
")",
")",
";",
"return",
"waitForTasksCompleted",
"(",
")",
";",
"}"
] |
Parses all class files from the given archive stream and returns
all target locations.
|
[
"Parses",
"all",
"class",
"files",
"from",
"the",
"given",
"archive",
"stream",
"and",
"returns",
"all",
"target",
"locations",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java#L130-L133
|
5,658 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java
|
DependencyFinder.parseExportedAPIs
|
public Set<Location> parseExportedAPIs(Stream<? extends Archive> archiveStream) {
archiveStream.forEach(archive -> parse(archive, API_FINDER));
return waitForTasksCompleted();
}
|
java
|
public Set<Location> parseExportedAPIs(Stream<? extends Archive> archiveStream) {
archiveStream.forEach(archive -> parse(archive, API_FINDER));
return waitForTasksCompleted();
}
|
[
"public",
"Set",
"<",
"Location",
">",
"parseExportedAPIs",
"(",
"Stream",
"<",
"?",
"extends",
"Archive",
">",
"archiveStream",
")",
"{",
"archiveStream",
".",
"forEach",
"(",
"archive",
"->",
"parse",
"(",
"archive",
",",
"API_FINDER",
")",
")",
";",
"return",
"waitForTasksCompleted",
"(",
")",
";",
"}"
] |
Parses the exported API class files from the given archive stream and
returns all target locations.
|
[
"Parses",
"the",
"exported",
"API",
"class",
"files",
"from",
"the",
"given",
"archive",
"stream",
"and",
"returns",
"all",
"target",
"locations",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java#L139-L142
|
5,659 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java
|
DependencyFinder.parse
|
public Set<Location> parse(Archive archive, String name) {
try {
return parse(archive, CLASS_FINDER, name);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
|
java
|
public Set<Location> parse(Archive archive, String name) {
try {
return parse(archive, CLASS_FINDER, name);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
|
[
"public",
"Set",
"<",
"Location",
">",
"parse",
"(",
"Archive",
"archive",
",",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"parse",
"(",
"archive",
",",
"CLASS_FINDER",
",",
"name",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"UncheckedIOException",
"(",
"e",
")",
";",
"}",
"}"
] |
Parses the named class from the given archive and
returns all target locations the named class references.
|
[
"Parses",
"the",
"named",
"class",
"from",
"the",
"given",
"archive",
"and",
"returns",
"all",
"target",
"locations",
"the",
"named",
"class",
"references",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java#L148-L154
|
5,660 |
google/error-prone-javac
|
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java
|
DependencyFinder.parseExportedAPIs
|
public Set<Location> parseExportedAPIs(Archive archive, String name)
{
try {
return parse(archive, API_FINDER, name);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
|
java
|
public Set<Location> parseExportedAPIs(Archive archive, String name)
{
try {
return parse(archive, API_FINDER, name);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
|
[
"public",
"Set",
"<",
"Location",
">",
"parseExportedAPIs",
"(",
"Archive",
"archive",
",",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"parse",
"(",
"archive",
",",
"API_FINDER",
",",
"name",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"UncheckedIOException",
"(",
"e",
")",
";",
"}",
"}"
] |
Parses the exported API of the named class from the given archive and
returns all target locations the named class references.
|
[
"Parses",
"the",
"exported",
"API",
"of",
"the",
"named",
"class",
"from",
"the",
"given",
"archive",
"and",
"returns",
"all",
"target",
"locations",
"the",
"named",
"class",
"references",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java#L160-L167
|
5,661 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java
|
TransTypes.instance
|
public static TransTypes instance(Context context) {
TransTypes instance = context.get(transTypesKey);
if (instance == null)
instance = new TransTypes(context);
return instance;
}
|
java
|
public static TransTypes instance(Context context) {
TransTypes instance = context.get(transTypesKey);
if (instance == null)
instance = new TransTypes(context);
return instance;
}
|
[
"public",
"static",
"TransTypes",
"instance",
"(",
"Context",
"context",
")",
"{",
"TransTypes",
"instance",
"=",
"context",
".",
"get",
"(",
"transTypesKey",
")",
";",
"if",
"(",
"instance",
"==",
"null",
")",
"instance",
"=",
"new",
"TransTypes",
"(",
"context",
")",
";",
"return",
"instance",
";",
"}"
] |
Get the instance for this context.
|
[
"Get",
"the",
"instance",
"for",
"this",
"context",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java#L60-L65
|
5,662 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java
|
TransTypes.cast
|
JCExpression cast(JCExpression tree, Type target) {
int oldpos = make.pos;
make.at(tree.pos);
if (!types.isSameType(tree.type, target)) {
if (!resolve.isAccessible(env, target.tsym))
resolve.logAccessErrorInternal(env, tree, target);
tree = make.TypeCast(make.Type(target), tree).setType(target);
}
make.pos = oldpos;
return tree;
}
|
java
|
JCExpression cast(JCExpression tree, Type target) {
int oldpos = make.pos;
make.at(tree.pos);
if (!types.isSameType(tree.type, target)) {
if (!resolve.isAccessible(env, target.tsym))
resolve.logAccessErrorInternal(env, tree, target);
tree = make.TypeCast(make.Type(target), tree).setType(target);
}
make.pos = oldpos;
return tree;
}
|
[
"JCExpression",
"cast",
"(",
"JCExpression",
"tree",
",",
"Type",
"target",
")",
"{",
"int",
"oldpos",
"=",
"make",
".",
"pos",
";",
"make",
".",
"at",
"(",
"tree",
".",
"pos",
")",
";",
"if",
"(",
"!",
"types",
".",
"isSameType",
"(",
"tree",
".",
"type",
",",
"target",
")",
")",
"{",
"if",
"(",
"!",
"resolve",
".",
"isAccessible",
"(",
"env",
",",
"target",
".",
"tsym",
")",
")",
"resolve",
".",
"logAccessErrorInternal",
"(",
"env",
",",
"tree",
",",
"target",
")",
";",
"tree",
"=",
"make",
".",
"TypeCast",
"(",
"make",
".",
"Type",
"(",
"target",
")",
",",
"tree",
")",
".",
"setType",
"(",
"target",
")",
";",
"}",
"make",
".",
"pos",
"=",
"oldpos",
";",
"return",
"tree",
";",
"}"
] |
Construct an attributed tree for a cast of expression to target type,
unless it already has precisely that type.
@param tree The expression tree.
@param target The target type.
|
[
"Construct",
"an",
"attributed",
"tree",
"for",
"a",
"cast",
"of",
"expression",
"to",
"target",
"type",
"unless",
"it",
"already",
"has",
"precisely",
"that",
"type",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java#L112-L122
|
5,663 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java
|
TransTypes.coerce
|
public JCExpression coerce(Env<AttrContext> env, JCExpression tree, Type target) {
Env<AttrContext> prevEnv = this.env;
try {
this.env = env;
return coerce(tree, target);
}
finally {
this.env = prevEnv;
}
}
|
java
|
public JCExpression coerce(Env<AttrContext> env, JCExpression tree, Type target) {
Env<AttrContext> prevEnv = this.env;
try {
this.env = env;
return coerce(tree, target);
}
finally {
this.env = prevEnv;
}
}
|
[
"public",
"JCExpression",
"coerce",
"(",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"JCExpression",
"tree",
",",
"Type",
"target",
")",
"{",
"Env",
"<",
"AttrContext",
">",
"prevEnv",
"=",
"this",
".",
"env",
";",
"try",
"{",
"this",
".",
"env",
"=",
"env",
";",
"return",
"coerce",
"(",
"tree",
",",
"target",
")",
";",
"}",
"finally",
"{",
"this",
".",
"env",
"=",
"prevEnv",
";",
"}",
"}"
] |
Construct an attributed tree to coerce an expression to some erased
target type, unless the expression is already assignable to that type.
If target type is a constant type, use its base type instead.
@param tree The expression tree.
@param target The target type.
|
[
"Construct",
"an",
"attributed",
"tree",
"to",
"coerce",
"an",
"expression",
"to",
"some",
"erased",
"target",
"type",
"unless",
"the",
"expression",
"is",
"already",
"assignable",
"to",
"that",
"type",
".",
"If",
"target",
"type",
"is",
"a",
"constant",
"type",
"use",
"its",
"base",
"type",
"instead",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java#L130-L139
|
5,664 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java
|
TransTypes.translateArgs
|
<T extends JCTree> List<T> translateArgs(List<T> _args,
List<Type> parameters,
Type varargsElement) {
if (parameters.isEmpty()) return _args;
List<T> args = _args;
while (parameters.tail.nonEmpty()) {
args.head = translate(args.head, parameters.head);
args = args.tail;
parameters = parameters.tail;
}
Type parameter = parameters.head;
Assert.check(varargsElement != null || args.length() == 1);
if (varargsElement != null) {
while (args.nonEmpty()) {
args.head = translate(args.head, varargsElement);
args = args.tail;
}
} else {
args.head = translate(args.head, parameter);
}
return _args;
}
|
java
|
<T extends JCTree> List<T> translateArgs(List<T> _args,
List<Type> parameters,
Type varargsElement) {
if (parameters.isEmpty()) return _args;
List<T> args = _args;
while (parameters.tail.nonEmpty()) {
args.head = translate(args.head, parameters.head);
args = args.tail;
parameters = parameters.tail;
}
Type parameter = parameters.head;
Assert.check(varargsElement != null || args.length() == 1);
if (varargsElement != null) {
while (args.nonEmpty()) {
args.head = translate(args.head, varargsElement);
args = args.tail;
}
} else {
args.head = translate(args.head, parameter);
}
return _args;
}
|
[
"<",
"T",
"extends",
"JCTree",
">",
"List",
"<",
"T",
">",
"translateArgs",
"(",
"List",
"<",
"T",
">",
"_args",
",",
"List",
"<",
"Type",
">",
"parameters",
",",
"Type",
"varargsElement",
")",
"{",
"if",
"(",
"parameters",
".",
"isEmpty",
"(",
")",
")",
"return",
"_args",
";",
"List",
"<",
"T",
">",
"args",
"=",
"_args",
";",
"while",
"(",
"parameters",
".",
"tail",
".",
"nonEmpty",
"(",
")",
")",
"{",
"args",
".",
"head",
"=",
"translate",
"(",
"args",
".",
"head",
",",
"parameters",
".",
"head",
")",
";",
"args",
"=",
"args",
".",
"tail",
";",
"parameters",
"=",
"parameters",
".",
"tail",
";",
"}",
"Type",
"parameter",
"=",
"parameters",
".",
"head",
";",
"Assert",
".",
"check",
"(",
"varargsElement",
"!=",
"null",
"||",
"args",
".",
"length",
"(",
")",
"==",
"1",
")",
";",
"if",
"(",
"varargsElement",
"!=",
"null",
")",
"{",
"while",
"(",
"args",
".",
"nonEmpty",
"(",
")",
")",
"{",
"args",
".",
"head",
"=",
"translate",
"(",
"args",
".",
"head",
",",
"varargsElement",
")",
";",
"args",
"=",
"args",
".",
"tail",
";",
"}",
"}",
"else",
"{",
"args",
".",
"head",
"=",
"translate",
"(",
"args",
".",
"head",
",",
"parameter",
")",
";",
"}",
"return",
"_args",
";",
"}"
] |
Translate method argument list, casting each argument
to its corresponding type in a list of target types.
@param _args The method argument list.
@param parameters The list of target types.
@param varargsElement The erasure of the varargs element type,
or null if translating a non-varargs invocation
|
[
"Translate",
"method",
"argument",
"list",
"casting",
"each",
"argument",
"to",
"its",
"corresponding",
"type",
"in",
"a",
"list",
"of",
"target",
"types",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java#L196-L217
|
5,665 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java
|
TransTypes.isSameMemberWhenErased
|
private boolean isSameMemberWhenErased(Type type,
MethodSymbol method,
Type erasure) {
return types.isSameType(erasure(types.memberType(type, method)),
erasure);
}
|
java
|
private boolean isSameMemberWhenErased(Type type,
MethodSymbol method,
Type erasure) {
return types.isSameType(erasure(types.memberType(type, method)),
erasure);
}
|
[
"private",
"boolean",
"isSameMemberWhenErased",
"(",
"Type",
"type",
",",
"MethodSymbol",
"method",
",",
"Type",
"erasure",
")",
"{",
"return",
"types",
".",
"isSameType",
"(",
"erasure",
"(",
"types",
".",
"memberType",
"(",
"type",
",",
"method",
")",
")",
",",
"erasure",
")",
";",
"}"
] |
Lookup the method as a member of the type. Compare the
erasures.
@param type the class where to look for the method
@param method the method to look for in class
@param erasure the erasure of method
|
[
"Lookup",
"the",
"method",
"as",
"a",
"member",
"of",
"the",
"type",
".",
"Compare",
"the",
"erasures",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java#L443-L448
|
5,666 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java
|
Messager.printError
|
private void printError(String prefix, String msg) {
if (nerrors < MaxErrors) {
PrintWriter errWriter = getWriter(WriterKind.ERROR);
printRawLines(errWriter, prefix + ": " + getText("javadoc.error") + " - " + msg);
errWriter.flush();
prompt();
nerrors++;
}
}
|
java
|
private void printError(String prefix, String msg) {
if (nerrors < MaxErrors) {
PrintWriter errWriter = getWriter(WriterKind.ERROR);
printRawLines(errWriter, prefix + ": " + getText("javadoc.error") + " - " + msg);
errWriter.flush();
prompt();
nerrors++;
}
}
|
[
"private",
"void",
"printError",
"(",
"String",
"prefix",
",",
"String",
"msg",
")",
"{",
"if",
"(",
"nerrors",
"<",
"MaxErrors",
")",
"{",
"PrintWriter",
"errWriter",
"=",
"getWriter",
"(",
"WriterKind",
".",
"ERROR",
")",
";",
"printRawLines",
"(",
"errWriter",
",",
"prefix",
"+",
"\": \"",
"+",
"getText",
"(",
"\"javadoc.error\"",
")",
"+",
"\" - \"",
"+",
"msg",
")",
";",
"errWriter",
".",
"flush",
"(",
")",
";",
"prompt",
"(",
")",
";",
"nerrors",
"++",
";",
"}",
"}"
] |
print the error and increment count
|
[
"print",
"the",
"error",
"and",
"increment",
"count"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java#L247-L255
|
5,667 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java
|
Messager.printWarning
|
private void printWarning(String prefix, String msg) {
if (nwarnings < MaxWarnings) {
PrintWriter warnWriter = getWriter(WriterKind.WARNING);
printRawLines(warnWriter, prefix + ": " + getText("javadoc.warning") + " - " + msg);
warnWriter.flush();
nwarnings++;
}
}
|
java
|
private void printWarning(String prefix, String msg) {
if (nwarnings < MaxWarnings) {
PrintWriter warnWriter = getWriter(WriterKind.WARNING);
printRawLines(warnWriter, prefix + ": " + getText("javadoc.warning") + " - " + msg);
warnWriter.flush();
nwarnings++;
}
}
|
[
"private",
"void",
"printWarning",
"(",
"String",
"prefix",
",",
"String",
"msg",
")",
"{",
"if",
"(",
"nwarnings",
"<",
"MaxWarnings",
")",
"{",
"PrintWriter",
"warnWriter",
"=",
"getWriter",
"(",
"WriterKind",
".",
"WARNING",
")",
";",
"printRawLines",
"(",
"warnWriter",
",",
"prefix",
"+",
"\": \"",
"+",
"getText",
"(",
"\"javadoc.warning\"",
")",
"+",
"\" - \"",
"+",
"msg",
")",
";",
"warnWriter",
".",
"flush",
"(",
")",
";",
"nwarnings",
"++",
";",
"}",
"}"
] |
print the warning and increment count
|
[
"print",
"the",
"warning",
"and",
"increment",
"count"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java#L294-L301
|
5,668 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
|
Enter.enterScope
|
WriteableScope enterScope(Env<AttrContext> env) {
return (env.tree.hasTag(JCTree.Tag.CLASSDEF))
? ((JCClassDecl) env.tree).sym.members_field
: env.info.scope;
}
|
java
|
WriteableScope enterScope(Env<AttrContext> env) {
return (env.tree.hasTag(JCTree.Tag.CLASSDEF))
? ((JCClassDecl) env.tree).sym.members_field
: env.info.scope;
}
|
[
"WriteableScope",
"enterScope",
"(",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"return",
"(",
"env",
".",
"tree",
".",
"hasTag",
"(",
"JCTree",
".",
"Tag",
".",
"CLASSDEF",
")",
")",
"?",
"(",
"(",
"JCClassDecl",
")",
"env",
".",
"tree",
")",
".",
"sym",
".",
"members_field",
":",
"env",
".",
"info",
".",
"scope",
";",
"}"
] |
The scope in which a member definition in environment env is to be entered
This is usually the environment's scope, except for class environments,
where the local scope is for type variables, and the this and super symbol
only, and members go into the class member scope.
|
[
"The",
"scope",
"in",
"which",
"a",
"member",
"definition",
"in",
"environment",
"env",
"is",
"to",
"be",
"entered",
"This",
"is",
"usually",
"the",
"environment",
"s",
"scope",
"except",
"for",
"class",
"environments",
"where",
"the",
"local",
"scope",
"is",
"for",
"type",
"variables",
"and",
"the",
"this",
"and",
"super",
"symbol",
"only",
"and",
"members",
"go",
"into",
"the",
"class",
"member",
"scope",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java#L238-L242
|
5,669 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
|
Enter.moduleEnv
|
public Env<AttrContext> moduleEnv(JCModuleDecl tree, Env<AttrContext> env) {
Assert.checkNonNull(tree.sym);
Env<AttrContext> localEnv =
env.dup(tree, env.info.dup(WriteableScope.create(tree.sym)));
localEnv.enclClass = predefClassDef;
localEnv.outer = env;
localEnv.info.isSelfCall = false;
localEnv.info.lint = null; // leave this to be filled in by Attr,
// when annotations have been processed
return localEnv;
}
|
java
|
public Env<AttrContext> moduleEnv(JCModuleDecl tree, Env<AttrContext> env) {
Assert.checkNonNull(tree.sym);
Env<AttrContext> localEnv =
env.dup(tree, env.info.dup(WriteableScope.create(tree.sym)));
localEnv.enclClass = predefClassDef;
localEnv.outer = env;
localEnv.info.isSelfCall = false;
localEnv.info.lint = null; // leave this to be filled in by Attr,
// when annotations have been processed
return localEnv;
}
|
[
"public",
"Env",
"<",
"AttrContext",
">",
"moduleEnv",
"(",
"JCModuleDecl",
"tree",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"Assert",
".",
"checkNonNull",
"(",
"tree",
".",
"sym",
")",
";",
"Env",
"<",
"AttrContext",
">",
"localEnv",
"=",
"env",
".",
"dup",
"(",
"tree",
",",
"env",
".",
"info",
".",
"dup",
"(",
"WriteableScope",
".",
"create",
"(",
"tree",
".",
"sym",
")",
")",
")",
";",
"localEnv",
".",
"enclClass",
"=",
"predefClassDef",
";",
"localEnv",
".",
"outer",
"=",
"env",
";",
"localEnv",
".",
"info",
".",
"isSelfCall",
"=",
"false",
";",
"localEnv",
".",
"info",
".",
"lint",
"=",
"null",
";",
"// leave this to be filled in by Attr,",
"// when annotations have been processed",
"return",
"localEnv",
";",
"}"
] |
Create a fresh environment for modules.
@param tree The module definition.
@param env The environment current outside of the module definition.
|
[
"Create",
"a",
"fresh",
"environment",
"for",
"modules",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java#L249-L259
|
5,670 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
|
Enter.classNameMatchesFileName
|
private static boolean classNameMatchesFileName(ClassSymbol c,
Env<AttrContext> env) {
return env.toplevel.sourcefile.isNameCompatible(c.name.toString(),
JavaFileObject.Kind.SOURCE);
}
|
java
|
private static boolean classNameMatchesFileName(ClassSymbol c,
Env<AttrContext> env) {
return env.toplevel.sourcefile.isNameCompatible(c.name.toString(),
JavaFileObject.Kind.SOURCE);
}
|
[
"private",
"static",
"boolean",
"classNameMatchesFileName",
"(",
"ClassSymbol",
"c",
",",
"Env",
"<",
"AttrContext",
">",
"env",
")",
"{",
"return",
"env",
".",
"toplevel",
".",
"sourcefile",
".",
"isNameCompatible",
"(",
"c",
".",
"name",
".",
"toString",
"(",
")",
",",
"JavaFileObject",
".",
"Kind",
".",
"SOURCE",
")",
";",
"}"
] |
Does class have the same name as the file it appears in?
|
[
"Does",
"class",
"have",
"the",
"same",
"name",
"as",
"the",
"file",
"it",
"appears",
"in?"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java#L507-L511
|
5,671 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
|
Enter.duplicateClass
|
protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) {
log.error(pos, "duplicate.class", c.fullname);
}
|
java
|
protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) {
log.error(pos, "duplicate.class", c.fullname);
}
|
[
"protected",
"void",
"duplicateClass",
"(",
"DiagnosticPosition",
"pos",
",",
"ClassSymbol",
"c",
")",
"{",
"log",
".",
"error",
"(",
"pos",
",",
"\"duplicate.class\"",
",",
"c",
".",
"fullname",
")",
";",
"}"
] |
Complain about a duplicate class.
|
[
"Complain",
"about",
"a",
"duplicate",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java#L514-L516
|
5,672 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
|
Enter.visitTypeParameter
|
@Override
public void visitTypeParameter(JCTypeParameter tree) {
TypeVar a = (tree.type != null)
? (TypeVar)tree.type
: new TypeVar(tree.name, env.info.scope.owner, syms.botType);
tree.type = a;
if (chk.checkUnique(tree.pos(), a.tsym, env.info.scope)) {
env.info.scope.enter(a.tsym);
}
result = a;
}
|
java
|
@Override
public void visitTypeParameter(JCTypeParameter tree) {
TypeVar a = (tree.type != null)
? (TypeVar)tree.type
: new TypeVar(tree.name, env.info.scope.owner, syms.botType);
tree.type = a;
if (chk.checkUnique(tree.pos(), a.tsym, env.info.scope)) {
env.info.scope.enter(a.tsym);
}
result = a;
}
|
[
"@",
"Override",
"public",
"void",
"visitTypeParameter",
"(",
"JCTypeParameter",
"tree",
")",
"{",
"TypeVar",
"a",
"=",
"(",
"tree",
".",
"type",
"!=",
"null",
")",
"?",
"(",
"TypeVar",
")",
"tree",
".",
"type",
":",
"new",
"TypeVar",
"(",
"tree",
".",
"name",
",",
"env",
".",
"info",
".",
"scope",
".",
"owner",
",",
"syms",
".",
"botType",
")",
";",
"tree",
".",
"type",
"=",
"a",
";",
"if",
"(",
"chk",
".",
"checkUnique",
"(",
"tree",
".",
"pos",
"(",
")",
",",
"a",
".",
"tsym",
",",
"env",
".",
"info",
".",
"scope",
")",
")",
"{",
"env",
".",
"info",
".",
"scope",
".",
"enter",
"(",
"a",
".",
"tsym",
")",
";",
"}",
"result",
"=",
"a",
";",
"}"
] |
Class enter visitor method for type parameters.
Enter a symbol for type parameter in local scope, after checking that it
is unique.
|
[
"Class",
"enter",
"visitor",
"method",
"for",
"type",
"parameters",
".",
"Enter",
"a",
"symbol",
"for",
"type",
"parameter",
"in",
"local",
"scope",
"after",
"checking",
"that",
"it",
"is",
"unique",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java#L522-L532
|
5,673 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java
|
AbstractExecutableMemberWriter.addInheritedSummaryLink
|
@Override
protected void addInheritedSummaryLink(TypeElement te, Element member, Content linksTree) {
linksTree.addContent(writer.getDocLink(MEMBER, te, member, name(member), false));
}
|
java
|
@Override
protected void addInheritedSummaryLink(TypeElement te, Element member, Content linksTree) {
linksTree.addContent(writer.getDocLink(MEMBER, te, member, name(member), false));
}
|
[
"@",
"Override",
"protected",
"void",
"addInheritedSummaryLink",
"(",
"TypeElement",
"te",
",",
"Element",
"member",
",",
"Content",
"linksTree",
")",
"{",
"linksTree",
".",
"addContent",
"(",
"writer",
".",
"getDocLink",
"(",
"MEMBER",
",",
"te",
",",
"member",
",",
"name",
"(",
"member",
")",
",",
"false",
")",
")",
";",
"}"
] |
Add the inherited summary link for the member.
@param te the type element that we should link to
@param member the member being linked to
@param linksTree the content tree to which the link will be added
|
[
"Add",
"the",
"inherited",
"summary",
"link",
"for",
"the",
"member",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java#L139-L142
|
5,674 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java
|
PortFile.lock
|
public void lock() throws IOException, InterruptedException {
if (channel == null) {
initializeChannel();
}
lockSem.acquire();
lock = channel.lock();
}
|
java
|
public void lock() throws IOException, InterruptedException {
if (channel == null) {
initializeChannel();
}
lockSem.acquire();
lock = channel.lock();
}
|
[
"public",
"void",
"lock",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"channel",
"==",
"null",
")",
"{",
"initializeChannel",
"(",
")",
";",
"}",
"lockSem",
".",
"acquire",
"(",
")",
";",
"lock",
"=",
"channel",
".",
"lock",
"(",
")",
";",
"}"
] |
Lock the port file.
|
[
"Lock",
"the",
"port",
"file",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java#L107-L113
|
5,675 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java
|
PortFile.getValues
|
public void getValues() {
containsPortInfo = false;
if (lock == null) {
// Not locked, remain ignorant about port file contents.
return;
}
try {
if (rwfile.length()>0) {
rwfile.seek(0);
int nr = rwfile.readInt();
serverPort = rwfile.readInt();
serverCookie = rwfile.readLong();
if (nr == magicNr) {
containsPortInfo = true;
} else {
containsPortInfo = false;
}
}
} catch (IOException e) {
containsPortInfo = false;
}
}
|
java
|
public void getValues() {
containsPortInfo = false;
if (lock == null) {
// Not locked, remain ignorant about port file contents.
return;
}
try {
if (rwfile.length()>0) {
rwfile.seek(0);
int nr = rwfile.readInt();
serverPort = rwfile.readInt();
serverCookie = rwfile.readLong();
if (nr == magicNr) {
containsPortInfo = true;
} else {
containsPortInfo = false;
}
}
} catch (IOException e) {
containsPortInfo = false;
}
}
|
[
"public",
"void",
"getValues",
"(",
")",
"{",
"containsPortInfo",
"=",
"false",
";",
"if",
"(",
"lock",
"==",
"null",
")",
"{",
"// Not locked, remain ignorant about port file contents.",
"return",
";",
"}",
"try",
"{",
"if",
"(",
"rwfile",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"rwfile",
".",
"seek",
"(",
"0",
")",
";",
"int",
"nr",
"=",
"rwfile",
".",
"readInt",
"(",
")",
";",
"serverPort",
"=",
"rwfile",
".",
"readInt",
"(",
")",
";",
"serverCookie",
"=",
"rwfile",
".",
"readLong",
"(",
")",
";",
"if",
"(",
"nr",
"==",
"magicNr",
")",
"{",
"containsPortInfo",
"=",
"true",
";",
"}",
"else",
"{",
"containsPortInfo",
"=",
"false",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"containsPortInfo",
"=",
"false",
";",
"}",
"}"
] |
Read the values from the port file in the file system.
Expects the port file to be locked.
|
[
"Read",
"the",
"values",
"from",
"the",
"port",
"file",
"in",
"the",
"file",
"system",
".",
"Expects",
"the",
"port",
"file",
"to",
"be",
"locked",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java#L119-L141
|
5,676 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java
|
PortFile.setValues
|
public void setValues(int port, long cookie) throws IOException {
Assert.check(lock != null);
rwfile.seek(0);
// Write the magic nr that identifes a port file.
rwfile.writeInt(magicNr);
rwfile.writeInt(port);
rwfile.writeLong(cookie);
myServerPort = port;
myServerCookie = cookie;
}
|
java
|
public void setValues(int port, long cookie) throws IOException {
Assert.check(lock != null);
rwfile.seek(0);
// Write the magic nr that identifes a port file.
rwfile.writeInt(magicNr);
rwfile.writeInt(port);
rwfile.writeLong(cookie);
myServerPort = port;
myServerCookie = cookie;
}
|
[
"public",
"void",
"setValues",
"(",
"int",
"port",
",",
"long",
"cookie",
")",
"throws",
"IOException",
"{",
"Assert",
".",
"check",
"(",
"lock",
"!=",
"null",
")",
";",
"rwfile",
".",
"seek",
"(",
"0",
")",
";",
"// Write the magic nr that identifes a port file.",
"rwfile",
".",
"writeInt",
"(",
"magicNr",
")",
";",
"rwfile",
".",
"writeInt",
"(",
"port",
")",
";",
"rwfile",
".",
"writeLong",
"(",
"cookie",
")",
";",
"myServerPort",
"=",
"port",
";",
"myServerCookie",
"=",
"cookie",
";",
"}"
] |
Store the values into the locked port file.
|
[
"Store",
"the",
"values",
"into",
"the",
"locked",
"port",
"file",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java#L169-L178
|
5,677 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java
|
PortFile.delete
|
public void delete() throws IOException, InterruptedException {
// Access to file must be closed before deleting.
rwfile.close();
file.delete();
// Wait until file has been deleted (deletes are asynchronous on Windows!) otherwise we
// might shutdown the server and prevent another one from starting.
for (int i = 0; i < 10 && file.exists(); i++) {
Thread.sleep(1000);
}
if (file.exists()) {
throw new IOException("Failed to delete file.");
}
}
|
java
|
public void delete() throws IOException, InterruptedException {
// Access to file must be closed before deleting.
rwfile.close();
file.delete();
// Wait until file has been deleted (deletes are asynchronous on Windows!) otherwise we
// might shutdown the server and prevent another one from starting.
for (int i = 0; i < 10 && file.exists(); i++) {
Thread.sleep(1000);
}
if (file.exists()) {
throw new IOException("Failed to delete file.");
}
}
|
[
"public",
"void",
"delete",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"// Access to file must be closed before deleting.",
"rwfile",
".",
"close",
"(",
")",
";",
"file",
".",
"delete",
"(",
")",
";",
"// Wait until file has been deleted (deletes are asynchronous on Windows!) otherwise we",
"// might shutdown the server and prevent another one from starting.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"10",
"&&",
"file",
".",
"exists",
"(",
")",
";",
"i",
"++",
")",
"{",
"Thread",
".",
"sleep",
"(",
"1000",
")",
";",
"}",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Failed to delete file.\"",
")",
";",
"}",
"}"
] |
Delete the port file.
|
[
"Delete",
"the",
"port",
"file",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java#L183-L197
|
5,678 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java
|
PortFile.markedForStop
|
public boolean markedForStop() throws IOException {
if (stopFile.exists()) {
try {
stopFile.delete();
} catch (Exception e) {
}
return true;
}
return false;
}
|
java
|
public boolean markedForStop() throws IOException {
if (stopFile.exists()) {
try {
stopFile.delete();
} catch (Exception e) {
}
return true;
}
return false;
}
|
[
"public",
"boolean",
"markedForStop",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"stopFile",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"stopFile",
".",
"delete",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Is a stop file there?
|
[
"Is",
"a",
"stop",
"file",
"there?"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java#L209-L218
|
5,679 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java
|
PortFile.unlock
|
public void unlock() throws IOException {
if (lock == null) {
return;
}
lock.release();
lock = null;
lockSem.release();
}
|
java
|
public void unlock() throws IOException {
if (lock == null) {
return;
}
lock.release();
lock = null;
lockSem.release();
}
|
[
"public",
"void",
"unlock",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"lock",
"==",
"null",
")",
"{",
"return",
";",
"}",
"lock",
".",
"release",
"(",
")",
";",
"lock",
"=",
"null",
";",
"lockSem",
".",
"release",
"(",
")",
";",
"}"
] |
Unlock the port file.
|
[
"Unlock",
"the",
"port",
"file",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java#L223-L230
|
5,680 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java
|
PortFile.waitForValidValues
|
public void waitForValidValues() throws IOException, InterruptedException {
final int MS_BETWEEN_ATTEMPTS = 500;
long startTime = System.currentTimeMillis();
long timeout = startTime + getServerStartupTimeoutSeconds() * 1000;
while (true) {
Log.debug("Looking for valid port file values...");
if (exists()) {
lock();
getValues();
unlock();
}
if (containsPortInfo) {
Log.debug("Valid port file values found after " + (System.currentTimeMillis() - startTime) + " ms");
return;
}
if (System.currentTimeMillis() > timeout) {
break;
}
Thread.sleep(MS_BETWEEN_ATTEMPTS);
}
throw new IOException("No port file values materialized. Giving up after " +
(System.currentTimeMillis() - startTime) + " ms");
}
|
java
|
public void waitForValidValues() throws IOException, InterruptedException {
final int MS_BETWEEN_ATTEMPTS = 500;
long startTime = System.currentTimeMillis();
long timeout = startTime + getServerStartupTimeoutSeconds() * 1000;
while (true) {
Log.debug("Looking for valid port file values...");
if (exists()) {
lock();
getValues();
unlock();
}
if (containsPortInfo) {
Log.debug("Valid port file values found after " + (System.currentTimeMillis() - startTime) + " ms");
return;
}
if (System.currentTimeMillis() > timeout) {
break;
}
Thread.sleep(MS_BETWEEN_ATTEMPTS);
}
throw new IOException("No port file values materialized. Giving up after " +
(System.currentTimeMillis() - startTime) + " ms");
}
|
[
"public",
"void",
"waitForValidValues",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"final",
"int",
"MS_BETWEEN_ATTEMPTS",
"=",
"500",
";",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"long",
"timeout",
"=",
"startTime",
"+",
"getServerStartupTimeoutSeconds",
"(",
")",
"*",
"1000",
";",
"while",
"(",
"true",
")",
"{",
"Log",
".",
"debug",
"(",
"\"Looking for valid port file values...\"",
")",
";",
"if",
"(",
"exists",
"(",
")",
")",
"{",
"lock",
"(",
")",
";",
"getValues",
"(",
")",
";",
"unlock",
"(",
")",
";",
"}",
"if",
"(",
"containsPortInfo",
")",
"{",
"Log",
".",
"debug",
"(",
"\"Valid port file values found after \"",
"+",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"startTime",
")",
"+",
"\" ms\"",
")",
";",
"return",
";",
"}",
"if",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
">",
"timeout",
")",
"{",
"break",
";",
"}",
"Thread",
".",
"sleep",
"(",
"MS_BETWEEN_ATTEMPTS",
")",
";",
"}",
"throw",
"new",
"IOException",
"(",
"\"No port file values materialized. Giving up after \"",
"+",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"startTime",
")",
"+",
"\" ms\"",
")",
";",
"}"
] |
Wait for the port file to contain values that look valid.
|
[
"Wait",
"for",
"the",
"port",
"file",
"to",
"contain",
"values",
"that",
"look",
"valid",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java#L235-L257
|
5,681 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/Main.java
|
Main.compile
|
public static int compile(String[] args) {
com.sun.tools.javac.main.Main compiler =
new com.sun.tools.javac.main.Main("javac");
return compiler.compile(args).exitCode;
}
|
java
|
public static int compile(String[] args) {
com.sun.tools.javac.main.Main compiler =
new com.sun.tools.javac.main.Main("javac");
return compiler.compile(args).exitCode;
}
|
[
"public",
"static",
"int",
"compile",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"com",
".",
"sun",
".",
"tools",
".",
"javac",
".",
"main",
".",
"Main",
"compiler",
"=",
"new",
"com",
".",
"sun",
".",
"tools",
".",
"javac",
".",
"main",
".",
"Main",
"(",
"\"javac\"",
")",
";",
"return",
"compiler",
".",
"compile",
"(",
"args",
")",
".",
"exitCode",
";",
"}"
] |
Programmatic interface to the Java Programming Language
compiler, javac.
@param args The command line arguments that would normally be
passed to the javac program as described in the man page.
@return an integer equivalent to the exit value from invoking
javac, see the man page for details.
|
[
"Programmatic",
"interface",
"to",
"the",
"Java",
"Programming",
"Language",
"compiler",
"javac",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/Main.java#L54-L58
|
5,682 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
|
ConfigurationImpl.getDocletSpecificBuildDate
|
@Override
public String getDocletSpecificBuildDate() {
if (versionRB == null) {
try {
versionRB = ResourceBundle.getBundle(versionRBName);
} catch (MissingResourceException e) {
return BUILD_DATE;
}
}
try {
return versionRB.getString("release");
} catch (MissingResourceException e) {
return BUILD_DATE;
}
}
|
java
|
@Override
public String getDocletSpecificBuildDate() {
if (versionRB == null) {
try {
versionRB = ResourceBundle.getBundle(versionRBName);
} catch (MissingResourceException e) {
return BUILD_DATE;
}
}
try {
return versionRB.getString("release");
} catch (MissingResourceException e) {
return BUILD_DATE;
}
}
|
[
"@",
"Override",
"public",
"String",
"getDocletSpecificBuildDate",
"(",
")",
"{",
"if",
"(",
"versionRB",
"==",
"null",
")",
"{",
"try",
"{",
"versionRB",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"versionRBName",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
"e",
")",
"{",
"return",
"BUILD_DATE",
";",
"}",
"}",
"try",
"{",
"return",
"versionRB",
".",
"getString",
"(",
"\"release\"",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
"e",
")",
"{",
"return",
"BUILD_DATE",
";",
"}",
"}"
] |
Return the build date for the doclet.
|
[
"Return",
"the",
"build",
"date",
"for",
"the",
"doclet",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java#L240-L255
|
5,683 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFinder.java
|
DocFinder.search
|
public static Output search(Configuration configuration, Input input) {
Output output = new Output();
Utils utils = configuration.utils;
if (input.isInheritDocTag) {
//Do nothing because "element" does not have any documentation.
//All it has is {@inheritDoc}.
} else if (input.taglet == null) {
//We want overall documentation.
output.inlineTags = input.isFirstSentence
? utils.getFirstSentenceTrees(input.element)
: utils.getFullBody(input.element);
output.holder = input.element;
} else {
input.taglet.inherit(input, output);
}
if (output.inlineTags != null && !output.inlineTags.isEmpty()) {
return output;
}
output.isValidInheritDocTag = false;
Input inheritedSearchInput = input.copy(configuration.utils);
inheritedSearchInput.isInheritDocTag = false;
if (utils.isMethod(input.element)) {
ExecutableElement overriddenMethod = utils.overriddenMethod((ExecutableElement) input.element);
if (overriddenMethod != null) {
inheritedSearchInput.element = overriddenMethod;
output = search(configuration, inheritedSearchInput);
output.isValidInheritDocTag = true;
if (!output.inlineTags.isEmpty()) {
return output;
}
}
//NOTE: When we fix the bug where ClassDoc.interfaceTypes() does
// not pass all implemented interfaces, we will use the
// appropriate element here.
ImplementedMethods implMethods
= new ImplementedMethods((ExecutableElement) input.element, configuration);
List<ExecutableElement> implementedMethods = implMethods.build();
for (ExecutableElement implementedMethod : implementedMethods) {
inheritedSearchInput.element = implementedMethod;
output = search(configuration, inheritedSearchInput);
output.isValidInheritDocTag = true;
if (!output.inlineTags.isEmpty()) {
return output;
}
}
} else if (utils.isTypeElement(input.element)) {
TypeMirror t = ((TypeElement) input.element).getSuperclass();
Element superclass = utils.asTypeElement(t);
if (superclass != null) {
inheritedSearchInput.element = superclass;
output = search(configuration, inheritedSearchInput);
output.isValidInheritDocTag = true;
if (!output.inlineTags.isEmpty()) {
return output;
}
}
}
return output;
}
|
java
|
public static Output search(Configuration configuration, Input input) {
Output output = new Output();
Utils utils = configuration.utils;
if (input.isInheritDocTag) {
//Do nothing because "element" does not have any documentation.
//All it has is {@inheritDoc}.
} else if (input.taglet == null) {
//We want overall documentation.
output.inlineTags = input.isFirstSentence
? utils.getFirstSentenceTrees(input.element)
: utils.getFullBody(input.element);
output.holder = input.element;
} else {
input.taglet.inherit(input, output);
}
if (output.inlineTags != null && !output.inlineTags.isEmpty()) {
return output;
}
output.isValidInheritDocTag = false;
Input inheritedSearchInput = input.copy(configuration.utils);
inheritedSearchInput.isInheritDocTag = false;
if (utils.isMethod(input.element)) {
ExecutableElement overriddenMethod = utils.overriddenMethod((ExecutableElement) input.element);
if (overriddenMethod != null) {
inheritedSearchInput.element = overriddenMethod;
output = search(configuration, inheritedSearchInput);
output.isValidInheritDocTag = true;
if (!output.inlineTags.isEmpty()) {
return output;
}
}
//NOTE: When we fix the bug where ClassDoc.interfaceTypes() does
// not pass all implemented interfaces, we will use the
// appropriate element here.
ImplementedMethods implMethods
= new ImplementedMethods((ExecutableElement) input.element, configuration);
List<ExecutableElement> implementedMethods = implMethods.build();
for (ExecutableElement implementedMethod : implementedMethods) {
inheritedSearchInput.element = implementedMethod;
output = search(configuration, inheritedSearchInput);
output.isValidInheritDocTag = true;
if (!output.inlineTags.isEmpty()) {
return output;
}
}
} else if (utils.isTypeElement(input.element)) {
TypeMirror t = ((TypeElement) input.element).getSuperclass();
Element superclass = utils.asTypeElement(t);
if (superclass != null) {
inheritedSearchInput.element = superclass;
output = search(configuration, inheritedSearchInput);
output.isValidInheritDocTag = true;
if (!output.inlineTags.isEmpty()) {
return output;
}
}
}
return output;
}
|
[
"public",
"static",
"Output",
"search",
"(",
"Configuration",
"configuration",
",",
"Input",
"input",
")",
"{",
"Output",
"output",
"=",
"new",
"Output",
"(",
")",
";",
"Utils",
"utils",
"=",
"configuration",
".",
"utils",
";",
"if",
"(",
"input",
".",
"isInheritDocTag",
")",
"{",
"//Do nothing because \"element\" does not have any documentation.",
"//All it has is {@inheritDoc}.",
"}",
"else",
"if",
"(",
"input",
".",
"taglet",
"==",
"null",
")",
"{",
"//We want overall documentation.",
"output",
".",
"inlineTags",
"=",
"input",
".",
"isFirstSentence",
"?",
"utils",
".",
"getFirstSentenceTrees",
"(",
"input",
".",
"element",
")",
":",
"utils",
".",
"getFullBody",
"(",
"input",
".",
"element",
")",
";",
"output",
".",
"holder",
"=",
"input",
".",
"element",
";",
"}",
"else",
"{",
"input",
".",
"taglet",
".",
"inherit",
"(",
"input",
",",
"output",
")",
";",
"}",
"if",
"(",
"output",
".",
"inlineTags",
"!=",
"null",
"&&",
"!",
"output",
".",
"inlineTags",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"output",
";",
"}",
"output",
".",
"isValidInheritDocTag",
"=",
"false",
";",
"Input",
"inheritedSearchInput",
"=",
"input",
".",
"copy",
"(",
"configuration",
".",
"utils",
")",
";",
"inheritedSearchInput",
".",
"isInheritDocTag",
"=",
"false",
";",
"if",
"(",
"utils",
".",
"isMethod",
"(",
"input",
".",
"element",
")",
")",
"{",
"ExecutableElement",
"overriddenMethod",
"=",
"utils",
".",
"overriddenMethod",
"(",
"(",
"ExecutableElement",
")",
"input",
".",
"element",
")",
";",
"if",
"(",
"overriddenMethod",
"!=",
"null",
")",
"{",
"inheritedSearchInput",
".",
"element",
"=",
"overriddenMethod",
";",
"output",
"=",
"search",
"(",
"configuration",
",",
"inheritedSearchInput",
")",
";",
"output",
".",
"isValidInheritDocTag",
"=",
"true",
";",
"if",
"(",
"!",
"output",
".",
"inlineTags",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"output",
";",
"}",
"}",
"//NOTE: When we fix the bug where ClassDoc.interfaceTypes() does",
"// not pass all implemented interfaces, we will use the",
"// appropriate element here.",
"ImplementedMethods",
"implMethods",
"=",
"new",
"ImplementedMethods",
"(",
"(",
"ExecutableElement",
")",
"input",
".",
"element",
",",
"configuration",
")",
";",
"List",
"<",
"ExecutableElement",
">",
"implementedMethods",
"=",
"implMethods",
".",
"build",
"(",
")",
";",
"for",
"(",
"ExecutableElement",
"implementedMethod",
":",
"implementedMethods",
")",
"{",
"inheritedSearchInput",
".",
"element",
"=",
"implementedMethod",
";",
"output",
"=",
"search",
"(",
"configuration",
",",
"inheritedSearchInput",
")",
";",
"output",
".",
"isValidInheritDocTag",
"=",
"true",
";",
"if",
"(",
"!",
"output",
".",
"inlineTags",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"output",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"utils",
".",
"isTypeElement",
"(",
"input",
".",
"element",
")",
")",
"{",
"TypeMirror",
"t",
"=",
"(",
"(",
"TypeElement",
")",
"input",
".",
"element",
")",
".",
"getSuperclass",
"(",
")",
";",
"Element",
"superclass",
"=",
"utils",
".",
"asTypeElement",
"(",
"t",
")",
";",
"if",
"(",
"superclass",
"!=",
"null",
")",
"{",
"inheritedSearchInput",
".",
"element",
"=",
"superclass",
";",
"output",
"=",
"search",
"(",
"configuration",
",",
"inheritedSearchInput",
")",
";",
"output",
".",
"isValidInheritDocTag",
"=",
"true",
";",
"if",
"(",
"!",
"output",
".",
"inlineTags",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"output",
";",
"}",
"}",
"}",
"return",
"output",
";",
"}"
] |
Search for the requested comments in the given element. If it does not
have comments, return documentation from the overridden element if possible.
If the overridden element does not exist or does not have documentation to
inherit, search for documentation to inherit from implemented methods.
@param input the input object used to perform the search.
@return an Output object representing the documentation that was found.
|
[
"Search",
"for",
"the",
"requested",
"comments",
"in",
"the",
"given",
"element",
".",
"If",
"it",
"does",
"not",
"have",
"comments",
"return",
"documentation",
"from",
"the",
"overridden",
"element",
"if",
"possible",
".",
"If",
"the",
"overridden",
"element",
"does",
"not",
"exist",
"or",
"does",
"not",
"have",
"documentation",
"to",
"inherit",
"search",
"for",
"documentation",
"to",
"inherit",
"from",
"implemented",
"methods",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFinder.java#L244-L303
|
5,684 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/source/util/TreePath.java
|
TreePath.iterator
|
@Override
public Iterator<Tree> iterator() {
return new Iterator<Tree>() {
@Override
public boolean hasNext() {
return next != null;
}
@Override
public Tree next() {
Tree t = next.leaf;
next = next.parent;
return t;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
private TreePath next = TreePath.this;
};
}
|
java
|
@Override
public Iterator<Tree> iterator() {
return new Iterator<Tree>() {
@Override
public boolean hasNext() {
return next != null;
}
@Override
public Tree next() {
Tree t = next.leaf;
next = next.parent;
return t;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
private TreePath next = TreePath.this;
};
}
|
[
"@",
"Override",
"public",
"Iterator",
"<",
"Tree",
">",
"iterator",
"(",
")",
"{",
"return",
"new",
"Iterator",
"<",
"Tree",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"return",
"next",
"!=",
"null",
";",
"}",
"@",
"Override",
"public",
"Tree",
"next",
"(",
")",
"{",
"Tree",
"t",
"=",
"next",
".",
"leaf",
";",
"next",
"=",
"next",
".",
"parent",
";",
"return",
"t",
";",
"}",
"@",
"Override",
"public",
"void",
"remove",
"(",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"}",
"private",
"TreePath",
"next",
"=",
"TreePath",
".",
"this",
";",
"}",
";",
"}"
] |
Iterates from leaves to root.
|
[
"Iterates",
"from",
"leaves",
"to",
"root",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreePath.java#L143-L165
|
5,685 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java
|
PackageDocImpl.exceptions
|
public ClassDoc[] exceptions() {
ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
for (ClassDocImpl c : getClasses(true)) {
if (c.isException()) {
ret.append(c);
}
}
return ret.toArray(new ClassDocImpl[ret.length()]);
}
|
java
|
public ClassDoc[] exceptions() {
ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
for (ClassDocImpl c : getClasses(true)) {
if (c.isException()) {
ret.append(c);
}
}
return ret.toArray(new ClassDocImpl[ret.length()]);
}
|
[
"public",
"ClassDoc",
"[",
"]",
"exceptions",
"(",
")",
"{",
"ListBuffer",
"<",
"ClassDocImpl",
">",
"ret",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"for",
"(",
"ClassDocImpl",
"c",
":",
"getClasses",
"(",
"true",
")",
")",
"{",
"if",
"(",
"c",
".",
"isException",
"(",
")",
")",
"{",
"ret",
".",
"append",
"(",
"c",
")",
";",
"}",
"}",
"return",
"ret",
".",
"toArray",
"(",
"new",
"ClassDocImpl",
"[",
"ret",
".",
"length",
"(",
")",
"]",
")",
";",
"}"
] |
Get Exception classes in this package.
@return included Exceptions in this package.
|
[
"Get",
"Exception",
"classes",
"in",
"this",
"package",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java#L218-L226
|
5,686 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java
|
PackageDocImpl.errors
|
public ClassDoc[] errors() {
ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
for (ClassDocImpl c : getClasses(true)) {
if (c.isError()) {
ret.append(c);
}
}
return ret.toArray(new ClassDocImpl[ret.length()]);
}
|
java
|
public ClassDoc[] errors() {
ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
for (ClassDocImpl c : getClasses(true)) {
if (c.isError()) {
ret.append(c);
}
}
return ret.toArray(new ClassDocImpl[ret.length()]);
}
|
[
"public",
"ClassDoc",
"[",
"]",
"errors",
"(",
")",
"{",
"ListBuffer",
"<",
"ClassDocImpl",
">",
"ret",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"for",
"(",
"ClassDocImpl",
"c",
":",
"getClasses",
"(",
"true",
")",
")",
"{",
"if",
"(",
"c",
".",
"isError",
"(",
")",
")",
"{",
"ret",
".",
"append",
"(",
"c",
")",
";",
"}",
"}",
"return",
"ret",
".",
"toArray",
"(",
"new",
"ClassDocImpl",
"[",
"ret",
".",
"length",
"(",
")",
"]",
")",
";",
"}"
] |
Get Error classes in this package.
@return included Errors in this package.
|
[
"Get",
"Error",
"classes",
"in",
"this",
"package",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java#L233-L241
|
5,687 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java
|
PackageDocImpl.annotationTypes
|
public AnnotationTypeDoc[] annotationTypes() {
ListBuffer<AnnotationTypeDocImpl> ret = new ListBuffer<>();
for (ClassDocImpl c : getClasses(true)) {
if (c.isAnnotationType()) {
ret.append((AnnotationTypeDocImpl)c);
}
}
return ret.toArray(new AnnotationTypeDocImpl[ret.length()]);
}
|
java
|
public AnnotationTypeDoc[] annotationTypes() {
ListBuffer<AnnotationTypeDocImpl> ret = new ListBuffer<>();
for (ClassDocImpl c : getClasses(true)) {
if (c.isAnnotationType()) {
ret.append((AnnotationTypeDocImpl)c);
}
}
return ret.toArray(new AnnotationTypeDocImpl[ret.length()]);
}
|
[
"public",
"AnnotationTypeDoc",
"[",
"]",
"annotationTypes",
"(",
")",
"{",
"ListBuffer",
"<",
"AnnotationTypeDocImpl",
">",
"ret",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"for",
"(",
"ClassDocImpl",
"c",
":",
"getClasses",
"(",
"true",
")",
")",
"{",
"if",
"(",
"c",
".",
"isAnnotationType",
"(",
")",
")",
"{",
"ret",
".",
"append",
"(",
"(",
"AnnotationTypeDocImpl",
")",
"c",
")",
";",
"}",
"}",
"return",
"ret",
".",
"toArray",
"(",
"new",
"AnnotationTypeDocImpl",
"[",
"ret",
".",
"length",
"(",
")",
"]",
")",
";",
"}"
] |
Get included annotation types in this package.
@return included annotation types in this package.
|
[
"Get",
"included",
"annotation",
"types",
"in",
"this",
"package",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java#L278-L286
|
5,688 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java
|
PackageDocImpl.qualifiedName
|
public String qualifiedName() {
if (qualifiedName == null) {
Name fullname = sym.getQualifiedName();
// Some bogus tests depend on the interned "" being returned.
// See 6457276.
qualifiedName = fullname.isEmpty() ? "" : fullname.toString();
}
return qualifiedName;
}
|
java
|
public String qualifiedName() {
if (qualifiedName == null) {
Name fullname = sym.getQualifiedName();
// Some bogus tests depend on the interned "" being returned.
// See 6457276.
qualifiedName = fullname.isEmpty() ? "" : fullname.toString();
}
return qualifiedName;
}
|
[
"public",
"String",
"qualifiedName",
"(",
")",
"{",
"if",
"(",
"qualifiedName",
"==",
"null",
")",
"{",
"Name",
"fullname",
"=",
"sym",
".",
"getQualifiedName",
"(",
")",
";",
"// Some bogus tests depend on the interned \"\" being returned.",
"// See 6457276.",
"qualifiedName",
"=",
"fullname",
".",
"isEmpty",
"(",
")",
"?",
"\"\"",
":",
"fullname",
".",
"toString",
"(",
")",
";",
"}",
"return",
"qualifiedName",
";",
"}"
] |
Get package name.
|
[
"Get",
"package",
"name",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java#L338-L346
|
5,689 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java
|
PackageDocImpl.setDocPath
|
public void setDocPath(FileObject path) {
setDocPath = true;
if (path == null)
return;
if (!path.equals(docPath)) {
docPath = path;
checkDoc();
}
}
|
java
|
public void setDocPath(FileObject path) {
setDocPath = true;
if (path == null)
return;
if (!path.equals(docPath)) {
docPath = path;
checkDoc();
}
}
|
[
"public",
"void",
"setDocPath",
"(",
"FileObject",
"path",
")",
"{",
"setDocPath",
"=",
"true",
";",
"if",
"(",
"path",
"==",
"null",
")",
"return",
";",
"if",
"(",
"!",
"path",
".",
"equals",
"(",
"docPath",
")",
")",
"{",
"docPath",
"=",
"path",
";",
"checkDoc",
"(",
")",
";",
"}",
"}"
] |
set doc path for an unzipped directory
|
[
"set",
"doc",
"path",
"for",
"an",
"unzipped",
"directory"
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java#L353-L361
|
5,690 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java
|
PackageDocImpl.checkDoc
|
private void checkDoc() {
if (foundDoc) {
if (!checkDocWarningEmitted) {
env.warning(null, "javadoc.Multiple_package_comments", name());
checkDocWarningEmitted = true;
}
} else {
foundDoc = true;
}
}
|
java
|
private void checkDoc() {
if (foundDoc) {
if (!checkDocWarningEmitted) {
env.warning(null, "javadoc.Multiple_package_comments", name());
checkDocWarningEmitted = true;
}
} else {
foundDoc = true;
}
}
|
[
"private",
"void",
"checkDoc",
"(",
")",
"{",
"if",
"(",
"foundDoc",
")",
"{",
"if",
"(",
"!",
"checkDocWarningEmitted",
")",
"{",
"env",
".",
"warning",
"(",
"null",
",",
"\"javadoc.Multiple_package_comments\"",
",",
"name",
"(",
")",
")",
";",
"checkDocWarningEmitted",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"foundDoc",
"=",
"true",
";",
"}",
"}"
] |
Invoked when a source of package doc comments is located.
Emits a diagnostic if this is the second one.
|
[
"Invoked",
"when",
"a",
"source",
"of",
"package",
"doc",
"comments",
"is",
"located",
".",
"Emits",
"a",
"diagnostic",
"if",
"this",
"is",
"the",
"second",
"one",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java#L370-L379
|
5,691 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
|
Main.error
|
void error(String key, Object... args) {
if (apiMode) {
String msg = log.localize(PrefixKind.JAVAC, key, args);
throw new PropagatedException(new IllegalStateException(msg));
}
warning(key, args);
log.printLines(PrefixKind.JAVAC, "msg.usage", ownName);
}
|
java
|
void error(String key, Object... args) {
if (apiMode) {
String msg = log.localize(PrefixKind.JAVAC, key, args);
throw new PropagatedException(new IllegalStateException(msg));
}
warning(key, args);
log.printLines(PrefixKind.JAVAC, "msg.usage", ownName);
}
|
[
"void",
"error",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"apiMode",
")",
"{",
"String",
"msg",
"=",
"log",
".",
"localize",
"(",
"PrefixKind",
".",
"JAVAC",
",",
"key",
",",
"args",
")",
";",
"throw",
"new",
"PropagatedException",
"(",
"new",
"IllegalStateException",
"(",
"msg",
")",
")",
";",
"}",
"warning",
"(",
"key",
",",
"args",
")",
";",
"log",
".",
"printLines",
"(",
"PrefixKind",
".",
"JAVAC",
",",
"\"msg.usage\"",
",",
"ownName",
")",
";",
"}"
] |
Report a usage error.
|
[
"Report",
"a",
"usage",
"error",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java#L138-L145
|
5,692 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
|
Main.compile
|
public Result compile(String[] args) {
Context context = new Context();
JavacFileManager.preRegister(context); // can't create it until Log has been set up
Result result = compile(args, context);
if (fileManager instanceof JavacFileManager) {
try {
// A fresh context was created above, so jfm must be a JavacFileManager
((JavacFileManager)fileManager).close();
} catch (IOException ex) {
bugMessage(ex);
}
}
return result;
}
|
java
|
public Result compile(String[] args) {
Context context = new Context();
JavacFileManager.preRegister(context); // can't create it until Log has been set up
Result result = compile(args, context);
if (fileManager instanceof JavacFileManager) {
try {
// A fresh context was created above, so jfm must be a JavacFileManager
((JavacFileManager)fileManager).close();
} catch (IOException ex) {
bugMessage(ex);
}
}
return result;
}
|
[
"public",
"Result",
"compile",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"Context",
"context",
"=",
"new",
"Context",
"(",
")",
";",
"JavacFileManager",
".",
"preRegister",
"(",
"context",
")",
";",
"// can't create it until Log has been set up",
"Result",
"result",
"=",
"compile",
"(",
"args",
",",
"context",
")",
";",
"if",
"(",
"fileManager",
"instanceof",
"JavacFileManager",
")",
"{",
"try",
"{",
"// A fresh context was created above, so jfm must be a JavacFileManager",
"(",
"(",
"JavacFileManager",
")",
"fileManager",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"bugMessage",
"(",
"ex",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Programmatic interface for main function.
@param args the command line parameters
@return the result of the compilation
|
[
"Programmatic",
"interface",
"for",
"main",
"function",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java#L159-L172
|
5,693 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
|
Main.bugMessage
|
void bugMessage(Throwable ex) {
log.printLines(PrefixKind.JAVAC, "msg.bug", JavaCompiler.version());
ex.printStackTrace(log.getWriter(WriterKind.NOTICE));
}
|
java
|
void bugMessage(Throwable ex) {
log.printLines(PrefixKind.JAVAC, "msg.bug", JavaCompiler.version());
ex.printStackTrace(log.getWriter(WriterKind.NOTICE));
}
|
[
"void",
"bugMessage",
"(",
"Throwable",
"ex",
")",
"{",
"log",
".",
"printLines",
"(",
"PrefixKind",
".",
"JAVAC",
",",
"\"msg.bug\"",
",",
"JavaCompiler",
".",
"version",
"(",
")",
")",
";",
"ex",
".",
"printStackTrace",
"(",
"log",
".",
"getWriter",
"(",
"WriterKind",
".",
"NOTICE",
")",
")",
";",
"}"
] |
Print a message reporting an internal error.
|
[
"Print",
"a",
"message",
"reporting",
"an",
"internal",
"error",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java#L348-L351
|
5,694 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
|
Main.feMessage
|
void feMessage(Throwable ex, Options options) {
log.printRawLines(ex.getMessage());
if (ex.getCause() != null && options.isSet("dev")) {
ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE));
}
}
|
java
|
void feMessage(Throwable ex, Options options) {
log.printRawLines(ex.getMessage());
if (ex.getCause() != null && options.isSet("dev")) {
ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE));
}
}
|
[
"void",
"feMessage",
"(",
"Throwable",
"ex",
",",
"Options",
"options",
")",
"{",
"log",
".",
"printRawLines",
"(",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"if",
"(",
"ex",
".",
"getCause",
"(",
")",
"!=",
"null",
"&&",
"options",
".",
"isSet",
"(",
"\"dev\"",
")",
")",
"{",
"ex",
".",
"getCause",
"(",
")",
".",
"printStackTrace",
"(",
"log",
".",
"getWriter",
"(",
"WriterKind",
".",
"NOTICE",
")",
")",
";",
"}",
"}"
] |
Print a message reporting a fatal error.
|
[
"Print",
"a",
"message",
"reporting",
"a",
"fatal",
"error",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java#L355-L360
|
5,695 |
google/error-prone-javac
|
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
|
Main.showClass
|
void showClass(String className) {
PrintWriter pw = log.getWriter(WriterKind.NOTICE);
pw.println("javac: show class: " + className);
URL url = getClass().getResource('/' + className.replace('.', '/') + ".class");
if (url != null) {
pw.println(" " + url);
}
try (InputStream in = getClass().getResourceAsStream('/' + className.replace('.', '/') + ".class")) {
final String algorithm = "MD5";
byte[] digest;
MessageDigest md = MessageDigest.getInstance(algorithm);
try (DigestInputStream din = new DigestInputStream(in, md)) {
byte[] buf = new byte[8192];
int n;
do { n = din.read(buf); } while (n > 0);
digest = md.digest();
}
StringBuilder sb = new StringBuilder();
for (byte b: digest)
sb.append(String.format("%02x", b));
pw.println(" " + algorithm + " checksum: " + sb);
} catch (NoSuchAlgorithmException | IOException e) {
pw.println(" cannot compute digest: " + e);
}
}
|
java
|
void showClass(String className) {
PrintWriter pw = log.getWriter(WriterKind.NOTICE);
pw.println("javac: show class: " + className);
URL url = getClass().getResource('/' + className.replace('.', '/') + ".class");
if (url != null) {
pw.println(" " + url);
}
try (InputStream in = getClass().getResourceAsStream('/' + className.replace('.', '/') + ".class")) {
final String algorithm = "MD5";
byte[] digest;
MessageDigest md = MessageDigest.getInstance(algorithm);
try (DigestInputStream din = new DigestInputStream(in, md)) {
byte[] buf = new byte[8192];
int n;
do { n = din.read(buf); } while (n > 0);
digest = md.digest();
}
StringBuilder sb = new StringBuilder();
for (byte b: digest)
sb.append(String.format("%02x", b));
pw.println(" " + algorithm + " checksum: " + sb);
} catch (NoSuchAlgorithmException | IOException e) {
pw.println(" cannot compute digest: " + e);
}
}
|
[
"void",
"showClass",
"(",
"String",
"className",
")",
"{",
"PrintWriter",
"pw",
"=",
"log",
".",
"getWriter",
"(",
"WriterKind",
".",
"NOTICE",
")",
";",
"pw",
".",
"println",
"(",
"\"javac: show class: \"",
"+",
"className",
")",
";",
"URL",
"url",
"=",
"getClass",
"(",
")",
".",
"getResource",
"(",
"'",
"'",
"+",
"className",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\".class\"",
")",
";",
"if",
"(",
"url",
"!=",
"null",
")",
"{",
"pw",
".",
"println",
"(",
"\" \"",
"+",
"url",
")",
";",
"}",
"try",
"(",
"InputStream",
"in",
"=",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"'",
"'",
"+",
"className",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\".class\"",
")",
")",
"{",
"final",
"String",
"algorithm",
"=",
"\"MD5\"",
";",
"byte",
"[",
"]",
"digest",
";",
"MessageDigest",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"algorithm",
")",
";",
"try",
"(",
"DigestInputStream",
"din",
"=",
"new",
"DigestInputStream",
"(",
"in",
",",
"md",
")",
")",
"{",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"8192",
"]",
";",
"int",
"n",
";",
"do",
"{",
"n",
"=",
"din",
".",
"read",
"(",
"buf",
")",
";",
"}",
"while",
"(",
"n",
">",
"0",
")",
";",
"digest",
"=",
"md",
".",
"digest",
"(",
")",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"byte",
"b",
":",
"digest",
")",
"sb",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"%02x\"",
",",
")",
")",
";",
"pw",
".",
"println",
"(",
"\" \"",
"+",
"algorithm",
"+",
"\" checksum: \"",
"+",
"sb",
")",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"|",
"IOException",
"e",
")",
"{",
"pw",
".",
"println",
"(",
"\" cannot compute digest: \"",
"+",
"e",
")",
";",
"}",
"}"
] |
Display the location and checksum of a class.
|
[
"Display",
"the",
"location",
"and",
"checksum",
"of",
"a",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java#L393-L419
|
5,696 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
|
ClassUseWriter.addPackageList
|
protected void addPackageList(Content contentTree) throws IOException {
Content caption = getTableCaption(configuration.getResource(
"doclet.ClassUse_Packages.that.use.0",
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc))));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
: HtmlTree.TABLE(HtmlStyle.useSummary, useTableSummary, caption);
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<PackageDoc> it = pkgSet.iterator();
for (int i = 0; it.hasNext(); i++) {
PackageDoc pkg = it.next();
HtmlTree tr = new HtmlTree(HtmlTag.TR);
if (i % 2 == 0) {
tr.addStyle(HtmlStyle.altColor);
} else {
tr.addStyle(HtmlStyle.rowColor);
}
addPackageUse(pkg, tr);
tbody.addContent(tr);
}
table.addContent(tbody);
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
contentTree.addContent(li);
}
|
java
|
protected void addPackageList(Content contentTree) throws IOException {
Content caption = getTableCaption(configuration.getResource(
"doclet.ClassUse_Packages.that.use.0",
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc))));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
: HtmlTree.TABLE(HtmlStyle.useSummary, useTableSummary, caption);
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<PackageDoc> it = pkgSet.iterator();
for (int i = 0; it.hasNext(); i++) {
PackageDoc pkg = it.next();
HtmlTree tr = new HtmlTree(HtmlTag.TR);
if (i % 2 == 0) {
tr.addStyle(HtmlStyle.altColor);
} else {
tr.addStyle(HtmlStyle.rowColor);
}
addPackageUse(pkg, tr);
tbody.addContent(tr);
}
table.addContent(tbody);
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
contentTree.addContent(li);
}
|
[
"protected",
"void",
"addPackageList",
"(",
"Content",
"contentTree",
")",
"throws",
"IOException",
"{",
"Content",
"caption",
"=",
"getTableCaption",
"(",
"configuration",
".",
"getResource",
"(",
"\"doclet.ClassUse_Packages.that.use.0\"",
",",
"getLink",
"(",
"new",
"LinkInfoImpl",
"(",
"configuration",
",",
"LinkInfoImpl",
".",
"Kind",
".",
"CLASS_USE_HEADER",
",",
"classdoc",
")",
")",
")",
")",
";",
"Content",
"table",
"=",
"(",
"configuration",
".",
"isOutputHtml5",
"(",
")",
")",
"?",
"HtmlTree",
".",
"TABLE",
"(",
"HtmlStyle",
".",
"useSummary",
",",
"caption",
")",
":",
"HtmlTree",
".",
"TABLE",
"(",
"HtmlStyle",
".",
"useSummary",
",",
"useTableSummary",
",",
"caption",
")",
";",
"table",
".",
"addContent",
"(",
"getSummaryTableHeader",
"(",
"packageTableHeader",
",",
"\"col\"",
")",
")",
";",
"Content",
"tbody",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"TBODY",
")",
";",
"Iterator",
"<",
"PackageDoc",
">",
"it",
"=",
"pkgSet",
".",
"iterator",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"it",
".",
"hasNext",
"(",
")",
";",
"i",
"++",
")",
"{",
"PackageDoc",
"pkg",
"=",
"it",
".",
"next",
"(",
")",
";",
"HtmlTree",
"tr",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"TR",
")",
";",
"if",
"(",
"i",
"%",
"2",
"==",
"0",
")",
"{",
"tr",
".",
"addStyle",
"(",
"HtmlStyle",
".",
"altColor",
")",
";",
"}",
"else",
"{",
"tr",
".",
"addStyle",
"(",
"HtmlStyle",
".",
"rowColor",
")",
";",
"}",
"addPackageUse",
"(",
"pkg",
",",
"tr",
")",
";",
"tbody",
".",
"addContent",
"(",
"tr",
")",
";",
"}",
"table",
".",
"addContent",
"(",
"tbody",
")",
";",
"Content",
"li",
"=",
"HtmlTree",
".",
"LI",
"(",
"HtmlStyle",
".",
"blockList",
",",
"table",
")",
";",
"contentTree",
".",
"addContent",
"(",
"li",
")",
";",
"}"
] |
Add the packages list that use the given class.
@param contentTree the content tree to which the packages list will be added
|
[
"Add",
"the",
"packages",
"list",
"that",
"use",
"the",
"given",
"class",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java#L278-L302
|
5,697 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
|
ClassUseWriter.addPackageAnnotationList
|
protected void addPackageAnnotationList(Content contentTree) throws IOException {
if ((!classdoc.isAnnotationType()) ||
pkgToPackageAnnotations == null ||
pkgToPackageAnnotations.isEmpty()) {
return;
}
Content caption = getTableCaption(configuration.getResource(
"doclet.ClassUse_PackageAnnotation",
getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc))));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
: HtmlTree.TABLE(HtmlStyle.useSummary, useTableSummary, caption);
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
for (int i = 0; it.hasNext(); i++) {
PackageDoc pkg = it.next();
HtmlTree tr = new HtmlTree(HtmlTag.TR);
if (i % 2 == 0) {
tr.addStyle(HtmlStyle.altColor);
} else {
tr.addStyle(HtmlStyle.rowColor);
}
Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
getPackageLink(pkg, new StringContent(pkg.name())));
tr.addContent(tdFirst);
HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
tdLast.addStyle(HtmlStyle.colLast);
addSummaryComment(pkg, tdLast);
tr.addContent(tdLast);
tbody.addContent(tr);
}
table.addContent(tbody);
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
contentTree.addContent(li);
}
|
java
|
protected void addPackageAnnotationList(Content contentTree) throws IOException {
if ((!classdoc.isAnnotationType()) ||
pkgToPackageAnnotations == null ||
pkgToPackageAnnotations.isEmpty()) {
return;
}
Content caption = getTableCaption(configuration.getResource(
"doclet.ClassUse_PackageAnnotation",
getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc))));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
: HtmlTree.TABLE(HtmlStyle.useSummary, useTableSummary, caption);
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
for (int i = 0; it.hasNext(); i++) {
PackageDoc pkg = it.next();
HtmlTree tr = new HtmlTree(HtmlTag.TR);
if (i % 2 == 0) {
tr.addStyle(HtmlStyle.altColor);
} else {
tr.addStyle(HtmlStyle.rowColor);
}
Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
getPackageLink(pkg, new StringContent(pkg.name())));
tr.addContent(tdFirst);
HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
tdLast.addStyle(HtmlStyle.colLast);
addSummaryComment(pkg, tdLast);
tr.addContent(tdLast);
tbody.addContent(tr);
}
table.addContent(tbody);
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
contentTree.addContent(li);
}
|
[
"protected",
"void",
"addPackageAnnotationList",
"(",
"Content",
"contentTree",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"!",
"classdoc",
".",
"isAnnotationType",
"(",
")",
")",
"||",
"pkgToPackageAnnotations",
"==",
"null",
"||",
"pkgToPackageAnnotations",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"Content",
"caption",
"=",
"getTableCaption",
"(",
"configuration",
".",
"getResource",
"(",
"\"doclet.ClassUse_PackageAnnotation\"",
",",
"getLink",
"(",
"new",
"LinkInfoImpl",
"(",
"configuration",
",",
"LinkInfoImpl",
".",
"Kind",
".",
"CLASS_USE_HEADER",
",",
"classdoc",
")",
")",
")",
")",
";",
"Content",
"table",
"=",
"(",
"configuration",
".",
"isOutputHtml5",
"(",
")",
")",
"?",
"HtmlTree",
".",
"TABLE",
"(",
"HtmlStyle",
".",
"useSummary",
",",
"caption",
")",
":",
"HtmlTree",
".",
"TABLE",
"(",
"HtmlStyle",
".",
"useSummary",
",",
"useTableSummary",
",",
"caption",
")",
";",
"table",
".",
"addContent",
"(",
"getSummaryTableHeader",
"(",
"packageTableHeader",
",",
"\"col\"",
")",
")",
";",
"Content",
"tbody",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"TBODY",
")",
";",
"Iterator",
"<",
"PackageDoc",
">",
"it",
"=",
"pkgToPackageAnnotations",
".",
"iterator",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"it",
".",
"hasNext",
"(",
")",
";",
"i",
"++",
")",
"{",
"PackageDoc",
"pkg",
"=",
"it",
".",
"next",
"(",
")",
";",
"HtmlTree",
"tr",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"TR",
")",
";",
"if",
"(",
"i",
"%",
"2",
"==",
"0",
")",
"{",
"tr",
".",
"addStyle",
"(",
"HtmlStyle",
".",
"altColor",
")",
";",
"}",
"else",
"{",
"tr",
".",
"addStyle",
"(",
"HtmlStyle",
".",
"rowColor",
")",
";",
"}",
"Content",
"tdFirst",
"=",
"HtmlTree",
".",
"TD",
"(",
"HtmlStyle",
".",
"colFirst",
",",
"getPackageLink",
"(",
"pkg",
",",
"new",
"StringContent",
"(",
"pkg",
".",
"name",
"(",
")",
")",
")",
")",
";",
"tr",
".",
"addContent",
"(",
"tdFirst",
")",
";",
"HtmlTree",
"tdLast",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"TD",
")",
";",
"tdLast",
".",
"addStyle",
"(",
"HtmlStyle",
".",
"colLast",
")",
";",
"addSummaryComment",
"(",
"pkg",
",",
"tdLast",
")",
";",
"tr",
".",
"addContent",
"(",
"tdLast",
")",
";",
"tbody",
".",
"addContent",
"(",
"tr",
")",
";",
"}",
"table",
".",
"addContent",
"(",
"tbody",
")",
";",
"Content",
"li",
"=",
"HtmlTree",
".",
"LI",
"(",
"HtmlStyle",
".",
"blockList",
",",
"table",
")",
";",
"contentTree",
".",
"addContent",
"(",
"li",
")",
";",
"}"
] |
Add the package annotation list.
@param contentTree the content tree to which the package annotation list will be added
|
[
"Add",
"the",
"package",
"annotation",
"list",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java#L309-L345
|
5,698 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
|
ClassUseWriter.getClassUseHeader
|
protected HtmlTree getClassUseHeader() {
String cltype = configuration.getText(classdoc.isInterface()?
"doclet.Interface":"doclet.Class");
String clname = classdoc.qualifiedName();
String title = configuration.getText("doclet.Window_ClassUse_Header",
cltype, clname);
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
ContentBuilder headContent = new ContentBuilder();
headContent.addContent(getResource("doclet.ClassUse_Title", cltype));
headContent.addContent(new HtmlTree(HtmlTag.BR));
headContent.addContent(clname);
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
true, HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
}
|
java
|
protected HtmlTree getClassUseHeader() {
String cltype = configuration.getText(classdoc.isInterface()?
"doclet.Interface":"doclet.Class");
String clname = classdoc.qualifiedName();
String title = configuration.getText("doclet.Window_ClassUse_Header",
cltype, clname);
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
ContentBuilder headContent = new ContentBuilder();
headContent.addContent(getResource("doclet.ClassUse_Title", cltype));
headContent.addContent(new HtmlTree(HtmlTag.BR));
headContent.addContent(clname);
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
true, HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
}
|
[
"protected",
"HtmlTree",
"getClassUseHeader",
"(",
")",
"{",
"String",
"cltype",
"=",
"configuration",
".",
"getText",
"(",
"classdoc",
".",
"isInterface",
"(",
")",
"?",
"\"doclet.Interface\"",
":",
"\"doclet.Class\"",
")",
";",
"String",
"clname",
"=",
"classdoc",
".",
"qualifiedName",
"(",
")",
";",
"String",
"title",
"=",
"configuration",
".",
"getText",
"(",
"\"doclet.Window_ClassUse_Header\"",
",",
"cltype",
",",
"clname",
")",
";",
"HtmlTree",
"bodyTree",
"=",
"getBody",
"(",
"true",
",",
"getWindowTitle",
"(",
"title",
")",
")",
";",
"HtmlTree",
"htmlTree",
"=",
"(",
"configuration",
".",
"allowTag",
"(",
"HtmlTag",
".",
"HEADER",
")",
")",
"?",
"HtmlTree",
".",
"HEADER",
"(",
")",
":",
"bodyTree",
";",
"addTop",
"(",
"htmlTree",
")",
";",
"addNavLinks",
"(",
"true",
",",
"htmlTree",
")",
";",
"if",
"(",
"configuration",
".",
"allowTag",
"(",
"HtmlTag",
".",
"HEADER",
")",
")",
"{",
"bodyTree",
".",
"addContent",
"(",
"htmlTree",
")",
";",
"}",
"ContentBuilder",
"headContent",
"=",
"new",
"ContentBuilder",
"(",
")",
";",
"headContent",
".",
"addContent",
"(",
"getResource",
"(",
"\"doclet.ClassUse_Title\"",
",",
"cltype",
")",
")",
";",
"headContent",
".",
"addContent",
"(",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"BR",
")",
")",
";",
"headContent",
".",
"addContent",
"(",
"clname",
")",
";",
"Content",
"heading",
"=",
"HtmlTree",
".",
"HEADING",
"(",
"HtmlConstants",
".",
"CLASS_PAGE_HEADING",
",",
"true",
",",
"HtmlStyle",
".",
"title",
",",
"headContent",
")",
";",
"Content",
"div",
"=",
"HtmlTree",
".",
"DIV",
"(",
"HtmlStyle",
".",
"header",
",",
"heading",
")",
";",
"if",
"(",
"configuration",
".",
"allowTag",
"(",
"HtmlTag",
".",
"MAIN",
")",
")",
"{",
"mainTree",
".",
"addContent",
"(",
"div",
")",
";",
"}",
"else",
"{",
"bodyTree",
".",
"addContent",
"(",
"div",
")",
";",
"}",
"return",
"bodyTree",
";",
"}"
] |
Get the header for the class use Listing.
@return a content tree representing the class use header
|
[
"Get",
"the",
"header",
"for",
"the",
"class",
"use",
"Listing",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java#L473-L501
|
5,699 |
google/error-prone-javac
|
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
|
ClassUseWriter.getNavLinkPackage
|
protected Content getNavLinkPackage() {
Content linkContent =
getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY), packageLabel);
Content li = HtmlTree.LI(linkContent);
return li;
}
|
java
|
protected Content getNavLinkPackage() {
Content linkContent =
getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY), packageLabel);
Content li = HtmlTree.LI(linkContent);
return li;
}
|
[
"protected",
"Content",
"getNavLinkPackage",
"(",
")",
"{",
"Content",
"linkContent",
"=",
"getHyperLink",
"(",
"DocPath",
".",
"parent",
".",
"resolve",
"(",
"DocPaths",
".",
"PACKAGE_SUMMARY",
")",
",",
"packageLabel",
")",
";",
"Content",
"li",
"=",
"HtmlTree",
".",
"LI",
"(",
"linkContent",
")",
";",
"return",
"li",
";",
"}"
] |
Get this package link.
@return a content tree for the package link
|
[
"Get",
"this",
"package",
"link",
"."
] |
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java#L508-L513
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.