-
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): Consider spread parameters for score calculat…
…ion (#48) In the filter condition there was a missing case in which the method contains spread parameters, which is a different token identifier.
- Loading branch information
Showing
5 changed files
with
163 additions
and
1 deletion.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
bin/tests/scenarios/overload_methods_with_spread_parameter/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,51 @@ | ||
package de.fosd.jdime; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.StringReader; | ||
import java.net.URL; | ||
import java.util.Arrays; | ||
import java.util.Iterator; | ||
|
||
import org.junit.BeforeClass; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.junit.Assert.fail; | ||
|
||
public class JDimeTest { | ||
protected static File file(File parent, String child) { | ||
File f = new File(parent, child); | ||
assertTrue(f + " does not exist.", f.exists()); | ||
|
||
return f; | ||
} | ||
|
||
protected static File file(File parent, String name, String... names) { | ||
|
||
if (names != null) { | ||
String path = String.format("%s/%s", name, String.join("/", names)); | ||
return file(parent, path); | ||
} else { | ||
return file(parent, name); | ||
} | ||
} | ||
|
||
protected static File file(String path) throws Exception { | ||
URL res = JDimeTest.class.getResource(path); | ||
|
||
assertNotNull("The file " + path + " was not found.", res); | ||
return new File(res.toURI()); | ||
} | ||
|
||
protected static File file(String name, String... names) throws Exception { | ||
|
||
if (names != null) { | ||
String path = String.format("/%s/%s", name, String.join("/", names)); | ||
return file(path); | ||
} else { | ||
return file("/" + name); | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
bin/tests/scenarios/overload_methods_with_spread_parameter/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,54 @@ | ||
package de.fosd.jdime; | ||
|
||
import java.io.File; | ||
import java.net.URISyntaxException; | ||
import java.net.URL; | ||
import java.util.Arrays; | ||
|
||
import org.junit.BeforeClass; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.junit.Assert.fail; | ||
|
||
public class JDimeTest { | ||
protected static File file(File parent, String child) { | ||
File f = new File(parent, child); | ||
assertTrue(f + " does not exist.", f.exists()); | ||
|
||
return f; | ||
} | ||
|
||
protected static File file(File parent, String name, String... names) { | ||
|
||
if (names != null) { | ||
String path = String.format("%s/%s", name, String.join("/", names)); | ||
return file(parent, path); | ||
} else { | ||
return file(parent, name); | ||
} | ||
} | ||
|
||
protected static File file(String path) { | ||
URL res = JDimeTest.class.getResource(path); | ||
|
||
assertNotNull("The file " + path + " was not found.", res); | ||
|
||
try { | ||
return new File(res.toURI()); | ||
} catch (URISyntaxException e) { | ||
fail(e.getMessage()); | ||
return null; | ||
} | ||
} | ||
|
||
protected static File file(String name, String... names) { | ||
|
||
if (names != null) { | ||
String path = String.format("/%s/%s", name, String.join("/", names)); | ||
return file(path); | ||
} else { | ||
return file("/" + name); | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
bin/tests/scenarios/overload_methods_with_spread_parameter/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 ; import java . io . File ; import java . net . URISyntaxException ; import java . net . URL ; import java . util . Arrays ; import org . junit . BeforeClass ; import static org . junit . Assert . assertNotNull ; import static org . junit . Assert . assertTrue ; import static org . junit . Assert . fail ; public class JDimeTest { protected static File file ( File parent , String child ) { File f = new File ( parent , child ) ; assertTrue ( f + " does not exist." , f . exists ( ) ) ; return f ; } protected static File file ( File parent , String name , String ... names ) { if ( names != null ) { String path = String . format ( "%s/%s" , name , String . join ( "/" , names ) ) ; return file ( parent , path ) ; } else { return file ( parent , name ) ; } } protected static File file ( String path ) { URL res = JDimeTest . class . getResource ( path ) ; assertNotNull ( "The file " + path + " was not found." , res ) ; try { return new File ( res . toURI ( ) ) ; } catch ( URISyntaxException e ) { fail ( e . getMessage ( ) ) ; return null ; } } protected static File file ( String name , String ... names ) { if ( names != null ) { String path = String . format ( "/%s/%s" , name , String . join ( "/" , names ) ) ; return file ( path ) ; } else { return file ( "/" + name ) ; } } } |
54 changes: 54 additions & 0 deletions
54
bin/tests/scenarios/overload_methods_with_spread_parameter/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,54 @@ | ||
package de.fosd.jdime; | ||
|
||
import java.io.File; | ||
import java.net.URISyntaxException; | ||
import java.net.URL; | ||
import java.util.Arrays; | ||
|
||
import org.junit.BeforeClass; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.junit.Assert.fail; | ||
|
||
public class JDimeTest { | ||
protected static File file(File parent, String child) { | ||
File f = new File(parent, child); | ||
assertTrue(f + " does not exist.", f.exists()); | ||
|
||
return f; | ||
} | ||
|
||
protected static File file(File parent, String name, String... names) { | ||
|
||
if (names != null) { | ||
String path = String.format("%s/%s", name, String.join("/", names)); | ||
return file(parent, path); | ||
} else { | ||
return file(parent, name); | ||
} | ||
} | ||
|
||
protected static File file(String path) { | ||
URL res = JDimeTest.class.getResource(path); | ||
|
||
assertNotNull("The file " + path + " was not found.", res); | ||
|
||
try { | ||
return new File(res.toURI()); | ||
} catch (URISyntaxException e) { | ||
fail(e.getMessage()); | ||
return null; | ||
} | ||
} | ||
|
||
protected static File file(String name, String... names) { | ||
|
||
if (names != null) { | ||
String path = String.format("/%s/%s", name, String.join("/", names)); | ||
return file(path); | ||
} else { | ||
return file("/" + name); | ||
} | ||
} | ||
} |
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