Upgrade from Xtext 2.3.0 to 2.4.1: org.eclipse.xtext.xbase.validation.XtypeJavaValidator doesn't exist

StackOverflow https://stackoverflow.com/questions/21160016

  •  28-09-2022
  •  | 
  •  

Question

Where org.eclipse.xtext.xbase.validation.XtypeJavaValidator is supposed to be?

Xtext needs it in a generated file Abstract*DslJavaValidator. This type replaces org.eclipse.xtext.validation.AbstractDeclarativeValidator from Xtext 2.3.0 but I can't find this class anywhere in Xtext 2.4.1.

2.4 has XbaseJavaValidator but I'm not sure whether I should use this (the code being generated by Xtext and the access to this class being discouraged).

Are there instructions anywhere how to upgrade from 2.3 to 2.4?

By blindly messing the URL, I was able to generate a list of bugs with the title "Whiteboard: v2.4" but I'm not sure whether a) this is the actual list of bugs and b) how to get the list for 2.4.1.

Was it helpful?

Solution

The prefix of the class is generated from the base grammar. So if your grammar starts with

grammar ...
with org.eclipse.xtext.xbase.Xtype

the code generators will try to extend XtypeJavaValidtor. If you derive from Xbase, it will use XbaseJavaValidtor (i.e. name of grammar + JavaValidtor)

This bug report contains a workaround:

Workaround: pass inheritImplementation=false in the workflow like this:

fragment = validation.ValidatorFragment auto-inject {
  inheritImplementation = false
}

Same is probably true for the ImportNamespacesScopingFragment, ContentAssistFragment and QuickfixProviderFragment

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top