mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-170804 Idea does't support @Newify annotation
This commit is contained in:
+7
-4
@@ -39,13 +39,13 @@ class NewifyMemberContributor : NonCodeMembersContributor() {
|
||||
for (annotation in listNewifyAnnotations(place)) {
|
||||
val newifiedClasses = GrAnnotationUtil.getClassArrayValue(annotation, "value", true)
|
||||
qualifier ?: newifiedClasses.flatMap { it.constructors.asList() }.forEach {
|
||||
ResolveUtil.processElement(processor, NewifiedConstructor(it, "by @Newify", it.name, true, arrayOf(PsiModifier.STATIC)), state)
|
||||
ResolveUtil.processElement(processor, NewifiedConstructor(it, "by @Newify", it.name, true), state)
|
||||
}
|
||||
val createNewMethods = GrAnnotationUtil.inferBooleanAttributeNotNull(annotation, "auto")
|
||||
val type = (qualifier as? GrReferenceExpression)?.resolve() as? PsiClass
|
||||
if (type != null && createNewMethods) {
|
||||
type.constructors.forEach {
|
||||
ResolveUtil.processElement(processor, NewifiedConstructor(it, "by @Newify", "new", false, arrayOf(PsiModifier.STATIC)), state)
|
||||
ResolveUtil.processElement(processor, NewifiedConstructor(it, "by @Newify", "new", false), state)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,13 +67,16 @@ class NewifyMemberContributor : NonCodeMembersContributor() {
|
||||
return (elem as? GrReferenceExpression)?.qualifierExpression
|
||||
}
|
||||
|
||||
class NewifiedConstructor(val myPrototype: PsiMethod, val myOriginInfo: String, val newName: String, val asConstructor: Boolean, val modifiers:Array<String>)
|
||||
class NewifiedConstructor(val myPrototype: PsiMethod,
|
||||
val myOriginInfo: String,
|
||||
val newName: String,
|
||||
val asConstructor: Boolean)
|
||||
: LightMethod(myPrototype.manager, myPrototype, myPrototype.containingClass!!), OriginInfoAwareElement, PsiMirrorElement {
|
||||
override fun getPrototype(): PsiElement {
|
||||
return myPrototype
|
||||
}
|
||||
|
||||
val myModifierList: LightModifierList = LightModifierList(myPrototype.manager, JavaLanguage.INSTANCE, *modifiers)
|
||||
val myModifierList: LightModifierList = LightModifierList(myPrototype.manager, JavaLanguage.INSTANCE, PsiModifier.STATIC)
|
||||
|
||||
|
||||
override fun getName(): String {
|
||||
|
||||
Reference in New Issue
Block a user