@@ -176,29 +176,29 @@ public static Set<Entrypoint> findBenchmarkEntryPoints(IClassHierarchy classHier
176
176
TypeName annotationName = annotation .getType ().getName ();
177
177
178
178
if (isBenchmark (annotationName ) || isSetup (annotationName )) {
179
- result . add ( new DefaultEntrypoint ( method , classHierarchy ) );
179
+ addEntryPoint ( result , method , classHierarchy );
180
180
isBenchmarkClass = true ;
181
181
break ;
182
182
}
183
183
}
184
184
}
185
- if (isBenchmarkClass ) {
186
- IMethod classInitializer = klass .getClassInitializer ();
187
-
188
- if (classInitializer != null )
189
- result .add (new DefaultEntrypoint (classInitializer , classHierarchy ));
190
-
191
- IMethod ctor = klass .getMethod (MethodReference .initSelector );
192
-
193
- if (ctor != null )
194
- result .add (new DefaultEntrypoint (ctor , classHierarchy ));
195
185
186
+ if (isBenchmarkClass ) {
187
+ addEntryPoint (result , klass .getClassInitializer (), classHierarchy );
188
+ addEntryPoint (result , klass .getMethod (MethodReference .initSelector ), classHierarchy );
196
189
}
197
190
}
198
191
199
192
return result ;
200
193
}
201
194
195
+ private static void addEntryPoint (Set <Entrypoint > result , final IMethod method , IClassHierarchy classHierarchy ) {
196
+ if (method != null ) {
197
+ Entrypoint entrypoint = new DefaultEntrypoint (method , classHierarchy );
198
+ result .add (entrypoint );
199
+ }
200
+ }
201
+
202
202
private static MethodInvocation findCorrespondingMethodInvocation (CompilationUnit unit ,
203
203
SourcePosition sourcePosition , MethodReference method ) {
204
204
CorrespondingASTVisitor visitor = new CorrespondingASTVisitor (unit , sourcePosition , method );
@@ -225,7 +225,7 @@ public static Set<Entrypoint> findEntryPoints(IClassHierarchy classHierarchy) {
225
225
try {
226
226
for (Annotation annotation : ((ShrikeCTMethod ) method ).getAnnotations (true ))
227
227
if (isEntryPointClass (annotation .getType ().getName ())) {
228
- result . add ( new DefaultEntrypoint ( method , classHierarchy ) );
228
+ addEntryPoint ( result , method , classHierarchy );
229
229
break ;
230
230
}
231
231
} catch (InvalidClassFileException e ) {
0 commit comments