Java Code Examples for org.apache.bcel.classfile.JavaClass#accept()

The following examples show how to use org.apache.bcel.classfile.JavaClass#accept() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InvalidJUnitTest.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void visitClassContext(ClassContext classContext) {
    if (!enabled()) {
        return;
    }

    JavaClass jClass = classContext.getJavaClass();
    XClass xClass = classContext.getXClass();

    try {

        if (!isJunit3TestCase(xClass)) {
            return;
        }
        if ((jClass.getAccessFlags() & Const.ACC_ABSTRACT) == 0) {
            if (!hasTestMethods(jClass)) {
                bugReporter.reportBug(new BugInstance(this, "IJU_NO_TESTS", LOW_PRIORITY).addClass(jClass));
            }
        }
        directChildOfTestCase = "junit.framework.TestCase".equals(jClass.getSuperclassName());
        jClass.accept(this);
    } catch (ClassNotFoundException cnfe) {
        bugReporter.reportMissingClass(cnfe);
    }

}
 
Example 2
Source File: NoteNonNullAnnotations.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void visitClassContext(ClassContext classContext) {

    JavaClass javaClass = classContext.getJavaClass();
    if (!BCELUtil.preTiger(javaClass)) {
        javaClass.accept(this);
    }
}
 
Example 3
Source File: NoteAnnotationRetention.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void visitClassContext(ClassContext classContext) {
    JavaClass javaClass = classContext.getJavaClass();
    if (!BCELUtil.preTiger(javaClass)) {
        javaClass.accept(this);
    }

}
 
Example 4
Source File: NoteCheckReturnValueAnnotations.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void visitClassContext(ClassContext classContext) {

    JavaClass javaClass = classContext.getJavaClass();
    if (!BCELUtil.preTiger(javaClass)) {
        javaClass.accept(this);
    }
}
 
Example 5
Source File: NoteDirectlyRelevantTypeQualifiers.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void visitClassContext(ClassContext classContext) {
    if (qualifiers == null) {
        qualifiers = AnalysisContext.currentAnalysisContext().getDirectlyRelevantTypeQualifiersDatabase();
    }

    JavaClass javaClass = classContext.getJavaClass();
    if (!BCELUtil.preTiger(javaClass)) {
        javaClass.accept(this);
    }
}
 
Example 6
Source File: NoteJCIPAnnotation.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void visitClassContext(ClassContext classContext) {
    JavaClass javaClass = classContext.getJavaClass();
    if (!BCELUtil.preTiger(javaClass)) {
        javaClass.accept(this);
    }

}
 
Example 7
Source File: BadAppletConstructor.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void visitClassContext(ClassContext classContext) {
    if (appletClass == null) {
        return;
    }

    JavaClass cls = classContext.getJavaClass();
    try {
        if (cls.instanceOf(appletClass)) {
            cls.accept(this);
        }
    } catch (ClassNotFoundException cnfe) {
        bugReporter.reportMissingClass(cnfe);
    }
}
 
Example 8
Source File: VisitorSet.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitJavaClass(JavaClass aJavaClass)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aJavaClass.accept(v);
    }
}
 
Example 9
Source File: JavaClassWalker.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Traverses a JavaClass parse tree and accepts all registered
 * visitors.
 * @param aJavaClass the root of the tree.
 */
public void walk(JavaClass aJavaClass)
{
    DescendingVisitor visitor =
        new DescendingVisitor(aJavaClass, mVisitor);
    aJavaClass.accept(visitor);
}
 
Example 10
Source File: VisitorSet.java    From contribution with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitJavaClass(JavaClass aJavaClass)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aJavaClass.accept(v);
    }
}
 
Example 11
Source File: JavaClassWalker.java    From contribution with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Traverses a JavaClass parse tree and accepts all registered
 * visitors.
 * @param aJavaClass the root of the tree.
 */
public void walk(JavaClass aJavaClass)
{
    DescendingVisitor visitor =
        new DescendingVisitor(aJavaClass, mVisitor);
    aJavaClass.accept(visitor);
}