Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361660 - API Usage Problem "Execution environment references were not checked"
Summary: API Usage Problem "Execution environment references were not checked"
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: API Tools (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.8 M6   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-21 10:20 EDT by Greg Watson CLA
Modified: 2012-06-15 01:46 EDT (History)
10 users (show)

See Also:


Attachments
NPE stack trace (1.84 KB, text/plain)
2012-02-16 11:57 EST, John Cortell CLA
no flags Details
Proposed fix (3.01 KB, patch)
2012-02-16 12:14 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Watson CLA 2011-10-21 10:20:31 EDT
I've just moved my workspace from 3.7 to 4.2M2. Plugins in the workspace that have API tooling enabled now show an error marker and the message:

Execution environment references were not checked for 'plugin' because no environment descriptions are installed.

It is not clear what this message means or how to correct it. I have not been able to locate it in any documentation.
Comment 1 Olivier Thomann CLA 2011-10-21 10:31:19 EDT
You need to install the EE description from a p2 repository. Add the update site in the list of available update site:
http://download.eclipse.org/eclipse/updates/3.8-I-builds
Then select "Install New Software..".
Check that update site. Uncheck the option "Group items by category" and type "description" in the search field.
Then install all the API descriptions you want to use.

Hope this help.
Comment 2 Curtis Windatt CLA 2011-10-21 11:00:55 EDT
There is also a quickfix on that problem which will open the correct preference page.  Moving this bug to doc as we can add a blurb about it somewhere.
Comment 3 Greg Watson CLA 2011-10-21 14:43:57 EDT
I had to rebuild the projects, but otherwise this fixed the errors. Thanks!

I presume these will be installed by default in the final version?
Comment 4 Jeffrey Overbey CLA 2012-01-17 16:50:07 EST
I'm not seeing any EE descriptions at http://download.eclipse.org/eclipse/updates/3.8-I-builds following the instructions in Comment 1.  Did these move?
Comment 5 Curtis Windatt CLA 2012-01-17 17:33:12 EST
(In reply to comment #4)
> I'm not seeing any EE descriptions at
> http://download.eclipse.org/eclipse/updates/3.8-I-builds following the
> instructions in Comment 1.  Did these move?

They should be there.  The category still exists, but there are no entries currently.  Probably something wrong with the integration build that will be corrected in the near future.  I'll cc Kim so she is aware.
Comment 6 Paul Webster CLA 2012-01-17 17:36:01 EST
(In reply to comment #5)
> (In reply to comment #4)
> > I'm not seeing any EE descriptions at
> > http://download.eclipse.org/eclipse/updates/3.8-I-builds following the
> > instructions in Comment 1.  Did these move?
> 
> They should be there.  The category still exists, but there are no entries
> currently.  Probably something wrong with the integration build that will be
> corrected in the near future.  I'll cc Kim so she is aware.

Currently you can get them from http://download.eclipse.org/eclipse/updates/3.8milestones

There is a bug open about them missing from the I builds.

PW
Comment 7 Jeffrey Overbey CLA 2012-01-18 11:28:03 EST
Great; thanks for your help.
Comment 8 Doug Schaefer CLA 2012-01-27 20:00:07 EST
I'm still getting this with M5. And even after installing them I still get the error.
Comment 9 Doug Schaefer CLA 2012-01-27 20:01:35 EST
BTW, I'm talking about 4.2M5. I was using 3.8M4 and this workaround worked then. Haven't tried 3.8M5.
Comment 10 Paul Webster CLA 2012-01-30 08:18:08 EST
You might be seeing bug 369402 in M5
PW
Comment 11 John Cortell CLA 2012-02-16 11:34:35 EST
(In reply to comment #9)
> BTW, I'm talking about 4.2M5. I was using 3.8M4 and this workaround worked
> then. Haven't tried 3.8M5.

Ditto. I've just leaped into the E4 world with 4.2M5 and am seeing these issues building the CDT sources. I, too, installed the EEs as instructed with no relief.
Comment 12 Olivier Thomann CLA 2012-02-16 11:51:00 EST
(In reply to comment #11)
> Ditto. I've just leaped into the E4 world with 4.2M5 and am seeing these issues
> building the CDT sources. I, too, installed the EEs as instructed with no
> relief.
Select the project. Right-click>Properties>Plug-in Development>API Errors/Warnings>API Use.
What do you see in the "Execution Environment Descriptions" section ?

I got a case where the section was still empty even if I installed the descriptions. I had to do a restart with "-clean" to fix it.
Comment 13 John Cortell CLA 2012-02-16 11:56:55 EST
(In reply to comment #12)
> (In reply to comment #11)
> > Ditto. I've just leaped into the E4 world with 4.2M5 and am seeing these issues
> > building the CDT sources. I, too, installed the EEs as instructed with no
> > relief.
> Select the project. Right-click>Properties>Plug-in Development>API
> Errors/Warnings>API Use.
> What do you see in the "Execution Environment Descriptions" section ?
> 
> I got a case where the section was still empty even if I installed the
> descriptions. I had to do a restart with "-clean" to fix it.

Bingo! That was it. The properties page showed no EEs installed. I relaunched with -clean and they then appear. I did a clean/rebuild and no longer get the errors. However, I go get an NPE dialog. I'll attach the exception stack trace.
Comment 14 John Cortell CLA 2012-02-16 11:57:43 EST
Created attachment 211125 [details]
NPE stack trace
Comment 15 Olivier Thomann CLA 2012-02-16 12:07:17 EST
(In reply to comment #14)
> Created attachment 211125 [details] [diff]
> NPE stack trace
It is indeed possible to get a null class file. So we should add some tracing for this as I was not expecting that the class file for a superclass is not available.
I suggest to log the superclass name and the component name and report true to say that the reference was validated.
Once this is done, it would be good if you could try it again, so that we have an idea why the class file for the superclass was not found.
Comment 16 Olivier Thomann CLA 2012-02-16 12:14:22 EST
Created attachment 211131 [details]
Proposed fix
Comment 17 John Cortell CLA 2012-02-16 12:26:11 EST
(In reply to comment #15)
> (In reply to comment #14)
> > Created attachment 211125 [details] [diff]
> > NPE stack trace
> It is indeed possible to get a null class file. So we should add some tracing
> for this as I was not expecting that the class file for a superclass is not
> available.
> I suggest to log the superclass name and the component name and report true to
> say that the reference was validated.
> Once this is done, it would be good if you could try it again, so that we have
> an idea why the class file for the superclass was not found.

Assuming this gets picked up in the next milestone, I'll go through the same steps and report back what I get.
Comment 18 Curtis Windatt CLA 2012-02-17 19:12:21 EST
Mike and I were discussing what we could do to 'discover' that the list of installed descriptions has changed at startup and rebuild.  This would remove the need to do a clean of the workspace.

The proposed solution was to store a list of the fragments installed when API tools starts up.  If the list changes, we could then perform a full api tools build.

I pushed a basic implementation of this to a feature branch:
http://git.eclipse.org/c/pde/eclipse.pde.ui.git/?h=cwindatt%2Fbug361660

Doing this at plug-in startup isn't perfect as the user needs to do something to startup API Tools before their markers will be cleaned.  Also, I ended up storing this in preferences, which means that when switching workspaces you may get a build at each startup (but this likely is correct as the projects in each workspace may need to react to the fragment changes).
Comment 19 Michael Rennie CLA 2012-02-21 11:27:24 EST
(In reply to comment #18)
> Mike and I were discussing what we could do to 'discover' that the list of
> installed descriptions has changed at startup and rebuild.  This would remove
> the need to do a clean of the workspace.
> 
> The proposed solution was to store a list of the fragments installed when API
> tools starts up.  If the list changes, we could then perform a full api tools
> build.
> 
> I pushed a basic implementation of this to a feature branch:
> http://git.eclipse.org/c/pde/eclipse.pde.ui.git/?h=cwindatt%2Fbug361660
> 
> Doing this at plug-in startup isn't perfect as the user needs to do something
> to startup API Tools before their markers will be cleaned.  Also, I ended up
> storing this in preferences, which means that when switching workspaces you may
> get a build at each startup (but this likely is correct as the projects in each
> workspace may need to react to the fragment changes).

The approach makes sense to me. I think it is the best solution without causing API tools to load at start up. It would be even better if we could also provide some hooks to know when EE fragments have been installed *without* a restart - i.e. the user presses "Apply Now" or "Not Now" when installing descriptions from the pref page
Comment 20 Curtis Windatt CLA 2012-02-21 15:39:07 EST
I have pushed both Olivier's logging fix and my build on startup fix.
Comment 21 Dani Megert CLA 2012-02-22 03:53:07 EST
Not good. I get NPEs and the bundle doesn't start:

aused by: java.lang.NullPointerException
	at org.eclipse.pde.api.tools.internal.provisional.ApiPlugin.getListOfEEFragments(ApiPlugin.java:600)
	at org.eclipse.pde.api.tools.internal.provisional.ApiPlugin.checkForEEDescriptionChanges(ApiPlugin.java:532)
	at org.eclipse.pde.api.tools.internal.provisional.ApiPlugin.start(ApiPlugin.java:518)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
	... 106 more
Comment 22 Curtis Windatt CLA 2012-02-22 10:30:13 EST
Fixed in master. Platform.getFragments() returns null when there are no results instead of an empty array. The null check was removed when I moved the search to its own method.
Comment 23 Dani Megert CLA 2012-02-23 04:07:33 EST
Oh man! Again, NPE but a bit later (see stack below). And of course the builder fails.

Caused by: java.lang.NullPointerException
	at org.eclipse.pde.api.tools.internal.provisional.ApiPlugin.checkForEEDescriptionChanges(ApiPlugin.java:556)
	at org.eclipse.pde.api.tools.internal.provisional.ApiPlugin.start(ApiPlugin.java:518)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
Comment 24 Dani Megert CLA 2012-02-23 04:18:43 EST
Fixed in master: 9040cf1832ea8d6f8e9643d67589871ca158ea2e
Comment 25 Dani Megert CLA 2012-02-25 04:58:17 EST
Verified in I20120224-1544.
Comment 26 Greg Watson CLA 2012-06-13 20:02:08 EDT
I just installed RC4 and I'm seeing exactly the same messages I reported in the original comment.
Comment 27 Dani Megert CLA 2012-06-14 03:03:02 EDT
(In reply to comment #26)
> I just installed RC4 and I'm seeing exactly the same messages I reported in the
> original comment.

Did you install the EEs as requested in this bug?
Comment 28 Greg Watson CLA 2012-06-14 15:27:19 EDT
Yes, I'm able to make the errors go away by installing the EE's, but shouldn't they be installed by default? They used to be.
Comment 29 Curtis Windatt CLA 2012-06-14 15:34:06 EDT
(In reply to comment #28)
> Yes, I'm able to make the errors go away by installing the EE's, but shouldn't
> they be installed by default? They used to be.

The EE's are not installed by default, AFAIK they never have been.  The default workspace setting for 'Reference not defined in specified EE' is Ignore so the problems would not have been reported.

Returning to FIXED.
Comment 30 Curtis Windatt CLA 2012-06-14 15:34:56 EDT
Returning to VERIFIED.

If you still believe you are experiencing a bug, please open a new report or clone this bug.
Comment 31 Greg Watson CLA 2012-06-14 16:09:30 EDT
Well, prior to 4.2, I've never installed an EE. So something has changed between 3.x and 4.2 that is going to confuse anyone that is using API tooling.
Comment 32 Dani Megert CLA 2012-06-14 16:22:28 EDT
(In reply to comment #31)
> Well, prior to 4.2, I've never installed an EE. So something has changed
> between 3.x and 4.2 that is going to confuse anyone that is using API 
> tooling.

Yes, the error is new, but it should only appear if in your workspace or project properties, the option to check the API reference has been changed from the default 'Ignore' to something else. If that's not the case, then please open a new bug, with steps to reproduce the problem.
Comment 33 Greg Watson CLA 2012-06-14 18:11:55 EDT
Yes, it's set to Error. I can't imagine I changed it, but I can't say for certain I didn't. I doubt opening a bug would achieve much under these circumstances. Thanks!
Comment 34 Dani Megert CLA 2012-06-15 01:46:39 EDT
(In reply to comment #33)
> Yes, it's set to Error. I can't imagine I changed it, but I can't say for
> certain I didn't. 
I believe you :-). That specific problem report is new and set to 'Error' by default. What I wanted to explain is, that the error should only be reported if either the project or the workspace has the following option changed from 'Ignore' to something else:
Plug-in Development > API Errors/Warnings
    Reference not defined in specified execution environment:

==> If you have that set to 'Ignore' and get the error reported, then that's not what we intended and would deserve a bug report, hopefully with steps to reproduce out of a new workspace.