Commits

Jan Lahoda committed 8d35f4b

Even more generic way to strip unwanted characters from the hint description.

Comments (0)

Files changed (2)

cmdline/tool/src/org/netbeans/modules/jackpot30/cmdline/Main.java

         }
 
         for (Entry<String, String> remap : toIdRemap.entrySet()) {
-            idDisplayName.replace(remap.getKey(), remap.getValue());
+            idDisplayName = idDisplayName.replace(remap.getKey(), remap.getValue());
         }
 
-        idDisplayName = "[" + idDisplayName.replaceAll("_+", "_") + "] ";
+        idDisplayName = idDisplayName.replaceAll("[^A-Za-z0-9]", "_").replaceAll("_+", "_");
+
+        idDisplayName = "[" + idDisplayName + "] ";
 
         System.out.println(FileUtil.getFileDisplayName(error.getFile()) + ":" + (lineNumber + 1) + ": warning: " + idDisplayName + error.getDescription());
         System.out.println(line);
     }
 
     private static final Map<String, String> toIdRemap = new HashMap<String, String>() {{
-        put(" ", "_");
-        put("-", "_");
-        put(".", "_");
-        put("(", "");
-        put(")", "");
         put("==", "equals");
         put("!=", "not_equals");
     }};

cmdline/tool/test/unit/src/org/netbeans/modules/jackpot30/cmdline/MainTest.java

             "}\n";
 
         doRunCompiler(golden,
-                      "${workdir}/src/test/Test.java:4: warning: Usage of .size() == 0 can be replaced with .isEmpty()\n" +
+                      "${workdir}/src/test/Test.java:4: warning: [Usage_of_size_equals_0] Usage of .size() == 0 can be replaced with .isEmpty()\n" +
                       "        boolean b1 = c.size() == 0;\n" +
                       "                     ^\n" +
-                      "${workdir}/src/test/Test.java:5: warning: Usage of .size() == 0 can be replaced with .isEmpty()\n" +
+                      "${workdir}/src/test/Test.java:5: warning: [Usage_of_size_equals_0] Usage of .size() == 0 can be replaced with .isEmpty()\n" +
                       "\tboolean b2 = c.size() == 0;\n" +
                       "\t             ^\n",
                       null,
             "}\n";
 
         doRunCompiler(golden,
-                      "${workdir}/src/test/Test.java:4: warning: Usage of .size() == 0 can be replaced with .isEmpty()\n" +
+                      "${workdir}/src/test/Test.java:4: warning: [Usage_of_size_equals_0] Usage of .size() == 0 can be replaced with .isEmpty()\n" +
                       "        boolean b = c.size() == 0;\n" +
                       "                    ^\n",
                       null,