Skip to content

Is it missing the Push Down Method refactoring? #16

@osmarleandro

Description

@osmarleandro

Summary

In the source code of osmarleandro/spring-boot@2787fad commit, I applied a single Push Down Method refactoring to customize() method in ManagementWebServerFactoryCustomizer class.

RefDiff detects a single Move Method refactoring, where the customize() method was moved to ServletManagementChildContextConfiguration class.

But, the ServletManagementChildContextConfiguration class has a nested class called ServletManagementWebServerFactoryCustomizer, which extends the ManagementWebServerFactoryCustomizer and receive the customize() method from the Push Down Method operation.

Code example

Diff fragment between the commit osmarleandro/spring-boot@2787fad and their parent.

@@ -61,22 +60,7 @@ public abstract class ManagementWebServerFactoryCustomizer<T extends Configurabl
-       @Override
-       public final void customize(T factory) {
-               ManagementServerProperties managementServerProperties = BeanFactoryUtils
-                               .beanOfTypeIncludingAncestors(this.beanFactory, ManagementServerProperties.class);
-               // Customize as per the parent context first (so e.g. the access logs go to
-               // the same place)
-               customizeSameAsParentContext(factory);
-               // Then reset the error pages
-               factory.setErrorPages(Collections.emptySet());
-               // and add the management-specific bits
-               ServerProperties serverProperties = BeanFactoryUtils.beanOfTypeIncludingAncestors(this.beanFactory,
-                               ServerProperties.class);
-               customize(factory, managementServerProperties, serverProperties);
-       }

@@ -126,6 +128,21 @@ class ServletManagementChildContextConfiguration {
                static class ServletManagementWebServerFactoryCustomizer
			extends ManagementWebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {
                [...] 
+               @Override
+               public final void customize(ConfigurableServletWebServerFactory factory) {
+                       ManagementServerProperties managementServerProperties = BeanFactoryUtils
+                                       .beanOfTypeIncludingAncestors(this.beanFactory, ManagementServerProperties.class);
+                       // Customize as per the parent context first (so e.g. the access logs go to
+                       // the same place)
+                       customizeSameAsParentContext(factory);
+                       // Then reset the error pages
+                       factory.setErrorPages(Collections.emptySet());
+                       // and add the management-specific bits
+                       ServerProperties serverProperties = BeanFactoryUtils.beanOfTypeIncludingAncestors(this.beanFactory,
+                                       ServerProperties.class);
+                       customize(factory, managementServerProperties, serverProperties);
+               }
+
        }

Environment details

RefDiff 2.0

Steps to reproduce

  1. Run RefDiff and pass as input the commit osmarleandro/spring-boot@2787fad.

Actual results

MOVE	{Method customize(T) at spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementWebServerFactoryCustomizer.java:64}	{Method customize(ConfigurableServletWebServerFactory) at spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ServletManagementChildContextConfiguration.java:131})

Expected results

A single instance of the Push Down Method refactoring applied to customize() method in ManagementWebServerFactoryCustomizer class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions