@ Check public void checkTopElementsAreUnique ( SarlScript script ) { final Multimap < String , XtendTypeDeclaration > name2type = HashMultimap . create ( ) ; for ( final XtendTypeDeclaration declaration : script . getXtendTypes ( ) ) { final String name = declaration . getName ( ) ; if ( ! Strings . isEmpty ( name ) ) { name2type . put ( name , declaration ) ; } } for ( final String name : name2type . keySet ( ) ) { final Collection < XtendTypeDeclaration > types = name2type . get ( name ) ; if ( types . size ( ) > 1 ) { for ( final XtendTypeDeclaration type : types ) { error ( MessageFormat . format ( Messages . SARLValidator_93 , name ) , type , XtendPackage . Literals . XTEND_TYPE_DECLARATION__NAME , DUPLICATE_TYPE_NAME ) ; } } } }
Check the top elements within a script are not duplicated .