This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 409224 - Mark EMF Factory methods as @noreference
Summary: Mark EMF Factory methods as @noreference
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.4 RC1   Edit
Assignee: Missing name Mising name CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 402781
Blocks: 420779
  Show dependency tree
 
Reported: 2013-05-27 18:21 EDT by Paul Webster CLA
Modified: 2014-05-14 13:26 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Webster CLA 2013-05-27 18:21:26 EDT
With the support for bug 402781 we don't need the default EMF factory methods to be API.

They should be marked as @noreference.

PW
Comment 1 Jonas Helming CLA 2013-05-28 04:04:44 EDT
No I have opened a BR I actually did not want :-)
What is the motivation to hide the factories, especially the create methods?
Comment 2 Paul Elder CLA 2013-08-15 08:51:13 EDT
(In reply to comment #1)
> No I have opened a BR I actually did not want :-)
> What is the motivation to hide the factories, especially the create methods?

The goal in for the model interface is to be independent of its implementation. The factory create methods 'leak' the fact we are using EMF to implement it.
Comment 3 Lars Vogel CLA 2014-04-28 16:45:54 EDT
Rene, any idea how to implement that?
Comment 4 Missing name Mising name CLA 2014-04-29 12:08:48 EDT
(In reply to Lars Vogel from comment #3)
> Rene, any idea how to implement that?

I think a custom EMF-JavaJet-Template for factories would solve the problem easily. Copy the "org.eclipse.emf.codegen.ecore/templates/model/FactoryClass.javajet" template to the E4-model modify it (add the annotation to the correct place) and afterwards reference the template in the corresponding *.genmodel files.

If we don't care about the exact location of the "@noreference"-JavaDoc entry (means can be in the middle of the JavaDoc and not at the end), we could maybe use some already existing EMF-GenModel-Annotation to enrich it.
Comment 5 Lars Vogel CLA 2014-04-29 12:12:34 EDT
(In reply to René Brandstetter from comment #4)
> (In reply to Lars Vogel from comment #3)
> > Rene, any idea how to implement that?
> 
> I think a custom EMF-JavaJet-Template for factories would solve the problem
> easily. Copy the
> "org.eclipse.emf.codegen.ecore/templates/model/FactoryClass.javajet"
> template to the E4-model modify it (add the annotation to the correct place)
> and afterwards reference the template in the corresponding *.genmodel files.
> 
> If we don't care about the exact location of the "@noreference"-JavaDoc
> entry (means can be in the middle of the JavaDoc and not at the end), we
> could maybe use some already existing EMF-GenModel-Annotation to enrich it.

Thanks Rene, that sounds a bit complex for such a simple task. I add Ed to the bug, he may be able to guide us here.
Comment 6 Ed Merks CLA 2014-04-30 01:48:59 EDT
You can add anything to the "user-doc" section

 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->

JMerge preserves those contents. If you remove the section markers (but leave the @generated so that the interface body itself is still regenerated) JMerge will leave the entire Javadoc comment untouched.  So I don't see a need for a specialized template...
Comment 7 Missing name Mising name CLA 2014-04-30 03:26:51 EDT
(In reply to Ed Merks from comment #6)
> You can add anything to the "user-doc" section
> 
>  * <!-- begin-user-doc -->
>  * <!-- end-user-doc -->
> 
> JMerge preserves those contents. If you remove the section markers (but
> leave the @generated so that the interface body itself is still regenerated)
> JMerge will leave the entire Javadoc comment untouched.  So I don't see a
> need for a specialized template...

I always thought that the GenModel-Annotation detail "documentation" was required to bring custom content into the JavaDoc part, but that are great news to hear (makes things easier). The only problem is a complete new generation of the model/factory/..., in this case the information will be gone, but I guess/hope nobody will ever do this.
Comment 8 Eric Moffatt CLA 2014-05-07 14:06:08 EDT
Thanks Ed ! Rene, feel free to make a Gerrit patch based on this info...
Comment 9 Paul Webster CLA 2014-05-14 12:23:45 EDT
I know I opened this, but it looks like marking these as @noreference now would be an API change.

Dani, that would make this a no-go, right?

PW
Comment 10 Paul Webster CLA 2014-05-14 13:26:27 EDT
I think we'll just have to live with it.

If anybody has any suggestions, I'm open to them.

PW