You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2019/10/11 20:24:21 UTC

[GitHub] [netbeans] jlahoda commented on issue #1559: [NETBEANS-3218] Add inline hint support for literals used in constructors

jlahoda commented on issue #1559: [NETBEANS-3218] Add inline hint support for literals used in constructors
URL: https://github.com/apache/netbeans/pull/1559#issuecomment-541211470
 
 
   Doing e.g. "tree instanceof MethodInvocationTree" is not required in the trees API. If "tree.getKind() == Kind.METHOD_INVOCATION", then the tree can be cast to MethodInvocationTree, otherwise, it should not be cast, even if it the cast itself might pass.
   
   The instanceof ensures the instance in the "tree" variable can be cast to MethodInvocationTree, but it does not ensure the actual instance models the method invocation node, because the actual instance may be of e.g. type:
   class X implements MethodInvocationTree, NewClassTree, ... {}
   
   I.e. the actual implementation classes may implement any number of the API interfaces, so instanceof is unreliable. Tree.getKind() is the documented way to detect tree types.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists