if (clazz == null) return false;
if (clazz.isInterface()) return false;
final GrModifierList modifierList = getModifierList();
+ if (GroovyPropertyUtils.isPropertyName(getName())) return false;
return modifierList == null || !modifierList.hasExplicitVisibilityModifiers();
}
* @return getter names
*/
public static String[] suggestGettersName(@NotNull String name) {
+ if (!isPropertyName(name)) return ArrayUtil.EMPTY_STRING_ARRAY;
return new String[]{getGetterNameBoolean(name), getGetterNameNonBoolean(name)};
}
+ public static boolean isPropertyName(String name) {
+ if (name.length() == 0) return false;
+ if (Character.isUpperCase(name.charAt(0)) && (name.length() == 1 || !Character.isUpperCase(name.charAt(1)))) return false;
+ return true;
+ }
+
public static String[] suggestSettersName(@NotNull String name) {
+ if (!isPropertyName(name)) return ArrayUtil.EMPTY_STRING_ARRAY;
return new String[]{getSetterName(name)};
}
assertNotNull(resolved);
}
- private void doTest() throws Exception {
+ public void testClassVsPropertyGetter() {
+ doTest();
+ }
+
+ private void doTest() {
doTest(getTestName(true) + "/" + getTestName(false) + ".groovy");
}
- private void doTest(String fileName) throws Exception {
+ private void doTest(String fileName) {
PsiReference ref = configureByFile(fileName);
PsiElement resolved = ref.resolve();
assertTrue(resolved instanceof PsiClass);
--- /dev/null
+class Currency {
+ static Currency newInstance() {}
+}
+
+class X {
+ def getCurrency() {
+ return Curre<ref>ncy.newInstance();
+ }
+}
\ No newline at end of file