我正在做一个Maven项目。情况如下所示...
class Test {
public void applyAll() {
....................
....................
Collection<Migratable> applicableUpdates = SomeOtherClass.getApplicableUpdates();
doUpdate(applicableUpdates);
}
@Benchmark
public void apply(Migratable m) {
....................
....................
}
private void doUpdate(Collection<Migratable> applicableUpdates) throws Exception {
for (Migratable m : applicableUpdates) {
try {
apply(m);
} catch (Exception e) {
logger.error("Falid to apply migration {}" + m, e);
throw e;
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我需要计算执行每次迁移需要多长时间。我只需要计算apply(Migratable m)方法的执行时间。
现在,当我使用“ mvn clean install”构建项目时,构建失败,并且显示“方法参数应为@State类”。
在这里,参数来自另一个方法doUpdate(Collection applyUpdates) [请参见场景]。那么如何在给定的情况下摆脱这个错误呢?