[
https://issues.apache.org/jira/browse/NETBEANS-5935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17403803#comment-17403803
]
Svatopluk Dedic commented on NETBEANS-5935:
-------------------------------------------
Note that ASTPath.isInside method is hacked up to allow brute-force traversal
in all subtrees when path is constructed. this should be also fixed -> perf
improvement.
> Groovy ASTPath does not contain full path from root
> ---------------------------------------------------
>
> Key: NETBEANS-5935
> URL: https://issues.apache.org/jira/browse/NETBEANS-5935
> Project: NetBeans
> Issue Type: Bug
> Components: groovy - Editor
> Affects Versions: 12.4
> Reporter: Svatopluk Dedic
> Priority: Critical
> Fix For: 12.6
>
>
> Groovy API produces wrong data. For certain constructions, AST node levels
> are skipped in ASTPath(). Consider, for example the following code:
>
> {code:java}
> def result = GradleRunner.create()
> .withProjectDir(testProjectDir.root)
> .withArguments('dockerBuild')
> .withPluginClasspath()
> .build()
> {code}
> When ASTPath is used to search path to "A" in {{withArguments}}, the
> resulting path will contain:
>
> * (levels from class to statement OK)
> * DeclarationExpression(result) - OK
> * MethodCallExpression(expr1, build()) - OK
> * MethodCallExpression(expr2, withArguments()
> But the actual AST contains: build(withPluginClassPath(withArguments))) - the
> withPluginClasspath level is gone.
> This is caused by anomalies in line:column information in Groovy AST nodes.
> With the above example, positions provided by Groovy parser are as follows
> (copypaste from debugger)
>
> {noformat}
> value String "build" "build" value String "build" "build"
> lineNumber int 20 20
> columnNumber int 22 22
> lastLineNumber int 24 24
> lastColumnNumber int 25 25
> method ConstantExpression #18247
> org.codehaus.groovy.ast.expr.ConstantExpression@7eed0c39[build]
> lineNumber int 24 24
> columnNumber int 18 18
> lastLineNumber int 24 24
> lastColumnNumber int 23 23
> value String "withPluginClasspath" "withPluginClasspath"
> lineNumber int 23 23
> columnNumber int 18 18
> lastLineNumber int 23 23
> lastColumnNumber int 39 39
> method ConstantExpression #18263
> org.codehaus.groovy.ast.expr.ConstantExpression@e3678b4[withPluginClasspath]
>
> lineNumber int 23 23
> columnNumber int 18 18
> lastLineNumber int 23 23
> lastColumnNumber int 37 37
> value String "withArguments" "withArguments"
> lineNumber int 22 22
> columnNumber int 18 18
> lastLineNumber int 22 22
> lastColumnNumber int 46 46
> method ConstantExpression #18280
> org.codehaus.groovy.ast.expr.ConstantExpression@3042594a[withArguments]
> lineNumber int 22 22
> columnNumber int 18 18
> lastLineNumber int 22 22
> lastColumnNumber int 31 31
> value String "withProjectDir" "withProjectDir"
> lineNumber int 21 21
> columnNumber int 18 18
> lastLineNumber int 21 21
> lastColumnNumber int 53 53
> method ConstantExpression #18294
> org.codehaus.groovy.ast.expr.ConstantExpression@25fb46ab[withProjectDir]
> lineNumber int 21 21
> columnNumber int 18 18
> lastLineNumber int 21 21
> lastColumnNumber int 32 32
>
> value String "create" "create"
> lineNumber int 20 20
> columnNumber int 35 35
> lastLineNumber int 20 20
> lastColumnNumber int 43 43
> method ConstantExpression #16415
> org.codehaus.groovy.ast.expr.ConstantExpression@37691095[create]
> lineNumber int 20 20
> columnNumber int 35 35
> lastLineNumber int 20 20
> lastColumnNumber int 41 41 {noformat}
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists