Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324249 - ECF in HEAD uses classes not defined in its EE
Summary: ECF in HEAD uses classes not defined in its EE
Status: CLOSED FIXED
Alias: None
Product: ECF
Classification: RT
Component: ecf.filetransfer (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4.0   Edit
Assignee: Scott Lewis CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-01 17:13 EDT by John Arthorne CLA
Modified: 2010-10-20 11:31 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2010-09-01 17:13:58 EDT
I have various ECF projects loaded from HEAD, and there are several exceptions due to using class libraries not defined in your bundle's EE. There is a preference to enable these errors:

Preferences > Plugin Development > API Errors/Warnings > API Use > Invalid references to system libraries: Error.

Examples:

FileIDFactory references URI, but EE says J2SE 1.3 which doesn't contain URI

FileTransferID uses URI#compareTo, which is defined in Java 5, but bundle EE says 1.4.

Either the bundle EE's need to be updated, or the code changed to avoid using those class libraries.
Comment 1 Scott Lewis CLA 2010-09-01 18:48:37 EDT
Thanks for the report.  The use of EE 1.3 should have been replaced with 1.4 when use of URI was added, and since we're using CDC 1.1/Foundation 1.1 as the first EE (and it does include URI), the update to the second EE (1.3 in a couple of cases) was missed.

I've updated relevant plugins to specify EE of cdc 1.1 + jre 1.4 for those that were specifying cdc 1.1 + 1.3 previously (and now access/use URI, and so need cdc 1.1 or 1.4).  These changes released to HEAD (ECF 3.4 stream).  No changes to 3.3 stream (yet).

For use of URI.compareTo...1.4 (and cdc 1.1) does/did have a compareTo, and it's signature was

int compareTo(Object other)

1.5 introduced compareTo(URI other)

In our usage of URI.compareTo...we would like to use cdc 1.1 and 1.4 as minimum...but if I explicitly cast the compareTo URI argument to Object Eclipse gives me a warning about the cast being unnecessary.  So what's the appropriate thing to do in this case?  Do the Object cast and ignore the warning?  Not do the cast?  Something else?  Thanks.
Comment 2 John Arthorne CLA 2010-09-02 10:38:18 EDT
The compareTo problem is an interesting case. Olivier, do you have any thoughts on that? Without the cast, it will compile as compareTo(URI) when compiling against Java 5, which won't run on Java 1.4. As long as ECF is being built against the lower class library it should actually be fine. It is strange that the class libraries overloaded the method in this way...
Comment 3 Scott Lewis CLA 2010-10-18 14:30:02 EDT
I would like to deal with this issue in ECF 3.4 (proposed release on 10/29/2010), so would like an answer to the question posed in comment 1...how would/should we handle URI.compareTo...i.e. cast to Object?

Thanks.
Comment 4 Olivier Thomann CLA 2010-10-18 14:43:44 EDT
(In reply to comment #1)
> In our usage of URI.compareTo...we would like to use cdc 1.1 and 1.4 as
> minimum...but if I explicitly cast the compareTo URI argument to Object Eclipse
> gives me a warning about the cast being unnecessary.  So what's the appropriate
> thing to do in this case?  Do the Object cast and ignore the warning?  Not do
> the cast?  Something else?  Thanks.
If you have a 1.5 JDK on the classpath, then the cast is necessary to point to the method that is taking java.lang.Object as the parameter. I don't see another way to target the appropriate compareTo(..) method.
Comment 5 Scott Lewis CLA 2010-10-18 14:49:17 EDT
(In reply to comment #4)
> (In reply to comment #1)
> > In our usage of URI.compareTo...we would like to use cdc 1.1 and 1.4 as
> > minimum...but if I explicitly cast the compareTo URI argument to Object Eclipse
> > gives me a warning about the cast being unnecessary.  So what's the appropriate
> > thing to do in this case?  Do the Object cast and ignore the warning?  Not do
> > the cast?  Something else?  Thanks.
> If you have a 1.5 JDK on the classpath, then the cast is necessary to point to
> the method that is taking java.lang.Object as the parameter. I don't see
> another way to target the appropriate compareTo(..) method.

The current code in URIID casts to Object for calling URI.compareTo...so that's apparently ok with you?  If you respond yes, then I'll resolve this bug...or if you would prefer, please go ahead and resolve yourself.
Comment 6 Olivier Thomann CLA 2010-10-18 14:59:04 EDT
(In reply to comment #5)
> The current code in URIID casts to Object for calling URI.compareTo...so that's
> apparently ok with you?  If you respond yes, then I'll resolve this bug...or if
> you would prefer, please go ahead and resolve yourself.
I cannot find the current code for this class. It looks like it is only available using git and I don't have git installed.
Comment 7 Scott Lewis CLA 2010-10-18 15:27:31 EDT
(In reply to comment #6)
> (In reply to comment #5)
> > The current code in URIID casts to Object for calling URI.compareTo...so that's
> > apparently ok with you?  If you respond yes, then I'll resolve this bug...or if
> > you would prefer, please go ahead and resolve yourself.
> I cannot find the current code for this class. It looks like it is only
> available using git and I don't have git installed.

Right, we've moved to git.  It's available here:

http://git.eclipse.org/c/ecf/org.eclipse.ecf.git/tree/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/URIID.java
Comment 8 Scott Lewis CLA 2010-10-20 11:31:05 EDT
Closing this bug.  If we should be doing something other than what we are currently doing (i.e. casting to URI.compareTo(Object)), then please just re-open.