RFR: JDK-8230776: Javac throws AssertionError in jvm.Gen.visitExec

Jan Lahoda jan.lahoda at oracle.com
Wed Aug 26 08:26:25 UTC 2020


Hi Vicente,

I am sorry, but I don't think this is a fix on a good place.

The root cause here is that the classfile for Test has an invalid method 
descriptor for the Test's constructor (returns float instead of void). 
See JVMS 4.6., descriptor_index. I think it would be much better to 
validate method descriptors, and reject classfiles with descriptors not 
adhering to JVMS. The user would then get a much more helpful error, 
saying something like:
---
Sub.java:1: error: cannot access Test
class Sub extends Test {}
                   ^
   bad class file: 
/home/jlahoda/src/jdk/jdk/build/linux-x86_64-server-release/nb-jtreg/work/classes/tools/javac/T8230776/AssertionErrorTest.d/Test.class
     method descriptor invalid for <init>
     Please remove or make sure it appears in the correct subdirectory 
of the classpath.
1 error
---

What do you think?

Jan

On 25. 08. 20 19:23, Vicente Romero wrote:
> Please review fix for [1] at [2]. The fix is ending the compilation at 
> the code generation phase if a statement cant be generated and there is 
> no way for the compilation to continue.
> 
> Thanks,
> Vicente
> 
> [1] https://bugs.openjdk.java.net/browse/JDK-8230776
> [2] http://cr.openjdk.java.net/~vromero/8230776/webrev.00/


More information about the compiler-dev mailing list