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,500
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java
LocalTypeDetector.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); suspectLocals = new HashMap<>(); classVersion = classContext.getJavaClass().getMajor(); super.visitClassContext(classContext); } finally { ...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); suspectLocals = new HashMap<>(); classVersion = classContext.getJavaClass().getMajor(); super.visitClassContext(classContext); } finally { ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "suspectLocals", "=", "new", "HashMap", "<>", "(", ")", ";", "classVersion", "=", "classCont...
implements the visitor to create and clear the stack and suspectLocals @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "create", "and", "clear", "the", "stack", "and", "suspectLocals" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java#L92-L103
104,501
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java
LocalTypeDetector.visitMethod
@Override public void visitMethod(Method obj) { suspectLocals.clear(); int[] parmRegs = RegisterUtils.getParameterRegisters(obj); for (int pr : parmRegs) { suspectLocals.put(Integer.valueOf(pr), new RegisterInfo(RegisterUtils.getLocalVariableEndRange(obj.getLocalVariableTable(), ...
java
@Override public void visitMethod(Method obj) { suspectLocals.clear(); int[] parmRegs = RegisterUtils.getParameterRegisters(obj); for (int pr : parmRegs) { suspectLocals.put(Integer.valueOf(pr), new RegisterInfo(RegisterUtils.getLocalVariableEndRange(obj.getLocalVariableTable(), ...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "suspectLocals", ".", "clear", "(", ")", ";", "int", "[", "]", "parmRegs", "=", "RegisterUtils", ".", "getParameterRegisters", "(", "obj", ")", ";", "for", "(", "int", "pr"...
implements the visitor to collect parameter registers @param obj the context object of the currently parsed method
[ "implements", "the", "visitor", "to", "collect", "parameter", "registers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java#L111-L118
104,502
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java
FloatingPointLoops.visitCode
@Override public void visitCode(Code obj) { forLoops = new HashSet<>(); super.visitCode(obj); forLoops = null; }
java
@Override public void visitCode(Code obj) { forLoops = new HashSet<>(); super.visitCode(obj); forLoops = null; }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "forLoops", "=", "new", "HashSet", "<>", "(", ")", ";", "super", ".", "visitCode", "(", "obj", ")", ";", "forLoops", "=", "null", ";", "}" ]
implements the visitor to clear the forLoops set @param obj the context object for the currently parsed code block
[ "implements", "the", "visitor", "to", "clear", "the", "forLoops", "set" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java#L65-L70
104,503
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java
FloatingPointLoops.sawOpcode
@Override public void sawOpcode(int seen) { if (!forLoops.isEmpty()) { Iterator<FloatForLoop> ffl = forLoops.iterator(); while (ffl.hasNext()) { if (!ffl.next().sawOpcode(seen)) { ffl.remove(); } } } if ...
java
@Override public void sawOpcode(int seen) { if (!forLoops.isEmpty()) { Iterator<FloatForLoop> ffl = forLoops.iterator(); while (ffl.hasNext()) { if (!ffl.next().sawOpcode(seen)) { ffl.remove(); } } } if ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "!", "forLoops", ".", "isEmpty", "(", ")", ")", "{", "Iterator", "<", "FloatForLoop", ">", "ffl", "=", "forLoops", ".", "iterator", "(", ")", ";", "while", "(", ...
implements the visitor to find for loops using floating point indexes @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "find", "for", "loops", "using", "floating", "point", "indexes" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java#L78-L92
104,504
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.visitField
@Override public void visitField(Field obj) { String fieldSig = obj.getSignature(); if ("Ljavax/swing/JLabel;".equals(fieldSig)) { FieldAnnotation fa = FieldAnnotation.fromVisitedField(this); fieldLabels.add(XFactory.createXField(fa)); } }
java
@Override public void visitField(Field obj) { String fieldSig = obj.getSignature(); if ("Ljavax/swing/JLabel;".equals(fieldSig)) { FieldAnnotation fa = FieldAnnotation.fromVisitedField(this); fieldLabels.add(XFactory.createXField(fa)); } }
[ "@", "Override", "public", "void", "visitField", "(", "Field", "obj", ")", "{", "String", "fieldSig", "=", "obj", ".", "getSignature", "(", ")", ";", "if", "(", "\"Ljavax/swing/JLabel;\"", ".", "equals", "(", "fieldSig", ")", ")", "{", "FieldAnnotation", "...
looks for fields that are JLabels and stores them in a set @param obj the field object of the current field
[ "looks", "for", "fields", "that", "are", "JLabels", "and", "stores", "them", "in", "a", "set" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L198-L206
104,505
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.processFaultyGuiStrings
private void processFaultyGuiStrings() { FQMethod methodInfo = new FQMethod(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand()); Integer parmIndex = displayTextMethods.get(methodInfo); if ((parmIndex != null) && (stack.getStackDepth() > parmIndex.intValue())) { ...
java
private void processFaultyGuiStrings() { FQMethod methodInfo = new FQMethod(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand()); Integer parmIndex = displayTextMethods.get(methodInfo); if ((parmIndex != null) && (stack.getStackDepth() > parmIndex.intValue())) { ...
[ "private", "void", "processFaultyGuiStrings", "(", ")", "{", "FQMethod", "methodInfo", "=", "new", "FQMethod", "(", "getClassConstantOperand", "(", ")", ",", "getNameConstantOperand", "(", ")", ",", "getSigConstantOperand", "(", ")", ")", ";", "Integer", "parmInde...
looks for calls to set a readable string that is generated from a static constant, as these strings are not translatable. also looks for setting readable strings that are appended together. This is likely not to be internationalizable.
[ "looks", "for", "calls", "to", "set", "a", "readable", "string", "that", "is", "generated", "from", "a", "static", "constant", "as", "these", "strings", "are", "not", "translatable", ".", "also", "looks", "for", "setting", "readable", "strings", "that", "are...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L343-L357
104,506
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.processNullLayouts
private void processNullLayouts(String className, String methodName) { if ("java/awt/Container".equals(className) && "setLayout".equals(methodName) && (stack.getStackDepth() > 0) && stack.getStackItem(0).isNull()) { bugReporter.reportBug(new BugInstance(this, BugType.S508C_NULL_LAYOUT.name(), NORMAL...
java
private void processNullLayouts(String className, String methodName) { if ("java/awt/Container".equals(className) && "setLayout".equals(methodName) && (stack.getStackDepth() > 0) && stack.getStackItem(0).isNull()) { bugReporter.reportBug(new BugInstance(this, BugType.S508C_NULL_LAYOUT.name(), NORMAL...
[ "private", "void", "processNullLayouts", "(", "String", "className", ",", "String", "methodName", ")", "{", "if", "(", "\"java/awt/Container\"", ".", "equals", "(", "className", ")", "&&", "\"setLayout\"", ".", "equals", "(", "methodName", ")", "&&", "(", "sta...
looks for containers where a null layout is installed @param className class that a method call is made on @param methodName name of the method that is called
[ "looks", "for", "containers", "where", "a", "null", "layout", "is", "installed" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L367-L371
104,507
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.processSetColorOps
private void processSetColorOps(String methodName) throws ClassNotFoundException { if ("setBackground".equals(methodName) || "setForeground".equals(methodName)) { int argCount = SignatureUtils.getNumParameters(getSigConstantOperand()); if (stack.getStackDepth() > argCount) { ...
java
private void processSetColorOps(String methodName) throws ClassNotFoundException { if ("setBackground".equals(methodName) || "setForeground".equals(methodName)) { int argCount = SignatureUtils.getNumParameters(getSigConstantOperand()); if (stack.getStackDepth() > argCount) { ...
[ "private", "void", "processSetColorOps", "(", "String", "methodName", ")", "throws", "ClassNotFoundException", "{", "if", "(", "\"setBackground\"", ".", "equals", "(", "methodName", ")", "||", "\"setForeground\"", ".", "equals", "(", "methodName", ")", ")", "{", ...
looks for calls to set the color of components where the color isn't from UIManager @param methodName the method that is called @throws ClassNotFoundException if the gui component class can't be found
[ "looks", "for", "calls", "to", "set", "the", "color", "of", "components", "where", "the", "color", "isn", "t", "from", "UIManager" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L382-L397
104,508
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.processSetSizeOps
private void processSetSizeOps(String methodName) throws ClassNotFoundException { if ("setSize".equals(methodName)) { int argCount = SignatureUtils.getNumParameters(getSigConstantOperand()); if ((windowClass != null) && (stack.getStackDepth() > argCount)) { OpcodeStack.It...
java
private void processSetSizeOps(String methodName) throws ClassNotFoundException { if ("setSize".equals(methodName)) { int argCount = SignatureUtils.getNumParameters(getSigConstantOperand()); if ((windowClass != null) && (stack.getStackDepth() > argCount)) { OpcodeStack.It...
[ "private", "void", "processSetSizeOps", "(", "String", "methodName", ")", "throws", "ClassNotFoundException", "{", "if", "(", "\"setSize\"", ".", "equals", "(", "methodName", ")", ")", "{", "int", "argCount", "=", "SignatureUtils", ".", "getNumParameters", "(", ...
looks for calls to setSize on components, rather than letting the layout manager set them @param methodName the method that was called on a component @throws ClassNotFoundException if the gui class wasn't found
[ "looks", "for", "calls", "to", "setSize", "on", "components", "rather", "than", "letting", "the", "layout", "manager", "set", "them" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L408-L420
104,509
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getAStoreReg
public static int getAStoreReg(final DismantleBytecode dbc, final int seen) { if (seen == Const.ASTORE) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isAStore(seen)) { return seen - Const.ASTORE_0; } return -1; }
java
public static int getAStoreReg(final DismantleBytecode dbc, final int seen) { if (seen == Const.ASTORE) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isAStore(seen)) { return seen - Const.ASTORE_0; } return -1; }
[ "public", "static", "int", "getAStoreReg", "(", "final", "DismantleBytecode", "dbc", ",", "final", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "ASTORE", ")", "{", "return", "dbc", ".", "getRegisterOperand", "(", ")", ";", "}", "if", ...
returns the register used to store a reference @param dbc the dismantle byte code parsing the class @param seen the opcode of the store @return the register stored into
[ "returns", "the", "register", "used", "to", "store", "a", "reference" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L49-L58
104,510
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getALoadReg
public static int getALoadReg(DismantleBytecode dbc, int seen) { if (seen == Const.ALOAD) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isALoad(seen)) { return seen - Const.ALOAD_0; } return -1; }
java
public static int getALoadReg(DismantleBytecode dbc, int seen) { if (seen == Const.ALOAD) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isALoad(seen)) { return seen - Const.ALOAD_0; } return -1; }
[ "public", "static", "int", "getALoadReg", "(", "DismantleBytecode", "dbc", ",", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "ALOAD", ")", "{", "return", "dbc", ".", "getRegisterOperand", "(", ")", ";", "}", "if", "(", "OpcodeUtils", ...
returns the register used to load a reference @param dbc the dismantle byte code parsing the class @param seen the opcode of the load @return the register loaded from
[ "returns", "the", "register", "used", "to", "load", "a", "reference" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L69-L77
104,511
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getStoreReg
public static int getStoreReg(DismantleBytecode dbc, int seen) { if ((seen == Const.ASTORE) || (seen == Const.ISTORE) || (seen == Const.LSTORE) || (seen == Const.FSTORE) || (seen == Const.DSTORE)) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isIStore(seen)) { retu...
java
public static int getStoreReg(DismantleBytecode dbc, int seen) { if ((seen == Const.ASTORE) || (seen == Const.ISTORE) || (seen == Const.LSTORE) || (seen == Const.FSTORE) || (seen == Const.DSTORE)) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isIStore(seen)) { retu...
[ "public", "static", "int", "getStoreReg", "(", "DismantleBytecode", "dbc", ",", "int", "seen", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "ASTORE", ")", "||", "(", "seen", "==", "Const", ".", "ISTORE", ")", "||", "(", "seen", "==", "Const"...
returns the register used in a store operation @param dbc the dismantle byte code parsing the class @param seen the opcode of the store @return the register stored into
[ "returns", "the", "register", "used", "in", "a", "store", "operation" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L88-L104
104,512
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getLoadReg
public static int getLoadReg(DismantleBytecode dbc, int seen) { if ((seen == Const.ALOAD) || (seen == Const.ILOAD) || (seen == Const.LLOAD) || (seen == Const.FLOAD) || (seen == Const.DLOAD)) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isILoad(seen)) { return seen...
java
public static int getLoadReg(DismantleBytecode dbc, int seen) { if ((seen == Const.ALOAD) || (seen == Const.ILOAD) || (seen == Const.LLOAD) || (seen == Const.FLOAD) || (seen == Const.DLOAD)) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isILoad(seen)) { return seen...
[ "public", "static", "int", "getLoadReg", "(", "DismantleBytecode", "dbc", ",", "int", "seen", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "ALOAD", ")", "||", "(", "seen", "==", "Const", ".", "ILOAD", ")", "||", "(", "seen", "==", "Const", ...
returns the register used in a load operation @param dbc the dismantle byte code parsing the class @param seen the opcode of the load @return the register stored into
[ "returns", "the", "register", "used", "in", "a", "load", "operation" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L115-L131
104,513
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getLocalVariableEndRange
public static int getLocalVariableEndRange(LocalVariableTable lvt, int reg, int curPC) { int endRange = Integer.MAX_VALUE; if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, curPC); if (lv != null) { endRange = lv.getStartPC() + lv.getLength(); ...
java
public static int getLocalVariableEndRange(LocalVariableTable lvt, int reg, int curPC) { int endRange = Integer.MAX_VALUE; if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, curPC); if (lv != null) { endRange = lv.getStartPC() + lv.getLength(); ...
[ "public", "static", "int", "getLocalVariableEndRange", "(", "LocalVariableTable", "lvt", ",", "int", "reg", ",", "int", "curPC", ")", "{", "int", "endRange", "=", "Integer", ".", "MAX_VALUE", ";", "if", "(", "lvt", "!=", "null", ")", "{", "LocalVariable", ...
returns the end pc of the visible range of this register at this pc @param lvt the local variable table for this method @param reg the register to examine @param curPC the pc of the current instruction @return the endpc
[ "returns", "the", "end", "pc", "of", "the", "visible", "range", "of", "this", "register", "at", "this", "pc" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L144-L153
104,514
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getParameterRegisters
public static int[] getParameterRegisters(Method obj) { Type[] argTypes = obj.getArgumentTypes(); int[] regs = new int[argTypes.length]; int curReg = obj.isStatic() ? 0 : 1; for (int t = 0; t < argTypes.length; t++) { String sig = argTypes[t].getSignature(); regs...
java
public static int[] getParameterRegisters(Method obj) { Type[] argTypes = obj.getArgumentTypes(); int[] regs = new int[argTypes.length]; int curReg = obj.isStatic() ? 0 : 1; for (int t = 0; t < argTypes.length; t++) { String sig = argTypes[t].getSignature(); regs...
[ "public", "static", "int", "[", "]", "getParameterRegisters", "(", "Method", "obj", ")", "{", "Type", "[", "]", "argTypes", "=", "obj", ".", "getArgumentTypes", "(", ")", ";", "int", "[", "]", "regs", "=", "new", "int", "[", "argTypes", ".", "length", ...
gets the set of registers used for parameters @param obj the context object for the method to find the parameter registers of @return the set of registers that parameters are using
[ "gets", "the", "set", "of", "registers", "used", "for", "parameters" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L163-L174
104,515
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java
StaticArrayCreatedInMethod.visitCode
@Override public void visitCode(Code obj) { if (!Values.STATIC_INITIALIZER.equals(getMethodName())) { state = State.SEEN_NOTHING; super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { if (!Values.STATIC_INITIALIZER.equals(getMethodName())) { state = State.SEEN_NOTHING; super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "!", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "getMethodName", "(", ")", ")", ")", "{", "state", "=", "State", ".", "SEEN_NOTHING", ";", "super", "...
implements the visitor by forwarding calls for methods that are the static initializer @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "by", "forwarding", "calls", "for", "methods", "that", "are", "the", "static", "initializer" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java#L56-L62
104,516
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java
StaticArrayCreatedInMethod.sawOpcode
@Override public void sawOpcode(int seen) { int index; switch (state) { case SEEN_NOTHING: if (seen == Const.BIPUSH) { arraySize = getIntConstant(); if (arraySize > 0) { state = State.SEEN_ARRAY_SIZE; ...
java
@Override public void sawOpcode(int seen) { int index; switch (state) { case SEEN_NOTHING: if (seen == Const.BIPUSH) { arraySize = getIntConstant(); if (arraySize > 0) { state = State.SEEN_ARRAY_SIZE; ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "int", "index", ";", "switch", "(", "state", ")", "{", "case", "SEEN_NOTHING", ":", "if", "(", "seen", "==", "Const", ".", "BIPUSH", ")", "{", "arraySize", "=", "getIntConsta...
implements the visitor to look for creation of local arrays using constant values @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "creation", "of", "local", "arrays", "using", "constant", "values" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java#L70-L149
104,517
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java
NonFunctionalField.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if ((serializableClass != null) && (cls.implementationOf(serializableClass))) { Field[] fields = cls.getFields(); setupVisitorForCla...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if ((serializableClass != null) && (cls.implementationOf(serializableClass))) { Field[] fields = cls.getFields(); setupVisitorForCla...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "(", "serializableClass", "!=", "null", ")", "&&", "(",...
checks to see if the class is Serializable, then looks for fields that are both final and transient @param classContext the context object of the currently parsed class
[ "checks", "to", "see", "if", "the", "class", "is", "Serializable", "then", "looks", "for", "fields", "that", "are", "both", "final", "and", "transient" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java#L65-L82
104,518
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
ArrayIndexOutOfBounds.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); stack.resetForMethodEntry(this); initializedRegs.clear(); modifyRegs.clear(); Type[] argTypes = m.getArgumentTypes(); int arg = m.isStatic() ? 0 : 1; for (Type argType : argTypes) { ...
java
@Override public void visitCode(Code obj) { Method m = getMethod(); stack.resetForMethodEntry(this); initializedRegs.clear(); modifyRegs.clear(); Type[] argTypes = m.getArgumentTypes(); int arg = m.isStatic() ? 0 : 1; for (Type argType : argTypes) { ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "initializedRegs", ".", "clear", "(", ")", ";", "modifyRegs", ".", ...
overrides the visitor to collect parameter registers @param obj the code block of the currently parsed method
[ "overrides", "the", "visitor", "to", "collect", "parameter", "registers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java#L90-L110
104,519
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
AbnormalFinallyBlockReturn.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { // TODO: Look at method calls in a finally block to see if they throw // exceptions // : and those exceptions are not caught in the finally block // : Only do it if effort is on, ie: boolean fullAnalysis = /...
java
@Override public void visitClassContext(ClassContext classContext) { // TODO: Look at method calls in a finally block to see if they throw // exceptions // : and those exceptions are not caught in the finally block // : Only do it if effort is on, ie: boolean fullAnalysis = /...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "// TODO: Look at method calls in a finally block to see if they throw", "// exceptions", "// : and those exceptions are not caught in the finally block", "// : Only do it if effort is on...
overrides the visitor to check for java class version being as good or better than 1.4 @param classContext the context object that holds the JavaClass parsed
[ "overrides", "the", "visitor", "to", "check", "for", "java", "class", "version", "being", "as", "good", "or", "better", "than", "1", ".", "4" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java#L70-L87
104,520
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
AbnormalFinallyBlockReturn.visitCode
@Override public void visitCode(Code obj) { fbInfo.clear(); loadedReg = -1; CodeException[] exc = obj.getExceptionTable(); if (exc != null) { for (CodeException ce : exc) { if ((ce.getCatchType() == 0) && (ce.getStartPC() == ce.getHandlerPC())) { ...
java
@Override public void visitCode(Code obj) { fbInfo.clear(); loadedReg = -1; CodeException[] exc = obj.getExceptionTable(); if (exc != null) { for (CodeException ce : exc) { if ((ce.getCatchType() == 0) && (ce.getStartPC() == ce.getHandlerPC())) { ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "fbInfo", ".", "clear", "(", ")", ";", "loadedReg", "=", "-", "1", ";", "CodeException", "[", "]", "exc", "=", "obj", ".", "getExceptionTable", "(", ")", ";", "if", "(", ...
overrides the visitor to collect finally block info. @param obj the code object to scan for finally blocks
[ "overrides", "the", "visitor", "to", "collect", "finally", "block", "info", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java#L95-L116
104,521
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
AbnormalFinallyBlockReturn.findMethod
@Nullable private static Method findMethod(JavaClass cls, String name, String sig) { Method[] methods = cls.getMethods(); for (Method m : methods) { if (m.getName().equals(name) && m.getSignature().equals(sig)) { return m; } } return null; ...
java
@Nullable private static Method findMethod(JavaClass cls, String name, String sig) { Method[] methods = cls.getMethods(); for (Method m : methods) { if (m.getName().equals(name) && m.getSignature().equals(sig)) { return m; } } return null; ...
[ "@", "Nullable", "private", "static", "Method", "findMethod", "(", "JavaClass", "cls", ",", "String", "name", ",", "String", "sig", ")", "{", "Method", "[", "]", "methods", "=", "cls", ".", "getMethods", "(", ")", ";", "for", "(", "Method", "m", ":", ...
finds the method in specified class by name and signature @param cls the class to look the method in @param name the name of the method to look for @param sig the signature of the method to look for @return the Method object for the specified information
[ "finds", "the", "method", "in", "specified", "class", "by", "name", "and", "signature" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java#L209-L219
104,522
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
WeakExceptionMessaging.prescreen
public boolean prescreen(Method method) { if (Values.STATIC_INITIALIZER.equals(method.getName())) { return false; } BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.ATHROW)); }
java
public boolean prescreen(Method method) { if (Values.STATIC_INITIALIZER.equals(method.getName())) { return false; } BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.ATHROW)); }
[ "public", "boolean", "prescreen", "(", "Method", "method", ")", "{", "if", "(", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "method", ".", "getName", "(", ")", ")", ")", "{", "return", "false", ";", "}", "BitSet", "bytecodeSet", "=", "getCla...
looks for methods that contain a ATHROW opcodes, ignoring static initializers @param method the context object of the current method @return if the class uses throws
[ "looks", "for", "methods", "that", "contain", "a", "ATHROW", "opcodes", "ignoring", "static", "initializers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java#L102-L109
104,523
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
WeakExceptionMessaging.visitCode
@Override public void visitCode(Code obj) { Method method = getMethod(); if (!method.isSynthetic() && prescreen(method)) { stack.resetForMethodEntry(this); super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { Method method = getMethod(); if (!method.isSynthetic() && prescreen(method)) { stack.resetForMethodEntry(this); super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "method", "=", "getMethod", "(", ")", ";", "if", "(", "!", "method", ".", "isSynthetic", "(", ")", "&&", "prescreen", "(", "method", ")", ")", "{", "stack", ".", ...
overrides the visitor to prescreen the method to look for throws calls and only forward onto bytecode scanning if there @param obj the context object of the currently parsed code block
[ "overrides", "the", "visitor", "to", "prescreen", "the", "method", "to", "look", "for", "throws", "calls", "and", "only", "forward", "onto", "bytecode", "scanning", "if", "there" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java#L117-L124
104,524
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
WeakExceptionMessaging.sawOpcode
@Override public void sawOpcode(int seen) { boolean allConstantStrings = false; boolean sawConstant = false; try { stack.precomputation(this); if (seen == Const.ATHROW) { checkForWEM(); } else if ((seen == Const.LDC) || (seen == Const.LDC_...
java
@Override public void sawOpcode(int seen) { boolean allConstantStrings = false; boolean sawConstant = false; try { stack.precomputation(this); if (seen == Const.ATHROW) { checkForWEM(); } else if ((seen == Const.LDC) || (seen == Const.LDC_...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "boolean", "allConstantStrings", "=", "false", ";", "boolean", "sawConstant", "=", "false", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "...
overrides the visitor to look for throws instructions using exceptions with static messages @param seen the opcode of the currently visited instruction
[ "overrides", "the", "visitor", "to", "look", "for", "throws", "instructions", "using", "exceptions", "with", "static", "messages" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java#L132-L184
104,525
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/FBContrib.java
FBContrib.main
public static void main(final String[] args) { JOptionPane.showMessageDialog(null, "To use fb-contrib, copy this jar file into your local SpotBugs plugin directory, and use SpotBugs as usual.\n\nfb-contrib is a trademark of MeBigFatGuy.com", "fb-contrib: copyright 2005-2019", JOp...
java
public static void main(final String[] args) { JOptionPane.showMessageDialog(null, "To use fb-contrib, copy this jar file into your local SpotBugs plugin directory, and use SpotBugs as usual.\n\nfb-contrib is a trademark of MeBigFatGuy.com", "fb-contrib: copyright 2005-2019", JOp...
[ "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"To use fb-contrib, copy this jar file into your local SpotBugs plugin directory, and use SpotBugs as usual.\\n\\nfb-contrib is a t...
shows the simple help @param args standard command line args
[ "shows", "the", "simple", "help" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/FBContrib.java#L37-L42
104,526
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
SuspiciousComparatorReturnValues.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); for (CompareSpec entry : compareClasses) { if (cls.implementationOf(entry.getCompareClass())) { methodInfo = entry.getMethodInfo...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); for (CompareSpec entry : compareClasses) { if (cls.implementationOf(entry.getCompareClass())) { methodInfo = entry.getMethodInfo...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "for", "(", "CompareSpec", "entry", ":", "compareClasses", ")", "{",...
implements the visitor to actually iterate twice over this class, once for compareTo and once for compare. @param classContext the currently parsed class
[ "implements", "the", "visitor", "to", "actually", "iterate", "twice", "over", "this", "class", "once", "for", "compareTo", "and", "once", "for", "compare", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java#L91-L109
104,527
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
SuspiciousComparatorReturnValues.visitCode
@Override public void visitCode(Code obj) { if (getMethod().isSynthetic()) { return; } String methodName = getMethodName(); String methodSig = getMethodSig(); if (methodName.equals(methodInfo.methodName) && methodSig.endsWith(methodInfo.signatureEnding) ...
java
@Override public void visitCode(Code obj) { if (getMethod().isSynthetic()) { return; } String methodName = getMethodName(); String methodSig = getMethodSig(); if (methodName.equals(methodInfo.methodName) && methodSig.endsWith(methodInfo.signatureEnding) ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "getMethod", "(", ")", ".", "isSynthetic", "(", ")", ")", "{", "return", ";", "}", "String", "methodName", "=", "getMethodName", "(", ")", ";", "String", "methodSi...
implements the visitor to check to see what Const were returned from a comparator. If no Const were returned it can't determine anything, however if only Const were returned, it looks to see if negative positive and zero was returned. It also looks to see if a non zero value is returned unconditionally. While it is pos...
[ "implements", "the", "visitor", "to", "check", "to", "see", "what", "Const", "were", "returned", "from", "a", "comparator", ".", "If", "no", "Const", "were", "returned", "it", "can", "t", "determine", "anything", "however", "if", "only", "Const", "were", "...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java#L119-L150
104,528
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
SuspiciousComparatorReturnValues.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); switch (seen) { case Const.IRETURN: { processIntegerReturn(); } break; case Const.GOTO: case Const.GOTO_...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); switch (seen) { case Const.IRETURN: { processIntegerReturn(); } break; case Const.GOTO: case Const.GOTO_...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".", "IRETURN", ":", "{", "processIntegerReturn", "(", ")...
implements the visitor to look for returns of constant values, and records them for being negative, zero or positive. It also records unconditional returns of non zero values @param seen the currently parsed opcode
[ "implements", "the", "visitor", "to", "look", "for", "returns", "of", "constant", "values", "and", "records", "them", "for", "being", "negative", "zero", "or", "positive", ".", "It", "also", "records", "unconditional", "returns", "of", "non", "zero", "values" ...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java#L159-L252
104,529
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java
ParallelLists.visitCode
@Override public void visitCode(final Code obj) { stack.resetForMethodEntry(this); indexToFieldMap.clear(); super.visitCode(obj); }
java
@Override public void visitCode(final Code obj) { stack.resetForMethodEntry(this); indexToFieldMap.clear(); super.visitCode(obj); }
[ "@", "Override", "public", "void", "visitCode", "(", "final", "Code", "obj", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "indexToFieldMap", ".", "clear", "(", ")", ";", "super", ".", "visitCode", "(", "obj", ")", ";", "}" ]
implements the visitor to reset the opcode stack, and the file maps @param obj the currently parsed method code block
[ "implements", "the", "visitor", "to", "reset", "the", "opcode", "stack", "and", "the", "file", "maps" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java#L99-L104
104,530
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java
ParallelLists.getIntOpRegister
private int getIntOpRegister(final int seen) { if ((seen == Const.ISTORE) || (seen == Const.IINC)) { return getRegisterOperand(); } return seen - Const.ISTORE_0; }
java
private int getIntOpRegister(final int seen) { if ((seen == Const.ISTORE) || (seen == Const.IINC)) { return getRegisterOperand(); } return seen - Const.ISTORE_0; }
[ "private", "int", "getIntOpRegister", "(", "final", "int", "seen", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "ISTORE", ")", "||", "(", "seen", "==", "Const", ".", "IINC", ")", ")", "{", "return", "getRegisterOperand", "(", ")", ";", "}", ...
fetch the register from a integer op code @param seen the currently parsed opcode @return the register in use
[ "fetch", "the", "register", "from", "a", "integer", "op", "code" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java#L140-L145
104,531
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
UseEnumCollections.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (cls.getMajor() >= Const.MAJOR_1_5) { stack = new OpcodeStack(); checkedFields = new HashSet<>(); enumRegs = new ...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (cls.getMajor() >= Const.MAJOR_1_5) { stack = new OpcodeStack(); checkedFields = new HashSet<>(); enumRegs = new ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "cls", ".", "getMajor", "(", ")", ">=", "Const", ".",...
implements the visitor to check that the class is greater or equal than 1.5, and set and clear the stack @param classContext the context object for the currently parsed class
[ "implements", "the", "visitor", "to", "check", "that", "the", "class", "is", "greater", "or", "equal", "than", "1", ".", "5", "and", "set", "and", "clear", "the", "stack" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java#L79-L96
104,532
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
UseEnumCollections.isEnum
private boolean isEnum(int stackPos) throws ClassNotFoundException { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); if (!item.getSignature().startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { return fa...
java
private boolean isEnum(int stackPos) throws ClassNotFoundException { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); if (!item.getSignature().startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { return fa...
[ "private", "boolean", "isEnum", "(", "int", "stackPos", ")", "throws", "ClassNotFoundException", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", "<=", "stackPos", ")", "{", "return", "false", ";", "}", "OpcodeStack", ".", "Item", "item", "=", "sta...
returns whether the item at the stackPos location on the stack is an enum, and doesn't implement any interfaces @param stackPos the position on the opstack to check @return whether the class is an enum @throws ClassNotFoundException if the class can not be loaded
[ "returns", "whether", "the", "item", "at", "the", "stackPos", "location", "on", "the", "stack", "is", "an", "enum", "and", "doesn", "t", "implement", "any", "interfaces" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java#L223-L241
104,533
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
UseEnumCollections.couldBeEnumCollection
private boolean couldBeEnumCollection(int stackPos) { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); CollectionType userValue = (CollectionType) item.getUserValue(); if (userValue != null) { ...
java
private boolean couldBeEnumCollection(int stackPos) { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); CollectionType userValue = (CollectionType) item.getUserValue(); if (userValue != null) { ...
[ "private", "boolean", "couldBeEnumCollection", "(", "int", "stackPos", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", "<=", "stackPos", ")", "{", "return", "false", ";", "}", "OpcodeStack", ".", "Item", "item", "=", "stack", ".", "getStackIt...
returns whether the item at the stackpos location isn't an enum collection but could be @param stackPos the position on the opstack to check @return whether the collection should be converted to an enum collection
[ "returns", "whether", "the", "item", "at", "the", "stackpos", "location", "isn", "t", "an", "enum", "collection", "but", "could", "be" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java#L251-L265
104,534
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
UseEnumCollections.alreadyReported
private boolean alreadyReported(int stackPos) { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); XField field = item.getXField(); if (field == null) { return false; } String fi...
java
private boolean alreadyReported(int stackPos) { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); XField field = item.getXField(); if (field == null) { return false; } String fi...
[ "private", "boolean", "alreadyReported", "(", "int", "stackPos", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", "<=", "stackPos", ")", "{", "return", "false", ";", "}", "OpcodeStack", ".", "Item", "item", "=", "stack", ".", "getStackItem", ...
returns whether the collection has already been reported on @param stackPos the position on the opstack to check @return whether the collection has already been reported.
[ "returns", "whether", "the", "collection", "has", "already", "been", "reported", "on" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java#L275-L288
104,535
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java
StackedTryBlocks.visitCode
@Override public void visitCode(Code obj) { try { XMethod xMethod = getXMethod(); if (xMethod != null) { String[] tes = xMethod.getThrownExceptions(); Set<String> thrownExceptions = new HashSet<>(Arrays.<String> asList((tes == null) ? new String[0] : ...
java
@Override public void visitCode(Code obj) { try { XMethod xMethod = getXMethod(); if (xMethod != null) { String[] tes = xMethod.getThrownExceptions(); Set<String> thrownExceptions = new HashSet<>(Arrays.<String> asList((tes == null) ? new String[0] : ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "XMethod", "xMethod", "=", "getXMethod", "(", ")", ";", "if", "(", "xMethod", "!=", "null", ")", "{", "String", "[", "]", "tes", "=", "xMethod", ".", "getThrown...
overrides the visitor to look for 'idea' try catch blocks to find issues specifically, method needs two or more try catch blocks that only catch one exception type. @param obj the currently parsed code object
[ "overrides", "the", "visitor", "to", "look", "for", "idea", "try", "catch", "blocks", "to", "find", "issues", "specifically", "method", "needs", "two", "or", "more", "try", "catch", "blocks", "that", "only", "catch", "one", "exception", "type", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java#L88-L150
104,536
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java
StackedTryBlocks.findBlockWithStart
@Nullable private TryBlock findBlockWithStart(int pc) { for (TryBlock block : blocks) { if (block.atStartPC(pc)) { return block; } } return null; }
java
@Nullable private TryBlock findBlockWithStart(int pc) { for (TryBlock block : blocks) { if (block.atStartPC(pc)) { return block; } } return null; }
[ "@", "Nullable", "private", "TryBlock", "findBlockWithStart", "(", "int", "pc", ")", "{", "for", "(", "TryBlock", "block", ":", "blocks", ")", "{", "if", "(", "block", ".", "atStartPC", "(", "pc", ")", ")", "{", "return", "block", ";", "}", "}", "ret...
looks for an existing try block that has this pc as a start of the try @param pc the current program counter @return the tryblock if this statement starts it, else null
[ "looks", "for", "an", "existing", "try", "block", "that", "has", "this", "pc", "as", "a", "start", "of", "the", "try" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java#L274-L284
104,537
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DateComparison.java
DateComparison.visit
@Override public void visit(Method obj) { state = State.SAW_NOTHING; register1_1 = -1; register1_2 = -1; register2_1 = -1; register2_2 = -1; super.visit(obj); }
java
@Override public void visit(Method obj) { state = State.SAW_NOTHING; register1_1 = -1; register1_2 = -1; register2_1 = -1; register2_2 = -1; super.visit(obj); }
[ "@", "Override", "public", "void", "visit", "(", "Method", "obj", ")", "{", "state", "=", "State", ".", "SAW_NOTHING", ";", "register1_1", "=", "-", "1", ";", "register1_2", "=", "-", "1", ";", "register2_1", "=", "-", "1", ";", "register2_2", "=", "...
overrides the visitor to reset the registers @param obj the method of the currently parsed method
[ "overrides", "the", "visitor", "to", "reset", "the", "registers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DateComparison.java#L76-L84
104,538
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DateComparison.java
DateComparison.sawOpcode
@Override public void sawOpcode(int seen) { switch (state) { case SAW_NOTHING: if (OpcodeUtils.isALoad(seen)) { register1_1 = RegisterUtils.getALoadReg(this, seen); state = State.SAW_LOAD1_1; } break; ...
java
@Override public void sawOpcode(int seen) { switch (state) { case SAW_NOTHING: if (OpcodeUtils.isALoad(seen)) { register1_1 = RegisterUtils.getALoadReg(this, seen); state = State.SAW_LOAD1_1; } break; ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "switch", "(", "state", ")", "{", "case", "SAW_NOTHING", ":", "if", "(", "OpcodeUtils", ".", "isALoad", "(", "seen", ")", ")", "{", "register1_1", "=", "RegisterUtils", ".", ...
overrides the visitor to look for double date compares using the same registers @param seen the current opcode parsed.
[ "overrides", "the", "visitor", "to", "look", "for", "double", "date", "compares", "using", "the", "same", "registers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DateComparison.java#L92-L187
104,539
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java
AbstractCollectionScanningDetector.isLocalCollection
protected final int isLocalCollection(OpcodeStack.Item item) throws ClassNotFoundException { Comparable<?> aliasReg = (Comparable<?>) item.getUserValue(); if (aliasReg instanceof Integer) { return ((Integer) aliasReg).intValue(); } int reg = item.getRegisterNumber(); ...
java
protected final int isLocalCollection(OpcodeStack.Item item) throws ClassNotFoundException { Comparable<?> aliasReg = (Comparable<?>) item.getUserValue(); if (aliasReg instanceof Integer) { return ((Integer) aliasReg).intValue(); } int reg = item.getRegisterNumber(); ...
[ "protected", "final", "int", "isLocalCollection", "(", "OpcodeStack", ".", "Item", "item", ")", "throws", "ClassNotFoundException", "{", "Comparable", "<", "?", ">", "aliasReg", "=", "(", "Comparable", "<", "?", ">", ")", "item", ".", "getUserValue", "(", ")...
determines if the stack item refers to a collection that is stored in a local variable @param item the stack item to check @return the register number of the local variable that this collection refers to, or -1 @throws ClassNotFoundException if the items class cannot be found
[ "determines", "if", "the", "stack", "item", "refers", "to", "a", "collection", "that", "is", "stored", "in", "a", "local", "variable" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java#L92-L109
104,540
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
FieldCouldBeLocal.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { localizableFields = new HashMap<>(); visitedBlocks = new BitSet(); clsContext = classContext; clsName = clsContext.getJavaClass().getClassName(); clsSig = SignatureUtils.cla...
java
@Override public void visitClassContext(ClassContext classContext) { try { localizableFields = new HashMap<>(); visitedBlocks = new BitSet(); clsContext = classContext; clsName = clsContext.getJavaClass().getClassName(); clsSig = SignatureUtils.cla...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "localizableFields", "=", "new", "HashMap", "<>", "(", ")", ";", "visitedBlocks", "=", "new", "BitSet", "(", ")", ";", "clsContext", "=", "clas...
overrides the visitor to collect localizable fields, and then report those that survive all method checks. @param classContext the context object that holds the JavaClass parsed
[ "overrides", "the", "visitor", "to", "collect", "localizable", "fields", "and", "then", "report", "those", "that", "survive", "all", "method", "checks", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java#L97-L143
104,541
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
FieldCouldBeLocal.visitMethod
@Override public void visitMethod(Method obj) { if (localizableFields.isEmpty()) { return; } try { cfg = clsContext.getCFG(obj); cpg = cfg.getMethodGen().getConstantPool(); BasicBlock bb = cfg.getEntry(); Set<String> uncheckedFiel...
java
@Override public void visitMethod(Method obj) { if (localizableFields.isEmpty()) { return; } try { cfg = clsContext.getCFG(obj); cpg = cfg.getMethodGen().getConstantPool(); BasicBlock bb = cfg.getEntry(); Set<String> uncheckedFiel...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "if", "(", "localizableFields", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "try", "{", "cfg", "=", "clsContext", ".", "getCFG", "(", "obj", ")", ";", "cpg"...
overrides the visitor to navigate basic blocks looking for all first usages of fields, removing those that are read from first. @param obj the context object of the currently parsed method
[ "overrides", "the", "visitor", "to", "navigate", "basic", "blocks", "looking", "for", "all", "first", "usages", "of", "fields", "removing", "those", "that", "are", "read", "from", "first", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java#L151-L171
104,542
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
FieldCouldBeLocal.prescreen
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.PUTFIELD) || bytecodeSet.get(Const.GETFIELD)); }
java
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.PUTFIELD) || bytecodeSet.get(Const.GETFIELD)); }
[ "private", "boolean", "prescreen", "(", "Method", "method", ")", "{", "BitSet", "bytecodeSet", "=", "getClassContext", "(", ")", ".", "getBytecodeSet", "(", "method", ")", ";", "return", "(", "bytecodeSet", "!=", "null", ")", "&&", "(", "bytecodeSet", ".", ...
looks for methods that contain a GETFIELD or PUTFIELD opcodes @param method the context object of the current method @return if the class uses GETFIELD or PUTFIELD
[ "looks", "for", "methods", "that", "contain", "a", "GETFIELD", "or", "PUTFIELD", "opcodes" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java#L180-L183
104,543
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
FieldCouldBeLocal.sawOpcode
@Override public void sawOpcode(int seen) { if ((seen == Const.GETFIELD) || (seen == Const.PUTFIELD)) { String fieldName = getNameConstantOperand(); FieldInfo fi = localizableFields.get(fieldName); if (fi != null) { SourceLineAnnotation sla = SourceLineAnn...
java
@Override public void sawOpcode(int seen) { if ((seen == Const.GETFIELD) || (seen == Const.PUTFIELD)) { String fieldName = getNameConstantOperand(); FieldInfo fi = localizableFields.get(fieldName); if (fi != null) { SourceLineAnnotation sla = SourceLineAnn...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "GETFIELD", ")", "||", "(", "seen", "==", "Const", ".", "PUTFIELD", ")", ")", "{", "String", "fieldName", "=", "getNameConstantOpe...
implements the visitor to add SourceLineAnnotations for fields in constructors and static initializers. @param seen the opcode of the currently visited instruction
[ "implements", "the", "visitor", "to", "add", "SourceLineAnnotations", "for", "fields", "in", "constructors", "and", "static", "initializers", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java#L209-L219
104,544
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
FieldCouldBeLocal.buildMethodFieldModifiers
private void buildMethodFieldModifiers(ClassContext classContext) { FieldModifier fm = new FieldModifier(); fm.visitClassContext(classContext); methodFieldModifiers = fm.getMethodFieldModifiers(); }
java
private void buildMethodFieldModifiers(ClassContext classContext) { FieldModifier fm = new FieldModifier(); fm.visitClassContext(classContext); methodFieldModifiers = fm.getMethodFieldModifiers(); }
[ "private", "void", "buildMethodFieldModifiers", "(", "ClassContext", "classContext", ")", "{", "FieldModifier", "fm", "=", "new", "FieldModifier", "(", ")", ";", "fm", ".", "visitClassContext", "(", "classContext", ")", ";", "methodFieldModifiers", "=", "fm", ".",...
builds up the method to field map of what method write to which fields this is one recursively so that if method A calls method B, and method B writes to field C, then A modifies F. @param classContext the context object of the currently parsed class
[ "builds", "up", "the", "method", "to", "field", "map", "of", "what", "method", "write", "to", "which", "fields", "this", "is", "one", "recursively", "so", "that", "if", "method", "A", "calls", "method", "B", "and", "method", "B", "writes", "to", "field",...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java#L318-L322
104,545
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
CollectionNamingConfusion.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { if (mapInterface != null) { this.clsContext = classContext; classContext.getJavaClass().accept(this); } }
java
@Override public void visitClassContext(ClassContext classContext) { if (mapInterface != null) { this.clsContext = classContext; classContext.getJavaClass().accept(this); } }
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "if", "(", "mapInterface", "!=", "null", ")", "{", "this", ".", "clsContext", "=", "classContext", ";", "classContext", ".", "getJavaClass", "(", ")", ".", ...
overrides the visitor to make sure that the static initializer was able to load the map class @param classContext the currently parsed class
[ "overrides", "the", "visitor", "to", "make", "sure", "that", "the", "static", "initializer", "was", "able", "to", "load", "the", "map", "class" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java#L83-L89
104,546
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
CollectionNamingConfusion.visitField
@Override public void visitField(Field obj) { if (checkConfusedName(obj.getName(), obj.getSignature())) { bugReporter.reportBug(new BugInstance(this, BugType.CNC_COLLECTION_NAMING_CONFUSION.name(), NORMAL_PRIORITY).addClass(this).addField(this) .addString(obj.getName())); ...
java
@Override public void visitField(Field obj) { if (checkConfusedName(obj.getName(), obj.getSignature())) { bugReporter.reportBug(new BugInstance(this, BugType.CNC_COLLECTION_NAMING_CONFUSION.name(), NORMAL_PRIORITY).addClass(this).addField(this) .addString(obj.getName())); ...
[ "@", "Override", "public", "void", "visitField", "(", "Field", "obj", ")", "{", "if", "(", "checkConfusedName", "(", "obj", ".", "getName", "(", ")", ",", "obj", ".", "getSignature", "(", ")", ")", ")", "{", "bugReporter", ".", "reportBug", "(", "new",...
overrides the visitor to look for fields where the name has 'Map', 'Set', 'List' in it but the type of that field isn't that. @param obj the currently parsed field
[ "overrides", "the", "visitor", "to", "look", "for", "fields", "where", "the", "name", "has", "Map", "Set", "List", "in", "it", "but", "the", "type", "of", "that", "field", "isn", "t", "that", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java#L97-L103
104,547
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
CollectionNamingConfusion.visitMethod
@Override public void visitMethod(Method obj) { LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { LocalVariable[] lvs = lvt.getLocalVariableTable(); for (LocalVariable lv : lvs) { if (checkConfusedName(lv.getName(), lv.getSignature())) {...
java
@Override public void visitMethod(Method obj) { LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { LocalVariable[] lvs = lvt.getLocalVariableTable(); for (LocalVariable lv : lvs) { if (checkConfusedName(lv.getName(), lv.getSignature())) {...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "LocalVariableTable", "lvt", "=", "obj", ".", "getLocalVariableTable", "(", ")", ";", "if", "(", "lvt", "!=", "null", ")", "{", "LocalVariable", "[", "]", "lvs", "=", "lvt"...
overrides the visitor to look for local variables where the name has 'Map', 'Set', 'List' in it but the type of that field isn't that. note that this only is useful if compiled with debug labels. @param obj the currently parsed method
[ "overrides", "the", "visitor", "to", "look", "for", "local", "variables", "where", "the", "name", "has", "Map", "Set", "List", "in", "it", "but", "the", "type", "of", "that", "field", "isn", "t", "that", ".", "note", "that", "this", "only", "is", "usef...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java#L112-L124
104,548
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
CollectionNamingConfusion.checkConfusedName
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "EXS_EXCEPTION_SOFTENING_RETURN_FALSE", justification = "No other simple way to determine whether class exists") private boolean checkConfusedName(String methodOrVariableName, String signature) { try { String name = methodOrVariableName...
java
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "EXS_EXCEPTION_SOFTENING_RETURN_FALSE", justification = "No other simple way to determine whether class exists") private boolean checkConfusedName(String methodOrVariableName, String signature) { try { String name = methodOrVariableName...
[ "@", "edu", ".", "umd", ".", "cs", ".", "findbugs", ".", "annotations", ".", "SuppressFBWarnings", "(", "value", "=", "\"EXS_EXCEPTION_SOFTENING_RETURN_FALSE\"", ",", "justification", "=", "\"No other simple way to determine whether class exists\"", ")", "private", "boole...
looks for a name that mentions a collection type but the wrong type for the variable @param methodOrVariableName the method or variable name @param signature the variable signature @return whether the name doesn't match the type
[ "looks", "for", "a", "name", "that", "mentions", "a", "collection", "type", "but", "the", "wrong", "type", "for", "the", "variable" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java#L135-L154
104,549
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java
ConflictingTimeUnits.sawOpcode
@Override public void sawOpcode(int seen) { Units unit = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKEVIRTUAL: case Const.INVOKEINTERFACE: case Const.INVOKESTATIC: unit = processI...
java
@Override public void sawOpcode(int seen) { Units unit = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKEVIRTUAL: case Const.INVOKEINTERFACE: case Const.INVOKESTATIC: unit = processI...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "Units", "unit", "=", "null", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".", "INVOKEVIRTUAL", ...
overrides the visitor to look for operations on two time unit values that are conflicting
[ "overrides", "the", "visitor", "to", "look", "for", "operations", "on", "two", "time", "unit", "values", "that", "are", "conflicting" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java#L179-L230
104,550
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java
ConflictingTimeUnits.processArithmetic
@SuppressWarnings("PMD.CompareObjectsWithEquals") private void processArithmetic() { if (stack.getStackDepth() > 1) { OpcodeStack.Item arg1 = stack.getStackItem(0); OpcodeStack.Item arg2 = stack.getStackItem(1); Units u1 = (Units) arg1.getUserValue(); Units u...
java
@SuppressWarnings("PMD.CompareObjectsWithEquals") private void processArithmetic() { if (stack.getStackDepth() > 1) { OpcodeStack.Item arg1 = stack.getStackItem(0); OpcodeStack.Item arg2 = stack.getStackItem(1); Units u1 = (Units) arg1.getUserValue(); Units u...
[ "@", "SuppressWarnings", "(", "\"PMD.CompareObjectsWithEquals\"", ")", "private", "void", "processArithmetic", "(", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", ">", "1", ")", "{", "OpcodeStack", ".", "Item", "arg1", "=", "stack", ".", "getS...
false positive; we're comparing enums
[ "false", "positive", ";", "we", "re", "comparing", "enums" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java#L250-L264
104,551
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { if ((throwableClass != null) && !isPre14Class(classContext.getJavaClass())) { stack = new OpcodeStack(); catchInfos = new HashSet<>(); exReg = new HashMap<>(); ...
java
@Override public void visitClassContext(ClassContext classContext) { try { if ((throwableClass != null) && !isPre14Class(classContext.getJavaClass())) { stack = new OpcodeStack(); catchInfos = new HashSet<>(); exReg = new HashMap<>(); ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "if", "(", "(", "throwableClass", "!=", "null", ")", "&&", "!", "isPre14Class", "(", "classContext", ".", "getJavaClass", "(", ")", ")", ")", ...
implements the visitor to make sure the jdk is 1.4 or better @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "make", "sure", "the", "jdk", "is", "1", ".", "4", "or", "better" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L97-L112
104,552
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.prescreen
public boolean prescreen(Code code, Method method) { if (method.isSynthetic()) { return false; } CodeException[] ce = code.getExceptionTable(); if (CollectionUtils.isEmpty(ce)) { return false; } BitSet bytecodeSet = getClassContext().getBytecodeS...
java
public boolean prescreen(Code code, Method method) { if (method.isSynthetic()) { return false; } CodeException[] ce = code.getExceptionTable(); if (CollectionUtils.isEmpty(ce)) { return false; } BitSet bytecodeSet = getClassContext().getBytecodeS...
[ "public", "boolean", "prescreen", "(", "Code", "code", ",", "Method", "method", ")", "{", "if", "(", "method", ".", "isSynthetic", "(", ")", ")", "{", "return", "false", ";", "}", "CodeException", "[", "]", "ce", "=", "code", ".", "getExceptionTable", ...
looks for methods that contain a catch block and an ATHROW opcode @param code the context object of the current code block @param method the context object of the current method @return if the class throws exceptions
[ "looks", "for", "methods", "that", "contain", "a", "catch", "block", "and", "an", "ATHROW", "opcode" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L123-L135
104,553
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.visitCode
@Override public void visitCode(Code obj) { if (prescreen(obj, getMethod())) { stack.resetForMethodEntry(this); catchInfos.clear(); exceptions = collectExceptions(obj.getExceptionTable()); exReg.clear(); lastWasExitPoint = false; super....
java
@Override public void visitCode(Code obj) { if (prescreen(obj, getMethod())) { stack.resetForMethodEntry(this); catchInfos.clear(); exceptions = collectExceptions(obj.getExceptionTable()); exReg.clear(); lastWasExitPoint = false; super....
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "prescreen", "(", "obj", ",", "getMethod", "(", ")", ")", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "catchInfos", ".", "clear", "(", ...
implements the visitor to filter out methods that don't throw exceptions @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "filter", "out", "methods", "that", "don", "t", "throw", "exceptions" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L143-L153
104,554
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.collectExceptions
public CodeException[] collectExceptions(CodeException... exs) { List<CodeException> filteredEx = new ArrayList<>(); for (CodeException ce : exs) { if ((ce.getCatchType() != 0) && (ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) { filteredEx.add(ce);...
java
public CodeException[] collectExceptions(CodeException... exs) { List<CodeException> filteredEx = new ArrayList<>(); for (CodeException ce : exs) { if ((ce.getCatchType() != 0) && (ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) { filteredEx.add(ce);...
[ "public", "CodeException", "[", "]", "collectExceptions", "(", "CodeException", "...", "exs", ")", "{", "List", "<", "CodeException", ">", "filteredEx", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "CodeException", "ce", ":", "exs", ")", "{", ...
collects all the valid exception objects (ones where start and finish are before the target @param exs the exceptions from the class file @return the filtered exceptions
[ "collects", "all", "the", "valid", "exception", "objects", "(", "ones", "where", "start", "and", "finish", "are", "before", "the", "target" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L162-L170
104,555
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.isPossibleExBuilder
public boolean isPossibleExBuilder(int excReg) throws ClassNotFoundException { String sig = getSigConstantOperand(); String returnSig = SignatureUtils.getReturnSignature(sig); if (returnSig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { returnSig = SignatureUtils.trimSignature(retu...
java
public boolean isPossibleExBuilder(int excReg) throws ClassNotFoundException { String sig = getSigConstantOperand(); String returnSig = SignatureUtils.getReturnSignature(sig); if (returnSig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { returnSig = SignatureUtils.trimSignature(retu...
[ "public", "boolean", "isPossibleExBuilder", "(", "int", "excReg", ")", "throws", "ClassNotFoundException", "{", "String", "sig", "=", "getSigConstantOperand", "(", ")", ";", "String", "returnSig", "=", "SignatureUtils", ".", "getReturnSignature", "(", "sig", ")", ...
returns whether the method called might be a method that builds an exception using the original exception. It does so by looking to see if the method returns an exception, and if one of the parameters is the original exception @param excReg the register of the original exception caught @return whether this method call...
[ "returns", "whether", "the", "method", "called", "might", "be", "a", "method", "that", "builds", "an", "exception", "using", "the", "original", "exception", ".", "It", "does", "so", "by", "looking", "to", "see", "if", "the", "method", "returns", "an", "exc...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L327-L346
104,556
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.updateExceptionRegister
private boolean updateExceptionRegister(CatchInfo ci, int seen, int pc) { if (OpcodeUtils.isAStore(seen)) { int reg = RegisterUtils.getAStoreReg(this, seen); ci.setReg(reg); exReg.put(Integer.valueOf(reg), Boolean.TRUE); LocalVariableTable lvt = getMethod().getLoc...
java
private boolean updateExceptionRegister(CatchInfo ci, int seen, int pc) { if (OpcodeUtils.isAStore(seen)) { int reg = RegisterUtils.getAStoreReg(this, seen); ci.setReg(reg); exReg.put(Integer.valueOf(reg), Boolean.TRUE); LocalVariableTable lvt = getMethod().getLoc...
[ "private", "boolean", "updateExceptionRegister", "(", "CatchInfo", "ci", ",", "int", "seen", ",", "int", "pc", ")", "{", "if", "(", "OpcodeUtils", ".", "isAStore", "(", "seen", ")", ")", "{", "int", "reg", "=", "RegisterUtils", ".", "getAStoreReg", "(", ...
looks to update the catchinfo block with the register used for the exception variable. If their is a local variable table, but the local variable can't be found return false, signifying an empty catch block. @param ci the catchinfo record for the catch starting at this pc @param seen the opcode of the currently visite...
[ "looks", "to", "update", "the", "catchinfo", "block", "with", "the", "register", "used", "for", "the", "exception", "variable", ".", "If", "their", "is", "a", "local", "variable", "table", "but", "the", "local", "variable", "can", "t", "be", "found", "retu...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L394-L413
104,557
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.addCatchBlock
private void addCatchBlock(int start, int finish) { CatchInfo ci = new CatchInfo(start, finish); catchInfos.add(ci); }
java
private void addCatchBlock(int start, int finish) { CatchInfo ci = new CatchInfo(start, finish); catchInfos.add(ci); }
[ "private", "void", "addCatchBlock", "(", "int", "start", ",", "int", "finish", ")", "{", "CatchInfo", "ci", "=", "new", "CatchInfo", "(", "start", ",", "finish", ")", ";", "catchInfos", ".", "add", "(", "ci", ")", ";", "}" ]
add a catch block info record for the catch block that is guessed to be in the range of start to finish @param start the handler pc @param finish the guessed end of the catch block
[ "add", "a", "catch", "block", "info", "record", "for", "the", "catch", "block", "that", "is", "guessed", "to", "be", "in", "the", "range", "of", "start", "to", "finish" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L423-L426
104,558
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
UseVarArgs.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { javaClass = classContext.getJavaClass(); if (javaClass.getMajor() >= Const.MAJOR_1_5) { javaClass.accept(this); } } finally { javaClass = null; } }
java
@Override public void visitClassContext(ClassContext classContext) { try { javaClass = classContext.getJavaClass(); if (javaClass.getMajor() >= Const.MAJOR_1_5) { javaClass.accept(this); } } finally { javaClass = null; } }
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "javaClass", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "javaClass", ".", "getMajor", "(", ")", ">=", "Const", ".", ...
overrides the visitor to make sure that the class was compiled by java 1.5 or later. @param classContext the context object of the currently parsed class
[ "overrides", "the", "visitor", "to", "make", "sure", "that", "the", "class", "was", "compiled", "by", "java", "1", ".", "5", "or", "later", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java#L62-L72
104,559
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
UseVarArgs.visitMethod
@Override public void visitMethod(Method obj) { try { if (obj.isSynthetic()) { return; } if (Values.CONSTRUCTOR.equals(getMethodName()) && javaClass.getClassName().contains("$")) { return; } List<String> types = SignatureUtils.getParameterSignatures(obj.getSignature()); if ((types.isEmpty...
java
@Override public void visitMethod(Method obj) { try { if (obj.isSynthetic()) { return; } if (Values.CONSTRUCTOR.equals(getMethodName()) && javaClass.getClassName().contains("$")) { return; } List<String> types = SignatureUtils.getParameterSignatures(obj.getSignature()); if ((types.isEmpty...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "try", "{", "if", "(", "obj", ".", "isSynthetic", "(", ")", ")", "{", "return", ";", "}", "if", "(", "Values", ".", "CONSTRUCTOR", ".", "equals", "(", "getMethodName", ...
overrides the visitor to look for methods that has an array as a last parameter of an array type, where the base type is not like the previous parameter nor something like a char or byte array. @param obj the currently parse method
[ "overrides", "the", "visitor", "to", "look", "for", "methods", "that", "has", "an", "array", "as", "a", "last", "parameter", "of", "an", "array", "type", "where", "the", "base", "type", "is", "not", "like", "the", "previous", "parameter", "nor", "something...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java#L81-L131
104,560
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
UseVarArgs.hasSimilarParms
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "LII_LIST_INDEXED_ITERATING", justification = "this doesn't iterate over every element, so we can't use a for-each loop") private static boolean hasSimilarParms(List<String> argTypes) { for (int i = 0; i < (argTypes.size() - 1); i++) { if (argTypes.get(...
java
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "LII_LIST_INDEXED_ITERATING", justification = "this doesn't iterate over every element, so we can't use a for-each loop") private static boolean hasSimilarParms(List<String> argTypes) { for (int i = 0; i < (argTypes.size() - 1); i++) { if (argTypes.get(...
[ "@", "edu", ".", "umd", ".", "cs", ".", "findbugs", ".", "annotations", ".", "SuppressFBWarnings", "(", "value", "=", "\"LII_LIST_INDEXED_ITERATING\"", ",", "justification", "=", "\"this doesn't iterate over every element, so we can't use a for-each loop\"", ")", "private",...
determines whether a bunch of types are similar and thus would be confusing to have one be a varargs. @param argTypes the parameter signatures to check @return whether the parameter are similar
[ "determines", "whether", "a", "bunch", "of", "types", "are", "similar", "and", "thus", "would", "be", "confusing", "to", "have", "one", "be", "a", "varargs", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java#L148-L169
104,561
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
UseVarArgs.isInherited
private boolean isInherited(Method m) throws ClassNotFoundException { JavaClass[] infs = javaClass.getAllInterfaces(); for (JavaClass inf : infs) { if (hasMethod(inf, m)) { return true; } } JavaClass[] sups = javaClass.getSuperClasses(); for (JavaClass sup : sups) { if (hasMethod(sup, m)) { ...
java
private boolean isInherited(Method m) throws ClassNotFoundException { JavaClass[] infs = javaClass.getAllInterfaces(); for (JavaClass inf : infs) { if (hasMethod(inf, m)) { return true; } } JavaClass[] sups = javaClass.getSuperClasses(); for (JavaClass sup : sups) { if (hasMethod(sup, m)) { ...
[ "private", "boolean", "isInherited", "(", "Method", "m", ")", "throws", "ClassNotFoundException", "{", "JavaClass", "[", "]", "infs", "=", "javaClass", ".", "getAllInterfaces", "(", ")", ";", "for", "(", "JavaClass", "inf", ":", "infs", ")", "{", "if", "("...
looks to see if this method is derived from a super class. If it is we don't want to report on it, as that would entail changing a whole hierarchy @param m the current method @return if the method is inherited @throws ClassNotFoundException if the super class(s) aren't found
[ "looks", "to", "see", "if", "this", "method", "is", "derived", "from", "a", "super", "class", ".", "If", "it", "is", "we", "don", "t", "want", "to", "report", "on", "it", "as", "that", "would", "entail", "changing", "a", "whole", "hierarchy" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java#L180-L196
104,562
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
UseVarArgs.hasMethod
private static boolean hasMethod(JavaClass c, Method candidateMethod) { String name = candidateMethod.getName(); String sig = candidateMethod.getSignature(); for (Method method : c.getMethods()) { if (!method.isStatic() && method.getName().equals(name) && method.getSignature().equals(sig)) { return true; ...
java
private static boolean hasMethod(JavaClass c, Method candidateMethod) { String name = candidateMethod.getName(); String sig = candidateMethod.getSignature(); for (Method method : c.getMethods()) { if (!method.isStatic() && method.getName().equals(name) && method.getSignature().equals(sig)) { return true; ...
[ "private", "static", "boolean", "hasMethod", "(", "JavaClass", "c", ",", "Method", "candidateMethod", ")", "{", "String", "name", "=", "candidateMethod", ".", "getName", "(", ")", ";", "String", "sig", "=", "candidateMethod", ".", "getSignature", "(", ")", "...
looks to see if a class has a method with a specific name and signature @param c the class to check @param candidateMethod the method to look for @return whether this class has the exact method
[ "looks", "to", "see", "if", "a", "class", "has", "a", "method", "with", "a", "specific", "name", "and", "signature" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java#L206-L217
104,563
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java
IncorrectInternalClassUse.visitClassContext
@Override public void visitClassContext(ClassContext context) { JavaClass cls = context.getJavaClass(); if (!isInternal(cls.getClassName())) { ConstantPool pool = cls.getConstantPool(); int numItems = pool.getLength(); for (int i = 0; i < numItems; i++) { ...
java
@Override public void visitClassContext(ClassContext context) { JavaClass cls = context.getJavaClass(); if (!isInternal(cls.getClassName())) { ConstantPool pool = cls.getConstantPool(); int numItems = pool.getLength(); for (int i = 0; i < numItems; i++) { ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "context", ")", "{", "JavaClass", "cls", "=", "context", ".", "getJavaClass", "(", ")", ";", "if", "(", "!", "isInternal", "(", "cls", ".", "getClassName", "(", ")", ")", ")", "...
implements the visitor to look for classes that reference com.sun.xxx, or org.apache.xerces.xxx classes by looking for class Const in the constant pool @param context the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "look", "for", "classes", "that", "reference", "com", ".", "sun", ".", "xxx", "or", "org", ".", "apache", ".", "xerces", ".", "xxx", "classes", "by", "looking", "for", "class", "Const", "in", "the", "constant", "pool...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java#L97-L114
104,564
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java
IncorrectInternalClassUse.isInternal
private static boolean isInternal(String clsName) { boolean internal = false; for (String internalPackage : internalPackages) { if (clsName.startsWith(internalPackage)) { internal = true; break; } } if (internal) { for ...
java
private static boolean isInternal(String clsName) { boolean internal = false; for (String internalPackage : internalPackages) { if (clsName.startsWith(internalPackage)) { internal = true; break; } } if (internal) { for ...
[ "private", "static", "boolean", "isInternal", "(", "String", "clsName", ")", "{", "boolean", "internal", "=", "false", ";", "for", "(", "String", "internalPackage", ":", "internalPackages", ")", "{", "if", "(", "clsName", ".", "startsWith", "(", "internalPacka...
determines if the class in question is an internal class by looking at package prefixes @param clsName the name of the class to check @return whether the class is internal
[ "determines", "if", "the", "class", "in", "question", "is", "an", "internal", "class", "by", "looking", "at", "package", "prefixes" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java#L131-L150
104,565
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java
FindClassCircularDependencies.getDependenciesForClass
private Set<String> getDependenciesForClass(String clsName) { Set<String> dependencies = dependencyGraph.get(clsName); if (dependencies == null) { dependencies = new HashSet<>(); dependencyGraph.put(clsName, dependencies); } return dependencies; }
java
private Set<String> getDependenciesForClass(String clsName) { Set<String> dependencies = dependencyGraph.get(clsName); if (dependencies == null) { dependencies = new HashSet<>(); dependencyGraph.put(clsName, dependencies); } return dependencies; }
[ "private", "Set", "<", "String", ">", "getDependenciesForClass", "(", "String", "clsName", ")", "{", "Set", "<", "String", ">", "dependencies", "=", "dependencyGraph", ".", "get", "(", "clsName", ")", ";", "if", "(", "dependencies", "==", "null", ")", "{",...
returns a set of dependent class names for a class, and if it doesn't exist create the set install it, and then return; @param clsName the class for which you are trying to get dependencies @return the active set of classes that are dependent on the specified class
[ "returns", "a", "set", "of", "dependent", "class", "names", "for", "a", "class", "and", "if", "it", "doesn", "t", "exist", "create", "the", "set", "install", "it", "and", "then", "return", ";" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java#L160-L168
104,566
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java
UnrelatedCollectionContents.visitClassContext
@Override public void visitClassContext(final ClassContext classContext) { try { stack = new OpcodeStack(); memberCollections = new HashMap<>(); memberSourceLineAnnotations = new HashMap<>(); super.visitClassContext(classContext); } finally { ...
java
@Override public void visitClassContext(final ClassContext classContext) { try { stack = new OpcodeStack(); memberCollections = new HashMap<>(); memberSourceLineAnnotations = new HashMap<>(); super.visitClassContext(classContext); } finally { ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "final", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "memberCollections", "=", "new", "HashMap", "<>", "(", ")", ";", "memberSourceLineAnn...
implements the visitor to create and destroy the stack and member collections @param classContext the context object for the currently parsed class
[ "implements", "the", "visitor", "to", "create", "and", "destroy", "the", "stack", "and", "member", "collections" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java#L81-L93
104,567
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java
UnrelatedCollectionContents.visitCode
@Override public void visitCode(final Code obj) { try { localCollections = new HashMap<>(); localScopeEnds = new HashMap<>(); localSourceLineAnnotations = new HashMap<>(); stack.resetForMethodEntry(this); super.visitCode(obj); } finally { ...
java
@Override public void visitCode(final Code obj) { try { localCollections = new HashMap<>(); localScopeEnds = new HashMap<>(); localSourceLineAnnotations = new HashMap<>(); stack.resetForMethodEntry(this); super.visitCode(obj); } finally { ...
[ "@", "Override", "public", "void", "visitCode", "(", "final", "Code", "obj", ")", "{", "try", "{", "localCollections", "=", "new", "HashMap", "<>", "(", ")", ";", "localScopeEnds", "=", "new", "HashMap", "<>", "(", ")", ";", "localSourceLineAnnotations", "...
implements the visitor to reset the opcode stack, and clear the various collections @param obj the currently parsed code block
[ "implements", "the", "visitor", "to", "reset", "the", "opcode", "stack", "and", "clear", "the", "various", "collections" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java#L101-L114
104,568
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java
UnrelatedCollectionContents.sawOpcode
@Override public void sawOpcode(final int seen) { try { stack.precomputation(this); BitSet regs = localScopeEnds.remove(Integer.valueOf(getPC())); if (regs != null) { int i = regs.nextSetBit(0); while (i >= 0) { localCo...
java
@Override public void sawOpcode(final int seen) { try { stack.precomputation(this); BitSet regs = localScopeEnds.remove(Integer.valueOf(getPC())); if (regs != null) { int i = regs.nextSetBit(0); while (i >= 0) { localCo...
[ "@", "Override", "public", "void", "sawOpcode", "(", "final", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "BitSet", "regs", "=", "localScopeEnds", ".", "remove", "(", "Integer", ".", "valueOf", "(", "getPC"...
implements the visitor to look for collection method calls that put objects into the collection that are unrelated by anything besides java.lang.Objecct @param seen the currently parsed opcode
[ "implements", "the", "visitor", "to", "look", "for", "collection", "method", "calls", "that", "put", "objects", "into", "the", "collection", "that", "are", "unrelated", "by", "anything", "besides", "java", ".", "lang", ".", "Objecct" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java#L122-L170
104,569
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java
UnrelatedCollectionContents.mergeItem
private void mergeItem(final Set<String> supers, final Set<SourceLineAnnotation> sla, final OpcodeStack.Item addItm) throws ClassNotFoundException { if (supers.isEmpty()) { return; } Set<String> s = new HashSet<>(); addNewItem(s, addItm); if (s.isEmpty()) { ...
java
private void mergeItem(final Set<String> supers, final Set<SourceLineAnnotation> sla, final OpcodeStack.Item addItm) throws ClassNotFoundException { if (supers.isEmpty()) { return; } Set<String> s = new HashSet<>(); addNewItem(s, addItm); if (s.isEmpty()) { ...
[ "private", "void", "mergeItem", "(", "final", "Set", "<", "String", ">", "supers", ",", "final", "Set", "<", "SourceLineAnnotation", ">", "sla", ",", "final", "OpcodeStack", ".", "Item", "addItm", ")", "throws", "ClassNotFoundException", "{", "if", "(", "sup...
intersects the set of possible superclass that this collection might have seen before with this one. If we find that there is no commonality between superclasses, report it as a bug. @param supers the collection of possible superclass/interfaces that has been seen for this collection thus far @param sla the location o...
[ "intersects", "the", "set", "of", "possible", "superclass", "that", "this", "collection", "might", "have", "seen", "before", "with", "this", "one", ".", "If", "we", "find", "that", "there", "is", "no", "commonality", "between", "superclasses", "report", "it", ...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java#L245-L273
104,570
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnsynchronizedSingletonFieldWrites.java
UnsynchronizedSingletonFieldWrites.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (isSingleton(cls)) { syncBlockBranchResetValues = new HashMap<>(); stack = new OpcodeStack(); super.visitClassCon...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (isSingleton(cls)) { syncBlockBranchResetValues = new HashMap<>(); stack = new OpcodeStack(); super.visitClassCon...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "isSingleton", "(", "cls", ")", ")", "{", "syncBlockBra...
implements the visitor to look for classes that are singletons @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "look", "for", "classes", "that", "are", "singletons" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnsynchronizedSingletonFieldWrites.java#L89-L102
104,571
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnsynchronizedSingletonFieldWrites.java
UnsynchronizedSingletonFieldWrites.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); if (isIgnorableMethod(m)) { return; } stack.resetForMethodEntry(this); syncBlockBranchResetValues.clear(); syncBlockCount = 0; super.visitCode(obj); }
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if (isIgnorableMethod(m)) { return; } stack.resetForMethodEntry(this); syncBlockBranchResetValues.clear(); syncBlockCount = 0; super.visitCode(obj); }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "isIgnorableMethod", "(", "m", ")", ")", "{", "return", ";", "}", "stack", ".", "resetForMethodEntry", "(", "this",...
implements the visitor to look for methods that could possibly be 'normal' methods where a field is written to @param obj the currently parsed code block
[ "implements", "the", "visitor", "to", "look", "for", "methods", "that", "could", "possibly", "be", "normal", "methods", "where", "a", "field", "is", "written", "to" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnsynchronizedSingletonFieldWrites.java#L110-L122
104,572
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConflatingResourcesAndFiles.java
ConflatingResourcesAndFiles.sawOpcode
@Override public void sawOpcode(int seen) { boolean sawResource = false; try { stack.precomputation(this); if (seen == Const.INVOKEVIRTUAL) { sawResource = processInvokeVirtual(); } else if (seen == Const.INVOKESPECIAL) { sawResour...
java
@Override public void sawOpcode(int seen) { boolean sawResource = false; try { stack.precomputation(this); if (seen == Const.INVOKEVIRTUAL) { sawResource = processInvokeVirtual(); } else if (seen == Const.INVOKESPECIAL) { sawResour...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "boolean", "sawResource", "=", "false", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "seen", "==", "Const", ".", "INVOKEVIRTUAL", ")", "...
overrides the visitor to look conflated use of resources and files
[ "overrides", "the", "visitor", "to", "look", "conflated", "use", "of", "resources", "and", "files" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflatingResourcesAndFiles.java#L86-L105
104,573
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
PossiblyRedundantMethodCalls.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); localMethodCalls = new HashMap<>(); fieldMethodCalls = new HashMap<>(); staticMethodCalls = new HashMap<>(); branchTargets = new BitSet(); super.visitClassContext(classContext); } finally { st...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); localMethodCalls = new HashMap<>(); fieldMethodCalls = new HashMap<>(); staticMethodCalls = new HashMap<>(); branchTargets = new BitSet(); super.visitClassContext(classContext); } finally { st...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "localMethodCalls", "=", "new", "HashMap", "<>", "(", ")", ";", "fieldMethodCalls", "=", "ne...
implements the visitor to create and clear the stack, method call maps, and branch targets @param classContext the context object of the currently visited class
[ "implements", "the", "visitor", "to", "create", "and", "clear", "the", "stack", "method", "call", "maps", "and", "branch", "targets" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java#L216-L232
104,574
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
PossiblyRedundantMethodCalls.getBugPriority
private static int getBugPriority(String methodName, MethodInfo mi) { if (Values.STATIC_INITIALIZER.equals(methodName)) { return LOW_PRIORITY; } if ((mi.getNumBytes() >= highByteCountLimit) || (mi.getNumMethodCalls() >= highMethodCallLimit)) { return HIGH_PRIORITY; } if ((mi.getNumBytes() >= normalByt...
java
private static int getBugPriority(String methodName, MethodInfo mi) { if (Values.STATIC_INITIALIZER.equals(methodName)) { return LOW_PRIORITY; } if ((mi.getNumBytes() >= highByteCountLimit) || (mi.getNumMethodCalls() >= highMethodCallLimit)) { return HIGH_PRIORITY; } if ((mi.getNumBytes() >= normalByt...
[ "private", "static", "int", "getBugPriority", "(", "String", "methodName", ",", "MethodInfo", "mi", ")", "{", "if", "(", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "methodName", ")", ")", "{", "return", "LOW_PRIORITY", ";", "}", "if", "(", "(...
returns the bug priority based on metrics about the method @param methodName TODO @param mi metrics about the method @return the bug priority
[ "returns", "the", "bug", "priority", "based", "on", "metrics", "about", "the", "method" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java#L473-L491
104,575
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
PossiblyRedundantMethodCalls.isRiskyName
private static boolean isRiskyName(String className, String methodName) { if (riskyClassNames.contains(className)) { return true; } String qualifiedMethodName = className + '.' + methodName; if (riskyMethodNameContents.contains(qualifiedMethodName)) { return true; } for (String riskyName : riskyMeth...
java
private static boolean isRiskyName(String className, String methodName) { if (riskyClassNames.contains(className)) { return true; } String qualifiedMethodName = className + '.' + methodName; if (riskyMethodNameContents.contains(qualifiedMethodName)) { return true; } for (String riskyName : riskyMeth...
[ "private", "static", "boolean", "isRiskyName", "(", "String", "className", ",", "String", "methodName", ")", "{", "if", "(", "riskyClassNames", ".", "contains", "(", "className", ")", ")", "{", "return", "true", ";", "}", "String", "qualifiedMethodName", "=", ...
returns true if the class or method name contains a pattern that is considered likely to be this modifying @param className the class name to check @param methodName the method name to check @return whether the method sounds like it modifies this
[ "returns", "true", "if", "the", "class", "or", "method", "name", "contains", "a", "pattern", "that", "is", "considered", "likely", "to", "be", "this", "modifying" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java#L501-L518
104,576
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
PossiblyRedundantMethodCalls.getLineNumber
private int getLineNumber(int pc) { LineNumberTable lnt = getMethod().getLineNumberTable(); if (lnt == null) { return pc; } LineNumber[] lns = lnt.getLineNumberTable(); if (lns == null) { return pc; } if (pc > lns[lns.length - 1].getStartPC()) { return lns[lns.length - 1].getLineNumber(); } ...
java
private int getLineNumber(int pc) { LineNumberTable lnt = getMethod().getLineNumberTable(); if (lnt == null) { return pc; } LineNumber[] lns = lnt.getLineNumberTable(); if (lns == null) { return pc; } if (pc > lns[lns.length - 1].getStartPC()) { return lns[lns.length - 1].getLineNumber(); } ...
[ "private", "int", "getLineNumber", "(", "int", "pc", ")", "{", "LineNumberTable", "lnt", "=", "getMethod", "(", ")", ".", "getLineNumberTable", "(", ")", ";", "if", "(", "lnt", "==", "null", ")", "{", "return", "pc", ";", "}", "LineNumber", "[", "]", ...
returns the source line number for the pc, or just the pc if the line number table doesn't exist @param pc current pc @return the line number
[ "returns", "the", "source", "line", "number", "for", "the", "pc", "or", "just", "the", "pc", "if", "the", "line", "number", "table", "doesn", "t", "exist" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java#L527-L557
104,577
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CloneUsability.java
CloneUsability.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { if (cloneClass == null) { return; } try { cls = classContext.getJavaClass(); if (cls.implementationOf(cloneClass)) { clsName = cls.getClassName(); stack ...
java
@Override public void visitClassContext(ClassContext classContext) { if (cloneClass == null) { return; } try { cls = classContext.getJavaClass(); if (cls.implementationOf(cloneClass)) { clsName = cls.getClassName(); stack ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "if", "(", "cloneClass", "==", "null", ")", "{", "return", ";", "}", "try", "{", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", ...
overrides the visitor to check for classes that implement Cloneable. @param classContext the context object that holds the JavaClass being parsed
[ "overrides", "the", "visitor", "to", "check", "for", "classes", "that", "implement", "Cloneable", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CloneUsability.java#L75-L95
104,578
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CloneUsability.java
CloneUsability.sawOpcode
@Override public void sawOpcode(int seen) { try { if ((seen == Const.ATHROW) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); if ("Ljava/lang/CloneNotSupportedException;".equals(item.getSignature())) { throwsCNFE...
java
@Override public void sawOpcode(int seen) { try { if ((seen == Const.ATHROW) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); if ("Ljava/lang/CloneNotSupportedException;".equals(item.getSignature())) { throwsCNFE...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "if", "(", "(", "seen", "==", "Const", ".", "ATHROW", ")", "&&", "(", "stack", ".", "getStackDepth", "(", ")", ">", "0", ")", ")", "{", "OpcodeStack", ".", ...
overrides the visitor to look for a CloneNotSupported being thrown @param seen the currently parsed opcode
[ "overrides", "the", "visitor", "to", "look", "for", "a", "CloneNotSupported", "being", "thrown" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CloneUsability.java#L151-L163
104,579
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java
NeedlessInstanceRetrieval.visitCode
@Override public void visitCode(Code obj) { try { lnTable = obj.getLineNumberTable(); if (lnTable != null) { state = State.SEEN_NOTHING; invokePC = -1; returnType = null; super.visitCode(obj); } } fin...
java
@Override public void visitCode(Code obj) { try { lnTable = obj.getLineNumberTable(); if (lnTable != null) { state = State.SEEN_NOTHING; invokePC = -1; returnType = null; super.visitCode(obj); } } fin...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "lnTable", "=", "obj", ".", "getLineNumberTable", "(", ")", ";", "if", "(", "lnTable", "!=", "null", ")", "{", "state", "=", "State", ".", "SEEN_NOTHING", ";", ...
overrides the interface to collect the line number table, and reset state @param obj the content object of the currently parsed code
[ "overrides", "the", "interface", "to", "collect", "the", "line", "number", "table", "and", "reset", "state" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java#L65-L78
104,580
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java
NeedlessInstanceRetrieval.sawOpcode
@Override public void sawOpcode(int seen) { switch (state) { case SEEN_NOTHING: if ((seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEVIRTUAL)) { String sig = getSigConstantOperand(); String returnSig = SignatureUtils.getReturnSignatu...
java
@Override public void sawOpcode(int seen) { switch (state) { case SEEN_NOTHING: if ((seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEVIRTUAL)) { String sig = getSigConstantOperand(); String returnSig = SignatureUtils.getReturnSignatu...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "switch", "(", "state", ")", "{", "case", "SEEN_NOTHING", ":", "if", "(", "(", "seen", "==", "Const", ".", "INVOKEINTERFACE", ")", "||", "(", "seen", "==", "Const", ".", "I...
overrides the interface to find accesses of static variables off of an instance immediately fetched from a method call. @param seen the opcode of the currently visited instruction
[ "overrides", "the", "interface", "to", "find", "accesses", "of", "static", "variables", "off", "of", "an", "instance", "immediately", "fetched", "from", "a", "method", "call", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java#L86-L134
104,581
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java
CyclomaticComplexity.visitClassContext
@Override public void visitClassContext(final ClassContext context) { try { classContext = context; classContext.getJavaClass().accept(this); } finally { classContext = null; } }
java
@Override public void visitClassContext(final ClassContext context) { try { classContext = context; classContext.getJavaClass().accept(this); } finally { classContext = null; } }
[ "@", "Override", "public", "void", "visitClassContext", "(", "final", "ClassContext", "context", ")", "{", "try", "{", "classContext", "=", "context", ";", "classContext", ".", "getJavaClass", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "finally", ...
overrides the visitor to store the class context @param context the context object for the currently parsed class
[ "overrides", "the", "visitor", "to", "store", "the", "class", "context" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java#L70-L78
104,582
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java
CyclomaticComplexity.visitMethod
@Override public void visitMethod(final Method obj) { try { if (obj.isSynthetic()) { return; } Code code = obj.getCode(); if (code == null) { return; } // There really is no valid relationship between ...
java
@Override public void visitMethod(final Method obj) { try { if (obj.isSynthetic()) { return; } Code code = obj.getCode(); if (code == null) { return; } // There really is no valid relationship between ...
[ "@", "Override", "public", "void", "visitMethod", "(", "final", "Method", "obj", ")", "{", "try", "{", "if", "(", "obj", ".", "isSynthetic", "(", ")", ")", "{", "return", ";", "}", "Code", "code", "=", "obj", ".", "getCode", "(", ")", ";", "if", ...
overrides the visitor to navigate the basic block list to count branches @param obj the method of the currently parsed method
[ "overrides", "the", "visitor", "to", "navigate", "the", "basic", "block", "list", "to", "count", "branches" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java#L94-L159
104,583
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java
JPAIssues.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); if (m.isSynthetic()) { return; } isPublic = m.isPublic(); stack.resetForMethodEntry(this); super.visitCode(obj); }
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if (m.isSynthetic()) { return; } isPublic = m.isPublic(); stack.resetForMethodEntry(this); super.visitCode(obj); }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "m", ".", "isSynthetic", "(", ")", ")", "{", "return", ";", "}", "isPublic", "=", "m", ".", "isPublic", "(", ...
implements the visitor to reset the opcode stack, Note that the synthetic check is done in both visitMethod and visitCode as visitMethod is not a proper listener stopping method. We don't want to report issues reported in visitMethod if it is synthetic, but we also don't want it to get into sawOpcode, so that is why it...
[ "implements", "the", "visitor", "to", "reset", "the", "opcode", "stack", "Note", "that", "the", "synthetic", "check", "is", "done", "in", "both", "visitMethod", "and", "visitCode", "as", "visitMethod", "is", "not", "a", "proper", "listener", "stopping", "metho...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java#L188-L200
104,584
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java
JPAIssues.catalogClass
private void catalogClass(JavaClass clz) { transactionalMethods = new HashMap<>(); isEntity = false; hasId = false; hasGeneratedValue = false; hasEagerOneToMany = false; hasHCEquals = false; for (AnnotationEntry entry : clz.getAnnotationEntries()) { i...
java
private void catalogClass(JavaClass clz) { transactionalMethods = new HashMap<>(); isEntity = false; hasId = false; hasGeneratedValue = false; hasEagerOneToMany = false; hasHCEquals = false; for (AnnotationEntry entry : clz.getAnnotationEntries()) { i...
[ "private", "void", "catalogClass", "(", "JavaClass", "clz", ")", "{", "transactionalMethods", "=", "new", "HashMap", "<>", "(", ")", ";", "isEntity", "=", "false", ";", "hasId", "=", "false", ";", "hasGeneratedValue", "=", "false", ";", "hasEagerOneToMany", ...
parses the current class for spring-tx and jpa annotations, as well as hashCode and equals methods. @param clz the currently parsed class
[ "parses", "the", "current", "class", "for", "spring", "-", "tx", "and", "jpa", "annotations", "as", "well", "as", "hashCode", "and", "equals", "methods", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java#L275-L302
104,585
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java
JPAIssues.catalogFieldOrMethod
private void catalogFieldOrMethod(FieldOrMethod fm) { for (AnnotationEntry entry : fm.getAnnotationEntries()) { String type = entry.getAnnotationType(); switch (type) { case "Lorg/springframework/transaction/annotation/Transactional;": if (fm instanceo...
java
private void catalogFieldOrMethod(FieldOrMethod fm) { for (AnnotationEntry entry : fm.getAnnotationEntries()) { String type = entry.getAnnotationType(); switch (type) { case "Lorg/springframework/transaction/annotation/Transactional;": if (fm instanceo...
[ "private", "void", "catalogFieldOrMethod", "(", "FieldOrMethod", "fm", ")", "{", "for", "(", "AnnotationEntry", "entry", ":", "fm", ".", "getAnnotationEntries", "(", ")", ")", "{", "String", "type", "=", "entry", ".", "getAnnotationType", "(", ")", ";", "swi...
parses a field or method for spring-tx or jpa annotations @param fm the currently parsed field or method
[ "parses", "a", "field", "or", "method", "for", "spring", "-", "tx", "or", "jpa", "annotations" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java#L310-L355
104,586
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java
JPAIssues.getDeclaredExceptions
private Set<JavaClass> getDeclaredExceptions(Method method) throws ClassNotFoundException { ExceptionTable et = method.getExceptionTable(); if ((et == null) || (et.getLength() == 0)) { return Collections.<JavaClass> emptySet(); } Set<JavaClass> exceptions = new HashSet<>(); ...
java
private Set<JavaClass> getDeclaredExceptions(Method method) throws ClassNotFoundException { ExceptionTable et = method.getExceptionTable(); if ((et == null) || (et.getLength() == 0)) { return Collections.<JavaClass> emptySet(); } Set<JavaClass> exceptions = new HashSet<>(); ...
[ "private", "Set", "<", "JavaClass", ">", "getDeclaredExceptions", "(", "Method", "method", ")", "throws", "ClassNotFoundException", "{", "ExceptionTable", "et", "=", "method", ".", "getExceptionTable", "(", ")", ";", "if", "(", "(", "et", "==", "null", ")", ...
retrieves the set of non-runtime exceptions that are declared to be thrown by the method @param method the currently parsed method @return the set of exceptions thrown @throws ClassNotFoundException if an exception class is not found
[ "retrieves", "the", "set", "of", "non", "-", "runtime", "exceptions", "that", "are", "declared", "to", "be", "thrown", "by", "the", "method" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java#L445-L460
104,587
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java
BloatedSynchronizedBlock.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); if (prescreen(m)) { if (m.isSynchronized()) { syncPC = 0; } else { syncPC = -1; } isStatic = m.isStatic(); unsafeAliases.clear(); ...
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if (prescreen(m)) { if (m.isSynchronized()) { syncPC = 0; } else { syncPC = -1; } isStatic = m.isStatic(); unsafeAliases.clear(); ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "prescreen", "(", "m", ")", ")", "{", "if", "(", "m", ".", "isSynchronized", "(", ")", ")", "{", "syncPC", "=...
implement the visitor to reset the sync count, the stack, and gather some information @param obj the context object for the currently parsed method
[ "implement", "the", "visitor", "to", "reset", "the", "sync", "count", "the", "stack", "and", "gather", "some", "information" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java#L102-L118
104,588
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java
BloatedSynchronizedBlock.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (unsafeCallOccurred && OpcodeUtils.isAStore(seen)) { int storeReg = RegisterUtils.getAStoreReg(this, seen); if (storeReg >= 0) { unsafeAliases.set(sto...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (unsafeCallOccurred && OpcodeUtils.isAStore(seen)) { int storeReg = RegisterUtils.getAStoreReg(this, seen); if (storeReg >= 0) { unsafeAliases.set(sto...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "unsafeCallOccurred", "&&", "OpcodeUtils", ".", "isAStore", "(", "seen", ")", ")", "{", "int", "...
implement the visitor to find bloated sync blocks. This implementation only checks the outer most block @param seen the opcode of the currently parsed instruction
[ "implement", "the", "visitor", "to", "find", "bloated", "sync", "blocks", ".", "This", "implementation", "only", "checks", "the", "outer", "most", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java#L126-L187
104,589
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
OptionalIssues.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { currentClass = classContext.getJavaClass(); if (currentClass.getMajor() >= Const.MAJOR_1_8) { try { stack = new OpcodeStack(); activeStackOps = new ArrayDeque<>(); super....
java
@Override public void visitClassContext(ClassContext classContext) { currentClass = classContext.getJavaClass(); if (currentClass.getMajor() >= Const.MAJOR_1_8) { try { stack = new OpcodeStack(); activeStackOps = new ArrayDeque<>(); super....
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "currentClass", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "currentClass", ".", "getMajor", "(", ")", ">=", "Const", ".", "MAJOR_1_8...
implements the visitor to filter out pre-1.8 classes, for 1.8+ classes, it creates the opcode stack and active stack ops @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "filter", "out", "pre", "-", "1", ".", "8", "classes", "for", "1", ".", "8", "+", "classes", "it", "creates", "the", "opcode", "stack", "and", "active", "stack", "ops" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java#L125-L140
104,590
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
OptionalIssues.visitCode
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); activeStackOps.clear(); super.visitCode(obj); }
java
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); activeStackOps.clear(); super.visitCode(obj); }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "activeStackOps", ".", "clear", "(", ")", ";", "super", ".", "visitCode", "(", "obj", ")", ";", "}" ]
implements the visitor clear the stacks @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "clear", "the", "stacks" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java#L148-L153
104,591
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
OptionalIssues.isTrivialStackOps
private boolean isTrivialStackOps() { int invokeCount = 0; for (ActiveStackOp op : activeStackOps) { if (INVOKE_OPS.get(op.getOpcode())) { invokeCount++; } } if (invokeCount == 1) { FQMethod method = activeStackOps.getLast().getMethod...
java
private boolean isTrivialStackOps() { int invokeCount = 0; for (ActiveStackOp op : activeStackOps) { if (INVOKE_OPS.get(op.getOpcode())) { invokeCount++; } } if (invokeCount == 1) { FQMethod method = activeStackOps.getLast().getMethod...
[ "private", "boolean", "isTrivialStackOps", "(", ")", "{", "int", "invokeCount", "=", "0", ";", "for", "(", "ActiveStackOp", "op", ":", "activeStackOps", ")", "{", "if", "(", "INVOKE_OPS", ".", "get", "(", "op", ".", "getOpcode", "(", ")", ")", ")", "{"...
returns whether the set of operations that contributed to the current stack form, are trivial or not, specifically boxing a primitive value, or appending to strings or such. @return the operations that caused the current stack to exist are trivial
[ "returns", "whether", "the", "set", "of", "operations", "that", "contributed", "to", "the", "current", "stack", "form", "are", "trivial", "or", "not", "specifically", "boxing", "a", "primitive", "value", "or", "appending", "to", "strings", "or", "such", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java#L276-L299
104,592
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
OptionalIssues.getLambdaMethod
@Nullable private Method getLambdaMethod(String methodName) { for (Method method : currentClass.getMethods()) { if (methodName.equals(method.getName())) { return method; } } return null; }
java
@Nullable private Method getLambdaMethod(String methodName) { for (Method method : currentClass.getMethods()) { if (methodName.equals(method.getName())) { return method; } } return null; }
[ "@", "Nullable", "private", "Method", "getLambdaMethod", "(", "String", "methodName", ")", "{", "for", "(", "Method", "method", ":", "currentClass", ".", "getMethods", "(", ")", ")", "{", "if", "(", "methodName", ".", "equals", "(", "method", ".", "getName...
finds the bootstrap method for a lambda (invokedynamic call. As findbugs doesn't support bcel 6, have to cheat a little here. @param methodName the lambda name @return the method object if it exists
[ "finds", "the", "bootstrap", "method", "for", "a", "lambda", "(", "invokedynamic", "call", ".", "As", "findbugs", "doesn", "t", "support", "bcel", "6", "have", "to", "cheat", "a", "little", "here", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java#L308-L317
104,593
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java
BackportReusePublicIdentifiers.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); clsVersion = cls.getMajor(); super.visitClassContext(classContext); }
java
@Override public void visitClassContext(ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); clsVersion = cls.getMajor(); super.visitClassContext(classContext); }
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "clsVersion", "=", "cls", ".", "getMajor", "(", ")", ";", "super", ".", "visit...
overrides the visitor to make sure this is a 'modern' class better than 1.4 @param classContext the currently parsed class
[ "overrides", "the", "visitor", "to", "make", "sure", "this", "is", "a", "modern", "class", "better", "than", "1", ".", "4" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java#L75-L80
104,594
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java
BackportReusePublicIdentifiers.sawOpcode
@Override public void sawOpcode(int seen) { stack.precomputation(this); switch (seen) { case Const.INVOKESTATIC: { String className = getClassConstantOperand(); for (Backports backport : BACKPORTS) { if (className.startsWith(backport.g...
java
@Override public void sawOpcode(int seen) { stack.precomputation(this); switch (seen) { case Const.INVOKESTATIC: { String className = getClassConstantOperand(); for (Backports backport : BACKPORTS) { if (className.startsWith(backport.g...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".", "INVOKESTATIC", ":", "{", "String", "className", "=", "getClassCon...
overrides the visitor to look for method calls to the emory backport concurrent library, or threeten bp library when the now built-in versions are available @param seen the currently parsed opcode
[ "overrides", "the", "visitor", "to", "look", "for", "method", "calls", "to", "the", "emory", "backport", "concurrent", "library", "or", "threeten", "bp", "library", "when", "the", "now", "built", "-", "in", "versions", "are", "available" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java#L89-L122
104,595
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java
BackportReusePublicIdentifiers.reportBug
private void reportBug(Library library) { bugReporter.reportBug(new BugInstance(this, BugType.BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this).addString(library.name())); }
java
private void reportBug(Library library) { bugReporter.reportBug(new BugInstance(this, BugType.BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this).addString(library.name())); }
[ "private", "void", "reportBug", "(", "Library", "library", ")", "{", "bugReporter", ".", "reportBug", "(", "new", "BugInstance", "(", "this", ",", "BugType", ".", "BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS", ".", "name", "(", ")", ",", "NORMAL_PRIORITY", ")", ".", ...
issues a new bug at this location @param library the type of backport library that is in use
[ "issues", "a", "new", "bug", "at", "this", "location" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java#L130-L133
104,596
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
LoggerOddities.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); nameOfThisClass = SignatureUtils.getNonAnonymousPortion(classContext.getJavaClass().getClassName()); formatterLoggers = new HashSet<>(); super.visitClassConte...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); nameOfThisClass = SignatureUtils.getNonAnonymousPortion(classContext.getJavaClass().getClassName()); formatterLoggers = new HashSet<>(); super.visitClassConte...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "nameOfThisClass", "=", "SignatureUtils", ".", "getNonAnonymousPortion", "(", "classContext", ".",...
implements the visitor to discover what the class name is if it is a normal class, or the owning class, if the class is an anonymous class. @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "discover", "what", "the", "class", "name", "is", "if", "it", "is", "a", "normal", "class", "or", "the", "owning", "class", "if", "the", "class", "is", "an", "anonymous", "class", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java#L135-L146
104,597
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
LoggerOddities.checkForProblemsWithLoggerMethods
@SuppressWarnings("unchecked") private void checkForProblemsWithLoggerMethods() throws ClassNotFoundException { String callingClsName = getClassConstantOperand(); if (!(callingClsName.endsWith("Log") || (callingClsName.endsWith("Logger"))) || (stack.getStackDepth() == 0)) { return; ...
java
@SuppressWarnings("unchecked") private void checkForProblemsWithLoggerMethods() throws ClassNotFoundException { String callingClsName = getClassConstantOperand(); if (!(callingClsName.endsWith("Log") || (callingClsName.endsWith("Logger"))) || (stack.getStackDepth() == 0)) { return; ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "checkForProblemsWithLoggerMethods", "(", ")", "throws", "ClassNotFoundException", "{", "String", "callingClsName", "=", "getClassConstantOperand", "(", ")", ";", "if", "(", "!", "(", "callingClsNa...
looks for a variety of logging issues with log statements @throws ClassNotFoundException if the exception class, or a parent class can't be found
[ "looks", "for", "a", "variety", "of", "logging", "issues", "with", "log", "statements" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java#L379-L395
104,598
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
LoggerOddities.getVarArgsParmCount
@SuppressWarnings("unchecked") private int getVarArgsParmCount(String signature) { if (SignatureBuilder.SIG_STRING_AND_OBJECT_TO_VOID.equals(signature)) { return 1; } if (SIG_STRING_AND_TWO_OBJECTS_TO_VOID.equals(signature)) { return 2; } OpcodeStack....
java
@SuppressWarnings("unchecked") private int getVarArgsParmCount(String signature) { if (SignatureBuilder.SIG_STRING_AND_OBJECT_TO_VOID.equals(signature)) { return 1; } if (SIG_STRING_AND_TWO_OBJECTS_TO_VOID.equals(signature)) { return 2; } OpcodeStack....
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "int", "getVarArgsParmCount", "(", "String", "signature", ")", "{", "if", "(", "SignatureBuilder", ".", "SIG_STRING_AND_OBJECT_TO_VOID", ".", "equals", "(", "signature", ")", ")", "{", "return", "1", ...
returns the number of parameters slf4j or log4j2 is expecting to inject into the format string @param signature the method signature of the error, warn, info, debug statement @return the number of expected parameters
[ "returns", "the", "number", "of", "parameters", "slf4j", "or", "log4j2", "is", "expecting", "to", "inject", "into", "the", "format", "string" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java#L628-L646
104,599
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
LoggerOddities.hasExceptionOnStack
@SuppressWarnings("unchecked") private boolean hasExceptionOnStack() { try { for (int i = 0; i < (stack.getStackDepth() - 1); i++) { OpcodeStack.Item item = stack.getStackItem(i); String sig = item.getSignature(); if (sig.startsWith(Values.SIG_QUAL...
java
@SuppressWarnings("unchecked") private boolean hasExceptionOnStack() { try { for (int i = 0; i < (stack.getStackDepth() - 1); i++) { OpcodeStack.Item item = stack.getStackItem(i); String sig = item.getSignature(); if (sig.startsWith(Values.SIG_QUAL...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "boolean", "hasExceptionOnStack", "(", ")", "{", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "(", "stack", ".", "getStackDepth", "(", ")", "-", "1", ")", ";", "i", "++", ...
returns whether an exception object is on the stack slf4j will find this, and not include it in the parm list so i we find one, just don't report @return whether or not an exception i present
[ "returns", "whether", "an", "exception", "object", "is", "on", "the", "stack", "slf4j", "will", "find", "this", "and", "not", "include", "it", "in", "the", "parm", "list", "so", "i", "we", "find", "one", "just", "don", "t", "report" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java#L653-L680