idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
34,000
@ SuppressWarnings ( "static-method" ) protected Boolean _generate ( XBooleanLiteral expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { output . appendConstant ( Boolean . toString ( expression . isIsTrue ( ) ) ) ; return Boolean . TRUE ; }
Append the inline code for the given XBooleanLiteral .
79
15
34,001
protected Boolean _generate ( XNullLiteral expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { if ( parentExpression == null && feature instanceof XtendFunction ) { final XtendFunction function = ( XtendFunction ) feature ; output . append ( "(" ) ; //$NON-NLS-1$ final JvmTypeReference reference = getFunctionTypeReference ( function ) ; if ( reference != null ) { final JvmType type = reference . getType ( ) ; if ( type != null ) { output . append ( type ) ; } else { output . append ( Object . class ) ; } } else { output . append ( Object . class ) ; } output . append ( ")" ) ; //$NON-NLS-1$ output . append ( Objects . toString ( null ) ) ; output . setConstant ( true ) ; } else { output . appendConstant ( Objects . toString ( null ) ) ; } return Boolean . TRUE ; }
Append the inline code for the given XNullLiteral .
228
14
34,002
@ SuppressWarnings ( "static-method" ) protected Boolean _generate ( XNumberLiteral expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { output . appendConstant ( expression . getValue ( ) ) ; return Boolean . TRUE ; }
Append the inline code for the given XNumberLiteral .
71
14
34,003
@ SuppressWarnings ( "static-method" ) protected Boolean _generate ( XStringLiteral expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { output . appendStringConstant ( expression . getValue ( ) ) ; return Boolean . TRUE ; }
Append the inline code for the given XStringLiteral .
72
14
34,004
@ SuppressWarnings ( "static-method" ) protected Boolean _generate ( XTypeLiteral expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { output . appendTypeConstant ( expression . getType ( ) ) ; return Boolean . TRUE ; }
Append the inline code for the given XTypeLiteral .
72
14
34,005
protected Boolean _generate ( XCastedExpression expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { final InlineAnnotationTreeAppendable child = newAppendable ( output . getImportManager ( ) ) ; boolean bool = generate ( expression . getTarget ( ) , expression , feature , child ) ; final String childContent = child . getContent ( ) ; if ( ! Strings . isEmpty ( childContent ) ) { output . append ( "(" ) ; //$NON-NLS-1$ output . append ( expression . getType ( ) . getType ( ) ) ; output . append ( ")" ) ; //$NON-NLS-1$ output . append ( childContent ) ; output . setConstant ( child . isConstant ( ) ) ; bool = true ; } return bool ; }
Append the inline code for the given XCastedExpression .
193
14
34,006
protected Boolean _generate ( XReturnExpression expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { return generate ( expression . getExpression ( ) , parentExpression , feature , output ) ; }
Append the inline code for the given XReturnLiteral .
58
14
34,007
public void getExportedPackages ( Set < String > exportedPackages ) { if ( exportedPackages != null ) { exportedPackages . add ( getCodeElementExtractor ( ) . getBasePackage ( ) ) ; exportedPackages . add ( getCodeElementExtractor ( ) . getBuilderPackage ( ) ) ; if ( getCodeBuilderConfig ( ) . isISourceAppendableEnable ( ) ) { exportedPackages . add ( getCodeElementExtractor ( ) . getAppenderPackage ( ) ) ; } } }
Fill the given set with the exported packages for this fragment .
113
12
34,008
@ Pure protected String getLanguageScriptMemberGetter ( ) { final Grammar grammar = getGrammar ( ) ; final AbstractRule scriptRule = GrammarUtil . findRuleForName ( grammar , getCodeBuilderConfig ( ) . getScriptRuleName ( ) ) ; for ( final Assignment assignment : GrammarUtil . containedAssignments ( scriptRule ) ) { if ( ( assignment . getTerminal ( ) instanceof RuleCall ) && Objects . equals ( ( ( RuleCall ) assignment . getTerminal ( ) ) . getRule ( ) . getName ( ) , getCodeBuilderConfig ( ) . getTopElementRuleName ( ) ) ) { return "get" + Strings . toFirstUpper ( assignment . getFeature ( ) ) ; //$NON-NLS-1$ } } throw new IllegalStateException ( "member not found" ) ; //$NON-NLS-1$ }
Replies the getter function for accessing to the top element collection of the script .
197
17
34,009
@ Pure protected TypeReference getXFactoryFor ( TypeReference type ) { final String packageName = type . getPackageName ( ) ; final Grammar grammar = getGrammar ( ) ; TypeReference reference = getXFactoryFor ( packageName , grammar ) ; if ( reference != null ) { return reference ; } for ( final Grammar usedGrammar : GrammarUtil . allUsedGrammars ( grammar ) ) { reference = getXFactoryFor ( packageName , usedGrammar ) ; if ( reference != null ) { return reference ; } } throw new IllegalStateException ( "Cannot find the XFactory for " + type ) ; //$NON-NLS-1$ }
Replies the type for the factory for the given type .
150
12
34,010
@ SuppressWarnings ( "static-method" ) protected StringConcatenationClient generateAppenderMembers ( String appenderSimpleName , TypeReference builderInterface , String elementAccessor ) { return new StringConcatenationClient ( ) { @ Override protected void appendTo ( TargetStringConcatenation it ) { it . append ( "\tprivate final " ) ; //$NON-NLS-1$ it . append ( builderInterface ) ; it . append ( " builder;" ) ; //$NON-NLS-1$ it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\tpublic " ) ; //$NON-NLS-1$ it . append ( appenderSimpleName ) ; it . append ( "(" ) ; //$NON-NLS-1$ it . append ( builderInterface ) ; it . append ( " builder) {" ) ; //$NON-NLS-1$ it . newLine ( ) ; it . append ( "\t\tthis.builder = builder;" ) ; //$NON-NLS-1$ it . newLine ( ) ; it . append ( "\t}" ) ; //$NON-NLS-1$ it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\tpublic void build(" ) ; //$NON-NLS-1$ it . append ( ISourceAppender . class ) ; it . append ( " appender) throws " ) ; //$NON-NLS-1$ it . append ( IOException . class ) ; it . append ( " {" ) ; //$NON-NLS-1$ it . newLine ( ) ; it . append ( "\t\tbuild(this.builder." ) ; //$NON-NLS-1$ it . append ( elementAccessor ) ; it . append ( ", appender);" ) ; //$NON-NLS-1$ it . newLine ( ) ; it . append ( "\t}" ) ; //$NON-NLS-1$ it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; } } ; }
Generate the members related to appenders .
481
9
34,011
protected static String getAorAnArticle ( String word ) { if ( Arrays . asList ( ' ' , ' ' , ' ' , ' ' , ' ' , ' ' ) . contains ( Character . toLowerCase ( word . charAt ( 0 ) ) ) ) { return "an" ; //$NON-NLS-1$ } return "a" ; //$NON-NLS-1$ }
Replies the an or a article according to the given word .
91
13
34,012
protected static String toSingular ( String word ) { if ( word . endsWith ( "ies" ) ) { //$NON-NLS-1$ return word . substring ( 0 , word . length ( ) - 3 ) + "y" ; //$NON-NLS-1$ } if ( word . endsWith ( "s" ) ) { //$NON-NLS-1$ return word . substring ( 0 , word . length ( ) - 1 ) ; } return word ; }
Replies the singular version of the word .
111
9
34,013
protected static boolean nameMatches ( EObject element , String pattern ) { if ( element instanceof RuleCall ) { return nameMatches ( ( ( RuleCall ) element ) . getRule ( ) , pattern ) ; } if ( element instanceof AbstractRule ) { final String name = ( ( AbstractRule ) element ) . getName ( ) ; final Pattern compilerPattern = Pattern . compile ( pattern ) ; final Matcher matcher = compilerPattern . matcher ( name ) ; if ( matcher . find ( ) ) { return true ; } } return false ; }
Replies if the name of the given element is matching the pattern .
118
14
34,014
protected void bindElementDescription ( BindingFactory factory , CodeElementExtractor . ElementDescription ... descriptions ) { for ( final CodeElementExtractor . ElementDescription description : descriptions ) { bindTypeReferences ( factory , description . getBuilderInterfaceType ( ) , description . getBuilderImplementationType ( ) , description . getBuilderCustomImplementationType ( ) ) ; } }
Binds the given descriptions according to the standard policy .
75
11
34,015
protected void bindTypeReferences ( BindingFactory factory , TypeReference interfaceType , TypeReference implementationType , TypeReference customImplementationType ) { final IFileSystemAccess2 fileSystem = getSrc ( ) ; final TypeReference type ; if ( ( fileSystem . isFile ( implementationType . getJavaPath ( ) ) ) || ( fileSystem . isFile ( customImplementationType . getXtendPath ( ) ) ) ) { type = customImplementationType ; } else { type = implementationType ; } factory . addfinalTypeToType ( interfaceType , type ) ; }
Binds the given references according to the standard policy .
122
11
34,016
protected AbstractRule getMemberRule ( CodeElementExtractor . ElementDescription description ) { for ( final Assignment assignment : GrammarUtil . containedAssignments ( description . getGrammarComponent ( ) ) ) { if ( Objects . equals ( getCodeBuilderConfig ( ) . getMemberCollectionExtensionGrammarName ( ) , assignment . getFeature ( ) ) ) { if ( assignment . getTerminal ( ) instanceof RuleCall ) { return ( ( RuleCall ) assignment . getTerminal ( ) ) . getRule ( ) ; } } } return null ; }
Replies the rule used for defining the members of the given element .
121
14
34,017
public String getConfig ( String key ) throws MojoExecutionException { ResourceBundle resource = null ; try { resource = ResourceBundle . getBundle ( "io/sarl/maven/compiler/config" , //$NON-NLS-1$ java . util . Locale . getDefault ( ) , MavenHelper . class . getClassLoader ( ) ) ; } catch ( MissingResourceException e ) { throw new MojoExecutionException ( e . getLocalizedMessage ( ) , e ) ; } String value = resource . getString ( key ) ; if ( value == null || value . isEmpty ( ) ) { value = Strings . nullToEmpty ( value ) ; this . log . warn ( MessageFormat . format ( Messages . MavenHelper_1 , key ) ) ; } return value ; }
Extract the value from the hard - coded configuration .
179
11
34,018
public PluginDescriptor loadPlugin ( Plugin plugin ) throws MojoExecutionException { try { final Object repositorySessionObject = this . getRepositorySessionMethod . invoke ( this . session ) ; return ( PluginDescriptor ) this . loadPluginMethod . invoke ( this . buildPluginManager , plugin , getSession ( ) . getCurrentProject ( ) . getRemotePluginRepositories ( ) , repositorySessionObject ) ; } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { throw new MojoExecutionException ( e . getLocalizedMessage ( ) , e ) ; } }
Load the given plugin .
129
5
34,019
public void executeMojo ( MojoExecution mojo ) throws MojoExecutionException , MojoFailureException { try { this . buildPluginManager . executeMojo ( this . session , mojo ) ; } catch ( PluginConfigurationException | PluginManagerException e ) { throw new MojoFailureException ( e . getLocalizedMessage ( ) , e ) ; } }
Execute the given mojo .
79
7
34,020
@ SuppressWarnings ( "static-method" ) public Dependency toDependency ( Artifact artifact ) { final Dependency result = new Dependency ( ) ; result . setArtifactId ( artifact . getArtifactId ( ) ) ; result . setClassifier ( artifact . getClassifier ( ) ) ; result . setGroupId ( artifact . getGroupId ( ) ) ; result . setOptional ( artifact . isOptional ( ) ) ; result . setScope ( artifact . getScope ( ) ) ; result . setType ( artifact . getType ( ) ) ; result . setVersion ( artifact . getVersion ( ) ) ; return result ; }
Convert an artifact to a dependency .
139
8
34,021
public synchronized Map < String , Dependency > getPluginDependencies ( ) throws MojoExecutionException { if ( this . pluginDependencies == null ) { final String groupId = getConfig ( "plugin.groupId" ) ; //$NON-NLS-1$ final String artifactId = getConfig ( "plugin.artifactId" ) ; //$NON-NLS-1$ final String pluginArtifactKey = ArtifactUtils . versionlessKey ( groupId , artifactId ) ; final Set < Artifact > dependencies = resolveDependencies ( pluginArtifactKey , true ) ; final Map < String , Dependency > deps = new TreeMap <> ( ) ; for ( final Artifact artifact : dependencies ) { final Dependency dep = toDependency ( artifact ) ; deps . put ( ArtifactUtils . versionlessKey ( artifact ) , dep ) ; } this . pluginDependencies = deps ; } return this . pluginDependencies ; }
Build the map of dependencies for the current plugin .
211
10
34,022
public Set < Artifact > resolve ( String groupId , String artifactId ) throws MojoExecutionException { final ArtifactResolutionRequest request = new ArtifactResolutionRequest ( ) ; request . setResolveRoot ( true ) ; request . setResolveTransitively ( true ) ; request . setLocalRepository ( getSession ( ) . getLocalRepository ( ) ) ; request . setRemoteRepositories ( getSession ( ) . getCurrentProject ( ) . getRemoteArtifactRepositories ( ) ) ; request . setOffline ( getSession ( ) . isOffline ( ) ) ; request . setForceUpdate ( getSession ( ) . getRequest ( ) . isUpdateSnapshots ( ) ) ; request . setServers ( getSession ( ) . getRequest ( ) . getServers ( ) ) ; request . setMirrors ( getSession ( ) . getRequest ( ) . getMirrors ( ) ) ; request . setProxies ( getSession ( ) . getRequest ( ) . getProxies ( ) ) ; request . setArtifact ( createArtifact ( groupId , artifactId ) ) ; final ArtifactResolutionResult result = resolve ( request ) ; return result . getArtifacts ( ) ; }
Resolve the artifacts with the given key .
258
9
34,023
public Artifact createArtifact ( String groupId , String artifactId ) { return this . repositorySystem . createArtifact ( groupId , artifactId , "RELEASE" , "jar" ) ; //$NON-NLS-1$ //$NON-NLS-2$ }
Create an instance of artifact with a version range that corresponds to all versions .
62
15
34,024
public Set < Artifact > resolveDependencies ( String artifactId , boolean plugins ) throws MojoExecutionException { final Artifact pluginArtifact ; if ( plugins ) { pluginArtifact = getSession ( ) . getCurrentProject ( ) . getPluginArtifactMap ( ) . get ( artifactId ) ; } else { pluginArtifact = getSession ( ) . getCurrentProject ( ) . getArtifactMap ( ) . get ( artifactId ) ; } final ArtifactResolutionRequest request = new ArtifactResolutionRequest ( ) ; request . setResolveRoot ( false ) ; request . setResolveTransitively ( true ) ; request . setLocalRepository ( getSession ( ) . getLocalRepository ( ) ) ; request . setRemoteRepositories ( getSession ( ) . getCurrentProject ( ) . getRemoteArtifactRepositories ( ) ) ; request . setOffline ( getSession ( ) . isOffline ( ) ) ; request . setForceUpdate ( getSession ( ) . getRequest ( ) . isUpdateSnapshots ( ) ) ; request . setServers ( getSession ( ) . getRequest ( ) . getServers ( ) ) ; request . setMirrors ( getSession ( ) . getRequest ( ) . getMirrors ( ) ) ; request . setProxies ( getSession ( ) . getRequest ( ) . getProxies ( ) ) ; request . setArtifact ( pluginArtifact ) ; final ArtifactResolutionResult result = resolve ( request ) ; try { this . resolutionErrorHandler . throwErrors ( request , result ) ; } catch ( MultipleArtifactsNotFoundException e ) { final Collection < Artifact > missing = new HashSet <> ( e . getMissingArtifacts ( ) ) ; if ( ! missing . isEmpty ( ) ) { throw new MojoExecutionException ( e . getLocalizedMessage ( ) , e ) ; } } catch ( ArtifactResolutionException e ) { throw new MojoExecutionException ( e . getLocalizedMessage ( ) , e ) ; } return result . getArtifacts ( ) ; }
Replies the dependencies for the given artifact .
440
9
34,025
public String getPluginDependencyVersion ( String groupId , String artifactId ) throws MojoExecutionException { final Map < String , Dependency > deps = getPluginDependencies ( ) ; final String key = ArtifactUtils . versionlessKey ( groupId , artifactId ) ; this . log . debug ( "COMPONENT DEPENDENCIES(getPluginVersionFromDependencies):" ) ; //$NON-NLS-1$ this . log . debug ( deps . toString ( ) ) ; final Dependency dep = deps . get ( key ) ; if ( dep != null ) { final String version = dep . getVersion ( ) ; if ( version != null && ! version . isEmpty ( ) ) { return version ; } throw new MojoExecutionException ( MessageFormat . format ( Messages . MavenHelper_2 , key ) ) ; } throw new MojoExecutionException ( MessageFormat . format ( Messages . MavenHelper_3 , key , deps ) ) ; }
Replies the version of the given plugin that is specified in the POM of the plugin in which this mojo is located .
220
26
34,026
@ SuppressWarnings ( "static-method" ) public Xpp3Dom toXpp3Dom ( String content , Log logger ) { if ( content != null && ! content . isEmpty ( ) ) { try ( StringReader sr = new StringReader ( content ) ) { return Xpp3DomBuilder . build ( sr ) ; } catch ( Exception exception ) { if ( logger != null ) { logger . debug ( exception ) ; } } } return null ; }
Parse the given string for extracting an XML tree .
100
11
34,027
@ SuppressWarnings ( "static-method" ) @ Provides @ Singleton public IJavaBatchCompiler providesJavaBatchCompiler ( Injector injector , Provider < SarlConfig > config ) { final SarlConfig cfg = config . get ( ) ; final IJavaBatchCompiler compiler = cfg . getCompiler ( ) . getJavaCompiler ( ) . newCompilerInstance ( ) ; injector . injectMembers ( compiler ) ; return compiler ; }
Provide a Java batch compiler based on the Bootique configuration .
105
13
34,028
private static void uninstallSkillsPreStage ( Iterable < ? extends Skill > skills ) { try { // Use reflection to ignore the "private/protected" access right. for ( final Skill s : skills ) { SREutils . doSkillUninstallation ( s , UninstallationStage . PRE_DESTROY_EVENT ) ; } } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Run the uninstallation functions of the skills for the pre stage of the uninstallation process .
100
18
34,029
private static void uninstallSkillsFinalStage ( Iterable < ? extends Skill > skills ) { try { // Use reflection to ignore the "private/protected" access right. for ( final Skill s : skills ) { SREutils . doSkillUninstallation ( s , UninstallationStage . POST_DESTROY_EVENT ) ; } } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Run the uninstallation functions of the skills for the final stage of the uninstallation process .
100
18
34,030
protected void fireKernelDiscovered ( URI uri ) { this . logger . getKernelLogger ( ) . info ( MessageFormat . format ( Messages . HazelcastKernelDiscoveryService_0 , uri , getCurrentKernel ( ) ) ) ; for ( final KernelDiscoveryServiceListener listener : this . listeners . getListeners ( KernelDiscoveryServiceListener . class ) ) { listener . kernelDiscovered ( uri ) ; } }
Notifies the listeners about the discovering of a kernel .
96
11
34,031
protected void fireKernelDisconnected ( URI uri ) { this . logger . getKernelLogger ( ) . info ( MessageFormat . format ( Messages . HazelcastKernelDiscoveryService_1 , uri , getCurrentKernel ( ) ) ) ; for ( final KernelDiscoveryServiceListener listener : this . listeners . getListeners ( KernelDiscoveryServiceListener . class ) ) { listener . kernelDisconnected ( uri ) ; } }
Notifies the listeners about the killing of a kernel .
96
11
34,032
public static SarlConfig getConfiguration ( ConfigurationFactory configFactory ) { assert configFactory != null ; return configFactory . config ( SarlConfig . class , PREFIX ) ; }
Replies the configuration for SARLC .
37
8
34,033
protected static File unix2os ( String filename ) { File file = null ; for ( final String base : filename . split ( Pattern . quote ( "/" ) ) ) { //$NON-NLS-1$ if ( file == null ) { file = new File ( base ) ; } else { file = new File ( file , base ) ; } } return file ; }
Create a file from a unix - like representation of the filename .
81
14
34,034
protected File makeAbsolute ( File file ) { if ( ! file . isAbsolute ( ) ) { final File basedir = this . mavenHelper . getSession ( ) . getCurrentProject ( ) . getBasedir ( ) ; return new File ( basedir , file . getPath ( ) ) . getAbsoluteFile ( ) ; } return file ; }
Make absolute the given filename relatively to the project s folder .
77
12
34,035
protected void executeMojo ( String groupId , String artifactId , String version , String goal , String configuration , Dependency ... dependencies ) throws MojoExecutionException , MojoFailureException { final Plugin plugin = new Plugin ( ) ; plugin . setArtifactId ( artifactId ) ; plugin . setGroupId ( groupId ) ; plugin . setVersion ( version ) ; plugin . setDependencies ( Arrays . asList ( dependencies ) ) ; getLog ( ) . debug ( MessageFormat . format ( Messages . AbstractSarlMojo_0 , plugin . getId ( ) ) ) ; final PluginDescriptor pluginDescriptor = this . mavenHelper . loadPlugin ( plugin ) ; if ( pluginDescriptor == null ) { throw new MojoExecutionException ( MessageFormat . format ( Messages . AbstractSarlMojo_1 , plugin . getId ( ) ) ) ; } final MojoDescriptor mojoDescriptor = pluginDescriptor . getMojo ( goal ) ; if ( mojoDescriptor == null ) { throw new MojoExecutionException ( MessageFormat . format ( Messages . AbstractSarlMojo_2 , goal ) ) ; } final Xpp3Dom mojoXml ; try { mojoXml = this . mavenHelper . toXpp3Dom ( mojoDescriptor . getMojoConfiguration ( ) ) ; } catch ( PlexusConfigurationException e1 ) { throw new MojoExecutionException ( e1 . getLocalizedMessage ( ) , e1 ) ; } Xpp3Dom configurationXml = this . mavenHelper . toXpp3Dom ( configuration , getLog ( ) ) ; if ( configurationXml != null ) { configurationXml = Xpp3DomUtils . mergeXpp3Dom ( configurationXml , mojoXml ) ; } else { configurationXml = mojoXml ; } getLog ( ) . debug ( MessageFormat . format ( Messages . AbstractSarlMojo_3 , plugin . getId ( ) , configurationXml . toString ( ) ) ) ; final MojoExecution execution = new MojoExecution ( mojoDescriptor , configurationXml ) ; this . mavenHelper . executeMojo ( execution ) ; }
Execute another MOJO .
486
6
34,036
protected String internalExecute ( ) { getLog ( ) . info ( Messages . AbstractDocumentationMojo_1 ) ; final Map < File , File > files = getFiles ( ) ; getLog ( ) . info ( MessageFormat . format ( Messages . AbstractDocumentationMojo_2 , files . size ( ) ) ) ; return internalExecute ( files ) ; }
Internal run .
79
3
34,037
protected String formatErrorMessage ( File inputFile , Throwable exception ) { File filename ; int lineno = 0 ; final boolean addExceptionName ; if ( exception instanceof ParsingException ) { addExceptionName = false ; final ParsingException pexception = ( ParsingException ) exception ; final File file = pexception . getFile ( ) ; if ( file != null ) { filename = file ; } else { filename = inputFile ; } lineno = pexception . getLineno ( ) ; } else { addExceptionName = true ; filename = inputFile ; } for ( final String sourceDir : this . session . getCurrentProject ( ) . getCompileSourceRoots ( ) ) { final File root = new File ( sourceDir ) ; if ( isParentFile ( filename , root ) ) { try { filename = FileSystem . makeRelative ( filename , root ) ; } catch ( IOException exception1 ) { // } break ; } } final StringBuilder msg = new StringBuilder ( ) ; msg . append ( filename . toString ( ) ) ; if ( lineno > 0 ) { msg . append ( ":" ) . append ( lineno ) ; //$NON-NLS-1$ } msg . append ( ": " ) ; //$NON-NLS-1$ final Throwable rootEx = Throwables . getRootCause ( exception ) ; if ( addExceptionName ) { msg . append ( rootEx . getClass ( ) . getName ( ) ) ; msg . append ( " - " ) ; //$NON-NLS-1$ } msg . append ( rootEx . getLocalizedMessage ( ) ) ; return msg . toString ( ) ; }
Format the error message .
363
5
34,038
@ SuppressWarnings ( "checkstyle:npathcomplexity" ) protected AbstractMarkerLanguageParser createLanguageParser ( File inputFile ) throws MojoExecutionException , IOException { final AbstractMarkerLanguageParser parser ; if ( isFileExtension ( inputFile , MarkdownParser . MARKDOWN_FILE_EXTENSIONS ) ) { parser = this . injector . getInstance ( MarkdownParser . class ) ; } else { throw new MojoExecutionException ( MessageFormat . format ( Messages . AbstractDocumentationMojo_3 , inputFile ) ) ; } parser . setGithubExtensionEnable ( this . githubExtension ) ; final SarlDocumentationParser internalParser = parser . getDocumentParser ( ) ; if ( this . isLineContinuationEnable ) { internalParser . setLineContinuation ( SarlDocumentationParser . DEFAULT_LINE_CONTINUATION ) ; } else { internalParser . addLowPropertyProvider ( createProjectProperties ( ) ) ; } final ScriptExecutor scriptExecutor = internalParser . getScriptExecutor ( ) ; final StringBuilder cp = new StringBuilder ( ) ; for ( final File cpElement : getClassPath ( ) ) { if ( cp . length ( ) > 0 ) { cp . append ( ":" ) ; //$NON-NLS-1$ } cp . append ( cpElement . getAbsolutePath ( ) ) ; } scriptExecutor . setClassPath ( cp . toString ( ) ) ; final String bootPath = getBootClassPath ( ) ; if ( ! Strings . isEmpty ( bootPath ) ) { scriptExecutor . setBootClassPath ( bootPath ) ; } JavaVersion version = null ; if ( ! Strings . isEmpty ( this . source ) ) { version = JavaVersion . fromQualifier ( this . source ) ; } if ( version == null ) { version = JavaVersion . JAVA8 ; } scriptExecutor . setJavaSourceVersion ( version . getQualifier ( ) ) ; scriptExecutor . setTempFolder ( this . tempDirectory . getAbsoluteFile ( ) ) ; internalParser . addLowPropertyProvider ( createProjectProperties ( ) ) ; internalParser . addLowPropertyProvider ( this . session . getCurrentProject ( ) . getProperties ( ) ) ; internalParser . addLowPropertyProvider ( this . session . getUserProperties ( ) ) ; internalParser . addLowPropertyProvider ( this . session . getSystemProperties ( ) ) ; internalParser . addLowPropertyProvider ( createGeneratorProperties ( ) ) ; final Properties defaultValues = createDefaultValueProperties ( ) ; if ( defaultValues != null ) { internalParser . addLowPropertyProvider ( defaultValues ) ; } return parser ; }
Create a parser for the given file .
586
8
34,039
protected Map < File , File > getFiles ( ) { final Map < File , File > files = new TreeMap <> ( ) ; for ( final String rootName : this . inferredSourceDirectories ) { File root = FileSystem . convertStringToFile ( rootName ) ; if ( ! root . isAbsolute ( ) ) { root = FileSystem . makeAbsolute ( root , this . baseDirectory ) ; } getLog ( ) . debug ( MessageFormat . format ( Messages . AbstractDocumentationMojo_4 , root . getName ( ) ) ) ; for ( final File file : Files . fileTreeTraverser ( ) . breadthFirstTraversal ( root ) ) { if ( file . exists ( ) && file . isFile ( ) && ! file . isHidden ( ) && file . canRead ( ) && hasExtension ( file ) ) { files . put ( file , root ) ; } } } return files ; }
Replies the source files .
200
6
34,040
protected static String toPackageName ( String rootPackage , File packageName ) { final StringBuilder name = new StringBuilder ( ) ; File tmp = packageName ; while ( tmp != null ) { final String elementName = tmp . getName ( ) ; if ( ! Strings . equal ( FileSystem . CURRENT_DIRECTORY , elementName ) && ! Strings . equal ( FileSystem . PARENT_DIRECTORY , elementName ) ) { if ( name . length ( ) > 0 ) { name . insert ( 0 , "." ) ; //$NON-NLS-1$ } name . insert ( 0 , elementName ) ; } tmp = tmp . getParentFile ( ) ; } if ( ! Strings . isEmpty ( rootPackage ) ) { if ( name . length ( ) > 0 ) { name . insert ( 0 , "." ) ; //$NON-NLS-1$ } name . insert ( 0 , rootPackage ) ; } return name . toString ( ) ; }
Convert a file to a package name .
215
9
34,041
protected static File toPackageFolder ( String packageName ) { File file = null ; for ( final String element : packageName . split ( "[.]" ) ) { //$NON-NLS-1$ if ( file == null ) { file = new File ( element ) ; } else { file = new File ( file , element ) ; } } return file ; }
Convert a a package name for therelative file .
78
12
34,042
protected String getBootClassPath ( ) throws IOException { final Toolchain toolchain = this . toolchainManager . getToolchainFromBuildContext ( "jdk" , this . session ) ; //$NON-NLS-1$ if ( toolchain instanceof JavaToolchain && toolchain instanceof ToolchainPrivate ) { final JavaToolchain javaToolChain = ( JavaToolchain ) toolchain ; final ToolchainPrivate privateJavaToolChain = ( ToolchainPrivate ) toolchain ; String [ ] includes = { "jre/lib/*" , "jre/lib/ext/*" , "jre/lib/endorsed/*" } ; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ String [ ] excludes = new String [ 0 ] ; final Xpp3Dom config = ( Xpp3Dom ) privateJavaToolChain . getModel ( ) . getConfiguration ( ) ; if ( config != null ) { final Xpp3Dom bootClassPath = config . getChild ( "bootClassPath" ) ; //$NON-NLS-1$ if ( bootClassPath != null ) { final Xpp3Dom includeParent = bootClassPath . getChild ( "includes" ) ; //$NON-NLS-1$ if ( includeParent != null ) { includes = getValues ( includeParent . getChildren ( "include" ) ) ; //$NON-NLS-1$ } final Xpp3Dom excludeParent = bootClassPath . getChild ( "excludes" ) ; //$NON-NLS-1$ if ( excludeParent != null ) { excludes = getValues ( excludeParent . getChildren ( "exclude" ) ) ; //$NON-NLS-1$ } } } try { return scanBootclasspath ( Objects . toString ( this . reflect . invoke ( javaToolChain , "getJavaHome" ) ) , includes , excludes ) ; //$NON-NLS-1$ } catch ( Exception e ) { throw new IOException ( e . getLocalizedMessage ( ) , e ) ; } } return "" ; //$NON-NLS-1$ }
Replies the boot classpath .
478
7
34,043
@ Pure protected XExpression fromString ( String expression ) { if ( ! Strings . isEmpty ( expression ) ) { ResourceSet resourceSet = this . context . eResource ( ) . getResourceSet ( ) ; URI uri = computeUnusedUri ( resourceSet ) ; Resource resource = getResourceFactory ( ) . createResource ( uri ) ; resourceSet . getResources ( ) . add ( resource ) ; try ( StringInputStream is = new StringInputStream ( generateExpressionCode ( expression ) ) ) { resource . load ( is , null ) ; SarlScript script = resource . getContents ( ) . isEmpty ( ) ? null : ( SarlScript ) resource . getContents ( ) . get ( 0 ) ; SarlEvent topElement = ( SarlEvent ) script . getXtendTypes ( ) . get ( 0 ) ; SarlField member = ( SarlField ) topElement . getMembers ( ) . get ( 0 ) ; return member . getInitialValue ( ) ; } catch ( Throwable exception ) { throw new RuntimeException ( exception ) ; } finally { resourceSet . getResources ( ) . remove ( resource ) ; } } throw new IllegalArgumentException ( "not a valid expression" ) ; }
Create an expression but does not change the container .
264
10
34,044
@ Pure public XExpression getDefaultXExpressionForType ( String type ) { //TODO: Check if a similar function exists in the Xbase library. XExpression expr = null ; if ( type != null && ! "void" . equals ( type ) && ! Void . class . getName ( ) . equals ( type ) ) { switch ( type ) { case "boolean" : case "java.lang.Boolean" : XBooleanLiteral booleanLiteral = XbaseFactory . eINSTANCE . createXBooleanLiteral ( ) ; booleanLiteral . setIsTrue ( false ) ; expr = booleanLiteral ; break ; case "float" : case "java.lang.Float" : XNumberLiteral numberLiteral = XbaseFactory . eINSTANCE . createXNumberLiteral ( ) ; numberLiteral . setValue ( "0.0f" ) ; expr = numberLiteral ; break ; case "double" : case "java.lang.Double" : case "java.lang.BigDecimal" : numberLiteral = XbaseFactory . eINSTANCE . createXNumberLiteral ( ) ; numberLiteral . setValue ( "0.0" ) ; expr = numberLiteral ; break ; case "int" : case "long" : case "java.lang.Integer" : case "java.lang.Long" : case "java.lang.BigInteger" : numberLiteral = XbaseFactory . eINSTANCE . createXNumberLiteral ( ) ; numberLiteral . setValue ( "0" ) ; expr = numberLiteral ; break ; case "byte" : case "short" : case "char" : case "java.lang.Byte" : case "java.lang.Short" : case "java.lang.Character" : numberLiteral = XbaseFactory . eINSTANCE . createXNumberLiteral ( ) ; numberLiteral . setValue ( "0" ) ; XCastedExpression castExpression = XbaseFactory . eINSTANCE . createXCastedExpression ( ) ; castExpression . setTarget ( numberLiteral ) ; castExpression . setType ( newTypeRef ( this . context , type ) ) ; expr = numberLiteral ; break ; default : expr = XbaseFactory . eINSTANCE . createXNullLiteral ( ) ; break ; } } return expr ; }
Replies the XExpression for the default value associated to the given type .
537
16
34,045
@ Pure public String getDefaultValueForType ( String type ) { //TODO: Check if a similar function exists in the Xbase library. String defaultValue = "" ; if ( ! Strings . isEmpty ( type ) && ! "void" . equals ( type ) ) { switch ( type ) { case "boolean" : defaultValue = "true" ; break ; case "double" : defaultValue = "0.0" ; break ; case "float" : defaultValue = "0.0f" ; break ; case "int" : defaultValue = "0" ; break ; case "long" : defaultValue = "0" ; break ; case "byte" : defaultValue = "(0 as byte)" ; break ; case "short" : defaultValue = "(0 as short)" ; break ; case "char" : defaultValue = "(0 as char)" ; break ; default : defaultValue = "null" ; break ; } } return defaultValue ; }
Replies the default value for the given type .
207
10
34,046
public XFeatureCall createReferenceToThis ( ) { final XExpression expr = getXExpression ( ) ; XtendTypeDeclaration type = EcoreUtil2 . getContainerOfType ( expr , XtendTypeDeclaration . class ) ; JvmType jvmObject = getAssociatedElement ( JvmType . class , type , expr . eResource ( ) ) ; final XFeatureCall thisFeature = XbaseFactory . eINSTANCE . createXFeatureCall ( ) ; thisFeature . setFeature ( jvmObject ) ; return thisFeature ; }
Create a reference to this object or to the current type .
120
12
34,047
public XFeatureCall createReferenceToSuper ( ) { final XExpression expr = getXExpression ( ) ; XtendTypeDeclaration type = EcoreUtil2 . getContainerOfType ( expr , XtendTypeDeclaration . class ) ; JvmType jvmObject = getAssociatedElement ( JvmType . class , type , expr . eResource ( ) ) ; final XFeatureCall superFeature = XbaseFactory . eINSTANCE . createXFeatureCall ( ) ; JvmIdentifiableElement feature ; if ( jvmObject instanceof JvmDeclaredType ) { feature = ( ( JvmDeclaredType ) jvmObject ) . getExtendedClass ( ) . getType ( ) ; } else { feature = findType ( expr , getQualifiedName ( type ) ) . getType ( ) ; if ( feature instanceof JvmDeclaredType ) { feature = ( ( JvmDeclaredType ) feature ) . getExtendedClass ( ) . getType ( ) ; } else { feature = null ; } } if ( feature == null ) { return null ; } superFeature . setFeature ( feature ) ; return superFeature ; }
Create a reference to super object or to the super type .
247
12
34,048
public static InetAddress getLoopbackAddress ( ) { try { final Enumeration < NetworkInterface > interfaces = NetworkInterface . getNetworkInterfaces ( ) ; if ( interfaces != null ) { NetworkInterface inter ; InetAddress adr ; Enumeration < InetAddress > addrs ; while ( interfaces . hasMoreElements ( ) ) { inter = interfaces . nextElement ( ) ; addrs = inter . getInetAddresses ( ) ; if ( addrs != null ) { while ( addrs . hasMoreElements ( ) ) { adr = addrs . nextElement ( ) ; if ( adr != null && adr . isLoopbackAddress ( ) && ( adr instanceof Inet4Address ) ) { return adr ; } } } } } } catch ( SocketException e ) { // } return null ; }
Replies the IPv4 loopback address .
180
9
34,049
public static URI toURI ( String uri ) throws URISyntaxException { final URI u = new URI ( uri ) ; // Inspired by ZeroMQ String adr = u . getAuthority ( ) ; if ( adr == null ) { adr = u . getPath ( ) ; } if ( adr != null && adr . endsWith ( ":*" ) ) { //$NON-NLS-1$ return new URI ( u . getScheme ( ) , u . getUserInfo ( ) , adr . substring ( 0 , adr . length ( ) - 2 ) , - 1 , null , u . getQuery ( ) , u . getFragment ( ) ) ; } return u ; }
Convert a string URI to an object URI .
158
10
34,050
public static URI toURI ( InetAddress adr ) { try { return new URI ( "tcp" , adr . getHostAddress ( ) , null , null ) ; //$NON-NLS-1$ } catch ( URISyntaxException e ) { throw new IOError ( e ) ; } }
Convert an inet address to an URI .
69
10
34,051
protected LightweightTypeReference toLightweightTypeReference ( JvmType type , EObject context ) { final StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner ( getServices ( ) , context ) ; final LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory ( owner , false ) ; return factory . toLightweightReference ( type ) ; }
Create a lightweight type reference from the given type .
74
10
34,052
protected boolean isIgnored ( String issueCode , EObject currentObject ) { final IssueSeverities severities = getIssueSeverities ( getContext ( ) , currentObject ) ; return severities . isIgnored ( issueCode ) ; }
Replies if the given issue is ignored for the given object .
52
13
34,053
protected String canonicalName ( EObject object ) { if ( object instanceof JvmIdentifiableElement ) { return ( ( JvmIdentifiableElement ) object ) . getQualifiedName ( ) ; } final EObject jvmElement = this . associations . getPrimaryJvmElement ( object ) ; if ( jvmElement instanceof JvmIdentifiableElement ) { return ( ( JvmIdentifiableElement ) jvmElement ) . getQualifiedName ( ) ; } return null ; }
Replies the canonical name of the given object .
102
10
34,054
@ Check public void checkSpaceUse ( SarlSpace space ) { error ( MessageFormat . format ( Messages . SARLValidator_0 , this . grammarAccess . getSpaceKeyword ( ) ) , space , null ) ; }
Space keyword is reserved .
49
5
34,055
@ Check public void checkArtifactUse ( SarlArtifact artifact ) { error ( MessageFormat . format ( Messages . SARLValidator_0 , this . grammarAccess . getSpaceKeyword ( ) ) , artifact , null ) ; }
Artifact keyword is reserved .
51
6
34,056
@ Check public void checkEarlyExitEventInFires ( SarlAction action ) { int i = 0 ; for ( final JvmTypeReference event : action . getFiredEvents ( ) ) { if ( ! this . earlyExitComputer . isEarlyExitEvent ( event ) ) { warning ( MessageFormat . format ( Messages . SARLValidator_95 , event . getSimpleName ( ) ) , action , SarlPackage . eINSTANCE . getSarlAction_FiredEvents ( ) , i ) ; } ++ i ; } }
Emit a warning when the events after the fires keyword are not early - exit events .
115
18
34,057
@ Check public void checkRequiredCapacityUse ( SarlRequiredCapacity statement ) { warning ( MessageFormat . format ( Messages . SARLValidator_0 , this . grammarAccess . getRequiresKeyword ( ) ) , statement , null ) ; }
Emit a warning when the requires keyword is used .
53
11
34,058
@ Check protected void checkModifiers ( SarlAgent agent ) { this . agentModifierValidator . checkModifiers ( agent , MessageFormat . format ( Messages . SARLValidator_9 , agent . getName ( ) ) ) ; }
Check the modifiers for the SARL agents .
52
9
34,059
@ Check protected void checkModifiers ( SarlBehavior behavior ) { this . behaviorModifierValidator . checkModifiers ( behavior , MessageFormat . format ( Messages . SARLValidator_9 , behavior . getName ( ) ) ) ; }
Check the modifiers for the SARL behaviors .
53
9
34,060
@ Check protected void checkModifiers ( SarlCapacity capacity ) { this . capacityModifierValidator . checkModifiers ( capacity , MessageFormat . format ( Messages . SARLValidator_9 , capacity . getName ( ) ) ) ; }
Check the modifiers for the SARL capacities .
53
9
34,061
@ Check protected void checkModifiers ( SarlSkill skill ) { this . skillModifierValidator . checkModifiers ( skill , MessageFormat . format ( Messages . SARLValidator_9 , skill . getName ( ) ) ) ; }
Check the modifiers for the SARL skills .
52
9
34,062
@ Check public void checkContainerType ( SarlAgent agent ) { final XtendTypeDeclaration declaringType = agent . getDeclaringType ( ) ; if ( declaringType != null ) { final String name = canonicalName ( declaringType ) ; assert name != null ; error ( MessageFormat . format ( Messages . SARLValidator_28 , name ) , agent , null , INVALID_NESTED_DEFINITION ) ; } }
Check the container for the SARL agents .
95
9
34,063
@ Check public void checkContainerType ( SarlBehavior behavior ) { final XtendTypeDeclaration declaringType = behavior . getDeclaringType ( ) ; if ( declaringType != null ) { final String name = canonicalName ( declaringType ) ; assert name != null ; error ( MessageFormat . format ( Messages . SARLValidator_29 , name ) , behavior , null , INVALID_NESTED_DEFINITION ) ; } }
Check the container for the SARL behaviors .
96
9
34,064
@ Check public void checkContainerType ( SarlCapacity capacity ) { final XtendTypeDeclaration declaringType = capacity . getDeclaringType ( ) ; if ( declaringType != null ) { final String name = canonicalName ( declaringType ) ; assert name != null ; error ( MessageFormat . format ( Messages . SARLValidator_30 , name ) , capacity , null , INVALID_NESTED_DEFINITION ) ; } }
Check the container for the SARL capacities .
96
9
34,065
@ Check public void checkContainerType ( SarlSkill skill ) { final XtendTypeDeclaration declaringType = skill . getDeclaringType ( ) ; if ( declaringType != null ) { final String name = canonicalName ( declaringType ) ; assert name != null ; error ( MessageFormat . format ( Messages . SARLValidator_31 , name ) , skill , null , INVALID_NESTED_DEFINITION ) ; } }
Check the container for the SARL skills .
95
9
34,066
@ Check public void checkFinalFieldInitialization ( SarlEvent event ) { final JvmGenericType inferredType = this . associations . getInferredType ( event ) ; if ( inferredType != null ) { checkFinalFieldInitialization ( inferredType ) ; } }
Check if all the fields are initialized in a SARL event .
56
13
34,067
@ Check public void checkFinalFieldInitialization ( SarlBehavior behavior ) { final JvmGenericType inferredType = this . associations . getInferredType ( behavior ) ; if ( inferredType != null ) { checkFinalFieldInitialization ( inferredType ) ; } }
Check if all the fields are initialized in a SARL behavior .
57
13
34,068
@ Check public void checkFinalFieldInitialization ( SarlSkill skill ) { final JvmGenericType inferredType = this . associations . getInferredType ( skill ) ; if ( inferredType != null ) { checkFinalFieldInitialization ( inferredType ) ; } }
Check if all the fields are initialized in a SARL skill .
56
13
34,069
@ Check public void checkFinalFieldInitialization ( SarlAgent agent ) { final JvmGenericType inferredType = this . associations . getInferredType ( agent ) ; if ( inferredType != null ) { checkFinalFieldInitialization ( inferredType ) ; } }
Check if all the fields are initialized in a SARL agent .
56
13
34,070
@ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" , "checkstyle:nestedifdepth" } ) protected void checkSuperConstructor ( XtendTypeDeclaration container , EStructuralFeature feature , Collection < ActionParameterTypes > defaultSignatures ) { final JvmDeclaredType jvmElement = this . associations . getInferredType ( container ) ; if ( jvmElement != null ) { final Map < ActionParameterTypes , JvmConstructor > superConstructors = CollectionLiterals . newTreeMap ( ( Comparator < ActionParameterTypes > ) null ) ; final JvmTypeReference typeRef = jvmElement . getExtendedClass ( ) ; final JvmType supertype = ( typeRef == null ) ? null : typeRef . getType ( ) ; if ( supertype instanceof JvmGenericType ) { final JvmGenericType jvmSuperElement = ( JvmGenericType ) supertype ; for ( final JvmConstructor superConstructor : jvmSuperElement . getDeclaredConstructors ( ) ) { final ActionParameterTypes sig = this . sarlActionSignatures . createParameterTypesFromJvmModel ( superConstructor . isVarArgs ( ) , superConstructor . getParameters ( ) ) ; superConstructors . put ( sig , superConstructor ) ; } } final ActionParameterTypes voidKey = this . sarlActionSignatures . createParameterTypesForVoid ( ) ; //boolean hasDeclaredConstructor = false; for ( final XtendMember member : container . getMembers ( ) ) { if ( member instanceof SarlConstructor ) { final SarlConstructor constructor = ( SarlConstructor ) member ; //hasDeclaredConstructor = true; boolean invokeDefaultConstructor = true ; final XExpression body = constructor . getExpression ( ) ; if ( body instanceof XBlockExpression ) { final XBlockExpression block = ( XBlockExpression ) body ; if ( ! block . getExpressions ( ) . isEmpty ( ) ) { final XExpression firstStatement = block . getExpressions ( ) . get ( 0 ) ; if ( firstStatement instanceof XConstructorCall || isDelegateConstructorCall ( firstStatement ) ) { invokeDefaultConstructor = false ; } } } else if ( body instanceof XConstructorCall || isDelegateConstructorCall ( body ) ) { invokeDefaultConstructor = false ; } if ( invokeDefaultConstructor && ! superConstructors . containsKey ( voidKey ) ) { final List < String > issueData = new ArrayList <> ( ) ; for ( final ActionParameterTypes defaultSignature : defaultSignatures ) { issueData . add ( defaultSignature . toString ( ) ) ; } error ( Messages . SARLValidator_33 , member , null , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , MUST_INVOKE_SUPER_CONSTRUCTOR , toArray ( issueData , String . class ) ) ; } } } // The following code is no more needed because of the constructor inheritance mechanism which // is implemented into the JVM model inferrer. /*if (!hasDeclaredConstructor) { for (final ActionParameterTypes defaultSignature : defaultSignatures) { if (!superConstructors.containsKey(defaultSignature)) { final List<String> issueData = new ArrayList<>(); for (final JvmConstructor superConstructor : superConstructors.values()) { issueData.add(EcoreUtil.getURI(superConstructor).toString()); issueData.add(doGetReadableSignature(container.getName(), superConstructor.getParameters())); } error(Messages.SARLValidator_33, container, feature, MISSING_CONSTRUCTOR, toArray(issueData, String.class)); } } }*/ } }
Check the super constructors .
837
6
34,071
@ Check ( CheckType . FAST ) public void checkForbiddenCalls ( XAbstractFeatureCall expression ) { if ( this . featureCallValidator . isDisallowedCall ( expression ) ) { error ( MessageFormat . format ( Messages . SARLValidator_36 , expression . getFeature ( ) . getIdentifier ( ) ) , expression , null , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , FORBIDDEN_REFERENCE ) ; } }
Check if the call is forbidden .
102
7
34,072
@ Check ( CheckType . FAST ) public void checkDiscouragedCalls ( XAbstractFeatureCall expression ) { if ( ! isIgnored ( DISCOURAGED_REFERENCE ) && this . featureCallValidator . isDiscouragedCall ( expression ) ) { addIssue ( MessageFormat . format ( Messages . SARLValidator_37 , expression . getConcreteSyntaxFeatureName ( ) ) , expression , DISCOURAGED_REFERENCE ) ; } }
Check if the call is discouraged .
105
7
34,073
@ Check public void checkDefaultValueTypeCompatibleWithParameterType ( SarlFormalParameter param ) { final XExpression defaultValue = param . getDefaultValue ( ) ; if ( defaultValue != null ) { final JvmTypeReference rawType = param . getParameterType ( ) ; assert rawType != null ; final LightweightTypeReference toType = toLightweightTypeReference ( rawType , true ) ; if ( toType == null ) { error ( MessageFormat . format ( Messages . SARLValidator_20 , param . getName ( ) ) , param , XtendPackage . Literals . XTEND_PARAMETER__PARAMETER_TYPE , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , INVALID_TYPE ) ; return ; } LightweightTypeReference fromType = getExpectedType ( defaultValue ) ; if ( fromType == null ) { fromType = getActualType ( defaultValue ) ; if ( fromType == null ) { error ( MessageFormat . format ( Messages . SARLValidator_21 , param . getName ( ) ) , param , SARL_FORMAL_PARAMETER__DEFAULT_VALUE , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , INVALID_TYPE ) ; return ; } } if ( ! Utils . canCast ( fromType , toType , true , false , true ) ) { error ( MessageFormat . format ( Messages . SARLValidator_38 , getNameOfTypes ( fromType ) , canonicalName ( toType ) ) , param , SARL_FORMAL_PARAMETER__DEFAULT_VALUE , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , INCOMPATIBLE_TYPES , canonicalName ( fromType ) , canonicalName ( toType ) ) ; } } }
Check if the default values of the formal parameters have a compatible type with the formal parameter .
395
18
34,074
@ Check public void checkDefaultValueFieldReference ( SarlFormalParameter param ) { final XExpression defaultValue = param . getDefaultValue ( ) ; if ( defaultValue != null ) { final Iterator < XFeatureCall > iter ; if ( defaultValue instanceof XFeatureCall ) { iter = Iterators . singletonIterator ( ( XFeatureCall ) defaultValue ) ; } else { iter = Iterators . filter ( defaultValue . eAllContents ( ) , XFeatureCall . class ) ; } while ( iter . hasNext ( ) ) { final XFeatureCall call = iter . next ( ) ; final JvmIdentifiableElement feature = call . getFeature ( ) ; String invalidFieldName = null ; if ( feature instanceof XtendField ) { final XtendField field = ( XtendField ) feature ; if ( ! field . isFinal ( ) ) { invalidFieldName = field . getName ( ) ; } } else if ( feature instanceof JvmField ) { final JvmField field = ( JvmField ) feature ; if ( ! field . isFinal ( ) ) { invalidFieldName = field . getSimpleName ( ) ; } } if ( invalidFieldName != null ) { error ( MessageFormat . format ( Messages . SARLValidator_19 , invalidFieldName ) , call , XbasePackage . Literals . XABSTRACT_FEATURE_CALL__FEATURE , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , FORBIDDEN_REFERENCE ) ; } } } }
Check if the default values has not a reference to the not final fields .
331
15
34,075
@ Check ( CheckType . FAST ) public void checkActionName ( SarlAction action ) { final JvmOperation inferredType = this . associations . getDirectlyInferredOperation ( action ) ; final QualifiedName name = QualifiedName . create ( inferredType . getQualifiedName ( ' ' ) . split ( "\\." ) ) ; //$NON-NLS-1$ if ( this . featureNames . isDisallowedName ( name ) ) { final String validName = Utils . fixHiddenMember ( action . getName ( ) ) ; error ( MessageFormat . format ( Messages . SARLValidator_39 , action . getName ( ) ) , action , XTEND_FUNCTION__NAME , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , INVALID_MEMBER_NAME , validName ) ; } else if ( ! isIgnored ( DISCOURAGED_FUNCTION_NAME ) && this . featureNames . isDiscouragedName ( name ) ) { warning ( MessageFormat . format ( Messages . SARLValidator_39 , action . getName ( ) ) , action , XTEND_FUNCTION__NAME , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , DISCOURAGED_FUNCTION_NAME ) ; } }
Check if the given action has a valid name .
283
10
34,076
@ Check ( CheckType . FAST ) public void checkFieldName ( SarlField field ) { final JvmField inferredType = this . associations . getJvmField ( field ) ; final QualifiedName name = Utils . getQualifiedName ( inferredType ) ; if ( this . featureNames . isDisallowedName ( name ) ) { final String validName = Utils . fixHiddenMember ( field . getName ( ) ) ; error ( MessageFormat . format ( Messages . SARLValidator_41 , field . getName ( ) ) , field , XTEND_FIELD__NAME , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , VARIABLE_NAME_DISALLOWED , validName ) ; } else if ( this . grammarAccess . getOccurrenceKeyword ( ) . equals ( field . getName ( ) ) ) { error ( MessageFormat . format ( Messages . SARLValidator_41 , this . grammarAccess . getOccurrenceKeyword ( ) ) , field , XTEND_FIELD__NAME , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , VARIABLE_NAME_DISALLOWED ) ; } }
Check if the given field has a valid name .
253
10
34,077
@ Check public void checkFieldNameShadowing ( SarlField field ) { if ( ! isIgnored ( VARIABLE_NAME_SHADOWING ) && ! Utils . isHiddenMember ( field . getName ( ) ) ) { final JvmField inferredField = this . associations . getJvmField ( field ) ; final Map < String , JvmField > inheritedFields = new TreeMap <> ( ) ; Utils . populateInheritanceContext ( inferredField . getDeclaringType ( ) , null , null , inheritedFields , null , null , this . sarlActionSignatures ) ; final JvmField inheritedField = inheritedFields . get ( field . getName ( ) ) ; if ( inheritedField != null ) { int nameIndex = 0 ; String newName = field . getName ( ) + nameIndex ; while ( inheritedFields . containsKey ( newName ) ) { ++ nameIndex ; newName = field . getName ( ) + nameIndex ; } addIssue ( MessageFormat . format ( Messages . SARLValidator_42 , field . getName ( ) , inferredField . getDeclaringType ( ) . getQualifiedName ( ) , inheritedField . getQualifiedName ( ) ) , field , XTEND_FIELD__NAME , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , VARIABLE_NAME_SHADOWING , newName ) ; } } }
Check if the given field has a name that is shadowing an inherited field .
308
16
34,078
@ Check ( CheckType . FAST ) public void checkParameterName ( SarlFormalParameter parameter ) { if ( this . grammarAccess . getOccurrenceKeyword ( ) . equals ( parameter . getName ( ) ) ) { error ( MessageFormat . format ( Messages . SARLValidator_14 , this . grammarAccess . getOccurrenceKeyword ( ) ) , parameter , XtendPackage . Literals . XTEND_PARAMETER__NAME , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , VARIABLE_NAME_DISALLOWED ) ; } }
Check if the given parameter has a valid name .
128
10
34,079
@ Check ( CheckType . FAST ) public void checkParameterName ( XVariableDeclaration variable ) { if ( this . grammarAccess . getOccurrenceKeyword ( ) . equals ( variable . getName ( ) ) ) { error ( MessageFormat . format ( Messages . SARLValidator_15 , this . grammarAccess . getOccurrenceKeyword ( ) ) , variable , XbasePackage . Literals . XVARIABLE_DECLARATION__NAME , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , VARIABLE_NAME_DISALLOWED ) ; } }
Check if the given local variable has a valid name .
128
11
34,080
@ Check public void checkRedundantImplementedInterfaces ( SarlSkill skill ) { checkRedundantInterfaces ( skill , SARL_SKILL__IMPLEMENTS , skill . getImplements ( ) , Utils . singletonList ( skill . getExtends ( ) ) ) ; }
Check if implemented interfaces of a skill are redundant .
66
10
34,081
@ Check public void checkRedundantImplementedInterfaces ( SarlClass xtendClass ) { checkRedundantInterfaces ( xtendClass , XTEND_CLASS__IMPLEMENTS , xtendClass . getImplements ( ) , Utils . singletonList ( xtendClass . getExtends ( ) ) ) ; }
Check if implemented interfaces of a Xtend Class are redundant .
77
13
34,082
@ Check public void checkRedundantImplementedInterfaces ( SarlInterface xtendInterface ) { checkRedundantInterfaces ( xtendInterface , XTEND_INTERFACE__EXTENDS , xtendInterface . getExtends ( ) , Collections . < JvmTypeReference > emptyList ( ) ) ; }
Check if implemented interfaces of a Xtend Interface are redundant .
71
13
34,083
@ Check ( CheckType . FAST ) public void checkBehaviorUnitGuardType ( SarlBehaviorUnit behaviorUnit ) { final XExpression guard = behaviorUnit . getGuard ( ) ; if ( guard != null ) { if ( this . operationHelper . hasSideEffects ( null , guard ) ) { error ( Messages . SARLValidator_53 , guard , null , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , INVALID_INNER_EXPRESSION ) ; return ; } if ( guard instanceof XBooleanLiteral ) { final XBooleanLiteral booleanLiteral = ( XBooleanLiteral ) guard ; if ( booleanLiteral . isIsTrue ( ) ) { if ( ! isIgnored ( DISCOURAGED_BOOLEAN_EXPRESSION ) ) { addIssue ( Messages . SARLValidator_54 , booleanLiteral , null , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , DISCOURAGED_BOOLEAN_EXPRESSION ) ; } } else if ( ! isIgnored ( UNREACHABLE_BEHAVIOR_UNIT ) ) { addIssue ( Messages . SARLValidator_55 , behaviorUnit , null , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , UNREACHABLE_BEHAVIOR_UNIT , behaviorUnit . getName ( ) . getSimpleName ( ) ) ; } return ; } final LightweightTypeReference fromType = getActualType ( guard ) ; if ( ! fromType . isAssignableFrom ( Boolean . TYPE ) ) { error ( MessageFormat . format ( Messages . SARLValidator_38 , getNameOfTypes ( fromType ) , boolean . class . getName ( ) ) , guard , null , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , INCOMPATIBLE_TYPES ) ; } } }
Check the type of the behavior unit s guard .
420
10
34,084
@ Check ( CheckType . FAST ) public void checkCapacityTypeForUses ( SarlCapacityUses uses ) { for ( final JvmParameterizedTypeReference usedType : uses . getCapacities ( ) ) { final LightweightTypeReference ref = toLightweightTypeReference ( usedType ) ; if ( ref != null && ! this . inheritanceHelper . isSarlCapacity ( ref ) ) { error ( MessageFormat . format ( Messages . SARLValidator_57 , usedType . getQualifiedName ( ) , Messages . SARLValidator_58 , this . grammarAccess . getUsesKeyword ( ) ) , usedType , null , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , INVALID_CAPACITY_TYPE , usedType . getSimpleName ( ) ) ; } } }
Check the type of the capacity uses .
180
8
34,085
@ Check ( CheckType . FAST ) public void checkActionFires ( SarlAction action ) { for ( final JvmTypeReference event : action . getFiredEvents ( ) ) { final LightweightTypeReference ref = toLightweightTypeReference ( event ) ; if ( ref != null && ! this . inheritanceHelper . isSarlEvent ( ref ) ) { error ( MessageFormat . format ( Messages . SARLValidator_57 , event . getQualifiedName ( ) , Messages . SARLValidator_62 , this . grammarAccess . getFiresKeyword ( ) ) , event , null , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , INVALID_FIRING_EVENT_TYPE , event . getSimpleName ( ) ) ; } } }
Check the types of the parameters of the fires statement .
168
11
34,086
@ Check ( CheckType . FAST ) public void checkSuperTypes ( SarlCapacity capacity ) { checkSuperTypes ( capacity , SARL_CAPACITY__EXTENDS , capacity . getExtends ( ) , Capacity . class , false ) ; }
Check if the supertype of the given capacity is a subtype of Capacity .
55
16
34,087
@ Check ( CheckType . FAST ) public void checkSuperType ( SarlSkill skill ) { final int nbSuperTypes = checkSuperTypes ( skill , SARL_SKILL__EXTENDS , Utils . singletonList ( skill . getExtends ( ) ) , Skill . class , false ) ; checkImplementedTypes ( skill , SARL_SKILL__IMPLEMENTS , skill . getImplements ( ) , Capacity . class , nbSuperTypes > 0 ? 0 : 1 , true ) ; }
Check if the supertype of the given skill is a subtype of Skill .
113
16
34,088
@ Check ( CheckType . FAST ) public void checkSuperType ( SarlEvent event ) { checkSuperTypes ( event , SARL_EVENT__EXTENDS , Utils . singletonList ( event . getExtends ( ) ) , Event . class , false ) ; }
Check if the supertype of the given event is a subtype of Event .
61
16
34,089
@ Check ( CheckType . FAST ) public void checkSuperType ( SarlBehavior behavior ) { checkSuperTypes ( behavior , SARL_BEHAVIOR__EXTENDS , Utils . singletonList ( behavior . getExtends ( ) ) , Behavior . class , false ) ; }
Check if the supertype of the given behavior is a subtype of Behavior .
64
16
34,090
@ Check ( CheckType . FAST ) public void checkSuperType ( SarlAgent agent ) { checkSuperTypes ( agent , SARL_AGENT__EXTENDS , Utils . singletonList ( agent . getExtends ( ) ) , Agent . class , false ) ; }
Check if the supertype of the given agent is a subtype of Agent .
61
16
34,091
protected boolean checkImplementedTypes ( XtendTypeDeclaration element , EReference feature , List < ? extends JvmTypeReference > implementedTypes , Class < ? > expectedType , int mandatoryNumberOfTypes , boolean onlySubTypes ) { boolean success = true ; int nb = 0 ; int index = 0 ; for ( final JvmTypeReference superType : implementedTypes ) { final LightweightTypeReference ref = toLightweightTypeReference ( superType ) ; if ( ref != null && ( ! ref . isInterfaceType ( ) || ! ref . isSubtypeOf ( expectedType ) || ( onlySubTypes && ref . isType ( expectedType ) ) ) ) { final String msg ; if ( onlySubTypes ) { msg = Messages . SARLValidator_72 ; } else { msg = Messages . SARLValidator_73 ; } error ( MessageFormat . format ( msg , superType . getQualifiedName ( ) , expectedType . getName ( ) , element . getName ( ) ) , element , feature , index , INVALID_IMPLEMENTED_TYPE , superType . getSimpleName ( ) ) ; success = false ; } else { ++ nb ; } ++ index ; } if ( nb < mandatoryNumberOfTypes ) { error ( MessageFormat . format ( Messages . SARLValidator_74 , expectedType . getName ( ) , element . getName ( ) ) , element , feature , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , MISSING_TYPE ) ; success = false ; } return success ; }
Check the implemeted type .
334
8
34,092
@ Check ( CheckType . FAST ) public void checkBehaviorUnitEventType ( SarlBehaviorUnit behaviorUnit ) { final JvmTypeReference event = behaviorUnit . getName ( ) ; final LightweightTypeReference ref = toLightweightTypeReference ( event ) ; if ( ref == null || ! this . inheritanceHelper . isSarlEvent ( ref ) ) { error ( MessageFormat . format ( Messages . SARLValidator_75 , event . getQualifiedName ( ) , Messages . SARLValidator_62 , this . grammarAccess . getOnKeyword ( ) ) , event , null , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , TYPE_BOUNDS_MISMATCH ) ; } }
Check if the parameter of the bahavior unit is an event .
157
14
34,093
@ Check ( CheckType . FAST ) public void checkCapacityFeatures ( SarlCapacity capacity ) { if ( capacity . getMembers ( ) . isEmpty ( ) ) { if ( ! isIgnored ( DISCOURAGED_CAPACITY_DEFINITION ) ) { addIssue ( Messages . SARLValidator_77 , capacity , null , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , DISCOURAGED_CAPACITY_DEFINITION , capacity . getName ( ) , "aFunction" ) ; //$NON-NLS-1$ } } }
Check if a capacity has a feature defined inside .
131
10
34,094
@ Check ( CheckType . NORMAL ) public void checkUnusedCapacities ( SarlCapacityUses uses ) { if ( ! isIgnored ( UNUSED_AGENT_CAPACITY ) ) { final XtendTypeDeclaration container = uses . getDeclaringType ( ) ; final JvmDeclaredType jvmContainer = ( JvmDeclaredType ) this . associations . getPrimaryJvmElement ( container ) ; final Map < String , JvmOperation > importedFeatures = CollectionLiterals . newHashMap ( ) ; for ( final JvmOperation operation : jvmContainer . getDeclaredOperations ( ) ) { if ( Utils . isNameForHiddenCapacityImplementationCallingMethod ( operation . getSimpleName ( ) ) ) { importedFeatures . put ( operation . getSimpleName ( ) , operation ) ; } } final boolean isSkill = container instanceof SarlSkill ; int index = 0 ; for ( final JvmTypeReference capacity : uses . getCapacities ( ) ) { final LightweightTypeReference lreference = toLightweightTypeReference ( capacity ) ; if ( isSkill && lreference . isAssignableFrom ( jvmContainer ) ) { addIssue ( MessageFormat . format ( Messages . SARLValidator_22 , capacity . getSimpleName ( ) ) , uses , SARL_CAPACITY_USES__CAPACITIES , index , UNUSED_AGENT_CAPACITY , capacity . getSimpleName ( ) ) ; } else { final String fieldName = Utils . createNameForHiddenCapacityImplementationAttribute ( capacity . getIdentifier ( ) ) ; final String operationName = Utils . createNameForHiddenCapacityImplementationCallingMethodFromFieldName ( fieldName ) ; final JvmOperation operation = importedFeatures . get ( operationName ) ; if ( operation != null && ! isLocallyUsed ( operation , container ) ) { addIssue ( MessageFormat . format ( Messages . SARLValidator_78 , capacity . getSimpleName ( ) ) , uses , SARL_CAPACITY_USES__CAPACITIES , index , UNUSED_AGENT_CAPACITY , capacity . getSimpleName ( ) ) ; } } ++ index ; } } }
Check for unused capacities .
480
5
34,095
@ Check ( CheckType . NORMAL ) public void checkMultipleCapacityUses ( SarlCapacityUses uses ) { if ( ! isIgnored ( REDUNDANT_CAPACITY_USE ) ) { final XtendTypeDeclaration declaringType = uses . getDeclaringType ( ) ; if ( declaringType != null ) { final Set < String > previousCapacityUses = doGetPreviousCapacities ( uses , declaringType . getMembers ( ) . iterator ( ) ) ; int index = 0 ; for ( final JvmTypeReference capacity : uses . getCapacities ( ) ) { if ( previousCapacityUses . contains ( capacity . getIdentifier ( ) ) ) { addIssue ( MessageFormat . format ( Messages . SARLValidator_79 , capacity . getSimpleName ( ) ) , uses , SARL_CAPACITY_USES__CAPACITIES , index , REDUNDANT_CAPACITY_USE , capacity . getSimpleName ( ) ) ; } else { previousCapacityUses . add ( capacity . getIdentifier ( ) ) ; } ++ index ; } } } }
Check for multiple capacity use declaration .
243
7
34,096
@ Check public void checkReservedAnnotation ( XtendAnnotationTarget annotationTarget ) { if ( ! isIgnored ( USED_RESERVED_SARL_ANNOTATION ) ) { if ( annotationTarget . getAnnotations ( ) . isEmpty ( ) || ! isRelevantAnnotationTarget ( annotationTarget ) ) { return ; } final QualifiedName reservedPackage = this . qualifiedNameConverter . toQualifiedName ( EarlyExit . class . getPackage ( ) . getName ( ) ) ; final String earlyExitAnnotation = EarlyExit . class . getName ( ) ; for ( final XAnnotation annotation : annotationTarget . getAnnotations ( ) ) { final JvmType type = annotation . getAnnotationType ( ) ; if ( type != null && ! type . eIsProxy ( ) ) { if ( Objects . equal ( type . getIdentifier ( ) , earlyExitAnnotation ) ) { // Special case: EarlyExit is allowed on events for declaring early-exit events if ( ! ( annotationTarget instanceof SarlEvent ) ) { addIssue ( MessageFormat . format ( Messages . SARLValidator_87 , type . getSimpleName ( ) ) , annotation , USED_RESERVED_SARL_ANNOTATION ) ; } } else { final QualifiedName annotationName = this . qualifiedNameConverter . toQualifiedName ( type . getIdentifier ( ) ) ; if ( annotationName . startsWith ( reservedPackage ) ) { addIssue ( MessageFormat . format ( Messages . SARLValidator_87 , type . getSimpleName ( ) ) , annotation , USED_RESERVED_SARL_ANNOTATION ) ; } } } } } }
Check for reserved annotations .
372
5
34,097
protected static XMemberFeatureCall getRootOfMemberFeatureCallSequence ( EObject leaf , EObject container , Procedure1 < XMemberFeatureCall > feedback ) { EObject call = leaf ; EObject obj = EcoreUtil2 . getContainerOfType ( leaf . eContainer ( ) , XExpression . class ) ; while ( obj != null && ( container == null || obj != container ) ) { if ( ! ( obj instanceof XMemberFeatureCall ) ) { obj = null ; } else { final EObject previous = call ; final XMemberFeatureCall fcall = ( XMemberFeatureCall ) obj ; call = fcall ; if ( fcall . getActualReceiver ( ) == previous ) { // Sequence of calls, with the '.' char. if ( feedback != null ) { feedback . apply ( fcall ) ; } obj = EcoreUtil2 . getContainerOfType ( call . eContainer ( ) , XExpression . class ) ; } else if ( fcall . getActualArguments ( ) . contains ( previous ) ) { // The sequence is an argument of a function call. call = previous ; obj = null ; } else { obj = null ; } } } return call instanceof XMemberFeatureCall ? ( XMemberFeatureCall ) call : null ; }
Replies the member feature call that is the root of a sequence of member feature calls .
275
18
34,098
protected List < LightweightTypeReference > getParamTypeReferences ( JvmExecutable jvmExecutable , boolean wrapFromPrimitives , boolean wrapToPrimitives ) { assert ( wrapFromPrimitives && ! wrapToPrimitives ) || ( wrapToPrimitives && ! wrapFromPrimitives ) ; final List < LightweightTypeReference > types = newArrayList ( ) ; for ( final JvmFormalParameter parameter : jvmExecutable . getParameters ( ) ) { LightweightTypeReference typeReference = toLightweightTypeReference ( parameter . getParameterType ( ) ) ; if ( wrapFromPrimitives ) { typeReference = typeReference . getWrapperTypeIfPrimitive ( ) ; } else if ( wrapToPrimitives ) { typeReference = typeReference . getPrimitiveIfWrapperType ( ) ; } types . add ( typeReference ) ; } return types ; }
Retrieve the types of the formal parameters of the given JVM executable object .
185
16
34,099
@ Check public void checkUnmodifiableEventAccess ( SarlBehaviorUnit unit ) { final boolean enable1 = ! isIgnored ( DISCOURAGED_OCCURRENCE_READONLY_USE ) ; final XExpression root = unit . getExpression ( ) ; final String occurrenceKw = this . grammarAccess . getOccurrenceKeyword ( ) ; for ( final XFeatureCall child : EcoreUtil2 . getAllContentsOfType ( root , XFeatureCall . class ) ) { if ( occurrenceKw . equals ( child . getFeature ( ) . getIdentifier ( ) ) ) { checkUnmodifiableFeatureAccess ( enable1 , child , occurrenceKw ) ; } } }
Check for usage of the event functions in the behavior units .
153
12