mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: don't generate past participle name suggestion when the word contains anything other than an ascii letter
GitOrigin-RevId: e0271568a5b61d073b344c200c1ebf3490840930
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8ee2687772
commit
272585bf3c
+2
-1
@@ -115,6 +115,7 @@ public class PastParticipleTest {
|
||||
assertEquals("matches", pastParticiple("matches"));
|
||||
assertEquals("equals", pastParticiple("equals"));
|
||||
assertEquals("of", pastParticiple("of"));
|
||||
//assertEquals("running", generatePastParticiple("running"));
|
||||
assertEquals("проблем", pastParticiple("проблем"));
|
||||
assertEquals("string1", pastParticiple("string1"));
|
||||
}
|
||||
}
|
||||
@@ -105,9 +105,16 @@ public class PastParticiple {
|
||||
char c1 = toLowerCase(verb.charAt(length - 1));
|
||||
char c2 = toLowerCase(verb.charAt(length - 2));
|
||||
if (c1 == 's' && (c2 == 'e' || c2 == 'l')) return true;
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (!isAsciiLetter(verb.charAt(i))) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private static boolean isAsciiLetter(char c) {
|
||||
return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z';
|
||||
}
|
||||
|
||||
private static char toLowerCase(char c) {
|
||||
return (char)(c | 0x20); // cheap hack
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user