Provide definitions for implicitly-defined script classes#117
Open
trustytrojan wants to merge 1 commit into
Open
Provide definitions for implicitly-defined script classes#117trustytrojan wants to merge 1 commit into
trustytrojan wants to merge 1 commit into
Conversation
…`s and `ImportNode`s where otherwise scripts were required to return an expression (last statement is an expression) Fix `NullPointerException` when requesting references for a `ClassExpression` of an implicit script class within the same file Add tests to `GroovyServicesDefinitionTests` for implicit script class definition requests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
ClassExpressions,ConstructorCallExpressions, andImportNodes using implicit script classes, where otherwise scripts were required to return an expression (or have its last statement be an expression) and the definition pointed to that expression.FixSee FixNullPointerExceptionwhen requesting references for aClassExpressionof an implicit script class within the same file. This was found when ctrl+clicking on the expressionmoduleAwithin the filemoduleA.groovywhile another file contained the statementimport moduleA.NullPointerExceptioninReferenceProvider#118GroovyServicesDefinitionTestsfor implicit script class definition requestsVisual testing
Create the file
moduleA.groovy. Do not define an explicit script class likeclass moduleA {}. Instead write a static and an instance method at the top-level of the script:In another Groovy script in the same directory as
moduleA.groovy, write:Then ctrl+click or use the "Go To Definition" feature of your editor on
moduleAwithin each statement. Your cursor should be placed at the first character ofmoduleA.groovy.