When I moved over to use Guice instead of just static singletons I already knew I was going to have to still use those static singletons in some instances. Today I discovered I will have to use it for the Language object. It seems even if you create it outside of the Host IDEA. The Langauge class you inherit from still prohibits you to create more then one with the same name anyway. (I was trying to just go new FxLangauge() in my unit test and since the Tokens already created a instance it all went haywire). So I moved it to a constant on FxLanguage.INSTANCE. I still think it’s better then the way the examples are done with for instance GroovyFileType.LANGUAGE. I think there might be more places where I will have to do this and then so be it. I’m still going to be on the lookout if there’s another way to solve it.
0 Responses to “FxLanguage not as singleton in guice but as constant somewhere”