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

Comments

Projects
None yet
2 participants
@lombokissues
Collaborator

lombokissues commented Jul 14, 2015

Migrated from Google Code (issue 381)

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

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.

Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

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

Fixed with commit 8fb4f79

Collaborator

lombokissues commented Jul 14, 2015

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

Fixed with commit 8fb4f79

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

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

Collaborator

lombokissues commented Jul 14, 2015

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

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

End of migration

Collaborator

lombokissues commented Jul 14, 2015

End of migration

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