Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 334277

Summary: Strange API tooling Error referencing a method (in SAXTransformerFactory) declared in a super class TransformerFactory
Product: [Eclipse Project] PDE Reporter: James Blackburn <jamesblackburn+eclipse>
Component: API ToolsAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Michael_Rennie, Olivier_Thomann
Version: 3.7Flags: Michael_Rennie: review+
Target Milestone: 3.7 M5   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Attachments:
Description Flags
configuration
none
Proposed fix none

Description James Blackburn CLA 2011-01-13 11:28:17 EST
Eclipse 3.7M4  (Eclipse SDK	3.7.0.I20101208-1300)

The line of code looks like:

SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();

I'm seeing the following API error:

Description	Resource	Path	Location	Type
The method SAXTransformerFactory.newInstance() referenced in org.eclipse.cdt.internal.ui.wizards.settingswizards.ProjectSettingsExportStrategy.finish(IProjectSettingsWizardPage) is not defined in the bundle's required execution environment: J2SE-1.5 	ProjectSettingsExportStrategy.java	/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards	line 95	API Usage Problem

According to:
http://download.oracle.com/javase/1.5.0/docs/api/javax/xml/transform/sax/SAXTransformerFactory.html
this method is defined as TransformerFactory.newInstance() which is extended by SAXTransformerFactory.


If I change this to:
TransformerFactory.newInstance();

The error goes away.

I have a Java 4, Java 5, and Java 6 execution environment installed. 

However I think this may be related to the PDE/API tools I've recently installed: 
    PDE/API Tools Environment Descriptions	1.0.100.v20101028-7C-7BF9JgLWLMBMMAMsLL
Comment 1 Olivier Thomann CLA 2011-01-13 11:36:32 EST
(In reply to comment #0)
> However I think this may be related to the PDE/API tools I've recently
> installed: 
>     PDE/API Tools Environment Descriptions   
> 1.0.100.v20101028-7C-7BF9JgLWLMBMMAMsLL
Could you please give me the exact bundle ids from the installation page ?

What version of CDT should I install to reproduce ?
Comment 2 James Blackburn CLA 2011-01-13 11:45:57 EST
Created attachment 186748 [details]
configuration

attached is my current eclipse configuration.

I'm using Eclipse Classic 3.7M4 with PDE API Tools installed from here:
http://download.eclipse.org/releases/indigo

To see the CDT plugins where this occurs, checkout from:
dev.eclipse.org/cvsroot/tools
Two plugins (should be sufficient):
org.eclipse.cdt/all/org.eclipse.cdt.core
org.eclipse.cdt/all/org.eclipse.cdt.ui

The error occurs in cdt ui:
src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsExportStrategy.java
Comment 3 Olivier Thomann CLA 2011-01-13 12:54:19 EST
Reproduced with a simple test case.
The problem comes from the fact that I don't do any lookup for static methods while checking the EEs defined for the project.
Working on it.
Comment 4 Olivier Thomann CLA 2011-01-13 13:11:14 EST
In fact the compiler generates the actual receiver type even if the method is static and it is defined in a super class.
So we actually need a method lookup when resolving the static method for checking the EEs defined for the bundle.
Comment 5 Olivier Thomann CLA 2011-01-13 13:33:05 EST
Created attachment 186767 [details]
Proposed fix
Comment 6 Olivier Thomann CLA 2011-01-13 13:33:26 EST
Michael, please review.
Comment 7 Olivier Thomann CLA 2011-01-19 21:36:22 EST
Released for 3.7M5.
Michael, please verify.
Comment 8 Michael Rennie CLA 2011-01-26 14:22:09 EST
verified in I20110126-0800