neilcsmith-net commented on code in PR #9173:
URL: https://github.com/apache/netbeans/pull/9173#discussion_r2745730082


##########
java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java:
##########
@@ -5996,7 +5996,7 @@ private Set<? extends TypeMirror> getSmartTypesImpl(Env 
env) throws IOException
                         path = new TreePath(path, mid);
                         TypeMirror typeMirror = 
controller.getTrees().getTypeMirror(path);
                         final ExecutableType midTM = typeMirror != null && 
typeMirror.getKind() == TypeKind.EXECUTABLE ? (ExecutableType) typeMirror : 
null;
-                        final ExecutableElement midEl = midTM == null ? null : 
(ExecutableElement) controller.getTrees().getElement(path);
+                        final ExecutableElement midEl = midTM != null && 
controller.getTrees().getElement(path) instanceof ExecutableElement ee ? ee : 
null;

Review Comment:
   Wouldn't mind seeing an example of how this should be written like this.  I 
think I understand what you're getting at but it seems very similar to what was 
there already.
   
   We don't have a utility that does this check somewhere?  Take TreePath, Kind 
and expected output Class?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
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

Reply via email to