rtaneja1 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_r187325989
########## 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: Done ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists