[foreign-jextract] Integrated: Change error handling strategy in MacroParserImpl's constructor

Jorn Vernee jvernee at openjdk.java.net
Wed Jul 29 14:52:04 UTC 2020


On Wed, 29 Jul 2020 13:40:06 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Hi,
> 
> This patch changes the error handling strategy in MacroParserImpl's constructor.
> 
> When running the tests I ran into cryptic NPEs. It turned out that this was caused due to a failure to create the
> default ClangReparser, which led to an exception, which led to the treeMaker and macroTable fields being left
> uninitialized.  This patch changes these fields to `final` to catch any future problems with not being initialized
> along all paths, as well as factoring out the constructor argument pre-processing into a static factory method, to more
> clearly show that argument pre-processing takes place when creating a MacroParserImpl instance. It also just propagates
> the exception thrown when creating the ClangReparser instead of trying to use a dummy reparser.  Thanks, Jorn

This pull request has now been integrated.

Changeset: f89e5fd2
Author:    Jorn Vernee <jvernee at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/f89e5fd2
Stats:     26 lines in 2 files changed: 9 ins; 9 del; 8 mod

Change error handling strategy in MacroParserImpl's constructor

Reviewed-by: mcimadamore

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

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


More information about the panama-dev mailing list