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
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
DeletingWhileIterating.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { if ((collectionClass == null) || (iteratorClass == null)) { return; } try { collectionGroups = new ArrayList<>(); groupToIterator = new HashMap<>(); loops = new HashMap<>(10)...
java
@Override public void visitClassContext(ClassContext classContext) { if ((collectionClass == null) || (iteratorClass == null)) { return; } try { collectionGroups = new ArrayList<>(); groupToIterator = new HashMap<>(); loops = new HashMap<>(10)...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "if", "(", "(", "collectionClass", "==", "null", ")", "||", "(", "iteratorClass", "==", "null", ")", ")", "{", "return", ";", "}", "try", "{", "collectio...
implements the visitor to setup the opcode stack, collectionGroups, groupToIterator and loops @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "setup", "the", "opcode", "stack", "collectionGroups", "groupToIterator", "and", "loops" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java#L130-L147
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
DeletingWhileIterating.visitCode
@Override public void visitCode(Code obj) { collectionGroups.clear(); groupToIterator.clear(); loops.clear(); buildVariableEndScopeMap(); super.visitCode(obj); }
java
@Override public void visitCode(Code obj) { collectionGroups.clear(); groupToIterator.clear(); loops.clear(); buildVariableEndScopeMap(); super.visitCode(obj); }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "collectionGroups", ".", "clear", "(", ")", ";", "groupToIterator", ".", "clear", "(", ")", ";", "loops", ".", "clear", "(", ")", ";", "buildVariableEndScopeMap", "(", ")", ";"...
implements the visitor to reset the stack, collectionGroups, groupToIterator and loops @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "reset", "the", "stack", "collectionGroups", "groupToIterator", "and", "loops" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java#L155-L163
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
DeletingWhileIterating.breakFollows
private boolean breakFollows(Loop loop, boolean needsPop) { byte[] code = getCode().getCode(); int nextPC = getNextPC(); if (needsPop) { int popOp = CodeByteUtils.getbyte(code, nextPC++); if (popOp != Const.POP) { return false; } } ...
java
private boolean breakFollows(Loop loop, boolean needsPop) { byte[] code = getCode().getCode(); int nextPC = getNextPC(); if (needsPop) { int popOp = CodeByteUtils.getbyte(code, nextPC++); if (popOp != Const.POP) { return false; } } ...
[ "private", "boolean", "breakFollows", "(", "Loop", "loop", ",", "boolean", "needsPop", ")", "{", "byte", "[", "]", "code", "=", "getCode", "(", ")", ".", "getCode", "(", ")", ";", "int", "nextPC", "=", "getNextPC", "(", ")", ";", "if", "(", "needsPop...
looks to see if the following instruction is a GOTO, preceded by potentially a pop @param loop the loop structure we are checking @param needsPop whether we expect to see a pop next @return whether a GOTO is found
[ "looks", "to", "see", "if", "the", "following", "instruction", "is", "a", "GOTO", "preceded", "by", "potentially", "a", "pop" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java#L346-L367
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
DeletingWhileIterating.getGroupElement
private static Comparable<?> getGroupElement(OpcodeStack.Item itm) { Comparable<?> groupElement = null; int reg = itm.getRegisterNumber(); if (reg >= 0) { groupElement = Integer.valueOf(reg); } else { XField field = itm.getXField(); if (field != null)...
java
private static Comparable<?> getGroupElement(OpcodeStack.Item itm) { Comparable<?> groupElement = null; int reg = itm.getRegisterNumber(); if (reg >= 0) { groupElement = Integer.valueOf(reg); } else { XField field = itm.getXField(); if (field != null)...
[ "private", "static", "Comparable", "<", "?", ">", "getGroupElement", "(", "OpcodeStack", ".", "Item", "itm", ")", "{", "Comparable", "<", "?", ">", "groupElement", "=", "null", ";", "int", "reg", "=", "itm", ".", "getRegisterNumber", "(", ")", ";", "if",...
given an register or field, look to see if this thing is associated with an already discovered loop @param itm the item containing the register or field @return the group element
[ "given", "an", "register", "or", "field", "look", "to", "see", "if", "this", "thing", "is", "associated", "with", "an", "already", "discovered", "loop" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java#L423-L440
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java
SuspiciousUninitializedArray.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); if (m.isSynthetic()) { return; } if (isEnum && "values".equals(m.getName())) { return; } String sig = m.getSignature(); int sigPos = sig.indexOf(")["); if (s...
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if (m.isSynthetic()) { return; } if (isEnum && "values".equals(m.getName())) { return; } String sig = m.getSignature(); int sigPos = sig.indexOf(")["); if (s...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "m", ".", "isSynthetic", "(", ")", ")", "{", "return", ";", "}", "if", "(", "isEnum", "&&", "\"values\"", ".", ...
overrides the visitor to check to see if the method returns an array, and if so resets the stack for this method. @param obj the context object for the currently parsed code block
[ "overrides", "the", "visitor", "to", "check", "to", "see", "if", "the", "method", "returns", "an", "array", "and", "if", "so", "resets", "the", "stack", "for", "this", "method", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java#L114-L148
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java
NonProductiveMethodCall.sawOpcode
@Override public void sawOpcode(int seen) { String methodInfo = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKEVIRTUAL: case Const.INVOKEINTERFACE: case Const.INVOKESTATIC: String s...
java
@Override public void sawOpcode(int seen) { String methodInfo = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKEVIRTUAL: case Const.INVOKEINTERFACE: case Const.INVOKESTATIC: String s...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "String", "methodInfo", "=", "null", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".", "INVOKEVIR...
implements the visitor to look for return values of common immutable method calls, that are thrown away. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "return", "values", "of", "common", "immutable", "method", "calls", "that", "are", "thrown", "away", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java#L104-L147
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java
CharsetIssues.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { classVersion = classContext.getJavaClass().getMajor(); if (classVersion >= Const.MAJOR_1_4) { stack = new OpcodeStack(); super.visitClassContext(classContext); } ...
java
@Override public void visitClassContext(ClassContext classContext) { try { classVersion = classContext.getJavaClass().getMajor(); if (classVersion >= Const.MAJOR_1_4) { stack = new OpcodeStack(); super.visitClassContext(classContext); } ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "classVersion", "=", "classContext", ".", "getJavaClass", "(", ")", ".", "getMajor", "(", ")", ";", "if", "(", "classVersion", ">=", "Const", "...
implements the visitor to make sure the class is at least 1.4, and if so continues, reseting the opcode stack @param classContext the currently parsed java class
[ "implements", "the", "visitor", "to", "make", "sure", "the", "class", "is", "at", "least", "1", ".", "4", "and", "if", "so", "continues", "reseting", "the", "opcode", "stack" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java#L177-L188
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java
CharsetIssues.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); switch (seen) { case Const.INVOKESPECIAL: case Const.INVOKESTATIC: case Const.INVOKEINTERFACE: case Const.INVOKEVIRTUAL: ...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); switch (seen) { case Const.INVOKESPECIAL: case Const.INVOKESTATIC: case Const.INVOKEINTERFACE: case Const.INVOKEVIRTUAL: ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".", "INVOKESPECIAL", ":", "case", "Const", ".", "INVOKES...
implements the visitor to look for method calls that take a parameter that either represents a encoding via a string, or takes a Charset. If the method can take both, and a string is presented for a standard charset available in jdk 7, and the code is compiled against 7, then report. It also looks for mistakes, encodin...
[ "implements", "the", "visitor", "to", "look", "for", "method", "calls", "that", "take", "a", "parameter", "that", "either", "represents", "a", "encoding", "via", "a", "string", "or", "takes", "a", "Charset", ".", "If", "the", "method", "can", "take", "both...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java#L209-L279
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java
CharsetIssues.replaceNthArgWithCharsetString
private static String replaceNthArgWithCharsetString(String sig, int stackOffset) { List<String> arguments = SignatureUtils.getParameterSignatures(sig); StringBuilder sb = new StringBuilder("("); int argumentIndexToReplace = (arguments.size() - stackOffset) - 1; for (int i = 0; i < ar...
java
private static String replaceNthArgWithCharsetString(String sig, int stackOffset) { List<String> arguments = SignatureUtils.getParameterSignatures(sig); StringBuilder sb = new StringBuilder("("); int argumentIndexToReplace = (arguments.size() - stackOffset) - 1; for (int i = 0; i < ar...
[ "private", "static", "String", "replaceNthArgWithCharsetString", "(", "String", "sig", ",", "int", "stackOffset", ")", "{", "List", "<", "String", ">", "arguments", "=", "SignatureUtils", ".", "getParameterSignatures", "(", "sig", ")", ";", "StringBuilder", "sb", ...
rebuilds a signature replacing a String argument at a specified spot, with a Charset parameter. @param sig the signature to replace @param stackOffset the offset of the parameter to replace @return a new signature with a Charset parameter
[ "rebuilds", "a", "signature", "replacing", "a", "String", "argument", "at", "a", "specified", "spot", "with", "a", "Charset", "parameter", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java#L291-L308
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java
CharsetIssues.getUnreplaceableCharsetEncodings
@PublicAPI("Used by fb-contrib-eclipse-quickfixes to determine type of fix to apply") public static Map<String, Integer> getUnreplaceableCharsetEncodings() { Map<String, Integer> encodings = new HashMap<>((int) (UNREPLACEABLE_ENCODING_METHODS.size() * 1.6)); for (Map.Entry<FQMethod, Integer> entry :...
java
@PublicAPI("Used by fb-contrib-eclipse-quickfixes to determine type of fix to apply") public static Map<String, Integer> getUnreplaceableCharsetEncodings() { Map<String, Integer> encodings = new HashMap<>((int) (UNREPLACEABLE_ENCODING_METHODS.size() * 1.6)); for (Map.Entry<FQMethod, Integer> entry :...
[ "@", "PublicAPI", "(", "\"Used by fb-contrib-eclipse-quickfixes to determine type of fix to apply\"", ")", "public", "static", "Map", "<", "String", ",", "Integer", ">", "getUnreplaceableCharsetEncodings", "(", ")", "{", "Map", "<", "String", ",", "Integer", ">", "encod...
used by external tools, lists the method signature checked for, for unreplaceable encoding methods @return a map of these methods
[ "used", "by", "external", "tools", "lists", "the", "method", "signature", "checked", "for", "for", "unreplaceable", "encoding", "methods" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java#L315-L322
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java
CharsetIssues.getReplaceableCharsetEncodings
@PublicAPI("Used by fb-contrib-eclipse-quickfixes to determine type of fix to apply") public static Map<String, Integer> getReplaceableCharsetEncodings() { Map<String, Integer> encodings = new HashMap<>((int) (REPLACEABLE_ENCODING_METHODS.size() * 1.6)); for (Map.Entry<FQMethod, Integer> entry : REP...
java
@PublicAPI("Used by fb-contrib-eclipse-quickfixes to determine type of fix to apply") public static Map<String, Integer> getReplaceableCharsetEncodings() { Map<String, Integer> encodings = new HashMap<>((int) (REPLACEABLE_ENCODING_METHODS.size() * 1.6)); for (Map.Entry<FQMethod, Integer> entry : REP...
[ "@", "PublicAPI", "(", "\"Used by fb-contrib-eclipse-quickfixes to determine type of fix to apply\"", ")", "public", "static", "Map", "<", "String", ",", "Integer", ">", "getReplaceableCharsetEncodings", "(", ")", "{", "Map", "<", "String", ",", "Integer", ">", "encodin...
used by external tools, lists the method signature checked for, for replaceable encoding methods @return a map of these methods
[ "used", "by", "external", "tools", "lists", "the", "method", "signature", "checked", "for", "for", "replaceable", "encoding", "methods" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java#L329-L336
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Unjitable.java
Unjitable.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); if ((!m.isStatic() || !Values.STATIC_INITIALIZER.equals(m.getName())) && (!m.getName().contains("enum constant"))) { // a findbugs thing!! byte[] code = obj.getCode(); if (code.length >= UNJITABLE_CODE_LENGT...
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if ((!m.isStatic() || !Values.STATIC_INITIALIZER.equals(m.getName())) && (!m.getName().contains("enum constant"))) { // a findbugs thing!! byte[] code = obj.getCode(); if (code.length >= UNJITABLE_CODE_LENGT...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "(", "!", "m", ".", "isStatic", "(", ")", "||", "!", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "...
implements the visitor to look at the size of the method. static initializer are ignored as these will only be executed once anyway. @param obj the context object of the currently parsed method
[ "implements", "the", "visitor", "to", "look", "at", "the", "size", "of", "the", "method", ".", "static", "initializer", "are", "ignored", "as", "these", "will", "only", "be", "executed", "once", "anyway", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Unjitable.java#L65-L76
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java
ArrayWrappedCallByReference.prescreen
public boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.NEWARRAY) || bytecodeSet.get(Const.ANEWARRAY)); }
java
public boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.NEWARRAY) || bytecodeSet.get(Const.ANEWARRAY)); }
[ "public", "boolean", "prescreen", "(", "Method", "method", ")", "{", "BitSet", "bytecodeSet", "=", "getClassContext", "(", ")", ".", "getBytecodeSet", "(", "method", ")", ";", "return", "(", "bytecodeSet", "!=", "null", ")", "&&", "(", "bytecodeSet", ".", ...
looks for methods that contain a NEWARRAY or ANEWARRAY opcodes @param method the context object of the current method @return if the class uses synchronization
[ "looks", "for", "methods", "that", "contain", "a", "NEWARRAY", "or", "ANEWARRAY", "opcodes" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java#L92-L95
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java
ArrayWrappedCallByReference.processLocalStore
private void processLocalStore(int seen) { if (stack.getStackDepth() == 0) { return; } OpcodeStack.Item itm = stack.getStackItem(0); String sig = itm.getSignature(); if (sig.startsWith(Values.SIG_ARRAY_PREFIX)) { int reg = RegisterUtils.getAStoreReg(this, ...
java
private void processLocalStore(int seen) { if (stack.getStackDepth() == 0) { return; } OpcodeStack.Item itm = stack.getStackItem(0); String sig = itm.getSignature(); if (sig.startsWith(Values.SIG_ARRAY_PREFIX)) { int reg = RegisterUtils.getAStoreReg(this, ...
[ "private", "void", "processLocalStore", "(", "int", "seen", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", "==", "0", ")", "{", "return", ";", "}", "OpcodeStack", ".", "Item", "itm", "=", "stack", ".", "getStackItem", "(", "0", ")", ";...
looks for stores to registers, if that store is an array, builds a wrapper info for it and stores it in the wrappers collection. If it is a regular store, sees if this value, came from a wrapper array passed into a method, and if so reports it. @param seen the currently parsed opcode
[ "looks", "for", "stores", "to", "registers", "if", "that", "store", "is", "an", "array", "builds", "a", "wrapper", "info", "for", "it", "and", "stores", "it", "in", "the", "wrappers", "collection", ".", "If", "it", "is", "a", "regular", "store", "sees", ...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java#L255-L274
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java
ArrayWrappedCallByReference.processArrayElementStore
@Nullable private Integer processArrayElementStore() { if (stack.getStackDepth() >= 2) { OpcodeStack.Item itm = stack.getStackItem(2); int reg = itm.getRegisterNumber(); if (reg != -1) { WrapperInfo wi = wrappers.get(Integer.valueOf(reg)); ...
java
@Nullable private Integer processArrayElementStore() { if (stack.getStackDepth() >= 2) { OpcodeStack.Item itm = stack.getStackItem(2); int reg = itm.getRegisterNumber(); if (reg != -1) { WrapperInfo wi = wrappers.get(Integer.valueOf(reg)); ...
[ "@", "Nullable", "private", "Integer", "processArrayElementStore", "(", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", ">=", "2", ")", "{", "OpcodeStack", ".", "Item", "itm", "=", "stack", ".", "getStackItem", "(", "2", ")", ";", "int", ...
processes a store to an array element to see if this array is being used as a wrapper array, and if so records the register that is stored within it. @return the user value representing the stored register value
[ "processes", "a", "store", "to", "an", "array", "element", "to", "see", "if", "this", "array", "is", "being", "used", "as", "a", "wrapper", "array", "and", "if", "so", "records", "the", "register", "that", "is", "stored", "within", "it", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java#L281-L302
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java
ArrayWrappedCallByReference.processMethodCall
private void processMethodCall() { if ("invoke".equals(getNameConstantOperand()) && "java/lang/reflect/Method".equals(getClassConstantOperand())) { return; } String sig = getSigConstantOperand(); List<String> args = SignatureUtils.getParameterSignatures(sig); if (stac...
java
private void processMethodCall() { if ("invoke".equals(getNameConstantOperand()) && "java/lang/reflect/Method".equals(getClassConstantOperand())) { return; } String sig = getSigConstantOperand(); List<String> args = SignatureUtils.getParameterSignatures(sig); if (stac...
[ "private", "void", "processMethodCall", "(", ")", "{", "if", "(", "\"invoke\"", ".", "equals", "(", "getNameConstantOperand", "(", ")", ")", "&&", "\"java/lang/reflect/Method\"", ".", "equals", "(", "getClassConstantOperand", "(", ")", ")", ")", "{", "return", ...
processes a method call looking for parameters that are arrays. If this array was seen earlier as a simple wrapping array, then it marks it as being having been used as a parameter.
[ "processes", "a", "method", "call", "looking", "for", "parameters", "that", "are", "arrays", ".", "If", "this", "array", "was", "seen", "earlier", "as", "a", "simple", "wrapping", "array", "then", "it", "marks", "it", "as", "being", "having", "been", "used...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java#L309-L328
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java
OverlyPermissiveMethod.isCallingOnThis
private boolean isCallingOnThis(String sig) { if (getMethod().isStatic()) { return false; } int numParameters = SignatureUtils.getNumParameters(sig); if (stack.getStackDepth() <= numParameters) { return false; } OpcodeStack.Item item = stack.getS...
java
private boolean isCallingOnThis(String sig) { if (getMethod().isStatic()) { return false; } int numParameters = SignatureUtils.getNumParameters(sig); if (stack.getStackDepth() <= numParameters) { return false; } OpcodeStack.Item item = stack.getS...
[ "private", "boolean", "isCallingOnThis", "(", "String", "sig", ")", "{", "if", "(", "getMethod", "(", ")", ".", "isStatic", "(", ")", ")", "{", "return", "false", ";", "}", "int", "numParameters", "=", "SignatureUtils", ".", "getNumParameters", "(", "sig",...
checks to see if an instance method is called on the 'this' object @param sig the signature of the method called to find the called-on object @return when it is called on this or not
[ "checks", "to", "see", "if", "an", "instance", "method", "is", "called", "on", "the", "this", "object" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java#L241-L253
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java
OverlyPermissiveMethod.report
@Override public void report() { for (Map.Entry<FQMethod, MethodInfo> entry : Statistics.getStatistics()) { MethodInfo mi = entry.getValue(); int declaredAccess = mi.getDeclaredAccess(); if ((declaredAccess & Const.ACC_PRIVATE) != 0) { continue; ...
java
@Override public void report() { for (Map.Entry<FQMethod, MethodInfo> entry : Statistics.getStatistics()) { MethodInfo mi = entry.getValue(); int declaredAccess = mi.getDeclaredAccess(); if ((declaredAccess & Const.ACC_PRIVATE) != 0) { continue; ...
[ "@", "Override", "public", "void", "report", "(", ")", "{", "for", "(", "Map", ".", "Entry", "<", "FQMethod", ",", "MethodInfo", ">", "entry", ":", "Statistics", ".", "getStatistics", "(", ")", ")", "{", "MethodInfo", "mi", "=", "entry", ".", "getValue...
after collecting all method calls, build a report of all methods that have been called, but in a way that is less permissive then is defined.
[ "after", "collecting", "all", "method", "calls", "build", "a", "report", "of", "all", "methods", "that", "have", "been", "called", "but", "in", "a", "way", "that", "is", "less", "permissive", "then", "is", "defined", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java#L258-L298
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java
OverlyPermissiveMethod.isConstrainedByInterface
private boolean isConstrainedByInterface(FQMethod fqMethod) { try { JavaClass fqCls = Repository.lookupClass(fqMethod.getClassName()); if (fqCls.isInterface()) { return true; } for (JavaClass inf : fqCls.getAllInterfaces()) { for ...
java
private boolean isConstrainedByInterface(FQMethod fqMethod) { try { JavaClass fqCls = Repository.lookupClass(fqMethod.getClassName()); if (fqCls.isInterface()) { return true; } for (JavaClass inf : fqCls.getAllInterfaces()) { for ...
[ "private", "boolean", "isConstrainedByInterface", "(", "FQMethod", "fqMethod", ")", "{", "try", "{", "JavaClass", "fqCls", "=", "Repository", ".", "lookupClass", "(", "fqMethod", ".", "getClassName", "(", ")", ")", ";", "if", "(", "fqCls", ".", "isInterface", ...
looks to see if this method is an implementation of a method in an interface, including generic specified interface methods. @param fqMethod the method to check @return if this method is constrained by an interface method
[ "looks", "to", "see", "if", "this", "method", "is", "an", "implementation", "of", "a", "method", "in", "an", "interface", "including", "generic", "specified", "interface", "methods", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java#L311-L364
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java
OverlyPermissiveMethod.isDerived
private boolean isDerived(JavaClass fqCls, FQMethod key) { try { for (JavaClass infCls : fqCls.getInterfaces()) { for (Method infMethod : infCls.getMethods()) { if (key.getMethodName().equals(infMethod.getName())) { if (infMethod.getGeneric...
java
private boolean isDerived(JavaClass fqCls, FQMethod key) { try { for (JavaClass infCls : fqCls.getInterfaces()) { for (Method infMethod : infCls.getMethods()) { if (key.getMethodName().equals(infMethod.getName())) { if (infMethod.getGeneric...
[ "private", "boolean", "isDerived", "(", "JavaClass", "fqCls", ",", "FQMethod", "key", ")", "{", "try", "{", "for", "(", "JavaClass", "infCls", ":", "fqCls", ".", "getInterfaces", "(", ")", ")", "{", "for", "(", "Method", "infMethod", ":", "infCls", ".", ...
looks to see if this method described by key is derived from a superclass or interface @param fqCls the class that the method is defined in @param key the information about the method @return whether this method derives from something or not
[ "looks", "to", "see", "if", "this", "method", "described", "by", "key", "is", "derived", "from", "a", "superclass", "or", "interface" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java#L375-L413
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/MissingMethodsDetector.java
MissingMethodsDetector.visitCode
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); localSpecialObjects.clear(); sawTernary = false; super.visitCode(obj); for (Integer pc : localSpecialObjects.values()) { bugReporter.reportBug( makeLocalBugInstance(...
java
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); localSpecialObjects.clear(); sawTernary = false; super.visitCode(obj); for (Integer pc : localSpecialObjects.values()) { bugReporter.reportBug( makeLocalBugInstance(...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "localSpecialObjects", ".", "clear", "(", ")", ";", "sawTernary", "=", "false", ";", "super", ".", "visitCode", "(", ...
overrides the visitor reset the stack @param obj the context object of the currently parsed code block
[ "overrides", "the", "visitor", "reset", "the", "stack" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/MissingMethodsDetector.java#L114-L126
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/MissingMethodsDetector.java
MissingMethodsDetector.processMethodParms
protected void processMethodParms() { String sig = getSigConstantOperand(); int numParms = SignatureUtils.getNumParameters(sig); if ((numParms > 0) && (stack.getStackDepth() >= numParms)) { for (int i = 0; i < numParms; i++) { clearUserValue(stack.getStackItem(i)); ...
java
protected void processMethodParms() { String sig = getSigConstantOperand(); int numParms = SignatureUtils.getNumParameters(sig); if ((numParms > 0) && (stack.getStackDepth() >= numParms)) { for (int i = 0; i < numParms; i++) { clearUserValue(stack.getStackItem(i)); ...
[ "protected", "void", "processMethodParms", "(", ")", "{", "String", "sig", "=", "getSigConstantOperand", "(", ")", ";", "int", "numParms", "=", "SignatureUtils", ".", "getNumParameters", "(", "sig", ")", ";", "if", "(", "(", "numParms", ">", "0", ")", "&&"...
Checks to see if any of the locals or fields that we are tracking are passed into another method. If they are, we clear out our tracking of them, because we can't easily track their progress into the method. This can be overridden to check for exceptions to this rule, for example, being logged to the console not count...
[ "Checks", "to", "see", "if", "any", "of", "the", "locals", "or", "fields", "that", "we", "are", "tracking", "are", "passed", "into", "another", "method", ".", "If", "they", "are", "we", "clear", "out", "our", "tracking", "of", "them", "because", "we", ...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/MissingMethodsDetector.java#L403-L412
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java
SluggishGui.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { guiInterfaces = new HashSet<>(); JavaClass cls = classContext.getJavaClass(); JavaClass[] infs = cls.getAllInterfaces(); for (JavaClass inf : infs) { String name = inf.g...
java
@Override public void visitClassContext(ClassContext classContext) { try { guiInterfaces = new HashSet<>(); JavaClass cls = classContext.getJavaClass(); JavaClass[] infs = cls.getAllInterfaces(); for (JavaClass inf : infs) { String name = inf.g...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "guiInterfaces", "=", "new", "HashSet", "<>", "(", ")", ";", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "Java...
overrides the visitor to reset look for gui interfaces @param classContext the context object for the currently parsed class
[ "overrides", "the", "visitor", "to", "reset", "look", "for", "gui", "interfaces" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java#L81-L106
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java
SluggishGui.visitAfter
@Override public void visitAfter(JavaClass obj) { isListenerMethod = true; for (Code l : listenerCode.keySet()) { try { super.visitCode(l); } catch (StopOpcodeParsingException e) { // method already reported } } supe...
java
@Override public void visitAfter(JavaClass obj) { isListenerMethod = true; for (Code l : listenerCode.keySet()) { try { super.visitCode(l); } catch (StopOpcodeParsingException e) { // method already reported } } supe...
[ "@", "Override", "public", "void", "visitAfter", "(", "JavaClass", "obj", ")", "{", "isListenerMethod", "=", "true", ";", "for", "(", "Code", "l", ":", "listenerCode", ".", "keySet", "(", ")", ")", "{", "try", "{", "super", ".", "visitCode", "(", "l", ...
overrides the visitor to visit all of the collected listener methods @param obj the context object of the currently parsed class
[ "overrides", "the", "visitor", "to", "visit", "all", "of", "the", "collected", "listener", "methods" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java#L114-L125
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java
SluggishGui.visitMethod
@Override public void visitMethod(Method obj) { methodName = obj.getName(); methodSig = obj.getSignature(); }
java
@Override public void visitMethod(Method obj) { methodName = obj.getName(); methodSig = obj.getSignature(); }
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "methodName", "=", "obj", ".", "getName", "(", ")", ";", "methodSig", "=", "obj", ".", "getSignature", "(", ")", ";", "}" ]
overrides the visitor collect method info @param obj the context object of the currently parsed method
[ "overrides", "the", "visitor", "collect", "method", "info" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java#L133-L137
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java
SluggishGui.visitCode
@Override public void visitCode(Code obj) { try { for (JavaClass inf : guiInterfaces) { Method[] methods = inf.getMethods(); for (Method m : methods) { if (m.getName().equals(methodName) && m.getSignature().equals(methodSig)) { ...
java
@Override public void visitCode(Code obj) { try { for (JavaClass inf : guiInterfaces) { Method[] methods = inf.getMethods(); for (Method m : methods) { if (m.getName().equals(methodName) && m.getSignature().equals(methodSig)) { ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "for", "(", "JavaClass", "inf", ":", "guiInterfaces", ")", "{", "Method", "[", "]", "methods", "=", "inf", ".", "getMethods", "(", ")", ";", "for", "(", "Method...
overrides the visitor to segregate method into two, those that implement listeners, and those that don't. The ones that don't are processed first. @param obj the context object of the currently parsed code block
[ "overrides", "the", "visitor", "to", "segregate", "method", "into", "two", "those", "that", "implement", "listeners", "and", "those", "that", "don", "t", ".", "The", "ones", "that", "don", "t", "are", "processed", "first", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java#L145-L162
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java
SluggishGui.sawOpcode
@Override public void sawOpcode(int seen) { if ((seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKESPECIAL) || (seen == Const.INVOKESTATIC)) { String clsName = getClassConstantOperand(); String mName = getNameConstantOperand(); Strin...
java
@Override public void sawOpcode(int seen) { if ((seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKESPECIAL) || (seen == Const.INVOKESTATIC)) { String clsName = getClassConstantOperand(); String mName = getNameConstantOperand(); Strin...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "INVOKEINTERFACE", ")", "||", "(", "seen", "==", "Const", ".", "INVOKEVIRTUAL", ")", "||", "(", "seen", "==", "Const", ".", "INV...
overrides the visitor to look for the execution of expensive calls @param seen the currently parsed opcode
[ "overrides", "the", "visitor", "to", "look", "for", "the", "execution", "of", "expensive", "calls" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java#L170-L189
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/debug/Debug.java
Debug.println
public static void println(int pc, Object obj) { out.printf("[PC:%d] %s%n", Integer.valueOf(pc), obj); }
java
public static void println(int pc, Object obj) { out.printf("[PC:%d] %s%n", Integer.valueOf(pc), obj); }
[ "public", "static", "void", "println", "(", "int", "pc", ",", "Object", "obj", ")", "{", "out", ".", "printf", "(", "\"[PC:%d] %s%n\"", ",", "Integer", ".", "valueOf", "(", "pc", ")", ",", "obj", ")", ";", "}" ]
Like println, but will print PC, if it's passed in e.g. Debug.println(getPC(), "Hello world"); will print [PC:42] Hello world @param pc the program counter @param obj the object to output
[ "Like", "println", "but", "will", "print", "PC", "if", "it", "s", "passed", "in" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/debug/Debug.java#L67-L69
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/AttributesUtils.java
AttributesUtils.isValidLineNumber
public static boolean isValidLineNumber(Code obj, int pc) { LineNumberTable lnt = obj.getLineNumberTable(); if (lnt == null) return true; LineNumber[] lineNumbers = lnt.getLineNumberTable(); if (lineNumbers == null) return true; int lo = 0; int h...
java
public static boolean isValidLineNumber(Code obj, int pc) { LineNumberTable lnt = obj.getLineNumberTable(); if (lnt == null) return true; LineNumber[] lineNumbers = lnt.getLineNumberTable(); if (lineNumbers == null) return true; int lo = 0; int h...
[ "public", "static", "boolean", "isValidLineNumber", "(", "Code", "obj", ",", "int", "pc", ")", "{", "LineNumberTable", "lnt", "=", "obj", ".", "getLineNumberTable", "(", ")", ";", "if", "(", "lnt", "==", "null", ")", "return", "true", ";", "LineNumber", ...
returns whether the pc is at a line number that also appears for a another byte code offset later on in the method. If this occurs we are in a jdk6 finally replicated block, and so don't report this. If the code has no line number table, then just report it. @param obj the code object to find line number attributes fr...
[ "returns", "whether", "the", "pc", "is", "at", "a", "line", "number", "that", "also", "appears", "for", "a", "another", "byte", "code", "offset", "later", "on", "in", "the", "method", ".", "If", "this", "occurs", "we", "are", "in", "a", "jdk6", "finall...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/AttributesUtils.java#L43-L75
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java
NeedlessMemberCollectionSynchronization.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { if ((collectionClass != null) && (mapClass != null)) { collectionFields = new HashMap<>(); aliases = new HashMap<>(); stack = new OpcodeStack(); JavaClass cl...
java
@Override public void visitClassContext(ClassContext classContext) { try { if ((collectionClass != null) && (mapClass != null)) { collectionFields = new HashMap<>(); aliases = new HashMap<>(); stack = new OpcodeStack(); JavaClass cl...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "if", "(", "(", "collectionClass", "!=", "null", ")", "&&", "(", "mapClass", "!=", "null", ")", ")", "{", "collectionFields", "=", "new", "Ha...
implements the visitor to clear the collectionFields and stack and to report collections that remain unmodified out of clinit or init @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "clear", "the", "collectionFields", "and", "stack", "and", "to", "report", "collections", "that", "remain", "unmodified", "out", "of", "clinit", "or", "init" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java#L106-L128
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java
NeedlessMemberCollectionSynchronization.visitField
@Override public void visitField(Field obj) { if (obj.isPrivate()) { String signature = obj.getSignature(); if (signature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { try { JavaClass cls = Repository.lookupClass(SignatureUtils.stripSignature(si...
java
@Override public void visitField(Field obj) { if (obj.isPrivate()) { String signature = obj.getSignature(); if (signature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { try { JavaClass cls = Repository.lookupClass(SignatureUtils.stripSignature(si...
[ "@", "Override", "public", "void", "visitField", "(", "Field", "obj", ")", "{", "if", "(", "obj", ".", "isPrivate", "(", ")", ")", "{", "String", "signature", "=", "obj", ".", "getSignature", "(", ")", ";", "if", "(", "signature", ".", "startsWith", ...
implements the visitor to find collection fields @param obj the context object of the currently parse field
[ "implements", "the", "visitor", "to", "find", "collection", "fields" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java#L136-L152
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java
NeedlessMemberCollectionSynchronization.visitCode
@Override public void visitCode(Code obj) { if (collectionFields.isEmpty()) { return; } aliases.clear(); String methodName = getMethodName(); if (Values.STATIC_INITIALIZER.equals(methodName)) { state = State.IN_CLINIT; } else if (Values.CONSTRU...
java
@Override public void visitCode(Code obj) { if (collectionFields.isEmpty()) { return; } aliases.clear(); String methodName = getMethodName(); if (Values.STATIC_INITIALIZER.equals(methodName)) { state = State.IN_CLINIT; } else if (Values.CONSTRU...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "collectionFields", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "aliases", ".", "clear", "(", ")", ";", "String", "methodName", "=", "getMethodName", "...
implements the visitor to set the state based on the type of method being parsed @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "set", "the", "state", "based", "on", "the", "type", "of", "method", "being", "parsed" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java#L160-L176
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java
NeedlessMemberCollectionSynchronization.sawOpcode
@Override public void sawOpcode(int seen) { switch (state) { case IN_CLINIT: sawCLInitOpcode(seen); break; case IN_INIT: sawInitOpcode(seen); break; case IN_METHOD: sawMethodOpcode(seen); ...
java
@Override public void sawOpcode(int seen) { switch (state) { case IN_CLINIT: sawCLInitOpcode(seen); break; case IN_INIT: sawInitOpcode(seen); break; case IN_METHOD: sawMethodOpcode(seen); ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "switch", "(", "state", ")", "{", "case", "IN_CLINIT", ":", "sawCLInitOpcode", "(", "seen", ")", ";", "break", ";", "case", "IN_INIT", ":", "sawInitOpcode", "(", "seen", ")", ...
implements the visitor to call the approriate visitor based on state @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "call", "the", "approriate", "visitor", "based", "on", "state" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java#L184-L199
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java
NeedlessMemberCollectionSynchronization.sawMethodOpcode
private void sawMethodOpcode(int seen) { boolean isSyncCollection = false; try { stack.mergeJumps(this); isSyncCollection = isSyncCollectionCreation(seen); switch (seen) { case Const.INVOKEVIRTUAL: case Const.INVOKEINTERFACE: ...
java
private void sawMethodOpcode(int seen) { boolean isSyncCollection = false; try { stack.mergeJumps(this); isSyncCollection = isSyncCollectionCreation(seen); switch (seen) { case Const.INVOKEVIRTUAL: case Const.INVOKEINTERFACE: ...
[ "private", "void", "sawMethodOpcode", "(", "int", "seen", ")", "{", "boolean", "isSyncCollection", "=", "false", ";", "try", "{", "stack", ".", "mergeJumps", "(", "this", ")", ";", "isSyncCollection", "=", "isSyncCollectionCreation", "(", "seen", ")", ";", "...
handles regular methods by looking for methods on collections that are modifying and removes those collections from the ones under review @param seen the opcode of the currently parsed instruction
[ "handles", "regular", "methods", "by", "looking", "for", "methods", "on", "collections", "that", "are", "modifying", "and", "removes", "those", "collections", "from", "the", "ones", "under", "review" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java#L255-L332
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java
NeedlessMemberCollectionSynchronization.isSyncCollectionCreation
private boolean isSyncCollectionCreation(int seen) { if (seen == Const.INVOKESPECIAL) { if (Values.CONSTRUCTOR.equals(getNameConstantOperand())) { return (syncCollections.contains(getClassConstantOperand())); } } else if ((seen == Const.INVOKESTATIC) && "java/util...
java
private boolean isSyncCollectionCreation(int seen) { if (seen == Const.INVOKESPECIAL) { if (Values.CONSTRUCTOR.equals(getNameConstantOperand())) { return (syncCollections.contains(getClassConstantOperand())); } } else if ((seen == Const.INVOKESTATIC) && "java/util...
[ "private", "boolean", "isSyncCollectionCreation", "(", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "INVOKESPECIAL", ")", "{", "if", "(", "Values", ".", "CONSTRUCTOR", ".", "equals", "(", "getNameConstantOperand", "(", ")", ")", ")", "{"...
returns whether this instruction is creating a synchronized collection @param seen the opcode of the currently parsed instruction @return whether a synchronized collection has just been created
[ "returns", "whether", "this", "instruction", "is", "creating", "a", "synchronized", "collection" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java#L341-L351
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java
NeedlessMemberCollectionSynchronization.processCollectionStore
private void processCollectionStore() { String fieldClassName = getDottedClassConstantOperand(); if (fieldClassName.equals(className) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); if (item.getUserValue() != null) { String fieldNa...
java
private void processCollectionStore() { String fieldClassName = getDottedClassConstantOperand(); if (fieldClassName.equals(className) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); if (item.getUserValue() != null) { String fieldNa...
[ "private", "void", "processCollectionStore", "(", ")", "{", "String", "fieldClassName", "=", "getDottedClassConstantOperand", "(", ")", ";", "if", "(", "fieldClassName", ".", "equals", "(", "className", ")", "&&", "(", "stack", ".", "getStackDepth", "(", ")", ...
sets the source line annotation of a store to a collection if that collection is synchronized.
[ "sets", "the", "source", "line", "annotation", "of", "a", "store", "to", "a", "collection", "if", "that", "collection", "is", "synchronized", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java#L356-L371
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java
NeedlessMemberCollectionSynchronization.removeCollectionParameters
private void removeCollectionParameters() { int parmCount = SignatureUtils.getNumParameters(getSigConstantOperand()); if (stack.getStackDepth() >= parmCount) { for (int i = 0; i < parmCount; i++) { OpcodeStack.Item item = stack.getStackItem(i); XField field = ...
java
private void removeCollectionParameters() { int parmCount = SignatureUtils.getNumParameters(getSigConstantOperand()); if (stack.getStackDepth() >= parmCount) { for (int i = 0; i < parmCount; i++) { OpcodeStack.Item item = stack.getStackItem(i); XField field = ...
[ "private", "void", "removeCollectionParameters", "(", ")", "{", "int", "parmCount", "=", "SignatureUtils", ".", "getNumParameters", "(", "getSigConstantOperand", "(", ")", ")", ";", "if", "(", "stack", ".", "getStackDepth", "(", ")", ">=", "parmCount", ")", "{...
removes collection fields that are passed to other methods as arguments
[ "removes", "collection", "fields", "that", "are", "passed", "to", "other", "methods", "as", "arguments" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java#L376-L387
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java
PossibleMemoryBloat.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { bloatableCandidates = new HashMap<>(); bloatableFields = new HashMap<>(); threadLocalNonStaticFields = new HashSet<>(); userValues = new HashMap<>(); jaxbContextRegs = new H...
java
@Override public void visitClassContext(ClassContext classContext) { try { bloatableCandidates = new HashMap<>(); bloatableFields = new HashMap<>(); threadLocalNonStaticFields = new HashSet<>(); userValues = new HashMap<>(); jaxbContextRegs = new H...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "bloatableCandidates", "=", "new", "HashMap", "<>", "(", ")", ";", "bloatableFields", "=", "new", "HashMap", "<>", "(", ")", ";", "threadLocalNon...
collects static fields that are likely bloatable objects and if found allows the visitor to proceed, at the end report all leftover fields @param classContext the class context object of the currently parsed java class
[ "collects", "static", "fields", "that", "are", "likely", "bloatable", "objects", "and", "if", "found", "allows", "the", "visitor", "to", "proceed", "at", "the", "end", "report", "all", "leftover", "fields" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java#L106-L130
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuboptimalExpressionOrder.java
SuboptimalExpressionOrder.visitClassContext
@Override public void visitClassContext(ClassContext clsContext) { try { stack = new OpcodeStack(); super.visitClassContext(clsContext); } finally { stack = null; } }
java
@Override public void visitClassContext(ClassContext clsContext) { try { stack = new OpcodeStack(); super.visitClassContext(clsContext); } finally { stack = null; } }
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "clsContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "super", ".", "visitClassContext", "(", "clsContext", ")", ";", "}", "finally", "{", "stack", ...
overrides the visitor to setup the opcode stack @param clsContext the context object of the currently parse class
[ "overrides", "the", "visitor", "to", "setup", "the", "opcode", "stack" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuboptimalExpressionOrder.java#L68-L76
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuboptimalExpressionOrder.java
SuboptimalExpressionOrder.visitCode
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); conditionalTarget = -1; sawMethodWeight = 0; super.visitCode(obj); }
java
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); conditionalTarget = -1; sawMethodWeight = 0; super.visitCode(obj); }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "conditionalTarget", "=", "-", "1", ";", "sawMethodWeight", "=", "0", ";", "super", ".", "visitCode", "(", "obj", ")...
overrides the visitor to reset the opcode stack, and initialize vars @param obj the code object of the currently parsed method
[ "overrides", "the", "visitor", "to", "reset", "the", "opcode", "stack", "and", "initialize", "vars" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuboptimalExpressionOrder.java#L84-L90
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java
PossibleIncompleteSerialization.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (isSerializable(cls)) { JavaClass superCls = cls.getSuperClass(); if (!isSerializable(superCls) && hasSerializableFields(superCls...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (isSerializable(cls)) { JavaClass superCls = cls.getSuperClass(); if (!isSerializable(superCls) && hasSerializableFields(superCls...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "isSerializable", "(", "cls", ")", ")", "{", "JavaClass...
implements the visitor to look for classes that are serializable, and are derived from non serializable classes and don't either implement methods in Externalizable or Serializable to save parent class fields. @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "look", "for", "classes", "that", "are", "serializable", "and", "are", "derived", "from", "non", "serializable", "classes", "and", "don", "t", "either", "implement", "methods", "in", "Externalizable", "or", "Serializable", "...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java#L62-L75
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java
PossibleIncompleteSerialization.isSerializable
private static boolean isSerializable(JavaClass cls) throws ClassNotFoundException { JavaClass[] infs = cls.getAllInterfaces(); for (JavaClass inf : infs) { String clsName = inf.getClassName(); if ("java.io.Serializable".equals(clsName) || "java.io.Externalizable".equals(clsName)...
java
private static boolean isSerializable(JavaClass cls) throws ClassNotFoundException { JavaClass[] infs = cls.getAllInterfaces(); for (JavaClass inf : infs) { String clsName = inf.getClassName(); if ("java.io.Serializable".equals(clsName) || "java.io.Externalizable".equals(clsName)...
[ "private", "static", "boolean", "isSerializable", "(", "JavaClass", "cls", ")", "throws", "ClassNotFoundException", "{", "JavaClass", "[", "]", "infs", "=", "cls", ".", "getAllInterfaces", "(", ")", ";", "for", "(", "JavaClass", "inf", ":", "infs", ")", "{",...
returns if the class implements Serializable or Externalizable @param cls the class to check for interfaces @return if the class implements Serializable or Externalizable @throws ClassNotFoundException if a super class or super interfaces can't be found
[ "returns", "if", "the", "class", "implements", "Serializable", "or", "Externalizable" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java#L88-L97
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java
PossibleIncompleteSerialization.hasSerializableFields
private static boolean hasSerializableFields(JavaClass cls) { Field[] fields = cls.getFields(); for (Field f : fields) { if (!f.isStatic() && !f.isTransient() && !f.isSynthetic()) { return true; } } return false; }
java
private static boolean hasSerializableFields(JavaClass cls) { Field[] fields = cls.getFields(); for (Field f : fields) { if (!f.isStatic() && !f.isTransient() && !f.isSynthetic()) { return true; } } return false; }
[ "private", "static", "boolean", "hasSerializableFields", "(", "JavaClass", "cls", ")", "{", "Field", "[", "]", "fields", "=", "cls", ".", "getFields", "(", ")", ";", "for", "(", "Field", "f", ":", "fields", ")", "{", "if", "(", "!", "f", ".", "isStat...
looks for fields that are candidates for serialization @param cls the class to look for fields @return if their is a field that looks like it should be serialized
[ "looks", "for", "fields", "that", "are", "candidates", "for", "serialization" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java#L106-L114
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java
PossibleIncompleteSerialization.hasSerializingMethods
private static boolean hasSerializingMethods(JavaClass cls) { Method[] methods = cls.getMethods(); for (Method m : methods) { if (!m.isStatic()) { String methodName = m.getName(); String methodSig = m.getSignature(); if ("writeObject".equals(me...
java
private static boolean hasSerializingMethods(JavaClass cls) { Method[] methods = cls.getMethods(); for (Method m : methods) { if (!m.isStatic()) { String methodName = m.getName(); String methodSig = m.getSignature(); if ("writeObject".equals(me...
[ "private", "static", "boolean", "hasSerializingMethods", "(", "JavaClass", "cls", ")", "{", "Method", "[", "]", "methods", "=", "cls", ".", "getMethods", "(", ")", ";", "for", "(", "Method", "m", ":", "methods", ")", "{", "if", "(", "!", "m", ".", "i...
looks to see if this class implements method described by Serializable or Externalizable @param cls the class to examine for serializing methods @return whether the class handles it's own serializing/externalizing
[ "looks", "to", "see", "if", "this", "class", "implements", "method", "described", "by", "Serializable", "or", "Externalizable" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java#L123-L138
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java
ConfusingArrayAsList.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKESTATIC) { String clsName = getClassConstantOperand(); if ("java/util/Arrays".equals(clsName)) { String methodName = getNameConsta...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKESTATIC) { String clsName = getClassConstantOperand(); if ("java/util/Arrays".equals(clsName)) { String methodName = getNameConsta...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "seen", "==", "Const", ".", "INVOKESTATIC", ")", "{", "String", "clsName", "=", "getClassConstantO...
implements the visitor to find calls to Arrays.asList with a primitive array @param seen the currently visitor opcode
[ "implements", "the", "visitor", "to", "find", "calls", "to", "Arrays", ".", "asList", "with", "a", "primitive", "array" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java#L97-L122
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousGetterSetterUse.java
SuspiciousGetterSetterUse.visitCode
@Override public void visitCode(Code obj) { state = State.SEEN_NOTHING; beanReference1 = null; beanReference2 = null; propName = null; propType = null; sawField = false; super.visitCode(obj); }
java
@Override public void visitCode(Code obj) { state = State.SEEN_NOTHING; beanReference1 = null; beanReference2 = null; propName = null; propType = null; sawField = false; super.visitCode(obj); }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "state", "=", "State", ".", "SEEN_NOTHING", ";", "beanReference1", "=", "null", ";", "beanReference2", "=", "null", ";", "propName", "=", "null", ";", "propType", "=", "null", ...
overrides the visitor to reset the state to SEEN_NOTHING, and clear the beanReference, propName and propType @param obj the context object of the currently parsed code block
[ "overrides", "the", "visitor", "to", "reset", "the", "state", "to", "SEEN_NOTHING", "and", "clear", "the", "beanReference", "propName", "and", "propType" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousGetterSetterUse.java#L66-L75
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousGetterSetterUse.java
SuspiciousGetterSetterUse.sawOpcode
@Override public void sawOpcode(int seen) { boolean reset = true; switch (state) { // TODO: Refactor this to use state pattern, not nested // switches case SEEN_NOTHING: reset = sawOpcodeAfterNothing(seen); break; case SEE...
java
@Override public void sawOpcode(int seen) { boolean reset = true; switch (state) { // TODO: Refactor this to use state pattern, not nested // switches case SEEN_NOTHING: reset = sawOpcodeAfterNothing(seen); break; case SEE...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "boolean", "reset", "=", "true", ";", "switch", "(", "state", ")", "{", "// TODO: Refactor this to use state pattern, not nested", "// switches", "case", "SEEN_NOTHING", ":", "reset", "=...
overrides the visitor to look for a setXXX with the value returned from a getXXX using the same base object. @param seen the currently parsed opcode
[ "overrides", "the", "visitor", "to", "look", "for", "a", "setXXX", "with", "the", "value", "returned", "from", "a", "getXXX", "using", "the", "same", "base", "object", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousGetterSetterUse.java#L83-L119
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
ConstantListIndex.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { if ((invocationHandlerClass != null) && classContext.getJavaClass().implementationOf(invocationHandlerClass)) { return; } iConst0Looped = new BitSet(); stack = new Opcod...
java
@Override public void visitClassContext(ClassContext classContext) { try { if ((invocationHandlerClass != null) && classContext.getJavaClass().implementationOf(invocationHandlerClass)) { return; } iConst0Looped = new BitSet(); stack = new Opcod...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "if", "(", "(", "invocationHandlerClass", "!=", "null", ")", "&&", "classContext", ".", "getJavaClass", "(", ")", ".", "implementationOf", "(", "...
implements the visitor to create and clear the const0loop set @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "create", "and", "clear", "the", "const0loop", "set" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java#L120-L135
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
ConstantListIndex.isArrayFromUbiquitousMethod
private static boolean isArrayFromUbiquitousMethod(OpcodeStack.Item item) { XMethod method = item.getReturnValueOf(); if (method == null) { return false; } FQMethod methodDesc = new FQMethod(method.getClassName().replace('.', '/'), method.getName(), method.getSignature()); ...
java
private static boolean isArrayFromUbiquitousMethod(OpcodeStack.Item item) { XMethod method = item.getReturnValueOf(); if (method == null) { return false; } FQMethod methodDesc = new FQMethod(method.getClassName().replace('.', '/'), method.getName(), method.getSignature()); ...
[ "private", "static", "boolean", "isArrayFromUbiquitousMethod", "(", "OpcodeStack", ".", "Item", "item", ")", "{", "XMethod", "method", "=", "item", ".", "getReturnValueOf", "(", ")", ";", "if", "(", "method", "==", "null", ")", "{", "return", "false", ";", ...
returns whether the array item was returned from a common method that the user can't do anything about and so don't report CLI in this case. @param item the stack item representing the array @return if the array was returned from a common method
[ "returns", "whether", "the", "array", "item", "was", "returned", "from", "a", "common", "method", "that", "the", "user", "can", "t", "do", "anything", "about", "and", "so", "don", "t", "report", "CLI", "in", "this", "case", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java#L247-L255
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java
UnusedParameter.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { unusedParms = new BitSet(); regToParm = new HashMap<>(); stack = new OpcodeStack(); super.visitClassContext(classContext); } finally { stack = null; regT...
java
@Override public void visitClassContext(ClassContext classContext) { try { unusedParms = new BitSet(); regToParm = new HashMap<>(); stack = new OpcodeStack(); super.visitClassContext(classContext); } finally { stack = null; regT...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "unusedParms", "=", "new", "BitSet", "(", ")", ";", "regToParm", "=", "new", "HashMap", "<>", "(", ")", ";", "stack", "=", "new", "OpcodeStac...
implements the visitor to create parm bitset @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "create", "parm", "bitset" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java#L78-L90
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java
UnusedParameter.visitCode
@Override public void visitCode(Code obj) { unusedParms.clear(); regToParm.clear(); stack.resetForMethodEntry(this); Method m = getMethod(); String methodName = m.getName(); if (IGNORE_METHODS.contains(methodName)) { return; } int accessFl...
java
@Override public void visitCode(Code obj) { unusedParms.clear(); regToParm.clear(); stack.resetForMethodEntry(this); Method m = getMethod(); String methodName = m.getName(); if (IGNORE_METHODS.contains(methodName)) { return; } int accessFl...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "unusedParms", ".", "clear", "(", ")", ";", "regToParm", ".", "clear", "(", ")", ";", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "Method", "m", "=", "getMeth...
implements the visitor to clear the parm set, and check for potential methods @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "clear", "the", "parm", "set", "and", "check", "for", "potential", "methods" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java#L98-L152
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java
UnusedParameter.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (OpcodeUtils.isStore(seen) || OpcodeUtils.isLoad(seen)) { int reg = getRegisterOperand(); unusedParms.clear(reg); } else if (OpcodeUtils.isReturn(seen) && (st...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (OpcodeUtils.isStore(seen) || OpcodeUtils.isLoad(seen)) { int reg = getRegisterOperand(); unusedParms.clear(reg); } else if (OpcodeUtils.isReturn(seen) && (st...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "OpcodeUtils", ".", "isStore", "(", "seen", ")", "||", "OpcodeUtils", ".", "isLoad", "(", "seen"...
implements the visitor to look for usage of parmeter registers. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "usage", "of", "parmeter", "registers", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java#L160-L181
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
SignatureUtils.getPackageName
public static String getPackageName(final String className) { int dotPos = className.lastIndexOf('.'); if (dotPos < 0) { return ""; } return className.substring(0, dotPos); }
java
public static String getPackageName(final String className) { int dotPos = className.lastIndexOf('.'); if (dotPos < 0) { return ""; } return className.substring(0, dotPos); }
[ "public", "static", "String", "getPackageName", "(", "final", "String", "className", ")", "{", "int", "dotPos", "=", "className", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "dotPos", "<", "0", ")", "{", "return", "\"\"", ";", "}", "return"...
parses the package name from a fully qualified class name @param className the class in question @return the package of the class
[ "parses", "the", "package", "name", "from", "a", "fully", "qualified", "class", "name" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L97-L103
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
SignatureUtils.similarPackages
public static boolean similarPackages(String packName1, String packName2, int depth) { if (depth == 0) { return true; } String dottedPackName1 = packName1.replace('/', '.'); String dottedPackName2 = packName2.replace('/', '.'); int dot1 = dottedPackName1.indexOf('.'...
java
public static boolean similarPackages(String packName1, String packName2, int depth) { if (depth == 0) { return true; } String dottedPackName1 = packName1.replace('/', '.'); String dottedPackName2 = packName2.replace('/', '.'); int dot1 = dottedPackName1.indexOf('.'...
[ "public", "static", "boolean", "similarPackages", "(", "String", "packName1", ",", "String", "packName2", ",", "int", "depth", ")", "{", "if", "(", "depth", "==", "0", ")", "{", "return", "true", ";", "}", "String", "dottedPackName1", "=", "packName1", "."...
returns whether or not the two packages have the same first 'depth' parts, if they exist @param packName1 the first package to check @param packName2 the second package to check @param depth the number of package parts to check @return if they are similar
[ "returns", "whether", "or", "not", "the", "two", "packages", "have", "the", "same", "first", "depth", "parts", "if", "they", "exist" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L117-L141
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
SignatureUtils.getTypeCodeSignature
public static String getTypeCodeSignature(int typeCode) { String signature = Values.PRIMITIVE_TYPE_CODE_SIGS.get((byte) typeCode); return signature == null ? Values.SIG_JAVA_LANG_OBJECT : signature; }
java
public static String getTypeCodeSignature(int typeCode) { String signature = Values.PRIMITIVE_TYPE_CODE_SIGS.get((byte) typeCode); return signature == null ? Values.SIG_JAVA_LANG_OBJECT : signature; }
[ "public", "static", "String", "getTypeCodeSignature", "(", "int", "typeCode", ")", "{", "String", "signature", "=", "Values", ".", "PRIMITIVE_TYPE_CODE_SIGS", ".", "get", "(", "(", "byte", ")", "typeCode", ")", ";", "return", "signature", "==", "null", "?", ...
converts a primitive type code to a signature @param typeCode the raw JVM type value @return the signature of the type
[ "converts", "a", "primitive", "type", "code", "to", "a", "signature" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L150-L153
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
SignatureUtils.getParameterSlotAndSignatures
public static Map<Integer, String> getParameterSlotAndSignatures(boolean methodIsStatic, String methodSignature) { int start = methodSignature.indexOf('(') + 1; int limit = methodSignature.lastIndexOf(')'); if ((limit - start) == 0) { return Collections.emptyMap(); } ...
java
public static Map<Integer, String> getParameterSlotAndSignatures(boolean methodIsStatic, String methodSignature) { int start = methodSignature.indexOf('(') + 1; int limit = methodSignature.lastIndexOf(')'); if ((limit - start) == 0) { return Collections.emptyMap(); } ...
[ "public", "static", "Map", "<", "Integer", ",", "String", ">", "getParameterSlotAndSignatures", "(", "boolean", "methodIsStatic", ",", "String", "methodSignature", ")", "{", "int", "start", "=", "methodSignature", ".", "indexOf", "(", "'", "'", ")", "+", "1", ...
returns a Map that represents the type of the parameter in slot x @param methodIsStatic if the method is static, causes where to start counting from, slot 0 or 1 @param methodSignature the signature of the method to parse @return a map of parameter types (expect empty slots when doubles/longs are used
[ "returns", "a", "Map", "that", "represents", "the", "type", "of", "the", "parameter", "in", "slot", "x" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L179-L212
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
SignatureUtils.getParameterSignatures
public static List<String> getParameterSignatures(String methodSignature) { int start = methodSignature.indexOf('(') + 1; int limit = methodSignature.lastIndexOf(')'); if ((limit - start) == 0) { return Collections.emptyList(); } List<String> parmSignatures = new A...
java
public static List<String> getParameterSignatures(String methodSignature) { int start = methodSignature.indexOf('(') + 1; int limit = methodSignature.lastIndexOf(')'); if ((limit - start) == 0) { return Collections.emptyList(); } List<String> parmSignatures = new A...
[ "public", "static", "List", "<", "String", ">", "getParameterSignatures", "(", "String", "methodSignature", ")", "{", "int", "start", "=", "methodSignature", ".", "indexOf", "(", "'", "'", ")", "+", "1", ";", "int", "limit", "=", "methodSignature", ".", "l...
returns a List of parameter signatures @param methodSignature the signature of the method to parse @return a list of parameter signatures
[ "returns", "a", "List", "of", "parameter", "signatures" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L221-L246
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
SignatureUtils.getReturnSignature
public static String getReturnSignature(String methodSig) { int parenPos = methodSig.indexOf(')'); if (parenPos < 0) { return "?"; } return methodSig.substring(parenPos + 1); }
java
public static String getReturnSignature(String methodSig) { int parenPos = methodSig.indexOf(')'); if (parenPos < 0) { return "?"; } return methodSig.substring(parenPos + 1); }
[ "public", "static", "String", "getReturnSignature", "(", "String", "methodSig", ")", "{", "int", "parenPos", "=", "methodSig", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "parenPos", "<", "0", ")", "{", "return", "\"?\"", ";", "}", "return", "m...
gets the return type signature from a method signature @param methodSig the signature of the method @return the signature of the return type, or ? if a bogus method signature is given
[ "gets", "the", "return", "type", "signature", "from", "a", "method", "signature" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L257-L264
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
SignatureUtils.getNumParameters
public static int getNumParameters(String methodSignature) { int start = methodSignature.indexOf('(') + 1; int limit = methodSignature.lastIndexOf(')'); if ((limit - start) == 0) { return 0; } int numParms = 0; for (int i = start; i < limit; i++) { ...
java
public static int getNumParameters(String methodSignature) { int start = methodSignature.indexOf('(') + 1; int limit = methodSignature.lastIndexOf(')'); if ((limit - start) == 0) { return 0; } int numParms = 0; for (int i = start; i < limit; i++) { ...
[ "public", "static", "int", "getNumParameters", "(", "String", "methodSignature", ")", "{", "int", "start", "=", "methodSignature", ".", "indexOf", "(", "'", "'", ")", "+", "1", ";", "int", "limit", "=", "methodSignature", ".", "lastIndexOf", "(", "'", "'",...
returns the number of parameters in this method signature @param methodSignature the method signature to parse @return the number of parameters
[ "returns", "the", "number", "of", "parameters", "in", "this", "method", "signature" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L273-L294
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
SignatureUtils.getFirstRegisterSlot
public static int getFirstRegisterSlot(Method m) { Type[] parms = m.getArgumentTypes(); int first = m.isStatic() ? 0 : 1; for (Type t : parms) { first += getSignatureSize(t.getSignature()); } return first; }
java
public static int getFirstRegisterSlot(Method m) { Type[] parms = m.getArgumentTypes(); int first = m.isStatic() ? 0 : 1; for (Type t : parms) { first += getSignatureSize(t.getSignature()); } return first; }
[ "public", "static", "int", "getFirstRegisterSlot", "(", "Method", "m", ")", "{", "Type", "[", "]", "parms", "=", "m", ".", "getArgumentTypes", "(", ")", ";", "int", "first", "=", "m", ".", "isStatic", "(", ")", "?", "0", ":", "1", ";", "for", "(", ...
returns the first open register slot after parameters @param m the method for which you want the parameters @return the first available register slot
[ "returns", "the", "first", "open", "register", "slot", "after", "parameters" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L303-L312
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
SignatureUtils.toArraySignature
@Nullable public static String toArraySignature(String typeName) { String sig = classToSignature(typeName); if ((sig == null) || (sig.length() == 0)) { return sig; } return Values.SIG_ARRAY_PREFIX + sig; }
java
@Nullable public static String toArraySignature(String typeName) { String sig = classToSignature(typeName); if ((sig == null) || (sig.length() == 0)) { return sig; } return Values.SIG_ARRAY_PREFIX + sig; }
[ "@", "Nullable", "public", "static", "String", "toArraySignature", "(", "String", "typeName", ")", "{", "String", "sig", "=", "classToSignature", "(", "typeName", ")", ";", "if", "(", "(", "sig", "==", "null", ")", "||", "(", "sig", ".", "length", "(", ...
Converts a type name into an array signature. Accepts slashed or dotted classnames, or type signatures. @param typeName the class name to generate an array signature from @return the array signature
[ "Converts", "a", "type", "name", "into", "an", "array", "signature", ".", "Accepts", "slashed", "or", "dotted", "classnames", "or", "type", "signatures", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L416-L423
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
SignatureUtils.isWonkyEclipseSignature
private static boolean isWonkyEclipseSignature(String sig, int startIndex) { return (sig.length() > startIndex) && (ECLIPSE_WEIRD_SIG_CHARS.indexOf(sig.charAt(startIndex)) >= 0); }
java
private static boolean isWonkyEclipseSignature(String sig, int startIndex) { return (sig.length() > startIndex) && (ECLIPSE_WEIRD_SIG_CHARS.indexOf(sig.charAt(startIndex)) >= 0); }
[ "private", "static", "boolean", "isWonkyEclipseSignature", "(", "String", "sig", ",", "int", "startIndex", ")", "{", "return", "(", "sig", ".", "length", "(", ")", ">", "startIndex", ")", "&&", "(", "ECLIPSE_WEIRD_SIG_CHARS", ".", "indexOf", "(", "sig", ".",...
Eclipse makes weird class signatures. @param sig the signature in type table @param startIndex the index into the signature where the wonkyness begins @return if this signature has eclipse meta chars
[ "Eclipse", "makes", "weird", "class", "signatures", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L455-L457
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java
SuspiciousWaitOnConcurrentObject.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); int major = cls.getMajor(); if (major >= Const.MAJOR_1_5) { stack = new OpcodeStack(); super.visitClassContext(classCont...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); int major = cls.getMajor(); if (major >= Const.MAJOR_1_5) { stack = new OpcodeStack(); super.visitClassContext(classCont...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "int", "major", "=", "cls", ".", "getMajor", "(", ")", ";", "if"...
implements the visitor to check for class file version 1.5 or better @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "check", "for", "class", "file", "version", "1", ".", "5", "or", "better" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java#L62-L74
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java
SuspiciousWaitOnConcurrentObject.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen != Const.INVOKEVIRTUAL) || !"wait".equals(getNameConstantOperand()) || stack.getStackDepth() == 0) { return; } JavaClass cls = stack.getStackItem(0).getJav...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen != Const.INVOKEVIRTUAL) || !"wait".equals(getNameConstantOperand()) || stack.getStackDepth() == 0) { return; } JavaClass cls = stack.getStackItem(0).getJav...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "(", "seen", "!=", "Const", ".", "INVOKEVIRTUAL", ")", "||", "!", "\"wait\"", ".", "equals", "...
implements the visitor to look for calls to wait, on java.util.concurrent classes that define await. @param seen the opcode of the currently visited instruction
[ "implements", "the", "visitor", "to", "look", "for", "calls", "to", "wait", "on", "java", ".", "util", ".", "concurrent", "classes", "that", "define", "await", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java#L93-L114
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java
CustomBuiltXML.sawOpcode
@Override public void sawOpcode(int seen) { String strCon = null; try { stack.precomputation(this); if (seen == Const.INVOKESPECIAL) { String clsName = getClassConstantOperand(); if (SignatureUtils.isPlainStringConvertableClass(clsName)) { ...
java
@Override public void sawOpcode(int seen) { String strCon = null; try { stack.precomputation(this); if (seen == Const.INVOKESPECIAL) { String clsName = getClassConstantOperand(); if (SignatureUtils.isPlainStringConvertableClass(clsName)) { ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "String", "strCon", "=", "null", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "seen", "==", "Const", ".", "INVOKESPECIAL", ")", "{", "...
overrides the visitor to find String concatenations including xml strings @param seen the opcode that is being visited
[ "overrides", "the", "visitor", "to", "find", "String", "concatenations", "including", "xml", "strings" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java#L133-L185
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousLoopSearch.java
SuspiciousLoopSearch.sawOpcode
@Override public void sawOpcode(int seen) { try { switch (state) { case SAW_NOTHING: sawOpcodeAfterNothing(seen); break; case SAW_EQUALS: sawOpcodeAfterEquals(seen); break; c...
java
@Override public void sawOpcode(int seen) { try { switch (state) { case SAW_NOTHING: sawOpcodeAfterNothing(seen); break; case SAW_EQUALS: sawOpcodeAfterEquals(seen); break; c...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "switch", "(", "state", ")", "{", "case", "SAW_NOTHING", ":", "sawOpcodeAfterNothing", "(", "seen", ")", ";", "break", ";", "case", "SAW_EQUALS", ":", "sawOpcodeAfter...
implements the visitor to find continuations after finding a search result in a loop. @param seen the currently visitor opcode
[ "implements", "the", "visitor", "to", "find", "continuations", "after", "finding", "a", "search", "result", "in", "a", "loop", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousLoopSearch.java#L121-L144
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java
LingeringGraphicsObjects.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); graphicsRegs = new HashMap<Integer, Integer>(5); super.visitClassContext(classContext); } finally { stack = null; graphicsRegs = null; ...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); graphicsRegs = new HashMap<Integer, Integer>(5); super.visitClassContext(classContext); } finally { stack = null; graphicsRegs = null; ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "graphicsRegs", "=", "new", "HashMap", "<", "Integer", ",", "Integer", ">", "(", "5", ")",...
overrides the visitor to set up the opcode stack @param classContext the context object of the currently parsed class
[ "overrides", "the", "visitor", "to", "set", "up", "the", "opcode", "stack" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java#L80-L90
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java
PoorlyDefinedParameter.visitCode
@Override public void visitCode(Code obj) { try { Method m = getMethod(); if (m.isSynthetic()) { return; } if (m.isStatic() || m.isPrivate() || Values.CONSTRUCTOR.equals(m.getName())) { parmSigs = SignatureUtils.getParameterSlo...
java
@Override public void visitCode(Code obj) { try { Method m = getMethod(); if (m.isSynthetic()) { return; } if (m.isStatic() || m.isPrivate() || Values.CONSTRUCTOR.equals(m.getName())) { parmSigs = SignatureUtils.getParameterSlo...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "m", ".", "isSynthetic", "(", ")", ")", "{", "return", ";", "}", "if", "(", "m", ".", "isStatic",...
implements the visitor to see if the method has parameters @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "see", "if", "the", "method", "has", "parameters" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java#L75-L98
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java
PoorlyDefinedParameter.sawOpcode
@Override public void sawOpcode(int seen) { if (downwardBranchTarget == -1) { switch (state) { case SAW_NOTHING: sawOpcodeAfterNothing(seen); break; case SAW_LOAD: sawOpcodeAfterLoad(seen); b...
java
@Override public void sawOpcode(int seen) { if (downwardBranchTarget == -1) { switch (state) { case SAW_NOTHING: sawOpcodeAfterNothing(seen); break; case SAW_LOAD: sawOpcodeAfterLoad(seen); b...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "downwardBranchTarget", "==", "-", "1", ")", "{", "switch", "(", "state", ")", "{", "case", "SAW_NOTHING", ":", "sawOpcodeAfterNothing", "(", "seen", ")", ";", "brea...
implements the visitor to look for check casts of parameters to more specific types
[ "implements", "the", "visitor", "to", "look", "for", "check", "casts", "of", "parameters", "to", "more", "specific", "types" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java#L115-L151
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java
UnrelatedReturnValues.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { currentClass = classContext.getJavaClass(); stack = new OpcodeStack(); returnTypes = new HashMap<>(); super.visitClassContext(classContext); } finally { currentClass...
java
@Override public void visitClassContext(ClassContext classContext) { try { currentClass = classContext.getJavaClass(); stack = new OpcodeStack(); returnTypes = new HashMap<>(); super.visitClassContext(classContext); } finally { currentClass...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "currentClass", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "returnTypes", "=", ...
implements the visitor to create and destroy the stack and return types @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "create", "and", "destroy", "the", "stack", "and", "return", "types" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java#L70-L82
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java
UnrelatedReturnValues.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); if (m.isSynthetic()) { return; } String signature = m.getSignature(); if (!signature.endsWith(")Ljava/lang/Object;")) { return; } stack.resetForMethodEntry(this); ...
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if (m.isSynthetic()) { return; } String signature = m.getSignature(); if (!signature.endsWith(")Ljava/lang/Object;")) { return; } stack.resetForMethodEntry(this); ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "m", ".", "isSynthetic", "(", ")", ")", "{", "return", ";", "}", "String", "signature", "=", "m", ".", "getSign...
implements the visitor to see if the method returns Object, and if the method is defined in a superclass, or interface. @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "see", "if", "the", "method", "returns", "Object", "and", "if", "the", "method", "is", "defined", "in", "a", "superclass", "or", "interface", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java#L90-L140
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java
UnrelatedReturnValues.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.ARETURN) && (stack.getStackDepth() > 0)) { OpcodeStack.Item itm = stack.getStackItem(0); if (!itm.isNull()) { returnTypes.put(itm.getJ...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.ARETURN) && (stack.getStackDepth() > 0)) { OpcodeStack.Item itm = stack.getStackItem(0); if (!itm.isNull()) { returnTypes.put(itm.getJ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "(", "seen", "==", "Const", ".", "ARETURN", ")", "&&", "(", "stack", ".", "getStackDepth", "("...
implements the visitor to find return values where the types of objects returned from the method are related only by object. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "find", "return", "values", "where", "the", "types", "of", "objects", "returned", "from", "the", "method", "are", "related", "only", "by", "object", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java#L148-L164
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java
UnrelatedReturnValues.findCommonType
@Nullable private static JavaClass findCommonType(Set<JavaClass> classes) throws ClassNotFoundException { Set<JavaClass> possibleCommonTypes = new HashSet<>(); boolean populate = true; for (JavaClass cls : classes) { if (cls == null) { return null; } ...
java
@Nullable private static JavaClass findCommonType(Set<JavaClass> classes) throws ClassNotFoundException { Set<JavaClass> possibleCommonTypes = new HashSet<>(); boolean populate = true; for (JavaClass cls : classes) { if (cls == null) { return null; } ...
[ "@", "Nullable", "private", "static", "JavaClass", "findCommonType", "(", "Set", "<", "JavaClass", ">", "classes", ")", "throws", "ClassNotFoundException", "{", "Set", "<", "JavaClass", ">", "possibleCommonTypes", "=", "new", "HashSet", "<>", "(", ")", ";", "b...
looks for a common superclass or interface for all the passed in types @param classes the set of classes to look for a common super class or interface @return the type that is the common interface or superclass (not Object, tho). @throws ClassNotFoundException if a superclass or superinterface of one of the class is ...
[ "looks", "for", "a", "common", "superclass", "or", "interface", "for", "all", "the", "passed", "in", "types" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java#L176-L215
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java
SideEffectConstructor.visitCode
@Override public void visitCode(Code obj) { state = State.SAW_NOTHING; stack.resetForMethodEntry(this); super.visitCode(obj); }
java
@Override public void visitCode(Code obj) { state = State.SAW_NOTHING; stack.resetForMethodEntry(this); super.visitCode(obj); }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "state", "=", "State", ".", "SAW_NOTHING", ";", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "super", ".", "visitCode", "(", "obj", ")", ";", "}" ]
overrides the visitor to reset the state and reset the opcode stack @param obj the context object of the currently parsed code
[ "overrides", "the", "visitor", "to", "reset", "the", "state", "and", "reset", "the", "opcode", "stack" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java#L82-L87
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java
SideEffectConstructor.sawOpcode
@Override public void sawOpcode(int seen) { int pc = 0; try { stack.precomputation(this); switch (state) { case SAW_NOTHING: pc = sawOpcodeAfterNothing(seen); break; case SAW_CTOR: if ((...
java
@Override public void sawOpcode(int seen) { int pc = 0; try { stack.precomputation(this); switch (state) { case SAW_NOTHING: pc = sawOpcodeAfterNothing(seen); break; case SAW_CTOR: if ((...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "int", "pc", "=", "0", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "state", ")", "{", "case", "SAW_NOTHING", ":", "pc", "=", "s...
overrides the visitor to look for constructors who's value is popped off the stack, and not assigned before the pop of the value, or if a return is issued with that object still on the stack. @param seen the opcode of the currently parse opcode
[ "overrides", "the", "visitor", "to", "look", "for", "constructors", "who", "s", "value", "is", "popped", "off", "the", "stack", "and", "not", "assigned", "before", "the", "pop", "of", "the", "value", "or", "if", "a", "return", "is", "issued", "with", "th...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java#L96-L124
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
ClassEnvy.visitClassContext
@Override public void visitClassContext(final ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); packageName = cls.getPackageName(); clsName = cls.getClassName(); parentClassName = cls.getSuperclassName(); stack = new O...
java
@Override public void visitClassContext(final ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); packageName = cls.getPackageName(); clsName = cls.getClassName(); parentClassName = cls.getSuperclassName(); stack = new O...
[ "@", "Override", "public", "void", "visitClassContext", "(", "final", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "packageName", "=", "cls", ".", "getPackageName", "(", ")",...
overrides the visitor to collect package and class names @param classContext the context object that holds the JavaClass being parsed
[ "overrides", "the", "visitor", "to", "collect", "package", "and", "class", "names" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java#L110-L126
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
ClassEnvy.visitMethod
@Override public void visitMethod(final Method obj) { methodName = obj.getName(); methodIsStatic = obj.isStatic(); }
java
@Override public void visitMethod(final Method obj) { methodName = obj.getName(); methodIsStatic = obj.isStatic(); }
[ "@", "Override", "public", "void", "visitMethod", "(", "final", "Method", "obj", ")", "{", "methodName", "=", "obj", ".", "getName", "(", ")", ";", "methodIsStatic", "=", "obj", ".", "isStatic", "(", ")", ";", "}" ]
overrides the visitor to check whether the method is static @param obj the method currently being parsed
[ "overrides", "the", "visitor", "to", "check", "whether", "the", "method", "is", "static" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java#L134-L138
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
ClassEnvy.visitCode
@Override @SuppressWarnings("unchecked") public void visitCode(final Code obj) { stack.resetForMethodEntry(this); thisClsAccessCount = 0; if (Values.STATIC_INITIALIZER.equals(methodName)) { return; } clsAccessCount = new HashMap<>(); super.visitCode(o...
java
@Override @SuppressWarnings("unchecked") public void visitCode(final Code obj) { stack.resetForMethodEntry(this); thisClsAccessCount = 0; if (Values.STATIC_INITIALIZER.equals(methodName)) { return; } clsAccessCount = new HashMap<>(); super.visitCode(o...
[ "@", "Override", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "visitCode", "(", "final", "Code", "obj", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "thisClsAccessCount", "=", "0", ";", "if", "(", "Values", ...
overrides the visitor to look for the method that uses another class the most, and if it exceeds the threshold reports it @param obj the code that is currently being parsed
[ "overrides", "the", "visitor", "to", "look", "for", "the", "method", "that", "uses", "another", "class", "the", "most", "and", "if", "it", "exceeds", "the", "threshold", "reports", "it" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java#L146-L191
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
ClassEnvy.sawOpcode
@Override public void sawOpcode(final int seen) { try { stack.precomputation(this); if (OpcodeUtils.isStandardInvoke(seen)) { String calledClass = getDottedClassConstantOperand(); if (seen == Const.INVOKEINTERFACE) { int parmCount...
java
@Override public void sawOpcode(final int seen) { try { stack.precomputation(this); if (OpcodeUtils.isStandardInvoke(seen)) { String calledClass = getDottedClassConstantOperand(); if (seen == Const.INVOKEINTERFACE) { int parmCount...
[ "@", "Override", "public", "void", "sawOpcode", "(", "final", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "OpcodeUtils", ".", "isStandardInvoke", "(", "seen", ")", ")", "{", "String", "calledClas...
overrides the visitor to look for method calls, and populate a class access count map based on the owning class of methods called. @param seen the opcode currently being parsed
[ "overrides", "the", "visitor", "to", "look", "for", "method", "calls", "and", "populate", "a", "class", "access", "count", "map", "based", "on", "the", "owning", "class", "of", "methods", "called", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java#L199-L227
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
ClassEnvy.implementsCommonInterface
private boolean implementsCommonInterface(String name) { try { JavaClass cls = Repository.lookupClass(name); JavaClass[] infs = cls.getAllInterfaces(); for (JavaClass inf : infs) { String infName = inf.getClassName(); if (ignorableInterfaces.c...
java
private boolean implementsCommonInterface(String name) { try { JavaClass cls = Repository.lookupClass(name); JavaClass[] infs = cls.getAllInterfaces(); for (JavaClass inf : infs) { String infName = inf.getClassName(); if (ignorableInterfaces.c...
[ "private", "boolean", "implementsCommonInterface", "(", "String", "name", ")", "{", "try", "{", "JavaClass", "cls", "=", "Repository", ".", "lookupClass", "(", "name", ")", ";", "JavaClass", "[", "]", "infs", "=", "cls", ".", "getAllInterfaces", "(", ")", ...
return whether or not a class implements a common or marker interface @param name the class name to check @return if this class implements a common or marker interface
[ "return", "whether", "or", "not", "a", "class", "implements", "a", "common", "or", "marker", "interface" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java#L237-L257
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
ClassEnvy.countClassAccess
private boolean countClassAccess(final int classAtStackIndex) { String calledClass; try { if (stack.getStackDepth() > classAtStackIndex) { OpcodeStack.Item itm = stack.getStackItem(classAtStackIndex); JavaClass cls = itm.getJavaClass(); if (cl...
java
private boolean countClassAccess(final int classAtStackIndex) { String calledClass; try { if (stack.getStackDepth() > classAtStackIndex) { OpcodeStack.Item itm = stack.getStackItem(classAtStackIndex); JavaClass cls = itm.getJavaClass(); if (cl...
[ "private", "boolean", "countClassAccess", "(", "final", "int", "classAtStackIndex", ")", "{", "String", "calledClass", ";", "try", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", ">", "classAtStackIndex", ")", "{", "OpcodeStack", ".", "Item", "itm", ...
increment the count of class access of the class on the stack @param classAtStackIndex the position on the stack of the class in question @return true if the class is counted
[ "increment", "the", "count", "of", "class", "access", "of", "the", "class", "on", "the", "stack" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java#L267-L285
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
ClassEnvy.countClassAccess
private void countClassAccess(final @DottedClassName String calledClass) { if (calledClass.equals(clsName) || isAssociatedClass(calledClass)) { if (getPrevOpcode(1) != Const.ALOAD_0) { thisClsAccessCount++; } } else { String calledPackage = SignatureUt...
java
private void countClassAccess(final @DottedClassName String calledClass) { if (calledClass.equals(clsName) || isAssociatedClass(calledClass)) { if (getPrevOpcode(1) != Const.ALOAD_0) { thisClsAccessCount++; } } else { String calledPackage = SignatureUt...
[ "private", "void", "countClassAccess", "(", "final", "@", "DottedClassName", "String", "calledClass", ")", "{", "if", "(", "calledClass", ".", "equals", "(", "clsName", ")", "||", "isAssociatedClass", "(", "calledClass", ")", ")", "{", "if", "(", "getPrevOpcod...
increment the count of class access of the specified class if it is in a similar package to the caller, and is not general purpose @param calledClass the class to check
[ "increment", "the", "count", "of", "class", "access", "of", "the", "specified", "class", "if", "it", "is", "in", "a", "similar", "package", "to", "the", "caller", "and", "is", "not", "general", "purpose" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java#L293-L311
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
ClassEnvy.addLineNumber
private void addLineNumber(BitSet lineNumbers) { LineNumberTable lnt = getCode().getLineNumberTable(); if (lnt == null) { lineNumbers.set(0); } else { int line = lnt.getSourceLine(getPC()); if (line < 0) { lineNumbers.set(lineNumbers.size()); ...
java
private void addLineNumber(BitSet lineNumbers) { LineNumberTable lnt = getCode().getLineNumberTable(); if (lnt == null) { lineNumbers.set(0); } else { int line = lnt.getSourceLine(getPC()); if (line < 0) { lineNumbers.set(lineNumbers.size()); ...
[ "private", "void", "addLineNumber", "(", "BitSet", "lineNumbers", ")", "{", "LineNumberTable", "lnt", "=", "getCode", "(", ")", ".", "getLineNumberTable", "(", ")", ";", "if", "(", "lnt", "==", "null", ")", "{", "lineNumbers", ".", "set", "(", "0", ")", ...
add the current line number to a set of line numbers @param lineNumbers the current set of line numbers
[ "add", "the", "current", "line", "number", "to", "a", "set", "of", "line", "numbers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java#L346-L358
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
ClassEnvy.generalPurpose
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "EXS_EXCEPTION_SOFTENING_RETURN_FALSE", justification = "No other simple way to determine whether class exists") private boolean generalPurpose(final String className) { if (className.startsWith("java.") || className.startsWith("javax.")) { ...
java
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "EXS_EXCEPTION_SOFTENING_RETURN_FALSE", justification = "No other simple way to determine whether class exists") private boolean generalPurpose(final String className) { if (className.startsWith("java.") || className.startsWith("javax.")) { ...
[ "@", "edu", ".", "umd", ".", "cs", ".", "findbugs", ".", "annotations", ".", "SuppressFBWarnings", "(", "value", "=", "\"EXS_EXCEPTION_SOFTENING_RETURN_FALSE\"", ",", "justification", "=", "\"No other simple way to determine whether class exists\"", ")", "private", "boole...
checks to see if the specified class is a built in class, or implements a simple interface @param className the class in question @return whether or not the class is general purpose
[ "checks", "to", "see", "if", "the", "specified", "class", "is", "a", "built", "in", "class", "or", "implements", "a", "simple", "interface" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java#L368-L405
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java
ReflectionOnObjectMethods.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); localClassTypes = new HashMap<>(); fieldClassTypes = new HashMap<>(); JavaClass cls = classContext.getJavaClass(); Method staticInit = findStaticI...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); localClassTypes = new HashMap<>(); fieldClassTypes = new HashMap<>(); JavaClass cls = classContext.getJavaClass(); Method staticInit = findStaticI...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "localClassTypes", "=", "new", "HashMap", "<>", "(", ")", ";", "fieldClassTypes", "=", "new"...
implements the visitor to create the stack and local and field maps for Class arrays to be used for getting the reflection method @param classContext the context object of the currently parse class
[ "implements", "the", "visitor", "to", "create", "the", "stack", "and", "local", "and", "field", "maps", "for", "Class", "arrays", "to", "be", "used", "for", "getting", "the", "reflection", "method" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java#L86-L105
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java
ReflectionOnObjectMethods.findStaticInitializer
@Nullable private static Method findStaticInitializer(JavaClass cls) { Method[] methods = cls.getMethods(); for (Method m : methods) { if (Values.STATIC_INITIALIZER.equals(m.getName())) { return m; } } return null; }
java
@Nullable private static Method findStaticInitializer(JavaClass cls) { Method[] methods = cls.getMethods(); for (Method m : methods) { if (Values.STATIC_INITIALIZER.equals(m.getName())) { return m; } } return null; }
[ "@", "Nullable", "private", "static", "Method", "findStaticInitializer", "(", "JavaClass", "cls", ")", "{", "Method", "[", "]", "methods", "=", "cls", ".", "getMethods", "(", ")", ";", "for", "(", "Method", "m", ":", "methods", ")", "{", "if", "(", "Va...
finds the method that is the static initializer for the class @param cls the class to find the initializer for @return the Method of the static initializer or null if this class has none
[ "finds", "the", "method", "that", "is", "the", "static", "initializer", "for", "the", "class" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java#L275-L285
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java
BuryingLogic.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); ifBlocks = new IfBlocks(); gotoBranchPCs = new BitSet(); casePositions = new BitSet(); super.visitClassContext(classContext); } finally { ...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); ifBlocks = new IfBlocks(); gotoBranchPCs = new BitSet(); casePositions = new BitSet(); super.visitClassContext(classContext); } finally { ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "ifBlocks", "=", "new", "IfBlocks", "(", ")", ";", "gotoBranchPCs", "=", "new", "BitSet", ...
implements the visitor to reset the opcode stack, and initialize if tracking collections @param classContext the currently parsed java class
[ "implements", "the", "visitor", "to", "reset", "the", "opcode", "stack", "and", "initialize", "if", "tracking", "collections" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java#L132-L147
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java
BuryingLogic.isResetOp
private boolean isResetOp(int seen) { return resetOps.get(seen) || OpcodeUtils.isStore(seen) || OpcodeUtils.isReturn(seen) || ((OpcodeUtils.isInvoke(seen) && getSigConstantOperand().endsWith(")V")) || (isBranch(seen) && (getBranchOffset() < 0))); }
java
private boolean isResetOp(int seen) { return resetOps.get(seen) || OpcodeUtils.isStore(seen) || OpcodeUtils.isReturn(seen) || ((OpcodeUtils.isInvoke(seen) && getSigConstantOperand().endsWith(")V")) || (isBranch(seen) && (getBranchOffset() < 0))); }
[ "private", "boolean", "isResetOp", "(", "int", "seen", ")", "{", "return", "resetOps", ".", "get", "(", "seen", ")", "||", "OpcodeUtils", ".", "isStore", "(", "seen", ")", "||", "OpcodeUtils", ".", "isReturn", "(", "seen", ")", "||", "(", "(", "OpcodeU...
determines if this opcode couldn't be part of a conditional expression or at least is very unlikely to be so. @param seen the currently parse opcode @return if this operation resets the looking for conditionals
[ "determines", "if", "this", "opcode", "couldn", "t", "be", "part", "of", "a", "conditional", "expression", "or", "at", "least", "is", "very", "unlikely", "to", "be", "so", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java#L282-L285
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ModifyingUnmodifiableCollection.java
ModifyingUnmodifiableCollection.visitCode
@Override public void visitCode(Code obj) { try { stack.resetForMethodEntry(this); reportedType = ImmutabilityType.UNKNOWN; super.visitCode(obj); } catch (StopOpcodeParsingException e) { // report type is immutable } }
java
@Override public void visitCode(Code obj) { try { stack.resetForMethodEntry(this); reportedType = ImmutabilityType.UNKNOWN; super.visitCode(obj); } catch (StopOpcodeParsingException e) { // report type is immutable } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "reportedType", "=", "ImmutabilityType", ".", "UNKNOWN", ";", "super", ".", "visitCode", "(", "obj", ")", ...
overrides the visitor to reset the opcode stack, and reset the reported immutability of the method @param obj the context object of the currently parse code block
[ "overrides", "the", "visitor", "to", "reset", "the", "opcode", "stack", "and", "reset", "the", "reported", "immutability", "of", "the", "method" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ModifyingUnmodifiableCollection.java#L102-L111
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ModifyingUnmodifiableCollection.java
ModifyingUnmodifiableCollection.sawOpcode
@Override public void sawOpcode(int seen) { ImmutabilityType imType = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKESTATIC: case Const.INVOKEINTERFACE: case Const.INVOKESPECIAL: case ...
java
@Override public void sawOpcode(int seen) { ImmutabilityType imType = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKESTATIC: case Const.INVOKEINTERFACE: case Const.INVOKESPECIAL: case ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "ImmutabilityType", "imType", "=", "null", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".", "INV...
overrides the visitor to find method mutations on collections that have previously been determined to have been created as immutable collections @param seen the currently parsed opcode
[ "overrides", "the", "visitor", "to", "find", "method", "mutations", "on", "collections", "that", "have", "previously", "been", "determined", "to", "have", "been", "created", "as", "immutable", "collections" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ModifyingUnmodifiableCollection.java#L119-L172
train
simbiose/Encryption
Encryption/main/se/simbio/encryption/Encryption.java
Encryption.encrypt
public String encrypt(String data) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeyException, InvalidKeySpecException, BadPaddingException, IllegalBlockSizeException { if (data == null) return null; SecretKey secretKey ...
java
public String encrypt(String data) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeyException, InvalidKeySpecException, BadPaddingException, IllegalBlockSizeException { if (data == null) return null; SecretKey secretKey ...
[ "public", "String", "encrypt", "(", "String", "data", ")", "throws", "UnsupportedEncodingException", ",", "NoSuchAlgorithmException", ",", "NoSuchPaddingException", ",", "InvalidAlgorithmParameterException", ",", "InvalidKeyException", ",", "InvalidKeySpecException", ",", "Ba...
Encrypt a String @param data the String to be encrypted @return the encrypted String or {@code null} if you send the data as {@code null} @throws UnsupportedEncodingException if the Builder charset name is not supported or if the Builder charset name is not supported @throws NoSuchAlgorithmException ...
[ "Encrypt", "a", "String" ]
a344761a10add131cbe9962f895b416e5217d0e9
https://github.com/simbiose/Encryption/blob/a344761a10add131cbe9962f895b416e5217d0e9/Encryption/main/se/simbio/encryption/Encryption.java#L88-L95
train
simbiose/Encryption
Encryption/main/se/simbio/encryption/Encryption.java
Encryption.encryptAsync
public void encryptAsync(final String data, final Callback callback) { if (callback == null) return; new Thread(new Runnable() { @Override public void run() { try { String encrypt = encrypt(data); if (encrypt == null) { ...
java
public void encryptAsync(final String data, final Callback callback) { if (callback == null) return; new Thread(new Runnable() { @Override public void run() { try { String encrypt = encrypt(data); if (encrypt == null) { ...
[ "public", "void", "encryptAsync", "(", "final", "String", "data", ",", "final", "Callback", "callback", ")", "{", "if", "(", "callback", "==", "null", ")", "return", ";", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", ...
This is a sugar method that calls encrypt method in background, it is a good idea to use this one instead the default method because encryption can take several time and with this method the process occurs in a AsyncTask, other advantage is the Callback with separated methods, one for success and other for the exceptio...
[ "This", "is", "a", "sugar", "method", "that", "calls", "encrypt", "method", "in", "background", "it", "is", "a", "good", "idea", "to", "use", "this", "one", "instead", "the", "default", "method", "because", "encryption", "can", "take", "several", "time", "...
a344761a10add131cbe9962f895b416e5217d0e9
https://github.com/simbiose/Encryption/blob/a344761a10add131cbe9962f895b416e5217d0e9/Encryption/main/se/simbio/encryption/Encryption.java#L123-L139
train
simbiose/Encryption
Encryption/main/se/simbio/encryption/Encryption.java
Encryption.decrypt
public String decrypt(String data) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException { if (data == null) return null; byte[] dataBytes = B...
java
public String decrypt(String data) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException { if (data == null) return null; byte[] dataBytes = B...
[ "public", "String", "decrypt", "(", "String", "data", ")", "throws", "UnsupportedEncodingException", ",", "NoSuchAlgorithmException", ",", "InvalidKeySpecException", ",", "NoSuchPaddingException", ",", "InvalidAlgorithmParameterException", ",", "InvalidKeyException", ",", "Ba...
Decrypt a String @param data the String to be decrypted @return the decrypted String or {@code null} if you send the data as {@code null} @throws UnsupportedEncodingException if the Builder charset name is not supported or if the Builder charset name is not supported @throws NoSuchAlgorithmException ...
[ "Decrypt", "a", "String" ]
a344761a10add131cbe9962f895b416e5217d0e9
https://github.com/simbiose/Encryption/blob/a344761a10add131cbe9962f895b416e5217d0e9/Encryption/main/se/simbio/encryption/Encryption.java#L173-L181
train
simbiose/Encryption
Encryption/main/se/simbio/encryption/Encryption.java
Encryption.decryptAsync
public void decryptAsync(final String data, final Callback callback) { if (callback == null) return; new Thread(new Runnable() { @Override public void run() { try { String decrypt = decrypt(data); if (decrypt == null) { ...
java
public void decryptAsync(final String data, final Callback callback) { if (callback == null) return; new Thread(new Runnable() { @Override public void run() { try { String decrypt = decrypt(data); if (decrypt == null) { ...
[ "public", "void", "decryptAsync", "(", "final", "String", "data", ",", "final", "Callback", "callback", ")", "{", "if", "(", "callback", "==", "null", ")", "return", ";", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", ...
This is a sugar method that calls decrypt method in background, it is a good idea to use this one instead the default method because decryption can take several time and with this method the process occurs in a AsyncTask, other advantage is the Callback with separated methods, one for success and other for the exceptio...
[ "This", "is", "a", "sugar", "method", "that", "calls", "decrypt", "method", "in", "background", "it", "is", "a", "good", "idea", "to", "use", "this", "one", "instead", "the", "default", "method", "because", "decryption", "can", "take", "several", "time", "...
a344761a10add131cbe9962f895b416e5217d0e9
https://github.com/simbiose/Encryption/blob/a344761a10add131cbe9962f895b416e5217d0e9/Encryption/main/se/simbio/encryption/Encryption.java#L209-L225
train
simbiose/Encryption
Encryption/main/se/simbio/encryption/Encryption.java
Encryption.getSecretKey
private SecretKey getSecretKey(char[] key) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeySpecException { SecretKeyFactory factory = SecretKeyFactory.getInstance(mBuilder.getSecretKeyType()); KeySpec spec = new PBEKeySpec(key, mBuilder.getSalt().getBytes(mBuilder.getCharsetName...
java
private SecretKey getSecretKey(char[] key) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeySpecException { SecretKeyFactory factory = SecretKeyFactory.getInstance(mBuilder.getSecretKeyType()); KeySpec spec = new PBEKeySpec(key, mBuilder.getSalt().getBytes(mBuilder.getCharsetName...
[ "private", "SecretKey", "getSecretKey", "(", "char", "[", "]", "key", ")", "throws", "NoSuchAlgorithmException", ",", "UnsupportedEncodingException", ",", "InvalidKeySpecException", "{", "SecretKeyFactory", "factory", "=", "SecretKeyFactory", ".", "getInstance", "(", "m...
creates a 128bit salted aes key @param key encoded input key @return aes 128 bit salted key @throws NoSuchAlgorithmException if no installed provider that can provide the requested by the Builder secret key type @throws UnsupportedEncodingException if the Builder charset name is not supported @throws InvalidKeyS...
[ "creates", "a", "128bit", "salted", "aes", "key" ]
a344761a10add131cbe9962f895b416e5217d0e9
https://github.com/simbiose/Encryption/blob/a344761a10add131cbe9962f895b416e5217d0e9/Encryption/main/se/simbio/encryption/Encryption.java#L241-L246
train
simbiose/Encryption
Encryption/main/se/simbio/encryption/Encryption.java
Encryption.hashTheKey
private char[] hashTheKey(String key) throws UnsupportedEncodingException, NoSuchAlgorithmException { MessageDigest messageDigest = MessageDigest.getInstance(mBuilder.getDigestAlgorithm()); messageDigest.update(key.getBytes(mBuilder.getCharsetName())); return Base64.encodeToString(messageDigest....
java
private char[] hashTheKey(String key) throws UnsupportedEncodingException, NoSuchAlgorithmException { MessageDigest messageDigest = MessageDigest.getInstance(mBuilder.getDigestAlgorithm()); messageDigest.update(key.getBytes(mBuilder.getCharsetName())); return Base64.encodeToString(messageDigest....
[ "private", "char", "[", "]", "hashTheKey", "(", "String", "key", ")", "throws", "UnsupportedEncodingException", ",", "NoSuchAlgorithmException", "{", "MessageDigest", "messageDigest", "=", "MessageDigest", ".", "getInstance", "(", "mBuilder", ".", "getDigestAlgorithm", ...
takes in a simple string and performs an sha1 hash that is 128 bits long...we then base64 encode it and return the char array @param key simple inputted string @return sha1 base64 encoded representation @throws UnsupportedEncodingException if the Builder charset name is not supported @throws NoSuchAlgorithmException...
[ "takes", "in", "a", "simple", "string", "and", "performs", "an", "sha1", "hash", "that", "is", "128", "bits", "long", "...", "we", "then", "base64", "encode", "it", "and", "return", "the", "char", "array" ]
a344761a10add131cbe9962f895b416e5217d0e9
https://github.com/simbiose/Encryption/blob/a344761a10add131cbe9962f895b416e5217d0e9/Encryption/main/se/simbio/encryption/Encryption.java#L261-L265
train
asciidoctor/asciidoclet
src/main/java/org/asciidoctor/asciidoclet/AsciidoctorRenderer.java
AsciidoctorRenderer.renderTag
private void renderTag(Tag tag, StringBuilder buffer) { buffer.append(tag.name()).append(' '); // Special handling for @param <T> tags // See http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#@param if ((tag instanceof ParamTag) && ((ParamTag) tag).isTypeParameter())...
java
private void renderTag(Tag tag, StringBuilder buffer) { buffer.append(tag.name()).append(' '); // Special handling for @param <T> tags // See http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#@param if ((tag instanceof ParamTag) && ((ParamTag) tag).isTypeParameter())...
[ "private", "void", "renderTag", "(", "Tag", "tag", ",", "StringBuilder", "buffer", ")", "{", "buffer", ".", "append", "(", "tag", ".", "name", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "// Special handling for @param <T> tags", "// See http://do...
Renders a document tag in the standard way. @param tag input @param buffer output buffer
[ "Renders", "a", "document", "tag", "in", "the", "standard", "way", "." ]
6c43ce214e48797d2b5e8d59c31b65304279717b
https://github.com/asciidoctor/asciidoclet/blob/6c43ce214e48797d2b5e8d59c31b65304279717b/src/main/java/org/asciidoctor/asciidoclet/AsciidoctorRenderer.java#L129-L143
train
asciidoctor/asciidoclet
src/main/java/org/asciidoctor/asciidoclet/AsciidoctorRenderer.java
AsciidoctorRenderer.render
private String render(String input, boolean inline) { if (input.trim().isEmpty()) { return ""; } options.setDocType(inline ? INLINE_DOCTYPE : null); return asciidoctor.render(cleanJavadocInput(input), options); }
java
private String render(String input, boolean inline) { if (input.trim().isEmpty()) { return ""; } options.setDocType(inline ? INLINE_DOCTYPE : null); return asciidoctor.render(cleanJavadocInput(input), options); }
[ "private", "String", "render", "(", "String", "input", ",", "boolean", "inline", ")", "{", "if", "(", "input", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "return", "\"\"", ";", "}", "options", ".", "setDocType", "(", "inline", "?", ...
Renders the input using Asciidoctor. The source is first cleaned by stripping any trailing space after an end line (e.g., `"\n "`), which gets left behind by the Javadoc processor. @param input AsciiDoc source @return content rendered by Asciidoctor
[ "Renders", "the", "input", "using", "Asciidoctor", "." ]
6c43ce214e48797d2b5e8d59c31b65304279717b
https://github.com/asciidoctor/asciidoclet/blob/6c43ce214e48797d2b5e8d59c31b65304279717b/src/main/java/org/asciidoctor/asciidoclet/AsciidoctorRenderer.java#L155-L161
train
asciidoctor/asciidoclet
src/main/java/org/asciidoctor/Asciidoclet.java
Asciidoclet.validOptions
@SuppressWarnings("UnusedDeclaration") public static boolean validOptions(String[][] options, DocErrorReporter errorReporter) { return validOptions(options, errorReporter, new StandardAdapter()); }
java
@SuppressWarnings("UnusedDeclaration") public static boolean validOptions(String[][] options, DocErrorReporter errorReporter) { return validOptions(options, errorReporter, new StandardAdapter()); }
[ "@", "SuppressWarnings", "(", "\"UnusedDeclaration\"", ")", "public", "static", "boolean", "validOptions", "(", "String", "[", "]", "[", "]", "options", ",", "DocErrorReporter", "errorReporter", ")", "{", "return", "validOptions", "(", "options", ",", "errorReport...
Processes the input options by delegating to the standard handler. _Javadoc spec requirement._ @param options input option array @param errorReporter error handling @return success
[ "Processes", "the", "input", "options", "by", "delegating", "to", "the", "standard", "handler", "." ]
6c43ce214e48797d2b5e8d59c31b65304279717b
https://github.com/asciidoctor/asciidoclet/blob/6c43ce214e48797d2b5e8d59c31b65304279717b/src/main/java/org/asciidoctor/Asciidoclet.java#L254-L257
train
asciidoctor/asciidoclet
src/main/java/org/asciidoctor/asciidoclet/DocletIterator.java
DocletIterator.render
public boolean render(RootDoc rootDoc, DocletRenderer renderer) { if (!processOverview(rootDoc, renderer)) { return false; } Set<PackageDoc> packages = new HashSet<PackageDoc>(); for (ClassDoc doc : rootDoc.classes()) { packages.add(doc.containingPackage()); ...
java
public boolean render(RootDoc rootDoc, DocletRenderer renderer) { if (!processOverview(rootDoc, renderer)) { return false; } Set<PackageDoc> packages = new HashSet<PackageDoc>(); for (ClassDoc doc : rootDoc.classes()) { packages.add(doc.containingPackage()); ...
[ "public", "boolean", "render", "(", "RootDoc", "rootDoc", ",", "DocletRenderer", "renderer", ")", "{", "if", "(", "!", "processOverview", "(", "rootDoc", ",", "renderer", ")", ")", "{", "return", "false", ";", "}", "Set", "<", "PackageDoc", ">", "packages"...
Renders a RootDoc's contents. @param rootDoc @param renderer
[ "Renders", "a", "RootDoc", "s", "contents", "." ]
6c43ce214e48797d2b5e8d59c31b65304279717b
https://github.com/asciidoctor/asciidoclet/blob/6c43ce214e48797d2b5e8d59c31b65304279717b/src/main/java/org/asciidoctor/asciidoclet/DocletIterator.java#L49-L62
train