mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
bindToClass: avoid creation from text to preserve copyable user data (IDEA-196955)
This commit is contained in:
+6
-2
@@ -648,12 +648,11 @@ public class PsiJavaCodeReferenceElementImpl extends CompositePsiElement impleme
|
||||
PsiReferenceParameterList parameterList = getParameterList();
|
||||
if (parameterList != null) {
|
||||
PsiElement cur = getReferenceNameElement();
|
||||
do {
|
||||
while (cur != parameterList) {
|
||||
assert cur != null : getText();
|
||||
cur = cur.getNextSibling();
|
||||
text.append(cur.getText());
|
||||
}
|
||||
while (cur != parameterList);
|
||||
}
|
||||
|
||||
PsiJavaCodeReferenceElement ref;
|
||||
@@ -664,6 +663,11 @@ public class PsiJavaCodeReferenceElementImpl extends CompositePsiElement impleme
|
||||
throw new IncorrectOperationException(e.getMessage() + " [qname=" + qName + " class=" + aClass + ";" + aClass.getClass().getName() + "]");
|
||||
}
|
||||
|
||||
PsiReferenceParameterList refParameterList = ref.getParameterList();
|
||||
if (parameterList != null && refParameterList != null) {
|
||||
refParameterList.replace(parameterList);
|
||||
}
|
||||
|
||||
getTreeParent().replaceChildInternal(this, (TreeElement)ref.getNode());
|
||||
|
||||
if (!preserveQualification) {
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Test {
|
||||
static {
|
||||
List<MethodCandidate> l = new ArrayList<>();
|
||||
List<MethodCandidate1> l1 = new ArrayList<>();
|
||||
}
|
||||
|
||||
private static class MethodCandidate {
|
||||
}
|
||||
|
||||
private static class MethodCandidate1 {
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Super {
|
||||
private static class MethodCandidate {
|
||||
}
|
||||
|
||||
static {
|
||||
List<Super.MethodCandidate> l = new ArrayList<>();
|
||||
List<Super.MethodCandidate1> l1 = new ArrayList<>();
|
||||
}
|
||||
|
||||
private static class MethodCandidate1 {
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
class Test extends Super{
|
||||
}
|
||||
@@ -77,6 +77,7 @@ public class InlineSuperClassTest extends MultiFileTestCase {
|
||||
public void testTypeParameterBound() { doTest();}
|
||||
public void testInlineInterfaceDoNotChangeConstructor() { doTest(); }
|
||||
public void testArrayTypeElements() { doTest(); }
|
||||
public void testReferencesOnInnerClasses() { doTest(); }
|
||||
public void testConflictOnMemberNotAccessibleThroughInheritor() { doTest(true, false); }
|
||||
public void testOneAndKeepReferencesInAnotherInheritor() {
|
||||
doTest(false, true);
|
||||
|
||||
Reference in New Issue
Block a user