--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Jun 09 15:46:44 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Jun 10 12:41:39 2014 -0600
@@ -135,6 +135,7 @@
allowTypeAnnos = source.allowTypeAnnotations();
allowLambda = source.allowLambda();
allowDefaultMethods = source.allowDefaultMethods();
+ allowStaticInterfaceMethods = source.allowStaticInterfaceMethods();
sourceName = source.name;
relax = (options.isSet("-retrofit") ||
options.isSet("-relax"));
@@ -192,6 +193,10 @@
*/
boolean allowDefaultMethods;
+ /** Switch: static interface methods enabled?
+ */
+ boolean allowStaticInterfaceMethods;
+
/** Switch: allow references to surrounding object from anonymous
* objects during constructor call?
*/
@@ -3518,6 +3523,10 @@
tree.pos(), site, sym.name, true);
}
}
+ if (!allowStaticInterfaceMethods && sitesym.isInterface() &&
+ sym.isStatic() && sym.kind == MTH) {
+ log.error(tree.pos(), "static.intf.method.invoke.not.supported.in.source", sourceName);
+ }
} else if (sym.kind != ERR && (sym.flags() & STATIC) != 0 && sym.name != names._class) {
// If the qualified item is not a type and the selected item is static, report
// a warning. Make allowance for the class of an array type e.g. Object[].class)