[492072] Minimized usage of local variables

The Xtend compiler was optimized to minimize the usage of synthetic variables for member feature calls and right-hand assignments

Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
This commit is contained in:
Karsten Thoms 2016-12-21 23:32:19 +01:00
parent 1d79c61326
commit c9b7bf5af2
126 changed files with 1462 additions and 3921 deletions

View file

@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.tests.editor.contentassist;
import com.google.inject.Inject;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory;
import org.eclipse.xtext.ide.tests.editor.contentassist.ContentAssistContextTestHelper;
import org.eclipse.xtext.ide.tests.testlanguage.TestLanguageIdeInjectorProvider;
@ -169,8 +168,7 @@ public class ContentAssistContextFactoryTest {
@Test
public void testCustomEntryPoint() {
ParserRule _propertyRule = this.grammar.getPropertyRule();
this._contentAssistContextTestHelper.setEntryPoint(_propertyRule);
this._contentAssistContextTestHelper.setEntryPoint(this.grammar.getPropertyRule());
StringConcatenation _builder = new StringConcatenation();
_builder.append("int <|>bar");
_builder.newLine();
@ -199,8 +197,7 @@ public class ContentAssistContextFactoryTest {
@Test
public void testCustomEntryPointBeginning() {
ParserRule _propertyRule = this.grammar.getPropertyRule();
this._contentAssistContextTestHelper.setEntryPoint(_propertyRule);
this._contentAssistContextTestHelper.setEntryPoint(this.grammar.getPropertyRule());
StringConcatenation _builder = new StringConcatenation();
_builder.append("<|>int bar");
_builder.newLine();

View file

@ -11,7 +11,6 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
@ -89,8 +88,7 @@ public class ContentAssistContextTestHelper {
Preconditions.checkArgument((offset >= 0), "you forgot to provide a cursor");
final String doc = this.document.replace(this.cursor, "");
final XtextResource res = this.parse(doc);
ExecutorService _newCachedThreadPool = Executors.newCachedThreadPool();
factory.setPool(_newCachedThreadPool);
factory.setPool(Executors.newCachedThreadPool());
TextRegion _textRegion = new TextRegion(0, 0);
final ContentAssistContext[] ctxs = factory.create(doc, _textRegion, offset, res);
GrammarElementTitleSwitch _grammarElementTitleSwitch = new GrammarElementTitleSwitch();

View file

@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.tests.editor.contentassist;
import com.google.inject.Inject;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory;
import org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory;
import org.eclipse.xtext.ide.tests.editor.contentassist.ContentAssistContextTestHelper;
@ -139,8 +138,7 @@ public class PartialContentAssistTestLanguageContextFactoryTest {
@Test
public void testCustomEntryPoint() {
ParserRule _propertyRule = this.grammar.getPropertyRule();
this._contentAssistContextTestHelper.setEntryPoint(_propertyRule);
this._contentAssistContextTestHelper.setEntryPoint(this.grammar.getPropertyRule());
StringConcatenation _builder = new StringConcatenation();
_builder.append("int <|>bar");
_builder.newLine();
@ -163,8 +161,7 @@ public class PartialContentAssistTestLanguageContextFactoryTest {
@Test
public void testCustomEntryPointBeginning() {
ParserRule _propertyRule = this.grammar.getPropertyRule();
this._contentAssistContextTestHelper.setEntryPoint(_propertyRule);
this._contentAssistContextTestHelper.setEntryPoint(this.grammar.getPropertyRule());
StringConcatenation _builder = new StringConcatenation();
_builder.append("<|>int bar");
_builder.newLine();

View file

@ -53,12 +53,9 @@ public class BuildOrderTest {
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList()));
};
final ProjectDescription d = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_3, _function_3);
TopologicalSorter _topologicalSorter = new TopologicalSorter();
final Procedure1<ProjectDescription> _function_4 = (ProjectDescription it) -> {
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
Assert.fail();
};
List<ProjectDescription> _sortByDependencies = _topologicalSorter.sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), _function_4);
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), _sortByDependencies);
})));
}
@Test
@ -87,12 +84,9 @@ public class BuildOrderTest {
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList()));
};
final ProjectDescription d = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_3, _function_3);
TopologicalSorter _topologicalSorter = new TopologicalSorter();
final Procedure1<ProjectDescription> _function_4 = (ProjectDescription it) -> {
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
Assert.fail();
};
List<ProjectDescription> _sortByDependencies = _topologicalSorter.sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), _function_4);
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), _sortByDependencies);
})));
}
@Test
@ -121,12 +115,9 @@ public class BuildOrderTest {
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList()));
};
final ProjectDescription d = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_3, _function_3);
TopologicalSorter _topologicalSorter = new TopologicalSorter();
final Procedure1<ProjectDescription> _function_4 = (ProjectDescription it) -> {
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
Assert.fail();
};
List<ProjectDescription> _sortByDependencies = _topologicalSorter.sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), _function_4);
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), _sortByDependencies);
})));
}
@Test
@ -142,18 +133,12 @@ public class BuildOrderTest {
it.setName("b");
};
final ProjectDescription b = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_1, _function_1);
TopologicalSorter _topologicalSorter = new TopologicalSorter();
final Procedure1<ProjectDescription> _function_2 = (ProjectDescription it) -> {
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
Assert.fail();
};
List<ProjectDescription> _sortByDependencies = _topologicalSorter.sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), _function_2);
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), _sortByDependencies);
TopologicalSorter _topologicalSorter_1 = new TopologicalSorter();
final Procedure1<ProjectDescription> _function_3 = (ProjectDescription it) -> {
})));
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
Assert.fail();
};
List<ProjectDescription> _sortByDependencies_1 = _topologicalSorter_1.sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), _function_3);
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), _sortByDependencies_1);
})));
}
@Test
@ -189,12 +174,9 @@ public class BuildOrderTest {
};
final ProjectDescription e = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_4, _function_4);
final ArrayList<ProjectDescription> cyclic = CollectionLiterals.<ProjectDescription>newArrayList();
TopologicalSorter _topologicalSorter = new TopologicalSorter();
final Procedure1<ProjectDescription> _function_5 = (ProjectDescription it) -> {
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(e)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d, e)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
cyclic.add(it);
};
List<ProjectDescription> _sortByDependencies = _topologicalSorter.sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d, e)), _function_5);
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(e)), _sortByDependencies);
})));
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b, d, c, a)), cyclic);
}
@ -207,12 +189,9 @@ public class BuildOrderTest {
};
final ProjectDescription a = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription, _function);
final ArrayList<ProjectDescription> cyclic = CollectionLiterals.<ProjectDescription>newArrayList();
TopologicalSorter _topologicalSorter = new TopologicalSorter();
final Procedure1<ProjectDescription> _function_1 = (ProjectDescription it) -> {
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList()), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
cyclic.add(it);
};
List<ProjectDescription> _sortByDependencies = _topologicalSorter.sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), _function_1);
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList()), _sortByDependencies);
})));
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), cyclic);
}

View file

@ -53,8 +53,7 @@ public class CompletionTest extends AbstractTestLangLanguageServerTest {
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(1);
int _length = "type Bar {".length();
it.setColumn(_length);
it.setColumn("type Bar {".length());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("Bar (TypeDeclaration) -> Bar [[1, 10] .. [1, 10]]");
_builder_1.newLine();
@ -92,8 +91,7 @@ public class CompletionTest extends AbstractTestLangLanguageServerTest {
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(1);
int _length = " Fo".length();
it.setColumn(_length);
it.setColumn(" Fo".length());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("Foo (TypeDeclaration) -> Foo [[1, 4] .. [1, 6]]");
_builder_1.newLine();
@ -118,8 +116,7 @@ public class CompletionTest extends AbstractTestLangLanguageServerTest {
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(1);
int _length = "type Bar {".length();
it.setColumn(_length);
it.setColumn("type Bar {".length());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("Boo (TypeDeclaration) -> Boo [[1, 10] .. [1, 10]]");
_builder_1.newLine();

View file

@ -39,8 +39,7 @@ public class HoverTest extends AbstractTestLangLanguageServerTest {
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(3);
int _length = "type F".length();
it.setColumn(_length);
it.setColumn("type F".length());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[[3, 5] .. [3, 8]]");
_builder_1.newLine();
@ -67,8 +66,7 @@ public class HoverTest extends AbstractTestLangLanguageServerTest {
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(3);
int _length = "{".length();
it.setColumn(_length);
it.setColumn("{".length());
};
this.testHover(_function);
}
@ -94,8 +92,7 @@ public class HoverTest extends AbstractTestLangLanguageServerTest {
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(4);
int _length = "\tF".length();
it.setColumn(_length);
it.setColumn("\tF".length());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[[4, 1] .. [4, 4]]");
_builder_1.newLine();
@ -128,8 +125,7 @@ public class HoverTest extends AbstractTestLangLanguageServerTest {
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(5);
int _length = "type Bar extends F".length();
it.setColumn(_length);
it.setColumn("type Bar extends F".length());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[[5, 17] .. [5, 20]]");
_builder_1.newLine();
@ -164,8 +160,7 @@ public class HoverTest extends AbstractTestLangLanguageServerTest {
_builder_1.append("}");
_builder_1.newLine();
it.setModel(_builder_1.toString());
int _length = "type Bar extends F".length();
it.setColumn(_length);
it.setColumn("type Bar extends F".length());
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("[[0, 17] .. [0, 20]]");
_builder_2.newLine();

View file

@ -77,18 +77,10 @@ public class MultiProjectTest {
final URI bar = this.createFile(this.project1, "Bar.testlang", _builder_1);
List<URI> _emptyList = CollectionLiterals.<URI>emptyList();
this.workspaceManager.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(foo, bar)), _emptyList, CancelIndicator.NullImpl);
int _size = this.diagnostics.size();
Assert.assertEquals(2, _size);
List<Issue> _get = this.diagnostics.get(foo);
int _size_1 = _get.size();
Assert.assertEquals(1, _size_1);
List<Issue> _get_1 = this.diagnostics.get(foo);
Issue _head = IterableExtensions.<Issue>head(_get_1);
String _code = _head.getCode();
Assert.assertEquals(Diagnostic.LINKING_DIAGNOSTIC, _code);
List<Issue> _get_2 = this.diagnostics.get(bar);
boolean _isEmpty = _get_2.isEmpty();
Assert.assertTrue(_isEmpty);
Assert.assertEquals(2, this.diagnostics.size());
Assert.assertEquals(1, this.diagnostics.get(foo).size());
Assert.assertEquals(Diagnostic.LINKING_DIAGNOSTIC, IterableExtensions.<Issue>head(this.diagnostics.get(foo)).getCode());
Assert.assertTrue(this.diagnostics.get(bar).isEmpty());
this.diagnostics.clear();
String _name = this.project0.getName();
ProjectManager _projectManager = this.workspaceManager.getProjectManager(_name);
@ -98,14 +90,9 @@ public class MultiProjectTest {
_dependencies.add(_name_1);
List<URI> _emptyList_1 = CollectionLiterals.<URI>emptyList();
this.workspaceManager.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(foo, bar)), _emptyList_1, CancelIndicator.NullImpl);
int _size_2 = this.diagnostics.size();
Assert.assertEquals(2, _size_2);
List<Issue> _get_3 = this.diagnostics.get(foo);
boolean _isEmpty_1 = _get_3.isEmpty();
Assert.assertTrue(_isEmpty_1);
List<Issue> _get_4 = this.diagnostics.get(bar);
boolean _isEmpty_2 = _get_4.isEmpty();
Assert.assertTrue(_isEmpty_2);
Assert.assertEquals(2, this.diagnostics.size());
Assert.assertTrue(this.diagnostics.get(foo).isEmpty());
Assert.assertTrue(this.diagnostics.get(bar).isEmpty());
}
@Before
@ -184,8 +171,7 @@ public class MultiProjectTest {
FileWriter _fileWriter = new FileWriter(file);
final Procedure1<FileWriter> _function = (FileWriter it) -> {
try {
String _string = contents.toString();
it.write(_string);
it.write(contents.toString());
it.close();
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);

View file

@ -35,8 +35,7 @@ public class ReferenceTest extends AbstractTestLangLanguageServerTest {
_builder.append("}");
_builder.newLine();
it.setModel(_builder.toString());
int _length = "type F".length();
it.setColumn(_length);
it.setColumn("type F".length());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("MyModel.testlang [[2, 1] .. [2, 4]]");
_builder_1.newLine();
@ -59,8 +58,7 @@ public class ReferenceTest extends AbstractTestLangLanguageServerTest {
_builder.append("}");
_builder.newLine();
it.setModel(_builder.toString());
int _length = "type F".length();
it.setColumn(_length);
it.setColumn("type F".length());
it.setIncludeDeclaration(true);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("MyModel.testlang [[0, 5] .. [0, 8]]");

View file

@ -46,8 +46,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo()");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(");
@ -64,8 +63,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo(1)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(1");
@ -82,8 +80,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo(1, 2)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(1, 2");
@ -100,8 +97,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo(1, 2, 3)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(1, 2, 3");
@ -118,8 +114,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo( 1)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo( 1");
@ -136,8 +131,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo(1 )");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(1 ");
@ -154,8 +148,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo( 1, 2)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo( 1");
@ -172,8 +165,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo( 1 , 2)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo( 1 ");
@ -190,8 +182,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo( 1 , 2)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo( 1 ,");
@ -208,8 +199,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo(1, 2, 3)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(1, 2,");
@ -226,8 +216,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo(1, 2,)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(1, 2,");
@ -244,8 +233,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo(1, /*,*/ 2,)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(1, /*,*/ 2,");
@ -262,8 +250,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo(1, 2)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo");
@ -280,8 +267,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
_builder.append("foo(1, 2)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
String _model = this.getModel(testMe);
it.setModel(_model);
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(1, 2)");

View file

@ -119,8 +119,7 @@ public class WorkspaceManagerTest {
FileWriter _fileWriter = new FileWriter(file);
final Procedure1<FileWriter> _function = (FileWriter it) -> {
try {
String _string = contents.toString();
it.write(_string);
it.write(contents.toString());
it.close();
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);

View file

@ -55,8 +55,7 @@ public class RequestManagerTest {
return "Foo";
};
final CompletableFuture<String> future = this.requestManager.<String>runRead(_function);
String _get = future.get();
Assert.assertEquals("Foo", _get);
Assert.assertEquals("Foo", future.get());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -79,8 +78,7 @@ public class RequestManagerTest {
};
this.requestManager.<Integer>runRead(_function_1);
future.join();
int _get = this.sharedState.get();
Assert.assertEquals(2, _get);
Assert.assertEquals(2, this.sharedState.get());
}
@Test(timeout = 1000)
@ -94,8 +92,7 @@ public class RequestManagerTest {
return Integer.valueOf(this.sharedState.get());
};
final CompletableFuture<Integer> future = this.requestManager.<Integer>runRead(_function_1);
Integer _get = future.get();
Assert.assertEquals(1, (_get).intValue());
Assert.assertEquals(1, (future.get()).intValue());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -108,8 +105,7 @@ public class RequestManagerTest {
};
CompletableFuture<Integer> _runWrite = this.requestManager.<Integer>runWrite(_function);
_runWrite.join();
int _get = this.sharedState.get();
Assert.assertEquals(1, _get);
Assert.assertEquals(1, this.sharedState.get());
}
@Test(timeout = 1000)
@ -130,8 +126,7 @@ public class RequestManagerTest {
};
CompletableFuture<Integer> _runWrite = this.requestManager.<Integer>runWrite(_function_1);
_runWrite.join();
int _get = this.sharedState.get();
Assert.assertEquals(2, _get);
Assert.assertEquals(2, this.sharedState.get());
}
@Test(timeout = 1000)
@ -143,16 +138,14 @@ public class RequestManagerTest {
final Function1<CancelIndicator, Integer> _function_1 = (CancelIndicator it) -> {
int _xblockexpression = (int) 0;
{
int _get = this.sharedState.get();
Assert.assertEquals(1, _get);
Assert.assertEquals(1, this.sharedState.get());
_xblockexpression = this.sharedState.incrementAndGet();
}
return Integer.valueOf(_xblockexpression);
};
CompletableFuture<Integer> _runWrite = this.requestManager.<Integer>runWrite(_function_1);
_runWrite.join();
int _get = this.sharedState.get();
Assert.assertEquals(2, _get);
Assert.assertEquals(2, this.sharedState.get());
}
@Test(timeout = 1000)

View file

@ -42,8 +42,7 @@ public class ExecutorServiceProvider implements Provider<ExecutorService>, IDisp
public ExecutorService get(final String key) {
ExecutorService result = this.instanceCache.get(key);
if ((result == null)) {
ExecutorService _createInstance = this.createInstance(key);
result = _createInstance;
result = this.createInstance(key);
this.instanceCache.put(key, result);
}
return result;

View file

@ -192,8 +192,7 @@ public abstract class AbstractIdeTemplateProposalProvider {
protected ContentAssistEntry createProposal(final StringConcatenationClient template, final ContentAssistContext context, final boolean adaptIndentation) {
final ContentAssistEntry entry = new ContentAssistEntry();
String _prefix = context.getPrefix();
entry.setPrefix(_prefix);
entry.setPrefix(context.getPrefix());
String _lineDelimiter = this.getLineDelimiter();
final AbstractIdeTemplateProposalProvider.TemplateStringConcatenation stringConcat = new AbstractIdeTemplateProposalProvider.TemplateStringConcatenation(context, entry, _lineDelimiter);
String _xifexpression = null;
@ -208,8 +207,7 @@ public abstract class AbstractIdeTemplateProposalProvider {
} else {
stringConcat.append(template, indentation);
}
String _string = stringConcat.toString();
entry.setProposal(_string);
entry.setProposal(stringConcat.toString());
return entry;
}

View file

@ -34,8 +34,7 @@ public class IdeContentProposalCreator {
* Returns an entry with the given proposal and the prefix from the context, or null if the proposal is not valid.
*/
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context) {
String _prefix = context.getPrefix();
return this.createProposal(proposal, _prefix, context, ContentAssistEntry.KIND_UNKNOWN, null);
return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, null);
}
/**
@ -43,8 +42,7 @@ public class IdeContentProposalCreator {
* If it is valid, the initializer function is applied to it.
*/
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context, final Procedure1<? super ContentAssistEntry> init) {
String _prefix = context.getPrefix();
return this.createProposal(proposal, _prefix, context, ContentAssistEntry.KIND_UNKNOWN, init);
return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, init);
}
/**
@ -52,8 +50,7 @@ public class IdeContentProposalCreator {
* If it is valid, the initializer function is applied to it.
*/
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context, final String kind, final Procedure1<? super ContentAssistEntry> init) {
String _prefix = context.getPrefix();
return this.createProposal(proposal, _prefix, context, kind, init);
return this.createProposal(proposal, context.getPrefix(), context, kind, init);
}
/**

View file

@ -143,8 +143,7 @@ public class IdeContentProposalProvider {
_editPositions_1.add(_textRegion_1);
it.setKind(ContentAssistEntry.KIND_VALUE);
}
String _name_2 = rule.getName();
it.setDescription(_name_2);
it.setDescription(rule.getName());
};
final ContentAssistEntry entry = this.proposalCreator.createProposal(proposal, context, _function);
int _defaultPriority = this.proposalPriorities.getDefaultPriority(entry);

View file

@ -90,20 +90,14 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
if (hierarchyType != null) {
switch (hierarchyType) {
case CALLEE:
IEObjectDescription _element = parent.getElement();
URI _eObjectURI = _element.getEObjectURI();
this.findTargetDeclarations(_eObjectURI, monitor, acceptor);
this.findTargetDeclarations(parent.getElement().getEObjectURI(), monitor, acceptor);
break;
default:
IEObjectDescription _element_1 = parent.getElement();
URI _eObjectURI_1 = _element_1.getEObjectURI();
this.findSourceDeclarations(_eObjectURI_1, monitor, acceptor);
this.findSourceDeclarations(parent.getElement().getEObjectURI(), monitor, acceptor);
break;
}
} else {
IEObjectDescription _element_1 = parent.getElement();
URI _eObjectURI_1 = _element_1.getEObjectURI();
this.findSourceDeclarations(_eObjectURI_1, monitor, acceptor);
this.findSourceDeclarations(parent.getElement().getEObjectURI(), monitor, acceptor);
}
}
@ -219,8 +213,7 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
URI _eObjectURI = declaration.getEObjectURI();
IHierarchyNode childNode = children.get(_eObjectURI);
if ((childNode == null)) {
IHierarchyNode _createChild = this.createChild(declaration, parent);
childNode = _createChild;
childNode = this.createChild(declaration, parent);
URI _eObjectURI_1 = declaration.getEObjectURI();
children.put(_eObjectURI_1, childNode);
}
@ -239,7 +232,7 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
final String text = this.getText(sourceObject, textRegion);
return new DefaultHierarchyNodeReference(text, textRegion, reference);
};
return this.<DefaultHierarchyNodeReference>readOnly(_sourceEObjectUri, _function);
return this.<DefaultHierarchyNodeReference>readOnly(reference.getSourceEObjectUri(), _function);
}
protected ITextRegionWithLineInformation getTextRegion(final EObject obj, final EReference reference, final int indexInList) {

View file

@ -55,9 +55,7 @@ public class DefaultHierarchyNode implements IHierarchyNode {
@Override
public boolean isRecursive() {
if ((this.recursive == null)) {
boolean _internalIsRecursive = this.internalIsRecursive();
Wrapper<Boolean> _wrap = Wrapper.<Boolean>wrap(Boolean.valueOf(_internalIsRecursive));
this.recursive = _wrap;
this.recursive = Wrapper.<Boolean>wrap(Boolean.valueOf(this.internalIsRecursive()));
}
return (this.recursive.get()).booleanValue();
}
@ -73,8 +71,7 @@ public class DefaultHierarchyNode implements IHierarchyNode {
if (_equals) {
return true;
}
IHierarchyNode _parent = node.getParent();
node = _parent;
node = node.getParent();
}
}
return false;

View file

@ -27,14 +27,11 @@ public abstract class TokenTypeToStringMapper {
@Inject
public void setTokenDefProvider(@Named(LexerIdeBindings.HIGHLIGHTING) final ITokenDefProvider tokenDefProvider) {
Map<Integer, String> _tokenDefMap = tokenDefProvider.getTokenDefMap();
this.initIds(_tokenDefMap);
this.initIds(tokenDefProvider.getTokenDefMap());
}
protected void initIds(final Map<Integer, String> tokenDefMap) {
int _size = tokenDefMap.size();
String[] _newArrayOfSize = new String[_size];
this.mappedValues = _newArrayOfSize;
this.mappedValues = new String[tokenDefMap.size()];
Set<Map.Entry<Integer, String>> _entrySet = tokenDefMap.entrySet();
for (final Map.Entry<Integer, String> entry : _entrySet) {
Integer _key = entry.getKey();
@ -42,9 +39,7 @@ public abstract class TokenTypeToStringMapper {
if (_greaterEqualsThan) {
Integer _key_1 = entry.getKey();
int _minus = ((_key_1).intValue() - Token.MIN_TOKEN_TYPE);
String _value = entry.getValue();
Integer _key_2 = entry.getKey();
String _calculateId = this.calculateId(_value, (_key_2).intValue());
String _calculateId = this.calculateId(entry.getValue(), (entry.getKey()).intValue());
this.mappedValues[_minus] = _calculateId;
}
}

View file

@ -20,8 +20,7 @@ public class AlternativeImageDescription implements IImageDescription {
private final List<String> imageIDs;
public AlternativeImageDescription(final Iterable<String> imageIDs) {
ImmutableList<String> _copyOf = ImmutableList.<String>copyOf(imageIDs);
this.imageIDs = _copyOf;
this.imageIDs = ImmutableList.<String>copyOf(imageIDs);
}
@Override

View file

@ -23,8 +23,7 @@ public class DecoratedImageDescription implements IImageDescription {
public DecoratedImageDescription(final IImageDescription baseImage, final IImageDescription... decorators) {
this.baseImage = baseImage;
ImmutableList<IImageDescription> _copyOf = ImmutableList.<IImageDescription>copyOf(decorators);
this.decorators = _copyOf;
this.decorators = ImmutableList.<IImageDescription>copyOf(decorators);
}
@Override

View file

@ -19,8 +19,7 @@ public class DefaultProjectDescriptionFactory implements IProjectDescriptionFact
public ProjectDescription getProjectDescription(final IProjectConfig config) {
ProjectDescription _projectDescription = new ProjectDescription();
final Procedure1<ProjectDescription> _function = (ProjectDescription it) -> {
String _name = config.getName();
it.setName(_name);
it.setName(config.getName());
};
return ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription, _function);
}

View file

@ -47,9 +47,7 @@ public class MultiProjectWorkspaceConfigFactory implements IWorkspaceConfigFacto
};
Iterable<File> _filter = IterableExtensions.<File>filter(((Iterable<File>)Conversions.doWrapArray(_listFiles)), _function_1);
final Consumer<File> _function_2 = (File it) -> {
String _absolutePath = it.getAbsolutePath();
URI _createFileURI = URI.createFileURI(_absolutePath);
this.addProjectConfigs(_createFileURI, result, acceptor);
this.addProjectConfigs(URI.createFileURI(it.getAbsolutePath()), result, acceptor);
};
_filter.forEach(_function_2);
return result;

View file

@ -88,8 +88,7 @@ public class ProjectManager {
public void initialize(final ProjectDescription description, final IProjectConfig projectConfig, final Procedure2<? super URI, ? super Iterable<Issue>> acceptor, final IExternalContentSupport.IExternalContentProvider openedDocumentsContentProvider, final Provider<Map<String, ResourceDescriptionsData>> indexProvider, final CancelIndicator cancelIndicator) {
this.projectDescription = description;
this.projectConfig = projectConfig;
URI _path = projectConfig.getPath();
this.baseDir = _path;
this.baseDir = projectConfig.getPath();
this.issueAcceptor = acceptor;
this.openedDocumentsContentProvider = openedDocumentsContentProvider;
this.indexProvider = indexProvider;
@ -106,8 +105,7 @@ public class ProjectManager {
this.fileSystemScanner.scan(_path, _function_1);
};
_sourceFolders.forEach(_function);
List<URI> _emptyList = CollectionLiterals.<URI>emptyList();
return this.doBuild(uris, _emptyList, cancelIndicator);
return this.doBuild(uris, CollectionLiterals.<URI>emptyList(), cancelIndicator);
}
public IncrementalBuilder.Result doBuild(final List<URI> dirtyFiles, final List<URI> deletedFiles, final CancelIndicator cancelIndicator) {
@ -116,10 +114,8 @@ public class ProjectManager {
return this.languagesRegistry.getResourceServiceProvider(it);
};
final IncrementalBuilder.Result result = this.incrementalBuilder.build(request, _function);
IndexState _indexState = result.getIndexState();
this.indexState = _indexState;
XtextResourceSet _resourceSet = request.getResourceSet();
this.resourceSet = _resourceSet;
this.indexState = result.getIndexState();
this.resourceSet = request.getResourceSet();
Map<String, ResourceDescriptionsData> _get = this.indexProvider.get();
String _name = this.projectDescription.getName();
ResourceDescriptionsData _resourceDescriptions = this.indexState.getResourceDescriptions();
@ -137,10 +133,7 @@ public class ProjectManager {
Source2GeneratedMapping _copy_1 = _fileMappings.copy();
IndexState _indexState = new IndexState(_copy, _copy_1);
it.setState(_indexState);
IndexState _state = it.getState();
ResourceDescriptionsData _resourceDescriptions_1 = _state.getResourceDescriptions();
XtextResourceSet _createFreshResourceSet = this.createFreshResourceSet(_resourceDescriptions_1);
it.setResourceSet(_createFreshResourceSet);
it.setResourceSet(this.createFreshResourceSet(it.getState().getResourceDescriptions()));
it.setDirtyFiles(changedFiles);
it.setDeletedFiles(deletedFiles);
final BuildRequest.IPostValidationCallback _function_1 = (URI uri, Iterable<Issue> issues) -> {

View file

@ -38,11 +38,9 @@ public class ServerLauncher {
private static boolean IS_DEBUG = false;
public static void main(final String[] args) {
final Function1<String, Boolean> _function = (String it) -> {
ServerLauncher.IS_DEBUG = IterableExtensions.<String>exists(((Iterable<String>)Conversions.doWrapArray(args)), ((Function1<String, Boolean>) (String it) -> {
return Boolean.valueOf(Objects.equal(it, "debug"));
};
boolean _exists = IterableExtensions.<String>exists(((Iterable<String>)Conversions.doWrapArray(args)), _function);
ServerLauncher.IS_DEBUG = _exists;
}));
final InputStream stdin = System.in;
final PrintStream stdout = System.out;
ServerLauncher.redirectStandardStreams();

View file

@ -59,22 +59,17 @@ public class TopologicalSorter {
cyclicAcceptor.apply(t);
}
};
final Function1<ProjectDescription, TopologicalSorter.Entry> _function = (ProjectDescription it) -> {
this.name2entry = IterableExtensions.<String, TopologicalSorter.Entry>toMap(IterableExtensions.<ProjectDescription, TopologicalSorter.Entry>map(descriptions, ((Function1<ProjectDescription, TopologicalSorter.Entry>) (ProjectDescription it) -> {
return new TopologicalSorter.Entry(it);
};
Iterable<TopologicalSorter.Entry> _map = IterableExtensions.<ProjectDescription, TopologicalSorter.Entry>map(descriptions, _function);
final Function1<TopologicalSorter.Entry, String> _function_1 = (TopologicalSorter.Entry it) -> {
})), ((Function1<TopologicalSorter.Entry, String>) (TopologicalSorter.Entry it) -> {
return it.description.getName();
};
Map<String, TopologicalSorter.Entry> _map_1 = IterableExtensions.<String, TopologicalSorter.Entry>toMap(_map, _function_1);
this.name2entry = _map_1;
LinkedHashSet<ProjectDescription> _newLinkedHashSet = CollectionLiterals.<ProjectDescription>newLinkedHashSet();
this.result = _newLinkedHashSet;
}));
this.result = CollectionLiterals.<ProjectDescription>newLinkedHashSet();
Collection<TopologicalSorter.Entry> _values = this.name2entry.values();
final Consumer<TopologicalSorter.Entry> _function_2 = (TopologicalSorter.Entry it) -> {
final Consumer<TopologicalSorter.Entry> _function = (TopologicalSorter.Entry it) -> {
this.visit(it);
};
_values.forEach(_function_2);
_values.forEach(_function);
_xblockexpression = IterableExtensions.<ProjectDescription>toList(this.result);
}
return _xblockexpression;

View file

@ -41,8 +41,7 @@ public class InMemoryURIHandler implements URIHandler {
return new ByteArrayOutputStream() {
@Override
public void close() throws IOException {
byte[] _byteArray = this.toByteArray();
InMemFile.this.contents = _byteArray;
InMemFile.this.contents = this.toByteArray();
InMemFile.this.exists = true;
}
};

View file

@ -13,7 +13,6 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtend2.lib.StringConcatenation;
@ -27,7 +26,6 @@ import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.GrammarUtil;
import org.eclipse.xtext.Group;
import org.eclipse.xtext.ReferencedMetamodel;
import org.eclipse.xtext.TypeRef;
import org.eclipse.xtext.XtextStandaloneSetup;
import org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup;
import org.eclipse.xtext.linking.langATestLanguage.Main;
@ -72,8 +70,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
final AbstractRule rule = IterableExtensions.<AbstractRule>head(_rules);
final AbstractElement fragmentCall = rule.getAlternatives();
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
String _name = currentType.getName();
Assert.assertEquals("Rule", _name);
Assert.assertEquals("Rule", currentType.getName());
}
@Test
@ -100,8 +97,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
final AbstractRule rule = IterableExtensions.<AbstractRule>head(_rules);
final AbstractElement fragmentCall = rule.getAlternatives();
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
String _name = currentType.getName();
Assert.assertEquals("SubRule", _name);
Assert.assertEquals("SubRule", currentType.getName());
}
@Test
@ -130,8 +126,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
final AbstractRule rule = IterableExtensions.<AbstractRule>head(_rules);
final AbstractElement fragmentCall = rule.getAlternatives();
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
String _name = currentType.getName();
Assert.assertEquals("SubRule", _name);
Assert.assertEquals("SubRule", currentType.getName());
}
@Test
@ -160,8 +155,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
final AbstractRule rule = IterableExtensions.<AbstractRule>head(_rules);
final AbstractElement fragmentCall = rule.getAlternatives();
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
String _name = currentType.getName();
Assert.assertEquals("Rule", _name);
Assert.assertEquals("Rule", currentType.getName());
}
@Test
@ -193,8 +187,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
final AbstractRule rule = IterableExtensions.<AbstractRule>head(_rules);
final AbstractElement fragmentCall = rule.getAlternatives();
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
String _name = currentType.getName();
Assert.assertEquals("Rule", _name);
Assert.assertEquals("Rule", currentType.getName());
}
@Test
@ -228,8 +221,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
EList<AbstractElement> _elements = ((Group) _alternatives).getElements();
final AbstractElement fragmentCall = IterableExtensions.<AbstractElement>last(_elements);
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
String _name = currentType.getName();
Assert.assertEquals("Rule", _name);
Assert.assertEquals("Rule", currentType.getName());
}
@Test
@ -253,13 +245,11 @@ public class GrammarUtilTest extends AbstractXtextTests {
EObject _get = _contents.get(0);
final Grammar grammar = ((Grammar) _get);
final List<AbstractRule> allRules = GrammarUtil.allRules(grammar);
String _string = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Rule", "STRING", "ID", "INT", "STRING", "ML_COMMENT", "SL_COMMENT", "WS", "ANY_OTHER")).toString();
final Function1<AbstractRule, String> _function = (AbstractRule it) -> {
return it.getName();
};
List<String> _map = ListExtensions.<AbstractRule, String>map(allRules, _function);
String _string_1 = _map.toString();
Assert.assertEquals(_string, _string_1);
Assert.assertEquals(
Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Rule", "STRING", "ID", "INT", "STRING", "ML_COMMENT", "SL_COMMENT", "WS", "ANY_OTHER")).toString(),
ListExtensions.<AbstractRule, String>map(allRules, ((Function1<AbstractRule, String>) (AbstractRule it) -> {
return it.getName();
})).toString());
}
@Test
@ -282,24 +272,11 @@ public class GrammarUtilTest extends AbstractXtextTests {
EList<EObject> _contents = r.getContents();
EObject _get = _contents.get(0);
Grammar grammar = ((Grammar) _get);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Rule");
EObject _eContainer = _findRuleForName.eContainer();
Assert.assertEquals(grammar, _eContainer);
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.Rule");
Assert.assertNull(_findRuleForName_1);
EList<Grammar> _usedGrammars = grammar.getUsedGrammars();
Grammar _head = IterableExtensions.<Grammar>head(_usedGrammars);
AbstractRule _findRuleForName_2 = GrammarUtil.findRuleForName(grammar, "ID");
EObject _eContainer_1 = _findRuleForName_2.eContainer();
Assert.assertEquals(_head, _eContainer_1);
AbstractRule _findRuleForName_3 = GrammarUtil.findRuleForName(grammar, "STRING");
EObject _eContainer_2 = _findRuleForName_3.eContainer();
Assert.assertEquals(grammar, _eContainer_2);
EList<Grammar> _usedGrammars_1 = grammar.getUsedGrammars();
Grammar _head_1 = IterableExtensions.<Grammar>head(_usedGrammars_1);
AbstractRule _findRuleForName_4 = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.STRING");
EObject _eContainer_3 = _findRuleForName_4.eContainer();
Assert.assertEquals(_head_1, _eContainer_3);
Assert.assertEquals(grammar, GrammarUtil.findRuleForName(grammar, "Rule").eContainer());
Assert.assertNull(GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.Rule"));
Assert.assertEquals(IterableExtensions.<Grammar>head(grammar.getUsedGrammars()), GrammarUtil.findRuleForName(grammar, "ID").eContainer());
Assert.assertEquals(grammar, GrammarUtil.findRuleForName(grammar, "STRING").eContainer());
Assert.assertEquals(IterableExtensions.<Grammar>head(grammar.getUsedGrammars()), GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.STRING").eContainer());
}
@Test
@ -320,26 +297,16 @@ public class GrammarUtilTest extends AbstractXtextTests {
EObject _get = _contents.get(0);
Grammar g = ((Grammar) _get);
List<AbstractMetamodelDeclaration> decls = GrammarUtil.allMetamodelDeclarations(g);
int _size = decls.size();
Assert.assertEquals(2, _size);
Assert.assertEquals(2, decls.size());
AbstractMetamodelDeclaration decl = decls.get(0);
Assert.assertTrue((decl instanceof ReferencedMetamodel));
EPackage _ePackage = decl.getEPackage();
Assert.assertNotNull(_ePackage);
EPackage _ePackage_1 = decl.getEPackage();
String _nsURI = _ePackage_1.getNsURI();
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", _nsURI);
String _alias = decl.getAlias();
Assert.assertEquals("ecore", _alias);
AbstractMetamodelDeclaration _get_1 = decls.get(1);
decl = _get_1;
String _alias_1 = decl.getAlias();
Assert.assertEquals("ecore", _alias_1);
EPackage _ePackage_2 = decl.getEPackage();
Assert.assertNotNull(_ePackage_2);
EPackage _ePackage_3 = decl.getEPackage();
String _nsURI_1 = _ePackage_3.getNsURI();
Assert.assertEquals("http://3", _nsURI_1);
Assert.assertNotNull(decl.getEPackage());
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", decl.getEPackage().getNsURI());
Assert.assertEquals("ecore", decl.getAlias());
decl = decls.get(1);
Assert.assertEquals("ecore", decl.getAlias());
Assert.assertNotNull(decl.getEPackage());
Assert.assertEquals("http://3", decl.getEPackage().getNsURI());
}
@Test
@ -360,42 +327,24 @@ public class GrammarUtilTest extends AbstractXtextTests {
EObject _get = _contents.get(0);
Grammar g = ((Grammar) _get);
List<AbstractMetamodelDeclaration> decls = GrammarUtil.allMetamodelDeclarations(g);
int _size = decls.size();
Assert.assertEquals(3, _size);
Assert.assertEquals(3, decls.size());
AbstractMetamodelDeclaration decl = decls.get(0);
Assert.assertTrue((decl instanceof ReferencedMetamodel));
EPackage _ePackage = decl.getEPackage();
Assert.assertNotNull(_ePackage);
EPackage _ePackage_1 = decl.getEPackage();
String _nsURI = _ePackage_1.getNsURI();
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", _nsURI);
String _alias = decl.getAlias();
Assert.assertEquals("bar", _alias);
AbstractMetamodelDeclaration _get_1 = decls.get(1);
decl = _get_1;
String _alias_1 = decl.getAlias();
Assert.assertEquals("bar", _alias_1);
EPackage _ePackage_2 = decl.getEPackage();
Assert.assertNotNull(_ePackage_2);
EPackage _ePackage_3 = decl.getEPackage();
String _nsURI_1 = _ePackage_3.getNsURI();
Assert.assertEquals("http://3", _nsURI_1);
AbstractMetamodelDeclaration _get_2 = decls.get(2);
decl = _get_2;
Assert.assertNotNull(decl.getEPackage());
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", decl.getEPackage().getNsURI());
Assert.assertEquals("bar", decl.getAlias());
decl = decls.get(1);
Assert.assertEquals("bar", decl.getAlias());
Assert.assertNotNull(decl.getEPackage());
Assert.assertEquals("http://3", decl.getEPackage().getNsURI());
decl = decls.get(2);
Assert.assertTrue((decl instanceof ReferencedMetamodel));
EPackage _ePackage_4 = decl.getEPackage();
Assert.assertNotNull(_ePackage_4);
EPackage _ePackage_5 = decl.getEPackage();
String _nsURI_2 = _ePackage_5.getNsURI();
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", _nsURI_2);
String _alias_2 = decl.getAlias();
Assert.assertEquals("ecore", _alias_2);
Assert.assertNotNull(decl.getEPackage());
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", decl.getEPackage().getNsURI());
Assert.assertEquals("ecore", decl.getAlias());
EList<AbstractRule> _rules = g.getRules();
AbstractRule abstractRule = _rules.get(0);
AbstractMetamodelDeclaration _get_3 = decls.get(1);
TypeRef _type = abstractRule.getType();
AbstractMetamodelDeclaration _metamodel = _type.getMetamodel();
Assert.assertSame(_get_3, _metamodel);
Assert.assertSame(decls.get(1), abstractRule.getType().getMetamodel());
}
@Test
@ -416,43 +365,25 @@ public class GrammarUtilTest extends AbstractXtextTests {
EObject _get = _contents.get(0);
Grammar g = ((Grammar) _get);
List<AbstractMetamodelDeclaration> decls = GrammarUtil.allMetamodelDeclarations(g);
int _size = decls.size();
Assert.assertEquals(3, _size);
Assert.assertEquals(3, decls.size());
AbstractMetamodelDeclaration decl = decls.get(0);
Assert.assertTrue((decl instanceof GeneratedMetamodel));
String _alias = decl.getAlias();
Assert.assertEquals("bar", _alias);
EPackage _ePackage = decl.getEPackage();
Assert.assertNotNull(_ePackage);
EPackage _ePackage_1 = decl.getEPackage();
String _nsURI = _ePackage_1.getNsURI();
Assert.assertEquals("http://3", _nsURI);
AbstractMetamodelDeclaration _get_1 = decls.get(1);
decl = _get_1;
Assert.assertEquals("bar", decl.getAlias());
Assert.assertNotNull(decl.getEPackage());
Assert.assertEquals("http://3", decl.getEPackage().getNsURI());
decl = decls.get(1);
Assert.assertTrue((decl instanceof ReferencedMetamodel));
EPackage _ePackage_2 = decl.getEPackage();
Assert.assertNotNull(_ePackage_2);
EPackage _ePackage_3 = decl.getEPackage();
String _nsURI_1 = _ePackage_3.getNsURI();
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", _nsURI_1);
String _alias_1 = decl.getAlias();
Assert.assertEquals("bar", _alias_1);
AbstractMetamodelDeclaration _get_2 = decls.get(2);
decl = _get_2;
Assert.assertNotNull(decl.getEPackage());
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", decl.getEPackage().getNsURI());
Assert.assertEquals("bar", decl.getAlias());
decl = decls.get(2);
Assert.assertTrue((decl instanceof ReferencedMetamodel));
EPackage _ePackage_4 = decl.getEPackage();
Assert.assertNotNull(_ePackage_4);
EPackage _ePackage_5 = decl.getEPackage();
String _nsURI_2 = _ePackage_5.getNsURI();
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", _nsURI_2);
String _alias_2 = decl.getAlias();
Assert.assertEquals("ecore", _alias_2);
Assert.assertNotNull(decl.getEPackage());
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", decl.getEPackage().getNsURI());
Assert.assertEquals("ecore", decl.getAlias());
EList<AbstractRule> _rules = g.getRules();
AbstractRule abstractRule = _rules.get(0);
AbstractMetamodelDeclaration _get_3 = decls.get(0);
TypeRef _type = abstractRule.getType();
AbstractMetamodelDeclaration _metamodel = _type.getMetamodel();
Assert.assertSame(_get_3, _metamodel);
Assert.assertSame(decls.get(0), abstractRule.getType().getMetamodel());
}
@Test
@ -471,12 +402,8 @@ public class GrammarUtilTest extends AbstractXtextTests {
EClass _eClass = typeA.eClass();
EReference ref = GrammarUtil.getReference(xref, _eClass);
Assert.assertNotNull(ref);
String _name = ref.getName();
Assert.assertEquals("extends", _name);
boolean _isMany = ref.isMany();
Assert.assertFalse(_isMany);
EClass _eClass_1 = typeA.eClass();
EClass _eReferenceType = ref.getEReferenceType();
Assert.assertEquals(_eClass_1, _eReferenceType);
Assert.assertEquals("extends", ref.getName());
Assert.assertFalse(ref.isMany());
Assert.assertEquals(typeA.eClass(), ref.getEReferenceType());
}
}

View file

@ -73,8 +73,7 @@ public class URIBasedFileSystemAccessTest {
_file_1.deleteOnExit();
Set<OutputConfiguration> _outputConfigurations = this.configProvider.getOutputConfigurations();
final OutputConfiguration config = IterableExtensions.<OutputConfiguration>head(_outputConfigurations);
String _string = output.toString();
config.setOutputDirectory(_string);
config.setOutputDirectory(output.toString());
Pair<String, OutputConfiguration> _mappedTo = Pair.<String, OutputConfiguration>of(IFileSystemAccess.DEFAULT_OUTPUT, config);
this.fsa.setOutputConfigurations(Collections.<String, OutputConfiguration>unmodifiableMap(CollectionLiterals.<String, OutputConfiguration>newHashMap(_mappedTo)));
this.fsa.setConverter(this.uriConverter);
@ -85,13 +84,11 @@ public class URIBasedFileSystemAccessTest {
@Test
public void testFalseOnAbsent() {
boolean _isFile = this.fsa.isFile(URIBasedFileSystemAccessTest.MISSING_RESOURCE_NAME);
Assert.assertFalse(_isFile);
Assert.assertFalse(this.fsa.isFile(URIBasedFileSystemAccessTest.MISSING_RESOURCE_NAME));
}
@Test
public void testTrueOnPresent() {
boolean _isFile = this.fsa.isFile(URIBasedFileSystemAccessTest.EXISTING_RESOURCE_NAME);
Assert.assertTrue(_isFile);
Assert.assertTrue(this.fsa.isFile(URIBasedFileSystemAccessTest.EXISTING_RESOURCE_NAME));
}
}

View file

@ -11,7 +11,6 @@ import com.google.inject.Inject;
import com.google.inject.Provider;
import java.util.List;
import java.util.function.Consumer;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.TerminalRule;
import org.eclipse.xtext.formatting2.FormatterRequest;
@ -23,7 +22,6 @@ import org.eclipse.xtext.formatting2.internal.services.FormatterTestLanguageGram
import org.eclipse.xtext.formatting2.internal.tests.FormatterTestLanguageInjectorProvider;
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion;
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder;
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess;
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionExtensions;
import org.eclipse.xtext.formatting2.regionaccess.ITextReplacement;
import org.eclipse.xtext.formatting2.regionaccess.TextRegionAccessBuilder;
@ -84,10 +82,7 @@ public class FormatterReplacementsTest {
final IDList parsed = this.parseHelper.parse("idlist aaa bbb");
final FormatterRequest request = this.requestProvider.get();
request.setAllowIdentityEdits(false);
Resource _eResource = parsed.eResource();
TextRegionAccessBuilder _forNodeModel = this.regionBuilder.forNodeModel(((XtextResource) _eResource));
ITextRegionAccess _create = _forNodeModel.create();
request.setTextRegionAccess(_create);
request.setTextRegionAccess(this.regionBuilder.forNodeModel(((XtextResource) parsed.eResource())).create());
final List<ITextReplacement> replacements = formatter.format(request);
final Function1<ITextReplacement, String> _function_1 = (ITextReplacement it) -> {
StringConcatenation _builder = new StringConcatenation();

View file

@ -11,9 +11,7 @@ import java.util.Arrays;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.formatting2.AbstractFormatter2;
import org.eclipse.xtext.formatting2.FormatterRequest;
import org.eclipse.xtext.formatting2.IFormattableDocument;
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess;
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionExtensions;
import org.eclipse.xtext.resource.XtextResource;
@ -25,10 +23,7 @@ import org.eclipse.xtext.resource.XtextResource;
public abstract class GenericFormatter<T extends EObject> extends AbstractFormatter2 {
@Override
protected void _format(final EObject obj, final IFormattableDocument document) {
FormatterRequest _request = this.getRequest();
ITextRegionAccess _textRegionAccess = _request.getTextRegionAccess();
ITextRegionExtensions _extensions = _textRegionAccess.getExtensions();
this.format(((T) obj), _extensions, document);
this.format(((T) obj), this.getRequest().getTextRegionAccess().getExtensions(), document);
}
protected abstract void format(final T model, final ITextRegionExtensions regionAccess, final IFormattableDocument document);

View file

@ -40,9 +40,7 @@ public class RegionSetTest {
throw Exceptions.sneakyThrow(_t);
}
}
String _string = expectation.toString();
String _string_1 = set.toString();
Assert.assertEquals(_string, _string_1);
Assert.assertEquals(expectation.toString(), set.toString());
}
@Test

View file

@ -492,13 +492,9 @@ public class SemanticRegionFinderTest {
}
private void assertEquals(final String expected, final ITextSegment single, final Collection<? extends ITextSegment> regions) {
String _text = single.getText();
Assert.assertEquals(expected, _text);
int _size = regions.size();
Assert.assertEquals(1, _size);
ITextSegment _head = IterableExtensions.head(regions);
String _text_1 = _head.getText();
Assert.assertEquals(expected, _text_1);
Assert.assertEquals(expected, single.getText());
Assert.assertEquals(1, regions.size());
Assert.assertEquals(expected, IterableExtensions.head(regions).getText());
Assert.assertTrue((regions instanceof ImmutableList<?>));
}
}

View file

@ -17,14 +17,12 @@ public class TraceFileNameProviderTest {
@Test
public void testTraceFileNameOnWindows() {
boolean _isTraceFileName = this.nameProvider.isTraceFileName("C:\\workspace\\.Foo.java._trace");
Assert.assertTrue(_isTraceFileName);
Assert.assertTrue(this.nameProvider.isTraceFileName("C:\\workspace\\.Foo.java._trace"));
}
@Test
public void testTraceFileNameOnUnix() {
boolean _isTraceFileName = this.nameProvider.isTraceFileName("/workspace/.Foo.java._trace");
Assert.assertTrue(_isTraceFileName);
Assert.assertTrue(this.nameProvider.isTraceFileName("/workspace/.Foo.java._trace"));
}
@Test

View file

@ -129,41 +129,24 @@ public class TraceRegionMergerTest {
TraceRegionMergerTest.AssertBuilder _xblockexpression = null;
{
final AbstractTraceRegion head = this.regions.poll();
String _string = head.toString();
int _myOffset = head.getMyOffset();
Assert.assertEquals(_string, offset, _myOffset);
String _string_1 = head.toString();
int _myLength = head.getMyLength();
Assert.assertEquals(_string_1, length, _myLength);
String _string_2 = head.toString();
int _myLineNumber = head.getMyLineNumber();
Assert.assertEquals(_string_2, startLine, _myLineNumber);
String _string_3 = head.toString();
int _myEndLineNumber = head.getMyEndLineNumber();
Assert.assertEquals(_string_3, endLine, _myEndLineNumber);
Assert.assertEquals(head.toString(), offset, head.getMyOffset());
Assert.assertEquals(head.toString(), length, head.getMyLength());
Assert.assertEquals(head.toString(), startLine, head.getMyLineNumber());
Assert.assertEquals(head.toString(), endLine, head.getMyEndLineNumber());
List<ILocationData> _associatedLocations = head.getAssociatedLocations();
final Function1<ILocationData, SourceRelativeURI> _function = (ILocationData it) -> {
return it.getSrcRelativePath();
};
List<SourceRelativeURI> _map = ListExtensions.<ILocationData, SourceRelativeURI>map(_associatedLocations, _function);
final Set<SourceRelativeURI> associatedLocations = IterableExtensions.<SourceRelativeURI>toSet(_map);
String _string_4 = head.toString();
int _length = ((Object[])Conversions.unwrapArray(uris, Object.class)).length;
int _length_1 = ((Object[])Conversions.unwrapArray(associatedLocations, Object.class)).length;
Assert.assertEquals(_string_4, _length, _length_1);
Assert.assertEquals(head.toString(), ((Object[])Conversions.unwrapArray(uris, Object.class)).length, ((Object[])Conversions.unwrapArray(associatedLocations, Object.class)).length);
for (final String uri : uris) {
URI _createURI = URI.createURI(uri);
SourceRelativeURI _sourceRelativeURI = new SourceRelativeURI(_createURI);
boolean _contains = associatedLocations.contains(_sourceRelativeURI);
Assert.assertTrue(("Missing " + uri), _contains);
Assert.assertTrue(("Missing " + uri), associatedLocations.contains(new SourceRelativeURI(URI.createURI(uri))));
}
if ((init == null)) {
List<AbstractTraceRegion> _nestedRegions = head.getNestedRegions();
boolean _isEmpty = _nestedRegions.isEmpty();
Assert.assertTrue(_isEmpty);
Assert.assertTrue(head.getNestedRegions().isEmpty());
} else {
List<AbstractTraceRegion> _nestedRegions_1 = head.getNestedRegions();
LinkedList<AbstractTraceRegion> _newLinkedList = CollectionLiterals.<AbstractTraceRegion>newLinkedList(((AbstractTraceRegion[])Conversions.unwrapArray(_nestedRegions_1, AbstractTraceRegion.class)));
LinkedList<AbstractTraceRegion> _newLinkedList = CollectionLiterals.<AbstractTraceRegion>newLinkedList(((AbstractTraceRegion[])Conversions.unwrapArray(head.getNestedRegions(), AbstractTraceRegion.class)));
final TraceRegionMergerTest.AssertBuilder child = new TraceRegionMergerTest.AssertBuilder(this.testBuilder, _newLinkedList);
init.apply(child);
child.thatsIt();
@ -174,9 +157,7 @@ public class TraceRegionMergerTest {
}
public void thatsIt() {
String _string = this.regions.toString();
boolean _isEmpty = this.regions.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.regions.toString(), this.regions.isEmpty());
}
public AssertBuilder(final TraceRegionMergerTest.TestBuilder testBuilder, final Queue<AbstractTraceRegion> regions) {

View file

@ -31,12 +31,9 @@ public class IndexTestLanguageInjectorProvider implements IInjectorProvider, IRe
@Override
public Injector getInjector() {
if ((this.injector == null)) {
GlobalRegistries.GlobalStateMemento _makeCopyOfGlobalState = GlobalRegistries.makeCopyOfGlobalState();
this.stateBeforeInjectorCreation = _makeCopyOfGlobalState;
Injector _internalCreateInjector = this.internalCreateInjector();
this.injector = _internalCreateInjector;
GlobalRegistries.GlobalStateMemento _makeCopyOfGlobalState_1 = GlobalRegistries.makeCopyOfGlobalState();
this.stateAfterInjectorCreation = _makeCopyOfGlobalState_1;
this.stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
this.injector = this.internalCreateInjector();
this.stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
}
return this.injector;
}

View file

@ -7,7 +7,6 @@
*/
package org.eclipse.xtext.parser;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtend2.lib.StringConcatenation;
@ -46,8 +45,7 @@ public class Bug410560Test extends AbstractXtextTests {
EObject _model = this.getModel(_builder.toString());
final Model model = ((Model) _model);
Assert.assertNotNull(model);
org.eclipse.xtext.parsetree.reconstr.serializationerror.Test _test = model.getTest();
Assert.assertNull(_test);
Assert.assertNull(model.getTest());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -62,8 +60,7 @@ public class Bug410560Test extends AbstractXtextTests {
EObject _model = this.getModel(_builder.toString());
final Model model = ((Model) _model);
Assert.assertNotNull(model);
org.eclipse.xtext.parsetree.reconstr.serializationerror.Test _test = model.getTest();
Assert.assertNull(_test);
Assert.assertNull(model.getTest());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -78,8 +75,7 @@ public class Bug410560Test extends AbstractXtextTests {
EObject _model = this.getModel(_builder.toString());
final Model model = ((Model) _model);
Assert.assertNotNull(model);
org.eclipse.xtext.parsetree.reconstr.serializationerror.Test _test = model.getTest();
Assert.assertNotNull(_test);
Assert.assertNotNull(model.getTest());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -94,8 +90,7 @@ public class Bug410560Test extends AbstractXtextTests {
EObject _model = this.getModel(_builder.toString());
final Model model = ((Model) _model);
Assert.assertNotNull(model);
org.eclipse.xtext.parsetree.reconstr.serializationerror.Test _test = model.getTest();
Assert.assertNotNull(_test);
Assert.assertNotNull(model.getTest());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -111,9 +106,7 @@ public class Bug410560Test extends AbstractXtextTests {
final XtextResource res = ((XtextResource) _eResource);
int _indexOf = modelAsString.indexOf("a");
res.update(_indexOf, 1, "b");
EList<EObject> _contents = res.getContents();
EObject _head = IterableExtensions.<EObject>head(_contents);
Assert.assertSame(model, _head);
Assert.assertSame(model, IterableExtensions.<EObject>head(res.getContents()));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -130,9 +123,7 @@ public class Bug410560Test extends AbstractXtextTests {
int _indexOf = modelAsString.indexOf("t");
int _length = "tworequired a b".length();
res.update(_indexOf, _length, " ");
EList<EObject> _contents = res.getContents();
EObject _head = IterableExtensions.<EObject>head(_contents);
Assert.assertSame(model, _head);
Assert.assertSame(model, IterableExtensions.<EObject>head(res.getContents()));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -149,9 +140,7 @@ public class Bug410560Test extends AbstractXtextTests {
int _indexOf = modelAsString.indexOf("t");
int _length = "tworequired a b".length();
res.update(_indexOf, _length, " ");
EList<EObject> _contents = res.getContents();
EObject _head = IterableExtensions.<EObject>head(_contents);
Assert.assertSame(model, _head);
Assert.assertSame(model, IterableExtensions.<EObject>head(res.getContents()));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}

View file

@ -55,73 +55,47 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
public void testSimpleModel() {
final ParserRuleFragments fragments = this.parseAndValidate("#1 myName");
Assert.assertNotNull(fragments);
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("myName", _name);
Assert.assertEquals("myName", fragments.getElement().getName());
}
@Test
public void testReference() {
final ParserRuleFragments fragments = this.parseAndValidate("#2 myName -> myName");
Assert.assertNotNull(fragments);
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("myName", _name);
PRFNamed _element_1 = fragments.getElement();
PRFNamed _ref = fragments.getRef();
Assert.assertEquals(_element_1, _ref);
Assert.assertEquals("myName", fragments.getElement().getName());
Assert.assertEquals(fragments.getElement(), fragments.getRef());
}
@Test
public void testReference_02() {
final ParserRuleFragments fragments = this.parseAndValidate("#1 myName : myName");
Assert.assertNotNull(fragments);
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("myName", _name);
PRFNamed _element_1 = fragments.getElement();
PRFNamed _element_2 = fragments.getElement();
PRFNamed _ref = _element_2.getRef();
Assert.assertEquals(_element_1, _ref);
Assert.assertEquals("myName", fragments.getElement().getName());
Assert.assertEquals(fragments.getElement(), fragments.getElement().getRef());
}
@Test
public void testReferenceInFragment() {
final ParserRuleFragments fragments = this.parseAndValidate("#1 myName - myName");
Assert.assertNotNull(fragments);
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("myName", _name);
PRFNamed _element_1 = fragments.getElement();
PRFNamed _element_2 = fragments.getElement();
PRFNamed _ref = _element_2.getRef();
Assert.assertEquals(_element_1, _ref);
Assert.assertEquals("myName", fragments.getElement().getName());
Assert.assertEquals(fragments.getElement(), fragments.getElement().getRef());
}
@Test
public void testReferenceBeforeFragment() {
final ParserRuleFragments fragments = this.parseAndValidate("#3 myName <- myName");
Assert.assertNotNull(fragments);
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("myName", _name);
PRFNamed _element_1 = fragments.getElement();
PRFNamed _element_2 = fragments.getElement();
PRFNamed _ref = _element_2.getRef();
Assert.assertEquals(_element_1, _ref);
Assert.assertEquals("myName", fragments.getElement().getName());
Assert.assertEquals(fragments.getElement(), fragments.getElement().getRef());
}
@Test
public void testAction() {
final ParserRuleFragments fragments = this.parseAndValidate("#4 prev current");
Assert.assertNotNull(fragments);
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("current", _name);
PRFNamed _element_1 = fragments.getElement();
PRFNamed _prev = ((PRFNamedWithAction) _element_1).getPrev();
String _name_1 = _prev.getName();
Assert.assertEquals("prev", _name_1);
Assert.assertEquals("current", fragments.getElement().getName());
Assert.assertEquals("prev", ((PRFNamedWithAction) fragments.getElement()).getPrev().getName());
}
@Test
@ -129,15 +103,11 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
final ParserRuleFragments fragments = this.parseAndValidate("#4 prev current prev current");
Assert.assertNotNull(fragments);
final PRFNamed element = fragments.getElement();
String _name = element.getName();
Assert.assertEquals("current", _name);
Assert.assertEquals("current", element.getName());
final PRFNamed prev = ((PRFNamedWithAction) element).getPrev();
String _name_1 = prev.getName();
Assert.assertEquals("prev", _name_1);
PRFNamed _ref = element.getRef();
Assert.assertEquals(prev, _ref);
PRFNamed _ref2 = ((PRFNamedWithAction) element).getRef2();
Assert.assertEquals(element, _ref2);
Assert.assertEquals("prev", prev.getName());
Assert.assertEquals(prev, element.getRef());
Assert.assertEquals(element, ((PRFNamedWithAction) element).getRef2());
}
@Test
@ -145,13 +115,8 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
public void testActionInFragment_01() {
final ParserRuleFragments fragments = this.parseAndValidate("#5 prev current");
Assert.assertNotNull(fragments);
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("current", _name);
PRFNamed _element_1 = fragments.getElement();
PRFNamed _prev = ((PRFNamedWithAction) _element_1).getPrev();
String _name_1 = _prev.getName();
Assert.assertEquals("prev", _name_1);
Assert.assertEquals("current", fragments.getElement().getName());
Assert.assertEquals("prev", ((PRFNamedWithAction) fragments.getElement()).getPrev().getName());
}
@Test
@ -159,13 +124,8 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
public void testActionInFragment_02() {
final ParserRuleFragments fragments = this.parseAndValidate("#6 prev current");
Assert.assertNotNull(fragments);
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("current", _name);
PRFNamed _element_1 = fragments.getElement();
PRFNamed _prev = ((PRFNamedWithAction) _element_1).getPrev();
String _name_1 = _prev.getName();
Assert.assertEquals("prev", _name_1);
Assert.assertEquals("current", fragments.getElement().getName());
Assert.assertEquals("prev", ((PRFNamedWithAction) fragments.getElement()).getPrev().getName());
}
@Test
@ -174,15 +134,11 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
final ParserRuleFragments fragments = this.parseAndValidate("#5 prev current current - prev");
Assert.assertNotNull(fragments);
final PRFNamed element = fragments.getElement();
String _name = element.getName();
Assert.assertEquals("current", _name);
Assert.assertEquals("current", element.getName());
final PRFNamed prev = ((PRFNamedWithAction) element).getPrev();
String _name_1 = prev.getName();
Assert.assertEquals("prev", _name_1);
PRFNamed _ref = element.getRef();
Assert.assertEquals(prev, _ref);
PRFNamed _ref2 = ((PRFNamedWithAction) element).getRef2();
Assert.assertEquals(element, _ref2);
Assert.assertEquals("prev", prev.getName());
Assert.assertEquals(prev, element.getRef());
Assert.assertEquals(element, ((PRFNamedWithAction) element).getRef2());
}
@Test
@ -191,15 +147,11 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
final ParserRuleFragments fragments = this.parseAndValidate("#6 prev current current - prev");
Assert.assertNotNull(fragments);
final PRFNamed element = fragments.getElement();
String _name = element.getName();
Assert.assertEquals("current", _name);
Assert.assertEquals("current", element.getName());
final PRFNamed prev = ((PRFNamedWithAction) element).getPrev();
String _name_1 = prev.getName();
Assert.assertEquals("prev", _name_1);
PRFNamed _ref = element.getRef();
Assert.assertEquals(prev, _ref);
PRFNamed _ref2 = ((PRFNamedWithAction) element).getRef2();
Assert.assertEquals(element, _ref2);
Assert.assertEquals("prev", prev.getName());
Assert.assertEquals(prev, element.getRef());
Assert.assertEquals(element, ((PRFNamedWithAction) element).getRef2());
}
@Test
@ -210,14 +162,11 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
PRFNamed element = fragments.getElement();
while ((element instanceof PRFNamedWithAction)) {
{
PRFNamed _ref2 = ((PRFNamedWithAction)element).getRef2();
Assert.assertEquals(element, _ref2);
PRFNamed _prev = ((PRFNamedWithAction)element).getPrev();
element = _prev;
Assert.assertEquals(element, ((PRFNamedWithAction)element).getRef2());
element = ((PRFNamedWithAction)element).getPrev();
}
}
PRFNamed _ref = element.getRef();
Assert.assertEquals(element, _ref);
Assert.assertEquals(element, element.getRef());
}
@Test
@ -225,8 +174,7 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
final ParserRuleFragments fragments = this.parseAndValidate("#8 a - a");
Assert.assertNotNull(fragments);
PRFNamed element = fragments.getElement();
PRFNamed _ref = element.getRef();
Assert.assertEquals(element, _ref);
Assert.assertEquals(element, element.getRef());
}
@Test
@ -234,8 +182,7 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
final ParserRuleFragments fragments = this.parseAndValidate("#8 a.b.c.d");
Assert.assertNotNull(fragments);
PRFNamed element = fragments.getElement();
String _name = element.getName();
Assert.assertEquals("a.b.c.d", _name);
Assert.assertEquals("a.b.c.d", element.getName());
}
@Test
@ -243,37 +190,27 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
final ParserRuleFragments fragments = this.parseAndValidate("#8 a.b.c.d - a.b.c.d");
Assert.assertNotNull(fragments);
PRFNamed element = fragments.getElement();
PRFNamed _ref = element.getRef();
Assert.assertEquals(element, _ref);
Assert.assertEquals(element, element.getRef());
}
@Test
public void testFragmentWithPredicate() {
final ParserRuleFragments fragments = this.parseAndValidate("#9 myName - myName");
Assert.assertNotNull(fragments);
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("myName", _name);
PRFNamed _element_1 = fragments.getElement();
PRFNamed _element_2 = fragments.getElement();
PRFNamed _ref = _element_2.getRef();
Assert.assertEquals(_element_1, _ref);
Assert.assertEquals("myName", fragments.getElement().getName());
Assert.assertEquals(fragments.getElement(), fragments.getElement().getRef());
}
@Test
public void testFragmentRecursive_01() {
final ParserRuleFragments fragments = this.parseAndValidate("#10 myName myPrev");
Assert.assertNotNull(fragments);
Assert.assertEquals("myName", fragments.getElement().getName());
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("myName", _name);
PRFNamed _element_1 = fragments.getElement();
final PRFNamed prev = ((PRFNamedWithAction) _element_1).getPrev();
String _name_1 = prev.getName();
Assert.assertEquals("myPrev", _name_1);
final PRFNamed prev = ((PRFNamedWithAction) _element).getPrev();
Assert.assertEquals("myPrev", prev.getName());
final ICompositeNode node = NodeModelUtils.findActualNodeFor(prev);
String _text = node.getText();
Assert.assertEquals(" myPrev", _text);
Assert.assertEquals(" myPrev", node.getText());
final EObject lookup = NodeModelUtils.findActualSemanticObjectFor(node);
Assert.assertSame(prev, lookup);
}
@ -282,16 +219,12 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
public void testFragmentRecursive_02() {
final ParserRuleFragments fragments = this.parseAndValidate("#10 myName ((myPrev))");
Assert.assertNotNull(fragments);
Assert.assertEquals("myName", fragments.getElement().getName());
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("myName", _name);
PRFNamed _element_1 = fragments.getElement();
final PRFNamed prev = ((PRFNamedWithAction) _element_1).getPrev();
String _name_1 = prev.getName();
Assert.assertEquals("myPrev", _name_1);
final PRFNamed prev = ((PRFNamedWithAction) _element).getPrev();
Assert.assertEquals("myPrev", prev.getName());
final ICompositeNode node = NodeModelUtils.findActualNodeFor(prev);
String _text = node.getText();
Assert.assertEquals(" ((myPrev))", _text);
Assert.assertEquals(" ((myPrev))", node.getText());
final EObject lookup = NodeModelUtils.findActualSemanticObjectFor(node);
Assert.assertSame(prev, lookup);
}
@ -300,16 +233,12 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
public void testFragmentRecursive_03() {
final ParserRuleFragments fragments = this.parseAndValidate("#11 myName myPrev");
Assert.assertNotNull(fragments);
Assert.assertEquals("myName", fragments.getElement().getName());
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("myName", _name);
PRFNamed _element_1 = fragments.getElement();
final PRFNamed prev = ((PRFNamedWithAction) _element_1).getPrev();
String _name_1 = prev.getName();
Assert.assertEquals("myPrev", _name_1);
final PRFNamed prev = ((PRFNamedWithAction) _element).getPrev();
Assert.assertEquals("myPrev", prev.getName());
final ICompositeNode node = NodeModelUtils.findActualNodeFor(prev);
String _text = node.getText();
Assert.assertEquals(" myPrev", _text);
Assert.assertEquals(" myPrev", node.getText());
final EObject lookup = NodeModelUtils.findActualSemanticObjectFor(node);
Assert.assertSame(prev, lookup);
}
@ -318,16 +247,12 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
public void testFragmentRecursive_04() {
final ParserRuleFragments fragments = this.parseAndValidate("#11 myName ((myPrev))");
Assert.assertNotNull(fragments);
Assert.assertEquals("myName", fragments.getElement().getName());
PRFNamed _element = fragments.getElement();
String _name = _element.getName();
Assert.assertEquals("myName", _name);
PRFNamed _element_1 = fragments.getElement();
final PRFNamed prev = ((PRFNamedWithAction) _element_1).getPrev();
String _name_1 = prev.getName();
Assert.assertEquals("myPrev", _name_1);
final PRFNamed prev = ((PRFNamedWithAction) _element).getPrev();
Assert.assertEquals("myPrev", prev.getName());
final ICompositeNode node = NodeModelUtils.findActualNodeFor(prev);
String _text = node.getText();
Assert.assertEquals("myPrev", _text);
Assert.assertEquals("myPrev", node.getText());
final EObject lookup = NodeModelUtils.findActualSemanticObjectFor(node);
Assert.assertSame(prev, lookup);
}

View file

@ -53,9 +53,7 @@ public class IndentationAwareLanguageTest {
try {
final Tree tree = this.parseHelper.parse("");
Assert.assertNotNull(tree);
EList<TreeNode> _nodes = tree.getNodes();
boolean _isEmpty = _nodes.isEmpty();
Assert.assertTrue(_isEmpty);
Assert.assertTrue(tree.getNodes().isEmpty());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -66,13 +64,8 @@ public class IndentationAwareLanguageTest {
try {
final Tree tree = this.parseHelper.parse("root");
Assert.assertNotNull(tree);
EList<TreeNode> _nodes = tree.getNodes();
int _size = _nodes.size();
Assert.assertEquals(1, _size);
EList<TreeNode> _nodes_1 = tree.getNodes();
TreeNode _head = IterableExtensions.<TreeNode>head(_nodes_1);
String _name = _head.getName();
Assert.assertEquals("root", _name);
Assert.assertEquals(1, tree.getNodes().size());
Assert.assertEquals("root", IterableExtensions.<TreeNode>head(tree.getNodes()).getName());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -88,17 +81,9 @@ public class IndentationAwareLanguageTest {
_builder.newLine();
final Tree tree = this.parseHelper.parse(_builder);
Assert.assertNotNull(tree);
EList<TreeNode> _nodes = tree.getNodes();
int _size = _nodes.size();
Assert.assertEquals(2, _size);
EList<TreeNode> _nodes_1 = tree.getNodes();
TreeNode _head = IterableExtensions.<TreeNode>head(_nodes_1);
String _name = _head.getName();
Assert.assertEquals("first", _name);
EList<TreeNode> _nodes_2 = tree.getNodes();
TreeNode _last = IterableExtensions.<TreeNode>last(_nodes_2);
String _name_1 = _last.getName();
Assert.assertEquals("second", _name_1);
Assert.assertEquals(2, tree.getNodes().size());
Assert.assertEquals("first", IterableExtensions.<TreeNode>head(tree.getNodes()).getName());
Assert.assertEquals("second", IterableExtensions.<TreeNode>last(tree.getNodes()).getName());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -115,19 +100,9 @@ public class IndentationAwareLanguageTest {
_builder.newLine();
final Tree tree = this.parseHelper.parse(_builder);
Assert.assertNotNull(tree);
EList<TreeNode> _nodes = tree.getNodes();
int _size = _nodes.size();
Assert.assertEquals(1, _size);
EList<TreeNode> _nodes_1 = tree.getNodes();
TreeNode _head = IterableExtensions.<TreeNode>head(_nodes_1);
String _name = _head.getName();
Assert.assertEquals("parent", _name);
EList<TreeNode> _nodes_2 = tree.getNodes();
TreeNode _head_1 = IterableExtensions.<TreeNode>head(_nodes_2);
EList<TreeNode> _children = _head_1.getChildren();
TreeNode _head_2 = IterableExtensions.<TreeNode>head(_children);
String _name_1 = _head_2.getName();
Assert.assertEquals("child", _name_1);
Assert.assertEquals(1, tree.getNodes().size());
Assert.assertEquals("parent", IterableExtensions.<TreeNode>head(tree.getNodes()).getName());
Assert.assertEquals("child", IterableExtensions.<TreeNode>head(IterableExtensions.<TreeNode>head(tree.getNodes()).getChildren()).getName());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("parent");
_builder_1.newLine();

View file

@ -8,11 +8,9 @@
package org.eclipse.xtext.parser.parameters;
import com.google.inject.Injector;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters;
import org.eclipse.xtext.parser.parameters.parametersTestLanguage.Scenario;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.tests.AbstractXtextTests;
import org.eclipse.xtext.xbase.lib.Exceptions;
@ -51,9 +49,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario1_first() {
try {
final ParserRuleParameters instance = this.getModel("#1 first");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("first", _first);
Assert.assertEquals("first", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -63,9 +59,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario2_second() {
try {
final ParserRuleParameters instance = this.getModel("#2 second");
Scenario _scenario = instance.getScenario();
String _second = _scenario.getSecond();
Assert.assertEquals("second", _second);
Assert.assertEquals("second", instance.getScenario().getSecond());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -75,9 +69,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario3_keyword() {
try {
final ParserRuleParameters instance = this.getModel("#3 keyword");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("keyword", _first);
Assert.assertEquals("keyword", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -87,9 +79,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario3_id() {
try {
final ParserRuleParameters instance = this.getModel("#3 id");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("id", _first);
Assert.assertEquals("id", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -99,18 +89,9 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario4_keyword() {
try {
final ParserRuleParameters instance = this.getModelWithErrors("#4 keyword");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals(null, _first);
Resource _eResource = instance.eResource();
EList<Resource.Diagnostic> _errors = _eResource.getErrors();
int _size = _errors.size();
Assert.assertEquals(1, _size);
Resource _eResource_1 = instance.eResource();
EList<Resource.Diagnostic> _errors_1 = _eResource_1.getErrors();
Resource.Diagnostic _head = IterableExtensions.<Resource.Diagnostic>head(_errors_1);
String _message = _head.getMessage();
Assert.assertEquals("mismatched input \'keyword\' expecting RULE_ID", _message);
Assert.assertEquals(null, instance.getScenario().getFirst());
Assert.assertEquals(1, instance.eResource().getErrors().size());
Assert.assertEquals("mismatched input \'keyword\' expecting RULE_ID", IterableExtensions.<Resource.Diagnostic>head(instance.eResource().getErrors()).getMessage());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -120,9 +101,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario4_id() {
try {
final ParserRuleParameters instance = this.getModel("#4 id");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("id", _first);
Assert.assertEquals("id", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -132,9 +111,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario5_keyword() {
try {
final ParserRuleParameters instance = this.getModel("#5 keyword");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("keyword", _first);
Assert.assertEquals("keyword", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -144,9 +121,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario5_id() {
try {
final ParserRuleParameters instance = this.getModel("#5 id");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("id", _first);
Assert.assertEquals("id", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -156,13 +131,8 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario6_keyword() {
try {
final ParserRuleParameters instance = this.getModelWithErrors("#6 keyword");
Scenario _scenario = instance.getScenario();
Assert.assertEquals(null, _scenario);
Resource _eResource = instance.eResource();
EList<Resource.Diagnostic> _errors = _eResource.getErrors();
Resource.Diagnostic _head = IterableExtensions.<Resource.Diagnostic>head(_errors);
String _message = _head.getMessage();
Assert.assertEquals("no viable alternative at input \'#6\'", _message);
Assert.assertEquals(null, instance.getScenario());
Assert.assertEquals("no viable alternative at input \'#6\'", IterableExtensions.<Resource.Diagnostic>head(instance.eResource().getErrors()).getMessage());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -172,9 +142,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario6_id() {
try {
final ParserRuleParameters instance = this.getModel("#6 id");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("id", _first);
Assert.assertEquals("id", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -184,9 +152,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario7_keyword() {
try {
final ParserRuleParameters instance = this.getModel("#7 keyword");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("keyword", _first);
Assert.assertEquals("keyword", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -196,9 +162,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario7_id() {
try {
final ParserRuleParameters instance = this.getModel("#7 id");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("id", _first);
Assert.assertEquals("id", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -208,9 +172,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario8_keyword() {
try {
final ParserRuleParameters instance = this.getModel("#8 keyword");
Scenario _scenario = instance.getScenario();
String _second = _scenario.getSecond();
Assert.assertEquals("keyword", _second);
Assert.assertEquals("keyword", instance.getScenario().getSecond());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -220,9 +182,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario8_id() {
try {
final ParserRuleParameters instance = this.getModel("#8 id");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("id", _first);
Assert.assertEquals("id", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -232,9 +192,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario9_keyword_keyword() {
try {
final ParserRuleParameters instance = this.getModel("#9 keyword keyword");
Scenario _scenario = instance.getScenario();
String _second = _scenario.getSecond();
Assert.assertEquals("keyword", _second);
Assert.assertEquals("keyword", instance.getScenario().getSecond());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -244,9 +202,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario9_id_keyword() {
try {
final ParserRuleParameters instance = this.getModel("#9 id keyword");
Scenario _scenario = instance.getScenario();
String _second = _scenario.getSecond();
Assert.assertEquals("id", _second);
Assert.assertEquals("id", instance.getScenario().getSecond());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -256,9 +212,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario9_id() {
try {
final ParserRuleParameters instance = this.getModel("#9 id");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("id", _first);
Assert.assertEquals("id", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -268,9 +222,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario9_keyword() {
try {
final ParserRuleParameters instance = this.getModel("#9 keyword");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("keyword", _first);
Assert.assertEquals("keyword", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -280,9 +232,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario10_keyword_keyword() {
try {
final ParserRuleParameters instance = this.getModel("#10 keyword keyword");
Scenario _scenario = instance.getScenario();
String _second = _scenario.getSecond();
Assert.assertEquals("keyword", _second);
Assert.assertEquals("keyword", instance.getScenario().getSecond());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -292,9 +242,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario10_id_keyword() {
try {
final ParserRuleParameters instance = this.getModel("#10 id keyword");
Scenario _scenario = instance.getScenario();
String _second = _scenario.getSecond();
Assert.assertEquals("id", _second);
Assert.assertEquals("id", instance.getScenario().getSecond());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -304,9 +252,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario10_id() {
try {
final ParserRuleParameters instance = this.getModel("#10 id");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("id", _first);
Assert.assertEquals("id", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -316,14 +262,8 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario10_keyword() {
try {
final ParserRuleParameters instance = this.getModelWithErrors("#10 keyword");
Scenario _scenario = instance.getScenario();
String _second = _scenario.getSecond();
Assert.assertEquals("keyword", _second);
Resource _eResource = instance.eResource();
EList<Resource.Diagnostic> _errors = _eResource.getErrors();
Resource.Diagnostic _head = IterableExtensions.<Resource.Diagnostic>head(_errors);
String _message = _head.getMessage();
Assert.assertEquals("mismatched input \'<EOF>\' expecting \'keyword\'", _message);
Assert.assertEquals("keyword", instance.getScenario().getSecond());
Assert.assertEquals("mismatched input \'<EOF>\' expecting \'keyword\'", IterableExtensions.<Resource.Diagnostic>head(instance.eResource().getErrors()).getMessage());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -333,9 +273,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario11_keyword_keyword() {
try {
final ParserRuleParameters instance = this.getModel("#11 keyword keyword");
Scenario _scenario = instance.getScenario();
String _first = _scenario.getFirst();
Assert.assertEquals("keyword", _first);
Assert.assertEquals("keyword", instance.getScenario().getFirst());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -345,9 +283,7 @@ public abstract class AbstractParametersParsingTest extends AbstractXtextTests {
public void testScenario11_id_keyword() {
try {
final ParserRuleParameters instance = this.getModel("#11 id keyword");
Scenario _scenario = instance.getScenario();
String _second = _scenario.getSecond();
Assert.assertEquals("id", _second);
Assert.assertEquals("id", instance.getScenario().getSecond());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}

View file

@ -38,16 +38,12 @@ public abstract class AbstractResourceSetTest {
Resource.Factory.Registry _resourceFactoryRegistry = rs.getResourceFactoryRegistry();
Map<String, Object> _extensionToFactoryMap = _resourceFactoryRegistry.getExtensionToFactoryMap();
_extensionToFactoryMap.put("xmi", nullFactory);
Map<URI, Resource> _uRIResourceMap = rs.getURIResourceMap();
int _size = _uRIResourceMap.size();
Assert.assertEquals(0, _size);
Assert.assertEquals(0, rs.getURIResourceMap().size());
final URI uri = URI.createURI("file:/does/not/exist.xmi");
final Resource demandLoaded = rs.getResource(uri, true);
Assert.assertNotNull(demandLoaded);
final Resource second = rs.getResource(uri, true);
Assert.assertSame(demandLoaded, second);
Map<URI, Resource> _uRIResourceMap_1 = rs.getURIResourceMap();
int _size_1 = _uRIResourceMap_1.size();
Assert.assertEquals(1, _size_1);
Assert.assertEquals(1, rs.getURIResourceMap().size());
}
}

View file

@ -10,12 +10,9 @@ package org.eclipse.xtext.resource;
import com.google.common.collect.Iterables;
import java.io.File;
import java.util.ArrayList;
import java.util.Map;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.xtext.resource.AbstractResourceSetTest;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.XtextResourceSet;
@ -31,377 +28,191 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe
@Test
public void testResourcesAreInMap() {
final XtextResourceSet rs = this.createEmptyResourceSet();
Map<URI, Resource> _uRIResourceMap = rs.getURIResourceMap();
int _size = _uRIResourceMap.size();
Assert.assertEquals(0, _size);
Assert.assertEquals(0, rs.getURIResourceMap().size());
final XtextResource resource = new XtextResource();
File _file = new File("foo");
String _absolutePath = _file.getAbsolutePath();
URI _createFileURI = URI.createFileURI(_absolutePath);
resource.setURI(_createFileURI);
resource.setURI(URI.createFileURI(new File("foo").getAbsolutePath()));
EList<Resource> _resources = rs.getResources();
_resources.add(resource);
Map<URI, Resource> _uRIResourceMap_1 = rs.getURIResourceMap();
int _size_1 = _uRIResourceMap_1.size();
Assert.assertEquals(1, _size_1);
Assert.assertEquals(1, rs.getURIResourceMap().size());
EList<Resource> _resources_1 = rs.getResources();
_resources_1.remove(resource);
EList<Adapter> _eAdapters = resource.eAdapters();
boolean _isEmpty = _eAdapters.isEmpty();
Assert.assertTrue(_isEmpty);
Map<URI, Resource> _uRIResourceMap_2 = rs.getURIResourceMap();
int _size_2 = _uRIResourceMap_2.size();
Assert.assertEquals(0, _size_2);
Assert.assertTrue(resource.eAdapters().isEmpty());
Assert.assertEquals(0, rs.getURIResourceMap().size());
}
@Test
public void testResourcesAreInMap_02() {
final XtextResourceSet rs = this.createEmptyResourceSet();
Map<URI, Resource> _uRIResourceMap = rs.getURIResourceMap();
int _size = _uRIResourceMap.size();
Assert.assertEquals(0, _size);
Assert.assertEquals(0, rs.getURIResourceMap().size());
final XtextResource resource = new XtextResource();
File _file = new File("foo");
String _absolutePath = _file.getAbsolutePath();
URI _createFileURI = URI.createFileURI(_absolutePath);
resource.setURI(_createFileURI);
resource.setURI(URI.createFileURI(new File("foo").getAbsolutePath()));
EList<Resource> _resources = rs.getResources();
ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
Iterables.<Resource>addAll(_resources, _newArrayList);
Map<URI, Resource> _uRIResourceMap_1 = rs.getURIResourceMap();
int _size_1 = _uRIResourceMap_1.size();
Assert.assertEquals(1, _size_1);
Assert.assertEquals(1, rs.getURIResourceMap().size());
EList<Resource> _resources_1 = rs.getResources();
_resources_1.remove(resource);
EList<Adapter> _eAdapters = resource.eAdapters();
boolean _isEmpty = _eAdapters.isEmpty();
Assert.assertTrue(_isEmpty);
Map<URI, Resource> _uRIResourceMap_2 = rs.getURIResourceMap();
int _size_2 = _uRIResourceMap_2.size();
Assert.assertEquals(0, _size_2);
Assert.assertTrue(resource.eAdapters().isEmpty());
Assert.assertEquals(0, rs.getURIResourceMap().size());
}
@Test
public void testResourcesAreInMap_03() {
final XtextResourceSet rs = this.createEmptyResourceSet();
Map<URI, Resource> _uRIResourceMap = rs.getURIResourceMap();
int _size = _uRIResourceMap.size();
Assert.assertEquals(0, _size);
Assert.assertEquals(0, rs.getURIResourceMap().size());
final XtextResource resource = new XtextResource();
EList<Resource> _resources = rs.getResources();
_resources.add(resource);
Map<URI, Resource> _uRIResourceMap_1 = rs.getURIResourceMap();
int _size_1 = _uRIResourceMap_1.size();
Assert.assertEquals(1, _size_1);
Map<URI, Resource> _uRIResourceMap_2 = rs.getURIResourceMap();
Resource _get = _uRIResourceMap_2.get(null);
Assert.assertEquals(resource, _get);
File _file = new File("foo");
String _absolutePath = _file.getAbsolutePath();
URI _createFileURI = URI.createFileURI(_absolutePath);
resource.setURI(_createFileURI);
Map<URI, Resource> _uRIResourceMap_3 = rs.getURIResourceMap();
int _size_2 = _uRIResourceMap_3.size();
Assert.assertEquals(1, _size_2);
Map<URI, Resource> _uRIResourceMap_4 = rs.getURIResourceMap();
boolean _containsKey = _uRIResourceMap_4.containsKey(null);
Assert.assertFalse(_containsKey);
Map<URI, Resource> _uRIResourceMap_5 = rs.getURIResourceMap();
URI _uRI = resource.getURI();
Resource _get_1 = _uRIResourceMap_5.get(_uRI);
Assert.assertEquals(resource, _get_1);
Map<URI, Resource> _uRIResourceMap_6 = rs.getURIResourceMap();
URIConverter _uRIConverter = rs.getURIConverter();
URI _uRI_1 = resource.getURI();
URI _normalize = _uRIConverter.normalize(_uRI_1);
Resource _get_2 = _uRIResourceMap_6.get(_normalize);
Assert.assertEquals(resource, _get_2);
File _file_1 = new File("bar");
String _absolutePath_1 = _file_1.getAbsolutePath();
URI _createFileURI_1 = URI.createFileURI(_absolutePath_1);
resource.setURI(_createFileURI_1);
Map<URI, Resource> _uRIResourceMap_7 = rs.getURIResourceMap();
int _size_3 = _uRIResourceMap_7.size();
Assert.assertEquals(1, _size_3);
Map<URI, Resource> _uRIResourceMap_8 = rs.getURIResourceMap();
boolean _containsKey_1 = _uRIResourceMap_8.containsKey(null);
Assert.assertFalse(_containsKey_1);
Map<URI, Resource> _uRIResourceMap_9 = rs.getURIResourceMap();
URI _uRI_2 = resource.getURI();
Resource _get_3 = _uRIResourceMap_9.get(_uRI_2);
Assert.assertEquals(resource, _get_3);
Map<URI, Resource> _uRIResourceMap_10 = rs.getURIResourceMap();
URIConverter _uRIConverter_1 = rs.getURIConverter();
URI _uRI_3 = resource.getURI();
URI _normalize_1 = _uRIConverter_1.normalize(_uRI_3);
Resource _get_4 = _uRIResourceMap_10.get(_normalize_1);
Assert.assertEquals(resource, _get_4);
Assert.assertEquals(1, rs.getURIResourceMap().size());
Assert.assertEquals(resource, rs.getURIResourceMap().get(null));
resource.setURI(URI.createFileURI(new File("foo").getAbsolutePath()));
Assert.assertEquals(1, rs.getURIResourceMap().size());
Assert.assertFalse(rs.getURIResourceMap().containsKey(null));
Assert.assertEquals(resource, rs.getURIResourceMap().get(resource.getURI()));
Assert.assertEquals(resource, rs.getURIResourceMap().get(rs.getURIConverter().normalize(resource.getURI())));
resource.setURI(URI.createFileURI(new File("bar").getAbsolutePath()));
Assert.assertEquals(1, rs.getURIResourceMap().size());
Assert.assertFalse(rs.getURIResourceMap().containsKey(null));
Assert.assertEquals(resource, rs.getURIResourceMap().get(resource.getURI()));
Assert.assertEquals(resource, rs.getURIResourceMap().get(rs.getURIConverter().normalize(resource.getURI())));
resource.setURI(null);
Map<URI, Resource> _uRIResourceMap_11 = rs.getURIResourceMap();
int _size_4 = _uRIResourceMap_11.size();
Assert.assertEquals(1, _size_4);
Map<URI, Resource> _uRIResourceMap_12 = rs.getURIResourceMap();
Resource _get_5 = _uRIResourceMap_12.get(null);
Assert.assertEquals(resource, _get_5);
Assert.assertEquals(1, rs.getURIResourceMap().size());
Assert.assertEquals(resource, rs.getURIResourceMap().get(null));
EList<Resource> _resources_1 = rs.getResources();
_resources_1.remove(resource);
EList<Adapter> _eAdapters = resource.eAdapters();
boolean _isEmpty = _eAdapters.isEmpty();
Assert.assertTrue(_isEmpty);
Map<URI, Resource> _uRIResourceMap_13 = rs.getURIResourceMap();
int _size_5 = _uRIResourceMap_13.size();
Assert.assertEquals(0, _size_5);
Assert.assertTrue(resource.eAdapters().isEmpty());
Assert.assertEquals(0, rs.getURIResourceMap().size());
}
@Test
public void testResourcesAreCleared_01() {
final XtextResourceSet rs = this.createEmptyResourceSet();
Map<URI, Resource> _uRIResourceMap = rs.getURIResourceMap();
int _size = _uRIResourceMap.size();
Assert.assertEquals(0, _size);
Assert.assertEquals(0, rs.getURIResourceMap().size());
final XtextResource resource = new XtextResource();
File _file = new File("foo");
String _absolutePath = _file.getAbsolutePath();
URI _createFileURI = URI.createFileURI(_absolutePath);
resource.setURI(_createFileURI);
resource.setURI(URI.createFileURI(new File("foo").getAbsolutePath()));
EList<Resource> _resources = rs.getResources();
ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
Iterables.<Resource>addAll(_resources, _newArrayList);
Map<URI, Resource> _uRIResourceMap_1 = rs.getURIResourceMap();
int _size_1 = _uRIResourceMap_1.size();
Assert.assertEquals(1, _size_1);
Assert.assertEquals(1, rs.getURIResourceMap().size());
EList<Resource> _resources_1 = rs.getResources();
_resources_1.clear();
EList<Adapter> _eAdapters = resource.eAdapters();
boolean _isEmpty = _eAdapters.isEmpty();
Assert.assertTrue(_isEmpty);
Map<URI, Resource> _uRIResourceMap_2 = rs.getURIResourceMap();
int _size_2 = _uRIResourceMap_2.size();
Assert.assertEquals(0, _size_2);
Assert.assertTrue(resource.eAdapters().isEmpty());
Assert.assertEquals(0, rs.getURIResourceMap().size());
}
@Test
public void testResourcesAreClearedWithDeliverFalse_01() {
final XtextResourceSet rs = this.createEmptyResourceSet();
Map<URI, Resource> _uRIResourceMap = rs.getURIResourceMap();
int _size = _uRIResourceMap.size();
Assert.assertEquals(0, _size);
Assert.assertEquals(0, rs.getURIResourceMap().size());
final XtextResource resource = new XtextResource();
File _file = new File("foo");
String _absolutePath = _file.getAbsolutePath();
URI _createFileURI = URI.createFileURI(_absolutePath);
resource.setURI(_createFileURI);
resource.setURI(URI.createFileURI(new File("foo").getAbsolutePath()));
EList<Resource> _resources = rs.getResources();
ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
Iterables.<Resource>addAll(_resources, _newArrayList);
Map<URI, Resource> _uRIResourceMap_1 = rs.getURIResourceMap();
int _size_1 = _uRIResourceMap_1.size();
Assert.assertEquals(1, _size_1);
Assert.assertEquals(1, rs.getURIResourceMap().size());
rs.eSetDeliver(false);
EList<Resource> _resources_1 = rs.getResources();
_resources_1.clear();
EList<Adapter> _eAdapters = resource.eAdapters();
boolean _isEmpty = _eAdapters.isEmpty();
Assert.assertTrue(_isEmpty);
Map<URI, Resource> _uRIResourceMap_2 = rs.getURIResourceMap();
int _size_2 = _uRIResourceMap_2.size();
Assert.assertEquals(0, _size_2);
Assert.assertTrue(resource.eAdapters().isEmpty());
Assert.assertEquals(0, rs.getURIResourceMap().size());
}
@Test
public void testResourcesAreInMapWithNormalizedURI_01() {
final XtextResourceSet rs = this.createEmptyResourceSet();
Map<URI, Resource> _uRIResourceMap = rs.getURIResourceMap();
int _size = _uRIResourceMap.size();
Assert.assertEquals(0, _size);
Assert.assertEquals(0, rs.getURIResourceMap().size());
final XtextResource resource = new XtextResource();
URI _createURI = URI.createURI("/a/../foo");
resource.setURI(_createURI);
resource.setURI(URI.createURI("/a/../foo"));
EList<Resource> _resources = rs.getResources();
_resources.add(resource);
Map<URI, Resource> _uRIResourceMap_1 = rs.getURIResourceMap();
int _size_1 = _uRIResourceMap_1.size();
Assert.assertEquals(2, _size_1);
Assert.assertEquals(2, rs.getURIResourceMap().size());
EList<Resource> _resources_1 = rs.getResources();
_resources_1.remove(resource);
EList<Adapter> _eAdapters = resource.eAdapters();
boolean _isEmpty = _eAdapters.isEmpty();
Assert.assertTrue(_isEmpty);
Map<URI, Resource> _uRIResourceMap_2 = rs.getURIResourceMap();
int _size_2 = _uRIResourceMap_2.size();
Assert.assertEquals(0, _size_2);
Assert.assertTrue(resource.eAdapters().isEmpty());
Assert.assertEquals(0, rs.getURIResourceMap().size());
}
@Test
public void testResourcesAreInMapWithNormalizedURI_02() {
final XtextResourceSet rs = this.createEmptyResourceSet();
Map<URI, Resource> _uRIResourceMap = rs.getURIResourceMap();
int _size = _uRIResourceMap.size();
Assert.assertEquals(0, _size);
Assert.assertEquals(0, rs.getURIResourceMap().size());
final XtextResource resource = new XtextResource();
URI _createURI = URI.createURI("/a/../foo");
resource.setURI(_createURI);
resource.setURI(URI.createURI("/a/../foo"));
EList<Resource> _resources = rs.getResources();
ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
Iterables.<Resource>addAll(_resources, _newArrayList);
Map<URI, Resource> _uRIResourceMap_1 = rs.getURIResourceMap();
int _size_1 = _uRIResourceMap_1.size();
Assert.assertEquals(2, _size_1);
Assert.assertEquals(2, rs.getURIResourceMap().size());
EList<Resource> _resources_1 = rs.getResources();
_resources_1.remove(resource);
EList<Adapter> _eAdapters = resource.eAdapters();
boolean _isEmpty = _eAdapters.isEmpty();
Assert.assertTrue(_isEmpty);
Map<URI, Resource> _uRIResourceMap_2 = rs.getURIResourceMap();
int _size_2 = _uRIResourceMap_2.size();
Assert.assertEquals(0, _size_2);
Assert.assertTrue(resource.eAdapters().isEmpty());
Assert.assertEquals(0, rs.getURIResourceMap().size());
}
@Test
public void testResourcesAreInMapWithNormalizedURI_03() {
final XtextResourceSet rs = this.createEmptyResourceSet();
Map<URI, Resource> _uRIResourceMap = rs.getURIResourceMap();
int _size = _uRIResourceMap.size();
Assert.assertEquals(0, _size);
Assert.assertEquals(0, rs.getURIResourceMap().size());
final XtextResource resource = new XtextResource();
EList<Resource> _resources = rs.getResources();
_resources.add(resource);
Map<URI, Resource> _uRIResourceMap_1 = rs.getURIResourceMap();
int _size_1 = _uRIResourceMap_1.size();
Assert.assertEquals(1, _size_1);
Map<URI, Resource> _uRIResourceMap_2 = rs.getURIResourceMap();
Resource _get = _uRIResourceMap_2.get(null);
Assert.assertEquals(resource, _get);
Map<URI, URI> _normalizationMap = rs.getNormalizationMap();
int _size_2 = _normalizationMap.size();
Assert.assertEquals(0, _size_2);
URI _createURI = URI.createURI("/a/../foo");
resource.setURI(_createURI);
Map<URI, Resource> _uRIResourceMap_3 = rs.getURIResourceMap();
int _size_3 = _uRIResourceMap_3.size();
Assert.assertEquals(2, _size_3);
Map<URI, Resource> _uRIResourceMap_4 = rs.getURIResourceMap();
boolean _containsKey = _uRIResourceMap_4.containsKey(null);
Assert.assertFalse(_containsKey);
Map<URI, Resource> _uRIResourceMap_5 = rs.getURIResourceMap();
URI _uRI = resource.getURI();
Resource _get_1 = _uRIResourceMap_5.get(_uRI);
Assert.assertEquals(resource, _get_1);
Map<URI, Resource> _uRIResourceMap_6 = rs.getURIResourceMap();
URIConverter _uRIConverter = rs.getURIConverter();
URI _uRI_1 = resource.getURI();
URI _normalize = _uRIConverter.normalize(_uRI_1);
Resource _get_2 = _uRIResourceMap_6.get(_normalize);
Assert.assertEquals(resource, _get_2);
Map<URI, URI> _normalizationMap_1 = rs.getNormalizationMap();
int _size_4 = _normalizationMap_1.size();
Assert.assertEquals(1, _size_4);
URIConverter _uRIConverter_1 = rs.getURIConverter();
URI _uRI_2 = resource.getURI();
URI _normalize_1 = _uRIConverter_1.normalize(_uRI_2);
Map<URI, URI> _normalizationMap_2 = rs.getNormalizationMap();
URI _uRI_3 = resource.getURI();
URI _get_3 = _normalizationMap_2.get(_uRI_3);
Assert.assertEquals(_normalize_1, _get_3);
URI _createURI_1 = URI.createURI("/a/../bar");
resource.setURI(_createURI_1);
Map<URI, Resource> _uRIResourceMap_7 = rs.getURIResourceMap();
int _size_5 = _uRIResourceMap_7.size();
Assert.assertEquals(2, _size_5);
Map<URI, Resource> _uRIResourceMap_8 = rs.getURIResourceMap();
boolean _containsKey_1 = _uRIResourceMap_8.containsKey(null);
Assert.assertFalse(_containsKey_1);
Map<URI, Resource> _uRIResourceMap_9 = rs.getURIResourceMap();
URI _uRI_4 = resource.getURI();
Resource _get_4 = _uRIResourceMap_9.get(_uRI_4);
Assert.assertEquals(resource, _get_4);
Map<URI, Resource> _uRIResourceMap_10 = rs.getURIResourceMap();
URIConverter _uRIConverter_2 = rs.getURIConverter();
URI _uRI_5 = resource.getURI();
URI _normalize_2 = _uRIConverter_2.normalize(_uRI_5);
Resource _get_5 = _uRIResourceMap_10.get(_normalize_2);
Assert.assertEquals(resource, _get_5);
Map<URI, URI> _normalizationMap_3 = rs.getNormalizationMap();
int _size_6 = _normalizationMap_3.size();
Assert.assertEquals(1, _size_6);
URIConverter _uRIConverter_3 = rs.getURIConverter();
URI _uRI_6 = resource.getURI();
URI _normalize_3 = _uRIConverter_3.normalize(_uRI_6);
Map<URI, URI> _normalizationMap_4 = rs.getNormalizationMap();
URI _uRI_7 = resource.getURI();
URI _get_6 = _normalizationMap_4.get(_uRI_7);
Assert.assertEquals(_normalize_3, _get_6);
Assert.assertEquals(1, rs.getURIResourceMap().size());
Assert.assertEquals(resource, rs.getURIResourceMap().get(null));
Assert.assertEquals(0, rs.getNormalizationMap().size());
resource.setURI(URI.createURI("/a/../foo"));
Assert.assertEquals(2, rs.getURIResourceMap().size());
Assert.assertFalse(rs.getURIResourceMap().containsKey(null));
Assert.assertEquals(resource, rs.getURIResourceMap().get(resource.getURI()));
Assert.assertEquals(resource, rs.getURIResourceMap().get(rs.getURIConverter().normalize(resource.getURI())));
Assert.assertEquals(1, rs.getNormalizationMap().size());
Assert.assertEquals(rs.getURIConverter().normalize(resource.getURI()), rs.getNormalizationMap().get(resource.getURI()));
resource.setURI(URI.createURI("/a/../bar"));
Assert.assertEquals(2, rs.getURIResourceMap().size());
Assert.assertFalse(rs.getURIResourceMap().containsKey(null));
Assert.assertEquals(resource, rs.getURIResourceMap().get(resource.getURI()));
Assert.assertEquals(resource, rs.getURIResourceMap().get(rs.getURIConverter().normalize(resource.getURI())));
Assert.assertEquals(1, rs.getNormalizationMap().size());
Assert.assertEquals(rs.getURIConverter().normalize(resource.getURI()), rs.getNormalizationMap().get(resource.getURI()));
resource.setURI(null);
Map<URI, Resource> _uRIResourceMap_11 = rs.getURIResourceMap();
int _size_7 = _uRIResourceMap_11.size();
Assert.assertEquals(1, _size_7);
Map<URI, Resource> _uRIResourceMap_12 = rs.getURIResourceMap();
Resource _get_7 = _uRIResourceMap_12.get(null);
Assert.assertEquals(resource, _get_7);
Map<URI, URI> _normalizationMap_5 = rs.getNormalizationMap();
int _size_8 = _normalizationMap_5.size();
Assert.assertEquals(0, _size_8);
Assert.assertEquals(1, rs.getURIResourceMap().size());
Assert.assertEquals(resource, rs.getURIResourceMap().get(null));
Assert.assertEquals(0, rs.getNormalizationMap().size());
EList<Resource> _resources_1 = rs.getResources();
_resources_1.remove(resource);
EList<Adapter> _eAdapters = resource.eAdapters();
boolean _isEmpty = _eAdapters.isEmpty();
Assert.assertTrue(_isEmpty);
Map<URI, Resource> _uRIResourceMap_13 = rs.getURIResourceMap();
int _size_9 = _uRIResourceMap_13.size();
Assert.assertEquals(0, _size_9);
Map<URI, URI> _normalizationMap_6 = rs.getNormalizationMap();
int _size_10 = _normalizationMap_6.size();
Assert.assertEquals(0, _size_10);
Assert.assertTrue(resource.eAdapters().isEmpty());
Assert.assertEquals(0, rs.getURIResourceMap().size());
Assert.assertEquals(0, rs.getNormalizationMap().size());
}
@Test
public void testResourcesAreClearedWithNormalizedURI_01() {
final XtextResourceSet rs = this.createEmptyResourceSet();
Map<URI, Resource> _uRIResourceMap = rs.getURIResourceMap();
int _size = _uRIResourceMap.size();
Assert.assertEquals(0, _size);
Assert.assertEquals(0, rs.getURIResourceMap().size());
final XtextResource resource = new XtextResource();
URI _createURI = URI.createURI("/a/../foo");
resource.setURI(_createURI);
resource.setURI(URI.createURI("/a/../foo"));
EList<Resource> _resources = rs.getResources();
ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
Iterables.<Resource>addAll(_resources, _newArrayList);
Map<URI, Resource> _uRIResourceMap_1 = rs.getURIResourceMap();
int _size_1 = _uRIResourceMap_1.size();
Assert.assertEquals(2, _size_1);
Assert.assertEquals(2, rs.getURIResourceMap().size());
EList<Resource> _resources_1 = rs.getResources();
_resources_1.clear();
EList<Adapter> _eAdapters = resource.eAdapters();
boolean _isEmpty = _eAdapters.isEmpty();
Assert.assertTrue(_isEmpty);
Map<URI, Resource> _uRIResourceMap_2 = rs.getURIResourceMap();
int _size_2 = _uRIResourceMap_2.size();
Assert.assertEquals(0, _size_2);
Assert.assertTrue(resource.eAdapters().isEmpty());
Assert.assertEquals(0, rs.getURIResourceMap().size());
}
@Test
public void testResourcesAreClearedWithDeliverFalseWithNormalizedURI_01() {
final XtextResourceSet rs = this.createEmptyResourceSet();
Map<URI, Resource> _uRIResourceMap = rs.getURIResourceMap();
int _size = _uRIResourceMap.size();
Assert.assertEquals(0, _size);
Assert.assertEquals(0, rs.getURIResourceMap().size());
final XtextResource resource = new XtextResource();
URI _createURI = URI.createURI("//a/../foo");
resource.setURI(_createURI);
resource.setURI(URI.createURI("//a/../foo"));
EList<Resource> _resources = rs.getResources();
ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
Iterables.<Resource>addAll(_resources, _newArrayList);
Map<URI, Resource> _uRIResourceMap_1 = rs.getURIResourceMap();
int _size_1 = _uRIResourceMap_1.size();
Assert.assertEquals(2, _size_1);
Assert.assertEquals(2, rs.getURIResourceMap().size());
rs.eSetDeliver(false);
EList<Resource> _resources_1 = rs.getResources();
_resources_1.clear();
EList<Adapter> _eAdapters = resource.eAdapters();
boolean _isEmpty = _eAdapters.isEmpty();
Assert.assertTrue(_isEmpty);
Map<URI, Resource> _uRIResourceMap_2 = rs.getURIResourceMap();
int _size_2 = _uRIResourceMap_2.size();
Assert.assertEquals(0, _size_2);
Assert.assertTrue(resource.eAdapters().isEmpty());
Assert.assertEquals(0, rs.getURIResourceMap().size());
}
}

View file

@ -11,7 +11,6 @@ import java.io.IOException;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.parser.IParseResult;
import org.eclipse.xtext.resource.DerivedStateAwareResource;
import org.eclipse.xtext.testlanguages.OptionalEmptyTestLanguageStandaloneSetup;
import org.eclipse.xtext.tests.AbstractXtextTests;
@ -44,15 +43,12 @@ public class Bug451668Test extends AbstractXtextTests {
r.setURI(_createURI);
StringInputStream _stringInputStream = new StringInputStream("");
r.load(_stringInputStream, null);
boolean _isLoaded = r.isLoaded();
Assert.assertTrue(_isLoaded);
Assert.assertTrue(r.isLoaded());
final int callsBeforeUnload = r.contentsCalls;
r.unload();
Assert.assertEquals(callsBeforeUnload, r.contentsCalls);
boolean _isLoaded_1 = r.isLoaded();
Assert.assertFalse(_isLoaded_1);
IParseResult _parseResult = r.getParseResult();
Assert.assertNull(_parseResult);
Assert.assertFalse(r.isLoaded());
Assert.assertNull(r.getParseResult());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}

View file

@ -7,7 +7,6 @@
*/
package org.eclipse.xtext.resource;
import java.util.HashMap;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
@ -22,8 +21,7 @@ public class ResourceSetTest extends AbstractResourceSetTest {
protected ResourceSetImpl createEmptyResourceSet() {
ResourceSetImpl _resourceSetImpl = new ResourceSetImpl();
final Procedure1<ResourceSetImpl> _function = (ResourceSetImpl it) -> {
HashMap<URI, Resource> _newHashMap = CollectionLiterals.<URI, Resource>newHashMap();
it.setURIResourceMap(_newHashMap);
it.setURIResourceMap(CollectionLiterals.<URI, Resource>newHashMap());
};
return ObjectExtensions.<ResourceSetImpl>operator_doubleArrow(_resourceSetImpl, _function);
}

View file

@ -14,7 +14,6 @@ import java.io.InputStream;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
@ -80,16 +79,9 @@ public class PortableURIsTest extends AbstractXtextTests {
final URI uri = EcoreUtil.getURI(extended);
PortableURIs _portableURIs = resourceA.getPortableURIs();
final URI portableURI = _portableURIs.toPortableURI(resourceA, uri);
URI _uRI = resourceA.getURI();
URI _trimFragment = portableURI.trimFragment();
Assert.assertEquals(_uRI, _trimFragment);
PortableURIs _portableURIs_1 = resourceA.getPortableURIs();
String _fragment = portableURI.fragment();
boolean _isPortableURIFragment = _portableURIs_1.isPortableURIFragment(_fragment);
Assert.assertTrue(_isPortableURIFragment);
String _fragment_1 = portableURI.fragment();
EObject _eObject = resourceA.getEObject(_fragment_1);
Assert.assertSame(extended, _eObject);
Assert.assertEquals(resourceA.getURI(), portableURI.trimFragment());
Assert.assertTrue(resourceA.getPortableURIs().isPortableURIFragment(portableURI.fragment()));
Assert.assertSame(extended, resourceA.getEObject(portableURI.fragment()));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -133,20 +125,8 @@ public class PortableURIsTest extends AbstractXtextTests {
IResourceDescription _resourceDescription = resourceC.getResourceDescription();
Iterable<IReferenceDescription> _referenceDescriptions = _resourceDescription.getReferenceDescriptions();
final IReferenceDescription refDesc = IterableExtensions.<IReferenceDescription>head(_referenceDescriptions);
EList<EObject> _contents = resourceB.getContents();
EObject _head = IterableExtensions.<EObject>head(_contents);
EList<Type> _types = ((Main) _head).getTypes();
Type _head_1 = IterableExtensions.<Type>head(_types);
URI _targetEObjectUri = refDesc.getTargetEObjectUri();
EObject _eObject = resourceSet.getEObject(_targetEObjectUri, false);
Assert.assertSame(_head_1, _eObject);
EList<EObject> _contents_1 = resourceC.getContents();
EObject _head_2 = IterableExtensions.<EObject>head(_contents_1);
EList<Type> _types_1 = ((Main) _head_2).getTypes();
Type _head_3 = IterableExtensions.<Type>head(_types_1);
URI _sourceEObjectUri = refDesc.getSourceEObjectUri();
EObject _eObject_1 = resourceSet.getEObject(_sourceEObjectUri, false);
Assert.assertSame(_head_3, _eObject_1);
Assert.assertSame(IterableExtensions.<Type>head(((Main) IterableExtensions.<EObject>head(resourceB.getContents())).getTypes()), resourceSet.getEObject(refDesc.getTargetEObjectUri(), false));
Assert.assertSame(IterableExtensions.<Type>head(((Main) IterableExtensions.<EObject>head(resourceC.getContents())).getTypes()), resourceSet.getEObject(refDesc.getSourceEObjectUri(), false));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -154,15 +134,10 @@ public class PortableURIsTest extends AbstractXtextTests {
@Test
public void testEObjectRelativeFragments() {
EReference _eAnnotation_Details = EcorePackage.eINSTANCE.getEAnnotation_Details();
this.checkFragmentBothDirections(EcorePackage.eINSTANCE, _eAnnotation_Details);
EReference _eAttribute_EAttributeType = EcorePackage.eINSTANCE.getEAttribute_EAttributeType();
EReference _eAttribute_EAttributeType_1 = EcorePackage.eINSTANCE.getEAttribute_EAttributeType();
this.checkFragmentBothDirections(_eAttribute_EAttributeType, _eAttribute_EAttributeType_1);
this.checkFragmentBothDirections(EcorePackage.eINSTANCE, EcorePackage.eINSTANCE.getEAnnotation_Details());
this.checkFragmentBothDirections(EcorePackage.eINSTANCE.getEAttribute_EAttributeType(), EcorePackage.eINSTANCE.getEAttribute_EAttributeType());
try {
EReference _eAnnotation_EModelElement = EcorePackage.eINSTANCE.getEAnnotation_EModelElement();
EReference _eAttribute_EAttributeType_2 = EcorePackage.eINSTANCE.getEAttribute_EAttributeType();
this.checkFragmentBothDirections(_eAnnotation_EModelElement, _eAttribute_EAttributeType_2);
this.checkFragmentBothDirections(EcorePackage.eINSTANCE.getEAnnotation_EModelElement(), EcorePackage.eINSTANCE.getEAttribute_EAttributeType());
Assert.fail();
} catch (final Throwable _t) {
if (_t instanceof IllegalStateException) {

View file

@ -12,11 +12,8 @@ import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.persistence.SerializableEObjectDescription;
@ -45,42 +42,29 @@ public class SerializableResourceDescriptionTest {
it.setURI(uri);
SerializableReferenceDescription _serializableReferenceDescription = new SerializableReferenceDescription();
final Procedure1<SerializableReferenceDescription> _function_1 = (SerializableReferenceDescription it_1) -> {
URI _appendFragment = uri.appendFragment("foo");
it_1.setSourceEObjectUri(_appendFragment);
URI _appendFragment_1 = uri.appendFragment("hubble");
it_1.setTargetEObjectUri(_appendFragment_1);
URI _appendFragment_2 = uri.appendFragment("baz");
it_1.setContainerEObjectURI(_appendFragment_2);
EReference _eAnnotation_Contents = EcorePackage.eINSTANCE.getEAnnotation_Contents();
it_1.setEReference(_eAnnotation_Contents);
it_1.setSourceEObjectUri(uri.appendFragment("foo"));
it_1.setTargetEObjectUri(uri.appendFragment("hubble"));
it_1.setContainerEObjectURI(uri.appendFragment("baz"));
it_1.setEReference(EcorePackage.eINSTANCE.getEAnnotation_Contents());
it_1.setIndexInList(1);
};
SerializableReferenceDescription _doubleArrow = ObjectExtensions.<SerializableReferenceDescription>operator_doubleArrow(_serializableReferenceDescription, _function_1);
SerializableReferenceDescription _serializableReferenceDescription_1 = new SerializableReferenceDescription();
final Procedure1<SerializableReferenceDescription> _function_2 = (SerializableReferenceDescription it_1) -> {
URI _appendFragment = uri.appendFragment("foo2");
it_1.setSourceEObjectUri(_appendFragment);
URI _appendFragment_1 = uri.appendFragment("hubble2");
it_1.setTargetEObjectUri(_appendFragment_1);
URI _appendFragment_2 = uri.appendFragment("baz2");
it_1.setContainerEObjectURI(_appendFragment_2);
EReference _eAnnotation_Contents = EcorePackage.eINSTANCE.getEAnnotation_Contents();
it_1.setEReference(_eAnnotation_Contents);
it_1.setSourceEObjectUri(uri.appendFragment("foo2"));
it_1.setTargetEObjectUri(uri.appendFragment("hubble2"));
it_1.setContainerEObjectURI(uri.appendFragment("baz2"));
it_1.setEReference(EcorePackage.eINSTANCE.getEAnnotation_Contents());
it_1.setIndexInList(2);
};
SerializableReferenceDescription _doubleArrow_1 = ObjectExtensions.<SerializableReferenceDescription>operator_doubleArrow(_serializableReferenceDescription_1, _function_2);
it.setReferences(Collections.<SerializableReferenceDescription>unmodifiableList(CollectionLiterals.<SerializableReferenceDescription>newArrayList(_doubleArrow, _doubleArrow_1)));
SerializableEObjectDescription _serializableEObjectDescription = new SerializableEObjectDescription();
final Procedure1<SerializableEObjectDescription> _function_3 = (SerializableEObjectDescription it_1) -> {
URI _appendFragment = uri.appendFragment("baz");
it_1.setEObjectURI(_appendFragment);
QualifiedName _create = QualifiedName.create("foo", "baz");
it_1.qualifiedName = _create;
EClass _eAttribute = EcorePackage.eINSTANCE.getEAttribute();
it_1.setEClass(_eAttribute);
Pair<String, String> _mappedTo = Pair.<String, String>of("myKey", "myValue");
HashMap<String, String> _newHashMap = CollectionLiterals.<String, String>newHashMap(_mappedTo);
it_1.userData = _newHashMap;
it_1.setEObjectURI(uri.appendFragment("baz"));
it_1.qualifiedName = QualifiedName.create("foo", "baz");
it_1.setEClass(EcorePackage.eINSTANCE.getEAttribute());
it_1.userData = CollectionLiterals.<String, String>newHashMap(Pair.<String, String>of("myKey", "myValue"));
};
SerializableEObjectDescription _doubleArrow_2 = ObjectExtensions.<SerializableEObjectDescription>operator_doubleArrow(_serializableEObjectDescription, _function_3);
it.setDescriptions(Collections.<SerializableEObjectDescription>unmodifiableList(CollectionLiterals.<SerializableEObjectDescription>newArrayList(_doubleArrow_2)));
@ -104,68 +88,40 @@ public class SerializableResourceDescriptionTest {
}
public void assertDescriptionsEqual(final SerializableResourceDescription before, final SerializableResourceDescription after) {
URI _uRI = before.getURI();
URI _uRI_1 = after.getURI();
Assert.assertEquals(_uRI, _uRI_1);
Iterable<QualifiedName> _importedNames = before.getImportedNames();
Iterable<QualifiedName> _importedNames_1 = after.getImportedNames();
Assert.assertEquals(_importedNames, _importedNames_1);
Assert.assertEquals(before.getURI(), after.getURI());
Assert.assertEquals(before.getImportedNames(), after.getImportedNames());
Assert.assertEquals(before.getReferences().size(), after.getReferences().size());
List<SerializableReferenceDescription> _references = before.getReferences();
int _size = _references.size();
List<SerializableReferenceDescription> _references_1 = after.getReferences();
int _size_1 = _references_1.size();
Assert.assertEquals(_size, _size_1);
List<SerializableReferenceDescription> _references_2 = before.getReferences();
int _size_2 = _references_2.size();
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size_2, true);
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
for (final int i : _doubleDotLessThan) {
{
List<SerializableReferenceDescription> _references_3 = before.getReferences();
final SerializableReferenceDescription beforeRef = _references_3.get(i);
List<SerializableReferenceDescription> _references_4 = after.getReferences();
final SerializableReferenceDescription afterRef = _references_4.get(i);
URI _containerEObjectURI = beforeRef.getContainerEObjectURI();
URI _containerEObjectURI_1 = afterRef.getContainerEObjectURI();
Assert.assertEquals(_containerEObjectURI, _containerEObjectURI_1);
URI _sourceEObjectUri = beforeRef.getSourceEObjectUri();
URI _sourceEObjectUri_1 = afterRef.getSourceEObjectUri();
Assert.assertEquals(_sourceEObjectUri, _sourceEObjectUri_1);
URI _targetEObjectUri = beforeRef.getTargetEObjectUri();
URI _targetEObjectUri_1 = afterRef.getTargetEObjectUri();
Assert.assertEquals(_targetEObjectUri, _targetEObjectUri_1);
EReference _eReference = beforeRef.getEReference();
EReference _eReference_1 = afterRef.getEReference();
Assert.assertEquals(_eReference, _eReference_1);
int _indexInList = beforeRef.getIndexInList();
int _indexInList_1 = afterRef.getIndexInList();
Assert.assertEquals(_indexInList, _indexInList_1);
List<SerializableReferenceDescription> _references_1 = before.getReferences();
final SerializableReferenceDescription beforeRef = _references_1.get(i);
List<SerializableReferenceDescription> _references_2 = after.getReferences();
final SerializableReferenceDescription afterRef = _references_2.get(i);
Assert.assertEquals(beforeRef.getContainerEObjectURI(), afterRef.getContainerEObjectURI());
Assert.assertEquals(beforeRef.getSourceEObjectUri(), afterRef.getSourceEObjectUri());
Assert.assertEquals(beforeRef.getTargetEObjectUri(), afterRef.getTargetEObjectUri());
Assert.assertEquals(beforeRef.getEReference(), afterRef.getEReference());
Assert.assertEquals(beforeRef.getIndexInList(), afterRef.getIndexInList());
}
}
Assert.assertEquals(before.getDescriptions().size(), after.getDescriptions().size());
List<SerializableEObjectDescription> _descriptions = before.getDescriptions();
int _size_3 = _descriptions.size();
List<SerializableEObjectDescription> _descriptions_1 = after.getDescriptions();
int _size_4 = _descriptions_1.size();
Assert.assertEquals(_size_3, _size_4);
List<SerializableEObjectDescription> _descriptions_2 = before.getDescriptions();
int _size_5 = _descriptions_2.size();
ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, _size_5, true);
int _size_1 = _descriptions.size();
ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, _size_1, true);
for (final int i_1 : _doubleDotLessThan_1) {
{
List<SerializableEObjectDescription> _descriptions_3 = before.getDescriptions();
final SerializableEObjectDescription beforeDesc = _descriptions_3.get(i_1);
List<SerializableEObjectDescription> _descriptions_4 = after.getDescriptions();
final SerializableEObjectDescription afterDesc = _descriptions_4.get(i_1);
EClass _eClass = beforeDesc.getEClass();
EClass _eClass_1 = afterDesc.getEClass();
Assert.assertEquals(_eClass, _eClass_1);
QualifiedName _name = beforeDesc.getName();
QualifiedName _name_1 = afterDesc.getName();
Assert.assertEquals(_name, _name_1);
List<SerializableEObjectDescription> _descriptions_1 = before.getDescriptions();
final SerializableEObjectDescription beforeDesc = _descriptions_1.get(i_1);
List<SerializableEObjectDescription> _descriptions_2 = after.getDescriptions();
final SerializableEObjectDescription afterDesc = _descriptions_2.get(i_1);
Assert.assertEquals(beforeDesc.getEClass(), afterDesc.getEClass());
Assert.assertEquals(beforeDesc.getName(), afterDesc.getName());
Assert.assertEquals(beforeDesc.qualifiedName, afterDesc.qualifiedName);
Assert.assertEquals(beforeDesc.userData, afterDesc.userData);
URI _eObjectURI = beforeDesc.getEObjectURI();
URI _eObjectURI_1 = afterDesc.getEObjectURI();
Assert.assertEquals(_eObjectURI, _eObjectURI_1);
Assert.assertEquals(beforeDesc.getEObjectURI(), afterDesc.getEObjectURI());
}
}
}
@ -179,48 +135,37 @@ public class SerializableResourceDescriptionTest {
it.setURI(uri);
SerializableReferenceDescription _serializableReferenceDescription = new SerializableReferenceDescription();
final Procedure1<SerializableReferenceDescription> _function_1 = (SerializableReferenceDescription it_1) -> {
URI _appendFragment = uri.appendFragment("foo");
it_1.setSourceEObjectUri(_appendFragment);
it_1.setSourceEObjectUri(uri.appendFragment("foo"));
it_1.setTargetEObjectUri(null);
URI _appendFragment_1 = uri.appendFragment("baz");
it_1.setContainerEObjectURI(_appendFragment_1);
EReference _eAnnotation_Contents = EcorePackage.eINSTANCE.getEAnnotation_Contents();
it_1.setEReference(_eAnnotation_Contents);
it_1.setContainerEObjectURI(uri.appendFragment("baz"));
it_1.setEReference(EcorePackage.eINSTANCE.getEAnnotation_Contents());
it_1.setIndexInList(1);
};
SerializableReferenceDescription _doubleArrow = ObjectExtensions.<SerializableReferenceDescription>operator_doubleArrow(_serializableReferenceDescription, _function_1);
SerializableReferenceDescription _serializableReferenceDescription_1 = new SerializableReferenceDescription();
final Procedure1<SerializableReferenceDescription> _function_2 = (SerializableReferenceDescription it_1) -> {
it_1.setSourceEObjectUri(null);
URI _appendFragment = uri.appendFragment("hubble2");
it_1.setTargetEObjectUri(_appendFragment);
URI _appendFragment_1 = uri.appendFragment("baz2");
it_1.setContainerEObjectURI(_appendFragment_1);
EReference _eAnnotation_Contents = EcorePackage.eINSTANCE.getEAnnotation_Contents();
it_1.setEReference(_eAnnotation_Contents);
it_1.setTargetEObjectUri(uri.appendFragment("hubble2"));
it_1.setContainerEObjectURI(uri.appendFragment("baz2"));
it_1.setEReference(EcorePackage.eINSTANCE.getEAnnotation_Contents());
it_1.setIndexInList(2);
};
SerializableReferenceDescription _doubleArrow_1 = ObjectExtensions.<SerializableReferenceDescription>operator_doubleArrow(_serializableReferenceDescription_1, _function_2);
SerializableReferenceDescription _serializableReferenceDescription_2 = new SerializableReferenceDescription();
final Procedure1<SerializableReferenceDescription> _function_3 = (SerializableReferenceDescription it_1) -> {
URI _appendFragment = uri.appendFragment("foo");
it_1.setSourceEObjectUri(_appendFragment);
URI _appendFragment_1 = uri.appendFragment("hubble2");
it_1.setTargetEObjectUri(_appendFragment_1);
it_1.setSourceEObjectUri(uri.appendFragment("foo"));
it_1.setTargetEObjectUri(uri.appendFragment("hubble2"));
it_1.setContainerEObjectURI(null);
EReference _eAnnotation_Contents = EcorePackage.eINSTANCE.getEAnnotation_Contents();
it_1.setEReference(_eAnnotation_Contents);
it_1.setEReference(EcorePackage.eINSTANCE.getEAnnotation_Contents());
it_1.setIndexInList(2);
};
SerializableReferenceDescription _doubleArrow_2 = ObjectExtensions.<SerializableReferenceDescription>operator_doubleArrow(_serializableReferenceDescription_2, _function_3);
SerializableReferenceDescription _serializableReferenceDescription_3 = new SerializableReferenceDescription();
final Procedure1<SerializableReferenceDescription> _function_4 = (SerializableReferenceDescription it_1) -> {
URI _appendFragment = uri.appendFragment("foo");
it_1.setSourceEObjectUri(_appendFragment);
it_1.setSourceEObjectUri(uri.appendFragment("foo"));
it_1.setTargetEObjectUri(null);
it_1.setContainerEObjectURI(null);
EReference _eAnnotation_Contents = EcorePackage.eINSTANCE.getEAnnotation_Contents();
it_1.setEReference(_eAnnotation_Contents);
it_1.setEReference(EcorePackage.eINSTANCE.getEAnnotation_Contents());
it_1.setIndexInList(2);
};
SerializableReferenceDescription _doubleArrow_3 = ObjectExtensions.<SerializableReferenceDescription>operator_doubleArrow(_serializableReferenceDescription_3, _function_4);
@ -229,23 +174,17 @@ public class SerializableResourceDescriptionTest {
it_1.setSourceEObjectUri(null);
it_1.setTargetEObjectUri(null);
it_1.setContainerEObjectURI(null);
EReference _eAnnotation_Contents = EcorePackage.eINSTANCE.getEAnnotation_Contents();
it_1.setEReference(_eAnnotation_Contents);
it_1.setEReference(EcorePackage.eINSTANCE.getEAnnotation_Contents());
it_1.setIndexInList(2);
};
SerializableReferenceDescription _doubleArrow_4 = ObjectExtensions.<SerializableReferenceDescription>operator_doubleArrow(_serializableReferenceDescription_4, _function_5);
it.setReferences(Collections.<SerializableReferenceDescription>unmodifiableList(CollectionLiterals.<SerializableReferenceDescription>newArrayList(_doubleArrow, _doubleArrow_1, _doubleArrow_2, _doubleArrow_3, _doubleArrow_4)));
SerializableEObjectDescription _serializableEObjectDescription = new SerializableEObjectDescription();
final Procedure1<SerializableEObjectDescription> _function_6 = (SerializableEObjectDescription it_1) -> {
URI _appendFragment = uri.appendFragment("baz");
it_1.setEObjectURI(_appendFragment);
QualifiedName _create = QualifiedName.create("foo", "baz");
it_1.qualifiedName = _create;
EClass _eAttribute = EcorePackage.eINSTANCE.getEAttribute();
it_1.setEClass(_eAttribute);
Pair<String, String> _mappedTo = Pair.<String, String>of("myKey", "myValue");
HashMap<String, String> _newHashMap = CollectionLiterals.<String, String>newHashMap(_mappedTo);
it_1.userData = _newHashMap;
it_1.setEObjectURI(uri.appendFragment("baz"));
it_1.qualifiedName = QualifiedName.create("foo", "baz");
it_1.setEClass(EcorePackage.eINSTANCE.getEAttribute());
it_1.userData = CollectionLiterals.<String, String>newHashMap(Pair.<String, String>of("myKey", "myValue"));
};
SerializableEObjectDescription _doubleArrow_5 = ObjectExtensions.<SerializableEObjectDescription>operator_doubleArrow(_serializableEObjectDescription, _function_6);
it.setDescriptions(Collections.<SerializableEObjectDescription>unmodifiableList(CollectionLiterals.<SerializableEObjectDescription>newArrayList(_doubleArrow_5)));

View file

@ -943,8 +943,7 @@ public class GrammarPDAProviderTest {
final SerializationContextMap<Pda<ISerState, RuleCall>> pdas = this.pdaProvider.getGrammarPDAs(grammar);
List<SerializationContextMap.Entry<Pda<ISerState, RuleCall>>> _values = pdas.values();
final Consumer<SerializationContextMap.Entry<Pda<ISerState, RuleCall>>> _function = (SerializationContextMap.Entry<Pda<ISerState, RuleCall>> it) -> {
Pda<ISerState, RuleCall> _value = it.getValue();
this.assertNoLeakedGrammarElements(grammar, _value);
this.assertNoLeakedGrammarElements(grammar, it.getValue());
};
_values.forEach(_function);
List<SerializationContextMap.Entry<Pda<ISerState, RuleCall>>> _values_1 = pdas.values();

View file

@ -547,8 +547,6 @@ public class SerializationAfterModelChangeTest {
}
private void assertSerializesTo(final Model model, final CharSequence expectation) {
String _string = expectation.toString();
String _serialize = this._iSerializer.serialize(model);
Assert.assertEquals(_string, _serialize);
Assert.assertEquals(expectation.toString(), this._iSerializer.serialize(model));
}
}

View file

@ -41,9 +41,7 @@ public class DefaultTaskParserTest {
public void setup() {
DefaultTaskParser _defaultTaskParser = new DefaultTaskParser();
this.parser = _defaultTaskParser;
DefaultTaskTagProvider _defaultTaskTagProvider = new DefaultTaskTagProvider();
TaskTags _taskTags = _defaultTaskTagProvider.getTaskTags(null);
this.definitions = _taskTags;
this.definitions = new DefaultTaskTagProvider().getTaskTags(null);
}
@Test
@ -176,13 +174,10 @@ public class DefaultTaskParserTest {
final String source = _builder.toString();
String _unix = LineDelimiters.toUnix(source);
final List<Task> parsed = this.parser.parseTasks(_unix, this.definitions);
int _size = parsed.size();
Assert.assertEquals(expectation, _size);
Assert.assertEquals(expectation, parsed.size());
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, expectation, true);
for (final Integer i_1 : _doubleDotLessThan) {
Task _get = parsed.get((i_1).intValue());
int _lineNumber = _get.getLineNumber();
Assert.assertEquals(((i_1).intValue() + 2), _lineNumber);
Assert.assertEquals(((i_1).intValue() + 2), parsed.get((i_1).intValue()).getLineNumber());
}
}
@ -190,15 +185,11 @@ public class DefaultTaskParserTest {
String _string = source.toString();
String _unix = LineDelimiters.toUnix(_string);
final List<Task> actualTasks = this.parser.parseTasks(_unix, this.definitions);
Assert.assertEquals(expectedTasks.size(), actualTasks.size());
int _size = expectedTasks.size();
int _size_1 = actualTasks.size();
Assert.assertEquals(_size, _size_1);
int _size_2 = expectedTasks.size();
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size_2, true);
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
for (final Integer i : _doubleDotLessThan) {
Task _get = expectedTasks.get((i).intValue());
Task _get_1 = actualTasks.get((i).intValue());
TaskAssert.assertExactMatch(_get, _get_1);
TaskAssert.assertExactMatch(expectedTasks.get((i).intValue()), actualTasks.get((i).intValue()));
}
}
}

View file

@ -7,7 +7,6 @@
*/
package org.eclipse.xtext.tasks;
import org.eclipse.xtext.tasks.Priority;
import org.eclipse.xtext.tasks.Task;
import org.eclipse.xtext.tasks.TaskTag;
import org.junit.Assert;
@ -18,26 +17,14 @@ import org.junit.Assert;
@SuppressWarnings("all")
public class TaskAssert {
public static void assertExactMatch(final Task expected, final Task actual) {
TaskTag _tag = expected.getTag();
TaskTag _tag_1 = actual.getTag();
TaskAssert.assertExactMatch(_tag, _tag_1);
String _description = expected.getDescription();
String _description_1 = actual.getDescription();
Assert.assertEquals(_description, _description_1);
int _lineNumber = expected.getLineNumber();
int _lineNumber_1 = actual.getLineNumber();
Assert.assertEquals(_lineNumber, _lineNumber_1);
int _offset = expected.getOffset();
int _offset_1 = actual.getOffset();
Assert.assertEquals(_offset, _offset_1);
TaskAssert.assertExactMatch(expected.getTag(), actual.getTag());
Assert.assertEquals(expected.getDescription(), actual.getDescription());
Assert.assertEquals(expected.getLineNumber(), actual.getLineNumber());
Assert.assertEquals(expected.getOffset(), actual.getOffset());
}
public static void assertExactMatch(final TaskTag expected, final TaskTag actual) {
String _name = expected.getName();
String _name_1 = actual.getName();
Assert.assertEquals(_name, _name_1);
Priority _priority = expected.getPriority();
Priority _priority_1 = actual.getPriority();
Assert.assertEquals(_priority, _priority_1);
Assert.assertEquals(expected.getName(), actual.getName());
Assert.assertEquals(expected.getPriority(), actual.getPriority());
}
}

View file

@ -139,7 +139,6 @@ public class StringsDiffTest {
if (_string!=null) {
_trim=_string.trim();
}
String _diff = DiffUtil.diff(one, two);
Assert.assertEquals(_trim, _diff);
Assert.assertEquals(_trim, DiffUtil.diff(one, two));
}
}

View file

@ -19,43 +19,35 @@ public class UriUtilTest {
public void testPrefix() {
final URI prefix = URI.createURI("file:/foo/");
final URI uri = URI.createURI("file:/foo/bar");
boolean _isPrefixOf = UriUtil.isPrefixOf(prefix, uri);
Assert.assertTrue(_isPrefixOf);
Assert.assertTrue(UriUtil.isPrefixOf(prefix, uri));
}
@Test
public void testPrefixRequiresSameScheme() {
final URI prefix = URI.createURI("platform:/foo/");
final URI uri = URI.createURI("file:/foo/bar");
boolean _isPrefixOf = UriUtil.isPrefixOf(prefix, uri);
Assert.assertFalse(_isPrefixOf);
Assert.assertFalse(UriUtil.isPrefixOf(prefix, uri));
}
@Test
public void testPrefixRequiresTrailingSeparator() {
final URI prefix = URI.createURI("file:/foo");
final URI uri = URI.createURI("file:/foo/bar");
boolean _isPrefixOf = UriUtil.isPrefixOf(prefix, uri);
Assert.assertFalse(_isPrefixOf);
Assert.assertFalse(UriUtil.isPrefixOf(prefix, uri));
}
@Test
public void testPrefixRequiresSegmentsToMatch() {
final URI prefix = URI.createURI("file:/foo");
final URI uri = URI.createURI("file:/buzz/bar");
boolean _isPrefixOf = UriUtil.isPrefixOf(prefix, uri);
Assert.assertFalse(_isPrefixOf);
Assert.assertFalse(UriUtil.isPrefixOf(prefix, uri));
}
@Test
public void testFolderUriHasTrailingSeparator() {
final File folder = new File(".");
final URI uri = UriUtil.createFolderURI(folder);
boolean _hasTrailingPathSeparator = uri.hasTrailingPathSeparator();
Assert.assertTrue(_hasTrailingPathSeparator);
int _segmentCount = uri.segmentCount();
int _minus = (_segmentCount - 2);
String _segment = uri.segment(_minus);
Assert.assertEquals(".", _segment);
Assert.assertTrue(uri.hasTrailingPathSeparator());
Assert.assertEquals(".", uri.segment((uri.segmentCount() - 2)));
}
}

View file

@ -115,8 +115,7 @@ public class Bug456789Test extends AbstractXtextTests {
EObject _get = _contents.get(0);
final Diagnostic diag = Diagnostician.INSTANCE.validate(_get);
Assert.assertNotNull("diag", diag);
int _severity = diag.getSeverity();
Assert.assertEquals("diag.isError", _severity, Diagnostic.ERROR);
Assert.assertEquals("diag.isError", diag.getSeverity(), Diagnostic.ERROR);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
@ -396,8 +395,7 @@ public class Bug456789Test extends AbstractXtextTests {
EObject _get = _contents.get(0);
final Diagnostic diag = Diagnostician.INSTANCE.validate(_get);
Assert.assertNotNull("diag", diag);
int _severity = diag.getSeverity();
Assert.assertEquals("diag.isError", _severity, Diagnostic.ERROR);
Assert.assertEquals("diag.isError", diag.getSeverity(), Diagnostic.ERROR);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}

View file

@ -7,7 +7,6 @@
*/
package org.eclipse.xtext.xtext;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.xtend2.lib.StringConcatenation;
@ -50,15 +49,11 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "Named");
final ParserRule fragment = ((ParserRule) _findRuleForName_1);
this.validateRule(fragment);
String _string_1 = this.warnings.toString();
int _size_1 = this.warnings.size();
Assert.assertEquals(_string_1, 0, _size_1);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
}
@Test
@ -77,15 +72,11 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 0, _size);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "Named");
final ParserRule fragment = ((ParserRule) _findRuleForName_1);
this.validateRule(fragment);
String _string_1 = this.warnings.toString();
int _size_1 = this.warnings.size();
Assert.assertEquals(_string_1, 1, _size_1);
Assert.assertEquals(this.warnings.toString(), 1, this.warnings.size());
}
@Test
@ -104,23 +95,15 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
final Function1<Triple<String, EObject, EStructuralFeature>, String> _function = (Triple<String, EObject, EStructuralFeature> it) -> {
Assert.assertEquals(ListExtensions.<Triple<String, EObject, EStructuralFeature>, String>map(this.warnings, ((Function1<Triple<String, EObject, EStructuralFeature>, String>) (Triple<String, EObject, EStructuralFeature> it) -> {
return it.getFirst();
};
List<String> _map = ListExtensions.<Triple<String, EObject, EStructuralFeature>, String>map(this.warnings, _function);
String _string = _map.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 0, _size);
})).toString(), 0, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "Named");
final ParserRule fragment = ((ParserRule) _findRuleForName_1);
this.validateRule(fragment);
final Function1<Triple<String, EObject, EStructuralFeature>, String> _function_1 = (Triple<String, EObject, EStructuralFeature> it) -> {
Assert.assertEquals(ListExtensions.<Triple<String, EObject, EStructuralFeature>, String>map(this.warnings, ((Function1<Triple<String, EObject, EStructuralFeature>, String>) (Triple<String, EObject, EStructuralFeature> it) -> {
return it.getFirst();
};
List<String> _map_1 = ListExtensions.<Triple<String, EObject, EStructuralFeature>, String>map(this.warnings, _function_1);
String _string_1 = _map_1.toString();
int _size_1 = this.warnings.size();
Assert.assertEquals(_string_1, 2, _size_1);
})).toString(), 2, this.warnings.size());
}
@Test
@ -141,33 +124,21 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
final Function1<Triple<String, EObject, EStructuralFeature>, String> _function = (Triple<String, EObject, EStructuralFeature> it) -> {
Assert.assertEquals(ListExtensions.<Triple<String, EObject, EStructuralFeature>, String>map(this.warnings, ((Function1<Triple<String, EObject, EStructuralFeature>, String>) (Triple<String, EObject, EStructuralFeature> it) -> {
return it.getFirst();
};
List<String> _map = ListExtensions.<Triple<String, EObject, EStructuralFeature>, String>map(this.warnings, _function);
String _string = _map.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 0, _size);
})).toString(), 0, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "Named");
final ParserRule fragment = ((ParserRule) _findRuleForName_1);
this.validateRule(fragment);
final Function1<Triple<String, EObject, EStructuralFeature>, String> _function_1 = (Triple<String, EObject, EStructuralFeature> it) -> {
Assert.assertEquals(ListExtensions.<Triple<String, EObject, EStructuralFeature>, String>map(this.warnings, ((Function1<Triple<String, EObject, EStructuralFeature>, String>) (Triple<String, EObject, EStructuralFeature> it) -> {
return it.getFirst();
};
List<String> _map_1 = ListExtensions.<Triple<String, EObject, EStructuralFeature>, String>map(this.warnings, _function_1);
String _string_1 = _map_1.toString();
int _size_1 = this.warnings.size();
Assert.assertEquals(_string_1, 2, _size_1);
})).toString(), 2, this.warnings.size());
AbstractRule _findRuleForName_2 = GrammarUtil.findRuleForName(grammar, "NamedAgain");
final ParserRule otherFragment = ((ParserRule) _findRuleForName_2);
this.validateRule(otherFragment);
final Function1<Triple<String, EObject, EStructuralFeature>, String> _function_2 = (Triple<String, EObject, EStructuralFeature> it) -> {
Assert.assertEquals(ListExtensions.<Triple<String, EObject, EStructuralFeature>, String>map(this.warnings, ((Function1<Triple<String, EObject, EStructuralFeature>, String>) (Triple<String, EObject, EStructuralFeature> it) -> {
return it.getFirst();
};
List<String> _map_2 = ListExtensions.<Triple<String, EObject, EStructuralFeature>, String>map(this.warnings, _function_2);
String _string_2 = _map_2.toString();
int _size_2 = this.warnings.size();
Assert.assertEquals(_string_2, 0, _size_2);
})).toString(), 0, this.warnings.size());
}
@Test
@ -186,15 +157,11 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 1, _size);
Assert.assertEquals(this.warnings.toString(), 1, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "Named");
final ParserRule fragment = ((ParserRule) _findRuleForName_1);
this.validateRule(fragment);
String _string_1 = this.warnings.toString();
int _size_1 = this.warnings.size();
Assert.assertEquals(_string_1, 0, _size_1);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
}
@Test
@ -213,15 +180,11 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "Named");
final ParserRule fragment = ((ParserRule) _findRuleForName_1);
this.validateRule(fragment);
String _string_1 = this.warnings.toString();
int _size_1 = this.warnings.size();
Assert.assertEquals(_string_1, 0, _size_1);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
}
@Test
@ -250,15 +213,11 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "EntryRule");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 0, _size);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "FragmentWithAction");
final ParserRule fragment = ((ParserRule) _findRuleForName_1);
this.validateRule(fragment);
String _string_1 = this.warnings.toString();
int _size_1 = this.warnings.size();
Assert.assertEquals(_string_1, 0, _size_1);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
}
@Test
@ -287,15 +246,11 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "EntryRule");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "FragmentWithAction");
final ParserRule fragment = ((ParserRule) _findRuleForName_1);
this.validateRule(fragment);
String _string_1 = this.warnings.toString();
int _size_1 = this.warnings.size();
Assert.assertEquals(_string_1, 0, _size_1);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
}
@Test
@ -324,15 +279,11 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "EntryRule");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "FragmentWithAction");
final ParserRule fragment = ((ParserRule) _findRuleForName_1);
this.validateRule(fragment);
String _string_1 = this.warnings.toString();
int _size_1 = this.warnings.size();
Assert.assertEquals(_string_1, 0, _size_1);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
}
@Test
@ -361,15 +312,11 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "EntryRule");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 0, _size);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "FragmentWithAction");
final ParserRule fragment = ((ParserRule) _findRuleForName_1);
this.validateRule(fragment);
String _string_1 = this.warnings.toString();
int _size_1 = this.warnings.size();
Assert.assertEquals(_string_1, 0, _size_1);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
}
@Test
@ -386,9 +333,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Q");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -405,9 +350,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Q");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -424,9 +367,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Q");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -443,9 +384,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Q");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 1, _size);
Assert.assertEquals(this.warnings.toString(), 1, this.warnings.size());
}
@Test
@ -464,9 +403,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -485,9 +422,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -506,9 +441,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -527,9 +460,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -548,9 +479,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -569,9 +498,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -590,9 +517,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -611,9 +536,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 4, _size);
Assert.assertEquals(this.warnings.toString(), 4, this.warnings.size());
}
@Test
@ -632,9 +555,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -653,9 +574,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -674,9 +593,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 3, _size);
Assert.assertEquals(this.warnings.toString(), 3, this.warnings.size());
}
@Test
@ -695,9 +612,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -716,9 +631,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -737,9 +650,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -758,9 +669,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -779,9 +688,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -802,9 +709,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -823,15 +728,11 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 0, _size);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "Second");
rule = ((ParserRule) _findRuleForName_1);
this.validateRule(rule);
String _string_1 = this.warnings.toString();
int _size_1 = this.warnings.size();
Assert.assertEquals(_string_1, 2, _size_1);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -848,9 +749,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -867,9 +766,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -886,9 +783,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -905,9 +800,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -924,9 +817,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -943,9 +834,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -962,9 +851,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -981,9 +868,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -1000,9 +885,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -1019,9 +902,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -1038,9 +919,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -1057,9 +936,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -1076,9 +953,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -1095,9 +970,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -1113,9 +986,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
int _size = this.warnings.size();
Assert.assertEquals(_string, 2, _size);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
@Test
@ -1132,9 +1003,7 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
@Test
@ -1153,8 +1022,6 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
String _string = this.warnings.toString();
boolean _isEmpty = this.warnings.isEmpty();
Assert.assertTrue(_string, _isEmpty);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
}

View file

@ -131,8 +131,7 @@ public class PredicatedElementTest extends AbstractXtextTests {
AbstractRule _head = IterableExtensions.<AbstractRule>head(_rules);
final AbstractElement body = _head.getAlternatives();
final AbstractElement predicate = AntlrGrammarGenUtil.getPredicatedElement(body);
String _xtext = this.toXtext(predicate);
Assert.assertEquals(expectation, _xtext);
Assert.assertEquals(expectation, this.toXtext(predicate));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}

View file

@ -33,8 +33,7 @@ public class ReducedXtextResourceValidatorTest extends AbstractXtextTests {
super.setUp();
XtextStandaloneSetup _xtextStandaloneSetup = new XtextStandaloneSetup();
this.with(_xtextStandaloneSetup);
ReducedXtextResourceValidator _get = this.<ReducedXtextResourceValidator>get(ReducedXtextResourceValidator.class);
this.resourceValidator = _get;
this.resourceValidator = this.<ReducedXtextResourceValidator>get(ReducedXtextResourceValidator.class);
}
private ReducedXtextResourceValidator resourceValidator;
@ -51,9 +50,7 @@ public class ReducedXtextResourceValidatorTest extends AbstractXtextTests {
final String grammarAsString = _builder.toString();
XtextResource _erroneousResource = this.getErroneousResource(grammarAsString);
final List<Issue> issues = this.resourceValidator.validate(_erroneousResource, CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl);
String _string = issues.toString();
int _size = issues.size();
Assert.assertEquals(_string, 0, _size);
Assert.assertEquals(issues.toString(), 0, issues.size());
}
@Test
@ -68,14 +65,8 @@ public class ReducedXtextResourceValidatorTest extends AbstractXtextTests {
final String grammarAsString = _builder.toString();
XtextResource _erroneousResource = this.getErroneousResource(grammarAsString);
final List<Issue> issues = this.resourceValidator.validate(_erroneousResource, CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl);
String _string = issues.toString();
int _size = issues.size();
Assert.assertEquals(_string, 1, _size);
String _string_1 = issues.toString();
Issue _head = IterableExtensions.<Issue>head(issues);
String _message = _head.getMessage();
boolean _contains = _message.contains("extraneous input \';\'");
Assert.assertTrue(_string_1, _contains);
Assert.assertEquals(issues.toString(), 1, issues.size());
Assert.assertTrue(issues.toString(), IterableExtensions.<Issue>head(issues).getMessage().contains("extraneous input \';\'"));
}
@Test
@ -90,14 +81,8 @@ public class ReducedXtextResourceValidatorTest extends AbstractXtextTests {
final String grammarAsString = _builder.toString();
XtextResource _erroneousResource = this.getErroneousResource(grammarAsString);
final List<Issue> issues = this.resourceValidator.validate(_erroneousResource, CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl);
String _string = issues.toString();
int _size = issues.size();
Assert.assertEquals(_string, 1, _size);
String _string_1 = issues.toString();
Issue _head = IterableExtensions.<Issue>head(issues);
String _message = _head.getMessage();
boolean _contains = _message.contains("IDS");
Assert.assertTrue(_string_1, _contains);
Assert.assertEquals(issues.toString(), 1, issues.size());
Assert.assertTrue(issues.toString(), IterableExtensions.<Issue>head(issues).getMessage().contains("IDS"));
}
@Test
@ -112,14 +97,8 @@ public class ReducedXtextResourceValidatorTest extends AbstractXtextTests {
final String grammarAsString = _builder.toString();
XtextResource _erroneousResource = this.getErroneousResource(grammarAsString);
final List<Issue> issues = this.resourceValidator.validate(_erroneousResource, CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl);
String _string = issues.toString();
int _size = issues.size();
Assert.assertEquals(_string, 1, _size);
String _string_1 = issues.toString();
Issue _head = IterableExtensions.<Issue>head(issues);
String _message = _head.getMessage();
boolean _contains = _message.contains("Trminals");
Assert.assertTrue(_string_1, _contains);
Assert.assertEquals(issues.toString(), 1, issues.size());
Assert.assertTrue(issues.toString(), IterableExtensions.<Issue>head(issues).getMessage().contains("Trminals"));
}
public XtextResource getErroneousResource(final CharSequence seq) {

View file

@ -242,9 +242,7 @@ public class XtextGrammarSerializationTest extends AbstractXtextTests {
private void doTestSerialization(final String model, final String expectedModel) throws Exception {
final XtextResource resource = this.getResourceFromString(model);
EList<Resource.Diagnostic> _errors = resource.getErrors();
boolean _isEmpty = _errors.isEmpty();
Assert.assertTrue(_isEmpty);
Assert.assertTrue(resource.getErrors().isEmpty());
IParseResult _parseResult = resource.getParseResult();
EObject _rootASTElement = _parseResult.getRootASTElement();
final Grammar g = ((Grammar) _rootASTElement);
@ -256,8 +254,7 @@ public class XtextGrammarSerializationTest extends AbstractXtextTests {
Map<Object, Object> _optionsMap = _options.toOptionsMap();
resource.save(outputStream, _optionsMap);
final String serializedModel = outputStream.toString();
String _platform = LineDelimiters.toPlatform(expectedModel);
Assert.assertEquals(_platform, serializedModel);
Assert.assertEquals(LineDelimiters.toPlatform(expectedModel), serializedModel);
}
@Test

View file

@ -10,7 +10,6 @@ package org.eclipse.xtext.xtext;
import com.google.common.base.Objects;
import com.google.common.collect.Iterators;
import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
@ -80,19 +79,12 @@ public class XtextLinkerTest extends AbstractXtextTests {
AbstractElement _head_1 = IterableExtensions.<AbstractElement>head(_elements);
Condition _guardCondition = ((Group) _head_1).getGuardCondition();
final ParameterReference firstGuard = ((ParameterReference) _guardCondition);
EList<Parameter> _parameters = rootRule.getParameters();
Parameter _head_2 = IterableExtensions.<Parameter>head(_parameters);
Parameter _parameter = firstGuard.getParameter();
Assert.assertEquals(_head_2, _parameter);
Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), firstGuard.getParameter());
EList<AbstractElement> _elements_1 = alternatives.getElements();
AbstractElement _last = IterableExtensions.<AbstractElement>last(_elements_1);
Condition _guardCondition_1 = ((Group) _last).getGuardCondition();
final Negation secondGuard = ((Negation) _guardCondition_1);
EList<Parameter> _parameters_1 = rootRule.getParameters();
Parameter _head_3 = IterableExtensions.<Parameter>head(_parameters_1);
Condition _value = secondGuard.getValue();
Parameter _parameter_1 = ((ParameterReference) _value).getParameter();
Assert.assertEquals(_head_3, _parameter_1);
Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), ((ParameterReference) secondGuard.getValue()).getParameter());
}
@Test
@ -123,15 +115,8 @@ public class XtextLinkerTest extends AbstractXtextTests {
final RuleCall ruleCall = ((RuleCall) _terminal);
EList<NamedArgument> _arguments = ruleCall.getArguments();
final NamedArgument argument = IterableExtensions.<NamedArgument>head(_arguments);
EList<Parameter> _parameters = rootRule.getParameters();
Parameter _head_1 = IterableExtensions.<Parameter>head(_parameters);
Parameter _parameter = argument.getParameter();
Assert.assertEquals(_head_1, _parameter);
EList<Parameter> _parameters_1 = lastRule.getParameters();
Parameter _head_2 = IterableExtensions.<Parameter>head(_parameters_1);
Condition _value = argument.getValue();
Parameter _parameter_1 = ((ParameterReference) _value).getParameter();
Assert.assertEquals(_head_2, _parameter_1);
Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), argument.getParameter());
Assert.assertEquals(IterableExtensions.<Parameter>head(lastRule.getParameters()), ((ParameterReference) argument.getValue()).getParameter());
}
@Test
@ -162,15 +147,8 @@ public class XtextLinkerTest extends AbstractXtextTests {
final RuleCall ruleCall = ((RuleCall) _terminal);
EList<NamedArgument> _arguments = ruleCall.getArguments();
final NamedArgument argument = IterableExtensions.<NamedArgument>head(_arguments);
EList<Parameter> _parameters = rootRule.getParameters();
Parameter _head_1 = IterableExtensions.<Parameter>head(_parameters);
Parameter _parameter = argument.getParameter();
Assert.assertEquals(_head_1, _parameter);
EList<Parameter> _parameters_1 = lastRule.getParameters();
Parameter _head_2 = IterableExtensions.<Parameter>head(_parameters_1);
Condition _value = argument.getValue();
Parameter _parameter_1 = ((ParameterReference) _value).getParameter();
Assert.assertEquals(_head_2, _parameter_1);
Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), argument.getParameter());
Assert.assertEquals(IterableExtensions.<Parameter>head(lastRule.getParameters()), ((ParameterReference) argument.getValue()).getParameter());
}
@Test
@ -201,13 +179,8 @@ public class XtextLinkerTest extends AbstractXtextTests {
final RuleCall ruleCall = ((RuleCall) _terminal);
EList<NamedArgument> _arguments = ruleCall.getArguments();
final NamedArgument argument = IterableExtensions.<NamedArgument>head(_arguments);
EList<Parameter> _parameters = rootRule.getParameters();
Parameter _head_1 = IterableExtensions.<Parameter>head(_parameters);
Parameter _parameter = argument.getParameter();
Assert.assertEquals(_head_1, _parameter);
Condition _value = argument.getValue();
boolean _isTrue = ((LiteralCondition) _value).isTrue();
Assert.assertFalse(_isTrue);
Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), argument.getParameter());
Assert.assertFalse(((LiteralCondition) argument.getValue()).isTrue());
}
@Test
@ -254,13 +227,8 @@ public class XtextLinkerTest extends AbstractXtextTests {
final RuleCall ruleCall = ((RuleCall) _terminal);
EList<NamedArgument> _arguments = ruleCall.getArguments();
final NamedArgument argument = IterableExtensions.<NamedArgument>head(_arguments);
EList<Parameter> _parameters = rootRule.getParameters();
Parameter _head_2 = IterableExtensions.<Parameter>head(_parameters);
Parameter _parameter = argument.getParameter();
Assert.assertEquals(_head_2, _parameter);
Condition _value = argument.getValue();
boolean _isTrue = ((LiteralCondition) _value).isTrue();
Assert.assertFalse(_isTrue);
Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), argument.getParameter());
Assert.assertFalse(((LiteralCondition) argument.getValue()).isTrue());
}
@Test
@ -286,35 +254,25 @@ public class XtextLinkerTest extends AbstractXtextTests {
TreeIterator<EObject> _eAllContents = firstRule.eAllContents();
Iterator<RuleCall> _filter = Iterators.<RuleCall>filter(_eAllContents, RuleCall.class);
final RuleCall firstRuleCall = IteratorExtensions.<RuleCall>head(_filter);
boolean _isExplicitlyCalled = firstRuleCall.isExplicitlyCalled();
Assert.assertTrue(_isExplicitlyCalled);
Assert.assertTrue(firstRuleCall.isExplicitlyCalled());
TreeIterator<EObject> _eAllContents_1 = firstRule.eAllContents();
Iterator<RuleCall> _filter_1 = Iterators.<RuleCall>filter(_eAllContents_1, RuleCall.class);
final RuleCall secondRuleCall = IteratorExtensions.<RuleCall>last(_filter_1);
boolean _isExplicitlyCalled_1 = secondRuleCall.isExplicitlyCalled();
Assert.assertFalse(_isExplicitlyCalled_1);
Assert.assertFalse(secondRuleCall.isExplicitlyCalled());
EList<AbstractRule> _rules_1 = grammar.getRules();
AbstractRule _get_1 = _rules_1.get(1);
TreeIterator<EObject> _eAllContents_2 = _get_1.eAllContents();
Iterator<RuleCall> _filter_2 = Iterators.<RuleCall>filter(_eAllContents_2, RuleCall.class);
final RuleCall thirdRuleCall = IteratorExtensions.<RuleCall>head(_filter_2);
boolean _isExplicitlyCalled_2 = thirdRuleCall.isExplicitlyCalled();
Assert.assertTrue(_isExplicitlyCalled_2);
Assert.assertTrue(thirdRuleCall.isExplicitlyCalled());
int _indexOf = grammarAsString.indexOf("_super");
resource.update(_indexOf, 1, " ");
Resource _eResource = firstRuleCall.eResource();
Assert.assertEquals(resource, _eResource);
Resource _eResource_1 = secondRuleCall.eResource();
Assert.assertEquals(resource, _eResource_1);
Resource _eResource_2 = thirdRuleCall.eResource();
Assert.assertEquals(resource, _eResource_2);
Assert.assertEquals(resource, firstRuleCall.eResource());
Assert.assertEquals(resource, secondRuleCall.eResource());
Assert.assertEquals(resource, thirdRuleCall.eResource());
resource.getContents();
boolean _isExplicitlyCalled_3 = thirdRuleCall.isExplicitlyCalled();
Assert.assertFalse(_isExplicitlyCalled_3);
EList<AbstractRule> _rules_2 = grammar.getRules();
AbstractRule _last = IterableExtensions.<AbstractRule>last(_rules_2);
AbstractRule _rule = thirdRuleCall.getRule();
Assert.assertEquals(_last, _rule);
Assert.assertFalse(thirdRuleCall.isExplicitlyCalled());
Assert.assertEquals(IterableExtensions.<AbstractRule>last(grammar.getRules()), thirdRuleCall.getRule());
}
@Test
@ -351,38 +309,35 @@ public class XtextLinkerTest extends AbstractXtextTests {
EList<Grammar> _usedGrammars = grammar.getUsedGrammars();
Grammar _head = IterableExtensions.<Grammar>head(_usedGrammars);
final AbstractRule idRule = GrammarUtil.findRuleForName(_head, "ID");
List<RuleCall> _containedRuleCalls = GrammarUtil.containedRuleCalls(firstRule);
final Function1<RuleCall, Boolean> _function = (RuleCall it) -> {
AbstractRule _rule = it.getRule();
return Boolean.valueOf(Objects.equal(_rule, idRule));
};
boolean _forall = IterableExtensions.<RuleCall>forall(_containedRuleCalls, _function);
Assert.assertTrue(_forall);
Assert.assertTrue(
IterableExtensions.<RuleCall>forall(GrammarUtil.containedRuleCalls(firstRule),
((Function1<RuleCall, Boolean>) (RuleCall it) -> {
AbstractRule _rule = it.getRule();
return Boolean.valueOf(Objects.equal(_rule, idRule));
})));
EList<AbstractRule> _rules_1 = grammar.getRules();
Iterable<AbstractRule> _tail = IterableExtensions.<AbstractRule>tail(_rules_1);
final AbstractRule secondRule = IterableExtensions.<AbstractRule>head(_tail);
EList<AbstractRule> _rules_2 = grammar.getRules();
final AbstractRule stringRule = IterableExtensions.<AbstractRule>last(_rules_2);
List<RuleCall> _containedRuleCalls_1 = GrammarUtil.containedRuleCalls(secondRule);
final Function1<RuleCall, Boolean> _function_1 = (RuleCall it) -> {
AbstractRule _rule = it.getRule();
return Boolean.valueOf(Objects.equal(_rule, stringRule));
};
boolean _forall_1 = IterableExtensions.<RuleCall>forall(_containedRuleCalls_1, _function_1);
Assert.assertTrue(_forall_1);
Assert.assertTrue(
IterableExtensions.<RuleCall>forall(GrammarUtil.containedRuleCalls(secondRule),
((Function1<RuleCall, Boolean>) (RuleCall it) -> {
AbstractRule _rule = it.getRule();
return Boolean.valueOf(Objects.equal(_rule, stringRule));
})));
EList<AbstractRule> _rules_3 = grammar.getRules();
Iterable<AbstractRule> _drop = IterableExtensions.<AbstractRule>drop(_rules_3, 2);
final AbstractRule thirdRule = IterableExtensions.<AbstractRule>head(_drop);
EList<Grammar> _usedGrammars_1 = grammar.getUsedGrammars();
Grammar _head_1 = IterableExtensions.<Grammar>head(_usedGrammars_1);
final AbstractRule inheritedString = GrammarUtil.findRuleForName(_head_1, "STRING");
List<RuleCall> _containedRuleCalls_2 = GrammarUtil.containedRuleCalls(thirdRule);
final Function1<RuleCall, Boolean> _function_2 = (RuleCall it) -> {
AbstractRule _rule = it.getRule();
return Boolean.valueOf(Objects.equal(_rule, inheritedString));
};
boolean _forall_2 = IterableExtensions.<RuleCall>forall(_containedRuleCalls_2, _function_2);
Assert.assertTrue(_forall_2);
Assert.assertTrue(
IterableExtensions.<RuleCall>forall(GrammarUtil.containedRuleCalls(thirdRule),
((Function1<RuleCall, Boolean>) (RuleCall it) -> {
AbstractRule _rule = it.getRule();
return Boolean.valueOf(Objects.equal(_rule, inheritedString));
})));
}
@Test
@ -406,11 +361,7 @@ public class XtextLinkerTest extends AbstractXtextTests {
final TerminalRule string = ((TerminalRule) _get_1);
AbstractElement _alternatives = string.getAlternatives();
final RuleCall callToSuper = ((RuleCall) _alternatives);
EList<Grammar> _usedGrammars = grammar.getUsedGrammars();
Grammar _head = IterableExtensions.<Grammar>head(_usedGrammars);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(_head, "STRING");
AbstractRule _rule = callToSuper.getRule();
Assert.assertEquals(_findRuleForName, _rule);
Assert.assertEquals(GrammarUtil.findRuleForName(IterableExtensions.<Grammar>head(grammar.getUsedGrammars()), "STRING"), callToSuper.getRule());
}
@Test
@ -436,46 +387,37 @@ public class XtextLinkerTest extends AbstractXtextTests {
final TerminalRule string = ((TerminalRule) _get_1);
AbstractElement _alternatives = string.getAlternatives();
final RuleCall callToSuper = ((RuleCall) _alternatives);
EList<AbstractRule> _rules_1 = grammar.getRules();
AbstractRule _last = IterableExtensions.<AbstractRule>last(_rules_1);
AbstractRule _rule = callToSuper.getRule();
Assert.assertEquals(_last, _rule);
Assert.assertEquals(IterableExtensions.<AbstractRule>last(grammar.getRules()), callToSuper.getRule());
}
@Test
public void testGeneratedPackageRemovedProperly() throws Exception {
final String testGrammar = "grammar foo.Bar generate foo \'bar\' Model : name=ID;";
int _indexOf = testGrammar.indexOf("name");
this.checkPackageRemovalAfterGrammarChange(true, testGrammar, _indexOf, 4, "foo");
int _indexOf_1 = testGrammar.indexOf("generate foo");
int _plus = (_indexOf_1 + 11);
this.checkPackageRemovalAfterGrammarChange(true, testGrammar, testGrammar.indexOf("name"), 4, "foo");
int _indexOf = testGrammar.indexOf("generate foo");
int _plus = (_indexOf + 11);
this.checkPackageRemovalAfterGrammarChange(true, testGrammar, _plus, 1, "x");
int _indexOf_2 = testGrammar.indexOf("foo.Bar");
this.checkPackageRemovalAfterGrammarChange(true, testGrammar, _indexOf_2, 1, "x");
this.checkPackageRemovalAfterGrammarChange(true, testGrammar, testGrammar.indexOf("foo.Bar"), 1, "x");
}
@Test
public void testImportedPackageRemovedProperly() throws Exception {
final String testGrammar = "grammar foo.Bar import \'classpath:/org/eclipse/xtext/xtext/Foo.ecore\' as foo Model returns foo::Model: name=ID;";
int _indexOf = testGrammar.indexOf("name");
this.checkPackageRemovalAfterGrammarChange(false, testGrammar, _indexOf, 4, "foo");
int _indexOf_1 = testGrammar.indexOf("as foo");
int _plus = (_indexOf_1 + 4);
this.checkPackageRemovalAfterGrammarChange(false, testGrammar, testGrammar.indexOf("name"), 4, "foo");
int _indexOf = testGrammar.indexOf("as foo");
int _plus = (_indexOf + 4);
this.checkPackageRemovalAfterGrammarChange(true, testGrammar, _plus, 1, "x");
int _indexOf_2 = testGrammar.indexOf("foo.Bar");
this.checkPackageRemovalAfterGrammarChange(true, testGrammar, _indexOf_2, 1, "x");
this.checkPackageRemovalAfterGrammarChange(true, testGrammar, testGrammar.indexOf("foo.Bar"), 1, "x");
}
@Test
public void testRegisteredPackageNotUnloaded() throws Exception {
final String testGrammar = "grammar foo.Bar import \'http://www.eclipse.org/emf/2002/Ecore\' EClass: \'foo\';";
int _indexOf = testGrammar.indexOf("\'foo\'");
this.checkRegisteredPackageNotUnloadedAfterGrammarChange(testGrammar, _indexOf, 4, "foo");
int _indexOf_1 = testGrammar.indexOf("import ");
int _plus = (_indexOf_1 + 11);
this.checkRegisteredPackageNotUnloadedAfterGrammarChange(testGrammar, testGrammar.indexOf("\'foo\'"), 4, "foo");
int _indexOf = testGrammar.indexOf("import ");
int _plus = (_indexOf + 11);
this.checkRegisteredPackageNotUnloadedAfterGrammarChange(testGrammar, _plus, 1, "x");
int _indexOf_2 = testGrammar.indexOf("foo.Bar");
this.checkRegisteredPackageNotUnloadedAfterGrammarChange(testGrammar, _indexOf_2, 1, "x");
this.checkRegisteredPackageNotUnloadedAfterGrammarChange(testGrammar, testGrammar.indexOf("foo.Bar"), 1, "x");
}
private void checkPackageRemovalAfterGrammarChange(final boolean isRemoved, final String originalGrammar, final int offset, final int length, final String replacement) throws Exception {
@ -486,33 +428,19 @@ public class XtextLinkerTest extends AbstractXtextTests {
EList<AbstractMetamodelDeclaration> _metamodelDeclarations = grammar.getMetamodelDeclarations();
AbstractMetamodelDeclaration generatedMetamodel = _metamodelDeclarations.get(0);
EPackage ePackage = generatedMetamodel.getEPackage();
Resource _eResource = ePackage.eResource();
ResourceSet _resourceSet = _eResource.getResourceSet();
ResourceSet _resourceSet_1 = resource.getResourceSet();
Assert.assertEquals(_resourceSet, _resourceSet_1);
Assert.assertEquals(ePackage.eResource().getResourceSet(), resource.getResourceSet());
resource.update(offset, length, replacement);
if (isRemoved) {
Resource _eResource_1 = ePackage.eResource();
ResourceSet _resourceSet_2 = _eResource_1.getResourceSet();
Assert.assertNull(_resourceSet_2);
Assert.assertNull(ePackage.eResource().getResourceSet());
} else {
Resource _eResource_2 = ePackage.eResource();
ResourceSet _resourceSet_3 = _eResource_2.getResourceSet();
ResourceSet _resourceSet_4 = resource.getResourceSet();
Assert.assertEquals(_resourceSet_3, _resourceSet_4);
Assert.assertEquals(ePackage.eResource().getResourceSet(), resource.getResourceSet());
}
EList<EObject> _contents_1 = resource.getContents();
EObject _get_1 = _contents_1.get(0);
grammar = ((Grammar) _get_1);
EList<AbstractMetamodelDeclaration> _metamodelDeclarations_1 = grammar.getMetamodelDeclarations();
AbstractMetamodelDeclaration _get_2 = _metamodelDeclarations_1.get(0);
generatedMetamodel = _get_2;
EPackage _ePackage = generatedMetamodel.getEPackage();
ePackage = _ePackage;
ResourceSet _resourceSet_5 = resource.getResourceSet();
Resource _eResource_3 = ePackage.eResource();
ResourceSet _resourceSet_6 = _eResource_3.getResourceSet();
Assert.assertEquals(_resourceSet_5, _resourceSet_6);
generatedMetamodel = grammar.getMetamodelDeclarations().get(0);
ePackage = generatedMetamodel.getEPackage();
Assert.assertEquals(resource.getResourceSet(), ePackage.eResource().getResourceSet());
}
private void checkRegisteredPackageNotUnloadedAfterGrammarChange(final String originalGrammar, final int offset, final int length, final String replacement) throws Exception {
@ -523,10 +451,8 @@ public class XtextLinkerTest extends AbstractXtextTests {
EList<AbstractMetamodelDeclaration> _metamodelDeclarations = grammar.getMetamodelDeclarations();
final AbstractMetamodelDeclaration generatedMetamodel = _metamodelDeclarations.get(0);
final EPackage ePackage = generatedMetamodel.getEPackage();
URI _eProxyURI = ((InternalEObject) ePackage).eProxyURI();
Assert.assertNull(_eProxyURI);
Assert.assertNull(((InternalEObject) ePackage).eProxyURI());
resource.update(offset, length, replacement);
URI _eProxyURI_1 = ((InternalEObject) ePackage).eProxyURI();
Assert.assertNull(_eProxyURI_1);
Assert.assertNull(((InternalEObject) ePackage).eProxyURI());
}
}

View file

@ -9,8 +9,6 @@ package org.eclipse.xtext.xtext.generator;
import com.google.inject.Guice;
import com.google.inject.Injector;
import java.util.Collection;
import java.util.Map;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.Grammar;
@ -257,11 +255,7 @@ public class AntlrGeneratorFragmentTest extends AbstractXtextTests {
final AntlrOptions options = new AntlrOptions();
AntlrDebugGrammarGenerator _instance = injector.<AntlrDebugGrammarGenerator>getInstance(AntlrDebugGrammarGenerator.class);
_instance.generate(grammar, options, inMem);
Map<String, Object> _allFiles = inMem.getAllFiles();
Collection<Object> _values = _allFiles.values();
Object _head = IterableExtensions.<Object>head(_values);
String _string_1 = _head.toString();
Assert.assertEquals(expectedDebugGrammar, _string_1);
Assert.assertEquals(expectedDebugGrammar, IterableExtensions.<Object>head(inMem.getAllFiles().values()).toString());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}

View file

@ -22,26 +22,16 @@ public class GrammarAccessExtensionsTest {
@Test
public void testToJavaIdentifier() {
String _javaIdentifier = this._grammarAccessExtensions.toJavaIdentifier("foo Bar", true);
Assert.assertEquals("FooBar", _javaIdentifier);
String _javaIdentifier_1 = this._grammarAccessExtensions.toJavaIdentifier("foo;", true);
Assert.assertEquals("Foo", _javaIdentifier_1);
String _javaIdentifier_2 = this._grammarAccessExtensions.toJavaIdentifier("foo;", false);
Assert.assertEquals("foo", _javaIdentifier_2);
String _javaIdentifier_3 = this._grammarAccessExtensions.toJavaIdentifier(":", true);
Assert.assertEquals("Colon", _javaIdentifier_3);
String _javaIdentifier_4 = this._grammarAccessExtensions.toJavaIdentifier(":", false);
Assert.assertEquals("Colon", _javaIdentifier_4);
String _javaIdentifier_5 = this._grammarAccessExtensions.toJavaIdentifier(";", false);
Assert.assertEquals("Semicolon", _javaIdentifier_5);
String _javaIdentifier_6 = this._grammarAccessExtensions.toJavaIdentifier("@\'", false);
Assert.assertEquals("CommercialAtApostrophe", _javaIdentifier_6);
String _javaIdentifier_7 = this._grammarAccessExtensions.toJavaIdentifier("Grün", true);
Assert.assertEquals("Grün", _javaIdentifier_7);
String _javaIdentifier_8 = this._grammarAccessExtensions.toJavaIdentifier("$", true);
Assert.assertEquals("DollarSign", _javaIdentifier_8);
String _javaIdentifier_9 = this._grammarAccessExtensions.toJavaIdentifier("_", true);
Assert.assertEquals("_", _javaIdentifier_9);
Assert.assertEquals("FooBar", this._grammarAccessExtensions.toJavaIdentifier("foo Bar", true));
Assert.assertEquals("Foo", this._grammarAccessExtensions.toJavaIdentifier("foo;", true));
Assert.assertEquals("foo", this._grammarAccessExtensions.toJavaIdentifier("foo;", false));
Assert.assertEquals("Colon", this._grammarAccessExtensions.toJavaIdentifier(":", true));
Assert.assertEquals("Colon", this._grammarAccessExtensions.toJavaIdentifier(":", false));
Assert.assertEquals("Semicolon", this._grammarAccessExtensions.toJavaIdentifier(";", false));
Assert.assertEquals("CommercialAtApostrophe", this._grammarAccessExtensions.toJavaIdentifier("@\'", false));
Assert.assertEquals("Grün", this._grammarAccessExtensions.toJavaIdentifier("Grün", true));
Assert.assertEquals("DollarSign", this._grammarAccessExtensions.toJavaIdentifier("$", true));
Assert.assertEquals("_", this._grammarAccessExtensions.toJavaIdentifier("_", true));
}
/**
@ -49,21 +39,18 @@ public class GrammarAccessExtensionsTest {
*/
@Test
public void testBug() throws Exception {
String _javaIdentifier = this._grammarAccessExtensions.toJavaIdentifier("\u308b", true);
Assert.assertEquals("HiraganaLetterRu", _javaIdentifier);
Assert.assertEquals("HiraganaLetterRu", this._grammarAccessExtensions.toJavaIdentifier("\u308b", true));
}
@Test
public void testSmoke() throws Exception {
for (int i = 0; (i < 4000); i++) {
{
String _valueOf = String.valueOf(((char) i));
final String identifier = this._grammarAccessExtensions.toJavaIdentifier(_valueOf, false);
final String identifier = this._grammarAccessExtensions.toJavaIdentifier(String.valueOf(((char) i)), false);
for (int j = 0; (j < identifier.length()); j++) {
{
final char charAt = identifier.charAt(j);
boolean _isValidJavaLatinIdentifier = this._grammarAccessExtensions.isValidJavaLatinIdentifier(charAt, (j == 0));
Assert.assertTrue(((identifier + ":") + Character.valueOf(charAt)), _isValidJavaLatinIdentifier);
Assert.assertTrue(((identifier + ":") + Character.valueOf(charAt)), this._grammarAccessExtensions.isValidJavaLatinIdentifier(charAt, (j == 0)));
}
}
}

View file

@ -27,9 +27,7 @@ public class WizardConfigTest {
@Before
public void createInjector() {
DefaultGeneratorModule _defaultGeneratorModule = new DefaultGeneratorModule();
Injector _createInjector = Guice.createInjector(_defaultGeneratorModule);
this.injector = _createInjector;
this.injector = Guice.createInjector(new DefaultGeneratorModule());
}
@Test

View file

@ -36,7 +36,6 @@ import org.eclipse.xtext.xtext.wizard.ProjectLayout;
import org.eclipse.xtext.xtext.wizard.RuntimeProjectDescriptor;
import org.eclipse.xtext.xtext.wizard.SdkFeatureProject;
import org.eclipse.xtext.xtext.wizard.SourceLayout;
import org.eclipse.xtext.xtext.wizard.TargetPlatformProject;
import org.eclipse.xtext.xtext.wizard.TestProjectDescriptor;
import org.eclipse.xtext.xtext.wizard.TestedProjectDescriptor;
import org.eclipse.xtext.xtext.wizard.UiProjectDescriptor;
@ -59,8 +58,7 @@ public class WizardConfigurationTest {
LanguageDescriptor _language = it.getLanguage();
final Procedure1<LanguageDescriptor> _function_1 = (LanguageDescriptor it_1) -> {
it_1.setName("org.example.mydsl.MyDsl");
LanguageDescriptor.FileExtensions _fromString = LanguageDescriptor.FileExtensions.fromString("mydsl");
it_1.setFileExtensions(_fromString);
it_1.setFileExtensions(LanguageDescriptor.FileExtensions.fromString("mydsl"));
};
ObjectExtensions.<LanguageDescriptor>operator_doubleArrow(_language, _function_1);
};
@ -71,41 +69,24 @@ public class WizardConfigurationTest {
@Test
public void runtimeProjectCanBeBuiltAsPlainMavenProject() {
this.config.setPreferredBuildSystem(BuildSystem.MAVEN);
RuntimeProjectDescriptor _runtimeProject = this.config.getRuntimeProject();
boolean _isEclipsePluginProject = _runtimeProject.isEclipsePluginProject();
Assert.assertFalse(_isEclipsePluginProject);
RuntimeProjectDescriptor _runtimeProject_1 = this.config.getRuntimeProject();
PomFile _pom = _runtimeProject_1.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains("eclipse-plugin");
Assert.assertFalse(_contains);
ParentProjectDescriptor _parentProject = this.config.getParentProject();
PomFile _pom_1 = _parentProject.pom();
String _content_1 = _pom_1.getContent();
boolean _contains_1 = _content_1.contains("tycho");
Assert.assertFalse(_contains_1);
List<? extends ProjectDescriptor> _allJavaProjects = this.allJavaProjects();
final Function1<ProjectDescriptor, Boolean> _function = (ProjectDescriptor it) -> {
boolean _isEclipsePluginProject_1 = it.isEclipsePluginProject();
return Boolean.valueOf((!_isEclipsePluginProject_1));
};
Iterable<? extends ProjectDescriptor> _filter = IterableExtensions.filter(_allJavaProjects, _function);
final Function1<ProjectDescriptor, Boolean> _function_1 = (ProjectDescriptor it) -> {
PomFile _pom_2 = it.pom();
String _content_2 = _pom_2.getContent();
return Boolean.valueOf(_content_2.contains("tycho"));
};
boolean _exists = IterableExtensions.exists(_filter, _function_1);
Assert.assertFalse(_exists);
Assert.assertFalse(this.config.getRuntimeProject().isEclipsePluginProject());
Assert.assertFalse(this.config.getRuntimeProject().pom().getContent().contains("eclipse-plugin"));
Assert.assertFalse(this.config.getParentProject().pom().getContent().contains("tycho"));
Assert.assertFalse(IterableExtensions.exists(IterableExtensions.filter(this.allJavaProjects(), ((Function1<ProjectDescriptor, Boolean>) (ProjectDescriptor it) -> {
boolean _isEclipsePluginProject = it.isEclipsePluginProject();
return Boolean.valueOf((!_isEclipsePluginProject));
})), ((Function1<ProjectDescriptor, Boolean>) (ProjectDescriptor it) -> {
PomFile _pom = it.pom();
String _content = _pom.getContent();
return Boolean.valueOf(_content.contains("tycho"));
})));
}
@Test
public void runtimeProjectIsPluginProjectWhenUiProjectIsEnabled() {
UiProjectDescriptor _uiProject = this.config.getUiProject();
_uiProject.setEnabled(true);
RuntimeProjectDescriptor _runtimeProject = this.config.getRuntimeProject();
boolean _isEclipsePluginProject = _runtimeProject.isEclipsePluginProject();
Assert.assertTrue(_isEclipsePluginProject);
Assert.assertTrue(this.config.getRuntimeProject().isEclipsePluginProject());
}
@Test
@ -115,23 +96,15 @@ public class WizardConfigurationTest {
IdeProjectDescriptor _ideProject = this.config.getIdeProject();
_ideProject.setEnabled(true);
this.config.setPreferredBuildSystem(BuildSystem.MAVEN);
boolean _needsTychoBuild = this.config.needsTychoBuild();
Assert.assertTrue(_needsTychoBuild);
Assert.assertTrue(this.config.needsTychoBuild());
RuntimeProjectDescriptor _runtimeProject = this.config.getRuntimeProject();
IdeProjectDescriptor _ideProject_1 = this.config.getIdeProject();
UiProjectDescriptor _uiProject_1 = this.config.getUiProject();
final Consumer<ProjectDescriptor> _function = (ProjectDescriptor it) -> {
PomFile _pom = it.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains("eclipse-plugin");
Assert.assertTrue(_contains);
Assert.assertTrue(it.pom().getContent().contains("eclipse-plugin"));
};
Collections.<ProjectDescriptor>unmodifiableList(CollectionLiterals.<ProjectDescriptor>newArrayList(_runtimeProject, _ideProject_1, _uiProject_1)).forEach(_function);
ParentProjectDescriptor _parentProject = this.config.getParentProject();
PomFile _pom = _parentProject.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains("tycho");
Assert.assertTrue(_contains);
Assert.assertTrue(this.config.getParentProject().pom().getContent().contains("tycho"));
}
@Test
@ -141,23 +114,10 @@ public class WizardConfigurationTest {
P2RepositoryProject _p2Project = this.config.getP2Project();
_p2Project.setEnabled(true);
this.config.setPreferredBuildSystem(BuildSystem.MAVEN);
boolean _needsTychoBuild = this.config.needsTychoBuild();
Assert.assertTrue(_needsTychoBuild);
SdkFeatureProject _sdkProject = this.config.getSdkProject();
PomFile _pom = _sdkProject.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains("eclipse-feature");
Assert.assertTrue(_contains);
P2RepositoryProject _p2Project_1 = this.config.getP2Project();
PomFile _pom_1 = _p2Project_1.pom();
String _content_1 = _pom_1.getContent();
boolean _contains_1 = _content_1.contains("eclipse-repository");
Assert.assertTrue(_contains_1);
ParentProjectDescriptor _parentProject = this.config.getParentProject();
PomFile _pom_2 = _parentProject.pom();
String _content_2 = _pom_2.getContent();
boolean _contains_2 = _content_2.contains("tycho");
Assert.assertTrue(_contains_2);
Assert.assertTrue(this.config.needsTychoBuild());
Assert.assertTrue(this.config.getSdkProject().pom().getContent().contains("eclipse-feature"));
Assert.assertTrue(this.config.getP2Project().pom().getContent().contains("eclipse-repository"));
Assert.assertTrue(this.config.getParentProject().pom().getContent().contains("tycho"));
}
@Test
@ -167,16 +127,13 @@ public class WizardConfigurationTest {
P2RepositoryProject _p2Project = this.config.getP2Project();
_p2Project.setEnabled(true);
this.config.setPreferredBuildSystem(BuildSystem.MAVEN);
boolean _needsTychoBuild = this.config.needsTychoBuild();
Assert.assertTrue(_needsTychoBuild);
Assert.assertTrue(this.config.needsTychoBuild());
ParentProjectDescriptor _parentProject = this.config.getParentProject();
PomFile _pom = _parentProject.pom();
String _content = _pom.getContent();
final Procedure1<String> _function = (String it) -> {
boolean _contains = it.contains("tycho-source-plugin");
Assert.assertTrue(_contains);
boolean _contains_1 = it.contains("tycho-source-feature-plugin");
Assert.assertTrue(_contains_1);
Assert.assertTrue(it.contains("tycho-source-plugin"));
Assert.assertTrue(it.contains("tycho-source-feature-plugin"));
};
ObjectExtensions.<String>operator_doubleArrow(_content, _function);
}
@ -186,9 +143,7 @@ public class WizardConfigurationTest {
UiProjectDescriptor _uiProject = this.config.getUiProject();
_uiProject.setEnabled(true);
this.config.setPreferredBuildSystem(BuildSystem.MAVEN);
TargetPlatformProject _targetPlatformProject = this.config.getTargetPlatformProject();
boolean _isEnabled = _targetPlatformProject.isEnabled();
Assert.assertTrue(_isEnabled);
Assert.assertTrue(this.config.getTargetPlatformProject().isEnabled());
}
@Test
@ -196,10 +151,7 @@ public class WizardConfigurationTest {
RuntimeProjectDescriptor _runtimeProject = this.config.getRuntimeProject();
TestProjectDescriptor _testProject = _runtimeProject.getTestProject();
_testProject.setEnabled(true);
RuntimeProjectDescriptor _runtimeProject_1 = this.config.getRuntimeProject();
TestProjectDescriptor _testProject_1 = _runtimeProject_1.getTestProject();
boolean _isEclipsePluginProject = _testProject_1.isEclipsePluginProject();
Assert.assertTrue(_isEclipsePluginProject);
Assert.assertTrue(this.config.getRuntimeProject().getTestProject().isEclipsePluginProject());
}
@Test
@ -208,19 +160,15 @@ public class WizardConfigurationTest {
_p2Project.setEnabled(true);
SdkFeatureProject _sdkProject = this.config.getSdkProject();
_sdkProject.setEnabled(false);
SdkFeatureProject _sdkProject_1 = this.config.getSdkProject();
boolean _isEnabled = _sdkProject_1.isEnabled();
Assert.assertTrue(_isEnabled);
Assert.assertTrue(this.config.getSdkProject().isEnabled());
}
@Test
public void eclipseUiCanBeBuiltWithPDE() {
UiProjectDescriptor _uiProject = this.config.getUiProject();
_uiProject.setEnabled(true);
boolean _needsGradleBuild = this.config.needsGradleBuild();
Assert.assertFalse(_needsGradleBuild);
boolean _needsMavenBuild = this.config.needsMavenBuild();
Assert.assertFalse(_needsMavenBuild);
Assert.assertFalse(this.config.needsGradleBuild());
Assert.assertFalse(this.config.needsMavenBuild());
}
@Test
@ -228,32 +176,26 @@ public class WizardConfigurationTest {
UiProjectDescriptor _uiProject = this.config.getUiProject();
_uiProject.setEnabled(true);
this.config.setPreferredBuildSystem(BuildSystem.GRADLE);
boolean _needsTychoBuild = this.config.needsTychoBuild();
Assert.assertTrue(_needsTychoBuild);
Assert.assertTrue(this.config.needsTychoBuild());
}
@Test
public void intellijNeedsAGradleBuild() {
IntellijProjectDescriptor _intellijProject = this.config.getIntellijProject();
_intellijProject.setEnabled(true);
boolean _needsGradleBuild = this.config.needsGradleBuild();
Assert.assertTrue(_needsGradleBuild);
Assert.assertTrue(this.config.needsGradleBuild());
}
@Test
public void mavenNeedsAParentProject() {
this.config.setPreferredBuildSystem(BuildSystem.MAVEN);
ParentProjectDescriptor _parentProject = this.config.getParentProject();
boolean _isEnabled = _parentProject.isEnabled();
Assert.assertTrue(_isEnabled);
Assert.assertTrue(this.config.getParentProject().isEnabled());
}
@Test
public void gradleNeedsAParentProject() {
this.config.setPreferredBuildSystem(BuildSystem.GRADLE);
ParentProjectDescriptor _parentProject = this.config.getParentProject();
boolean _isEnabled = _parentProject.isEnabled();
Assert.assertTrue(_isEnabled);
Assert.assertTrue(this.config.getParentProject().isEnabled());
}
@Test
@ -271,10 +213,7 @@ public class WizardConfigurationTest {
};
final AbstractFile pom = IterableExtensions.findFirst(_files, _function);
Assert.assertTrue((pom instanceof PomFile));
String _content = ((PomFile) pom).getContent();
String _string = _content.toString();
boolean _contains = _string.contains("<artifactId>org.example.mydsl</artifactId>");
Assert.assertTrue(_contains);
Assert.assertTrue(((PomFile) pom).getContent().toString().contains("<artifactId>org.example.mydsl</artifactId>"));
}
@Test
@ -287,13 +226,11 @@ public class WizardConfigurationTest {
TestProjectDescriptor _testProject_1 = _runtimeProject_1.getTestProject();
Set<ExternalDependency> _externalDependencies = _testProject_1.getExternalDependencies();
final Consumer<ExternalDependency> _function = (ExternalDependency testDependency) -> {
RuntimeProjectDescriptor _runtimeProject_2 = this.config.getRuntimeProject();
Set<ExternalDependency> _externalDependencies_1 = _runtimeProject_2.getExternalDependencies();
final Function1<ExternalDependency, Boolean> _function_1 = (ExternalDependency it) -> {
return Boolean.valueOf(((Objects.equal(it.getMaven().getArtifactId(), testDependency.getMaven().getArtifactId()) && Objects.equal(it.getP2().getBundleId(), testDependency.getP2().getBundleId())) && Objects.equal(it.getP2().getPackages(), testDependency.getP2().getPackages())));
};
boolean _exists = IterableExtensions.<ExternalDependency>exists(_externalDependencies_1, _function_1);
Assert.assertTrue(_exists);
Assert.assertTrue(
IterableExtensions.<ExternalDependency>exists(this.config.getRuntimeProject().getExternalDependencies(),
((Function1<ExternalDependency, Boolean>) (ExternalDependency it) -> {
return Boolean.valueOf(((Objects.equal(it.getMaven().getArtifactId(), testDependency.getMaven().getArtifactId()) && Objects.equal(it.getP2().getBundleId(), testDependency.getP2().getBundleId())) && Objects.equal(it.getP2().getPackages(), testDependency.getP2().getPackages())));
})));
};
_externalDependencies.forEach(_function);
}
@ -308,10 +245,7 @@ public class WizardConfigurationTest {
TestProjectDescriptor _testProject_1 = _runtimeProject_1.getTestProject();
Set<String> _sourceFolders = _testProject_1.getSourceFolders();
final Consumer<String> _function = (String testFolder) -> {
RuntimeProjectDescriptor _runtimeProject_2 = this.config.getRuntimeProject();
Set<String> _sourceFolders_1 = _runtimeProject_2.getSourceFolders();
boolean _contains = _sourceFolders_1.contains(testFolder);
Assert.assertTrue(_contains);
Assert.assertTrue(this.config.getRuntimeProject().getSourceFolders().contains(testFolder));
};
_sourceFolders.forEach(_function);
}
@ -326,13 +260,10 @@ public class WizardConfigurationTest {
Iterable<? extends ProjectDescriptor> _filter = IterableExtensions.filter(_allJavaProjects, _function);
final Consumer<ProjectDescriptor> _function_1 = (ProjectDescriptor it) -> {
it.setEnabled(true);
Iterable<? extends AbstractFile> _files = it.getFiles();
final Function1<AbstractFile, Boolean> _function_2 = (AbstractFile it_1) -> {
Assert.assertTrue(IterableExtensions.exists(it.getFiles(), ((Function1<AbstractFile, Boolean>) (AbstractFile it_1) -> {
String _relativePath = it_1.getRelativePath();
return Boolean.valueOf(Objects.equal(_relativePath, "pom.xml"));
};
boolean _exists = IterableExtensions.exists(_files, _function_2);
Assert.assertTrue(_exists);
})));
};
_filter.forEach(_function_1);
}
@ -347,13 +278,10 @@ public class WizardConfigurationTest {
Iterable<? extends ProjectDescriptor> _filter = IterableExtensions.filter(_allJavaProjects, _function);
final Consumer<ProjectDescriptor> _function_1 = (ProjectDescriptor it) -> {
it.setEnabled(true);
Iterable<? extends AbstractFile> _files = it.getFiles();
final Function1<AbstractFile, Boolean> _function_2 = (AbstractFile it_1) -> {
Assert.assertTrue(IterableExtensions.exists(it.getFiles(), ((Function1<AbstractFile, Boolean>) (AbstractFile it_1) -> {
String _relativePath = it_1.getRelativePath();
return Boolean.valueOf(Objects.equal(_relativePath, "build.gradle"));
};
boolean _exists = IterableExtensions.exists(_files, _function_2);
Assert.assertTrue(_exists);
})));
};
_filter.forEach(_function_1);
}
@ -367,34 +295,24 @@ public class WizardConfigurationTest {
Iterable<? extends ProjectDescriptor> _filter = IterableExtensions.filter(_allJavaProjects, _function);
final Consumer<ProjectDescriptor> _function_1 = (ProjectDescriptor it) -> {
it.setEnabled(true);
Iterable<? extends AbstractFile> _files = it.getFiles();
final Function1<AbstractFile, Boolean> _function_2 = (AbstractFile it_1) -> {
Assert.assertTrue(IterableExtensions.exists(it.getFiles(), ((Function1<AbstractFile, Boolean>) (AbstractFile it_1) -> {
String _relativePath = it_1.getRelativePath();
return Boolean.valueOf(Objects.equal(_relativePath, "MANIFEST.MF"));
};
boolean _exists = IterableExtensions.exists(_files, _function_2);
Assert.assertTrue(_exists);
Iterable<? extends AbstractFile> _files_1 = it.getFiles();
final Function1<AbstractFile, Boolean> _function_3 = (AbstractFile it_1) -> {
})));
Assert.assertTrue(IterableExtensions.exists(it.getFiles(), ((Function1<AbstractFile, Boolean>) (AbstractFile it_1) -> {
String _relativePath = it_1.getRelativePath();
return Boolean.valueOf(Objects.equal(_relativePath, "build.properties"));
};
boolean _exists_1 = IterableExtensions.exists(_files_1, _function_3);
Assert.assertTrue(_exists_1);
})));
};
_filter.forEach(_function_1);
}
@Test
public void featureProjectsHaveEclipseBuildProperties() {
SdkFeatureProject _sdkProject = this.config.getSdkProject();
Iterable<? extends AbstractFile> _files = _sdkProject.getFiles();
final Function1<AbstractFile, Boolean> _function = (AbstractFile it) -> {
Assert.assertTrue(IterableExtensions.exists(this.config.getSdkProject().getFiles(), ((Function1<AbstractFile, Boolean>) (AbstractFile it) -> {
String _relativePath = it.getRelativePath();
return Boolean.valueOf(Objects.equal(_relativePath, "build.properties"));
};
boolean _exists = IterableExtensions.exists(_files, _function);
Assert.assertTrue(_exists);
})));
}
@Test
@ -407,28 +325,12 @@ public class WizardConfigurationTest {
XtextVersion _xtextVersion = new XtextVersion("2.9.0-SNAPSHOT");
this.config.setXtextVersion(_xtextVersion);
final String snapshotsRepo = "repositories/snapshots";
ParentProjectDescriptor _parentProject = this.config.getParentProject();
PomFile _pom = _parentProject.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains(snapshotsRepo);
Assert.assertTrue(_contains);
ParentProjectDescriptor _parentProject_1 = this.config.getParentProject();
GradleBuildFile _buildGradle = _parentProject_1.buildGradle();
String _content_1 = _buildGradle.getContent();
boolean _contains_1 = _content_1.contains(snapshotsRepo);
Assert.assertTrue(_contains_1);
Assert.assertTrue(this.config.getParentProject().pom().getContent().contains(snapshotsRepo));
Assert.assertTrue(this.config.getParentProject().buildGradle().getContent().contains(snapshotsRepo));
final String xtextIntellijSnapshots = "/xtext-intellij/lastSuccessfulBuild/";
IntellijProjectDescriptor _intellijProject_1 = this.config.getIntellijProject();
GradleBuildFile _buildGradle_1 = _intellijProject_1.buildGradle();
String _content_2 = _buildGradle_1.getContent();
boolean _contains_2 = _content_2.contains(xtextIntellijSnapshots);
Assert.assertTrue(_contains_2);
Assert.assertTrue(this.config.getIntellijProject().buildGradle().getContent().contains(xtextIntellijSnapshots));
final String nightlyUpdateSite = "xtext/updates/nightly";
TargetPlatformProject _targetPlatformProject = this.config.getTargetPlatformProject();
CharSequence _target = _targetPlatformProject.target();
String _string = _target.toString();
boolean _contains_3 = _string.contains(nightlyUpdateSite);
Assert.assertTrue(_contains_3);
Assert.assertTrue(this.config.getTargetPlatformProject().target().toString().contains(nightlyUpdateSite));
}
@Test
@ -441,28 +343,12 @@ public class WizardConfigurationTest {
XtextVersion _xtextVersion = new XtextVersion("2.9.0");
this.config.setXtextVersion(_xtextVersion);
final String snapshotsRepo = "repositories/snapshots";
ParentProjectDescriptor _parentProject = this.config.getParentProject();
PomFile _pom = _parentProject.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains(snapshotsRepo);
Assert.assertFalse(_contains);
ParentProjectDescriptor _parentProject_1 = this.config.getParentProject();
GradleBuildFile _buildGradle = _parentProject_1.buildGradle();
String _content_1 = _buildGradle.getContent();
boolean _contains_1 = _content_1.contains(snapshotsRepo);
Assert.assertFalse(_contains_1);
Assert.assertFalse(this.config.getParentProject().pom().getContent().contains(snapshotsRepo));
Assert.assertFalse(this.config.getParentProject().buildGradle().getContent().contains(snapshotsRepo));
final String xtextIntellijRelease = "xtext/idea/${xtextVersion}";
IntellijProjectDescriptor _intellijProject_1 = this.config.getIntellijProject();
GradleBuildFile _buildGradle_1 = _intellijProject_1.buildGradle();
String _content_2 = _buildGradle_1.getContent();
boolean _contains_2 = _content_2.contains(xtextIntellijRelease);
Assert.assertTrue(_contains_2);
Assert.assertTrue(this.config.getIntellijProject().buildGradle().getContent().contains(xtextIntellijRelease));
final String releaseUpdateSite = "xtext/updates/releases/2.9.0";
TargetPlatformProject _targetPlatformProject = this.config.getTargetPlatformProject();
CharSequence _target = _targetPlatformProject.target();
String _string = _target.toString();
boolean _contains_3 = _string.contains(releaseUpdateSite);
Assert.assertTrue(_contains_3);
Assert.assertTrue(this.config.getTargetPlatformProject().target().toString().contains(releaseUpdateSite));
}
@Test
@ -478,10 +364,7 @@ public class WizardConfigurationTest {
};
Iterable<ProjectDescriptor> _filter = IterableExtensions.<ProjectDescriptor>filter(_enabledProjects, _function);
final Consumer<ProjectDescriptor> _function_1 = (ProjectDescriptor it) -> {
GradleBuildFile _buildGradle = it.buildGradle();
String _content = _buildGradle.getContent();
boolean _contains = _content.contains("eclipseClasspath.enabled=false");
Assert.assertTrue(_contains);
Assert.assertTrue(it.buildGradle().getContent().contains("eclipseClasspath.enabled=false"));
};
_filter.forEach(_function_1);
}
@ -491,12 +374,7 @@ public class WizardConfigurationTest {
this.config.setProjectLayout(ProjectLayout.HIERARCHICAL);
List<? extends ProjectDescriptor> _allJavaProjects = this.allJavaProjects();
final Consumer<ProjectDescriptor> _function = (ProjectDescriptor it) -> {
String _location = it.getLocation();
ParentProjectDescriptor _parentProject = this.config.getParentProject();
String _location_1 = _parentProject.getLocation();
String _plus = (_location_1 + "/");
boolean _startsWith = _location.startsWith(_plus);
Assert.assertTrue(_startsWith);
Assert.assertTrue(it.getLocation().startsWith((this.config.getParentProject().getLocation() + "/")));
};
_allJavaProjects.forEach(_function);
}
@ -511,18 +389,9 @@ public class WizardConfigurationTest {
};
final Iterable<? extends ProjectDescriptor> plainMavenProjects = IterableExtensions.filter(_allJavaProjects, _function);
final Consumer<ProjectDescriptor> _function_1 = (ProjectDescriptor it) -> {
PomFile _pom = it.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains("<directory>src</directory>");
Assert.assertTrue(_contains);
PomFile _pom_1 = it.pom();
String _content_1 = _pom_1.getContent();
boolean _contains_1 = _content_1.contains("<source>src-gen</source>");
Assert.assertTrue(_contains_1);
PomFile _pom_2 = it.pom();
String _content_2 = _pom_2.getContent();
boolean _contains_2 = _content_2.contains("<directory>src-gen</directory>");
Assert.assertTrue(_contains_2);
Assert.assertTrue(it.pom().getContent().contains("<directory>src</directory>"));
Assert.assertTrue(it.pom().getContent().contains("<source>src-gen</source>"));
Assert.assertTrue(it.pom().getContent().contains("<directory>src-gen</directory>"));
};
plainMavenProjects.forEach(_function_1);
final Function1<ProjectDescriptor, Boolean> _function_2 = (ProjectDescriptor it) -> {
@ -530,50 +399,20 @@ public class WizardConfigurationTest {
};
Iterable<? extends ProjectDescriptor> _filter = IterableExtensions.filter(plainMavenProjects, _function_2);
final Consumer<ProjectDescriptor> _function_3 = (ProjectDescriptor it) -> {
PomFile _pom = it.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains("<sourceDirectory>src</sourceDirectory>");
Assert.assertTrue(_contains);
PomFile _pom_1 = it.pom();
String _content_1 = _pom_1.getContent();
boolean _contains_1 = _content_1.contains("add-source");
Assert.assertTrue(_contains_1);
PomFile _pom_2 = it.pom();
String _content_2 = _pom_2.getContent();
boolean _contains_2 = _content_2.contains("add-resource");
Assert.assertTrue(_contains_2);
PomFile _pom_3 = it.pom();
String _content_3 = _pom_3.getContent();
boolean _contains_3 = _content_3.contains("add-test-source");
Assert.assertFalse(_contains_3);
PomFile _pom_4 = it.pom();
String _content_4 = _pom_4.getContent();
boolean _contains_4 = _content_4.contains("add-test-resource");
Assert.assertFalse(_contains_4);
Assert.assertTrue(it.pom().getContent().contains("<sourceDirectory>src</sourceDirectory>"));
Assert.assertTrue(it.pom().getContent().contains("add-source"));
Assert.assertTrue(it.pom().getContent().contains("add-resource"));
Assert.assertFalse(it.pom().getContent().contains("add-test-source"));
Assert.assertFalse(it.pom().getContent().contains("add-test-resource"));
};
_filter.forEach(_function_3);
Iterable<TestProjectDescriptor> _filter_1 = Iterables.<TestProjectDescriptor>filter(plainMavenProjects, TestProjectDescriptor.class);
final Consumer<TestProjectDescriptor> _function_4 = (TestProjectDescriptor it) -> {
PomFile _pom = it.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains("<testSourceDirectory>src</testSourceDirectory>");
Assert.assertTrue(_contains);
PomFile _pom_1 = it.pom();
String _content_1 = _pom_1.getContent();
boolean _contains_1 = _content_1.contains("add-test-source");
Assert.assertTrue(_contains_1);
PomFile _pom_2 = it.pom();
String _content_2 = _pom_2.getContent();
boolean _contains_2 = _content_2.contains("add-test-resource");
Assert.assertTrue(_contains_2);
PomFile _pom_3 = it.pom();
String _content_3 = _pom_3.getContent();
boolean _contains_3 = _content_3.contains("add-source");
Assert.assertFalse(_contains_3);
PomFile _pom_4 = it.pom();
String _content_4 = _pom_4.getContent();
boolean _contains_4 = _content_4.contains("add-resource");
Assert.assertFalse(_contains_4);
Assert.assertTrue(it.pom().getContent().contains("<testSourceDirectory>src</testSourceDirectory>"));
Assert.assertTrue(it.pom().getContent().contains("add-test-source"));
Assert.assertTrue(it.pom().getContent().contains("add-test-resource"));
Assert.assertFalse(it.pom().getContent().contains("add-source"));
Assert.assertFalse(it.pom().getContent().contains("add-resource"));
};
_filter_1.forEach(_function_4);
}
@ -595,51 +434,24 @@ public class WizardConfigurationTest {
it.setEnabled(true);
};
plainMavenProjects.forEach(_function_2);
Iterable<TestProjectDescriptor> _filter = Iterables.<TestProjectDescriptor>filter(plainMavenProjects, TestProjectDescriptor.class);
final Function1<TestProjectDescriptor, Boolean> _function_3 = (TestProjectDescriptor it) -> {
Assert.assertTrue(IterableExtensions.<TestProjectDescriptor>forall(Iterables.<TestProjectDescriptor>filter(plainMavenProjects, TestProjectDescriptor.class), ((Function1<TestProjectDescriptor, Boolean>) (TestProjectDescriptor it) -> {
return Boolean.valueOf(it.isInlined());
})));
final Consumer<ProjectDescriptor> _function_3 = (ProjectDescriptor it) -> {
Assert.assertTrue(it.pom().getContent().contains("add-source"));
Assert.assertTrue(it.pom().getContent().contains("add-resource"));
Assert.assertTrue(it.pom().getContent().contains("<source>src/main/xtext-gen</source>"));
Assert.assertTrue(it.pom().getContent().contains("<directory>src/main/xtext-gen</directory>"));
};
boolean _forall = IterableExtensions.<TestProjectDescriptor>forall(_filter, _function_3);
Assert.assertTrue(_forall);
final Consumer<ProjectDescriptor> _function_4 = (ProjectDescriptor it) -> {
PomFile _pom = it.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains("add-source");
Assert.assertTrue(_contains);
PomFile _pom_1 = it.pom();
String _content_1 = _pom_1.getContent();
boolean _contains_1 = _content_1.contains("add-resource");
Assert.assertTrue(_contains_1);
PomFile _pom_2 = it.pom();
String _content_2 = _pom_2.getContent();
boolean _contains_2 = _content_2.contains("<source>src/main/xtext-gen</source>");
Assert.assertTrue(_contains_2);
PomFile _pom_3 = it.pom();
String _content_3 = _pom_3.getContent();
boolean _contains_3 = _content_3.contains("<directory>src/main/xtext-gen</directory>");
Assert.assertTrue(_contains_3);
mainProjects.forEach(_function_3);
Iterable<TestedProjectDescriptor> _filter = Iterables.<TestedProjectDescriptor>filter(mainProjects, TestedProjectDescriptor.class);
final Consumer<TestedProjectDescriptor> _function_4 = (TestedProjectDescriptor it) -> {
Assert.assertTrue(it.pom().getContent().contains("add-test-source"));
Assert.assertTrue(it.pom().getContent().contains("add-test-resource"));
Assert.assertTrue(it.pom().getContent().contains("<source>src/test/xtext-gen</source>"));
Assert.assertTrue(it.pom().getContent().contains("<directory>src/test/xtext-gen</directory>"));
};
mainProjects.forEach(_function_4);
Iterable<TestedProjectDescriptor> _filter_1 = Iterables.<TestedProjectDescriptor>filter(mainProjects, TestedProjectDescriptor.class);
final Consumer<TestedProjectDescriptor> _function_5 = (TestedProjectDescriptor it) -> {
PomFile _pom = it.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains("add-test-source");
Assert.assertTrue(_contains);
PomFile _pom_1 = it.pom();
String _content_1 = _pom_1.getContent();
boolean _contains_1 = _content_1.contains("add-test-resource");
Assert.assertTrue(_contains_1);
PomFile _pom_2 = it.pom();
String _content_2 = _pom_2.getContent();
boolean _contains_2 = _content_2.contains("<source>src/test/xtext-gen</source>");
Assert.assertTrue(_contains_2);
PomFile _pom_3 = it.pom();
String _content_3 = _pom_3.getContent();
boolean _contains_3 = _content_3.contains("<directory>src/test/xtext-gen</directory>");
Assert.assertTrue(_contains_3);
};
_filter_1.forEach(_function_5);
_filter.forEach(_function_4);
}
@Test
@ -660,22 +472,10 @@ public class WizardConfigurationTest {
};
plainMavenProjects.forEach(_function_2);
final Consumer<ProjectDescriptor> _function_3 = (ProjectDescriptor it) -> {
PomFile _pom = it.pom();
String _content = _pom.getContent();
boolean _contains = _content.contains("<sourceDirectory>");
Assert.assertFalse(_contains);
PomFile _pom_1 = it.pom();
String _content_1 = _pom_1.getContent();
boolean _contains_1 = _content_1.contains("<directory>src/main/resources</directory>");
Assert.assertFalse(_contains_1);
PomFile _pom_2 = it.pom();
String _content_2 = _pom_2.getContent();
boolean _contains_2 = _content_2.contains("<testSourceDirectory>");
Assert.assertFalse(_contains_2);
PomFile _pom_3 = it.pom();
String _content_3 = _pom_3.getContent();
boolean _contains_3 = _content_3.contains("<directory>src/test/resources</directory>");
Assert.assertFalse(_contains_3);
Assert.assertFalse(it.pom().getContent().contains("<sourceDirectory>"));
Assert.assertFalse(it.pom().getContent().contains("<directory>src/main/resources</directory>"));
Assert.assertFalse(it.pom().getContent().contains("<testSourceDirectory>"));
Assert.assertFalse(it.pom().getContent().contains("<directory>src/test/resources</directory>"));
};
mainProjects.forEach(_function_3);
}
@ -689,8 +489,7 @@ public class WizardConfigurationTest {
TestProjectDescriptor _testProject = _uiProject_1.getTestProject();
PomFile _pom = _testProject.pom();
final String pom = _pom.getContent();
boolean _contains = pom.contains("useUIHarness");
Assert.assertTrue(_contains);
Assert.assertTrue(pom.contains("useUIHarness"));
}
@Test
@ -702,8 +501,7 @@ public class WizardConfigurationTest {
TestProjectDescriptor _testProject = _runtimeProject.getTestProject();
PomFile _pom = _testProject.pom();
final String pom = _pom.getContent();
boolean _contains = pom.contains("useUIHarness");
Assert.assertFalse(_contains);
Assert.assertFalse(pom.contains("useUIHarness"));
}
@Test
@ -722,9 +520,7 @@ public class WizardConfigurationTest {
};
final Iterable<PomFile> poms = IterableExtensions.<TestProjectDescriptor, PomFile>map(_filter_1, _function_1);
final Consumer<PomFile> _function_2 = (PomFile it) -> {
String _content = it.getContent();
boolean _contains = _content.contains("failIfNoTests");
Assert.assertTrue(_contains);
Assert.assertTrue(it.getContent().contains("failIfNoTests"));
};
poms.forEach(_function_2);
}
@ -734,25 +530,20 @@ public class WizardConfigurationTest {
ParentProjectDescriptor _parentProject = this.config.getParentProject();
PomFile _pom = _parentProject.pom();
final String parentPom = _pom.getContent();
boolean _contains = parentPom.contains("<maven.compiler.source>1.8</maven.compiler.source>");
Assert.assertTrue(_contains);
boolean _contains_1 = parentPom.contains("<maven.compiler.target>1.8</maven.compiler.target>");
Assert.assertTrue(_contains_1);
Assert.assertTrue(parentPom.contains("<maven.compiler.source>1.8</maven.compiler.source>"));
Assert.assertTrue(parentPom.contains("<maven.compiler.target>1.8</maven.compiler.target>"));
ParentProjectDescriptor _parentProject_1 = this.config.getParentProject();
GradleBuildFile _buildGradle = _parentProject_1.buildGradle();
final String parentGradle = _buildGradle.getContent();
boolean _contains_2 = parentGradle.contains("sourceCompatibility = \'1.8\'");
Assert.assertTrue(_contains_2);
boolean _contains_3 = parentGradle.contains("targetCompatibility = \'1.8\'");
Assert.assertTrue(_contains_3);
Assert.assertTrue(parentGradle.contains("sourceCompatibility = \'1.8\'"));
Assert.assertTrue(parentGradle.contains("targetCompatibility = \'1.8\'"));
List<? extends ProjectDescriptor> _allJavaProjects = this.allJavaProjects();
final Function1<ProjectDescriptor, String> _function = (ProjectDescriptor it) -> {
return it.manifest();
};
List<String> _map = ListExtensions.map(_allJavaProjects, _function);
final Consumer<String> _function_1 = (String it) -> {
boolean _contains_4 = it.contains("Bundle-RequiredExecutionEnvironment: JavaSE-1.8");
Assert.assertTrue(_contains_4);
Assert.assertTrue(it.contains("Bundle-RequiredExecutionEnvironment: JavaSE-1.8"));
};
_map.forEach(_function_1);
}
@ -763,25 +554,20 @@ public class WizardConfigurationTest {
ParentProjectDescriptor _parentProject = this.config.getParentProject();
PomFile _pom = _parentProject.pom();
final String parentPom = _pom.getContent();
boolean _contains = parentPom.contains("<maven.compiler.source>1.7</maven.compiler.source>");
Assert.assertTrue(_contains);
boolean _contains_1 = parentPom.contains("<maven.compiler.target>1.7</maven.compiler.target>");
Assert.assertTrue(_contains_1);
Assert.assertTrue(parentPom.contains("<maven.compiler.source>1.7</maven.compiler.source>"));
Assert.assertTrue(parentPom.contains("<maven.compiler.target>1.7</maven.compiler.target>"));
ParentProjectDescriptor _parentProject_1 = this.config.getParentProject();
GradleBuildFile _buildGradle = _parentProject_1.buildGradle();
final String parentGradle = _buildGradle.getContent();
boolean _contains_2 = parentGradle.contains("sourceCompatibility = \'1.7\'");
Assert.assertTrue(_contains_2);
boolean _contains_3 = parentGradle.contains("targetCompatibility = \'1.7\'");
Assert.assertTrue(_contains_3);
Assert.assertTrue(parentGradle.contains("sourceCompatibility = \'1.7\'"));
Assert.assertTrue(parentGradle.contains("targetCompatibility = \'1.7\'"));
List<? extends ProjectDescriptor> _allJavaProjects = this.allJavaProjects();
final Function1<ProjectDescriptor, String> _function = (ProjectDescriptor it) -> {
return it.manifest();
};
List<String> _map = ListExtensions.map(_allJavaProjects, _function);
final Consumer<String> _function_1 = (String it) -> {
boolean _contains_4 = it.contains("Bundle-RequiredExecutionEnvironment: JavaSE-1.7");
Assert.assertTrue(_contains_4);
Assert.assertTrue(it.contains("Bundle-RequiredExecutionEnvironment: JavaSE-1.7"));
};
_map.forEach(_function_1);
}
@ -801,22 +587,10 @@ public class WizardConfigurationTest {
@Test
public void binExcludes() {
RuntimeProjectDescriptor _runtimeProject = this.config.getRuntimeProject();
Set<String> _binExcludes = _runtimeProject.getBinExcludes();
Assert.assertEquals(Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("**/*.mwe2", "**/*.xtend")), _binExcludes);
RuntimeProjectDescriptor _runtimeProject_1 = this.config.getRuntimeProject();
TestProjectDescriptor _testProject = _runtimeProject_1.getTestProject();
Set<String> _binExcludes_1 = _testProject.getBinExcludes();
Assert.assertEquals(Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("**/*.xtend")), _binExcludes_1);
UiProjectDescriptor _uiProject = this.config.getUiProject();
Set<String> _binExcludes_2 = _uiProject.getBinExcludes();
Assert.assertEquals(Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("**/*.xtend")), _binExcludes_2);
UiProjectDescriptor _uiProject_1 = this.config.getUiProject();
TestProjectDescriptor _testProject_1 = _uiProject_1.getTestProject();
Set<String> _binExcludes_3 = _testProject_1.getBinExcludes();
Assert.assertEquals(Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("**/*.xtend")), _binExcludes_3);
SdkFeatureProject _sdkProject = this.config.getSdkProject();
Set<String> _binExcludes_4 = _sdkProject.getBinExcludes();
Assert.assertEquals(Collections.<Object>unmodifiableSet(CollectionLiterals.<Object>newHashSet()), _binExcludes_4);
Assert.assertEquals(Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("**/*.mwe2", "**/*.xtend")), this.config.getRuntimeProject().getBinExcludes());
Assert.assertEquals(Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("**/*.xtend")), this.config.getRuntimeProject().getTestProject().getBinExcludes());
Assert.assertEquals(Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("**/*.xtend")), this.config.getUiProject().getBinExcludes());
Assert.assertEquals(Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("**/*.xtend")), this.config.getUiProject().getTestProject().getBinExcludes());
Assert.assertEquals(Collections.<Object>unmodifiableSet(CollectionLiterals.<Object>newHashSet()), this.config.getSdkProject().getBinExcludes());
}
}

View file

@ -93,8 +93,7 @@ public class XtextVersion {
URL _baseURL = XtextVersion.Plugin.INSTANCE.getBaseURL();
String _plus = (_baseURL + "META-INF/MANIFEST.MF");
final URL url = new URL(_plus);
InputStream _openStream = url.openStream();
is = _openStream;
is = url.openStream();
final Manifest manifest = new Manifest(is);
Attributes _mainAttributes = manifest.getMainAttributes();
return _mainAttributes.getValue("Maven-Version");

View file

@ -14,13 +14,11 @@ import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.xtend.lib.macro.AbstractClassProcessor;
import org.eclipse.xtend.lib.macro.RegisterGlobalsContext;
import org.eclipse.xtend.lib.macro.TransformationContext;
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference;
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration;
import org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration;
import org.eclipse.xtend.lib.macro.declaration.MutableConstructorDeclaration;
import org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration;
import org.eclipse.xtend.lib.macro.declaration.MutableMethodDeclaration;
import org.eclipse.xtend.lib.macro.declaration.TypeReference;
import org.eclipse.xtend2.lib.StringConcatenationClient;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
@ -35,13 +33,10 @@ public class EmfAdaptableProcessor extends AbstractClassProcessor {
@Override
public void doTransform(final MutableClassDeclaration annotatedClass, @Extension final TransformationContext context) {
String _adapterClassName = this.getAdapterClassName(annotatedClass);
final MutableClassDeclaration adapterClass = context.findClass(_adapterClassName);
final MutableClassDeclaration adapterClass = context.findClass(this.getAdapterClassName(annotatedClass));
final Procedure1<MutableMethodDeclaration> _function = (MutableMethodDeclaration it) -> {
TypeReference _newTypeReference = context.newTypeReference(Notifier.class);
it.addParameter("emfObject", _newTypeReference);
TypeReference _newTypeReference_1 = context.newTypeReference(annotatedClass);
it.setReturnType(_newTypeReference_1);
it.addParameter("emfObject", context.newTypeReference(Notifier.class));
it.setReturnType(context.newTypeReference(annotatedClass));
it.setStatic(true);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
@ -73,10 +68,8 @@ public class EmfAdaptableProcessor extends AbstractClassProcessor {
};
annotatedClass.addMethod("findInEmfObject", _function);
final Procedure1<MutableMethodDeclaration> _function_1 = (MutableMethodDeclaration it) -> {
TypeReference _newTypeReference = context.newTypeReference(Notifier.class);
it.addParameter("emfObject", _newTypeReference);
TypeReference _newTypeReference_1 = context.newTypeReference(annotatedClass);
it.setReturnType(_newTypeReference_1);
it.addParameter("emfObject", context.newTypeReference(Notifier.class));
it.setReturnType(context.newTypeReference(annotatedClass));
it.setStatic(true);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
@ -118,10 +111,8 @@ public class EmfAdaptableProcessor extends AbstractClassProcessor {
};
annotatedClass.addMethod("removeFromEmfObject", _function_1);
final Procedure1<MutableMethodDeclaration> _function_2 = (MutableMethodDeclaration it) -> {
TypeReference _newTypeReference = context.newTypeReference(Notifier.class);
it.addParameter("emfObject", _newTypeReference);
TypeReference _primitiveVoid = context.getPrimitiveVoid();
it.setReturnType(_primitiveVoid);
it.addParameter("emfObject", context.newTypeReference(Notifier.class));
it.setReturnType(context.getPrimitiveVoid());
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
@ -149,16 +140,13 @@ public class EmfAdaptableProcessor extends AbstractClassProcessor {
it.setBody(_client);
};
annotatedClass.addMethod("attachToEmfObject", _function_2);
TypeReference _newTypeReference = context.newTypeReference(AdapterImpl.class);
adapterClass.setExtendedClass(_newTypeReference);
adapterClass.setExtendedClass(context.newTypeReference(AdapterImpl.class));
final Procedure1<MutableFieldDeclaration> _function_3 = (MutableFieldDeclaration it) -> {
TypeReference _newTypeReference_1 = context.newTypeReference(annotatedClass);
it.setType(_newTypeReference_1);
it.setType(context.newTypeReference(annotatedClass));
};
adapterClass.addField("element", _function_3);
final Procedure1<MutableConstructorDeclaration> _function_4 = (MutableConstructorDeclaration it) -> {
TypeReference _newTypeReference_1 = context.newTypeReference(annotatedClass);
it.addParameter("element", _newTypeReference_1);
it.addParameter("element", context.newTypeReference(annotatedClass));
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
@ -170,8 +158,7 @@ public class EmfAdaptableProcessor extends AbstractClassProcessor {
};
adapterClass.addConstructor(_function_4);
final Procedure1<MutableMethodDeclaration> _function_5 = (MutableMethodDeclaration it) -> {
TypeReference _newTypeReference_1 = context.newTypeReference(annotatedClass);
it.setReturnType(_newTypeReference_1);
it.setReturnType(context.newTypeReference(annotatedClass));
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
@ -183,12 +170,9 @@ public class EmfAdaptableProcessor extends AbstractClassProcessor {
};
adapterClass.addMethod("get", _function_5);
final Procedure1<MutableMethodDeclaration> _function_6 = (MutableMethodDeclaration it) -> {
AnnotationReference _newAnnotationReference = context.newAnnotationReference(Override.class);
it.addAnnotation(_newAnnotationReference);
TypeReference _newTypeReference_1 = context.newTypeReference(Object.class);
it.addParameter("object", _newTypeReference_1);
TypeReference _primitiveBoolean = context.getPrimitiveBoolean();
it.setReturnType(_primitiveBoolean);
it.addAnnotation(context.newAnnotationReference(Override.class));
it.addParameter("object", context.newTypeReference(Object.class));
it.setReturnType(context.getPrimitiveBoolean());
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {

View file

@ -12,7 +12,6 @@ import org.eclipse.xtend.lib.macro.AbstractClassProcessor;
import org.eclipse.xtend.lib.macro.TransformationContext;
import org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration;
import org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration;
import org.eclipse.xtend.lib.macro.declaration.TypeReference;
import org.eclipse.xtend2.lib.StringConcatenationClient;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
@ -24,8 +23,7 @@ public class LogProcessor extends AbstractClassProcessor {
final Procedure1<MutableFieldDeclaration> _function = (MutableFieldDeclaration it) -> {
it.setStatic(true);
it.setFinal(true);
TypeReference _newTypeReference = context.newTypeReference(Logger.class);
it.setType(_newTypeReference);
it.setType(context.newTypeReference(Logger.class));
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {

View file

@ -82,8 +82,7 @@ public class CodeConfig implements IGuiceAwareGeneratorComponent {
@Override
public void initialize(final Injector injector) {
injector.injectMembers(this);
XtextVersion _current = XtextVersion.getCurrent();
this.xtextVersion = _current;
this.xtextVersion = XtextVersion.getCurrent();
if ((this.lineDelimiter == null)) {
this.lineDelimiter = "\n";
}
@ -94,38 +93,32 @@ public class CodeConfig implements IGuiceAwareGeneratorComponent {
final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
Date _date = new Date();
final String time = dateFormat.format(_date);
String _replace = fileHeader.replace(CodeConfig.FILE_HEADER_VAR_TIME, time);
fileHeader = _replace;
fileHeader = fileHeader.replace(CodeConfig.FILE_HEADER_VAR_TIME, time);
}
boolean _contains_1 = fileHeader.contains(CodeConfig.FILE_HEADER_VAR_DATE);
if (_contains_1) {
final SimpleDateFormat dateFormat_1 = new SimpleDateFormat("MMM d, yyyy");
Date _date_1 = new Date();
final String date = dateFormat_1.format(_date_1);
String _replace_1 = fileHeader.replace(CodeConfig.FILE_HEADER_VAR_DATE, date);
fileHeader = _replace_1;
fileHeader = fileHeader.replace(CodeConfig.FILE_HEADER_VAR_DATE, date);
}
boolean _contains_2 = fileHeader.contains(CodeConfig.FILE_HEADER_VAR_YEAR);
if (_contains_2) {
final SimpleDateFormat dateFormat_2 = new SimpleDateFormat("yyyy");
Date _date_2 = new Date();
final String year = dateFormat_2.format(_date_2);
String _replace_2 = fileHeader.replace(CodeConfig.FILE_HEADER_VAR_YEAR, year);
fileHeader = _replace_2;
fileHeader = fileHeader.replace(CodeConfig.FILE_HEADER_VAR_YEAR, year);
}
boolean _contains_3 = fileHeader.contains(CodeConfig.FILE_HEADER_VAR_USER);
if (_contains_3) {
final String user = System.getProperty("user.name");
if ((user != null)) {
String _replace_3 = fileHeader.replace(CodeConfig.FILE_HEADER_VAR_USER, user);
fileHeader = _replace_3;
fileHeader = fileHeader.replace(CodeConfig.FILE_HEADER_VAR_USER, user);
}
}
boolean _contains_4 = fileHeader.contains(CodeConfig.FILE_HEADER_VAR_VERSION);
if (_contains_4) {
String _string = this.xtextVersion.toString();
String _replace_4 = fileHeader.replace(CodeConfig.FILE_HEADER_VAR_VERSION, _string);
fileHeader = _replace_4;
fileHeader = fileHeader.replace(CodeConfig.FILE_HEADER_VAR_VERSION, this.xtextVersion.toString());
}
}
this.fileHeader = fileHeader;

View file

@ -66,8 +66,7 @@ public class DefaultGeneratorModule extends AbstractGenericModule {
AnnotatedBindingBuilder<IEncodingProvider> _bind = binder.<IEncodingProvider>bind(IEncodingProvider.class);
IEncodingProvider.Runtime _runtime = new IEncodingProvider.Runtime();
final Procedure1<IEncodingProvider.Runtime> _function = (IEncodingProvider.Runtime it) -> {
String _encoding = this.code.getEncoding();
it.setDefaultEncoding(_encoding);
it.setDefaultEncoding(this.code.getEncoding());
};
IEncodingProvider.Runtime _doubleArrow = ObjectExtensions.<IEncodingProvider.Runtime>operator_doubleArrow(_runtime, _function);
_bind.toInstance(_doubleArrow);

View file

@ -118,8 +118,7 @@ class ImplicitFragment extends AbstractStubGeneratingFragment {
GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
TypeReference _typeRef = TypeReference.typeRef(IAllContainersState.class);
final GuiceModuleAccess.BindingFactory bindingFactory = _bindingFactory.addTypeToProviderInstance(_typeRef, expression);
Grammar _grammar_1 = this.getGrammar();
boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(_grammar_1);
boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getGrammar());
if (_inheritsXbase) {
TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.XtextEditor");
TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.editor.XbaseEditor");

View file

@ -169,8 +169,7 @@ public class XtextGenerator extends AbstractWorkflowComponent2 {
StandaloneSetup _standaloneSetup = new StandaloneSetup();
_standaloneSetup.addRegisterGeneratedEPackage("org.eclipse.xtext.common.types.TypesPackage");
this.initializeEncoding();
Injector _createInjector = this.createInjector();
this.injector = _createInjector;
this.injector = this.createInjector();
this.injector.injectMembers(this);
CodeConfig _instance = this.injector.<CodeConfig>getInstance(CodeConfig.class);
final Procedure1<CodeConfig> _function = (CodeConfig it) -> {
@ -370,8 +369,7 @@ public class XtextGenerator extends AbstractWorkflowComponent2 {
manifestIter.remove();
} else {
if (((manifest.getActivator() == null) && (manifest == this.projectConfig.getEclipsePlugin().getManifest()))) {
TypeReference _eclipsePluginActivator = this.naming.getEclipsePluginActivator();
manifest.setActivator(_eclipsePluginActivator);
manifest.setActivator(this.naming.getEclipsePluginActivator());
}
String _path = manifest.getPath();
final URI uri = metaInf.getURI(_path);
@ -393,8 +391,7 @@ public class XtextGenerator extends AbstractWorkflowComponent2 {
String _bundleName = manifest.getBundleName();
boolean _tripleEquals = (_bundleName == null);
if (_tripleEquals) {
String _third = entry.getThird();
manifest.setBundleName(_third);
manifest.setBundleName(entry.getThird());
}
String _path = manifest.getPath();
boolean _isFile = metaInf.isFile(_path);
@ -425,13 +422,10 @@ public class XtextGenerator extends AbstractWorkflowComponent2 {
protected void mergeManifest(final ManifestAccess manifest, final IXtextGeneratorFileSystemAccess metaInf) throws IOException {
InputStream in = null;
try {
String _path = manifest.getPath();
InputStream _readBinaryFile = metaInf.readBinaryFile(_path);
in = _readBinaryFile;
in = metaInf.readBinaryFile(manifest.getPath());
String _bundleName = manifest.getBundleName();
final MergeableManifest merge = new MergeableManifest(in, _bundleName);
String _lineDelimiter = this.codeConfig.getLineDelimiter();
merge.setLineDelimiter(_lineDelimiter);
merge.setLineDelimiter(this.codeConfig.getLineDelimiter());
Set<String> _exportedPackages = manifest.getExportedPackages();
merge.addExportedPackages(_exportedPackages);
Set<String> _requiredBundles = manifest.getRequiredBundles();
@ -439,18 +433,16 @@ public class XtextGenerator extends AbstractWorkflowComponent2 {
Set<String> _importedPackages = manifest.getImportedPackages();
merge.addImportedPackages(_importedPackages);
if (((manifest.getActivator() != null) && StringExtensions.isNullOrEmpty(merge.getBundleActivator()))) {
TypeReference _activator = manifest.getActivator();
String _name = _activator.getName();
merge.setBundleActivator(_name);
merge.setBundleActivator(manifest.getActivator().getName());
}
boolean _isModified = merge.isModified();
if (_isModified) {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
merge.write(out);
String _path_1 = manifest.getPath();
String _path = manifest.getPath();
byte[] _byteArray = out.toByteArray();
ByteArrayInputStream _byteArrayInputStream = new ByteArrayInputStream(_byteArray);
metaInf.generateFile(_path_1, _byteArrayInputStream);
metaInf.generateFile(_path, _byteArrayInputStream);
}
} finally {
if ((in != null)) {

View file

@ -151,10 +151,7 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen
}
public void setFileExtensions(final String fileExtensions) {
String _trim = fileExtensions.trim();
String[] _split = _trim.split("\\s*,\\s*");
List<String> _list = IterableExtensions.<String>toList(((Iterable<String>)Conversions.doWrapArray(_split)));
this.fileExtensions = _list;
this.fileExtensions = IterableExtensions.<String>toList(((Iterable<String>)Conversions.doWrapArray(fileExtensions.trim().split("\\s*,\\s*"))));
}
public void addReferencedResource(final String referencedResource) {
@ -164,9 +161,7 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen
@Override
public List<String> getFileExtensions() {
if (((this.fileExtensions == null) || this.fileExtensions.isEmpty())) {
String _simpleName = GrammarUtil.getSimpleName(this.grammar);
String _lowerCase = _simpleName.toLowerCase();
this.setFileExtensions(_lowerCase);
this.setFileExtensions(GrammarUtil.getSimpleName(this.grammar).toLowerCase());
XtextGeneratorLanguage.LOG.info((("No explicit fileExtensions configured. Using \'*." + this.fileExtensions) + "\'."));
}
return this.fileExtensions;
@ -190,8 +185,7 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen
_fragments.addAll(0, _implicitFragments);
injector.injectMembers(XtextGeneratorLanguage.class);
if ((this.resourceSet == null)) {
ResourceSet _get = this.resourceSetProvider.get();
this.resourceSet = _get;
this.resourceSet = this.resourceSetProvider.get();
}
this.resourceSetInitializer.initialize(this.resourceSet, this.referencedResources);
EList<Resource> _resources = this.resourceSet.getResources();
@ -270,8 +264,8 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen
throw new IllegalStateException(_plus_4);
}
EList<EObject> _contents_1 = resource.getContents();
EObject _get_1 = _contents_1.get(0);
final Grammar grammar = ((Grammar) _get_1);
EObject _get = _contents_1.get(0);
final Grammar grammar = ((Grammar) _get);
this.validateGrammar(grammar);
this.initialize(grammar);
super.initialize(injector);
@ -290,8 +284,7 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen
public void initialize(final Grammar grammar) {
this.grammar = grammar;
RuleNames _ruleNames = RuleNames.getRuleNames(grammar, true);
this.ruleNames = _ruleNames;
this.ruleNames = RuleNames.getRuleNames(grammar, true);
}
private void installIndex() {
@ -300,8 +293,7 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen
EList<Resource> _resources = this.resourceSet.getResources();
final ArrayList<Resource> resources = Lists.<Resource>newArrayList(_resources);
for (final Resource resource : resources) {
org.eclipse.emf.common.util.URI _uRI = resource.getURI();
this.index(resource, _uRI, index);
this.index(resource, resource.getURI(), index);
}
ResourceDescriptionsData.ResourceSetAdapter.installResourceDescriptionsData(this.resourceSet, index);
}

View file

@ -52,10 +52,8 @@ public class XtextGeneratorStandaloneSetup implements IGuiceAwareGeneratorCompon
final Consumer<Pair<String, String>> _function = (Pair<String, String> mapping) -> {
ProjectMapping _projectMapping = new ProjectMapping();
final Procedure1<ProjectMapping> _function_1 = (ProjectMapping it) -> {
String _key = mapping.getKey();
it.setProjectName(_key);
String _value = mapping.getValue();
it.setPath(_value);
it.setProjectName(mapping.getKey());
it.setPath(mapping.getValue());
};
ProjectMapping _doubleArrow = ObjectExtensions.<ProjectMapping>operator_doubleArrow(_projectMapping, _function_1);
delegate.addProjectMapping(_doubleArrow);

View file

@ -1876,8 +1876,7 @@ public class XtextGeneratorTemplates {
_builder.append("\t\t");
_builder.append("\t");
_builder.append("return new ");
Grammar _grammar_3 = lang_1.getGrammar();
TypeReference _runtimeModule = XtextGeneratorTemplates.this.naming.getRuntimeModule(_grammar_3);
TypeReference _runtimeModule = XtextGeneratorTemplates.this.naming.getRuntimeModule(lang_1.getGrammar());
_builder.append(_runtimeModule, "\t\t\t");
_builder.append("();");
_builder.newLineIfNotEmpty();
@ -1903,8 +1902,8 @@ public class XtextGeneratorTemplates {
for(final IXtextGeneratorLanguage lang_2 : langConfigs) {
_builder.append("\t\t");
_builder.append("if (");
Grammar _grammar_4 = lang_2.getGrammar();
String _name_3 = _grammar_4.getName();
Grammar _grammar_3 = lang_2.getGrammar();
String _name_3 = _grammar_3.getName();
String _upperCase_2 = _name_3.toUpperCase();
String _replaceAll_2 = _upperCase_2.replaceAll("\\.", "_");
_builder.append(_replaceAll_2, "\t\t");
@ -1913,8 +1912,7 @@ public class XtextGeneratorTemplates {
_builder.append("\t\t");
_builder.append("\t");
_builder.append("return new ");
Grammar _grammar_5 = lang_2.getGrammar();
TypeReference _eclipsePluginModule = XtextGeneratorTemplates.this.naming.getEclipsePluginModule(_grammar_5);
TypeReference _eclipsePluginModule = XtextGeneratorTemplates.this.naming.getEclipsePluginModule(lang_2.getGrammar());
_builder.append(_eclipsePluginModule, "\t\t\t");
_builder.append("(this);");
_builder.newLineIfNotEmpty();

View file

@ -205,8 +205,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
* Sets the target EMF runtime version to generate for to the specified value.
*/
public void setEmfRuntimeVersion(final String emfRuntimeVersion) {
GenRuntimeVersion _get = GenRuntimeVersion.get(emfRuntimeVersion);
this.emfRuntimeVersion = _get;
this.emfRuntimeVersion = GenRuntimeVersion.get(emfRuntimeVersion);
if ((this.emfRuntimeVersion == null)) {
EMFGeneratorFragment2.LOG.warn(("Illegal EMF runtime version: " + emfRuntimeVersion));
}
@ -224,8 +223,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
* The default level is "JDK60".
*/
public void setJdkLevel(final String jdkLevel) {
GenJDKLevel _byName = GenJDKLevel.getByName(jdkLevel);
this.jdkLevel = _byName;
this.jdkLevel = GenJDKLevel.getByName(jdkLevel);
if ((this.jdkLevel == null)) {
EMFGeneratorFragment2.LOG.warn(("Illegal JDK level: " + jdkLevel));
}
@ -445,8 +443,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
return;
}
try {
Grammar _grammar_1 = this.getGrammar();
final Grammar clonedGrammar = this.cloneGrammarIntoNewResourceSet(_grammar_1);
final Grammar clonedGrammar = this.cloneGrammarIntoNewResourceSet(this.getGrammar());
Resource _eResource = clonedGrammar.eResource();
final ResourceSet workingResourceSet = _eResource.getResourceSet();
EList<AbstractMetamodelDeclaration> _metamodelDeclarations_1 = clonedGrammar.getMetamodelDeclarations();
@ -457,15 +454,13 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
Iterable<EPackage> _map = IterableExtensions.<GeneratedMetamodel, EPackage>map(_filter_1, _function);
final List<EPackage> generatedPackages = IterableExtensions.<EPackage>toList(_map);
if ((this.genModel != null)) {
URIConverter _uRIConverter = workingResourceSet.getURIConverter();
this.registerUsedGenModel(_uRIConverter, clonedGrammar);
this.registerUsedGenModel(workingResourceSet.getURIConverter(), clonedGrammar);
}
boolean _isEmpty_1 = generatedPackages.isEmpty();
boolean _not = (!_isEmpty_1);
if (_not) {
final Map<String, EPackage> usedEPackages = this.findAllUsedEPackages(generatedPackages);
Set<String> _keySet = usedEPackages.keySet();
final Map<String, EPackage> loadedEPackages = this.findEPackagesInGenPackages(_keySet, workingResourceSet);
final Map<String, EPackage> loadedEPackages = this.findEPackagesInGenPackages(usedEPackages.keySet(), workingResourceSet);
final Map<EObject, EObject> eNamedElementMapping = this.createENamedElementMapping(usedEPackages, loadedEPackages);
this.replaceReferencesInGeneratedPackages(generatedPackages, eNamedElementMapping);
final Resource ePackageResource = this.createResourceForEPackages(clonedGrammar, generatedPackages, workingResourceSet);
@ -497,9 +492,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
if (this.bindEPackageAndEFactory) {
for (final EPackage pkg : generatedPackages) {
{
Resource _eResource_1 = genModel.eResource();
ResourceSet _resourceSet = _eResource_1.getResourceSet();
final GenPackage genPkg = GenModelUtil2.getGenPackage(pkg, _resourceSet);
final GenPackage genPkg = GenModelUtil2.getGenPackage(pkg, genModel.eResource().getResourceSet());
GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
String _qualifiedPackageInterfaceName = genPkg.getQualifiedPackageInterfaceName();
TypeReference _typeRef = TypeReference.typeRef(_qualifiedPackageInterfaceName);
@ -758,10 +751,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
final HashMap<EObject, EObject> result = CollectionLiterals.<EObject, EObject>newHashMap();
Set<Map.Entry<String, EPackage>> _entrySet = usedEPackages.entrySet();
for (final Map.Entry<String, EPackage> entry : _entrySet) {
EPackage _value = entry.getValue();
String _key = entry.getKey();
EPackage _get = loadedEPackages.get(_key);
this.putMappingData(result, _value, _get);
this.putMappingData(result, entry.getValue(), loadedEPackages.get(entry.getKey()));
}
return result;
}
@ -864,16 +854,12 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
EList<GenPackage> _genPackages = genModel.getGenPackages();
for (final GenPackage genPackage : _genPackages) {
{
String _basePackage = this.getBasePackage(grammar);
genPackage.setBasePackage(_basePackage);
genPackage.setBasePackage(this.getBasePackage(grammar));
if (this.suppressLoadInitialization) {
genPackage.setLoadInitialization(false);
}
if (((!this.getLanguage().getFileExtensions().isEmpty()) && packs.contains(genPackage.getEcorePackage()))) {
IXtextGeneratorLanguage _language = this.getLanguage();
List<String> _fileExtensions = _language.getFileExtensions();
String _join = IterableExtensions.join(_fileExtensions, ",");
genPackage.setFileExtensions(_join);
genPackage.setFileExtensions(IterableExtensions.join(this.getLanguage().getFileExtensions(), ","));
}
}
}
@ -882,8 +868,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
this.reconcileMissingGenPackagesInUsedModels(usedGenPackages);
EList<GenPackage> _usedGenPackages = genModel.getUsedGenPackages();
_usedGenPackages.addAll(usedGenPackages);
Resource _eResource = genModel.eResource();
this.saveResource(_eResource);
this.saveResource(genModel.eResource());
GenModelHelper _genModelHelper = new GenModelHelper();
_genModelHelper.registerGenModel(genModel);
return genModel;
@ -944,23 +929,16 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
};
}
};
String _modelName = this.getModelName(grammar);
genModel.setModelName(_modelName);
String _modelPluginID = this.getModelPluginID();
genModel.setModelPluginID(_modelPluginID);
String _javaModelDirectory = this.getJavaModelDirectory();
genModel.setModelDirectory(_javaModelDirectory);
genModel.setModelName(this.getModelName(grammar));
genModel.setModelPluginID(this.getModelPluginID());
genModel.setModelDirectory(this.getJavaModelDirectory());
if (this.generateEdit) {
String _editPluginID = this.getEditPluginID();
genModel.setEditPluginID(_editPluginID);
String _editDirectory = this.getEditDirectory();
genModel.setEditDirectory(_editDirectory);
genModel.setEditPluginID(this.getEditPluginID());
genModel.setEditDirectory(this.getEditDirectory());
}
if (this.generateEditor) {
String _editorPluginID = this.getEditorPluginID();
genModel.setEditorPluginID(_editorPluginID);
String _editorDirectory = this.getEditorDirectory();
genModel.setEditorDirectory(_editorDirectory);
genModel.setEditorPluginID(this.getEditorPluginID());
genModel.setEditorDirectory(this.getEditorDirectory());
}
genModel.setValidateModel(false);
genModel.setForceOverwrite(true);
@ -970,14 +948,11 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
genModel.setComplianceLevel(this.jdkLevel);
genModel.setRuntimeVersion(this.emfRuntimeVersion);
genModel.setRootExtendsClass("org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container");
String _lineDelimiter = this.codeConfig.getLineDelimiter();
genModel.setLineDelimiter(_lineDelimiter);
genModel.setLineDelimiter(this.codeConfig.getLineDelimiter());
String _fileHeader = this.codeConfig.getFileHeader();
boolean _tripleNotEquals = (_fileHeader != null);
if (_tripleNotEquals) {
String _fileHeader_1 = this.codeConfig.getFileHeader();
String _trimMultiLineComment = EMFGeneratorFragment2.trimMultiLineComment(_fileHeader_1);
genModel.setCopyrightText(_trimMultiLineComment);
genModel.setCopyrightText(EMFGeneratorFragment2.trimMultiLineComment(this.codeConfig.getFileHeader()));
}
}
EList<EObject> _contents_1 = genModelFile.getContents();
@ -1045,9 +1020,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
boolean _exists = IterableExtensions.<GenPackage>exists(_genPackages, _function);
boolean _not = (!_exists);
if (_not) {
Resource _eResource = existingGenModel.eResource();
ResourceSet _resourceSet = _eResource.getResourceSet();
GenPackage _genPackage = GenModelUtil2.getGenPackage(pkg, _resourceSet);
GenPackage _genPackage = GenModelUtil2.getGenPackage(pkg, existingGenModel.eResource().getResourceSet());
result.add(_genPackage);
}
}
@ -1179,11 +1152,8 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment {
boolean _contains = binIncludes.contains(modelContainer);
boolean _not = (!_contains);
if (_not) {
String _newLine_1 = Strings.newLine();
String _plus_2 = ((("bin.includes = " + modelContainer) + "/,\\") + _newLine_1);
String _plus_3 = (_plus_2 + " ");
String _replace = existingContent.replace("bin.includes = ", _plus_3);
existingContent = _replace;
existingContent = existingContent.replace("bin.includes = ",
(((("bin.includes = " + modelContainer) + "/,\\") + Strings.newLine()) + " "));
changed = true;
}
}

View file

@ -11,7 +11,6 @@ import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import com.google.inject.Inject;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger;
@ -145,18 +144,11 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment {
Grammar _grammar = this.getGrammar();
TypeReference _formatter2Stub = this.getFormatter2Stub(_grammar);
final XtendFileAccess xtendFile = this.fileAccessFactory.createXtendFile(_formatter2Stub);
IXtextGeneratorLanguage _language = this.getLanguage();
ResourceSet _resourceSet = _language.getResourceSet();
xtendFile.setResourceSet(_resourceSet);
xtendFile.setResourceSet(this.getLanguage().getResourceSet());
final LinkedHashMultimap<EClass, EReference> type2ref = LinkedHashMultimap.<EClass, EReference>create();
IXtextGeneratorLanguage _language_1 = this.getLanguage();
Grammar _grammar_1 = _language_1.getGrammar();
this.getLocallyAssignedContainmentReferences(_grammar_1, type2ref);
this.getLocallyAssignedContainmentReferences(this.getLanguage().getGrammar(), type2ref);
final LinkedHashMultimap<EClass, EReference> inheritedTypes = LinkedHashMultimap.<EClass, EReference>create();
IXtextGeneratorLanguage _language_2 = this.getLanguage();
Grammar _grammar_2 = _language_2.getGrammar();
HashSet<Grammar> _newHashSet = CollectionLiterals.<Grammar>newHashSet();
this.getInheritedContainmentReferences(_grammar_2, inheritedTypes, _newHashSet);
this.getInheritedContainmentReferences(this.getLanguage().getGrammar(), inheritedTypes, CollectionLiterals.<Grammar>newHashSet());
final Set<EClass> types = type2ref.keySet();
StringConcatenationClient _client = new StringConcatenationClient() {
@Override

View file

@ -7,7 +7,6 @@
*/
package org.eclipse.xtext.xtext.generator.grammarAccess;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.emf.common.util.EList;
@ -83,9 +82,7 @@ public class FragmentFakingEcoreResource extends XMIResourceImpl {
boolean _tripleNotEquals = (_eSuperPackage != null);
if (_tripleNotEquals) {
final StringBuilder result = new StringBuilder(60);
EPackage _ePackage_1 = classifier.getEPackage();
HashSet<EPackage> _newHashSet = CollectionLiterals.<EPackage>newHashSet();
this.calculateURIFragment(_ePackage_1, result, _newHashSet);
this.calculateURIFragment(classifier.getEPackage(), result, CollectionLiterals.<EPackage>newHashSet());
String _name = classifier.getName();
result.append(_name);
return result.toString();
@ -107,8 +104,7 @@ public class FragmentFakingEcoreResource extends XMIResourceImpl {
Resource _eResource_1 = _eSuperPackage_1.eResource();
boolean _tripleEquals = (_eResource == _eResource_1);
if (_tripleEquals) {
EPackage _eSuperPackage_2 = ePackage.getESuperPackage();
this.calculateURIFragment(_eSuperPackage_2, result, visited);
this.calculateURIFragment(ePackage.getESuperPackage(), result, visited);
EList<EClassifier> _eClassifiers = ePackage.getEClassifiers();
boolean _isEmpty = _eClassifiers.isEmpty();
boolean _not_1 = (!_isEmpty);

View file

@ -163,12 +163,10 @@ public class GrammarAccessExtensions {
private String toJavaIdentifier(final List<String> text, final boolean uppercaseFirst) {
final Iterator<String> i = text.iterator();
String _next = i.next();
String _javaIdentifierSegment = this.toJavaIdentifierSegment(_next, true, uppercaseFirst);
String _javaIdentifierSegment = this.toJavaIdentifierSegment(i.next(), true, uppercaseFirst);
final StringBuilder b = new StringBuilder(_javaIdentifierSegment);
while (i.hasNext()) {
String _next_1 = i.next();
String _javaIdentifierSegment_1 = this.toJavaIdentifierSegment(_next_1, false, true);
String _javaIdentifierSegment_1 = this.toJavaIdentifierSegment(i.next(), false, true);
b.append(_javaIdentifierSegment_1);
}
return b.toString();
@ -201,10 +199,7 @@ public class GrammarAccessExtensions {
}
}
}
String _string = builder.toString();
String _lowerCase = _string.toLowerCase();
String _trim = _lowerCase.trim();
return this.toJavaIdentifierSegmentInt(_trim, isFirst, true);
return this.toJavaIdentifierSegmentInt(builder.toString().toLowerCase().trim(), isFirst, true);
}
/**
@ -656,13 +651,11 @@ public class GrammarAccessExtensions {
SaveOptions.Builder _newBuilder = SaveOptions.newBuilder();
SaveOptions.Builder _format = _newBuilder.format();
final SaveOptions options = _format.getOptions();
String _serialize = serializer.serialize(object, options);
s = _serialize;
s = serializer.serialize(object, options);
} catch (final Throwable _t) {
if (_t instanceof Exception) {
final Exception e = (Exception)_t;
String _string = e.toString();
s = _string;
s = e.toString();
} else {
throw Exceptions.sneakyThrow(_t);
}
@ -721,9 +714,7 @@ public class GrammarAccessExtensions {
int _size = _usedGrammars.size();
boolean _equals = (_size == 1);
if (_equals) {
EList<Grammar> _usedGrammars_1 = it.getUsedGrammars();
Grammar _head = IterableExtensions.<Grammar>head(_usedGrammars_1);
return this.initialHiddenTokens(_head);
return this.initialHiddenTokens(IterableExtensions.<Grammar>head(it.getUsedGrammars()));
}
_xblockexpression = CollectionLiterals.<String>emptyList();
}
@ -950,8 +941,7 @@ public class GrammarAccessExtensions {
};
GrammarAccessExtensions.LineSeparatorModule _lineSeparatorModule = new GrammarAccessExtensions.LineSeparatorModule(_function);
final Injector injector = Guice.createInjector(_lineSeparatorModule);
ISerializer _instance = injector.<ISerializer>getInstance(ISerializer.class);
result = _instance;
result = injector.<ISerializer>getInstance(ISerializer.class);
this.xtextSerializerByLineDelimiter.put(delimiter, result);
return result;
}

View file

@ -236,8 +236,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment {
if ((packResourceSet != null)) {
EPackage topMost = pack;
while (((topMost.getESuperPackage() != null) && (topMost.getESuperPackage().eResource() == topMost.eResource()))) {
EPackage _eSuperPackage = topMost.getESuperPackage();
topMost = _eSuperPackage;
topMost = topMost.getESuperPackage();
}
if ((packResource.getContents().contains(topMost) && (packResource.getContents().size() == 1))) {
EList<EClassifier> _eClassifiers = topMost.getEClassifiers();
@ -248,8 +247,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment {
URI _createURI = URI.createURI(_nsURI_1);
packResource.setURI(_createURI);
} else {
ResourceSet _resourceSet = resource.getResourceSet();
this.moveSubpackagesToNewResource(topMost, _resourceSet);
this.moveSubpackagesToNewResource(topMost, resource.getResourceSet());
}
}
Resource _eResource = topMost.eResource();
@ -259,8 +257,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment {
boolean _equals = _string_1.equals(_nsURI_2);
boolean _not_2 = (!_equals);
if (_not_2) {
ResourceSet _resourceSet_1 = resource.getResourceSet();
this.movePackageToNewResource(topMost, _resourceSet_1);
this.movePackageToNewResource(topMost, resource.getResourceSet());
}
}
}
@ -574,9 +571,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment {
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
IXtextGeneratorLanguage _language_12 = GrammarAccessFragment2.this.getLanguage();
Grammar _grammar_12 = _language_12.getGrammar();
StringConcatenationClient _ter = GrammarAccessFragment2.this.getter(r_4, _grammar_12);
StringConcatenationClient _ter = GrammarAccessFragment2.this.getter(r_4, GrammarAccessFragment2.this.getLanguage().getGrammar());
_builder.append(_ter, "\t");
_builder.newLineIfNotEmpty();
}

View file

@ -268,10 +268,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment {
JavaFileAccess _compileFacetConfiguration = this.compileFacetConfiguration(grammar);
JavaFileAccess _compileColorSettingsPage = this.compileColorSettingsPage(grammar);
final Consumer<JavaFileAccess> _function = (JavaFileAccess it) -> {
IXtextProjectConfig _projectConfig_1 = this.getProjectConfig();
ISubProjectConfig _ideaPlugin_1 = _projectConfig_1.getIdeaPlugin();
IXtextGeneratorFileSystemAccess _src = _ideaPlugin_1.getSrc();
it.writeTo(_src);
it.writeTo(this.getProjectConfig().getIdeaPlugin().getSrc());
};
Collections.<JavaFileAccess>unmodifiableList(CollectionLiterals.<JavaFileAccess>newArrayList(_compileStandaloneSetup, _compileIdeaSetup, _compileCompletionContributor, _compileFileType, _compileFacetConfiguration, _compileColorSettingsPage)).forEach(_function);
TextFileAccess _compileServicesISetup = this.compileServicesISetup(grammar);
@ -293,10 +290,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment {
JavaFileAccess _compileFacetType = this.compileFacetType(grammar);
JavaFileAccess _compileBaseColorSettingsPage = this.compileBaseColorSettingsPage(grammar);
final Consumer<TextFileAccess> _function_1 = (TextFileAccess it) -> {
IXtextProjectConfig _projectConfig_1 = this.getProjectConfig();
ISubProjectConfig _ideaPlugin_1 = _projectConfig_1.getIdeaPlugin();
IXtextGeneratorFileSystemAccess _srcGen = _ideaPlugin_1.getSrcGen();
it.writeTo(_srcGen);
it.writeTo(this.getProjectConfig().getIdeaPlugin().getSrcGen());
};
Collections.<TextFileAccess>unmodifiableList(CollectionLiterals.<TextFileAccess>newArrayList(_compileServicesISetup, _compileAbstractCompletionContributor, _compileLanguage, _compileAbstractFileType, _compileFileTypeFactory, _compileFileImpl, _compileTokenTypeProvider, _compileElementTypeProvider, _compileParserDefinition, _compileSyntaxHighlighterFactory, _compileSemanticHighlightVisitor, _compileExtensionFactory, _compileCodeBlockModificationListener, _compilePsiParser, _compileAntlrTokenFileProvider, _compilePomDeclarationSearcher, _compileFacetType, _compileBaseColorSettingsPage)).forEach(_function_1);
if (this.deployable) {

View file

@ -267,8 +267,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen
if ((it instanceof ParserRule)) {
boolean _isPassCurrentIntoFragment = this.isPassCurrentIntoFragment();
boolean _not = (!_isPassCurrentIntoFragment);
String _currentType = this.getCurrentType();
String _parameterList = AntlrGrammarGenUtil.getParameterList(((ParserRule)it), Boolean.valueOf(_not), _currentType);
String _parameterList = AntlrGrammarGenUtil.getParameterList(((ParserRule)it), Boolean.valueOf(_not), this.getCurrentType());
_builder.append(_parameterList);
}
}
@ -416,8 +415,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen
_builder_1.append("{");
_builder_1.newLine();
_builder_1.append("\t");
String _localVar_1 = this._grammarAccessExtensions.localVar(it);
CharSequence _doneLeaf = this.doneLeaf(it, _localVar_1);
CharSequence _doneLeaf = this.doneLeaf(it, this._grammarAccessExtensions.localVar(it));
_builder_1.append(_doneLeaf, "\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");
@ -503,9 +501,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen
_builder.append("{");
_builder.newLine();
_builder.append("\t");
Assignment _containingAssignment_1 = GrammarUtil.containingAssignment(it);
String _localVar_1 = this._grammarAccessExtensions.localVar(_containingAssignment_1, it);
CharSequence _doneLeaf = this.doneLeaf(it, _localVar_1);
CharSequence _doneLeaf = this.doneLeaf(it, this._grammarAccessExtensions.localVar(GrammarUtil.containingAssignment(it), it));
_builder.append(_doneLeaf, "\t");
_builder.newLineIfNotEmpty();
_builder.append("}");
@ -521,8 +517,8 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");
_builder_1.newLine();
String _localVar_2 = this._grammarAccessExtensions.localVar(it);
_builder_1.append(_localVar_2);
String _localVar_1 = this._grammarAccessExtensions.localVar(it);
_builder_1.append(_localVar_1);
_builder_1.append("=");
String __ebnf2_1 = super._ebnf2(it, options, supportActions);
_builder_1.append(__ebnf2_1);
@ -530,8 +526,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen
_builder_1.append("{");
_builder_1.newLine();
_builder_1.append("\t");
String _localVar_3 = this._grammarAccessExtensions.localVar(it);
CharSequence _doneLeaf_1 = this.doneLeaf(it, _localVar_3);
CharSequence _doneLeaf_1 = this.doneLeaf(it, this._grammarAccessExtensions.localVar(it));
_builder_1.append(_doneLeaf_1, "\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");
@ -567,8 +562,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen
_builder.append("{");
_builder.newLine();
_builder.append("\t");
String _localVar_1 = this._grammarAccessExtensions.localVar(it);
CharSequence _doneLeaf = this.doneLeaf(it, _localVar_1);
CharSequence _doneLeaf = this.doneLeaf(it, this._grammarAccessExtensions.localVar(it));
_builder.append(_doneLeaf, "\t");
_builder.newLineIfNotEmpty();
_builder.append("}");
@ -740,8 +734,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen
_builder_1.append("{");
_builder_1.newLine();
_builder_1.append("\t");
String _localVar_1 = this._grammarAccessExtensions.localVar(it);
CharSequence _doneLeaf = this.doneLeaf(it, _localVar_1);
CharSequence _doneLeaf = this.doneLeaf(it, this._grammarAccessExtensions.localVar(it));
_builder_1.append(_doneLeaf, "\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");
@ -1005,8 +998,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen
_builder_1.append("{");
_builder_1.newLine();
_builder_1.append("\t");
String _localVar_2 = this._grammarAccessExtensions.localVar(assignment, it);
CharSequence _doneLeaf = this.doneLeaf(it, _localVar_2);
CharSequence _doneLeaf = this.doneLeaf(it, this._grammarAccessExtensions.localVar(assignment, it));
_builder_1.append(_doneLeaf, "\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");

View file

@ -15,7 +15,6 @@ import org.eclipse.xtext.xtext.generator.CodeConfig;
import org.eclipse.xtext.xtext.generator.idea.parser.antlr.PsiAntlrGrammarGenerator;
import org.eclipse.xtext.xtext.generator.idea.parser.antlr.PsiGrammarNaming;
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
import org.eclipse.xtext.xtext.generator.model.TypeReference;
import org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig;
import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig;
import org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2;
@ -59,34 +58,14 @@ public class XtextAntlrIDEAGeneratorFragment extends AbstractAntlrGeneratorFragm
_builder.append(grammarFileName);
final String absoluteGrammarFileName = _builder.toString();
this.addAntlrParam("-fo");
int _lastIndexOf = absoluteGrammarFileName.lastIndexOf("/");
String _substring = absoluteGrammarFileName.substring(0, _lastIndexOf);
this.addAntlrParam(_substring);
this.addAntlrParam(absoluteGrammarFileName.substring(0, absoluteGrammarFileName.lastIndexOf("/")));
AntlrToolFacade _antlrTool = this.getAntlrTool();
String[] _antlrParams = this.getAntlrParams();
_antlrTool.runWithEncodingAndParams(absoluteGrammarFileName, encoding, _antlrParams);
Grammar _grammar_2 = this.getGrammar();
Grammar _grammar_3 = this.getGrammar();
TypeReference _internalParserClass = this._psiGrammarNaming.getInternalParserClass(_grammar_3);
this.simplifyUnorderedGroupPredicatesIfRequired(_grammar_2, fsa, _internalParserClass);
Grammar _grammar_4 = this.getGrammar();
TypeReference _internalParserClass_1 = this._psiGrammarNaming.getInternalParserClass(_grammar_4);
Grammar _grammar_5 = this.getGrammar();
TypeReference _lexerClass = this._psiGrammarNaming.getLexerClass(_grammar_5);
this.splitParserAndLexerIfEnabled(fsa, _internalParserClass_1, _lexerClass);
Grammar _grammar_6 = this.getGrammar();
AntlrGrammar _lexerGrammar = this._psiGrammarNaming.getLexerGrammar(_grammar_6);
String _tokensFileName = _lexerGrammar.getTokensFileName();
this.normalizeTokens(fsa, _tokensFileName);
Grammar _grammar_7 = this.getGrammar();
TypeReference _internalParserClass_2 = this._psiGrammarNaming.getInternalParserClass(_grammar_7);
Grammar _grammar_8 = this.getGrammar();
TypeReference _lexerClass_1 = this._psiGrammarNaming.getLexerClass(_grammar_8);
this.suppressWarnings(fsa, _internalParserClass_2, _lexerClass_1);
Grammar _grammar_9 = this.getGrammar();
TypeReference _internalParserClass_3 = this._psiGrammarNaming.getInternalParserClass(_grammar_9);
Grammar _grammar_10 = this.getGrammar();
TypeReference _lexerClass_2 = this._psiGrammarNaming.getLexerClass(_grammar_10);
this.normalizeLineDelimiters(fsa, _internalParserClass_3, _lexerClass_2);
this.simplifyUnorderedGroupPredicatesIfRequired(this.getGrammar(), fsa, this._psiGrammarNaming.getInternalParserClass(this.getGrammar()));
this.splitParserAndLexerIfEnabled(fsa, this._psiGrammarNaming.getInternalParserClass(this.getGrammar()), this._psiGrammarNaming.getLexerClass(this.getGrammar()));
this.normalizeTokens(fsa, this._psiGrammarNaming.getLexerGrammar(this.getGrammar()).getTokensFileName());
this.suppressWarnings(fsa, this._psiGrammarNaming.getInternalParserClass(this.getGrammar()), this._psiGrammarNaming.getLexerClass(this.getGrammar()));
this.normalizeLineDelimiters(fsa, this._psiGrammarNaming.getInternalParserClass(this.getGrammar()), this._psiGrammarNaming.getLexerClass(this.getGrammar()));
}
}

View file

@ -55,8 +55,7 @@ public class GeneratedJavaFileAccess extends JavaFileAccess {
{
Iterable<IClassAnnotation> _classAnnotations = this.getClassAnnotations();
final Consumer<IClassAnnotation> _function = (IClassAnnotation it) -> {
TypeReference _annotationImport = it.getAnnotationImport();
this.importType(_annotationImport);
this.importType(it.getAnnotationImport());
};
_classAnnotations.forEach(_function);
_xblockexpression = super.getContent();

View file

@ -268,11 +268,7 @@ public class GuiceModuleAccess {
private final Set<GuiceModuleAccess.Binding> bindings = CollectionLiterals.<GuiceModuleAccess.Binding>newLinkedHashSet();
public BindingFactory() {
Exception _exception = new Exception();
StackTraceElement[] _stackTrace = _exception.getStackTrace();
StackTraceElement _get = _stackTrace[1];
String _className = _get.getClassName();
this.contributedBy = _className;
this.contributedBy = new Exception().getStackTrace()[1].getClassName();
}
public BindingFactory(final String contributedBy) {
@ -337,107 +333,77 @@ public class GuiceModuleAccess {
}
public GuiceModuleAccess.BindingFactory addTypeToInstance(final TypeReference type, final StringConcatenationClient expression) {
GuiceModuleAccess.BindKey _key = this.key(type);
GuiceModuleAccess.BindValue _expr = this.expr(expression);
this.add(_key, _expr);
this.add(this.key(type), this.expr(expression));
return this;
}
public GuiceModuleAccess.BindingFactory addTypeToProviderInstance(final TypeReference type, final StringConcatenationClient expression) {
GuiceModuleAccess.BindKey _key = this.key(type);
GuiceModuleAccess.BindValue _providerExpr = this.providerExpr(expression);
this.add(_key, _providerExpr);
this.add(this.key(type), this.providerExpr(expression));
return this;
}
public GuiceModuleAccess.BindingFactory addConfiguredBinding(final String name, final StringConcatenationClient statement) {
GuiceModuleAccess.BindKey _key = this.key(name);
GuiceModuleAccess.BindValue _statements = this.statements(new Object[] { statement });
this.add(_key, _statements);
this.add(this.key(name), this.statements(new Object[] { statement }));
return this;
}
public GuiceModuleAccess.BindingFactory addTypeToType(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _key = this.key(keyType);
GuiceModuleAccess.BindValue _value = this.value(valueType);
this.add(_key, _value);
this.add(this.key(keyType), this.value(valueType));
return this;
}
public GuiceModuleAccess.BindingFactory addTypeToTypeSingleton(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _singleton = this.singleton(keyType);
GuiceModuleAccess.BindValue _value = this.value(valueType);
this.add(_singleton, _value);
this.add(this.singleton(keyType), this.value(valueType));
return this;
}
public GuiceModuleAccess.BindingFactory addTypeToTypeEagerSingleton(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _eagerSingleton = this.eagerSingleton(keyType);
GuiceModuleAccess.BindValue _value = this.value(valueType);
this.add(_eagerSingleton, _value);
this.add(this.eagerSingleton(keyType), this.value(valueType));
return this;
}
public GuiceModuleAccess.BindingFactory addTypeToProvider(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _key = this.key(keyType);
GuiceModuleAccess.BindValue _provider = this.provider(valueType);
this.add(_key, _provider);
this.add(this.key(keyType), this.provider(valueType));
return this;
}
public GuiceModuleAccess.BindingFactory addTypeToProviderSingleton(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _singleton = this.singleton(keyType);
GuiceModuleAccess.BindValue _provider = this.provider(valueType);
this.add(_singleton, _provider);
this.add(this.singleton(keyType), this.provider(valueType));
return this;
}
public GuiceModuleAccess.BindingFactory addTypeToProviderEagerSingleton(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _eagerSingleton = this.eagerSingleton(keyType);
GuiceModuleAccess.BindValue _provider = this.provider(valueType);
this.add(_eagerSingleton, _provider);
this.add(this.eagerSingleton(keyType), this.provider(valueType));
return this;
}
public GuiceModuleAccess.BindingFactory addfinalTypeToType(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _key = this.key(keyType);
GuiceModuleAccess.BindValue _value = this.value(valueType);
this.add(_key, _value, true);
this.add(this.key(keyType), this.value(valueType), true);
return this;
}
public GuiceModuleAccess.BindingFactory addfinalTypeToTypeSingleton(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _singleton = this.singleton(keyType);
GuiceModuleAccess.BindValue _value = this.value(valueType);
this.add(_singleton, _value, true);
this.add(this.singleton(keyType), this.value(valueType), true);
return this;
}
public GuiceModuleAccess.BindingFactory addfinalTypeToTypeEagerSingleton(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _eagerSingleton = this.eagerSingleton(keyType);
GuiceModuleAccess.BindValue _value = this.value(valueType);
this.add(_eagerSingleton, _value, true);
this.add(this.eagerSingleton(keyType), this.value(valueType), true);
return this;
}
public GuiceModuleAccess.BindingFactory addfinalTypeToProvider(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _key = this.key(keyType);
GuiceModuleAccess.BindValue _provider = this.provider(valueType);
this.add(_key, _provider, true);
this.add(this.key(keyType), this.provider(valueType), true);
return this;
}
public GuiceModuleAccess.BindingFactory addfinalTypeToProviderSingleton(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _singleton = this.singleton(keyType);
GuiceModuleAccess.BindValue _provider = this.provider(valueType);
this.add(_singleton, _provider, true);
this.add(this.singleton(keyType), this.provider(valueType), true);
return this;
}
public GuiceModuleAccess.BindingFactory addfinalTypeToProviderEagerSingleton(final TypeReference keyType, final TypeReference valueType) {
GuiceModuleAccess.BindKey _eagerSingleton = this.eagerSingleton(keyType);
GuiceModuleAccess.BindValue _provider = this.provider(valueType);
this.add(_eagerSingleton, _provider, true);
this.add(this.eagerSingleton(keyType), this.provider(valueType), true);
return this;
}

View file

@ -122,8 +122,7 @@ public class JavaFileAccess extends TextFileAccess {
final List<String> simpleNames = typeRef.getSimpleNames();
String usableName = null;
if ((Objects.equal(typeRef.getPackageName(), "java.lang") || Objects.equal(typeRef.getPackageName(), this.javaType.getPackageName()))) {
String _join = IterableExtensions.join(simpleNames, ".");
usableName = _join;
usableName = IterableExtensions.join(simpleNames, ".");
} else {
boolean found = false;
for (int i = (((Object[])Conversions.unwrapArray(simpleNames, Object.class)).length - 1); ((i >= 0) && (!found)); i--) {
@ -138,8 +137,8 @@ public class JavaFileAccess extends TextFileAccess {
String _packageName = typeRef.getPackageName();
String _plus = (_packageName + ".");
List<String> _subList = simpleNames.subList(0, (i + 1));
String _join_1 = IterableExtensions.join(_subList, ".");
final String importable = (_plus + _join_1);
String _join = IterableExtensions.join(_subList, ".");
final String importable = (_plus + _join);
final String imported = this.imports.get(usableName);
if ((imported == null)) {
this.imports.put(usableName, importable);
@ -154,16 +153,15 @@ public class JavaFileAccess extends TextFileAccess {
}
}
if ((!found)) {
String _name = typeRef.getName();
usableName = _name;
usableName = typeRef.getName();
}
}
List<TypeReference> _typeArguments = typeRef.getTypeArguments();
final Function1<TypeReference, CharSequence> _function = (TypeReference it) -> {
return this.importType(it);
};
String _join_1 = IterableExtensions.<TypeReference>join(_typeArguments, "<", ", ", ">", _function);
return (usableName + _join_1);
String _join = IterableExtensions.<TypeReference>join(_typeArguments, "<", ", ", ">", _function);
return (usableName + _join);
}
@Override

View file

@ -9,7 +9,6 @@ package org.eclipse.xtext.xtext.generator.model;
import com.google.common.base.Objects;
import com.google.common.base.Splitter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.codegen.ecore.genmodel.GenClass;
@ -82,8 +81,7 @@ public class TypeReference {
throw new IllegalArgumentException(("Invalid class name: " + className));
}
this.packageName = packageName;
String[] _split = className.split("\\.");
this.simpleNames = ((List<String>)Conversions.doWrapArray(_split));
this.simpleNames = ((List<String>)Conversions.doWrapArray(className.split("\\.")));
List<TypeReference> _elvis = null;
if (arguments != null) {
_elvis = arguments;
@ -117,11 +115,8 @@ public class TypeReference {
String _plus_2 = ("Class is local: " + _name_2);
throw new IllegalArgumentException(_plus_2);
}
Package _package = clazz.getPackage();
String _name_3 = _package.getName();
this.packageName = _name_3;
ArrayList<String> _newArrayList = CollectionLiterals.<String>newArrayList();
this.simpleNames = _newArrayList;
this.packageName = clazz.getPackage().getName();
this.simpleNames = CollectionLiterals.<String>newArrayList();
List<TypeReference> _elvis = null;
if (arguments != null) {
_elvis = arguments;
@ -135,8 +130,7 @@ public class TypeReference {
{
String _simpleName = c.getSimpleName();
this.simpleNames.add(0, _simpleName);
Class<?> _declaringClass = c.getDeclaringClass();
c = _declaringClass;
c = c.getDeclaringClass();
}
} while((c != null));
}
@ -182,11 +176,7 @@ public class TypeReference {
char _charAt = _last.charAt(0);
boolean _isUpperCase = Character.isUpperCase(_charAt);
if (_isUpperCase) {
final List<String> _converted_packageSegments_1 = (List<String>)packageSegments_1;
int _length_2 = ((Object[])Conversions.unwrapArray(_converted_packageSegments_1, Object.class)).length;
int _minus_2 = (_length_2 - 1);
List<String> _subList = packageSegments_1.subList(0, _minus_2);
packageSegments_1 = _subList;
packageSegments_1 = packageSegments_1.subList(0, (((Object[])Conversions.unwrapArray(packageSegments_1, Object.class)).length - 1));
} else {
return IterableExtensions.join(packageSegments_1, ".");
}

View file

@ -18,8 +18,7 @@ import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
@SuppressWarnings("all")
public class XtextGeneratorFileSystemAccess extends JavaIoFileSystemAccess implements IXtextGeneratorFileSystemAccess {
public XtextGeneratorFileSystemAccess(final String path, final boolean overwrite) {
String _removeTrailingPathSeparator = this.removeTrailingPathSeparator(path);
this.setOutputPath(_removeTrailingPathSeparator);
this.setOutputPath(this.removeTrailingPathSeparator(path));
OutputConfiguration _defaultOutput = this.getDefaultOutput();
_defaultOutput.setOverrideExistingResources(overwrite);
}

View file

@ -14,10 +14,8 @@ import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
import org.eclipse.xtext.xtext.generator.model.XtextGeneratorFileSystemAccess;
import org.eclipse.xtext.xtext.generator.model.project.BundleProjectConfig;
import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig;
import org.eclipse.xtext.xtext.generator.model.project.XtextProjectConfig;
/**
* @noextend
@ -76,9 +74,7 @@ public class RuntimeProjectConfig extends BundleProjectConfig implements IRuntim
public void initialize(final Injector injector) {
super.initialize(injector);
if ((this.ecoreModelPath != null)) {
XtextProjectConfig _owner = this.getOwner();
XtextGeneratorFileSystemAccess _newFileSystemAccess = _owner.newFileSystemAccess(this.ecoreModelPath, true);
this.ecoreModel = _newFileSystemAccess;
this.ecoreModel = this.getOwner().newFileSystemAccess(this.ecoreModelPath, true);
this.ecoreModel.initialize(injector);
}
}

View file

@ -68,46 +68,39 @@ public class StandardProjectConfig extends XtextProjectConfig {
String _name = it.getName();
boolean _tripleEquals = (_name == null);
if (_tripleEquals) {
String _computeName = this.computeName(it);
it.setName(_computeName);
it.setName(this.computeName(it));
}
String _rootPath = it.getRootPath();
boolean _tripleEquals_1 = (_rootPath == null);
if (_tripleEquals_1) {
String _computeRoot = this.computeRoot(it);
it.setRoot(_computeRoot);
it.setRoot(this.computeRoot(it));
}
String _metaInfPath = it.getMetaInfPath();
boolean _tripleEquals_2 = (_metaInfPath == null);
if (_tripleEquals_2) {
String _computeMetaInf = this.computeMetaInf(it);
it.setMetaInf(_computeMetaInf);
it.setMetaInf(this.computeMetaInf(it));
}
String _srcPath = it.getSrcPath();
boolean _tripleEquals_3 = (_srcPath == null);
if (_tripleEquals_3) {
String _computeSrc = this.computeSrc(it);
it.setSrc(_computeSrc);
it.setSrc(this.computeSrc(it));
}
String _srcGenPath = it.getSrcGenPath();
boolean _tripleEquals_4 = (_srcGenPath == null);
if (_tripleEquals_4) {
String _computeSrcGen = this.computeSrcGen(it);
it.setSrcGen(_computeSrcGen);
it.setSrcGen(this.computeSrcGen(it));
}
if ((it instanceof BundleProjectConfig)) {
if (this.createEclipseMetaData) {
ManifestAccess _manifest = ((BundleProjectConfig)it).getManifest();
boolean _tripleEquals_5 = (_manifest == null);
if (_tripleEquals_5) {
ManifestAccess _newManifestAccess = this.newManifestAccess();
((BundleProjectConfig)it).setManifest(_newManifestAccess);
((BundleProjectConfig)it).setManifest(this.newManifestAccess());
}
PluginXmlAccess _pluginXml = ((BundleProjectConfig)it).getPluginXml();
boolean _tripleEquals_6 = (_pluginXml == null);
if (_tripleEquals_6) {
PluginXmlAccess _newPluginXmlAccess = this.newPluginXmlAccess();
((BundleProjectConfig)it).setPluginXml(_newPluginXmlAccess);
((BundleProjectConfig)it).setPluginXml(this.newPluginXmlAccess());
}
}
}
@ -115,16 +108,14 @@ public class StandardProjectConfig extends XtextProjectConfig {
String _ecoreModelPath = ((RuntimeProjectConfig)it).getEcoreModelPath();
boolean _tripleEquals_7 = (_ecoreModelPath == null);
if (_tripleEquals_7) {
String _computeEcoreModel = this.computeEcoreModel(((RuntimeProjectConfig)it));
((RuntimeProjectConfig)it).setEcoreModel(_computeEcoreModel);
((RuntimeProjectConfig)it).setEcoreModel(this.computeEcoreModel(((RuntimeProjectConfig)it)));
}
}
if ((it instanceof WebProjectConfig)) {
String _assetsPath = ((WebProjectConfig)it).getAssetsPath();
boolean _tripleEquals_8 = (_assetsPath == null);
if (_tripleEquals_8) {
String _computeAssets = this.computeAssets(((WebProjectConfig)it));
((WebProjectConfig)it).setAssets(_computeAssets);
((WebProjectConfig)it).setAssets(this.computeAssets(((WebProjectConfig)it)));
}
}
};

View file

@ -15,7 +15,6 @@ import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import org.eclipse.xtext.xtext.generator.Issues;
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
import org.eclipse.xtext.xtext.generator.model.XtextGeneratorFileSystemAccess;
import org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig;
import org.eclipse.xtext.xtext.generator.model.project.XtextProjectConfig;
@ -86,29 +85,25 @@ public class SubProjectConfig implements ISubProjectConfig {
boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(this.rootPath);
boolean _not = (!_isNullOrEmpty);
if (_not) {
XtextGeneratorFileSystemAccess _newFileSystemAccess = this.owner.newFileSystemAccess(this.rootPath, true);
this.root = _newFileSystemAccess;
this.root = this.owner.newFileSystemAccess(this.rootPath, true);
this.root.initialize(injector);
}
boolean _isNullOrEmpty_1 = StringExtensions.isNullOrEmpty(this.metaInfPath);
boolean _not_1 = (!_isNullOrEmpty_1);
if (_not_1) {
XtextGeneratorFileSystemAccess _newFileSystemAccess_1 = this.owner.newFileSystemAccess(this.metaInfPath, true);
this.metaInf = _newFileSystemAccess_1;
this.metaInf = this.owner.newFileSystemAccess(this.metaInfPath, true);
this.metaInf.initialize(injector);
}
boolean _isNullOrEmpty_2 = StringExtensions.isNullOrEmpty(this.srcPath);
boolean _not_2 = (!_isNullOrEmpty_2);
if (_not_2) {
XtextGeneratorFileSystemAccess _newFileSystemAccess_2 = this.owner.newFileSystemAccess(this.srcPath, this.overwriteSrc);
this.src = _newFileSystemAccess_2;
this.src = this.owner.newFileSystemAccess(this.srcPath, this.overwriteSrc);
this.src.initialize(injector);
}
boolean _isNullOrEmpty_3 = StringExtensions.isNullOrEmpty(this.srcGenPath);
boolean _not_3 = (!_isNullOrEmpty_3);
if (_not_3) {
XtextGeneratorFileSystemAccess _newFileSystemAccess_3 = this.owner.newFileSystemAccess(this.srcGenPath, true);
this.srcGen = _newFileSystemAccess_3;
this.srcGen = this.owner.newFileSystemAccess(this.srcGenPath, true);
this.srcGen.initialize(injector);
}
}

View file

@ -12,10 +12,8 @@ import org.eclipse.xtend.lib.annotations.AccessorType;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
import org.eclipse.xtext.xtext.generator.model.XtextGeneratorFileSystemAccess;
import org.eclipse.xtext.xtext.generator.model.project.IWebProjectConfig;
import org.eclipse.xtext.xtext.generator.model.project.SubProjectConfig;
import org.eclipse.xtext.xtext.generator.model.project.XtextProjectConfig;
/**
* @noextend
@ -36,9 +34,7 @@ public class WebProjectConfig extends SubProjectConfig implements IWebProjectCon
public void initialize(final Injector injector) {
super.initialize(injector);
if ((this.assetsPath != null)) {
XtextProjectConfig _owner = this.getOwner();
XtextGeneratorFileSystemAccess _newFileSystemAccess = _owner.newFileSystemAccess(this.assetsPath, true);
this.assets = _newFileSystemAccess;
this.assets = this.getOwner().newFileSystemAccess(this.assetsPath, true);
this.assets.initialize(injector);
}
}

View file

@ -125,8 +125,7 @@ public class XtextProjectConfig implements IXtextProjectConfig {
protected ManifestAccess newManifestAccess() {
ManifestAccess _manifestAccess = new ManifestAccess();
final Procedure1<ManifestAccess> _function = (ManifestAccess it) -> {
String _lineDelimiter = this.codeConfig.getLineDelimiter();
it.setLineDelimiter(_lineDelimiter);
it.setLineDelimiter(this.codeConfig.getLineDelimiter());
};
return ObjectExtensions.<ManifestAccess>operator_doubleArrow(_manifestAccess, _function);
}

View file

@ -23,7 +23,6 @@ import java.util.Set;
import java.util.function.Consumer;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtend.lib.annotations.AccessorType;
import org.eclipse.xtend.lib.annotations.Accessors;
@ -118,8 +117,7 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener
protected abstract void doGenerate();
protected void checkGrammar() {
Grammar _grammar = this.getGrammar();
boolean _hasProductionRules = this.hasProductionRules(_grammar);
boolean _hasProductionRules = this.hasProductionRules(this.getGrammar());
boolean _not = (!_hasProductionRules);
if (_not) {
throw new IllegalArgumentException("You may not generate an ANTLR parser for a grammar without production rules.");
@ -186,8 +184,7 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener
UnorderedGroupsSplitter splitter = new UnorderedGroupsSplitter(content);
String transformed = splitter.transform();
SyntacticPredicateFixup fixup = new SyntacticPredicateFixup(transformed);
String _transform = fixup.transform();
transformed = _transform;
transformed = fixup.transform();
BacktrackingGuardForUnorderedGroupsRemover remover = new BacktrackingGuardForUnorderedGroupsRemover(transformed);
String newContent = remover.transform();
String _javaPath_1 = parser.getJavaPath();
@ -215,15 +212,10 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener
String _javaPath = type.getJavaPath();
CharSequence _readTextFile = fsa.readTextFile(_javaPath);
String content = _readTextFile.toString();
content = this.newLineNormalizer.postProcess(fsa.getURI(type.getJavaPath()), content).toString();
content = content.replaceAll("\"\\+(\\r)?\\n\\s+\"", "");
String _javaPath_1 = type.getJavaPath();
URI _uRI = fsa.getURI(_javaPath_1);
CharSequence _postProcess = this.newLineNormalizer.postProcess(_uRI, content);
String _string = _postProcess.toString();
content = _string;
String _replaceAll = content.replaceAll("\"\\+(\\r)?\\n\\s+\"", "");
content = _replaceAll;
String _javaPath_2 = type.getJavaPath();
fsa.generateFile(_javaPath_2, content);
fsa.generateFile(_javaPath_1, content);
}
protected void normalizeLineDelimiters(final IXtextGeneratorFileSystemAccess fsa, final TypeReference... types) {
@ -236,10 +228,7 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener
protected void normalizeTokens(final IXtextGeneratorFileSystemAccess fsa, final String tokenFile) {
CharSequence _readTextFile = fsa.readTextFile(tokenFile);
String content = _readTextFile.toString();
URI _uRI = fsa.getURI(tokenFile);
CharSequence _postProcess = this.newLineNormalizer.postProcess(_uRI, content);
String _string = _postProcess.toString();
content = _string;
content = this.newLineNormalizer.postProcess(fsa.getURI(tokenFile), content).toString();
String _lineDelimiter = this.codeConfig.getLineDelimiter();
final List<String> splitted = Strings.split(content, _lineDelimiter);
Collections.<String>sort(splitted);
@ -265,19 +254,15 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener
String _javaPath = lexer.getJavaPath();
CharSequence _readTextFile = fsa.readTextFile(_javaPath);
String lexerContent = _readTextFile.toString();
String _stripUnnecessaryComments = this.codeQualityHelper.stripUnnecessaryComments(lexerContent, this.options);
lexerContent = _stripUnnecessaryComments;
lexerContent = this.codeQualityHelper.stripUnnecessaryComments(lexerContent, this.options);
String _javaPath_1 = lexer.getJavaPath();
fsa.generateFile(_javaPath_1, lexerContent);
String _javaPath_2 = parser.getJavaPath();
CharSequence _readTextFile_1 = fsa.readTextFile(_javaPath_2);
String parserContent = _readTextFile_1.toString();
String _stripUnnecessaryComments_1 = this.codeQualityHelper.stripUnnecessaryComments(parserContent, this.options);
parserContent = _stripUnnecessaryComments_1;
String _removeDuplicateBitsets = this.codeQualityHelper.removeDuplicateBitsets(parserContent, this.options);
parserContent = _removeDuplicateBitsets;
String _removeDuplicateDFAs = this.codeQualityHelper.removeDuplicateDFAs(parserContent, this.options);
parserContent = _removeDuplicateDFAs;
parserContent = this.codeQualityHelper.stripUnnecessaryComments(parserContent, this.options);
parserContent = this.codeQualityHelper.removeDuplicateBitsets(parserContent, this.options);
parserContent = this.codeQualityHelper.removeDuplicateDFAs(parserContent, this.options);
String _javaPath_3 = parser.getJavaPath();
fsa.generateFile(_javaPath_3, parserContent);
}

View file

@ -76,12 +76,10 @@ public abstract class AbstractAntlrGrammarGenerator {
private Grammar originalGrammar;
public void generate(final Grammar it, final AntlrOptions options, final IXtextGeneratorFileSystemAccess fsa) {
KeywordHelper _helper = KeywordHelper.getHelper(it);
this.keywordHelper = _helper;
this.keywordHelper = KeywordHelper.getHelper(it);
this.originalGrammar = it;
final RuleFilter filter = new RuleFilter();
boolean _isSkipUnusedRules = options.isSkipUnusedRules();
filter.setDiscardUnreachableRules(_isSkipUnusedRules);
filter.setDiscardUnreachableRules(options.isSkipUnusedRules());
final RuleNames ruleNames = RuleNames.getRuleNames(it, true);
FlattenedGrammarAccess _flattenedGrammarAccess = new FlattenedGrammarAccess(ruleNames, filter);
final Grammar flattened = _flattenedGrammarAccess.getFlattenedGrammar();
@ -677,14 +675,12 @@ public abstract class AbstractAntlrGrammarGenerator {
{
if (((it instanceof ParserRule) && GrammarUtil.isDatatypeRule(AntlrGrammarGenUtil.<AbstractRule>getOriginalElement(it)))) {
_builder.append("\t");
AbstractElement _alternatives = it.getAlternatives();
String _dataTypeEbnf = this.dataTypeEbnf(_alternatives, true);
String _dataTypeEbnf = this.dataTypeEbnf(it.getAlternatives(), true);
_builder.append(_dataTypeEbnf, "\t");
_builder.newLineIfNotEmpty();
} else {
_builder.append("\t");
AbstractElement _alternatives_1 = it.getAlternatives();
String _ebnf = this.ebnf(_alternatives_1, options, true);
String _ebnf = this.ebnf(it.getAlternatives(), options, true);
_builder.append(_ebnf, "\t");
_builder.newLineIfNotEmpty();
}

View file

@ -542,8 +542,7 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA
@Override
protected String _ebnf2(final RuleCall it, final AntlrOptions options, final boolean supportActions) {
String __ebnf2 = super._ebnf2(it, options, supportActions);
boolean _isPassCurrentIntoFragment = this.isPassCurrentIntoFragment();
String _argumentList = AntlrGrammarGenUtil.getArgumentList(it, _isPassCurrentIntoFragment, (!supportActions));
String _argumentList = AntlrGrammarGenUtil.getArgumentList(it, this.isPassCurrentIntoFragment(), (!supportActions));
return (__ebnf2 + _argumentList);
}
@ -564,8 +563,7 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA
@Override
protected String _dataTypeEbnf2(final RuleCall it, final boolean supportActions) {
String __dataTypeEbnf2 = super._dataTypeEbnf2(it, supportActions);
boolean _isPassCurrentIntoFragment = this.isPassCurrentIntoFragment();
String _argumentList = AntlrGrammarGenUtil.getArgumentList(it, _isPassCurrentIntoFragment, (!supportActions));
String _argumentList = AntlrGrammarGenUtil.getArgumentList(it, this.isPassCurrentIntoFragment(), (!supportActions));
return (__dataTypeEbnf2 + _argumentList);
}

View file

@ -334,8 +334,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera
if ((it instanceof ParserRule)) {
boolean _isPassCurrentIntoFragment = this.isPassCurrentIntoFragment();
boolean _not = (!_isPassCurrentIntoFragment);
String _currentType = this.getCurrentType();
String _parameterList = AntlrGrammarGenUtil.getParameterList(((ParserRule)it), Boolean.valueOf(_not), _currentType);
String _parameterList = AntlrGrammarGenUtil.getParameterList(((ParserRule)it), Boolean.valueOf(_not), this.getCurrentType());
_builder.append(_parameterList);
}
}
@ -491,8 +490,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera
_builder.append("=");
String __dataTypeEbnf2 = super._dataTypeEbnf2(it, supportActions);
_builder.append(__dataTypeEbnf2);
boolean _isPassCurrentIntoFragment = this.isPassCurrentIntoFragment();
String _argumentList = AntlrGrammarGenUtil.getArgumentList(it, _isPassCurrentIntoFragment, (!supportActions));
String _argumentList = AntlrGrammarGenUtil.getArgumentList(it, this.isPassCurrentIntoFragment(), (!supportActions));
_builder.append(_argumentList);
_builder.newLineIfNotEmpty();
_builder.append("{");
@ -538,8 +536,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera
_builder_1.append("{");
_builder_1.newLine();
_builder_1.append("\t");
String _localVar_4 = this._grammarAccessExtensions.localVar(it);
CharSequence _newLeafNode = this.newLeafNode(it, _localVar_4);
CharSequence _newLeafNode = this.newLeafNode(it, this._grammarAccessExtensions.localVar(it));
_builder_1.append(_newLeafNode, "\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");
@ -625,9 +622,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera
_builder.append("{");
_builder.newLine();
_builder.append("\t");
Assignment _containingAssignment = GrammarUtil.containingAssignment(it);
String _localVar = this._grammarAccessExtensions.localVar(_containingAssignment, it);
CharSequence _newLeafNode = this.newLeafNode(it, _localVar);
CharSequence _newLeafNode = this.newLeafNode(it, this._grammarAccessExtensions.localVar(GrammarUtil.containingAssignment(it), it));
_builder.append(_newLeafNode, "\t");
_builder.newLineIfNotEmpty();
_builder.append("}");
@ -635,8 +630,8 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera
_xifexpression_1 = _builder.toString();
} else {
StringConcatenation _builder_1 = new StringConcatenation();
String _localVar_1 = this._grammarAccessExtensions.localVar(it);
_builder_1.append(_localVar_1);
String _localVar = this._grammarAccessExtensions.localVar(it);
_builder_1.append(_localVar);
_builder_1.append("=");
String __ebnf2_1 = super._ebnf2(it, options, supportActions);
_builder_1.append(__ebnf2_1);
@ -644,8 +639,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera
_builder_1.append("{");
_builder_1.newLine();
_builder_1.append("\t");
String _localVar_2 = this._grammarAccessExtensions.localVar(it);
CharSequence _newLeafNode_1 = this.newLeafNode(it, _localVar_2);
CharSequence _newLeafNode_1 = this.newLeafNode(it, this._grammarAccessExtensions.localVar(it));
_builder_1.append(_newLeafNode_1, "\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");
@ -674,14 +668,12 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera
_builder.newLine();
_builder.append("\t");
_builder.append("$current = grammarAccess.");
EnumLiteralDeclaration _originalElement = AntlrGrammarGenUtil.<EnumLiteralDeclaration>getOriginalElement(it);
String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement);
String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.<EnumLiteralDeclaration>getOriginalElement(it));
_builder.append(_grammarElementAccess, "\t");
_builder.append(".getEnumLiteral().getInstance();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
String _localVar_1 = this._grammarAccessExtensions.localVar(it);
CharSequence _newLeafNode = this.newLeafNode(it, _localVar_1);
CharSequence _newLeafNode = this.newLeafNode(it, this._grammarAccessExtensions.localVar(it));
_builder.append(_newLeafNode, "\t");
_builder.newLineIfNotEmpty();
_builder.append("}");
@ -843,8 +835,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera
_builder_1.append("{");
_builder_1.newLine();
_builder_1.append("\t");
String _localVar_1 = this._grammarAccessExtensions.localVar(it);
CharSequence _newLeafNode = this.newLeafNode(it, _localVar_1);
CharSequence _newLeafNode = this.newLeafNode(it, this._grammarAccessExtensions.localVar(it));
_builder_1.append(_newLeafNode, "\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");
@ -1127,8 +1118,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera
_builder_1.append("{");
_builder_1.newLine();
_builder_1.append("\t");
String _localVar_3 = this._grammarAccessExtensions.localVar(assignment, it);
CharSequence _newLeafNode = this.newLeafNode(it, _localVar_3);
CharSequence _newLeafNode = this.newLeafNode(it, this._grammarAccessExtensions.localVar(assignment, it));
_builder_1.append(_newLeafNode, "\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");
@ -1167,8 +1157,8 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera
if (_isBooleanAssignment_1) {
_builder_1.append("true");
} else {
String _localVar_4 = this._grammarAccessExtensions.localVar(assignment, it);
_builder_1.append(_localVar_4, "\t\t");
String _localVar_3 = this._grammarAccessExtensions.localVar(assignment, it);
_builder_1.append(_localVar_3, "\t\t");
}
}
_builder_1.append(",");

View file

@ -49,23 +49,19 @@ public class AntlrOptions {
private String keptBitSetName;
public void setFieldsPerClass(final String fieldsPerClass) {
int _parseInt = Integer.parseInt(fieldsPerClass);
this.fieldsPerClass = _parseInt;
this.fieldsPerClass = Integer.parseInt(fieldsPerClass);
}
public void setMethodsPerClass(final String methodsPerClass) {
int _parseInt = Integer.parseInt(methodsPerClass);
this.methodsPerClass = _parseInt;
this.methodsPerClass = Integer.parseInt(methodsPerClass);
}
public void setCasesPerSpecialStateSwitch(final String casesPerSpecialStateSwitch) {
int _parseInt = Integer.parseInt(casesPerSpecialStateSwitch);
this.casesPerSpecialStateSwitch = _parseInt;
this.casesPerSpecialStateSwitch = Integer.parseInt(casesPerSpecialStateSwitch);
}
public void setKAsString(final String k) {
int _parseInt = Integer.parseInt(k);
this.k = _parseInt;
this.k = Integer.parseInt(k);
}
@Pure

View file

@ -208,8 +208,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
}
public void setLookaheadThreshold(final String lookaheadThreshold) {
int _parseInt = Integer.parseInt(lookaheadThreshold);
this.lookaheadThreshold = _parseInt;
this.lookaheadThreshold = Integer.parseInt(lookaheadThreshold);
}
protected void generateProductionGrammar() {
@ -221,34 +220,12 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
Grammar _grammar = this.getGrammar();
AntlrOptions _options = this.getOptions();
this.productionGenerator.generate(_grammar, _options, fsa);
Grammar _grammar_1 = this.getGrammar();
AntlrGrammar _parserGrammar = naming.getParserGrammar(_grammar_1);
Grammar _grammar_2 = this.getGrammar();
AntlrGrammar _lexerGrammar = naming.getLexerGrammar(_grammar_2);
this.runAntlr(_parserGrammar, _lexerGrammar, fsa);
Grammar _grammar_3 = this.getGrammar();
Grammar _grammar_4 = this.getGrammar();
TypeReference _internalParserClass = naming.getInternalParserClass(_grammar_4);
this.simplifyUnorderedGroupPredicatesIfRequired(_grammar_3, fsa, _internalParserClass);
Grammar _grammar_5 = this.getGrammar();
TypeReference _internalParserClass_1 = naming.getInternalParserClass(_grammar_5);
Grammar _grammar_6 = this.getGrammar();
TypeReference _lexerClass = naming.getLexerClass(_grammar_6);
this.splitParserAndLexerIfEnabled(fsa, _internalParserClass_1, _lexerClass);
Grammar _grammar_7 = this.getGrammar();
AntlrGrammar _lexerGrammar_1 = naming.getLexerGrammar(_grammar_7);
String _tokensFileName = _lexerGrammar_1.getTokensFileName();
this.normalizeTokens(fsa, _tokensFileName);
Grammar _grammar_8 = this.getGrammar();
TypeReference _internalParserClass_2 = naming.getInternalParserClass(_grammar_8);
Grammar _grammar_9 = this.getGrammar();
TypeReference _lexerClass_1 = naming.getLexerClass(_grammar_9);
this.suppressWarnings(fsa, _internalParserClass_2, _lexerClass_1);
Grammar _grammar_10 = this.getGrammar();
TypeReference _internalParserClass_3 = naming.getInternalParserClass(_grammar_10);
Grammar _grammar_11 = this.getGrammar();
TypeReference _lexerClass_2 = naming.getLexerClass(_grammar_11);
this.normalizeLineDelimiters(fsa, _internalParserClass_3, _lexerClass_2);
this.runAntlr(naming.getParserGrammar(this.getGrammar()), naming.getLexerGrammar(this.getGrammar()), fsa);
this.simplifyUnorderedGroupPredicatesIfRequired(this.getGrammar(), fsa, naming.getInternalParserClass(this.getGrammar()));
this.splitParserAndLexerIfEnabled(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
this.normalizeTokens(fsa, naming.getLexerGrammar(this.getGrammar()).getTokensFileName());
this.suppressWarnings(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
this.normalizeLineDelimiters(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
}
protected void generateContentAssistGrammar() {
@ -260,38 +237,14 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
Grammar _grammar = this.getGrammar();
AntlrOptions _options = this.getOptions();
this.contentAssistGenerator.generate(_grammar, _options, fsa);
Grammar _grammar_1 = this.getGrammar();
AntlrGrammar _parserGrammar = naming.getParserGrammar(_grammar_1);
Grammar _grammar_2 = this.getGrammar();
AntlrGrammar _lexerGrammar = naming.getLexerGrammar(_grammar_2);
this.runAntlr(_parserGrammar, _lexerGrammar, fsa);
Grammar _grammar_3 = this.getGrammar();
Grammar _grammar_4 = this.getGrammar();
TypeReference _internalParserClass = naming.getInternalParserClass(_grammar_4);
this.simplifyUnorderedGroupPredicatesIfRequired(_grammar_3, fsa, _internalParserClass);
Grammar _grammar_5 = this.getGrammar();
TypeReference _internalParserClass_1 = naming.getInternalParserClass(_grammar_5);
Grammar _grammar_6 = this.getGrammar();
TypeReference _lexerClass = naming.getLexerClass(_grammar_6);
this.splitParserAndLexerIfEnabled(fsa, _internalParserClass_1, _lexerClass);
Grammar _grammar_7 = this.getGrammar();
AntlrGrammar _lexerGrammar_1 = naming.getLexerGrammar(_grammar_7);
String _tokensFileName = _lexerGrammar_1.getTokensFileName();
this.normalizeTokens(fsa, _tokensFileName);
Grammar _grammar_8 = this.getGrammar();
TypeReference _internalParserClass_2 = naming.getInternalParserClass(_grammar_8);
Grammar _grammar_9 = this.getGrammar();
TypeReference _lexerClass_1 = naming.getLexerClass(_grammar_9);
this.suppressWarnings(fsa, _internalParserClass_2, _lexerClass_1);
Grammar _grammar_10 = this.getGrammar();
TypeReference _lexerClass_2 = naming.getLexerClass(_grammar_10);
Grammar _grammar_11 = this.getGrammar();
TypeReference _internalParserClass_3 = naming.getInternalParserClass(_grammar_11);
this.normalizeLineDelimiters(fsa, _lexerClass_2, _internalParserClass_3);
this.runAntlr(naming.getParserGrammar(this.getGrammar()), naming.getLexerGrammar(this.getGrammar()), fsa);
this.simplifyUnorderedGroupPredicatesIfRequired(this.getGrammar(), fsa, naming.getInternalParserClass(this.getGrammar()));
this.splitParserAndLexerIfEnabled(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
this.normalizeTokens(fsa, naming.getLexerGrammar(this.getGrammar()).getTokensFileName());
this.suppressWarnings(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
this.normalizeLineDelimiters(fsa, naming.getLexerClass(this.getGrammar()), naming.getInternalParserClass(this.getGrammar()));
if (this.removeBacktrackingGuards) {
Grammar _grammar_12 = this.getGrammar();
TypeReference _internalParserClass_4 = naming.getInternalParserClass(_grammar_12);
this.removeBackTrackingGuards(fsa, _internalParserClass_4, this.lookaheadThreshold);
this.removeBackTrackingGuards(fsa, naming.getInternalParserClass(this.getGrammar()), this.lookaheadThreshold);
}
}
@ -305,8 +258,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
String _grammarFileName = lexerGrammar.getGrammarFileName();
_builder.append(_grammarFileName);
final String lexerGrammarFile = _builder.toString();
String[] _antlrParams = this.getAntlrParams();
final ArrayList<String> lexerAntlrParams = CollectionLiterals.<String>newArrayList(_antlrParams);
final ArrayList<String> lexerAntlrParams = CollectionLiterals.<String>newArrayList(this.getAntlrParams());
lexerAntlrParams.add("-fo");
int _lastIndexOf = lexerGrammarFile.lastIndexOf("/");
final String lexerOutputDir = lexerGrammarFile.substring(0, _lastIndexOf);
@ -316,9 +268,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
if (_not) {
AntlrToolFacade _antlrTool = this.getAntlrTool();
_antlrTool.runWithEncodingAndParams(lexerGrammarFile, encoding, ((String[])Conversions.unwrapArray(lexerAntlrParams, String.class)));
Grammar _grammar = this.getGrammar();
KeywordHelper _helper = KeywordHelper.getHelper(_grammar);
this.cleanupLexerTokensFile(lexerGrammar, _helper, fsa);
this.cleanupLexerTokensFile(lexerGrammar, KeywordHelper.getHelper(this.getGrammar()), fsa);
}
StringConcatenation _builder_1 = new StringConcatenation();
String _path_1 = fsa.getPath();
@ -327,8 +277,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
String _grammarFileName_1 = parserGrammar.getGrammarFileName();
_builder_1.append(_grammarFileName_1);
final String parserGrammarFile = _builder_1.toString();
String[] _antlrParams_1 = this.getAntlrParams();
final ArrayList<String> parserAntlrParams = CollectionLiterals.<String>newArrayList(_antlrParams_1);
final ArrayList<String> parserAntlrParams = CollectionLiterals.<String>newArrayList(this.getAntlrParams());
parserAntlrParams.add("-fo");
int _lastIndexOf_1 = parserGrammarFile.lastIndexOf("/");
String _substring = parserGrammarFile.substring(0, _lastIndexOf_1);
@ -344,9 +293,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
boolean _isCombinedGrammar_2 = this.isCombinedGrammar();
boolean _not_2 = (!_isCombinedGrammar_2);
if (_not_2) {
Grammar _grammar_1 = this.getGrammar();
KeywordHelper _helper_1 = KeywordHelper.getHelper(_grammar_1);
this.cleanupParserTokensFile(lexerGrammar, parserGrammar, _helper_1, fsa);
this.cleanupParserTokensFile(lexerGrammar, parserGrammar, KeywordHelper.getHelper(this.getGrammar()), fsa);
}
}
@ -1345,8 +1292,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
}
};
final GuiceModuleAccess.BindingFactory rtBindings = _addTypeToProviderInstance.addConfiguredBinding("RuntimeLexer", _client_1);
Grammar _grammar_5 = this.getGrammar();
boolean _containsUnorderedGroup = this.containsUnorderedGroup(_grammar_5);
boolean _containsUnorderedGroup = this.containsUnorderedGroup(this.getGrammar());
if (_containsUnorderedGroup) {
TypeReference _typeRef_6 = TypeReference.typeRef(IUnorderedGroupHelper.class);
TypeReference _typeRef_7 = TypeReference.typeRef(UnorderedGroupHelper.class);

View file

@ -8,7 +8,6 @@
package org.eclipse.xtext.xtext.generator.serializer;
import com.google.inject.Inject;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -19,18 +18,15 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.ILeafNode;
import org.eclipse.xtext.resource.IClasspathUriResolver;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.serializer.ISerializationContext;
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider;
@ -81,8 +77,7 @@ public class SemanticSequencerExtensions {
if (_tripleEquals) {
List<ISerializationContext> contexts = result.get(constraint);
if ((contexts == null)) {
ArrayList<ISerializationContext> _newArrayList = CollectionLiterals.<ISerializationContext>newArrayList();
contexts = _newArrayList;
contexts = CollectionLiterals.<ISerializationContext>newArrayList();
result.put(constraint, contexts);
}
List<ISerializationContext> _contexts = e.getContexts(clazz);
@ -95,17 +90,12 @@ public class SemanticSequencerExtensions {
protected ResourceSet cloneResourceSet(final ResourceSet rs) {
final XtextResourceSet result = new XtextResourceSet();
EPackage.Registry _packageRegistry = rs.getPackageRegistry();
result.setPackageRegistry(_packageRegistry);
Resource.Factory.Registry _resourceFactoryRegistry = rs.getResourceFactoryRegistry();
result.setResourceFactoryRegistry(_resourceFactoryRegistry);
URIConverter _uRIConverter = rs.getURIConverter();
result.setURIConverter(_uRIConverter);
result.setPackageRegistry(rs.getPackageRegistry());
result.setResourceFactoryRegistry(rs.getResourceFactoryRegistry());
result.setURIConverter(rs.getURIConverter());
if ((rs instanceof XtextResourceSet)) {
Object _classpathURIContext = ((XtextResourceSet)rs).getClasspathURIContext();
result.setClasspathURIContext(_classpathURIContext);
IClasspathUriResolver _classpathUriResolver = ((XtextResourceSet)rs).getClasspathUriResolver();
result.setClasspathUriResolver(_classpathUriResolver);
result.setClasspathURIContext(((XtextResourceSet)rs).getClasspathURIContext());
result.setClasspathUriResolver(((XtextResourceSet)rs).getClasspathUriResolver());
}
return result;
}
@ -125,9 +115,7 @@ public class SemanticSequencerExtensions {
Grammar _head = IterableExtensions.<Grammar>head(_usedGrammars_1);
Resource _eResource = _head.eResource();
final URI uri = _eResource.getURI();
Resource _eResource_1 = grammar.eResource();
ResourceSet _resourceSet = _eResource_1.getResourceSet();
ResourceSet _cloneResourceSet = this.cloneResourceSet(_resourceSet);
ResourceSet _cloneResourceSet = this.cloneResourceSet(grammar.eResource().getResourceSet());
final Resource resource = _cloneResourceSet.getResource(uri, true);
EList<EObject> _contents = resource.getContents();
EObject _head_1 = IterableExtensions.<EObject>head(_contents);
@ -184,9 +172,7 @@ public class SemanticSequencerExtensions {
}
result.add(state);
}
List<ISemanticSequencerNfaProvider.ISemState> _followers_1 = state.getFollowers();
ISemanticSequencerNfaProvider.ISemState _head = IterableExtensions.<ISemanticSequencerNfaProvider.ISemState>head(_followers_1);
state = _head;
state = IterableExtensions.<ISemanticSequencerNfaProvider.ISemState>head(state.getFollowers());
}
}
return null;

View file

@ -525,9 +525,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment {
}
final TypeReference superClazz = _xifexpression_1;
final GeneratedJavaFileAccess javaFile = this.fileAccessFactory.createGeneratedJavaFile(clazz);
IXtextGeneratorLanguage _language = this.getLanguage();
ResourceSet _resourceSet = _language.getResourceSet();
javaFile.setResourceSet(_resourceSet);
javaFile.setResourceSet(this.getLanguage().getResourceSet());
final HashSet<Pair<String, EClass>> methodSignatures = CollectionLiterals.<Pair<String, EClass>>newHashSet();
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
@ -850,18 +848,12 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment {
}
}
_builder.append("if (");
Map.Entry<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>> _value = ctx.getValue();
List<ISerializationContext> _value_1 = _value.getValue();
Map.Entry<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>> _value_2 = ctx.getValue();
IGrammarConstraintProvider.IConstraint _key_1 = _value_2.getKey();
StringConcatenationClient _genCondition = SerializerFragment2.this.genCondition(_value_1, _key_1, context2constraint);
StringConcatenationClient _genCondition = SerializerFragment2.this.genCondition(ctx.getValue().getValue(), ctx.getValue().getKey(), context2constraint);
_builder.append(_genCondition);
_builder.append(") {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
Map.Entry<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>> _value_3 = ctx.getValue();
IGrammarConstraintProvider.IConstraint _key_2 = _value_3.getKey();
StringConcatenationClient _genMethodCreateSequenceCall = SerializerFragment2.this.genMethodCreateSequenceCall(superConstraints, type, _key_2);
StringConcatenationClient _genMethodCreateSequenceCall = SerializerFragment2.this.genMethodCreateSequenceCall(superConstraints, type, ctx.getValue().getKey());
_builder.append(_genMethodCreateSequenceCall, "\t");
_builder.newLineIfNotEmpty();
_builder.append("}");
@ -874,9 +866,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment {
int _size_1 = contexts.size();
boolean _equals = (_size_1 == 1);
if (_equals) {
Map.Entry<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>> _head = IterableExtensions.<Map.Entry<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>>>head(contexts);
IGrammarConstraintProvider.IConstraint _key_3 = _head.getKey();
StringConcatenationClient _genMethodCreateSequenceCall_1 = SerializerFragment2.this.genMethodCreateSequenceCall(superConstraints, type, _key_3);
StringConcatenationClient _genMethodCreateSequenceCall_1 = SerializerFragment2.this.genMethodCreateSequenceCall(superConstraints, type, IterableExtensions.<Map.Entry<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>>>head(contexts).getKey());
_builder.append(_genMethodCreateSequenceCall_1);
_builder.newLineIfNotEmpty();
} else {
@ -1330,9 +1320,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment {
}
final TypeReference clazz = _xifexpression;
final GeneratedJavaFileAccess javaFile = this.fileAccessFactory.createGeneratedJavaFile(clazz);
IXtextGeneratorLanguage _language = this.getLanguage();
ResourceSet _resourceSet = _language.getResourceSet();
javaFile.setResourceSet(_resourceSet);
javaFile.setResourceSet(this.getLanguage().getResourceSet());
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {

View file

@ -51,19 +51,17 @@ public class TypesGeneratorFragment2 extends AbstractXtextGeneratorFragment {
_addTypeToType.contributeTo(_runtimeGenModule);
IXtextGeneratorLanguage _language_1 = this.getLanguage();
GuiceModuleAccess _runtimeGenModule_1 = _language_1.getRuntimeGenModule();
TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.common.types.DefaultCommonTypesRuntimeModule");
_runtimeGenModule_1.setSuperClass(_typeRef_2);
_runtimeGenModule_1.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.common.types.DefaultCommonTypesRuntimeModule"));
GuiceModuleAccess.BindingFactory _bindingFactory_1 = new GuiceModuleAccess.BindingFactory();
TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.PrefixMatcher");
TypeReference _typeRef_4 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.FQNPrefixMatcher");
GuiceModuleAccess.BindingFactory _addTypeToType_1 = _bindingFactory_1.addTypeToType(_typeRef_3, _typeRef_4);
TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.PrefixMatcher");
TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.FQNPrefixMatcher");
GuiceModuleAccess.BindingFactory _addTypeToType_1 = _bindingFactory_1.addTypeToType(_typeRef_2, _typeRef_3);
IXtextGeneratorLanguage _language_2 = this.getLanguage();
GuiceModuleAccess _eclipsePluginGenModule = _language_2.getEclipsePluginGenModule();
_addTypeToType_1.contributeTo(_eclipsePluginGenModule);
IXtextGeneratorLanguage _language_3 = this.getLanguage();
GuiceModuleAccess _eclipsePluginGenModule_1 = _language_3.getEclipsePluginGenModule();
TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.common.types.ui.DefaultCommonTypesUiModule");
_eclipsePluginGenModule_1.setSuperClass(_typeRef_5);
_eclipsePluginGenModule_1.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.common.types.ui.DefaultCommonTypesUiModule"));
IXtextProjectConfig _projectConfig = this.getProjectConfig();
IRuntimeProjectConfig _runtime = _projectConfig.getRuntime();
ManifestAccess _manifest = _runtime.getManifest();

View file

@ -395,10 +395,7 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment {
}
};
it.setContent(_client_1);
IXtextProjectConfig _projectConfig = this.getProjectConfig();
IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin();
IXtextGeneratorFileSystemAccess _srcGen = _eclipsePlugin.getSrcGen();
it.writeTo(_srcGen);
it.writeTo(this.getProjectConfig().getEclipsePlugin().getSrcGen());
};
_xblockexpression = ObjectExtensions.<GeneratedJavaFileAccess>operator_doubleArrow(_createGeneratedJavaFile, _function_2);
}

Some files were not shown because too many files have changed in this diff Show more