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/MostSpecific05.java
Normal file
28
test/langtools/tools/javac/lambda/MostSpecific05.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=MostSpecific05.out -XDrawDiagnostics MostSpecific05.java
|
||||
*/
|
||||
public class MostSpecific05 {
|
||||
|
||||
interface ObjectConverter<T extends Object> {
|
||||
T map(Object o);
|
||||
}
|
||||
|
||||
interface NumberConverter<T extends Number> {
|
||||
T map(Object o);
|
||||
}
|
||||
|
||||
static class MyMapper<A extends Object, B extends Number> {
|
||||
void map(ObjectConverter<? extends A> m) { }
|
||||
void map(NumberConverter<? extends B> m) { }
|
||||
}
|
||||
|
||||
public static void meth() {
|
||||
MyMapper<Number, Double> mm = new MyMapper<Number, Double>();
|
||||
mm.map(e->1.0); //ambiguous - implicit
|
||||
mm.map((Object e)->1.0); //ok
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue