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: Local classes are ignored #1739

Open
pyropeter opened this issue Apr 16, 2018 · 5 comments
Open

Java: Local classes are ignored #1739

pyropeter opened this issue Apr 16, 2018 · 5 comments
Assignees

Comments

@pyropeter
Copy link

Steps to reproduce:

Expected:

I expect ctags to create four tags for greet. It only creates one, inside the interface definition.

The option --kinds-Java=l, which is described with local variables, surprisingly influences this: An additional tag is emitted for the greet implementation inside EnglishGreeting. Still no tags are created for the implementations inside the anonymous classes.

@masatake masatake self-assigned this Apr 16, 2018
@masatake
Copy link
Member

Thank you for reporting.
Reproduced.
Could you give me shorter input?

@masatake
Copy link
Member

It seems that fixing this is not so easy.

masatake added a commit to masatake/ctags that referenced this issue May 21, 2018
… anonymous class)

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
masatake added a commit to masatake/ctags that referenced this issue May 22, 2018
… anonymous class)

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake
Copy link
Member

The input is recorded as a test case triggering the bug. See #1756.

@masatake
Copy link
Member

I'm working on reimplenting the java parser with using a parser generator.
What I got today is what you wanted:)

I have to work on this item more.

[yamato@master]~/var/ctags-peg/Units/parser-java.r/anonymous-class.b% cat input.java 
cat input.java 
// See #1739
public class input {
    interface greeting {
	public void greet(String word);
    }

    public void hello () {
	greeting g = new greeting() {
		public void greet (String word) {
		}
	};
	g.greet("hello");
    }
    public void bye () {
	greeting h = new greeting() {
		public void greet (String word) {
		}
	};
	h.greet("bye");
    }

}
[yamato@master]~/var/ctags-peg/Units/parser-java.r/anonymous-class.b% ../../../ctags --kinds-Java=+l --sort=no --fields=+liK -o - input.java
../../../ctags --kinds-Java=+l --sort=no --fields=+liK -o - input.java
input	input.java	/^public class input {$/;"	class	language:Java
greeting	input.java	/^    interface greeting {$/;"	interface	language:Java	class:input
greet	input.java	/^	public void greet(String word);$/;"	method	language:Java	interface:input.greeting
hello	input.java	/^    public void hello () {$/;"	method	language:Java	class:input
g	input.java	/^	greeting g = new greeting() {$/;"	local	language:Java	method:input.hello
AnonymousClass88b977650101	input.java	/^	greeting g = new greeting() {$/;"	class	language:Java	method:input.hello	inherits:greeting
greet	input.java	/^		public void greet (String word) {$/;"	method	language:Java	class:input.hello.AnonymousClass88b977650101
bye	input.java	/^    public void bye () {$/;"	method	language:Java	class:input
h	input.java	/^	greeting h = new greeting() {$/;"	local	language:Java	method:input.bye
AnonymousClass88b977650201	input.java	/^	greeting h = new greeting() {$/;"	class	language:Java	method:input.bye	inherits:greeting
greet	input.java	/^		public void greet (String word) {$/;"	method	language:Java	class:input.bye.AnonymousClass88b977650201

@masatake
Copy link
Member

masatake commented Feb 7, 2019

I have measured the performance of the new Java parser.
Too slow. 30 ~ 50 times slower than the current implementation.

I have to rewrite a new one without the parser generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants