Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 255811 - Wrong methods used in org.eclipse.core.contenttype
Summary: Wrong methods used in org.eclipse.core.contenttype
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M4   Edit
Assignee: Szymon Brandys CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-19 10:29 EST by Olivier Thomann CLA
Modified: 2008-12-01 11:50 EST (History)
2 users (show)

See Also:


Attachments
Fix v01 (3.35 KB, patch)
2008-12-01 11:49 EST, Szymon Brandys CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2008-11-19 10:29:26 EST
That bundle is supposed to be Foundation 1.0 compliant according to the 3.4 plan. Maybe this has changed for 3.5.
The EEs defined for this project are:
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
 CDC-1.0/Foundation-1.0,
 J2SE-1.3

And for the compilation, pde.build is forcing an J2SE-1.4 environment to be used:
jre.compilation.profile = J2SE-1.4

The bundle execution environment should be changed to 1.4 or some methods calls should be removed.

Here are the problems reported by the new validation tool from api tooling:
The method java.lang.String.matches(String) referenced in org.eclipse.core.runtime.content.XMLContentDescriber is not defined in bundle's required execution environment: J2SE-1.3
The method java.lang.StringBuffer.indexOf(String) referenced in org.eclipse.core.runtime.content.XMLContentDescriber is not defined in bundle's required execution environment: J2SE-1.3
The method java.lang.String.matches(String) referenced in org.eclipse.core.runtime.content.XMLContentDescriber is not defined in bundle's required execution environment: J2SE-1.3

Since 1.3 doesn't match, Foundation 1.0 is not even considered.

java.lang.String.matches(String) and java.lang.StringBuffer.indexOf(String) are methods available only in 1.4 and above.
Comment 1 Olivier Thomann CLA 2008-11-19 10:30:05 EST
So if this bundle is compiled using a pure J2SE-1.3 environment, it would not compile.
Comment 2 John Arthorne CLA 2008-11-19 15:34:41 EST
I suggest just switching to Foundation 1.1 / J2SE 1.4 here.
Comment 3 Szymon Brandys CLA 2008-11-20 12:16:32 EST
org.eclipse.core.contenttype depends on org.eclipse.equinox.common which has the minimal execution environment set to Foundation 1.1 / J2SE-1.4. So clients can't use org.eclipse.core.contenttype on Foundation 1.0 anyway.

John's suggestion looks good.
Comment 4 Szymon Brandys CLA 2008-11-21 05:43:15 EST
Fixed.
Comment 5 Olivier Thomann CLA 2008-11-28 12:23:58 EST
Using Foundation1.1 is good enough for the java.lang.StringBuffer#indexOf(String), but it doesn't fix the String.matches(..) calls.
This is still invalid for a foundation 1.1 profile.

I got these errors from last night build:
The method java.lang.String.matches(String) referenced in org.eclipse.core.runtime.content.XMLContentDescriber.internalDescribe(String, IContentDescription) is not defined in bundle's required execution environment: CDC-1.1/Foundation-1.1
The method java.lang.String.matches(String) referenced in org.eclipse.core.runtime.content.XMLContentDescriber.isCharsetValid(String) is not defined in bundle's required execution environment: CDC-1.1/Foundation-1.1 
Comment 6 Szymon Brandys CLA 2008-11-28 12:56:58 EST
Olivier, could you tell me how should I configure my Eclipse to see such errors? I use j2se-1.4 machine and the compliance level for the project is set to 1.4. What else should I do?
Comment 7 Olivier Thomann CLA 2008-11-28 13:14:29 EST
You should set the check for invalid references in the library to warnings or errors in your project settings.
Plug-in Development>API Errors/Warnings>General>Invalid references in system libraries.
By default this is set to ignore.
Comment 8 Szymon Brandys CLA 2008-12-01 11:49:02 EST
Created attachment 119168 [details]
Fix v01
Comment 9 Szymon Brandys CLA 2008-12-01 11:50:16 EST
Thanks Olivier. Released to HEAD.