mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 19:02:13 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,4 +34,5 @@ contributor([:]) {
|
||||
category "org.codehaus.groovy.runtime.StringGroovyMethods"
|
||||
category "org.codehaus.groovy.runtime.SwingGroovyMethods"
|
||||
category "org.codehaus.groovy.runtime.XmlGroovyMethods"
|
||||
category "org.codehaus.groovy.vmplugin.v5.PluginDefaultGroovyMethods"
|
||||
}
|
||||
|
||||
+18
-2
@@ -60,7 +60,7 @@ public class AccessorResolverProcessor extends MethodResolverProcessor {
|
||||
if (mySearchForGetter) {
|
||||
if (element instanceof PsiMethod &&
|
||||
(importedName != null && isSimplePropertyGetter((PsiMethod)element, null) &&
|
||||
(myPropertyName.equals(getPropertyNameByGetter((PsiMethod)element, importedName)) || myPropertyName.equals(importedName)) ||
|
||||
(isAppropriatePropertyNameForGetter((PsiMethod)element, importedName, myPropertyName) || myPropertyName.equals(importedName)) ||
|
||||
importedName == null && isSimplePropertyGetter((PsiMethod)element, myPropertyName))) {
|
||||
return addAccessor((PsiMethod)element, state);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class AccessorResolverProcessor extends MethodResolverProcessor {
|
||||
else {
|
||||
if (element instanceof PsiMethod &&
|
||||
(importedName != null && isSimplePropertySetter((PsiMethod)element, null) &&
|
||||
(myPropertyName.equals(getPropertyNameBySetterName(importedName)) || myPropertyName.equals(importedName)) ||
|
||||
(isAppropriatePropertyNameForSetter(importedName, myPropertyName) || myPropertyName.equals(importedName)) ||
|
||||
importedName == null && isSimplePropertySetter((PsiMethod)element, myPropertyName))) {
|
||||
return addAccessor((PsiMethod)element, state);
|
||||
}
|
||||
@@ -76,6 +76,22 @@ public class AccessorResolverProcessor extends MethodResolverProcessor {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* use only for imported properties
|
||||
*/
|
||||
private static boolean isAppropriatePropertyNameForSetter(@NotNull String importedName, @NotNull String propertyName) {
|
||||
propertyName = decapitalize(propertyName);
|
||||
return propertyName.equals(getPropertyNameBySetterName(importedName));
|
||||
}
|
||||
|
||||
/**
|
||||
* use only for imported properties
|
||||
*/
|
||||
private static boolean isAppropriatePropertyNameForGetter(@NotNull PsiMethod getter, @NotNull String importedNameForGetter, @NotNull String propertyName) {
|
||||
propertyName = decapitalize(propertyName);
|
||||
return propertyName.equals(getPropertyNameByGetter(getter, importedNameForGetter));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getPropertyNameByGetter(PsiMethod element, String importedName) {
|
||||
return getPropertyNameByGetterName(importedName, isBoolean(element));
|
||||
|
||||
+91
@@ -946,4 +946,95 @@ println ([[new A()]].stri<caret>ng)
|
||||
|
||||
assertNotNull(resolved)
|
||||
}
|
||||
|
||||
void testImportedProperty() {
|
||||
myFixture.addFileToProject('pack/Const.groovy', '''\
|
||||
package pack
|
||||
|
||||
class Const {
|
||||
static final int Field1 = 2
|
||||
}
|
||||
''')
|
||||
|
||||
final ref = configureByText('''\
|
||||
import static pack.Const.getField1
|
||||
|
||||
print Fie<caret>ld1
|
||||
''')
|
||||
|
||||
assertNotNull(ref.resolve())
|
||||
}
|
||||
|
||||
void testImportedProperty2() {
|
||||
myFixture.addFileToProject('pack/Const.groovy', '''\
|
||||
package pack
|
||||
|
||||
class Const {
|
||||
static final int Field1 = 2
|
||||
}
|
||||
''')
|
||||
|
||||
final ref = configureByText('''\
|
||||
import static pack.Const.getField1
|
||||
|
||||
print fie<caret>ld1
|
||||
''')
|
||||
|
||||
assertNotNull(ref.resolve())
|
||||
}
|
||||
|
||||
void testImportedProperty3() {
|
||||
myFixture.addFileToProject('pack/Const.groovy', '''\
|
||||
package pack
|
||||
|
||||
class Const {
|
||||
static final int Field1 = 2
|
||||
}
|
||||
''')
|
||||
|
||||
final ref = configureByText('''\
|
||||
import static pack.Const.getField1 as getBar
|
||||
|
||||
print Ba<caret>r
|
||||
''')
|
||||
|
||||
assertNotNull(ref.resolve())
|
||||
}
|
||||
|
||||
void testImportedProperty4() {
|
||||
myFixture.addFileToProject('pack/Const.groovy', '''\
|
||||
package pack
|
||||
|
||||
class Const {
|
||||
static final int Field1 = 2
|
||||
}
|
||||
''')
|
||||
|
||||
final ref = configureByText('''\
|
||||
import static pack.Const.getField1 as getBar
|
||||
|
||||
print ba<caret>r
|
||||
''')
|
||||
|
||||
assertNotNull(ref.resolve())
|
||||
}
|
||||
|
||||
void testImportedProperty5() {
|
||||
myFixture.addFileToProject('pack/Const.groovy', '''\
|
||||
package pack
|
||||
|
||||
class Const {
|
||||
static final int field1 = 2
|
||||
}
|
||||
''')
|
||||
|
||||
final ref = configureByText('''\
|
||||
import static pack.Const.getField1
|
||||
|
||||
print Fie<caret>ld1
|
||||
''')
|
||||
|
||||
assertNotNull(ref.resolve())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user