Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Pull Up Method refactoring #14

Closed
osmarleandro opened this issue Jan 17, 2021 · 1 comment
Closed

Missing Pull Up Method refactoring #14

osmarleandro opened this issue Jan 17, 2021 · 1 comment

Comments

@osmarleandro
Copy link

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 osmarleandro changed the title Is the Pull Up Method a missing refactoring? Missing Pull Up Method refactoring Jan 27, 2021
@osmarleandro
Copy link
Author

Same issue #21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant