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 @@ -669,4 +669,23 @@ private static boolean wouldOrderingBeConsistent(final Collection<TypeAbstractio
669
669
670
670
private Util () {
671
671
}
672
+
673
+ /**
674
+ * If it's a ctor, return the declaring class, otherwise, return the return
675
+ * type.
676
+ *
677
+ * @param method
678
+ * The {@link IMethod} in question.
679
+ * @return The declaring class of target if target is a ctor and the return type
680
+ * otherwise.
681
+ */
682
+ public static TypeReference getEvaluationType (IMethod method ) {
683
+ // if it's a ctor.
684
+ if (method .isInit ())
685
+ // then, use the declaring type.
686
+ return method .getDeclaringClass ().getReference ();
687
+ else // otherwise.
688
+ // use the return type.
689
+ return method .getReturnType ();
690
+ }
672
691
}
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