Giter Site home page Giter Site logo

rm-astdiff's Issues

Missing Move Attribute

tsantalis@40cf1c8

Screenshot from 2022-10-19 14-00-37

While the moved methods are properly indicated, the moved attributes don't have a move tooltip.

private static final Pattern SPLIT_CONDITIONAL_PATTERN = Pattern.compile("(\\|\\|)|(&&)|(\\?)|(:)");
public static final Pattern SPLIT_CONCAT_STRING_PATTERN = Pattern.compile("(\\s)*(\\+)(\\s)*");

moved from
src/gr/uom/java/xmi/decomposition/UMLOperationBodyMapper.java
to
src/gr/uom/java/xmi/decomposition/StringBasedHeuristics.java

Execution time is also problematic:

2022-10-19 13:40:23 INFO RefactoringMiner Started...
2022-10-19 13:41:24 INFO RefactoringMiner ModelDiff execution: 60 seconds
2022-10-19 13:43:26 INFO Diff execution: 122 seconds
2022-10-19 13:43:27 INFO EditScript execution: 1 seconds

Support for composite replacements

  • Traditional try replaced with try-with-resources

Composite replacement: the resource expressions correspond to extra statements
NLPchina/ansj_seg@913704e#diff-37efb71e313d229310c23302fb8788212cafe759abfdcca86e60fbde9deb7c7cR105

neo4j/neo4j@d3533c1#diff-b32651bf4edb0ff7028d860d1deed635ff9a5ab38b7e422d4bcca2eeccb36124R144

DataInputStream dis = null;
        try
        {
            FileInputStream fis = new FileInputStream(privateKeyFile);
            dis = new DataInputStream(fis);

becomes

try(DataInputStream in = new DataInputStream(new FileInputStream(privateKeyFile)))
  • Replace Loop with Pipeline

http://refactoring.encs.concordia.ca/oracle/tool-refactorings/RefactoringMiner/TP/Replace%20Loop%20With%20Pipeline

  • Replace Pipeline with Loop

junit-team/junit5@62c433c#diff-3679a3039f048d756df1feebd214cc17df7b0a686dc3be77f24bff5bc61bbf4cR203-R222

  • Split Conditional

kiegroup/drools@1bf2875#diff-1e1bf3853477703f78c734cfb42a7cb2a2a0e55e5ac89265a9a9e73982d5438bL231-L233

nutzam/nutz@6599c74#diff-d47d95ef90d7f70d88b06a02d8505b58a81c7c1174c2494e56c9b09d090bc6edL307

graphhopper/graphhopper@7f80425#diff-619f379c7f10d178fba87944b27d543e3f36a9d34803fbdd5ab964a8c9f60a86L943

BuildCraft/BuildCraft@6abc40e#diff-0850b8a596d522bb87b55e5a3799a56612654c4c2b7d86a8157bf2d6bb8e5e0cL353-L356

JetBrains/intellij-community@1b70adb#diff-618af48f6b6713ae4367692615f2309a93d3ac39eb4453167d89ed33d0f8e35aL160

apache/giraph@03ade42
if(!conf.isStaticGraph() && !file.delete()) to [if(!conf.isStaticGraph() || serviceWorker.getSuperstep() == BspServiceWorker.INPUT_SUPERSTEP), if(!file.delete())]

While Split to While + If
thymeleaf/thymeleaf@378ba37#diff-fe47a14afb3317314d81d6f5278d04b52ae3ce0d65dedc1d84cb6c40aa3908ceR270-R278

While Split to If + While
apache/drill@711992f#diff-6c459fac9e29d1448e6a4a08041df7c7250f6aed611eaa036a24a529196b490dR148-R151

JetBrains/intellij-community@9f7de20#diff-ed6bc52ae4591f4de13f2398154358599d6380ef4f524b4442c3176d82fb037cR105-R107

  • Iterator-based while replaced with enhanced-for

checkstyle/checkstyle@f1afaf8#diff-b48cc2ff38026f94180847550cd260a0ebefb4a9cb9635e39f5fa2046311d72bR474

  • Inlined statements

netty/netty@d31fa31#diff-ac1404c2792cc01bf80c28d4a352a533a9e8d2937e7b97d65d16842e2b7f1ad4L80-L84

JetBrains/intellij-community@ff46945#diff-195db6e789b2625726917559b766417af74e54362fa8580ca7d4681c8eb3a435R107

  • Builder call chain decomposed to individual statements

open-keychain/open-keychain@c11fef6#diff-4d4436d415b26cfa599819885f9510c2da0cd152fcd5e1898a135b29ca90bce8R136-R146

linkedin/rest.li@54fa890#diff-ad956a39fb8d6f1ba66cc531080cbc28877e2f10781c2633b0ccc321b69d1c00R231-R234
public onRestRequest(req RestRequest, requestContext RequestContext, wireAttrs Map<String,String>, nextFilter NextFilter<RestRequest,RestResponse>) : void
req.builder().addHeaderValue(HttpConstants.ACCEPT_ENCODING, _acceptEncodingHeader).build(); is extracted to
public addResponseCompressionHeaders(responseCompressionOverride CompressionOption, req RestRequest) : RestRequest

CyanogenMod/android_frameworks_base@910397f#diff-3915a87990e3c24a5f92c176d5f80db4fcc23d08ed9b59cc3ec048e262ac4491R114-R116

linkedin/rest.li@ec5ea36#diff-fdf9da24acd0f3b1439a8ce6c9fd04484e15222cc08f615e837fec6a69426081L55-L57

  • StringBuilder declaration in chain decomposed to individual statement

jfinal/jfinal@881baed#diff-e19efa6dd99d3caacc529cb4b7d1038422f5f791ce618b4c6c48cbf9d2ef68e3R112

  • Collection data entry replaced with Collection.of() factory method (Java 9)

iluwatar/java-design-patterns@dd971d8

  • Merge catch blocks with Intersection type

jersey/fab1516773d50bf86d9cc37e2f6db13496f0ecae
core-server/src/main/java/org/glassfish/jersey/server/internal/scanning/JarFileScanner.java

} catch (final IOException e) {
    LOGGER.log(Level.CONFIG, "Unable to read the next jar entry.", e);
    return false;
} catch (final SecurityException e) {
    LOGGER.log(Level.CONFIG, "Unable to read the next jar entry.", e);
    return false;
}

becomes

} catch (final IOException | SecurityException e) {
    LOGGER.log(Level.CONFIG, LocalizationMessages.JAR_SCANNER_UNABLE_TO_READ_ENTRY(), e);
    return false;
}

Graylog2/graylog2-server@2ef067f

  • Merge Conditionals

spring-projects/spring-integration@247232b#diff-e69bfd584978efc415e3ea5cca8bf35c943372e7968d73fe1c4eea27a02d53d4R366

facebook/buck@f26d234#diff-8b1672ed0167e6b7a425fbf4a33be8fc18c01a3a79d830495e4835a41797de14R246

apache/cassandra@3566843#diff-a5de948460b9aa759b9c5af1da662661484df0820d82615af7028089a7e87331R87

addthis/hydra@7fea4c9#diff-6e31c93704ae2e71e5bcda132ae0f9cb9d6cca9a0169f14cf32bac7697fc7868R75-R80

kiegroup/drools@1bf2875#diff-59225e3f98b0396f7a4b33b3de9c5c8aeb2369d213e0ee3575c737179e7f7e60R57-R58

  • Merge Conditionals with Duplicated Code in branches

spring-projects/spring-framework@7dd8dc6?diff=split#diff-ea43e736983102ff93143d5a8e5a0e63837233bafa3a5f8bae78256211ed9113R230

liferay/liferay-plugins@7c7ecf4#diff-685c23de6ec190cf9008b52295e9fe3714c9efa7fcd94f7747abb8d56909b154R45-R50

  • Variable Declaration Split to Declaration + Assignment statement

https://github.com/flozender/jgit/commit/45e79a526c7ffebaf8e4758a6cb6b7af05716707?diff=split#diff-61139ff71d8675ad33d046412d1fca65a59c31c8325cc757238d3283eb2219f6R128

NullPointerException ProjectASTDiffer.processAttributeJavaDoc(ProjectASTDiffer.java:530)

NullPointerException in release branch
phishman3579/java-algorithms-implementation@ab98bca

Exception in thread "main" java.lang.NullPointerException
at ASTDiff.ProjectASTDiffer.processAttributeJavaDoc(ProjectASTDiffer.java:530)
at ASTDiff.ProjectASTDiffer.processFieldDeclaration(ProjectASTDiffer.java:525)
at ASTDiff.ProjectASTDiffer.processClassAttributes(ProjectASTDiffer.java:481)
at ASTDiff.ProjectASTDiffer.processClassDeclarationMapping(ProjectASTDiffer.java:725)
at ASTDiff.ProjectASTDiffer.process(ProjectASTDiffer.java:124)
at ASTDiff.ProjectASTDiffer.makeASTDiff(ProjectASTDiffer.java:98)
at ASTDiff.ProjectASTDiffer.diff(ProjectASTDiffer.java:74)
at ASTDiff.Run.main(Run.java:15)

Inline Attribute Cases

  • infinispan/infinispan@8f446b6
    File: server/integration/jgroups/src/test/java/org/jboss/as/clustering/jgroups/subsystem/OperationsTestCase.java -> server/integration/jgroups/src/test/java/org/infinispan/server/jgroups/subsystem/OperationsTestCase.java

  • readTransportRackOp : ModelNode

  • readSubsystemDefaultStackOp : ModelNode

  • readProtocolSocketBindingOp : ModelNode

  • addStackOpWithParams : ModelNode

  • writeProtocolSocketBindingOp : ModelNode

  • writeTransportRackOp : ModelNode

image

image

NoSuchElementException in case of Extract Variable with multi-mappings

java.util.NoSuchElementException
at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1513)
at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1534)
at org.refactoringminer.astDiff.matchers.ExtendedMultiMappingStore.getSrcToDstMono(ExtendedMultiMappingStore.java:70)
at org.refactoringminer.astDiff.matchers.ExtendedMultiMappingStore.getMonoMappingStore(ExtendedMultiMappingStore.java:102)
at org.refactoringminer.astDiff.actions.ASTDiff.(ASTDiff.java:27)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.process(ProjectASTDiffer.java:118)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.makeASTDiff(ProjectASTDiffer.java:69)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.diff(ProjectASTDiffer.java:50)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.(ProjectASTDiffer.java:37)

In commit spring-projects/spring-data-neo4j@ef2a0d6?diff=split#diff-7f8b71d8f4360bb48c12bb4cad109e67a8f322b0973b0b760619a90e75ef1c91

There is a case of Extract Variable with multi-mappings in file
spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/GraphRepositoryQuery.java

parameters[i] is extracted from two different places into
Object parameterValue = session.resolveGraphIdFor(parameters[i]);
and
parameterValue = parameters[i];

So, there are 2 pairs of multi-mappings.

Screenshot from 2023-01-20 03-12-00

NullPointerException at addMappingRecursively(ExtendedMultiMappingStore.java:197)

netty/netty@d31fa31
java.lang.NullPointerException
at org.refactoringminer.astDiff.matchers.ExtendedMultiMappingStore.addMappingRecursively(ExtendedMultiMappingStore.java:197)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.processImports(ProjectASTDiffer.java:912)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.process(ProjectASTDiffer.java:104)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.makeASTDiff(ProjectASTDiffer.java:70)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.diff(ProjectASTDiffer.java:50)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.(ProjectASTDiffer.java:37)

infinispan/infinispan@8f446b6

infinispan/infinispan@8f446b6
server/integration/jgroups/src/main/java/org/jboss/as/clustering/jgroups/subsystem/RemoteSiteResourceDefinition.java -> server/integration/jgroups/src/main/java/org/infinispan/server/jgroups/subsystem/RemoteSiteResourceDefinition.java

  • Incorrect MultiMappings

image

Long running commit

CyanogenMod/android_frameworks_base@910397f
Populating File execution: 0 seconds
2022-12-23 03:50:40 INFO RefactoringMiner Started...
2022-12-23 03:50:46 INFO RefactoringMiner ModelDiff execution: 6 seconds
2022-12-23 03:50:47 INFO ModelDiff.getRefactorings() execution time: 0 seconds
2022-12-23 03:50:59 INFO Diff execution: 11 seconds
2022-12-23 03:51:00 INFO EditScript execution: 0 seconds

NullPointerException in ASTDiff tests

[main] INFO org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl - Processing tmp1/TestCases 1da76a369c988da62c3b826d5c97a047a1f1d1e9 ...
[main] INFO org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl - Processing tmp1/TestCases 0ae8f723a59722694e394300656128f9136ef466 ...
[main] INFO org.refactoringminer.astDiff.matchers.ProjectASTDiffer - ModelDiff.getRefactorings() execution time: 0 seconds
[main] WARN org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl - Ignored revision 0ae8f723a59722694e394300656128f9136ef466 due to error
java.lang.NullPointerException
at com.github.gumtreediff.matchers.heuristic.gt.MappingComparators$SiblingsSimilarityMappingComparator.commonDescendantsNb(MappingComparators.java:102)
at com.github.gumtreediff.matchers.heuristic.gt.MappingComparators$SiblingsSimilarityMappingComparator.compare(MappingComparators.java:86)
at com.github.gumtreediff.matchers.heuristic.gt.MappingComparators$FullMappingComparator.compare(MappingComparators.java:49)
at com.github.gumtreediff.matchers.heuristic.gt.MappingComparators$FullMappingComparator.compare(MappingComparators.java:33)
at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
at java.base/java.util.TimSort.sort(TimSort.java:220)
at java.base/java.util.Arrays.sort(Arrays.java:1515)
at java.base/java.util.ArrayList.sort(ArrayList.java:1750)
at java.base/java.util.Collections.sort(Collections.java:179)
at com.github.gumtreediff.matchers.heuristic.gt.GreedySubtreeMatcher.filterMappings(GreedySubtreeMatcher.java:65)
at com.github.gumtreediff.matchers.heuristic.gt.AbstractSubtreeMatcher.match(AbstractSubtreeMatcher.java:90)
at com.github.gumtreediff.matchers.Matcher.match(Matcher.java:50)
at org.refactoringminer.astDiff.matchers.LeafMatcher.match(LeafMatcher.java:32)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.processLastStepMappings(ProjectASTDiffer.java:135)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.process(ProjectASTDiffer.java:108)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.makeASTDiff(ProjectASTDiffer.java:69)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.diff(ProjectASTDiffer.java:49)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.(ProjectASTDiffer.java:36)
at org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl.diffAtCommit(GitHistoryRefactoringMinerImpl.java:1021)
at org.refactoringminer.astDiff.test.testAllCases.initData(testAllCases.java:58)

NoSuchElementException in MultiMappingStore.isDstMultiMapped(MultiMappingStore.java:56)

2022-10-24 16:02:52 INFO Processing /home/tsantalis/eclipse-workspace/RefactoringMiner 6095e84 ...
Populating File execution: 0 seconds
2022-10-24 16:02:52 INFO RefactoringMiner Started...
2022-10-24 16:03:01 INFO RefactoringMiner ModelDiff execution: 9 seconds
2022-10-24 16:03:01 INFO ModelDiff.getRefactorings() execution time: 0 seconds
2022-10-24 16:03:18 INFO Diff execution: 16 seconds
Exception in thread "main" java.util.NoSuchElementException
at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1513)
at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1534)
at diffTool.matchers.MultiMappingStore.isDstMultiMapped(MultiMappingStore.java:56)
at diffTool.actions.ChawatheScriptGenerator.generate(ChawatheScriptGenerator.java:91)
at diffTool.actions.ChawatheScriptGenerator.computeActions(ChawatheScriptGenerator.java:49)
at diffTool.actions.SimplifiedChawatheScriptGenerator.computeActions(SimplifiedChawatheScriptGenerator.java:21)
at diffTool.actions.ASTDiff.computeEditScript(ASTDiff.java:59)
at diffTool.diff.ProjectASTDiffer.computeAllEditScripts(ProjectASTDiffer.java:128)
at diffTool.diff.ProjectASTDiffer.diff(ProjectASTDiffer.java:120)
at diffTool.Run.main(Run.java:59)

Tree Matching, Min height = 0

ImmutableMap<String, Optional<? extends Element>> deferredElements = deferredElementsBuilder.build(); -> return deferredElements.build();

Given the fact that deferredElements has been renamed to deferredElementsBuilder
Probably we can avoid matching textually similar deferredElements in those statements.

This came from google/auto@8fc60d8, File BasicAnnotationProcessor.java

image

Extract Attribute Cases

image

image

image

image

image

image

image

image

image

Argument mapping cases

The fourth argument of the AdHocPlannerWork Class instance Creation: false in Line 102 parent version
The seventh argument (the last one) of the makeStoredProcAdHocPlannerWork method invocation: false in Line 102 child version

Its two separate 2to1 Mappings:
image

image

image

image

Thanks to @pedramnoori for providing the last 9 cases.

Complex Cases

Dir: community/server/src/main/java/org/neo4j/server/security/

ssl/SslCertificateFactory.java ssl/Certificates.java

MultiMappings must be discussed. @tsantalis

  • Case 2: JetBrains/intellij-community@04397f4
    There is a recursive method checkForTestRoots. @tsantalis Should we match
    Line 139 parent commit testFolders.addAll(ModuleRootManager.getInstance(srcModule).getSourceRoots(JavaSourceRootType.TEST_SOURCE));
    with Line 140 child commit testFolders.addAll(ModuleRootManager.getInstance(module).getSourceRoots(JavaSourceRootType.TEST_SOURCE));?

Line 139 parent is already matched with Line 132 child.
image

Multiple candidates problem

VoltDB/voltdb@669e072
File:TestSystemProcedureSuite.java

project.addLiteralSchema(
                        "CREATE TABLE WAREHOUSE (\n" +
                        "  W_ID SMALLINT DEFAULT '0' NOT NULL,\n" +
                        "  W_NAME VARCHAR(16) DEFAULT NULL,\n" +
                        "  W_STREET_1 VARCHAR(32) DEFAULT NULL,\n" +
                        "  W_STREET_2 VARCHAR(32) DEFAULT NULL,\n" +
                        "  W_CITY VARCHAR(32) DEFAULT NULL,\n" +
                        "  W_STATE VARCHAR(2) DEFAULT NULL,\n" +
                        "  W_ZIP VARCHAR(9) DEFAULT NULL,\n" +
                        "  W_TAX FLOAT DEFAULT NULL,\n" +
                        "  W_YTD FLOAT DEFAULT NULL,\n" +
                        "  CONSTRAINT W_PK_TREE PRIMARY KEY (W_ID)\n" +
                        ");\n" +
                        "CREATE TABLE ITEM (\n" +
                        "  I_ID INTEGER DEFAULT '0' NOT NULL,\n" +
                        "  I_IM_ID INTEGER DEFAULT NULL,\n" +
                        "  I_NAME VARCHAR(32) DEFAULT NULL,\n" +
                        "  I_PRICE FLOAT DEFAULT NULL,\n" +
                        "  I_DATA VARCHAR(64) DEFAULT NULL,\n" +
                        "  CONSTRAINT I_PK_TREE PRIMARY KEY (I_ID)\n" +
                        ");\n" +
                        "CREATE TABLE NEW_ORDER (\n" +
                        "  NO_W_ID SMALLINT DEFAULT '0' NOT NULL\n" +
                        ");\n");

mapped to

project.addLiteralSchema(
                        "CREATE TABLE WAREHOUSE (\n" +
                        "  W_ID SMALLINT DEFAULT '0' NOT NULL,\n" +
                        "  W_NAME VARCHAR(16) DEFAULT NULL,\n" +
                        "  W_STREET_1 VARCHAR(32) DEFAULT NULL,\n" +
                        "  W_STREET_2 VARCHAR(32) DEFAULT NULL,\n" +
                        "  W_CITY VARCHAR(32) DEFAULT NULL,\n" +
                        "  W_STATE VARCHAR(2) DEFAULT NULL,\n" +
                        "  W_ZIP VARCHAR(9) DEFAULT NULL,\n" +
                        "  W_TAX FLOAT DEFAULT NULL,\n" +
                        "  W_YTD FLOAT DEFAULT NULL,\n" +
                        "  CONSTRAINT W_PK_TREE PRIMARY KEY (W_ID)\n" +
                        ");\n" +
                        "CREATE TABLE ITEM (\n" +
                        "  I_ID INTEGER DEFAULT '0' NOT NULL,\n" +
                        "  I_IM_ID INTEGER DEFAULT NULL,\n" +
                        "  I_NAME VARCHAR(32) DEFAULT NULL,\n" +
                        "  I_PRICE FLOAT DEFAULT NULL,\n" +
                        "  I_DATA VARCHAR(64) DEFAULT NULL,\n" +
                        "  CONSTRAINT I_PK_TREE PRIMARY KEY (I_ID)\n" +
                        ");\n" +
                        "CREATE TABLE NEW_ORDER (\n" +
                        "  NO_W_ID SMALLINT DEFAULT '0' NOT NULL\n" +
                        ");\n" +
                        "CREATE TABLE PAUSE_TEST_TBL (\n" +
                        "  TEST_ID SMALLINT DEFAULT '0' NOT NULL\n" +
                        ");\n");

There are multiple candidates for ");\n" which seems to be troublesome.
image

java.lang.IndexOutOfBoundsException

Task :Run.main()

2022-12-13 12:13:27 INFO Processing https://github.com/Graylog2/graylog2-server.git 2ef067fc70055fc4d55c75937303414ddcf07e0e ...
2022-12-13 12:13:28 INFO Connected to GitHub with OAuth token
2022-12-13 12:13:30 INFO Population From GitHub execution: 3 seconds
2022-12-13 12:13:30 INFO RefactoringMiner Started...

2022-12-13 12:13:31 INFO RefactoringMiner ModelDiff execution: 0 seconds
2022-12-13 12:13:32 INFO ModelDiff.getRefactorings() execution time: 0 seconds
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:459)
at diffTool.tree.Tree.getChild(Tree.java:74)
at diffTool.matchers.MultiMappingStore.addMappingRecursively(MultiMappingStore.java:296)
at diffTool.matchers.MultiMappingStore.addMappingRecursively(MultiMappingStore.java:296)
at diffTool.diff.ProjectASTDiffer.processPackageDeclaration(ProjectASTDiffer.java:853)
at diffTool.diff.ProjectASTDiffer.process(ProjectASTDiffer.java:191)
at diffTool.diff.ProjectASTDiffer.makeASTDiff(ProjectASTDiffer.java:148)
at diffTool.diff.ProjectASTDiffer.diff(ProjectASTDiffer.java:124)
at diffTool.Run.main(Run.java:62)

NullPointerException at diffTool.diff.LeafMatcher.pruneTrees(LeafMatcher.java:35)

Task :Run.main()
2022-11-15 01:08:24 INFO Processing /home/tsantalis/eclipse-workspace/RefactoringMiner/tmp1/java-algorithms-implementation f689bf3137fad0ae712e036ed36e00dd3f7cab6b ...
2022-11-15 01:08:24 INFO Processing /home/tsantalis/eclipse-workspace/RefactoringMiner/tmp1/java-algorithms-implementation ab98bcacf6e5bf1c3a06f6bcca68f178f880ffc9 ...
Populating File execution: 0 seconds
2022-11-15 01:08:24 INFO RefactoringMiner Started...
2022-11-15 01:09:42 INFO RefactoringMiner ModelDiff execution: 78 seconds
2022-11-15 01:09:48 INFO ModelDiff.getRefactorings() execution time: 6 seconds
Exception in thread "main" java.lang.NullPointerException
at diffTool.diff.LeafMatcher.pruneTrees(LeafMatcher.java:35)
at diffTool.diff.LeafMatcher.match(LeafMatcher.java:26)
at diffTool.diff.ProjectASTDiffer.processLastStepMappings(ProjectASTDiffer.java:216)
at diffTool.diff.ProjectASTDiffer.process(ProjectASTDiffer.java:206)
at diffTool.diff.ProjectASTDiffer.makeASTDiff(ProjectASTDiffer.java:148)
at diffTool.diff.ProjectASTDiffer.diff(ProjectASTDiffer.java:124)
at diffTool.Run.main(Run.java:58)

Replacement target not found in encoded URL

In class GitHistoryRefactoringMinerImpl in method populateWithGitHubAPI in line:
String rawURLInParentCommit = currentRawURL.toString().replace(currentCommitId, parentCommitId).replace(fileName, previousFilename);
In currentRawURL special characters are encoded so fileName was not found

LocationInfo Problem

Commit: hazelcast/hazelcast@76d7f5e

The locationInfo for the following leaf mapping seems to be incorrect. The problem is most likely in List<Refactoring> getClassDiffRefactorings. It probably returns incorrect class.

  • Extract Method protected startSelectors() : void extracted from public start() : void in class com.hazelcast.client.connection.nio.ClientConnectionManagerImpl
    hazelcast-client/src/main/java/com/hazelcast/client/connection/nio/ClientConnectionManagerImpl.java
    inSelector.start(); LineRange:158-158 Offset:6860-6879
    hazelcast-client/src/main/java/com/hazelcast/client/connection/nio/ClientConnectionManagerImpl.java
    inSelector.start(); LineRange:168-168 Offset:7212-7231

  • Extract Method protected startSelectors() : void extracted from public start() : void in class com.hazelcast.client.connection.nio.ClientConnectionManagerImpl
    hazelcast-client/src/main/java/com/hazelcast/client/connection/nio/ClientConnectionManagerImpl.java
    outSelector.start(); LineRange:159-159 Offset:6888-6908
    hazelcast-client/src/main/java/com/hazelcast/client/connection/nio/ClientConnectionManagerImpl.java
    outSelector.start(); LineRange:169-169 Offset:7240-7260

  • Extract Method protected startSelectors() : void extracted from public start() : void in class com.hazelcast.client.connection.nio.ClientConnectionManagerImpl
    hazelcast-client-new/src/main/java/com/hazelcast/client/connection/nio/ClientConnectionManagerImpl.java
    inSelector.start(); LineRange:159-159 Offset:6929-6948
    hazelcast-client-new/src/main/java/com/hazelcast/client/connection/nio/ClientConnectionManagerImpl.java
    inSelector.start(); LineRange:168-168 Offset:7280-7299

  • Extract Method protected startSelectors() : void extracted from public start() : void in class com.hazelcast.client.connection.nio.ClientConnectionManagerImpl
    hazelcast-client-new/src/main/java/com/hazelcast/client/connection/nio/ClientConnectionManagerImpl.java
    outSelector.start(); LineRange:160-160 Offset:6957-6977
    hazelcast-client-new/src/main/java/com/hazelcast/client/connection/nio/ClientConnectionManagerImpl.java
    outSelector.start(); LineRange:169-169 Offset:7308-7328

Tree Matching Problems

Two subtrees to be matched:

return Arrays.asList(new Object[][] {
			{ new ParameterSet(TimeZone.getTimeZone("UTC")  , inputTimeMap, TimeZone.getTimeZone("UTC")   , "2014-03-30T04:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("UTC")  , inputTimeMap, TimeZone.getTimeZone("CET")   , "2014-03-30T02:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("UTC")  , "2014-03-30T04:58:47UTS"                    , "2014-03-30T04:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("CET")  , inputTimeMap, TimeZone.getTimeZone("UTC")   , "2014-03-30T04:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("CET")  , inputTimeMap, TimeZone.getTimeZone("CET")   , "2014-03-30T02:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("CET")  , "2014-03-30T04:58:47UTS"                    , "2014-03-30T04:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("GMT+2"), inputTimeMap, TimeZone.getTimeZone("GMT+3") , "2014-03-30T01:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("GMT-2"), inputTimeMap, TimeZone.getTimeZone("GMT+3") , "2014-03-30T01:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("GMT-2"), inputTimeMap, TimeZone.getTimeZone("GMT-3") , "2014-03-30T07:58:47") },
		});

&

return Arrays.asList(new Object[][] {
			{ new ParameterSet(TimeZone.getTimeZone("UTC")  , initTimeMap(), TimeZone.getTimeZone("UTC")   , "2014-03-30T10:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("UTC")  , initTimeMap(), TimeZone.getTimeZone("CET")   , "2014-03-30T08:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("UTC")  , "2014-03-30T10:58:47UTS"                    , "2014-03-30T10:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("CET")  , initTimeMap(), TimeZone.getTimeZone("UTC")   , "2014-03-30T12:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("CET")  , initTimeMap(), TimeZone.getTimeZone("CET")   , "2014-03-30T10:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("CET")  , "2014-03-30T10:58:47UTS"                    , "2014-03-30T10:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("GMT"),   initTimeMap(), TimeZone.getTimeZone("GMT")   , "2014-03-30T10:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("GMT+2"), initTimeMap(), TimeZone.getTimeZone("GML") , "2014-03-30T12:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("GMT-2"), initTimeMap(), TimeZone.getTimeZone("GMT+3") , "2014-03-30T05:58:47") },
			{ new ParameterSet(TimeZone.getTimeZone("GMT-2"), initTimeMap(), TimeZone.getTimeZone("GMT-4") , "2014-03-30T12:58:47") },
		});

image

The problem is shown as highlighted! Must be discussed!!!

Two subtrees to be matched:

switch (ast.getType()) {
            case TokenTypes.OBJBLOCK:
            case TokenTypes.SLIST:
            case TokenTypes.LITERAL_FOR:
            case TokenTypes.METHOD_DEF:
            case TokenTypes.CTOR_DEF:
            case TokenTypes.STATIC_INIT:
            case TokenTypes.INSTANCE_INIT:
                scopeStack.push(new HashMap<String, DetailAST>());
                break;

            case TokenTypes.PARAMETER_DEF:
                if (ScopeUtils.inInterfaceBlock(ast)
                    || inAbstractOrNativeMethod(ast)
                    || inLambda(ast)) {
                    break;
                }
            case TokenTypes.VARIABLE_DEF:
                if (ast.getParent().getType() != TokenTypes.OBJBLOCK
                        && shouldCheckEnhancedForLoopVariable(ast)
                        && isVariableInForInit(ast)
                        && !ast.branchContains(TokenTypes.FINAL)) {
                    insertVariable(ast);
                }
                break;

            case TokenTypes.IDENT:
                final int parentType = ast.getParent().getType();
                if (isAssignOperator(parentType)
                        && ast.getParent().getFirstChild() == ast) {
                    removeVariable(ast);
                }
                break;

            default:
        }

&

switch (ast.getType()) {
            case TokenTypes.OBJBLOCK:
            case TokenTypes.SLIST:
            case TokenTypes.LITERAL_FOR:
            case TokenTypes.METHOD_DEF:
            case TokenTypes.CTOR_DEF:
            case TokenTypes.STATIC_INIT:
            case TokenTypes.INSTANCE_INIT:
                scopeStack.push(new HashMap<String, DetailAST>());
                break;

            case TokenTypes.PARAMETER_DEF:
                if (!inLambda(ast)
                        && !ast.branchContains(TokenTypes.FINAL)
                        && !inAbstractOrNativeMethod(ast)
                        && !ScopeUtils.inInterfaceBlock(ast)) {
                    insertVariable(ast);
                }
                break;
            case TokenTypes.VARIABLE_DEF:
                if (ast.getParent().getType() != TokenTypes.OBJBLOCK
                        && isVariableInForInit(ast)
                        && shouldCheckEnhancedForLoopVariable(ast)
                        && !ast.branchContains(TokenTypes.FINAL)) {
                    insertVariable(ast);
                }
                break;

            case TokenTypes.IDENT:
                final int parentType = ast.getParent().getType();
                if (isAssignOperator(parentType)
                        && ast.getParent().getFirstChild() == ast) {
                    removeVariable(ast);
                }
                break;

            default:
        }

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.