lombok getters/setters in .class file, not able to parse file with getter setter

221 views
Skip to first unread message

naman.v...@via.com

unread,
Apr 7, 2016, 2:33:38 AM4/7/16
to j2objc-discuss
Hi

I have used lombok jar in my java code and used getters/setters in some files. And when I am trying to compile those files j2objc compiler gives "method not found" error.

Is there a workaround for this?

I am getting the errors in fares.getTotalFareDetail() and fares.setTotalFareDetail(new HashMap<FareType, FareValue>());

FareDetail class also have getters/setters for the variables.

Code:


import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class SearchResultJourneyDetail extends JourneyDetail {
private FareDetails fares;
@WebSerializedName("allowBlocking")
private Boolean isBlockingAllowed;
@WebSerializedName("allowUpgrade")
private Boolean isUpgradeAllowed;
@WebSerializedName("isMultiCar")
private Boolean isMultiCar;

public void putTotalFareDetail(FareType type, FareValue fareValue) {
if (fares == null) {
fares = new FareDetails();
}
if (fares.getTotalFareDetail() == null) {
fares.setTotalFareDetail(new HashMap<FareType, FareValue>());
}
fares.getTotalFareDetail().put(type, fareValue);
}
}

Kirk Vogen

unread,
Apr 7, 2016, 12:10:56 PM4/7/16
to j2objc-discuss, naman.v...@via.com
It looks like Lombok does it as part of compilation to bytecode. Since J2ObjC doesn't operate on bytecode, that's probably why it can't find the methods when the transpilation occurs.

It looks like there is a way to get Lombok to actually generate the getter/setter into the source code. If you run delombok prior to J2ObjC and have J2ObjC use the generated code instead of the original code, it should be possible to solve the problem.

naman.v...@via.com

unread,
Apr 7, 2016, 2:45:27 PM4/7/16
to j2objc-discuss
Thank you for the reply.
I have solved the above issue by using delombok.
Reply all
Reply to author
Forward
0 new messages