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
40
test/langtools/tools/javac/lambda/MethodReference37.java
Normal file
40
test/langtools/tools/javac/lambda/MethodReference37.java
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8003280 8081271
|
||||
* @summary Add lambda tests
|
||||
* spurious exceptions when checking references to inner constructors where
|
||||
* the enclosing class is not defined in any outer context
|
||||
* @compile/fail/ref=MethodReference37.out -XDrawDiagnostics MethodReference37.java
|
||||
*/
|
||||
|
||||
class MethodReference37 {
|
||||
|
||||
interface SAM1<R> {
|
||||
R invoke();
|
||||
}
|
||||
|
||||
interface SAM2<R, A> {
|
||||
R invoke(A a);
|
||||
}
|
||||
|
||||
static class Outer {
|
||||
class Inner { }
|
||||
|
||||
void test1() {
|
||||
SAM2<Inner, Outer> sam = Inner::new;
|
||||
}
|
||||
|
||||
void test2() {
|
||||
SAM1<Inner> sam0 = Inner::new;
|
||||
SAM2<Inner, Outer> sam1 = Inner::new;
|
||||
}
|
||||
}
|
||||
|
||||
static void test1() {
|
||||
SAM2<Outer.Inner, Outer> sam = Outer.Inner::new;
|
||||
}
|
||||
|
||||
void test2() {
|
||||
SAM2<Outer.Inner, Outer> sam1 = Outer.Inner::new;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue