hg: hsx/hotspot-rt/hotspot: 8005689: InterfaceAccessFlagsTest failures in Lambda-JDK tests

Bharadwaj Yadavalli bharadwaj.yadavalli at oracle.com
Fri Jan 11 08:10:08 PST 2013


Hi David,

Thanks for taking a closer look at this.

I followed the specification at 
http://cr.openjdk.java.net/~dlsmith/jsr335-0.6.1/J.html#JJVMS-4.6 to 
make these changes.

The illegality check I modified/added for Java 8 is as follows:

if (major_gte_8) {
       // Class file version is JAVA_8_VERSION or later Methods of
       // interfaces may set any of the flags except ACC_PROTECTED,
       // ACC_FINAL, ACC_NATIVE, and ACC_SYNCHRONIZED; they must
       // have exactly one of the ACC_PUBLIC or ACC_PRIVATE flags set.
       if ((is_public == is_private) || /* Only one of private and 
public should be true - XNOR */
           (is_native || is_protected || is_final || is_synchronized) ||
           // If a specific method of a class or interface has its
           // ACC_ABSTRACT flag set, it must not have any of its
           // ACC_FINAL, ACC_NATIVE, ACC_PRIVATE, ACC_STATIC,
           // ACC_STRICT, or ACC_SYNCHRONIZED flags set.  No need to
           // check for ACC_FINAL, ACC_NATIVE or ACC_SYNCHRONIZED as
           // those flags are illegal irrespective of ACC_ABSTRACT being 
set or not.
           (is_abstract && (is_private || is_static || is_strict))) {
         is_illegal = true;
       }

On 1/11/2013 12:24 AM, David Holmes wrote:
> It is far from clear to me that this change is correct. If a Java 8 
> interface method is a default method then any of the implementation 
> related modifiers should be valid:
> - strictfp

The above condition does not flag strictfp as illegal and hence is valid.

> - synchronized
>
 From my reading of the spec and conversations with Brian Goetz and Dan 
Smith synchronized is now considered invalid.

> And can't interfaces now also have static methods?
>

Yes, they can and the condition flags a method with static modifier only 
if it also has abstract modifier.

Please let me know if I am missing (or misinterpreting) something.

Thanks,

Bharadwaj



More information about the hotspot-runtime-dev mailing list