Bug 280497 - Incorrect null result for IJavaProject.getClasspathEntryFor(IPath)
Summary: Incorrect null result for IJavaProject.getClasspathEntryFor(IPath)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 3.5.1   Edit
Assignee: Jay Arthanareeswaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 276707
  Show dependency tree
 
Reported: 2009-06-16 15:10 EDT by Paul Fullbright CLA
Modified: 2010-05-27 17:45 EDT (History)
5 users (show)

See Also:
srikanth_sankaran: review+


Attachments
test project (9.79 KB, application/zip)
2009-06-16 15:32 EDT, Paul Fullbright CLA
no flags Details
junit test plugin (6.26 KB, application/zip)
2009-06-16 15:37 EDT, Paul Fullbright CLA
no flags Details
patch possibility (1.06 KB, patch)
2009-06-16 15:45 EDT, Paul Fullbright CLA
no flags Details | Diff
Patch with tests (2.74 KB, patch)
2009-07-07 01:59 EDT, Jay Arthanareeswaran CLA
srikanth_sankaran: iplog+
srikanth_sankaran: review+
srikanth_sankaran: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Fullbright CLA 2009-06-16 15:10:39 EDT
This bug is similar to bug 276373.

If retrieving a classpath entry for a path that is relative to the project, and the classpath entry is specified absolutely on the project, the correct classpath entry is not returned.

Test project and JUnit test to follow.
Comment 1 Olivier Thomann CLA 2009-06-16 15:16:47 EDT
Jay, please investigate.
Comment 2 Paul Fullbright CLA 2009-06-16 15:32:13 EDT
Created attachment 139351 [details]
test project

This project is for use with the following test.  Simply put in your JUnit
target workspace and adjust the following:
- the classpath entry for the external library jar should match your directory
structure
- add a classpath variable VARIABLE_LIB that points to the variableLib.jar
- add a user library USER_LIB that includes the userLib.jar
Comment 3 Paul Fullbright CLA 2009-06-16 15:37:09 EDT
Created attachment 139352 [details]
junit test plugin

Contains two JUnit test classes:  TestIsOnClasspath, TestGetClasspathEntryFor.  Only the second is important for this bug.  The first is to test bug 276373.

My results:
testSimple - pass
testInternalJar - pass
testExternalJar - fail
testVariableJar - fail
testUserLibraryJar - pass (I was surprised!  But the user library setup figures
   out that the jar being added is an internal resource.)
testWebAppLibJar - fail
Comment 4 Paul Fullbright CLA 2009-06-16 15:40:52 EDT
One additional note:  while this method is internal, it is used by JavaModelManager.createJarPackageFragmentRootFrom(IFile, IJavaProject), which is where we're hitting our problems.  Creating a jar package fragment root from a jar file that is in the project and is on the classpath, although *absolutely* specified in the java build properties (or absolutely specified by the particular classpath container), returns null.
Comment 5 Paul Fullbright CLA 2009-06-16 15:45:17 EDT
Created attachment 139354 [details]
patch possibility

This patch fixes my test failures.
Comment 6 Jay Arthanareeswaran CLA 2009-07-07 01:59:14 EDT
Created attachment 140930 [details]
Patch with tests

Patch looks fine. I have added/modified the required tests.
Comment 7 Paul Fullbright CLA 2009-07-07 10:34:52 EDT
This and bug 276373 are blocking one of our milestone targeted bugs.  Can this fix possibly be moved to maintenance?
Comment 8 Srikanth Sankaran CLA 2009-07-08 03:11:09 EDT
Released in HEAD for 3.6M1 on Jay's behalf.
Comment 9 Srikanth Sankaran CLA 2009-07-08 03:14:00 EDT
(In reply to comment #7)
> This and bug 276373 are blocking one of our milestone targeted bugs.  Can this
> fix possibly be moved to maintenance?

Olivier, what do you think ?

Comment 10 Olivier Thomann CLA 2009-07-13 09:33:20 EDT
Blocking Dali JPA Tools is not an option.
Please backport for 3.5.1.

Reopening to get it fixed for 3.5.1.
Comment 11 Srikanth Sankaran CLA 2009-07-14 06:56:22 EDT
Fix backported and released to R3_5_maintenance branch.
Comment 12 Frederic Fusier CLA 2009-08-04 06:32:08 EDT
Verified for 3.6M1 using I20090802-2000.
Comment 13 Frederic Fusier CLA 2009-08-04 06:36:04 EDT
Ooops, should not have been set as VERIFIED...
Comment 14 Frederic Fusier CLA 2009-08-04 06:39:05 EDT
...as this will be done only while the 3.5.1 verification process.
Comment 15 Paul Fullbright CLA 2009-08-11 12:02:05 EDT
I have verified the fix for 3.6 M1 and 3.5 maintenance build M20090807-0800.