Java Code Examples for javassist.bytecode.MethodInfo#isMethod()

The following examples show how to use javassist.bytecode.MethodInfo#isMethod() . 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: JClass.java    From jadira with Apache License 2.0 5 votes vote down vote up
public List<JMethod> getMethods() {

        final List<JMethod> retVal = new ArrayList<JMethod>();
        @SuppressWarnings("unchecked")
        final List<MethodInfo> methods = (List<MethodInfo>) getClassFile().getMethods();

        for (MethodInfo next : methods) {
            if (next.isMethod()) {
                retVal.add(JMethod.getJMethod(next, this, getResolver()));
            }
        }
        return retVal;
    }
 
Example 2
Source File: JInterface.java    From jadira with Apache License 2.0 5 votes vote down vote up
public List<JMethod> getMethods() {

        final List<JMethod> retVal = new ArrayList<JMethod>();
        @SuppressWarnings("unchecked")
        final List<MethodInfo> methods = (List<MethodInfo>) getClassFile().getMethods();

        for (MethodInfo next : methods) {
            if (next.isMethod()) {
                retVal.add(JMethod.getJMethod(next, this, getResolver()));
            }
        }
        return retVal;
    }
 
Example 3
Source File: MainClassAnalyzer.java    From deadcode4j with Apache License 2.0 5 votes vote down vote up
@Override
protected void analyzeClass(@Nonnull AnalysisContext analysisContext, @Nonnull CtClass clazz) {
    String clazzName = clazz.getName();
    analysisContext.addAnalyzedClass(clazzName);

    for (MethodInfo methodInfo : filter(clazz.getClassFile2().getMethods(), MethodInfo.class)) {
        if (methodInfo.isMethod()
                && isPublicStatic(methodInfo)
                && "main".equals(methodInfo.getName())
                && matchesSignature(methodInfo)) {
            analysisContext.addDependencies("_Main-Class_", clazz.getName());
        }
    }
}