sdedic commented on a change in pull request #997: Simplifying semantic 
highlighter.
URL: https://github.com/apache/incubator-netbeans/pull/997#discussion_r234193054
 
 

 ##########
 File path: 
java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/SemanticHighlighterBase.java
 ##########
 @@ -684,7 +581,20 @@ private void handlePossibleIdentifier(TreePath expr, 
Collection<UseTypes> type,
 //            if (decl == null) {
 //                c = Collections.singletonList(ColoringAttributes.UNDEFINED);
 //            }
-            
+
+            //for new <type>(), highlight <type> as a constructor:
+            if (decl != null && (decl.getKind().isClass() || 
decl.getKind().isInterface()) &&
 
 Review comment:
   Style: it could increase readaibility if:
   - the whole block is surrounded in `decl != null`. Maybe even short return 
if `decl == null` since the rest of code relies on at least one branch was 
executed
   - locals for `decl.getKind()`, `getCurrentPath().getLeaf() and 
getCurrentPath().getParentPath().getLeaf()`
   - the first two if-s have common parts, maybe nest in a common if ?
   - `decl.getKind().isClass() || decl.getKind().isInterface()` is repeated 
many times

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


With regards,
Apache Git Services

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