java 8 - How to use Lombok with cucumber and guice -
this code. using cucumber , guice. want use lombok. using java 8
@scenarioscoped public class volumecreateteststeps { private final volumesummarypage volumesummarypage; private final volumecreatetabs volumecreatetabs; private final volumecreatepropertytab volumecreatepropertytab; @inject public volumecreateteststeps(volumesummarypage volumesummarypage, volumecreatetabs volumecreatetabs, volumecreatepropertytab volumecreatepropertytab) { this.volumesummarypage = volumesummarypage; this.volumecreatetabs = volumecreatetabs; this.volumecreatepropertytab = volumecreatepropertytab; }
no idea cucumber, lombok+guice work together. syntax pretty hacky:
@scenarioscoped @requiredargsconstructor(onconstructor=@__(@inject)) public class volumecreateteststeps { private final volumesummarypage volumesummarypage; private final volumecreatetabs volumecreatetabs; private final volumecreatepropertytab volumecreatepropertytab; }
this funny onconstructor=@__(@inject)
using undefined annotation names "two underscores" major hack, works me since java 5. currently, i'm using lombok 1.16.12 java 8. guess, java 9, there's problem, newest lombok version uses different hack:
onconstructor_=@inject
note trailing underscore.
Comments
Post a Comment