mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
UAST visitor visits constructor parameters of Java anonymous class creation expression (IDEA-172643)
This commit is contained in:
@@ -52,6 +52,7 @@ interface UObjectLiteralExpression : UCallExpression {
|
||||
override fun accept(visitor: UastVisitor) {
|
||||
if (visitor.visitObjectLiteralExpression(this)) return
|
||||
annotations.acceptList(visitor)
|
||||
valueArguments.acceptList(visitor)
|
||||
declaration.accept(visitor)
|
||||
visitor.afterVisitObjectLiteralExpression(this)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
public abstract class Foo<T> {
|
||||
private T name;
|
||||
|
||||
public Foo(T name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public abstract void bar();
|
||||
|
||||
public static void test() {
|
||||
new Foo<String>("Name") {
|
||||
@Override public void bar() {
|
||||
}
|
||||
}.bar();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
UFile (package = )
|
||||
UClass (name = Foo)
|
||||
UField (name = name)
|
||||
UMethod (name = Foo)
|
||||
UParameter (name = name)
|
||||
UBlockExpression
|
||||
UBinaryExpression (operator = =)
|
||||
UQualifiedReferenceExpression
|
||||
UThisExpression (label = null)
|
||||
USimpleNameReferenceExpression (identifier = name)
|
||||
USimpleNameReferenceExpression (identifier = name)
|
||||
UMethod (name = bar)
|
||||
UMethod (name = test)
|
||||
UBlockExpression
|
||||
UQualifiedReferenceExpression
|
||||
UObjectLiteralExpression
|
||||
ULiteralExpression (value = "Name")
|
||||
UClass (name = null)
|
||||
UMethod (name = bar)
|
||||
UAnnotation (fqName = java.lang.Override)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (bar))
|
||||
@@ -0,0 +1,13 @@
|
||||
public abstract class Foo {
|
||||
private var name: T
|
||||
public fun Foo(name: T) {
|
||||
this.name = name
|
||||
}
|
||||
public abstract fun bar() : void = UastEmptyExpression
|
||||
public static fun test() : void {
|
||||
anonymous Foo<String>("Name") {
|
||||
@Override public void bar() {
|
||||
}
|
||||
}.bar()
|
||||
}
|
||||
}
|
||||
@@ -35,4 +35,6 @@ class SimpleJavaRenderLogTest : AbstractJavaRenderLogTest() {
|
||||
@Test fun testEnumValueMembers() = doTest("Simple/EnumValueMembers.java")
|
||||
|
||||
@Test fun testQualifiedConstructorCall() = doTest("Simple/QualifiedConstructorCall.java")
|
||||
|
||||
@Test fun testAnonymousClassWithParameters() = doTest("Simple/AnonymousClassWithParameters.java")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user