New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in type check validation #1366

Closed
joeseibel opened this Issue Jun 28, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@joeseibel
Contributor

joeseibel commented Jun 28, 2018

The following example throws an exception when validating:

property set ps1 is
  type1: type record (f1: aadlboolean;);
  const1: constant ps1::type1 => [f1 => true;];
  def1: list of ps1::type1 applies to (all);
end ps1;

package pkg1
public
  with ps1;
  
  abstract a
    properties
      ps1::def1 => ps1::const1;
  end a;
end pkg1;

When validating the property association, the error message is placed on the property value, which is in the property constant, not the property association. This raises an exception because the error message is being placed on an object in a resource which is different from the one being validated.

This was originally noticed by @rob-edman.

Exception:

java.lang.IllegalArgumentException: You can only add issues for EObjects contained in the currently validated resource 'platform:/resource/Test/pkg1.aadl'. But the given EObject was contained in 'platform:/resource/Test/ps1.aadl'
	at org.eclipse.xtext.validation.AbstractDeclarativeValidator.checkIsFromCurrentlyCheckedResource(AbstractDeclarativeValidator.java:571)
	at org.eclipse.xtext.validation.AbstractDeclarativeValidator.acceptError(AbstractDeclarativeValidator.java:554)
	at org.eclipse.xtext.validation.AbstractDeclarativeValidator.error(AbstractDeclarativeValidator.java:441)
	at org.osate.xtext.aadl2.properties.validation.PropertiesJavaValidator.error(PropertiesJavaValidator.java:1036)
	at org.osate.xtext.aadl2.properties.validation.PropertiesJavaValidator.typeCheckPropertyValues(PropertiesJavaValidator.java:876)
	at org.osate.xtext.aadl2.properties.validation.PropertiesJavaValidator.typeCheckPropertyValues(PropertiesJavaValidator.java:784)
	at org.osate.xtext.aadl2.properties.validation.PropertiesJavaValidator.typeCheckPropertyValues(PropertiesJavaValidator.java:903)
	at org.osate.xtext.aadl2.properties.validation.PropertiesJavaValidator.typeCheckPropertyValues(PropertiesJavaValidator.java:784)
	at org.osate.xtext.aadl2.properties.validation.PropertiesJavaValidator.checkPropertyAssociation(PropertiesJavaValidator.java:607)
	at org.osate.xtext.aadl2.properties.validation.PropertiesJavaValidator.casePropertyAssociation(PropertiesJavaValidator.java:155)
	at jdk.internal.reflect.GeneratedMethodAccessor152.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.eclipse.xtext.validation.AbstractDeclarativeValidator$MethodWrapper.invoke(AbstractDeclarativeValidator.java:118)
	at org.eclipse.xtext.validation.AbstractDeclarativeValidator.internalValidate(AbstractDeclarativeValidator.java:312)
	at org.eclipse.xtext.validation.AbstractInjectableValidator.validate(AbstractInjectableValidator.java:71)
	at org.eclipse.xtext.validation.CompositeEValidator.validate(CompositeEValidator.java:151)
	at org.eclipse.emf.ecore.util.Diagnostician.doValidate(Diagnostician.java:171)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:158)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
	at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
	at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
	at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:70)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
	at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
	at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
	at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:70)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
	at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
	at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
	at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:70)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
	at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:120)
	at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:146)
	at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:124)
	at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:90)
	at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec(ValidationJob.java:91)
	at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec(ValidationJob.java:1)
	at org.eclipse.xtext.util.concurrent.CancelableUnitOfWork.exec(CancelableUnitOfWork.java:26)
	at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:91)
	at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.internalReadOnly(XtextDocument.java:520)
	at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.readOnly(XtextDocument.java:492)
	at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:133)
	at org.eclipse.xtext.ui.editor.validation.ValidationJob.createIssues(ValidationJob.java:86)
	at org.eclipse.xtext.ui.editor.validation.ValidationJob.run(ValidationJob.java:67)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

@lwrage lwrage added this to the 2.3.5 milestone Jul 2, 2018

@lwrage lwrage added the next label Jul 2, 2018

@wafflebot wafflebot bot added in progress and removed next labels Aug 13, 2018

@wafflebot wafflebot bot added review and removed in progress labels Aug 13, 2018

@wafflebot wafflebot bot removed the review label Aug 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment