You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Svatopluk Dedic (Jira)" <ji...@apache.org> on 2021/09/08 13:47:00 UTC
[jira] [Updated] (NETBEANS-5983) Static type analysis does not
consider instanceof type hint
[ https://issues.apache.org/jira/browse/NETBEANS-5983?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Svatopluk Dedic updated NETBEANS-5983:
--------------------------------------
Attachment: T.groovy
> Static type analysis does not consider instanceof type hint
> -----------------------------------------------------------
>
> Key: NETBEANS-5983
> URL: https://issues.apache.org/jira/browse/NETBEANS-5983
> Project: NetBeans
> Issue Type: Bug
> Components: groovy - Editor
> Reporter: Svatopluk Dedic
> Priority: Major
> Attachments: T.groovy
>
>
> Consider code like
> {code:java}
> public BindingHolder(BindingHolder parent, Object value) {
> if(value instanceof List) {
> def instance = value[0]; // ERROR
> ...
> }
> }
> {code}
> whent the editor parser uses static type analysis, it will report an error on the marker line, as *vlaue* is typed as *java.lang.Object*, which has no *get()* method.
> In this specific case, the subtree can be evaluated speculatively, supposing that *value* is instance of *List* - requires partial evaluation of if-conditions. Similar case when typecast precedes reference to an identifier.
> This must be probably fixed in Groovy; in NetBeans we can block the message and try to re-evaluate the AST subtree with a speculative type(s) found on path(s) to the code.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists