Script for automatically adding initializers

Hi,

we have an example solution with plain Java code. At some point of development, we applied quick fixes after type checking. The problem is that this removed initializers of for instance variable declarations. Now the compiler complaints about non-initialized variables: "The local variable test may not have been initialized".

Is there something like a script that automatically adds initializers?

Thanks and cheers

Ben

 

2 comments

You can use the MPS console to execute a command. See https://www.youtube.com/watch?v=nPQ-3o7MfPc to get an idea about how it works.

Also, do you remember what fix you applied or what were the typechecking problems? Sounds like the fix shouldn't have removed the initializers so we should fix the fix :)

0

Thanks for the hint! We already identified the problem and it was not related MPS's core. In particular, we use a language that adds variability to BaseLanguage (in the sense of SPL engineering) and data flow analysis was not variability-aware. So no need to fix the fix :D 

0

Please sign in to leave a comment.