I have written the following code:
void Test(A a) {
B b = new B(a.getName());
}
So, the constructor of B
expects a String
. It looks like the following:
protected B (String name) {
super(name, KIND);
this.name = name;
}
But a.getName()
gives me a name with Optional<String>
as return value and I do not want to change that. Therefore, I try to change the parameter of the constructor B
(I replace String name
with Optional<String>
), but then Eclipse underlines super(name, KIND)
and this.name = name
with red and Eclipse recommends to change the parameter of the constructor again to String name
.
How can I solve it?
best regards,