[foreign-jextract] RFR: 8265211: Print specific error message when an option parsing error occurs

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Apr 14 12:59:33 UTC 2021


On Wed, 14 Apr 2021 12:03:04 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Hi,
>> 
>> This patch makes jextract print a more specific error message when an option parsing error occurs, where currently only the help message is printed.
>> 
>> For instance, when using an unrecognized option `-o` it will print
>> 
>> 
>> OPTION ERROR: o is not a recognized option
>> 
>> 
>> Or when specifying multiple header files
>> 
>> 
>> OPTION ERROR: Expected 1 header file, not 3
>> 
>> 
>> Thanks,
>> Jorn
>
> As discussed offline, might be helpful to print help from `printOptonError` anyway.

> @mcimadamore The help message is quite noisy because it's so large

True - I also checked with other launchers:


$ java -f
Unrecognized option: -f
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

$ javac -f
error: invalid flag: -f
Usage: javac <options> <source files>
use --help for a list of possible options



Of theses, I think javac gets it right.

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/500


More information about the panama-dev mailing list