Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 70198 - Semantic checks on plugin.xml
Summary: Semantic checks on plugin.xml
Status: RESOLVED INVALID
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-16 04:12 EDT by Juergen Weber CLA
Modified: 2011-06-07 16:07 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Weber CLA 2004-07-16 04:12:46 EDT
A huge disadvantage of XML based plugin descriptions is that there is no
friendly java compiler that makes lots of syntactical and semantic checks. If
there is something wrong in XML (besides XML syntax itself) it simply fails
without giving a hint. 

I think PDE at development time and Eclipse at runtime should make a lot of
semantic checks on parsing plugin.xml:

o do the referenced IDs match (and even exist)
o is plugin/class instanceof AbstractUIPlugin (there are really strange error
messages if not), 
o is view/class instanceof IViewContent

If there are typos like point="org.eclipse.core.runtime.producrs", neither the
Extensions tab of the plugin editor complains, nor is there any error message in
the log and the programmer can spend hours of searching.

Other checks I can think of are

O do exported libraries or referenced icons exist
o does package exist in <export name="mypacke"/>

And certainly there are lots of other things that can go wrong on entering XML.
Comment 1 Nick Edgar CLA 2006-01-11 11:42:47 EST
Note that PDE does support some of these checks, but their reporting severity may need to be bumped up, via Window > Preferences > Plug-in Development > Compilers.
There have been steady improvements in this area between Eclipse 3.0 and 3.2.
Comment 2 Wassim Melhem CLA 2006-01-13 03:25:48 EST
most of the checks mentioned here are already implemented.

The only outstanding ones are:
1. type checking: ie. view/class instanceof IViewContent. 
This one is pretty reasonable and we have enough information in the schema to do so.

2. ids and id refs, such as editor ids, menu ids, etc.
I don't see this one happening any time soon.
This one would require changes to all schemas, as these ids are currently marked as strings.
For validation, given how these ids are used, there is a lot of room for error and it would be very expensive, as we would have to keep track of all those ids.
Comment 3 Nick Edgar CLA 2006-01-13 09:31:52 EST
I thought you did do (1) already (note in the example it should be IViewPart).
Comment 4 Wassim Melhem CLA 2006-01-13 11:45:43 EST
we only check for the presence/absence of a type.  the actual check for the type hierarchy we don't do.  I vaguely remember that it may have been a costly operation and that is why we don't do it.  I will have to check.
Comment 5 Dejan Glozic CLA 2006-01-13 11:51:04 EST
Yes, my first implementation (probably suboptimal) made it the main bottleneck of the entire PDE builder.
Comment 6 Jeff McAffer CLA 2006-01-14 09:40:57 EST
for #2 of comment 2 is it reasonable to put this support in place for 3.2 and allow exploitation over time?  We would jump on this and update our schemas the day after such support went into an I build.
Comment 7 Juergen Weber CLA 2006-01-14 11:34:09 EST
I do not understand why schema changes were necessary for semantic checks.

Let simply the consumers of the information contained in the plugin.xml do the semantic checks. 

E.g. it would suffice if the code that instantiates a view would cast the new class to IViewContent and would throw a clear and exact error message if there is a class cast exception.
Comment 8 Curtis Windatt CLA 2011-06-07 16:07:55 EDT
There have been improvements to the PDE builder over the part four years.  This bug is too general to fix.  Closing as INVALID.  Please open new bugs with specific issues in the current versions of Eclipse.