Summary: Since Java8, interfaces mays contain implementations (default methods). We modify the resolve algorith in the Java frontend to take care of that. Reviewed By: jvillard Differential Revision: D21785182 fbshipit-source-id: ffab8124cmaster
parent
1459505540
commit
dbdd4413a7
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
interface I {
|
||||
default Object defaultMethod1() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default Object defaultMethod2() {
|
||||
return "foo";
|
||||
}
|
||||
}
|
||||
|
||||
public class DefaultInInterface implements I {
|
||||
|
||||
public void bad() {
|
||||
System.out.println(this.defaultMethod1().toString());
|
||||
}
|
||||
|
||||
public void ok() {
|
||||
System.out.println(this.defaultMethod2().toString());
|
||||
}
|
||||
}
|
Loading…
Reference in new issue