@@ -117,6 +117,13 @@ public boolean visit(MethodInvocation node) {
117
117
118
118
private static final String SETUP = "org.openjdk.jmh.annotations.Setup" ;
119
119
120
+ private static void addEntryPoint (Set <Entrypoint > result , final IMethod method , IClassHierarchy classHierarchy ) {
121
+ if (method != null ) {
122
+ Entrypoint entrypoint = new DefaultEntrypoint (method , classHierarchy );
123
+ result .add (entrypoint );
124
+ }
125
+ }
126
+
120
127
public static boolean allEqual (Collection <?> collection ) {
121
128
if (collection .isEmpty ())
122
129
return true ;
@@ -196,13 +203,6 @@ public static Set<Entrypoint> findBenchmarkEntryPoints(IClassHierarchy classHier
196
203
return result ;
197
204
}
198
205
199
- private static void addEntryPoint (Set <Entrypoint > result , final IMethod method , IClassHierarchy classHierarchy ) {
200
- if (method != null ) {
201
- Entrypoint entrypoint = new DefaultEntrypoint (method , classHierarchy );
202
- result .add (entrypoint );
203
- }
204
- }
205
-
206
206
private static MethodInvocation findCorrespondingMethodInvocation (CompilationUnit unit ,
207
207
SourcePosition sourcePosition , MethodReference method ) {
208
208
CorrespondingASTVisitor visitor = new CorrespondingASTVisitor (unit , sourcePosition , method );
@@ -261,32 +261,6 @@ public static Set<Entrypoint> findEntryPoints(IClassHierarchy classHierarchy) {
261
261
return result ;
262
262
}
263
263
264
- /**
265
- * A null get value means that there is no unique ctor.
266
- *
267
- * @param klass
268
- * The {@link IClass} to find a unique ctor.
269
- * @return The one and only ctor for klass and <code>null</code> if it doesn't
270
- * exist.
271
- */
272
- private static IMethod getUniqueConstructor (IClass klass ) {
273
- // try to find the default ctor.
274
- IMethod ctor = klass .getMethod (MethodReference .initSelector );
275
-
276
- // if not found, get all constructors.
277
- if (ctor == null ) {
278
- Set <IMethod > allDeclaredConstructors = klass .getDeclaredMethods ().stream ()
279
- .filter (m -> m .getName ().startsWith (MethodReference .initAtom )).collect (Collectors .toSet ());
280
-
281
- // if there is a unique one.
282
- if (allDeclaredConstructors .size () == 1 )
283
- // use that.
284
- ctor = allDeclaredConstructors .iterator ().next ();
285
- }
286
-
287
- return ctor ;
288
- }
289
-
290
264
static Set <ITypeBinding > getAllInterfaces (ITypeBinding type ) {
291
265
Set <ITypeBinding > ret = new HashSet <>();
292
266
ITypeBinding [] interfaces = type .getInterfaces ();
@@ -495,6 +469,32 @@ public static Collection<TypeAbstraction> getPossibleTypesInterprocedurally(CGNo
495
469
return ret ;
496
470
}
497
471
472
+ /**
473
+ * A null get value means that there is no unique ctor.
474
+ *
475
+ * @param klass
476
+ * The {@link IClass} to find a unique ctor.
477
+ * @return The one and only ctor for klass and <code>null</code> if it doesn't
478
+ * exist.
479
+ */
480
+ private static IMethod getUniqueConstructor (IClass klass ) {
481
+ // try to find the default ctor.
482
+ IMethod ctor = klass .getMethod (MethodReference .initSelector );
483
+
484
+ // if not found, get all constructors.
485
+ if (ctor == null ) {
486
+ Set <IMethod > allDeclaredConstructors = klass .getDeclaredMethods ().stream ()
487
+ .filter (m -> m .getName ().startsWith (MethodReference .initAtom )).collect (Collectors .toSet ());
488
+
489
+ // if there is a unique one.
490
+ if (allDeclaredConstructors .size () == 1 )
491
+ // use that.
492
+ ctor = allDeclaredConstructors .iterator ().next ();
493
+ }
494
+
495
+ return ctor ;
496
+ }
497
+
498
498
static boolean implementsBaseStream (ITypeBinding type ) {
499
499
Set <ITypeBinding > implementedInterfaces = getImplementedInterfaces (type );
500
500
return implementedInterfaces .stream ()
0 commit comments