Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] goto definition doesn't work when generic method is present #6358

Open
ghostbuster91 opened this issue Apr 26, 2024 · 0 comments
Open
Labels
bug Something that is making a piece of functionality unusable java support Java support related tickets

Comments

@ghostbuster91
Copy link
Collaborator

Describe the bug

Given the following java code:

package com.example;

import hello.Foo;

public class Builder {

	static <T> void instance() {
	}

	void build() {
		String baz = Foo.baz();
	}
}

and some scala code in the same module:

package hello

object Foo {
  def baz: String = "SSSS"
}

Calling goto def. on Foo or baz from java returns empty results.

It seems to be connected with the presence of the generic parameter in the instance method.
If we comment out the whole instance method, goto def. starts to work correctly.

There is one more thing that I discovered which seems to be connected with another issue #6357

If we add class definition to the Foo file like so:

class Foo {}

object Foo {
  def baz: String = "SSSS"
}

Then both Foo and baz starts to navigating to Foo class definition.

Full project to reproduce the issue: https://github.com/ghostbuster91/demos/tree/goto-def-generic

Expected behavior

I would expect goto definition to navigate to the baz method inside the Foo object regardless of the presence of any type parameters in other methods.

Operating system

Linux

Editor/Extension

Nvim (nvim-metals)

Version of Metals

1.3.0

Extra context or search terms

goto definition, java

@tgodzik tgodzik added bug Something that is making a piece of functionality unusable java support Java support related tickets labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable java support Java support related tickets
Projects
None yet
Development

No branches or pull requests

2 participants