EMF Validation with specific target Class and Java 8 [message #1587943] |
Tue, 27 January 2015 12:01  |
Eclipse User |
|
|
|
Hi,
i'm testing my product on Java 8 and I detected that some EMF Validation Constraint are ignored. They work perfectly with Java 7.
If I remove the Target class constraint, the validation is well called. Some other constraints are using a Target class and are working correctly.
I tried to debug a little but I can't figure out yet where the path is diverging. Where should I point my breakpoint?
I try on org.eclipse.emf.validation.internal.service.AbstractValidationContext.ConstraintFilter.accept(IModelConstraint). In Java 7 it returned true, in Java 8 it is not called.
With org.eclipse.emf.validation.internal.service.AbstractGetConstraintsOperation the list attributes filteredConstraints and myConstraints are empty list in Java 8.
I launched EMF Validation test suite and one test failed when launched alone which might be related to my configuration. This test has failed also several times with Java 8 inside the complete test suite and never with Java 7.
junit.framework.AssertionFailedError: Did not find batch constraints: [org.eclipse.emf.validation.tests.multipackage.test]
at junit.framework.Assert.fail(Assert.java:57)
at junit.framework.TestCase.fail(TestCase.java:227)
at org.eclipse.emf.validation.tests.TestBase.assertAllConstraintsPresent(TestBase.java:152)
at org.eclipse.emf.validation.tests.FrameworkTest.test_multiPackagesPerProvider(FrameworkTest.java:467)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at org.eclipse.emf.validation.tests.AllTests$1.run(AllTests.java:88)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:648)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:592)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:54)
at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:47)
at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Thanks by advance for any help
[Updated on: Tue, 27 January 2015 12:04] by Moderator
|
|
|
Re: EMF Validation with specific target Class and Java 8 [message #1588128 is a reply to message #1587943] |
Tue, 27 January 2015 14:22   |
Eclipse User |
|
|
|
Hi, Aurelien,
I cannot think of any good reason why you should see different
behaviour with Java 8, unless it be that introducing Java 8 into your
run-time environment causes some kind of classpath consistency problem.
For debugging, I'd suggest a breakpoint in
AbstractConstraintProvider::getBatchConstraints(...)
to see whether constraints are being missed simply because they aren't
being contributed in the first place (such as might happen if the
bundle providing them is not resolved by OSGi) and then in
ClientContextManager::getClientContextsFor(EObject)
to see whether the right contexts are matched for the object you're
validating and finally
ClientContextManager::getBindings(EObject, Collection)
to see whether the constraints aren't somehow misbound.
HTH,
Christian
On 2015-01-27 17:01:14 +0000, Aurelien Pupier said:
> Hi,
>
> i'm testing my product on Java 8 and I detected that some EMF
> Validation Constraint are ignored. They work perfectly with Java 7.
>
> If I remove the Target class constraint, the validation is well called.
> Some other constraints are using a Target class and are working
> correctly.
>
> I tried to debug a little but I can't figure out yet where the path is
> diverging. Where should I point my breakpoint?
>
> I try on
> org.eclipse.emf.validation.internal.service.AbstractValidationContext.ConstraintFilter.accept(IModelConstraint).
> In Java 7 it returned true, in Java 8 it is not called.
> With
> org.eclipse.emf.validation.internal.service.AbstractGetConstraintsOperation
> the list attributes filteredConstraints and myConstraints are empty
> list in Java 8.
>
> I launched EMF Validation test suite and one test failed when launched
> alone which might be related to my configuration. This test has failed
> also one time with Java 8 inside the complete test suite.
>
> junit.framework.AssertionFailedError: Did not find batch constraints:
> [org.eclipse.emf.validation.tests.multipackage.test]
> at junit.framework.Assert.fail(Assert.java:57)
> at junit.framework.TestCase.fail(TestCase.java:227)
> at
> org.eclipse.emf.validation.tests.TestBase.assertAllConstraintsPresent(TestBase.java:152)
>
> at
> org.eclipse.emf.validation.tests.FrameworkTest.test_multiPackagesPerProvider(FrameworkTest.java:467)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
> at java.lang.reflect.Method.invoke(Method.java:483)
> at junit.framework.TestCase.runTest(TestCase.java:176)
> at junit.framework.TestCase.runBare(TestCase.java:141)
> at junit.framework.TestResult$1.protect(TestResult.java:122)
> at junit.framework.TestResult.runProtected(TestResult.java:142)
> at junit.framework.TestResult.run(TestResult.java:125)
> at junit.framework.TestCase.run(TestCase.java:129)
> at junit.framework.TestSuite.runTest(TestSuite.java:255)
> at junit.framework.TestSuite.run(TestSuite.java:250)
> at junit.framework.TestSuite.runTest(TestSuite.java:255)
> at junit.framework.TestSuite.run(TestSuite.java:250)
> at org.eclipse.emf.validation.tests.AllTests$1.run(AllTests.java:88)
> at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
>
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
>
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
>
> at
> org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
>
> at
> org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
>
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
>
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
>
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
>
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
>
> at
> org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
>
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:648)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
>
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:592)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
>
> at
> org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:54)
>
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:47)
>
> at
> org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
> at java.lang.reflect.Method.invoke(Method.java:483)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
>
>
>
>
> Thanks by advance for any help
|
|
|
|
|
Re: EMF Validation with specific target Class and Java 8 [message #1589558 is a reply to message #1589156] |
Wed, 28 January 2015 09:15  |
Eclipse User |
|
|
|
Hi, Aurelien,
I'm glad that you were able to resolve this problem and that it is not
something scary about incompatible behaviour of Java. I would always
recommend specifying the nsURI; indeed, I'm surprised that it would be
optional, but the exsd cannot express conditional optionality, so maybe
that's why.
Anyways, by all means submit an enhancement request, and with a patch
if you can. But as I'm not a committer, I can't promise anything nor
speak for the EMFv team.
Cheers,
Christian
On 2015-01-28 09:11:32 +0000, Aurelien Pupier said:
> Hi again,
>
> just writing thinks sometimes help to go further. Sorry for the double
> post but I think that I found the issue. There is effectively two
> EClass with the same name, one is contributed by another model than
> mine (GMF). I suppose that I hit the issue with Java 8 because the list
> order should be different. If I specify the Class Name AND the nsURI in
> the extension point the validation are working. I will precise it on
> each of my Validation Contraints.
>
> Would it be possible to log a warnign when several EClass are found for
> the same Class name?
>
> regards and thanks for your help,
|
|
|
Powered by
FUDForum. Page generated in 0.04752 seconds