-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(matching_handlers): Incorrect calculation of matching score for m…
…ethod declarations (#45) An issue arose when calculating matching scores with method signatures that had more subtle type arguments. In the failing test before this change, the final keyword caused the matching score calculator to break because the naive implementation was fetching the first child of the formal_parameter node. The implementation has been altered so that all children are considered except for the identifier one, which should not be taken into account anyway.
- Loading branch information
Showing
5 changed files
with
200 additions
and
3 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
bin/tests/scenarios/fancy_argument_types_matching_issue/base.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package de.fosd.jdime.common; | ||
|
||
import AST.*; | ||
|
||
public class ASTNodeArtifact extends Artifact<ASTNodeArtifact> { | ||
private ASTNodeArtifact(final ASTNode<?> astnode) { | ||
assert (astnode != null); | ||
this.astnode = astnode; | ||
|
||
this.initializeChildren(); | ||
} | ||
|
||
public ASTNodeArtifact(final FileArtifact artifact) { | ||
assert (artifact != null); | ||
|
||
setRevision(artifact.getRevision()); | ||
|
||
ASTNode<?> astnode; | ||
if (artifact.isEmpty()) { | ||
astnode = new ASTNode<>(); | ||
} else { | ||
Program p = initProgram(); | ||
p.addSourceFile(artifact.getPath()); | ||
astnode = p; | ||
} | ||
|
||
this.astnode = astnode; | ||
this.initializeChildren(); | ||
renumberTree(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
bin/tests/scenarios/fancy_argument_types_matching_issue/left.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package de.fosd.jdime.common; | ||
|
||
import AST.*; | ||
import de.fosd.jdime.common.operations.ConflictOperation; | ||
|
||
public class ASTNodeArtifact extends Artifact<ASTNodeArtifact> { | ||
private ASTNodeArtifact(final ASTNode<?> astnode) { | ||
assert (astnode != null); | ||
this.astnode = astnode; | ||
|
||
this.initializeChildren(); | ||
} | ||
|
||
public ASTNodeArtifact(final FileArtifact artifact) { | ||
assert (artifact != null); | ||
|
||
setRevision(artifact.getRevision()); | ||
|
||
ASTNode<?> astnode; | ||
if (artifact.isEmpty()) { | ||
astnode = new ASTNode<>(); | ||
} else { | ||
Program p = initProgram(); | ||
p.addSourceFile(artifact.getPath()); | ||
astnode = p; | ||
} | ||
|
||
this.astnode = astnode; | ||
this.initializeChildren(); | ||
renumberTree(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
bin/tests/scenarios/fancy_argument_types_matching_issue/merge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package de . fosd . jdime . common ; import de . fosd . jdime . common . operations . AddOperation ; import AST . * ; import de . fosd . jdime . common . operations . ConflictOperation ; public class ASTNodeArtifact extends Artifact < ASTNodeArtifact > { private ASTNodeArtifact ( final ASTNode < ? > astnode ) { assert ( astnode != null ) ; this . astnode = astnode ; this . initializeChildren ( ) ; } public ASTNodeArtifact ( final FileArtifact artifact ) { assert ( artifact != null ) ; setRevision ( artifact . getRevision ( ) ) ; ASTNode < ? > astnode ; if ( artifact . isEmpty ( ) ) { astnode = new ASTNode < > ( ) ; } else { Program p = initProgram ( ) ; p . addSourceFile ( artifact . getPath ( ) ) ; astnode = p ; } this . astnode = astnode ; this . initializeChildren ( ) ; renumberTree ( ) ; } } |
32 changes: 32 additions & 0 deletions
32
bin/tests/scenarios/fancy_argument_types_matching_issue/right.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package de.fosd.jdime.common; | ||
|
||
import de.fosd.jdime.common.operations.AddOperation; | ||
import AST.*; | ||
|
||
public class ASTNodeArtifact extends Artifact<ASTNodeArtifact> { | ||
private ASTNodeArtifact(final ASTNode<?> astnode) { | ||
assert (astnode != null); | ||
this.astnode = astnode; | ||
|
||
this.initializeChildren(); | ||
} | ||
|
||
public ASTNodeArtifact(final FileArtifact artifact) { | ||
assert (artifact != null); | ||
|
||
setRevision(artifact.getRevision()); | ||
|
||
ASTNode<?> astnode; | ||
if (artifact.isEmpty()) { | ||
astnode = new ASTNode<>(); | ||
} else { | ||
Program p = initProgram(); | ||
p.addSourceFile(artifact.getPath()); | ||
astnode = p; | ||
} | ||
|
||
this.astnode = astnode; | ||
this.initializeChildren(); | ||
renumberTree(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters