aserg-ufmg / refdiff Goto Github PK
View Code? Open in Web Editor NEWA tool to mine refactorings in the commit history of git repositories.
License: MIT License
A tool to mine refactorings in the commit history of git repositories.
License: MIT License
In the source code present in osmarleandro/spring-boot@9576873 commit, I applied a single Inline Method to applyAdvisors() method in DiscoveredOperationsFactory class, and RefDiff does not detect it.
Diff fragment between the commit osmarleandro/spring-boot@9576873 and their parent.
@@ -89,19 +89,15 @@ abstract class DiscoveredOperationsFactory<O extends Operation> {
DiscoveredOperationMethod operationMethod = new DiscoveredOperationMethod(method, operationType,
annotation.asAnnotationAttributes());
OperationInvoker invoker = new ReflectiveOperationInvoker(target, operationMethod, this.parameterValueMapper);
- invoker = applyAdvisors(endpointId, operationMethod, invoker);
- return createOperation(endpointId, operationMethod, invoker);
- }
-
- private OperationInvoker applyAdvisors(EndpointId endpointId, OperationMethod operationMethod,
- OperationInvoker invoker) {
+ OperationInvoker invoker1 = invoker;
if (this.invokerAdvisors != null) {
for (OperationInvokerAdvisor advisor : this.invokerAdvisors) {
- invoker = advisor.apply(endpointId, operationMethod.getOperationType(), operationMethod.getParameters(),
- invoker);
+ invoker1 = advisor.apply(endpointId, operationMethod.getOperationType(), operationMethod.getParameters(),
+ invoker1);
}
}
- return invoker;
+ invoker = invoker1;
+ return createOperation(endpointId, operationMethod, invoker);
}
RefDiff 2.0
RefDiff yields an empty set of refactorings.
A single instance of the Inline Method refactoring applied to applyAdvisors() method in DiscoveredOperationsFactory class.
I've been facing an issue while running and mining C project.
The code:
CPlugin cPlugin = new CPlugin();
RefDiff refDiffC = new RefDiff(cPlugin);
File gitRepo = refDiffC.cloneGitRepository(
new File(tempFolder, "htop"),
"https://github.com/htop-dev/htop.git");
printRefactorings(
"Refactorings found in:",
refDiffC.computeDiffForCommit(gitRepo, "0750ff7e76d845a70749cc00fa25dbe98a7147a1"));
The exception:
Exception in thread "main" java.lang.RuntimeException: java.lang.SecurityException: class "org.eclipse.cdt.internal.core.dom.parser.c.GNUCASTGotoStatement"'s signer information does not match signer information of other classes in the same package
at refdiff.core.diff.CstComparator.compare(CstComparator.java:55)
at refdiff.core.diff.CstComparator.compare(CstComparator.java:39)
at refdiff.core.RefDiff.computeDiffForCommit(RefDiff.java:58)
at refdiff.examples.CTest.runExamples(CTest.java:34)
at refdiff.examples.CTest.main(CTest.java:15)
Caused by: java.lang.SecurityException: class "org.eclipse.cdt.internal.core.dom.parser.c.GNUCASTGotoStatement"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(Unknown Source)
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at refdiff.parsers.c.CCstVisitor.shouldSkip(CCstVisitor.java:337)
at refdiff.parsers.c.CCstVisitor.genericVisit(CCstVisitor.java:106)
at org.eclipse.cdt.core.dom.ast.ASTGenericVisitor.visit(ASTGenericVisitor.java:123)
at org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit.accept(ASTTranslationUnit.java:257)
at refdiff.parsers.c.CPlugin.parse(CPlugin.java:47)
at refdiff.core.diff.CstComparator$DiffBuilder.(CstComparator.java:75)
at refdiff.core.diff.CstComparator.compare(CstComparator.java:49)
... 4 more
I think it would be solved by a jar file. I've tried to check all possible jars but still no one effect on parsing.
The following error happens when running RefDiffExample
:
Exception in thread "main" java.lang.IllegalStateException: J2V8 native library not loaded
at com.eclipsesource.v8.V8.checkNativeLibraryLoaded(V8.java:195)
at com.eclipsesource.v8.V8.createV8Runtime(V8.java:149)
at com.eclipsesource.v8.V8.createV8Runtime(V8.java:125)
at com.eclipsesource.v8.NodeJS.createNodeJS(NodeJS.java:58)
at com.eclipsesource.v8.NodeJS.createNodeJS(NodeJS.java:45)
at refdiff.parsers.js.JsParser.<init>(JsParser.java:40)
at refdiff.examples.RefDiffExample.runExamples(RefDiffExample.java:23)
at refdiff.examples.RefDiffExample.main(RefDiffExample.java:15)
Caused by: java.lang.UnsatisfiedLinkError: Could not load J2V8 library. Reasons:
no j2v8_macosx_x86_64 in java.library.path
at com.eclipsesource.v8.LibraryLoader.loadLibrary(LibraryLoader.java:75)
at com.eclipsesource.v8.V8.load(V8.java:71)
at com.eclipsesource.v8.V8.createV8Runtime(V8.java:145)
... 6 more
Environment:
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
MacOS Mojave - version 10.14.6
Eclipse Version: 2019-06 (4.12.0)
Build id: 20190614-1200
Hello!
I'm trying to install RefDiff and run your example (https://github.com/aserg-ufmg/RefDiff/blob/master/doc/Tutorial1.md).
When running the first chunk of example code, I get this error:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" java.lang.RuntimeException: org.eclipse.jgit.errors.MissingObjectException: Missing unknown d94ca2b27c9e8a5fa9fe19483d58d2f2ef024606 at refdiff.core.rm2.analysis.StructuralDiffHandler.handleException(StructuralDiffHandler.java:36) at refdiff.core.rm2.analysis.GitHistoryStructuralDiffAnalyzer.detectAtCommit(GitHistoryStructuralDiffAnalyzer.java:108) at refdiff.core.RefDiff.detectAtCommit(RefDiff.java:64) at refdiff.tutorial1.Main.main(Main.java:18) Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown d94ca2b27c9e8a5fa9fe19483d58d2f2ef024606 at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:163) at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:234) at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:859) at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:772) at refdiff.core.rm2.analysis.GitHistoryStructuralDiffAnalyzer.detectAtCommit(GitHistoryStructuralDiffAnalyzer.java:101) ... 2 more
Inside the "slf4j-api-1.7.2-sources.jar", I can't see the class "org.slf4j.impl.StaticLoggerBinder" at all.
Let me know if I'm doing something incorrectly, or if the jar should be updated to another version.
Thanks!
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?
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);
+ }
RefDiff 2.0
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})
An instance of the Pull Up refactoring applied to shouldRetry(Response) method in OkHttpPendingResult class.
In the source code present in osmarleandro/RefactoringMiner@6c42a27 commit, I applied a single Move Method refactoring to setFinallyClause(CompositeStatementObject) method in TryStatementObject class. The method was moved to CompositeStatementObject superclass of TryStatementObject class.
RefDiff detects a single instance of Move Method refactoring, but is the instance a Pull Up Method?
Diff fragment between the commit osmarleandro/RefactoringMiner@6c42a27 and their parent.
@@ -531,4 +531,8 @@ public class CompositeStatementObject extends AbstractStatement {
}
return null;
}
+
+ public void setFinallyClause(TryStatementObject tryStatementObject) {
+ tryStatementObject.finallyClause = this;
+ }
}
@@ -250,7 +250,7 @@ public class OperationBody {
Block finallyBlock = tryStatement.getFinally();
if(finallyBlock != null) {
CompositeStatementObject finallyClauseStatementObject = new CompositeStatementObject(cu, filePath, finallyBlock, parent.getDepth()+1, CodeElementType.FINALLY_BLOCK);
- child.setFinallyClause(finallyClauseStatementObject);
+ finallyClauseStatementObject.setFinallyClause(child);
@@ -10,7 +10,7 @@ import gr.uom.java.xmi.LocationInfo.CodeElementType;
public class TryStatementObject extends CompositeStatementObject {
private List<CompositeStatementObject> catchClauses;
- private CompositeStatementObject finallyClause;
+ CompositeStatementObject finallyClause;
public TryStatementObject(CompilationUnit cu, String filePath, Statement statement, int depth) {
super(cu, filePath, statement, depth, CodeElementType.TRY_STATEMENT);
@@ -25,10 +25,6 @@ public class TryStatementObject extends CompositeStatementObject {
return catchClauses;
}
- public void setFinallyClause(CompositeStatementObject finallyClause) {
- this.finallyClause = finallyClause;
- }
-
RefDiff 2.0
MOVE {Method setFinallyClause(CompositeStatementObject) at src/gr/uom/java/xmi/decomposition/TryStatementObject.java:28} {Method setFinallyClause(TryStatementObject) at src/gr/uom/java/xmi/decomposition/CompositeStatementObject.java:535})
A single instance of the Pull Up Method refactoring applied to setFinallyClause(CompositeStatementObject) method in TryStatementObject class.
It would be fantastic if a kind of tutorial could be provided in the README file. Currently, it is hard to grasp the expressiveness of RefDiff just by reading the README file
In the source code present in osmarleandro/incubator-gobblin@26c45ca commit, I applied a single Extract Interface to the Watermark interface, extracting the IWatermark interface. RefDiff yields a list of refactorings, which includes Extract Interface, Change Signature Method, Move Method, and Pull Up Method.
The Move Method instance points to a method that changes the signature moved to the IWatermark interface, while the Pull Up Method points to a method with the same signature moved to the IWatermark interface. Fowler’s book (2020) shows that the Extract Interface can be followed by Pull Up Method, Pull Up Field, and Change Function Declaration, but it was not mentioned the Move Method.
Considering Fowler's definition and the IWatermark interface was created between the revisions, is the Move Method a valid refactoring transformation?
Diff fragment between the commit osmarleandro/incubator-gobblin@26c45ca and their parent.
@@ -0,0 +1,24 @@
+public interface IWatermark {
+
+ /**
+ * Convert this {@link Watermark} into a {@link JsonElement}.
+ * @return a {@link JsonElement} representing this {@link Watermark}.
+ */
+ JsonElement toJson();
+
+ /**
+ * This method must return a value from [0, 100]. The value should correspond to a percent completion. Given two
+ * {@link Watermark} values, where the lowWatermark is the starting point, and the highWatermark is the goal, what
+ * is the percent completion of this {@link Watermark}.
+ *
+ * @param lowWatermark is the starting {@link Watermark} for the percent completion calculation. So if this.equals(lowWatermark) is true, this method should return 0.
+ * @param highWatermark is the end value {@link Watermark} for the percent completion calculation. So if this.equals(highWatermark) is true, this method should return 100.
+ * @return a value from [0, 100] representing the percentage completion of this {@link Watermark}.
+ */
+ short calculatePercentCompletion(IWatermark lowWatermark, IWatermark highWatermark);
+
+}
@@ -30,22 +30,5 @@ import com.google.gson.JsonElement;
-public interface Watermark {
-
- /**
- * Convert this {@link Watermark} into a {@link JsonElement}.
- * @return a {@link JsonElement} representing this {@link Watermark}.
- */
- public JsonElement toJson();
-
- /**
- * This method must return a value from [0, 100]. The value should correspond to a percent completion. Given two
- * {@link Watermark} values, where the lowWatermark is the starting point, and the highWatermark is the goal, what
- * is the percent completion of this {@link Watermark}.
- *
- * @param lowWatermark is the starting {@link Watermark} for the percent completion calculation. So if this.equals(lowWatermark) is true, this method should return 0.
- * @param highWatermark is the end value {@link Watermark} for the percent completion calculation. So if this.equals(highWatermark) is true, this method should return 100.
- * @return a value from [0, 100] representing the percentage completion of this {@link Watermark}.
- */
- public short calculatePercentCompletion(Watermark lowWatermark, Watermark highWatermark);
+public interface Watermark extends IWatermark {
}
RefDiff 2.0
CHANGE_SIGNATURE {Method setActualHighWatermark(Watermark) at gobblin-api/src/main/java/org/apache/gobblin/configuration/WorkUnitState.java:244} {Method setActualHighWatermark(IWatermark) at gobblin-api/src/main/java/org/apache/gobblin/configuration/WorkUnitState.java:245})
CHANGE_SIGNATURE {Method calculatePercentCompletion(Watermark, Watermark) at gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/watermark/StringWatermark.java:53} {Method calculatePercentCompletion(IWatermark, IWatermark) at gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/watermark/StringWatermark.java:53})
CHANGE_SIGNATURE {Method new(String, Path, Watermark) at gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/replication/WatermarkMetadataGenerationCommitStep.java:47} {Method new(String, Path, IWatermark) at gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/replication/WatermarkMetadataGenerationCommitStep.java:47})
CHANGE_SIGNATURE {Method calculatePercentCompletion(Watermark, Watermark) at gobblin-utility/src/test/java/org/apache/gobblin/util/ParallelRunnerTest.java:283} {Method calculatePercentCompletion(IWatermark, IWatermark) at gobblin-utility/src/test/java/org/apache/gobblin/util/ParallelRunnerTest.java:284})
CHANGE_SIGNATURE {Method new(Watermark, Watermark) at gobblin-api/src/main/java/org/apache/gobblin/source/extractor/WatermarkInterval.java:38} {Method new(IWatermark, IWatermark) at gobblin-api/src/main/java/org/apache/gobblin/source/extractor/WatermarkInterval.java:38})
CHANGE_SIGNATURE {Method calculatePercentCompletion(Watermark, Watermark) at gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaStreamingExtractor.java:158} {Method calculatePercentCompletion(IWatermark, IWatermark) at gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaStreamingExtractor.java:158})
CHANGE_SIGNATURE {Method setActualHighWatermark(Watermark) at gobblin-api/src/main/java/org/apache/gobblin/configuration/ImmutableWorkUnitState.java:44} {Method setActualHighWatermark(IWatermark) at gobblin-api/src/main/java/org/apache/gobblin/configuration/ImmutableWorkUnitState.java:44})
CHANGE_SIGNATURE {Method convertWatermarkToJson(Watermark) at gobblin-api/src/main/java/org/apache/gobblin/source/extractor/WatermarkSerializerHelper.java:33} {Method convertWatermarkToJson(IWatermark) at gobblin-api/src/main/java/org/apache/gobblin/source/extractor/WatermarkSerializerHelper.java:33})
CHANGE_SIGNATURE {Method calculatePercentCompletion(Watermark, Watermark) at gobblin-api/src/test/java/org/apache/gobblin/stream/RecordEnvelopeTest.java:270} {Method calculatePercentCompletion(IWatermark, IWatermark) at gobblin-api/src/test/java/org/apache/gobblin/stream/RecordEnvelopeTest.java:270})
CHANGE_SIGNATURE {Method serialize(Watermark) at gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/replication/WatermarkMetadataUtil.java:37} {Method serialize(IWatermark) at gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/replication/WatermarkMetadataUtil.java:38})
CHANGE_SIGNATURE {Method calculatePercentCompletion(Watermark, Watermark) at gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/MultiLongWatermark.java:71} {Method calculatePercentCompletion(IWatermark, IWatermark) at gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/MultiLongWatermark.java:72})
CHANGE_SIGNATURE {Method calculatePercentCompletion(Watermark, Watermark) at gobblin-api/src/test/java/org/apache/gobblin/source/extractor/TestWatermark.java:37} {Method calculatePercentCompletion(IWatermark, IWatermark) at gobblin-api/src/test/java/org/apache/gobblin/source/extractor/TestWatermark.java:37})
CHANGE_SIGNATURE {Method calculatePercentCompletion(Watermark, Watermark) at gobblin-core-base/src/main/java/org/apache/gobblin/source/extractor/extract/LongWatermark.java:59} {Method calculatePercentCompletion(IWatermark, IWatermark) at gobblin-core-base/src/main/java/org/apache/gobblin/source/extractor/extract/LongWatermark.java:59})
CHANGE_SIGNATURE {Method calculatePercentCompletion(Watermark, Watermark) at gobblin-modules/gobblin-kafka-09/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaSimpleStreamingExtractor.java:113} {Method calculatePercentCompletion(IWatermark, IWatermark) at gobblin-modules/gobblin-kafka-09/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaSimpleStreamingExtractor.java:113})
CHANGE_SIGNATURE {Method calculatePercentCompletion(Watermark, Watermark) at gobblin-core-base/src/main/java/org/apache/gobblin/source/extractor/DefaultCheckpointableWatermark.java:67} {Method calculatePercentCompletion(IWatermark, IWatermark) at gobblin-core-base/src/main/java/org/apache/gobblin/source/extractor/DefaultCheckpointableWatermark.java:67})
CHANGE_SIGNATURE {Method calculatePercentCompletion(Watermark, Watermark) at gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/MultiKeyValueLongWatermark.java:59} {Method calculatePercentCompletion(IWatermark, IWatermark) at gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/MultiKeyValueLongWatermark.java:60})
EXTRACT_SUPER {Interface Watermark at gobblin-api/src/main/java/org/apache/gobblin/source/extractor/Watermark.java:22} {Interface IWatermark at gobblin-api/src/main/java/org/apache/gobblin/source/extractor/IWatermark.java:5})
MOVE {Method calculatePercentCompletion(Watermark, Watermark) at gobblin-api/src/main/java/org/apache/gobblin/source/extractor/Watermark.java:41} {Method calculatePercentCompletion(IWatermark, IWatermark) at gobblin-api/src/main/java/org/apache/gobblin/source/extractor/IWatermark.java:13})
PULL_UP {Method toJson() at gobblin-api/src/main/java/org/apache/gobblin/source/extractor/Watermark.java:35} {Method toJson() at gobblin-api/src/main/java/org/apache/gobblin/source/extractor/IWatermark.java:7})
A single instance of the Extract Interface refactoring applied to Watermark interface.
Hi,
Thanks for this excellent tool! Can I use this for python? or is there a similar tool for python code?
Thanks
I've been trying to do the example but it doesn't work, i get an internal error.
Here is the log :
0 [main] INFO refdiff.core.util.GitServiceImpl - Checking out A:\Ecole\Session11\LOG530\jersey d94ca2b27c9e8a5fa9fe19483d58d2f2ef024606 ...
2887 [main] INFO refdiff.core.rm2.analysis.GitHistoryStructuralDiffAnalyzer - Analyzing code after (d94ca2b27c9e8a5fa9fe19483d58d2f2ef024606) ...
3628 [main] INFO refdiff.core.util.GitServiceImpl - Checking out A:\Ecole\Session11\LOG530\jersey 526599a8e2110f3ffb50c12294f5b7e4cd13b0b6 ...
5916 [main] INFO refdiff.core.rm2.analysis.GitHistoryStructuralDiffAnalyzer - Analyzing code before (526599a8e2110f3ffb50c12294f5b7e4cd13b0b6) ...
Exception in thread "main" java.lang.NoSuchMethodError: org.eclipse.jgit.revwalk.RevWalk.close()V
at refdiff.core.rm2.analysis.GitHistoryStructuralDiffAnalyzer.detectAtCommit(GitHistoryStructuralDiffAnalyzer.java:106)
at refdiff.core.RefDiff.detectAtCommit(RefDiff.java:64)
at application.Analyser.analyseRepo(Analyser.java:17)
at application.Application.main(Application.java:10)
And here is the code :
`public class Analyser {
public static List<SDRefactoring> analyseRepo(String repoURL,String localRepoLocation) throws Exception{
RefDiff refDiff = new RefDiff();
GitService gitService = new GitServiceImpl();
Repository repository = gitService.cloneIfNotExists(localRepoLocation,repoURL);
List<SDRefactoring> refactorings = refDiff.detectAtCommit(repository, "d94ca2b27c9e8a5fa9fe19483d58d2f2ef024606");
return refactorings;
}
}`
But the code doesn't even get to the return. Is there an error in my code or the problem resides in the RefDiff ?
As requested in README, I downloaded JDK 8 and build the repo. However Gradle refused to build.
$ export JAVA_HOME=~/jdk1.8.0_301/
$ ./gradlew build
> Task :refdiff-java:compileJava
warning: unknown enum constant Include.NON_NULL
reason: class file for com.fasterxml.jackson.annotation.JsonInclude$Include not found
error: org.eclipse.core.runtime.IProgressMonitor: bad class file: /home/qiqig/.gradle/caches/modules-2/files-2.1/org.eclipse.platform/org.eclipse.equinox.common/3.15.0/bd08027a06f7c62fa281cacd887daa2f590f20d0/org.eclipse.equinox.common-3.15.0.jar(org/eclipse/core/runtime/IProgressMonitor.class)
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
/home/qiqig/RefDiff/refdiff-java/src/main/java/refdiff/parsers/java/SDModelBuilder.java:28: error: cannot access IProgressMonitor
public class SDModelBuilder {
^
bad class file: /home/qiqig/.gradle/caches/modules-2/files-2.1/org.eclipse.platform/org.eclipse.equinox.common/3.15.0/bd08027a06f7c62fa281cacd887daa2f590f20d0/org.eclipse.equinox.common-3.15.0.jar(org/eclipse/core/runtime/IProgressMonitor.class)
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
1 error
1 warning
> Task :refdiff-java:compileJava FAILED
Can you check the required JDK version?
I have used Refdif-0.1.1 library in my project. It seems that it can not detect "Change Method Signature" refactoring.
In the source code present in osmarleandro/RefactoringMiner@cf32531 commit, I applied a single Rename Method refactoring to getRegex() method in the RefactoringType class. RefDiff yields an empty list of refactoring. Is it missing this true instance of Rename Method refactoring?
Diff fragment between the commit osmarleandro/RefactoringMiner@cf32531 and their parent.
@@ -121,7 +121,7 @@ public enum RefactoringType {
this.aggregateGroups = aggregateGroups;
}
- public Pattern getRegex() {
+ public Pattern getRegex_RENAMED() {
return regex;
}
RefDiff 2.0
A single instance of the Rename Method refactoring applied to getRegex() method in the RefactoringType class.
In the source code of osmarleandro/google-maps-services-java@12a03c9 commit, I recognize an Extract and Move Method refactoring applied to handle() method in GaeRequestHandler class. I ran RefDiff but it yields an empty set of refactoring as result. Why this refactoring instance was not detected?
Diff fragment between the commit osmarleandro/google-maps-services-java@12a03c9 and their parent.
@@ -60,29 +60,9 @@ public class GaeRequestHandler implements GeoApiContext.RequestHandler {
- FetchOptions fetchOptions = FetchOptions.Builder.withDeadline(10);
- HTTPRequest req;
- try {
- req = new HTTPRequest(new URL(hostName + url), HTTPMethod.POST, fetchOptions);
- if (experienceIdHeaderValue != null) {
- req.setHeader(
- new HTTPHeader(HttpHeaders.X_GOOG_MAPS_EXPERIENCE_ID, experienceIdHeaderValue));
- }
- } catch (MalformedURLException e) {
- LOG.error("Request: {}{}", hostName, url, e);
- throw (new RuntimeException(e));
- }
-
- return new GaePendingResult<>(
- req,
- client,
- clazz,
- fieldNamingPolicy,
- errorTimeout,
- maxRetries,
- exceptionsAllowedToRetry,
- metrics);
- }
+ return exceptionsAllowedToRetry.handle(hostName, url, userAgent, experienceIdHeaderValue, clazz,
+ fieldNamingPolicy, errorTimeout, maxRetries, this, metrics);
+ }
@@ -15,7 +15,19 @@
[...]
public final class ExceptionsAllowedToRetry extends HashSet<Class<? extends ApiException>> {
@@ -37,4 +49,30 @@ public final class ExceptionsAllowedToRetry extends HashSet<Class<? extends ApiE
sb.append(']');
return sb.toString();
}
+
+public <T, R extends ApiResponse<T>> PendingResult<T> handle(
+ String hostName, String url, String userAgent, String experienceIdHeaderValue, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries, GaeRequestHandler gaeRequestHandler, RequestMetrics metrics) {
+ FetchOptions fetchOptions = Builder.withDeadline(10);
+ HTTPRequest req;
+ try {
+ req = new HTTPRequest(new URL(hostName + url), HTTPMethod.POST, fetchOptions);
+ if (experienceIdHeaderValue != null) {
+ req.setHeader(
+ new HTTPHeader(HttpHeaders.X_GOOG_MAPS_EXPERIENCE_ID, experienceIdHeaderValue));
+ }
+ } catch (MalformedURLException e) {
+ GaeRequestHandler.LOG.error("Request: {}{}", hostName, url, e);
+ throw (new RuntimeException(e));
+ }
+
+ return new GaePendingResult<>(
+ req,
+ gaeRequestHandler.client,
+ clazz,
+ fieldNamingPolicy,
+ errorTimeout,
+ maxRetries,
+ this,
+ metrics);
+ }
}
RefDiff 2.0
RefDiff yields and empty set of refactoring.
A single instance of Extract and Move Method refactoring applied to handle() method of GaeRequestHandler class.
In the source code present in osmarleandro/RefactoringMiner@c088784 commit, I applied a single Rename Class refactoring to MoveAttributeRefactoring class. RefDiff detects the Rename Class refactoring, but also Change Signature Method refactoring.
Whereas to apply the Rename Class refactoring it is required to update its references. Therefore, is the instances of the Change Signature Method false positives?
Diff fragment between the commit osmarleandro/RefactoringMiner@c088784 and their parent.
@@ -11,12 +11,12 @@ import org.refactoringminer.api.RefactoringType;
import gr.uom.java.xmi.UMLAttribute;
-public class MoveAttributeRefactoring implements Refactoring {
+public class MoveAttributeRefactoring_RENAMED implements Refactoring {
protected UMLAttribute originalAttribute;
protected UMLAttribute movedAttribute;
private volatile int hashCode = 0;
@@ -86,7 +86,7 @@ public class MoveOperationRefactoring implements Refactoring {
return movedOperation.codeRange();
}
- public boolean compatibleWith(MoveAttributeRefactoring ref) {
+ public boolean compatibleWith(MoveAttributeRefactoring_RENAMED ref) {
if(ref.getMovedAttribute().getClassName().equals(this.movedOperation.getClassName()) &&
@@ -735,7 +735,7 @@ public class UMLModelDiff {
return false;
}
- private int computeCompatibility(MoveAttributeRefactoring candidate) {
+ private int computeCompatibility(MoveAttributeRefactoring_RENAMED candidate) {
int count = 0;
RefDiff 2.0
CHANGE_SIGNATURE {Method compatibleWith(MoveAttributeRefactoring) at src/gr/uom/java/xmi/diff/MoveOperationRefactoring.java:89} {Method compatibleWith(MoveAttributeRefactoring_RENAMED) at src/gr/uom/java/xmi/diff/MoveOperationRefactoring.java:89})
CHANGE_SIGNATURE {Method computeCompatibility(MoveAttributeRefactoring) at src/gr/uom/java/xmi/diff/UMLModelDiff.java:738} {Method computeCompatibility(MoveAttributeRefactoring_RENAMED) at src/gr/uom/java/xmi/diff/UMLModelDiff.java:738})
RENAME {Class MoveAttributeRefactoring at src/gr/uom/java/xmi/diff/MoveAttributeRefactoring.java:14} {Class MoveAttributeRefactoring_RENAMED at src/gr/uom/java/xmi/diff/MoveAttributeRefactoring_RENAMED.java:14})
A single instance of the Rename Class refactoring applied to MoveAttributeRefactoring class.
In the source code of osmarleandro/spring-boot@0022080 commit, I applied a single Move Method refactoring to getType(Class) method in MBeanInfoFactory class, moving to JmxOperationResponseMapper interface. RefDiff yields a single Inline Method refactoring as result. Why is the Move Method refactoring instance not detected?
Diff fragment between the commit osmarleandro/spring-boot@0022080 and their parent.
@@ -38,4 +38,8 @@ public interface JmxOperationResponseMapper {
*/
Object mapResponse(Object response);
+ default String getType(MBeanInfoFactory mBeanInfoFactory, Class<?> outputType) {
+ return mapResponseType(outputType).getName();
+ }
+
}
@@ -69,7 +69,7 @@ class MBeanInfoFactory {
String name = operation.getName();
String description = operation.getDescription();
MBeanParameterInfo[] signature = getSignature(operation.getParameters());
- String type = getType(operation.getOutputType());
+ String type = responseMapper.getType(this, operation.getOutputType());
int impact = getImpact(operation.getType());
return new ModelMBeanOperationInfo(name, description, signature, type, impact);
}
@@ -92,8 +92,4 @@ class MBeanInfoFactory {
return MBeanOperationInfo.UNKNOWN;
}
- private String getType(Class<?> outputType) {
- return this.responseMapper.mapResponseType(outputType).getName();
- }
-
}
RefDiff 2.0
INLINE {Method getType(Class) at spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/MBeanInfoFactory.java:95} {Method getMBeanOperation(JmxOperation) at spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/MBeanInfoFactory.java:68})
An instance of the Move Method refactoring applied to getType(Class) method in MBeanInfoFactory class and moved to JmxOperationResponseMapper interface.
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.
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);
+ }
+
}
RefDiff 2.0
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})
A single instance of the Push Down Method refactoring applied to customize() method in ManagementWebServerFactoryCustomizer class.
In the source code present in osmarleandro/RefactoringMiner@00d45e1 commit, I applied a single Rename Method to isFinal() method in UMLAttribute class, but RefDiff yields Extract and Move Method instance.
Diff fragment between the commit osmarleandro/RefactoringMiner@00d45e1 and their parent.
@@ -45,7 +45,7 @@ public class UMLAttribute implements Comparable<UMLAttribute>, Serializable, Loc
this.visibility = visibility;
}
- public boolean isFinal() {
+ public boolean isFinal_RENAMED() {
return isFinal;
}
@@ -42,7 +42,7 @@ public class UMLAttributeDiff {
qualifiedTypeChanged = true;
if(removedAttribute.isStatic() != addedAttribute.isStatic())
staticChanged = true;
- if(removedAttribute.isFinal() != addedAttribute.isFinal())
+ if(removedAttribute.isFinal_RENAMED() != addedAttribute.isFinal_RENAMED())
@@ -89,8 +89,8 @@ public class UMLAttributeDiff {
sb.append("\t").append("modifier changed from " + (removedAttribute.isStatic() ? "static" : "non-static") + " to " +
(addedAttribute.isStatic() ? "static" : "non-static")).append("\n");
if(finalChanged)
- sb.append("\t").append("modifier changed from " + (removedAttribute.isFinal() ? "final" : "non-final") + " to " +
- (addedAttribute.isFinal() ? "final" : "non-final")).append("\n");
+ sb.append("\t").append("modifier changed from " + (removedAttribute.isFinal_RENAMED() ? "final" : "non-final") + " to " +
+ (addedAttribute.isFinal_RENAMED() ? "final" : "non-final")).append("\n");
RefDiff 2.0
EXTRACT_MOVE {Method toString() at src/gr/uom/java/xmi/diff/UMLAttributeDiff.java:78} {Method isFinal_RENAMED() at src/gr/uom/java/xmi/UMLAttribute.java:48})
A single instance of the Rename Method refactoring applied to isFinal() method in UMLAttribute class.
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/eclipse/core/runtime/CoreException has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
My jdk and jre are both 1.8.
How can I fix this ?
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?
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);
+ }
+ }
RefDiff 2.0
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})
A single instance of the Push Down Method refactoring applied to convertRecord() method in AvroToJsonStringConverterBase class.
It would be great if a new release of RefDiff could be used as a gradle or maven dependency.
In the source code present in osmarleandro/RefactoringMiner@38b41e6 commit, I applied a single Rename Method refactoring to isParameter() method in the VariableDeclaration class. RefDiff yields four instances of Extract and Move Method refactoring.
Diff fragment between the commit osmarleandro/RefactoringMiner@38b41e6 and their parent.
@@ -115,7 +115,7 @@ public class VariableDeclaration implements LocationInfoProvider, VariableDeclar
return scope;
}
- public boolean isParameter() {
+ public boolean isParameter_RENAMED() {
return isParameter;
}
@@ -40,7 +40,7 @@ public class ChangeVariableTypeRefactoring implements Refactoring {
}
public RefactoringType getRefactoringType() {
- if(originalVariable.isParameter() && changedTypeVariable.isParameter())
+ if(originalVariable.isParameter_RENAMED() && changedTypeVariable.isParameter_RENAMED())
@@ -51,11 +51,11 @@ public class MergeVariableRefactoring implements Refactoring {
private boolean allVariablesAreParameters() {
for(VariableDeclaration declaration : mergedVariables) {
- if(!declaration.isParameter()) {
+ if(!declaration.isParameter_RENAMED()) {
return false;
}
}
- return newVariable.isParameter();
+ return newVariable.isParameter_RENAMED();
@@ -34,9 +34,9 @@ public class RenameVariableRefactoring implements Refactoring {
}
public RefactoringType getRefactoringType() {
- if(originalVariable.isParameter() && renamedVariable.isParameter())
+ if(originalVariable.isParameter_RENAMED() && renamedVariable.isParameter_RENAMED())
return RefactoringType.RENAME_PARAMETER;
- if(!originalVariable.isParameter() && renamedVariable.isParameter())
+ if(!originalVariable.isParameter_RENAMED() && renamedVariable.isParameter_RENAMED())
@@ -51,11 +51,11 @@ public class SplitVariableRefactoring implements Refactoring {
private boolean allVariablesAreParameters() {
for(VariableDeclaration declaration : splitVariables) {
- if(!declaration.isParameter()) {
+ if(!declaration.isParameter_RENAMED()) {
return false;
}
}
- return oldVariable.isParameter();
+ return oldVariable.isParameter_RENAMED();
}
RefDiff 2.0
EXTRACT_MOVE {Method allVariablesAreParameters() at src/gr/uom/java/xmi/diff/SplitVariableRefactoring.java:52} {Method isParameter_RENAMED() at src/gr/uom/java/xmi/decomposition/VariableDeclaration.java:118})
EXTRACT_MOVE {Method getRefactoringType() at src/gr/uom/java/xmi/diff/RenameVariableRefactoring.java:36} {Method isParameter_RENAMED() at src/gr/uom/java/xmi/decomposition/VariableDeclaration.java:118})
EXTRACT_MOVE {Method allVariablesAreParameters() at src/gr/uom/java/xmi/diff/MergeVariableRefactoring.java:52} {Method isParameter_RENAMED() at src/gr/uom/java/xmi/decomposition/VariableDeclaration.java:118})
EXTRACT_MOVE {Method getRefactoringType() at src/gr/uom/java/xmi/diff/ChangeVariableTypeRefactoring.java:42} {Method isParameter_RENAMED() at src/gr/uom/java/xmi/decomposition/VariableDeclaration.java:118})
A single instance of the Rename Method refactoring applied to isParameter() method in the VariableDeclaration class.
Hello,
Thanks for providing such a great tool. However, I want to use a similar tool on python code. I tried my best and did not find any. Is it possible that you can give me some guide to let me write a parser for python code?
Best
Hi! I ran RefDiff on the Java project and encountered the NPE problem.
Project: IntelliJDeodorant
Code:
JavaPlugin javaPlugin = new JavaPlugin(tempFolder);
RefDiff refDiffJava = new RefDiff(javaPlugin);
File intellijdeodorantRepo = refDiffJava.cloneGitRepository(
new File(tempFolder, "intellijdeodorant"),
"https://github.com/JetBrains-Research/IntelliJDeodorant.git");
refDiffJava.computeDiffForCommitHistory(intellijdeodorantRepo, 100, (commit, diff) -> {
printRefactorings("Refactorings found in IntelliJDeodorant " + commit.getId().name(), diff);
});
Stacktrace:
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.NullPointerException
at refdiff.core.io.GitHelper.forEachNonMergeCommit(GitHelper.java:120)
at refdiff.core.RefDiff.computeDiffForCommitHistory(RefDiff.java:83)
at refdiff.core.RefDiff.computeDiffForCommitHistory(RefDiff.java:70)
at refdiff.examples.RefDiffExample.runExamples(RefDiffExample.java:74)
at refdiff.examples.RefDiffExample.main(RefDiffExample.java:15)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at refdiff.core.diff.CstComparator.compare(CstComparator.java:55)
at refdiff.core.diff.CstComparator.compare(CstComparator.java:39)
at refdiff.core.RefDiff.lambda$0(RefDiff.java:85)
at refdiff.core.io.GitHelper.forEachNonMergeCommit(GitHelper.java:111)
... 4 more
Caused by: java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.addType(PackageBinding.java:106)
at org.eclipse.jdt.internal.compiler.lookup.ClassScope.buildType(ClassScope.java:432)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.buildTypeBindings(CompilationUnitScope.java:188)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.buildTypeBindings(LookupEnvironment.java:463)
at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:340)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.accept(CompilationUnitResolver.java:186)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:327)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:262)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:3328)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:3040)
at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:57)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:514)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:615)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:611)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypeFor(SourceTypeBinding.java:1817)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.fields(SourceTypeBinding.java:949)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.internalFaultInTypeForFieldsAndMethods(SourceTypeBinding.java:917)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:913)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:515)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:885)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1047)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:662)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:1007)
at refdiff.parsers.java.SDModelBuilder.analyze(SDModelBuilder.java:98)
at refdiff.parsers.java.JavaPlugin.parse(JavaPlugin.java:49)
at refdiff.core.diff.CstComparator$DiffBuilder.<init>(CstComparator.java:76)
at refdiff.core.diff.CstComparator.compare(CstComparator.java:49)
... 7 more
In the source code of osmarleandro/RefactoringMiner@d67f4b4 commit, I applied a single Rename Class refactoring to VariableDeclarationProvider class. RefDiff yields a single Move Method refactoring as result. Why is the Rename Class refactoring instance not detected?
Diff fragment between the commit osmarleandro/RefactoringMiner@d67f4b4 and their parent.
@@ -2,6 +2,6 @@ package gr.uom.java.xmi;
import gr.uom.java.xmi.decomposition.VariableDeclaration;
-public interface VariableDeclarationProvider {
+public interface VariableDeclarationProvider_RENAMED {
RefDiff 2.0
MOVE {Method getVariableDeclaration() at src/gr/uom/java/xmi/VariableDeclarationProvider.java:6} {Method getVariableDeclaration() at src/gr/uom/java/xmi/VariableDeclarationProvider_RENAMED.java:6})
A single instance of the Rename Class refactoring applied to VariableDeclarationProvider class.
In the source code present in osmarleandro/google-maps-services-java@982b095 commit, I applied a single Extract Method to makeRequest() method in PendingResultBase class, and RefDiff does not detect it.
Diff fragment between the commit osmarleandro/google-maps-services-java@982b095 and their parent.
@@ -72,11 +72,7 @@ abstract class PendingResultBase<T, A extends PendingResultBase<T, A, R>, R exte
}
private PendingResult<T> makeRequest() {
- if (delegate != null) {
- throw new IllegalStateException(
- "'await', 'awaitIgnoreError' or 'setCallback' was already called.");
- }
- validateRequest();
+ extracted();
switch (config.requestVerb) {
case "GET":
return delegate = context.get(config, responseClass, params);
@@ -88,6 +84,14 @@ abstract class PendingResultBase<T, A extends PendingResultBase<T, A, R>, R exte
}
}
+private void extracted() {
+ if (delegate != null) {
+ throw new IllegalStateException(
+ "'await', 'awaitIgnoreError' or 'setCallback' was already called.");
+ }
+ validateRequest();
+}
+
RefDiff 2.0
RefDiff yields an empty set of refactorings.
A single instance of the Extract Method refactoring applied to makeRequest() method in PendingResultBase class.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.