mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
Merge pull request #1481 from eclipse/cd_deprXtendXtext2EcorePostProcessor
marked xpand/xtend(1) depending XtendXtext2EcorePostProcessor as deprecated
This commit is contained in:
commit
5416808eda
7 changed files with 27 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2008, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
|
@ -54,6 +54,7 @@ class Xtext2EcoreTransformerTest extends AbstractXtextTests {
|
|||
* @author Dennis Hübner - Initial contribution and API
|
||||
*/
|
||||
@FinalFieldsConstructor
|
||||
@Deprecated
|
||||
private static final class MockedXtext2EcorePostProcessor implements IXtext2EcorePostProcessor {
|
||||
int called = 0
|
||||
val GeneratedMetamodel testMetamodel
|
||||
|
@ -1283,7 +1284,7 @@ class Xtext2EcoreTransformerTest extends AbstractXtextTests {
|
|||
assertTrue(resource.errors.isEmpty)
|
||||
}
|
||||
|
||||
@Test def void testPostProcessorHook() throws Exception {
|
||||
@Deprecated @Test def void testPostProcessorHook() throws Exception {
|
||||
val xtextGrammar = '''grammar test with org.eclipse.xtext.common.Terminals import 'http://www.eclipse.org/emf/2002/Ecore' as ecore generate test 'http://test' MyRule: myFeature=INT;'''
|
||||
val grammar = getModel(xtextGrammar) as Grammar
|
||||
val transformer = new Xtext2EcoreTransformer(grammar)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2008, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2008, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
|
@ -67,6 +67,7 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests {
|
|||
* @author Dennis Hübner - Initial contribution and API
|
||||
*/
|
||||
@FinalFieldsConstructor
|
||||
@Deprecated
|
||||
private static final class MockedXtext2EcorePostProcessor implements IXtext2EcorePostProcessor {
|
||||
private int called = 0;
|
||||
|
||||
|
@ -1684,6 +1685,7 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests {
|
|||
Assert.assertTrue(resource.getErrors().isEmpty());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Test
|
||||
public void testPostProcessorHook() throws Exception {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
|
|
|
@ -51,8 +51,6 @@ import org.eclipse.xtext.xtext.XtextTransientValueService2;
|
|||
import org.eclipse.xtext.xtext.XtextValidator;
|
||||
import org.eclipse.xtext.xtext.XtextValueConverters;
|
||||
import org.eclipse.xtext.xtext.CardinalityAwareSyntacticSequencer;
|
||||
import org.eclipse.xtext.xtext.ecoreInference.IXtext2EcorePostProcessor;
|
||||
import org.eclipse.xtext.xtext.ecoreInference.XtendXtext2EcorePostProcessor;
|
||||
import org.eclipse.xtext.xtext.parser.CardinalityAwareEcoreFactory;
|
||||
import org.eclipse.xtext.xtext.parser.CardinalityAwareSyntaxErrorMessageProvider;
|
||||
|
||||
|
@ -110,10 +108,12 @@ public class XtextRuntimeModule extends AbstractXtextRuntimeModule {
|
|||
/**
|
||||
* @since 2.9
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void configureIXtext2EcorePostProcessor(Binder binder) {
|
||||
try {
|
||||
Class.forName("org.eclipse.xtend.expression.ExecutionContext");
|
||||
binder.bind(IXtext2EcorePostProcessor.class).to(XtendXtext2EcorePostProcessor.class);
|
||||
binder.bind(org.eclipse.xtext.xtext.ecoreInference.IXtext2EcorePostProcessor.class)
|
||||
.to(org.eclipse.xtext.xtext.ecoreInference.XtendXtext2EcorePostProcessor.class);
|
||||
} catch (ClassNotFoundException e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2008, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
|
@ -53,7 +53,6 @@ import org.eclipse.xtext.parser.antlr.IReferableElementsUnloader;
|
|||
import org.eclipse.xtext.scoping.IScopeProvider;
|
||||
import org.eclipse.xtext.util.NonRecursiveEContentAdapter;
|
||||
import org.eclipse.xtext.util.OnChangeEvictingCache;
|
||||
import org.eclipse.xtext.xtext.ecoreInference.IXtext2EcorePostProcessor;
|
||||
import org.eclipse.xtext.xtext.ecoreInference.TransformationDiagnosticsProducer;
|
||||
import org.eclipse.xtext.xtext.ecoreInference.Xtext2EcoreTransformer;
|
||||
|
||||
|
@ -71,7 +70,8 @@ public class XtextLinker extends Linker {
|
|||
private IScopeProvider scopeProvider;
|
||||
|
||||
@Inject(optional = true)
|
||||
private IXtext2EcorePostProcessor postProcessor;
|
||||
@SuppressWarnings("deprecation")
|
||||
private org.eclipse.xtext.xtext.ecoreInference.IXtext2EcorePostProcessor postProcessor;
|
||||
|
||||
@Inject(optional = true)
|
||||
private IReferableElementsUnloader unloader;
|
||||
|
@ -87,11 +87,13 @@ public class XtextLinker extends Linker {
|
|||
this.scopeProvider = scopeProvider;
|
||||
}
|
||||
|
||||
public IXtext2EcorePostProcessor getPostProcessor() {
|
||||
@Deprecated
|
||||
public org.eclipse.xtext.xtext.ecoreInference.IXtext2EcorePostProcessor getPostProcessor() {
|
||||
return postProcessor;
|
||||
}
|
||||
|
||||
public void setPostProcessor(IXtext2EcorePostProcessor postProcessor) {
|
||||
@Deprecated
|
||||
public void setPostProcessor(org.eclipse.xtext.xtext.ecoreInference.IXtext2EcorePostProcessor postProcessor) {
|
||||
this.postProcessor = postProcessor;
|
||||
}
|
||||
|
||||
|
@ -199,6 +201,7 @@ public class XtextLinker extends Linker {
|
|||
super.beforeEnsureIsLinked(obj, ref, producer);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Xtext2EcoreTransformer createTransformer(Grammar grammar, IDiagnosticConsumer consumer) {
|
||||
final Xtext2EcoreTransformer transformer = new Xtext2EcoreTransformer(grammar);
|
||||
transformer.setErrorAcceptor(new TransformationDiagnosticsProducer(consumer));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2009, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
|
@ -15,7 +15,9 @@ import org.eclipse.xtext.GeneratedMetamodel;
|
|||
*
|
||||
* @author Knut Wannheden - Initial contribution and API
|
||||
* @author Michael Clay
|
||||
* @deprecated Switch to a manually maintained metamodel instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IXtext2EcorePostProcessor {
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2009, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
|
@ -39,7 +39,10 @@ import org.eclipse.xtext.util.Strings;
|
|||
*
|
||||
* @author Knut Wannheden - Initial contribution and API
|
||||
* @author Michael Clay
|
||||
*
|
||||
* @deprecated This class depends on Xpand/Xtend(1) which is dead as a mouse. So don't use this post processor. Switch to a manually maintained metamodel instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class XtendXtext2EcorePostProcessor implements IXtext2EcorePostProcessor {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(XtendXtext2EcorePostProcessor.class);
|
||||
|
|
|
@ -81,6 +81,7 @@ public class Xtext2EcoreTransformer {
|
|||
private Map<String, EPackage> generatedEPackages;
|
||||
private EClassifierInfos eClassifierInfos;
|
||||
private ErrorAcceptor errorAcceptor = new NullErrorAcceptor();
|
||||
@SuppressWarnings("deprecation")
|
||||
private IXtext2EcorePostProcessor postProcessor;
|
||||
|
||||
public Xtext2EcoreTransformer(Grammar grammar) {
|
||||
|
@ -102,6 +103,7 @@ public class Xtext2EcoreTransformer {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setPostProcessor(IXtext2EcorePostProcessor postProcessor) {
|
||||
this.postProcessor = postProcessor;
|
||||
}
|
||||
|
@ -1072,6 +1074,7 @@ public class Xtext2EcoreTransformer {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void postProcessGeneratedPackages() {
|
||||
if (postProcessor != null) {
|
||||
final Iterable<GeneratedMetamodel> generatedMetamodels = Iterables.filter(grammar
|
||||
|
|
Loading…
Reference in a new issue