mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix stub-AST mismatch when typing 'enum' in a method
This commit is contained in:
@@ -142,7 +142,7 @@ public class JavaLightStubBuilder extends LightStubBuilder {
|
||||
return (result = false);
|
||||
}
|
||||
// local classes
|
||||
else if (type == JavaTokenType.CLASS_KEYWORD && last != JavaTokenType.DOT) {
|
||||
else if (type == JavaTokenType.CLASS_KEYWORD ? last != JavaTokenType.DOT : ElementType.CLASS_KEYWORD_BIT_SET.contains(type)) {
|
||||
return (result = false);
|
||||
}
|
||||
|
||||
|
||||
@@ -221,4 +221,16 @@ class Foo {
|
||||
PsiTestUtil.checkStubsMatchText(psiFile)
|
||||
}
|
||||
|
||||
void "test inserting enum keyword"() {
|
||||
String text = "class Foo { void foo() { return; } }"
|
||||
PsiFile psiFile = myFixture.addFileToProject("a.java", text)
|
||||
Document document = psiFile.getViewProvider().getDocument()
|
||||
|
||||
WriteCommandAction.runWriteCommandAction(project) {
|
||||
document.insertString(text.indexOf("return"), "enum Foo")
|
||||
}
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments()
|
||||
PsiTestUtil.checkStubsMatchText(psiFile)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user