Skip to content

Commit 615c1c4

Browse files
committed
Clean up.
1 parent ce19fa3 commit 615c1c4

File tree

1 file changed

+33
-33
lines changed
  • edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis

1 file changed

+33
-33
lines changed

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis/Util.java

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ public boolean visit(MethodInvocation node) {
117117

118118
private static final String SETUP = "org.openjdk.jmh.annotations.Setup";
119119

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+
120127
public static boolean allEqual(Collection<?> collection) {
121128
if (collection.isEmpty())
122129
return true;
@@ -196,13 +203,6 @@ public static Set<Entrypoint> findBenchmarkEntryPoints(IClassHierarchy classHier
196203
return result;
197204
}
198205

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-
206206
private static MethodInvocation findCorrespondingMethodInvocation(CompilationUnit unit,
207207
SourcePosition sourcePosition, MethodReference method) {
208208
CorrespondingASTVisitor visitor = new CorrespondingASTVisitor(unit, sourcePosition, method);
@@ -261,32 +261,6 @@ public static Set<Entrypoint> findEntryPoints(IClassHierarchy classHierarchy) {
261261
return result;
262262
}
263263

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-
290264
static Set<ITypeBinding> getAllInterfaces(ITypeBinding type) {
291265
Set<ITypeBinding> ret = new HashSet<>();
292266
ITypeBinding[] interfaces = type.getInterfaces();
@@ -495,6 +469,32 @@ public static Collection<TypeAbstraction> getPossibleTypesInterprocedurally(CGNo
495469
return ret;
496470
}
497471

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+
498498
static boolean implementsBaseStream(ITypeBinding type) {
499499
Set<ITypeBinding> implementedInterfaces = getImplementedInterfaces(type);
500500
return implementedInterfaces.stream()

0 commit comments

Comments
 (0)