Bug 101756 - [select] Open Declaration broken
Summary: [select] Open Declaration broken
Status: RESOLVED DUPLICATE of bug 90021
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-25 05:11 EDT by Hosam CLA
Modified: 2007-06-21 04:48 EDT (History)
0 users

See Also:


Attachments
Part of the class that shows the problem (654 bytes, text/plain)
2005-06-26 04:53 EDT, Hosam CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hosam CLA 2005-06-25 05:11:55 EDT
Using Eclipse 3.1RC3 on J2SE 5.0u4, WinXP Pro.
Project Settings: Compiler compliance level 1.4 (default settings)

I was writing the following inner class. Trying hyperlink navigation or open
declaration on the "super.addLast()" call below produces the error "does not
resolve to a java element". The code is below:

// code
class MyClass {
    // lots of code, and an inner class just before this one
    private class PriorityList extends LinkedList {
        public void add(Comparable object) {
            for (int i = 0; i < size(); i++) {
                if (object.compareTo(get(i)) <= 0) {
                    add(i, object);
                    return;
                }
            }
            super.addLast(object);
        }
    }
}
// end of code
Comment 1 Frederic Fusier CLA 2005-06-25 08:43:26 EDT
I cannot reproduce it neither using 3.1 RC3 nor 3.1 RC4...
Click F3 or use hyperlink on super.addLast(object) always opens editor on
LinkedList.class at correct position (ie. if I'm on "super" position is at top
of file, if I'm "addLast" position is at addlast method).
I've also tried both with JRE System Library 1.4 or 1.5 and it always works
correctly.
May you verify that your build ID is I20050617-1618?

Another point is you're using eclipse with an 1.5 VM. This is not recommended,
you should used an 1.4 VM instead, see
http://www.eclipse.org/eclipse/development/eclipse_project_plan_3_1.html#TargetOperatingEnvironments)
I don't know if this is can have any relation with your problem but you'd better
use a recommended VM...
Comment 2 Hosam CLA 2005-06-26 04:47:46 EDT
Thanks for your interest.

1) I'm using build I20050617-1618 (RC3). I'm using Sun JDK 1.5.0_04-b05.
2) Using hyperlink on "super" works fine, but not on "addLast".
3) I don't see a reason for using an older JVM. And I need JDK 5.0 anyway. In
fact I find it strange that JVM 5.0 is not one of the supported targets!

4) I'll attach another test case. Maybe this would help you.

Thanks again!

(In reply to comment #1)
> I cannot reproduce it neither using 3.1 RC3 nor 3.1 RC4...
> Click F3 or use hyperlink on super.addLast(object) always opens editor on
> LinkedList.class at correct position (ie. if I'm on "super" position is at top
> of file, if I'm "addLast" position is at addlast method).
> I've also tried both with JRE System Library 1.4 or 1.5 and it always works
> correctly.
> May you verify that your build ID is I20050617-1618?
> 
> Another point is you're using eclipse with an 1.5 VM. This is not recommended,
> you should used an 1.4 VM instead, see
>
http://www.eclipse.org/eclipse/development/eclipse_project_plan_3_1.html#TargetOperatingEnvironments)
> I don't know if this is can have any relation with your problem but you'd better
> use a recommended VM...
Comment 3 Hosam CLA 2005-06-26 04:53:59 EDT
Created attachment 24000 [details]
Part of the class that shows the problem

I added an attachment that reproduces the problem.
Using either F3 or hyperlink navigation on "add" (in the call "add(i,object)"),
or "addLast" (in the call "addLast(object)") results in the error "Current text
selection does not resolve to a Java element".
Comment 4 Frederic Fusier CLA 2005-06-26 05:12:52 EDT
Again, I cannot reproduce. Hyperlink or F3 works perfectly on you example using
RC3 or RC4. Perhaps, if not too big may you zip your workspace or project and
attach it to the bug.

About 1.5 VM, even if you need it to run your application, you definetely do not
need it to launch eclipse which is implemented to run with a 1.4 VM (we started
3.1 before Sun 1.5 VM was finalized...).

If you really want to continue to use eclipse with 1.5 VM, it's possible but
some problem may happen we cannot look at as all committers use 1.4 in their
development. I just want to you to make a try to know whether the problem comes
from the VM or not.

Last point, please do not copy/paste previous comment in your comment, bugzilla
keep comments history available when you look at bugs. This add unnecessary
length to the bug, thx.
You can refer to previous comment just saying "comment 2" and bugzilla will set
an hyperlink automatically for you...
Comment 5 Hosam CLA 2005-06-26 07:53:13 EDT
(In reply to comment #4)

Thanks.

I saw why you could not reproduce it today. Making a new Java Project and
pasting the file into it makes it work fine. But after that I changed the
Project Properties to use Java Compiler Compliance Level 1.4, leaving the other
default settings. This reproduces the problem on my machine.

I don't know, but I am guessing it might have something to do with generics.
Since I am setting the Eclipse JRE to use JDK 1.5, LinkedList methods in
"rt.jar" use generics. But setting the compiler compliance level to 1.4 means no
support for generics. I wonder whether this might be causing the problem.

Finally, sorry for leaving your message into my reply, but that's the default
behavior in BugZilla, and I simply did not alter it.

And thanks for all your efforts!
Comment 6 Hosam CLA 2005-06-26 09:07:04 EDT
I have just installed j2sdk1.4.2_08. After changing the project settings to use
the 1.4.2 JRE, I noticed that the problem was solved.

This makes me more convinced that it might be a problem in dealing with generics.
Comment 7 Frederic Fusier CLA 2005-06-26 11:21:57 EDT
Thanks for your effort too, I can now reproduce it :-).

Note that with this project configuration compliance level 1.4 and JRE System
Library 1.5, comment 0 simple test case is enough to reproduce the problem.
Comment 8 Frederic Fusier CLA 2005-06-26 11:30:17 EDT
David,
Problem is located in SelectionRequestor.acceptBinaryMethod(IType,...).
As compilation is done using 1.4 compliance level, parameterTypeNames and
parameterSignatures are respectively "[[O, b, j, e, c, t]]" and
"[Ljava.lang.Object;]" instead of "[[E]]" and "[TE;]" when compiling using 1.5
level.
As type is LinkedClass in JRE 1.5.0 library, type.getMethod(...) returns a
method which does not exist in JavaModel...

It seems really tricky to fix this kind of issue in this peculiar configuration
as there's no easy way to get correct 1.4 method in 1.5 binary type...
Comment 9 David Audel CLA 2007-06-21 04:48:34 EDT

*** This bug has been marked as a duplicate of bug 90021 ***