use of org.apache.bcel.classfile.LocalVariable in project fb-contrib by mebigfatguy.
the class ImmatureClass method isIDEGeneratedMethodWithCode.
private boolean isIDEGeneratedMethodWithCode(Method m) {
if (!m.isPublic()) {
return false;
}
String name = m.getName();
if (Values.CONSTRUCTOR.equals(name) || Values.STATIC_INITIALIZER.equals(name)) {
return false;
}
LocalVariableTable lvt = m.getLocalVariableTable();
if (lvt == null) {
return false;
}
if (m.getCode().getCode().length <= MAX_EMPTY_METHOD_SIZE) {
return false;
}
int numArgs = m.getArgumentTypes().length;
if (numArgs == 0) {
return false;
}
int offset = m.isStatic() ? 0 : 1;
for (int i = 0; i < numArgs; i++) {
LocalVariable lv = lvt.getLocalVariable(offset + i, 0);
if ((lv == null) || (lv.getName() == null)) {
return false;
}
Matcher ma = ARG_PATTERN.matcher(lv.getName());
if (!ma.matches()) {
return false;
}
}
return true;
}
Aggregations