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

Jorn Vernee jvernee at openjdk.java.net
Wed Jul 29 14:48:30 UTC 2020


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

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

Commit messages:
 - Remove redundant Reparser interface
 - Change error handling strategy in MacroParserImpl's constructor

Changes: https://git.openjdk.java.net/panama-foreign/pull/273/files
 Webrev: https://webrevs.openjdk.java.net/panama-foreign/273/webrev.00
  Stats: 26 lines in 2 files changed: 9 ins; 9 del; 8 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/273.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/273/head:pull/273

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


More information about the panama-dev mailing list