Delombok of sneakythrows in constructors causes build failure with super() #454

Closed
lombokissues opened this Issue Jul 14, 2015 · 4 comments

Projects

None yet

2 participants

@lombokissues
Collaborator

Migrated from Google Code (issue 381)

@lombokissues
Collaborator

๐Ÿ‘ค chris.alexander@import.io ย  ๐Ÿ•— Jun 20, 2012 at 16:03 UTC

Just came across an interesting issue using delombok as part of our build process (for various reasons, don't ask!).

This code (where AbstractField is the constructor):

@ SneakyThrows(UnknownCustomTypeException.class)
public AbstractField(FieldParameter parameter, JsonSchema jsonSchema) {
super();
{{rest of constructor}}
}

Is translated by Delombok to:

public AbstractField(FieldParameter parameter, JsonSchema jsonSchema) {
try {
super();
{{rest of constructor}}
} catch (final UnknownCustomTypeException $ex) {
throw lombok.Lombok.sneakyThrow($ex);
}
}

Clearly this is invalid as the super() needs to be before the try { otherwise it fails to compile, "Constructor call must be the first statement in a constructor" etc.

@lombokissues
Collaborator

๐Ÿ‘ค pe.fips ย  ๐Ÿ•— Jun 24, 2012 at 18:45 UTC

Fixed with commit 8fb4f79

@lombokissues
Collaborator

๐Ÿ‘ค r.spilker ย  ๐Ÿ•— Jun 25, 2012 at 20:50 UTC

@lombokissues
Collaborator

End of migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment