Bug 519735 - Cannot Bind Xcore-Derived Edit Adapter Factory in DSL
Summary: Cannot Bind Xcore-Derived Edit Adapter Factory in DSL
Status: UNCONFIRMED
Alias: None
Product: EMF.Parsley
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P3 normal
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-16 17:31 EDT by Jon Passki CLA
Modified: 2020-06-11 11:57 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Passki CLA 2017-07-16 17:31:46 EDT
Given a Parsley project that also contains an Xcore model, it does not seem possible to define a binding that uses an Xcore-derived source resource within the DSL.

Reproducer:

* Create a Parsley DSL project using the new project wizard, unselecting the
  default option to create from a template. For this example, "reproducer"

* In the 'src/reproducer' directory, create an Xcore file (Test.xcore) with the
  following:


	@GenModel(editDirectory="/reproducer/src-gen")
	package reproducer
	class Test {}


* In the Parsley DSL, bind AdapterFactory to the EMF.Edit adapter factory
  generated by Xcore:


	import org.eclipse.emf.common.notify.AdapterFactory
	module reproducer {
		bindings {
			type AdapterFactory -> reproducer.provider.ReproducerItemProviderAdapterFactory
		}
	}

Expected results: no compilation errors
Actual results: compilation error:

"Type mismatch: cannot convert from Class<ReproducerItemProviderAdapterFactory> to Class<? extends AdapterFactory>"


* Copy the above adapter factory to the "src/reproducer" directory, importing "reproducer.providerTestItemProvider", and renaming it something else for clarification-sake, for example "ReproducerItemProviderAdapterFactory2"

* Use this renamed class as the binding:

	import org.eclipse.emf.common.notify.AdapterFactory
	module reproducer {
		bindings {
			type AdapterFactory -> ReproducerItemProviderAdapterFactory2
		}
	}


Expected results: no compilation errors
Actual results: no compilation errors
Comment 1 Jon Passki CLA 2017-07-16 19:00:37 EDT
It doesn't seem to matter if the Xcore project is located within the Parsley project or not. I had a separate Xcore project and had the same import errors as the prior test above. Copying the factory to the Parsley project (& cleaning up its import) had the same effect as the latter test above.
Comment 2 Lorenzo Bettini CLA 2017-09-13 07:32:10 EDT
Probably a stupid question but, do you export the package reproducer.provider in your Xcore project's MANIFEST.MF?
Comment 3 Jon Passki CLA 2017-10-01 12:33:47 EDT
(In reply to Lorenzo Bettini from comment #2)
> Probably a stupid question but, do you export the package
> reproducer.provider in your Xcore project's MANIFEST.MF?

Never a dumb question!

Here's the code that's showing the error in Oxygen.0: https://github.com/jonpasski/eclipse-bug-519735. The xcore-edit has this in its MANIFEST.MF:

Export-Package: xcore.provider

The parsley project imports the type without any visual indication of an error, so I'm assuming the package exporting is correct.