Home > database >  Eclipse/Java - deactivate temporarily save action "functional interface instances"
Eclipse/Java - deactivate temporarily save action "functional interface instances"

Time:10-30

I'm using Eclipse IDE programming in Java and usually I don't have any problems with the save action "Functional interface instances: simplify lambda expression and method reference syntax".

However, in this case it changes .map(t -> ensureClosedPeriods(t)) to .map(this::ensureClosedPeriods).

This causes a problem, as the method is static: Cannot use this in a static context.

I really like this save action, but I don't want this to apply to this part of the code.

@formatter:off does not work in this case.

Does anyone know any solution?

CodePudding user response:

It sounds like a bug in the action that is refactoring your code. In terms of "any solution", presumably you could rewrite it like this:

.map(classname::ensureClosedPeriods)

where classname is the name of the class that defines the static method.

  • Related