Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346820 - An EPackage.Registry global test
Summary: An EPackage.Registry global test
Status: RESOLVED FIXED
Alias: None
Product: EPP
Classification: Technology
Component: modeling-package (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 enhancement (vote)
Target Milestone: 1.4.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-23 01:09 EDT by Ed Willink CLA
Modified: 2014-06-10 10:18 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2011-05-23 01:09:53 EDT
In Bug 321432 J2EE broke Xtext.

In Bug 346368 one part of OCL Examples broke another and if we hadn't caught it could have broken other projects.

In both cases, a bad EPackage.Registry registration broke code that did a loop over the EPackage.Registry without catching a Throwable within the loop.

Since this is an inter-project EMF issue, it would be good if some multi-project activity loaded every possible Indigo plugin, and then performed an EPackage.Registry getPackage() loop and reported any exceptions.

This would protect inadequately coded consumers (within and beyond the train) from these bad registrations.
Comment 1 Cedric Brun CLA 2011-05-30 08:31:51 EDT
Sounds like a good idea and It could be indeed quite easy to do and run with every package built.
Comment 2 Cedric Brun CLA 2013-10-02 05:26:34 EDT
I did it with the following commit : http://git.eclipse.org/c/amalgam/org.eclipse.amalgam.git/commit/?id=122eaab5233d6b28a6eb86507bb7213f02b8cdb1

Now I have the infrastructure to launch the tests on top of an already-built package, and I added a test checking the EPackage.Registry state and making sure the Ecore models are valid.

By the way, the test detects the UML EPackages as not valid in a strict EMF sense. Do you know if this is intended?

java.lang.AssertionError: EPackage with uri http://www.eclipse.org/uml2/2.1.0/UML is not valid (ERROR) 
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@72fdeacb{http://www.eclipse.org/uml2/4.0.0/UML#//Stereotype/getProfile}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EReferenceImpl@7c41f067{http://www.eclipse.org/uml2/4.0.0/UML#//Stereotype/profile}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@4c46c9b3{http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/getNamespace}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EReferenceImpl@3b642de4{http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/namespace}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@2e00f232{http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/getQualifiedName}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@401cc836{http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/qualifiedName}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@36d885b1{http://www.eclipse.org/uml2/4.0.0/UML#//Extension/getMetaclass}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EReferenceImpl@41314398{http://www.eclipse.org/uml2/4.0.0/UML#//Extension/metaclass}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@6ee76d09{http://www.eclipse.org/uml2/4.0.0/UML#//Property/isSetDefault}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@1ba7a2c1{http://www.eclipse.org/uml2/4.0.0/UML#//Property/default}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@1aae3b16{http://www.eclipse.org/uml2/4.0.0/UML#//Property/setDefault}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@1ba7a2c1{http://www.eclipse.org/uml2/4.0.0/UML#//Property/default}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@24a92f09{http://www.eclipse.org/uml2/4.0.0/UML#//Property/setIsComposite}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@5f4f0aac{http://www.eclipse.org/uml2/4.0.0/UML#//Property/isComposite.1}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@3e45d316{http://www.eclipse.org/uml2/4.0.0/UML#//Property/setOpposite}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EReferenceImpl@5a25694a{http://www.eclipse.org/uml2/4.0.0/UML#//Property/opposite}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@4e23a782{http://www.eclipse.org/uml2/4.0.0/UML#//Property/unsetDefault}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@1ba7a2c1{http://www.eclipse.org/uml2/4.0.0/UML#//Property/default}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@6ca6fe2{http://www.eclipse.org/uml2/4.0.0/UML#//Property/getDefault}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@1ba7a2c1{http://www.eclipse.org/uml2/4.0.0/UML#//Property/default}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@547761e9{http://www.eclipse.org/uml2/4.0.0/UML#//Property/getOpposite}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EReferenceImpl@5a25694a{http://www.eclipse.org/uml2/4.0.0/UML#//Property/opposite}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@6801357b{http://www.eclipse.org/uml2/4.0.0/UML#//MultiplicityElement/setLower}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@275e5395{http://www.eclipse.org/uml2/4.0.0/UML#//MultiplicityElement/lower}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@21c16f64{http://www.eclipse.org/uml2/4.0.0/UML#//MultiplicityElement/setUpper}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@22781f8c{http://www.eclipse.org/uml2/4.0.0/UML#//MultiplicityElement/upper}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@7c5f3201{http://www.eclipse.org/uml2/4.0.0/UML#//MultiplicityElement/getLower}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@275e5395{http://www.eclipse.org/uml2/4.0.0/UML#//MultiplicityElement/lower}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@4dcc1f71{http://www.eclipse.org/uml2/4.0.0/UML#//MultiplicityElement/getUpper}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@22781f8c{http://www.eclipse.org/uml2/4.0.0/UML#//MultiplicityElement/upper}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@5669a2f5{http://www.eclipse.org/uml2/4.0.0/UML#//ConnectorEnd/getDefiningEnd}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EReferenceImpl@3149af25{http://www.eclipse.org/uml2/4.0.0/UML#//ConnectorEnd/definingEnd}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@50291ad1{http://www.eclipse.org/uml2/4.0.0/UML#//Operation/getLower}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@3a9fb874{http://www.eclipse.org/uml2/4.0.0/UML#//Operation/lower}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@4c06e5bd{http://www.eclipse.org/uml2/4.0.0/UML#//Operation/getType}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EReferenceImpl@58d50249{http://www.eclipse.org/uml2/4.0.0/UML#//Operation/type}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@889342f{http://www.eclipse.org/uml2/4.0.0/UML#//Operation/getUpper}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@67c0fe09{http://www.eclipse.org/uml2/4.0.0/UML#//Operation/upper}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@66551924{http://www.eclipse.org/uml2/4.0.0/UML#//Behavior/getContext}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EReferenceImpl@5ce5bef8{http://www.eclipse.org/uml2/4.0.0/UML#//Behavior/context}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@45cee553{http://www.eclipse.org/uml2/4.0.0/UML#//Parameter/isSetDefault}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@1231cff3{http://www.eclipse.org/uml2/4.0.0/UML#//Parameter/default}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@44b63da{http://www.eclipse.org/uml2/4.0.0/UML#//Parameter/setDefault}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@1231cff3{http://www.eclipse.org/uml2/4.0.0/UML#//Parameter/default}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@71887f69{http://www.eclipse.org/uml2/4.0.0/UML#//Parameter/unsetDefault}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@1231cff3{http://www.eclipse.org/uml2/4.0.0/UML#//Parameter/default}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@386500ba{http://www.eclipse.org/uml2/4.0.0/UML#//Parameter/getDefault}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@1231cff3{http://www.eclipse.org/uml2/4.0.0/UML#//Parameter/default}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@56fd59ab{http://www.eclipse.org/uml2/4.0.0/UML#//Connector/getKind}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@130a162b{http://www.eclipse.org/uml2/4.0.0/UML#//Connector/kind}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@24b91d1b{http://www.eclipse.org/uml2/4.0.0/UML#//OpaqueExpression/getResult}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EReferenceImpl@7525ea72{http://www.eclipse.org/uml2/4.0.0/UML#//OpaqueExpression/result}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@f2d4f33{http://www.eclipse.org/uml2/4.0.0/UML#//Action/getContext}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EReferenceImpl@67aaa50d{http://www.eclipse.org/uml2/4.0.0/UML#//Action/context}'
ERROR : There may not be an operation 'org.eclipse.emf.ecore.impl.EOperationImpl@1aa45854{http://www.eclipse.org/uml2/4.0.0/UML#//Message/getMessageKind}' with the same signature as an accessor method for feature 'org.eclipse.emf.ecore.impl.EAttributeImpl@1ba30076{http://www.eclipse.org/uml2/4.0.0/UML#//Message/messageKind}'
	at org.junit.Assert.fail(Assert.java:88)
	at org.eclipse.amalgam.pak.tests.unit.EPackageRegistryConsistencyTest.isValid(EPackageRegistryConsistencyTest.java:53)
Comment 3 Ed Willink CLA 2013-10-02 05:40:33 EDT
The a, a() pairing is an OMG UML idiom for derived properties.

I'm not clear why EMF is unhappy. a(), getA() and setA() are distinct.
Comment 4 Cedric Brun CLA 2013-10-02 06:00:38 EDT
I don't see how they can be distincts, for each case, an EOperation named getA() is specifically defined and a "a" reference too (which is supposed to generate a getA() java method too.)
Comment 5 Cedric Brun CLA 2014-06-10 03:59:32 EDT
I tweaked the test so that UML is ignored. 
I think we're done here.
Comment 6 Ed Willink CLA 2014-06-10 10:18:28 EDT
Thanks