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 2018/05/10 11:24:36 UTC

[GitHub] sdedic commented on a change in pull request #533: [NETBEANS-694] : Support convert to var for diamond operator and other fixes

sdedic commented on a change in pull request #533: [NETBEANS-694] : Support convert to var for diamond operator and other fixes
URL: https://github.com/apache/incubator-netbeans/pull/533#discussion_r187303971
 
 

 ##########
 File path: java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertToVarHint.java
 ##########
 @@ -156,8 +164,56 @@ private static boolean preConditionChecker(HintContext ctx) {
      * @param info : compilationInfo
      * @return true if Diagnostic Code is present in SKIPPED_ERROR_CODES
      */
-    private static boolean isDiagnosticCodeTobeSkipped(CompilationInfo info) {
+    private static boolean isDiagnosticCodeTobeSkipped(CompilationInfo info, Tree tree) {
+        long startPos = info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), tree);
+        long endPos = info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), tree);
+
         List<Diagnostic> diagnosticsList = info.getDiagnostics();
-        return diagnosticsList.stream().anyMatch((d) -> (SKIPPED_ERROR_CODES.contains(d.getCode())));
+        if (diagnosticsList.stream().filter((d)
+                -> ((d.getStartPosition() >= startPos) && (d.getEndPosition() <= endPos))).anyMatch((d)
 
 Review comment:
   can be this part of condition part of the `anyMatch` clause ?

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