sdedic commented on a change in pull request #2293:
URL: https://github.com/apache/netbeans/pull/2293#discussion_r486798647



##########
File path: 
java/java.hints/src/org/netbeans/modules/java/hints/introduce/Flow.java
##########
@@ -444,11 +445,45 @@ protected boolean isCanceled() {
             return cancel.isCanceled();
         }
 
+        private TreePath currentPath;
+
+        public TreePath getCurrentPath() {
+            return currentPath;
+        }
+
+        public Boolean scan(TreePath path, ConstructorData p) {
+            TreePath oldPath = currentPath;
+            try {
+                currentPath = path;
+                return super.scan(path.getLeaf(), p);
+            } finally {
+                currentPath = oldPath;
+            }
+        }
+
         @Override
         public Boolean scan(Tree tree, ConstructorData p) {
             resume(tree, resumeBefore);
             
-            Boolean result = super.scan(tree, p);
+            Boolean result;
+
+            if (tree != null) {

Review comment:
       Wouldn't it be beneficial to build the `visitSwitchExpression` and 
`visitYield` into baseclasses ?

##########
File path: 
java/java.hints/src/org/netbeans/modules/java/hints/introduce/Flow.java
##########
@@ -444,11 +445,45 @@ protected boolean isCanceled() {
             return cancel.isCanceled();
         }
 
+        private TreePath currentPath;
+
+        public TreePath getCurrentPath() {
+            return currentPath;
+        }
+
+        public Boolean scan(TreePath path, ConstructorData p) {
+            TreePath oldPath = currentPath;
+            try {
+                currentPath = path;
+                return super.scan(path.getLeaf(), p);
+            } finally {
+                currentPath = oldPath;
+            }
+        }
+
         @Override
         public Boolean scan(Tree tree, ConstructorData p) {
             resume(tree, resumeBefore);
             
-            Boolean result = super.scan(tree, p);
+            Boolean result;
+
+            if (tree != null) {

Review comment:
       Wouldn't it be beneficial to build the `visitSwitchExpression` and 
`visitYield` into baseclasses ?

##########
File path: 
java/java.hints/src/org/netbeans/modules/java/hints/introduce/Flow.java
##########
@@ -444,11 +445,45 @@ protected boolean isCanceled() {
             return cancel.isCanceled();
         }
 
+        private TreePath currentPath;
+
+        public TreePath getCurrentPath() {
+            return currentPath;
+        }
+
+        public Boolean scan(TreePath path, ConstructorData p) {
+            TreePath oldPath = currentPath;
+            try {
+                currentPath = path;
+                return super.scan(path.getLeaf(), p);
+            } finally {
+                currentPath = oldPath;
+            }
+        }
+
         @Override
         public Boolean scan(Tree tree, ConstructorData p) {
             resume(tree, resumeBefore);
             
-            Boolean result = super.scan(tree, p);
+            Boolean result;
+
+            if (tree != null) {

Review comment:
       Wouldn't it be beneficial to build the `visitSwitchExpression` and 
`visitYield` into baseclasses ?

##########
File path: 
java/java.hints/src/org/netbeans/modules/java/hints/introduce/Flow.java
##########
@@ -444,11 +445,45 @@ protected boolean isCanceled() {
             return cancel.isCanceled();
         }
 
+        private TreePath currentPath;
+
+        public TreePath getCurrentPath() {
+            return currentPath;
+        }
+
+        public Boolean scan(TreePath path, ConstructorData p) {
+            TreePath oldPath = currentPath;
+            try {
+                currentPath = path;
+                return super.scan(path.getLeaf(), p);
+            } finally {
+                currentPath = oldPath;
+            }
+        }
+
         @Override
         public Boolean scan(Tree tree, ConstructorData p) {
             resume(tree, resumeBefore);
             
-            Boolean result = super.scan(tree, p);
+            Boolean result;
+
+            if (tree != null) {

Review comment:
       Wouldn't it be beneficial to build the `visitSwitchExpression` and 
`visitYield` into baseclasses ?

##########
File path: 
java/java.hints/src/org/netbeans/modules/java/hints/introduce/Flow.java
##########
@@ -444,11 +445,45 @@ protected boolean isCanceled() {
             return cancel.isCanceled();
         }
 
+        private TreePath currentPath;
+
+        public TreePath getCurrentPath() {
+            return currentPath;
+        }
+
+        public Boolean scan(TreePath path, ConstructorData p) {
+            TreePath oldPath = currentPath;
+            try {
+                currentPath = path;
+                return super.scan(path.getLeaf(), p);
+            } finally {
+                currentPath = oldPath;
+            }
+        }
+
         @Override
         public Boolean scan(Tree tree, ConstructorData p) {
             resume(tree, resumeBefore);
             
-            Boolean result = super.scan(tree, p);
+            Boolean result;
+
+            if (tree != null) {

Review comment:
       Wouldn't it be beneficial to build the `visitSwitchExpression` and 
`visitYield` into baseclasses ?

##########
File path: 
java/java.hints/src/org/netbeans/modules/java/hints/introduce/Flow.java
##########
@@ -444,11 +445,45 @@ protected boolean isCanceled() {
             return cancel.isCanceled();
         }
 
+        private TreePath currentPath;
+
+        public TreePath getCurrentPath() {
+            return currentPath;
+        }
+
+        public Boolean scan(TreePath path, ConstructorData p) {
+            TreePath oldPath = currentPath;
+            try {
+                currentPath = path;
+                return super.scan(path.getLeaf(), p);
+            } finally {
+                currentPath = oldPath;
+            }
+        }
+
         @Override
         public Boolean scan(Tree tree, ConstructorData p) {
             resume(tree, resumeBefore);
             
-            Boolean result = super.scan(tree, p);
+            Boolean result;
+
+            if (tree != null) {

Review comment:
       Wouldn't it be beneficial to build the `visitSwitchExpression` and 
`visitYield` into baseclasses ?

##########
File path: 
java/java.hints/src/org/netbeans/modules/java/hints/introduce/Flow.java
##########
@@ -444,11 +445,45 @@ protected boolean isCanceled() {
             return cancel.isCanceled();
         }
 
+        private TreePath currentPath;
+
+        public TreePath getCurrentPath() {
+            return currentPath;
+        }
+
+        public Boolean scan(TreePath path, ConstructorData p) {
+            TreePath oldPath = currentPath;
+            try {
+                currentPath = path;
+                return super.scan(path.getLeaf(), p);
+            } finally {
+                currentPath = oldPath;
+            }
+        }
+
         @Override
         public Boolean scan(Tree tree, ConstructorData p) {
             resume(tree, resumeBefore);
             
-            Boolean result = super.scan(tree, p);
+            Boolean result;
+
+            if (tree != null) {

Review comment:
       Wouldn't it be beneficial to build the `visitSwitchExpression` and 
`visitYield` into baseclasses ?

##########
File path: 
java/java.hints/src/org/netbeans/modules/java/hints/introduce/Flow.java
##########
@@ -444,11 +445,45 @@ protected boolean isCanceled() {
             return cancel.isCanceled();
         }
 
+        private TreePath currentPath;
+
+        public TreePath getCurrentPath() {
+            return currentPath;
+        }
+
+        public Boolean scan(TreePath path, ConstructorData p) {
+            TreePath oldPath = currentPath;
+            try {
+                currentPath = path;
+                return super.scan(path.getLeaf(), p);
+            } finally {
+                currentPath = oldPath;
+            }
+        }
+
         @Override
         public Boolean scan(Tree tree, ConstructorData p) {
             resume(tree, resumeBefore);
             
-            Boolean result = super.scan(tree, p);
+            Boolean result;
+
+            if (tree != null) {

Review comment:
       Wouldn't it be beneficial to build the `visitSwitchExpression` and 
`visitYield` into baseclasses ?




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