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

changeset 1513
cf84b07a82db
parent 1510
7873d37f5b37
child 1521
71f35e4b93a5
equal deleted inserted replaced
1512:b12ffdfa1341 1513:cf84b07a82db
952 952
953 if (tree.body == null) { 953 if (tree.body == null) {
954 // Empty bodies are only allowed for 954 // Empty bodies are only allowed for
955 // abstract, native, or interface methods, or for methods 955 // abstract, native, or interface methods, or for methods
956 // in a retrofit signature class. 956 // in a retrofit signature class.
957 if (isDefaultMethod || ((owner.flags() & INTERFACE) == 0 && 957 if (isDefaultMethod || (tree.sym.flags() & (ABSTRACT | NATIVE)) == 0 &&
958 (tree.mods.flags & (ABSTRACT | NATIVE)) == 0) &&
959 !relax) 958 !relax)
960 log.error(tree.pos(), "missing.meth.body.or.decl.abstract"); 959 log.error(tree.pos(), "missing.meth.body.or.decl.abstract");
961 if (tree.defaultValue != null) { 960 if (tree.defaultValue != null) {
962 if ((owner.flags() & ANNOTATION) == 0) 961 if ((owner.flags() & ANNOTATION) == 0)
963 log.error(tree.pos(), 962 log.error(tree.pos(),
3479 } 3478 }
3480 } 3479 }
3481 env.info.defaultSuperCallSite = null; 3480 env.info.defaultSuperCallSite = null;
3482 } 3481 }
3483 3482
3483 if (sym.isStatic() && site.isInterface()) {
3484 Assert.check(env.tree.hasTag(APPLY));
3485 JCMethodInvocation app = (JCMethodInvocation)env.tree;
3486 if (app.meth.hasTag(SELECT) &&
3487 !TreeInfo.isStaticSelector(((JCFieldAccess)app.meth).selected, names)) {
3488 log.error(env.tree.pos(), "illegal.static.intf.meth.call", site);
3489 }
3490 }
3491
3484 // Compute the identifier's instantiated type. 3492 // Compute the identifier's instantiated type.
3485 // For methods, we need to compute the instance type by 3493 // For methods, we need to compute the instance type by
3486 // Resolve.instantiate from the symbol's type as well as 3494 // Resolve.instantiate from the symbol's type as well as
3487 // any type arguments and value arguments. 3495 // any type arguments and value arguments.
3488 noteWarner.clear(); 3496 noteWarner.clear();

mercurial