RFR (S) : 8004967 - Default method cause java.lang.VerifyError: Illegal use of nonvirtual function call

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Jan 3 07:47:01 PST 2013


     /* Legality of interface method modifiers for various Java versions
        public:       Required in pre-JAVA_8_VERSION
        abstract:     Required in pre-JAVA_8_VERSION


In the original condition the combination ((is_synchronized || 
is_strict) && is_abstract) was invalid for major_gte_8. Why you don't 
have it?

I would also move common invalid condition outside version checks:

     if (is_native || is_protected || is_final) {
       // Invalid in all class file versions.
       is_illegal = true;
     } else if (major_gte_8) {
       // Class file version is JAVA_8_VERSION or later
       if (is_public == is_private) {
         // Only one of private and public should be true - XNOR
         is_illegal = true;
       }
     } else if (!is_public || !is_abstract ||
                is_private || is_static) {
       // Invalid in pre-JAVA_8_VERSION versions
       is_illegal = true;
     } else if (major_gte_15) {
       // Class file version in the interval [JAVA_1_5_VERSION, 
JAVA_8_VERSION)
       if (is_strict || is_synchronized) {
         is_illegal = true;
       }
     } else {
       // Class file version is pre-JAVA_1_5_VERSION
       if (is_bridge || is_varargs || is_synthetic) {
         is_illegal = true;
       }
     }

Vladimir

On 1/2/13 7:54 AM, Bharadwaj Yadavalli wrote:
> Updated the webrev at
> http://cr.openjdk.java.net/~bharadwaj/8004967/hotspot/webrev/.
>
> Please review the changes.
>
> I re-ran JCK tests and runThese. No new failures.
>
> Thanks,
>
> Bharadwaj
>
> On 12/27/2012 12:49 PM, Vladimir Kozlov wrote:
>> Bharadwaj,
>>
>> I would check for < jdk8 instead of !>=, it is more clear :
>>
>> +       if (! (_major_version >= JAVA_8_VERSION)) {
>>
>> Next should be one line "} else {":
>>
>> +     }
>> +     else {
>>
>> I would move the legality table comment inside "if (is_interface)".
>> Why is_public and is_abstract in your table are illegal before jdk5?
>> The conditions check the opposite.
>>
>> Should you also check for (is_protected) for versions before jdk8? It
>> may be not defined for those versions but for condition completeness
>> we should check. Also I don't see checks for is_bridge, is_varargs,
>> is_synthetic. And what about pre jdk5? I would split >=jdk5 and pre
>> versions to follow the table:
>>
>> if (major_gte_8) {
>>   ...
>> } else if (major_gte_15) {
>>   ...
>> } else {
>>   ...
>> }
>>
>> Thanks,
>> Vladimir
>>
>> On 12/24/12 7:44 AM, Bharadwaj Yadavalli wrote:
>>> I updated legality verification of default methods of a Java 8
>>> interfaces. This update
>>> fixes JDK-8004967 and three other failures in Lambda's test-ng tests.
>>>
>>> I also cleaned up the legality verification of interface methods of
>>> pre-Java 8 interface
>>> methods. I refactored the code by separating the checks depending on the
>>> version
>>> being pre-Java 8 or Java 8 and later.
>>>
>>> Please review the changes at
>>> http://cr.openjdk.java.net/~bharadwaj/8004967/hotspot/webrev/
>>>
>>> Ran api, lang and vm JCK tests; no new failures.
>>>
>>> Thanks,
>>>
>>> Bharadwaj
>>>


More information about the hotspot-runtime-dev mailing list