Bug 331879 - Incorrect type visibility and/or import statement handling
Summary: Incorrect type visibility and/or import statement handling
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.7 M4   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-05 16:06 EST by Alexander Pavlenko CLA
Modified: 2010-12-08 03:00 EST (History)
4 users (show)

See Also:


Attachments
sample java file (706 bytes, text/plain)
2010-12-05 16:07 EST, Alexander Pavlenko CLA
no flags Details
screenshot 1 (33.64 KB, image/png)
2010-12-05 16:08 EST, Alexander Pavlenko CLA
no flags Details
screenshot 2 (34.23 KB, image/png)
2010-12-05 16:08 EST, Alexander Pavlenko CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pavlenko CLA 2010-12-05 16:06:39 EST
Build Identifier: 20100917-0705

I suppose it's a generic problem but I can demonstrate it on my example using Vaadin runtime library. When I just try to refer to com.vaadin.terminal.Terminal.ErrorEvent type in the parameter of terminalError method the Java Editor reports a problem although it shouldn't because the type is correctly imported. Meanwhile the problem diagnostics contains the wrong mention of com.vaadin.terminal.URIHandler.ErrorEvent.
If I use a fully qualified type in in the parameter declaration - problem disappears

Reproducible: Always

Steps to Reproduce:
1. Add vaadin-6.4.8.jar or any other version to classpath (can be downloaded here http://vaadin.com/downloading?package=release/6.4/6.4.8/vaadin-6.4.8.zip)
2. Open the sample VaadinApplicatin.java attached
3. See problems detected
Comment 1 Alexander Pavlenko CLA 2010-12-05 16:07:50 EST
Created attachment 184564 [details]
sample java file
Comment 2 Alexander Pavlenko CLA 2010-12-05 16:08:32 EST
Created attachment 184565 [details]
screenshot 1
Comment 3 Alexander Pavlenko CLA 2010-12-05 16:08:54 EST
Created attachment 184566 [details]
screenshot 2
Comment 4 Alexander Pavlenko CLA 2010-12-05 16:10:53 EST
Both com.vaadin.terminal.Terminal.ErrorEvent
and com.vaadin.terminal.Terminal.ErrorListener
are nested interfaces of the interface com.vaadin.terminal.Terminal
Comment 5 Dani Megert CLA 2010-12-06 06:37:46 EST
Can reproduce with I20101205-2000.

What does 'javac' do?
Comment 6 Srikanth Sankaran CLA 2010-12-07 06:51:54 EST
Can reproduce all the way to 3.3.2 which is the earliest version
I have a copy.

Actually I can reproduce with javac too :)

C:\jtests>C:\ibm-java2-sdk-50-win-i386\bin\javac.exe -g -Xlint:unchecked -Xlint:
deprecation -Xlint:rawtypes -sourcepath c:\jtests -source 1.5 -classpath C:\vaad
in-6.4.8\vaadin-6.4.8\WebContent\WEB-INF\lib\vaadin-6.4.8.jar VaadinApplication.
java
VaadinApplication.java:24: <anonymous ru.alfabank.orrpp.forms.VaadinApplication$
1> is not abstract and does not override abstract method terminalError(com.vaadi
n.terminal.Terminal.ErrorEvent) in com.vaadin.terminal.Terminal.ErrorListener
            public void terminalError(ErrorEvent event) {
                        ^
VaadinApplication.java:23: method does not override a method from its superclass

            @Override
             ^
2 errors
Comment 7 Srikanth Sankaran CLA 2010-12-07 07:24:50 EST
I believe what you are observing is the right behavior.
Since VaadinApplication extends Application and since
Application implements URIHandler, in the absence of
qualification, ErrorEvent should bind to URIHandler's
ErrorEvent (as it does).

Confirmed that JDK7 barks too.
Comment 8 Dani Megert CLA 2010-12-07 13:23:18 EST
>ErrorEvent should bind to URIHandler's ErrorEvent
Shouldn't it bind to imported com.vaadin.terminal.Terminal.ErrorEvent?
Comment 9 Srikanth Sankaran CLA 2010-12-08 00:33:43 EST
(In reply to comment #8)
> >ErrorEvent should bind to URIHandler's ErrorEvent
> Shouldn't it bind to imported com.vaadin.terminal.Terminal.ErrorEvent?

No, Since URIHandler is a super type of VaadinApplication, com.vaadin.terminal.URIHandler.ErrorEvent is a member (albeit
inherited) of VaadinApplication. So the unqualified reference to
ErrorEvent should bind to the member.

This is no different from :

import java.util.List;
public class Test {
	public interface List {
	}
	List l;
}

The field l's type is not java.util.List here.
Comment 10 Ayushman Jain CLA 2010-12-08 00:49:52 EST
Verified for 3.7M4 using build I20101205-2000.
Comment 11 Dani Megert CLA 2010-12-08 03:00:43 EST
(In reply to comment #9)
> (In reply to comment #8)
> > >ErrorEvent should bind to URIHandler's ErrorEvent
> > Shouldn't it bind to imported com.vaadin.terminal.Terminal.ErrorEvent?
> 
> No, Since URIHandler is a super type of VaadinApplication,
> com.vaadin.terminal.URIHandler.ErrorEvent is a member (albeit
> inherited) of VaadinApplication.
Ah, right!