Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » ITypeBinding.getQualifiedName() ignores imports in case of implemented interface
ITypeBinding.getQualifiedName() ignores imports in case of implemented interface [message #1720569] Tue, 19 January 2016 12:08 Go to next message
Sergey Toshin is currently offline Sergey ToshinFriend
Messages: 56
Registered: May 2015
Member
Hi, I want to know is that designed or I'm doing something wrong.
I have a testing code:
package test;

import com.example.Interface;

public class Test implements Interface
{
	public void test()
	{
		
	}
}


We see, that I've written implicit import of Interface
import com.example.Interface;


Then I run this code
cu.accept(new ASTVisitor()
{
	public boolean visit(MethodDeclaration decl)
	{
		for(ITypeBinding binding : decl.resolveBinding().getDeclaringClass().getInterfaces())
		{
			System.out.println(binding.getQualifiedName());
		}
		return true;
	}
});


And output is
test.Interface


I believe that output should be
com.example.Interface


If not, why? Thanks

[Updated on: Tue, 19 January 2016 12:11]

Report message to a moderator

Re: ITypeBinding.getQualifiedName() ignores imports in case of implemented interface [message #1721451 is a reply to message #1720569] Wed, 27 January 2016 14:40 Go to previous messageGo to next message
Sergey Toshin is currently offline Sergey ToshinFriend
Messages: 56
Registered: May 2015
Member
Any ideas?
Re: ITypeBinding.getQualifiedName() ignores imports in case of implemented interface [message #1722449 is a reply to message #1721451] Thu, 04 February 2016 21:13 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Are you sure that com.example.Interface can be found by the compiler? Does the compilation unit cu have any compile errors?
Re: ITypeBinding.getQualifiedName() ignores imports in case of implemented interface [message #1724557 is a reply to message #1722449] Wed, 24 February 2016 15:45 Go to previous message
Sergey Toshin is currently offline Sergey ToshinFriend
Messages: 56
Registered: May 2015
Member
It works in cases when the dependence file (Interface.java) exists. But I believe it should work in any cases, because error recovery module should choose the best solution for each unit and com.example.Interface is the best
Previous Topic:Problem in importing Gradle project
Next Topic:Correct call for ASTParser.setEnvironment(...)
Goto Forum:
  


Current Time: Fri Apr 26 14:35:35 GMT 2024

Powered by FUDForum. Page generated in 0.03168 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top