Java Code Examples for org.apache.bcel.Repository#clearCache()

The following examples show how to use org.apache.bcel.Repository#clearCache() . 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: ParserTest.java    From JQF with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Fuzz
public void verifyJavaClass(@From(JavaClassGenerator.class) JavaClass javaClass) throws IOException {
    try {
        Repository.addClass(javaClass);
        Verifier verifier = StatelessVerifierFactory.getVerifier(javaClass.getClassName());
        VerificationResult result;
        result = verifier.doPass1();
        assumeThat(result.getMessage(), result.getStatus(), is(VerificationResult.VERIFIED_OK));
        result = verifier.doPass2();
        assumeThat(result.getMessage(), result.getStatus(), is(VerificationResult.VERIFIED_OK));
        for (int i = 0; i < javaClass.getMethods().length; i++) {
            result = verifier.doPass3a(i);
            assumeThat(result.getMessage(), result.getStatus(), is(VerificationResult.VERIFIED_OK));
        }
    } finally {
        Repository.clearCache();
    }
}
 
Example 2
Source File: ClassFileSetCheck.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/** @see com.puppycrawl.tools.checkstyle.bcel.IObjectSetVisitor */
public void visitSet(Set aSet)
{
    // register the JavaClasses in the Repository
    Repository.clearCache();
    Iterator it = aSet.iterator();
    while (it.hasNext()) {
        final JavaClass javaClass = (JavaClass) it.next();
        Repository.addClass(javaClass);
    }

    // visit the visitors
    it = getObjectSetVisitors().iterator();
    while (it.hasNext()) {
        final IObjectSetVisitor visitor = (IObjectSetVisitor) it.next();
        visitor.visitSet(aSet);
    }
}
 
Example 3
Source File: ClassFileSetCheck.java    From contribution with GNU Lesser General Public License v2.1 6 votes vote down vote up
/** @see com.puppycrawl.tools.checkstyle.bcel.IObjectSetVisitor */
public void visitSet(Set aSet)
{
    // register the JavaClasses in the Repository
    Repository.clearCache();
    Iterator it = aSet.iterator();
    while (it.hasNext()) {
        final JavaClass javaClass = (JavaClass) it.next();
        Repository.addClass(javaClass);
    }

    // visit the visitors
    it = getObjectSetVisitors().iterator();
    while (it.hasNext()) {
        final IObjectSetVisitor visitor = (IObjectSetVisitor) it.next();
        visitor.visitSet(aSet);
    }
}