Skip to content

Commit

Permalink
Metamodel: use a module list view to avoid concurrent exceptions #347
Browse files Browse the repository at this point in the history
  • Loading branch information
FroMage committed Apr 10, 2014
1 parent 63e0aa7 commit 9247a14
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -761,9 +761,11 @@ public static int getVariadicParameter(List<Parameter> parameters) {
public static Sequential<? extends ceylon.language.meta.declaration.Module> getModuleList() {
// FIXME: this probably needs synchronisation to avoid new modules loaded during traversal
Set<com.redhat.ceylon.compiler.typechecker.model.Module> modules = moduleManager.getContext().getModules().getListOfModules();
ceylon.language.meta.declaration.Module[] array = new ceylon.language.meta.declaration.Module[modules.size()];
com.redhat.ceylon.compiler.typechecker.model.Module[] view = new com.redhat.ceylon.compiler.typechecker.model.Module[modules.size()];
modules.toArray(view);
ceylon.language.meta.declaration.Module[] array = new ceylon.language.meta.declaration.Module[view.length];
int i=0;
for(com.redhat.ceylon.compiler.typechecker.model.Module module : modules){
for(com.redhat.ceylon.compiler.typechecker.model.Module module : view){
array[i++] = getOrCreateMetamodel(module);
}
return Util.sequentialInstance(Module.$TypeDescriptor$, array);
Expand Down

0 comments on commit 9247a14

Please sign in to comment.