Community
Participate
Working Groups
The situation behind is caused by a mark "~" that occupies the position of keyword "return", which means the function faces two bugs, one is the lack of return, the other one is the redundant character. public static String parseName( String pattern, GregorianCalendar cal){ Map map=cal == null ? getTokenMap("") : getTokenMap(cal); return parseName(pattern,map); } public static boolean matchPattern( String name, String pattern, String extension){ if (!name.endsWith(extension)) { return false; } else { name=name.substring(0,name.length() - extension.length()); } HashMap map=new HashMap(); for (int i=0; i < TOKENS.length; i++) { int l=TOKENS[i].length() - 2; String rep=""; for (int j=0; j < l; j++) { rep+='%'; } map.put(TOKENS[i],rep); } String parsed=parseName(pattern,map); if (parsed.length() > name.length()) { ~ false; } else if (parsed.length() < name.length()) { String suffix=name.substring(parsed.length()); if (suffix.charAt(0) != SUFFIX_SEPARATOR) { return false; } else { for (int i=1; i < suffix.length(); i++) { if (!isNumber(suffix.charAt(i))) { return false; } } } } for (int i=0; i < parsed.length(); i++) { char pc=parsed.charAt(i); char nc=name.charAt(i); if (pc != nc && (pc != '%' || !isNumber(nc))) { return false; } } return true; } However, the response from ECJ is quite strange for blaming it on the lack of "throw". The report is shown below. ---------- 1. ERROR in C:\DataG\ArchiveNameHelper.java (at line 80) if (parsed.length() > name.length()) { ^ Syntax error on token "{", throw expected after this token ---------- 1 problem (1 error) The report cannot fetch this to any solutions whether add a command with "return" to complete the consumption of the function, or just delete the curious '~' to help the function more close to compiled.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
Moving to JDT Core, problem still exists. Stripped snippet: public static boolean matchPattern( String name, String parsed){ if (parsed.length() > name.length()) { ~ false; } for (int i=0; i < parsed.length(); i++) { char pc=parsed.charAt(i); char nc=name.charAt(i); if (pc != nc && (pc != '%' )) { return false; } } return true; } ECJ reports 2 errors instead of expected 1.