src/share/classes/com/sun/tools/javac/comp/Attr.java

changeset 1513
cf84b07a82db
parent 1510
7873d37f5b37
child 1521
71f35e4b93a5
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jan 21 20:15:16 2013 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jan 21 20:19:53 2013 +0000
     1.3 @@ -954,8 +954,7 @@
     1.4                  // Empty bodies are only allowed for
     1.5                  // abstract, native, or interface methods, or for methods
     1.6                  // in a retrofit signature class.
     1.7 -                if (isDefaultMethod || ((owner.flags() & INTERFACE) == 0 &&
     1.8 -                    (tree.mods.flags & (ABSTRACT | NATIVE)) == 0) &&
     1.9 +                if (isDefaultMethod || (tree.sym.flags() & (ABSTRACT | NATIVE)) == 0 &&
    1.10                      !relax)
    1.11                      log.error(tree.pos(), "missing.meth.body.or.decl.abstract");
    1.12                  if (tree.defaultValue != null) {
    1.13 @@ -3481,6 +3480,15 @@
    1.14              env.info.defaultSuperCallSite = null;
    1.15          }
    1.16  
    1.17 +        if (sym.isStatic() && site.isInterface()) {
    1.18 +            Assert.check(env.tree.hasTag(APPLY));
    1.19 +            JCMethodInvocation app = (JCMethodInvocation)env.tree;
    1.20 +            if (app.meth.hasTag(SELECT) &&
    1.21 +                    !TreeInfo.isStaticSelector(((JCFieldAccess)app.meth).selected, names)) {
    1.22 +                log.error(env.tree.pos(), "illegal.static.intf.meth.call", site);
    1.23 +            }
    1.24 +        }
    1.25 +
    1.26          // Compute the identifier's instantiated type.
    1.27          // For methods, we need to compute the instance type by
    1.28          // Resolve.instantiate from the symbol's type as well as

mercurial