RFR: Remove dead code

Jorn Vernee jvernee at openjdk.org
Wed Dec 13 01:44:23 UTC 2023


On Wed, 13 Dec 2023 01:37:29 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Remove the last little bits of dead code. As found through code coverage report.

src/main/java/org/openjdk/jextract/impl/HeaderFileBuilder.java line 71:

> 69:             fiName.ifPresent(s -> emitFunctionalInterfaceGetter(s, javaName));
> 70:         } else {
> 71:             throw new IllegalArgumentException("Tree type not handled: " + varTree.type());

Note that here I'm adding an explicit default branch (which is never taken) for the if/else blocks above, so that when this method is not implemented for a certain type, we don't just silently do nothing.

src/main/java/org/openjdk/jextract/impl/TreeMaker.java line 326:

> 324:     public Declaration.Scoped createEnum(Cursor c) {
> 325:         List<Declaration> decls = new ArrayList<>();
> 326:         c.forEach(child -> decls.add(createTree(child)));

Not sure how we ended up with the current code, but an enum can not contain any bitfields AFAIK.

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

PR Review Comment: https://git.openjdk.org/jextract/pull/158#discussion_r1424747459
PR Review Comment: https://git.openjdk.org/jextract/pull/158#discussion_r1424747712


More information about the jextract-dev mailing list