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,500
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
ClassWriter.putInt
void putInt(ByteBuffer buf, int adr, int x) { buf.elems[adr ] = (byte)((x >> 24) & 0xFF); buf.elems[adr+1] = (byte)((x >> 16) & 0xFF); buf.elems[adr+2] = (byte)((x >> 8) & 0xFF); buf.elems[adr+3] = (byte)((x ) & 0xFF); }
java
void putInt(ByteBuffer buf, int adr, int x) { buf.elems[adr ] = (byte)((x >> 24) & 0xFF); buf.elems[adr+1] = (byte)((x >> 16) & 0xFF); buf.elems[adr+2] = (byte)((x >> 8) & 0xFF); buf.elems[adr+3] = (byte)((x ) & 0xFF); }
[ "void", "putInt", "(", "ByteBuffer", "buf", ",", "int", "adr", ",", "int", "x", ")", "{", "buf", ".", "elems", "[", "adr", "]", "=", "(", "byte", ")", "(", "(", "x", ">>", "24", ")", "&", "0xFF", ")", ";", "buf", ".", "elems", "[", "adr", "+", "1", "]", "=", "(", "byte", ")", "(", "(", "x", ">>", "16", ")", "&", "0xFF", ")", ";", "buf", ".", "elems", "[", "adr", "+", "2", "]", "=", "(", "byte", ")", "(", "(", "x", ">>", "8", ")", "&", "0xFF", ")", ";", "buf", ".", "elems", "[", "adr", "+", "3", "]", "=", "(", "byte", ")", "(", "(", "x", ")", "&", "0xFF", ")", ";", "}" ]
Write an integer into given byte buffer; byte buffer will not be grown.
[ "Write", "an", "integer", "into", "given", "byte", "buffer", ";", "byte", "buffer", "will", "not", "be", "grown", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java#L256-L261
5,501
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
ClassWriter.typeSig
Name typeSig(Type type) { Assert.check(signatureGen.isEmpty()); //- System.out.println(" ? " + type); signatureGen.assembleSig(type); Name n = signatureGen.toName(); signatureGen.reset(); //- System.out.println(" " + n); return n; }
java
Name typeSig(Type type) { Assert.check(signatureGen.isEmpty()); //- System.out.println(" ? " + type); signatureGen.assembleSig(type); Name n = signatureGen.toName(); signatureGen.reset(); //- System.out.println(" " + n); return n; }
[ "Name", "typeSig", "(", "Type", "type", ")", "{", "Assert", ".", "check", "(", "signatureGen", ".", "isEmpty", "(", ")", ")", ";", "//- System.out.println(\" ? \" + type);", "signatureGen", ".", "assembleSig", "(", "type", ")", ";", "Name", "n", "=", "signatureGen", ".", "toName", "(", ")", ";", "signatureGen", ".", "reset", "(", ")", ";", "//- System.out.println(\" \" + n);", "return", "n", ";", "}" ]
Return signature of given type
[ "Return", "signature", "of", "given", "type" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java#L331-L339
5,502
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
ClassWriter.writeAttr
int writeAttr(Name attrName) { databuf.appendChar(pool.put(attrName)); databuf.appendInt(0); return databuf.length; }
java
int writeAttr(Name attrName) { databuf.appendChar(pool.put(attrName)); databuf.appendInt(0); return databuf.length; }
[ "int", "writeAttr", "(", "Name", "attrName", ")", "{", "databuf", ".", "appendChar", "(", "pool", ".", "put", "(", "attrName", ")", ")", ";", "databuf", ".", "appendInt", "(", "0", ")", ";", "return", "databuf", ".", "length", ";", "}" ]
Write header for an attribute to data buffer and return position past attribute length index.
[ "Write", "header", "for", "an", "attribute", "to", "data", "buffer", "and", "return", "position", "past", "attribute", "length", "index", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java#L510-L514
5,503
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
ClassWriter.writeMethodParametersAttr
int writeMethodParametersAttr(MethodSymbol m) { MethodType ty = m.externalType(types).asMethodType(); final int allparams = ty.argtypes.size(); if (m.params != null && allparams != 0) { final int attrIndex = writeAttr(names.MethodParameters); databuf.appendByte(allparams); // Write extra parameters first for (VarSymbol s : m.extraParams) { final int flags = ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) | ((int) m.flags() & SYNTHETIC); databuf.appendChar(pool.put(s.name)); databuf.appendChar(flags); } // Now write the real parameters for (VarSymbol s : m.params) { final int flags = ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) | ((int) m.flags() & SYNTHETIC); databuf.appendChar(pool.put(s.name)); databuf.appendChar(flags); } // Now write the captured locals for (VarSymbol s : m.capturedLocals) { final int flags = ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) | ((int) m.flags() & SYNTHETIC); databuf.appendChar(pool.put(s.name)); databuf.appendChar(flags); } endAttr(attrIndex); return 1; } else return 0; }
java
int writeMethodParametersAttr(MethodSymbol m) { MethodType ty = m.externalType(types).asMethodType(); final int allparams = ty.argtypes.size(); if (m.params != null && allparams != 0) { final int attrIndex = writeAttr(names.MethodParameters); databuf.appendByte(allparams); // Write extra parameters first for (VarSymbol s : m.extraParams) { final int flags = ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) | ((int) m.flags() & SYNTHETIC); databuf.appendChar(pool.put(s.name)); databuf.appendChar(flags); } // Now write the real parameters for (VarSymbol s : m.params) { final int flags = ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) | ((int) m.flags() & SYNTHETIC); databuf.appendChar(pool.put(s.name)); databuf.appendChar(flags); } // Now write the captured locals for (VarSymbol s : m.capturedLocals) { final int flags = ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) | ((int) m.flags() & SYNTHETIC); databuf.appendChar(pool.put(s.name)); databuf.appendChar(flags); } endAttr(attrIndex); return 1; } else return 0; }
[ "int", "writeMethodParametersAttr", "(", "MethodSymbol", "m", ")", "{", "MethodType", "ty", "=", "m", ".", "externalType", "(", "types", ")", ".", "asMethodType", "(", ")", ";", "final", "int", "allparams", "=", "ty", ".", "argtypes", ".", "size", "(", ")", ";", "if", "(", "m", ".", "params", "!=", "null", "&&", "allparams", "!=", "0", ")", "{", "final", "int", "attrIndex", "=", "writeAttr", "(", "names", ".", "MethodParameters", ")", ";", "databuf", ".", "appendByte", "(", "allparams", ")", ";", "// Write extra parameters first", "for", "(", "VarSymbol", "s", ":", "m", ".", "extraParams", ")", "{", "final", "int", "flags", "=", "(", "(", "int", ")", "s", ".", "flags", "(", ")", "&", "(", "FINAL", "|", "SYNTHETIC", "|", "MANDATED", ")", ")", "|", "(", "(", "int", ")", "m", ".", "flags", "(", ")", "&", "SYNTHETIC", ")", ";", "databuf", ".", "appendChar", "(", "pool", ".", "put", "(", "s", ".", "name", ")", ")", ";", "databuf", ".", "appendChar", "(", "flags", ")", ";", "}", "// Now write the real parameters", "for", "(", "VarSymbol", "s", ":", "m", ".", "params", ")", "{", "final", "int", "flags", "=", "(", "(", "int", ")", "s", ".", "flags", "(", ")", "&", "(", "FINAL", "|", "SYNTHETIC", "|", "MANDATED", ")", ")", "|", "(", "(", "int", ")", "m", ".", "flags", "(", ")", "&", "SYNTHETIC", ")", ";", "databuf", ".", "appendChar", "(", "pool", ".", "put", "(", "s", ".", "name", ")", ")", ";", "databuf", ".", "appendChar", "(", "flags", ")", ";", "}", "// Now write the captured locals", "for", "(", "VarSymbol", "s", ":", "m", ".", "capturedLocals", ")", "{", "final", "int", "flags", "=", "(", "(", "int", ")", "s", ".", "flags", "(", ")", "&", "(", "FINAL", "|", "SYNTHETIC", "|", "MANDATED", ")", ")", "|", "(", "(", "int", ")", "m", ".", "flags", "(", ")", "&", "SYNTHETIC", ")", ";", "databuf", ".", "appendChar", "(", "pool", ".", "put", "(", "s", ".", "name", ")", ")", ";", "databuf", ".", "appendChar", "(", "flags", ")", ";", "}", "endAttr", "(", "attrIndex", ")", ";", "return", "1", ";", "}", "else", "return", "0", ";", "}" ]
Write method parameter names attribute.
[ "Write", "method", "parameter", "names", "attribute", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java#L601-L635
5,504
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
ClassWriter.writeCompoundAttribute
void writeCompoundAttribute(Attribute.Compound c) { databuf.appendChar(pool.put(typeSig(c.type))); databuf.appendChar(c.values.length()); for (Pair<Symbol.MethodSymbol,Attribute> p : c.values) { databuf.appendChar(pool.put(p.fst.name)); p.snd.accept(awriter); } }
java
void writeCompoundAttribute(Attribute.Compound c) { databuf.appendChar(pool.put(typeSig(c.type))); databuf.appendChar(c.values.length()); for (Pair<Symbol.MethodSymbol,Attribute> p : c.values) { databuf.appendChar(pool.put(p.fst.name)); p.snd.accept(awriter); } }
[ "void", "writeCompoundAttribute", "(", "Attribute", ".", "Compound", "c", ")", "{", "databuf", ".", "appendChar", "(", "pool", ".", "put", "(", "typeSig", "(", "c", ".", "type", ")", ")", ")", ";", "databuf", ".", "appendChar", "(", "c", ".", "values", ".", "length", "(", ")", ")", ";", "for", "(", "Pair", "<", "Symbol", ".", "MethodSymbol", ",", "Attribute", ">", "p", ":", "c", ".", "values", ")", "{", "databuf", ".", "appendChar", "(", "pool", ".", "put", "(", "p", ".", "fst", ".", "name", ")", ")", ";", "p", ".", "snd", ".", "accept", "(", "awriter", ")", ";", "}", "}" ]
Write a compound attribute excluding the '@' marker.
[ "Write", "a", "compound", "attribute", "excluding", "the" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java#L857-L864
5,505
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
ClassWriter.writeInnerClasses
void writeInnerClasses() { int alenIdx = writeAttr(names.InnerClasses); databuf.appendChar(innerClassesQueue.length()); for (List<ClassSymbol> l = innerClassesQueue.toList(); l.nonEmpty(); l = l.tail) { ClassSymbol inner = l.head; inner.markAbstractIfNeeded(types); char flags = (char) adjustFlags(inner.flags_field); if ((flags & INTERFACE) != 0) flags |= ABSTRACT; // Interfaces are always ABSTRACT flags &= ~STRICTFP; //inner classes should not have the strictfp flag set. if (dumpInnerClassModifiers) { PrintWriter pw = log.getWriter(Log.WriterKind.ERROR); pw.println("INNERCLASS " + inner.name); pw.println("---" + flagNames(flags)); } databuf.appendChar(pool.get(inner)); databuf.appendChar( inner.owner.kind == TYP && !inner.name.isEmpty() ? pool.get(inner.owner) : 0); databuf.appendChar( !inner.name.isEmpty() ? pool.get(inner.name) : 0); databuf.appendChar(flags); } endAttr(alenIdx); }
java
void writeInnerClasses() { int alenIdx = writeAttr(names.InnerClasses); databuf.appendChar(innerClassesQueue.length()); for (List<ClassSymbol> l = innerClassesQueue.toList(); l.nonEmpty(); l = l.tail) { ClassSymbol inner = l.head; inner.markAbstractIfNeeded(types); char flags = (char) adjustFlags(inner.flags_field); if ((flags & INTERFACE) != 0) flags |= ABSTRACT; // Interfaces are always ABSTRACT flags &= ~STRICTFP; //inner classes should not have the strictfp flag set. if (dumpInnerClassModifiers) { PrintWriter pw = log.getWriter(Log.WriterKind.ERROR); pw.println("INNERCLASS " + inner.name); pw.println("---" + flagNames(flags)); } databuf.appendChar(pool.get(inner)); databuf.appendChar( inner.owner.kind == TYP && !inner.name.isEmpty() ? pool.get(inner.owner) : 0); databuf.appendChar( !inner.name.isEmpty() ? pool.get(inner.name) : 0); databuf.appendChar(flags); } endAttr(alenIdx); }
[ "void", "writeInnerClasses", "(", ")", "{", "int", "alenIdx", "=", "writeAttr", "(", "names", ".", "InnerClasses", ")", ";", "databuf", ".", "appendChar", "(", "innerClassesQueue", ".", "length", "(", ")", ")", ";", "for", "(", "List", "<", "ClassSymbol", ">", "l", "=", "innerClassesQueue", ".", "toList", "(", ")", ";", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", ".", "tail", ")", "{", "ClassSymbol", "inner", "=", "l", ".", "head", ";", "inner", ".", "markAbstractIfNeeded", "(", "types", ")", ";", "char", "flags", "=", "(", "char", ")", "adjustFlags", "(", "inner", ".", "flags_field", ")", ";", "if", "(", "(", "flags", "&", "INTERFACE", ")", "!=", "0", ")", "flags", "|=", "ABSTRACT", ";", "// Interfaces are always ABSTRACT", "flags", "&=", "~", "STRICTFP", ";", "//inner classes should not have the strictfp flag set.", "if", "(", "dumpInnerClassModifiers", ")", "{", "PrintWriter", "pw", "=", "log", ".", "getWriter", "(", "Log", ".", "WriterKind", ".", "ERROR", ")", ";", "pw", ".", "println", "(", "\"INNERCLASS \"", "+", "inner", ".", "name", ")", ";", "pw", ".", "println", "(", "\"---\"", "+", "flagNames", "(", "flags", ")", ")", ";", "}", "databuf", ".", "appendChar", "(", "pool", ".", "get", "(", "inner", ")", ")", ";", "databuf", ".", "appendChar", "(", "inner", ".", "owner", ".", "kind", "==", "TYP", "&&", "!", "inner", ".", "name", ".", "isEmpty", "(", ")", "?", "pool", ".", "get", "(", "inner", ".", "owner", ")", ":", "0", ")", ";", "databuf", ".", "appendChar", "(", "!", "inner", ".", "name", ".", "isEmpty", "(", ")", "?", "pool", ".", "get", "(", "inner", ".", "name", ")", ":", "0", ")", ";", "databuf", ".", "appendChar", "(", "flags", ")", ";", "}", "endAttr", "(", "alenIdx", ")", ";", "}" ]
Write "inner classes" attribute.
[ "Write", "inner", "classes", "attribute", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java#L1072-L1096
5,506
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
ClassWriter.writeField
void writeField(VarSymbol v) { int flags = adjustFlags(v.flags()); databuf.appendChar(flags); if (dumpFieldModifiers) { PrintWriter pw = log.getWriter(Log.WriterKind.ERROR); pw.println("FIELD " + v.name); pw.println("---" + flagNames(v.flags())); } databuf.appendChar(pool.put(v.name)); databuf.appendChar(pool.put(typeSig(v.erasure(types)))); int acountIdx = beginAttrs(); int acount = 0; if (v.getConstValue() != null) { int alenIdx = writeAttr(names.ConstantValue); databuf.appendChar(pool.put(v.getConstValue())); endAttr(alenIdx); acount++; } acount += writeMemberAttrs(v); endAttrs(acountIdx, acount); }
java
void writeField(VarSymbol v) { int flags = adjustFlags(v.flags()); databuf.appendChar(flags); if (dumpFieldModifiers) { PrintWriter pw = log.getWriter(Log.WriterKind.ERROR); pw.println("FIELD " + v.name); pw.println("---" + flagNames(v.flags())); } databuf.appendChar(pool.put(v.name)); databuf.appendChar(pool.put(typeSig(v.erasure(types)))); int acountIdx = beginAttrs(); int acount = 0; if (v.getConstValue() != null) { int alenIdx = writeAttr(names.ConstantValue); databuf.appendChar(pool.put(v.getConstValue())); endAttr(alenIdx); acount++; } acount += writeMemberAttrs(v); endAttrs(acountIdx, acount); }
[ "void", "writeField", "(", "VarSymbol", "v", ")", "{", "int", "flags", "=", "adjustFlags", "(", "v", ".", "flags", "(", ")", ")", ";", "databuf", ".", "appendChar", "(", "flags", ")", ";", "if", "(", "dumpFieldModifiers", ")", "{", "PrintWriter", "pw", "=", "log", ".", "getWriter", "(", "Log", ".", "WriterKind", ".", "ERROR", ")", ";", "pw", ".", "println", "(", "\"FIELD \"", "+", "v", ".", "name", ")", ";", "pw", ".", "println", "(", "\"---\"", "+", "flagNames", "(", "v", ".", "flags", "(", ")", ")", ")", ";", "}", "databuf", ".", "appendChar", "(", "pool", ".", "put", "(", "v", ".", "name", ")", ")", ";", "databuf", ".", "appendChar", "(", "pool", ".", "put", "(", "typeSig", "(", "v", ".", "erasure", "(", "types", ")", ")", ")", ")", ";", "int", "acountIdx", "=", "beginAttrs", "(", ")", ";", "int", "acount", "=", "0", ";", "if", "(", "v", ".", "getConstValue", "(", ")", "!=", "null", ")", "{", "int", "alenIdx", "=", "writeAttr", "(", "names", ".", "ConstantValue", ")", ";", "databuf", ".", "appendChar", "(", "pool", ".", "put", "(", "v", ".", "getConstValue", "(", ")", ")", ")", ";", "endAttr", "(", "alenIdx", ")", ";", "acount", "++", ";", "}", "acount", "+=", "writeMemberAttrs", "(", "v", ")", ";", "endAttrs", "(", "acountIdx", ",", "acount", ")", ";", "}" ]
Write field symbol, entering all references into constant pool.
[ "Write", "field", "symbol", "entering", "all", "references", "into", "constant", "pool", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java#L1120-L1140
5,507
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visit
public final R visit(DocTree node, P p) { return (node == null) ? null : node.accept(this, p); }
java
public final R visit(DocTree node, P p) { return (node == null) ? null : node.accept(this, p); }
[ "public", "final", "R", "visit", "(", "DocTree", "node", ",", "P", "p", ")", "{", "return", "(", "node", "==", "null", ")", "?", "null", ":", "node", ".", "accept", "(", "this", ",", "p", ")", ";", "}" ]
Invokes the appropriate visit method specific to the type of the node. @param node the node on which to dispatch @param p a parameter to be passed to the appropriate visit method @return the value returns from the appropriate visit method
[ "Invokes", "the", "appropriate", "visit", "method", "specific", "to", "the", "type", "of", "the", "node", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L78-L80
5,508
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visit
public final R visit(Iterable<? extends DocTree> nodes, P p) { R r = null; if (nodes != null) { for (DocTree node : nodes) r = visit(node, p); } return r; }
java
public final R visit(Iterable<? extends DocTree> nodes, P p) { R r = null; if (nodes != null) { for (DocTree node : nodes) r = visit(node, p); } return r; }
[ "public", "final", "R", "visit", "(", "Iterable", "<", "?", "extends", "DocTree", ">", "nodes", ",", "P", "p", ")", "{", "R", "r", "=", "null", ";", "if", "(", "nodes", "!=", "null", ")", "{", "for", "(", "DocTree", "node", ":", "nodes", ")", "r", "=", "visit", "(", "node", ",", "p", ")", ";", "}", "return", "r", ";", "}" ]
Invokes the appropriate visit method on each of a sequence of nodes. @param nodes the nodes on which to dispatch @param p a parameter value to be passed to each appropriate visit method @return the value return from the last of the visit methods, or null if none were called.
[ "Invokes", "the", "appropriate", "visit", "method", "on", "each", "of", "a", "sequence", "of", "nodes", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L89-L96
5,509
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java
ParamTaglet.getInheritedTagletOutput
private Content getInheritedTagletOutput(boolean isParameters, Element holder, TagletWriter writer, List<? extends Element> formalParameters, Set<String> alreadyDocumented) { Utils utils = writer.configuration().utils; Content result = writer.getOutputInstance(); if ((!alreadyDocumented.contains(null)) && utils.isExecutableElement(holder)) { for (int i = 0; i < formalParameters.size(); i++) { if (alreadyDocumented.contains(String.valueOf(i))) { continue; } // This parameter does not have any @param documentation. // Try to inherit it. Input input = new DocFinder.Input(writer.configuration().utils, holder, this, Integer.toString(i), !isParameters); DocFinder.Output inheritedDoc = DocFinder.search(writer.configuration(), input); if (inheritedDoc.inlineTags != null && !inheritedDoc.inlineTags.isEmpty()) { Element e = formalParameters.get(i); String lname = isParameters ? utils.getSimpleName(e) : utils.getTypeName(e.asType(), false); CommentHelper ch = utils.getCommentHelper(holder); ch.setOverrideElement(inheritedDoc.holder); Content content = processParamTag(holder, isParameters, writer, inheritedDoc.holderTag, lname, alreadyDocumented.isEmpty()); result.addContent(content); } alreadyDocumented.add(String.valueOf(i)); } } return result; }
java
private Content getInheritedTagletOutput(boolean isParameters, Element holder, TagletWriter writer, List<? extends Element> formalParameters, Set<String> alreadyDocumented) { Utils utils = writer.configuration().utils; Content result = writer.getOutputInstance(); if ((!alreadyDocumented.contains(null)) && utils.isExecutableElement(holder)) { for (int i = 0; i < formalParameters.size(); i++) { if (alreadyDocumented.contains(String.valueOf(i))) { continue; } // This parameter does not have any @param documentation. // Try to inherit it. Input input = new DocFinder.Input(writer.configuration().utils, holder, this, Integer.toString(i), !isParameters); DocFinder.Output inheritedDoc = DocFinder.search(writer.configuration(), input); if (inheritedDoc.inlineTags != null && !inheritedDoc.inlineTags.isEmpty()) { Element e = formalParameters.get(i); String lname = isParameters ? utils.getSimpleName(e) : utils.getTypeName(e.asType(), false); CommentHelper ch = utils.getCommentHelper(holder); ch.setOverrideElement(inheritedDoc.holder); Content content = processParamTag(holder, isParameters, writer, inheritedDoc.holderTag, lname, alreadyDocumented.isEmpty()); result.addContent(content); } alreadyDocumented.add(String.valueOf(i)); } } return result; }
[ "private", "Content", "getInheritedTagletOutput", "(", "boolean", "isParameters", ",", "Element", "holder", ",", "TagletWriter", "writer", ",", "List", "<", "?", "extends", "Element", ">", "formalParameters", ",", "Set", "<", "String", ">", "alreadyDocumented", ")", "{", "Utils", "utils", "=", "writer", ".", "configuration", "(", ")", ".", "utils", ";", "Content", "result", "=", "writer", ".", "getOutputInstance", "(", ")", ";", "if", "(", "(", "!", "alreadyDocumented", ".", "contains", "(", "null", ")", ")", "&&", "utils", ".", "isExecutableElement", "(", "holder", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "formalParameters", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "alreadyDocumented", ".", "contains", "(", "String", ".", "valueOf", "(", "i", ")", ")", ")", "{", "continue", ";", "}", "// This parameter does not have any @param documentation.", "// Try to inherit it.", "Input", "input", "=", "new", "DocFinder", ".", "Input", "(", "writer", ".", "configuration", "(", ")", ".", "utils", ",", "holder", ",", "this", ",", "Integer", ".", "toString", "(", "i", ")", ",", "!", "isParameters", ")", ";", "DocFinder", ".", "Output", "inheritedDoc", "=", "DocFinder", ".", "search", "(", "writer", ".", "configuration", "(", ")", ",", "input", ")", ";", "if", "(", "inheritedDoc", ".", "inlineTags", "!=", "null", "&&", "!", "inheritedDoc", ".", "inlineTags", ".", "isEmpty", "(", ")", ")", "{", "Element", "e", "=", "formalParameters", ".", "get", "(", "i", ")", ";", "String", "lname", "=", "isParameters", "?", "utils", ".", "getSimpleName", "(", "e", ")", ":", "utils", ".", "getTypeName", "(", "e", ".", "asType", "(", ")", ",", "false", ")", ";", "CommentHelper", "ch", "=", "utils", ".", "getCommentHelper", "(", "holder", ")", ";", "ch", ".", "setOverrideElement", "(", "inheritedDoc", ".", "holder", ")", ";", "Content", "content", "=", "processParamTag", "(", "holder", ",", "isParameters", ",", "writer", ",", "inheritedDoc", ".", "holderTag", ",", "lname", ",", "alreadyDocumented", ".", "isEmpty", "(", ")", ")", ";", "result", ".", "addContent", "(", "content", ")", ";", "}", "alreadyDocumented", ".", "add", "(", "String", ".", "valueOf", "(", "i", ")", ")", ";", "}", "}", "return", "result", ";", "}" ]
Loop through each individual parameter, despite not having a corresponding param tag, try to inherit it.
[ "Loop", "through", "each", "individual", "parameter", "despite", "not", "having", "a", "corresponding", "param", "tag", "try", "to", "inherit", "it", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java#L237-L269
5,510
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java
Graph.reduce
public Graph<T> reduce() { Builder<T> builder = new Builder<>(); nodes.stream() .forEach(u -> { builder.addNode(u); edges.get(u).stream() .filter(v -> !pathExists(u, v, false)) .forEach(v -> builder.addEdge(u, v)); }); return builder.build(); }
java
public Graph<T> reduce() { Builder<T> builder = new Builder<>(); nodes.stream() .forEach(u -> { builder.addNode(u); edges.get(u).stream() .filter(v -> !pathExists(u, v, false)) .forEach(v -> builder.addEdge(u, v)); }); return builder.build(); }
[ "public", "Graph", "<", "T", ">", "reduce", "(", ")", "{", "Builder", "<", "T", ">", "builder", "=", "new", "Builder", "<>", "(", ")", ";", "nodes", ".", "stream", "(", ")", ".", "forEach", "(", "u", "->", "{", "builder", ".", "addNode", "(", "u", ")", ";", "edges", ".", "get", "(", "u", ")", ".", "stream", "(", ")", ".", "filter", "(", "v", "->", "!", "pathExists", "(", "u", ",", "v", ",", "false", ")", ")", ".", "forEach", "(", "v", "->", "builder", ".", "addEdge", "(", "u", ",", "v", ")", ")", ";", "}", ")", ";", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Returns a new Graph after transitive reduction
[ "Returns", "a", "new", "Graph", "after", "transitive", "reduction" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java#L77-L87
5,511
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java
Graph.reduce
public Graph<T> reduce(Graph<T> g) { boolean subgraph = nodes.containsAll(g.nodes) && g.edges.keySet().stream() .allMatch(u -> adjacentNodes(u).containsAll(g.adjacentNodes(u))); if (!subgraph) { throw new IllegalArgumentException(g + " is not a subgraph of " + this); } Builder<T> builder = new Builder<>(); nodes.stream() .forEach(u -> { builder.addNode(u); // filter the edge if there exists a path from u to v in the given g // or there exists another path from u to v in this graph edges.get(u).stream() .filter(v -> !g.pathExists(u, v) && !pathExists(u, v, false)) .forEach(v -> builder.addEdge(u, v)); }); // add the overlapped edges from this graph and the given g g.edges().keySet().stream() .forEach(u -> g.adjacentNodes(u).stream() .filter(v -> isAdjacent(u, v)) .forEach(v -> builder.addEdge(u, v))); return builder.build().reduce(); }
java
public Graph<T> reduce(Graph<T> g) { boolean subgraph = nodes.containsAll(g.nodes) && g.edges.keySet().stream() .allMatch(u -> adjacentNodes(u).containsAll(g.adjacentNodes(u))); if (!subgraph) { throw new IllegalArgumentException(g + " is not a subgraph of " + this); } Builder<T> builder = new Builder<>(); nodes.stream() .forEach(u -> { builder.addNode(u); // filter the edge if there exists a path from u to v in the given g // or there exists another path from u to v in this graph edges.get(u).stream() .filter(v -> !g.pathExists(u, v) && !pathExists(u, v, false)) .forEach(v -> builder.addEdge(u, v)); }); // add the overlapped edges from this graph and the given g g.edges().keySet().stream() .forEach(u -> g.adjacentNodes(u).stream() .filter(v -> isAdjacent(u, v)) .forEach(v -> builder.addEdge(u, v))); return builder.build().reduce(); }
[ "public", "Graph", "<", "T", ">", "reduce", "(", "Graph", "<", "T", ">", "g", ")", "{", "boolean", "subgraph", "=", "nodes", ".", "containsAll", "(", "g", ".", "nodes", ")", "&&", "g", ".", "edges", ".", "keySet", "(", ")", ".", "stream", "(", ")", ".", "allMatch", "(", "u", "->", "adjacentNodes", "(", "u", ")", ".", "containsAll", "(", "g", ".", "adjacentNodes", "(", "u", ")", ")", ")", ";", "if", "(", "!", "subgraph", ")", "{", "throw", "new", "IllegalArgumentException", "(", "g", "+", "\" is not a subgraph of \"", "+", "this", ")", ";", "}", "Builder", "<", "T", ">", "builder", "=", "new", "Builder", "<>", "(", ")", ";", "nodes", ".", "stream", "(", ")", ".", "forEach", "(", "u", "->", "{", "builder", ".", "addNode", "(", "u", ")", ";", "// filter the edge if there exists a path from u to v in the given g", "// or there exists another path from u to v in this graph", "edges", ".", "get", "(", "u", ")", ".", "stream", "(", ")", ".", "filter", "(", "v", "->", "!", "g", ".", "pathExists", "(", "u", ",", "v", ")", "&&", "!", "pathExists", "(", "u", ",", "v", ",", "false", ")", ")", ".", "forEach", "(", "v", "->", "builder", ".", "addEdge", "(", "u", ",", "v", ")", ")", ";", "}", ")", ";", "// add the overlapped edges from this graph and the given g", "g", ".", "edges", "(", ")", ".", "keySet", "(", ")", ".", "stream", "(", ")", ".", "forEach", "(", "u", "->", "g", ".", "adjacentNodes", "(", "u", ")", ".", "stream", "(", ")", ".", "filter", "(", "v", "->", "isAdjacent", "(", "u", ",", "v", ")", ")", ".", "forEach", "(", "v", "->", "builder", ".", "addEdge", "(", "u", ",", "v", ")", ")", ")", ";", "return", "builder", ".", "build", "(", ")", ".", "reduce", "(", ")", ";", "}" ]
Returns a new Graph after transitive reduction. All edges in the given g takes precedence over this graph. @throw IllegalArgumentException g must be a subgraph this graph
[ "Returns", "a", "new", "Graph", "after", "transitive", "reduction", ".", "All", "edges", "in", "the", "given", "g", "takes", "precedence", "over", "this", "graph", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java#L95-L120
5,512
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java
Graph.orderedNodes
public Stream<T> orderedNodes() { TopoSorter<T> sorter = new TopoSorter<>(this); return sorter.result.stream(); }
java
public Stream<T> orderedNodes() { TopoSorter<T> sorter = new TopoSorter<>(this); return sorter.result.stream(); }
[ "public", "Stream", "<", "T", ">", "orderedNodes", "(", ")", "{", "TopoSorter", "<", "T", ">", "sorter", "=", "new", "TopoSorter", "<>", "(", "this", ")", ";", "return", "sorter", ".", "result", ".", "stream", "(", ")", ";", "}" ]
Returns nodes sorted in topological order.
[ "Returns", "nodes", "sorted", "in", "topological", "order", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java#L125-L128
5,513
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java
Graph.ordered
public void ordered(Consumer<T> action) { TopoSorter<T> sorter = new TopoSorter<>(this); sorter.ordered(action); }
java
public void ordered(Consumer<T> action) { TopoSorter<T> sorter = new TopoSorter<>(this); sorter.ordered(action); }
[ "public", "void", "ordered", "(", "Consumer", "<", "T", ">", "action", ")", "{", "TopoSorter", "<", "T", ">", "sorter", "=", "new", "TopoSorter", "<>", "(", "this", ")", ";", "sorter", ".", "ordered", "(", "action", ")", ";", "}" ]
Traverse this graph and performs the given action in topological order
[ "Traverse", "this", "graph", "and", "performs", "the", "given", "action", "in", "topological", "order" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java#L133-L136
5,514
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java
Graph.reverse
public void reverse(Consumer<T> action) { TopoSorter<T> sorter = new TopoSorter<>(this); sorter.reverse(action); }
java
public void reverse(Consumer<T> action) { TopoSorter<T> sorter = new TopoSorter<>(this); sorter.reverse(action); }
[ "public", "void", "reverse", "(", "Consumer", "<", "T", ">", "action", ")", "{", "TopoSorter", "<", "T", ">", "sorter", "=", "new", "TopoSorter", "<>", "(", "this", ")", ";", "sorter", ".", "reverse", "(", "action", ")", ";", "}" ]
Traverses this graph and performs the given action in reverse topological order
[ "Traverses", "this", "graph", "and", "performs", "the", "given", "action", "in", "reverse", "topological", "order" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java#L141-L144
5,515
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java
Graph.transpose
public Graph<T> transpose() { Builder<T> builder = new Builder<>(); builder.addNodes(nodes); // reverse edges edges.keySet().forEach(u -> { edges.get(u).stream() .forEach(v -> builder.addEdge(v, u)); }); return builder.build(); }
java
public Graph<T> transpose() { Builder<T> builder = new Builder<>(); builder.addNodes(nodes); // reverse edges edges.keySet().forEach(u -> { edges.get(u).stream() .forEach(v -> builder.addEdge(v, u)); }); return builder.build(); }
[ "public", "Graph", "<", "T", ">", "transpose", "(", ")", "{", "Builder", "<", "T", ">", "builder", "=", "new", "Builder", "<>", "(", ")", ";", "builder", ".", "addNodes", "(", "nodes", ")", ";", "// reverse edges", "edges", ".", "keySet", "(", ")", ".", "forEach", "(", "u", "->", "{", "edges", ".", "get", "(", "u", ")", ".", "stream", "(", ")", ".", "forEach", "(", "v", "->", "builder", ".", "addEdge", "(", "v", ",", "u", ")", ")", ";", "}", ")", ";", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Returns a transposed graph from this graph
[ "Returns", "a", "transposed", "graph", "from", "this", "graph" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java#L149-L158
5,516
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java
Graph.dfs
public Set<T> dfs(Set<T> roots) { Deque<T> deque = new LinkedList<>(roots); Set<T> visited = new HashSet<>(); while (!deque.isEmpty()) { T u = deque.pop(); if (!visited.contains(u)) { visited.add(u); if (contains(u)) { adjacentNodes(u).stream() .filter(v -> !visited.contains(v)) .forEach(deque::push); } } } return visited; }
java
public Set<T> dfs(Set<T> roots) { Deque<T> deque = new LinkedList<>(roots); Set<T> visited = new HashSet<>(); while (!deque.isEmpty()) { T u = deque.pop(); if (!visited.contains(u)) { visited.add(u); if (contains(u)) { adjacentNodes(u).stream() .filter(v -> !visited.contains(v)) .forEach(deque::push); } } } return visited; }
[ "public", "Set", "<", "T", ">", "dfs", "(", "Set", "<", "T", ">", "roots", ")", "{", "Deque", "<", "T", ">", "deque", "=", "new", "LinkedList", "<>", "(", "roots", ")", ";", "Set", "<", "T", ">", "visited", "=", "new", "HashSet", "<>", "(", ")", ";", "while", "(", "!", "deque", ".", "isEmpty", "(", ")", ")", "{", "T", "u", "=", "deque", ".", "pop", "(", ")", ";", "if", "(", "!", "visited", ".", "contains", "(", "u", ")", ")", "{", "visited", ".", "add", "(", "u", ")", ";", "if", "(", "contains", "(", "u", ")", ")", "{", "adjacentNodes", "(", "u", ")", ".", "stream", "(", ")", ".", "filter", "(", "v", "->", "!", "visited", ".", "contains", "(", "v", ")", ")", ".", "forEach", "(", "deque", "::", "push", ")", ";", "}", "}", "}", "return", "visited", ";", "}" ]
Returns all nodes reachable from the given set of roots.
[ "Returns", "all", "nodes", "reachable", "from", "the", "given", "set", "of", "roots", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java#L163-L178
5,517
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java
Graph.pathExists
private boolean pathExists(T u, T v, boolean includeAdjacent) { if (!nodes.contains(u) || !nodes.contains(v)) { return false; } if (includeAdjacent && isAdjacent(u, v)) { return true; } Deque<T> stack = new LinkedList<>(); Set<T> visited = new HashSet<>(); stack.push(u); while (!stack.isEmpty()) { T node = stack.pop(); if (node.equals(v)) { return true; } if (!visited.contains(node)) { visited.add(node); edges.get(node).stream() .filter(e -> includeAdjacent || !node.equals(u) || !e.equals(v)) .forEach(stack::push); } } assert !visited.contains(v); return false; }
java
private boolean pathExists(T u, T v, boolean includeAdjacent) { if (!nodes.contains(u) || !nodes.contains(v)) { return false; } if (includeAdjacent && isAdjacent(u, v)) { return true; } Deque<T> stack = new LinkedList<>(); Set<T> visited = new HashSet<>(); stack.push(u); while (!stack.isEmpty()) { T node = stack.pop(); if (node.equals(v)) { return true; } if (!visited.contains(node)) { visited.add(node); edges.get(node).stream() .filter(e -> includeAdjacent || !node.equals(u) || !e.equals(v)) .forEach(stack::push); } } assert !visited.contains(v); return false; }
[ "private", "boolean", "pathExists", "(", "T", "u", ",", "T", "v", ",", "boolean", "includeAdjacent", ")", "{", "if", "(", "!", "nodes", ".", "contains", "(", "u", ")", "||", "!", "nodes", ".", "contains", "(", "v", ")", ")", "{", "return", "false", ";", "}", "if", "(", "includeAdjacent", "&&", "isAdjacent", "(", "u", ",", "v", ")", ")", "{", "return", "true", ";", "}", "Deque", "<", "T", ">", "stack", "=", "new", "LinkedList", "<>", "(", ")", ";", "Set", "<", "T", ">", "visited", "=", "new", "HashSet", "<>", "(", ")", ";", "stack", ".", "push", "(", "u", ")", ";", "while", "(", "!", "stack", ".", "isEmpty", "(", ")", ")", "{", "T", "node", "=", "stack", ".", "pop", "(", ")", ";", "if", "(", "node", ".", "equals", "(", "v", ")", ")", "{", "return", "true", ";", "}", "if", "(", "!", "visited", ".", "contains", "(", "node", ")", ")", "{", "visited", ".", "add", "(", "node", ")", ";", "edges", ".", "get", "(", "node", ")", ".", "stream", "(", ")", ".", "filter", "(", "e", "->", "includeAdjacent", "||", "!", "node", ".", "equals", "(", "u", ")", "||", "!", "e", ".", "equals", "(", "v", ")", ")", ".", "forEach", "(", "stack", "::", "push", ")", ";", "}", "}", "assert", "!", "visited", ".", "contains", "(", "v", ")", ";", "return", "false", ";", "}" ]
Returns true if there exists a path from u to v in this graph. If includeAdjacent is false, it returns true if there exists another path from u to v of distance > 1
[ "Returns", "true", "if", "there", "exists", "a", "path", "from", "u", "to", "v", "in", "this", "graph", ".", "If", "includeAdjacent", "is", "false", "it", "returns", "true", "if", "there", "exists", "another", "path", "from", "u", "to", "v", "of", "distance", ">", "1" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java#L193-L217
5,518
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java
Group.foundGroupFormat
boolean foundGroupFormat(Map<String,?> map, String elementFormat) { if (map.containsKey(elementFormat)) { initMessages(); messages.error("doclet.Same_element_name_used", elementFormat); return true; } return false; }
java
boolean foundGroupFormat(Map<String,?> map, String elementFormat) { if (map.containsKey(elementFormat)) { initMessages(); messages.error("doclet.Same_element_name_used", elementFormat); return true; } return false; }
[ "boolean", "foundGroupFormat", "(", "Map", "<", "String", ",", "?", ">", "map", ",", "String", "elementFormat", ")", "{", "if", "(", "map", ".", "containsKey", "(", "elementFormat", ")", ")", "{", "initMessages", "(", ")", ";", "messages", ".", "error", "(", "\"doclet.Same_element_name_used\"", ",", "elementFormat", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Search if the given map has the given element format. @param map Map to be searched. @param elementFormat The format to search. @return true if element name format found in the map, else false.
[ "Search", "if", "the", "given", "map", "has", "the", "given", "element", "format", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java#L217-L224
5,519
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java
Group.groupModules
public Map<String, SortedSet<ModuleElement>> groupModules(Set<ModuleElement> modules) { Map<String, SortedSet<ModuleElement>> groupModuleMap = new HashMap<>(); String defaultGroupName = (elementNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())? configuration.getResources().getText("doclet.Modules") : configuration.getResources().getText("doclet.Other_Modules"); // if the user has not used the default group name, add it if (!groupList.contains(defaultGroupName)) { groupList.add(defaultGroupName); } for (ModuleElement mdl : modules) { String moduleName = mdl.isUnnamed() ? null : mdl.getQualifiedName().toString(); String groupName = mdl.isUnnamed() ? null : elementNameGroupMap.get(moduleName); // if this module is not explicitly assigned to a group, // try matching it to group specified by regular expression if (groupName == null) { groupName = regExpGroupName(moduleName); } // if it is in neither group map, put it in the default // group if (groupName == null) { groupName = defaultGroupName; } getModuleList(groupModuleMap, groupName).add(mdl); } return groupModuleMap; }
java
public Map<String, SortedSet<ModuleElement>> groupModules(Set<ModuleElement> modules) { Map<String, SortedSet<ModuleElement>> groupModuleMap = new HashMap<>(); String defaultGroupName = (elementNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())? configuration.getResources().getText("doclet.Modules") : configuration.getResources().getText("doclet.Other_Modules"); // if the user has not used the default group name, add it if (!groupList.contains(defaultGroupName)) { groupList.add(defaultGroupName); } for (ModuleElement mdl : modules) { String moduleName = mdl.isUnnamed() ? null : mdl.getQualifiedName().toString(); String groupName = mdl.isUnnamed() ? null : elementNameGroupMap.get(moduleName); // if this module is not explicitly assigned to a group, // try matching it to group specified by regular expression if (groupName == null) { groupName = regExpGroupName(moduleName); } // if it is in neither group map, put it in the default // group if (groupName == null) { groupName = defaultGroupName; } getModuleList(groupModuleMap, groupName).add(mdl); } return groupModuleMap; }
[ "public", "Map", "<", "String", ",", "SortedSet", "<", "ModuleElement", ">", ">", "groupModules", "(", "Set", "<", "ModuleElement", ">", "modules", ")", "{", "Map", "<", "String", ",", "SortedSet", "<", "ModuleElement", ">", ">", "groupModuleMap", "=", "new", "HashMap", "<>", "(", ")", ";", "String", "defaultGroupName", "=", "(", "elementNameGroupMap", ".", "isEmpty", "(", ")", "&&", "regExpGroupMap", ".", "isEmpty", "(", ")", ")", "?", "configuration", ".", "getResources", "(", ")", ".", "getText", "(", "\"doclet.Modules\"", ")", ":", "configuration", ".", "getResources", "(", ")", ".", "getText", "(", "\"doclet.Other_Modules\"", ")", ";", "// if the user has not used the default group name, add it", "if", "(", "!", "groupList", ".", "contains", "(", "defaultGroupName", ")", ")", "{", "groupList", ".", "add", "(", "defaultGroupName", ")", ";", "}", "for", "(", "ModuleElement", "mdl", ":", "modules", ")", "{", "String", "moduleName", "=", "mdl", ".", "isUnnamed", "(", ")", "?", "null", ":", "mdl", ".", "getQualifiedName", "(", ")", ".", "toString", "(", ")", ";", "String", "groupName", "=", "mdl", ".", "isUnnamed", "(", ")", "?", "null", ":", "elementNameGroupMap", ".", "get", "(", "moduleName", ")", ";", "// if this module is not explicitly assigned to a group,", "// try matching it to group specified by regular expression", "if", "(", "groupName", "==", "null", ")", "{", "groupName", "=", "regExpGroupName", "(", "moduleName", ")", ";", "}", "// if it is in neither group map, put it in the default", "// group", "if", "(", "groupName", "==", "null", ")", "{", "groupName", "=", "defaultGroupName", ";", "}", "getModuleList", "(", "groupModuleMap", ",", "groupName", ")", ".", "add", "(", "mdl", ")", ";", "}", "return", "groupModuleMap", ";", "}" ]
Group the modules according the grouping information provided on the command line. Given a list of modules, search each module name in regular expression map as well as module name map to get the corresponding group name. Create another map with mapping of group name to the module list, which will fall under the specified group. If any module doesn't belong to any specified group on the command line, then a new group named "Other Modules" will be created for it. If there are no groups found, in other words if "-group" option is not at all used, then all the modules will be grouped under group "Modules". @param modules Specified modules. @return map of group names and set of module elements.
[ "Group", "the", "modules", "according", "the", "grouping", "information", "provided", "on", "the", "command", "line", ".", "Given", "a", "list", "of", "modules", "search", "each", "module", "name", "in", "regular", "expression", "map", "as", "well", "as", "module", "name", "map", "to", "get", "the", "corresponding", "group", "name", ".", "Create", "another", "map", "with", "mapping", "of", "group", "name", "to", "the", "module", "list", "which", "will", "fall", "under", "the", "specified", "group", ".", "If", "any", "module", "doesn", "t", "belong", "to", "any", "specified", "group", "on", "the", "command", "line", "then", "a", "new", "group", "named", "Other", "Modules", "will", "be", "created", "for", "it", ".", "If", "there", "are", "no", "groups", "found", "in", "other", "words", "if", "-", "group", "option", "is", "not", "at", "all", "used", "then", "all", "the", "modules", "will", "be", "grouped", "under", "group", "Modules", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java#L240-L266
5,520
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java
Group.groupPackages
public Map<String, SortedSet<PackageElement>> groupPackages(Set<PackageElement> packages) { Map<String, SortedSet<PackageElement>> groupPackageMap = new HashMap<>(); String defaultGroupName = (elementNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())? configuration.getResources().getText("doclet.Packages") : configuration.getResources().getText("doclet.Other_Packages"); // if the user has not used the default group name, add it if (!groupList.contains(defaultGroupName)) { groupList.add(defaultGroupName); } for (PackageElement pkg : packages) { String pkgName = pkg.isUnnamed() ? null : configuration.utils.getPackageName(pkg); String groupName = pkg.isUnnamed() ? null : elementNameGroupMap.get(pkgName); // if this package is not explicitly assigned to a group, // try matching it to group specified by regular expression if (groupName == null) { groupName = regExpGroupName(pkgName); } // if it is in neither group map, put it in the default // group if (groupName == null) { groupName = defaultGroupName; } getPkgList(groupPackageMap, groupName).add(pkg); } return groupPackageMap; }
java
public Map<String, SortedSet<PackageElement>> groupPackages(Set<PackageElement> packages) { Map<String, SortedSet<PackageElement>> groupPackageMap = new HashMap<>(); String defaultGroupName = (elementNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())? configuration.getResources().getText("doclet.Packages") : configuration.getResources().getText("doclet.Other_Packages"); // if the user has not used the default group name, add it if (!groupList.contains(defaultGroupName)) { groupList.add(defaultGroupName); } for (PackageElement pkg : packages) { String pkgName = pkg.isUnnamed() ? null : configuration.utils.getPackageName(pkg); String groupName = pkg.isUnnamed() ? null : elementNameGroupMap.get(pkgName); // if this package is not explicitly assigned to a group, // try matching it to group specified by regular expression if (groupName == null) { groupName = regExpGroupName(pkgName); } // if it is in neither group map, put it in the default // group if (groupName == null) { groupName = defaultGroupName; } getPkgList(groupPackageMap, groupName).add(pkg); } return groupPackageMap; }
[ "public", "Map", "<", "String", ",", "SortedSet", "<", "PackageElement", ">", ">", "groupPackages", "(", "Set", "<", "PackageElement", ">", "packages", ")", "{", "Map", "<", "String", ",", "SortedSet", "<", "PackageElement", ">", ">", "groupPackageMap", "=", "new", "HashMap", "<>", "(", ")", ";", "String", "defaultGroupName", "=", "(", "elementNameGroupMap", ".", "isEmpty", "(", ")", "&&", "regExpGroupMap", ".", "isEmpty", "(", ")", ")", "?", "configuration", ".", "getResources", "(", ")", ".", "getText", "(", "\"doclet.Packages\"", ")", ":", "configuration", ".", "getResources", "(", ")", ".", "getText", "(", "\"doclet.Other_Packages\"", ")", ";", "// if the user has not used the default group name, add it", "if", "(", "!", "groupList", ".", "contains", "(", "defaultGroupName", ")", ")", "{", "groupList", ".", "add", "(", "defaultGroupName", ")", ";", "}", "for", "(", "PackageElement", "pkg", ":", "packages", ")", "{", "String", "pkgName", "=", "pkg", ".", "isUnnamed", "(", ")", "?", "null", ":", "configuration", ".", "utils", ".", "getPackageName", "(", "pkg", ")", ";", "String", "groupName", "=", "pkg", ".", "isUnnamed", "(", ")", "?", "null", ":", "elementNameGroupMap", ".", "get", "(", "pkgName", ")", ";", "// if this package is not explicitly assigned to a group,", "// try matching it to group specified by regular expression", "if", "(", "groupName", "==", "null", ")", "{", "groupName", "=", "regExpGroupName", "(", "pkgName", ")", ";", "}", "// if it is in neither group map, put it in the default", "// group", "if", "(", "groupName", "==", "null", ")", "{", "groupName", "=", "defaultGroupName", ";", "}", "getPkgList", "(", "groupPackageMap", ",", "groupName", ")", ".", "add", "(", "pkg", ")", ";", "}", "return", "groupPackageMap", ";", "}" ]
Group the packages according the grouping information provided on the command line. Given a list of packages, search each package name in regular expression map as well as package name map to get the corresponding group name. Create another map with mapping of group name to the package list, which will fall under the specified group. If any package doesn't belong to any specified group on the command line, then a new group named "Other Packages" will be created for it. If there are no groups found, in other words if "-group" option is not at all used, then all the packages will be grouped under group "Packages". @param packages Packages specified on the command line. @return map of group names and set of package elements
[ "Group", "the", "packages", "according", "the", "grouping", "information", "provided", "on", "the", "command", "line", ".", "Given", "a", "list", "of", "packages", "search", "each", "package", "name", "in", "regular", "expression", "map", "as", "well", "as", "package", "name", "map", "to", "get", "the", "corresponding", "group", "name", ".", "Create", "another", "map", "with", "mapping", "of", "group", "name", "to", "the", "package", "list", "which", "will", "fall", "under", "the", "specified", "group", ".", "If", "any", "package", "doesn", "t", "belong", "to", "any", "specified", "group", "on", "the", "command", "line", "then", "a", "new", "group", "named", "Other", "Packages", "will", "be", "created", "for", "it", ".", "If", "there", "are", "no", "groups", "found", "in", "other", "words", "if", "-", "group", "option", "is", "not", "at", "all", "used", "then", "all", "the", "packages", "will", "be", "grouped", "under", "group", "Packages", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java#L282-L308
5,521
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java
Group.regExpGroupName
String regExpGroupName(String elementName) { for (String regexp : sortedRegExpList) { if (elementName.startsWith(regexp)) { return regExpGroupMap.get(regexp); } } return null; }
java
String regExpGroupName(String elementName) { for (String regexp : sortedRegExpList) { if (elementName.startsWith(regexp)) { return regExpGroupMap.get(regexp); } } return null; }
[ "String", "regExpGroupName", "(", "String", "elementName", ")", "{", "for", "(", "String", "regexp", ":", "sortedRegExpList", ")", "{", "if", "(", "elementName", ".", "startsWith", "(", "regexp", ")", ")", "{", "return", "regExpGroupMap", ".", "get", "(", "regexp", ")", ";", "}", "}", "return", "null", ";", "}" ]
Search for element name in the sorted regular expression list, if found return the group name. If not, return null. @param elementName Name of element to be found in the regular expression list.
[ "Search", "for", "element", "name", "in", "the", "sorted", "regular", "expression", "list", "if", "found", "return", "the", "group", "name", ".", "If", "not", "return", "null", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java#L317-L324
5,522
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java
Group.getModuleList
SortedSet<ModuleElement> getModuleList(Map<String, SortedSet<ModuleElement>> map, String groupname) { return map.computeIfAbsent(groupname, g -> new TreeSet<>(configuration.utils.makeModuleComparator())); }
java
SortedSet<ModuleElement> getModuleList(Map<String, SortedSet<ModuleElement>> map, String groupname) { return map.computeIfAbsent(groupname, g -> new TreeSet<>(configuration.utils.makeModuleComparator())); }
[ "SortedSet", "<", "ModuleElement", ">", "getModuleList", "(", "Map", "<", "String", ",", "SortedSet", "<", "ModuleElement", ">", ">", "map", ",", "String", "groupname", ")", "{", "return", "map", ".", "computeIfAbsent", "(", "groupname", ",", "g", "->", "new", "TreeSet", "<>", "(", "configuration", ".", "utils", ".", "makeModuleComparator", "(", ")", ")", ")", ";", "}" ]
For the given group name, return the module list, on which it is mapped. Create a new list, if not found. @param map Map to be searched for group name. @param groupname Group name to search.
[ "For", "the", "given", "group", "name", "return", "the", "module", "list", "on", "which", "it", "is", "mapped", ".", "Create", "a", "new", "list", "if", "not", "found", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java#L345-L348
5,523
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.wildUpperBound
public Type wildUpperBound(Type t) { if (t.hasTag(WILDCARD)) { WildcardType w = (WildcardType) t; if (w.isSuperBound()) return w.bound == null ? syms.objectType : w.bound.bound; else return wildUpperBound(w.type); } else return t; }
java
public Type wildUpperBound(Type t) { if (t.hasTag(WILDCARD)) { WildcardType w = (WildcardType) t; if (w.isSuperBound()) return w.bound == null ? syms.objectType : w.bound.bound; else return wildUpperBound(w.type); } else return t; }
[ "public", "Type", "wildUpperBound", "(", "Type", "t", ")", "{", "if", "(", "t", ".", "hasTag", "(", "WILDCARD", ")", ")", "{", "WildcardType", "w", "=", "(", "WildcardType", ")", "t", ";", "if", "(", "w", ".", "isSuperBound", "(", ")", ")", "return", "w", ".", "bound", "==", "null", "?", "syms", ".", "objectType", ":", "w", ".", "bound", ".", "bound", ";", "else", "return", "wildUpperBound", "(", "w", ".", "type", ")", ";", "}", "else", "return", "t", ";", "}" ]
Get a wildcard's upper bound, returning non-wildcards unchanged. @param t a type argument, either a wildcard or a type
[ "Get", "a", "wildcard", "s", "upper", "bound", "returning", "non", "-", "wildcards", "unchanged", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L133-L142
5,524
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.cvarUpperBound
public Type cvarUpperBound(Type t) { if (t.hasTag(TYPEVAR)) { TypeVar v = (TypeVar) t; return v.isCaptured() ? cvarUpperBound(v.bound) : v; } else return t; }
java
public Type cvarUpperBound(Type t) { if (t.hasTag(TYPEVAR)) { TypeVar v = (TypeVar) t; return v.isCaptured() ? cvarUpperBound(v.bound) : v; } else return t; }
[ "public", "Type", "cvarUpperBound", "(", "Type", "t", ")", "{", "if", "(", "t", ".", "hasTag", "(", "TYPEVAR", ")", ")", "{", "TypeVar", "v", "=", "(", "TypeVar", ")", "t", ";", "return", "v", ".", "isCaptured", "(", ")", "?", "cvarUpperBound", "(", "v", ".", "bound", ")", ":", "v", ";", "}", "else", "return", "t", ";", "}" ]
Get a capture variable's upper bound, returning other types unchanged. @param t a type
[ "Get", "a", "capture", "variable", "s", "upper", "bound", "returning", "other", "types", "unchanged", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L148-L154
5,525
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.wildLowerBound
public Type wildLowerBound(Type t) { if (t.hasTag(WILDCARD)) { WildcardType w = (WildcardType) t; return w.isExtendsBound() ? syms.botType : wildLowerBound(w.type); } else return t; }
java
public Type wildLowerBound(Type t) { if (t.hasTag(WILDCARD)) { WildcardType w = (WildcardType) t; return w.isExtendsBound() ? syms.botType : wildLowerBound(w.type); } else return t; }
[ "public", "Type", "wildLowerBound", "(", "Type", "t", ")", "{", "if", "(", "t", ".", "hasTag", "(", "WILDCARD", ")", ")", "{", "WildcardType", "w", "=", "(", "WildcardType", ")", "t", ";", "return", "w", ".", "isExtendsBound", "(", ")", "?", "syms", ".", "botType", ":", "wildLowerBound", "(", "w", ".", "type", ")", ";", "}", "else", "return", "t", ";", "}" ]
Get a wildcard's lower bound, returning non-wildcards unchanged. @param t a type argument, either a wildcard or a type
[ "Get", "a", "wildcard", "s", "lower", "bound", "returning", "non", "-", "wildcards", "unchanged", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L160-L166
5,526
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.findDescriptorType
public Type findDescriptorType(Type origin) throws FunctionDescriptorLookupError { return descCache.get(origin.tsym).getType(origin); }
java
public Type findDescriptorType(Type origin) throws FunctionDescriptorLookupError { return descCache.get(origin.tsym).getType(origin); }
[ "public", "Type", "findDescriptorType", "(", "Type", "origin", ")", "throws", "FunctionDescriptorLookupError", "{", "return", "descCache", ".", "get", "(", "origin", ".", "tsym", ")", ".", "getType", "(", "origin", ")", ";", "}" ]
Find the type of the method descriptor associated to this class symbol - if the symbol 'origin' is not a functional interface, an exception is thrown.
[ "Find", "the", "type", "of", "the", "method", "descriptor", "associated", "to", "this", "class", "symbol", "-", "if", "the", "symbol", "origin", "is", "not", "a", "functional", "interface", "an", "exception", "is", "thrown", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L508-L510
5,527
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.isSubtypeUnchecked
public boolean isSubtypeUnchecked(Type t, Type s, Warner warn) { boolean result = isSubtypeUncheckedInternal(t, s, true, warn); if (result) { checkUnsafeVarargsConversion(t, s, warn); } return result; }
java
public boolean isSubtypeUnchecked(Type t, Type s, Warner warn) { boolean result = isSubtypeUncheckedInternal(t, s, true, warn); if (result) { checkUnsafeVarargsConversion(t, s, warn); } return result; }
[ "public", "boolean", "isSubtypeUnchecked", "(", "Type", "t", ",", "Type", "s", ",", "Warner", "warn", ")", "{", "boolean", "result", "=", "isSubtypeUncheckedInternal", "(", "t", ",", "s", ",", "true", ",", "warn", ")", ";", "if", "(", "result", ")", "{", "checkUnsafeVarargsConversion", "(", "t", ",", "s", ",", "warn", ")", ";", "}", "return", "result", ";", "}" ]
Is t an unchecked subtype of s?
[ "Is", "t", "an", "unchecked", "subtype", "of", "s?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L687-L693
5,528
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.isSubtypes
public boolean isSubtypes(List<Type> ts, List<Type> ss) { while (ts.tail != null && ss.tail != null /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ && isSubtype(ts.head, ss.head)) { ts = ts.tail; ss = ss.tail; } return ts.tail == null && ss.tail == null; /*inlined: ts.isEmpty() && ss.isEmpty();*/ }
java
public boolean isSubtypes(List<Type> ts, List<Type> ss) { while (ts.tail != null && ss.tail != null /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ && isSubtype(ts.head, ss.head)) { ts = ts.tail; ss = ss.tail; } return ts.tail == null && ss.tail == null; /*inlined: ts.isEmpty() && ss.isEmpty();*/ }
[ "public", "boolean", "isSubtypes", "(", "List", "<", "Type", ">", "ts", ",", "List", "<", "Type", ">", "ss", ")", "{", "while", "(", "ts", ".", "tail", "!=", "null", "&&", "ss", ".", "tail", "!=", "null", "/*inlined: ts.nonEmpty() && ss.nonEmpty()*/", "&&", "isSubtype", "(", "ts", ".", "head", ",", "ss", ".", "head", ")", ")", "{", "ts", "=", "ts", ".", "tail", ";", "ss", "=", "ss", ".", "tail", ";", "}", "return", "ts", ".", "tail", "==", "null", "&&", "ss", ".", "tail", "==", "null", ";", "/*inlined: ts.isEmpty() && ss.isEmpty();*/", "}" ]
Are corresponding elements of ts subtypes of ss? If lists are of different length, return false.
[ "Are", "corresponding", "elements", "of", "ts", "subtypes", "of", "ss?", "If", "lists", "are", "of", "different", "length", "return", "false", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L926-L935
5,529
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.isSubtypesUnchecked
public boolean isSubtypesUnchecked(List<Type> ts, List<Type> ss, Warner warn) { while (ts.tail != null && ss.tail != null /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ && isSubtypeUnchecked(ts.head, ss.head, warn)) { ts = ts.tail; ss = ss.tail; } return ts.tail == null && ss.tail == null; /*inlined: ts.isEmpty() && ss.isEmpty();*/ }
java
public boolean isSubtypesUnchecked(List<Type> ts, List<Type> ss, Warner warn) { while (ts.tail != null && ss.tail != null /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ && isSubtypeUnchecked(ts.head, ss.head, warn)) { ts = ts.tail; ss = ss.tail; } return ts.tail == null && ss.tail == null; /*inlined: ts.isEmpty() && ss.isEmpty();*/ }
[ "public", "boolean", "isSubtypesUnchecked", "(", "List", "<", "Type", ">", "ts", ",", "List", "<", "Type", ">", "ss", ",", "Warner", "warn", ")", "{", "while", "(", "ts", ".", "tail", "!=", "null", "&&", "ss", ".", "tail", "!=", "null", "/*inlined: ts.nonEmpty() && ss.nonEmpty()*/", "&&", "isSubtypeUnchecked", "(", "ts", ".", "head", ",", "ss", ".", "head", ",", "warn", ")", ")", "{", "ts", "=", "ts", ".", "tail", ";", "ss", "=", "ss", ".", "tail", ";", "}", "return", "ts", ".", "tail", "==", "null", "&&", "ss", ".", "tail", "==", "null", ";", "/*inlined: ts.isEmpty() && ss.isEmpty();*/", "}" ]
Are corresponding elements of ts subtypes of ss, allowing unchecked conversions? If lists are of different length, return false.
[ "Are", "corresponding", "elements", "of", "ts", "subtypes", "of", "ss", "allowing", "unchecked", "conversions?", "If", "lists", "are", "of", "different", "length", "return", "false", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L942-L951
5,530
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.isSuperType
public boolean isSuperType(Type t, Type s) { switch (t.getTag()) { case ERROR: return true; case UNDETVAR: { UndetVar undet = (UndetVar)t; if (t == s || undet.qtype == s || s.hasTag(ERROR) || s.hasTag(BOT)) { return true; } undet.addBound(InferenceBound.LOWER, s, this); return true; } default: return isSubtype(s, t); } }
java
public boolean isSuperType(Type t, Type s) { switch (t.getTag()) { case ERROR: return true; case UNDETVAR: { UndetVar undet = (UndetVar)t; if (t == s || undet.qtype == s || s.hasTag(ERROR) || s.hasTag(BOT)) { return true; } undet.addBound(InferenceBound.LOWER, s, this); return true; } default: return isSubtype(s, t); } }
[ "public", "boolean", "isSuperType", "(", "Type", "t", ",", "Type", "s", ")", "{", "switch", "(", "t", ".", "getTag", "(", ")", ")", "{", "case", "ERROR", ":", "return", "true", ";", "case", "UNDETVAR", ":", "{", "UndetVar", "undet", "=", "(", "UndetVar", ")", "t", ";", "if", "(", "t", "==", "s", "||", "undet", ".", "qtype", "==", "s", "||", "s", ".", "hasTag", "(", "ERROR", ")", "||", "s", ".", "hasTag", "(", "BOT", ")", ")", "{", "return", "true", ";", "}", "undet", ".", "addBound", "(", "InferenceBound", ".", "LOWER", ",", "s", ",", "this", ")", ";", "return", "true", ";", "}", "default", ":", "return", "isSubtype", "(", "s", ",", "t", ")", ";", "}", "}" ]
Is t a supertype of s?
[ "Is", "t", "a", "supertype", "of", "s?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L958-L976
5,531
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.isSameTypes
public boolean isSameTypes(List<Type> ts, List<Type> ss) { return isSameTypes(ts, ss, false); }
java
public boolean isSameTypes(List<Type> ts, List<Type> ss) { return isSameTypes(ts, ss, false); }
[ "public", "boolean", "isSameTypes", "(", "List", "<", "Type", ">", "ts", ",", "List", "<", "Type", ">", "ss", ")", "{", "return", "isSameTypes", "(", "ts", ",", "ss", ",", "false", ")", ";", "}" ]
Are corresponding elements of the lists the same type? If lists are of different length, return false.
[ "Are", "corresponding", "elements", "of", "the", "lists", "the", "same", "type?", "If", "lists", "are", "of", "different", "length", "return", "false", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L984-L986
5,532
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.dimensions
public int dimensions(Type t) { int result = 0; while (t.hasTag(ARRAY)) { result++; t = elemtype(t); } return result; }
java
public int dimensions(Type t) { int result = 0; while (t.hasTag(ARRAY)) { result++; t = elemtype(t); } return result; }
[ "public", "int", "dimensions", "(", "Type", "t", ")", "{", "int", "result", "=", "0", ";", "while", "(", "t", ".", "hasTag", "(", "ARRAY", ")", ")", "{", "result", "++", ";", "t", "=", "elemtype", "(", "t", ")", ";", "}", "return", "result", ";", "}" ]
The number of dimensions of an array type.
[ "The", "number", "of", "dimensions", "of", "an", "array", "type", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1817-L1824
5,533
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.makeArrayType
public ArrayType makeArrayType(Type t) { if (t.hasTag(VOID) || t.hasTag(PACKAGE)) { Assert.error("Type t must not be a VOID or PACKAGE type, " + t.toString()); } return new ArrayType(t, syms.arrayClass); }
java
public ArrayType makeArrayType(Type t) { if (t.hasTag(VOID) || t.hasTag(PACKAGE)) { Assert.error("Type t must not be a VOID or PACKAGE type, " + t.toString()); } return new ArrayType(t, syms.arrayClass); }
[ "public", "ArrayType", "makeArrayType", "(", "Type", "t", ")", "{", "if", "(", "t", ".", "hasTag", "(", "VOID", ")", "||", "t", ".", "hasTag", "(", "PACKAGE", ")", ")", "{", "Assert", ".", "error", "(", "\"Type t must not be a VOID or PACKAGE type, \"", "+", "t", ".", "toString", "(", ")", ")", ";", "}", "return", "new", "ArrayType", "(", "t", ",", "syms", ".", "arrayClass", ")", ";", "}" ]
Returns an ArrayType with the component type t @param t The component type of the ArrayType @return the ArrayType for the given component
[ "Returns", "an", "ArrayType", "with", "the", "component", "type", "t" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1832-L1837
5,534
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.asOuterSuper
public Type asOuterSuper(Type t, Symbol sym) { switch (t.getTag()) { case CLASS: do { Type s = asSuper(t, sym); if (s != null) return s; t = t.getEnclosingType(); } while (t.hasTag(CLASS)); return null; case ARRAY: return isSubtype(t, sym.type) ? sym.type : null; case TYPEVAR: return asSuper(t, sym); case ERROR: return t; default: return null; } }
java
public Type asOuterSuper(Type t, Symbol sym) { switch (t.getTag()) { case CLASS: do { Type s = asSuper(t, sym); if (s != null) return s; t = t.getEnclosingType(); } while (t.hasTag(CLASS)); return null; case ARRAY: return isSubtype(t, sym.type) ? sym.type : null; case TYPEVAR: return asSuper(t, sym); case ERROR: return t; default: return null; } }
[ "public", "Type", "asOuterSuper", "(", "Type", "t", ",", "Symbol", "sym", ")", "{", "switch", "(", "t", ".", "getTag", "(", ")", ")", "{", "case", "CLASS", ":", "do", "{", "Type", "s", "=", "asSuper", "(", "t", ",", "sym", ")", ";", "if", "(", "s", "!=", "null", ")", "return", "s", ";", "t", "=", "t", ".", "getEnclosingType", "(", ")", ";", "}", "while", "(", "t", ".", "hasTag", "(", "CLASS", ")", ")", ";", "return", "null", ";", "case", "ARRAY", ":", "return", "isSubtype", "(", "t", ",", "sym", ".", "type", ")", "?", "sym", ".", "type", ":", "null", ";", "case", "TYPEVAR", ":", "return", "asSuper", "(", "t", ",", "sym", ")", ";", "case", "ERROR", ":", "return", "t", ";", "default", ":", "return", "null", ";", "}", "}" ]
Return the base type of t or any of its outer types that starts with the given symbol. If none exists, return null. @param t a type @param sym a symbol
[ "Return", "the", "base", "type", "of", "t", "or", "any", "of", "its", "outer", "types", "that", "starts", "with", "the", "given", "symbol", ".", "If", "none", "exists", "return", "null", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1923-L1941
5,535
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.asEnclosingSuper
public Type asEnclosingSuper(Type t, Symbol sym) { switch (t.getTag()) { case CLASS: do { Type s = asSuper(t, sym); if (s != null) return s; Type outer = t.getEnclosingType(); t = (outer.hasTag(CLASS)) ? outer : (t.tsym.owner.enclClass() != null) ? t.tsym.owner.enclClass().type : Type.noType; } while (t.hasTag(CLASS)); return null; case ARRAY: return isSubtype(t, sym.type) ? sym.type : null; case TYPEVAR: return asSuper(t, sym); case ERROR: return t; default: return null; } }
java
public Type asEnclosingSuper(Type t, Symbol sym) { switch (t.getTag()) { case CLASS: do { Type s = asSuper(t, sym); if (s != null) return s; Type outer = t.getEnclosingType(); t = (outer.hasTag(CLASS)) ? outer : (t.tsym.owner.enclClass() != null) ? t.tsym.owner.enclClass().type : Type.noType; } while (t.hasTag(CLASS)); return null; case ARRAY: return isSubtype(t, sym.type) ? sym.type : null; case TYPEVAR: return asSuper(t, sym); case ERROR: return t; default: return null; } }
[ "public", "Type", "asEnclosingSuper", "(", "Type", "t", ",", "Symbol", "sym", ")", "{", "switch", "(", "t", ".", "getTag", "(", ")", ")", "{", "case", "CLASS", ":", "do", "{", "Type", "s", "=", "asSuper", "(", "t", ",", "sym", ")", ";", "if", "(", "s", "!=", "null", ")", "return", "s", ";", "Type", "outer", "=", "t", ".", "getEnclosingType", "(", ")", ";", "t", "=", "(", "outer", ".", "hasTag", "(", "CLASS", ")", ")", "?", "outer", ":", "(", "t", ".", "tsym", ".", "owner", ".", "enclClass", "(", ")", "!=", "null", ")", "?", "t", ".", "tsym", ".", "owner", ".", "enclClass", "(", ")", ".", "type", ":", "Type", ".", "noType", ";", "}", "while", "(", "t", ".", "hasTag", "(", "CLASS", ")", ")", ";", "return", "null", ";", "case", "ARRAY", ":", "return", "isSubtype", "(", "t", ",", "sym", ".", "type", ")", "?", "sym", ".", "type", ":", "null", ";", "case", "TYPEVAR", ":", "return", "asSuper", "(", "t", ",", "sym", ")", ";", "case", "ERROR", ":", "return", "t", ";", "default", ":", "return", "null", ";", "}", "}" ]
Return the base type of t or any of its enclosing types that starts with the given symbol. If none exists, return null. @param t a type @param sym a symbol
[ "Return", "the", "base", "type", "of", "t", "or", "any", "of", "its", "enclosing", "types", "that", "starts", "with", "the", "given", "symbol", ".", "If", "none", "exists", "return", "null", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1950-L1971
5,536
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.memberType
public Type memberType(Type t, Symbol sym) { return (sym.flags() & STATIC) != 0 ? sym.type : memberType.visit(t, sym); }
java
public Type memberType(Type t, Symbol sym) { return (sym.flags() & STATIC) != 0 ? sym.type : memberType.visit(t, sym); }
[ "public", "Type", "memberType", "(", "Type", "t", ",", "Symbol", "sym", ")", "{", "return", "(", "sym", ".", "flags", "(", ")", "&", "STATIC", ")", "!=", "0", "?", "sym", ".", "type", ":", "memberType", ".", "visit", "(", "t", ",", "sym", ")", ";", "}" ]
The type of given symbol, seen as a member of t. @param t a type @param sym a symbol
[ "The", "type", "of", "given", "symbol", "seen", "as", "a", "member", "of", "t", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1981-L1985
5,537
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.getBounds
public List<Type> getBounds(TypeVar t) { if (t.bound.hasTag(NONE)) return List.nil(); else if (t.bound.isErroneous() || !t.bound.isCompound()) return List.of(t.bound); else if ((erasure(t).tsym.flags() & INTERFACE) == 0) return interfaces(t).prepend(supertype(t)); else // No superclass was given in bounds. // In this case, supertype is Object, erasure is first interface. return interfaces(t); }
java
public List<Type> getBounds(TypeVar t) { if (t.bound.hasTag(NONE)) return List.nil(); else if (t.bound.isErroneous() || !t.bound.isCompound()) return List.of(t.bound); else if ((erasure(t).tsym.flags() & INTERFACE) == 0) return interfaces(t).prepend(supertype(t)); else // No superclass was given in bounds. // In this case, supertype is Object, erasure is first interface. return interfaces(t); }
[ "public", "List", "<", "Type", ">", "getBounds", "(", "TypeVar", "t", ")", "{", "if", "(", "t", ".", "bound", ".", "hasTag", "(", "NONE", ")", ")", "return", "List", ".", "nil", "(", ")", ";", "else", "if", "(", "t", ".", "bound", ".", "isErroneous", "(", ")", "||", "!", "t", ".", "bound", ".", "isCompound", "(", ")", ")", "return", "List", ".", "of", "(", "t", ".", "bound", ")", ";", "else", "if", "(", "(", "erasure", "(", "t", ")", ".", "tsym", ".", "flags", "(", ")", "&", "INTERFACE", ")", "==", "0", ")", "return", "interfaces", "(", "t", ")", ".", "prepend", "(", "supertype", "(", "t", ")", ")", ";", "else", "// No superclass was given in bounds.", "// In this case, supertype is Object, erasure is first interface.", "return", "interfaces", "(", "t", ")", ";", "}" ]
Return list of bounds of the given type variable.
[ "Return", "list", "of", "bounds", "of", "the", "given", "type", "variable", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L2430-L2441
5,538
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.firstUnimplementedAbstract
public MethodSymbol firstUnimplementedAbstract(ClassSymbol sym) { try { return firstUnimplementedAbstractImpl(sym, sym); } catch (CompletionFailure ex) { chk.completionError(enter.getEnv(sym).tree.pos(), ex); return null; } }
java
public MethodSymbol firstUnimplementedAbstract(ClassSymbol sym) { try { return firstUnimplementedAbstractImpl(sym, sym); } catch (CompletionFailure ex) { chk.completionError(enter.getEnv(sym).tree.pos(), ex); return null; } }
[ "public", "MethodSymbol", "firstUnimplementedAbstract", "(", "ClassSymbol", "sym", ")", "{", "try", "{", "return", "firstUnimplementedAbstractImpl", "(", "sym", ",", "sym", ")", ";", "}", "catch", "(", "CompletionFailure", "ex", ")", "{", "chk", ".", "completionError", "(", "enter", ".", "getEnv", "(", "sym", ")", ".", "tree", ".", "pos", "(", ")", ",", "ex", ")", ";", "return", "null", ";", "}", "}" ]
Return first abstract member of class `sym'.
[ "Return", "first", "abstract", "member", "of", "class", "sym", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L2800-L2807
5,539
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.hasSameBounds
public boolean hasSameBounds(ForAll t, ForAll s) { List<Type> l1 = t.tvars; List<Type> l2 = s.tvars; while (l1.nonEmpty() && l2.nonEmpty() && isSameType(l1.head.getUpperBound(), subst(l2.head.getUpperBound(), s.tvars, t.tvars))) { l1 = l1.tail; l2 = l2.tail; } return l1.isEmpty() && l2.isEmpty(); }
java
public boolean hasSameBounds(ForAll t, ForAll s) { List<Type> l1 = t.tvars; List<Type> l2 = s.tvars; while (l1.nonEmpty() && l2.nonEmpty() && isSameType(l1.head.getUpperBound(), subst(l2.head.getUpperBound(), s.tvars, t.tvars))) { l1 = l1.tail; l2 = l2.tail; } return l1.isEmpty() && l2.isEmpty(); }
[ "public", "boolean", "hasSameBounds", "(", "ForAll", "t", ",", "ForAll", "s", ")", "{", "List", "<", "Type", ">", "l1", "=", "t", ".", "tvars", ";", "List", "<", "Type", ">", "l2", "=", "s", ".", "tvars", ";", "while", "(", "l1", ".", "nonEmpty", "(", ")", "&&", "l2", ".", "nonEmpty", "(", ")", "&&", "isSameType", "(", "l1", ".", "head", ".", "getUpperBound", "(", ")", ",", "subst", "(", "l2", ".", "head", ".", "getUpperBound", "(", ")", ",", "s", ".", "tvars", ",", "t", ".", "tvars", ")", ")", ")", "{", "l1", "=", "l1", ".", "tail", ";", "l2", "=", "l2", ".", "tail", ";", "}", "return", "l1", ".", "isEmpty", "(", ")", "&&", "l2", ".", "isEmpty", "(", ")", ";", "}" ]
Does t have the same bounds for quantified variables as s?
[ "Does", "t", "have", "the", "same", "bounds", "for", "quantified", "variables", "as", "s?" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3169-L3181
5,540
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.newInstances
public List<Type> newInstances(List<Type> tvars) { List<Type> tvars1 = tvars.map(newInstanceFun); for (List<Type> l = tvars1; l.nonEmpty(); l = l.tail) { TypeVar tv = (TypeVar) l.head; tv.bound = subst(tv.bound, tvars, tvars1); } return tvars1; }
java
public List<Type> newInstances(List<Type> tvars) { List<Type> tvars1 = tvars.map(newInstanceFun); for (List<Type> l = tvars1; l.nonEmpty(); l = l.tail) { TypeVar tv = (TypeVar) l.head; tv.bound = subst(tv.bound, tvars, tvars1); } return tvars1; }
[ "public", "List", "<", "Type", ">", "newInstances", "(", "List", "<", "Type", ">", "tvars", ")", "{", "List", "<", "Type", ">", "tvars1", "=", "tvars", ".", "map", "(", "newInstanceFun", ")", ";", "for", "(", "List", "<", "Type", ">", "l", "=", "tvars1", ";", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", ".", "tail", ")", "{", "TypeVar", "tv", "=", "(", "TypeVar", ")", "l", ".", "head", ";", "tv", ".", "bound", "=", "subst", "(", "tv", ".", "bound", ",", "tvars", ",", "tvars1", ")", ";", "}", "return", "tvars1", ";", "}" ]
Create new vector of type variables from list of variables changing all recursive bounds from old to new list.
[ "Create", "new", "vector", "of", "type", "variables", "from", "list", "of", "variables", "changing", "all", "recursive", "bounds", "from", "old", "to", "new", "list", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3188-L3195
5,541
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.closure
public List<Type> closure(Type t) { List<Type> cl = closureCache.get(t); if (cl == null) { Type st = supertype(t); if (!t.isCompound()) { if (st.hasTag(CLASS)) { cl = insert(closure(st), t); } else if (st.hasTag(TYPEVAR)) { cl = closure(st).prepend(t); } else { cl = List.of(t); } } else { cl = closure(supertype(t)); } for (List<Type> l = interfaces(t); l.nonEmpty(); l = l.tail) cl = union(cl, closure(l.head)); closureCache.put(t, cl); } return cl; }
java
public List<Type> closure(Type t) { List<Type> cl = closureCache.get(t); if (cl == null) { Type st = supertype(t); if (!t.isCompound()) { if (st.hasTag(CLASS)) { cl = insert(closure(st), t); } else if (st.hasTag(TYPEVAR)) { cl = closure(st).prepend(t); } else { cl = List.of(t); } } else { cl = closure(supertype(t)); } for (List<Type> l = interfaces(t); l.nonEmpty(); l = l.tail) cl = union(cl, closure(l.head)); closureCache.put(t, cl); } return cl; }
[ "public", "List", "<", "Type", ">", "closure", "(", "Type", "t", ")", "{", "List", "<", "Type", ">", "cl", "=", "closureCache", ".", "get", "(", "t", ")", ";", "if", "(", "cl", "==", "null", ")", "{", "Type", "st", "=", "supertype", "(", "t", ")", ";", "if", "(", "!", "t", ".", "isCompound", "(", ")", ")", "{", "if", "(", "st", ".", "hasTag", "(", "CLASS", ")", ")", "{", "cl", "=", "insert", "(", "closure", "(", "st", ")", ",", "t", ")", ";", "}", "else", "if", "(", "st", ".", "hasTag", "(", "TYPEVAR", ")", ")", "{", "cl", "=", "closure", "(", "st", ")", ".", "prepend", "(", "t", ")", ";", "}", "else", "{", "cl", "=", "List", ".", "of", "(", "t", ")", ";", "}", "}", "else", "{", "cl", "=", "closure", "(", "supertype", "(", "t", ")", ")", ";", "}", "for", "(", "List", "<", "Type", ">", "l", "=", "interfaces", "(", "t", ")", ";", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", ".", "tail", ")", "cl", "=", "union", "(", "cl", ",", "closure", "(", "l", ".", "head", ")", ")", ";", "closureCache", ".", "put", "(", "t", ",", "cl", ")", ";", "}", "return", "cl", ";", "}" ]
Returns the closure of a class or interface type.
[ "Returns", "the", "closure", "of", "a", "class", "or", "interface", "type", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3411-L3431
5,542
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.closureCollector
public Collector<Type, ClosureHolder, List<Type>> closureCollector(boolean minClosure, BiPredicate<Type, Type> shouldSkip) { return Collector.of(() -> new ClosureHolder(minClosure, shouldSkip), ClosureHolder::add, ClosureHolder::merge, ClosureHolder::closure); }
java
public Collector<Type, ClosureHolder, List<Type>> closureCollector(boolean minClosure, BiPredicate<Type, Type> shouldSkip) { return Collector.of(() -> new ClosureHolder(minClosure, shouldSkip), ClosureHolder::add, ClosureHolder::merge, ClosureHolder::closure); }
[ "public", "Collector", "<", "Type", ",", "ClosureHolder", ",", "List", "<", "Type", ">", ">", "closureCollector", "(", "boolean", "minClosure", ",", "BiPredicate", "<", "Type", ",", "Type", ">", "shouldSkip", ")", "{", "return", "Collector", ".", "of", "(", "(", ")", "->", "new", "ClosureHolder", "(", "minClosure", ",", "shouldSkip", ")", ",", "ClosureHolder", "::", "add", ",", "ClosureHolder", "::", "merge", ",", "ClosureHolder", "::", "closure", ")", ";", "}" ]
Collect types into a new closure (using a @code{ClosureHolder})
[ "Collect", "types", "into", "a", "new", "closure", "(", "using", "a" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3436-L3441
5,543
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.intersect
public List<Type> intersect(List<Type> cl1, List<Type> cl2) { if (cl1 == cl2) return cl1; if (cl1.isEmpty() || cl2.isEmpty()) return List.nil(); if (cl1.head.tsym.precedes(cl2.head.tsym, this)) return intersect(cl1.tail, cl2); if (cl2.head.tsym.precedes(cl1.head.tsym, this)) return intersect(cl1, cl2.tail); if (isSameType(cl1.head, cl2.head)) return intersect(cl1.tail, cl2.tail).prepend(cl1.head); if (cl1.head.tsym == cl2.head.tsym && cl1.head.hasTag(CLASS) && cl2.head.hasTag(CLASS)) { if (cl1.head.isParameterized() && cl2.head.isParameterized()) { Type merge = merge(cl1.head,cl2.head); return intersect(cl1.tail, cl2.tail).prepend(merge); } if (cl1.head.isRaw() || cl2.head.isRaw()) return intersect(cl1.tail, cl2.tail).prepend(erasure(cl1.head)); } return intersect(cl1.tail, cl2.tail); }
java
public List<Type> intersect(List<Type> cl1, List<Type> cl2) { if (cl1 == cl2) return cl1; if (cl1.isEmpty() || cl2.isEmpty()) return List.nil(); if (cl1.head.tsym.precedes(cl2.head.tsym, this)) return intersect(cl1.tail, cl2); if (cl2.head.tsym.precedes(cl1.head.tsym, this)) return intersect(cl1, cl2.tail); if (isSameType(cl1.head, cl2.head)) return intersect(cl1.tail, cl2.tail).prepend(cl1.head); if (cl1.head.tsym == cl2.head.tsym && cl1.head.hasTag(CLASS) && cl2.head.hasTag(CLASS)) { if (cl1.head.isParameterized() && cl2.head.isParameterized()) { Type merge = merge(cl1.head,cl2.head); return intersect(cl1.tail, cl2.tail).prepend(merge); } if (cl1.head.isRaw() || cl2.head.isRaw()) return intersect(cl1.tail, cl2.tail).prepend(erasure(cl1.head)); } return intersect(cl1.tail, cl2.tail); }
[ "public", "List", "<", "Type", ">", "intersect", "(", "List", "<", "Type", ">", "cl1", ",", "List", "<", "Type", ">", "cl2", ")", "{", "if", "(", "cl1", "==", "cl2", ")", "return", "cl1", ";", "if", "(", "cl1", ".", "isEmpty", "(", ")", "||", "cl2", ".", "isEmpty", "(", ")", ")", "return", "List", ".", "nil", "(", ")", ";", "if", "(", "cl1", ".", "head", ".", "tsym", ".", "precedes", "(", "cl2", ".", "head", ".", "tsym", ",", "this", ")", ")", "return", "intersect", "(", "cl1", ".", "tail", ",", "cl2", ")", ";", "if", "(", "cl2", ".", "head", ".", "tsym", ".", "precedes", "(", "cl1", ".", "head", ".", "tsym", ",", "this", ")", ")", "return", "intersect", "(", "cl1", ",", "cl2", ".", "tail", ")", ";", "if", "(", "isSameType", "(", "cl1", ".", "head", ",", "cl2", ".", "head", ")", ")", "return", "intersect", "(", "cl1", ".", "tail", ",", "cl2", ".", "tail", ")", ".", "prepend", "(", "cl1", ".", "head", ")", ";", "if", "(", "cl1", ".", "head", ".", "tsym", "==", "cl2", ".", "head", ".", "tsym", "&&", "cl1", ".", "head", ".", "hasTag", "(", "CLASS", ")", "&&", "cl2", ".", "head", ".", "hasTag", "(", "CLASS", ")", ")", "{", "if", "(", "cl1", ".", "head", ".", "isParameterized", "(", ")", "&&", "cl2", ".", "head", ".", "isParameterized", "(", ")", ")", "{", "Type", "merge", "=", "merge", "(", "cl1", ".", "head", ",", "cl2", ".", "head", ")", ";", "return", "intersect", "(", "cl1", ".", "tail", ",", "cl2", ".", "tail", ")", ".", "prepend", "(", "merge", ")", ";", "}", "if", "(", "cl1", ".", "head", ".", "isRaw", "(", ")", "||", "cl2", ".", "head", ".", "isRaw", "(", ")", ")", "return", "intersect", "(", "cl1", ".", "tail", ",", "cl2", ".", "tail", ")", ".", "prepend", "(", "erasure", "(", "cl1", ".", "head", ")", ")", ";", "}", "return", "intersect", "(", "cl1", ".", "tail", ",", "cl2", ".", "tail", ")", ";", "}" ]
Intersect two closures
[ "Intersect", "two", "closures" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3517-L3538
5,544
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.compoundMin
private Type compoundMin(List<Type> cl) { if (cl.isEmpty()) return syms.objectType; List<Type> compound = closureMin(cl); if (compound.isEmpty()) return null; else if (compound.tail.isEmpty()) return compound.head; else return makeIntersectionType(compound); }
java
private Type compoundMin(List<Type> cl) { if (cl.isEmpty()) return syms.objectType; List<Type> compound = closureMin(cl); if (compound.isEmpty()) return null; else if (compound.tail.isEmpty()) return compound.head; else return makeIntersectionType(compound); }
[ "private", "Type", "compoundMin", "(", "List", "<", "Type", ">", "cl", ")", "{", "if", "(", "cl", ".", "isEmpty", "(", ")", ")", "return", "syms", ".", "objectType", ";", "List", "<", "Type", ">", "compound", "=", "closureMin", "(", "cl", ")", ";", "if", "(", "compound", ".", "isEmpty", "(", ")", ")", "return", "null", ";", "else", "if", "(", "compound", ".", "tail", ".", "isEmpty", "(", ")", ")", "return", "compound", ".", "head", ";", "else", "return", "makeIntersectionType", "(", "compound", ")", ";", "}" ]
Return the minimum type of a closure, a compound type if no unique minimum exists.
[ "Return", "the", "minimum", "type", "of", "a", "closure", "a", "compound", "type", "if", "no", "unique", "minimum", "exists", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3612-L3621
5,545
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.closureMin
private List<Type> closureMin(List<Type> cl) { ListBuffer<Type> classes = new ListBuffer<>(); ListBuffer<Type> interfaces = new ListBuffer<>(); Set<Type> toSkip = new HashSet<>(); while (!cl.isEmpty()) { Type current = cl.head; boolean keep = !toSkip.contains(current); if (keep && current.hasTag(TYPEVAR)) { // skip lower-bounded variables with a subtype in cl.tail for (Type t : cl.tail) { if (isSubtypeNoCapture(t, current)) { keep = false; break; } } } if (keep) { if (current.isInterface()) interfaces.append(current); else classes.append(current); for (Type t : cl.tail) { // skip supertypes of 'current' in cl.tail if (isSubtypeNoCapture(current, t)) toSkip.add(t); } } cl = cl.tail; } return classes.appendList(interfaces).toList(); }
java
private List<Type> closureMin(List<Type> cl) { ListBuffer<Type> classes = new ListBuffer<>(); ListBuffer<Type> interfaces = new ListBuffer<>(); Set<Type> toSkip = new HashSet<>(); while (!cl.isEmpty()) { Type current = cl.head; boolean keep = !toSkip.contains(current); if (keep && current.hasTag(TYPEVAR)) { // skip lower-bounded variables with a subtype in cl.tail for (Type t : cl.tail) { if (isSubtypeNoCapture(t, current)) { keep = false; break; } } } if (keep) { if (current.isInterface()) interfaces.append(current); else classes.append(current); for (Type t : cl.tail) { // skip supertypes of 'current' in cl.tail if (isSubtypeNoCapture(current, t)) toSkip.add(t); } } cl = cl.tail; } return classes.appendList(interfaces).toList(); }
[ "private", "List", "<", "Type", ">", "closureMin", "(", "List", "<", "Type", ">", "cl", ")", "{", "ListBuffer", "<", "Type", ">", "classes", "=", "new", "ListBuffer", "<>", "(", ")", ";", "ListBuffer", "<", "Type", ">", "interfaces", "=", "new", "ListBuffer", "<>", "(", ")", ";", "Set", "<", "Type", ">", "toSkip", "=", "new", "HashSet", "<>", "(", ")", ";", "while", "(", "!", "cl", ".", "isEmpty", "(", ")", ")", "{", "Type", "current", "=", "cl", ".", "head", ";", "boolean", "keep", "=", "!", "toSkip", ".", "contains", "(", "current", ")", ";", "if", "(", "keep", "&&", "current", ".", "hasTag", "(", "TYPEVAR", ")", ")", "{", "// skip lower-bounded variables with a subtype in cl.tail", "for", "(", "Type", "t", ":", "cl", ".", "tail", ")", "{", "if", "(", "isSubtypeNoCapture", "(", "t", ",", "current", ")", ")", "{", "keep", "=", "false", ";", "break", ";", "}", "}", "}", "if", "(", "keep", ")", "{", "if", "(", "current", ".", "isInterface", "(", ")", ")", "interfaces", ".", "append", "(", "current", ")", ";", "else", "classes", ".", "append", "(", "current", ")", ";", "for", "(", "Type", "t", ":", "cl", ".", "tail", ")", "{", "// skip supertypes of 'current' in cl.tail", "if", "(", "isSubtypeNoCapture", "(", "current", ",", "t", ")", ")", "toSkip", ".", "add", "(", "t", ")", ";", "}", "}", "cl", "=", "cl", ".", "tail", ";", "}", "return", "classes", ".", "appendList", "(", "interfaces", ")", ".", "toList", "(", ")", ";", "}" ]
Return the minimum types of a closure, suitable for computing compoundMin or glb.
[ "Return", "the", "minimum", "types", "of", "a", "closure", "suitable", "for", "computing", "compoundMin", "or", "glb", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3627-L3657
5,546
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.lub
public Type lub(List<Type> ts) { return lub(ts.toArray(new Type[ts.length()])); }
java
public Type lub(List<Type> ts) { return lub(ts.toArray(new Type[ts.length()])); }
[ "public", "Type", "lub", "(", "List", "<", "Type", ">", "ts", ")", "{", "return", "lub", "(", "ts", ".", "toArray", "(", "new", "Type", "[", "ts", ".", "length", "(", ")", "]", ")", ")", ";", "}" ]
Return the least upper bound of list of types. if the lub does not exist return null.
[ "Return", "the", "least", "upper", "bound", "of", "list", "of", "types", ".", "if", "the", "lub", "does", "not", "exist", "return", "null", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3663-L3665
5,547
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.returnTypeSubstitutable
public boolean returnTypeSubstitutable(Type r1, Type r2) { if (hasSameArgs(r1, r2)) return resultSubtype(r1, r2, noWarnings); else return covariantReturnType(r1.getReturnType(), erasure(r2.getReturnType()), noWarnings); }
java
public boolean returnTypeSubstitutable(Type r1, Type r2) { if (hasSameArgs(r1, r2)) return resultSubtype(r1, r2, noWarnings); else return covariantReturnType(r1.getReturnType(), erasure(r2.getReturnType()), noWarnings); }
[ "public", "boolean", "returnTypeSubstitutable", "(", "Type", "r1", ",", "Type", "r2", ")", "{", "if", "(", "hasSameArgs", "(", "r1", ",", "r2", ")", ")", "return", "resultSubtype", "(", "r1", ",", "r2", ",", "noWarnings", ")", ";", "else", "return", "covariantReturnType", "(", "r1", ".", "getReturnType", "(", ")", ",", "erasure", "(", "r2", ".", "getReturnType", "(", ")", ")", ",", "noWarnings", ")", ";", "}" ]
Return-Type-Substitutable. @jls section 8.4.5
[ "Return", "-", "Type", "-", "Substitutable", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3977-L3984
5,548
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.boxedTypeOrType
public Type boxedTypeOrType(Type t) { return t.isPrimitive() ? boxedClass(t).type : t; }
java
public Type boxedTypeOrType(Type t) { return t.isPrimitive() ? boxedClass(t).type : t; }
[ "public", "Type", "boxedTypeOrType", "(", "Type", "t", ")", "{", "return", "t", ".", "isPrimitive", "(", ")", "?", "boxedClass", "(", "t", ")", ".", "type", ":", "t", ";", "}" ]
Return the boxed type if 't' is primitive, otherwise return 't' itself.
[ "Return", "the", "boxed", "type", "if", "t", "is", "primitive", "otherwise", "return", "t", "itself", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L4028-L4032
5,549
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.unboxedType
public Type unboxedType(Type t) { for (int i=0; i<syms.boxedName.length; i++) { Name box = syms.boxedName[i]; if (box != null && asSuper(t, syms.enterClass(syms.java_base, box)) != null) return syms.typeOfTag[i]; } return Type.noType; }
java
public Type unboxedType(Type t) { for (int i=0; i<syms.boxedName.length; i++) { Name box = syms.boxedName[i]; if (box != null && asSuper(t, syms.enterClass(syms.java_base, box)) != null) return syms.typeOfTag[i]; } return Type.noType; }
[ "public", "Type", "unboxedType", "(", "Type", "t", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "syms", ".", "boxedName", ".", "length", ";", "i", "++", ")", "{", "Name", "box", "=", "syms", ".", "boxedName", "[", "i", "]", ";", "if", "(", "box", "!=", "null", "&&", "asSuper", "(", "t", ",", "syms", ".", "enterClass", "(", "syms", ".", "java_base", ",", "box", ")", ")", "!=", "null", ")", "return", "syms", ".", "typeOfTag", "[", "i", "]", ";", "}", "return", "Type", ".", "noType", ";", "}" ]
Return the primitive type corresponding to a boxed type.
[ "Return", "the", "primitive", "type", "corresponding", "to", "a", "boxed", "type", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L4037-L4045
5,550
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.unboxedTypeOrType
public Type unboxedTypeOrType(Type t) { Type unboxedType = unboxedType(t); return unboxedType.hasTag(NONE) ? t : unboxedType; }
java
public Type unboxedTypeOrType(Type t) { Type unboxedType = unboxedType(t); return unboxedType.hasTag(NONE) ? t : unboxedType; }
[ "public", "Type", "unboxedTypeOrType", "(", "Type", "t", ")", "{", "Type", "unboxedType", "=", "unboxedType", "(", "t", ")", ";", "return", "unboxedType", ".", "hasTag", "(", "NONE", ")", "?", "t", ":", "unboxedType", ";", "}" ]
Return the unboxed type if 't' is a boxed class, otherwise return 't' itself.
[ "Return", "the", "unboxed", "type", "if", "t", "is", "a", "boxed", "class", "otherwise", "return", "t", "itself", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L4050-L4053
5,551
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.capture
public List<Type> capture(List<Type> ts) { List<Type> buf = List.nil(); for (Type t : ts) { buf = buf.prepend(capture(t)); } return buf.reverse(); }
java
public List<Type> capture(List<Type> ts) { List<Type> buf = List.nil(); for (Type t : ts) { buf = buf.prepend(capture(t)); } return buf.reverse(); }
[ "public", "List", "<", "Type", ">", "capture", "(", "List", "<", "Type", ">", "ts", ")", "{", "List", "<", "Type", ">", "buf", "=", "List", ".", "nil", "(", ")", ";", "for", "(", "Type", "t", ":", "ts", ")", "{", "buf", "=", "buf", ".", "prepend", "(", "capture", "(", "t", ")", ")", ";", "}", "return", "buf", ".", "reverse", "(", ")", ";", "}" ]
Capture conversion as specified by the JLS.
[ "Capture", "conversion", "as", "specified", "by", "the", "JLS", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L4094-L4100
5,552
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.adapt
public void adapt(Type source, Type target, ListBuffer<Type> from, ListBuffer<Type> to) throws AdaptFailure { new Adapter(from, to).adapt(source, target); }
java
public void adapt(Type source, Type target, ListBuffer<Type> from, ListBuffer<Type> to) throws AdaptFailure { new Adapter(from, to).adapt(source, target); }
[ "public", "void", "adapt", "(", "Type", "source", ",", "Type", "target", ",", "ListBuffer", "<", "Type", ">", "from", ",", "ListBuffer", "<", "Type", ">", "to", ")", "throws", "AdaptFailure", "{", "new", "Adapter", "(", "from", ",", "to", ")", ".", "adapt", "(", "source", ",", "target", ")", ";", "}" ]
Adapt a type by computing a substitution which maps a source type to a target type. @param source the source type @param target the target type @param from the type variables of the computed substitution @param to the types of the computed substitution.
[ "Adapt", "a", "type", "by", "computing", "a", "substitution", "which", "maps", "a", "source", "type", "to", "a", "target", "type", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L4291-L4296
5,553
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java
AnnotationDescImpl.annotationType
public AnnotationTypeDoc annotationType() { ClassSymbol atsym = (ClassSymbol)annotation.type.tsym; if (annotation.type.isErroneous()) { env.warning(null, "javadoc.class_not_found", annotation.type.toString()); return new AnnotationTypeDocImpl(env, atsym); } else { return (AnnotationTypeDoc)env.getClassDoc(atsym); } }
java
public AnnotationTypeDoc annotationType() { ClassSymbol atsym = (ClassSymbol)annotation.type.tsym; if (annotation.type.isErroneous()) { env.warning(null, "javadoc.class_not_found", annotation.type.toString()); return new AnnotationTypeDocImpl(env, atsym); } else { return (AnnotationTypeDoc)env.getClassDoc(atsym); } }
[ "public", "AnnotationTypeDoc", "annotationType", "(", ")", "{", "ClassSymbol", "atsym", "=", "(", "ClassSymbol", ")", "annotation", ".", "type", ".", "tsym", ";", "if", "(", "annotation", ".", "type", ".", "isErroneous", "(", ")", ")", "{", "env", ".", "warning", "(", "null", ",", "\"javadoc.class_not_found\"", ",", "annotation", ".", "type", ".", "toString", "(", ")", ")", ";", "return", "new", "AnnotationTypeDocImpl", "(", "env", ",", "atsym", ")", ";", "}", "else", "{", "return", "(", "AnnotationTypeDoc", ")", "env", ".", "getClassDoc", "(", "atsym", ")", ";", "}", "}" ]
Returns the annotation type of this annotation.
[ "Returns", "the", "annotation", "type", "of", "this", "annotation", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java#L66-L74
5,554
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java
AnnotationDescImpl.elementValues
public ElementValuePair[] elementValues() { List<Pair<MethodSymbol,Attribute>> vals = annotation.values; ElementValuePair res[] = new ElementValuePair[vals.length()]; int i = 0; for (Pair<MethodSymbol,Attribute> val : vals) { res[i++] = new ElementValuePairImpl(env, val.fst, val.snd); } return res; }
java
public ElementValuePair[] elementValues() { List<Pair<MethodSymbol,Attribute>> vals = annotation.values; ElementValuePair res[] = new ElementValuePair[vals.length()]; int i = 0; for (Pair<MethodSymbol,Attribute> val : vals) { res[i++] = new ElementValuePairImpl(env, val.fst, val.snd); } return res; }
[ "public", "ElementValuePair", "[", "]", "elementValues", "(", ")", "{", "List", "<", "Pair", "<", "MethodSymbol", ",", "Attribute", ">", ">", "vals", "=", "annotation", ".", "values", ";", "ElementValuePair", "res", "[", "]", "=", "new", "ElementValuePair", "[", "vals", ".", "length", "(", ")", "]", ";", "int", "i", "=", "0", ";", "for", "(", "Pair", "<", "MethodSymbol", ",", "Attribute", ">", "val", ":", "vals", ")", "{", "res", "[", "i", "++", "]", "=", "new", "ElementValuePairImpl", "(", "env", ",", "val", ".", "fst", ",", "val", ".", "snd", ")", ";", "}", "return", "res", ";", "}" ]
Returns this annotation's elements and their values. Only those explicitly present in the annotation are included, not those assuming their default values. Returns an empty array if there are none.
[ "Returns", "this", "annotation", "s", "elements", "and", "their", "values", ".", "Only", "those", "explicitly", "present", "in", "the", "annotation", "are", "included", "not", "those", "assuming", "their", "default", "values", ".", "Returns", "an", "empty", "array", "if", "there", "are", "none", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java#L82-L90
5,555
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java
TagletManager.getCustomTaglets
public List<Taglet> getCustomTaglets(Element e) { switch (e.getKind()) { case CONSTRUCTOR: return getConstructorCustomTaglets(); case METHOD: return getMethodCustomTaglets(); case ENUM_CONSTANT: case FIELD: return getFieldCustomTaglets(); case ANNOTATION_TYPE: case INTERFACE: case CLASS: case ENUM: return getTypeCustomTaglets(); case MODULE: return getModuleCustomTaglets(); case PACKAGE: return getPackageCustomTaglets(); case OTHER: return getOverviewCustomTaglets(); default: throw new AssertionError("unknown element: " + e + " ,kind: " + e.getKind()); } }
java
public List<Taglet> getCustomTaglets(Element e) { switch (e.getKind()) { case CONSTRUCTOR: return getConstructorCustomTaglets(); case METHOD: return getMethodCustomTaglets(); case ENUM_CONSTANT: case FIELD: return getFieldCustomTaglets(); case ANNOTATION_TYPE: case INTERFACE: case CLASS: case ENUM: return getTypeCustomTaglets(); case MODULE: return getModuleCustomTaglets(); case PACKAGE: return getPackageCustomTaglets(); case OTHER: return getOverviewCustomTaglets(); default: throw new AssertionError("unknown element: " + e + " ,kind: " + e.getKind()); } }
[ "public", "List", "<", "Taglet", ">", "getCustomTaglets", "(", "Element", "e", ")", "{", "switch", "(", "e", ".", "getKind", "(", ")", ")", "{", "case", "CONSTRUCTOR", ":", "return", "getConstructorCustomTaglets", "(", ")", ";", "case", "METHOD", ":", "return", "getMethodCustomTaglets", "(", ")", ";", "case", "ENUM_CONSTANT", ":", "case", "FIELD", ":", "return", "getFieldCustomTaglets", "(", ")", ";", "case", "ANNOTATION_TYPE", ":", "case", "INTERFACE", ":", "case", "CLASS", ":", "case", "ENUM", ":", "return", "getTypeCustomTaglets", "(", ")", ";", "case", "MODULE", ":", "return", "getModuleCustomTaglets", "(", ")", ";", "case", "PACKAGE", ":", "return", "getPackageCustomTaglets", "(", ")", ";", "case", "OTHER", ":", "return", "getOverviewCustomTaglets", "(", ")", ";", "default", ":", "throw", "new", "AssertionError", "(", "\"unknown element: \"", "+", "e", "+", "\" ,kind: \"", "+", "e", ".", "getKind", "(", ")", ")", ";", "}", "}" ]
Returns the custom tags for a given element. @param e the element to get custom tags for @return the array of <code>Taglet</code>s that can appear in the given element.
[ "Returns", "the", "custom", "tags", "for", "a", "given", "element", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java#L581-L604
5,556
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java
TagletManager.initCustomTaglets
private void initCustomTaglets() { moduleTags = new ArrayList<>(); packageTags = new ArrayList<>(); typeTags = new ArrayList<>(); fieldTags = new ArrayList<>(); constructorTags = new ArrayList<>(); methodTags = new ArrayList<>(); inlineTags = new ArrayList<>(); overviewTags = new ArrayList<>(); for (Taglet current : customTags.values()) { if (current.inModule() && !current.isInlineTag()) { moduleTags.add(current); } if (current.inPackage() && !current.isInlineTag()) { packageTags.add(current); } if (current.inType() && !current.isInlineTag()) { typeTags.add(current); } if (current.inField() && !current.isInlineTag()) { fieldTags.add(current); } if (current.inConstructor() && !current.isInlineTag()) { constructorTags.add(current); } if (current.inMethod() && !current.isInlineTag()) { methodTags.add(current); } if (current.isInlineTag()) { inlineTags.add(current); } if (current.inOverview() && !current.isInlineTag()) { overviewTags.add(current); } } //Init the serialized form tags serializedFormTags = new ArrayList<>(); serializedFormTags.add(customTags.get(SERIAL_DATA.tagName)); serializedFormTags.add(customTags.get(THROWS.tagName)); if (!nosince) serializedFormTags.add(customTags.get(SINCE.tagName)); serializedFormTags.add(customTags.get(SEE.tagName)); }
java
private void initCustomTaglets() { moduleTags = new ArrayList<>(); packageTags = new ArrayList<>(); typeTags = new ArrayList<>(); fieldTags = new ArrayList<>(); constructorTags = new ArrayList<>(); methodTags = new ArrayList<>(); inlineTags = new ArrayList<>(); overviewTags = new ArrayList<>(); for (Taglet current : customTags.values()) { if (current.inModule() && !current.isInlineTag()) { moduleTags.add(current); } if (current.inPackage() && !current.isInlineTag()) { packageTags.add(current); } if (current.inType() && !current.isInlineTag()) { typeTags.add(current); } if (current.inField() && !current.isInlineTag()) { fieldTags.add(current); } if (current.inConstructor() && !current.isInlineTag()) { constructorTags.add(current); } if (current.inMethod() && !current.isInlineTag()) { methodTags.add(current); } if (current.isInlineTag()) { inlineTags.add(current); } if (current.inOverview() && !current.isInlineTag()) { overviewTags.add(current); } } //Init the serialized form tags serializedFormTags = new ArrayList<>(); serializedFormTags.add(customTags.get(SERIAL_DATA.tagName)); serializedFormTags.add(customTags.get(THROWS.tagName)); if (!nosince) serializedFormTags.add(customTags.get(SINCE.tagName)); serializedFormTags.add(customTags.get(SEE.tagName)); }
[ "private", "void", "initCustomTaglets", "(", ")", "{", "moduleTags", "=", "new", "ArrayList", "<>", "(", ")", ";", "packageTags", "=", "new", "ArrayList", "<>", "(", ")", ";", "typeTags", "=", "new", "ArrayList", "<>", "(", ")", ";", "fieldTags", "=", "new", "ArrayList", "<>", "(", ")", ";", "constructorTags", "=", "new", "ArrayList", "<>", "(", ")", ";", "methodTags", "=", "new", "ArrayList", "<>", "(", ")", ";", "inlineTags", "=", "new", "ArrayList", "<>", "(", ")", ";", "overviewTags", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Taglet", "current", ":", "customTags", ".", "values", "(", ")", ")", "{", "if", "(", "current", ".", "inModule", "(", ")", "&&", "!", "current", ".", "isInlineTag", "(", ")", ")", "{", "moduleTags", ".", "add", "(", "current", ")", ";", "}", "if", "(", "current", ".", "inPackage", "(", ")", "&&", "!", "current", ".", "isInlineTag", "(", ")", ")", "{", "packageTags", ".", "add", "(", "current", ")", ";", "}", "if", "(", "current", ".", "inType", "(", ")", "&&", "!", "current", ".", "isInlineTag", "(", ")", ")", "{", "typeTags", ".", "add", "(", "current", ")", ";", "}", "if", "(", "current", ".", "inField", "(", ")", "&&", "!", "current", ".", "isInlineTag", "(", ")", ")", "{", "fieldTags", ".", "add", "(", "current", ")", ";", "}", "if", "(", "current", ".", "inConstructor", "(", ")", "&&", "!", "current", ".", "isInlineTag", "(", ")", ")", "{", "constructorTags", ".", "add", "(", "current", ")", ";", "}", "if", "(", "current", ".", "inMethod", "(", ")", "&&", "!", "current", ".", "isInlineTag", "(", ")", ")", "{", "methodTags", ".", "add", "(", "current", ")", ";", "}", "if", "(", "current", ".", "isInlineTag", "(", ")", ")", "{", "inlineTags", ".", "add", "(", "current", ")", ";", "}", "if", "(", "current", ".", "inOverview", "(", ")", "&&", "!", "current", ".", "isInlineTag", "(", ")", ")", "{", "overviewTags", ".", "add", "(", "current", ")", ";", "}", "}", "//Init the serialized form tags", "serializedFormTags", "=", "new", "ArrayList", "<>", "(", ")", ";", "serializedFormTags", ".", "add", "(", "customTags", ".", "get", "(", "SERIAL_DATA", ".", "tagName", ")", ")", ";", "serializedFormTags", ".", "add", "(", "customTags", ".", "get", "(", "THROWS", ".", "tagName", ")", ")", ";", "if", "(", "!", "nosince", ")", "serializedFormTags", ".", "add", "(", "customTags", ".", "get", "(", "SINCE", ".", "tagName", ")", ")", ";", "serializedFormTags", ".", "add", "(", "customTags", ".", "get", "(", "SEE", ".", "tagName", ")", ")", ";", "}" ]
Initialize the custom tag Lists.
[ "Initialize", "the", "custom", "tag", "Lists", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java#L648-L693
5,557
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/MethodDocImpl.java
MethodDocImpl.returnType
public com.sun.javadoc.Type returnType() { return TypeMaker.getType(env, sym.type.getReturnType(), false); }
java
public com.sun.javadoc.Type returnType() { return TypeMaker.getType(env, sym.type.getReturnType(), false); }
[ "public", "com", ".", "sun", ".", "javadoc", ".", "Type", "returnType", "(", ")", "{", "return", "TypeMaker", ".", "getType", "(", "env", ",", "sym", ".", "type", ".", "getReturnType", "(", ")", ",", "false", ")", ";", "}" ]
Get return type. @return the return type of this method, null if it is a constructor.
[ "Get", "return", "type", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/MethodDocImpl.java#L99-L101
5,558
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/MethodDocImpl.java
MethodDocImpl.membersOf
private Scope membersOf(ClassSymbol c) { try { return c.members(); } catch (CompletionFailure cf) { /* Quietly ignore completion failures and try again - the type * for which the CompletionFailure was thrown shouldn't be completed * again by the completer that threw the CompletionFailure. */ return membersOf(c); } }
java
private Scope membersOf(ClassSymbol c) { try { return c.members(); } catch (CompletionFailure cf) { /* Quietly ignore completion failures and try again - the type * for which the CompletionFailure was thrown shouldn't be completed * again by the completer that threw the CompletionFailure. */ return membersOf(c); } }
[ "private", "Scope", "membersOf", "(", "ClassSymbol", "c", ")", "{", "try", "{", "return", "c", ".", "members", "(", ")", ";", "}", "catch", "(", "CompletionFailure", "cf", ")", "{", "/* Quietly ignore completion failures and try again - the type\n * for which the CompletionFailure was thrown shouldn't be completed\n * again by the completer that threw the CompletionFailure.\n */", "return", "membersOf", "(", "c", ")", ";", "}", "}" ]
Retrieve members of c, ignoring any CompletionFailures that occur.
[ "Retrieve", "members", "of", "c", "ignoring", "any", "CompletionFailures", "that", "occur", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/MethodDocImpl.java#L174-L184
5,559
subinkrishna/CircularImageView
sample/src/main/java/com/subinkrishna/circularimageview/demo/MainActivity.java
MainActivity.onCodeContainerAnimationEnd
private void onCodeContainerAnimationEnd(boolean isCodeVisible) { if (isCodeVisible) { mCodeContainer.setVisibility(View.GONE); mFab.setImageResource(R.drawable.ic_code_black_24dp); mCodeContainer.scrollTo(0, 0); } else { mFab.setImageResource(R.drawable.ic_close_black_24dp); } mIsAnimating = false; }
java
private void onCodeContainerAnimationEnd(boolean isCodeVisible) { if (isCodeVisible) { mCodeContainer.setVisibility(View.GONE); mFab.setImageResource(R.drawable.ic_code_black_24dp); mCodeContainer.scrollTo(0, 0); } else { mFab.setImageResource(R.drawable.ic_close_black_24dp); } mIsAnimating = false; }
[ "private", "void", "onCodeContainerAnimationEnd", "(", "boolean", "isCodeVisible", ")", "{", "if", "(", "isCodeVisible", ")", "{", "mCodeContainer", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "mFab", ".", "setImageResource", "(", "R", ".", "drawable", ".", "ic_code_black_24dp", ")", ";", "mCodeContainer", ".", "scrollTo", "(", "0", ",", "0", ")", ";", "}", "else", "{", "mFab", ".", "setImageResource", "(", "R", ".", "drawable", ".", "ic_close_black_24dp", ")", ";", "}", "mIsAnimating", "=", "false", ";", "}" ]
Updates the view on animation end. @param isCodeVisible
[ "Updates", "the", "view", "on", "animation", "end", "." ]
b3033a79f4f831c0a7c2567cc52f63b8410198a2
https://github.com/subinkrishna/CircularImageView/blob/b3033a79f4f831c0a7c2567cc52f63b8410198a2/sample/src/main/java/com/subinkrishna/circularimageview/demo/MainActivity.java#L217-L227
5,560
subinkrishna/CircularImageView
sample/src/main/java/com/subinkrishna/circularimageview/demo/MainActivity.java
MainActivity.setupImageContainer
private void setupImageContainer() { Resources res = getResources(); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.grid); int cellH = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 22, res.getDisplayMetrics()); bitmap = Bitmap.createScaledBitmap(bitmap, cellH, cellH, true); BitmapDrawable bitmapDrawable = new BitmapDrawable(res, bitmap); bitmapDrawable.setTileModeX(Shader.TileMode.REPEAT); bitmapDrawable.setTileModeY(Shader.TileMode.REPEAT); mImageContainer.setBackgroundDrawable(bitmapDrawable); }
java
private void setupImageContainer() { Resources res = getResources(); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.grid); int cellH = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 22, res.getDisplayMetrics()); bitmap = Bitmap.createScaledBitmap(bitmap, cellH, cellH, true); BitmapDrawable bitmapDrawable = new BitmapDrawable(res, bitmap); bitmapDrawable.setTileModeX(Shader.TileMode.REPEAT); bitmapDrawable.setTileModeY(Shader.TileMode.REPEAT); mImageContainer.setBackgroundDrawable(bitmapDrawable); }
[ "private", "void", "setupImageContainer", "(", ")", "{", "Resources", "res", "=", "getResources", "(", ")", ";", "Bitmap", "bitmap", "=", "BitmapFactory", ".", "decodeResource", "(", "getResources", "(", ")", ",", "R", ".", "drawable", ".", "grid", ")", ";", "int", "cellH", "=", "(", "int", ")", "TypedValue", ".", "applyDimension", "(", "TypedValue", ".", "COMPLEX_UNIT_DIP", ",", "22", ",", "res", ".", "getDisplayMetrics", "(", ")", ")", ";", "bitmap", "=", "Bitmap", ".", "createScaledBitmap", "(", "bitmap", ",", "cellH", ",", "cellH", ",", "true", ")", ";", "BitmapDrawable", "bitmapDrawable", "=", "new", "BitmapDrawable", "(", "res", ",", "bitmap", ")", ";", "bitmapDrawable", ".", "setTileModeX", "(", "Shader", ".", "TileMode", ".", "REPEAT", ")", ";", "bitmapDrawable", ".", "setTileModeY", "(", "Shader", ".", "TileMode", ".", "REPEAT", ")", ";", "mImageContainer", ".", "setBackgroundDrawable", "(", "bitmapDrawable", ")", ";", "}" ]
Setup image container
[ "Setup", "image", "container" ]
b3033a79f4f831c0a7c2567cc52f63b8410198a2
https://github.com/subinkrishna/CircularImageView/blob/b3033a79f4f831c0a7c2567cc52f63b8410198a2/sample/src/main/java/com/subinkrishna/circularimageview/demo/MainActivity.java#L257-L267
5,561
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleDotGraph.java
ModuleDotGraph.genDotFile
public void genDotFile(Path path, String name, Configuration configuration, Attributes attributes) throws IOException { // transitive reduction Graph<String> graph = apiOnly ? requiresTransitiveGraph(configuration, Set.of(name)) : gengraph(configuration); DotGraphBuilder builder = new DotGraphBuilder(name, graph, attributes); builder.subgraph("se", "java", attributes.javaSubgraphColor(), DotGraphBuilder.JAVA_SE_SUBGRAPH) .subgraph("jdk", "jdk", attributes.jdkSubgraphColor(), DotGraphBuilder.JDK_SUBGRAPH) .modules(graph.nodes().stream() .map(mn -> configuration.findModule(mn).get() .reference().descriptor())); // build dot file builder.build(path); }
java
public void genDotFile(Path path, String name, Configuration configuration, Attributes attributes) throws IOException { // transitive reduction Graph<String> graph = apiOnly ? requiresTransitiveGraph(configuration, Set.of(name)) : gengraph(configuration); DotGraphBuilder builder = new DotGraphBuilder(name, graph, attributes); builder.subgraph("se", "java", attributes.javaSubgraphColor(), DotGraphBuilder.JAVA_SE_SUBGRAPH) .subgraph("jdk", "jdk", attributes.jdkSubgraphColor(), DotGraphBuilder.JDK_SUBGRAPH) .modules(graph.nodes().stream() .map(mn -> configuration.findModule(mn).get() .reference().descriptor())); // build dot file builder.build(path); }
[ "public", "void", "genDotFile", "(", "Path", "path", ",", "String", "name", ",", "Configuration", "configuration", ",", "Attributes", "attributes", ")", "throws", "IOException", "{", "// transitive reduction", "Graph", "<", "String", ">", "graph", "=", "apiOnly", "?", "requiresTransitiveGraph", "(", "configuration", ",", "Set", ".", "of", "(", "name", ")", ")", ":", "gengraph", "(", "configuration", ")", ";", "DotGraphBuilder", "builder", "=", "new", "DotGraphBuilder", "(", "name", ",", "graph", ",", "attributes", ")", ";", "builder", ".", "subgraph", "(", "\"se\"", ",", "\"java\"", ",", "attributes", ".", "javaSubgraphColor", "(", ")", ",", "DotGraphBuilder", ".", "JAVA_SE_SUBGRAPH", ")", ".", "subgraph", "(", "\"jdk\"", ",", "\"jdk\"", ",", "attributes", ".", "jdkSubgraphColor", "(", ")", ",", "DotGraphBuilder", ".", "JDK_SUBGRAPH", ")", ".", "modules", "(", "graph", ".", "nodes", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "mn", "->", "configuration", ".", "findModule", "(", "mn", ")", ".", "get", "(", ")", ".", "reference", "(", ")", ".", "descriptor", "(", ")", ")", ")", ";", "// build dot file", "builder", ".", "build", "(", "path", ")", ";", "}" ]
Generate dotfile of the given path
[ "Generate", "dotfile", "of", "the", "given", "path" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleDotGraph.java#L97-L117
5,562
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleDotGraph.java
ModuleDotGraph.gengraph
private Graph<String> gengraph(Configuration cf) { Graph.Builder<String> builder = new Graph.Builder<>(); cf.modules().stream() .forEach(rm -> { String mn = rm.name(); builder.addNode(mn); rm.reads().stream() .map(ResolvedModule::name) .forEach(target -> builder.addEdge(mn, target)); }); Graph<String> rpg = requiresTransitiveGraph(cf, builder.nodes); return builder.build().reduce(rpg); }
java
private Graph<String> gengraph(Configuration cf) { Graph.Builder<String> builder = new Graph.Builder<>(); cf.modules().stream() .forEach(rm -> { String mn = rm.name(); builder.addNode(mn); rm.reads().stream() .map(ResolvedModule::name) .forEach(target -> builder.addEdge(mn, target)); }); Graph<String> rpg = requiresTransitiveGraph(cf, builder.nodes); return builder.build().reduce(rpg); }
[ "private", "Graph", "<", "String", ">", "gengraph", "(", "Configuration", "cf", ")", "{", "Graph", ".", "Builder", "<", "String", ">", "builder", "=", "new", "Graph", ".", "Builder", "<>", "(", ")", ";", "cf", ".", "modules", "(", ")", ".", "stream", "(", ")", ".", "forEach", "(", "rm", "->", "{", "String", "mn", "=", "rm", ".", "name", "(", ")", ";", "builder", ".", "addNode", "(", "mn", ")", ";", "rm", ".", "reads", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "ResolvedModule", "::", "name", ")", ".", "forEach", "(", "target", "->", "builder", ".", "addEdge", "(", "mn", ",", "target", ")", ")", ";", "}", ")", ";", "Graph", "<", "String", ">", "rpg", "=", "requiresTransitiveGraph", "(", "cf", ",", "builder", ".", "nodes", ")", ";", "return", "builder", ".", "build", "(", ")", ".", "reduce", "(", "rpg", ")", ";", "}" ]
Returns a Graph of the given Configuration after transitive reduction. Transitive reduction of requires transitive edge and requires edge have to be applied separately to prevent the requires transitive edges (e.g. U -> V) from being reduced by a path (U -> X -> Y -> V) in which V would not be re-exported from U.
[ "Returns", "a", "Graph", "of", "the", "given", "Configuration", "after", "transitive", "reduction", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleDotGraph.java#L127-L140
5,563
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleDotGraph.java
ModuleDotGraph.requiresTransitiveGraph
public Graph<String> requiresTransitiveGraph(Configuration cf, Set<String> roots) { Deque<String> deque = new ArrayDeque<>(roots); Set<String> visited = new HashSet<>(); Graph.Builder<String> builder = new Graph.Builder<>(); while (deque.peek() != null) { String mn = deque.pop(); if (visited.contains(mn)) continue; visited.add(mn); builder.addNode(mn); cf.findModule(mn).get() .reference().descriptor().requires().stream() .filter(d -> d.modifiers().contains(TRANSITIVE) || d.name().equals("java.base")) .map(Requires::name) .forEach(d -> { deque.add(d); builder.addEdge(mn, d); }); } return builder.build().reduce(); }
java
public Graph<String> requiresTransitiveGraph(Configuration cf, Set<String> roots) { Deque<String> deque = new ArrayDeque<>(roots); Set<String> visited = new HashSet<>(); Graph.Builder<String> builder = new Graph.Builder<>(); while (deque.peek() != null) { String mn = deque.pop(); if (visited.contains(mn)) continue; visited.add(mn); builder.addNode(mn); cf.findModule(mn).get() .reference().descriptor().requires().stream() .filter(d -> d.modifiers().contains(TRANSITIVE) || d.name().equals("java.base")) .map(Requires::name) .forEach(d -> { deque.add(d); builder.addEdge(mn, d); }); } return builder.build().reduce(); }
[ "public", "Graph", "<", "String", ">", "requiresTransitiveGraph", "(", "Configuration", "cf", ",", "Set", "<", "String", ">", "roots", ")", "{", "Deque", "<", "String", ">", "deque", "=", "new", "ArrayDeque", "<>", "(", "roots", ")", ";", "Set", "<", "String", ">", "visited", "=", "new", "HashSet", "<>", "(", ")", ";", "Graph", ".", "Builder", "<", "String", ">", "builder", "=", "new", "Graph", ".", "Builder", "<>", "(", ")", ";", "while", "(", "deque", ".", "peek", "(", ")", "!=", "null", ")", "{", "String", "mn", "=", "deque", ".", "pop", "(", ")", ";", "if", "(", "visited", ".", "contains", "(", "mn", ")", ")", "continue", ";", "visited", ".", "add", "(", "mn", ")", ";", "builder", ".", "addNode", "(", "mn", ")", ";", "cf", ".", "findModule", "(", "mn", ")", ".", "get", "(", ")", ".", "reference", "(", ")", ".", "descriptor", "(", ")", ".", "requires", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "d", "->", "d", ".", "modifiers", "(", ")", ".", "contains", "(", "TRANSITIVE", ")", "||", "d", ".", "name", "(", ")", ".", "equals", "(", "\"java.base\"", ")", ")", ".", "map", "(", "Requires", "::", "name", ")", ".", "forEach", "(", "d", "->", "{", "deque", ".", "add", "(", "d", ")", ";", "builder", ".", "addEdge", "(", "mn", ",", "d", ")", ";", "}", ")", ";", "}", "return", "builder", ".", "build", "(", ")", ".", "reduce", "(", ")", ";", "}" ]
Returns a Graph containing only requires transitive edges with transitive reduction.
[ "Returns", "a", "Graph", "containing", "only", "requires", "transitive", "edges", "with", "transitive", "reduction", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleDotGraph.java#L147-L173
5,564
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
SourceToHTMLConverter.convertRoot
public static void convertRoot(ConfigurationImpl configuration, DocletEnvironment docEnv, DocPath outputdir) throws DocFileIOException, SimpleDocletException { new SourceToHTMLConverter(configuration, docEnv, outputdir).generate(); }
java
public static void convertRoot(ConfigurationImpl configuration, DocletEnvironment docEnv, DocPath outputdir) throws DocFileIOException, SimpleDocletException { new SourceToHTMLConverter(configuration, docEnv, outputdir).generate(); }
[ "public", "static", "void", "convertRoot", "(", "ConfigurationImpl", "configuration", ",", "DocletEnvironment", "docEnv", ",", "DocPath", "outputdir", ")", "throws", "DocFileIOException", ",", "SimpleDocletException", "{", "new", "SourceToHTMLConverter", "(", "configuration", ",", "docEnv", ",", "outputdir", ")", ".", "generate", "(", ")", ";", "}" ]
Translate the TypeElements in the given DocletEnvironment to HTML representation. @param configuration the configuration. @param docEnv the DocletEnvironment to convert. @param outputdir the name of the directory to output to. @throws DocFileIOException if there is a problem generating an output file @throws SimpleDocletException if there is a problem reading a source file
[ "Translate", "the", "TypeElements", "in", "the", "given", "DocletEnvironment", "to", "HTML", "representation", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java#L109-L112
5,565
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
SourceToHTMLConverter.convertPackage
public void convertPackage(PackageElement pkg, DocPath outputdir) throws DocFileIOException, SimpleDocletException { if (pkg == null) { return; } for (Element te : utils.getAllClasses(pkg)) { // If -nodeprecated option is set and the class is marked as deprecated, // do not convert the package files to HTML. We do not check for // containing package deprecation since it is already check in // the calling method above. if (!(configuration.nodeprecated && utils.isDeprecated(te))) convertClass((TypeElement)te, outputdir); } }
java
public void convertPackage(PackageElement pkg, DocPath outputdir) throws DocFileIOException, SimpleDocletException { if (pkg == null) { return; } for (Element te : utils.getAllClasses(pkg)) { // If -nodeprecated option is set and the class is marked as deprecated, // do not convert the package files to HTML. We do not check for // containing package deprecation since it is already check in // the calling method above. if (!(configuration.nodeprecated && utils.isDeprecated(te))) convertClass((TypeElement)te, outputdir); } }
[ "public", "void", "convertPackage", "(", "PackageElement", "pkg", ",", "DocPath", "outputdir", ")", "throws", "DocFileIOException", ",", "SimpleDocletException", "{", "if", "(", "pkg", "==", "null", ")", "{", "return", ";", "}", "for", "(", "Element", "te", ":", "utils", ".", "getAllClasses", "(", "pkg", ")", ")", "{", "// If -nodeprecated option is set and the class is marked as deprecated,", "// do not convert the package files to HTML. We do not check for", "// containing package deprecation since it is already check in", "// the calling method above.", "if", "(", "!", "(", "configuration", ".", "nodeprecated", "&&", "utils", ".", "isDeprecated", "(", "te", ")", ")", ")", "convertClass", "(", "(", "TypeElement", ")", "te", ",", "outputdir", ")", ";", "}", "}" ]
Convert the Classes in the given Package to an HTML file. @param pkg the Package to convert. @param outputdir the name of the directory to output to. @throws DocFileIOException if there is a problem generating an output file @throws SimpleDocletException if there is a problem reading a source file
[ "Convert", "the", "Classes", "in", "the", "given", "Package", "to", "an", "HTML", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java#L142-L155
5,566
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
SourceToHTMLConverter.writeToFile
private void writeToFile(Content body, DocPath path) throws DocFileIOException { Content htmlDocType = configuration.isOutputHtml5() ? DocType.HTML5 : DocType.TRANSITIONAL; Content head = new HtmlTree(HtmlTag.HEAD); head.addContent(HtmlTree.TITLE(new StringContent( configuration.getText("doclet.Window_Source_title")))); head.addContent(getStyleSheetProperties()); Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body); Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree); messages.notice("doclet.Generating_0", path.getPath()); DocFile df = DocFile.createFileForOutput(configuration, path); try (Writer w = df.openWriter()) { htmlDocument.write(w, true); } catch (IOException e) { throw new DocFileIOException(df, DocFileIOException.Mode.WRITE, e); } }
java
private void writeToFile(Content body, DocPath path) throws DocFileIOException { Content htmlDocType = configuration.isOutputHtml5() ? DocType.HTML5 : DocType.TRANSITIONAL; Content head = new HtmlTree(HtmlTag.HEAD); head.addContent(HtmlTree.TITLE(new StringContent( configuration.getText("doclet.Window_Source_title")))); head.addContent(getStyleSheetProperties()); Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body); Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree); messages.notice("doclet.Generating_0", path.getPath()); DocFile df = DocFile.createFileForOutput(configuration, path); try (Writer w = df.openWriter()) { htmlDocument.write(w, true); } catch (IOException e) { throw new DocFileIOException(df, DocFileIOException.Mode.WRITE, e); } }
[ "private", "void", "writeToFile", "(", "Content", "body", ",", "DocPath", "path", ")", "throws", "DocFileIOException", "{", "Content", "htmlDocType", "=", "configuration", ".", "isOutputHtml5", "(", ")", "?", "DocType", ".", "HTML5", ":", "DocType", ".", "TRANSITIONAL", ";", "Content", "head", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "HEAD", ")", ";", "head", ".", "addContent", "(", "HtmlTree", ".", "TITLE", "(", "new", "StringContent", "(", "configuration", ".", "getText", "(", "\"doclet.Window_Source_title\"", ")", ")", ")", ")", ";", "head", ".", "addContent", "(", "getStyleSheetProperties", "(", ")", ")", ";", "Content", "htmlTree", "=", "HtmlTree", ".", "HTML", "(", "configuration", ".", "getLocale", "(", ")", ".", "getLanguage", "(", ")", ",", "head", ",", "body", ")", ";", "Content", "htmlDocument", "=", "new", "HtmlDocument", "(", "htmlDocType", ",", "htmlTree", ")", ";", "messages", ".", "notice", "(", "\"doclet.Generating_0\"", ",", "path", ".", "getPath", "(", ")", ")", ";", "DocFile", "df", "=", "DocFile", ".", "createFileForOutput", "(", "configuration", ",", "path", ")", ";", "try", "(", "Writer", "w", "=", "df", ".", "openWriter", "(", ")", ")", "{", "htmlDocument", ".", "write", "(", "w", ",", "true", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "DocFileIOException", "(", "df", ",", "DocFileIOException", ".", "Mode", ".", "WRITE", ",", "e", ")", ";", "}", "}" ]
Write the output to the file. @param body the documentation content to be written to the file. @param path the path for the file.
[ "Write", "the", "output", "to", "the", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java#L206-L225
5,567
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
ScopeImpl.dupUnshared
public WriteableScope dupUnshared(Symbol newOwner) { if (shared > 0) { //The nested Scopes might have already added something to the table, so all items //that don't originate in this Scope or any of its outer Scopes need to be cleared: Set<Scope> acceptScopes = Collections.newSetFromMap(new IdentityHashMap<>()); ScopeImpl c = this; while (c != null) { acceptScopes.add(c); c = c.next; } int n = 0; Entry[] oldTable = this.table; Entry[] newTable = new Entry[this.table.length]; for (int i = 0; i < oldTable.length; i++) { Entry e = oldTable[i]; while (e != null && e != sentinel && !acceptScopes.contains(e.scope)) { e = e.shadowed; } if (e != null) { n++; newTable[i] = e; } } return new ScopeImpl(this, newOwner, newTable, n); } else { return new ScopeImpl(this, newOwner, this.table.clone(), this.nelems); } }
java
public WriteableScope dupUnshared(Symbol newOwner) { if (shared > 0) { //The nested Scopes might have already added something to the table, so all items //that don't originate in this Scope or any of its outer Scopes need to be cleared: Set<Scope> acceptScopes = Collections.newSetFromMap(new IdentityHashMap<>()); ScopeImpl c = this; while (c != null) { acceptScopes.add(c); c = c.next; } int n = 0; Entry[] oldTable = this.table; Entry[] newTable = new Entry[this.table.length]; for (int i = 0; i < oldTable.length; i++) { Entry e = oldTable[i]; while (e != null && e != sentinel && !acceptScopes.contains(e.scope)) { e = e.shadowed; } if (e != null) { n++; newTable[i] = e; } } return new ScopeImpl(this, newOwner, newTable, n); } else { return new ScopeImpl(this, newOwner, this.table.clone(), this.nelems); } }
[ "public", "WriteableScope", "dupUnshared", "(", "Symbol", "newOwner", ")", "{", "if", "(", "shared", ">", "0", ")", "{", "//The nested Scopes might have already added something to the table, so all items", "//that don't originate in this Scope or any of its outer Scopes need to be cleared:", "Set", "<", "Scope", ">", "acceptScopes", "=", "Collections", ".", "newSetFromMap", "(", "new", "IdentityHashMap", "<>", "(", ")", ")", ";", "ScopeImpl", "c", "=", "this", ";", "while", "(", "c", "!=", "null", ")", "{", "acceptScopes", ".", "add", "(", "c", ")", ";", "c", "=", "c", ".", "next", ";", "}", "int", "n", "=", "0", ";", "Entry", "[", "]", "oldTable", "=", "this", ".", "table", ";", "Entry", "[", "]", "newTable", "=", "new", "Entry", "[", "this", ".", "table", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "oldTable", ".", "length", ";", "i", "++", ")", "{", "Entry", "e", "=", "oldTable", "[", "i", "]", ";", "while", "(", "e", "!=", "null", "&&", "e", "!=", "sentinel", "&&", "!", "acceptScopes", ".", "contains", "(", "e", ".", "scope", ")", ")", "{", "e", "=", "e", ".", "shadowed", ";", "}", "if", "(", "e", "!=", "null", ")", "{", "n", "++", ";", "newTable", "[", "i", "]", "=", "e", ";", "}", "}", "return", "new", "ScopeImpl", "(", "this", ",", "newOwner", ",", "newTable", ",", "n", ")", ";", "}", "else", "{", "return", "new", "ScopeImpl", "(", "this", ",", "newOwner", ",", "this", ".", "table", ".", "clone", "(", ")", ",", "this", ".", "nelems", ")", ";", "}", "}" ]
Construct a fresh scope within this scope, with new owner, with a new hash table, whose contents initially are those of the table of its outer scope.
[ "Construct", "a", "fresh", "scope", "within", "this", "scope", "with", "new", "owner", "with", "a", "new", "hash", "table", "whose", "contents", "initially", "are", "those", "of", "the", "table", "of", "its", "outer", "scope", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java#L352-L379
5,568
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
ScopeImpl.leave
public WriteableScope leave() { Assert.check(shared == 0); if (table != next.table) return next; while (elems != null) { int hash = getIndex(elems.sym.name); Entry e = table[hash]; Assert.check(e == elems, elems.sym); table[hash] = elems.shadowed; elems = elems.sibling; } Assert.check(next.shared > 0); next.shared--; next.nelems = nelems; // System.out.println("====> leaving scope " + this.hashCode() + " owned by " + this.owner + " to " + next.hashCode()); // new Error().printStackTrace(System.out); return next; }
java
public WriteableScope leave() { Assert.check(shared == 0); if (table != next.table) return next; while (elems != null) { int hash = getIndex(elems.sym.name); Entry e = table[hash]; Assert.check(e == elems, elems.sym); table[hash] = elems.shadowed; elems = elems.sibling; } Assert.check(next.shared > 0); next.shared--; next.nelems = nelems; // System.out.println("====> leaving scope " + this.hashCode() + " owned by " + this.owner + " to " + next.hashCode()); // new Error().printStackTrace(System.out); return next; }
[ "public", "WriteableScope", "leave", "(", ")", "{", "Assert", ".", "check", "(", "shared", "==", "0", ")", ";", "if", "(", "table", "!=", "next", ".", "table", ")", "return", "next", ";", "while", "(", "elems", "!=", "null", ")", "{", "int", "hash", "=", "getIndex", "(", "elems", ".", "sym", ".", "name", ")", ";", "Entry", "e", "=", "table", "[", "hash", "]", ";", "Assert", ".", "check", "(", "e", "==", "elems", ",", "elems", ".", "sym", ")", ";", "table", "[", "hash", "]", "=", "elems", ".", "shadowed", ";", "elems", "=", "elems", ".", "sibling", ";", "}", "Assert", ".", "check", "(", "next", ".", "shared", ">", "0", ")", ";", "next", ".", "shared", "--", ";", "next", ".", "nelems", "=", "nelems", ";", "// System.out.println(\"====> leaving scope \" + this.hashCode() + \" owned by \" + this.owner + \" to \" + next.hashCode());", "// new Error().printStackTrace(System.out);", "return", "next", ";", "}" ]
Remove all entries of this scope from its table, if shared with next.
[ "Remove", "all", "entries", "of", "this", "scope", "from", "its", "table", "if", "shared", "with", "next", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java#L384-L400
5,569
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
ScopeImpl.dble
private void dble() { Assert.check(shared == 0); Entry[] oldtable = table; Entry[] newtable = new Entry[oldtable.length * 2]; for (ScopeImpl s = this; s != null; s = s.next) { if (s.table == oldtable) { Assert.check(s == this || s.shared != 0); s.table = newtable; s.hashMask = newtable.length - 1; } } int n = 0; for (int i = oldtable.length; --i >= 0; ) { Entry e = oldtable[i]; if (e != null && e != sentinel) { table[getIndex(e.sym.name)] = e; n++; } } // We don't need to update nelems for shared inherited scopes, // since that gets handled by leave(). nelems = n; }
java
private void dble() { Assert.check(shared == 0); Entry[] oldtable = table; Entry[] newtable = new Entry[oldtable.length * 2]; for (ScopeImpl s = this; s != null; s = s.next) { if (s.table == oldtable) { Assert.check(s == this || s.shared != 0); s.table = newtable; s.hashMask = newtable.length - 1; } } int n = 0; for (int i = oldtable.length; --i >= 0; ) { Entry e = oldtable[i]; if (e != null && e != sentinel) { table[getIndex(e.sym.name)] = e; n++; } } // We don't need to update nelems for shared inherited scopes, // since that gets handled by leave(). nelems = n; }
[ "private", "void", "dble", "(", ")", "{", "Assert", ".", "check", "(", "shared", "==", "0", ")", ";", "Entry", "[", "]", "oldtable", "=", "table", ";", "Entry", "[", "]", "newtable", "=", "new", "Entry", "[", "oldtable", ".", "length", "*", "2", "]", ";", "for", "(", "ScopeImpl", "s", "=", "this", ";", "s", "!=", "null", ";", "s", "=", "s", ".", "next", ")", "{", "if", "(", "s", ".", "table", "==", "oldtable", ")", "{", "Assert", ".", "check", "(", "s", "==", "this", "||", "s", ".", "shared", "!=", "0", ")", ";", "s", ".", "table", "=", "newtable", ";", "s", ".", "hashMask", "=", "newtable", ".", "length", "-", "1", ";", "}", "}", "int", "n", "=", "0", ";", "for", "(", "int", "i", "=", "oldtable", ".", "length", ";", "--", "i", ">=", "0", ";", ")", "{", "Entry", "e", "=", "oldtable", "[", "i", "]", ";", "if", "(", "e", "!=", "null", "&&", "e", "!=", "sentinel", ")", "{", "table", "[", "getIndex", "(", "e", ".", "sym", ".", "name", ")", "]", "=", "e", ";", "n", "++", ";", "}", "}", "// We don't need to update nelems for shared inherited scopes,", "// since that gets handled by leave().", "nelems", "=", "n", ";", "}" ]
Double size of hash table.
[ "Double", "size", "of", "hash", "table", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java#L404-L426
5,570
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
ScopeImpl.enter
public void enter(Symbol sym) { Assert.check(shared == 0); if (nelems * 3 >= hashMask * 2) dble(); int hash = getIndex(sym.name); Entry old = table[hash]; if (old == null) { old = sentinel; nelems++; } Entry e = new Entry(sym, old, elems, this); table[hash] = e; elems = e; //notify listeners listeners.symbolAdded(sym, this); }
java
public void enter(Symbol sym) { Assert.check(shared == 0); if (nelems * 3 >= hashMask * 2) dble(); int hash = getIndex(sym.name); Entry old = table[hash]; if (old == null) { old = sentinel; nelems++; } Entry e = new Entry(sym, old, elems, this); table[hash] = e; elems = e; //notify listeners listeners.symbolAdded(sym, this); }
[ "public", "void", "enter", "(", "Symbol", "sym", ")", "{", "Assert", ".", "check", "(", "shared", "==", "0", ")", ";", "if", "(", "nelems", "*", "3", ">=", "hashMask", "*", "2", ")", "dble", "(", ")", ";", "int", "hash", "=", "getIndex", "(", "sym", ".", "name", ")", ";", "Entry", "old", "=", "table", "[", "hash", "]", ";", "if", "(", "old", "==", "null", ")", "{", "old", "=", "sentinel", ";", "nelems", "++", ";", "}", "Entry", "e", "=", "new", "Entry", "(", "sym", ",", "old", ",", "elems", ",", "this", ")", ";", "table", "[", "hash", "]", "=", "e", ";", "elems", "=", "e", ";", "//notify listeners", "listeners", ".", "symbolAdded", "(", "sym", ",", "this", ")", ";", "}" ]
Enter symbol sym in this scope.
[ "Enter", "symbol", "sym", "in", "this", "scope", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java#L430-L446
5,571
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
ScopeImpl.enterIfAbsent
public void enterIfAbsent(Symbol sym) { Assert.check(shared == 0); Entry e = lookup(sym.name); while (e.scope == this && e.sym.kind != sym.kind) e = e.next(); if (e.scope != this) enter(sym); }
java
public void enterIfAbsent(Symbol sym) { Assert.check(shared == 0); Entry e = lookup(sym.name); while (e.scope == this && e.sym.kind != sym.kind) e = e.next(); if (e.scope != this) enter(sym); }
[ "public", "void", "enterIfAbsent", "(", "Symbol", "sym", ")", "{", "Assert", ".", "check", "(", "shared", "==", "0", ")", ";", "Entry", "e", "=", "lookup", "(", "sym", ".", "name", ")", ";", "while", "(", "e", ".", "scope", "==", "this", "&&", "e", ".", "sym", ".", "kind", "!=", "sym", ".", "kind", ")", "e", "=", "e", ".", "next", "(", ")", ";", "if", "(", "e", ".", "scope", "!=", "this", ")", "enter", "(", "sym", ")", ";", "}" ]
Enter symbol sym in this scope if not already there.
[ "Enter", "symbol", "sym", "in", "this", "scope", "if", "not", "already", "there", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java#L488-L493
5,572
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
ScopeImpl.getIndex
int getIndex (Name name) { int h = name.hashCode(); int i = h & hashMask; // The expression below is always odd, so it is guaranteed // to be mutually prime with table.length, a power of 2. int x = hashMask - ((h + (h >> 16)) << 1); int d = -1; // Index of a deleted item. for (;;) { Entry e = table[i]; if (e == null) return d >= 0 ? d : i; if (e == sentinel) { // We have to keep searching even if we see a deleted item. // However, remember the index in case we fail to find the name. if (d < 0) d = i; } else if (e.sym.name == name) return i; i = (i + x) & hashMask; } }
java
int getIndex (Name name) { int h = name.hashCode(); int i = h & hashMask; // The expression below is always odd, so it is guaranteed // to be mutually prime with table.length, a power of 2. int x = hashMask - ((h + (h >> 16)) << 1); int d = -1; // Index of a deleted item. for (;;) { Entry e = table[i]; if (e == null) return d >= 0 ? d : i; if (e == sentinel) { // We have to keep searching even if we see a deleted item. // However, remember the index in case we fail to find the name. if (d < 0) d = i; } else if (e.sym.name == name) return i; i = (i + x) & hashMask; } }
[ "int", "getIndex", "(", "Name", "name", ")", "{", "int", "h", "=", "name", ".", "hashCode", "(", ")", ";", "int", "i", "=", "h", "&", "hashMask", ";", "// The expression below is always odd, so it is guaranteed", "// to be mutually prime with table.length, a power of 2.", "int", "x", "=", "hashMask", "-", "(", "(", "h", "+", "(", "h", ">>", "16", ")", ")", "<<", "1", ")", ";", "int", "d", "=", "-", "1", ";", "// Index of a deleted item.", "for", "(", ";", ";", ")", "{", "Entry", "e", "=", "table", "[", "i", "]", ";", "if", "(", "e", "==", "null", ")", "return", "d", ">=", "0", "?", "d", ":", "i", ";", "if", "(", "e", "==", "sentinel", ")", "{", "// We have to keep searching even if we see a deleted item.", "// However, remember the index in case we fail to find the name.", "if", "(", "d", "<", "0", ")", "d", "=", "i", ";", "}", "else", "if", "(", "e", ".", "sym", ".", "name", "==", "name", ")", "return", "i", ";", "i", "=", "(", "i", "+", "x", ")", "&", "hashMask", ";", "}", "}" ]
Look for slot in the table. We use open addressing with double hashing.
[ "Look", "for", "slot", "in", "the", "table", ".", "We", "use", "open", "addressing", "with", "double", "hashing", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java#L544-L564
5,573
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
ImportScope.finalizeScope
public void finalizeScope() { for (List<Scope> scopes = this.subScopes; scopes.nonEmpty(); scopes = scopes.tail) { Scope impScope = scopes.head; if (impScope instanceof FilterImportScope && impScope.owner.kind == Kind.TYP) { WriteableScope finalized = WriteableScope.create(impScope.owner); for (Symbol sym : impScope.getSymbols()) { finalized.enter(sym); } finalized.listeners.add(new ScopeListener() { @Override public void symbolAdded(Symbol sym, Scope s) { Assert.error("The scope is sealed."); } @Override public void symbolRemoved(Symbol sym, Scope s) { Assert.error("The scope is sealed."); } }); scopes.head = finalized; } } }
java
public void finalizeScope() { for (List<Scope> scopes = this.subScopes; scopes.nonEmpty(); scopes = scopes.tail) { Scope impScope = scopes.head; if (impScope instanceof FilterImportScope && impScope.owner.kind == Kind.TYP) { WriteableScope finalized = WriteableScope.create(impScope.owner); for (Symbol sym : impScope.getSymbols()) { finalized.enter(sym); } finalized.listeners.add(new ScopeListener() { @Override public void symbolAdded(Symbol sym, Scope s) { Assert.error("The scope is sealed."); } @Override public void symbolRemoved(Symbol sym, Scope s) { Assert.error("The scope is sealed."); } }); scopes.head = finalized; } } }
[ "public", "void", "finalizeScope", "(", ")", "{", "for", "(", "List", "<", "Scope", ">", "scopes", "=", "this", ".", "subScopes", ";", "scopes", ".", "nonEmpty", "(", ")", ";", "scopes", "=", "scopes", ".", "tail", ")", "{", "Scope", "impScope", "=", "scopes", ".", "head", ";", "if", "(", "impScope", "instanceof", "FilterImportScope", "&&", "impScope", ".", "owner", ".", "kind", "==", "Kind", ".", "TYP", ")", "{", "WriteableScope", "finalized", "=", "WriteableScope", ".", "create", "(", "impScope", ".", "owner", ")", ";", "for", "(", "Symbol", "sym", ":", "impScope", ".", "getSymbols", "(", ")", ")", "{", "finalized", ".", "enter", "(", "sym", ")", ";", "}", "finalized", ".", "listeners", ".", "add", "(", "new", "ScopeListener", "(", ")", "{", "@", "Override", "public", "void", "symbolAdded", "(", "Symbol", "sym", ",", "Scope", "s", ")", "{", "Assert", ".", "error", "(", "\"The scope is sealed.\"", ")", ";", "}", "@", "Override", "public", "void", "symbolRemoved", "(", "Symbol", "sym", ",", "Scope", "s", ")", "{", "Assert", ".", "error", "(", "\"The scope is sealed.\"", ")", ";", "}", "}", ")", ";", "scopes", ".", "head", "=", "finalized", ";", "}", "}", "}" ]
Finalize the content of the ImportScope to speed-up future lookups. No further changes to class hierarchy or class content will be reflected.
[ "Finalize", "the", "content", "of", "the", "ImportScope", "to", "speed", "-", "up", "future", "lookups", ".", "No", "further", "changes", "to", "class", "hierarchy", "or", "class", "content", "will", "be", "reflected", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java#L742-L768
5,574
google/error-prone-javac
src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocFormatter.java
JavadocFormatter.formatJavadoc
public String formatJavadoc(String header, String javadoc) { try { StringBuilder result = new StringBuilder(); result.append(escape(CODE_HIGHLIGHT)).append(header).append(escape(CODE_RESET)).append("\n"); if (javadoc == null) { return result.toString(); } JavacTask task = (JavacTask) ToolProvider.getSystemJavaCompiler().getTask(null, null, null, null, null, null); DocTrees trees = DocTrees.instance(task); DocCommentTree docComment = trees.getDocCommentTree(new SimpleJavaFileObject(new URI("mem://doc.html"), Kind.HTML) { @Override @DefinedBy(Api.COMPILER) public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return "<body>" + javadoc + "</body>"; } }); new FormatJavadocScanner(result, task).scan(docComment, null); addNewLineIfNeeded(result); return result.toString(); } catch (URISyntaxException ex) { throw new InternalError("Unexpected exception", ex); } }
java
public String formatJavadoc(String header, String javadoc) { try { StringBuilder result = new StringBuilder(); result.append(escape(CODE_HIGHLIGHT)).append(header).append(escape(CODE_RESET)).append("\n"); if (javadoc == null) { return result.toString(); } JavacTask task = (JavacTask) ToolProvider.getSystemJavaCompiler().getTask(null, null, null, null, null, null); DocTrees trees = DocTrees.instance(task); DocCommentTree docComment = trees.getDocCommentTree(new SimpleJavaFileObject(new URI("mem://doc.html"), Kind.HTML) { @Override @DefinedBy(Api.COMPILER) public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return "<body>" + javadoc + "</body>"; } }); new FormatJavadocScanner(result, task).scan(docComment, null); addNewLineIfNeeded(result); return result.toString(); } catch (URISyntaxException ex) { throw new InternalError("Unexpected exception", ex); } }
[ "public", "String", "formatJavadoc", "(", "String", "header", ",", "String", "javadoc", ")", "{", "try", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "escape", "(", "CODE_HIGHLIGHT", ")", ")", ".", "append", "(", "header", ")", ".", "append", "(", "escape", "(", "CODE_RESET", ")", ")", ".", "append", "(", "\"\\n\"", ")", ";", "if", "(", "javadoc", "==", "null", ")", "{", "return", "result", ".", "toString", "(", ")", ";", "}", "JavacTask", "task", "=", "(", "JavacTask", ")", "ToolProvider", ".", "getSystemJavaCompiler", "(", ")", ".", "getTask", "(", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ")", ";", "DocTrees", "trees", "=", "DocTrees", ".", "instance", "(", "task", ")", ";", "DocCommentTree", "docComment", "=", "trees", ".", "getDocCommentTree", "(", "new", "SimpleJavaFileObject", "(", "new", "URI", "(", "\"mem://doc.html\"", ")", ",", "Kind", ".", "HTML", ")", "{", "@", "Override", "@", "DefinedBy", "(", "Api", ".", "COMPILER", ")", "public", "CharSequence", "getCharContent", "(", "boolean", "ignoreEncodingErrors", ")", "throws", "IOException", "{", "return", "\"<body>\"", "+", "javadoc", "+", "\"</body>\"", ";", "}", "}", ")", ";", "new", "FormatJavadocScanner", "(", "result", ",", "task", ")", ".", "scan", "(", "docComment", ",", "null", ")", ";", "addNewLineIfNeeded", "(", "result", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "catch", "(", "URISyntaxException", "ex", ")", "{", "throw", "new", "InternalError", "(", "\"Unexpected exception\"", ",", "ex", ")", ";", "}", "}" ]
Format javadoc to plain text. @param header element caption that should be used @param javadoc to format @return javadoc formatted to plain text
[ "Format", "javadoc", "to", "plain", "text", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocFormatter.java#L99-L126
5,575
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java
BuildState.lookupModule
public Module lookupModule(String mod) { Module m = modules.get(mod); if (m == null) { m = new Module(mod, "???"); modules.put(mod, m); } return m; }
java
public Module lookupModule(String mod) { Module m = modules.get(mod); if (m == null) { m = new Module(mod, "???"); modules.put(mod, m); } return m; }
[ "public", "Module", "lookupModule", "(", "String", "mod", ")", "{", "Module", "m", "=", "modules", ".", "get", "(", "mod", ")", ";", "if", "(", "m", "==", "null", ")", "{", "m", "=", "new", "Module", "(", "mod", ",", "\"???\"", ")", ";", "modules", ".", "put", "(", "mod", ",", "m", ")", ";", "}", "return", "m", ";", "}" ]
Lookup a module from a name. Create the module if it does not exist yet.
[ "Lookup", "a", "module", "from", "a", "name", ".", "Create", "the", "module", "if", "it", "does", "not", "exist", "yet", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java#L65-L72
5,576
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java
BuildState.flattenArtifacts
public void flattenArtifacts(Map<String,Module> m) { modules = m; // Extract all the found packages. for (Module i : modules.values()) { for (Map.Entry<String,Package> j : i.packages().entrySet()) { Package p = packages.get(j.getKey()); // Check that no two different packages are stored under same name. Assert.check(p == null || p == j.getValue()); p = j.getValue(); packages.put(j.getKey(),j.getValue()); for (Map.Entry<String,File> g : p.artifacts().entrySet()) { File f = artifacts.get(g.getKey()); // Check that no two artifacts are stored under the same file. Assert.check(f == null || f == g.getValue()); artifacts.put(g.getKey(), g.getValue()); } } } }
java
public void flattenArtifacts(Map<String,Module> m) { modules = m; // Extract all the found packages. for (Module i : modules.values()) { for (Map.Entry<String,Package> j : i.packages().entrySet()) { Package p = packages.get(j.getKey()); // Check that no two different packages are stored under same name. Assert.check(p == null || p == j.getValue()); p = j.getValue(); packages.put(j.getKey(),j.getValue()); for (Map.Entry<String,File> g : p.artifacts().entrySet()) { File f = artifacts.get(g.getKey()); // Check that no two artifacts are stored under the same file. Assert.check(f == null || f == g.getValue()); artifacts.put(g.getKey(), g.getValue()); } } } }
[ "public", "void", "flattenArtifacts", "(", "Map", "<", "String", ",", "Module", ">", "m", ")", "{", "modules", "=", "m", ";", "// Extract all the found packages.", "for", "(", "Module", "i", ":", "modules", ".", "values", "(", ")", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Package", ">", "j", ":", "i", ".", "packages", "(", ")", ".", "entrySet", "(", ")", ")", "{", "Package", "p", "=", "packages", ".", "get", "(", "j", ".", "getKey", "(", ")", ")", ";", "// Check that no two different packages are stored under same name.", "Assert", ".", "check", "(", "p", "==", "null", "||", "p", "==", "j", ".", "getValue", "(", ")", ")", ";", "p", "=", "j", ".", "getValue", "(", ")", ";", "packages", ".", "put", "(", "j", ".", "getKey", "(", ")", ",", "j", ".", "getValue", "(", ")", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "File", ">", "g", ":", "p", ".", "artifacts", "(", ")", ".", "entrySet", "(", ")", ")", "{", "File", "f", "=", "artifacts", ".", "get", "(", "g", ".", "getKey", "(", ")", ")", ";", "// Check that no two artifacts are stored under the same file.", "Assert", ".", "check", "(", "f", "==", "null", "||", "f", "==", "g", ".", "getValue", "(", ")", ")", ";", "artifacts", ".", "put", "(", "g", ".", "getKey", "(", ")", ",", "g", ".", "getValue", "(", ")", ")", ";", "}", "}", "}", "}" ]
Store references to all artifacts found in the module tree into the maps stored in the build state. @param m The set of modules.
[ "Store", "references", "to", "all", "artifacts", "found", "in", "the", "module", "tree", "into", "the", "maps", "stored", "in", "the", "build", "state", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java#L133-L151
5,577
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java
BuildState.loadModule
public Module loadModule(String l) { Module m = Module.load(l); modules.put(m.name(), m); return m; }
java
public Module loadModule(String l) { Module m = Module.load(l); modules.put(m.name(), m); return m; }
[ "public", "Module", "loadModule", "(", "String", "l", ")", "{", "Module", "m", "=", "Module", ".", "load", "(", "l", ")", ";", "modules", ".", "put", "(", "m", ".", "name", "(", ")", ",", "m", ")", ";", "return", "m", ";", "}" ]
Load a module from the javac state file.
[ "Load", "a", "module", "from", "the", "javac", "state", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java#L248-L252
5,578
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java
BuildState.loadPackage
public Package loadPackage(Module lastModule, String l) { Package p = Package.load(lastModule, l); lastModule.addPackage(p); packages.put(p.name(), p); return p; }
java
public Package loadPackage(Module lastModule, String l) { Package p = Package.load(lastModule, l); lastModule.addPackage(p); packages.put(p.name(), p); return p; }
[ "public", "Package", "loadPackage", "(", "Module", "lastModule", ",", "String", "l", ")", "{", "Package", "p", "=", "Package", ".", "load", "(", "lastModule", ",", "l", ")", ";", "lastModule", ".", "addPackage", "(", "p", ")", ";", "packages", ".", "put", "(", "p", ".", "name", "(", ")", ",", "p", ")", ";", "return", "p", ";", "}" ]
Load a package from the javac state file.
[ "Load", "a", "package", "from", "the", "javac", "state", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java#L257-L262
5,579
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java
BuildState.loadSource
public Source loadSource(Package lastPackage, String l, boolean is_generated) { Source s = Source.load(lastPackage, l, is_generated); lastPackage.addSource(s); sources.put(s.name(), s); return s; }
java
public Source loadSource(Package lastPackage, String l, boolean is_generated) { Source s = Source.load(lastPackage, l, is_generated); lastPackage.addSource(s); sources.put(s.name(), s); return s; }
[ "public", "Source", "loadSource", "(", "Package", "lastPackage", ",", "String", "l", ",", "boolean", "is_generated", ")", "{", "Source", "s", "=", "Source", ".", "load", "(", "lastPackage", ",", "l", ",", "is_generated", ")", ";", "lastPackage", ".", "addSource", "(", "s", ")", ";", "sources", ".", "put", "(", "s", ".", "name", "(", ")", ",", "s", ")", ";", "return", "s", ";", "}" ]
Load a source from the javac state file.
[ "Load", "a", "source", "from", "the", "javac", "state", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java#L267-L272
5,580
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java
SjavacImpl.findSourceFiles
public static void findSourceFiles(List<SourceLocation> sourceLocations, Set<String> sourceTypes, Map<String,Source> foundFiles, Map<String, Module> foundModules, Module currentModule, boolean permitSourcesInDefaultPackage, boolean inLinksrc) throws IOException { for (SourceLocation source : sourceLocations) { source.findSourceFiles(sourceTypes, foundFiles, foundModules, currentModule, permitSourcesInDefaultPackage, inLinksrc); } }
java
public static void findSourceFiles(List<SourceLocation> sourceLocations, Set<String> sourceTypes, Map<String,Source> foundFiles, Map<String, Module> foundModules, Module currentModule, boolean permitSourcesInDefaultPackage, boolean inLinksrc) throws IOException { for (SourceLocation source : sourceLocations) { source.findSourceFiles(sourceTypes, foundFiles, foundModules, currentModule, permitSourcesInDefaultPackage, inLinksrc); } }
[ "public", "static", "void", "findSourceFiles", "(", "List", "<", "SourceLocation", ">", "sourceLocations", ",", "Set", "<", "String", ">", "sourceTypes", ",", "Map", "<", "String", ",", "Source", ">", "foundFiles", ",", "Map", "<", "String", ",", "Module", ">", "foundModules", ",", "Module", "currentModule", ",", "boolean", "permitSourcesInDefaultPackage", ",", "boolean", "inLinksrc", ")", "throws", "IOException", "{", "for", "(", "SourceLocation", "source", ":", "sourceLocations", ")", "{", "source", ".", "findSourceFiles", "(", "sourceTypes", ",", "foundFiles", ",", "foundModules", ",", "currentModule", ",", "permitSourcesInDefaultPackage", ",", "inLinksrc", ")", ";", "}", "}" ]
Find source files in the given source locations.
[ "Find", "source", "files", "in", "the", "given", "source", "locations", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java#L375-L392
5,581
emfjson/emfjson-jackson
src/main/java/org/emfjson/jackson/module/EMFModule.java
EMFModule.configure
public EMFModule configure(Feature feature, boolean state) { if (state) { enable(feature); } else { disable(feature); } return this; }
java
public EMFModule configure(Feature feature, boolean state) { if (state) { enable(feature); } else { disable(feature); } return this; }
[ "public", "EMFModule", "configure", "(", "Feature", "feature", ",", "boolean", "state", ")", "{", "if", "(", "state", ")", "{", "enable", "(", "feature", ")", ";", "}", "else", "{", "disable", "(", "feature", ")", ";", "}", "return", "this", ";", "}" ]
Configures the module with one of possible Feature. @param feature feature @param state of feature @return EMFModule
[ "Configures", "the", "module", "with", "one", "of", "possible", "Feature", "." ]
5f4488d1b07d499003351606cf76ee0c4ac39964
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/module/EMFModule.java#L255-L262
5,582
emfjson/emfjson-jackson
src/main/java/org/emfjson/jackson/annotations/JsonAnnotations.java
JsonAnnotations.getElementName
public static String getElementName(ENamedElement element) { String value = getValue(element, "JsonProperty", "value"); if (value == null) { value = getValue(element, EXTENDED_METADATA, "name"); } return value == null ? element.getName(): value; }
java
public static String getElementName(ENamedElement element) { String value = getValue(element, "JsonProperty", "value"); if (value == null) { value = getValue(element, EXTENDED_METADATA, "name"); } return value == null ? element.getName(): value; }
[ "public", "static", "String", "getElementName", "(", "ENamedElement", "element", ")", "{", "String", "value", "=", "getValue", "(", "element", ",", "\"JsonProperty\"", ",", "\"value\"", ")", ";", "if", "(", "value", "==", "null", ")", "{", "value", "=", "getValue", "(", "element", ",", "EXTENDED_METADATA", ",", "\"name\"", ")", ";", "}", "return", "value", "==", "null", "?", "element", ".", "getName", "(", ")", ":", "value", ";", "}" ]
Returns the name that should be use to serialize the property. @param element @return name of property
[ "Returns", "the", "name", "that", "should", "be", "use", "to", "serialize", "the", "property", "." ]
5f4488d1b07d499003351606cf76ee0c4ac39964
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/annotations/JsonAnnotations.java#L36-L43
5,583
emfjson/emfjson-jackson
src/main/java/org/emfjson/jackson/annotations/JsonAnnotations.java
JsonAnnotations.getTypeProperty
public static EcoreTypeInfo getTypeProperty(final EClassifier classifier) { String property = getValue(classifier, "JsonType", "property"); String use = getValue(classifier, "JsonType", "use"); ValueReader<String, EClass> valueReader = EcoreTypeInfo.defaultValueReader; ValueWriter<EClass, String> valueWriter = EcoreTypeInfo.defaultValueWriter; if (use != null) { EcoreTypeInfo.USE useType = EcoreTypeInfo.USE.valueOf(use.toUpperCase()); if (useType == NAME) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getName(); } else if (useType == CLASS) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getInstanceClassName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByQualifiedName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getInstanceClassName(); } else { valueReader = EcoreTypeInfo.defaultValueReader; valueWriter = EcoreTypeInfo.defaultValueWriter; } } return property != null ? new EcoreTypeInfo(property, valueReader, valueWriter): null; }
java
public static EcoreTypeInfo getTypeProperty(final EClassifier classifier) { String property = getValue(classifier, "JsonType", "property"); String use = getValue(classifier, "JsonType", "use"); ValueReader<String, EClass> valueReader = EcoreTypeInfo.defaultValueReader; ValueWriter<EClass, String> valueWriter = EcoreTypeInfo.defaultValueWriter; if (use != null) { EcoreTypeInfo.USE useType = EcoreTypeInfo.USE.valueOf(use.toUpperCase()); if (useType == NAME) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getName(); } else if (useType == CLASS) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getInstanceClassName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByQualifiedName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getInstanceClassName(); } else { valueReader = EcoreTypeInfo.defaultValueReader; valueWriter = EcoreTypeInfo.defaultValueWriter; } } return property != null ? new EcoreTypeInfo(property, valueReader, valueWriter): null; }
[ "public", "static", "EcoreTypeInfo", "getTypeProperty", "(", "final", "EClassifier", "classifier", ")", "{", "String", "property", "=", "getValue", "(", "classifier", ",", "\"JsonType\"", ",", "\"property\"", ")", ";", "String", "use", "=", "getValue", "(", "classifier", ",", "\"JsonType\"", ",", "\"use\"", ")", ";", "ValueReader", "<", "String", ",", "EClass", ">", "valueReader", "=", "EcoreTypeInfo", ".", "defaultValueReader", ";", "ValueWriter", "<", "EClass", ",", "String", ">", "valueWriter", "=", "EcoreTypeInfo", ".", "defaultValueWriter", ";", "if", "(", "use", "!=", "null", ")", "{", "EcoreTypeInfo", ".", "USE", "useType", "=", "EcoreTypeInfo", ".", "USE", ".", "valueOf", "(", "use", ".", "toUpperCase", "(", ")", ")", ";", "if", "(", "useType", "==", "NAME", ")", "{", "valueReader", "=", "(", "value", ",", "context", ")", "->", "{", "EClass", "type", "=", "value", "!=", "null", "&&", "value", ".", "equalsIgnoreCase", "(", "classifier", ".", "getName", "(", ")", ")", "?", "(", "EClass", ")", "classifier", ":", "null", ";", "if", "(", "type", "==", "null", ")", "{", "type", "=", "EMFContext", ".", "findEClassByName", "(", "value", ",", "classifier", ".", "getEPackage", "(", ")", ")", ";", "}", "return", "type", ";", "}", ";", "valueWriter", "=", "(", "value", ",", "context", ")", "->", "value", ".", "getName", "(", ")", ";", "}", "else", "if", "(", "useType", "==", "CLASS", ")", "{", "valueReader", "=", "(", "value", ",", "context", ")", "->", "{", "EClass", "type", "=", "value", "!=", "null", "&&", "value", ".", "equalsIgnoreCase", "(", "classifier", ".", "getInstanceClassName", "(", ")", ")", "?", "(", "EClass", ")", "classifier", ":", "null", ";", "if", "(", "type", "==", "null", ")", "{", "type", "=", "EMFContext", ".", "findEClassByQualifiedName", "(", "value", ",", "classifier", ".", "getEPackage", "(", ")", ")", ";", "}", "return", "type", ";", "}", ";", "valueWriter", "=", "(", "value", ",", "context", ")", "->", "value", ".", "getInstanceClassName", "(", ")", ";", "}", "else", "{", "valueReader", "=", "EcoreTypeInfo", ".", "defaultValueReader", ";", "valueWriter", "=", "EcoreTypeInfo", ".", "defaultValueWriter", ";", "}", "}", "return", "property", "!=", "null", "?", "new", "EcoreTypeInfo", "(", "property", ",", "valueReader", ",", "valueWriter", ")", ":", "null", ";", "}" ]
Returns the property that should be use to store the type information of the classifier. @param classifier @return the type information property
[ "Returns", "the", "property", "that", "should", "be", "use", "to", "store", "the", "type", "information", "of", "the", "classifier", "." ]
5f4488d1b07d499003351606cf76ee0c4ac39964
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/annotations/JsonAnnotations.java#L71-L106
5,584
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java
Comment.throwsTags
ThrowsTag[] throwsTags() { ListBuffer<ThrowsTag> found = new ListBuffer<>(); for (Tag next : tagList) { if (next instanceof ThrowsTag) { found.append((ThrowsTag)next); } } return found.toArray(new ThrowsTag[found.length()]); }
java
ThrowsTag[] throwsTags() { ListBuffer<ThrowsTag> found = new ListBuffer<>(); for (Tag next : tagList) { if (next instanceof ThrowsTag) { found.append((ThrowsTag)next); } } return found.toArray(new ThrowsTag[found.length()]); }
[ "ThrowsTag", "[", "]", "throwsTags", "(", ")", "{", "ListBuffer", "<", "ThrowsTag", ">", "found", "=", "new", "ListBuffer", "<>", "(", ")", ";", "for", "(", "Tag", "next", ":", "tagList", ")", "{", "if", "(", "next", "instanceof", "ThrowsTag", ")", "{", "found", ".", "append", "(", "(", "ThrowsTag", ")", "next", ")", ";", "}", "}", "return", "found", ".", "toArray", "(", "new", "ThrowsTag", "[", "found", ".", "length", "(", ")", "]", ")", ";", "}" ]
Return throws tags in this comment.
[ "Return", "throws", "tags", "in", "this", "comment", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java#L238-L246
5,585
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java
Comment.serialFieldTags
SerialFieldTag[] serialFieldTags() { ListBuffer<SerialFieldTag> found = new ListBuffer<>(); for (Tag next : tagList) { if (next instanceof SerialFieldTag) { found.append((SerialFieldTag)next); } } return found.toArray(new SerialFieldTag[found.length()]); }
java
SerialFieldTag[] serialFieldTags() { ListBuffer<SerialFieldTag> found = new ListBuffer<>(); for (Tag next : tagList) { if (next instanceof SerialFieldTag) { found.append((SerialFieldTag)next); } } return found.toArray(new SerialFieldTag[found.length()]); }
[ "SerialFieldTag", "[", "]", "serialFieldTags", "(", ")", "{", "ListBuffer", "<", "SerialFieldTag", ">", "found", "=", "new", "ListBuffer", "<>", "(", ")", ";", "for", "(", "Tag", "next", ":", "tagList", ")", "{", "if", "(", "next", "instanceof", "SerialFieldTag", ")", "{", "found", ".", "append", "(", "(", "SerialFieldTag", ")", "next", ")", ";", "}", "}", "return", "found", ".", "toArray", "(", "new", "SerialFieldTag", "[", "found", ".", "length", "(", ")", "]", ")", ";", "}" ]
Return serialField tags in this comment.
[ "Return", "serialField", "tags", "in", "this", "comment", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java#L296-L304
5,586
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java
Comment.findInlineTagDelim
private static int findInlineTagDelim(String inlineText, int searchStart) { int delimEnd, nestedOpenBrace; if ((delimEnd = inlineText.indexOf("}", searchStart)) == -1) { return -1; } else if (((nestedOpenBrace = inlineText.indexOf("{", searchStart)) != -1) && nestedOpenBrace < delimEnd){ //Found a nested open brace. int nestedCloseBrace = findInlineTagDelim(inlineText, nestedOpenBrace + 1); return (nestedCloseBrace != -1) ? findInlineTagDelim(inlineText, nestedCloseBrace + 1) : -1; } else { return delimEnd; } }
java
private static int findInlineTagDelim(String inlineText, int searchStart) { int delimEnd, nestedOpenBrace; if ((delimEnd = inlineText.indexOf("}", searchStart)) == -1) { return -1; } else if (((nestedOpenBrace = inlineText.indexOf("{", searchStart)) != -1) && nestedOpenBrace < delimEnd){ //Found a nested open brace. int nestedCloseBrace = findInlineTagDelim(inlineText, nestedOpenBrace + 1); return (nestedCloseBrace != -1) ? findInlineTagDelim(inlineText, nestedCloseBrace + 1) : -1; } else { return delimEnd; } }
[ "private", "static", "int", "findInlineTagDelim", "(", "String", "inlineText", ",", "int", "searchStart", ")", "{", "int", "delimEnd", ",", "nestedOpenBrace", ";", "if", "(", "(", "delimEnd", "=", "inlineText", ".", "indexOf", "(", "\"}\"", ",", "searchStart", ")", ")", "==", "-", "1", ")", "{", "return", "-", "1", ";", "}", "else", "if", "(", "(", "(", "nestedOpenBrace", "=", "inlineText", ".", "indexOf", "(", "\"{\"", ",", "searchStart", ")", ")", "!=", "-", "1", ")", "&&", "nestedOpenBrace", "<", "delimEnd", ")", "{", "//Found a nested open brace.", "int", "nestedCloseBrace", "=", "findInlineTagDelim", "(", "inlineText", ",", "nestedOpenBrace", "+", "1", ")", ";", "return", "(", "nestedCloseBrace", "!=", "-", "1", ")", "?", "findInlineTagDelim", "(", "inlineText", ",", "nestedCloseBrace", "+", "1", ")", ":", "-", "1", ";", "}", "else", "{", "return", "delimEnd", ";", "}", "}" ]
Recursively find the index of the closing '}' character for an inline tag and return it. If it can't be found, return -1. @param inlineText the text to search in. @param searchStart the index of the place to start searching at. @return the index of the closing '}' character for an inline tag. If it can't be found, return -1.
[ "Recursively", "find", "the", "index", "of", "the", "closing", "}", "character", "for", "an", "inline", "tag", "and", "return", "it", ".", "If", "it", "can", "t", "be", "found", "return", "-", "1", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java#L405-L419
5,587
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java
Comment.firstSentenceTags
static Tag[] firstSentenceTags(DocImpl holder, String text) { DocLocale doclocale = holder.env.doclocale; return getInlineTags(holder, doclocale.localeSpecificFirstSentence(holder, text)); }
java
static Tag[] firstSentenceTags(DocImpl holder, String text) { DocLocale doclocale = holder.env.doclocale; return getInlineTags(holder, doclocale.localeSpecificFirstSentence(holder, text)); }
[ "static", "Tag", "[", "]", "firstSentenceTags", "(", "DocImpl", "holder", ",", "String", "text", ")", "{", "DocLocale", "doclocale", "=", "holder", ".", "env", ".", "doclocale", ";", "return", "getInlineTags", "(", "holder", ",", "doclocale", ".", "localeSpecificFirstSentence", "(", "holder", ",", "text", ")", ")", ";", "}" ]
Return array of tags for the locale specific first sentence in the text.
[ "Return", "array", "of", "tags", "for", "the", "locale", "specific", "first", "sentence", "in", "the", "text", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java#L448-L452
5,588
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java
DocletInvoker.start
public boolean start(RootDoc root) { Object retVal; String methodName = "start"; Class<?>[] paramTypes = { RootDoc.class }; Object[] params = { root }; try { retVal = invoke(methodName, null, paramTypes, params); } catch (DocletInvokeException exc) { return false; } if (retVal instanceof Boolean) { return ((Boolean)retVal); } else { messager.error(Messager.NOPOS, "main.must_return_boolean", docletClassName, methodName); return false; } }
java
public boolean start(RootDoc root) { Object retVal; String methodName = "start"; Class<?>[] paramTypes = { RootDoc.class }; Object[] params = { root }; try { retVal = invoke(methodName, null, paramTypes, params); } catch (DocletInvokeException exc) { return false; } if (retVal instanceof Boolean) { return ((Boolean)retVal); } else { messager.error(Messager.NOPOS, "main.must_return_boolean", docletClassName, methodName); return false; } }
[ "public", "boolean", "start", "(", "RootDoc", "root", ")", "{", "Object", "retVal", ";", "String", "methodName", "=", "\"start\"", ";", "Class", "<", "?", ">", "[", "]", "paramTypes", "=", "{", "RootDoc", ".", "class", "}", ";", "Object", "[", "]", "params", "=", "{", "root", "}", ";", "try", "{", "retVal", "=", "invoke", "(", "methodName", ",", "null", ",", "paramTypes", ",", "params", ")", ";", "}", "catch", "(", "DocletInvokeException", "exc", ")", "{", "return", "false", ";", "}", "if", "(", "retVal", "instanceof", "Boolean", ")", "{", "return", "(", "(", "Boolean", ")", "retVal", ")", ";", "}", "else", "{", "messager", ".", "error", "(", "Messager", ".", "NOPOS", ",", "\"main.must_return_boolean\"", ",", "docletClassName", ",", "methodName", ")", ";", "return", "false", ";", "}", "}" ]
Generate documentation here. Return true on success.
[ "Generate", "documentation", "here", ".", "Return", "true", "on", "success", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java#L205-L222
5,589
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java
DocletInvoker.optionLength
public int optionLength(String option) { Object retVal; String methodName = "optionLength"; Class<?>[] paramTypes = { String.class }; Object[] params = { option }; try { retVal = invoke(methodName, 0, paramTypes, params); } catch (DocletInvokeException exc) { return -1; } if (retVal instanceof Integer) { return ((Integer)retVal); } else { messager.error(Messager.NOPOS, "main.must_return_int", docletClassName, methodName); return -1; } }
java
public int optionLength(String option) { Object retVal; String methodName = "optionLength"; Class<?>[] paramTypes = { String.class }; Object[] params = { option }; try { retVal = invoke(methodName, 0, paramTypes, params); } catch (DocletInvokeException exc) { return -1; } if (retVal instanceof Integer) { return ((Integer)retVal); } else { messager.error(Messager.NOPOS, "main.must_return_int", docletClassName, methodName); return -1; } }
[ "public", "int", "optionLength", "(", "String", "option", ")", "{", "Object", "retVal", ";", "String", "methodName", "=", "\"optionLength\"", ";", "Class", "<", "?", ">", "[", "]", "paramTypes", "=", "{", "String", ".", "class", "}", ";", "Object", "[", "]", "params", "=", "{", "option", "}", ";", "try", "{", "retVal", "=", "invoke", "(", "methodName", ",", "0", ",", "paramTypes", ",", "params", ")", ";", "}", "catch", "(", "DocletInvokeException", "exc", ")", "{", "return", "-", "1", ";", "}", "if", "(", "retVal", "instanceof", "Integer", ")", "{", "return", "(", "(", "Integer", ")", "retVal", ")", ";", "}", "else", "{", "messager", ".", "error", "(", "Messager", ".", "NOPOS", ",", "\"main.must_return_int\"", ",", "docletClassName", ",", "methodName", ")", ";", "return", "-", "1", ";", "}", "}" ]
Check for doclet added options here. Zero return means option not known. Positive value indicates number of arguments to option. Negative value means error occurred.
[ "Check", "for", "doclet", "added", "options", "here", ".", "Zero", "return", "means", "option", "not", "known", ".", "Positive", "value", "indicates", "number", "of", "arguments", "to", "option", ".", "Negative", "value", "means", "error", "occurred", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java#L229-L246
5,590
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java
DocletInvoker.validOptions
public boolean validOptions(List<String[]> optlist) { Object retVal; String options[][] = optlist.toArray(new String[optlist.length()][]); String methodName = "validOptions"; DocErrorReporter reporter = messager; Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class }; Object[] params = { options, reporter }; try { retVal = invoke(methodName, Boolean.TRUE, paramTypes, params); } catch (DocletInvokeException exc) { return false; } if (retVal instanceof Boolean) { return ((Boolean)retVal); } else { messager.error(Messager.NOPOS, "main.must_return_boolean", docletClassName, methodName); return false; } }
java
public boolean validOptions(List<String[]> optlist) { Object retVal; String options[][] = optlist.toArray(new String[optlist.length()][]); String methodName = "validOptions"; DocErrorReporter reporter = messager; Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class }; Object[] params = { options, reporter }; try { retVal = invoke(methodName, Boolean.TRUE, paramTypes, params); } catch (DocletInvokeException exc) { return false; } if (retVal instanceof Boolean) { return ((Boolean)retVal); } else { messager.error(Messager.NOPOS, "main.must_return_boolean", docletClassName, methodName); return false; } }
[ "public", "boolean", "validOptions", "(", "List", "<", "String", "[", "]", ">", "optlist", ")", "{", "Object", "retVal", ";", "String", "options", "[", "]", "[", "]", "=", "optlist", ".", "toArray", "(", "new", "String", "[", "optlist", ".", "length", "(", ")", "]", "[", "", "]", ")", ";", "String", "methodName", "=", "\"validOptions\"", ";", "DocErrorReporter", "reporter", "=", "messager", ";", "Class", "<", "?", ">", "[", "]", "paramTypes", "=", "{", "String", "[", "]", "[", "]", ".", "class", ",", "DocErrorReporter", ".", "class", "}", ";", "Object", "[", "]", "params", "=", "{", "options", ",", "reporter", "}", ";", "try", "{", "retVal", "=", "invoke", "(", "methodName", ",", "Boolean", ".", "TRUE", ",", "paramTypes", ",", "params", ")", ";", "}", "catch", "(", "DocletInvokeException", "exc", ")", "{", "return", "false", ";", "}", "if", "(", "retVal", "instanceof", "Boolean", ")", "{", "return", "(", "(", "Boolean", ")", "retVal", ")", ";", "}", "else", "{", "messager", ".", "error", "(", "Messager", ".", "NOPOS", ",", "\"main.must_return_boolean\"", ",", "docletClassName", ",", "methodName", ")", ";", "return", "false", ";", "}", "}" ]
Let doclet check that all options are OK. Returning true means options are OK. If method does not exist, assume true.
[ "Let", "doclet", "check", "that", "all", "options", "are", "OK", ".", "Returning", "true", "means", "options", "are", "OK", ".", "If", "method", "does", "not", "exist", "assume", "true", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java#L252-L271
5,591
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java
DocletInvoker.exportInternalAPI
private void exportInternalAPI(ClassLoader cl) { String[] packages = { "com.sun.tools.doclets", "com.sun.tools.doclets.standard", "com.sun.tools.doclets.internal.toolkit", "com.sun.tools.doclets.internal.toolkit.taglets", "com.sun.tools.doclets.internal.toolkit.builders", "com.sun.tools.doclets.internal.toolkit.util", "com.sun.tools.doclets.internal.toolkit.util.links", "com.sun.tools.doclets.formats.html", "com.sun.tools.doclets.formats.html.markup" }; try { Method getModuleMethod = Class.class.getDeclaredMethod("getModule"); Object thisModule = getModuleMethod.invoke(getClass()); Class<?> moduleClass = Class.forName("java.lang.Module"); Method addExportsMethod = moduleClass.getDeclaredMethod("addExports", String.class, moduleClass); Method getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule"); Object target = getUnnamedModuleMethod.invoke(cl); for (String pack : packages) { addExportsMethod.invoke(thisModule, pack, target); } } catch (Exception e) { // do nothing } }
java
private void exportInternalAPI(ClassLoader cl) { String[] packages = { "com.sun.tools.doclets", "com.sun.tools.doclets.standard", "com.sun.tools.doclets.internal.toolkit", "com.sun.tools.doclets.internal.toolkit.taglets", "com.sun.tools.doclets.internal.toolkit.builders", "com.sun.tools.doclets.internal.toolkit.util", "com.sun.tools.doclets.internal.toolkit.util.links", "com.sun.tools.doclets.formats.html", "com.sun.tools.doclets.formats.html.markup" }; try { Method getModuleMethod = Class.class.getDeclaredMethod("getModule"); Object thisModule = getModuleMethod.invoke(getClass()); Class<?> moduleClass = Class.forName("java.lang.Module"); Method addExportsMethod = moduleClass.getDeclaredMethod("addExports", String.class, moduleClass); Method getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule"); Object target = getUnnamedModuleMethod.invoke(cl); for (String pack : packages) { addExportsMethod.invoke(thisModule, pack, target); } } catch (Exception e) { // do nothing } }
[ "private", "void", "exportInternalAPI", "(", "ClassLoader", "cl", ")", "{", "String", "[", "]", "packages", "=", "{", "\"com.sun.tools.doclets\"", ",", "\"com.sun.tools.doclets.standard\"", ",", "\"com.sun.tools.doclets.internal.toolkit\"", ",", "\"com.sun.tools.doclets.internal.toolkit.taglets\"", ",", "\"com.sun.tools.doclets.internal.toolkit.builders\"", ",", "\"com.sun.tools.doclets.internal.toolkit.util\"", ",", "\"com.sun.tools.doclets.internal.toolkit.util.links\"", ",", "\"com.sun.tools.doclets.formats.html\"", ",", "\"com.sun.tools.doclets.formats.html.markup\"", "}", ";", "try", "{", "Method", "getModuleMethod", "=", "Class", ".", "class", ".", "getDeclaredMethod", "(", "\"getModule\"", ")", ";", "Object", "thisModule", "=", "getModuleMethod", ".", "invoke", "(", "getClass", "(", ")", ")", ";", "Class", "<", "?", ">", "moduleClass", "=", "Class", ".", "forName", "(", "\"java.lang.Module\"", ")", ";", "Method", "addExportsMethod", "=", "moduleClass", ".", "getDeclaredMethod", "(", "\"addExports\"", ",", "String", ".", "class", ",", "moduleClass", ")", ";", "Method", "getUnnamedModuleMethod", "=", "ClassLoader", ".", "class", ".", "getDeclaredMethod", "(", "\"getUnnamedModule\"", ")", ";", "Object", "target", "=", "getUnnamedModuleMethod", ".", "invoke", "(", "cl", ")", ";", "for", "(", "String", "pack", ":", "packages", ")", "{", "addExportsMethod", ".", "invoke", "(", "thisModule", ",", "pack", ",", "target", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "// do nothing", "}", "}" ]
Export javadoc internal API to the unnamed module for a classloader. This is to support continued use of existing non-standard doclets that use the internal toolkit API and related classes. @param cl the classloader
[ "Export", "javadoc", "internal", "API", "to", "the", "unnamed", "module", "for", "a", "classloader", ".", "This", "is", "to", "support", "continued", "use", "of", "existing", "non", "-", "standard", "doclets", "that", "use", "the", "internal", "toolkit", "API", "and", "related", "classes", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java#L365-L394
5,592
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java
DocletInvoker.fileToURL
private static URL fileToURL(Path file) { Path p; try { p = file.toRealPath(); } catch (IOException e) { p = file.toAbsolutePath(); } try { return p.normalize().toUri().toURL(); } catch (MalformedURLException e) { return null; } }
java
private static URL fileToURL(Path file) { Path p; try { p = file.toRealPath(); } catch (IOException e) { p = file.toAbsolutePath(); } try { return p.normalize().toUri().toURL(); } catch (MalformedURLException e) { return null; } }
[ "private", "static", "URL", "fileToURL", "(", "Path", "file", ")", "{", "Path", "p", ";", "try", "{", "p", "=", "file", ".", "toRealPath", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "p", "=", "file", ".", "toAbsolutePath", "(", ")", ";", "}", "try", "{", "return", "p", ".", "normalize", "(", ")", ".", "toUri", "(", ")", ".", "toURL", "(", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "return", "null", ";", "}", "}" ]
Returns the directory or JAR file URL corresponding to the specified local file name. @param file the Path object @return the resulting directory or JAR file URL, or null if unknown
[ "Returns", "the", "directory", "or", "JAR", "file", "URL", "corresponding", "to", "the", "specified", "local", "file", "name", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java#L424-L436
5,593
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
JavacProcessingEnvironment.instance
public static JavacProcessingEnvironment instance(Context context) { JavacProcessingEnvironment instance = context.get(JavacProcessingEnvironment.class); if (instance == null) instance = new JavacProcessingEnvironment(context); return instance; }
java
public static JavacProcessingEnvironment instance(Context context) { JavacProcessingEnvironment instance = context.get(JavacProcessingEnvironment.class); if (instance == null) instance = new JavacProcessingEnvironment(context); return instance; }
[ "public", "static", "JavacProcessingEnvironment", "instance", "(", "Context", "context", ")", "{", "JavacProcessingEnvironment", "instance", "=", "context", ".", "get", "(", "JavacProcessingEnvironment", ".", "class", ")", ";", "if", "(", "instance", "==", "null", ")", "instance", "=", "new", "JavacProcessingEnvironment", "(", "context", ")", ";", "return", "instance", ";", "}" ]
Get the JavacProcessingEnvironment instance for this context.
[ "Get", "the", "JavacProcessingEnvironment", "instance", "for", "this", "context", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#L188-L193
5,594
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
JavacProcessingEnvironment.handleServiceLoaderUnavailability
private Iterator<Processor> handleServiceLoaderUnavailability(String key, Exception e) { if (fileManager instanceof JavacFileManager) { StandardJavaFileManager standardFileManager = (JavacFileManager) fileManager; Iterable<? extends Path> workingPath = fileManager.hasLocation(ANNOTATION_PROCESSOR_PATH) ? standardFileManager.getLocationAsPaths(ANNOTATION_PROCESSOR_PATH) : standardFileManager.getLocationAsPaths(CLASS_PATH); if (needClassLoader(options.get(Option.PROCESSOR), workingPath) ) handleException(key, e); } else { handleException(key, e); } java.util.List<Processor> pl = Collections.emptyList(); return pl.iterator(); }
java
private Iterator<Processor> handleServiceLoaderUnavailability(String key, Exception e) { if (fileManager instanceof JavacFileManager) { StandardJavaFileManager standardFileManager = (JavacFileManager) fileManager; Iterable<? extends Path> workingPath = fileManager.hasLocation(ANNOTATION_PROCESSOR_PATH) ? standardFileManager.getLocationAsPaths(ANNOTATION_PROCESSOR_PATH) : standardFileManager.getLocationAsPaths(CLASS_PATH); if (needClassLoader(options.get(Option.PROCESSOR), workingPath) ) handleException(key, e); } else { handleException(key, e); } java.util.List<Processor> pl = Collections.emptyList(); return pl.iterator(); }
[ "private", "Iterator", "<", "Processor", ">", "handleServiceLoaderUnavailability", "(", "String", "key", ",", "Exception", "e", ")", "{", "if", "(", "fileManager", "instanceof", "JavacFileManager", ")", "{", "StandardJavaFileManager", "standardFileManager", "=", "(", "JavacFileManager", ")", "fileManager", ";", "Iterable", "<", "?", "extends", "Path", ">", "workingPath", "=", "fileManager", ".", "hasLocation", "(", "ANNOTATION_PROCESSOR_PATH", ")", "?", "standardFileManager", ".", "getLocationAsPaths", "(", "ANNOTATION_PROCESSOR_PATH", ")", ":", "standardFileManager", ".", "getLocationAsPaths", "(", "CLASS_PATH", ")", ";", "if", "(", "needClassLoader", "(", "options", ".", "get", "(", "Option", ".", "PROCESSOR", ")", ",", "workingPath", ")", ")", "handleException", "(", "key", ",", "e", ")", ";", "}", "else", "{", "handleException", "(", "key", ",", "e", ")", ";", "}", "java", ".", "util", ".", "List", "<", "Processor", ">", "pl", "=", "Collections", ".", "emptyList", "(", ")", ";", "return", "pl", ".", "iterator", "(", ")", ";", "}" ]
Returns an empty processor iterator if no processors are on the relevant path, otherwise if processors are present, logs an error. Called when a service loader is unavailable for some reason, either because a service loader class cannot be found or because a security policy prevents class loaders from being created. @param key The resource key to use to log an error message @param e If non-null, pass this exception to Abort
[ "Returns", "an", "empty", "processor", "iterator", "if", "no", "processors", "are", "on", "the", "relevant", "path", "otherwise", "if", "processors", "are", "present", "logs", "an", "error", ".", "Called", "when", "a", "service", "loader", "is", "unavailable", "for", "some", "reason", "either", "because", "a", "service", "loader", "class", "cannot", "be", "found", "or", "because", "a", "security", "policy", "prevents", "class", "loaders", "from", "being", "created", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#L362-L378
5,595
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
JavacProcessingEnvironment.handleException
private void handleException(String key, Exception e) { if (e != null) { log.error(key, e.getLocalizedMessage()); throw new Abort(e); } else { log.error(key); throw new Abort(); } }
java
private void handleException(String key, Exception e) { if (e != null) { log.error(key, e.getLocalizedMessage()); throw new Abort(e); } else { log.error(key); throw new Abort(); } }
[ "private", "void", "handleException", "(", "String", "key", ",", "Exception", "e", ")", "{", "if", "(", "e", "!=", "null", ")", "{", "log", ".", "error", "(", "key", ",", "e", ".", "getLocalizedMessage", "(", ")", ")", ";", "throw", "new", "Abort", "(", "e", ")", ";", "}", "else", "{", "log", ".", "error", "(", "key", ")", ";", "throw", "new", "Abort", "(", ")", ";", "}", "}" ]
Handle a security exception thrown during initializing the Processor iterator.
[ "Handle", "a", "security", "exception", "thrown", "during", "initializing", "the", "Processor", "iterator", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#L384-L392
5,596
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
JavacProcessingEnvironment.join
private static <T> List<T> join(List<T> list1, List<T> list2) { return list1.appendList(list2); }
java
private static <T> List<T> join(List<T> list1, List<T> list2) { return list1.appendList(list2); }
[ "private", "static", "<", "T", ">", "List", "<", "T", ">", "join", "(", "List", "<", "T", ">", "list1", ",", "List", "<", "T", ">", "list2", ")", "{", "return", "list1", ".", "appendList", "(", "list2", ")", ";", "}" ]
avoid unchecked warning from use of varargs
[ "avoid", "unchecked", "warning", "from", "use", "of", "varargs" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#L1459-L1461
5,597
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
JavacProcessingEnvironment.importStringToPattern
private static Pattern importStringToPattern(boolean allowModules, String s, Processor p, Log log) { String module; String pkg; int slash = s.indexOf('/'); if (slash == (-1)) { if (s.equals("*")) { return MatchingUtils.validImportStringToPattern(s); } module = allowModules ? ".*/" : ""; pkg = s; } else { module = Pattern.quote(s.substring(0, slash + 1)); pkg = s.substring(slash + 1); } if (MatchingUtils.isValidImportString(pkg)) { return Pattern.compile(module + MatchingUtils.validImportStringToPatternString(pkg)); } else { log.warning("proc.malformed.supported.string", s, p.getClass().getName()); return noMatches; // won't match any valid identifier } }
java
private static Pattern importStringToPattern(boolean allowModules, String s, Processor p, Log log) { String module; String pkg; int slash = s.indexOf('/'); if (slash == (-1)) { if (s.equals("*")) { return MatchingUtils.validImportStringToPattern(s); } module = allowModules ? ".*/" : ""; pkg = s; } else { module = Pattern.quote(s.substring(0, slash + 1)); pkg = s.substring(slash + 1); } if (MatchingUtils.isValidImportString(pkg)) { return Pattern.compile(module + MatchingUtils.validImportStringToPatternString(pkg)); } else { log.warning("proc.malformed.supported.string", s, p.getClass().getName()); return noMatches; // won't match any valid identifier } }
[ "private", "static", "Pattern", "importStringToPattern", "(", "boolean", "allowModules", ",", "String", "s", ",", "Processor", "p", ",", "Log", "log", ")", "{", "String", "module", ";", "String", "pkg", ";", "int", "slash", "=", "s", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "slash", "==", "(", "-", "1", ")", ")", "{", "if", "(", "s", ".", "equals", "(", "\"*\"", ")", ")", "{", "return", "MatchingUtils", ".", "validImportStringToPattern", "(", "s", ")", ";", "}", "module", "=", "allowModules", "?", "\".*/\"", ":", "\"\"", ";", "pkg", "=", "s", ";", "}", "else", "{", "module", "=", "Pattern", ".", "quote", "(", "s", ".", "substring", "(", "0", ",", "slash", "+", "1", ")", ")", ";", "pkg", "=", "s", ".", "substring", "(", "slash", "+", "1", ")", ";", "}", "if", "(", "MatchingUtils", ".", "isValidImportString", "(", "pkg", ")", ")", "{", "return", "Pattern", ".", "compile", "(", "module", "+", "MatchingUtils", ".", "validImportStringToPatternString", "(", "pkg", ")", ")", ";", "}", "else", "{", "log", ".", "warning", "(", "\"proc.malformed.supported.string\"", ",", "s", ",", "p", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "return", "noMatches", ";", "// won't match any valid identifier", "}", "}" ]
Convert import-style string for supported annotations into a regex matching that string. If the string is not a valid import-style string, return a regex that won't match anything.
[ "Convert", "import", "-", "style", "string", "for", "supported", "annotations", "into", "a", "regex", "matching", "that", "string", ".", "If", "the", "string", "is", "not", "a", "valid", "import", "-", "style", "string", "return", "a", "regex", "that", "won", "t", "match", "anything", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#L1668-L1688
5,598
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java
AbstractMemberBuilder.build
@Override public void build(XMLNode node, Content contentTree) throws DocletException { if (hasMembersToDocument()) { super.build(node, contentTree); } }
java
@Override public void build(XMLNode node, Content contentTree) throws DocletException { if (hasMembersToDocument()) { super.build(node, contentTree); } }
[ "@", "Override", "public", "void", "build", "(", "XMLNode", "node", ",", "Content", "contentTree", ")", "throws", "DocletException", "{", "if", "(", "hasMembersToDocument", "(", ")", ")", "{", "super", ".", "build", "(", "node", ",", "contentTree", ")", ";", "}", "}" ]
Builds the sub component if there is anything to document. @param node the XML element that specifies which components to document. @param contentTree content tree to which the documentation will be added @throws DocletException if there is a problem while building the documentation
[ "Builds", "the", "sub", "component", "if", "there", "is", "anything", "to", "document", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java#L84-L89
5,599
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/SnippetMaps.java
SnippetMaps.importSnippets
private Stream<ImportSnippet> importSnippets() { return state.keyMap.importKeys() .map(key -> (ImportSnippet)getSnippet(key)) .filter(sn -> sn != null && state.status(sn).isDefined()); }
java
private Stream<ImportSnippet> importSnippets() { return state.keyMap.importKeys() .map(key -> (ImportSnippet)getSnippet(key)) .filter(sn -> sn != null && state.status(sn).isDefined()); }
[ "private", "Stream", "<", "ImportSnippet", ">", "importSnippets", "(", ")", "{", "return", "state", ".", "keyMap", ".", "importKeys", "(", ")", ".", "map", "(", "key", "->", "(", "ImportSnippet", ")", "getSnippet", "(", "key", ")", ")", ".", "filter", "(", "sn", "->", "sn", "!=", "null", "&&", "state", ".", "status", "(", "sn", ")", ".", "isDefined", "(", ")", ")", ";", "}" ]
Compute the set of imports to prepend to a snippet @return a stream of the import needed
[ "Compute", "the", "set", "of", "imports", "to", "prepend", "to", "a", "snippet" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/SnippetMaps.java#L190-L194