Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lombokissues opened this issue Jul 14, 2015 · 4 comments
Assignees

Comments

@lombokissues
Copy link

Migrated from Google Code (issue 381)

@lombokissues
Copy link
Author

👤 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
Copy link
Author

👤 pe.fips   🕗 Jun 24, 2012 at 18:45 UTC

Fixed with commit 8fb4f79

@lombokissues
Copy link
Author

👤 r.spilker   🕗 Jun 25, 2012 at 20:50 UTC

@lombokissues
Copy link
Author

End of migration

lianhaijun pushed a commit to lianhaijun/lombok that referenced this issue May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants