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

NoSuchElementException in case of Extract Variable with multi-mappings #22

Closed
tsantalis opened this issue Jan 20, 2023 · 1 comment
Closed

Comments

@tsantalis
Copy link

tsantalis commented Jan 20, 2023

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

@tsantalis
Copy link
Author

tsantalis commented Jan 20, 2023

I found another instance of this problem in commit
apache/giraph@03ade42

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.ChawatheScriptGenerator.computeActions(ChawatheScriptGenerator.java:42)
at org.refactoringminer.astDiff.actions.SimplifiedChawatheScriptGenerator.computeActions(SimplifiedChawatheScriptGenerator.java:21)
at org.refactoringminer.astDiff.actions.ASTDiff.computeEditScript(ASTDiff.java:62)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.computeAllEditScripts(ProjectASTDiffer.java:62)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.diff(ProjectASTDiffer.java:56)
at org.refactoringminer.astDiff.matchers.ProjectASTDiffer.(ProjectASTDiffer.java:37)
at org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl.diffAtCommit(GitHistoryRefactoringMinerImpl.java:1021)

tsantalis added a commit to tsantalis/RefactoringMiner that referenced this issue Jan 20, 2023
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

2 participants