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

David Holmes david.holmes at oracle.com
Sun Jan 13 16:32:36 PST 2013


On 12/01/2013 2:10 AM, Bharadwaj Yadavalli wrote:
> 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.

Sorry I had trouble reading the condition. I see now it is only the 
combination of abstract and strictfp that is illegal - as it should be.

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

Something I need to take up with them then, it makes no sense to outlaw 
synchronized when you can code a synchronized block in the method anyway.

>> 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.

Again I misread the condition.

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

Thanks,
David

> Thanks,
>
> Bharadwaj
>


More information about the serviceability-dev mailing list