sdedic commented on a change in pull request #997: Simplifying semantic
highlighter.
URL: https://github.com/apache/incubator-netbeans/pull/997#discussion_r234198386
##########
File path:
java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/SemanticHighlighterBase.java
##########
@@ -727,6 +630,76 @@ private void handlePossibleIdentifier(TreePath expr,
Collection<UseTypes> type,
}
if (c != null) {
+ Collection<UseTypes> type = EnumSet.noneOf(UseTypes.class);
+
+ if (decl.getKind().isClass() || decl.getKind().isInterface()) {
+ if (!declaration) {
+ type.add(UseTypes.CLASS_USE);
+ }
+ } else if (decl.getKind().isField() ||
isLocalVariableClosure(decl)) {
+ if (!declaration) {
+ TreePath pathToCheck = getCurrentPath();
+ while (true) {
+ if
(pathToCheck.getParentPath().getLeaf().getKind() == Kind.POSTFIX_DECREMENT ||
+
pathToCheck.getParentPath().getLeaf().getKind() == Kind.POSTFIX_INCREMENT ||
+
pathToCheck.getParentPath().getLeaf().getKind() == Kind.PREFIX_DECREMENT ||
+
pathToCheck.getParentPath().getLeaf().getKind() == Kind.PREFIX_INCREMENT) {
+ type.add(UseTypes.WRITE);
+ pathToCheck = pathToCheck.getParentPath();
+ continue;
+ }
+ if
(CompoundAssignmentTree.class.isAssignableFrom(pathToCheck.getParentPath().getLeaf().getKind().asInterface())
&&
+ ((CompoundAssignmentTree)
pathToCheck.getParentPath().getLeaf()).getVariable() == pathToCheck.getLeaf()) {
+ type.add(UseTypes.WRITE);
+ pathToCheck = pathToCheck.getParentPath();
+ continue;
+ }
+ break;
+ }
+ if (pathToCheck.getParentPath().getLeaf().getKind() ==
Kind.ASSIGNMENT &&
+ ((AssignmentTree)
pathToCheck.getParentPath().getLeaf()).getVariable() == pathToCheck.getLeaf()) {
+ type.add(UseTypes.WRITE);
+ } else if
(pathToCheck.getParentPath().getLeaf().getKind() != Kind.EXPRESSION_STATEMENT) {
+ type.add(UseTypes.READ);
+ }
+ } else if (decl.getKind() == ElementKind.PARAMETER) {
+ Element method = decl.getEnclosingElement();
+
+ type.add(UseTypes.WRITE);
+
+ if
(getCurrentPath().getParentPath().getLeaf().getKind() == Kind.LAMBDA_EXPRESSION
&&
+ ((LambdaExpressionTree)
getCurrentPath().getParentPath().getLeaf()).getParameters().contains(getCurrentPath().getLeaf()))
{
+// type.add(UseTypes.READ);
Review comment:
dead code ?
----------------------------------------------------------------
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