repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
ExceptionSoftening.findPossibleCatchSignatures
private static Set<String> findPossibleCatchSignatures(List<CatchInfo> infos, int pc) { Set<String> catchTypes = new HashSet<>(6); ListIterator<CatchInfo> it = infos.listIterator(infos.size()); while (it.hasPrevious()) { CatchInfo ci = it.previous(); if ((pc >= ci.getStar...
java
private static Set<String> findPossibleCatchSignatures(List<CatchInfo> infos, int pc) { Set<String> catchTypes = new HashSet<>(6); ListIterator<CatchInfo> it = infos.listIterator(infos.size()); while (it.hasPrevious()) { CatchInfo ci = it.previous(); if ((pc >= ci.getStar...
[ "private", "static", "Set", "<", "String", ">", "findPossibleCatchSignatures", "(", "List", "<", "CatchInfo", ">", "infos", ",", "int", "pc", ")", "{", "Set", "<", "String", ">", "catchTypes", "=", "new", "HashSet", "<>", "(", "6", ")", ";", "ListIterato...
returns an array of catch types that the current pc is in @param infos the list of catch infos for this method @param pc the current pc @return an set of catch exception types that the pc is currently in
[ "returns", "an", "array", "of", "catch", "types", "that", "the", "current", "pc", "is", "in" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java#L354-L367
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
ExceptionSoftening.getConstrainingInfo
@Nullable private Map<String, Set<String>> getConstrainingInfo(JavaClass cls, Method m) throws ClassNotFoundException { String methodName = m.getName(); String methodSig = m.getSignature(); { // First look for the method in interfaces of the class JavaClass[] infClas...
java
@Nullable private Map<String, Set<String>> getConstrainingInfo(JavaClass cls, Method m) throws ClassNotFoundException { String methodName = m.getName(); String methodSig = m.getSignature(); { // First look for the method in interfaces of the class JavaClass[] infClas...
[ "@", "Nullable", "private", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "getConstrainingInfo", "(", "JavaClass", "cls", ",", "Method", "m", ")", "throws", "ClassNotFoundException", "{", "String", "methodName", "=", "m", ".", "getName", "(", ...
finds the super class or interface that constrains the types of exceptions that can be thrown from the given method @param cls the currently parsed class @param m the method to check @return a map containing the class name to a set of exceptions that constrain this method @throws ClassNotFoundException if a super c...
[ "finds", "the", "super", "class", "or", "interface", "that", "constrains", "the", "types", "of", "exceptions", "that", "can", "be", "thrown", "from", "the", "given", "method" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java#L381-L419
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
ExceptionSoftening.findMethod
@Nullable private static Method findMethod(JavaClass cls, String methodName, String methodSig) { Method[] methods = cls.getMethods(); for (Method method : methods) { if (method.getName().equals(methodName) && method.getSignature().equals(methodSig)) { return method; ...
java
@Nullable private static Method findMethod(JavaClass cls, String methodName, String methodSig) { Method[] methods = cls.getMethods(); for (Method method : methods) { if (method.getName().equals(methodName) && method.getSignature().equals(methodSig)) { return method; ...
[ "@", "Nullable", "private", "static", "Method", "findMethod", "(", "JavaClass", "cls", ",", "String", "methodName", ",", "String", "methodSig", ")", "{", "Method", "[", "]", "methods", "=", "cls", ".", "getMethods", "(", ")", ";", "for", "(", "Method", "...
finds a method that matches the name and signature in the given class @param cls the class to look in @param methodName the name to look for @param methodSig the signature to look for @return the method or null
[ "finds", "a", "method", "that", "matches", "the", "name", "and", "signature", "in", "the", "given", "class" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java#L430-L439
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
ExceptionSoftening.buildConstrainingInfo
private Map<String, Set<String>> buildConstrainingInfo(JavaClass cls, Method m) throws ClassNotFoundException { Map<String, Set<String>> constraintInfo = new HashMap<>(); Set<String> exs = new HashSet<>(); ExceptionTable et = m.getExceptionTable(); if (et != null) { int[] ind...
java
private Map<String, Set<String>> buildConstrainingInfo(JavaClass cls, Method m) throws ClassNotFoundException { Map<String, Set<String>> constraintInfo = new HashMap<>(); Set<String> exs = new HashSet<>(); ExceptionTable et = m.getExceptionTable(); if (et != null) { int[] ind...
[ "private", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "buildConstrainingInfo", "(", "JavaClass", "cls", ",", "Method", "m", ")", "throws", "ClassNotFoundException", "{", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "constraint...
returns exception names describing what exceptions are allowed to be thrown @param cls the cls to find the exceptions in @param m the method to add exceptions from @return a map with one entry of a class name to a set of exceptions that constrain what can be thrown. @throws ClassNotFoundException if an exception cl...
[ "returns", "exception", "names", "describing", "what", "exceptions", "are", "allowed", "to", "be", "thrown" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java#L452-L472
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java
TristateBooleanPattern.visitCode
@Override public void visitCode(Code obj) { try { Method m = getMethod(); Type retType = m.getReturnType(); if ("Ljava/lang/Boolean;".equals(retType.getSignature())) { stack.resetForMethodEntry(this); super.visitCode(obj); } ...
java
@Override public void visitCode(Code obj) { try { Method m = getMethod(); Type retType = m.getReturnType(); if ("Ljava/lang/Boolean;".equals(retType.getSignature())) { stack.resetForMethodEntry(this); super.visitCode(obj); } ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "Type", "retType", "=", "m", ".", "getReturnType", "(", ")", ";", "if", "(", "\"Ljava/lang/Boolean;\"", ".", "equa...
implements the visitor to filter out methods that don't return Boolean, @param obj the context object for the currently parsed code block
[ "implements", "the", "visitor", "to", "filter", "out", "methods", "that", "don", "t", "return", "Boolean" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java#L76-L88
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java
TristateBooleanPattern.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.ARETURN) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); if (item.isNull()) { bugReporter.reportBug(...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.ARETURN) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); if (item.isNull()) { bugReporter.reportBug(...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "(", "seen", "==", "Const", ".", "ARETURN", ")", "&&", "(", "stack", ".", "getStackDepth", "("...
implements the visitor to look for null returns
[ "implements", "the", "visitor", "to", "look", "for", "null", "returns" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java#L93-L110
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java
DubiousSetOfCollections.visitClassContext
@Override public void visitClassContext(ClassContext clsContext) { try { if ((collectionCls == null) || (setCls == null) || (mapCls == null)) { return; } stack = new OpcodeStack(); super.visitClassContext(clsContext); } finally { ...
java
@Override public void visitClassContext(ClassContext clsContext) { try { if ((collectionCls == null) || (setCls == null) || (mapCls == null)) { return; } stack = new OpcodeStack(); super.visitClassContext(clsContext); } finally { ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "clsContext", ")", "{", "try", "{", "if", "(", "(", "collectionCls", "==", "null", ")", "||", "(", "setCls", "==", "null", ")", "||", "(", "mapCls", "==", "null", ")", ")", "{...
implement the visitor to set up the opcode stack, and make sure that collection, set and map classes could be loaded. @param clsContext the context object of the currently parsed class
[ "implement", "the", "visitor", "to", "set", "up", "the", "opcode", "stack", "and", "make", "sure", "that", "collection", "set", "and", "map", "classes", "could", "be", "loaded", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java#L76-L88
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java
DubiousSetOfCollections.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKEINTERFACE)) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); ...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKEINTERFACE)) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "(", "seen", "==", "Const", ".", "INVOKEVIRTUAL", ")", "||", "(", "seen", "==", "Const", ".", ...
implements the visitor look for adds to sets or puts to maps where the element to be added is a collection. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "look", "for", "adds", "to", "sets", "or", "puts", "to", "maps", "where", "the", "element", "to", "be", "added", "is", "a", "collection", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java#L108-L142
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java
LiteralStringComparison.lookupSwitchOnString
private boolean lookupSwitchOnString() { if (stack.getStackDepth() > 1) { OpcodeStack.Item item = stack.getStackItem(1); String stringRef = (String) item.getUserValue(); if (stringRef == null) { return false; } if (!lookupSwitches.isE...
java
private boolean lookupSwitchOnString() { if (stack.getStackDepth() > 1) { OpcodeStack.Item item = stack.getStackItem(1); String stringRef = (String) item.getUserValue(); if (stringRef == null) { return false; } if (!lookupSwitches.isE...
[ "private", "boolean", "lookupSwitchOnString", "(", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", ">", "1", ")", "{", "OpcodeStack", ".", "Item", "item", "=", "stack", ".", "getStackItem", "(", "1", ")", ";", "String", "stringRef", "=", ...
looks to see if the string used in a equals or compareTo is the same as that of a switch statement's switch on string. @return if the string is used in a switch
[ "looks", "to", "see", "if", "the", "string", "used", "in", "a", "equals", "or", "compareTo", "is", "the", "same", "as", "that", "of", "a", "switch", "statement", "s", "switch", "on", "string", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java#L215-L231
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java
JDBCVendorReliance.visitMethod
@Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); jdbcLocals.clear(); int[] parmRegs = RegisterUtils.getParameterRegisters(obj); Type[] argTypes = obj.getArgumentTypes(); for (int t = 0; t < argTypes.length; t++) { String sig = arg...
java
@Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); jdbcLocals.clear(); int[] parmRegs = RegisterUtils.getParameterRegisters(obj); Type[] argTypes = obj.getArgumentTypes(); for (int t = 0; t < argTypes.length; t++) { String sig = arg...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "jdbcLocals", ".", "clear", "(", ")", ";", "int", "[", "]", "parmRegs", "=", "RegisterUtils", ".", "getParameterRe...
implement the visitor to reset the opcode stack and set of locals that are jdbc objects @param obj the context param of the currently parsed method
[ "implement", "the", "visitor", "to", "reset", "the", "opcode", "stack", "and", "set", "of", "locals", "that", "are", "jdbc", "objects" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java#L84-L99
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java
ImmatureClass.fieldHasRuntimeVisibleAnnotation
private static boolean fieldHasRuntimeVisibleAnnotation(Field f) { AnnotationEntry[] annotations = f.getAnnotationEntries(); if (annotations != null) { for (AnnotationEntry annotation : annotations) { if (annotation.isRuntimeVisible()) { return true; } } } return false; }
java
private static boolean fieldHasRuntimeVisibleAnnotation(Field f) { AnnotationEntry[] annotations = f.getAnnotationEntries(); if (annotations != null) { for (AnnotationEntry annotation : annotations) { if (annotation.isRuntimeVisible()) { return true; } } } return false; }
[ "private", "static", "boolean", "fieldHasRuntimeVisibleAnnotation", "(", "Field", "f", ")", "{", "AnnotationEntry", "[", "]", "annotations", "=", "f", ".", "getAnnotationEntries", "(", ")", ";", "if", "(", "annotations", "!=", "null", ")", "{", "for", "(", "...
looks to see the field has a runtime visible annotation, if it does it might be autowired or some other mechanism attached that makes them less interesting for a toString call. @param f the field to check @return if the field has a runtime visible annotation
[ "looks", "to", "see", "the", "field", "has", "a", "runtime", "visible", "annotation", "if", "it", "does", "it", "might", "be", "autowired", "or", "some", "other", "mechanism", "attached", "that", "makes", "them", "less", "interesting", "for", "a", "toString"...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java#L338-L349
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java
ImmatureClass.checkIDEGeneratedParmNames
private void checkIDEGeneratedParmNames(JavaClass cls) { for (Method m : cls.getMethods()) { if (isIDEGeneratedMethodWithCode(m)) { bugReporter.reportBug( new BugInstance(this, BugType.IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES.name(), NORMAL_PRIORITY).addClass(cls).addMethod(cls, m)); ...
java
private void checkIDEGeneratedParmNames(JavaClass cls) { for (Method m : cls.getMethods()) { if (isIDEGeneratedMethodWithCode(m)) { bugReporter.reportBug( new BugInstance(this, BugType.IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES.name(), NORMAL_PRIORITY).addClass(cls).addMethod(cls, m)); ...
[ "private", "void", "checkIDEGeneratedParmNames", "(", "JavaClass", "cls", ")", "{", "for", "(", "Method", "m", ":", "cls", ".", "getMethods", "(", ")", ")", "{", "if", "(", "isIDEGeneratedMethodWithCode", "(", "m", ")", ")", "{", "bugReporter", ".", "repor...
looks for methods that have it's parameters all follow the form arg0, arg1, arg2, or parm0, parm1, parm2 etc, where the method actually has code in it @param cls the class to check
[ "looks", "for", "methods", "that", "have", "it", "s", "parameters", "all", "follow", "the", "form", "arg0", "arg1", "arg2", "or", "parm0", "parm1", "parm2", "etc", "where", "the", "method", "actually", "has", "code", "in", "it" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java#L377-L386
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java
InheritanceTypeChecking.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { ifStatements = new HashSet<>(); super.visitClassContext(classContext); } finally { ifStatements = null; } }
java
@Override public void visitClassContext(ClassContext classContext) { try { ifStatements = new HashSet<>(); super.visitClassContext(classContext); } finally { ifStatements = null; } }
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "ifStatements", "=", "new", "HashSet", "<>", "(", ")", ";", "super", ".", "visitClassContext", "(", "classContext", ")", ";", "}", "finally", "...
implements the visitor to allocate and clear the ifStatements set @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "allocate", "and", "clear", "the", "ifStatements", "set" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java#L62-L70
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java
PartiallyConstructedObjectAccess.visitClassContext
@Override public void visitClassContext(final ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (!cls.isFinal()) { stack = new OpcodeStack(); methodToCalledMethods = new HashMap<>(); super.visitClassCont...
java
@Override public void visitClassContext(final ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (!cls.isFinal()) { stack = new OpcodeStack(); methodToCalledMethods = new HashMap<>(); super.visitClassCont...
[ "@", "Override", "public", "void", "visitClassContext", "(", "final", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "!", "cls", ".", "isFinal", "(", ")", ")", ...
implements the visitor to set up the stack and methodToCalledmethods map reports calls to public non final methods from methods called from constructors. @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "set", "up", "the", "stack", "and", "methodToCalledmethods", "map", "reports", "calls", "to", "public", "non", "final", "methods", "from", "methods", "called", "from", "constructors", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java#L73-L90
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java
SuspiciousClusteredSessionSupport.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); changedAttributes = new HashMap<>(); savedAttributes = new HashMap<>(); super.visitClassContext(classContext); } finally { stack = null; ...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); changedAttributes = new HashMap<>(); savedAttributes = new HashMap<>(); super.visitClassContext(classContext); } finally { stack = null; ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "changedAttributes", "=", "new", "HashMap", "<>", "(", ")", ";", "savedAttributes", "=", "ne...
implements the visitor to setup the opcode stack and attribute maps @param classContext the currently parsed class
[ "implements", "the", "visitor", "to", "setup", "the", "opcode", "stack", "and", "attribute", "maps" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java#L66-L78
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java
SuspiciousClusteredSessionSupport.visitCode
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); changedAttributes.clear(); savedAttributes.clear(); super.visitCode(obj); for (Integer pc : changedAttributes.values()) { bugReporter.reportBug(new BugInstance(this, BugType.SCSS_SUSPICIO...
java
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); changedAttributes.clear(); savedAttributes.clear(); super.visitCode(obj); for (Integer pc : changedAttributes.values()) { bugReporter.reportBug(new BugInstance(this, BugType.SCSS_SUSPICIO...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "changedAttributes", ".", "clear", "(", ")", ";", "savedAttributes", ".", "clear", "(", ")", ";", "super", ".", "vis...
implements the visitor to report on attributes that have changed, without a setAttribute being called on them @param obj the currently parsed method
[ "implements", "the", "visitor", "to", "report", "on", "attributes", "that", "have", "changed", "without", "a", "setAttribute", "being", "called", "on", "them" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java#L86-L96
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java
FinalParameters.visitMethod
@Override public void visitMethod(final Method obj) { methodName = obj.getName(); if (Values.STATIC_INITIALIZER.equals(methodName) || Values.CONSTRUCTOR.equals(methodName)) { return; } List<String> parms = SignatureUtils.getParameterSignatures(obj.getSignature()); ...
java
@Override public void visitMethod(final Method obj) { methodName = obj.getName(); if (Values.STATIC_INITIALIZER.equals(methodName) || Values.CONSTRUCTOR.equals(methodName)) { return; } List<String> parms = SignatureUtils.getParameterSignatures(obj.getSignature()); ...
[ "@", "Override", "public", "void", "visitMethod", "(", "final", "Method", "obj", ")", "{", "methodName", "=", "obj", ".", "getName", "(", ")", ";", "if", "(", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "methodName", ")", "||", "Values", "."...
overrides the visitor capture source lines for the method @param obj the method object for the currently parsed method
[ "overrides", "the", "visitor", "capture", "source", "lines", "for", "the", "method" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java#L91-L111
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java
FinalParameters.getSourceLines
private String[] getSourceLines(Method obj) { if (srcInited) { return sourceLines; } try { srcLineAnnotation = SourceLineAnnotation.forEntireMethod(getClassContext().getJavaClass(), obj); if (srcLineAnnotation != null) { SourceFinder sourceFi...
java
private String[] getSourceLines(Method obj) { if (srcInited) { return sourceLines; } try { srcLineAnnotation = SourceLineAnnotation.forEntireMethod(getClassContext().getJavaClass(), obj); if (srcLineAnnotation != null) { SourceFinder sourceFi...
[ "private", "String", "[", "]", "getSourceLines", "(", "Method", "obj", ")", "{", "if", "(", "srcInited", ")", "{", "return", "sourceLines", ";", "}", "try", "{", "srcLineAnnotation", "=", "SourceLineAnnotation", ".", "forEntireMethod", "(", "getClassContext", ...
reads the sourcefile based on the source line annotation for the method @param obj the method object for the currently parsed method @return an array of source lines for the method
[ "reads", "the", "sourcefile", "based", "on", "the", "source", "line", "annotation", "for", "the", "method" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java#L121-L148
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java
FinalParameters.visitCode
@Override public void visitCode(final Code obj) { if (sourceLines == null) { return; } if (isAbstract) { return; } if (Values.STATIC_INITIALIZER.equals(methodName) || Values.CONSTRUCTOR.equals(methodName)) { return; } int...
java
@Override public void visitCode(final Code obj) { if (sourceLines == null) { return; } if (isAbstract) { return; } if (Values.STATIC_INITIALIZER.equals(methodName) || Values.CONSTRUCTOR.equals(methodName)) { return; } int...
[ "@", "Override", "public", "void", "visitCode", "(", "final", "Code", "obj", ")", "{", "if", "(", "sourceLines", "==", "null", ")", "{", "return", ";", "}", "if", "(", "isAbstract", ")", "{", "return", ";", "}", "if", "(", "Values", ".", "STATIC_INIT...
overrides the visitor to find the source lines for the method header, to find non final parameters @param obj the code object for the currently parsed method
[ "overrides", "the", "visitor", "to", "find", "the", "source", "lines", "for", "the", "method", "header", "to", "find", "non", "final", "parameters" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java#L156-L213
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java
FinalParameters.sawOpcode
@Override public void sawOpcode(final int seen) { if (OpcodeUtils.isAStore(seen)) { changedParms.set(RegisterUtils.getAStoreReg(this, seen)); } }
java
@Override public void sawOpcode(final int seen) { if (OpcodeUtils.isAStore(seen)) { changedParms.set(RegisterUtils.getAStoreReg(this, seen)); } }
[ "@", "Override", "public", "void", "sawOpcode", "(", "final", "int", "seen", ")", "{", "if", "(", "OpcodeUtils", ".", "isAStore", "(", "seen", ")", ")", "{", "changedParms", ".", "set", "(", "RegisterUtils", ".", "getAStoreReg", "(", "this", ",", "seen",...
overrides the visitor to find local variable reference stores to store them as changed @param seen the currently parsed opcode
[ "overrides", "the", "visitor", "to", "find", "local", "variable", "reference", "stores", "to", "store", "them", "as", "changed" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java#L221-L226
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java
FinalParameters.getRegisterName
private static String getRegisterName(final Code obj, final int reg) { LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, 0); if (lv != null) { return lv.getName(); } } ...
java
private static String getRegisterName(final Code obj, final int reg) { LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, 0); if (lv != null) { return lv.getName(); } } ...
[ "private", "static", "String", "getRegisterName", "(", "final", "Code", "obj", ",", "final", "int", "reg", ")", "{", "LocalVariableTable", "lvt", "=", "obj", ".", "getLocalVariableTable", "(", ")", ";", "if", "(", "lvt", "!=", "null", ")", "{", "LocalVaria...
returns the variable name of the specified register slot @param obj the currently parsed code object @param reg the variable register of interest @return the variable name of the specified register
[ "returns", "the", "variable", "name", "of", "the", "specified", "register", "slot" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java#L238-L247
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
MethodReturnsConstant.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); registerConstants = new HashMap<>(); overloadedMethods = collectOverloadedMethods(classContext.getJavaClass()); super.visitClassContext(classContext); ...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); registerConstants = new HashMap<>(); overloadedMethods = collectOverloadedMethods(classContext.getJavaClass()); super.visitClassContext(classContext); ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "registerConstants", "=", "new", "HashMap", "<>", "(", ")", ";", "overloadedMethods", "=", "...
implements the visitor to collect all methods that are overloads. These methods should be ignored, as you may differentiate Const based on parameter type, or value. @param classContext the currently parsed class object
[ "implements", "the", "visitor", "to", "collect", "all", "methods", "that", "are", "overloads", ".", "These", "methods", "should", "be", "ignored", "as", "you", "may", "differentiate", "Const", "based", "on", "parameter", "type", "or", "value", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java#L78-L90
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
MethodReturnsConstant.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); if (overloadedMethods.contains(m)) { return; } int aFlags = m.getAccessFlags(); if ((((aFlags & Const.ACC_PRIVATE) != 0) || ((aFlags & Const.ACC_STATIC) != 0)) && ((aFlags & Const.ACC_SYNTHETIC)...
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if (overloadedMethods.contains(m)) { return; } int aFlags = m.getAccessFlags(); if ((((aFlags & Const.ACC_PRIVATE) != 0) || ((aFlags & Const.ACC_STATIC) != 0)) && ((aFlags & Const.ACC_SYNTHETIC)...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "overloadedMethods", ".", "contains", "(", "m", ")", ")", "{", "return", ";", "}", "int", "aFlags", "=", "m", "...
implements the visitor to reset the stack and proceed for private methods @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "reset", "the", "stack", "and", "proceed", "for", "private", "methods" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java#L98-L131
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
WriteOnlyCollection.visitMethod
@Override public void visitMethod(Method obj) { firstLocalRegister = SignatureUtils.getFirstRegisterSlot(obj); super.visitMethod(obj); }
java
@Override public void visitMethod(Method obj) { firstLocalRegister = SignatureUtils.getFirstRegisterSlot(obj); super.visitMethod(obj); }
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "firstLocalRegister", "=", "SignatureUtils", ".", "getFirstRegisterSlot", "(", "obj", ")", ";", "super", ".", "visitMethod", "(", "obj", ")", ";", "}" ]
overrides the visitor to see what how many register slots are taken by parameters. @param obj the currently parsed method
[ "overrides", "the", "visitor", "to", "see", "what", "how", "many", "register", "slots", "are", "taken", "by", "parameters", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java#L200-L204
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
WriteOnlyCollection.sawOpcode
@Override public void sawOpcode(int seen) { if (seen == Const.PUTFIELD) { OpcodeStack stack = getStack(); if (stack.getStackDepth() > 0) { int reg = stack.getStackItem(0).getRegisterNumber(); if ((reg >= 0) && (reg < firstLocalRegister)) { ...
java
@Override public void sawOpcode(int seen) { if (seen == Const.PUTFIELD) { OpcodeStack stack = getStack(); if (stack.getStackDepth() > 0) { int reg = stack.getStackItem(0).getRegisterNumber(); if ((reg >= 0) && (reg < firstLocalRegister)) { ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "PUTFIELD", ")", "{", "OpcodeStack", "stack", "=", "getStack", "(", ")", ";", "if", "(", "stack", ".", "getStackDepth", "(", ")", ">"...
overrides the visitor to look for PUTFIELDS of collections @param seen the currently parsed opcode
[ "overrides", "the", "visitor", "to", "look", "for", "PUTFIELDS", "of", "collections" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java#L212-L224
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
WriteOnlyCollection.doesStaticFactoryReturnNeedToBeWatched
@Override protected boolean doesStaticFactoryReturnNeedToBeWatched(String clsName, String methodName, String signature) { return collectionFactoryMethods.contains(new FQMethod(clsName, methodName, signature)); }
java
@Override protected boolean doesStaticFactoryReturnNeedToBeWatched(String clsName, String methodName, String signature) { return collectionFactoryMethods.contains(new FQMethod(clsName, methodName, signature)); }
[ "@", "Override", "protected", "boolean", "doesStaticFactoryReturnNeedToBeWatched", "(", "String", "clsName", ",", "String", "methodName", ",", "String", "signature", ")", "{", "return", "collectionFactoryMethods", ".", "contains", "(", "new", "FQMethod", "(", "clsName...
implements the MissingMethodsDetector to determine whether this factory-like method returns a collection @param clsName the clsName the class name of the factory @param methodName the method name of the factory @param signature the signature of the factory method @return whether this class is a collection
[ "implements", "the", "MissingMethodsDetector", "to", "determine", "whether", "this", "factory", "-", "like", "method", "returns", "a", "collection" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java#L270-L273
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java
UnboundMethodTemplateParameter.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); cls.accept(this); }
java
@Override public void visitClassContext(ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); cls.accept(this); }
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "cls", ".", "accept", "(", "this", ")", ";", "}" ]
implements the visitor to accept the class for visiting @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "accept", "the", "class", "for", "visiting" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java#L63-L67
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java
UnboundMethodTemplateParameter.visitMethod
@Override public void visitMethod(Method obj) { Attribute[] attributes = obj.getAttributes(); for (Attribute a : attributes) { if ("Signature".equals(a.getName())) { TemplateSignature ts = parseSignatureAttribute((Signature) a); if (ts != null) { ...
java
@Override public void visitMethod(Method obj) { Attribute[] attributes = obj.getAttributes(); for (Attribute a : attributes) { if ("Signature".equals(a.getName())) { TemplateSignature ts = parseSignatureAttribute((Signature) a); if (ts != null) { ...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "Attribute", "[", "]", "attributes", "=", "obj", ".", "getAttributes", "(", ")", ";", "for", "(", "Attribute", "a", ":", "attributes", ")", "{", "if", "(", "\"Signature\"",...
implements the visitor to find methods that declare template parameters that are not bound to any parameter. @param obj the context object of the currently parsed method
[ "implements", "the", "visitor", "to", "find", "methods", "that", "declare", "template", "parameters", "that", "are", "not", "bound", "to", "any", "parameter", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java#L75-L94
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java
UnboundMethodTemplateParameter.isTemplateParent
private boolean isTemplateParent(String templateType, TemplateItem... items) { for (TemplateItem item : items) { if (templateType.equals(item.templateExtension)) { return true; } } return false; }
java
private boolean isTemplateParent(String templateType, TemplateItem... items) { for (TemplateItem item : items) { if (templateType.equals(item.templateExtension)) { return true; } } return false; }
[ "private", "boolean", "isTemplateParent", "(", "String", "templateType", ",", "TemplateItem", "...", "items", ")", "{", "for", "(", "TemplateItem", "item", ":", "items", ")", "{", "if", "(", "templateType", ".", "equals", "(", "item", ".", "templateExtension",...
looks to see if this templateType is a parent of another template type @param templateType the type to look for @param items the items to search @return whether this template type is something another template type extends
[ "looks", "to", "see", "if", "this", "templateType", "is", "a", "parent", "of", "another", "template", "type" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java#L110-L118
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java
UnboundMethodTemplateParameter.parseSignatureAttribute
@Nullable private static TemplateSignature parseSignatureAttribute(Signature signatureAttribute) { Matcher m = TEMPLATED_SIGNATURE.matcher(signatureAttribute.getSignature()); if (!m.matches()) { return null; } TemplateSignature ts = new TemplateSignature(); ts.s...
java
@Nullable private static TemplateSignature parseSignatureAttribute(Signature signatureAttribute) { Matcher m = TEMPLATED_SIGNATURE.matcher(signatureAttribute.getSignature()); if (!m.matches()) { return null; } TemplateSignature ts = new TemplateSignature(); ts.s...
[ "@", "Nullable", "private", "static", "TemplateSignature", "parseSignatureAttribute", "(", "Signature", "signatureAttribute", ")", "{", "Matcher", "m", "=", "TEMPLATED_SIGNATURE", ".", "matcher", "(", "signatureAttribute", ".", "getSignature", "(", ")", ")", ";", "i...
builds a template signature object based on the signature attribute of the method @param signatureAttribute the signature attribute @return a template signature if there are templates defined, otherwise null
[ "builds", "a", "template", "signature", "object", "based", "on", "the", "signature", "attribute", "of", "the", "method" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java#L127-L146
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java
ArrayBasedCollections.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); mapBugs = new ArrayList<>(); setBugs = new ArrayList<>(); hasMapComparator = false; hasSetComparator = false; super.visitClassContext(...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); mapBugs = new ArrayList<>(); setBugs = new ArrayList<>(); hasMapComparator = false; hasSetComparator = false; super.visitClassContext(...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "mapBugs", "=", "new", "ArrayList", "<>", "(", ")", ";", "setBugs", "=", "new", "ArrayList...
implement the visitor to report bugs if no Tree comparators were found @param classContext the context object for the class currently being parsed
[ "implement", "the", "visitor", "to", "report", "bugs", "if", "no", "Tree", "comparators", "were", "found" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java#L66-L91
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java
ArrayBasedCollections.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKEINTERFACE) { processInvokeInterface(); } else if (seen == Const.INVOKESPECIAL) { processInvokeSpecial(); } } finally...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKEINTERFACE) { processInvokeInterface(); } else if (seen == Const.INVOKESPECIAL) { processInvokeSpecial(); } } finally...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "seen", "==", "Const", ".", "INVOKEINTERFACE", ")", "{", "processInvokeInterface", "(", ")", ";", ...
implements the visitor to find accesses to maps, sets and lists using arrays @param seen the currently visitor opcode
[ "implements", "the", "visitor", "to", "find", "accesses", "to", "maps", "sets", "and", "lists", "using", "arrays" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java#L111-L125
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/RuntimeExceptionDeclared.java
RuntimeExceptionDeclared.visitMethod
@Override public void visitMethod(final Method obj) { if (obj.isSynthetic()) { return; } ExceptionTable et = obj.getExceptionTable(); if (et != null) { String[] exNames = et.getExceptionNames(); Set<String> methodRTExceptions = new HashSet<>(6); ...
java
@Override public void visitMethod(final Method obj) { if (obj.isSynthetic()) { return; } ExceptionTable et = obj.getExceptionTable(); if (et != null) { String[] exNames = et.getExceptionNames(); Set<String> methodRTExceptions = new HashSet<>(6); ...
[ "@", "Override", "public", "void", "visitMethod", "(", "final", "Method", "obj", ")", "{", "if", "(", "obj", ".", "isSynthetic", "(", ")", ")", "{", "return", ";", "}", "ExceptionTable", "et", "=", "obj", ".", "getExceptionTable", "(", ")", ";", "if", ...
overrides the visitor to find declared runtime exceptions @param obj the method object of the currently parsed method
[ "overrides", "the", "visitor", "to", "find", "declared", "runtime", "exceptions" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/RuntimeExceptionDeclared.java#L88-L133
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java
TernaryPatcher.post
public static void post(OpcodeStack stack, int opcode) { if (!sawGOTO || (opcode == Const.GOTO) || (opcode == Const.GOTO_W)) { return; } int depth = stack.getStackDepth(); for (int i = 0; i < depth && i < userValues.size(); i++) { OpcodeStack.Item item = stack.get...
java
public static void post(OpcodeStack stack, int opcode) { if (!sawGOTO || (opcode == Const.GOTO) || (opcode == Const.GOTO_W)) { return; } int depth = stack.getStackDepth(); for (int i = 0; i < depth && i < userValues.size(); i++) { OpcodeStack.Item item = stack.get...
[ "public", "static", "void", "post", "(", "OpcodeStack", "stack", ",", "int", "opcode", ")", "{", "if", "(", "!", "sawGOTO", "||", "(", "opcode", "==", "Const", ".", "GOTO", ")", "||", "(", "opcode", "==", "Const", ".", "GOTO_W", ")", ")", "{", "ret...
called after the execution of the parent OpcodeStack.sawOpcode, to restore the user values after the GOTO or GOTO_W's mergeJumps were processed @param stack the OpcodeStack with the items containing user values @param opcode the opcode currently seen
[ "called", "after", "the", "execution", "of", "the", "parent", "OpcodeStack", ".", "sawOpcode", "to", "restore", "the", "user", "values", "after", "the", "GOTO", "or", "GOTO_W", "s", "mergeJumps", "were", "processed" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java#L76-L90
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseToArray.java
UseToArray.visitCode
@Override public void visitCode(Code obj) { try { userValues = new HashMap<>(); super.visitCode(obj); } finally { userValues = null; } }
java
@Override public void visitCode(Code obj) { try { userValues = new HashMap<>(); super.visitCode(obj); } finally { userValues = null; } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "userValues", "=", "new", "HashMap", "<>", "(", ")", ";", "super", ".", "visitCode", "(", "obj", ")", ";", "}", "finally", "{", "userValues", "=", "null", ";", ...
implements the visitor to reset the uservalues @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "reset", "the", "uservalues" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseToArray.java#L64-L72
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
DeprecatedTypesafeEnumPattern.visitClassContext
@Override public void visitClassContext(ClassContext context) { try { JavaClass cls = context.getJavaClass(); if (!cls.isEnum() && (cls.getMajor() >= Const.MAJOR_1_5)) { Method[] methods = cls.getMethods(); for (Method m : methods) { ...
java
@Override public void visitClassContext(ClassContext context) { try { JavaClass cls = context.getJavaClass(); if (!cls.isEnum() && (cls.getMajor() >= Const.MAJOR_1_5)) { Method[] methods = cls.getMethods(); for (Method m : methods) { ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "context", ")", "{", "try", "{", "JavaClass", "cls", "=", "context", ".", "getJavaClass", "(", ")", ";", "if", "(", "!", "cls", ".", "isEnum", "(", ")", "&&", "(", "cls", ".",...
implements the visitor to look for classes compiled with 1.5 or better that have all constructors that are private @param context the currently parsed class context object
[ "implements", "the", "visitor", "to", "look", "for", "classes", "compiled", "with", "1", ".", "5", "or", "better", "that", "have", "all", "constructors", "that", "are", "private" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java#L70-L89
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
DeprecatedTypesafeEnumPattern.visitField
@Override public void visitField(Field obj) { if (obj.isStatic() && obj.isPublic() && obj.isFinal()) { JavaClass cls = getClassContext().getJavaClass(); if (!obj.isEnum()) { String fieldClass = obj.getSignature(); if (fieldClass.startsWith(Values.SIG_Q...
java
@Override public void visitField(Field obj) { if (obj.isStatic() && obj.isPublic() && obj.isFinal()) { JavaClass cls = getClassContext().getJavaClass(); if (!obj.isEnum()) { String fieldClass = obj.getSignature(); if (fieldClass.startsWith(Values.SIG_Q...
[ "@", "Override", "public", "void", "visitField", "(", "Field", "obj", ")", "{", "if", "(", "obj", ".", "isStatic", "(", ")", "&&", "obj", ".", "isPublic", "(", ")", "&&", "obj", ".", "isFinal", "(", ")", ")", "{", "JavaClass", "cls", "=", "getClass...
implements the visitor to look for fields that are public static final and are the same type as the owning class. it collects these object names for later @param obj the context object of the currently parsed field
[ "implements", "the", "visitor", "to", "look", "for", "fields", "that", "are", "public", "static", "final", "and", "are", "the", "same", "type", "as", "the", "owning", "class", ".", "it", "collects", "these", "object", "names", "for", "later" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java#L98-L114
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
DeprecatedTypesafeEnumPattern.visitCode
@Override public void visitCode(Code obj) { if (Values.STATIC_INITIALIZER.equals(getMethod().getName())) { state = State.SAW_NOTHING; super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { if (Values.STATIC_INITIALIZER.equals(getMethod().getName())) { state = State.SAW_NOTHING; super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "getMethod", "(", ")", ".", "getName", "(", ")", ")", ")", "{", "state", "=", "State", ".", "SAW_NOTHING",...
implements the visitor to look for static initializers to find enum generation @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "look", "for", "static", "initializers", "to", "find", "enum", "generation" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java#L122-L128
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
DeprecatedTypesafeEnumPattern.sawOpcode
@Override public void sawOpcode(int seen) { if (state == State.SAW_NOTHING) { if (seen == Const.INVOKESPECIAL) { state = State.SAW_INVOKESPECIAL; } } else if (state == State.SAW_INVOKESPECIAL) { handleInvokeSpecialState(seen); } }
java
@Override public void sawOpcode(int seen) { if (state == State.SAW_NOTHING) { if (seen == Const.INVOKESPECIAL) { state = State.SAW_INVOKESPECIAL; } } else if (state == State.SAW_INVOKESPECIAL) { handleInvokeSpecialState(seen); } }
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "state", "==", "State", ".", "SAW_NOTHING", ")", "{", "if", "(", "seen", "==", "Const", ".", "INVOKESPECIAL", ")", "{", "state", "=", "State", ".", "SAW_INVOKESPEC...
implements the visitor to find allocations of TypesafeEnum Const @param seen the currently parsed opcode
[ "implements", "the", "visitor", "to", "find", "allocations", "of", "TypesafeEnum", "Const" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java#L136-L145
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
CollectStatistics.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); constrainingMethods = buildConstrainingMethods(cls); AnnotationEntry[] annotations = cls.getAnnotationEntries(); classHasAnnotation = !Colle...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); constrainingMethods = buildConstrainingMethods(cls); AnnotationEntry[] annotations = cls.getAnnotationEntries(); classHasAnnotation = !Colle...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "constrainingMethods", "=", "buildConstrainingMethods", "(", "cls", ")",...
implements the visitor to collect statistics on this class @param classContext the currently class
[ "implements", "the", "visitor", "to", "collect", "statistics", "on", "this", "class" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java#L97-L116
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
PossibleConstantAllocationInLoop.isFirstUse
private boolean isFirstUse(int reg) { LocalVariableTable lvt = getMethod().getLocalVariableTable(); if (lvt == null) { return true; } LocalVariable lv = lvt.getLocalVariable(reg, getPC()); return lv == null; }
java
private boolean isFirstUse(int reg) { LocalVariableTable lvt = getMethod().getLocalVariableTable(); if (lvt == null) { return true; } LocalVariable lv = lvt.getLocalVariable(reg, getPC()); return lv == null; }
[ "private", "boolean", "isFirstUse", "(", "int", "reg", ")", "{", "LocalVariableTable", "lvt", "=", "getMethod", "(", ")", ".", "getLocalVariableTable", "(", ")", ";", "if", "(", "lvt", "==", "null", ")", "{", "return", "true", ";", "}", "LocalVariable", ...
looks to see if this register has already in scope or whether is a new assignment. return true if it's a new assignment. If you can't tell, return true anyway. might want to change. @param reg the store register @return whether this is a new register scope assignment
[ "looks", "to", "see", "if", "this", "register", "has", "already", "in", "scope", "or", "whether", "is", "a", "new", "assignment", ".", "return", "true", "if", "it", "s", "a", "new", "assignment", ".", "If", "you", "can", "t", "tell", "return", "true", ...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java#L347-L355
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
CopiedOverriddenMethod.visitClassContext
@Override public void visitClassContext(ClassContext clsContext) { try { JavaClass cls = clsContext.getJavaClass(); String superName = cls.getSuperclassName(); if (!Values.DOTTED_JAVA_LANG_OBJECT.equals(superName)) { this.classContext = clsContext; ...
java
@Override public void visitClassContext(ClassContext clsContext) { try { JavaClass cls = clsContext.getJavaClass(); String superName = cls.getSuperclassName(); if (!Values.DOTTED_JAVA_LANG_OBJECT.equals(superName)) { this.classContext = clsContext; ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "clsContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "clsContext", ".", "getJavaClass", "(", ")", ";", "String", "superName", "=", "cls", ".", "getSuperclassName", "(", ")", ...
overrides the visitor to accept classes derived from non java.lang.Object classes. @param clsContext the context object of the currently parsed class
[ "overrides", "the", "visitor", "to", "accept", "classes", "derived", "from", "non", "java", ".", "lang", ".", "Object", "classes", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java#L83-L113
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
CopiedOverriddenMethod.visitCode
@Override public void visitCode(Code obj) { try { Method m = getMethod(); if ((!m.isPublic() && !m.isProtected()) || m.isAbstract() || m.isSynthetic()) { return; } CodeInfo superCode = superclassCode.remove(curMethodInfo); if (supe...
java
@Override public void visitCode(Code obj) { try { Method m = getMethod(); if ((!m.isPublic() && !m.isProtected()) || m.isAbstract() || m.isSynthetic()) { return; } CodeInfo superCode = superclassCode.remove(curMethodInfo); if (supe...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "(", "!", "m", ".", "isPublic", "(", ")", "&&", "!", "m", ".", "isProtected", "(", ")", ")", "|...
overrides the visitor to find code blocks of methods that are the same as its parents @param obj the code object of the currently parsed method
[ "overrides", "the", "visitor", "to", "find", "code", "blocks", "of", "methods", "that", "are", "the", "same", "as", "its", "parents" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java#L132-L163
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
CopiedOverriddenMethod.sawOpcode
@Override public void sawOpcode(int seen) { if (!sawAload0) { if (seen == Const.ALOAD_0) { sawAload0 = true; } else { throw new StopOpcodeParsingException(); } } else if (nextParmIndex < parmTypes.length) { if (isExpect...
java
@Override public void sawOpcode(int seen) { if (!sawAload0) { if (seen == Const.ALOAD_0) { sawAload0 = true; } else { throw new StopOpcodeParsingException(); } } else if (nextParmIndex < parmTypes.length) { if (isExpect...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "!", "sawAload0", ")", "{", "if", "(", "seen", "==", "Const", ".", "ALOAD_0", ")", "{", "sawAload0", "=", "true", ";", "}", "else", "{", "throw", "new", "StopO...
overrides the visitor to look for an exact call to the parent class's method using this methods parm. @param seen the currently parsed instruction
[ "overrides", "the", "visitor", "to", "look", "for", "an", "exact", "call", "to", "the", "parent", "class", "s", "method", "using", "this", "methods", "parm", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java#L172-L206
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
CopiedOverriddenMethod.sameAccess
private static boolean sameAccess(int parentAccess, int childAccess) { return ((parentAccess & (Const.ACC_PUBLIC | Const.ACC_PROTECTED)) == (childAccess & (Const.ACC_PUBLIC | Const.ACC_PROTECTED))); }
java
private static boolean sameAccess(int parentAccess, int childAccess) { return ((parentAccess & (Const.ACC_PUBLIC | Const.ACC_PROTECTED)) == (childAccess & (Const.ACC_PUBLIC | Const.ACC_PROTECTED))); }
[ "private", "static", "boolean", "sameAccess", "(", "int", "parentAccess", ",", "int", "childAccess", ")", "{", "return", "(", "(", "parentAccess", "&", "(", "Const", ".", "ACC_PUBLIC", "|", "Const", ".", "ACC_PROTECTED", ")", ")", "==", "(", "childAccess", ...
determines if two access flags contain the same access modifiers @param parentAccess the access flags of the parent method @param childAccess the access flats of the child method @return whether the access modifiers are the same
[ "determines", "if", "two", "access", "flags", "contain", "the", "same", "access", "modifiers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java#L255-L257
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/TailRecursion.java
TailRecursion.visitMethod
@Override public void visitMethod(Method obj) { Code c = obj.getCode(); if (c != null) { byte[] opcodes = c.getCode(); if (opcodes != null) { trPCPos = opcodes.length - 1; if (!obj.getSignature().endsWith(Values.SIG_VOID)) { ...
java
@Override public void visitMethod(Method obj) { Code c = obj.getCode(); if (c != null) { byte[] opcodes = c.getCode(); if (opcodes != null) { trPCPos = opcodes.length - 1; if (!obj.getSignature().endsWith(Values.SIG_VOID)) { ...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "Code", "c", "=", "obj", ".", "getCode", "(", ")", ";", "if", "(", "c", "!=", "null", ")", "{", "byte", "[", "]", "opcodes", "=", "c", ".", "getCode", "(", ")", "...
implements the visitor to figure the pc where the method call must occur depending on whether the method returns a value, or not. @param obj the context object of the currently parsed method
[ "implements", "the", "visitor", "to", "figure", "the", "pc", "where", "the", "method", "call", "must", "occur", "depending", "on", "whether", "the", "method", "returns", "a", "value", "or", "not", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/TailRecursion.java#L80-L97
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/TailRecursion.java
TailRecursion.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKEVIRTUAL) { checkForTailRecursion(); } } finally { stack.sawOpcode(this, seen); } }
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKEVIRTUAL) { checkForTailRecursion(); } } finally { stack.sawOpcode(this, seen); } }
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "seen", "==", "Const", ".", "INVOKEVIRTUAL", ")", "{", "checkForTailRecursion", "(", ")", ";", "...
implements the visitor to find methods that employ tail recursion @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "find", "methods", "that", "employ", "tail", "recursion" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/TailRecursion.java#L105-L116
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java
NonCollectionMethodUse.sawOpcode
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEVIRTUAL) { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); String methodSig = getSigConstantOperand(); FQMethod methodInfo = new FQMethod(className...
java
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEVIRTUAL) { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); String methodSig = getSigConstantOperand(); FQMethod methodInfo = new FQMethod(className...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "INVOKEVIRTUAL", ")", "{", "String", "className", "=", "getClassConstantOperand", "(", ")", ";", "String", "methodName", "=", "getNameConstan...
implements the visitor to look for method calls that are one of the old pre-collections1.2 set of methods @param seen the currently parsed opcode
[ "implements", "the", "visitor", "to", "look", "for", "method", "calls", "that", "are", "one", "of", "the", "old", "pre", "-", "collections1", ".", "2", "set", "of", "methods" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java#L70-L83
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java
OrphanedDOMNode.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); nodeCreations = new HashMap<>(); nodeStores = new HashMap<>(); super.visitClassContext(classContext); } finally { stack = null; ...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); nodeCreations = new HashMap<>(); nodeStores = new HashMap<>(); super.visitClassContext(classContext); } finally { stack = null; ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "nodeCreations", "=", "new", "HashMap", "<>", "(", ")", ";", "nodeStores", "=", "new", "Ha...
implements the visitor to create and clear the stack, node creations and store maps @param classContext the context object for the currently parsed class
[ "implements", "the", "visitor", "to", "create", "and", "clear", "the", "stack", "node", "creations", "and", "store", "maps" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java#L75-L87
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java
OrphanedDOMNode.visitCode
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); nodeCreations.clear(); nodeStores.clear(); super.visitCode(obj); BitSet reportedPCs = new BitSet(); for (Integer pc : nodeCreations.values()) { if (!reportedPCs.get(pc.intValue()...
java
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); nodeCreations.clear(); nodeStores.clear(); super.visitCode(obj); BitSet reportedPCs = new BitSet(); for (Integer pc : nodeCreations.values()) { if (!reportedPCs.get(pc.intValue()...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "nodeCreations", ".", "clear", "(", ")", ";", "nodeStores", ".", "clear", "(", ")", ";", "super", ".", "visitCode", ...
implements the visitor to clear the opcode stack for the next code @param obj the context object for the currently parsed code block
[ "implements", "the", "visitor", "to", "clear", "the", "opcode", "stack", "for", "the", "next", "code" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java#L95-L117
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java
OrphanedDOMNode.findDOMNodeCreationPoint
@Nullable private Integer findDOMNodeCreationPoint(int index) { if (stack.getStackDepth() <= index) { return null; } return nodeCreations.remove(stack.getStackItem(index)); }
java
@Nullable private Integer findDOMNodeCreationPoint(int index) { if (stack.getStackDepth() <= index) { return null; } return nodeCreations.remove(stack.getStackItem(index)); }
[ "@", "Nullable", "private", "Integer", "findDOMNodeCreationPoint", "(", "int", "index", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", "<=", "index", ")", "{", "return", "null", ";", "}", "return", "nodeCreations", ".", "remove", "(", "stack...
returns the pc where this DOM Node was created, or null if this isn't a DOM node that was created @param index the index into the stack of the item to be checked @return the pc where this NODE was created, or null
[ "returns", "the", "pc", "where", "this", "DOM", "Node", "was", "created", "or", "null", "if", "this", "isn", "t", "a", "DOM", "node", "that", "was", "created" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java#L198-L205
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
AbstractClassEmptyMethods.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (cls.isAbstract()) { interfaceMethods = collectInterfaceMethods(cls); super.visitClassContext(classContext); } ...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (cls.isAbstract()) { interfaceMethods = collectInterfaceMethods(cls); super.visitClassContext(classContext); } ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "cls", ".", "isAbstract", "(", ")", ")", "{", "interf...
overrides the visitor to check for abstract classes. @param classContext the context object that holds the JavaClass being parsed
[ "overrides", "the", "visitor", "to", "check", "for", "abstract", "classes", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java#L77-L90
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
AbstractClassEmptyMethods.visitCode
@Override public void visitCode(Code obj) { if (Values.CONSTRUCTOR.equals(methodName) || Values.STATIC_INITIALIZER.equals(methodName)) { return; } Method m = getMethod(); if (m.isSynthetic()) { return; } if (!interfaceMethods.contains(new QMe...
java
@Override public void visitCode(Code obj) { if (Values.CONSTRUCTOR.equals(methodName) || Values.STATIC_INITIALIZER.equals(methodName)) { return; } Method m = getMethod(); if (m.isSynthetic()) { return; } if (!interfaceMethods.contains(new QMe...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "Values", ".", "CONSTRUCTOR", ".", "equals", "(", "methodName", ")", "||", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "methodName", ")", ")", "{", "ret...
overrides the visitor to filter out constructors. @param obj the code to parse
[ "overrides", "the", "visitor", "to", "filter", "out", "constructors", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java#L110-L124
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
AbstractClassEmptyMethods.sawOpcode
@Override public void sawOpcode(int seen) { try { switch (state) { case SAW_NOTHING: if (seen == Const.RETURN) { bugReporter.reportBug(new BugInstance(this, BugType.ACEM_ABSTRACT_CLASS_EMPTY_METHODS.name(), NORMAL_PRIORITY).addClass(thi...
java
@Override public void sawOpcode(int seen) { try { switch (state) { case SAW_NOTHING: if (seen == Const.RETURN) { bugReporter.reportBug(new BugInstance(this, BugType.ACEM_ABSTRACT_CLASS_EMPTY_METHODS.name(), NORMAL_PRIORITY).addClass(thi...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "switch", "(", "state", ")", "{", "case", "SAW_NOTHING", ":", "if", "(", "seen", "==", "Const", ".", "RETURN", ")", "{", "bugReporter", ".", "reportBug", "(", "...
overrides the visitor to look for empty methods or simple exception throwers. @param seen the opcode currently being parsed
[ "overrides", "the", "visitor", "to", "look", "for", "empty", "methods", "or", "simple", "exception", "throwers", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java#L132-L193
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java
ManualArrayCopy.prescreen
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && bytecodeSet.intersects(arrayLoadOps); }
java
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && bytecodeSet.intersects(arrayLoadOps); }
[ "private", "boolean", "prescreen", "(", "Method", "method", ")", "{", "BitSet", "bytecodeSet", "=", "getClassContext", "(", ")", ".", "getBytecodeSet", "(", "method", ")", ";", "return", "(", "bytecodeSet", "!=", "null", ")", "&&", "bytecodeSet", ".", "inter...
looks for methods that contain array load opcodes @param method the context object of the current method @return if the class loads array contents
[ "looks", "for", "methods", "that", "contain", "array", "load", "opcodes" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java#L77-L80
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java
ManualArrayCopy.similarArrayInstructions
private static boolean similarArrayInstructions(int load, int store) { return ((load == Const.AALOAD) && (store == Const.AASTORE)) || ((load == Const.IALOAD) && (store == Const.IASTORE)) || ((load == Const.DALOAD) && (store == Const.DASTORE)) || ((load == Const.LALOAD) && (store == Const.LASTORE...
java
private static boolean similarArrayInstructions(int load, int store) { return ((load == Const.AALOAD) && (store == Const.AASTORE)) || ((load == Const.IALOAD) && (store == Const.IASTORE)) || ((load == Const.DALOAD) && (store == Const.DASTORE)) || ((load == Const.LALOAD) && (store == Const.LASTORE...
[ "private", "static", "boolean", "similarArrayInstructions", "(", "int", "load", ",", "int", "store", ")", "{", "return", "(", "(", "load", "==", "Const", ".", "AALOAD", ")", "&&", "(", "store", "==", "Const", ".", "AASTORE", ")", ")", "||", "(", "(", ...
looks to see if a load and store operation are working on the same type of array @param load the load instruction on an array @param store the store instruction on an array @return whether the type of the load and store are the same
[ "looks", "to", "see", "if", "a", "load", "and", "store", "operation", "are", "working", "on", "the", "same", "type", "of", "array" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java#L196-L201
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java
ConfusingFunctionSemantics.visitCode
@Override public void visitCode(Code obj) { try { possibleParmRegs.clear(); Method m = getMethod(); String methodSignature = m.getSignature(); String retSignature = SignatureUtils.getReturnSignature(methodSignature); JavaClass returnClass = null; ...
java
@Override public void visitCode(Code obj) { try { possibleParmRegs.clear(); Method m = getMethod(); String methodSignature = m.getSignature(); String retSignature = SignatureUtils.getReturnSignature(methodSignature); JavaClass returnClass = null; ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "possibleParmRegs", ".", "clear", "(", ")", ";", "Method", "m", "=", "getMethod", "(", ")", ";", "String", "methodSignature", "=", "m", ".", "getSignature", "(", ...
implements the visitor to look for any non-immutable typed parameters are assignable to the return type. If found, the method is parsed. @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "look", "for", "any", "non", "-", "immutable", "typed", "parameters", "are", "assignable", "to", "the", "return", "type", ".", "If", "found", "the", "method", "is", "parsed", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java#L109-L156
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/CollectionUtils.java
CollectionUtils.isListSetMap
public static boolean isListSetMap(String clsName) throws ClassNotFoundException { JavaClass cls = Repository.lookupClass(clsName); return (cls.implementationOf(LIST_CLASS) || cls.implementationOf(SET_CLASS) || cls.implementationOf(MAP_CLASS)); }
java
public static boolean isListSetMap(String clsName) throws ClassNotFoundException { JavaClass cls = Repository.lookupClass(clsName); return (cls.implementationOf(LIST_CLASS) || cls.implementationOf(SET_CLASS) || cls.implementationOf(MAP_CLASS)); }
[ "public", "static", "boolean", "isListSetMap", "(", "String", "clsName", ")", "throws", "ClassNotFoundException", "{", "JavaClass", "cls", "=", "Repository", ".", "lookupClass", "(", "clsName", ")", ";", "return", "(", "cls", ".", "implementationOf", "(", "LIST_...
determines if the current class name is derived from List, Set or Map @param clsName the class to determine it's parentage @return if the class is a List, Set or Map @throws ClassNotFoundException if the cls parameter can't be found
[ "determines", "if", "the", "current", "class", "name", "is", "derived", "from", "List", "Set", "or", "Map" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/CollectionUtils.java#L62-L65
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java
NonSymmetricEquals.prescreen
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.CHECKCAST)); }
java
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.CHECKCAST)); }
[ "private", "boolean", "prescreen", "(", "Method", "method", ")", "{", "BitSet", "bytecodeSet", "=", "getClassContext", "(", ")", ".", "getBytecodeSet", "(", "method", ")", ";", "return", "(", "bytecodeSet", "!=", "null", ")", "&&", "(", "bytecodeSet", ".", ...
looks for methods that contain a checkcast instruction @param method the context object of the current method @return if the class does checkcast instructions
[ "looks", "for", "methods", "that", "contain", "a", "checkcast", "instruction" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java#L102-L105
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java
NonSymmetricEquals.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.CHECKCAST) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); if (item.getRegisterNumber() == 1) { Strin...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.CHECKCAST) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); if (item.getRegisterNumber() == 1) { Strin...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "(", "seen", "==", "Const", ".", "CHECKCAST", ")", "&&", "(", "stack", ".", "getStackDepth", "...
implements the visitor to look for checkcasts of the parameter to other types, and enter instances in a map for further processing in doReport. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "checkcasts", "of", "the", "parameter", "to", "other", "types", "and", "enter", "instances", "in", "a", "map", "for", "further", "processing", "in", "doReport", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java#L113-L144
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java
NonSymmetricEquals.report
@Override public void report() { for (Map.Entry<String, Map<String, BugInstance>> thisEntry : possibleBugs.entrySet()) { Map<String, BugInstance> equalsClassesMap = thisEntry.getValue(); for (Map.Entry<String, BugInstance> equalsEntry : equalsClassesMap.entrySet()) { ...
java
@Override public void report() { for (Map.Entry<String, Map<String, BugInstance>> thisEntry : possibleBugs.entrySet()) { Map<String, BugInstance> equalsClassesMap = thisEntry.getValue(); for (Map.Entry<String, BugInstance> equalsEntry : equalsClassesMap.entrySet()) { ...
[ "@", "Override", "public", "void", "report", "(", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Map", "<", "String", ",", "BugInstance", ">", ">", "thisEntry", ":", "possibleBugs", ".", "entrySet", "(", ")", ")", "{", "Map", "<", ...
reports all the collected issues from the parse of this class
[ "reports", "all", "the", "collected", "issues", "from", "the", "parse", "of", "this", "class" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java#L149-L170
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { ignoreRegs = new BitSet(); tryBlocks = new BitSet(); catchHandlers = new BitSet(); switchTargets = new BitSet(); monitorSyncPCs = new ArrayList<>(5); stack = new...
java
@Override public void visitClassContext(ClassContext classContext) { try { ignoreRegs = new BitSet(); tryBlocks = new BitSet(); catchHandlers = new BitSet(); switchTargets = new BitSet(); monitorSyncPCs = new ArrayList<>(5); stack = new...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "ignoreRegs", "=", "new", "BitSet", "(", ")", ";", "tryBlocks", "=", "new", "BitSet", "(", ")", ";", "catchHandlers", "=", "new", "BitSet", "...
implements the visitor to create and the clear the register to location map @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "create", "and", "the", "clear", "the", "register", "to", "location", "map" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L126-L144
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.visitCode
@Override public void visitCode(Code obj) { try { ignoreRegs.clear(); Method method = getMethod(); if (!method.isStatic()) { ignoreRegs.set(0); } int[] parmRegs = RegisterUtils.getParameterRegisters(method); for (int p...
java
@Override public void visitCode(Code obj) { try { ignoreRegs.clear(); Method method = getMethod(); if (!method.isStatic()) { ignoreRegs.set(0); } int[] parmRegs = RegisterUtils.getParameterRegisters(method); for (int p...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "ignoreRegs", ".", "clear", "(", ")", ";", "Method", "method", "=", "getMethod", "(", ")", ";", "if", "(", "!", "method", ".", "isStatic", "(", ")", ")", "{",...
implements the visitor to reset the register to location map @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "reset", "the", "register", "to", "location", "map" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L152-L192
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawOpcode
@Override public void sawOpcode(int seen) { UserObject uo = null; try { stack.precomputation(this); int pc = getPC(); if (tryBlocks.get(pc)) { ScopeBlock sb = new ScopeBlock(pc, findCatchHandlerFor(pc)); sb.setTry(); ...
java
@Override public void sawOpcode(int seen) { UserObject uo = null; try { stack.precomputation(this); int pc = getPC(); if (tryBlocks.get(pc)) { ScopeBlock sb = new ScopeBlock(pc, findCatchHandlerFor(pc)); sb.setTry(); ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "UserObject", "uo", "=", "null", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "int", "pc", "=", "getPC", "(", ")", ";", "if", "(", "tryBlocks", ...
implements the visitor to look for variables assigned below the scope in which they are used. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "variables", "assigned", "below", "the", "scope", "in", "which", "they", "are", "used", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L200-L248
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawStore
private void sawStore(int seen, int pc) { int reg = RegisterUtils.getStoreReg(this, seen); if (catchHandlers.get(pc)) { ignoreRegs.set(reg); ScopeBlock catchSB = findScopeBlock(rootScopeBlock, pc + 1); if ((catchSB != null) && (catchSB.getStart() < pc)) { ...
java
private void sawStore(int seen, int pc) { int reg = RegisterUtils.getStoreReg(this, seen); if (catchHandlers.get(pc)) { ignoreRegs.set(reg); ScopeBlock catchSB = findScopeBlock(rootScopeBlock, pc + 1); if ((catchSB != null) && (catchSB.getStart() < pc)) { ...
[ "private", "void", "sawStore", "(", "int", "seen", ",", "int", "pc", ")", "{", "int", "reg", "=", "RegisterUtils", ".", "getStoreReg", "(", "this", ",", "seen", ")", ";", "if", "(", "catchHandlers", ".", "get", "(", "pc", ")", ")", "{", "ignoreRegs",...
processes a register store by updating the appropriate scope block to mark this register as being stored in the block @param seen the currently parsed opcode @param pc the current program counter
[ "processes", "a", "register", "store", "by", "updating", "the", "appropriate", "scope", "block", "to", "mark", "this", "register", "as", "being", "stored", "in", "the", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L258-L308
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawIINC
private void sawIINC(int pc) { int reg = getRegisterOperand(); if (!ignoreRegs.get(reg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { sb.addLoad(reg, pc); } else { ignoreRegs.set(reg); } } ...
java
private void sawIINC(int pc) { int reg = getRegisterOperand(); if (!ignoreRegs.get(reg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { sb.addLoad(reg, pc); } else { ignoreRegs.set(reg); } } ...
[ "private", "void", "sawIINC", "(", "int", "pc", ")", "{", "int", "reg", "=", "getRegisterOperand", "(", ")", ";", "if", "(", "!", "ignoreRegs", ".", "get", "(", "reg", ")", ")", "{", "ScopeBlock", "sb", "=", "findScopeBlock", "(", "rootScopeBlock", ","...
processes a register IINC by updating the appropriate scope block to mark this register as being stored in the block @param pc the current program counter
[ "processes", "a", "register", "IINC", "by", "updating", "the", "appropriate", "scope", "block", "to", "mark", "this", "register", "as", "being", "stored", "in", "the", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L316-L345
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawLoad
private void sawLoad(int seen, int pc) { int reg = RegisterUtils.getLoadReg(this, seen); if (!ignoreRegs.get(reg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { sb.addLoad(reg, pc); } else { ignoreRegs.set(reg)...
java
private void sawLoad(int seen, int pc) { int reg = RegisterUtils.getLoadReg(this, seen); if (!ignoreRegs.get(reg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { sb.addLoad(reg, pc); } else { ignoreRegs.set(reg)...
[ "private", "void", "sawLoad", "(", "int", "seen", ",", "int", "pc", ")", "{", "int", "reg", "=", "RegisterUtils", ".", "getLoadReg", "(", "this", ",", "seen", ")", ";", "if", "(", "!", "ignoreRegs", ".", "get", "(", "reg", ")", ")", "{", "ScopeBloc...
processes a register store by updating the appropriate scope block to mark this register as being read in the block @param seen the currently parsed opcode @param pc the current program counter
[ "processes", "a", "register", "store", "by", "updating", "the", "appropriate", "scope", "block", "to", "mark", "this", "register", "as", "being", "read", "in", "the", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L355-L365
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawBranch
private void sawBranch(int seen, int pc) { int target = getBranchTarget(); if (target > pc) { if ((seen == Const.GOTO) || (seen == Const.GOTO_W)) { int nextPC = getNextPC(); if (!switchTargets.get(nextPC)) { ScopeBlock sb = findScopeBlockWi...
java
private void sawBranch(int seen, int pc) { int target = getBranchTarget(); if (target > pc) { if ((seen == Const.GOTO) || (seen == Const.GOTO_W)) { int nextPC = getNextPC(); if (!switchTargets.get(nextPC)) { ScopeBlock sb = findScopeBlockWi...
[ "private", "void", "sawBranch", "(", "int", "seen", ",", "int", "pc", ")", "{", "int", "target", "=", "getBranchTarget", "(", ")", ";", "if", "(", "target", ">", "pc", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "GOTO", ")", "||", "(", ...
creates a scope block to describe this branch location. @param seen the currently parsed opcode @param pc the current program counter
[ "creates", "a", "scope", "block", "to", "describe", "this", "branch", "location", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L375-L435
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawSwitch
private void sawSwitch(int pc) { int[] offsets = getSwitchOffsets(); List<Integer> targets = new ArrayList<>(offsets.length); for (int offset : offsets) { targets.add(Integer.valueOf(offset + pc)); } Integer defOffset = Integer.valueOf(getDefaultSwitchOffset() + pc); ...
java
private void sawSwitch(int pc) { int[] offsets = getSwitchOffsets(); List<Integer> targets = new ArrayList<>(offsets.length); for (int offset : offsets) { targets.add(Integer.valueOf(offset + pc)); } Integer defOffset = Integer.valueOf(getDefaultSwitchOffset() + pc); ...
[ "private", "void", "sawSwitch", "(", "int", "pc", ")", "{", "int", "[", "]", "offsets", "=", "getSwitchOffsets", "(", ")", ";", "List", "<", "Integer", ">", "targets", "=", "new", "ArrayList", "<>", "(", "offsets", ".", "length", ")", ";", "for", "("...
creates a new scope block for each case statement @param pc the current program counter
[ "creates", "a", "new", "scope", "block", "for", "each", "case", "statement" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L443-L466
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawStaticCall
@Nullable private UserObject sawStaticCall() { if (getSigConstantOperand().endsWith(Values.SIG_VOID)) { return null; } return new UserObject(isRiskyMethodCall()); }
java
@Nullable private UserObject sawStaticCall() { if (getSigConstantOperand().endsWith(Values.SIG_VOID)) { return null; } return new UserObject(isRiskyMethodCall()); }
[ "@", "Nullable", "private", "UserObject", "sawStaticCall", "(", ")", "{", "if", "(", "getSigConstantOperand", "(", ")", ".", "endsWith", "(", "Values", ".", "SIG_VOID", ")", ")", "{", "return", "null", ";", "}", "return", "new", "UserObject", "(", "isRisky...
processes a static call or initializer by checking to see if the call is risky, and returning a OpcodeStack item user value saying so. @return the user object to place on the OpcodeStack
[ "processes", "a", "static", "call", "or", "initializer", "by", "checking", "to", "see", "if", "the", "call", "is", "risky", "and", "returning", "a", "OpcodeStack", "item", "user", "value", "saying", "so", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L510-L518
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawMonitorEnter
private void sawMonitorEnter(int pc) { monitorSyncPCs.add(Integer.valueOf(pc)); ScopeBlock sb = new ScopeBlock(pc, Integer.MAX_VALUE); sb.setSync(); rootScopeBlock.addChild(sb); }
java
private void sawMonitorEnter(int pc) { monitorSyncPCs.add(Integer.valueOf(pc)); ScopeBlock sb = new ScopeBlock(pc, Integer.MAX_VALUE); sb.setSync(); rootScopeBlock.addChild(sb); }
[ "private", "void", "sawMonitorEnter", "(", "int", "pc", ")", "{", "monitorSyncPCs", ".", "add", "(", "Integer", ".", "valueOf", "(", "pc", ")", ")", ";", "ScopeBlock", "sb", "=", "new", "ScopeBlock", "(", "pc", ",", "Integer", ".", "MAX_VALUE", ")", ";...
processes a monitor enter call to create a scope block @param pc the current program counter
[ "processes", "a", "monitor", "enter", "call", "to", "create", "a", "scope", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L555-L561
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.sawMonitorExit
private void sawMonitorExit(int pc) { if (!monitorSyncPCs.isEmpty()) { ScopeBlock sb = findSynchronizedScopeBlock(rootScopeBlock, monitorSyncPCs.get(0).intValue()); if (sb != null) { sb.setFinish(pc); } monitorSyncPCs.remove(monitorSyncPCs.size() -...
java
private void sawMonitorExit(int pc) { if (!monitorSyncPCs.isEmpty()) { ScopeBlock sb = findSynchronizedScopeBlock(rootScopeBlock, monitorSyncPCs.get(0).intValue()); if (sb != null) { sb.setFinish(pc); } monitorSyncPCs.remove(monitorSyncPCs.size() -...
[ "private", "void", "sawMonitorExit", "(", "int", "pc", ")", "{", "if", "(", "!", "monitorSyncPCs", ".", "isEmpty", "(", ")", ")", "{", "ScopeBlock", "sb", "=", "findSynchronizedScopeBlock", "(", "rootScopeBlock", ",", "monitorSyncPCs", ".", "get", "(", "0", ...
processes a monitor exit to set the end of the already created scope block @param pc the current program counter
[ "processes", "a", "monitor", "exit", "to", "set", "the", "end", "of", "the", "already", "created", "scope", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L569-L577
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.getCallingObject
@Nullable private Comparable<?> getCallingObject() { String sig = getSigConstantOperand(); if (Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) { return null; } int numParameters = SignatureUtils.getNumParameters(sig); if (stack.getStackDepth() <=...
java
@Nullable private Comparable<?> getCallingObject() { String sig = getSigConstantOperand(); if (Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) { return null; } int numParameters = SignatureUtils.getNumParameters(sig); if (stack.getStackDepth() <=...
[ "@", "Nullable", "private", "Comparable", "<", "?", ">", "getCallingObject", "(", ")", "{", "String", "sig", "=", "getSigConstantOperand", "(", ")", ";", "if", "(", "Values", ".", "SIG_VOID", ".", "equals", "(", "SignatureUtils", ".", "getReturnSignature", "...
returns either a register number of a field reference of the object that a method is being called on, or null, if it can't be determined. @return either an Integer for a register, or a String for the field name, or null
[ "returns", "either", "a", "register", "number", "of", "a", "field", "reference", "of", "the", "object", "that", "a", "method", "is", "being", "called", "on", "or", "null", "if", "it", "can", "t", "be", "determined", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L584-L617
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.findScopeBlock
@Nullable private ScopeBlock findScopeBlock(ScopeBlock sb, int pc) { if ((pc <= sb.getStart()) || (pc >= sb.getFinish())) { return null; } List<ScopeBlock> children = sb.getChildren(); if (children != null) { for (ScopeBlock child : children) { ...
java
@Nullable private ScopeBlock findScopeBlock(ScopeBlock sb, int pc) { if ((pc <= sb.getStart()) || (pc >= sb.getFinish())) { return null; } List<ScopeBlock> children = sb.getChildren(); if (children != null) { for (ScopeBlock child : children) { ...
[ "@", "Nullable", "private", "ScopeBlock", "findScopeBlock", "(", "ScopeBlock", "sb", ",", "int", "pc", ")", "{", "if", "(", "(", "pc", "<=", "sb", ".", "getStart", "(", ")", ")", "||", "(", "pc", ">=", "sb", ".", "getFinish", "(", ")", ")", ")", ...
returns the scope block in which this register was assigned, by traversing the scope block tree @param sb the scope block to start searching in @param pc the current program counter @return the scope block or null if not found
[ "returns", "the", "scope", "block", "in", "which", "this", "register", "was", "assigned", "by", "traversing", "the", "scope", "block", "tree" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L628-L645
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.findScopeBlockWithTarget
private ScopeBlock findScopeBlockWithTarget(ScopeBlock sb, int start, int target) { ScopeBlock parentBlock = null; int finishLocation = sb.getFinish(); if ((sb.getStart() < start) && (finishLocation >= start) && ((finishLocation <= target) || (sb.isGoto() && !sb.isLoop()))) { parentB...
java
private ScopeBlock findScopeBlockWithTarget(ScopeBlock sb, int start, int target) { ScopeBlock parentBlock = null; int finishLocation = sb.getFinish(); if ((sb.getStart() < start) && (finishLocation >= start) && ((finishLocation <= target) || (sb.isGoto() && !sb.isLoop()))) { parentB...
[ "private", "ScopeBlock", "findScopeBlockWithTarget", "(", "ScopeBlock", "sb", ",", "int", "start", ",", "int", "target", ")", "{", "ScopeBlock", "parentBlock", "=", "null", ";", "int", "finishLocation", "=", "sb", ".", "getFinish", "(", ")", ";", "if", "(", ...
returns an existing scope block that has the same target as the one looked for @param sb the scope block to start with @param start the current pc @param target the target to look for @return the scope block found or null
[ "returns", "an", "existing", "scope", "block", "that", "has", "the", "same", "target", "as", "the", "one", "looked", "for" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L659-L677
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.findPreviousSiblingScopeBlock
@Nullable private ScopeBlock findPreviousSiblingScopeBlock(ScopeBlock sb) { ScopeBlock parent = sb.getParent(); if (parent == null) { return null; } List<ScopeBlock> children = parent.getChildren(); if (children == null) { return null; } ...
java
@Nullable private ScopeBlock findPreviousSiblingScopeBlock(ScopeBlock sb) { ScopeBlock parent = sb.getParent(); if (parent == null) { return null; } List<ScopeBlock> children = parent.getChildren(); if (children == null) { return null; } ...
[ "@", "Nullable", "private", "ScopeBlock", "findPreviousSiblingScopeBlock", "(", "ScopeBlock", "sb", ")", "{", "ScopeBlock", "parent", "=", "sb", ".", "getParent", "(", ")", ";", "if", "(", "parent", "==", "null", ")", "{", "return", "null", ";", "}", "List...
looks for the ScopeBlock has the same parent as this given one, but precedes it in the list. @param sb the scope block to look for the previous scope block @return the previous sibling scope block, or null if doesn't exist
[ "looks", "for", "the", "ScopeBlock", "has", "the", "same", "parent", "as", "this", "given", "one", "but", "precedes", "it", "in", "the", "list", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L686-L707
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.findSynchronizedScopeBlock
private ScopeBlock findSynchronizedScopeBlock(ScopeBlock sb, int monitorEnterPC) { ScopeBlock monitorBlock = sb; if (sb.hasChildren()) { for (ScopeBlock child : sb.getChildren()) { if (child.isSync() && (child.getStart() > monitorBlock.getStart())) { mon...
java
private ScopeBlock findSynchronizedScopeBlock(ScopeBlock sb, int monitorEnterPC) { ScopeBlock monitorBlock = sb; if (sb.hasChildren()) { for (ScopeBlock child : sb.getChildren()) { if (child.isSync() && (child.getStart() > monitorBlock.getStart())) { mon...
[ "private", "ScopeBlock", "findSynchronizedScopeBlock", "(", "ScopeBlock", "sb", ",", "int", "monitorEnterPC", ")", "{", "ScopeBlock", "monitorBlock", "=", "sb", ";", "if", "(", "sb", ".", "hasChildren", "(", ")", ")", "{", "for", "(", "ScopeBlock", "child", ...
finds the scope block that is the active synchronized block @param sb the parent scope block to start with @param monitorEnterPC the pc where the current synchronized block starts @return the scope block
[ "finds", "the", "scope", "block", "that", "is", "the", "active", "synchronized", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L718-L732
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
BloatedAssignmentScope.findCatchHandlerFor
private int findCatchHandlerFor(int pc) { CodeException[] exceptions = getMethod().getCode().getExceptionTable(); if (exceptions != null) { for (CodeException ex : exceptions) { if (ex.getStartPC() == pc) { return ex.getHandlerPC(); } ...
java
private int findCatchHandlerFor(int pc) { CodeException[] exceptions = getMethod().getCode().getExceptionTable(); if (exceptions != null) { for (CodeException ex : exceptions) { if (ex.getStartPC() == pc) { return ex.getHandlerPC(); } ...
[ "private", "int", "findCatchHandlerFor", "(", "int", "pc", ")", "{", "CodeException", "[", "]", "exceptions", "=", "getMethod", "(", ")", ".", "getCode", "(", ")", ".", "getExceptionTable", "(", ")", ";", "if", "(", "exceptions", "!=", "null", ")", "{", ...
returns the catch handler for a given try block @param pc the current instruction @return the pc of the handler for this pc if it's the start of a try block, or -1
[ "returns", "the", "catch", "handler", "for", "a", "given", "try", "block" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L742-L753
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java
SuspiciousCloneAlgorithm.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { if (cloneableClass == null) { return; } try { JavaClass cls = classContext.getJavaClass(); if (cls.implementationOf(cloneableClass)) { stack = new OpcodeStack(); ...
java
@Override public void visitClassContext(ClassContext classContext) { if (cloneableClass == null) { return; } try { JavaClass cls = classContext.getJavaClass(); if (cls.implementationOf(cloneableClass)) { stack = new OpcodeStack(); ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "if", "(", "cloneableClass", "==", "null", ")", "{", "return", ";", "}", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")"...
override the visitor to look for classes that implement Cloneable @param classContext the context object of the class to be checked
[ "override", "the", "visitor", "to", "look", "for", "classes", "that", "implement", "Cloneable" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java#L89-L106
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java
SuspiciousCloneAlgorithm.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); if (!m.isStatic() && "clone".equals(m.getName()) && SIG_VOID_TO_OBJECT.equals(m.getSignature())) { super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if (!m.isStatic() && "clone".equals(m.getName()) && SIG_VOID_TO_OBJECT.equals(m.getSignature())) { super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "!", "m", ".", "isStatic", "(", ")", "&&", "\"clone\"", ".", "equals", "(", "m", ".", "getName", "(", ")", ")...
override the visitor to only continue for the clone method @param obj the context object of the currently parsed method
[ "override", "the", "visitor", "to", "only", "continue", "for", "the", "clone", "method" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java#L114-L120
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java
SuspiciousCloneAlgorithm.sawOpcode
@Override public void sawOpcode(int seen) { boolean srcField = false; try { stack.precomputation(this); switch (seen) { case Const.ALOAD_0: srcField = true; break; case Const.DUP: if (st...
java
@Override public void sawOpcode(int seen) { boolean srcField = false; try { stack.precomputation(this); switch (seen) { case Const.ALOAD_0: srcField = true; break; case Const.DUP: if (st...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "boolean", "srcField", "=", "false", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".", "ALOAD_0",...
override the visitor to look for stores to member fields of the source object on a clone @param seen the opcode of the currently parsed instruction
[ "override", "the", "visitor", "to", "look", "for", "stores", "to", "member", "fields", "of", "the", "source", "object", "on", "a", "clone" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java#L128-L197
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
SQLInLoop.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { queryLocations = new ArrayList<>(); loops = new ArrayList<>(); super.visitClassContext(classContext); } finally { queryLocations = null; loops = null; } ...
java
@Override public void visitClassContext(ClassContext classContext) { try { queryLocations = new ArrayList<>(); loops = new ArrayList<>(); super.visitClassContext(classContext); } finally { queryLocations = null; loops = null; } ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "queryLocations", "=", "new", "ArrayList", "<>", "(", ")", ";", "loops", "=", "new", "ArrayList", "<>", "(", ")", ";", "super", ".", "visitCl...
implements the visitor to create and clear the query locations and loops collections @param classContext the context object for the currently parsed java class
[ "implements", "the", "visitor", "to", "create", "and", "clear", "the", "query", "locations", "and", "loops", "collections" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java#L67-L77
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
SQLInLoop.visitCode
@Override public void visitCode(Code obj) { queryLocations.clear(); loops.clear(); super.visitCode(obj); for (Integer qLoc : queryLocations) { for (LoopLocation lLoc : loops) { if (lLoc.isInLoop(qLoc.intValue())) { bugReporter.reportBug...
java
@Override public void visitCode(Code obj) { queryLocations.clear(); loops.clear(); super.visitCode(obj); for (Integer qLoc : queryLocations) { for (LoopLocation lLoc : loops) { if (lLoc.isInLoop(qLoc.intValue())) { bugReporter.reportBug...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "queryLocations", ".", "clear", "(", ")", ";", "loops", ".", "clear", "(", ")", ";", "super", ".", "visitCode", "(", "obj", ")", ";", "for", "(", "Integer", "qLoc", ":", ...
implements the visitor to clear the collections, and report the query locations that are in loops @param obj the context object for the currently parsed code block
[ "implements", "the", "visitor", "to", "clear", "the", "collections", "and", "report", "the", "query", "locations", "that", "are", "in", "loops" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java#L85-L99
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
SQLInLoop.sawOpcode
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEINTERFACE) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); if (queryClasses.contains(clsName) && queryMethods.contains(methodName)) { queryLoca...
java
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEINTERFACE) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); if (queryClasses.contains(clsName) && queryMethods.contains(methodName)) { queryLoca...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "INVOKEINTERFACE", ")", "{", "String", "clsName", "=", "getClassConstantOperand", "(", ")", ";", "String", "methodName", "=", "getNameConstan...
implements the visitor to collect positions of queries and loops @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "collect", "positions", "of", "queries", "and", "loops" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java#L107-L123
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java
StaticMethodInstanceInvocation.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); if (prescreen(m)) { stack.resetForMethodEntry(this); popStack.clear(); super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if (prescreen(m)) { stack.resetForMethodEntry(this); popStack.clear(); super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "prescreen", "(", "m", ")", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "popStack", "."...
implement the visitor to reset the stack @param obj the context object of the currently parsed method
[ "implement", "the", "visitor", "to", "reset", "the", "stack" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java#L93-L101
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java
DubiousMapCollection.processMethodCall
private void processMethodCall() { int numParams = SignatureUtils.getNumParameters(getSigConstantOperand()); int depth = stack.getStackDepth(); for (int i = 0; i < numParams; i++) { if (depth > i) { OpcodeStack.Item item = stack.getStackItem(i); XFiel...
java
private void processMethodCall() { int numParams = SignatureUtils.getNumParameters(getSigConstantOperand()); int depth = stack.getStackDepth(); for (int i = 0; i < numParams; i++) { if (depth > i) { OpcodeStack.Item item = stack.getStackItem(i); XFiel...
[ "private", "void", "processMethodCall", "(", ")", "{", "int", "numParams", "=", "SignatureUtils", ".", "getNumParameters", "(", "getSigConstantOperand", "(", ")", ")", ";", "int", "depth", "=", "stack", ".", "getStackDepth", "(", ")", ";", "for", "(", "int",...
parses all the parameters of a called method and removes any of the parameters that are maps currently being looked at for this detector
[ "parses", "all", "the", "parameters", "of", "a", "called", "method", "and", "removes", "any", "of", "the", "parameters", "that", "are", "maps", "currently", "being", "looked", "at", "for", "this", "detector" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java#L235-L250
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java
OverzealousCasting.visitCode
@Override public void visitCode(Code obj) { state = State.SAW_NOTHING; lvt = obj.getLocalVariableTable(); if ((lvt != null) && prescreen(getMethod())) { super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { state = State.SAW_NOTHING; lvt = obj.getLocalVariableTable(); if ((lvt != null) && prescreen(getMethod())) { super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "state", "=", "State", ".", "SAW_NOTHING", ";", "lvt", "=", "obj", ".", "getLocalVariableTable", "(", ")", ";", "if", "(", "(", "lvt", "!=", "null", ")", "&&", "prescreen", ...
implements the visitor to set the state on entry of the code block to SAW_NOTHING, and to see if there is a local variable table @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "set", "the", "state", "on", "entry", "of", "the", "code", "block", "to", "SAW_NOTHING", "and", "to", "see", "if", "there", "is", "a", "local", "variable", "table" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java#L71-L78
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java
OverzealousCasting.sawOpcode
@Override public void sawOpcode(int seen) { switch (state) { case SAW_NOTHING: if (seen == Const.CHECKCAST) { castClass = getClassConstantOperand(); state = State.SAW_CHECKCAST; } else if (seen == Const.INVOKEINTERFACE) { ...
java
@Override public void sawOpcode(int seen) { switch (state) { case SAW_NOTHING: if (seen == Const.CHECKCAST) { castClass = getClassConstantOperand(); state = State.SAW_CHECKCAST; } else if (seen == Const.INVOKEINTERFACE) { ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "switch", "(", "state", ")", "{", "case", "SAW_NOTHING", ":", "if", "(", "seen", "==", "Const", ".", "CHECKCAST", ")", "{", "castClass", "=", "getClassConstantOperand", "(", ")...
implements the visitor to look for a checkcast followed by a astore, where the types of the objects are different. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "a", "checkcast", "followed", "by", "a", "astore", "where", "the", "types", "of", "the", "objects", "are", "different", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java#L98-L150
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
AnnotationIssues.clearAssumptions
public static void clearAssumptions(Map<Integer, Integer> assumptionTill, int pc) { Iterator<Integer> it = assumptionTill.values().iterator(); while (it.hasNext()) { if (it.next().intValue() <= pc) { it.remove(); } } }
java
public static void clearAssumptions(Map<Integer, Integer> assumptionTill, int pc) { Iterator<Integer> it = assumptionTill.values().iterator(); while (it.hasNext()) { if (it.next().intValue() <= pc) { it.remove(); } } }
[ "public", "static", "void", "clearAssumptions", "(", "Map", "<", "Integer", ",", "Integer", ">", "assumptionTill", ",", "int", "pc", ")", "{", "Iterator", "<", "Integer", ">", "it", "=", "assumptionTill", ".", "values", "(", ")", ".", "iterator", "(", ")...
the map is keyed by register, and value by when an assumption holds to a byte offset if we have passed when the assumption holds, clear the item from the map @param assumptionTill the map of assumptions @param pc // * the current pc
[ "the", "map", "is", "keyed", "by", "register", "and", "value", "by", "when", "an", "assumption", "holds", "to", "a", "byte", "offset", "if", "we", "have", "passed", "when", "the", "assumption", "holds", "clear", "the", "item", "from", "the", "map" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java#L396-L403
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
AnnotationIssues.clearBranchTargets
public void clearBranchTargets(int pc) { Iterator<Integer> it = branchTargets.iterator(); while (it.hasNext()) { int target = it.next().intValue(); if (target <= pc) { it.remove(); } } }
java
public void clearBranchTargets(int pc) { Iterator<Integer> it = branchTargets.iterator(); while (it.hasNext()) { int target = it.next().intValue(); if (target <= pc) { it.remove(); } } }
[ "public", "void", "clearBranchTargets", "(", "int", "pc", ")", "{", "Iterator", "<", "Integer", ">", "it", "=", "branchTargets", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "int", "target", "=", "it", ".", ...
remove branch targets that have been passed @param pc the current pc
[ "remove", "branch", "targets", "that", "have", "been", "passed" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java#L427-L435
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java
InconsistentKeyNameCasing.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKEINTERFACE) { KeyType type = isKeyAccessMethod(seen); if (type != null) { int numParms = SignatureUtils.getNumParameters(getSigCon...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); if (seen == Const.INVOKEINTERFACE) { KeyType type = isKeyAccessMethod(seen); if (type != null) { int numParms = SignatureUtils.getNumParameters(getSigCon...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "seen", "==", "Const", ".", "INVOKEINTERFACE", ")", "{", "KeyType", "type", "=", "isKeyAccessMetho...
implements the visitor to look for calls to HttpServletRequest.getParameter and collect what the name of the key is. @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "calls", "to", "HttpServletRequest", ".", "getParameter", "and", "collect", "what", "the", "name", "of", "the", "key", "is", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java#L125-L161
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java
InconsistentKeyNameCasing.report
@Override public void report() { for (Map.Entry<KeyType, Map<String, Map<String, List<SourceInfo>>>> entry : parmInfo.entrySet()) { KeyType type = entry.getKey(); Map<String, Map<String, List<SourceInfo>>> typeMap = entry.getValue(); for (Map<String, List<SourceInfo>> pa...
java
@Override public void report() { for (Map.Entry<KeyType, Map<String, Map<String, List<SourceInfo>>>> entry : parmInfo.entrySet()) { KeyType type = entry.getKey(); Map<String, Map<String, List<SourceInfo>>> typeMap = entry.getValue(); for (Map<String, List<SourceInfo>> pa...
[ "@", "Override", "public", "void", "report", "(", ")", "{", "for", "(", "Map", ".", "Entry", "<", "KeyType", ",", "Map", "<", "String", ",", "Map", "<", "String", ",", "List", "<", "SourceInfo", ">", ">", ">", ">", "entry", ":", "parmInfo", ".", ...
implements the visitor to look for the collected parm names, and look for duplicates that are different in casing only.
[ "implements", "the", "visitor", "to", "look", "for", "the", "collected", "parm", "names", "and", "look", "for", "duplicates", "that", "are", "different", "in", "casing", "only", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java#L166-L190
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
UnnecessaryStoreBeforeReturn.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { branchTargets = new BitSet(); catchTargets = new BitSet(); stack = new OpcodeStack(); super.visitClassContext(classContext); } finally { branchTargets = null; ...
java
@Override public void visitClassContext(ClassContext classContext) { try { branchTargets = new BitSet(); catchTargets = new BitSet(); stack = new OpcodeStack(); super.visitClassContext(classContext); } finally { branchTargets = null; ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "branchTargets", "=", "new", "BitSet", "(", ")", ";", "catchTargets", "=", "new", "BitSet", "(", ")", ";", "stack", "=", "new", "OpcodeStack", ...
implements the visitor to create and clear the branchTargets @param classContext the context object for the currently parsed class
[ "implements", "the", "visitor", "to", "create", "and", "clear", "the", "branchTargets" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java#L131-L143
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
UnnecessaryStoreBeforeReturn.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); String sig = m.getSignature(); if (!Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) { state = State.SEEN_NOTHING; branchTargets.clear(); CodeException[] ces = obj.getExcept...
java
@Override public void visitCode(Code obj) { Method m = getMethod(); String sig = m.getSignature(); if (!Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) { state = State.SEEN_NOTHING; branchTargets.clear(); CodeException[] ces = obj.getExcept...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "String", "sig", "=", "m", ".", "getSignature", "(", ")", ";", "if", "(", "!", "Values", ".", "SIG_VOID", ".", "equals", "...
implements the visitor to make sure method returns a value, and then clears the targets @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "make", "sure", "method", "returns", "a", "value", "and", "then", "clears", "the", "targets" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java#L151-L168
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
UnnecessaryStoreBeforeReturn.sawOpcode
@Override public void sawOpcode(int seen) { int lhsReg = -1; try { stack.precomputation(this); switch (state) { case SEEN_NOTHING: if (!catchTargets.get(getPC()) && lookForStore(seen) && (stack.getStackDepth() >= 1)) { ...
java
@Override public void sawOpcode(int seen) { int lhsReg = -1; try { stack.precomputation(this); switch (state) { case SEEN_NOTHING: if (!catchTargets.get(getPC()) && lookForStore(seen) && (stack.getStackDepth() >= 1)) { ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "int", "lhsReg", "=", "-", "1", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "state", ")", "{", "case", "SEEN_NOTHING", ":", "if",...
implements the visitor to look for store of registers immediately before returns of that register @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "store", "of", "registers", "immediately", "before", "returns", "of", "that", "register" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java#L176-L227
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
UnnecessaryStoreBeforeReturn.lookForStore
private boolean lookForStore(int seen) { if (!OpcodeUtils.isStore(seen)) { return false; } storeReg = RegisterUtils.getStoreReg(this, seen); return true; }
java
private boolean lookForStore(int seen) { if (!OpcodeUtils.isStore(seen)) { return false; } storeReg = RegisterUtils.getStoreReg(this, seen); return true; }
[ "private", "boolean", "lookForStore", "(", "int", "seen", ")", "{", "if", "(", "!", "OpcodeUtils", ".", "isStore", "(", "seen", ")", ")", "{", "return", "false", ";", "}", "storeReg", "=", "RegisterUtils", ".", "getStoreReg", "(", "this", ",", "seen", ...
checks if the current opcode is a store, if so saves the register @param seen the opcode of the currently parsed instruction @return if a store was seen
[ "checks", "if", "the", "current", "opcode", "is", "a", "store", "if", "so", "saves", "the", "register" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java#L236-L243
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
UnnecessaryStoreBeforeReturn.lookForLoad
private boolean lookForLoad(int seen) { int loadReg; if (!OpcodeUtils.isLoad(seen)) { return false; } loadReg = RegisterUtils.getLoadReg(this, seen); return (storeReg == loadReg); }
java
private boolean lookForLoad(int seen) { int loadReg; if (!OpcodeUtils.isLoad(seen)) { return false; } loadReg = RegisterUtils.getLoadReg(this, seen); return (storeReg == loadReg); }
[ "private", "boolean", "lookForLoad", "(", "int", "seen", ")", "{", "int", "loadReg", ";", "if", "(", "!", "OpcodeUtils", ".", "isLoad", "(", "seen", ")", ")", "{", "return", "false", ";", "}", "loadReg", "=", "RegisterUtils", ".", "getLoadReg", "(", "t...
looks for a load of the register that was just stored @param seen the opcode of the currently parsed instruction @return if the load was seen
[ "looks", "for", "a", "load", "of", "the", "register", "that", "was", "just", "stored" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java#L252-L261
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java
CollectMethodsReturningImmutableCollections.visitCode
@Override public void visitCode(Code obj) { try { String signature = SignatureUtils.getReturnSignature(getMethod().getSignature()); if (signature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX) && CollectionUtils.isListSetMap(SignatureUtils.stripSignature(signature))) { ...
java
@Override public void visitCode(Code obj) { try { String signature = SignatureUtils.getReturnSignature(getMethod().getSignature()); if (signature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX) && CollectionUtils.isListSetMap(SignatureUtils.stripSignature(signature))) { ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "String", "signature", "=", "SignatureUtils", ".", "getReturnSignature", "(", "getMethod", "(", ")", ".", "getSignature", "(", ")", ")", ";", "if", "(", "signature", ...
overrides the visitor to reset the stack for the new method, then checks if the immutability field is set to immutable and if so reports it @param obj the context object of the currently parsed method
[ "overrides", "the", "visitor", "to", "reset", "the", "stack", "for", "the", "new", "method", "then", "checks", "if", "the", "immutability", "field", "is", "set", "to", "immutable", "and", "if", "so", "reports", "it" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java#L93-L111
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java
CollectMethodsReturningImmutableCollections.sawOpcode
@Override public void sawOpcode(int seen) { ImmutabilityType seenImmutable = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKESTATIC: { String className = getClassConstantOperand(); String method...
java
@Override public void sawOpcode(int seen) { ImmutabilityType seenImmutable = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKESTATIC: { String className = getClassConstantOperand(); String method...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "ImmutabilityType", "seenImmutable", "=", "null", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".",...
overrides the visitor to look for calls to static methods that are known to return immutable collections It records those variables, and documents if what the method returns is one of those objects.
[ "overrides", "the", "visitor", "to", "look", "for", "calls", "to", "static", "methods", "that", "are", "known", "to", "return", "immutable", "collections", "It", "records", "those", "variables", "and", "documents", "if", "what", "the", "method", "returns", "is...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java#L117-L164
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
SuspiciousJDKVersionUse.isJavaXExternal
private boolean isJavaXExternal(String className) { if (!className.startsWith("javax/")) { return false; } if (className.startsWith("javax/xml/")) { return true; } int lastSlashPos = className.lastIndexOf('/'); String packageName = className.subs...
java
private boolean isJavaXExternal(String className) { if (!className.startsWith("javax/")) { return false; } if (className.startsWith("javax/xml/")) { return true; } int lastSlashPos = className.lastIndexOf('/'); String packageName = className.subs...
[ "private", "boolean", "isJavaXExternal", "(", "String", "className", ")", "{", "if", "(", "!", "className", ".", "startsWith", "(", "\"javax/\"", ")", ")", "{", "return", "false", ";", "}", "if", "(", "className", ".", "startsWith", "(", "\"javax/xml/\"", ...
checks to see if this class is a javax.xxxx.Foo class if so, looks to see if the package is at least in the jdk if a whole new package comes into javax in rt.jar, this will be missed. Need a better solution here. @param className the slashed class in question @return whether it is in the default jdk rt.jar
[ "checks", "to", "see", "if", "this", "class", "is", "a", "javax", ".", "xxxx", ".", "Foo", "class", "if", "so", "looks", "to", "see", "if", "the", "package", "is", "at", "least", "in", "the", "jdk", "if", "a", "whole", "new", "package", "comes", "i...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java#L278-L301
train