Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325364 - Annotation Properties view should resolve annotation classes from project classpath
Summary: Annotation Properties view should resolve annotation classes from project cla...
Status: VERIFIED FIXED
Alias: None
Product: WTP Webservices
Classification: WebTools
Component: jst.ws.jaxws (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Shane Clarke CLA
QA Contact: Shane Clarke CLA
URL:
Whiteboard: jaxws PMC_approved
Keywords: plan
Depends on:
Blocks:
 
Reported: 2010-09-15 11:13 EDT by Brian Fitzpatrick CLA
Modified: 2011-04-28 22:11 EDT (History)
4 users (show)

See Also:
keith.chong.ca: pmc_approved? (david_williams)
keith.chong.ca: pmc_approved? (raghunathan.srinivasan)
keith.chong.ca: pmc_approved? (naci.dai)
keith.chong.ca: pmc_approved? (deboer)
neil.hauge: pmc_approved+
keith.chong.ca: pmc_approved? (kaloyan)
keith.chong.ca: pmc_approved? (cbridgha)
shane_clarke: review+


Attachments
annotations view patch (167.64 KB, text/plain)
2011-03-08 17:38 EST, Shane Clarke CLA
no flags Details
annotations view patch (169.45 KB, patch)
2011-03-23 15:20 EDT, Shane Clarke CLA
no flags Details | Diff
annotations view patch (168.86 KB, patch)
2011-03-27 12:01 EDT, Shane Clarke CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Fitzpatrick CLA 2010-09-15 11:13:46 EDT
While doing some work with extending the Annotation Properties view, I hit upon a strange convention. Instead of the view attempting to load annotation classes from the project classpath (which is a common use case for runtime-based projects), it expects those classes to be exposed by one of the design-time plug-ins. 

As an example, if you have to expose a particular runtime jar that has annotation classes within it in the plug-in implementing the annotation definition extension point, there's a good chance we'll run into issues with compatibilities between versions and so on. 

So it would be best to make sure the annotation classes are on the project classpath so that they are truly supported when you deploy your web service or other annotated classes to a server.
Comment 1 Max Rydahl Andersen CLA 2010-09-15 13:14:01 EDT
its not so much necessary that it comes from the users classpath but how to support mulitiple versions of same named annotations.

And how to provide that from plugins without having to necessarily expose them on the classpath when simply parsing/reading the .class files should be sufficient. i.e. JDT doesn't load .class files to provide tooling for it.
Comment 2 Keith Chong CLA 2010-09-30 13:58:19 EDT
Shane...I'm targetting this to 3.3 M3 to get it to show up in the plan.  Please adjust out if necessary.
Comment 3 Shane Clarke CLA 2010-11-08 16:55:33 EST
Won't have this finished for 3.3 M3. Retargeting.
Comment 4 Shane Clarke CLA 2011-03-08 17:38:34 EST
Created attachment 190708 [details]
annotations view patch
Comment 5 Shane Clarke CLA 2011-03-08 17:45:36 EST
This won't make 3.3 M6 but i'll target M7 and request PMC review and approval.

I've attached a patch that contains the changes to:

org.eclipse.jst.ws.annotations.core
org.eclipse.jst.ws.cxf.core
org.eclipse.jst.ws.cxf.creation.core
org.eclipse.jst.ws.cxf.creation.ui
org.eclipse.jst.ws.jaxb.core
org.eclipse.jst.ws.jaxws.core
org.eclipse.jst.ws.jaxws.ui

The key changes are the refactoring of the annotations view editing support to work with org.eclipse.jdt.core.IType and org.eclipse.jdt.core.IMethod instead of annotation classes and methods and the introduction of new API to support this. 

Annotation types are now resolved from the users projects classpath and multiple versions of the same named annotations can be supported using ordering of the build path.

Key API changes:

org.eclipse.jst.ws.annotations.core.AnnotationDefinition (cannot be extended by clients):
getAnnotationClass() deprecated and replaced with getAnnotationType()
getTargets() deprecated and replaced with getAnnotationTypeTargets()
setJavaProject() used to find the annotation type.

org.eclipse.jst.ws.annotations.core.AnnotationsManager (cannot be extended by clients):

getAnnotations() deprecated replaced with getAnnotationTypes()

org.eclipse.jst.ws.annotations.core.initialization.IAnnotationAttributeInitializer (interface not intended to be implemented or extended by clients)

getMemberValuePairs(IJavaElement, AST, Class) is now deprecated replaced with getMemberValuePairs(IJavaElement, AST, IType)

org.eclipse.jst.ws.annotations.core.initialization.AnnotationAttributeInitializer (Abstract base class for org.eclipse.jst.ws.annotations.core.annotationInitializer extension point.
Implements IAnnotationAttributeInitializer and now contains default implementation of getMemberValuePairs(IJavaElement, AST, IType))

This change to AnnotationAttributeInitializer can be treated as non breaking http://wiki.eclipse.org/Evolving_Java-based_APIs#Example_4_-_Adding_an_API_method.

The likelihood that a client has implemented a method with the same signature is sufficiently low. It's called by the annotations framework to provide memeber value pairs and is unlikey to be used outside of this.

Existing clients which implement getMemberValuePairs(IJavaElement, AST, Class) will still continue to work.
Comment 6 Shane Clarke CLA 2011-03-17 11:26:42 EDT
Keith could i ask you to review this patch for approval?

* Fix has been tested installed on number of platforms.
* All unit tests pass with fix.
* No work-around available.
* Fix is low risk. Reworking of view editing support tested extensively.
Comment 7 Keith Chong CLA 2011-03-23 12:31:10 EDT
I'm delegating the responsibility for the code review/acceptance of the patch to Shane, since this component is his area of specialty.
Comment 8 Keith Chong CLA 2011-03-23 12:37:56 EDT
This requires PMC approval since this enhancement is targeted for 3.3 M7, post-API freeze.
Comment 9 Shane Clarke CLA 2011-03-23 15:20:02 EDT
Created attachment 191786 [details]
annotations view patch

Updated patch.

The original patch was missing a required dependency range increment for the org.eclipse.jst.ws.annotations.core dependency in two test plug-ins: 

org.eclipse.jst.ws.jaxws.core.tests
org.eclipse.jst.ws.jaxb.core.tests
Comment 10 Shane Clarke CLA 2011-03-27 12:01:04 EDT
Created attachment 191966 [details]
annotations view patch

Attaching an updated patch after committing other bug fixes to HEAD which affect some of the same classes.
Comment 11 Shane Clarke CLA 2011-04-03 15:32:40 EDT
Patch committed.
Comment 12 Shane Clarke CLA 2011-04-03 15:55:50 EDT
Verified in Build I-3.3.0-20110403110154