undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com Patches, unit tests, benchmarks, whitepaper, and outreach briefs. Public domain — no copyright claimed. Use freely.
This commit is contained in:
commit
0a580b313d
70422 changed files with 17213626 additions and 0 deletions
28
test/langtools/tools/javac/lambda/MostSpecific04.java
Normal file
28
test/langtools/tools/javac/lambda/MostSpecific04.java
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8003280
|
||||
* @summary Add lambda tests
|
||||
* Structural most specific doesn't handle cases with wildcards in functional interfaces
|
||||
* @compile/fail/ref=MostSpecific04.out -XDrawDiagnostics MostSpecific04.java
|
||||
*/
|
||||
public class MostSpecific04 {
|
||||
|
||||
interface DoubleMapper<T> {
|
||||
double map(T t);
|
||||
}
|
||||
|
||||
interface LongMapper<T> {
|
||||
long map(T t);
|
||||
}
|
||||
|
||||
static class MyList<E> {
|
||||
void map(DoubleMapper<? super E> m) { }
|
||||
void map(LongMapper<? super E> m) { }
|
||||
}
|
||||
|
||||
public static void meth() {
|
||||
MyList<String> ls = new MyList<String>();
|
||||
ls.map(e->e.length()); //ambiguous - implicit
|
||||
ls.map((String e)->e.length()); //ok
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue