Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » QuickFix error
QuickFix error [message #844306] Fri, 13 April 2012 22:30 Go to next message
Antonio Metallo is currently offline Antonio MetalloFriend
Messages: 24
Registered: March 2012
Junior Member
Hi all,
in MyDlsQuickfixProvider i made this quickfix:

@Fix(MyDslJavaValidator.FIX_NAME)
public void maiInTesta(final Issue issue, IssueResolutionAcceptor acceptor){
	ISemanticModification is = new ISemanticModification() {
		public void apply(EObject element, IModificationContext context)throws Exception {

			Rule a = (Rule)element;
			a.setName("new");
				
		}

	};

	acceptor.accept(issue, "Change the name of the Rule", "Modify "+ issue.getData()[0]+" into "+issue.getData()[1], null, is);
}

But I always get this error:

org.eclipse.emf.common.util.WrappedException: org.eclipse.xtext.validation.IConcreteSyntaxValidator$InvalidConcreteSyntaxException: These errors need to be fixed before the model can be serialized.
File.classi[0]->Classe'Test'.methods[0]->MethodDeclaration'test'.block->Block.blockStatement[3]->BlockStatement.stat->Statement.DD->Declaration.inner->Inner'test'.program->Program.expre[0]->Expression.body_constr->Body.bodyA[2]->BodyA.atom->Atom.dvt[0]->Term: Feature Term.int must not be set. Constraint: (int|dlva) Quantities: int:0, dva:1
File.classi[0]->Classe'Test'.methods[0]->MethodDeclaration'test'.block->Block.blockStatement[3]->BlockStatement.stat->Statement.DD->Declaration.inner->Inner'test'.program->Program.expre[0]->Expression.body_constr->Body.bodyA[2]->BodyA.atom->Atom.dvt[0]->Term: Feature Term.int must not be set. Constraint: (int|dlva) Quantities: int:0, dlva:1

	at org.eclipse.xtext.ui.editor.quickfix.IssueResolution.apply(IssueResolution.java:50)
	at org.eclipse.xtext.ui.editor.quickfix.QuickAssistCompletionProposal.apply(QuickAssistCompletionProposal.java:32)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:933)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertSelectedProposalWithMask(CompletionProposalPopup.java:879)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$27(CompletionProposalPopup.java:875)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup$5.widgetDefaultSelected(CompletionProposalPopup.java:657)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:119)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1384)

What should I do to resolve this error?
Re: QuickFix error [message #844743 is a reply to message #844306] Sat, 14 April 2012 09:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

the error says there is something invalid with the model it trys to serialize.
cannot say if this is a bug in the serializer or if there is something wrong with your code and model
is actually invalid.

how does the grammar (Specially for Terms) look like? how does the test model look like.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: QuickFix error [message #844951 is a reply to message #844743] Sat, 14 April 2012 15:06 Go to previous messageGo to next message
Antonio Metallo is currently offline Antonio MetalloFriend
Messages: 24
Registered: March 2012
Junior Member
Hi Christian, it's very strange with the get I have no problem...
This is the grammar:
Rule:{Rule}
(
	k_1=('-')?
	(name=ID | str_1=STRING | objRef=Reference) 

            ( k_2='(' Term (k_3+=',' Term)* k_4=')')?
	)
	| Atom
;

Term:{Term}
	int=INT
	|a=Rule
	|non=NPTerm
;

This is the validator:

@Check
public void notNew(Body body){
    if(body.getRules()!=null){
         for(Rule s : body.getRules())
              if(s.getName()!=null && !s.getName().equals("new")){
                   error("The name must be new. ", s, JDLVPackage.BODY , NOT_NEW
						, s.getName(), "new");
              }
    }
}

Re: QuickFix error [message #844962 is a reply to message #844951] Sat, 14 April 2012 15:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

the grammar you posted is not valid at all. (at least if i post it to a new grammar)

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: QuickFix error [message #845988 is a reply to message #844962] Sun, 15 April 2012 16:42 Go to previous messageGo to next message
Antonio Metallo is currently offline Antonio MetalloFriend
Messages: 24
Registered: March 2012
Junior Member
I don't kno why it creates always a Term even if there is nothing after the ID

Rule:{Rule}
(
	k_1=('-')?
	(name=ID | str_1=STRING | objRef=Reference) 

            ( k_2='(' t+=Term (k_3+=',' t+=Term)* k_4=')')?
	)
	| Atom
;
Re: QuickFix error [message #845995 is a reply to message #845988] Sun, 15 April 2012 16:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
and where is this dlva thing?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: QuickFix error [message #846011 is a reply to message #845995] Sun, 15 April 2012 17:09 Go to previous messageGo to next message
Antonio Metallo is currently offline Antonio MetalloFriend
Messages: 24
Registered: March 2012
Junior Member
sorry:

Term:{Term}
	int=INT
	|dlva=Rule
	|non=NPTerm
;
Re: QuickFix error [message #846027 is a reply to message #846011] Sun, 15 April 2012 17:31 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i can reproduce the problem. it is imho a bug in the validator for the serializer.
the problem seems the int thing (value zero cannot be distinguished from value null)
=> please file a bug


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:ImportedNamespaceAwareLocalScopeProvider should check the path
Next Topic:Xtext/xtend generating an intf for type
Goto Forum:
  


Current Time: Thu Apr 25 12:59:33 GMT 2024

Powered by FUDForum. Page generated in 5.04181 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top