matthiasblaesing commented on code in PR #7333: URL: https://github.com/apache/netbeans/pull/7333#discussion_r1581440326
########## java/java.hints.declarative/src/org/netbeans/modules/java/hints/declarative/resources/duke.gif: ########## Review Comment: Please add an entry to `java/java.hints/licenseinfo.xml` for the file, with the license. ########## java/java.hints.declarative/src/org/netbeans/modules/java/hints/declarative/test/TestParser.java: ########## @@ -180,37 +187,42 @@ public static TestCase[] parse(String tests) { endIndicesArr[c++] = codeIndex + i; } - SourceVersion sourceLevel = DEFAULT_SOURCE_LEVEL; + SourceVersion sourceLevel = null; for (String option : options.split("[ \t]+")) { option = option.trim(); if (option.startsWith(SOURCE_LEVEL)) { option = option.substring(SOURCE_LEVEL.length()); - - //XXX: log if not found! - + if (option.startsWith("1.")) { + option = option.substring(2); + } for (SourceVersion v : SourceVersion.values()) { - if (option.equals("1." + v.name().substring("RELEASE_".length()))) { + if (option.equals(v.name().substring("RELEASE_".length()))) { sourceLevel = v; break; } } - } - - if (DISABLED.equals(option)) { + if (sourceLevel == null) { + LOG.warning("unsupported source version: " + option); Review Comment: I'm not sure this is a good idea. If you have a testcase and silently change the source version, it might succeed by luck. Isn't the testcase invalid if the source version is not supported? ########## java/java.hints.declarative/src/org/netbeans/modules/java/hints/declarative/DeclarativeHintRegistry.java: ########## @@ -229,8 +229,12 @@ private static Collection<? extends FileObject> findFilesRecursive(FileObject fo public static Map<HintMetadata, Collection<? extends HintDescription>> parseHintFile(@NonNull FileObject file) { String spec = Utilities.readFile(file); - - return spec != null ? parseHints(file, spec) : Collections.emptyMap(); + try { + return spec != null ? parseHints(file, spec) : Collections.emptyMap(); + } catch (Exception ex) { + LOG.log(Level.WARNING, "Can not parse hint file: "+file.toURL()+"\n"+spec, ex); + return Collections.emptyMap(); + } Review Comment: I think this is the wrong place to catch the exception. For example in `HintsActionProvider#invokeAction` could also just show info to the user, instead of reporting that "no hints" are present and giving the real info by an exclamation mark in the status bar. `TestPerformer#perform` most probably should report a broken test as test error. For `DeclarativeHintRegistry` it might be the right approach - not sure how it is really used. -- 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. To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- 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