Skip to content

Wrong code navigation with switch and def #405

@mauromol

Description

@mauromol

Consider the following:

package test15;
public enum MyEnum {
  A, B;
}

And:

package test15
class Test15 {
	void foo(String s, MyEnum e) {
		def d1, d2
		switch(e) {
			case MyEnum.A:
			 d1 = new Date()
			 d2 = new Date()
			 break
			case MyEnum.B:
			  d1 = null
			  d2 = null
			  break
		}
		foo(s, d1, d2)
	}

	void foo(String s, Date d1, Date d2) {
		
	}
}

Hit F3 over the call to foo(String, Date, Date) in foo(String, MyEnum) and/or look at the hover: Greclipse thinks that call is for foo(String, MyEnum) itself.
The cause of the problem seems to be d1 and d2 be declared as def together with the presence of the switch.
I think this case is a bit complicated to correctly analyse, but probably something can be done, because if you invoke Call Hierarchy (Ctrl+Alt+H) from foo(String, Date, Date), the call from foo(String, MyEnum) is correctly detected!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions