No hints found should be printed only if the hint is not found in any group.
1.1 --- a/cmdline/tool/src/org/netbeans/modules/jackpot30/cmdline/Main.java Sun Sep 04 16:45:52 2016 +0200
1.2 +++ b/cmdline/tool/src/org/netbeans/modules/jackpot30/cmdline/Main.java Sun Sep 04 16:57:57 2016 +0200
1.3 @@ -281,8 +281,6 @@
1.4 if (!groupConfig.rootFolders.isEmpty()) totalGroups++;
1.5 }
1.6
1.7 - System.err.println("totalGroups=" + totalGroups);
1.8 -
1.9 ProgressHandleWrapper progress = parsed.has("progress") ? new ProgressHandleWrapper(new ConsoleProgressHandleAbstraction(), ProgressHandleWrapper.prepareParts(totalGroups)) : new ProgressHandleWrapper(1);
1.10
1.11 Preferences hintSettingsPreferences;
1.12 @@ -336,6 +334,11 @@
1.13 return 1;
1.14 }
1.15
1.16 + if (result == GroupResult.NO_HINTS_FOUND) {
1.17 + System.err.println("no hints specified");
1.18 + return 1;
1.19 + }
1.20 +
1.21 return result == GroupResult.SUCCESS ? 0 : 1;
1.22 } catch (Throwable e) {
1.23 e.printStackTrace();
1.24 @@ -458,8 +461,7 @@
1.25 }
1.26
1.27 if (globalConfig.apply && !hints.iterator().hasNext()) {
1.28 - System.err.println("no hints specified");
1.29 - return GroupResult.FAILURE;
1.30 + return GroupResult.NO_HINTS_FOUND;
1.31 }
1.32
1.33 Object[] register2Lookup = new Object[] {
1.34 @@ -564,6 +566,13 @@
1.35 return other;
1.36 }
1.37 },
1.38 + NO_HINTS_FOUND {
1.39 + @Override
1.40 + public GroupResult join(GroupResult other) {
1.41 + if (other == NOTHING_TO_DO) return this;
1.42 + return other;
1.43 + }
1.44 + },
1.45 SUCCESS {
1.46 @Override
1.47 public GroupResult join(GroupResult other) {
2.1 --- a/cmdline/tool/test/unit/src/org/netbeans/modules/jackpot30/cmdline/MainTest.java Sun Sep 04 16:45:52 2016 +0200
2.2 +++ b/cmdline/tool/test/unit/src/org/netbeans/modules/jackpot30/cmdline/MainTest.java Sun Sep 04 16:57:57 2016 +0200
2.3 @@ -491,6 +491,46 @@
2.4 "--list");
2.5 }
2.6
2.7 + public void testNoHintsFoundWithGroups() throws Exception {
2.8 + doRunCompiler("package test;\n" +
2.9 + "public class Test {\n" +
2.10 + " private void test(java.util.Collection c) {\n" +
2.11 + " boolean b1 = c.isEmpty();\n" +
2.12 + " boolean b2 = c.size() != 0;\n" +
2.13 + " }\n" +
2.14 + "}\n",
2.15 + "",
2.16 + null,
2.17 + "cp/META-INF/upgrade/test.hint",
2.18 + "$coll.size() == 0 :: $coll instanceof java.util.Collection\n" +
2.19 + "=>\n" +
2.20 + "$coll.isEmpty()\n" +
2.21 + ";;",
2.22 + "src/test/Test.java",
2.23 + "package test;\n" +
2.24 + "public class Test {\n" +
2.25 + " private void test(java.util.Collection c) {\n" +
2.26 + " boolean b1 = c.size() == 0;\n" +
2.27 + " boolean b2 = c.size() != 0;\n" +
2.28 + " }\n" +
2.29 + "}\n",
2.30 + "src2/test/Test.java",
2.31 + "package test;\n" +
2.32 + "public class Test {\n" +
2.33 + " private void test(java.util.Collection c) {\n" +
2.34 + " boolean b1 = c.size() == 0;\n" +
2.35 + " boolean b2 = c.size() != 0;\n" +
2.36 + " }\n" +
2.37 + "}\n",
2.38 + null,
2.39 + DONT_APPEND_PATH,
2.40 + "--group",
2.41 + "--classpath ${workdir}/cp ${workdir}/src",
2.42 + "--group",
2.43 + "${workdir}/src2",
2.44 + "--apply");
2.45 + }
2.46 +
2.47 public void testGroupsParamEscape() throws Exception {
2.48 assertEquals(Arrays.asList("a b", "a\\b"),
2.49 Arrays.asList(Main.splitGroupArg("a\\ b a\\\\b")));