@Override public Instrumentation createInstrumentation(Method benchmarkMethod) throws InvalidBenchmarkException { if (benchmarkMethod.getParameterTypes().length != 0) { throw new InvalidBenchmarkException( "Arbitrary measurement methods should take no parameters: " + benchmarkMethod.getName()); } if (benchmarkMethod.getReturnType() != double.class) { throw new InvalidBenchmarkException( "Arbitrary measurement methods must have a return type of double: " + benchmarkMethod.getName()); } // Static technically doesn't hurt anything, but it's just the completely wrong idea if (Util.isStatic(benchmarkMethod)) { throw new InvalidBenchmarkException( "Arbitrary measurement methods must not be static: " + benchmarkMethod.getName()); } if (!Util.isPublic(benchmarkMethod)) { throw new InvalidBenchmarkException( "Arbitrary measurement methods must be public: " + benchmarkMethod.getName()); } return new ArbitraryMeasurementInstrumentation(benchmarkMethod); }
@Override public Instrumentation createInstrumentation(Method benchmarkMethod) throws InvalidBenchmarkException { if (benchmarkMethod.getParameterTypes().length != 0) { throw new InvalidBenchmarkException( "Arbitrary measurement methods should take no parameters: " + benchmarkMethod.getName()); } if (benchmarkMethod.getReturnType() != double.class) { throw new InvalidBenchmarkException( "Arbitrary measurement methods must have a return type of double: " + benchmarkMethod.getName()); } // Static technically doesn't hurt anything, but it's just the completely wrong idea if (Util.isStatic(benchmarkMethod)) { throw new InvalidBenchmarkException( "Arbitrary measurement methods must not be static: " + benchmarkMethod.getName()); } if (!Util.isPublic(benchmarkMethod)) { throw new InvalidBenchmarkException( "Arbitrary measurement methods must be public: " + benchmarkMethod.getName()); } return new ArbitraryMeasurementInstrumentation(benchmarkMethod); }