Bug 98434 - A non-1.5 project with 1.5 projects in the classpath does not show methods with generics
Summary: A non-1.5 project with 1.5 projects in the classpath does not show methods wi...
Status: CLOSED FIXED
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: 3.1 RC2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 98262 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-05 02:59 EDT by Michael East CLA
Modified: 2005-06-10 11:13 EDT (History)
2 users (show)

See Also:


Attachments
Sample projects (4.37 KB, application/zip)
2005-06-05 15:54 EDT, Michael East CLA
no flags Details
Editor with temporary error (8.44 KB, image/png)
2005-06-06 05:08 EDT, Dani Megert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael East CLA 2005-06-05 02:59:24 EDT
If code in a 1.4 project is using a method (static or otherwise) from code
inside a 1.5 project that has generics in the signature, an error marker appears
saying 'The method xxx ... is undefined for the type ...'.  Any methods using
generics do not appear in code assist.  Although the error is displayed, the
class file is still generated and runs fine.  I am using Eclipse 3.1 (build
I20050513-1415).

This bug only seems to happen with generics, and only when referring to the
project in the classpath (the new enumerations and varargs are unaffected).  The
marker and code assist behave correctly if using a jar or the 1.5 project's
class folder from the Libraries tab when setting the build path.
Comment 1 Dani Megert CLA 2005-06-05 05:49:46 EDT
You can only use 5.0 constructs if the project is set to 5.0. That's how the
builder works.
Comment 2 Michael East CLA 2005-06-05 15:54:16 EDT
Created attachment 22392 [details]
Sample projects
Comment 3 Michael East CLA 2005-06-05 15:55:03 EDT
I'm not suggesting that 1.4 should be able to make use of 1.5 constructs.  What
I'm saying is that if you have a 1.5 project and older 1.4 code is using it,
markers incorrectly appear saying that methods do not exist.

Please look at the two projects I'm attaching.  Project A is 1.4 compliant,
Project B is 1.5 compliant.

You'll see that in A, there is a marker saying 'The method foo(List) is
undefined for the type Blah'.  If you use code assist to get methods for Blah,
foo is not on the list.

The appropriate behaviour should be that "Blah.foo(List arg0)" appear in code
assist (whereas 1.5 projects would see "Blah.foo(List<String> list)"), and that
marker should not be there.  This is the bug, and it only happens with projects
in the buildpath.  If you export B into a jar and use it in A, "Blah.foo(List
arg0)" appears.  The project and the JAR should behave the same way.
Comment 4 Dani Megert CLA 2005-06-06 05:08:07 EDT
Created attachment 22408 [details]
Editor with temporary error

There's no error marker reported but a temporary problem is reported (see
attached picture) by JDT Core and the method is not reported by code assist.
Comment 5 Philipe Mulet CLA 2005-06-07 11:57:05 EDT
+1 for RC2

Source type converter should filter out 1.5 artifacts when client project is not
1.5 source level.
Comment 6 Jerome Lanneluc CLA 2005-06-08 04:39:53 EDT
*** Bug 98262 has been marked as a duplicate of this bug. ***
Comment 7 Jerome Lanneluc CLA 2005-06-08 05:03:18 EDT
Changed SourceTypeConverter to not convert 1.5 constructs if in 1.4 mode or below.
Added regression test ReconcilerTest#testTwoProjectsWithDifferentCompliance()
Comment 8 Olivier Thomann CLA 2005-06-09 09:49:19 EDT
Verified with N20050609-0010 + JDT/Core HEAD
Comment 9 Frederic Fusier CLA 2005-06-10 11:13:23 EDT
Verified for 3.1 RC2 using build I20050610-0010