File tree Expand file tree Collapse file tree 2 files changed +20
-10
lines changed
edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -687,4 +687,23 @@ private static boolean wouldOrderingBeConsistent(final Collection<TypeAbstractio
687
687
688
688
private Util () {
689
689
}
690
+
691
+ /**
692
+ * If it's a ctor, return the declaring class, otherwise, return the return
693
+ * type.
694
+ *
695
+ * @param method
696
+ * The {@link IMethod} in question.
697
+ * @return The declaring class of target if target is a ctor and the return type
698
+ * otherwise.
699
+ */
700
+ public static TypeReference getEvaluationType (IMethod method ) {
701
+ // if it's a ctor.
702
+ if (method .isInit ())
703
+ // then, use the declaring type.
704
+ return method .getDeclaringClass ().getReference ();
705
+ else // otherwise.
706
+ // use the return type.
707
+ return method .getReturnType ();
708
+ }
690
709
}
Original file line number Diff line number Diff line change @@ -127,16 +127,7 @@ protected Map<CallStringTriple, CallStringWithReceivers> getCallStringWithReceiv
127
127
*/
128
128
@ Override
129
129
protected int getLength (CGNode caller , CallSiteReference site , IMethod target ) {
130
- TypeReference typeToCheck ;
131
-
132
- // if it's a ctor.
133
- if (target .isInit ())
134
- // then, use the declaring type.
135
- typeToCheck = target .getDeclaringClass ().getReference ();
136
- else // otherwise.
137
- // use the return type.
138
- typeToCheck = target .getReturnType ();
139
-
130
+ TypeReference typeToCheck = Util .getEvaluationType (target );
140
131
boolean implementsBaseStream = Util .implementsBaseStream (typeToCheck , target .getClassHierarchy ());
141
132
142
133
if (implementsBaseStream )
You can’t perform that action at this time.
0 commit comments