StateObjectHandler.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:jmh 作者:
private void checkHelpers(MethodInfo mi, Class<? extends Annotation> annClass) {
    // OK to have these annotation for @State objects
    if (BenchmarkGeneratorUtils.getAnnSuper(mi.getDeclaringClass(), State.class) == null) {
        if (!mi.getDeclaringClass().isAbstract()) {
            throw new GenerationException(
                    "@" + TearDown.class.getSimpleName() + " annotation is placed within " +
                            "the class not having @" + State.class.getSimpleName() + " annotation. " +
                            "This has no behavioral effect, and prohibited.",
                    mi);
        }
    }

    if (!mi.isPublic()) {
        throw new GenerationException(
                "@" + annClass.getSimpleName() + " method should be public.",
                mi);
    }

    if (!mi.getReturnType().equalsIgnoreCase("void")) {
        throw new GenerationException(
                "@" + annClass.getSimpleName() + " method should not return anything.",
                mi);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号