aserg-ufmg / RefDiff

A tool to mine refactorings in the commit history of git repositories.
MIT License
146 stars 44 forks source link

Missing Pull Up Method refactoring #14

Closed osmarleandro closed 3 years ago

osmarleandro commented 3 years ago

Summary

In the source code of osmarleandro/google-maps-services-java@d07ed8e commit, I identify a Pull Up Method refactoring applied to shouldRetry(Response) method in OkHttpPendingResult class. RefDiff yields a single Move Method refactoring as result. Is it possible to infer that the Move Method to SuperType is a Pull Up Method refactoring? If yes, why this refactoring instance was not detected?

Code example

Diff fragment between the commit osmarleandro/google-maps-services-java@d07ed8e and their parent.

@@ -327,12 +327,6 @@ public class OkHttpPendingResult<T, R extends ApiResponse<T>> implements PendingResult<T>, Callback {
     return this.await();
   }

-  private boolean shouldRetry(Response response) {
-    return RETRY_ERROR_CODES.contains(response.code())
-        && cumulativeSleepTime < errorTimeOut
-        && (maxRetries == null || retryCounter < maxRetries);
-  }

@@ -77,5 +81,11 @@ public interface PendingResult<T> {
     void onFailure(Throwable e);
+
+       public default boolean shouldRetry(OkHttpPendingResult okHttpPendingResult, Response response) {
+           return OkHttpPendingResult.RETRY_ERROR_CODES.contains(response.code())
+               && okHttpPendingResult.cumulativeSleepTime < okHttpPendingResult.errorTimeOut
+               && (okHttpPendingResult.maxRetries == null || okHttpPendingResult.retryCounter < okHttpPendingResult.maxRetries);
+         }

Environment details

RefDiff 2.0

Steps to reproduce

  1. Run RefDiff and pass as input the commit osmarleandro/google-maps-services-java@d07ed8e.

Actual results

MOVE    {Method shouldRetry(Response) at src/main/java/com/google/maps/internal/OkHttpPendingResult.java:330}   {Method shouldRetry(OkHttpPendingResult, Response) at src/main/java/com/google/maps/PendingResult.java:85})

Expected results

An instance of the Pull Up refactoring applied to shouldRetry(Response) method in OkHttpPendingResult class.

osmarleandro commented 3 years ago

Same issue #21.