mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't produce type canonical texts with ?extends (EA-47528)
This commit is contained in:
@@ -46,7 +46,15 @@ public class SourceUtil {
|
||||
@Override
|
||||
public void visitLeaf(LeafElement leaf) {
|
||||
if (!REF_FILTER.contains(leaf.getElementType())) {
|
||||
buffer.append(leaf.getText());
|
||||
String leafText = leaf.getText();
|
||||
if (buffer.length() > 0 && leafText.length() > 0 && Character.isJavaIdentifierPart(leafText.charAt(0))) {
|
||||
char lastInBuffer = buffer.charAt(buffer.length() - 1);
|
||||
if (lastInBuffer == '?' || Character.isJavaIdentifierPart(lastInBuffer)) {
|
||||
buffer.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
buffer.append(leafText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -239,4 +239,9 @@ public class MiscPsiTest extends LightCodeInsightFixtureTestCase {
|
||||
assertFalse(assertInstanceOf(nestedBlock.getNode(), LazyParseableElement.class).isParsed());
|
||||
}
|
||||
|
||||
public void testTypeCanonicalText() {
|
||||
PsiType type = JavaPsiFacade.getElementFactory(getProject()).createTypeFromText("some .unknown. Foo<? extends String>", null);
|
||||
assertEquals("some.unknown.Foo<? extends String>", type.getCanonicalText());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user