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

Bharadwaj Yadavalli bharadwaj.yadavalli at oracle.com
Thu Dec 27 11:43:35 PST 2012


Thanks for your review, Vladimir.

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)) {
>
OK.
> Next should be one line "} else {":
>
> +     }
> +     else {
>
OK.
> I would move the legality table comment inside "if (is_interface)". 
OK.
> Why is_public and is_abstract in your table are illegal before jdk5? 
> The conditions check the opposite.
>
I'll change the comment. I believe that they should be legal across all 
JDK versions.

> Should you also check for (is_protected) for versions before jdk8? 

I thought about that. But, for now, as I am not aware of the history 
about its apparent omission in the original code, I took the 
conservative route of retaining the code that has been working for all 
pre-Java 8 versions (see the diff at 
http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/diff/4735d2c84362/src/share/vm/classfile/classFileParser.cpp). 
That was also the reason why I did the refactoring as:

if (major_gte_8) {
    ...
} else {
   /* Working code */
    ...
}

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

Yes, that would be ideal. I will try to get some more definitive 
information about the legality of all the interface method modifiers for 
all supported Java versions. I would be grateful if anyone on the 
mailing list has the information and can provide the same.

Thanks,

Bharadwaj



More information about the hotspot-runtime-dev mailing list