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
partition
stringclasses
1 value
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceFinder.java
SourceFinder.openSource
public InputStream openSource(String packageName, String fileName) throws IOException { SourceFile sourceFile = findSourceFile(packageName, fileName); return sourceFile.getInputStream(); }
java
public InputStream openSource(String packageName, String fileName) throws IOException { SourceFile sourceFile = findSourceFile(packageName, fileName); return sourceFile.getInputStream(); }
[ "public", "InputStream", "openSource", "(", "String", "packageName", ",", "String", "fileName", ")", "throws", "IOException", "{", "SourceFile", "sourceFile", "=", "findSourceFile", "(", "packageName", ",", "fileName", ")", ";", "return", "sourceFile", ".", "getIn...
Open an input stream on a source file in given package. @param packageName the name of the package containing the class whose source file is given @param fileName the unqualified name of the source file @return an InputStream on the source file @throws IOException if a matching source file cannot be found
[ "Open", "an", "input", "stream", "on", "a", "source", "file", "in", "given", "package", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceFinder.java#L442-L445
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceFinder.java
SourceFinder.findSourceFile
public SourceFile findSourceFile(String packageName, String fileName) throws IOException { // On windows the fileName specification is different between a file in // a directory tree, and a // file in a zip file. In a directory tree the separator used is '\', // while in a zip it's '/' ...
java
public SourceFile findSourceFile(String packageName, String fileName) throws IOException { // On windows the fileName specification is different between a file in // a directory tree, and a // file in a zip file. In a directory tree the separator used is '\', // while in a zip it's '/' ...
[ "public", "SourceFile", "findSourceFile", "(", "String", "packageName", ",", "String", "fileName", ")", "throws", "IOException", "{", "// On windows the fileName specification is different between a file in", "// a directory tree, and a", "// file in a zip file. In a directory tree the...
Open a source file in given package. @param packageName the name of the package containing the class whose source file is given @param fileName the unqualified name of the source file @return the source file @throws IOException if a matching source file cannot be found
[ "Open", "a", "source", "file", "in", "given", "package", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceFinder.java#L468-L516
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/FuzzyBugComparator.java
FuzzyBugComparator.compareSourceLines
public int compareSourceLines(BugCollection lhsCollection, BugCollection rhsCollection, SourceLineAnnotation lhs, SourceLineAnnotation rhs) { if (lhs == null || rhs == null) { return compareNullElements(lhs, rhs); } // Classes must match fuzzily. int cmp = compar...
java
public int compareSourceLines(BugCollection lhsCollection, BugCollection rhsCollection, SourceLineAnnotation lhs, SourceLineAnnotation rhs) { if (lhs == null || rhs == null) { return compareNullElements(lhs, rhs); } // Classes must match fuzzily. int cmp = compar...
[ "public", "int", "compareSourceLines", "(", "BugCollection", "lhsCollection", ",", "BugCollection", "rhsCollection", ",", "SourceLineAnnotation", "lhs", ",", "SourceLineAnnotation", "rhs", ")", "{", "if", "(", "lhs", "==", "null", "||", "rhs", "==", "null", ")", ...
Compare source line annotations. @param rhsCollection lhs BugCollection @param lhsCollection rhs BugCollection @param lhs a SourceLineAnnotation @param rhs another SourceLineAnnotation @return comparison of lhs and rhs
[ "Compare", "source", "line", "annotations", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FuzzyBugComparator.java#L298-L311
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/xml/QuoteMetaCharacters.java
QuoteMetaCharacters.process
public void process() throws IOException { int pos = 0; do { int meta = findNextMeta(text, pos); if (meta >= 0) { emitLiteral(text.substring(pos, meta)); emitLiteral(map.getReplacement(text.substring(meta, meta + 1))); pos = meta + ...
java
public void process() throws IOException { int pos = 0; do { int meta = findNextMeta(text, pos); if (meta >= 0) { emitLiteral(text.substring(pos, meta)); emitLiteral(map.getReplacement(text.substring(meta, meta + 1))); pos = meta + ...
[ "public", "void", "process", "(", ")", "throws", "IOException", "{", "int", "pos", "=", "0", ";", "do", "{", "int", "meta", "=", "findNextMeta", "(", "text", ",", "pos", ")", ";", "if", "(", "meta", ">=", "0", ")", "{", "emitLiteral", "(", "text", ...
Quote metacharacters in the text.
[ "Quote", "metacharacters", "in", "the", "text", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/xml/QuoteMetaCharacters.java#L60-L73
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/ReflectionDatabaseFactory.java
ReflectionDatabaseFactory.createUsingConstructor
private E createUsingConstructor() throws CheckedAnalysisException { Constructor<E> constructor; try { constructor = databaseClass.getConstructor(new Class[0]); } catch (NoSuchMethodException e) { return null; } try { return constructor.newIns...
java
private E createUsingConstructor() throws CheckedAnalysisException { Constructor<E> constructor; try { constructor = databaseClass.getConstructor(new Class[0]); } catch (NoSuchMethodException e) { return null; } try { return constructor.newIns...
[ "private", "E", "createUsingConstructor", "(", ")", "throws", "CheckedAnalysisException", "{", "Constructor", "<", "E", ">", "constructor", ";", "try", "{", "constructor", "=", "databaseClass", ".", "getConstructor", "(", "new", "Class", "[", "0", "]", ")", ";...
Try to create the database using a no-arg constructor. @return the database, or null if there is no no-arg constructor @throws CheckedAnalysisException
[ "Try", "to", "create", "the", "database", "using", "a", "no", "-", "arg", "constructor", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/ReflectionDatabaseFactory.java#L104-L121
train
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/actions/ClearMarkersAction.java
ClearMarkersAction.work
@Override protected void work(final IWorkbenchPart part, IResource resource, final List<WorkItem> resources) { FindBugsJob clearMarkersJob = new ClearMarkersJob(resource, resources); clearMarkersJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJob...
java
@Override protected void work(final IWorkbenchPart part, IResource resource, final List<WorkItem> resources) { FindBugsJob clearMarkersJob = new ClearMarkersJob(resource, resources); clearMarkersJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJob...
[ "@", "Override", "protected", "void", "work", "(", "final", "IWorkbenchPart", "part", ",", "IResource", "resource", ",", "final", "List", "<", "WorkItem", ">", "resources", ")", "{", "FindBugsJob", "clearMarkersJob", "=", "new", "ClearMarkersJob", "(", "resource...
Clear the FindBugs markers on each project in the given selection, displaying a progress monitor.
[ "Clear", "the", "FindBugs", "markers", "on", "each", "project", "in", "the", "given", "selection", "displaying", "a", "progress", "monitor", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/actions/ClearMarkersAction.java#L49-L59
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.pushValue
public void pushValue(ValueType value) { if (VERIFY_INTEGRITY && value == null) { throw new IllegalArgumentException(); } if (!isValid()) { throw new IllegalStateException("accessing top or bottom frame"); } slotList.add(value); }
java
public void pushValue(ValueType value) { if (VERIFY_INTEGRITY && value == null) { throw new IllegalArgumentException(); } if (!isValid()) { throw new IllegalStateException("accessing top or bottom frame"); } slotList.add(value); }
[ "public", "void", "pushValue", "(", "ValueType", "value", ")", "{", "if", "(", "VERIFY_INTEGRITY", "&&", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "!", "isValid", "(", ")", ")", "{", "th...
Push a value onto the Java operand stack. @param value the ValueType to push
[ "Push", "a", "value", "onto", "the", "Java", "operand", "stack", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L174-L182
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.popValue
public ValueType popValue() throws DataflowAnalysisException { if (!isValid()) { throw new DataflowAnalysisException("accessing top or bottom frame"); } if (slotList.size() == numLocals) { throw new DataflowAnalysisException("operand stack empty"); } retur...
java
public ValueType popValue() throws DataflowAnalysisException { if (!isValid()) { throw new DataflowAnalysisException("accessing top or bottom frame"); } if (slotList.size() == numLocals) { throw new DataflowAnalysisException("operand stack empty"); } retur...
[ "public", "ValueType", "popValue", "(", ")", "throws", "DataflowAnalysisException", "{", "if", "(", "!", "isValid", "(", ")", ")", "{", "throw", "new", "DataflowAnalysisException", "(", "\"accessing top or bottom frame\"", ")", ";", "}", "if", "(", "slotList", "...
Pop a value off of the Java operand stack. @return the value that was popped @throws DataflowAnalysisException if the Java operand stack is empty
[ "Pop", "a", "value", "off", "of", "the", "Java", "operand", "stack", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L191-L199
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getTopValue
public ValueType getTopValue() throws DataflowAnalysisException { if (!isValid()) { throw new DataflowAnalysisException("accessing top or bottom frame"); } assert slotList.size() >= numLocals; if (slotList.size() == numLocals) { throw new DataflowAnalysisException...
java
public ValueType getTopValue() throws DataflowAnalysisException { if (!isValid()) { throw new DataflowAnalysisException("accessing top or bottom frame"); } assert slotList.size() >= numLocals; if (slotList.size() == numLocals) { throw new DataflowAnalysisException...
[ "public", "ValueType", "getTopValue", "(", ")", "throws", "DataflowAnalysisException", "{", "if", "(", "!", "isValid", "(", ")", ")", "{", "throw", "new", "DataflowAnalysisException", "(", "\"accessing top or bottom frame\"", ")", ";", "}", "assert", "slotList", "...
Get the value on the top of the Java operand stack. @throws DataflowAnalysisException if the Java operand stack is empty
[ "Get", "the", "value", "on", "the", "top", "of", "the", "Java", "operand", "stack", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L207-L216
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getTopStackWords
public void getTopStackWords(ValueType[] valueList) throws DataflowAnalysisException { int stackDepth = getStackDepth(); if (valueList.length > stackDepth) { throw new DataflowAnalysisException("not enough values on stack"); } int numSlots = slotList.size(); for (int ...
java
public void getTopStackWords(ValueType[] valueList) throws DataflowAnalysisException { int stackDepth = getStackDepth(); if (valueList.length > stackDepth) { throw new DataflowAnalysisException("not enough values on stack"); } int numSlots = slotList.size(); for (int ...
[ "public", "void", "getTopStackWords", "(", "ValueType", "[", "]", "valueList", ")", "throws", "DataflowAnalysisException", "{", "int", "stackDepth", "=", "getStackDepth", "(", ")", ";", "if", "(", "valueList", ".", "length", ">", "stackDepth", ")", "{", "throw...
Get the values on the top of the Java operand stack. The top stack item is placed at the end of the array, so that to restore the values to the stack, you would push them in the order they appear in the array.
[ "Get", "the", "values", "on", "the", "top", "of", "the", "Java", "operand", "stack", ".", "The", "top", "stack", "item", "is", "placed", "at", "the", "end", "of", "the", "array", "so", "that", "to", "restore", "the", "values", "to", "the", "stack", "...
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L223-L232
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getStackValue
public ValueType getStackValue(int loc) throws DataflowAnalysisException { if (!isValid()) { throw new DataflowAnalysisException("Accessing TOP or BOTTOM frame!"); } int stackDepth = getStackDepth(); if (loc >= stackDepth) { throw new DataflowAnalysisException("no...
java
public ValueType getStackValue(int loc) throws DataflowAnalysisException { if (!isValid()) { throw new DataflowAnalysisException("Accessing TOP or BOTTOM frame!"); } int stackDepth = getStackDepth(); if (loc >= stackDepth) { throw new DataflowAnalysisException("no...
[ "public", "ValueType", "getStackValue", "(", "int", "loc", ")", "throws", "DataflowAnalysisException", "{", "if", "(", "!", "isValid", "(", ")", ")", "{", "throw", "new", "DataflowAnalysisException", "(", "\"Accessing TOP or BOTTOM frame!\"", ")", ";", "}", "int",...
Get a value on the operand stack. @param loc the stack location, counting downwards from the top (location 0)
[ "Get", "a", "value", "on", "the", "operand", "stack", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L241-L254
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getStackLocation
public int getStackLocation(int loc) throws DataflowAnalysisException { int stackDepth = getStackDepth(); if (loc >= stackDepth) { throw new DataflowAnalysisException("not enough values on stack: access=" + loc + ", avail=" + stackDepth); } return slotList.size() - (loc + 1);...
java
public int getStackLocation(int loc) throws DataflowAnalysisException { int stackDepth = getStackDepth(); if (loc >= stackDepth) { throw new DataflowAnalysisException("not enough values on stack: access=" + loc + ", avail=" + stackDepth); } return slotList.size() - (loc + 1);...
[ "public", "int", "getStackLocation", "(", "int", "loc", ")", "throws", "DataflowAnalysisException", "{", "int", "stackDepth", "=", "getStackDepth", "(", ")", ";", "if", "(", "loc", ">=", "stackDepth", ")", "{", "throw", "new", "DataflowAnalysisException", "(", ...
Get a the location in the frame of a value on the operand stack. @param loc the stack location, counting downwards from the top (location 0)
[ "Get", "a", "the", "location", "in", "the", "frame", "of", "a", "value", "on", "the", "operand", "stack", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L263-L269
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getInstanceSlot
public int getInstanceSlot(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { if (!isValid()) { throw new DataflowAnalysisException("Accessing invalid frame at " + ins); } int numConsumed = ins.consumeStack(cpg); if (numConsumed == Const.UNPREDICTABLE) {...
java
public int getInstanceSlot(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { if (!isValid()) { throw new DataflowAnalysisException("Accessing invalid frame at " + ins); } int numConsumed = ins.consumeStack(cpg); if (numConsumed == Const.UNPREDICTABLE) {...
[ "public", "int", "getInstanceSlot", "(", "Instruction", "ins", ",", "ConstantPoolGen", "cpg", ")", "throws", "DataflowAnalysisException", "{", "if", "(", "!", "isValid", "(", ")", ")", "{", "throw", "new", "DataflowAnalysisException", "(", "\"Accessing invalid frame...
Get the slot the object instance referred to by given instruction is located in. @param ins the Instruction @param cpg the ConstantPoolGen for the method @return stack slot the object instance is in @throws DataflowAnalysisException
[ "Get", "the", "slot", "the", "object", "instance", "referred", "to", "by", "given", "instruction", "is", "located", "in", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L324-L336
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getNumArguments
public int getNumArguments(InvokeInstruction ins, ConstantPoolGen cpg) { SignatureParser parser = new SignatureParser(ins.getSignature(cpg)); return parser.getNumParameters(); }
java
public int getNumArguments(InvokeInstruction ins, ConstantPoolGen cpg) { SignatureParser parser = new SignatureParser(ins.getSignature(cpg)); return parser.getNumParameters(); }
[ "public", "int", "getNumArguments", "(", "InvokeInstruction", "ins", ",", "ConstantPoolGen", "cpg", ")", "{", "SignatureParser", "parser", "=", "new", "SignatureParser", "(", "ins", ".", "getSignature", "(", "cpg", ")", ")", ";", "return", "parser", ".", "getN...
Get the number of arguments passed to given method invocation. @param ins the method invocation instruction @param cpg the ConstantPoolGen for the class containing the method @return number of arguments; note that this excludes the object instance for instance methods
[ "Get", "the", "number", "of", "arguments", "passed", "to", "given", "method", "invocation", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L348-L351
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getNumArgumentsIncludingObjectInstance
public int getNumArgumentsIncludingObjectInstance(InvokeInstruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { int numConsumed = ins.consumeStack(cpg); if (numConsumed == Const.UNPREDICTABLE) { throw new DataflowAnalysisException("Unpredictable stack consumption...
java
public int getNumArgumentsIncludingObjectInstance(InvokeInstruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { int numConsumed = ins.consumeStack(cpg); if (numConsumed == Const.UNPREDICTABLE) { throw new DataflowAnalysisException("Unpredictable stack consumption...
[ "public", "int", "getNumArgumentsIncludingObjectInstance", "(", "InvokeInstruction", "ins", ",", "ConstantPoolGen", "cpg", ")", "throws", "DataflowAnalysisException", "{", "int", "numConsumed", "=", "ins", ".", "consumeStack", "(", "cpg", ")", ";", "if", "(", "numCo...
Get the number of arguments passed to given method invocation, including the object instance if the call is to an instance method. @param ins the method invocation instruction @param cpg the ConstantPoolGen for the class containing the method @return number of arguments, including object instance if appropriate @throw...
[ "Get", "the", "number", "of", "arguments", "passed", "to", "given", "method", "invocation", "including", "the", "object", "instance", "if", "the", "call", "is", "to", "an", "instance", "method", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L364-L371
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getArgumentSet
public BitSet getArgumentSet(InvokeInstruction invokeInstruction, ConstantPoolGen cpg, DataflowValueChooser<ValueType> chooser) throws DataflowAnalysisException { BitSet chosenArgSet = new BitSet(); SignatureParser sigParser = new SignatureParser(invokeInstruction.getSignature(cpg)); ...
java
public BitSet getArgumentSet(InvokeInstruction invokeInstruction, ConstantPoolGen cpg, DataflowValueChooser<ValueType> chooser) throws DataflowAnalysisException { BitSet chosenArgSet = new BitSet(); SignatureParser sigParser = new SignatureParser(invokeInstruction.getSignature(cpg)); ...
[ "public", "BitSet", "getArgumentSet", "(", "InvokeInstruction", "invokeInstruction", ",", "ConstantPoolGen", "cpg", ",", "DataflowValueChooser", "<", "ValueType", ">", "chooser", ")", "throws", "DataflowAnalysisException", "{", "BitSet", "chosenArgSet", "=", "new", "Bit...
Get set of arguments passed to a method invocation which match given predicate. @param invokeInstruction the InvokeInstruction @param cpg the ConstantPoolGen @param chooser predicate to choose which argument values should be in the returned set @return BitSet specifying which arguments match the predicate, indexed by ...
[ "Get", "set", "of", "arguments", "passed", "to", "a", "method", "invocation", "which", "match", "given", "predicate", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L468-L481
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.clearStack
public void clearStack() { if (!isValid()) { throw new IllegalStateException("accessing top or bottom frame"); } assert slotList.size() >= numLocals; if (slotList.size() > numLocals) { slotList.subList(numLocals, slotList.size()).clear(); } }
java
public void clearStack() { if (!isValid()) { throw new IllegalStateException("accessing top or bottom frame"); } assert slotList.size() >= numLocals; if (slotList.size() > numLocals) { slotList.subList(numLocals, slotList.size()).clear(); } }
[ "public", "void", "clearStack", "(", ")", "{", "if", "(", "!", "isValid", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"accessing top or bottom frame\"", ")", ";", "}", "assert", "slotList", ".", "size", "(", ")", ">=", "numLocals", ...
Clear the Java operand stack. Only local variable slots will remain in the frame.
[ "Clear", "the", "Java", "operand", "stack", ".", "Only", "local", "variable", "slots", "will", "remain", "in", "the", "frame", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L487-L495
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.sameAs
public boolean sameAs(Frame<ValueType> other) { if (isTop != other.isTop) { return false; } if (isTop && other.isTop) { return true; } if (isBottom != other.isBottom) { return false; } if (isBottom && other.isBottom) { ...
java
public boolean sameAs(Frame<ValueType> other) { if (isTop != other.isTop) { return false; } if (isTop && other.isTop) { return true; } if (isBottom != other.isBottom) { return false; } if (isBottom && other.isBottom) { ...
[ "public", "boolean", "sameAs", "(", "Frame", "<", "ValueType", ">", "other", ")", "{", "if", "(", "isTop", "!=", "other", ".", "isTop", ")", "{", "return", "false", ";", "}", "if", "(", "isTop", "&&", "other", ".", "isTop", ")", "{", "return", "tru...
Return true if this stack frame is the same as the one given as a parameter. @param other the other Frame @return true if the frames are the same, false otherwise
[ "Return", "true", "if", "this", "stack", "frame", "is", "the", "same", "as", "the", "one", "given", "as", "a", "parameter", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L570-L598
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.copyFrom
public void copyFrom(Frame<ValueType> other) { lastUpdateTimestamp = other.lastUpdateTimestamp; slotList = new ArrayList<>(other.slotList); isTop = other.isTop; isBottom = other.isBottom; }
java
public void copyFrom(Frame<ValueType> other) { lastUpdateTimestamp = other.lastUpdateTimestamp; slotList = new ArrayList<>(other.slotList); isTop = other.isTop; isBottom = other.isBottom; }
[ "public", "void", "copyFrom", "(", "Frame", "<", "ValueType", ">", "other", ")", "{", "lastUpdateTimestamp", "=", "other", ".", "lastUpdateTimestamp", ";", "slotList", "=", "new", "ArrayList", "<>", "(", "other", ".", "slotList", ")", ";", "isTop", "=", "o...
Make this Frame exactly the same as the one given as a parameter. @param other the Frame to make this object the same as
[ "Make", "this", "Frame", "exactly", "the", "same", "as", "the", "one", "given", "as", "a", "parameter", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L606-L611
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/analysis/ClassInfo.java
ClassInfo.addAnnotation
public void addAnnotation(AnnotationValue annotationValue) { HashMap<ClassDescriptor, AnnotationValue> updatedMap = new HashMap<>(classAnnotations); updatedMap.put(annotationValue.getAnnotationClass(), annotationValue); classAnnotations = Util.immutableMap(updatedMap); }
java
public void addAnnotation(AnnotationValue annotationValue) { HashMap<ClassDescriptor, AnnotationValue> updatedMap = new HashMap<>(classAnnotations); updatedMap.put(annotationValue.getAnnotationClass(), annotationValue); classAnnotations = Util.immutableMap(updatedMap); }
[ "public", "void", "addAnnotation", "(", "AnnotationValue", "annotationValue", ")", "{", "HashMap", "<", "ClassDescriptor", ",", "AnnotationValue", ">", "updatedMap", "=", "new", "HashMap", "<>", "(", "classAnnotations", ")", ";", "updatedMap", ".", "put", "(", "...
Destructively add an annotation to the object. In general, this is not a great idea, since it could cause the same class to appear to have different annotations at different times. However, this method is necessary for "built-in" annotations that FindBugs adds to system classes. As long as we add such annotations early...
[ "Destructively", "add", "an", "annotation", "to", "the", "object", ".", "In", "general", "this", "is", "not", "a", "great", "idea", "since", "it", "could", "cause", "the", "same", "class", "to", "appear", "to", "have", "different", "annotations", "at", "di...
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/analysis/ClassInfo.java#L440-L444
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/DirectoryCodeBase.java
DirectoryCodeBase.getResourceName
String getResourceName(String fileName) { // FIXME: there is probably a more robust way to do this // Strip off the directory part. String dirPath = directory.getPath(); if (!fileName.startsWith(dirPath)) { throw new IllegalStateException("Filename " + fileName + " not insid...
java
String getResourceName(String fileName) { // FIXME: there is probably a more robust way to do this // Strip off the directory part. String dirPath = directory.getPath(); if (!fileName.startsWith(dirPath)) { throw new IllegalStateException("Filename " + fileName + " not insid...
[ "String", "getResourceName", "(", "String", "fileName", ")", "{", "// FIXME: there is probably a more robust way to do this", "// Strip off the directory part.", "String", "dirPath", "=", "directory", ".", "getPath", "(", ")", ";", "if", "(", "!", "fileName", ".", "star...
Get the resource name given a full filename. @param fileName the full filename (which must be inside the directory) @return the resource name (i.e., the filename with the directory stripped off)
[ "Get", "the", "resource", "name", "given", "a", "full", "filename", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/DirectoryCodeBase.java#L172-L204
train
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/actions/SaveXmlAction.java
SaveXmlAction.work
private void work(final IProject project, final String fileName) { FindBugsJob runFindBugs = new FindBugsJob("Saving SpotBugs XML data to " + fileName + "...", project) { @Override protected void runWithProgress(IProgressMonitor monitor) throws CoreException { BugCollecti...
java
private void work(final IProject project, final String fileName) { FindBugsJob runFindBugs = new FindBugsJob("Saving SpotBugs XML data to " + fileName + "...", project) { @Override protected void runWithProgress(IProgressMonitor monitor) throws CoreException { BugCollecti...
[ "private", "void", "work", "(", "final", "IProject", "project", ",", "final", "String", "fileName", ")", "{", "FindBugsJob", "runFindBugs", "=", "new", "FindBugsJob", "(", "\"Saving SpotBugs XML data to \"", "+", "fileName", "+", "\"...\"", ",", "project", ")", ...
Save the XML result of a FindBugs analysis on the given project, displaying a progress monitor. @param project The selected project. @param fileName The file name to store the XML to.
[ "Save", "the", "XML", "result", "of", "a", "FindBugs", "analysis", "on", "the", "given", "project", "displaying", "a", "progress", "monitor", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/actions/SaveXmlAction.java#L126-L142
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/TextUIBugReporter.java
TextUIBugReporter.printBug
protected void printBug(BugInstance bugInstance) { if (showRank) { int rank = BugRanker.findRank(bugInstance); outputStream.printf("%2d ", rank); } switch (bugInstance.getPriority()) { case Priorities.EXP_PRIORITY: outputStream.print("E "); ...
java
protected void printBug(BugInstance bugInstance) { if (showRank) { int rank = BugRanker.findRank(bugInstance); outputStream.printf("%2d ", rank); } switch (bugInstance.getPriority()) { case Priorities.EXP_PRIORITY: outputStream.print("E "); ...
[ "protected", "void", "printBug", "(", "BugInstance", "bugInstance", ")", "{", "if", "(", "showRank", ")", "{", "int", "rank", "=", "BugRanker", ".", "findRank", "(", "bugInstance", ")", ";", "outputStream", ".", "printf", "(", "\"%2d \"", ",", "rank", ")",...
Print bug in one-line format. @param bugInstance the bug to print
[ "Print", "bug", "in", "one", "-", "line", "format", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/TextUIBugReporter.java#L88-L139
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassFeatureSet.java
ClassFeatureSet.initialize
public ClassFeatureSet initialize(JavaClass javaClass) { this.className = javaClass.getClassName(); this.isInterface = javaClass.isInterface(); addFeature(CLASS_NAME_KEY + transformClassName(javaClass.getClassName())); for (Method method : javaClass.getMethods()) { if (!isS...
java
public ClassFeatureSet initialize(JavaClass javaClass) { this.className = javaClass.getClassName(); this.isInterface = javaClass.isInterface(); addFeature(CLASS_NAME_KEY + transformClassName(javaClass.getClassName())); for (Method method : javaClass.getMethods()) { if (!isS...
[ "public", "ClassFeatureSet", "initialize", "(", "JavaClass", "javaClass", ")", "{", "this", ".", "className", "=", "javaClass", ".", "getClassName", "(", ")", ";", "this", ".", "isInterface", "=", "javaClass", ".", "isInterface", "(", ")", ";", "addFeature", ...
Initialize from given JavaClass. @param javaClass the JavaClass @return this object
[ "Initialize", "from", "given", "JavaClass", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassFeatureSet.java#L82-L111
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassFeatureSet.java
ClassFeatureSet.overridesSuperclassMethod
private boolean overridesSuperclassMethod(JavaClass javaClass, Method method) { if (method.isStatic()) { return false; } try { JavaClass[] superclassList = javaClass.getSuperClasses(); if (superclassList != null) { JavaClassAndMethod match = H...
java
private boolean overridesSuperclassMethod(JavaClass javaClass, Method method) { if (method.isStatic()) { return false; } try { JavaClass[] superclassList = javaClass.getSuperClasses(); if (superclassList != null) { JavaClassAndMethod match = H...
[ "private", "boolean", "overridesSuperclassMethod", "(", "JavaClass", "javaClass", ",", "Method", "method", ")", "{", "if", "(", "method", ".", "isStatic", "(", ")", ")", "{", "return", "false", ";", "}", "try", "{", "JavaClass", "[", "]", "superclassList", ...
Determine if given method overrides a superclass or superinterface method. @param javaClass class defining the method @param method the method @return true if the method overrides a superclass/superinterface method, false if not
[ "Determine", "if", "given", "method", "overrides", "a", "superclass", "or", "superinterface", "method", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassFeatureSet.java#L124-L152
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassFeatureSet.java
ClassFeatureSet.transformClassName
public static String transformClassName(String className) { int lastDot = className.lastIndexOf('.'); if (lastDot >= 0) { String pkg = className.substring(0, lastDot); if (!isUnlikelyToBeRenamed(pkg)) { className = className.substring(lastDot + 1); } ...
java
public static String transformClassName(String className) { int lastDot = className.lastIndexOf('.'); if (lastDot >= 0) { String pkg = className.substring(0, lastDot); if (!isUnlikelyToBeRenamed(pkg)) { className = className.substring(lastDot + 1); } ...
[ "public", "static", "String", "transformClassName", "(", "String", "className", ")", "{", "int", "lastDot", "=", "className", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "lastDot", ">=", "0", ")", "{", "String", "pkg", "=", "className", ".", ...
Transform a class name by stripping its package name. @param className a class name @return the transformed class name
[ "Transform", "a", "class", "name", "by", "stripping", "its", "package", "name", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassFeatureSet.java#L224-L233
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassFeatureSet.java
ClassFeatureSet.transformMethodSignature
public static String transformMethodSignature(String signature) { StringBuilder buf = new StringBuilder(); buf.append('('); SignatureParser parser = new SignatureParser(signature); for (Iterator<String> i = parser.parameterSignatureIterator(); i.hasNext();) { String param =...
java
public static String transformMethodSignature(String signature) { StringBuilder buf = new StringBuilder(); buf.append('('); SignatureParser parser = new SignatureParser(signature); for (Iterator<String> i = parser.parameterSignatureIterator(); i.hasNext();) { String param =...
[ "public", "static", "String", "transformMethodSignature", "(", "String", "signature", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "'", "'", ")", ";", "SignatureParser", "parser", "=", "new", "Signa...
Transform a method signature to allow it to be compared even if any of its parameter types are moved to another package. @param signature a method signature @return the transformed signature
[ "Transform", "a", "method", "signature", "to", "allow", "it", "to", "be", "compared", "even", "if", "any", "of", "its", "parameter", "types", "are", "moved", "to", "another", "package", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassFeatureSet.java#L255-L270
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassFeatureSet.java
ClassFeatureSet.transformSignature
public static String transformSignature(String signature) { StringBuilder buf = new StringBuilder(); int lastBracket = signature.lastIndexOf('['); if (lastBracket > 0) { buf.append(signature.substring(0, lastBracket + 1)); signature = signature.substring(lastBracket + 1)...
java
public static String transformSignature(String signature) { StringBuilder buf = new StringBuilder(); int lastBracket = signature.lastIndexOf('['); if (lastBracket > 0) { buf.append(signature.substring(0, lastBracket + 1)); signature = signature.substring(lastBracket + 1)...
[ "public", "static", "String", "transformSignature", "(", "String", "signature", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "int", "lastBracket", "=", "signature", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "l...
Transform a field or method parameter signature to allow it to be compared even if it is moved to another package. @param signature the signature @return the transformed signature
[ "Transform", "a", "field", "or", "method", "parameter", "signature", "to", "allow", "it", "to", "be", "compared", "even", "if", "it", "is", "moved", "to", "another", "package", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassFeatureSet.java#L280-L297
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java
BetterCFGBuilder2.handleExceptions
private void handleExceptions(Subroutine subroutine, InstructionHandle pei, BasicBlock etb) { etb.setExceptionThrower(pei); // Remember whether or not a universal exception handler // is reachable. If so, then we know that exceptions raised // at this instruction cannot propagate out of...
java
private void handleExceptions(Subroutine subroutine, InstructionHandle pei, BasicBlock etb) { etb.setExceptionThrower(pei); // Remember whether or not a universal exception handler // is reachable. If so, then we know that exceptions raised // at this instruction cannot propagate out of...
[ "private", "void", "handleExceptions", "(", "Subroutine", "subroutine", ",", "InstructionHandle", "pei", ",", "BasicBlock", "etb", ")", "{", "etb", ".", "setExceptionThrower", "(", "pei", ")", ";", "// Remember whether or not a universal exception handler", "// is reachab...
Add exception edges for given instruction. @param subroutine the subroutine containing the instruction @param pei the instruction which throws an exception @param etb the exception thrower block (ETB) for the instruction
[ "Add", "exception", "edges", "for", "given", "instruction", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java#L941-L971
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java
BetterCFGBuilder2.isPEI
private boolean isPEI(InstructionHandle handle) throws CFGBuilderException { Instruction ins = handle.getInstruction(); if (!(ins instanceof ExceptionThrower)) { return false; } if (ins instanceof NEW) { return false; } // if (ins instanceof ATHR...
java
private boolean isPEI(InstructionHandle handle) throws CFGBuilderException { Instruction ins = handle.getInstruction(); if (!(ins instanceof ExceptionThrower)) { return false; } if (ins instanceof NEW) { return false; } // if (ins instanceof ATHR...
[ "private", "boolean", "isPEI", "(", "InstructionHandle", "handle", ")", "throws", "CFGBuilderException", "{", "Instruction", "ins", "=", "handle", ".", "getInstruction", "(", ")", ";", "if", "(", "!", "(", "ins", "instanceof", "ExceptionThrower", ")", ")", "{"...
Return whether or not the given instruction can throw exceptions. @param handle the instruction @return true if the instruction can throw an exception, false otherwise @throws CFGBuilderException
[ "Return", "whether", "or", "not", "the", "given", "instruction", "can", "throw", "exceptions", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java#L981-L1048
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java
BetterCFGBuilder2.isMerge
private static boolean isMerge(InstructionHandle handle) { if (handle.hasTargeters()) { // Check all targeters of this handle to see if any // of them are branches. If so, the instruction is a merge. InstructionTargeter[] targeterList = handle.getTargeters(); for ...
java
private static boolean isMerge(InstructionHandle handle) { if (handle.hasTargeters()) { // Check all targeters of this handle to see if any // of them are branches. If so, the instruction is a merge. InstructionTargeter[] targeterList = handle.getTargeters(); for ...
[ "private", "static", "boolean", "isMerge", "(", "InstructionHandle", "handle", ")", "{", "if", "(", "handle", ".", "hasTargeters", "(", ")", ")", "{", "// Check all targeters of this handle to see if any", "// of them are branches. If so, the instruction is a merge.", "Instru...
Determine whether or not the given instruction is a control flow merge. @param handle the instruction @return true if the instruction is a control merge, false otherwise
[ "Determine", "whether", "or", "not", "the", "given", "instruction", "is", "a", "control", "flow", "merge", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java#L1077-L1089
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java
BetterCFGBuilder2.inlineAll
private CFG inlineAll() throws CFGBuilderException { CFG result = new CFG(); Context rootContext = new Context(null, topLevelSubroutine, result); rootContext.mapBlock(topLevelSubroutine.getEntry(), result.getEntry()); rootContext.mapBlock(topLevelSubroutine.getExit(), result.getExit());...
java
private CFG inlineAll() throws CFGBuilderException { CFG result = new CFG(); Context rootContext = new Context(null, topLevelSubroutine, result); rootContext.mapBlock(topLevelSubroutine.getEntry(), result.getEntry()); rootContext.mapBlock(topLevelSubroutine.getExit(), result.getExit());...
[ "private", "CFG", "inlineAll", "(", ")", "throws", "CFGBuilderException", "{", "CFG", "result", "=", "new", "CFG", "(", ")", ";", "Context", "rootContext", "=", "new", "Context", "(", "null", ",", "topLevelSubroutine", ",", "result", ")", ";", "rootContext",...
Inline all JSR subroutines into the top-level subroutine. This produces a complete CFG for the entire method, in which all JSR subroutines are inlined. @return the CFG for the method
[ "Inline", "all", "JSR", "subroutines", "into", "the", "top", "-", "level", "subroutine", ".", "This", "produces", "a", "complete", "CFG", "for", "the", "entire", "method", "in", "which", "all", "JSR", "subroutines", "are", "inlined", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java#L1098-L1111
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java
BetterCFGBuilder2.main
public static void main(String[] argv) throws Exception { if (argv.length != 1) { System.err.println("Usage: " + BetterCFGBuilder2.class.getName() + " <class file>"); System.exit(1); } String methodName = SystemProperties.getProperty("cfgbuilder.method"); JavaCl...
java
public static void main(String[] argv) throws Exception { if (argv.length != 1) { System.err.println("Usage: " + BetterCFGBuilder2.class.getName() + " <class file>"); System.exit(1); } String methodName = SystemProperties.getProperty("cfgbuilder.method"); JavaCl...
[ "public", "static", "void", "main", "(", "String", "[", "]", "argv", ")", "throws", "Exception", "{", "if", "(", "argv", ".", "length", "!=", "1", ")", "{", "System", ".", "err", ".", "println", "(", "\"Usage: \"", "+", "BetterCFGBuilder2", ".", "class...
Test driver.
[ "Test", "driver", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java#L1271-L1306
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.createXField
public static XField createXField(String className, Field field) { String fieldName = field.getName(); String fieldSig = field.getSignature(); XField xfield = getExactXField(className, fieldName, fieldSig, field.isStatic()); assert xfield.isResolved() : "Could not exactly resolve " + xf...
java
public static XField createXField(String className, Field field) { String fieldName = field.getName(); String fieldSig = field.getSignature(); XField xfield = getExactXField(className, fieldName, fieldSig, field.isStatic()); assert xfield.isResolved() : "Could not exactly resolve " + xf...
[ "public", "static", "XField", "createXField", "(", "String", "className", ",", "Field", "field", ")", "{", "String", "fieldName", "=", "field", ".", "getName", "(", ")", ";", "String", "fieldSig", "=", "field", ".", "getSignature", "(", ")", ";", "XField",...
Create an XField object from a BCEL Field. @param className the name of the Java class containing the field @param field the Field within the JavaClass @return the created XField
[ "Create", "an", "XField", "object", "from", "a", "BCEL", "Field", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L509-L516
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.createXMethod
public static XMethod createXMethod(InvokeInstruction invokeInstruction, ConstantPoolGen cpg) { String className = invokeInstruction.getClassName(cpg); String methodName = invokeInstruction.getName(cpg); String methodSig = invokeInstruction.getSignature(cpg); if (invokeInstruction instan...
java
public static XMethod createXMethod(InvokeInstruction invokeInstruction, ConstantPoolGen cpg) { String className = invokeInstruction.getClassName(cpg); String methodName = invokeInstruction.getName(cpg); String methodSig = invokeInstruction.getSignature(cpg); if (invokeInstruction instan...
[ "public", "static", "XMethod", "createXMethod", "(", "InvokeInstruction", "invokeInstruction", ",", "ConstantPoolGen", "cpg", ")", "{", "String", "className", "=", "invokeInstruction", ".", "getClassName", "(", "cpg", ")", ";", "String", "methodName", "=", "invokeIn...
Create an XMethod object from an InvokeInstruction. @param invokeInstruction the InvokeInstruction @param cpg ConstantPoolGen from the class containing the instruction @return XMethod representing the method called by the InvokeInstruction
[ "Create", "an", "XMethod", "object", "from", "an", "InvokeInstruction", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L616-L631
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.createXMethod
public static XMethod createXMethod(PreorderVisitor visitor) { JavaClass javaClass = visitor.getThisClass(); Method method = visitor.getMethod(); XMethod m = createXMethod(javaClass, method); return m; }
java
public static XMethod createXMethod(PreorderVisitor visitor) { JavaClass javaClass = visitor.getThisClass(); Method method = visitor.getMethod(); XMethod m = createXMethod(javaClass, method); return m; }
[ "public", "static", "XMethod", "createXMethod", "(", "PreorderVisitor", "visitor", ")", "{", "JavaClass", "javaClass", "=", "visitor", ".", "getThisClass", "(", ")", ";", "Method", "method", "=", "visitor", ".", "getMethod", "(", ")", ";", "XMethod", "m", "=...
Create an XMethod object from the method currently being visited by the given PreorderVisitor. @param visitor the PreorderVisitor @return the XMethod representing the method currently being visited
[ "Create", "an", "XMethod", "object", "from", "the", "method", "currently", "being", "visited", "by", "the", "given", "PreorderVisitor", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L641-L646
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.createXField
public static XField createXField(PreorderVisitor visitor) { JavaClass javaClass = visitor.getThisClass(); Field field = visitor.getField(); XField f = createXField(javaClass, field); return f; }
java
public static XField createXField(PreorderVisitor visitor) { JavaClass javaClass = visitor.getThisClass(); Field field = visitor.getField(); XField f = createXField(javaClass, field); return f; }
[ "public", "static", "XField", "createXField", "(", "PreorderVisitor", "visitor", ")", "{", "JavaClass", "javaClass", "=", "visitor", ".", "getThisClass", "(", ")", ";", "Field", "field", "=", "visitor", ".", "getField", "(", ")", ";", "XField", "f", "=", "...
Create an XField object from the field currently being visited by the given PreorderVisitor. @param visitor the PreorderVisitor @return the XField representing the method currently being visited
[ "Create", "an", "XField", "object", "from", "the", "field", "currently", "being", "visited", "by", "the", "given", "PreorderVisitor", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L656-L661
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.getXClass
public @CheckForNull XClass getXClass(ClassDescriptor classDescriptor) { try { IAnalysisCache analysisCache = Global.getAnalysisCache(); return analysisCache.getClassAnalysis(XClass.class, classDescriptor); } catch (CheckedAnalysisException e) { return null; ...
java
public @CheckForNull XClass getXClass(ClassDescriptor classDescriptor) { try { IAnalysisCache analysisCache = Global.getAnalysisCache(); return analysisCache.getClassAnalysis(XClass.class, classDescriptor); } catch (CheckedAnalysisException e) { return null; ...
[ "public", "@", "CheckForNull", "XClass", "getXClass", "(", "ClassDescriptor", "classDescriptor", ")", "{", "try", "{", "IAnalysisCache", "analysisCache", "=", "Global", ".", "getAnalysisCache", "(", ")", ";", "return", "analysisCache", ".", "getClassAnalysis", "(", ...
Get the XClass object providing information about the class named by the given ClassDescriptor. @param classDescriptor a ClassDescriptor @return an XClass object providing information about the class, or null if the class cannot be found
[ "Get", "the", "XClass", "object", "providing", "information", "about", "the", "class", "named", "by", "the", "given", "ClassDescriptor", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L684-L692
train
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/actions/FindBugsAction.java
FindBugsAction.work
protected void work(IWorkbenchPart part, final IResource resource, final List<WorkItem> resources) { FindBugsJob runFindBugs = new StartedFromViewJob("Finding bugs in " + resource.getName() + "...", resource, resources, part); runFindBugs.scheduleInteractive(); }
java
protected void work(IWorkbenchPart part, final IResource resource, final List<WorkItem> resources) { FindBugsJob runFindBugs = new StartedFromViewJob("Finding bugs in " + resource.getName() + "...", resource, resources, part); runFindBugs.scheduleInteractive(); }
[ "protected", "void", "work", "(", "IWorkbenchPart", "part", ",", "final", "IResource", "resource", ",", "final", "List", "<", "WorkItem", ">", "resources", ")", "{", "FindBugsJob", "runFindBugs", "=", "new", "StartedFromViewJob", "(", "\"Finding bugs in \"", "+", ...
Run a FindBugs analysis on the given resource, displaying a progress monitor. @param part @param resources The resource to run the analysis on.
[ "Run", "a", "FindBugs", "analysis", "on", "the", "given", "resource", "displaying", "a", "progress", "monitor", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/actions/FindBugsAction.java#L167-L170
train
spotbugs/spotbugs
spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/AbstractFindBugsTask.java
AbstractFindBugsTask.setClasspath
public void setClasspath(Path src) { if (classpath == null) { classpath = src; } else { classpath.append(src); } }
java
public void setClasspath(Path src) { if (classpath == null) { classpath = src; } else { classpath.append(src); } }
[ "public", "void", "setClasspath", "(", "Path", "src", ")", "{", "if", "(", "classpath", "==", "null", ")", "{", "classpath", "=", "src", ";", "}", "else", "{", "classpath", ".", "append", "(", "src", ")", ";", "}", "}" ]
Set the classpath to use. @param src classpath to use
[ "Set", "the", "classpath", "to", "use", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/AbstractFindBugsTask.java#L200-L206
train
spotbugs/spotbugs
spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/AbstractFindBugsTask.java
AbstractFindBugsTask.setClasspathRef
public void setClasspathRef(Reference r) { Path path = createClasspath(); path.setRefid(r); path.toString(); // Evaluated for its side-effects (throwing a // BuildException) }
java
public void setClasspathRef(Reference r) { Path path = createClasspath(); path.setRefid(r); path.toString(); // Evaluated for its side-effects (throwing a // BuildException) }
[ "public", "void", "setClasspathRef", "(", "Reference", "r", ")", "{", "Path", "path", "=", "createClasspath", "(", ")", ";", "path", ".", "setRefid", "(", "r", ")", ";", "path", ".", "toString", "(", ")", ";", "// Evaluated for its side-effects (throwing a", ...
Adds a reference to a classpath defined elsewhere. @param r reference to a classpath defined elsewhere
[ "Adds", "a", "reference", "to", "a", "classpath", "defined", "elsewhere", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/AbstractFindBugsTask.java#L226-L231
train
spotbugs/spotbugs
spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/AbstractFindBugsTask.java
AbstractFindBugsTask.checkParameters
protected void checkParameters() { if (homeDir == null && classpath == null) { throw new BuildException("either home attribute or " + "classpath attributes " + " must be defined for task <" + getTaskName() + "/>", getLocation()); } if (pluginList != null) { ...
java
protected void checkParameters() { if (homeDir == null && classpath == null) { throw new BuildException("either home attribute or " + "classpath attributes " + " must be defined for task <" + getTaskName() + "/>", getLocation()); } if (pluginList != null) { ...
[ "protected", "void", "checkParameters", "(", ")", "{", "if", "(", "homeDir", "==", "null", "&&", "classpath", "==", "null", ")", "{", "throw", "new", "BuildException", "(", "\"either home attribute or \"", "+", "\"classpath attributes \"", "+", "\" must be defined f...
Check that all required attributes have been set.
[ "Check", "that", "all", "required", "attributes", "have", "been", "set", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/AbstractFindBugsTask.java#L288-L310
train
spotbugs/spotbugs
spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/AbstractFindBugsTask.java
AbstractFindBugsTask.execFindbugs
private void execFindbugs() throws BuildException { System.out.println("Executing SpotBugs " + this.getClass().getSimpleName() + " from ant task"); createFindbugsEngine(); configureFindbugsEngine(); beforeExecuteJavaProcess(); if (getDebug()) { log(getFindbugsEngin...
java
private void execFindbugs() throws BuildException { System.out.println("Executing SpotBugs " + this.getClass().getSimpleName() + " from ant task"); createFindbugsEngine(); configureFindbugsEngine(); beforeExecuteJavaProcess(); if (getDebug()) { log(getFindbugsEngin...
[ "private", "void", "execFindbugs", "(", ")", "throws", "BuildException", "{", "System", ".", "out", ".", "println", "(", "\"Executing SpotBugs \"", "+", "this", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\" from ant task\"", ")", ";", "...
Create a new JVM to do the work. @since Ant 1.5
[ "Create", "a", "new", "JVM", "to", "do", "the", "work", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/AbstractFindBugsTask.java#L400-L438
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java
FindBugs.configureTrainingDatabases
public static void configureTrainingDatabases(IFindBugsEngine findBugs) throws IOException { if (findBugs.emitTrainingOutput()) { String trainingOutputDir = findBugs.getTrainingOutputDir(); if (!new File(trainingOutputDir).isDirectory()) { throw new IOException("Training...
java
public static void configureTrainingDatabases(IFindBugsEngine findBugs) throws IOException { if (findBugs.emitTrainingOutput()) { String trainingOutputDir = findBugs.getTrainingOutputDir(); if (!new File(trainingOutputDir).isDirectory()) { throw new IOException("Training...
[ "public", "static", "void", "configureTrainingDatabases", "(", "IFindBugsEngine", "findBugs", ")", "throws", "IOException", "{", "if", "(", "findBugs", ".", "emitTrainingOutput", "(", ")", ")", "{", "String", "trainingOutputDir", "=", "findBugs", ".", "getTrainingOu...
Configure training databases. @param findBugs the IFindBugsEngine to configure @throws IOException
[ "Configure", "training", "databases", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java#L218-L242
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java
FindBugs.isDetectorEnabled
public static boolean isDetectorEnabled(IFindBugsEngine findBugs, DetectorFactory factory, int rankThreshold) { if (!findBugs.getUserPreferences().isDetectorEnabled(factory)) { return false; } if (!factory.isEnabledForCurrentJRE()) { return false; } // ...
java
public static boolean isDetectorEnabled(IFindBugsEngine findBugs, DetectorFactory factory, int rankThreshold) { if (!findBugs.getUserPreferences().isDetectorEnabled(factory)) { return false; } if (!factory.isEnabledForCurrentJRE()) { return false; } // ...
[ "public", "static", "boolean", "isDetectorEnabled", "(", "IFindBugsEngine", "findBugs", ",", "DetectorFactory", "factory", ",", "int", "rankThreshold", ")", "{", "if", "(", "!", "findBugs", ".", "getUserPreferences", "(", ")", ".", "isDetectorEnabled", "(", "facto...
Determines whether or not given DetectorFactory should be enabled. @param findBugs the IFindBugsEngine @param factory the DetectorFactory @param rankThreshold TODO @return true if the DetectorFactory should be enabled, false otherwise
[ "Determines", "whether", "or", "not", "given", "DetectorFactory", "should", "be", "enabled", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java#L255-L295
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java
FindBugs.handleBugCategories
public static Set<String> handleBugCategories(String categories) { // Parse list of bug categories Set<String> categorySet = new HashSet<>(); StringTokenizer tok = new StringTokenizer(categories, ","); while (tok.hasMoreTokens()) { categorySet.add(tok.nextToken()); } ...
java
public static Set<String> handleBugCategories(String categories) { // Parse list of bug categories Set<String> categorySet = new HashSet<>(); StringTokenizer tok = new StringTokenizer(categories, ","); while (tok.hasMoreTokens()) { categorySet.add(tok.nextToken()); } ...
[ "public", "static", "Set", "<", "String", ">", "handleBugCategories", "(", "String", "categories", ")", "{", "// Parse list of bug categories", "Set", "<", "String", ">", "categorySet", "=", "new", "HashSet", "<>", "(", ")", ";", "StringTokenizer", "tok", "=", ...
Process -bugCategories option. @param categories comma-separated list of bug categories @return Set of categories to be used
[ "Process", "-", "bugCategories", "option", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java#L305-L314
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java
FindBugs.processCommandLine
public static void processCommandLine(TextUICommandLine commandLine, String[] argv, IFindBugsEngine findBugs) throws IOException, FilterException { // Expand option files in command line. // An argument beginning with "@" is treated as specifying // the name of an option file. ...
java
public static void processCommandLine(TextUICommandLine commandLine, String[] argv, IFindBugsEngine findBugs) throws IOException, FilterException { // Expand option files in command line. // An argument beginning with "@" is treated as specifying // the name of an option file. ...
[ "public", "static", "void", "processCommandLine", "(", "TextUICommandLine", "commandLine", ",", "String", "[", "]", "argv", ",", "IFindBugsEngine", "findBugs", ")", "throws", "IOException", ",", "FilterException", "{", "// Expand option files in command line.", "// An arg...
Process the command line. @param commandLine the TextUICommandLine object which will parse the command line @param argv the command line arguments @param findBugs the IFindBugsEngine to configure @throws IOException @throws FilterException
[ "Process", "the", "command", "line", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java#L328-L365
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java
FindBugs.showHelp
@SuppressFBWarnings("DM_EXIT") public static void showHelp(TextUICommandLine commandLine) { showSynopsis(); ShowHelp.showGeneralOptions(); FindBugs.showCommandLineOptions(commandLine); System.exit(1); }
java
@SuppressFBWarnings("DM_EXIT") public static void showHelp(TextUICommandLine commandLine) { showSynopsis(); ShowHelp.showGeneralOptions(); FindBugs.showCommandLineOptions(commandLine); System.exit(1); }
[ "@", "SuppressFBWarnings", "(", "\"DM_EXIT\"", ")", "public", "static", "void", "showHelp", "(", "TextUICommandLine", "commandLine", ")", "{", "showSynopsis", "(", ")", ";", "ShowHelp", ".", "showGeneralOptions", "(", ")", ";", "FindBugs", ".", "showCommandLineOpt...
Show -help message. @param commandLine
[ "Show", "-", "help", "message", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java#L372-L378
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java
FindBugs.runMain
@SuppressFBWarnings("DM_EXIT") public static void runMain(IFindBugsEngine findBugs, TextUICommandLine commandLine) throws IOException { boolean verbose = !commandLine.quiet(); try { findBugs.execute(); } catch (InterruptedException e) { assert false; // should not oc...
java
@SuppressFBWarnings("DM_EXIT") public static void runMain(IFindBugsEngine findBugs, TextUICommandLine commandLine) throws IOException { boolean verbose = !commandLine.quiet(); try { findBugs.execute(); } catch (InterruptedException e) { assert false; // should not oc...
[ "@", "SuppressFBWarnings", "(", "\"DM_EXIT\"", ")", "public", "static", "void", "runMain", "(", "IFindBugsEngine", "findBugs", ",", "TextUICommandLine", "commandLine", ")", "throws", "IOException", "{", "boolean", "verbose", "=", "!", "commandLine", ".", "quiet", ...
Given a fully-configured IFindBugsEngine and the TextUICommandLine used to configure it, execute the analysis. @param findBugs a fully-configured IFindBugsEngine @param commandLine the TextUICommandLine used to configure the IFindBugsEngine
[ "Given", "a", "fully", "-", "configured", "IFindBugsEngine", "and", "the", "TextUICommandLine", "used", "to", "configure", "it", "execute", "the", "analysis", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java#L389-L433
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java
FindBugs.configureBaselineFilter
public static BugReporter configureBaselineFilter(BugReporter bugReporter, String baselineFileName) throws IOException, DocumentException { return new ExcludingHashesBugReporter(bugReporter, baselineFileName); }
java
public static BugReporter configureBaselineFilter(BugReporter bugReporter, String baselineFileName) throws IOException, DocumentException { return new ExcludingHashesBugReporter(bugReporter, baselineFileName); }
[ "public", "static", "BugReporter", "configureBaselineFilter", "(", "BugReporter", "bugReporter", ",", "String", "baselineFileName", ")", "throws", "IOException", ",", "DocumentException", "{", "return", "new", "ExcludingHashesBugReporter", "(", "bugReporter", ",", "baseli...
Configure a baseline bug instance filter. @param bugReporter a DelegatingBugReporter @param baselineFileName filename of baseline Filter @throws java.io.IOException @throws org.dom4j.DocumentException
[ "Configure", "a", "baseline", "bug", "instance", "filter", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java#L500-L503
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java
AbstractFrameModelingVisitor.analyzeInstruction
public void analyzeInstruction(Instruction ins) throws DataflowAnalysisException { if (frame.isValid()) { try { ins.accept(this); } catch (InvalidBytecodeException e) { String message = "Invalid bytecode: could not analyze instr. " + ins + " at frame " + f...
java
public void analyzeInstruction(Instruction ins) throws DataflowAnalysisException { if (frame.isValid()) { try { ins.accept(this); } catch (InvalidBytecodeException e) { String message = "Invalid bytecode: could not analyze instr. " + ins + " at frame " + f...
[ "public", "void", "analyzeInstruction", "(", "Instruction", "ins", ")", "throws", "DataflowAnalysisException", "{", "if", "(", "frame", ".", "isValid", "(", ")", ")", "{", "try", "{", "ins", ".", "accept", "(", "this", ")", ";", "}", "catch", "(", "Inval...
Analyze the given Instruction. @param ins the Instruction @throws DataflowAnalysisException if an error occurs analyzing the instruction; in most cases, this indicates that the bytecode for the method being analyzed is invalid
[ "Analyze", "the", "given", "Instruction", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java#L81-L90
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java
AbstractFrameModelingVisitor.getNumWordsConsumed
public int getNumWordsConsumed(Instruction ins) { int numWordsConsumed = ins.consumeStack(cpg); if (numWordsConsumed == Const.UNPREDICTABLE) { throw new InvalidBytecodeException("Unpredictable stack consumption"); } return numWordsConsumed; }
java
public int getNumWordsConsumed(Instruction ins) { int numWordsConsumed = ins.consumeStack(cpg); if (numWordsConsumed == Const.UNPREDICTABLE) { throw new InvalidBytecodeException("Unpredictable stack consumption"); } return numWordsConsumed; }
[ "public", "int", "getNumWordsConsumed", "(", "Instruction", "ins", ")", "{", "int", "numWordsConsumed", "=", "ins", ".", "consumeStack", "(", "cpg", ")", ";", "if", "(", "numWordsConsumed", "==", "Const", ".", "UNPREDICTABLE", ")", "{", "throw", "new", "Inva...
Get the number of words consumed by given instruction.
[ "Get", "the", "number", "of", "words", "consumed", "by", "given", "instruction", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java#L140-L146
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java
AbstractFrameModelingVisitor.getNumWordsProduced
public int getNumWordsProduced(Instruction ins) { int numWordsProduced = ins.produceStack(cpg); if (numWordsProduced == Const.UNPREDICTABLE) { throw new InvalidBytecodeException("Unpredictable stack productions"); } return numWordsProduced; }
java
public int getNumWordsProduced(Instruction ins) { int numWordsProduced = ins.produceStack(cpg); if (numWordsProduced == Const.UNPREDICTABLE) { throw new InvalidBytecodeException("Unpredictable stack productions"); } return numWordsProduced; }
[ "public", "int", "getNumWordsProduced", "(", "Instruction", "ins", ")", "{", "int", "numWordsProduced", "=", "ins", ".", "produceStack", "(", "cpg", ")", ";", "if", "(", "numWordsProduced", "==", "Const", ".", "UNPREDICTABLE", ")", "{", "throw", "new", "Inva...
Get the number of words produced by given instruction.
[ "Get", "the", "number", "of", "words", "produced", "by", "given", "instruction", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java#L151-L158
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java
AbstractFrameModelingVisitor.visitConversionInstruction
@Override public final void visitConversionInstruction(ConversionInstruction obj) { visitConversionInstruction2(obj); if (obj instanceof NULL2Z) { visitNULL2Z((NULL2Z) obj); } else if (obj instanceof NONNULL2Z) { visitNONNULL2Z((NONNULL2Z) obj); } }
java
@Override public final void visitConversionInstruction(ConversionInstruction obj) { visitConversionInstruction2(obj); if (obj instanceof NULL2Z) { visitNULL2Z((NULL2Z) obj); } else if (obj instanceof NONNULL2Z) { visitNONNULL2Z((NONNULL2Z) obj); } }
[ "@", "Override", "public", "final", "void", "visitConversionInstruction", "(", "ConversionInstruction", "obj", ")", "{", "visitConversionInstruction2", "(", "obj", ")", ";", "if", "(", "obj", "instanceof", "NULL2Z", ")", "{", "visitNULL2Z", "(", "(", "NULL2Z", "...
To allow for calls to visitNULL2Z and visitNONNULL2Z, this method is made final. If you want to override it, override visitConversionInstruction2 instead.
[ "To", "allow", "for", "calls", "to", "visitNULL2Z", "and", "visitNONNULL2Z", "this", "method", "is", "made", "final", ".", "If", "you", "want", "to", "override", "it", "override", "visitConversionInstruction2", "instead", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java#L202-L210
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java
AbstractFrameModelingVisitor.handleStoreInstruction
public void handleStoreInstruction(StoreInstruction obj) { try { int numConsumed = obj.consumeStack(cpg); if (numConsumed == Const.UNPREDICTABLE) { throw new InvalidBytecodeException("Unpredictable stack consumption"); } int index = obj.getIndex()...
java
public void handleStoreInstruction(StoreInstruction obj) { try { int numConsumed = obj.consumeStack(cpg); if (numConsumed == Const.UNPREDICTABLE) { throw new InvalidBytecodeException("Unpredictable stack consumption"); } int index = obj.getIndex()...
[ "public", "void", "handleStoreInstruction", "(", "StoreInstruction", "obj", ")", "{", "try", "{", "int", "numConsumed", "=", "obj", ".", "consumeStack", "(", "cpg", ")", ";", "if", "(", "numConsumed", "==", "Const", ".", "UNPREDICTABLE", ")", "{", "throw", ...
Handler for all instructions which pop values from the stack and store them in a local variable. Note that two locals are stored into for long and double stores.
[ "Handler", "for", "all", "instructions", "which", "pop", "values", "from", "the", "stack", "and", "store", "them", "in", "a", "local", "variable", ".", "Note", "that", "two", "locals", "are", "stored", "into", "for", "long", "and", "double", "stores", "." ...
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java#L311-L329
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java
AbstractFrameModelingVisitor.modelInstruction
public void modelInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced, Value pushValue) { if (frame.getStackDepth() < numWordsConsumed) { try { throw new IllegalArgumentException(" asked to pop " + numWordsConsumed + " stack elements but only " ...
java
public void modelInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced, Value pushValue) { if (frame.getStackDepth() < numWordsConsumed) { try { throw new IllegalArgumentException(" asked to pop " + numWordsConsumed + " stack elements but only " ...
[ "public", "void", "modelInstruction", "(", "Instruction", "ins", ",", "int", "numWordsConsumed", ",", "int", "numWordsProduced", ",", "Value", "pushValue", ")", "{", "if", "(", "frame", ".", "getStackDepth", "(", ")", "<", "numWordsConsumed", ")", "{", "try", ...
Primitive to model the stack effect of a single instruction, explicitly specifying the value to be pushed on the stack. @param ins the Instruction to model @param numWordsConsumed number of stack words consumed @param numWordsProduced number of stack words produced @param pushValue value to push on the stack
[ "Primitive", "to", "model", "the", "stack", "effect", "of", "a", "single", "instruction", "explicitly", "specifying", "the", "value", "to", "be", "pushed", "on", "the", "stack", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java#L390-L411
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java
ClassPathBuilder.locateCodebasesRequiredForAnalysis
private void locateCodebasesRequiredForAnalysis(IClassPath classPath, IClassPathBuilderProgress progress) throws InterruptedException, IOException, ResourceNotFoundException { boolean foundJavaLangObject = false; boolean foundFindBugsAnnotations = false; boolean foundJSR305Annotation...
java
private void locateCodebasesRequiredForAnalysis(IClassPath classPath, IClassPathBuilderProgress progress) throws InterruptedException, IOException, ResourceNotFoundException { boolean foundJavaLangObject = false; boolean foundFindBugsAnnotations = false; boolean foundJSR305Annotation...
[ "private", "void", "locateCodebasesRequiredForAnalysis", "(", "IClassPath", "classPath", ",", "IClassPathBuilderProgress", "progress", ")", "throws", "InterruptedException", ",", "IOException", ",", "ResourceNotFoundException", "{", "boolean", "foundJavaLangObject", "=", "fal...
Make an effort to find the codebases containing any files required for analysis.
[ "Make", "an", "effort", "to", "find", "the", "codebases", "containing", "any", "files", "required", "for", "analysis", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java#L292-L334
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java
ClassPathBuilder.probeCodeBaseForResource
private boolean probeCodeBaseForResource(DiscoveredCodeBase discoveredCodeBase, String resourceName) { ICodeBaseEntry resource = discoveredCodeBase.getCodeBase().lookupResource(resourceName); return resource != null; }
java
private boolean probeCodeBaseForResource(DiscoveredCodeBase discoveredCodeBase, String resourceName) { ICodeBaseEntry resource = discoveredCodeBase.getCodeBase().lookupResource(resourceName); return resource != null; }
[ "private", "boolean", "probeCodeBaseForResource", "(", "DiscoveredCodeBase", "discoveredCodeBase", ",", "String", "resourceName", ")", "{", "ICodeBaseEntry", "resource", "=", "discoveredCodeBase", ".", "getCodeBase", "(", ")", ".", "lookupResource", "(", "resourceName", ...
Probe a codebase to see if a given source exists in that code base. @param resourceName name of a resource @return true if the resource exists in the codebase, false if not
[ "Probe", "a", "codebase", "to", "see", "if", "a", "given", "source", "exists", "in", "that", "code", "base", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java#L366-L369
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java
ClassPathBuilder.addWorkListItemsForClasspath
private void addWorkListItemsForClasspath(LinkedList<WorkListItem> workList, String path) { if (path == null) { return; } StringTokenizer st = new StringTokenizer(path, File.pathSeparator); while (st.hasMoreTokens()) { String entry = st.nextToken(); i...
java
private void addWorkListItemsForClasspath(LinkedList<WorkListItem> workList, String path) { if (path == null) { return; } StringTokenizer st = new StringTokenizer(path, File.pathSeparator); while (st.hasMoreTokens()) { String entry = st.nextToken(); i...
[ "private", "void", "addWorkListItemsForClasspath", "(", "LinkedList", "<", "WorkListItem", ">", "workList", ",", "String", "path", ")", "{", "if", "(", "path", "==", "null", ")", "{", "return", ";", "}", "StringTokenizer", "st", "=", "new", "StringTokenizer", ...
Add worklist items from given system classpath. @param workList the worklist @param path a system classpath
[ "Add", "worklist", "items", "from", "given", "system", "classpath", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java#L519-L533
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java
ClassPathBuilder.addWorkListItemsForExtDir
private void addWorkListItemsForExtDir(LinkedList<WorkListItem> workList, String extDir) { File dir = new File(extDir); File[] fileList = dir.listFiles((FileFilter) pathname -> { String path = pathname.getPath(); boolean isArchive = Archive.isArchiveFileName(path); re...
java
private void addWorkListItemsForExtDir(LinkedList<WorkListItem> workList, String extDir) { File dir = new File(extDir); File[] fileList = dir.listFiles((FileFilter) pathname -> { String path = pathname.getPath(); boolean isArchive = Archive.isArchiveFileName(path); re...
[ "private", "void", "addWorkListItemsForExtDir", "(", "LinkedList", "<", "WorkListItem", ">", "workList", ",", "String", "extDir", ")", "{", "File", "dir", "=", "new", "File", "(", "extDir", ")", ";", "File", "[", "]", "fileList", "=", "dir", ".", "listFile...
Add worklist items from given extensions directory. @param workList the worklist @param extDir an extensions directory
[ "Add", "worklist", "items", "from", "given", "extensions", "directory", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java#L543-L558
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java
ClassPathBuilder.parseClassName
private void parseClassName(ICodeBaseEntry entry) { DataInputStream in = null; try { InputStream resourceIn = entry.openResource(); if (resourceIn == null) { throw new NullPointerException("Got null resource"); } in = new DataInputStream(re...
java
private void parseClassName(ICodeBaseEntry entry) { DataInputStream in = null; try { InputStream resourceIn = entry.openResource(); if (resourceIn == null) { throw new NullPointerException("Got null resource"); } in = new DataInputStream(re...
[ "private", "void", "parseClassName", "(", "ICodeBaseEntry", "entry", ")", "{", "DataInputStream", "in", "=", "null", ";", "try", "{", "InputStream", "resourceIn", "=", "entry", ".", "openResource", "(", ")", ";", "if", "(", "resourceIn", "==", "null", ")", ...
Attempt to parse data of given resource in order to divine the real name of the class contained in the resource. @param entry the resource
[ "Attempt", "to", "parse", "data", "of", "given", "resource", "in", "order", "to", "divine", "the", "real", "name", "of", "the", "class", "contained", "in", "the", "resource", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java#L723-L746
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java
ClassPathBuilder.scanJarManifestForClassPathEntries
private void scanJarManifestForClassPathEntries(LinkedList<WorkListItem> workList, ICodeBase codeBase) throws IOException { // See if this codebase has a jar manifest ICodeBaseEntry manifestEntry = codeBase.lookupResource("META-INF/MANIFEST.MF"); if (manifestEntry == null) { // Do no...
java
private void scanJarManifestForClassPathEntries(LinkedList<WorkListItem> workList, ICodeBase codeBase) throws IOException { // See if this codebase has a jar manifest ICodeBaseEntry manifestEntry = codeBase.lookupResource("META-INF/MANIFEST.MF"); if (manifestEntry == null) { // Do no...
[ "private", "void", "scanJarManifestForClassPathEntries", "(", "LinkedList", "<", "WorkListItem", ">", "workList", ",", "ICodeBase", "codeBase", ")", "throws", "IOException", "{", "// See if this codebase has a jar manifest", "ICodeBaseEntry", "manifestEntry", "=", "codeBase",...
Check a codebase for a Jar manifest to examine for Class-Path entries. @param workList the worklist @param codeBase the codebase for examine for a Jar manifest @throws IOException
[ "Check", "a", "codebase", "for", "a", "Jar", "manifest", "to", "examine", "for", "Class", "-", "Path", "entries", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java#L757-L792
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ResourceCollection.java
ResourceCollection.addCreatedResource
public void addCreatedResource(Location location, Resource resource) { resourceList.add(resource); locationToResourceMap.put(location, resource); }
java
public void addCreatedResource(Location location, Resource resource) { resourceList.add(resource); locationToResourceMap.put(location, resource); }
[ "public", "void", "addCreatedResource", "(", "Location", "location", ",", "Resource", "resource", ")", "{", "resourceList", ".", "add", "(", "resource", ")", ";", "locationToResourceMap", ".", "put", "(", "location", ",", "resource", ")", ";", "}" ]
Add a resource created within the analyzed method. @param location the location @param resource the resource created at that location
[ "Add", "a", "resource", "created", "within", "the", "analyzed", "method", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ResourceCollection.java#L77-L80
train
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/properties/DetectorConfigurationTab.java
DetectorConfigurationTab.syncUserPreferencesWithTable
protected void syncUserPreferencesWithTable() { TableItem[] itemList = availableFactoriesTableViewer.getTable().getItems(); UserPreferences currentProps = getCurrentProps(); for (int i = 0; i < itemList.length; i++) { DetectorFactory factory = (DetectorFactory) itemList[i].getData();...
java
protected void syncUserPreferencesWithTable() { TableItem[] itemList = availableFactoriesTableViewer.getTable().getItems(); UserPreferences currentProps = getCurrentProps(); for (int i = 0; i < itemList.length; i++) { DetectorFactory factory = (DetectorFactory) itemList[i].getData();...
[ "protected", "void", "syncUserPreferencesWithTable", "(", ")", "{", "TableItem", "[", "]", "itemList", "=", "availableFactoriesTableViewer", ".", "getTable", "(", ")", ".", "getItems", "(", ")", ";", "UserPreferences", "currentProps", "=", "getCurrentProps", "(", ...
Disables all unchecked detector factories and enables checked factory detectors, leaving those not in the table unmodified.
[ "Disables", "all", "unchecked", "detector", "factories", "and", "enables", "checked", "factory", "detectors", "leaving", "those", "not", "in", "the", "table", "unmodified", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/properties/DetectorConfigurationTab.java#L513-L521
train
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/properties/DetectorConfigurationTab.java
DetectorConfigurationTab.createDetectorsTableViewer
private Table createDetectorsTableViewer(Composite parent, IProject project) { final BugPatternTableSorter sorter = new BugPatternTableSorter(this); int tableStyle = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.CHECK; availableFactoriesTableViewer = CheckboxT...
java
private Table createDetectorsTableViewer(Composite parent, IProject project) { final BugPatternTableSorter sorter = new BugPatternTableSorter(this); int tableStyle = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.CHECK; availableFactoriesTableViewer = CheckboxT...
[ "private", "Table", "createDetectorsTableViewer", "(", "Composite", "parent", ",", "IProject", "project", ")", "{", "final", "BugPatternTableSorter", "sorter", "=", "new", "BugPatternTableSorter", "(", "this", ")", ";", "int", "tableStyle", "=", "SWT", ".", "BORDE...
Build rule table viewer
[ "Build", "rule", "table", "viewer" ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/properties/DetectorConfigurationTab.java#L550-L606
train
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/properties/DetectorConfigurationTab.java
DetectorConfigurationTab.populateAvailableRulesTable
private void populateAvailableRulesTable(IProject project) { List<DetectorFactory> allAvailableList = new ArrayList<>(); factoriesToBugAbbrev = new HashMap<>(); Iterator<DetectorFactory> iterator = DetectorFactoryCollection.instance().factoryIterator(); while (iterator.hasNext()) { ...
java
private void populateAvailableRulesTable(IProject project) { List<DetectorFactory> allAvailableList = new ArrayList<>(); factoriesToBugAbbrev = new HashMap<>(); Iterator<DetectorFactory> iterator = DetectorFactoryCollection.instance().factoryIterator(); while (iterator.hasNext()) { ...
[ "private", "void", "populateAvailableRulesTable", "(", "IProject", "project", ")", "{", "List", "<", "DetectorFactory", ">", "allAvailableList", "=", "new", "ArrayList", "<>", "(", ")", ";", "factoriesToBugAbbrev", "=", "new", "HashMap", "<>", "(", ")", ";", "...
Populate the rule table
[ "Populate", "the", "rule", "table" ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/properties/DetectorConfigurationTab.java#L643-L669
train
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/npe/ReturnPathType.java
ReturnPathType.mergeWith
public void mergeWith(ReturnPathType fact) { if (fact.isTop()) { // other fact is top: no change to this one return; } else if (this.isTop()) { // this fact is top: copy other fact this.copyFrom(fact); } else { // neither fact is top: a...
java
public void mergeWith(ReturnPathType fact) { if (fact.isTop()) { // other fact is top: no change to this one return; } else if (this.isTop()) { // this fact is top: copy other fact this.copyFrom(fact); } else { // neither fact is top: a...
[ "public", "void", "mergeWith", "(", "ReturnPathType", "fact", ")", "{", "if", "(", "fact", ".", "isTop", "(", ")", ")", "{", "// other fact is top: no change to this one", "return", ";", "}", "else", "if", "(", "this", ".", "isTop", "(", ")", ")", "{", "...
Merge this fact with given fact. @param fact another dataflow fact
[ "Merge", "this", "fact", "with", "given", "fact", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/npe/ReturnPathType.java#L103-L118
train
spotbugs/spotbugs
spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/OSXAdapter.java
OSXAdapter.handleAbout
@Override public void handleAbout(ApplicationEvent ae) { if (mainApp != null) { ae.setHandled(true); // We need to invoke modal About Dialog asynchronously // otherwise the Application queue is locked for the duration // of the about Dialog, which results in a...
java
@Override public void handleAbout(ApplicationEvent ae) { if (mainApp != null) { ae.setHandled(true); // We need to invoke modal About Dialog asynchronously // otherwise the Application queue is locked for the duration // of the about Dialog, which results in a...
[ "@", "Override", "public", "void", "handleAbout", "(", "ApplicationEvent", "ae", ")", "{", "if", "(", "mainApp", "!=", "null", ")", "{", "ae", ".", "setHandled", "(", "true", ")", ";", "// We need to invoke modal About Dialog asynchronously", "// otherwise the Appli...
over from another platform.
[ "over", "from", "another", "platform", "." ]
f6365c6eea6515035bded38efa4a7c8b46ccf28c
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/OSXAdapter.java#L50-L63
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/connection/LoggingIllegalOperationHandler.java
LoggingIllegalOperationHandler.handleMismatchData
@Override public BleIllegalOperationException handleMismatchData(BluetoothGattCharacteristic characteristic, int neededProperties) { RxBleLog.w(messageCreator.createMismatchMessage(characteristic, neededProperties)); return null; }
java
@Override public BleIllegalOperationException handleMismatchData(BluetoothGattCharacteristic characteristic, int neededProperties) { RxBleLog.w(messageCreator.createMismatchMessage(characteristic, neededProperties)); return null; }
[ "@", "Override", "public", "BleIllegalOperationException", "handleMismatchData", "(", "BluetoothGattCharacteristic", "characteristic", ",", "int", "neededProperties", ")", "{", "RxBleLog", ".", "w", "(", "messageCreator", ".", "createMismatchMessage", "(", "characteristic",...
This method logs a warning. @param characteristic the characteristic upon which the operation was requested @param neededProperties bitmask of properties needed by the operation
[ "This", "method", "logs", "a", "warning", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/connection/LoggingIllegalOperationHandler.java#L26-L30
train
Polidea/RxAndroidBle
sample/src/main/java/com/polidea/rxandroidble2/sample/SampleApplication.java
SampleApplication.getRxBleClient
public static RxBleClient getRxBleClient(Context context) { SampleApplication application = (SampleApplication) context.getApplicationContext(); return application.rxBleClient; }
java
public static RxBleClient getRxBleClient(Context context) { SampleApplication application = (SampleApplication) context.getApplicationContext(); return application.rxBleClient; }
[ "public", "static", "RxBleClient", "getRxBleClient", "(", "Context", "context", ")", "{", "SampleApplication", "application", "=", "(", "SampleApplication", ")", "context", ".", "getApplicationContext", "(", ")", ";", "return", "application", ".", "rxBleClient", ";"...
In practise you will use some kind of dependency injection pattern.
[ "In", "practise", "you", "will", "use", "some", "kind", "of", "dependency", "injection", "pattern", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/sample/src/main/java/com/polidea/rxandroidble2/sample/SampleApplication.java#L21-L24
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/connection/IllegalOperationChecker.java
IllegalOperationChecker.checkAnyPropertyMatches
public Completable checkAnyPropertyMatches(final BluetoothGattCharacteristic characteristic, final @BluetoothGattCharacteristicProperty int neededProperties) { return Completable.fromAction(new Action() { public void run() { final int ch...
java
public Completable checkAnyPropertyMatches(final BluetoothGattCharacteristic characteristic, final @BluetoothGattCharacteristicProperty int neededProperties) { return Completable.fromAction(new Action() { public void run() { final int ch...
[ "public", "Completable", "checkAnyPropertyMatches", "(", "final", "BluetoothGattCharacteristic", "characteristic", ",", "final", "@", "BluetoothGattCharacteristicProperty", "int", "neededProperties", ")", "{", "return", "Completable", ".", "fromAction", "(", "new", "Action"...
This method checks whether the supplied characteristic possesses properties supporting the requested kind of operation, specified by the supplied bitmask. Emits {@link BleIllegalOperationException} if there was no match between supported and necessary properties of characteristic and check has not been suppressed @pa...
[ "This", "method", "checks", "whether", "the", "supplied", "characteristic", "possesses", "properties", "supporting", "the", "requested", "kind", "of", "operation", "specified", "by", "the", "supplied", "bitmask", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/connection/IllegalOperationChecker.java#L36-L50
train
Polidea/RxAndroidBle
sample/src/main/java/com/polidea/rxandroidble2/sample/util/ScanExceptionHandler.java
ScanExceptionHandler.handleException
public static void handleException(final Activity context, final BleScanException exception) { final String text; final int reason = exception.getReason(); // Special case, as there might or might not be a retry date suggestion if (reason == BleScanException.UNDOCUMENTED_SCAN_THROTTLE) ...
java
public static void handleException(final Activity context, final BleScanException exception) { final String text; final int reason = exception.getReason(); // Special case, as there might or might not be a retry date suggestion if (reason == BleScanException.UNDOCUMENTED_SCAN_THROTTLE) ...
[ "public", "static", "void", "handleException", "(", "final", "Activity", "context", ",", "final", "BleScanException", "exception", ")", "{", "final", "String", "text", ";", "final", "int", "reason", "=", "exception", ".", "getReason", "(", ")", ";", "// Specia...
Show toast with error message appropriate to exception reason. @param context current Activity context @param exception BleScanException to show error message for
[ "Show", "toast", "with", "error", "message", "appropriate", "to", "exception", "reason", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/sample/src/main/java/com/polidea/rxandroidble2/sample/util/ScanExceptionHandler.java#L63-L84
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/operations/ConnectOperation.java
ConnectOperation.getConnectedBluetoothGatt
@NonNull private Single<BluetoothGatt> getConnectedBluetoothGatt() { // start connecting the BluetoothGatt // note: Due to different Android BLE stack implementations it is not certain whether `connectGatt()` or `BluetoothGattCallback` // will emit BluetoothGatt first return Single.c...
java
@NonNull private Single<BluetoothGatt> getConnectedBluetoothGatt() { // start connecting the BluetoothGatt // note: Due to different Android BLE stack implementations it is not certain whether `connectGatt()` or `BluetoothGattCallback` // will emit BluetoothGatt first return Single.c...
[ "@", "NonNull", "private", "Single", "<", "BluetoothGatt", ">", "getConnectedBluetoothGatt", "(", ")", "{", "// start connecting the BluetoothGatt", "// note: Due to different Android BLE stack implementations it is not certain whether `connectGatt()` or `BluetoothGattCallback`", "// will ...
Emits BluetoothGatt and completes after connection is established. @return BluetoothGatt after connection reaches {@link com.polidea.rxandroidble2.RxBleConnection.RxBleConnectionState#CONNECTED} state. @throws com.polidea.rxandroidble2.exceptions.BleDisconnectedException if connection was disconnected/failed before it...
[ "Emits", "BluetoothGatt", "and", "completes", "after", "connection", "is", "established", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/operations/ConnectOperation.java#L120-L165
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/scan/ScanSettingsEmulator.java
ScanSettingsEmulator.repeatedWindowTransformer
private ObservableTransformer<RxBleInternalScanResult, RxBleInternalScanResult> repeatedWindowTransformer( @IntRange(from = 0, to = 4999) final int windowInMillis ) { final long repeatCycleTimeInMillis = TimeUnit.SECONDS.toMillis(5); final long delayToNextWindow = Math.max(repeatCycleTim...
java
private ObservableTransformer<RxBleInternalScanResult, RxBleInternalScanResult> repeatedWindowTransformer( @IntRange(from = 0, to = 4999) final int windowInMillis ) { final long repeatCycleTimeInMillis = TimeUnit.SECONDS.toMillis(5); final long delayToNextWindow = Math.max(repeatCycleTim...
[ "private", "ObservableTransformer", "<", "RxBleInternalScanResult", ",", "RxBleInternalScanResult", ">", "repeatedWindowTransformer", "(", "@", "IntRange", "(", "from", "=", "0", ",", "to", "=", "4999", ")", "final", "int", "windowInMillis", ")", "{", "final", "lo...
A convenience method for running a scan for a period of time and repeat in five seconds intervals. @param windowInMillis window for which the observable should be active @return Observable.Transformer that will take the original observable for specific time and repeat subscription after 5 seconds
[ "A", "convenience", "method", "for", "running", "a", "scan", "for", "a", "period", "of", "time", "and", "repeat", "in", "five", "seconds", "intervals", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/scan/ScanSettingsEmulator.java#L104-L122
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/scan/ScanFilter.java
ScanFilter.matchesServiceUuids
private boolean matchesServiceUuids(ParcelUuid uuid, ParcelUuid parcelUuidMask, List<ParcelUuid> uuids) { if (uuid == null) { return true; } if (uuids == null) { return false; } for (ParcelUuid parcelUuid : uuids) {...
java
private boolean matchesServiceUuids(ParcelUuid uuid, ParcelUuid parcelUuidMask, List<ParcelUuid> uuids) { if (uuid == null) { return true; } if (uuids == null) { return false; } for (ParcelUuid parcelUuid : uuids) {...
[ "private", "boolean", "matchesServiceUuids", "(", "ParcelUuid", "uuid", ",", "ParcelUuid", "parcelUuidMask", ",", "List", "<", "ParcelUuid", ">", "uuids", ")", "{", "if", "(", "uuid", "==", "null", ")", "{", "return", "true", ";", "}", "if", "(", "uuids", ...
Check if the uuid pattern is contained in a list of parcel uuids.
[ "Check", "if", "the", "uuid", "pattern", "is", "contained", "in", "a", "list", "of", "parcel", "uuids", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/scan/ScanFilter.java#L314-L330
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/util/CheckerLocationPermission.java
CheckerLocationPermission.isPermissionGranted
private boolean isPermissionGranted(String permission) { if (permission == null) { throw new IllegalArgumentException("permission is null"); } return context.checkPermission(permission, android.os.Process.myPid(), Process.myUid()) == PackageManager.PERMISSION_GRANTED; }
java
private boolean isPermissionGranted(String permission) { if (permission == null) { throw new IllegalArgumentException("permission is null"); } return context.checkPermission(permission, android.os.Process.myPid(), Process.myUid()) == PackageManager.PERMISSION_GRANTED; }
[ "private", "boolean", "isPermissionGranted", "(", "String", "permission", ")", "{", "if", "(", "permission", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"permission is null\"", ")", ";", "}", "return", "context", ".", "checkPermissio...
Copied from android.support.v4.content.ContextCompat for backwards compatibility @param permission the permission to check @return true is granted
[ "Copied", "from", "android", ".", "support", ".", "v4", ".", "content", ".", "ContextCompat", "for", "backwards", "compatibility" ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/util/CheckerLocationPermission.java#L30-L36
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/util/UUIDUtil.java
UUIDUtil.parseServiceUuid
private static int parseServiceUuid(byte[] scanRecord, int currentPos, int dataLength, int uuidLength, List<ParcelUuid> serviceUuids) { while (dataLength > 0) { byte[] uuidBytes = extractBytes(scanRecord, currentPos, uuidLength); ...
java
private static int parseServiceUuid(byte[] scanRecord, int currentPos, int dataLength, int uuidLength, List<ParcelUuid> serviceUuids) { while (dataLength > 0) { byte[] uuidBytes = extractBytes(scanRecord, currentPos, uuidLength); ...
[ "private", "static", "int", "parseServiceUuid", "(", "byte", "[", "]", "scanRecord", ",", "int", "currentPos", ",", "int", "dataLength", ",", "int", "uuidLength", ",", "List", "<", "ParcelUuid", ">", "serviceUuids", ")", "{", "while", "(", "dataLength", ">",...
Parse service UUIDs.
[ "Parse", "service", "UUIDs", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/util/UUIDUtil.java#L248-L258
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/util/UUIDUtil.java
UUIDUtil.extractBytes
private static byte[] extractBytes(byte[] scanRecord, int start, int length) { byte[] bytes = new byte[length]; System.arraycopy(scanRecord, start, bytes, 0, length); return bytes; }
java
private static byte[] extractBytes(byte[] scanRecord, int start, int length) { byte[] bytes = new byte[length]; System.arraycopy(scanRecord, start, bytes, 0, length); return bytes; }
[ "private", "static", "byte", "[", "]", "extractBytes", "(", "byte", "[", "]", "scanRecord", ",", "int", "start", ",", "int", "length", ")", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "length", "]", ";", "System", ".", "arraycopy", "(", ...
Helper method to extract bytes from byte array.
[ "Helper", "method", "to", "extract", "bytes", "from", "byte", "array", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/util/UUIDUtil.java#L261-L265
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java
ValueInterpreter.unsignedBytesToInt
private static int unsignedBytesToInt(byte b0, byte b1, byte b2, byte b3) { return (unsignedByteToInt(b0) + (unsignedByteToInt(b1) << 8)) + (unsignedByteToInt(b2) << 16) + (unsignedByteToInt(b3) << 24); }
java
private static int unsignedBytesToInt(byte b0, byte b1, byte b2, byte b3) { return (unsignedByteToInt(b0) + (unsignedByteToInt(b1) << 8)) + (unsignedByteToInt(b2) << 16) + (unsignedByteToInt(b3) << 24); }
[ "private", "static", "int", "unsignedBytesToInt", "(", "byte", "b0", ",", "byte", "b1", ",", "byte", "b2", ",", "byte", "b3", ")", "{", "return", "(", "unsignedByteToInt", "(", "b0", ")", "+", "(", "unsignedByteToInt", "(", "b1", ")", "<<", "8", ")", ...
Convert signed bytes to a 32-bit unsigned int.
[ "Convert", "signed", "bytes", "to", "a", "32", "-", "bit", "unsigned", "int", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java#L199-L202
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java
ValueInterpreter.bytesToFloat
private static float bytesToFloat(byte b0, byte b1) { int mantissa = unsignedToSigned(unsignedByteToInt(b0) + ((unsignedByteToInt(b1) & 0x0F) << 8), 12); int exponent = unsignedToSigned(unsignedByteToInt(b1) >> 4, 4); return (float) (mantissa * Math.pow(10, exponent)); }
java
private static float bytesToFloat(byte b0, byte b1) { int mantissa = unsignedToSigned(unsignedByteToInt(b0) + ((unsignedByteToInt(b1) & 0x0F) << 8), 12); int exponent = unsignedToSigned(unsignedByteToInt(b1) >> 4, 4); return (float) (mantissa * Math.pow(10, exponent)); }
[ "private", "static", "float", "bytesToFloat", "(", "byte", "b0", ",", "byte", "b1", ")", "{", "int", "mantissa", "=", "unsignedToSigned", "(", "unsignedByteToInt", "(", "b0", ")", "+", "(", "(", "unsignedByteToInt", "(", "b1", ")", "&", "0x0F", ")", "<<"...
Convert signed bytes to a 16-bit short float value.
[ "Convert", "signed", "bytes", "to", "a", "16", "-", "bit", "short", "float", "value", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java#L207-L212
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java
ValueInterpreter.bytesToFloat
private static float bytesToFloat(byte b0, byte b1, byte b2, byte b3) { int mantissa = unsignedToSigned(unsignedByteToInt(b0) + (unsignedByteToInt(b1) << 8) + (unsignedByteToInt(b2) << 16), 24); return (float) (mantissa * Math.pow(10, b3)); }
java
private static float bytesToFloat(byte b0, byte b1, byte b2, byte b3) { int mantissa = unsignedToSigned(unsignedByteToInt(b0) + (unsignedByteToInt(b1) << 8) + (unsignedByteToInt(b2) << 16), 24); return (float) (mantissa * Math.pow(10, b3)); }
[ "private", "static", "float", "bytesToFloat", "(", "byte", "b0", ",", "byte", "b1", ",", "byte", "b2", ",", "byte", "b3", ")", "{", "int", "mantissa", "=", "unsignedToSigned", "(", "unsignedByteToInt", "(", "b0", ")", "+", "(", "unsignedByteToInt", "(", ...
Convert signed bytes to a 32-bit short float value.
[ "Convert", "signed", "bytes", "to", "a", "32", "-", "bit", "short", "float", "value", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java#L217-L222
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java
ValueInterpreter.unsignedToSigned
private static int unsignedToSigned(int unsigned, int size) { if ((unsigned & (1 << size - 1)) != 0) { unsigned = -1 * ((1 << size - 1) - (unsigned & ((1 << size - 1) - 1))); } return unsigned; }
java
private static int unsignedToSigned(int unsigned, int size) { if ((unsigned & (1 << size - 1)) != 0) { unsigned = -1 * ((1 << size - 1) - (unsigned & ((1 << size - 1) - 1))); } return unsigned; }
[ "private", "static", "int", "unsignedToSigned", "(", "int", "unsigned", ",", "int", "size", ")", "{", "if", "(", "(", "unsigned", "&", "(", "1", "<<", "size", "-", "1", ")", ")", "!=", "0", ")", "{", "unsigned", "=", "-", "1", "*", "(", "(", "1...
Convert an unsigned integer value to a two's-complement encoded signed value.
[ "Convert", "an", "unsigned", "integer", "value", "to", "a", "two", "s", "-", "complement", "encoded", "signed", "value", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java#L228-L233
train
Polidea/RxAndroidBle
sample/src/main/java/com/polidea/rxandroidble2/sample/example4_characteristic/advanced/Presenter.java
Presenter.repeatAfterCompleted
@NonNull private static <T> ObservableTransformer<T, T> repeatAfterCompleted() { return observable -> observable.repeatWhen(completedNotification -> completedNotification); }
java
@NonNull private static <T> ObservableTransformer<T, T> repeatAfterCompleted() { return observable -> observable.repeatWhen(completedNotification -> completedNotification); }
[ "@", "NonNull", "private", "static", "<", "T", ">", "ObservableTransformer", "<", "T", ",", "T", ">", "repeatAfterCompleted", "(", ")", "{", "return", "observable", "->", "observable", ".", "repeatWhen", "(", "completedNotification", "->", "completedNotification",...
A convenience function creating a transformer that will repeat the source observable whenever it will complete @param <T> the type of the transformed observable @return transformer that will emit observable that will never complete (source will be subscribed again)
[ "A", "convenience", "function", "creating", "a", "transformer", "that", "will", "repeat", "the", "source", "observable", "whenever", "it", "will", "complete" ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/sample/src/main/java/com/polidea/rxandroidble2/sample/example4_characteristic/advanced/Presenter.java#L261-L264
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/RxBleLog.java
RxBleLog.updateLogOptions
public static void updateLogOptions(LogOptions logOptions) { LoggerSetup oldLoggerSetup = RxBleLog.loggerSetup; LoggerSetup newLoggerSetup = oldLoggerSetup.merge(logOptions); d("Received new options (%s) and merged with old setup: %s. New setup: %s", logOptions, oldLoggerSetup, newLoggerSetup); ...
java
public static void updateLogOptions(LogOptions logOptions) { LoggerSetup oldLoggerSetup = RxBleLog.loggerSetup; LoggerSetup newLoggerSetup = oldLoggerSetup.merge(logOptions); d("Received new options (%s) and merged with old setup: %s. New setup: %s", logOptions, oldLoggerSetup, newLoggerSetup); ...
[ "public", "static", "void", "updateLogOptions", "(", "LogOptions", "logOptions", ")", "{", "LoggerSetup", "oldLoggerSetup", "=", "RxBleLog", ".", "loggerSetup", ";", "LoggerSetup", "newLoggerSetup", "=", "oldLoggerSetup", ".", "merge", "(", "logOptions", ")", ";", ...
Method to update current logger setup with new LogOptions. Only set options will be updated. Options that were not set or set to null on the LogOptions will not update the current setup leaving the previous values untouched. @param logOptions the new log options
[ "Method", "to", "update", "current", "logger", "setup", "with", "new", "LogOptions", ".", "Only", "set", "options", "will", "be", "updated", ".", "Options", "that", "were", "not", "set", "or", "set", "to", "null", "on", "the", "LogOptions", "will", "not", ...
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/RxBleLog.java#L130-L135
train
Polidea/RxAndroidBle
sample/src/main/java/com/polidea/rxandroidble2/sample/example4_characteristic/CharacteristicOperationExampleActivity.java
CharacteristicOperationExampleActivity.updateUI
private void updateUI(BluetoothGattCharacteristic characteristic) { connectButton.setText(characteristic != null ? R.string.disconnect : R.string.connect); readButton.setEnabled(hasProperty(characteristic, BluetoothGattCharacteristic.PROPERTY_READ)); writeButton.setEnabled(hasProperty(characteri...
java
private void updateUI(BluetoothGattCharacteristic characteristic) { connectButton.setText(characteristic != null ? R.string.disconnect : R.string.connect); readButton.setEnabled(hasProperty(characteristic, BluetoothGattCharacteristic.PROPERTY_READ)); writeButton.setEnabled(hasProperty(characteri...
[ "private", "void", "updateUI", "(", "BluetoothGattCharacteristic", "characteristic", ")", "{", "connectButton", ".", "setText", "(", "characteristic", "!=", "null", "?", "R", ".", "string", ".", "disconnect", ":", "R", ".", "string", ".", "connect", ")", ";", ...
This method updates the UI to a proper state. @param characteristic a nullable {@link BluetoothGattCharacteristic}. If it is null then UI is assuming a disconnected state.
[ "This", "method", "updates", "the", "UI", "to", "a", "proper", "state", "." ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/sample/src/main/java/com/polidea/rxandroidble2/sample/example4_characteristic/CharacteristicOperationExampleActivity.java#L209-L214
train
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/util/ClientStateObservable.java
ClientStateObservable.checkPermissionUntilGranted
@NonNull private static Single<Boolean> checkPermissionUntilGranted( final LocationServicesStatus locationServicesStatus, Scheduler timerScheduler ) { return Observable.interval(0, 1L, TimeUnit.SECONDS, timerScheduler) .takeWhile(new Predicate<Long>() { ...
java
@NonNull private static Single<Boolean> checkPermissionUntilGranted( final LocationServicesStatus locationServicesStatus, Scheduler timerScheduler ) { return Observable.interval(0, 1L, TimeUnit.SECONDS, timerScheduler) .takeWhile(new Predicate<Long>() { ...
[ "@", "NonNull", "private", "static", "Single", "<", "Boolean", ">", "checkPermissionUntilGranted", "(", "final", "LocationServicesStatus", "locationServicesStatus", ",", "Scheduler", "timerScheduler", ")", "{", "return", "Observable", ".", "interval", "(", "0", ",", ...
Observable that emits `true` if the permission was granted on the time of subscription @param locationServicesStatus the LocationServicesStatus @param timerScheduler the Scheduler @return the observable
[ "Observable", "that", "emits", "true", "if", "the", "permission", "was", "granted", "on", "the", "time", "of", "subscription" ]
c6e4a9753c834d710e255306bb290e9244cdbc10
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/util/ClientStateObservable.java#L59-L79
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyLayoutInflater.java
CalligraphyLayoutInflater.onCreateView
@Override @TargetApi(Build.VERSION_CODES.HONEYCOMB) protected View onCreateView(View parent, String name, AttributeSet attrs) throws ClassNotFoundException { return mCalligraphyFactory.onViewCreated(super.onCreateView(parent, name, attrs), getContext(), attrs); }
java
@Override @TargetApi(Build.VERSION_CODES.HONEYCOMB) protected View onCreateView(View parent, String name, AttributeSet attrs) throws ClassNotFoundException { return mCalligraphyFactory.onViewCreated(super.onCreateView(parent, name, attrs), getContext(), attrs); }
[ "@", "Override", "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "protected", "View", "onCreateView", "(", "View", "parent", ",", "String", "name", ",", "AttributeSet", "attrs", ")", "throws", "ClassNotFoundException", "{", "return",...
The LayoutInflater onCreateView is the fourth port of call for LayoutInflation. BUT only for none CustomViews.
[ "The", "LayoutInflater", "onCreateView", "is", "the", "fourth", "port", "of", "call", "for", "LayoutInflation", ".", "BUT", "only", "for", "none", "CustomViews", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyLayoutInflater.java#L145-L150
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java
CalligraphyUtils.applyTypefaceSpan
public static CharSequence applyTypefaceSpan(CharSequence s, Typeface typeface) { if (s != null && s.length() > 0) { if (!(s instanceof Spannable)) { s = new SpannableString(s); } ((Spannable) s).setSpan(TypefaceUtils.getSpan(typeface), 0, s.length(), Spanned....
java
public static CharSequence applyTypefaceSpan(CharSequence s, Typeface typeface) { if (s != null && s.length() > 0) { if (!(s instanceof Spannable)) { s = new SpannableString(s); } ((Spannable) s).setSpan(TypefaceUtils.getSpan(typeface), 0, s.length(), Spanned....
[ "public", "static", "CharSequence", "applyTypefaceSpan", "(", "CharSequence", "s", ",", "Typeface", "typeface", ")", "{", "if", "(", "s", "!=", "null", "&&", "s", ".", "length", "(", ")", ">", "0", ")", "{", "if", "(", "!", "(", "s", "instanceof", "S...
Applies a custom typeface span to the text. @param s text to apply it too. @param typeface typeface to apply. @return Either the passed in Object or new Spannable with the typeface span applied.
[ "Applies", "a", "custom", "typeface", "span", "to", "the", "text", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L34-L42
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java
CalligraphyUtils.applyFontToTextView
public static boolean applyFontToTextView(final TextView textView, final Typeface typeface, boolean deferred) { if (textView == null || typeface == null) return false; textView.setPaintFlags(textView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); textView.setTypeface(typefa...
java
public static boolean applyFontToTextView(final TextView textView, final Typeface typeface, boolean deferred) { if (textView == null || typeface == null) return false; textView.setPaintFlags(textView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); textView.setTypeface(typefa...
[ "public", "static", "boolean", "applyFontToTextView", "(", "final", "TextView", "textView", ",", "final", "Typeface", "typeface", ",", "boolean", "deferred", ")", "{", "if", "(", "textView", "==", "null", "||", "typeface", "==", "null", ")", "return", "false",...
Applies a Typeface to a TextView, if deferred,its recommend you don't call this multiple times, as this adds a TextWatcher. Deferring should really only be used on tricky views which get Typeface set by the system at weird times. @param textView Not null, TextView or child of. @param typeface Not null, Typeface to ap...
[ "Applies", "a", "Typeface", "to", "a", "TextView", "if", "deferred", "its", "recommend", "you", "don", "t", "call", "this", "multiple", "times", "as", "this", "adds", "a", "TextWatcher", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L74-L96
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java
CalligraphyUtils.pullFontPathFromView
static String pullFontPathFromView(Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) return null; final String attributeName; try { attributeName = context.getResources().getResourceEntryName(attributeId[0]); } ca...
java
static String pullFontPathFromView(Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) return null; final String attributeName; try { attributeName = context.getResources().getResourceEntryName(attributeId[0]); } ca...
[ "static", "String", "pullFontPathFromView", "(", "Context", "context", ",", "AttributeSet", "attrs", ",", "int", "[", "]", "attributeId", ")", "{", "if", "(", "attributeId", "==", "null", "||", "attrs", "==", "null", ")", "return", "null", ";", "final", "S...
Tries to pull the Custom Attribute directly from the TextView. @param context Activity Context @param attrs View Attributes @param attributeId if -1 returns null. @return null if attribute is not defined or added to View
[ "Tries", "to", "pull", "the", "Custom", "Attribute", "directly", "from", "the", "TextView", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L157-L173
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java
CalligraphyUtils.pullFontPathFromStyle
static String pullFontPathFromStyle(Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) return null; final TypedArray typedArray = context.obtainStyledAttributes(attrs, attributeId); if (typedArray != null) { try { ...
java
static String pullFontPathFromStyle(Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) return null; final TypedArray typedArray = context.obtainStyledAttributes(attrs, attributeId); if (typedArray != null) { try { ...
[ "static", "String", "pullFontPathFromStyle", "(", "Context", "context", ",", "AttributeSet", "attrs", ",", "int", "[", "]", "attributeId", ")", "{", "if", "(", "attributeId", "==", "null", "||", "attrs", "==", "null", ")", "return", "null", ";", "final", "...
Tries to pull the Font Path from the View Style as this is the next decendent after being defined in the View's xml. @param context Activity Activity Context @param attrs View Attributes @param attributeId if -1 returns null. @return null if attribute is not defined or found in the Style
[ "Tries", "to", "pull", "the", "Font", "Path", "from", "the", "View", "Style", "as", "this", "is", "the", "next", "decendent", "after", "being", "defined", "in", "the", "View", "s", "xml", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L184-L202
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java
CalligraphyUtils.pullFontPathFromTextAppearance
static String pullFontPathFromTextAppearance(final Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) { return null; } int textAppearanceId = -1; final TypedArray typedArrayAttr = context.obtainStyledAttributes(attrs, ANDROID_...
java
static String pullFontPathFromTextAppearance(final Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) { return null; } int textAppearanceId = -1; final TypedArray typedArrayAttr = context.obtainStyledAttributes(attrs, ANDROID_...
[ "static", "String", "pullFontPathFromTextAppearance", "(", "final", "Context", "context", ",", "AttributeSet", "attrs", ",", "int", "[", "]", "attributeId", ")", "{", "if", "(", "attributeId", "==", "null", "||", "attrs", "==", "null", ")", "{", "return", "n...
Tries to pull the Font Path from the Text Appearance. @param context Activity Context @param attrs View Attributes @param attributeId if -1 returns null. @return returns null if attribute is not defined or if no TextAppearance is found.
[ "Tries", "to", "pull", "the", "Font", "Path", "from", "the", "Text", "Appearance", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L212-L242
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java
CalligraphyUtils.canCheckForV7Toolbar
static boolean canCheckForV7Toolbar() { if (sToolbarCheck == null) { try { Class.forName("android.support.v7.widget.Toolbar"); sToolbarCheck = Boolean.TRUE; } catch (ClassNotFoundException e) { sToolbarCheck = Boolean.FALSE; } ...
java
static boolean canCheckForV7Toolbar() { if (sToolbarCheck == null) { try { Class.forName("android.support.v7.widget.Toolbar"); sToolbarCheck = Boolean.TRUE; } catch (ClassNotFoundException e) { sToolbarCheck = Boolean.FALSE; } ...
[ "static", "boolean", "canCheckForV7Toolbar", "(", ")", "{", "if", "(", "sToolbarCheck", "==", "null", ")", "{", "try", "{", "Class", ".", "forName", "(", "\"android.support.v7.widget.Toolbar\"", ")", ";", "sToolbarCheck", "=", "Boolean", ".", "TRUE", ";", "}",...
See if the user has added appcompat-v7, this is done at runtime, so we only check once. @return true if the v7.Toolbar is on the classpath
[ "See", "if", "the", "user", "has", "added", "appcompat", "-", "v7", "this", "is", "done", "at", "runtime", "so", "we", "only", "check", "once", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L323-L333
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java
CalligraphyUtils.canAddV7AppCompatViews
static boolean canAddV7AppCompatViews() { if (sAppCompatViewCheck == null) { try { Class.forName("android.support.v7.widget.AppCompatTextView"); sAppCompatViewCheck = Boolean.TRUE; } catch (ClassNotFoundException e) { sAppCompatViewCheck = ...
java
static boolean canAddV7AppCompatViews() { if (sAppCompatViewCheck == null) { try { Class.forName("android.support.v7.widget.AppCompatTextView"); sAppCompatViewCheck = Boolean.TRUE; } catch (ClassNotFoundException e) { sAppCompatViewCheck = ...
[ "static", "boolean", "canAddV7AppCompatViews", "(", ")", "{", "if", "(", "sAppCompatViewCheck", "==", "null", ")", "{", "try", "{", "Class", ".", "forName", "(", "\"android.support.v7.widget.AppCompatTextView\"", ")", ";", "sAppCompatViewCheck", "=", "Boolean", ".",...
See if the user has added appcompat-v7 with AppCompatViews @return true if AppcompatTextView is on the classpath
[ "See", "if", "the", "user", "has", "added", "appcompat", "-", "v7", "with", "AppCompatViews" ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L340-L350
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java
CalligraphyConfig.addAppCompatViews
private static void addAppCompatViews() { DEFAULT_STYLES.put(android.support.v7.widget.AppCompatTextView.class, android.R.attr.textViewStyle); DEFAULT_STYLES.put(android.support.v7.widget.AppCompatButton.class, android.R.attr.buttonStyle); DEFAULT_STYLES.put(android.support.v7.widget.AppCompatEd...
java
private static void addAppCompatViews() { DEFAULT_STYLES.put(android.support.v7.widget.AppCompatTextView.class, android.R.attr.textViewStyle); DEFAULT_STYLES.put(android.support.v7.widget.AppCompatButton.class, android.R.attr.buttonStyle); DEFAULT_STYLES.put(android.support.v7.widget.AppCompatEd...
[ "private", "static", "void", "addAppCompatViews", "(", ")", "{", "DEFAULT_STYLES", ".", "put", "(", "android", ".", "support", ".", "v7", ".", "widget", ".", "AppCompatTextView", ".", "class", ",", "android", ".", "R", ".", "attr", ".", "textViewStyle", ")...
AppCompat will inflate special versions of views for Material tinting etc, this adds those classes to the style lookup map
[ "AppCompat", "will", "inflate", "special", "versions", "of", "views", "for", "Material", "tinting", "etc", "this", "adds", "those", "classes", "to", "the", "style", "lookup", "map" ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java#L53-L62
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyContextWrapper.java
CalligraphyContextWrapper.get
static CalligraphyActivityFactory get(Activity activity) { if (!(activity.getLayoutInflater() instanceof CalligraphyLayoutInflater)) { throw new RuntimeException("This activity does not wrap the Base Context! See CalligraphyContextWrapper.wrap(Context)"); } return (CalligraphyActivit...
java
static CalligraphyActivityFactory get(Activity activity) { if (!(activity.getLayoutInflater() instanceof CalligraphyLayoutInflater)) { throw new RuntimeException("This activity does not wrap the Base Context! See CalligraphyContextWrapper.wrap(Context)"); } return (CalligraphyActivit...
[ "static", "CalligraphyActivityFactory", "get", "(", "Activity", "activity", ")", "{", "if", "(", "!", "(", "activity", ".", "getLayoutInflater", "(", ")", "instanceof", "CalligraphyLayoutInflater", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"This ac...
Get the Calligraphy Activity Fragment Instance to allow callbacks for when views are created. @param activity The activity the original that the ContextWrapper was attached too. @return Interface allowing you to call onActivityViewCreated
[ "Get", "the", "Calligraphy", "Activity", "Fragment", "Instance", "to", "allow", "callbacks", "for", "when", "views", "are", "created", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyContextWrapper.java#L68-L73
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java
CalligraphyFactory.getStyleForTextView
protected static int[] getStyleForTextView(TextView view) { final int[] styleIds = new int[]{-1, -1}; // Try to find the specific actionbar styles if (isActionBarTitle(view)) { styleIds[0] = android.R.attr.actionBarStyle; styleIds[1] = android.R.attr.titleTextStyle; ...
java
protected static int[] getStyleForTextView(TextView view) { final int[] styleIds = new int[]{-1, -1}; // Try to find the specific actionbar styles if (isActionBarTitle(view)) { styleIds[0] = android.R.attr.actionBarStyle; styleIds[1] = android.R.attr.titleTextStyle; ...
[ "protected", "static", "int", "[", "]", "getStyleForTextView", "(", "TextView", "view", ")", "{", "final", "int", "[", "]", "styleIds", "=", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ";", "// Try to find the specific actionbar styles", "if...
Some styles are in sub styles, such as actionBarTextStyle etc.. @param view view to check. @return 2 element array, default to -1 unless a style has been found.
[ "Some", "styles", "are", "in", "sub", "styles", "such", "as", "actionBarTextStyle", "etc", ".." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java#L25-L42
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java
CalligraphyFactory.matchesResourceIdName
protected static boolean matchesResourceIdName(View view, String matches) { if (view.getId() == View.NO_ID) return false; final String resourceEntryName = view.getResources().getResourceEntryName(view.getId()); return resourceEntryName.equalsIgnoreCase(matches); }
java
protected static boolean matchesResourceIdName(View view, String matches) { if (view.getId() == View.NO_ID) return false; final String resourceEntryName = view.getResources().getResourceEntryName(view.getId()); return resourceEntryName.equalsIgnoreCase(matches); }
[ "protected", "static", "boolean", "matchesResourceIdName", "(", "View", "view", ",", "String", "matches", ")", "{", "if", "(", "view", ".", "getId", "(", ")", "==", "View", ".", "NO_ID", ")", "return", "false", ";", "final", "String", "resourceEntryName", ...
Use to match a view against a potential view id. Such as ActionBar title etc. @param view not null view you want to see has resource matching name. @param matches not null resource name to match against. Its not case sensitive. @return true if matches false otherwise.
[ "Use", "to", "match", "a", "view", "against", "a", "potential", "view", "id", ".", "Such", "as", "ActionBar", "title", "etc", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java#L87-L91
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java
CalligraphyFactory.onViewCreated
public View onViewCreated(View view, Context context, AttributeSet attrs) { if (view != null && view.getTag(R.id.calligraphy_tag_id) != Boolean.TRUE) { onViewCreatedInternal(view, context, attrs); view.setTag(R.id.calligraphy_tag_id, Boolean.TRUE); } return view; }
java
public View onViewCreated(View view, Context context, AttributeSet attrs) { if (view != null && view.getTag(R.id.calligraphy_tag_id) != Boolean.TRUE) { onViewCreatedInternal(view, context, attrs); view.setTag(R.id.calligraphy_tag_id, Boolean.TRUE); } return view; }
[ "public", "View", "onViewCreated", "(", "View", "view", ",", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "if", "(", "view", "!=", "null", "&&", "view", ".", "getTag", "(", "R", ".", "id", ".", "calligraphy_tag_id", ")", "!=", "Boolean",...
Handle the created view @param view nullable. @param context shouldn't be null. @param attrs shouldn't be null. @return null if null is passed in.
[ "Handle", "the", "created", "view" ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java#L108-L114
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java
CalligraphyFactory.resolveFontPath
private String resolveFontPath(Context context, AttributeSet attrs) { // Try view xml attributes String textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, mAttributeId); // Try view style attributes if (TextUtils.isEmpty(textViewFont)) { textViewFont = Call...
java
private String resolveFontPath(Context context, AttributeSet attrs) { // Try view xml attributes String textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, mAttributeId); // Try view style attributes if (TextUtils.isEmpty(textViewFont)) { textViewFont = Call...
[ "private", "String", "resolveFontPath", "(", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "// Try view xml attributes", "String", "textViewFont", "=", "CalligraphyUtils", ".", "pullFontPathFromView", "(", "context", ",", "attrs", ",", "mAttributeId", ...
Resolving font path from xml attrs, style attrs or text appearance
[ "Resolving", "font", "path", "from", "xml", "attrs", "style", "attrs", "or", "text", "appearance" ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java#L181-L196
train