remove unnec. restriction for non xbase grammars

Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
This commit is contained in:
Christian Dietrich 2021-07-23 14:51:03 +02:00
parent 3904980267
commit 65305be6da
3 changed files with 11 additions and 6 deletions

View file

@ -145,7 +145,6 @@ public class ValidatorFragment2Tests extends AbstractGeneratorFragmentTests {
"import org.eclipse.xtext.validation.ConfigurableIssueCodesProvider;\n" +
"import org.eclipse.xtext.validation.SeverityConverter;\n" +
"\n" +
"@SuppressWarnings(\"restriction\")\n" +
"public class FooConfigurableIssueCodesProvider extends ConfigurableIssueCodesProvider {\n" +
" protected static final String ISSUE_CODE_PREFIX = \"org.xtext.\";\n" +
"\n" +
@ -181,7 +180,6 @@ public class ValidatorFragment2Tests extends AbstractGeneratorFragmentTests {
"import org.eclipse.xtext.util.IAcceptor;\n" +
"import org.eclipse.xtext.validation.ConfigurableIssueCodesProvider;\n" +
"\n" +
"@SuppressWarnings(\"restriction\")\n" +
"public class FooConfigurableIssueCodesProvider extends ConfigurableIssueCodesProvider {\n" +
" protected static final String ISSUE_CODE_PREFIX = \"org.xtext.\";\n" +
"\n" +

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2018 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2015, 2021 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.
@ -246,7 +246,9 @@ class ValidatorFragment2 extends AbstractInheritingFragment {
protected def generateIssueProvider(){
val javaFile = fileAccessFactory.createGeneratedJavaFile(configurableIssueCodesProviderClass)
javaFile.content = '''
«IF language.grammar.inheritsXbase»
@SuppressWarnings("restriction")
«ENDIF»
public class «configurableIssueCodesProviderClass» extends «superConfigurableIssueCodesProviderClass» {
protected static final String ISSUE_CODE_PREFIX = "«grammar.runtimeBasePackage».";

View file

@ -1,5 +1,5 @@
/**
* Copyright (c) 2015, 2018 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2015, 2021 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.
@ -466,8 +466,13 @@ public class ValidatorFragment2 extends AbstractInheritingFragment {
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("@SuppressWarnings(\"restriction\")");
_builder.newLine();
{
boolean _inheritsXbase = ValidatorFragment2.this._xbaseUsageDetector.inheritsXbase(ValidatorFragment2.this.getLanguage().getGrammar());
if (_inheritsXbase) {
_builder.append("@SuppressWarnings(\"restriction\")");
_builder.newLine();
}
}
_builder.append("public class ");
TypeReference _configurableIssueCodesProviderClass = ValidatorFragment2.this.getConfigurableIssueCodesProviderClass();
_builder.append(_configurableIssueCodesProviderClass);