Using java.util.collections classes in generator

I am trying to create a generator that outputs java code for my language, but I'm running into the problem that I can't figure out how to use a java.util.collections class (LinkedList / ArrayList etc). MPS lets me put linkedlist as the type for a generated node, but then there is no textgen for that, which makes me believe I am mis-using that type (same with map). What do I need to do in order to have my generated java code using arraylist etc?


(I searched the forum for other things related to this issue but could not find a post that spelled out exactly what I am either misunderstanding or doing wrong)
Solved my own problem, in my generator properties->common->imported models I imported "java.util@java_stub (JDK)", and now the collections classes are showing up in my generator.
I've the same problem with 'map' in Generator... I would like to use'em instead of fallbacking on java.util.*

Furthermore, in MPS2.0 Generator/properties/common accepts jars only... So I should import the sdk itself in my model! Which is inconsistent since the SDK itself has been modelized in baseLanguage :-/

Please could you help me on this, here is the real errors:
  private <!TextGen not found for 'jetbrains.mps.baseLanguage.collections.structure.MapType'!> connections = new <!TextGen not found for 'jetbrains.mps.baseLanguage.collections.structure.HashMapCreator'!>;

private map<string, list<string>> connections = new hashmap<string, list<string>>;    

     <!TextGen not found for 'jetbrains.mps.baseLanguage.collections.structure.MapElement'!> = new <!TextGen not found for 'jetbrains.mps.baseLanguage.collections.structure.ListCreatorWithInit'!>;

connections[connectionName] = new arraylist<string>{login, password};
I had this problem too.
Evgeny Gryaznov was kind enough to give a solution.

Plz feel free to contact me if you need further help.
Here you are using our collections language.

The expected generation workflow:
1. apply your generator (which produces collections)
2. reduce collections language -> java collections api
3. save to .java

In terms of languages:
[program in your language] —> [in baseLanguage + collections]
     —> [in baseLanguage] —> .java files

But since you didn't specify that your language produces collection language, your generator could be inserted at random step. The workflow could look like:

1. reduce collections language -> java collections api
2. apply your generator (produces collections which will never be reduced)
3. save to .java (failure, non-java elements found)

The solution:
Add a priority rule (see Generator -> Properties) that your generator is <= than collections generator.

Please sign in to leave a comment.