diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/AbstractInheritingFragment.java b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/AbstractInheritingFragment.java new file mode 100644 index 000000000..115b240df --- /dev/null +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/AbstractInheritingFragment.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2015, 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. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.xtext.generator; + +/** + * A fragment that generates a class that inherits from the generated class of + * the super-grammar. This inheritance can be disabled with the + * {@code inheritImplementation} property. + */ +public abstract class AbstractInheritingFragment extends AbstractStubGeneratingFragment { + + private boolean inheritImplementation = true; + + public boolean isInheritImplementation() { + return inheritImplementation; + } + + public void setInheritImplementation(boolean inheritImplementation) { + this.inheritImplementation = inheritImplementation; + } +} diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/AbstractInheritingFragment.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/AbstractInheritingFragment.xtend deleted file mode 100644 index 3f8ef72e0..000000000 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/AbstractInheritingFragment.xtend +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.xtext.generator - -import org.eclipse.xtext.xtext.generator.AbstractStubGeneratingFragment -import org.eclipse.xtend.lib.annotations.Accessors - -/** - * A fragment that generates a class that inherits from the generated class of the super-grammar. - * This inheritance can be disabled with the {@code inheritImplementation} property. - */ -abstract class AbstractInheritingFragment extends AbstractStubGeneratingFragment { - - @Accessors boolean inheritImplementation = true - -} diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IGuiceAwareGeneratorComponent.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IGuiceAwareGeneratorComponent.java similarity index 75% rename from org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IGuiceAwareGeneratorComponent.xtend rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IGuiceAwareGeneratorComponent.java index a8dd77458..7ad84fe18 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IGuiceAwareGeneratorComponent.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IGuiceAwareGeneratorComponent.java @@ -1,22 +1,22 @@ /******************************************************************************* - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 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. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.xtext.generator +package org.eclipse.xtext.xtext.generator; -import com.google.inject.Injector +import com.google.inject.Injector; /** * The Xtext generator uses dependency injection with Guice * for distributing the configuration to all its components. Instances of this interface can initialize * themselves with a Guice injector, e.g. by calling {@code injector.injectMembers(this)}. */ -interface IGuiceAwareGeneratorComponent { +public interface IGuiceAwareGeneratorComponent { - def void initialize(Injector injector) + void initialize(Injector injector); } diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorFragment.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorFragment.java similarity index 69% rename from org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorFragment.xtend rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorFragment.java index 534b5184b..498de18ae 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorFragment.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorFragment.java @@ -1,21 +1,21 @@ /******************************************************************************* - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 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. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.xtext.generator +package org.eclipse.xtext.xtext.generator; /** * A fragment that contributes to the {@link XtextGenerator}. Use {@link AbstractXtextGeneratorFragment} * for implementing new fragments. */ -interface IXtextGeneratorFragment extends IGuiceAwareGeneratorComponent { +public interface IXtextGeneratorFragment extends IGuiceAwareGeneratorComponent { - def void checkConfiguration(Issues issues) + void checkConfiguration(Issues issues); - def void generate() + void generate(); } diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorLanguage.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorLanguage.java similarity index 59% rename from org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorLanguage.xtend rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorLanguage.java index ab7965c14..c2ddec4fb 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorLanguage.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/IXtextGeneratorLanguage.java @@ -6,43 +6,43 @@ * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.xtext.generator +package org.eclipse.xtext.xtext.generator; -import java.util.List -import org.eclipse.emf.ecore.resource.ResourceSet -import org.eclipse.xtext.Grammar -import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess -import org.eclipse.xtext.xtext.generator.model.StandaloneSetupAccess +import java.util.List; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.xtext.Grammar; +import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; +import org.eclipse.xtext.xtext.generator.model.StandaloneSetupAccess; /** * Configuration for an Xtext language. Implemented by {@link XtextGeneratorLanguage}. * * @noimplement This interface should not be implemented by clients. */ -interface IXtextGeneratorLanguage { +public interface IXtextGeneratorLanguage { - def Grammar getGrammar() + Grammar getGrammar(); - def List getFileExtensions() + List getFileExtensions(); - def StandaloneSetupAccess getRuntimeGenSetup() + StandaloneSetupAccess getRuntimeGenSetup(); - def GuiceModuleAccess getRuntimeGenModule() + GuiceModuleAccess getRuntimeGenModule(); - def GuiceModuleAccess getIdeGenModule() + GuiceModuleAccess getIdeGenModule(); - def GuiceModuleAccess getEclipsePluginGenModule() + GuiceModuleAccess getEclipsePluginGenModule(); - def GuiceModuleAccess getIdeaGenModule() + GuiceModuleAccess getIdeaGenModule(); - def GuiceModuleAccess getWebGenModule() + GuiceModuleAccess getWebGenModule(); - def ResourceSet getResourceSet() + ResourceSet getResourceSet(); /** * @deprecated Use {@link CodeConfig#isPreferXtendStubs()} instead */ @Deprecated - def boolean isGenerateXtendStubs() + boolean isGenerateXtendStubs(); } diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/Issues.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/Issues.java similarity index 64% rename from org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/Issues.xtend rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/Issues.java index 6164df46e..ec23691ec 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/Issues.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/Issues.java @@ -1,24 +1,24 @@ /******************************************************************************* - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 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. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.xtext.generator +package org.eclipse.xtext.xtext.generator; /** * Use this to report configuration problems during the {@link IXtextGeneratorFragment#checkConfiguration(Issues)} phase. */ -interface Issues { +public interface Issues { - def void addError(String message) + void addError(String message); - def void addError(String message, Object source) + void addError(String message, Object source); - def void addWarning(String message) + void addWarning(String message); - def void addWarning(String message, Object source) + void addWarning(String message, Object source); } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/IXtextGeneratorFileSystemAccess.java b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/IXtextGeneratorFileSystemAccess.java similarity index 70% rename from org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/IXtextGeneratorFileSystemAccess.java rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/IXtextGeneratorFileSystemAccess.java index fd9b19158..c70f46f7e 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/IXtextGeneratorFileSystemAccess.java +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/IXtextGeneratorFileSystemAccess.java @@ -1,25 +1,25 @@ -/** - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. +/******************************************************************************* + * Copyright (c) 2015, 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. - * + * * SPDX-License-Identifier: EPL-2.0 - */ + *******************************************************************************/ package org.eclipse.xtext.xtext.generator.model; import com.google.inject.ImplementedBy; import org.eclipse.xtext.generator.IFileSystemAccess2; import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent; -import org.eclipse.xtext.xtext.generator.model.XtextGeneratorFileSystemAccess; /** * File system access for the Xtext generator. */ @ImplementedBy(XtextGeneratorFileSystemAccess.class) -@SuppressWarnings("all") public interface IXtextGeneratorFileSystemAccess extends IFileSystemAccess2, IGuiceAwareGeneratorComponent { - String getPath(); - - boolean isOverwrite(); + + String getPath(); + + boolean isOverwrite(); + } diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/IXtextGeneratorFileSystemAccess.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/IXtextGeneratorFileSystemAccess.xtend deleted file mode 100644 index b0080bc42..000000000 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/IXtextGeneratorFileSystemAccess.xtend +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.xtext.generator.model - -import com.google.inject.ImplementedBy -import org.eclipse.xtext.generator.IFileSystemAccess2 -import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent - -/** - * File system access for the Xtext generator. - */ -@ImplementedBy(XtextGeneratorFileSystemAccess) -interface IXtextGeneratorFileSystemAccess extends IFileSystemAccess2, IGuiceAwareGeneratorComponent { - - def String getPath() - - def boolean isOverwrite() - -} diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/annotations/IClassAnnotation.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/annotations/IClassAnnotation.java similarity index 74% rename from org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/annotations/IClassAnnotation.xtend rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/annotations/IClassAnnotation.java index e8de559d4..ceafeb79a 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/annotations/IClassAnnotation.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/annotations/IClassAnnotation.java @@ -1,17 +1,17 @@ /******************************************************************************* - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 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. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.xtext.generator.model.annotations +package org.eclipse.xtext.xtext.generator.model.annotations; -import java.lang.annotation.Repeatable -import org.eclipse.xtext.xtext.generator.XtextGenerator -import org.eclipse.xtext.xtext.generator.model.JavaFileAccess -import org.eclipse.xtext.xtext.generator.model.TypeReference +import java.lang.annotation.Repeatable; +import org.eclipse.xtext.xtext.generator.XtextGenerator; +import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; +import org.eclipse.xtext.xtext.generator.model.TypeReference; /** * Class annotations can be added to the {@link XtextGenerator} workflow component in order @@ -23,22 +23,22 @@ import org.eclipse.xtext.xtext.generator.model.TypeReference *
  • If the underlying Annotation is NOT {@link Repeatable} then {@link Object#equals(Object)} should return true for all instances and {@link Object#hashCode()} should return the same value for all instances
  • * */ -interface IClassAnnotation { +public interface IClassAnnotation { /** * Convert the class annotation to a string suitable for use in Java code generation. */ - def CharSequence generate() + CharSequence generate(); /** * Determine whether this annotation should be applied to the given Java file. */ - def boolean appliesTo(JavaFileAccess javaFile) + boolean appliesTo(JavaFileAccess javaFile); /** * Return the qualified name of the annotation interface for use in import declarations, * or {@code null} if no import is required. */ - def TypeReference getAnnotationImport() + TypeReference getAnnotationImport(); } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IBundleProjectConfig.java b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IBundleProjectConfig.java similarity index 67% rename from org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IBundleProjectConfig.java rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IBundleProjectConfig.java index ed791254d..7be23ef44 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IBundleProjectConfig.java +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IBundleProjectConfig.java @@ -1,25 +1,25 @@ -/** - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. +/******************************************************************************* + * Copyright (c) 2015, 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. - * + * * SPDX-License-Identifier: EPL-2.0 - */ + *******************************************************************************/ package org.eclipse.xtext.xtext.generator.model.project; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; -import org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig; /** * Configuration of subprojects that can be used as Eclipse bundles. * * @noimplement This interface should not be implemented by clients. */ -@SuppressWarnings("all") public interface IBundleProjectConfig extends ISubProjectConfig { - ManifestAccess getManifest(); - - PluginXmlAccess getPluginXml(); + + ManifestAccess getManifest(); + + PluginXmlAccess getPluginXml(); + } diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IBundleProjectConfig.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IBundleProjectConfig.xtend deleted file mode 100644 index 7267df0da..000000000 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IBundleProjectConfig.xtend +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.xtext.generator.model.project - -import org.eclipse.xtext.xtext.generator.model.ManifestAccess -import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess - -/** - * Configuration of subprojects that can be used as Eclipse bundles. - * - * @noimplement This interface should not be implemented by clients. - */ -interface IBundleProjectConfig extends ISubProjectConfig { - - def ManifestAccess getManifest() - - def PluginXmlAccess getPluginXml() - -} diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IRuntimeProjectConfig.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IRuntimeProjectConfig.java similarity index 65% rename from org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IRuntimeProjectConfig.xtend rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IRuntimeProjectConfig.java index de70b69b8..d473bd976 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IRuntimeProjectConfig.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IRuntimeProjectConfig.java @@ -1,34 +1,34 @@ /******************************************************************************* - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 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. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.xtext.generator.model.project +package org.eclipse.xtext.xtext.generator.model.project; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess +import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; /** * Configuration of the runtime project, i.e. the main subproject containing the language definition. * * @noimplement This interface should not be implemented by clients. */ -interface IRuntimeProjectConfig extends IBundleProjectConfig { +public interface IRuntimeProjectConfig extends IBundleProjectConfig { - def IXtextGeneratorFileSystemAccess getEcoreModel() + IXtextGeneratorFileSystemAccess getEcoreModel(); - def String getEcoreModelFolder() + String getEcoreModelFolder(); /** * @since 2.13 */ - def String getXbaseLibVersionLowerBound() + String getXbaseLibVersionLowerBound(); /** * @since 2.13 */ - def String getXtendLibVersionLowerBound() + String getXtendLibVersionLowerBound(); } diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/ISubProjectConfig.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/ISubProjectConfig.java similarity index 56% rename from org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/ISubProjectConfig.xtend rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/ISubProjectConfig.java index a67cf5973..ece24b4b4 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/ISubProjectConfig.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/ISubProjectConfig.java @@ -1,35 +1,35 @@ /******************************************************************************* - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 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. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.xtext.generator.model.project +package org.eclipse.xtext.xtext.generator.model.project; -import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess +import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent; +import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; /** * Configuration of subprojects. * * @noimplement This interface should not be implemented by clients. */ -interface ISubProjectConfig extends IGuiceAwareGeneratorComponent { +public interface ISubProjectConfig extends IGuiceAwareGeneratorComponent { - def boolean isEnabled() + boolean isEnabled(); - def String getName() + String getName(); - def IXtextGeneratorFileSystemAccess getRoot() + IXtextGeneratorFileSystemAccess getRoot(); - def IXtextGeneratorFileSystemAccess getMetaInf() + IXtextGeneratorFileSystemAccess getMetaInf(); - def IXtextGeneratorFileSystemAccess getSrc() + IXtextGeneratorFileSystemAccess getSrc(); - def IXtextGeneratorFileSystemAccess getSrcGen() + IXtextGeneratorFileSystemAccess getSrcGen(); - def IXtextGeneratorFileSystemAccess getIcons() + IXtextGeneratorFileSystemAccess getIcons(); } diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IWebProjectConfig.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IWebProjectConfig.java similarity index 70% rename from org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IWebProjectConfig.xtend rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IWebProjectConfig.java index 0651a8cb3..efc711c84 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IWebProjectConfig.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IWebProjectConfig.java @@ -1,22 +1,22 @@ /******************************************************************************* - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 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. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.xtext.generator.model.project +package org.eclipse.xtext.xtext.generator.model.project; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess +import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; /** * Configuration of the web project. * * @noimplement This interface should not be implemented by clients. */ -interface IWebProjectConfig extends ISubProjectConfig { +public interface IWebProjectConfig extends ISubProjectConfig { - def IXtextGeneratorFileSystemAccess getAssets() + IXtextGeneratorFileSystemAccess getAssets(); } diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IXtextProjectConfig.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IXtextProjectConfig.java similarity index 51% rename from org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IXtextProjectConfig.xtend rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IXtextProjectConfig.java index b1456ea19..34af33d67 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IXtextProjectConfig.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/model/project/IXtextProjectConfig.java @@ -1,39 +1,39 @@ /******************************************************************************* - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 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. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.xtext.generator.model.project +package org.eclipse.xtext.xtext.generator.model.project; -import java.util.List -import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent +import java.util.List; +import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent; /** * Configuration of the subprojects for one or more Xtext languages. Implemented by {@link XtextProjectConfig}. * * @noimplement This interface should not be implemented by clients. */ -interface IXtextProjectConfig extends IGuiceAwareGeneratorComponent { +public interface IXtextProjectConfig extends IGuiceAwareGeneratorComponent { - def IRuntimeProjectConfig getRuntime() + IRuntimeProjectConfig getRuntime(); - def IBundleProjectConfig getRuntimeTest() + IBundleProjectConfig getRuntimeTest(); - def IBundleProjectConfig getGenericIde() + IBundleProjectConfig getGenericIde(); - def IBundleProjectConfig getEclipsePlugin() + IBundleProjectConfig getEclipsePlugin(); - def IBundleProjectConfig getEclipsePluginTest() + IBundleProjectConfig getEclipsePluginTest(); - def ISubProjectConfig getIdeaPlugin() + ISubProjectConfig getIdeaPlugin(); - def IWebProjectConfig getWeb() + IWebProjectConfig getWeb(); - def List getEnabledProjects() + List getEnabledProjects(); - def List getTestProjects() + List getTestProjects(); } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/InjectableRuleNames.java b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/serializer/InjectableRuleNames.java similarity index 61% rename from org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/InjectableRuleNames.java rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/serializer/InjectableRuleNames.java index 3d47c75a0..5ae01f334 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/InjectableRuleNames.java +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/serializer/InjectableRuleNames.java @@ -1,11 +1,11 @@ -/** - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. +/******************************************************************************* + * Copyright (c) 2015, 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. - * + * * SPDX-License-Identifier: EPL-2.0 - */ + *******************************************************************************/ package org.eclipse.xtext.xtext.generator.serializer; import com.google.inject.Inject; @@ -13,14 +13,15 @@ import com.google.inject.Singleton; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.xtext.RuleNames; -/** +/** * @author Sebastian Zarnekow - Initial contribution and API */ -@Singleton -@SuppressWarnings("all") +@Singleton public class InjectableRuleNames extends RuleNames { - @Inject - public InjectableRuleNames(final Grammar grammar) { - super(grammar, false); - } + + @Inject + public InjectableRuleNames(Grammar grammar) { + super(grammar, false); + } + } diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/serializer/InjectableRuleNames.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/serializer/InjectableRuleNames.xtend deleted file mode 100644 index b23276201..000000000 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/serializer/InjectableRuleNames.xtend +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 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. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.xtext.generator.serializer - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.xtext.Grammar -import org.eclipse.xtext.xtext.RuleNames - -/** - * @author Sebastian Zarnekow - Initial contribution and API - */ -@Singleton class InjectableRuleNames extends RuleNames { - - @Inject - new(Grammar grammar) { - super(grammar, false) - } - -} diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/BooleanGeneratorOption.java b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/BooleanGeneratorOption.java new file mode 100644 index 000000000..01cf12085 --- /dev/null +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/BooleanGeneratorOption.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2015, 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. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.xtext.generator.util; + +/** + * A Boolean-valued option with default value for use in generator fragments. + */ +public class BooleanGeneratorOption { + + private final boolean defaultValue; + + private Boolean value; + + public BooleanGeneratorOption() { + this(false); + } + + public BooleanGeneratorOption(boolean defaultValue) { + this.defaultValue = defaultValue; + } + + public boolean get() { + if (value != null) { + return value; + } else { + return defaultValue; + } + } + + public void set(boolean value) { + this.value = value; + } + + public boolean isSet() { + return value != null; + } + +} \ No newline at end of file diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/BooleanGeneratorOption.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/BooleanGeneratorOption.xtend deleted file mode 100644 index 840d7337c..000000000 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/BooleanGeneratorOption.xtend +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 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. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.xtext.generator.util - -/** - * A Boolean-valued option with default value for use in generator fragments. - */ -class BooleanGeneratorOption { - - val boolean defaultValue - - Boolean value - - new() { - this(false) - } - - new(boolean defaultValue) { - this.defaultValue = defaultValue - } - - def boolean get() { - value ?: defaultValue - } - - def void set(boolean value) { - this.value = value - } - - def boolean isSet() { - value !== null - } - -} \ No newline at end of file diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/GeneratorOption.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/GeneratorOption.java similarity index 53% rename from org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/GeneratorOption.xtend rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/GeneratorOption.java index ea965ad99..22e2776f8 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/GeneratorOption.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/GeneratorOption.java @@ -1,46 +1,50 @@ /******************************************************************************* - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 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. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.xtext.generator.util +package org.eclipse.xtext.xtext.generator.util; /** * An object-valued option with default value for use in generator fragments. */ -class GeneratorOption { +public class GeneratorOption { - val T defaultValue + private final T defaultValue; - T value + private T value; /** * Create an option with no default value. */ - new() { - this.defaultValue = null + public GeneratorOption() { + this.defaultValue = null; } /** * Create an option with a default value. */ - new(T defaultValue) { - this.defaultValue = defaultValue + public GeneratorOption(T defaultValue) { + this.defaultValue = defaultValue; } - def T get() { - value ?: defaultValue + public T get() { + if (value != null) { + return value; + } else { + return defaultValue; + } } - def void set(T value) { - this.value = value + public void set(T value) { + this.value = value; } - def boolean isSet() { - value !== null + public boolean isSet() { + return value != null; } } \ No newline at end of file diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.java similarity index 56% rename from org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.xtend rename to org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.java index 4a77e88d8..5681b1938 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.java @@ -1,16 +1,18 @@ /** - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 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. * * SPDX-License-Identifier: EPL-2.0 */ -package org.eclipse.xtext.xtext.generator.util +package org.eclipse.xtext.xtext.generator.util; -import org.eclipse.xtext.Keyword -import org.eclipse.xtext.TerminalRule -import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil +import org.eclipse.xtext.Keyword; +import org.eclipse.xtext.TerminalRule; +import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil; + +import com.google.common.base.Objects; /** * Helper to identify synthetic terminal rules. @@ -19,19 +21,20 @@ import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil * * @author Sebastian Zarnekow - Initial contribution and API */ -class SyntheticTerminalDetector { +public class SyntheticTerminalDetector { /** * Answers {@code true} if the given terminal rule is synthetic. That is, * the tokens for this rule will not be produced by the generated Antlr lexer * but manually in a custom token source. */ - def boolean isSyntheticTerminalRule(TerminalRule rule) { - if (rule.alternatives instanceof Keyword) { - var String value = (rule.alternatives as Keyword).value - return 'synthetic:' + AntlrGrammarGenUtil.getOriginalElement(rule).name == value + public boolean isSyntheticTerminalRule(TerminalRule rule) { + if (rule.getAlternatives() instanceof Keyword) { + String value = ((Keyword) rule.getAlternatives()).getValue(); + String sytheticValue = "synthetic:" + AntlrGrammarGenUtil.getOriginalElement(rule).getName(); + return Objects.equal(sytheticValue, value); } - return false + return false; } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/AbstractInheritingFragment.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/AbstractInheritingFragment.java deleted file mode 100644 index 72ce2b5cc..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/AbstractInheritingFragment.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator; - -import org.eclipse.xtend.lib.annotations.Accessors; -import org.eclipse.xtext.xbase.lib.Pure; -import org.eclipse.xtext.xtext.generator.AbstractStubGeneratingFragment; - -/** - * A fragment that generates a class that inherits from the generated class of the super-grammar. - * This inheritance can be disabled with the {@code inheritImplementation} property. - */ -@SuppressWarnings("all") -public abstract class AbstractInheritingFragment extends AbstractStubGeneratingFragment { - @Accessors - private boolean inheritImplementation = true; - - @Pure - public boolean isInheritImplementation() { - return this.inheritImplementation; - } - - public void setInheritImplementation(final boolean inheritImplementation) { - this.inheritImplementation = inheritImplementation; - } -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/IGuiceAwareGeneratorComponent.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/IGuiceAwareGeneratorComponent.java deleted file mode 100644 index 2e714a8cc..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/IGuiceAwareGeneratorComponent.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator; - -import com.google.inject.Injector; - -/** - * The Xtext generator uses dependency injection with Guice - * for distributing the configuration to all its components. Instances of this interface can initialize - * themselves with a Guice injector, e.g. by calling {@code injector.injectMembers(this)}. - */ -@SuppressWarnings("all") -public interface IGuiceAwareGeneratorComponent { - void initialize(final Injector injector); -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/IXtextGeneratorFragment.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/IXtextGeneratorFragment.java deleted file mode 100644 index cfc4af3ed..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/IXtextGeneratorFragment.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator; - -import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent; -import org.eclipse.xtext.xtext.generator.Issues; - -/** - * A fragment that contributes to the {@link XtextGenerator}. Use {@link AbstractXtextGeneratorFragment} - * for implementing new fragments. - */ -@SuppressWarnings("all") -public interface IXtextGeneratorFragment extends IGuiceAwareGeneratorComponent { - void checkConfiguration(final Issues issues); - - void generate(); -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/IXtextGeneratorLanguage.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/IXtextGeneratorLanguage.java deleted file mode 100644 index 3d7a679d7..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/IXtextGeneratorLanguage.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator; - -import java.util.List; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.xtext.Grammar; -import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; -import org.eclipse.xtext.xtext.generator.model.StandaloneSetupAccess; - -/** - * Configuration for an Xtext language. Implemented by {@link XtextGeneratorLanguage}. - * - * @noimplement This interface should not be implemented by clients. - */ -@SuppressWarnings("all") -public interface IXtextGeneratorLanguage { - Grammar getGrammar(); - - List getFileExtensions(); - - StandaloneSetupAccess getRuntimeGenSetup(); - - GuiceModuleAccess getRuntimeGenModule(); - - GuiceModuleAccess getIdeGenModule(); - - GuiceModuleAccess getEclipsePluginGenModule(); - - GuiceModuleAccess getIdeaGenModule(); - - GuiceModuleAccess getWebGenModule(); - - ResourceSet getResourceSet(); - - /** - * @deprecated Use {@link CodeConfig#isPreferXtendStubs()} instead - */ - @Deprecated - boolean isGenerateXtendStubs(); -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/Issues.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/Issues.java deleted file mode 100644 index 642050768..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/Issues.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator; - -/** - * Use this to report configuration problems during the {@link IXtextGeneratorFragment#checkConfiguration(Issues)} phase. - */ -@SuppressWarnings("all") -public interface Issues { - void addError(final String message); - - void addError(final String message, final Object source); - - void addWarning(final String message); - - void addWarning(final String message, final Object source); -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/IClassAnnotation.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/IClassAnnotation.java deleted file mode 100644 index 22c8ee67d..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/IClassAnnotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator.model.annotations; - -import java.lang.annotation.Repeatable; -import org.eclipse.xtext.xtext.generator.XtextGenerator; -import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; -import org.eclipse.xtext.xtext.generator.model.TypeReference; - -/** - * Class annotations can be added to the {@link XtextGenerator} workflow component in order - * to configure specific Java annotations to be added to each generated class. - *

    - * Make sure that you implement {@link Object#equals(Object)} and {@link Object#hashCode()} to fulfill following contract - *
      - *
    • If the underlying Annotation is {@link Repeatable} then the methods should behave like in {@link Object}.
    • - *
    • If the underlying Annotation is NOT {@link Repeatable} then {@link Object#equals(Object)} should return true for all instances and {@link Object#hashCode()} should return the same value for all instances
    • - *
    - */ -@SuppressWarnings("all") -public interface IClassAnnotation { - /** - * Convert the class annotation to a string suitable for use in Java code generation. - */ - CharSequence generate(); - - /** - * Determine whether this annotation should be applied to the given Java file. - */ - boolean appliesTo(final JavaFileAccess javaFile); - - /** - * Return the qualified name of the annotation interface for use in import declarations, - * or {@code null} if no import is required. - */ - TypeReference getAnnotationImport(); -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IRuntimeProjectConfig.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IRuntimeProjectConfig.java deleted file mode 100644 index 7061cfd2c..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IRuntimeProjectConfig.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator.model.project; - -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; - -/** - * Configuration of the runtime project, i.e. the main subproject containing the language definition. - * - * @noimplement This interface should not be implemented by clients. - */ -@SuppressWarnings("all") -public interface IRuntimeProjectConfig extends IBundleProjectConfig { - IXtextGeneratorFileSystemAccess getEcoreModel(); - - String getEcoreModelFolder(); - - /** - * @since 2.13 - */ - String getXbaseLibVersionLowerBound(); - - /** - * @since 2.13 - */ - String getXtendLibVersionLowerBound(); -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/ISubProjectConfig.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/ISubProjectConfig.java deleted file mode 100644 index a3897f5e9..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/ISubProjectConfig.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator.model.project; - -import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; - -/** - * Configuration of subprojects. - * - * @noimplement This interface should not be implemented by clients. - */ -@SuppressWarnings("all") -public interface ISubProjectConfig extends IGuiceAwareGeneratorComponent { - boolean isEnabled(); - - String getName(); - - IXtextGeneratorFileSystemAccess getRoot(); - - IXtextGeneratorFileSystemAccess getMetaInf(); - - IXtextGeneratorFileSystemAccess getSrc(); - - IXtextGeneratorFileSystemAccess getSrcGen(); - - IXtextGeneratorFileSystemAccess getIcons(); -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IWebProjectConfig.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IWebProjectConfig.java deleted file mode 100644 index d76e1aeef..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IWebProjectConfig.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator.model.project; - -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; -import org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig; - -/** - * Configuration of the web project. - * - * @noimplement This interface should not be implemented by clients. - */ -@SuppressWarnings("all") -public interface IWebProjectConfig extends ISubProjectConfig { - IXtextGeneratorFileSystemAccess getAssets(); -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IXtextProjectConfig.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IXtextProjectConfig.java deleted file mode 100644 index 59faa0da3..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/IXtextProjectConfig.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2015, 2017 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator.model.project; - -import java.util.List; -import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IWebProjectConfig; - -/** - * Configuration of the subprojects for one or more Xtext languages. Implemented by {@link XtextProjectConfig}. - * - * @noimplement This interface should not be implemented by clients. - */ -@SuppressWarnings("all") -public interface IXtextProjectConfig extends IGuiceAwareGeneratorComponent { - IRuntimeProjectConfig getRuntime(); - - IBundleProjectConfig getRuntimeTest(); - - IBundleProjectConfig getGenericIde(); - - IBundleProjectConfig getEclipsePlugin(); - - IBundleProjectConfig getEclipsePluginTest(); - - ISubProjectConfig getIdeaPlugin(); - - IWebProjectConfig getWeb(); - - List getEnabledProjects(); - - List getTestProjects(); -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/BooleanGeneratorOption.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/BooleanGeneratorOption.java deleted file mode 100644 index 463c9490e..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/BooleanGeneratorOption.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2015 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator.util; - -/** - * A Boolean-valued option with default value for use in generator fragments. - */ -@SuppressWarnings("all") -public class BooleanGeneratorOption { - private final boolean defaultValue; - - private Boolean value; - - public BooleanGeneratorOption() { - this(false); - } - - public BooleanGeneratorOption(final boolean defaultValue) { - this.defaultValue = defaultValue; - } - - public boolean get() { - Boolean _elvis = null; - if (this.value != null) { - _elvis = this.value; - } else { - _elvis = Boolean.valueOf(this.defaultValue); - } - return (boolean) _elvis; - } - - public void set(final boolean value) { - this.value = Boolean.valueOf(value); - } - - public boolean isSet() { - return (this.value != null); - } -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/GeneratorOption.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/GeneratorOption.java deleted file mode 100644 index 98f23ad87..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/GeneratorOption.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) 2015 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator.util; - -/** - * An object-valued option with default value for use in generator fragments. - */ -@SuppressWarnings("all") -public class GeneratorOption { - private final T defaultValue; - - private T value; - - /** - * Create an option with no default value. - */ - public GeneratorOption() { - this.defaultValue = null; - } - - /** - * Create an option with a default value. - */ - public GeneratorOption(final T defaultValue) { - this.defaultValue = defaultValue; - } - - public T get() { - T _elvis = null; - if (this.value != null) { - _elvis = this.value; - } else { - _elvis = this.defaultValue; - } - return _elvis; - } - - public void set(final T value) { - this.value = value; - } - - public boolean isSet() { - return (this.value != null); - } -} diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.java deleted file mode 100644 index e9d3b4cd5..000000000 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2015 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. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.xtext.generator.util; - -import com.google.common.base.Objects; -import org.eclipse.xtext.AbstractElement; -import org.eclipse.xtext.Keyword; -import org.eclipse.xtext.TerminalRule; -import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil; - -/** - * Helper to identify synthetic terminal rules. - * This implementation answers true for any terminal rule that has a body in the form - * terminal MY_TERMINAL: 'synthetic:MY_TERMINAL';. - * - * @author Sebastian Zarnekow - Initial contribution and API - */ -@SuppressWarnings("all") -public class SyntheticTerminalDetector { - /** - * Answers {@code true} if the given terminal rule is synthetic. That is, - * the tokens for this rule will not be produced by the generated Antlr lexer - * but manually in a custom token source. - */ - public boolean isSyntheticTerminalRule(final TerminalRule rule) { - AbstractElement _alternatives = rule.getAlternatives(); - if ((_alternatives instanceof Keyword)) { - AbstractElement _alternatives_1 = rule.getAlternatives(); - String value = ((Keyword) _alternatives_1).getValue(); - String _name = AntlrGrammarGenUtil.getOriginalElement(rule).getName(); - String _plus = ("synthetic:" + _name); - return Objects.equal(_plus, value); - } - return false; - } -}