beagle
beagle

Reputation: 154

How to revert Java 10 "use local varaible type inference" via save actions?

I checked out the Java 10 option of "use local variable type inference" (JEP 286), but I think it is terrible to replace all type information with just the keyword var - was so much better to know what type you're currently working on.

Is there an option to revert this over a bunch of projects via save actions?

Just un-checking that option in Eclipse settings is not working, I would have to change all variables by hand.

Addon:

We changed that 2 month ago and we add a lot of things since we did that. We can not just rollback that single change anymore. Further it is replaced in more then 50 projects. So the option with source repo is not possible -> most of the changes which are done by save actions can be reverted with just deactivating that feature there -> this thing apparently not, so be careful. Please avoid discussing about "var" is useful or not, there are different threads about that topic and we made our decision already based on 2 month experience.

Upvotes: -1

Views: 60

Answers (2)

beagle
beagle

Reputation: 154

Ok,I found finally a solution for that. I had to use IntellyJ, but there is a free community version so not a big thing.

Further I had to change the following settings in intelliJs preferences. Search for "type var", change java 10 settings to activate implicit type usage, activate warnings to highlight the findings

picture of how to change settings

Scan all Projects that should be changed by clicking on one of the var declarations. There are extra options behind the ">" sign to scan the whole structure.:

picture of how to search the whole structure

Replace all findings in the context window below code:

picture of how all findings gets fixed automatically

Upvotes: 0

nitind
nitind

Reputation: 20013

No, there is not. Use source control next time.

Upvotes: -1

Related Questions