aserg-ufmg / RefDiff

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

Multiples Push Down Method instances #24

Open osmarleandro opened 3 years ago

osmarleandro commented 3 years ago

Summary

In the source code present in osmarleandro/incubator-gobblin@8353b60 commit, I applied a single Push Down Method to convertRecord() method in AvroToJsonStringConverterBase class, and RefDiff yields multiple instances.

Can these multiples instances be a single instance, since the same method can not be pushed down more than one time in the same revision?

Code example

Diff fragment between the commit osmarleandro/incubator-gobblin@8353b60 and their parent.

@@ -81,16 +79,5 @@ public abstract class AvroToJsonStringConverterBase<T> extends Converter<Schema,
     return this.schema.toString();
   }

-  @Override
-  public Iterable<T> convertRecord(String outputSchema, GenericRecord inputRecord, WorkUnitState workUnit)
-      throws DataConversionException {
-    try {
-      byte[] utf8Bytes = this.serializer.get().serialize(inputRecord);
-      return Collections.singleton(processUtf8Bytes(utf8Bytes));
-    } catch (IOException ioe) {
-      throw new DataConversionException(ioe);
-    }
-  }
-

@@ -24,4 +30,14 @@ public class AvroToJsonStringConverter extends AvroToJsonStringConverterBase<Str
   protected String processUtf8Bytes(byte[] utf8Bytes) {
     return new String(utf8Bytes, StandardCharsets.UTF_8);
   }
+
+@Override
+public Iterable<String> convertRecord(String outputSchema, GenericRecord inputRecord, WorkUnitState workUnit) throws DataConversionException {
+    try {
+      byte[] utf8Bytes = this.serializer.get().serialize(inputRecord);
+      return Collections.singleton(processUtf8Bytes(utf8Bytes));
+    } catch (IOException ioe) {
+      throw new DataConversionException(ioe);
+    }
+  }

Environment details

RefDiff 2.0

Steps to reproduce

  1. Run RefDiff and give as input the commit osmarleandro/incubator-gobblin@8353b60.

Actual results

PUSH_DOWN   {Method convertRecord(String, GenericRecord, WorkUnitState) at gobblin-modules/gobblin-avro-json/src/main/java/org/apache/gobblin/converter/avro/AvroToJsonStringConverterBase.java:84} {Method convertRecord(String, GenericRecord, WorkUnitState) at gobblin-modules/gobblin-avro-json/src/main/java/org/apache/gobblin/converter/avro/AvroToJsonBytesConverter.java:32})
PUSH_DOWN   {Method convertRecord(String, GenericRecord, WorkUnitState) at gobblin-modules/gobblin-avro-json/src/main/java/org/apache/gobblin/converter/avro/AvroToJsonStringConverterBase.java:84} {Method convertRecord(String, GenericRecord, WorkUnitState) at gobblin-modules/gobblin-avro-json/src/main/java/org/apache/gobblin/converter/avro/AvroToJsonStringConverter.java:34})

Expected results

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