Find Usages: Look for as-property usages of Java methods
This commit is contained in:
committed by
Alexey Sedunov
parent
7e9222f70a
commit
9c360ef05a
+2
-2
@@ -76,7 +76,7 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
||||
if (getter != null) {
|
||||
newGetter = new PropertyGetterDescriptorImpl(
|
||||
enhanced, getter.getAnnotations(), getter.getModality(), getter.getVisibility(),
|
||||
getter.hasBody(), getter.isDefault(), getter.isExternal(), getKind(), getter, SourceElement.NO_SOURCE);
|
||||
getter.hasBody(), getter.isDefault(), getter.isExternal(), getKind(), getter, getter.getSource());
|
||||
newGetter.initialize(enhancedReturnType);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
||||
if (setter != null) {
|
||||
newSetter = new PropertySetterDescriptorImpl(
|
||||
enhanced, setter.getAnnotations(), setter.getModality(), setter.getVisibility(),
|
||||
setter.hasBody(), setter.isDefault(), setter.isExternal(), getKind(), setter, SourceElement.NO_SOURCE);
|
||||
setter.hasBody(), setter.isDefault(), setter.isExternal(), getKind(), setter, setter.getSource());
|
||||
newSetter.initialize(setter.getValueParameters().get(0));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -322,7 +322,7 @@ public class LazyJavaClassMemberScope(
|
||||
|
||||
val setter = setterMethod?.let { setterMethod ->
|
||||
DescriptorFactory.createSetter(propertyDescriptor, setterMethod.annotations, /* isDefault = */false,
|
||||
/* isExternal = */ false, setterMethod.visibility)
|
||||
/* isExternal = */ false, setterMethod.visibility, setterMethod.source)
|
||||
}
|
||||
|
||||
return propertyDescriptor.apply { initialize(getter, setter) }
|
||||
|
||||
@@ -50,17 +50,7 @@ public class DescriptorFactory {
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations
|
||||
) {
|
||||
return createSetter(propertyDescriptor, annotations, true, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PropertySetterDescriptorImpl createSetter(
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal
|
||||
) {
|
||||
return createSetter(propertyDescriptor, annotations, isDefault, isExternal, propertyDescriptor.getVisibility());
|
||||
return createSetter(propertyDescriptor, annotations, true, false, propertyDescriptor.getSource());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -69,12 +59,24 @@ public class DescriptorFactory {
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
@NotNull Visibility visibility
|
||||
@NotNull SourceElement sourceElement
|
||||
) {
|
||||
return createSetter(propertyDescriptor, annotations, isDefault, isExternal, propertyDescriptor.getVisibility(), sourceElement);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PropertySetterDescriptorImpl createSetter(
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
@NotNull Visibility visibility,
|
||||
@NotNull SourceElement sourceElement
|
||||
) {
|
||||
PropertySetterDescriptorImpl setterDescriptor =
|
||||
new PropertySetterDescriptorImpl(propertyDescriptor, annotations, propertyDescriptor.getModality(),
|
||||
visibility, !isDefault, isDefault, isExternal,
|
||||
CallableMemberDescriptor.Kind.DECLARATION, null, propertyDescriptor.getSource());
|
||||
CallableMemberDescriptor.Kind.DECLARATION, null, sourceElement);
|
||||
setterDescriptor.initializeDefault();
|
||||
return setterDescriptor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user