id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
104,700
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseToArray.java
UseToArray.visitCode
@Override public void visitCode(Code obj) { try { userValues = new HashMap<>(); super.visitCode(obj); } finally { userValues = null; } }
java
@Override public void visitCode(Code obj) { try { userValues = new HashMap<>(); super.visitCode(obj); } finally { userValues = null; } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "userValues", "=", "new", "HashMap", "<>", "(", ")", ";", "super", ".", "visitCode", "(", "obj", ")", ";", "}", "finally", "{", "userValues", "=", "null", ";", ...
implements the visitor to reset the uservalues @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "reset", "the", "uservalues" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseToArray.java#L64-L72
104,701
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
DeprecatedTypesafeEnumPattern.visitClassContext
@Override public void visitClassContext(ClassContext context) { try { JavaClass cls = context.getJavaClass(); if (!cls.isEnum() && (cls.getMajor() >= Const.MAJOR_1_5)) { Method[] methods = cls.getMethods(); for (Method m : methods) { ...
java
@Override public void visitClassContext(ClassContext context) { try { JavaClass cls = context.getJavaClass(); if (!cls.isEnum() && (cls.getMajor() >= Const.MAJOR_1_5)) { Method[] methods = cls.getMethods(); for (Method m : methods) { ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "context", ")", "{", "try", "{", "JavaClass", "cls", "=", "context", ".", "getJavaClass", "(", ")", ";", "if", "(", "!", "cls", ".", "isEnum", "(", ")", "&&", "(", "cls", ".",...
implements the visitor to look for classes compiled with 1.5 or better that have all constructors that are private @param context the currently parsed class context object
[ "implements", "the", "visitor", "to", "look", "for", "classes", "compiled", "with", "1", ".", "5", "or", "better", "that", "have", "all", "constructors", "that", "are", "private" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java#L70-L89
104,702
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
DeprecatedTypesafeEnumPattern.visitField
@Override public void visitField(Field obj) { if (obj.isStatic() && obj.isPublic() && obj.isFinal()) { JavaClass cls = getClassContext().getJavaClass(); if (!obj.isEnum()) { String fieldClass = obj.getSignature(); if (fieldClass.startsWith(Values.SIG_Q...
java
@Override public void visitField(Field obj) { if (obj.isStatic() && obj.isPublic() && obj.isFinal()) { JavaClass cls = getClassContext().getJavaClass(); if (!obj.isEnum()) { String fieldClass = obj.getSignature(); if (fieldClass.startsWith(Values.SIG_Q...
[ "@", "Override", "public", "void", "visitField", "(", "Field", "obj", ")", "{", "if", "(", "obj", ".", "isStatic", "(", ")", "&&", "obj", ".", "isPublic", "(", ")", "&&", "obj", ".", "isFinal", "(", ")", ")", "{", "JavaClass", "cls", "=", "getClass...
implements the visitor to look for fields that are public static final and are the same type as the owning class. it collects these object names for later @param obj the context object of the currently parsed field
[ "implements", "the", "visitor", "to", "look", "for", "fields", "that", "are", "public", "static", "final", "and", "are", "the", "same", "type", "as", "the", "owning", "class", ".", "it", "collects", "these", "object", "names", "for", "later" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java#L98-L114
104,703
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
DeprecatedTypesafeEnumPattern.visitCode
@Override public void visitCode(Code obj) { if (Values.STATIC_INITIALIZER.equals(getMethod().getName())) { state = State.SAW_NOTHING; super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { if (Values.STATIC_INITIALIZER.equals(getMethod().getName())) { state = State.SAW_NOTHING; super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "getMethod", "(", ")", ".", "getName", "(", ")", ")", ")", "{", "state", "=", "State", ".", "SAW_NOTHING",...
implements the visitor to look for static initializers to find enum generation @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "look", "for", "static", "initializers", "to", "find", "enum", "generation" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java#L122-L128
104,704
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
DeprecatedTypesafeEnumPattern.sawOpcode
@Override public void sawOpcode(int seen) { if (state == State.SAW_NOTHING) { if (seen == Const.INVOKESPECIAL) { state = State.SAW_INVOKESPECIAL; } } else if (state == State.SAW_INVOKESPECIAL) { handleInvokeSpecialState(seen); } }
java
@Override public void sawOpcode(int seen) { if (state == State.SAW_NOTHING) { if (seen == Const.INVOKESPECIAL) { state = State.SAW_INVOKESPECIAL; } } else if (state == State.SAW_INVOKESPECIAL) { handleInvokeSpecialState(seen); } }
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "state", "==", "State", ".", "SAW_NOTHING", ")", "{", "if", "(", "seen", "==", "Const", ".", "INVOKESPECIAL", ")", "{", "state", "=", "State", ".", "SAW_INVOKESPEC...
implements the visitor to find allocations of TypesafeEnum Const @param seen the currently parsed opcode
[ "implements", "the", "visitor", "to", "find", "allocations", "of", "TypesafeEnum", "Const" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java#L136-L145
104,705
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
CollectStatistics.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); constrainingMethods = buildConstrainingMethods(cls); AnnotationEntry[] annotations = cls.getAnnotationEntries(); classHasAnnotation = !Colle...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); constrainingMethods = buildConstrainingMethods(cls); AnnotationEntry[] annotations = cls.getAnnotationEntries(); classHasAnnotation = !Colle...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "constrainingMethods", "=", "buildConstrainingMethods", "(", "cls", ")",...
implements the visitor to collect statistics on this class @param classContext the currently class
[ "implements", "the", "visitor", "to", "collect", "statistics", "on", "this", "class" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java#L97-L116
104,706
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
PossibleConstantAllocationInLoop.isFirstUse
private boolean isFirstUse(int reg) { LocalVariableTable lvt = getMethod().getLocalVariableTable(); if (lvt == null) { return true; } LocalVariable lv = lvt.getLocalVariable(reg, getPC()); return lv == null; }
java
private boolean isFirstUse(int reg) { LocalVariableTable lvt = getMethod().getLocalVariableTable(); if (lvt == null) { return true; } LocalVariable lv = lvt.getLocalVariable(reg, getPC()); return lv == null; }
[ "private", "boolean", "isFirstUse", "(", "int", "reg", ")", "{", "LocalVariableTable", "lvt", "=", "getMethod", "(", ")", ".", "getLocalVariableTable", "(", ")", ";", "if", "(", "lvt", "==", "null", ")", "{", "return", "true", ";", "}", "LocalVariable", ...
looks to see if this register has already in scope or whether is a new assignment. return true if it's a new assignment. If you can't tell, return true anyway. might want to change. @param reg the store register @return whether this is a new register scope assignment
[ "looks", "to", "see", "if", "this", "register", "has", "already", "in", "scope", "or", "whether", "is", "a", "new", "assignment", ".", "return", "true", "if", "it", "s", "a", "new", "assignment", ".", "If", "you", "can", "t", "tell", "return", "true", ...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java#L347-L355
104,707
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
CopiedOverriddenMethod.visitClassContext
@Override public void visitClassContext(ClassContext clsContext) { try { JavaClass cls = clsContext.getJavaClass(); String superName = cls.getSuperclassName(); if (!Values.DOTTED_JAVA_LANG_OBJECT.equals(superName)) { this.classContext = clsContext; ...
java
@Override public void visitClassContext(ClassContext clsContext) { try { JavaClass cls = clsContext.getJavaClass(); String superName = cls.getSuperclassName(); if (!Values.DOTTED_JAVA_LANG_OBJECT.equals(superName)) { this.classContext = clsContext; ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "clsContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "clsContext", ".", "getJavaClass", "(", ")", ";", "String", "superName", "=", "cls", ".", "getSuperclassName", "(", ")", ...
overrides the visitor to accept classes derived from non java.lang.Object classes. @param clsContext the context object of the currently parsed class
[ "overrides", "the", "visitor", "to", "accept", "classes", "derived", "from", "non", "java", ".", "lang", ".", "Object", "classes", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java#L83-L113
104,708
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
CopiedOverriddenMethod.visitCode
@Override public void visitCode(Code obj) { try { Method m = getMethod(); if ((!m.isPublic() && !m.isProtected()) || m.isAbstract() || m.isSynthetic()) { return; } CodeInfo superCode = superclassCode.remove(curMethodInfo); if (supe...
java
@Override public void visitCode(Code obj) { try { Method m = getMethod(); if ((!m.isPublic() && !m.isProtected()) || m.isAbstract() || m.isSynthetic()) { return; } CodeInfo superCode = superclassCode.remove(curMethodInfo); if (supe...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "(", "!", "m", ".", "isPublic", "(", ")", "&&", "!", "m", ".", "isProtected", "(", ")", ")", "|...
overrides the visitor to find code blocks of methods that are the same as its parents @param obj the code object of the currently parsed method
[ "overrides", "the", "visitor", "to", "find", "code", "blocks", "of", "methods", "that", "are", "the", "same", "as", "its", "parents" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java#L132-L163
104,709
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
CopiedOverriddenMethod.sawOpcode
@Override public void sawOpcode(int seen) { if (!sawAload0) { if (seen == Const.ALOAD_0) { sawAload0 = true; } else { throw new StopOpcodeParsingException(); } } else if (nextParmIndex < parmTypes.length) { if (isExpect...
java
@Override public void sawOpcode(int seen) { if (!sawAload0) { if (seen == Const.ALOAD_0) { sawAload0 = true; } else { throw new StopOpcodeParsingException(); } } else if (nextParmIndex < parmTypes.length) { if (isExpect...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "!", "sawAload0", ")", "{", "if", "(", "seen", "==", "Const", ".", "ALOAD_0", ")", "{", "sawAload0", "=", "true", ";", "}", "else", "{", "throw", "new", "StopO...
overrides the visitor to look for an exact call to the parent class's method using this methods parm. @param seen the currently parsed instruction
[ "overrides", "the", "visitor", "to", "look", "for", "an", "exact", "call", "to", "the", "parent", "class", "s", "method", "using", "this", "methods", "parm", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java#L172-L206
104,710
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
CopiedOverriddenMethod.sameAccess
private static boolean sameAccess(int parentAccess, int childAccess) { return ((parentAccess & (Const.ACC_PUBLIC | Const.ACC_PROTECTED)) == (childAccess & (Const.ACC_PUBLIC | Const.ACC_PROTECTED))); }
java
private static boolean sameAccess(int parentAccess, int childAccess) { return ((parentAccess & (Const.ACC_PUBLIC | Const.ACC_PROTECTED)) == (childAccess & (Const.ACC_PUBLIC | Const.ACC_PROTECTED))); }
[ "private", "static", "boolean", "sameAccess", "(", "int", "parentAccess", ",", "int", "childAccess", ")", "{", "return", "(", "(", "parentAccess", "&", "(", "Const", ".", "ACC_PUBLIC", "|", "Const", ".", "ACC_PROTECTED", ")", ")", "==", "(", "childAccess", ...
determines if two access flags contain the same access modifiers @param parentAccess the access flags of the parent method @param childAccess the access flats of the child method @return whether the access modifiers are the same
[ "determines", "if", "two", "access", "flags", "contain", "the", "same", "access", "modifiers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java#L255-L257
104,711
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/TailRecursion.java
TailRecursion.visitMethod
@Override public void visitMethod(Method obj) { Code c = obj.getCode(); if (c != null) { byte[] opcodes = c.getCode(); if (opcodes != null) { trPCPos = opcodes.length - 1; if (!obj.getSignature().endsWith(Values.SIG_VOID)) { ...
java
@Override public void visitMethod(Method obj) { Code c = obj.getCode(); if (c != null) { byte[] opcodes = c.getCode(); if (opcodes != null) { trPCPos = opcodes.length - 1; if (!obj.getSignature().endsWith(Values.SIG_VOID)) { ...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "Code", "c", "=", "obj", ".", "getCode", "(", ")", ";", "if", "(", "c", "!=", "null", ")", "{", "byte", "[", "]", "opcodes", "=", "c", ".", "getCode", "(", ")", "...
implements the visitor to figure the pc where the method call must occur depending on whether the method returns a value, or not. @param obj the context object of the currently parsed method
[ "implements", "the", "visitor", "to", "figure", "the", "pc", "where", "the", "method", "call", "must", "occur", "depending", "on", "whether", "the", "method", "returns", "a", "value", "or", "not", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/TailRecursion.java#L80-L97
104,712
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/TailRecursion.java
TailRecursion.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKEVIRTUAL) { checkForTailRecursion(); } } finally { stack.sawOpcode(this, seen); } }
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKEVIRTUAL) { checkForTailRecursion(); } } finally { stack.sawOpcode(this, seen); } }
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "seen", "==", "Const", ".", "INVOKEVIRTUAL", ")", "{", "checkForTailRecursion", "(", ")", ";", "...
implements the visitor to find methods that employ tail recursion @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "find", "methods", "that", "employ", "tail", "recursion" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/TailRecursion.java#L105-L116
104,713
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java
NonCollectionMethodUse.sawOpcode
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEVIRTUAL) { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); String methodSig = getSigConstantOperand(); FQMethod methodInfo = new FQMethod(className...
java
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEVIRTUAL) { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); String methodSig = getSigConstantOperand(); FQMethod methodInfo = new FQMethod(className...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "INVOKEVIRTUAL", ")", "{", "String", "className", "=", "getClassConstantOperand", "(", ")", ";", "String", "methodName", "=", "getNameConstan...
implements the visitor to look for method calls that are one of the old pre-collections1.2 set of methods @param seen the currently parsed opcode
[ "implements", "the", "visitor", "to", "look", "for", "method", "calls", "that", "are", "one", "of", "the", "old", "pre", "-", "collections1", ".", "2", "set", "of", "methods" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java#L70-L83
104,714
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java
OrphanedDOMNode.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); nodeCreations = new HashMap<>(); nodeStores = new HashMap<>(); super.visitClassContext(classContext); } finally { stack = null; ...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); nodeCreations = new HashMap<>(); nodeStores = new HashMap<>(); super.visitClassContext(classContext); } finally { stack = null; ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "nodeCreations", "=", "new", "HashMap", "<>", "(", ")", ";", "nodeStores", "=", "new", "Ha...
implements the visitor to create and clear the stack, node creations and store maps @param classContext the context object for the currently parsed class
[ "implements", "the", "visitor", "to", "create", "and", "clear", "the", "stack", "node", "creations", "and", "store", "maps" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java#L75-L87
104,715
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java
OrphanedDOMNode.visitCode
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); nodeCreations.clear(); nodeStores.clear(); super.visitCode(obj); BitSet reportedPCs = new BitSet(); for (Integer pc : nodeCreations.values()) { if (!reportedPCs.get(pc.intValue()...
java
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); nodeCreations.clear(); nodeStores.clear(); super.visitCode(obj); BitSet reportedPCs = new BitSet(); for (Integer pc : nodeCreations.values()) { if (!reportedPCs.get(pc.intValue()...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "nodeCreations", ".", "clear", "(", ")", ";", "nodeStores", ".", "clear", "(", ")", ";", "super", ".", "visitCode", ...
implements the visitor to clear the opcode stack for the next code @param obj the context object for the currently parsed code block
[ "implements", "the", "visitor", "to", "clear", "the", "opcode", "stack", "for", "the", "next", "code" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java#L95-L117
104,716
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java
OrphanedDOMNode.findDOMNodeCreationPoint
@Nullable private Integer findDOMNodeCreationPoint(int index) { if (stack.getStackDepth() <= index) { return null; } return nodeCreations.remove(stack.getStackItem(index)); }
java
@Nullable private Integer findDOMNodeCreationPoint(int index) { if (stack.getStackDepth() <= index) { return null; } return nodeCreations.remove(stack.getStackItem(index)); }
[ "@", "Nullable", "private", "Integer", "findDOMNodeCreationPoint", "(", "int", "index", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", "<=", "index", ")", "{", "return", "null", ";", "}", "return", "nodeCreations", ".", "remove", "(", "stack...
returns the pc where this DOM Node was created, or null if this isn't a DOM node that was created @param index the index into the stack of the item to be checked @return the pc where this NODE was created, or null
[ "returns", "the", "pc", "where", "this", "DOM", "Node", "was", "created", "or", "null", "if", "this", "isn", "t", "a", "DOM", "node", "that", "was", "created" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java#L198-L205
104,717
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
AbstractClassEmptyMethods.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (cls.isAbstract()) { interfaceMethods = collectInterfaceMethods(cls); super.visitClassContext(classContext); } ...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (cls.isAbstract()) { interfaceMethods = collectInterfaceMethods(cls); super.visitClassContext(classContext); } ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "cls", ".", "isAbstract", "(", ")", ")", "{", "interf...
overrides the visitor to check for abstract classes. @param classContext the context object that holds the JavaClass being parsed
[ "overrides", "the", "visitor", "to", "check", "for", "abstract", "classes", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java#L77-L90
104,718
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
AbstractClassEmptyMethods.visitCode
@Override public void visitCode(Code obj) { if (Values.CONSTRUCTOR.equals(methodName) || Values.STATIC_INITIALIZER.equals(methodName)) { return; } Method m = getMethod(); if (m.isSynthetic()) { return; } if (!interfaceMethods.contains(new QMe...
java
@Override public void visitCode(Code obj) { if (Values.CONSTRUCTOR.equals(methodName) || Values.STATIC_INITIALIZER.equals(methodName)) { return; } Method m = getMethod(); if (m.isSynthetic()) { return; } if (!interfaceMethods.contains(new QMe...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "Values", ".", "CONSTRUCTOR", ".", "equals", "(", "methodName", ")", "||", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "methodName", ")", ")", "{", "ret...
overrides the visitor to filter out constructors. @param obj the code to parse
[ "overrides", "the", "visitor", "to", "filter", "out", "constructors", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java#L110-L124
104,719
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
AbstractClassEmptyMethods.sawOpcode
@Override public void sawOpcode(int seen) { try { switch (state) { case SAW_NOTHING: if (seen == Const.RETURN) { bugReporter.reportBug(new BugInstance(this, BugType.ACEM_ABSTRACT_CLASS_EMPTY_METHODS.name(), NORMAL_PRIORITY).addClass(thi...
java
@Override public void sawOpcode(int seen) { try { switch (state) { case SAW_NOTHING: if (seen == Const.RETURN) { bugReporter.reportBug(new BugInstance(this, BugType.ACEM_ABSTRACT_CLASS_EMPTY_METHODS.name(), NORMAL_PRIORITY).addClass(thi...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "switch", "(", "state", ")", "{", "case", "SAW_NOTHING", ":", "if", "(", "seen", "==", "Const", ".", "RETURN", ")", "{", "bugReporter", ".", "reportBug", "(", "...
overrides the visitor to look for empty methods or simple exception throwers. @param seen the opcode currently being parsed
[ "overrides", "the", "visitor", "to", "look", "for", "empty", "methods", "or", "simple", "exception", "throwers", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java#L132-L193
104,720
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java
ManualArrayCopy.prescreen
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && bytecodeSet.intersects(arrayLoadOps); }
java
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && bytecodeSet.intersects(arrayLoadOps); }
[ "private", "boolean", "prescreen", "(", "Method", "method", ")", "{", "BitSet", "bytecodeSet", "=", "getClassContext", "(", ")", ".", "getBytecodeSet", "(", "method", ")", ";", "return", "(", "bytecodeSet", "!=", "null", ")", "&&", "bytecodeSet", ".", "inter...
looks for methods that contain array load opcodes @param method the context object of the current method @return if the class loads array contents
[ "looks", "for", "methods", "that", "contain", "array", "load", "opcodes" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java#L77-L80
104,721
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java
ManualArrayCopy.similarArrayInstructions
private static boolean similarArrayInstructions(int load, int store) { return ((load == Const.AALOAD) && (store == Const.AASTORE)) || ((load == Const.IALOAD) && (store == Const.IASTORE)) || ((load == Const.DALOAD) && (store == Const.DASTORE)) || ((load == Const.LALOAD) && (store == Const.LASTORE...
java
private static boolean similarArrayInstructions(int load, int store) { return ((load == Const.AALOAD) && (store == Const.AASTORE)) || ((load == Const.IALOAD) && (store == Const.IASTORE)) || ((load == Const.DALOAD) && (store == Const.DASTORE)) || ((load == Const.LALOAD) && (store == Const.LASTORE...
[ "private", "static", "boolean", "similarArrayInstructions", "(", "int", "load", ",", "int", "store", ")", "{", "return", "(", "(", "load", "==", "Const", ".", "AALOAD", ")", "&&", "(", "store", "==", "Const", ".", "AASTORE", ")", ")", "||", "(", "(", ...
looks to see if a load and store operation are working on the same type of array @param load the load instruction on an array @param store the store instruction on an array @return whether the type of the load and store are the same
[ "looks", "to", "see", "if", "a", "load", "and", "store", "operation", "are", "working", "on", "the", "same", "type", "of", "array" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java#L196-L201
104,722
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java
ConfusingFunctionSemantics.visitCode
@Override public void visitCode(Code obj) { try { possibleParmRegs.clear(); Method m = getMethod(); String methodSignature = m.getSignature(); String retSignature = SignatureUtils.getReturnSignature(methodSignature); JavaClass returnClass = null; ...
java
@Override public void visitCode(Code obj) { try { possibleParmRegs.clear(); Method m = getMethod(); String methodSignature = m.getSignature(); String retSignature = SignatureUtils.getReturnSignature(methodSignature); JavaClass returnClass = null; ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "possibleParmRegs", ".", "clear", "(", ")", ";", "Method", "m", "=", "getMethod", "(", ")", ";", "String", "methodSignature", "=", "m", ".", "getSignature", "(", ...
implements the visitor to look for any non-immutable typed parameters are assignable to the return type. If found, the method is parsed. @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "look", "for", "any", "non", "-", "immutable", "typed", "parameters", "are", "assignable", "to", "the", "return", "type", ".", "If", "found", "the", "method", "is", "parsed", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java#L109-L156
104,723
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/CollectionUtils.java
CollectionUtils.isListSetMap
public static boolean isListSetMap(String clsName) throws ClassNotFoundException { JavaClass cls = Repository.lookupClass(clsName); return (cls.implementationOf(LIST_CLASS) || cls.implementationOf(SET_CLASS) || cls.implementationOf(MAP_CLASS)); }
java
public static boolean isListSetMap(String clsName) throws ClassNotFoundException { JavaClass cls = Repository.lookupClass(clsName); return (cls.implementationOf(LIST_CLASS) || cls.implementationOf(SET_CLASS) || cls.implementationOf(MAP_CLASS)); }
[ "public", "static", "boolean", "isListSetMap", "(", "String", "clsName", ")", "throws", "ClassNotFoundException", "{", "JavaClass", "cls", "=", "Repository", ".", "lookupClass", "(", "clsName", ")", ";", "return", "(", "cls", ".", "implementationOf", "(", "LIST_...
determines if the current class name is derived from List, Set or Map @param clsName the class to determine it's parentage @return if the class is a List, Set or Map @throws ClassNotFoundException if the cls parameter can't be found
[ "determines", "if", "the", "current", "class", "name", "is", "derived", "from", "List", "Set", "or", "Map" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/CollectionUtils.java#L62-L65
104,724
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java
NonSymmetricEquals.prescreen
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.CHECKCAST)); }
java
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.CHECKCAST)); }
[ "private", "boolean", "prescreen", "(", "Method", "method", ")", "{", "BitSet", "bytecodeSet", "=", "getClassContext", "(", ")", ".", "getBytecodeSet", "(", "method", ")", ";", "return", "(", "bytecodeSet", "!=", "null", ")", "&&", "(", "bytecodeSet", ".", ...
looks for methods that contain a checkcast instruction @param method the context object of the current method @return if the class does checkcast instructions
[ "looks", "for", "methods", "that", "contain", "a", "checkcast", "instruction" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java#L102-L105
104,725
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java
NonSymmetricEquals.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.CHECKCAST) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); if (item.getRegisterNumber() == 1) { Strin...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.CHECKCAST) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); if (item.getRegisterNumber() == 1) { Strin...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "(", "seen", "==", "Const", ".", "CHECKCAST", ")", "&&", "(", "stack", ".", "getStackDepth", "...
implements the visitor to look for checkcasts of the parameter to other types, and enter instances in a map for further processing in doReport. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "checkcasts", "of", "the", "parameter", "to", "other", "types", "and", "enter", "instances", "in", "a", "map", "for", "further", "processing", "in", "doReport", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java#L113-L144
104,726
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java
NonSymmetricEquals.report
@Override public void report() { for (Map.Entry<String, Map<String, BugInstance>> thisEntry : possibleBugs.entrySet()) { Map<String, BugInstance> equalsClassesMap = thisEntry.getValue(); for (Map.Entry<String, BugInstance> equalsEntry : equalsClassesMap.entrySet()) { ...
java
@Override public void report() { for (Map.Entry<String, Map<String, BugInstance>> thisEntry : possibleBugs.entrySet()) { Map<String, BugInstance> equalsClassesMap = thisEntry.getValue(); for (Map.Entry<String, BugInstance> equalsEntry : equalsClassesMap.entrySet()) { ...
[ "@", "Override", "public", "void", "report", "(", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Map", "<", "String", ",", "BugInstance", ">", ">", "thisEntry", ":", "possibleBugs", ".", "entrySet", "(", ")", ")", "{", "Map", "<", ...
reports all the collected issues from the parse of this class
[ "reports", "all", "the", "collected", "issues", "from", "the", "parse", "of", "this", "class" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java#L149-L170
104,727
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { ignoreRegs = new BitSet(); tryBlocks = new BitSet(); catchHandlers = new BitSet(); switchTargets = new BitSet(); monitorSyncPCs = new ArrayList<>(5); stack = new...
java
@Override public void visitClassContext(ClassContext classContext) { try { ignoreRegs = new BitSet(); tryBlocks = new BitSet(); catchHandlers = new BitSet(); switchTargets = new BitSet(); monitorSyncPCs = new ArrayList<>(5); stack = new...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "ignoreRegs", "=", "new", "BitSet", "(", ")", ";", "tryBlocks", "=", "new", "BitSet", "(", ")", ";", "catchHandlers", "=", "new", "BitSet", "...
implements the visitor to create and the clear the register to location map @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "create", "and", "the", "clear", "the", "register", "to", "location", "map" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L126-L144
104,728
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.visitCode
@Override public void visitCode(Code obj) { try { ignoreRegs.clear(); Method method = getMethod(); if (!method.isStatic()) { ignoreRegs.set(0); } int[] parmRegs = RegisterUtils.getParameterRegisters(method); for (int p...
java
@Override public void visitCode(Code obj) { try { ignoreRegs.clear(); Method method = getMethod(); if (!method.isStatic()) { ignoreRegs.set(0); } int[] parmRegs = RegisterUtils.getParameterRegisters(method); for (int p...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "ignoreRegs", ".", "clear", "(", ")", ";", "Method", "method", "=", "getMethod", "(", ")", ";", "if", "(", "!", "method", ".", "isStatic", "(", ")", ")", "{",...
implements the visitor to reset the register to location map @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "reset", "the", "register", "to", "location", "map" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L152-L192
104,729
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawOpcode
@Override public void sawOpcode(int seen) { UserObject uo = null; try { stack.precomputation(this); int pc = getPC(); if (tryBlocks.get(pc)) { ScopeBlock sb = new ScopeBlock(pc, findCatchHandlerFor(pc)); sb.setTry(); ...
java
@Override public void sawOpcode(int seen) { UserObject uo = null; try { stack.precomputation(this); int pc = getPC(); if (tryBlocks.get(pc)) { ScopeBlock sb = new ScopeBlock(pc, findCatchHandlerFor(pc)); sb.setTry(); ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "UserObject", "uo", "=", "null", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "int", "pc", "=", "getPC", "(", ")", ";", "if", "(", "tryBlocks", ...
implements the visitor to look for variables assigned below the scope in which they are used. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "variables", "assigned", "below", "the", "scope", "in", "which", "they", "are", "used", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L200-L248
104,730
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawStore
private void sawStore(int seen, int pc) { int reg = RegisterUtils.getStoreReg(this, seen); if (catchHandlers.get(pc)) { ignoreRegs.set(reg); ScopeBlock catchSB = findScopeBlock(rootScopeBlock, pc + 1); if ((catchSB != null) && (catchSB.getStart() < pc)) { ...
java
private void sawStore(int seen, int pc) { int reg = RegisterUtils.getStoreReg(this, seen); if (catchHandlers.get(pc)) { ignoreRegs.set(reg); ScopeBlock catchSB = findScopeBlock(rootScopeBlock, pc + 1); if ((catchSB != null) && (catchSB.getStart() < pc)) { ...
[ "private", "void", "sawStore", "(", "int", "seen", ",", "int", "pc", ")", "{", "int", "reg", "=", "RegisterUtils", ".", "getStoreReg", "(", "this", ",", "seen", ")", ";", "if", "(", "catchHandlers", ".", "get", "(", "pc", ")", ")", "{", "ignoreRegs",...
processes a register store by updating the appropriate scope block to mark this register as being stored in the block @param seen the currently parsed opcode @param pc the current program counter
[ "processes", "a", "register", "store", "by", "updating", "the", "appropriate", "scope", "block", "to", "mark", "this", "register", "as", "being", "stored", "in", "the", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L258-L308
104,731
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawIINC
private void sawIINC(int pc) { int reg = getRegisterOperand(); if (!ignoreRegs.get(reg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { sb.addLoad(reg, pc); } else { ignoreRegs.set(reg); } } ...
java
private void sawIINC(int pc) { int reg = getRegisterOperand(); if (!ignoreRegs.get(reg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { sb.addLoad(reg, pc); } else { ignoreRegs.set(reg); } } ...
[ "private", "void", "sawIINC", "(", "int", "pc", ")", "{", "int", "reg", "=", "getRegisterOperand", "(", ")", ";", "if", "(", "!", "ignoreRegs", ".", "get", "(", "reg", ")", ")", "{", "ScopeBlock", "sb", "=", "findScopeBlock", "(", "rootScopeBlock", ","...
processes a register IINC by updating the appropriate scope block to mark this register as being stored in the block @param pc the current program counter
[ "processes", "a", "register", "IINC", "by", "updating", "the", "appropriate", "scope", "block", "to", "mark", "this", "register", "as", "being", "stored", "in", "the", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L316-L345
104,732
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawLoad
private void sawLoad(int seen, int pc) { int reg = RegisterUtils.getLoadReg(this, seen); if (!ignoreRegs.get(reg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { sb.addLoad(reg, pc); } else { ignoreRegs.set(reg)...
java
private void sawLoad(int seen, int pc) { int reg = RegisterUtils.getLoadReg(this, seen); if (!ignoreRegs.get(reg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { sb.addLoad(reg, pc); } else { ignoreRegs.set(reg)...
[ "private", "void", "sawLoad", "(", "int", "seen", ",", "int", "pc", ")", "{", "int", "reg", "=", "RegisterUtils", ".", "getLoadReg", "(", "this", ",", "seen", ")", ";", "if", "(", "!", "ignoreRegs", ".", "get", "(", "reg", ")", ")", "{", "ScopeBloc...
processes a register store by updating the appropriate scope block to mark this register as being read in the block @param seen the currently parsed opcode @param pc the current program counter
[ "processes", "a", "register", "store", "by", "updating", "the", "appropriate", "scope", "block", "to", "mark", "this", "register", "as", "being", "read", "in", "the", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L355-L365
104,733
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawBranch
private void sawBranch(int seen, int pc) { int target = getBranchTarget(); if (target > pc) { if ((seen == Const.GOTO) || (seen == Const.GOTO_W)) { int nextPC = getNextPC(); if (!switchTargets.get(nextPC)) { ScopeBlock sb = findScopeBlockWi...
java
private void sawBranch(int seen, int pc) { int target = getBranchTarget(); if (target > pc) { if ((seen == Const.GOTO) || (seen == Const.GOTO_W)) { int nextPC = getNextPC(); if (!switchTargets.get(nextPC)) { ScopeBlock sb = findScopeBlockWi...
[ "private", "void", "sawBranch", "(", "int", "seen", ",", "int", "pc", ")", "{", "int", "target", "=", "getBranchTarget", "(", ")", ";", "if", "(", "target", ">", "pc", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "GOTO", ")", "||", "(", ...
creates a scope block to describe this branch location. @param seen the currently parsed opcode @param pc the current program counter
[ "creates", "a", "scope", "block", "to", "describe", "this", "branch", "location", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L375-L435
104,734
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawSwitch
private void sawSwitch(int pc) { int[] offsets = getSwitchOffsets(); List<Integer> targets = new ArrayList<>(offsets.length); for (int offset : offsets) { targets.add(Integer.valueOf(offset + pc)); } Integer defOffset = Integer.valueOf(getDefaultSwitchOffset() + pc); ...
java
private void sawSwitch(int pc) { int[] offsets = getSwitchOffsets(); List<Integer> targets = new ArrayList<>(offsets.length); for (int offset : offsets) { targets.add(Integer.valueOf(offset + pc)); } Integer defOffset = Integer.valueOf(getDefaultSwitchOffset() + pc); ...
[ "private", "void", "sawSwitch", "(", "int", "pc", ")", "{", "int", "[", "]", "offsets", "=", "getSwitchOffsets", "(", ")", ";", "List", "<", "Integer", ">", "targets", "=", "new", "ArrayList", "<>", "(", "offsets", ".", "length", ")", ";", "for", "("...
creates a new scope block for each case statement @param pc the current program counter
[ "creates", "a", "new", "scope", "block", "for", "each", "case", "statement" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L443-L466
104,735
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawStaticCall
@Nullable private UserObject sawStaticCall() { if (getSigConstantOperand().endsWith(Values.SIG_VOID)) { return null; } return new UserObject(isRiskyMethodCall()); }
java
@Nullable private UserObject sawStaticCall() { if (getSigConstantOperand().endsWith(Values.SIG_VOID)) { return null; } return new UserObject(isRiskyMethodCall()); }
[ "@", "Nullable", "private", "UserObject", "sawStaticCall", "(", ")", "{", "if", "(", "getSigConstantOperand", "(", ")", ".", "endsWith", "(", "Values", ".", "SIG_VOID", ")", ")", "{", "return", "null", ";", "}", "return", "new", "UserObject", "(", "isRisky...
processes a static call or initializer by checking to see if the call is risky, and returning a OpcodeStack item user value saying so. @return the user object to place on the OpcodeStack
[ "processes", "a", "static", "call", "or", "initializer", "by", "checking", "to", "see", "if", "the", "call", "is", "risky", "and", "returning", "a", "OpcodeStack", "item", "user", "value", "saying", "so", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L510-L518
104,736
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawMonitorEnter
private void sawMonitorEnter(int pc) { monitorSyncPCs.add(Integer.valueOf(pc)); ScopeBlock sb = new ScopeBlock(pc, Integer.MAX_VALUE); sb.setSync(); rootScopeBlock.addChild(sb); }
java
private void sawMonitorEnter(int pc) { monitorSyncPCs.add(Integer.valueOf(pc)); ScopeBlock sb = new ScopeBlock(pc, Integer.MAX_VALUE); sb.setSync(); rootScopeBlock.addChild(sb); }
[ "private", "void", "sawMonitorEnter", "(", "int", "pc", ")", "{", "monitorSyncPCs", ".", "add", "(", "Integer", ".", "valueOf", "(", "pc", ")", ")", ";", "ScopeBlock", "sb", "=", "new", "ScopeBlock", "(", "pc", ",", "Integer", ".", "MAX_VALUE", ")", ";...
processes a monitor enter call to create a scope block @param pc the current program counter
[ "processes", "a", "monitor", "enter", "call", "to", "create", "a", "scope", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L555-L561
104,737
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawMonitorExit
private void sawMonitorExit(int pc) { if (!monitorSyncPCs.isEmpty()) { ScopeBlock sb = findSynchronizedScopeBlock(rootScopeBlock, monitorSyncPCs.get(0).intValue()); if (sb != null) { sb.setFinish(pc); } monitorSyncPCs.remove(monitorSyncPCs.size() -...
java
private void sawMonitorExit(int pc) { if (!monitorSyncPCs.isEmpty()) { ScopeBlock sb = findSynchronizedScopeBlock(rootScopeBlock, monitorSyncPCs.get(0).intValue()); if (sb != null) { sb.setFinish(pc); } monitorSyncPCs.remove(monitorSyncPCs.size() -...
[ "private", "void", "sawMonitorExit", "(", "int", "pc", ")", "{", "if", "(", "!", "monitorSyncPCs", ".", "isEmpty", "(", ")", ")", "{", "ScopeBlock", "sb", "=", "findSynchronizedScopeBlock", "(", "rootScopeBlock", ",", "monitorSyncPCs", ".", "get", "(", "0", ...
processes a monitor exit to set the end of the already created scope block @param pc the current program counter
[ "processes", "a", "monitor", "exit", "to", "set", "the", "end", "of", "the", "already", "created", "scope", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L569-L577
104,738
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.getCallingObject
@Nullable private Comparable<?> getCallingObject() { String sig = getSigConstantOperand(); if (Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) { return null; } int numParameters = SignatureUtils.getNumParameters(sig); if (stack.getStackDepth() <=...
java
@Nullable private Comparable<?> getCallingObject() { String sig = getSigConstantOperand(); if (Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) { return null; } int numParameters = SignatureUtils.getNumParameters(sig); if (stack.getStackDepth() <=...
[ "@", "Nullable", "private", "Comparable", "<", "?", ">", "getCallingObject", "(", ")", "{", "String", "sig", "=", "getSigConstantOperand", "(", ")", ";", "if", "(", "Values", ".", "SIG_VOID", ".", "equals", "(", "SignatureUtils", ".", "getReturnSignature", "...
returns either a register number of a field reference of the object that a method is being called on, or null, if it can't be determined. @return either an Integer for a register, or a String for the field name, or null
[ "returns", "either", "a", "register", "number", "of", "a", "field", "reference", "of", "the", "object", "that", "a", "method", "is", "being", "called", "on", "or", "null", "if", "it", "can", "t", "be", "determined", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L584-L617
104,739
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.findScopeBlock
@Nullable private ScopeBlock findScopeBlock(ScopeBlock sb, int pc) { if ((pc <= sb.getStart()) || (pc >= sb.getFinish())) { return null; } List<ScopeBlock> children = sb.getChildren(); if (children != null) { for (ScopeBlock child : children) { ...
java
@Nullable private ScopeBlock findScopeBlock(ScopeBlock sb, int pc) { if ((pc <= sb.getStart()) || (pc >= sb.getFinish())) { return null; } List<ScopeBlock> children = sb.getChildren(); if (children != null) { for (ScopeBlock child : children) { ...
[ "@", "Nullable", "private", "ScopeBlock", "findScopeBlock", "(", "ScopeBlock", "sb", ",", "int", "pc", ")", "{", "if", "(", "(", "pc", "<=", "sb", ".", "getStart", "(", ")", ")", "||", "(", "pc", ">=", "sb", ".", "getFinish", "(", ")", ")", ")", ...
returns the scope block in which this register was assigned, by traversing the scope block tree @param sb the scope block to start searching in @param pc the current program counter @return the scope block or null if not found
[ "returns", "the", "scope", "block", "in", "which", "this", "register", "was", "assigned", "by", "traversing", "the", "scope", "block", "tree" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L628-L645
104,740
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.findScopeBlockWithTarget
private ScopeBlock findScopeBlockWithTarget(ScopeBlock sb, int start, int target) { ScopeBlock parentBlock = null; int finishLocation = sb.getFinish(); if ((sb.getStart() < start) && (finishLocation >= start) && ((finishLocation <= target) || (sb.isGoto() && !sb.isLoop()))) { parentB...
java
private ScopeBlock findScopeBlockWithTarget(ScopeBlock sb, int start, int target) { ScopeBlock parentBlock = null; int finishLocation = sb.getFinish(); if ((sb.getStart() < start) && (finishLocation >= start) && ((finishLocation <= target) || (sb.isGoto() && !sb.isLoop()))) { parentB...
[ "private", "ScopeBlock", "findScopeBlockWithTarget", "(", "ScopeBlock", "sb", ",", "int", "start", ",", "int", "target", ")", "{", "ScopeBlock", "parentBlock", "=", "null", ";", "int", "finishLocation", "=", "sb", ".", "getFinish", "(", ")", ";", "if", "(", ...
returns an existing scope block that has the same target as the one looked for @param sb the scope block to start with @param start the current pc @param target the target to look for @return the scope block found or null
[ "returns", "an", "existing", "scope", "block", "that", "has", "the", "same", "target", "as", "the", "one", "looked", "for" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L659-L677
104,741
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.findPreviousSiblingScopeBlock
@Nullable private ScopeBlock findPreviousSiblingScopeBlock(ScopeBlock sb) { ScopeBlock parent = sb.getParent(); if (parent == null) { return null; } List<ScopeBlock> children = parent.getChildren(); if (children == null) { return null; } ...
java
@Nullable private ScopeBlock findPreviousSiblingScopeBlock(ScopeBlock sb) { ScopeBlock parent = sb.getParent(); if (parent == null) { return null; } List<ScopeBlock> children = parent.getChildren(); if (children == null) { return null; } ...
[ "@", "Nullable", "private", "ScopeBlock", "findPreviousSiblingScopeBlock", "(", "ScopeBlock", "sb", ")", "{", "ScopeBlock", "parent", "=", "sb", ".", "getParent", "(", ")", ";", "if", "(", "parent", "==", "null", ")", "{", "return", "null", ";", "}", "List...
looks for the ScopeBlock has the same parent as this given one, but precedes it in the list. @param sb the scope block to look for the previous scope block @return the previous sibling scope block, or null if doesn't exist
[ "looks", "for", "the", "ScopeBlock", "has", "the", "same", "parent", "as", "this", "given", "one", "but", "precedes", "it", "in", "the", "list", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L686-L707
104,742
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.findSynchronizedScopeBlock
private ScopeBlock findSynchronizedScopeBlock(ScopeBlock sb, int monitorEnterPC) { ScopeBlock monitorBlock = sb; if (sb.hasChildren()) { for (ScopeBlock child : sb.getChildren()) { if (child.isSync() && (child.getStart() > monitorBlock.getStart())) { mon...
java
private ScopeBlock findSynchronizedScopeBlock(ScopeBlock sb, int monitorEnterPC) { ScopeBlock monitorBlock = sb; if (sb.hasChildren()) { for (ScopeBlock child : sb.getChildren()) { if (child.isSync() && (child.getStart() > monitorBlock.getStart())) { mon...
[ "private", "ScopeBlock", "findSynchronizedScopeBlock", "(", "ScopeBlock", "sb", ",", "int", "monitorEnterPC", ")", "{", "ScopeBlock", "monitorBlock", "=", "sb", ";", "if", "(", "sb", ".", "hasChildren", "(", ")", ")", "{", "for", "(", "ScopeBlock", "child", ...
finds the scope block that is the active synchronized block @param sb the parent scope block to start with @param monitorEnterPC the pc where the current synchronized block starts @return the scope block
[ "finds", "the", "scope", "block", "that", "is", "the", "active", "synchronized", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L718-L732
104,743
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.findCatchHandlerFor
private int findCatchHandlerFor(int pc) { CodeException[] exceptions = getMethod().getCode().getExceptionTable(); if (exceptions != null) { for (CodeException ex : exceptions) { if (ex.getStartPC() == pc) { return ex.getHandlerPC(); } ...
java
private int findCatchHandlerFor(int pc) { CodeException[] exceptions = getMethod().getCode().getExceptionTable(); if (exceptions != null) { for (CodeException ex : exceptions) { if (ex.getStartPC() == pc) { return ex.getHandlerPC(); } ...
[ "private", "int", "findCatchHandlerFor", "(", "int", "pc", ")", "{", "CodeException", "[", "]", "exceptions", "=", "getMethod", "(", ")", ".", "getCode", "(", ")", ".", "getExceptionTable", "(", ")", ";", "if", "(", "exceptions", "!=", "null", ")", "{", ...
returns the catch handler for a given try block @param pc the current instruction @return the pc of the handler for this pc if it's the start of a try block, or -1
[ "returns", "the", "catch", "handler", "for", "a", "given", "try", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L742-L753
104,744
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java
SuspiciousCloneAlgorithm.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { if (cloneableClass == null) { return; } try { JavaClass cls = classContext.getJavaClass(); if (cls.implementationOf(cloneableClass)) { stack = new OpcodeStack(); ...
java
@Override public void visitClassContext(ClassContext classContext) { if (cloneableClass == null) { return; } try { JavaClass cls = classContext.getJavaClass(); if (cls.implementationOf(cloneableClass)) { stack = new OpcodeStack(); ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "if", "(", "cloneableClass", "==", "null", ")", "{", "return", ";", "}", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")"...
override the visitor to look for classes that implement Cloneable @param classContext the context object of the class to be checked
[ "override", "the", "visitor", "to", "look", "for", "classes", "that", "implement", "Cloneable" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java#L89-L106
104,745
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java
SuspiciousCloneAlgorithm.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); if (!m.isStatic() && "clone".equals(m.getName()) && SIG_VOID_TO_OBJECT.equals(m.getSignature())) { super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if (!m.isStatic() && "clone".equals(m.getName()) && SIG_VOID_TO_OBJECT.equals(m.getSignature())) { super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "!", "m", ".", "isStatic", "(", ")", "&&", "\"clone\"", ".", "equals", "(", "m", ".", "getName", "(", ")", ")...
override the visitor to only continue for the clone method @param obj the context object of the currently parsed method
[ "override", "the", "visitor", "to", "only", "continue", "for", "the", "clone", "method" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java#L114-L120
104,746
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java
SuspiciousCloneAlgorithm.sawOpcode
@Override public void sawOpcode(int seen) { boolean srcField = false; try { stack.precomputation(this); switch (seen) { case Const.ALOAD_0: srcField = true; break; case Const.DUP: if (st...
java
@Override public void sawOpcode(int seen) { boolean srcField = false; try { stack.precomputation(this); switch (seen) { case Const.ALOAD_0: srcField = true; break; case Const.DUP: if (st...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "boolean", "srcField", "=", "false", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".", "ALOAD_0",...
override the visitor to look for stores to member fields of the source object on a clone @param seen the opcode of the currently parsed instruction
[ "override", "the", "visitor", "to", "look", "for", "stores", "to", "member", "fields", "of", "the", "source", "object", "on", "a", "clone" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java#L128-L197
104,747
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
SQLInLoop.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { queryLocations = new ArrayList<>(); loops = new ArrayList<>(); super.visitClassContext(classContext); } finally { queryLocations = null; loops = null; } ...
java
@Override public void visitClassContext(ClassContext classContext) { try { queryLocations = new ArrayList<>(); loops = new ArrayList<>(); super.visitClassContext(classContext); } finally { queryLocations = null; loops = null; } ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "queryLocations", "=", "new", "ArrayList", "<>", "(", ")", ";", "loops", "=", "new", "ArrayList", "<>", "(", ")", ";", "super", ".", "visitCl...
implements the visitor to create and clear the query locations and loops collections @param classContext the context object for the currently parsed java class
[ "implements", "the", "visitor", "to", "create", "and", "clear", "the", "query", "locations", "and", "loops", "collections" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java#L67-L77
104,748
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
SQLInLoop.visitCode
@Override public void visitCode(Code obj) { queryLocations.clear(); loops.clear(); super.visitCode(obj); for (Integer qLoc : queryLocations) { for (LoopLocation lLoc : loops) { if (lLoc.isInLoop(qLoc.intValue())) { bugReporter.reportBug...
java
@Override public void visitCode(Code obj) { queryLocations.clear(); loops.clear(); super.visitCode(obj); for (Integer qLoc : queryLocations) { for (LoopLocation lLoc : loops) { if (lLoc.isInLoop(qLoc.intValue())) { bugReporter.reportBug...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "queryLocations", ".", "clear", "(", ")", ";", "loops", ".", "clear", "(", ")", ";", "super", ".", "visitCode", "(", "obj", ")", ";", "for", "(", "Integer", "qLoc", ":", ...
implements the visitor to clear the collections, and report the query locations that are in loops @param obj the context object for the currently parsed code block
[ "implements", "the", "visitor", "to", "clear", "the", "collections", "and", "report", "the", "query", "locations", "that", "are", "in", "loops" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java#L85-L99
104,749
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
SQLInLoop.sawOpcode
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEINTERFACE) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); if (queryClasses.contains(clsName) && queryMethods.contains(methodName)) { queryLoca...
java
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEINTERFACE) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); if (queryClasses.contains(clsName) && queryMethods.contains(methodName)) { queryLoca...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "INVOKEINTERFACE", ")", "{", "String", "clsName", "=", "getClassConstantOperand", "(", ")", ";", "String", "methodName", "=", "getNameConstan...
implements the visitor to collect positions of queries and loops @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "collect", "positions", "of", "queries", "and", "loops" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java#L107-L123
104,750
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java
StaticMethodInstanceInvocation.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); if (prescreen(m)) { stack.resetForMethodEntry(this); popStack.clear(); super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if (prescreen(m)) { stack.resetForMethodEntry(this); popStack.clear(); super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "prescreen", "(", "m", ")", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "popStack", "."...
implement the visitor to reset the stack @param obj the context object of the currently parsed method
[ "implement", "the", "visitor", "to", "reset", "the", "stack" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java#L93-L101
104,751
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java
DubiousMapCollection.processMethodCall
private void processMethodCall() { int numParams = SignatureUtils.getNumParameters(getSigConstantOperand()); int depth = stack.getStackDepth(); for (int i = 0; i < numParams; i++) { if (depth > i) { OpcodeStack.Item item = stack.getStackItem(i); XFiel...
java
private void processMethodCall() { int numParams = SignatureUtils.getNumParameters(getSigConstantOperand()); int depth = stack.getStackDepth(); for (int i = 0; i < numParams; i++) { if (depth > i) { OpcodeStack.Item item = stack.getStackItem(i); XFiel...
[ "private", "void", "processMethodCall", "(", ")", "{", "int", "numParams", "=", "SignatureUtils", ".", "getNumParameters", "(", "getSigConstantOperand", "(", ")", ")", ";", "int", "depth", "=", "stack", ".", "getStackDepth", "(", ")", ";", "for", "(", "int",...
parses all the parameters of a called method and removes any of the parameters that are maps currently being looked at for this detector
[ "parses", "all", "the", "parameters", "of", "a", "called", "method", "and", "removes", "any", "of", "the", "parameters", "that", "are", "maps", "currently", "being", "looked", "at", "for", "this", "detector" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java#L235-L250
104,752
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java
OverzealousCasting.visitCode
@Override public void visitCode(Code obj) { state = State.SAW_NOTHING; lvt = obj.getLocalVariableTable(); if ((lvt != null) && prescreen(getMethod())) { super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { state = State.SAW_NOTHING; lvt = obj.getLocalVariableTable(); if ((lvt != null) && prescreen(getMethod())) { super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "state", "=", "State", ".", "SAW_NOTHING", ";", "lvt", "=", "obj", ".", "getLocalVariableTable", "(", ")", ";", "if", "(", "(", "lvt", "!=", "null", ")", "&&", "prescreen", ...
implements the visitor to set the state on entry of the code block to SAW_NOTHING, and to see if there is a local variable table @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "set", "the", "state", "on", "entry", "of", "the", "code", "block", "to", "SAW_NOTHING", "and", "to", "see", "if", "there", "is", "a", "local", "variable", "table" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java#L71-L78
104,753
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java
OverzealousCasting.sawOpcode
@Override public void sawOpcode(int seen) { switch (state) { case SAW_NOTHING: if (seen == Const.CHECKCAST) { castClass = getClassConstantOperand(); state = State.SAW_CHECKCAST; } else if (seen == Const.INVOKEINTERFACE) { ...
java
@Override public void sawOpcode(int seen) { switch (state) { case SAW_NOTHING: if (seen == Const.CHECKCAST) { castClass = getClassConstantOperand(); state = State.SAW_CHECKCAST; } else if (seen == Const.INVOKEINTERFACE) { ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "switch", "(", "state", ")", "{", "case", "SAW_NOTHING", ":", "if", "(", "seen", "==", "Const", ".", "CHECKCAST", ")", "{", "castClass", "=", "getClassConstantOperand", "(", ")...
implements the visitor to look for a checkcast followed by a astore, where the types of the objects are different. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "a", "checkcast", "followed", "by", "a", "astore", "where", "the", "types", "of", "the", "objects", "are", "different", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java#L98-L150
104,754
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
AnnotationIssues.clearAssumptions
public static void clearAssumptions(Map<Integer, Integer> assumptionTill, int pc) { Iterator<Integer> it = assumptionTill.values().iterator(); while (it.hasNext()) { if (it.next().intValue() <= pc) { it.remove(); } } }
java
public static void clearAssumptions(Map<Integer, Integer> assumptionTill, int pc) { Iterator<Integer> it = assumptionTill.values().iterator(); while (it.hasNext()) { if (it.next().intValue() <= pc) { it.remove(); } } }
[ "public", "static", "void", "clearAssumptions", "(", "Map", "<", "Integer", ",", "Integer", ">", "assumptionTill", ",", "int", "pc", ")", "{", "Iterator", "<", "Integer", ">", "it", "=", "assumptionTill", ".", "values", "(", ")", ".", "iterator", "(", ")...
the map is keyed by register, and value by when an assumption holds to a byte offset if we have passed when the assumption holds, clear the item from the map @param assumptionTill the map of assumptions @param pc // * the current pc
[ "the", "map", "is", "keyed", "by", "register", "and", "value", "by", "when", "an", "assumption", "holds", "to", "a", "byte", "offset", "if", "we", "have", "passed", "when", "the", "assumption", "holds", "clear", "the", "item", "from", "the", "map" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java#L396-L403
104,755
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
AnnotationIssues.clearBranchTargets
public void clearBranchTargets(int pc) { Iterator<Integer> it = branchTargets.iterator(); while (it.hasNext()) { int target = it.next().intValue(); if (target <= pc) { it.remove(); } } }
java
public void clearBranchTargets(int pc) { Iterator<Integer> it = branchTargets.iterator(); while (it.hasNext()) { int target = it.next().intValue(); if (target <= pc) { it.remove(); } } }
[ "public", "void", "clearBranchTargets", "(", "int", "pc", ")", "{", "Iterator", "<", "Integer", ">", "it", "=", "branchTargets", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "int", "target", "=", "it", ".", ...
remove branch targets that have been passed @param pc the current pc
[ "remove", "branch", "targets", "that", "have", "been", "passed" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java#L427-L435
104,756
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java
InconsistentKeyNameCasing.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKEINTERFACE) { KeyType type = isKeyAccessMethod(seen); if (type != null) { int numParms = SignatureUtils.getNumParameters(getSigCon...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKEINTERFACE) { KeyType type = isKeyAccessMethod(seen); if (type != null) { int numParms = SignatureUtils.getNumParameters(getSigCon...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "seen", "==", "Const", ".", "INVOKEINTERFACE", ")", "{", "KeyType", "type", "=", "isKeyAccessMetho...
implements the visitor to look for calls to HttpServletRequest.getParameter and collect what the name of the key is. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "calls", "to", "HttpServletRequest", ".", "getParameter", "and", "collect", "what", "the", "name", "of", "the", "key", "is", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java#L125-L161
104,757
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java
InconsistentKeyNameCasing.report
@Override public void report() { for (Map.Entry<KeyType, Map<String, Map<String, List<SourceInfo>>>> entry : parmInfo.entrySet()) { KeyType type = entry.getKey(); Map<String, Map<String, List<SourceInfo>>> typeMap = entry.getValue(); for (Map<String, List<SourceInfo>> pa...
java
@Override public void report() { for (Map.Entry<KeyType, Map<String, Map<String, List<SourceInfo>>>> entry : parmInfo.entrySet()) { KeyType type = entry.getKey(); Map<String, Map<String, List<SourceInfo>>> typeMap = entry.getValue(); for (Map<String, List<SourceInfo>> pa...
[ "@", "Override", "public", "void", "report", "(", ")", "{", "for", "(", "Map", ".", "Entry", "<", "KeyType", ",", "Map", "<", "String", ",", "Map", "<", "String", ",", "List", "<", "SourceInfo", ">", ">", ">", ">", "entry", ":", "parmInfo", ".", ...
implements the visitor to look for the collected parm names, and look for duplicates that are different in casing only.
[ "implements", "the", "visitor", "to", "look", "for", "the", "collected", "parm", "names", "and", "look", "for", "duplicates", "that", "are", "different", "in", "casing", "only", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java#L166-L190
104,758
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
UnnecessaryStoreBeforeReturn.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { branchTargets = new BitSet(); catchTargets = new BitSet(); stack = new OpcodeStack(); super.visitClassContext(classContext); } finally { branchTargets = null; ...
java
@Override public void visitClassContext(ClassContext classContext) { try { branchTargets = new BitSet(); catchTargets = new BitSet(); stack = new OpcodeStack(); super.visitClassContext(classContext); } finally { branchTargets = null; ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "branchTargets", "=", "new", "BitSet", "(", ")", ";", "catchTargets", "=", "new", "BitSet", "(", ")", ";", "stack", "=", "new", "OpcodeStack", ...
implements the visitor to create and clear the branchTargets @param classContext the context object for the currently parsed class
[ "implements", "the", "visitor", "to", "create", "and", "clear", "the", "branchTargets" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java#L131-L143
104,759
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
UnnecessaryStoreBeforeReturn.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); String sig = m.getSignature(); if (!Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) { state = State.SEEN_NOTHING; branchTargets.clear(); CodeException[] ces = obj.getExcept...
java
@Override public void visitCode(Code obj) { Method m = getMethod(); String sig = m.getSignature(); if (!Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) { state = State.SEEN_NOTHING; branchTargets.clear(); CodeException[] ces = obj.getExcept...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "String", "sig", "=", "m", ".", "getSignature", "(", ")", ";", "if", "(", "!", "Values", ".", "SIG_VOID", ".", "equals", "...
implements the visitor to make sure method returns a value, and then clears the targets @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "make", "sure", "method", "returns", "a", "value", "and", "then", "clears", "the", "targets" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java#L151-L168
104,760
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
UnnecessaryStoreBeforeReturn.sawOpcode
@Override public void sawOpcode(int seen) { int lhsReg = -1; try { stack.precomputation(this); switch (state) { case SEEN_NOTHING: if (!catchTargets.get(getPC()) && lookForStore(seen) && (stack.getStackDepth() >= 1)) { ...
java
@Override public void sawOpcode(int seen) { int lhsReg = -1; try { stack.precomputation(this); switch (state) { case SEEN_NOTHING: if (!catchTargets.get(getPC()) && lookForStore(seen) && (stack.getStackDepth() >= 1)) { ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "int", "lhsReg", "=", "-", "1", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "state", ")", "{", "case", "SEEN_NOTHING", ":", "if",...
implements the visitor to look for store of registers immediately before returns of that register @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "store", "of", "registers", "immediately", "before", "returns", "of", "that", "register" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java#L176-L227
104,761
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
UnnecessaryStoreBeforeReturn.lookForStore
private boolean lookForStore(int seen) { if (!OpcodeUtils.isStore(seen)) { return false; } storeReg = RegisterUtils.getStoreReg(this, seen); return true; }
java
private boolean lookForStore(int seen) { if (!OpcodeUtils.isStore(seen)) { return false; } storeReg = RegisterUtils.getStoreReg(this, seen); return true; }
[ "private", "boolean", "lookForStore", "(", "int", "seen", ")", "{", "if", "(", "!", "OpcodeUtils", ".", "isStore", "(", "seen", ")", ")", "{", "return", "false", ";", "}", "storeReg", "=", "RegisterUtils", ".", "getStoreReg", "(", "this", ",", "seen", ...
checks if the current opcode is a store, if so saves the register @param seen the opcode of the currently parsed instruction @return if a store was seen
[ "checks", "if", "the", "current", "opcode", "is", "a", "store", "if", "so", "saves", "the", "register" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java#L236-L243
104,762
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
UnnecessaryStoreBeforeReturn.lookForLoad
private boolean lookForLoad(int seen) { int loadReg; if (!OpcodeUtils.isLoad(seen)) { return false; } loadReg = RegisterUtils.getLoadReg(this, seen); return (storeReg == loadReg); }
java
private boolean lookForLoad(int seen) { int loadReg; if (!OpcodeUtils.isLoad(seen)) { return false; } loadReg = RegisterUtils.getLoadReg(this, seen); return (storeReg == loadReg); }
[ "private", "boolean", "lookForLoad", "(", "int", "seen", ")", "{", "int", "loadReg", ";", "if", "(", "!", "OpcodeUtils", ".", "isLoad", "(", "seen", ")", ")", "{", "return", "false", ";", "}", "loadReg", "=", "RegisterUtils", ".", "getLoadReg", "(", "t...
looks for a load of the register that was just stored @param seen the opcode of the currently parsed instruction @return if the load was seen
[ "looks", "for", "a", "load", "of", "the", "register", "that", "was", "just", "stored" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java#L252-L261
104,763
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java
CollectMethodsReturningImmutableCollections.visitCode
@Override public void visitCode(Code obj) { try { String signature = SignatureUtils.getReturnSignature(getMethod().getSignature()); if (signature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX) && CollectionUtils.isListSetMap(SignatureUtils.stripSignature(signature))) { ...
java
@Override public void visitCode(Code obj) { try { String signature = SignatureUtils.getReturnSignature(getMethod().getSignature()); if (signature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX) && CollectionUtils.isListSetMap(SignatureUtils.stripSignature(signature))) { ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "String", "signature", "=", "SignatureUtils", ".", "getReturnSignature", "(", "getMethod", "(", ")", ".", "getSignature", "(", ")", ")", ";", "if", "(", "signature", ...
overrides the visitor to reset the stack for the new method, then checks if the immutability field is set to immutable and if so reports it @param obj the context object of the currently parsed method
[ "overrides", "the", "visitor", "to", "reset", "the", "stack", "for", "the", "new", "method", "then", "checks", "if", "the", "immutability", "field", "is", "set", "to", "immutable", "and", "if", "so", "reports", "it" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java#L93-L111
104,764
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java
CollectMethodsReturningImmutableCollections.sawOpcode
@Override public void sawOpcode(int seen) { ImmutabilityType seenImmutable = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKESTATIC: { String className = getClassConstantOperand(); String method...
java
@Override public void sawOpcode(int seen) { ImmutabilityType seenImmutable = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKESTATIC: { String className = getClassConstantOperand(); String method...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "ImmutabilityType", "seenImmutable", "=", "null", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".",...
overrides the visitor to look for calls to static methods that are known to return immutable collections It records those variables, and documents if what the method returns is one of those objects.
[ "overrides", "the", "visitor", "to", "look", "for", "calls", "to", "static", "methods", "that", "are", "known", "to", "return", "immutable", "collections", "It", "records", "those", "variables", "and", "documents", "if", "what", "the", "method", "returns", "is...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java#L117-L164
104,765
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
SuspiciousJDKVersionUse.isJavaXExternal
private boolean isJavaXExternal(String className) { if (!className.startsWith("javax/")) { return false; } if (className.startsWith("javax/xml/")) { return true; } int lastSlashPos = className.lastIndexOf('/'); String packageName = className.subs...
java
private boolean isJavaXExternal(String className) { if (!className.startsWith("javax/")) { return false; } if (className.startsWith("javax/xml/")) { return true; } int lastSlashPos = className.lastIndexOf('/'); String packageName = className.subs...
[ "private", "boolean", "isJavaXExternal", "(", "String", "className", ")", "{", "if", "(", "!", "className", ".", "startsWith", "(", "\"javax/\"", ")", ")", "{", "return", "false", ";", "}", "if", "(", "className", ".", "startsWith", "(", "\"javax/xml/\"", ...
checks to see if this class is a javax.xxxx.Foo class if so, looks to see if the package is at least in the jdk if a whole new package comes into javax in rt.jar, this will be missed. Need a better solution here. @param className the slashed class in question @return whether it is in the default jdk rt.jar
[ "checks", "to", "see", "if", "this", "class", "is", "a", "javax", ".", "xxxx", ".", "Foo", "class", "if", "so", "looks", "to", "see", "if", "the", "package", "is", "at", "least", "in", "the", "jdk", "if", "a", "whole", "new", "package", "comes", "i...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java#L278-L301
104,766
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
104,767
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
104,768
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
104,769
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
104,770
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
104,771
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
104,772
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
104,773
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
104,774
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
104,775
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
104,776
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
104,777
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
104,778
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
104,779
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
104,780
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
104,781
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
104,782
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
104,783
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
104,784
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
104,785
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
104,786
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
104,787
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
104,788
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
104,789
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
104,790
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
104,791
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
104,792
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
104,793
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
104,794
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
104,795
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
104,796
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
104,797
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
104,798
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
104,799
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