use of org.apache.bcel.classfile.JavaClass in project fb-contrib by mebigfatguy.
the class SuspiciousWaitOnConcurrentObject method visitClassContext.
/**
* implements the visitor to check for class file version 1.5 or better
*
* @param classContext
* the context object of the currently parsed class
*/
@Override
public void visitClassContext(ClassContext classContext) {
try {
JavaClass cls = classContext.getJavaClass();
int major = cls.getMajor();
if (major >= Const.MAJOR_1_5) {
stack = new OpcodeStack();
super.visitClassContext(classContext);
}
} finally {
stack = null;
}
}
use of org.apache.bcel.classfile.JavaClass in project fb-contrib by mebigfatguy.
the class UnboundMethodTemplateParameter method visitClassContext.
/**
* implements the visitor to accept the class for visiting
*
* @param classContext
* the context object of the currently parsed class
*/
@Override
public void visitClassContext(ClassContext classContext) {
JavaClass cls = classContext.getJavaClass();
cls.accept(this);
}
use of org.apache.bcel.classfile.JavaClass in project fb-contrib by mebigfatguy.
the class UnitTestAssertionOddities method visitClassContext.
/**
* override the visitor to see if this class could be a test class
*
* @param classContext
* the context object of the currently parsed class
*/
@Override
public void visitClassContext(ClassContext classContext) {
try {
JavaClass cls = classContext.getJavaClass();
className = cls.getClassName().replace('.', '/');
isTestCaseDerived = (testCaseClass != null) && cls.instanceOf(testCaseClass);
isAnnotationCapable = (cls.getMajor() >= 5) && ((testAnnotationClass != null) || (testNGAnnotationClass != null));
if (isTestCaseDerived || isAnnotationCapable) {
stack = new OpcodeStack();
fieldsWithAnnotations = new HashSet<>();
super.visitClassContext(classContext);
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
} finally {
stack = null;
fieldsWithAnnotations = null;
}
}
use of org.apache.bcel.classfile.JavaClass in project fb-contrib by mebigfatguy.
the class Unjitable method visitClassContext.
/**
* implements the visitor to accept the class for visiting
*
* @param classContext
* the context object of the currently parsed class
*/
@Override
public void visitClassContext(ClassContext classContext) {
JavaClass cls = classContext.getJavaClass();
cls.accept(this);
}
use of org.apache.bcel.classfile.JavaClass in project fb-contrib by mebigfatguy.
the class UseVarArgs method isInherited.
/**
* looks to see if this method is derived from a super class. If it is we don't want to report on it, as that would entail changing a whole hierarchy
*
* @param m
* the current method
* @return if the method is inherited
*
* @throws ClassNotFoundException
* if the super class(s) aren't found
*/
private boolean isInherited(Method m) throws ClassNotFoundException {
JavaClass[] infs = javaClass.getAllInterfaces();
for (JavaClass inf : infs) {
if (hasMethod(inf, m)) {
return true;
}
}
JavaClass[] sups = javaClass.getSuperClasses();
for (JavaClass sup : sups) {
if (hasMethod(sup, m)) {
return true;
}
}
return false;
}
Aggregations