diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/ContentAssistContextFactoryTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/ContentAssistContextFactoryTest.java index 8a1fd5a36..a11a3ab57 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/ContentAssistContextFactoryTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/ContentAssistContextFactoryTest.java @@ -59,9 +59,7 @@ public class ContentAssistContextFactoryTest { _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory); - Assert.assertEquals(_string, _firstSetGrammarElementsToString); + Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory)); } @Test @@ -128,9 +126,7 @@ public class ContentAssistContextFactoryTest { _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory); - Assert.assertEquals(_string, _firstSetGrammarElementsToString); + Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory)); } @Test @@ -161,9 +157,7 @@ public class ContentAssistContextFactoryTest { _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory); - Assert.assertEquals(_string, _firstSetGrammarElementsToString); + Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory)); } @Test @@ -190,9 +184,7 @@ public class ContentAssistContextFactoryTest { _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory); - Assert.assertEquals(_string, _firstSetGrammarElementsToString); + Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory)); } @Test @@ -240,8 +232,6 @@ public class ContentAssistContextFactoryTest { _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory); - Assert.assertEquals(_string, _firstSetGrammarElementsToString); + Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory)); } } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/ContentAssistContextTestHelper.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/ContentAssistContextTestHelper.java index be9cafb00..c966e49be 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/ContentAssistContextTestHelper.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/ContentAssistContextTestHelper.java @@ -10,11 +10,9 @@ package org.eclipse.xtext.ide.tests.editor.contentassist; 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.Executors; 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.resource.Resource; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend2.lib.StringConcatenation; @@ -67,15 +65,13 @@ public class ContentAssistContextTestHelper { final URI uri = URI.createURI(_plus); Resource _createResource = this.resFactory.createResource(uri); final XtextResource res = ((XtextResource) _createResource); - XtextResourceSet _xtextResourceSet = new XtextResourceSet(); - EList _resources = _xtextResourceSet.getResources(); + EList _resources = new XtextResourceSet().getResources(); _resources.add(res); if ((this.entryPoint != null)) { res.setEntryPoint(this.entryPoint); } StringInputStream _stringInputStream = new StringInputStream(doc); - Map _emptyMap = CollectionLiterals.emptyMap(); - res.load(_stringInputStream, _emptyMap); + res.load(_stringInputStream, CollectionLiterals.emptyMap()); this.validator.assertNoErrors(res); return res; } catch (Throwable _e) { @@ -91,10 +87,7 @@ public class ContentAssistContextTestHelper { factory.setPool(Executors.newCachedThreadPool()); TextRegion _textRegion = new TextRegion(0, 0); final ContentAssistContext[] ctxs = factory.create(doc, _textRegion, offset, res); - GrammarElementTitleSwitch _grammarElementTitleSwitch = new GrammarElementTitleSwitch(); - GrammarElementTitleSwitch _showAssignments = _grammarElementTitleSwitch.showAssignments(); - GrammarElementTitleSwitch _showQualified = _showAssignments.showQualified(); - final GrammarElementTitleSwitch f = _showQualified.showRule(); + final GrammarElementTitleSwitch f = new GrammarElementTitleSwitch().showAssignments().showQualified().showRule(); StringConcatenation _builder = new StringConcatenation(); { Iterable> _indexed = IterableExtensions.indexed(((Iterable)Conversions.doWrapArray(ctxs))); @@ -105,12 +98,10 @@ public class ContentAssistContextTestHelper { _builder.append(" {"); _builder.newLineIfNotEmpty(); { - ContentAssistContext _value = ctx.getValue(); - ImmutableList _firstSetGrammarElements = _value.getFirstSetGrammarElements(); + ImmutableList _firstSetGrammarElements = ctx.getValue().getFirstSetGrammarElements(); for(final AbstractElement ele : _firstSetGrammarElements) { _builder.append("\t"); - EClass _eClass = ele.eClass(); - String _name = _eClass.getName(); + String _name = ele.eClass().getName(); _builder.append(_name, "\t"); _builder.append(": "); String _apply = f.apply(ele); diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/PartialContentAssistTestLanguageContextFactoryTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/PartialContentAssistTestLanguageContextFactoryTest.java index f18b30645..6c554e25e 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/PartialContentAssistTestLanguageContextFactoryTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/PartialContentAssistTestLanguageContextFactoryTest.java @@ -65,9 +65,7 @@ public class PartialContentAssistTestLanguageContextFactoryTest { _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory); - Assert.assertEquals(_string, _firstSetGrammarElementsToString); + Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory)); } @Test @@ -104,9 +102,7 @@ public class PartialContentAssistTestLanguageContextFactoryTest { _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory); - Assert.assertEquals(_string, _firstSetGrammarElementsToString); + Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory)); } @Test @@ -131,9 +127,7 @@ public class PartialContentAssistTestLanguageContextFactoryTest { _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory); - Assert.assertEquals(_string, _firstSetGrammarElementsToString); + Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory)); } @Test @@ -154,9 +148,7 @@ public class PartialContentAssistTestLanguageContextFactoryTest { _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory); - Assert.assertEquals(_string, _firstSetGrammarElementsToString); + Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory)); } @Test @@ -183,8 +175,6 @@ public class PartialContentAssistTestLanguageContextFactoryTest { _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory); - Assert.assertEquals(_string, _firstSetGrammarElementsToString); + Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory)); } } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/BuildOrderTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/BuildOrderTest.java index 92a6fd1c4..a537adf5f 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/BuildOrderTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/BuildOrderTest.java @@ -53,9 +53,10 @@ public class BuildOrderTest { it.setDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList())); }; final ProjectDescription d = ObjectExtensions.operator_doubleArrow(_projectDescription_3, _function_3); - this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a, b, c, d)), ((Procedure1) (ProjectDescription it) -> { + final Procedure1 _function_4 = (ProjectDescription it) -> { Assert.fail(); - }))); + }; + this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a, b, c, d)), _function_4)); } @Test @@ -84,9 +85,10 @@ public class BuildOrderTest { it.setDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList())); }; final ProjectDescription d = ObjectExtensions.operator_doubleArrow(_projectDescription_3, _function_3); - this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a, b, c, d)), ((Procedure1) (ProjectDescription it) -> { + final Procedure1 _function_4 = (ProjectDescription it) -> { Assert.fail(); - }))); + }; + this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a, b, c, d)), _function_4)); } @Test @@ -115,9 +117,10 @@ public class BuildOrderTest { it.setDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList())); }; final ProjectDescription d = ObjectExtensions.operator_doubleArrow(_projectDescription_3, _function_3); - this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a, b, c, d)), ((Procedure1) (ProjectDescription it) -> { + final Procedure1 _function_4 = (ProjectDescription it) -> { Assert.fail(); - }))); + }; + this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a, b, c, d)), _function_4)); } @Test @@ -133,12 +136,14 @@ public class BuildOrderTest { it.setName("b"); }; final ProjectDescription b = ObjectExtensions.operator_doubleArrow(_projectDescription_1, _function_1); - this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(a)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a)), ((Procedure1) (ProjectDescription it) -> { + final Procedure1 _function_2 = (ProjectDescription it) -> { Assert.fail(); - }))); - this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(b)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(b)), ((Procedure1) (ProjectDescription it) -> { + }; + this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(a)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a)), _function_2)); + final Procedure1 _function_3 = (ProjectDescription it) -> { Assert.fail(); - }))); + }; + this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(b)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(b)), _function_3)); } @Test @@ -174,9 +179,10 @@ public class BuildOrderTest { }; final ProjectDescription e = ObjectExtensions.operator_doubleArrow(_projectDescription_4, _function_4); final ArrayList cyclic = CollectionLiterals.newArrayList(); - this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(e)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a, b, c, d, e)), ((Procedure1) (ProjectDescription it) -> { + final Procedure1 _function_5 = (ProjectDescription it) -> { cyclic.add(it); - }))); + }; + this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(e)), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a, b, c, d, e)), _function_5)); this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(b, d, c, a)), cyclic); } @@ -189,9 +195,10 @@ public class BuildOrderTest { }; final ProjectDescription a = ObjectExtensions.operator_doubleArrow(_projectDescription, _function); final ArrayList cyclic = CollectionLiterals.newArrayList(); - this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList()), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a)), ((Procedure1) (ProjectDescription it) -> { + final Procedure1 _function_1 = (ProjectDescription it) -> { cyclic.add(it); - }))); + }; + this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList()), new TopologicalSorter().sortByDependencies(Collections.unmodifiableList(CollectionLiterals.newArrayList(a)), _function_1)); this.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList(a)), cyclic); } @@ -210,7 +217,6 @@ public class BuildOrderTest { final Function1 _function = (ProjectDescription it) -> { return it.getName(); }; - List _map = ListExtensions.map(list, _function); - return IterableExtensions.join(_map, ", "); + return IterableExtensions.join(ListExtensions.map(list, _function), ", "); } } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/ColoringTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/ColoringTest.java index fe03b1c41..a4e616b6f 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/ColoringTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/ColoringTest.java @@ -8,11 +8,9 @@ package org.eclipse.xtext.ide.tests.server; import java.io.File; -import java.net.URI; import java.nio.file.Path; import java.util.List; import java.util.Map; -import java.util.Set; import org.eclipse.lsp4j.ColoringInformation; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest; @@ -85,25 +83,19 @@ public class ColoringTest extends AbstractTestLangLanguageServerTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("MyModel."); _builder.append(this.fileExtension); - Path _resolve = _path.resolve(_builder.toString()); - final File file = _resolve.toFile(); - URI _uRI = file.toURI(); - final String uri = _uRI.toString(); + final File file = _path.resolve(_builder.toString()).toFile(); + final String uri = file.toURI().toString(); this.open(uri, ColoringTest.MODEL); - Map> _coloringParams = this.getColoringParams(); - Set>> _entrySet = _coloringParams.entrySet(); final Function1>, String> _function = (Map.Entry> it) -> { String _key = it.getKey(); - String _key_1 = it.getKey(); - int _lastIndexOf = _key_1.lastIndexOf("/"); + int _lastIndexOf = it.getKey().lastIndexOf("/"); int _plus = (_lastIndexOf + 1); return _key.substring(_plus); }; final Function1>, List> _function_1 = (Map.Entry> it) -> { return it.getValue(); }; - Map> _map = IterableExtensions.>, String, List>toMap(_entrySet, _function, _function_1); - final String expectation = this.toExpectation(_map); + final String expectation = this.toExpectation(IterableExtensions.>, String, List>toMap(this.getColoringParams().entrySet(), _function, _function_1)); StringConcatenation _builder_1 = new StringConcatenation(); String _name = file.getName(); _builder_1.append(_name); diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/DocumentHighlightTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/DocumentHighlightTest.java index 765ac72c8..ad5f41f5c 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/DocumentHighlightTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/DocumentHighlightTest.java @@ -53,8 +53,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest { it.setModel(_builder.toString()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type A { op"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedDocumentHighlight(""); }; this.testDocumentHighlight(_function); @@ -68,8 +67,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest { it.setModel(_builder.toString()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type A { op foo("); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedDocumentHighlight(""); }; this.testDocumentHighlight(_function); @@ -83,8 +81,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest { it.setModel(_builder.toString()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type A { op fo"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]]"); }; this.testDocumentHighlight(_function); @@ -98,8 +95,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest { it.setModel(_builder.toString()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type A { int fo"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedDocumentHighlight("W [[0, 13] .. [0, 16]]"); }; this.testDocumentHighlight(_function); @@ -113,8 +109,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest { it.setModel(_builder.toString()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type A { op fo"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]]"); }; this.testDocumentHighlight(_function); @@ -129,8 +124,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest { it.setLine(0); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type A { op foo() { } op bar() { fo"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]] | R [[0, 33] .. [0, 36]]"); }; this.testDocumentHighlight(_function); @@ -145,8 +139,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest { it.setLine(0); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type A { op fo"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]] | R [[0, 33] .. [0, 36]]"); }; this.testDocumentHighlight(_function); @@ -176,8 +169,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest { StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("\t"); _builder_1.append("op fo"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedDocumentHighlight("W [[1, 4] .. [1, 7]] | R [[3, 2] .. [3, 5]]"); }; this.testDocumentHighlight(_function); @@ -207,8 +199,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest { StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("op fo"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedDocumentHighlight("W [[1, 7] .. [1, 10]] | R [[3, 8] .. [3, 11]]"); }; this.testDocumentHighlight(_function); diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/DocumentTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/DocumentTest.java index f88229312..ac6dbf8f6 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/DocumentTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/DocumentTest.java @@ -37,15 +37,10 @@ public class DocumentTest { String _normalize = this.normalize(_builder); Document _document = new Document(1, _normalize); final Procedure1 _function = (Document it) -> { - Position _position = this.position(0, 0); - int _offSet = it.getOffSet(_position); - Assert.assertEquals(0, _offSet); - Position _position_1 = this.position(0, 11); - int _offSet_1 = it.getOffSet(_position_1); - Assert.assertEquals(11, _offSet_1); + Assert.assertEquals(0, it.getOffSet(this.position(0, 0))); + Assert.assertEquals(11, it.getOffSet(this.position(0, 11))); try { - Position _position_2 = this.position(0, 12); - it.getOffSet(_position_2); + it.getOffSet(this.position(0, 12)); Assert.fail(); } catch (final Throwable _t) { if (_t instanceof IndexOutOfBoundsException) { @@ -54,21 +49,11 @@ public class DocumentTest { throw Exceptions.sneakyThrow(_t); } } - Position _position_3 = this.position(1, 0); - int _offSet_2 = it.getOffSet(_position_3); - Assert.assertEquals(12, _offSet_2); - Position _position_4 = this.position(1, 1); - int _offSet_3 = it.getOffSet(_position_4); - Assert.assertEquals(13, _offSet_3); - Position _position_5 = this.position(1, 2); - int _offSet_4 = it.getOffSet(_position_5); - Assert.assertEquals(14, _offSet_4); - Position _position_6 = this.position(2, 0); - int _offSet_5 = it.getOffSet(_position_6); - Assert.assertEquals(16, _offSet_5); - Position _position_7 = this.position(2, 3); - int _offSet_6 = it.getOffSet(_position_7); - Assert.assertEquals(19, _offSet_6); + Assert.assertEquals(12, it.getOffSet(this.position(1, 0))); + Assert.assertEquals(13, it.getOffSet(this.position(1, 1))); + Assert.assertEquals(14, it.getOffSet(this.position(1, 2))); + Assert.assertEquals(16, it.getOffSet(this.position(2, 0))); + Assert.assertEquals(19, it.getOffSet(this.position(2, 3))); }; ObjectExtensions.operator_doubleArrow(_document, _function); } @@ -77,12 +62,9 @@ public class DocumentTest { public void testOffSet_empty() { Document _document = new Document(1, ""); final Procedure1 _function = (Document it) -> { - Position _position = this.position(0, 0); - int _offSet = it.getOffSet(_position); - Assert.assertEquals(0, _offSet); + Assert.assertEquals(0, it.getOffSet(this.position(0, 0))); try { - Position _position_1 = this.position(0, 12); - it.getOffSet(_position_1); + it.getOffSet(this.position(0, 12)); Assert.fail(); } catch (final Throwable _t) { if (_t instanceof IndexOutOfBoundsException) { @@ -112,14 +94,9 @@ public class DocumentTest { _builder_1.newLine(); _builder_1.append("bar"); _builder_1.newLine(); - String _normalize_1 = this.normalize(_builder_1); - Position _position = this.position(1, 0); - Position _position_1 = this.position(2, 0); - TextEdit _change = this.change(_position, _position_1, ""); - Document _applyChanges = it.applyChanges( - Collections.unmodifiableList(CollectionLiterals.newArrayList(_change))); - String _contents = _applyChanges.getContents(); - Assert.assertEquals(_normalize_1, _contents); + TextEdit _change = this.change(this.position(1, 0), this.position(2, 0), ""); + Assert.assertEquals(this.normalize(_builder_1), it.applyChanges( + Collections.unmodifiableList(CollectionLiterals.newArrayList(_change))).getContents()); }; ObjectExtensions.operator_doubleArrow(_document, _function); } @@ -143,14 +120,9 @@ public class DocumentTest { _builder_1.newLine(); _builder_1.append("bar"); _builder_1.newLine(); - String _normalize_1 = this.normalize(_builder_1); - Position _position = this.position(1, 1); - Position _position_1 = this.position(1, 3); - TextEdit _change = this.change(_position, _position_1, "uture"); - Document _applyChanges = it.applyChanges( - Collections.unmodifiableList(CollectionLiterals.newArrayList(_change))); - String _contents = _applyChanges.getContents(); - Assert.assertEquals(_normalize_1, _contents); + TextEdit _change = this.change(this.position(1, 1), this.position(1, 3), "uture"); + Assert.assertEquals(this.normalize(_builder_1), it.applyChanges( + Collections.unmodifiableList(CollectionLiterals.newArrayList(_change))).getContents()); }; ObjectExtensions.operator_doubleArrow(_document, _function); } @@ -166,13 +138,9 @@ public class DocumentTest { String _normalize = this.normalize(_builder); Document _document = new Document(1, _normalize); final Procedure1 _function = (Document it) -> { - Position _position = this.position(0, 0); - Position _position_1 = this.position(2, 3); - TextEdit _change = this.change(_position, _position_1, ""); - Document _applyChanges = it.applyChanges( - Collections.unmodifiableList(CollectionLiterals.newArrayList(_change))); - String _contents = _applyChanges.getContents(); - Assert.assertEquals("", _contents); + TextEdit _change = this.change(this.position(0, 0), this.position(2, 3), ""); + Assert.assertEquals("", it.applyChanges( + Collections.unmodifiableList(CollectionLiterals.newArrayList(_change))).getContents()); }; ObjectExtensions.operator_doubleArrow(_document, _function); } @@ -189,10 +157,8 @@ public class DocumentTest { Document _document = new Document(1, _normalize); final Procedure1 _function = (Document it) -> { TextEdit _change = this.change(null, null, " foo "); - Document _applyChanges = it.applyChanges( - Collections.unmodifiableList(CollectionLiterals.newArrayList(_change))); - String _contents = _applyChanges.getContents(); - Assert.assertEquals(" foo ", _contents); + Assert.assertEquals(" foo ", it.applyChanges( + Collections.unmodifiableList(CollectionLiterals.newArrayList(_change))).getContents()); }; ObjectExtensions.operator_doubleArrow(_document, _function); } @@ -215,8 +181,7 @@ public class DocumentTest { } private String normalize(final CharSequence s) { - String _string = s.toString(); - return _string.replaceAll("\r", ""); + return s.toString().replaceAll("\r", ""); } private Position position(final int l, final int c) { diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/LspExtensionTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/LspExtensionTest.java index f8f4ddbe7..df4bb7fb0 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/LspExtensionTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/LspExtensionTest.java @@ -8,8 +8,6 @@ package org.eclipse.xtext.ide.tests.server; import com.google.common.collect.Iterables; -import java.util.List; -import java.util.concurrent.CompletableFuture; import org.eclipse.lsp4j.DidOpenTextDocumentParams; import org.eclipse.lsp4j.TextDocumentItem; import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints; @@ -63,16 +61,12 @@ public class LspExtensionTest extends AbstractTestLangLanguageServerTest { it.line = 1; }; TestLangLSPExtension.TextOfLineParam _doubleArrow_1 = ObjectExtensions.operator_doubleArrow(_textOfLineParam, _function_1); - CompletableFuture _textOfLine = ext.getTextOfLine(_doubleArrow_1); - final TestLangLSPExtension.TextOfLineResult result = _textOfLine.get(); + final TestLangLSPExtension.TextOfLineResult result = ext.getTextOfLine(_doubleArrow_1).get(); Assert.assertEquals("baz test", result.text); final Function1, Object> _function_2 = (Pair it) -> { return it.getValue(); }; - List _map = ListExtensions., Object>map(this.notifications, _function_2); - Iterable _filter = Iterables.filter(_map, TestLangLSPExtension.BuildNotification.class); - int _size = IterableExtensions.size(_filter); - Assert.assertEquals(2, _size); + Assert.assertEquals(2, IterableExtensions.size(Iterables.filter(ListExtensions., Object>map(this.notifications, _function_2), TestLangLSPExtension.BuildNotification.class))); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/MultiProjectTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/MultiProjectTest.java index 009a8c299..5128dad34 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/MultiProjectTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/MultiProjectTest.java @@ -11,7 +11,6 @@ import com.google.inject.AbstractModule; import com.google.inject.Guice; import com.google.inject.Inject; import com.google.inject.Injector; -import com.google.inject.Module; import com.google.inject.binder.AnnotatedBindingBuilder; import java.io.File; import java.io.FileWriter; @@ -24,11 +23,9 @@ import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.diagnostics.Diagnostic; import org.eclipse.xtext.ide.server.IWorkspaceConfigFactory; import org.eclipse.xtext.ide.server.MultiProjectWorkspaceConfigFactory; -import org.eclipse.xtext.ide.server.ProjectManager; import org.eclipse.xtext.ide.server.ServerModule; import org.eclipse.xtext.ide.server.WorkspaceManager; import org.eclipse.xtext.ide.server.concurrent.RequestManager; -import org.eclipse.xtext.resource.impl.ProjectDescription; import org.eclipse.xtext.util.CancelIndicator; import org.eclipse.xtext.util.Files; import org.eclipse.xtext.util.Modules2; @@ -75,21 +72,16 @@ public class MultiProjectTest { _builder_1.append("}"); _builder_1.newLine(); final URI bar = this.createFile(this.project1, "Bar.testlang", _builder_1); - List _emptyList = CollectionLiterals.emptyList(); - this.workspaceManager.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(foo, bar)), _emptyList, CancelIndicator.NullImpl); + this.workspaceManager.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(foo, bar)), CollectionLiterals.emptyList(), CancelIndicator.NullImpl); Assert.assertEquals(2, this.diagnostics.size()); Assert.assertEquals(1, this.diagnostics.get(foo).size()); Assert.assertEquals(Diagnostic.LINKING_DIAGNOSTIC, IterableExtensions.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); - ProjectDescription _projectDescription = _projectManager.getProjectDescription(); - List _dependencies = _projectDescription.getDependencies(); - String _name_1 = this.project1.getName(); - _dependencies.add(_name_1); - List _emptyList_1 = CollectionLiterals.emptyList(); - this.workspaceManager.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(foo, bar)), _emptyList_1, CancelIndicator.NullImpl); + List _dependencies = this.workspaceManager.getProjectManager(this.project0.getName()).getProjectDescription().getDependencies(); + String _name = this.project1.getName(); + _dependencies.add(_name); + this.workspaceManager.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(foo, bar)), CollectionLiterals.emptyList(), CancelIndicator.NullImpl); Assert.assertEquals(2, this.diagnostics.size()); Assert.assertTrue(this.diagnostics.get(foo).isEmpty()); Assert.assertTrue(this.diagnostics.get(bar).isEmpty()); @@ -98,20 +90,18 @@ public class MultiProjectTest { @Before public void setup() { ServerModule _serverModule = new ServerModule(); - Module _mixin = Modules2.mixin(_serverModule, new AbstractModule() { + final Injector injector = Guice.createInjector(Modules2.mixin(_serverModule, new AbstractModule() { @Override protected void configure() { - AnnotatedBindingBuilder _bind = this.bind(IWorkspaceConfigFactory.class); - _bind.to(MultiProjectWorkspaceConfigFactory.class); - AnnotatedBindingBuilder _bind_1 = this.bind(RequestManager.class); - _bind_1.toInstance(new RequestManager() { + this.bind(IWorkspaceConfigFactory.class).to(MultiProjectWorkspaceConfigFactory.class); + AnnotatedBindingBuilder _bind = this.bind(RequestManager.class); + _bind.toInstance(new RequestManager() { @Override public CompletableFuture runWrite(final Function1 writeRequest) { final CancelIndicator _function = () -> { return false; }; - V _apply = writeRequest.apply(_function); - return CompletableFuture.completedFuture(_apply); + return CompletableFuture.completedFuture(writeRequest.apply(_function)); } @Override @@ -119,13 +109,11 @@ public class MultiProjectTest { final CancelIndicator _function = () -> { return false; }; - V _apply = readRequest.apply(_function); - return CompletableFuture.completedFuture(_apply); + return CompletableFuture.completedFuture(readRequest.apply(_function)); } }); } - }); - final Injector injector = Guice.createInjector(_mixin); + })); injector.injectMembers(this); final File workspaceRoot = this.getRoot("test-data"); File _file = new File(workspaceRoot, "test-project0"); @@ -134,13 +122,10 @@ public class MultiProjectTest { this.project1 = _file_1; this.project0.mkdir(); this.project1.mkdir(); - String _absolutePath = workspaceRoot.getAbsolutePath(); - URI _createFileURI = URI.createFileURI(_absolutePath); final Procedure2> _function = (URI $0, Iterable $1) -> { - List _list = IterableExtensions.toList($1); - this.diagnostics.put($0, _list); + this.diagnostics.put($0, IterableExtensions.toList($1)); }; - this.workspaceManager.initialize(_createFileURI, _function, null); + this.workspaceManager.initialize(URI.createFileURI(workspaceRoot.getAbsolutePath()), _function, null); } protected File getRoot(final String path) { @@ -165,8 +150,7 @@ public class MultiProjectTest { public URI createFile(final File root, final String path, final CharSequence contents) { try { final File file = new File(root, path); - File _parentFile = file.getParentFile(); - _parentFile.mkdirs(); + file.getParentFile().mkdirs(); file.createNewFile(); FileWriter _fileWriter = new FileWriter(file); final Procedure1 _function = (FileWriter it) -> { @@ -178,8 +162,7 @@ public class MultiProjectTest { } }; ObjectExtensions.operator_doubleArrow(_fileWriter, _function); - String _absolutePath = file.getAbsolutePath(); - return URI.createFileURI(_absolutePath); + return URI.createFileURI(file.getAbsolutePath()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/OpenDocumentTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/OpenDocumentTest.java index 19063435b..badfa5027 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/OpenDocumentTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/OpenDocumentTest.java @@ -8,8 +8,6 @@ package org.eclipse.xtext.ide.tests.server; import java.util.Collections; -import java.util.List; -import java.util.Map; import org.eclipse.lsp4j.Diagnostic; import org.eclipse.lsp4j.DidChangeTextDocumentParams; import org.eclipse.lsp4j.DidChangeWatchedFilesParams; @@ -46,11 +44,7 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest { _builder.newLine(); final String firstFile = this.writeFile("MyType1.testlang", _builder); this.initialize(); - Map> _diagnostics = this.getDiagnostics(); - List _get = _diagnostics.get(firstFile); - Diagnostic _head = IterableExtensions.head(_get); - String _message = _head.getMessage(); - this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message); + this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.head(this.getDiagnostics().get(firstFile)).getMessage()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type Foo {"); _builder_1.newLine(); @@ -62,27 +56,16 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest { DidChangeWatchedFilesParams _didChangeWatchedFilesParams = new DidChangeWatchedFilesParams( Collections.unmodifiableList(CollectionLiterals.newArrayList(_fileEvent))); _workspaceService.didChangeWatchedFiles(_didChangeWatchedFilesParams); - Map> _diagnostics_1 = this.getDiagnostics(); - List _get_1 = _diagnostics_1.get(firstFile); - Diagnostic _head_1 = IterableExtensions.head(_get_1); - String _message_1 = _head_1.getMessage(); - this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message_1); + this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.head(this.getDiagnostics().get(firstFile)).getMessage()); StringConcatenation _builder_2 = new StringConcatenation(); _builder_2.append("type NonExisting {"); _builder_2.newLine(); _builder_2.append("}"); _builder_2.newLine(); this.open(path, _builder_2.toString()); - Map> _diagnostics_2 = this.getDiagnostics(); - List _get_2 = _diagnostics_2.get(firstFile); - Diagnostic _head_2 = IterableExtensions.head(_get_2); - Assert.assertNull(_head_2); + Assert.assertNull(IterableExtensions.head(this.getDiagnostics().get(firstFile))); this.close(path); - Map> _diagnostics_3 = this.getDiagnostics(); - List _get_3 = _diagnostics_3.get(firstFile); - Diagnostic _head_3 = IterableExtensions.head(_get_3); - String _message_2 = _head_3.getMessage(); - this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message_2); + this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.head(this.getDiagnostics().get(firstFile)).getMessage()); } @Test @@ -97,11 +80,7 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest { _builder.newLine(); final String firstFile = this.writeFile("MyType1.testlang", _builder); this.initialize(); - Map> _diagnostics = this.getDiagnostics(); - List _get = _diagnostics.get(firstFile); - Diagnostic _head = IterableExtensions.head(_get); - String _message = _head.getMessage(); - this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message); + this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.head(this.getDiagnostics().get(firstFile)).getMessage()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type Test {"); _builder_1.newLine(); @@ -111,11 +90,7 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest { _builder_1.append("}"); _builder_1.newLine(); this.open(firstFile, _builder_1.toString()); - Map> _diagnostics_1 = this.getDiagnostics(); - List _get_1 = _diagnostics_1.get(firstFile); - Diagnostic _head_1 = IterableExtensions.head(_get_1); - String _message_1 = _head_1.getMessage(); - this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message_1); + this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.head(this.getDiagnostics().get(firstFile)).getMessage()); DidChangeTextDocumentParams _didChangeTextDocumentParams = new DidChangeTextDocumentParams(); final Procedure1 _function = (DidChangeTextDocumentParams it) -> { VersionedTextDocumentIdentifier _versionedTextDocumentIdentifier = new VersionedTextDocumentIdentifier(); @@ -138,10 +113,7 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest { }; DidChangeTextDocumentParams _doubleArrow = ObjectExtensions.operator_doubleArrow(_didChangeTextDocumentParams, _function); this.languageServer.didChange(_doubleArrow); - Map> _diagnostics_2 = this.getDiagnostics(); - List _get_2 = _diagnostics_2.get(firstFile); - Diagnostic _head_2 = IterableExtensions.head(_get_2); - Assert.assertNull(_head_2); + Assert.assertNull(IterableExtensions.head(this.getDiagnostics().get(firstFile))); } @Test @@ -158,20 +130,11 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest { _builder.append("}"); _builder.newLine(); this.open(referencingFileURI, _builder.toString()); - Map> _diagnostics = this.getDiagnostics(); - List _get = _diagnostics.get(referencingFileURI); - boolean _isEmpty = _get.isEmpty(); - Assert.assertFalse(_isEmpty); + Assert.assertFalse(this.getDiagnostics().get(referencingFileURI).isEmpty()); this.open(fileURI, "type Foo {}"); - Map> _diagnostics_1 = this.getDiagnostics(); - List _get_1 = _diagnostics_1.get(referencingFileURI); - boolean _isEmpty_1 = _get_1.isEmpty(); - Assert.assertTrue(_isEmpty_1); + Assert.assertTrue(this.getDiagnostics().get(referencingFileURI).isEmpty()); this.close(fileURI); - Map> _diagnostics_2 = this.getDiagnostics(); - List _get_2 = _diagnostics_2.get(referencingFileURI); - boolean _isEmpty_2 = _get_2.isEmpty(); - Assert.assertFalse(_isEmpty_2); + Assert.assertFalse(this.getDiagnostics().get(referencingFileURI).isEmpty()); } @Test @@ -189,14 +152,8 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest { _builder.append("}"); _builder.newLine(); this.open(referencingFileURI, _builder.toString()); - Map> _diagnostics = this.getDiagnostics(); - List _get = _diagnostics.get(referencingFileURI); - boolean _isEmpty = _get.isEmpty(); - Assert.assertTrue(_isEmpty); + Assert.assertTrue(this.getDiagnostics().get(referencingFileURI).isEmpty()); this.close(fileURI); - Map> _diagnostics_1 = this.getDiagnostics(); - List _get_1 = _diagnostics_1.get(referencingFileURI); - boolean _isEmpty_1 = _get_1.isEmpty(); - Assert.assertFalse(_isEmpty_1); + Assert.assertFalse(this.getDiagnostics().get(referencingFileURI).isEmpty()); } } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/ServerTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/ServerTest.java index 8c09dbdbd..8021a304b 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/ServerTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/ServerTest.java @@ -7,17 +7,12 @@ */ package org.eclipse.xtext.ide.tests.server; -import java.util.Collection; import java.util.Collections; import java.util.List; -import java.util.Map; -import java.util.Set; import org.eclipse.lsp4j.Diagnostic; import org.eclipse.lsp4j.DidChangeWatchedFilesParams; import org.eclipse.lsp4j.FileChangeType; import org.eclipse.lsp4j.FileEvent; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.Range; import org.eclipse.lsp4j.services.WorkspaceService; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest; @@ -44,14 +39,7 @@ public class ServerTest extends AbstractTestLangLanguageServerTest { _builder.newLine(); this.writeFile("MyType1.testlang", _builder); this.initialize(); - Map> _diagnostics = this.getDiagnostics(); - Set>> _entrySet = _diagnostics.entrySet(); - String _join = IterableExtensions.join(_entrySet, ","); - Map> _diagnostics_1 = this.getDiagnostics(); - Collection> _values = _diagnostics_1.values(); - List _head = IterableExtensions.>head(_values); - boolean _isEmpty = _head.isEmpty(); - Assert.assertTrue(_join, _isEmpty); + Assert.assertTrue(IterableExtensions.join(this.getDiagnostics().entrySet(), ","), IterableExtensions.>head(this.getDiagnostics().values()).isEmpty()); } @Test @@ -66,47 +54,16 @@ public class ServerTest extends AbstractTestLangLanguageServerTest { _builder.newLine(); this.writeFile("MyType1.testlang", _builder); this.initialize(); - Map> _diagnostics = this.getDiagnostics(); - Collection> _values = _diagnostics.values(); - List _head = IterableExtensions.>head(_values); - Diagnostic _head_1 = IterableExtensions.head(_head); + Diagnostic _head = IterableExtensions.head(IterableExtensions.>head(this.getDiagnostics().values())); String _message = null; - if (_head_1!=null) { - _message=_head_1.getMessage(); + if (_head!=null) { + _message=_head.getMessage(); } this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message); - Map> _diagnostics_1 = this.getDiagnostics(); - Collection> _values_1 = _diagnostics_1.values(); - List _head_2 = IterableExtensions.>head(_values_1); - Diagnostic _head_3 = IterableExtensions.head(_head_2); - Range _range = _head_3.getRange(); - Position _start = _range.getStart(); - int _line = _start.getLine(); - Assert.assertEquals(1, _line); - Map> _diagnostics_2 = this.getDiagnostics(); - Collection> _values_2 = _diagnostics_2.values(); - List _head_4 = IterableExtensions.>head(_values_2); - Diagnostic _head_5 = IterableExtensions.head(_head_4); - Range _range_1 = _head_5.getRange(); - Position _start_1 = _range_1.getStart(); - int _character = _start_1.getCharacter(); - Assert.assertEquals(4, _character); - Map> _diagnostics_3 = this.getDiagnostics(); - Collection> _values_3 = _diagnostics_3.values(); - List _head_6 = IterableExtensions.>head(_values_3); - Diagnostic _head_7 = IterableExtensions.head(_head_6); - Range _range_2 = _head_7.getRange(); - Position _end = _range_2.getEnd(); - int _line_1 = _end.getLine(); - Assert.assertEquals(1, _line_1); - Map> _diagnostics_4 = this.getDiagnostics(); - Collection> _values_4 = _diagnostics_4.values(); - List _head_8 = IterableExtensions.>head(_values_4); - Diagnostic _head_9 = IterableExtensions.head(_head_8); - Range _range_3 = _head_9.getRange(); - Position _end_1 = _range_3.getEnd(); - int _character_1 = _end_1.getCharacter(); - Assert.assertEquals(15, _character_1); + Assert.assertEquals(1, IterableExtensions.head(IterableExtensions.>head(this.getDiagnostics().values())).getRange().getStart().getLine()); + Assert.assertEquals(4, IterableExtensions.head(IterableExtensions.>head(this.getDiagnostics().values())).getRange().getStart().getCharacter()); + Assert.assertEquals(1, IterableExtensions.head(IterableExtensions.>head(this.getDiagnostics().values())).getRange().getEnd().getLine()); + Assert.assertEquals(15, IterableExtensions.head(IterableExtensions.>head(this.getDiagnostics().values())).getRange().getEnd().getCharacter()); } @Test @@ -121,12 +78,7 @@ public class ServerTest extends AbstractTestLangLanguageServerTest { _builder.newLine(); this.writeFile("MyType1.testlang", _builder); this.initialize(); - Map> _diagnostics = this.getDiagnostics(); - Collection> _values = _diagnostics.values(); - List _head = IterableExtensions.>head(_values); - Diagnostic _head_1 = IterableExtensions.head(_head); - String _message = _head_1.getMessage(); - this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message); + this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.head(IterableExtensions.>head(this.getDiagnostics().values())).getMessage()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type NonExisting {"); _builder_1.newLine(); @@ -137,18 +89,10 @@ public class ServerTest extends AbstractTestLangLanguageServerTest { FileEvent _fileEvent = new FileEvent(path, FileChangeType.Created); DidChangeWatchedFilesParams _didChangeWatchedFilesParams = new DidChangeWatchedFilesParams(Collections.unmodifiableList(CollectionLiterals.newArrayList(_fileEvent))); _workspaceService.didChangeWatchedFiles(_didChangeWatchedFilesParams); - Map> _diagnostics_1 = this.getDiagnostics(); - List _get = _diagnostics_1.get(path); - Assert.assertNotNull(_get); - Map> _diagnostics_2 = this.getDiagnostics(); - Collection> _values_1 = _diagnostics_2.values(); - String _join = IterableExtensions.join(_values_1, ","); - Map> _diagnostics_3 = this.getDiagnostics(); - Collection> _values_2 = _diagnostics_3.values(); + Assert.assertNotNull(this.getDiagnostics().get(path)); final Function1, Boolean> _function = (List it) -> { return Boolean.valueOf(it.isEmpty()); }; - boolean _forall = IterableExtensions.>forall(_values_2, _function); - Assert.assertTrue(_join, _forall); + Assert.assertTrue(IterableExtensions.join(this.getDiagnostics().values(), ","), IterableExtensions.>forall(this.getDiagnostics().values(), _function)); } } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/SignatureHelpTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/SignatureHelpTest.java index 29d0c0033..967c46ad9 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/SignatureHelpTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/SignatureHelpTest.java @@ -33,8 +33,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(0); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type A { op foo(a: A) { } } type Main { op main() { foo("); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("A.foo(a: A): void | a: A"); }; this.testSignatureHelp(_function); @@ -50,8 +49,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo("); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("A.foo(): void | A.foo(a: A): string | B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | "); }; this.testSignatureHelp(_function); @@ -67,8 +65,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo(1"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("A.foo(a: A): string | B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | a: A"); }; this.testSignatureHelp(_function); @@ -84,8 +81,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo(1, 2"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | b: B"); }; this.testSignatureHelp(_function); @@ -101,8 +97,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo(1, 2, 3"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("C.foo(a: A, b: B, c: C): void | c: C"); }; this.testSignatureHelp(_function); @@ -118,8 +113,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo( 1"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("A.foo(a: A): string | B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | a: A"); }; this.testSignatureHelp(_function); @@ -135,8 +129,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo(1 "); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("A.foo(a: A): string | B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | a: A"); }; this.testSignatureHelp(_function); @@ -152,8 +145,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo( 1"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | a: A"); }; this.testSignatureHelp(_function); @@ -169,8 +161,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo( 1 "); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | a: A"); }; this.testSignatureHelp(_function); @@ -186,8 +177,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo( 1 ,"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | b: B"); }; this.testSignatureHelp(_function); @@ -203,8 +193,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo(1, 2,"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("C.foo(a: A, b: B, c: C): void | c: C"); }; this.testSignatureHelp(_function); @@ -220,8 +209,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo(1, 2,"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("C.foo(a: A, b: B, c: C): void | c: C"); }; this.testSignatureHelp(_function); @@ -237,8 +225,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo(1, /*,*/ 2,"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp("C.foo(a: A, b: B, c: C): void | c: C"); }; this.testSignatureHelp(_function); @@ -254,8 +241,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp(""); }; this.testSignatureHelp(_function); @@ -271,8 +257,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest { it.setLine(SignatureHelpTest.LINE_NUMBER); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("foo(1, 2)"); - int _length = _builder_1.length(); - it.setColumn(_length); + it.setColumn(_builder_1.length()); it.setExpectedSignatureHelp(""); }; this.testSignatureHelp(_function); diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/WorkspaceManagerTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/WorkspaceManagerTest.java index fb519da5d..6e3879b7a 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/WorkspaceManagerTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/WorkspaceManagerTest.java @@ -52,8 +52,7 @@ public class WorkspaceManagerTest { _builder.append("}"); _builder.newLine(); final URI path = this.operator_mappedTo("MyType1.testlang", _builder); - List _emptyList = CollectionLiterals.emptyList(); - this.workspaceManger.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(path)), _emptyList, null); + this.workspaceManger.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(path)), CollectionLiterals.emptyList(), null); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type Test {"); _builder_1.newLine(); @@ -67,8 +66,7 @@ public class WorkspaceManagerTest { final Function2 _function = (Document $0, XtextResource $1) -> { return $0.getContents(); }; - String _doRead = this.workspaceManger.doRead(path, _function); - Assert.assertEquals(inMemContents, _doRead); + Assert.assertEquals(inMemContents, this.workspaceManger.doRead(path, _function)); } @Inject @@ -92,15 +90,10 @@ public class WorkspaceManagerTest { Files.cleanFolder(this.root, null, true, false); } this.root.deleteOnExit(); - String _absolutePath = this.root.getAbsolutePath(); - URI _createFileURI = URI.createFileURI(_absolutePath); - String _path = this.uriExtensions.toPath(_createFileURI); - URI _uri = this.uriExtensions.toUri(_path); final Procedure2> _function = (URI $0, Iterable $1) -> { - List _list = IterableExtensions.toList($1); - this.diagnostics.put($0, _list); + this.diagnostics.put($0, IterableExtensions.toList($1)); }; - this.workspaceManger.initialize(_uri, _function, null); + this.workspaceManger.initialize(this.uriExtensions.toUri(this.uriExtensions.toPath(URI.createFileURI(this.root.getAbsolutePath()))), _function, null); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -113,8 +106,7 @@ public class WorkspaceManagerTest { public URI operator_mappedTo(final String path, final CharSequence contents) { try { final File file = new File(this.root, path); - File _parentFile = file.getParentFile(); - _parentFile.mkdirs(); + file.getParentFile().mkdirs(); file.createNewFile(); FileWriter _fileWriter = new FileWriter(file); final Procedure1 _function = (FileWriter it) -> { @@ -126,8 +118,7 @@ public class WorkspaceManagerTest { } }; ObjectExtensions.operator_doubleArrow(_fileWriter, _function); - String _absolutePath = file.getAbsolutePath(); - return URI.createFileURI(_absolutePath); + return URI.createFileURI(file.getAbsolutePath()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/concurrent/RequestManagerTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/concurrent/RequestManagerTest.java index 061f8259d..eea7d4ac1 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/concurrent/RequestManagerTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/server/concurrent/RequestManagerTest.java @@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.tests.server.concurrent; import com.google.inject.Guice; import com.google.inject.Inject; -import com.google.inject.Injector; import java.util.concurrent.CancellationException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicInteger; @@ -38,8 +37,7 @@ public class RequestManagerTest { AtomicInteger _atomicInteger = new AtomicInteger(); this.sharedState = _atomicInteger; ServerModule _serverModule = new ServerModule(); - Injector _createInjector = Guice.createInjector(_serverModule); - _createInjector.injectMembers(this); + Guice.createInjector(_serverModule).injectMembers(this); } @After @@ -103,8 +101,7 @@ public class RequestManagerTest { final Function1 _function = (CancelIndicator it) -> { return Integer.valueOf(this.sharedState.incrementAndGet()); }; - CompletableFuture _runWrite = this.requestManager.runWrite(_function); - _runWrite.join(); + this.requestManager.runWrite(_function).join(); Assert.assertEquals(1, this.sharedState.get()); } @@ -124,8 +121,7 @@ public class RequestManagerTest { } return _xifexpression; }; - CompletableFuture _runWrite = this.requestManager.runWrite(_function_1); - _runWrite.join(); + this.requestManager.runWrite(_function_1).join(); Assert.assertEquals(2, this.sharedState.get()); } @@ -143,8 +139,7 @@ public class RequestManagerTest { } return Integer.valueOf(_xblockexpression); }; - CompletableFuture _runWrite = this.requestManager.runWrite(_function_1); - _runWrite.join(); + this.requestManager.runWrite(_function_1).join(); Assert.assertEquals(2, this.sharedState.get()); } @@ -177,8 +172,7 @@ public class RequestManagerTest { } catch (final Throwable _t) { if (_t instanceof CancellationException) { final CancellationException e = (CancellationException)_t; - int _get = this.sharedState.get(); - Assert.assertEquals(1, _get); + Assert.assertEquals(1, this.sharedState.get()); } else { throw Exceptions.sneakyThrow(_t); } @@ -217,8 +211,7 @@ public class RequestManagerTest { } catch (final Throwable _t) { if (_t instanceof CancellationException) { final CancellationException e = (CancellationException)_t; - int _get = this.sharedState.get(); - Assert.assertEquals(1, _get); + Assert.assertEquals(1, this.sharedState.get()); } else { throw Exceptions.sneakyThrow(_t); } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/PartialContentAssistTestLanguageStandaloneSetup.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/PartialContentAssistTestLanguageStandaloneSetup.java index d4923558f..f20818919 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/PartialContentAssistTestLanguageStandaloneSetup.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/PartialContentAssistTestLanguageStandaloneSetup.java @@ -15,7 +15,6 @@ import org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguage @SuppressWarnings("all") public class PartialContentAssistTestLanguageStandaloneSetup extends PartialContentAssistTestLanguageStandaloneSetupGenerated { public static void doSetup() { - PartialContentAssistTestLanguageStandaloneSetup _partialContentAssistTestLanguageStandaloneSetup = new PartialContentAssistTestLanguageStandaloneSetup(); - _partialContentAssistTestLanguageStandaloneSetup.createInjectorAndDoEMFRegistration(); + new PartialContentAssistTestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration(); } } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/TestLanguageStandaloneSetup.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/TestLanguageStandaloneSetup.java index d1126a0a1..d71e03362 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/TestLanguageStandaloneSetup.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/TestLanguageStandaloneSetup.java @@ -15,7 +15,6 @@ import org.eclipse.xtext.ide.tests.testlanguage.TestLanguageStandaloneSetupGener @SuppressWarnings("all") public class TestLanguageStandaloneSetup extends TestLanguageStandaloneSetupGenerated { public static void doSetup() { - TestLanguageStandaloneSetup _testLanguageStandaloneSetup = new TestLanguageStandaloneSetup(); - _testLanguageStandaloneSetup.createInjectorAndDoEMFRegistration(); + new TestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration(); } } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/coloring/ColoringServiceImpl.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/coloring/ColoringServiceImpl.java index 550b146c8..138f1b4ee 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/coloring/ColoringServiceImpl.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/coloring/ColoringServiceImpl.java @@ -11,7 +11,6 @@ import com.google.common.collect.ImmutableList; import java.util.Collections; import java.util.List; import java.util.function.Consumer; -import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.lsp4j.ColoringInformation; @@ -46,7 +45,6 @@ public class ColoringServiceImpl implements IColoringService { return CollectionLiterals.emptyList(); } final ImmutableList.Builder builder = ImmutableList.builder(); - TreeIterator _allContents = EcoreUtil.getAllContents(resource, true); final Procedure1 _function = (Object it) -> { List _xifexpression = null; if ((it instanceof Property)) { @@ -74,7 +72,7 @@ public class ColoringServiceImpl implements IColoringService { }; nodes.forEach(_function_1); }; - IteratorExtensions.forEach(_allContents, _function); + IteratorExtensions.forEach(EcoreUtil.getAllContents(resource, true), _function); return builder.build(); } } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/formatting2/TestLanguageFormatter.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/formatting2/TestLanguageFormatter.java index 39a8096bf..4266eef42 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/formatting2/TestLanguageFormatter.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/formatting2/TestLanguageFormatter.java @@ -12,14 +12,11 @@ import java.util.Arrays; import javax.inject.Inject; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; -import org.eclipse.xtext.Keyword; import org.eclipse.xtext.formatting2.AbstractFormatter2; import org.eclipse.xtext.formatting2.IFormattableDocument; import org.eclipse.xtext.formatting2.IHiddenRegionFormatter; import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion; -import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder; import org.eclipse.xtext.ide.tests.testlanguage.services.TestLanguageGrammarAccess; -import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Member; import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model; import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Property; import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration; @@ -44,40 +41,24 @@ public class TestLanguageFormatter extends AbstractFormatter2 { } protected void _format(final TypeDeclaration type, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(type); - TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess = this._testLanguageGrammarAccess.getTypeDeclarationAccess(); - Keyword _leftCurlyBracketKeyword_3 = _typeDeclarationAccess.getLeftCurlyBracketKeyword_3(); - ISemanticRegion _keyword = _regionFor.keyword(_leftCurlyBracketKeyword_3); final Procedure1 _function = (IHiddenRegionFormatter it) -> { it.newLine(); }; - document.append(_keyword, _function); - ISemanticRegionsFinder _regionFor_1 = this.textRegionExtensions.regionFor(type); - TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess_1 = this._testLanguageGrammarAccess.getTypeDeclarationAccess(); - Keyword _rightCurlyBracketKeyword_5 = _typeDeclarationAccess_1.getRightCurlyBracketKeyword_5(); - ISemanticRegion _keyword_1 = _regionFor_1.keyword(_rightCurlyBracketKeyword_5); + document.append(this.textRegionExtensions.regionFor(type).keyword(this._testLanguageGrammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3()), _function); final Procedure1 _function_1 = (IHiddenRegionFormatter it) -> { it.newLine(); }; - ISemanticRegion _prepend = document.prepend(_keyword_1, _function_1); final Procedure1 _function_2 = (IHiddenRegionFormatter it) -> { it.newLine(); }; - document.append(_prepend, _function_2); - ISemanticRegionsFinder _regionFor_2 = this.textRegionExtensions.regionFor(type); - TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess_2 = this._testLanguageGrammarAccess.getTypeDeclarationAccess(); - Keyword _leftCurlyBracketKeyword_3_1 = _typeDeclarationAccess_2.getLeftCurlyBracketKeyword_3(); - ISemanticRegion _keyword_2 = _regionFor_2.keyword(_leftCurlyBracketKeyword_3_1); - ISemanticRegionsFinder _regionFor_3 = this.textRegionExtensions.regionFor(type); - TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess_3 = this._testLanguageGrammarAccess.getTypeDeclarationAccess(); - Keyword _rightCurlyBracketKeyword_5_1 = _typeDeclarationAccess_3.getRightCurlyBracketKeyword_5(); - ISemanticRegion _keyword_3 = _regionFor_3.keyword(_rightCurlyBracketKeyword_5_1); + document.append(document.prepend(this.textRegionExtensions.regionFor(type).keyword(this._testLanguageGrammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5()), _function_1), _function_2); final Procedure1 _function_3 = (IHiddenRegionFormatter it) -> { it.indent(); }; - document.interior(_keyword_2, _keyword_3, _function_3); - EList _members = type.getMembers(); - Iterable _filter = Iterables.filter(_members, Property.class); + document.interior( + this.textRegionExtensions.regionFor(type).keyword(this._testLanguageGrammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3()), + this.textRegionExtensions.regionFor(type).keyword(this._testLanguageGrammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5()), _function_3); + Iterable _filter = Iterables.filter(type.getMembers(), Property.class); for (final Property property : _filter) { document.format(property); } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/generator/TestLanguageGenerator.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/generator/TestLanguageGenerator.java index e71f55fa3..50faaaa48 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/generator/TestLanguageGenerator.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/generator/TestLanguageGenerator.java @@ -10,17 +10,12 @@ package org.eclipse.xtext.ide.tests.testlanguage.generator; import com.google.common.collect.Iterables; import com.google.common.collect.Iterators; import java.util.Arrays; -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.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.generator.AbstractGenerator; import org.eclipse.xtext.generator.IFileSystemAccess2; import org.eclipse.xtext.generator.IGeneratorContext; -import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Member; import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.PrimitiveType; import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Property; import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Type; @@ -41,9 +36,7 @@ import org.eclipse.xtext.xbase.lib.StringExtensions; public class TestLanguageGenerator extends AbstractGenerator { @Override public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) { - TreeIterator _allContents = resource.getAllContents(); - Iterator _filter = Iterators.filter(_allContents, TypeDeclaration.class); - List _list = IteratorExtensions.toList(_filter); + List _list = IteratorExtensions.toList(Iterators.filter(resource.getAllContents(), TypeDeclaration.class)); for (final TypeDeclaration type : _list) { String _name = type.getName(); String _plus = (_name + ".java"); @@ -54,13 +47,11 @@ public class TestLanguageGenerator extends AbstractGenerator { _builder.append(" {"); _builder.newLineIfNotEmpty(); { - EList _members = type.getMembers(); - Iterable _filter_1 = Iterables.filter(_members, Property.class); - for(final Property p : _filter_1) { + Iterable _filter = Iterables.filter(type.getMembers(), Property.class); + for(final Property p : _filter) { _builder.append("\t"); _builder.append("private "); - Type _type = p.getType(); - String _java = this.toJava(_type); + String _java = this.toJava(p.getType()); _builder.append(_java, "\t"); _builder.append(" "); String _name_2 = p.getName(); @@ -71,26 +62,24 @@ public class TestLanguageGenerator extends AbstractGenerator { _builder.newLine(); _builder.append("\t"); _builder.append("public void set"); - String _name_3 = p.getName(); - String _firstUpper = StringExtensions.toFirstUpper(_name_3); + String _firstUpper = StringExtensions.toFirstUpper(p.getName()); _builder.append(_firstUpper, "\t"); _builder.append("("); - Type _type_1 = p.getType(); - String _java_1 = this.toJava(_type_1); + String _java_1 = this.toJava(p.getType()); _builder.append(_java_1, "\t"); _builder.append(" "); - String _name_4 = p.getName(); - _builder.append(_name_4, "\t"); + String _name_3 = p.getName(); + _builder.append(_name_3, "\t"); _builder.append(") {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("\t"); _builder.append("this."); + String _name_4 = p.getName(); + _builder.append(_name_4, "\t\t"); + _builder.append(" = "); String _name_5 = p.getName(); _builder.append(_name_5, "\t\t"); - _builder.append(" = "); - String _name_6 = p.getName(); - _builder.append(_name_6, "\t\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -100,20 +89,18 @@ public class TestLanguageGenerator extends AbstractGenerator { _builder.newLine(); _builder.append("\t"); _builder.append("public "); - Type _type_2 = p.getType(); - String _java_2 = this.toJava(_type_2); + String _java_2 = this.toJava(p.getType()); _builder.append(_java_2, "\t"); _builder.append(" get"); - String _name_7 = p.getName(); - String _firstUpper_1 = StringExtensions.toFirstUpper(_name_7); + String _firstUpper_1 = StringExtensions.toFirstUpper(p.getName()); _builder.append(_firstUpper_1, "\t"); _builder.append("() {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("\t"); _builder.append("return this."); - String _name_8 = p.getName(); - _builder.append(_name_8, "\t\t"); + String _name_6 = p.getName(); + _builder.append(_name_6, "\t\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -128,25 +115,20 @@ public class TestLanguageGenerator extends AbstractGenerator { } protected String _toJava(final TypeReference type) { - TypeDeclaration _typeRef = type.getTypeRef(); - String _name = _typeRef.getName(); - EList _arrayDiemensions = type.getArrayDiemensions(); + String _name = type.getTypeRef().getName(); final Function1 _function = (String it) -> { return "[]"; }; - List _map = ListExtensions.map(_arrayDiemensions, _function); - String _join = IterableExtensions.join(_map, ""); + String _join = IterableExtensions.join(ListExtensions.map(type.getArrayDiemensions(), _function), ""); return (_name + _join); } protected String _toJava(final PrimitiveType type) { String _name = type.getName(); - EList _arrayDiemensions = type.getArrayDiemensions(); final Function1 _function = (String it) -> { return "[]"; }; - List _map = ListExtensions.map(_arrayDiemensions, _function); - String _join = IterableExtensions.join(_map, ""); + String _join = IterableExtensions.join(ListExtensions.map(type.getArrayDiemensions(), _function), ""); return (_name + _join); } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLangLSPExtension.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLangLSPExtension.java index 6f799f087..57057d068 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLangLSPExtension.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLangLSPExtension.java @@ -13,7 +13,6 @@ import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.function.Function; -import org.eclipse.emf.common.util.URI; import org.eclipse.lsp4j.Position; import org.eclipse.lsp4j.jsonrpc.Endpoint; import org.eclipse.lsp4j.jsonrpc.json.JsonRpcMethod; @@ -23,7 +22,6 @@ import org.eclipse.lsp4j.jsonrpc.services.JsonRequest; import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints; import org.eclipse.lsp4j.services.LanguageClient; import org.eclipse.xtend.lib.annotations.ToString; -import org.eclipse.xtext.ide.server.Document; import org.eclipse.xtext.ide.server.ILanguageServerAccess; import org.eclipse.xtext.ide.server.ILanguageServerExtension; import org.eclipse.xtext.resource.IResourceDescription; @@ -78,19 +76,14 @@ public interface TestLangLSPExtension extends ILanguageServerExtension { @Override public CompletableFuture getTextOfLine(final TestLangLSPExtension.TextOfLineParam param) { final Function _function = (ILanguageServerAccess.Context ctx) -> { - Document _document = ctx.getDocument(); Position _position = new Position(param.line, 0); - final int start = _document.getOffSet(_position); - Document _document_1 = ctx.getDocument(); + final int start = ctx.getDocument().getOffSet(_position); Position _position_1 = new Position((param.line + 1), 0); - int _offSet = _document_1.getOffSet(_position_1); + int _offSet = ctx.getDocument().getOffSet(_position_1); final int end = (_offSet - 1); TestLangLSPExtension.TextOfLineResult _textOfLineResult = new TestLangLSPExtension.TextOfLineResult(); final Procedure1 _function_1 = (TestLangLSPExtension.TextOfLineResult it) -> { - Document _document_2 = ctx.getDocument(); - String _contents = _document_2.getContents(); - String _substring = _contents.substring(start, end); - it.text = _substring; + it.text = ctx.getDocument().getContents().substring(start, end); }; return ObjectExtensions.operator_doubleArrow(_textOfLineResult, _function_1); }; @@ -102,8 +95,7 @@ public interface TestLangLSPExtension extends ILanguageServerExtension { this.access = access; this.access.addBuildListener(this); LanguageClient _languageClient = access.getLanguageClient(); - TestLangLSPExtension.CustomClient _serviceObject = ServiceEndpoints.toServiceObject(((Endpoint) _languageClient), TestLangLSPExtension.CustomClient.class); - this.client = _serviceObject; + this.client = ServiceEndpoints.toServiceObject(((Endpoint) _languageClient), TestLangLSPExtension.CustomClient.class); } @Override @@ -111,11 +103,9 @@ public interface TestLangLSPExtension extends ILanguageServerExtension { TestLangLSPExtension.BuildNotification _buildNotification = new TestLangLSPExtension.BuildNotification(); final Procedure1 _function = (TestLangLSPExtension.BuildNotification it) -> { final Function1 _function_1 = (IResourceDescription.Delta it_1) -> { - URI _uri = it_1.getUri(); - return _uri.toString(); + return it_1.getUri().toString(); }; - List _map = ListExtensions.map(deltas, _function_1); - String _join = IterableExtensions.join(_map, ", "); + String _join = IterableExtensions.join(ListExtensions.map(deltas, _function_1), ", "); String _plus = ("Built " + _join); it.message = _plus; }; @@ -126,11 +116,8 @@ public interface TestLangLSPExtension extends ILanguageServerExtension { @Override public Map supportedMethods() { final HashMap result = CollectionLiterals.newHashMap(); - Class _class = this.getClass(); - Map _supportedMethods = ServiceEndpoints.getSupportedMethods(_class); - result.putAll(_supportedMethods); - Map _supportedMethods_1 = ServiceEndpoints.getSupportedMethods(TestLangLSPExtension.CustomClient.class); - result.putAll(_supportedMethods_1); + result.putAll(ServiceEndpoints.getSupportedMethods(this.getClass())); + result.putAll(ServiceEndpoints.getSupportedMethods(TestLangLSPExtension.CustomClient.class)); return result; } } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLanguageIdeSetup.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLanguageIdeSetup.java index 4206dc48d..f092a6dbd 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLanguageIdeSetup.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLanguageIdeSetup.java @@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.tests.testlanguage.ide; import com.google.inject.Guice; import com.google.inject.Injector; -import com.google.inject.Module; import org.eclipse.xtext.ide.tests.testlanguage.TestLanguageRuntimeModule; import org.eclipse.xtext.ide.tests.testlanguage.TestLanguageStandaloneSetup; import org.eclipse.xtext.ide.tests.testlanguage.ide.TestLanguageIdeModule; @@ -24,7 +23,6 @@ public class TestLanguageIdeSetup extends TestLanguageStandaloneSetup { public Injector createInjector() { TestLanguageRuntimeModule _testLanguageRuntimeModule = new TestLanguageRuntimeModule(); TestLanguageIdeModule _testLanguageIdeModule = new TestLanguageIdeModule(); - Module _mixin = Modules2.mixin(_testLanguageRuntimeModule, _testLanguageIdeModule); - return Guice.createInjector(_mixin); + return Guice.createInjector(Modules2.mixin(_testLanguageRuntimeModule, _testLanguageIdeModule)); } } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/server/SocketServerLauncher.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/server/SocketServerLauncher.java index c7f7dcaf1..c21f37b5f 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/server/SocketServerLauncher.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/server/SocketServerLauncher.java @@ -16,7 +16,6 @@ import java.net.InetSocketAddress; import java.nio.channels.Channels; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; -import java.util.concurrent.Future; import org.eclipse.lsp4j.jsonrpc.Launcher; import org.eclipse.lsp4j.launch.LSPLauncher; import org.eclipse.lsp4j.services.LanguageClient; @@ -42,8 +41,7 @@ public class SocketServerLauncher { OutputStream _newOutputStream = Channels.newOutputStream(socketChannel); PrintWriter _printWriter = new PrintWriter(System.out); final Launcher launcher = LSPLauncher.createServerLauncher(languageServer, _newInputStream, _newOutputStream, true, _printWriter); - Future _startListening = launcher.startListening(); - _startListening.get(); + launcher.startListening().get(); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/signatureHelp/SignatureHelpServiceImpl.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/signatureHelp/SignatureHelpServiceImpl.java index a26c88398..c409192f6 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/signatureHelp/SignatureHelpServiceImpl.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/signatureHelp/SignatureHelpServiceImpl.java @@ -17,7 +17,6 @@ import java.util.List; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; import org.eclipse.lsp4j.ParameterInformation; import org.eclipse.lsp4j.SignatureHelp; import org.eclipse.lsp4j.SignatureInformation; @@ -32,15 +31,12 @@ import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Type; import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration; import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeReference; -import org.eclipse.xtext.naming.QualifiedName; import org.eclipse.xtext.nodemodel.BidiIterable; -import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; import org.eclipse.xtext.resource.EObjectAtOffsetHelper; import org.eclipse.xtext.resource.IEObjectDescription; import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.scoping.IScope; import org.eclipse.xtext.scoping.IScopeProvider; import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Conversions; @@ -70,26 +66,16 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService { * based on the number of parameters first, then the parameter labels lexicographically. */ private final static Comparator SIGNATURE_INFO_ORDERING = ((Comparator) (SignatureInformation left, SignatureInformation right) -> { - List _parameters = left.getParameters(); - int _size = _parameters.size(); - List _parameters_1 = right.getParameters(); - int _size_1 = _parameters_1.size(); + int _size = left.getParameters().size(); + int _size_1 = right.getParameters().size(); int result = (_size - _size_1); if ((result == 0)) { int i = 0; - List _parameters_2 = left.getParameters(); - int size = _parameters_2.size(); + int size = left.getParameters().size(); boolean _while = (i < size); while (_while) { { - List _parameters_3 = left.getParameters(); - ParameterInformation _get = _parameters_3.get(i); - String _label = _get.getLabel(); - List _parameters_4 = right.getParameters(); - ParameterInformation _get_1 = _parameters_4.get(i); - String _label_1 = _get_1.getLabel(); - int _compareTo = _label.compareTo(_label_1); - result = _compareTo; + result = left.getParameters().get(i).getLabel().compareTo(right.getParameters().get(i).getLabel()); if ((result != 0)) { return result; } @@ -128,8 +114,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService { private SignatureHelp getSignatureHelp(final OperationCall call, final String operationName, final int offset) { final List separatorIndices = CollectionLiterals.newArrayList(); - ICompositeNode _node = NodeModelUtils.getNode(call); - BidiIterable _children = _node.getChildren(); + BidiIterable _children = NodeModelUtils.getNode(call).getChildren(); for (final INode node : _children) { { final String text = node.getText(); @@ -141,19 +126,16 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService { } else { boolean _equals = Objects.equal(SignatureHelpServiceImpl.SEPARATOR_CHAR, text); if (_equals) { - int _offset = node.getOffset(); - separatorIndices.add(Integer.valueOf(_offset)); + separatorIndices.add(Integer.valueOf(node.getOffset())); } } } } } - EList _params = call.getParams(); - final int paramCount = _params.size(); + final int paramCount = call.getParams().size(); final int separatorCount = separatorIndices.size(); if ((((separatorCount + 1) == paramCount) || (separatorCount == paramCount))) { - EReference _operation_Params = this._testLanguagePackage.getOperation_Params(); - final List paramNodes = NodeModelUtils.findNodesForFeature(call, _operation_Params); + final List paramNodes = NodeModelUtils.findNodesForFeature(call, this._testLanguagePackage.getOperation_Params()); for (int i = 0; (i < separatorCount); i++) { { final INode paramNode = paramNodes.get(i); @@ -186,13 +168,11 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService { _xifexpression = _xifexpression_1; } final int currentParameter = _xifexpression; - Iterable _visibleOperationsWithName = this.getVisibleOperationsWithName(call, operationName); final Function1 _function = (Operation it) -> { - EList _params_1 = it.getParams(); - int _size = _params_1.size(); + int _size = it.getParams().size(); return Boolean.valueOf((currentParameter <= _size)); }; - final Iterable visibleOperations = IterableExtensions.filter(_visibleOperationsWithName, _function); + final Iterable visibleOperations = IterableExtensions.filter(this.getVisibleOperationsWithName(call, operationName), _function); int _xifexpression_2 = (int) 0; boolean _contains_1 = separatorIndices.contains(Integer.valueOf(offset)); if (_contains_1) { @@ -206,16 +186,14 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService { Integer _xblockexpression = null; { final Function1 _function_1 = (Operation it) -> { - EList _params_1 = it.getParams(); - return Integer.valueOf(_params_1.size()); + return Integer.valueOf(it.getParams().size()); }; final Iterable paramSize = IterableExtensions.map(visibleOperations, _function_1); Integer _xifexpression_4 = null; if (((!IterableExtensions.exists(paramSize, ((Function1) (Integer it) -> { return Boolean.valueOf(((it).intValue() == 0)); }))) && IterableExtensions.exists(visibleOperations, ((Function1) (Operation it) -> { - EList _params_1 = it.getParams(); - boolean _isEmpty = _params_1.isEmpty(); + boolean _isEmpty = it.getParams().isEmpty(); return Boolean.valueOf((!_isEmpty)); })))) { _xifexpression_4 = Integer.valueOf(0); @@ -236,9 +214,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService { final Function1 _function_2 = (Operation operation) -> { SignatureInformation _signatureInformation = new SignatureInformation(); final Procedure1 _function_3 = (SignatureInformation it_1) -> { - String _label = this.getLabel(operation); - it_1.setLabel(_label); - EList _params_1 = operation.getParams(); + it_1.setLabel(this.getLabel(operation)); final Function1 _function_4 = (Parameter param) -> { ParameterInformation _parameterInformation = new ParameterInformation(); final Procedure1 _function_5 = (ParameterInformation it_2) -> { @@ -246,53 +222,39 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService { String _name = param.getName(); _builder.append(_name); _builder.append(": "); - Type _type = param.getType(); - String _label_1 = this.getLabel(_type); - _builder.append(_label_1); + String _label = this.getLabel(param.getType()); + _builder.append(_label); it_2.setLabel(_builder.toString()); }; return ObjectExtensions.operator_doubleArrow(_parameterInformation, _function_5); }; - List _map = ListExtensions.map(_params_1, _function_4); - it_1.setParameters(_map); + it_1.setParameters(ListExtensions.map(operation.getParams(), _function_4)); }; return ObjectExtensions.operator_doubleArrow(_signatureInformation, _function_3); }; - Iterable _map = IterableExtensions.map(visibleOperations, _function_2); - List _list = IterableExtensions.toList(_map); - List _sortWith = IterableExtensions.sortWith(_list, SignatureHelpServiceImpl.SIGNATURE_INFO_ORDERING); - it.setSignatures(_sortWith); + it.setSignatures(IterableExtensions.sortWith(IterableExtensions.toList(IterableExtensions.map(visibleOperations, _function_2)), SignatureHelpServiceImpl.SIGNATURE_INFO_ORDERING)); }; return ObjectExtensions.operator_doubleArrow(_signatureHelp, _function_1); } private Iterable getVisibleOperationsWithName(final EObject object, final String name) { - EReference _operationCall_Operation = this._testLanguagePackage.getOperationCall_Operation(); - IScope _scope = this.scopeProvider.getScope(object, _operationCall_Operation); - Iterable _allElements = _scope.getAllElements(); final Function1 _function = (IEObjectDescription it) -> { EClass _eClass = it.getEClass(); EClass _operation = this._testLanguagePackage.getOperation(); return Boolean.valueOf(Objects.equal(_eClass, _operation)); }; - Iterable _filter = IterableExtensions.filter(_allElements, _function); final Function1 _function_1 = (IEObjectDescription it) -> { - QualifiedName _qualifiedName = it.getQualifiedName(); - String _lastSegment = _qualifiedName.getLastSegment(); + String _lastSegment = it.getQualifiedName().getLastSegment(); return Boolean.valueOf(Objects.equal(_lastSegment, name)); }; - Iterable _filter_1 = IterableExtensions.filter(_filter, _function_1); final Function1 _function_2 = (IEObjectDescription it) -> { return it.getEObjectOrProxy(); }; - Iterable _map = IterableExtensions.map(_filter_1, _function_2); - return Iterables.filter(_map, Operation.class); + return Iterables.filter(IterableExtensions.map(IterableExtensions.filter(IterableExtensions.filter(this.scopeProvider.getScope(object, this._testLanguagePackage.getOperationCall_Operation()).getAllElements(), _function), _function_1), _function_2), Operation.class); } private String getOperationName(final OperationCall call) { - EReference _operationCall_Operation = this._testLanguagePackage.getOperationCall_Operation(); - List _findNodesForFeature = NodeModelUtils.findNodesForFeature(call, _operationCall_Operation); - INode _head = IterableExtensions.head(_findNodesForFeature); + INode _head = IterableExtensions.head(NodeModelUtils.findNodesForFeature(call, this._testLanguagePackage.getOperationCall_Operation())); String _text = null; if (_head!=null) { _text=_head.getText(); @@ -302,8 +264,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService { private String _getLabel(final Operation it) { StringConcatenation _builder = new StringConcatenation(); - TypeDeclaration _containerOfType = EcoreUtil2.getContainerOfType(it, TypeDeclaration.class); - String _name = _containerOfType.getName(); + String _name = EcoreUtil2.getContainerOfType(it, TypeDeclaration.class).getName(); _builder.append(_name); _builder.append("."); String _name_1 = it.getName(); @@ -321,8 +282,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService { String _name_2 = p.getName(); _builder.append(_name_2); _builder.append(": "); - Type _type = p.getType(); - String _label = this.getLabel(_type); + String _label = this.getLabel(p.getType()); _builder.append(_label); } } @@ -333,8 +293,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService { if (_tripleEquals) { _builder.append("void"); } else { - Type _returnType_1 = it.getReturnType(); - String _label_1 = this.getLabel(_returnType_1); + String _label_1 = this.getLabel(it.getReturnType()); _builder.append(_label_1); } } @@ -342,8 +301,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService { } private String _getLabel(final TypeReference it) { - TypeDeclaration _typeRef = it.getTypeRef(); - return _typeRef.getName(); + return it.getTypeRef().getName(); } private String _getLabel(final PrimitiveType it) { diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/DocumentHighlightComparatorTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/DocumentHighlightComparatorTest.java index 7a8603698..c66a20761 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/DocumentHighlightComparatorTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/DocumentHighlightComparatorTest.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.ide.tests.util; import com.google.inject.Inject; -import java.util.ArrayList; import java.util.List; import org.eclipse.lsp4j.DocumentHighlight; import org.eclipse.lsp4j.DocumentHighlightKind; @@ -42,241 +41,61 @@ public class DocumentHighlightComparatorTest extends Assert { @Test public void withoutNull() { - Range _newRange = this.newRange(2, 2, 2, 2); - DocumentHighlight _newHighlight = this.newHighlight(DocumentHighlightKind.Text, _newRange); - Range _newRange_1 = this.newRange(1, 1, 1, 1); - DocumentHighlight _newHighlight_1 = this.newHighlight(DocumentHighlightKind.Text, _newRange_1); - Range _newRange_2 = this.newRange(2, 2, 2, 2); - DocumentHighlight _newHighlight_2 = this.newHighlight(DocumentHighlightKind.Write, _newRange_2); - Range _newRange_3 = this.newRange(1, 1, 1, 1); - DocumentHighlight _newHighlight_3 = this.newHighlight(DocumentHighlightKind.Write, _newRange_3); - Range _newRange_4 = this.newRange(2, 2, 2, 2); - DocumentHighlight _newHighlight_4 = this.newHighlight(DocumentHighlightKind.Read, _newRange_4); - Range _newRange_5 = this.newRange(1, 1, 1, 1); - DocumentHighlight _newHighlight_5 = this.newHighlight(DocumentHighlightKind.Read, _newRange_5); - ArrayList _newArrayList = CollectionLiterals.newArrayList(_newHighlight, _newHighlight_1, _newHighlight_2, _newHighlight_3, _newHighlight_4, _newHighlight_5); - final List input = this.sort(_newArrayList); - DocumentHighlight _get = input.get(0); - Range _range = _get.getRange(); - Position _start = _range.getStart(); - int _line = _start.getLine(); - Assert.assertEquals(1, _line); - DocumentHighlight _get_1 = input.get(0); - Range _range_1 = _get_1.getRange(); - Position _start_1 = _range_1.getStart(); - int _character = _start_1.getCharacter(); - Assert.assertEquals(1, _character); - DocumentHighlight _get_2 = input.get(0); - Range _range_2 = _get_2.getRange(); - Position _end = _range_2.getEnd(); - int _line_1 = _end.getLine(); - Assert.assertEquals(1, _line_1); - DocumentHighlight _get_3 = input.get(0); - Range _range_3 = _get_3.getRange(); - Position _end_1 = _range_3.getEnd(); - int _character_1 = _end_1.getCharacter(); - Assert.assertEquals(1, _character_1); - DocumentHighlight _get_4 = input.get(0); - DocumentHighlightKind _kind = _get_4.getKind(); - Assert.assertEquals(DocumentHighlightKind.Text, _kind); - DocumentHighlight _get_5 = input.get(1); - Range _range_4 = _get_5.getRange(); - Position _start_2 = _range_4.getStart(); - int _line_2 = _start_2.getLine(); - Assert.assertEquals(1, _line_2); - DocumentHighlight _get_6 = input.get(1); - Range _range_5 = _get_6.getRange(); - Position _start_3 = _range_5.getStart(); - int _character_2 = _start_3.getCharacter(); - Assert.assertEquals(1, _character_2); - DocumentHighlight _get_7 = input.get(1); - Range _range_6 = _get_7.getRange(); - Position _end_2 = _range_6.getEnd(); - int _line_3 = _end_2.getLine(); - Assert.assertEquals(1, _line_3); - DocumentHighlight _get_8 = input.get(1); - Range _range_7 = _get_8.getRange(); - Position _end_3 = _range_7.getEnd(); - int _character_3 = _end_3.getCharacter(); - Assert.assertEquals(1, _character_3); - DocumentHighlight _get_9 = input.get(1); - DocumentHighlightKind _kind_1 = _get_9.getKind(); - Assert.assertEquals(DocumentHighlightKind.Read, _kind_1); - DocumentHighlight _get_10 = input.get(2); - Range _range_8 = _get_10.getRange(); - Position _start_4 = _range_8.getStart(); - int _line_4 = _start_4.getLine(); - Assert.assertEquals(1, _line_4); - DocumentHighlight _get_11 = input.get(2); - Range _range_9 = _get_11.getRange(); - Position _start_5 = _range_9.getStart(); - int _character_4 = _start_5.getCharacter(); - Assert.assertEquals(1, _character_4); - DocumentHighlight _get_12 = input.get(2); - Range _range_10 = _get_12.getRange(); - Position _end_4 = _range_10.getEnd(); - int _line_5 = _end_4.getLine(); - Assert.assertEquals(1, _line_5); - DocumentHighlight _get_13 = input.get(2); - Range _range_11 = _get_13.getRange(); - Position _end_5 = _range_11.getEnd(); - int _character_5 = _end_5.getCharacter(); - Assert.assertEquals(1, _character_5); - DocumentHighlight _get_14 = input.get(2); - DocumentHighlightKind _kind_2 = _get_14.getKind(); - Assert.assertEquals(DocumentHighlightKind.Write, _kind_2); - DocumentHighlight _get_15 = input.get(3); - Range _range_12 = _get_15.getRange(); - Position _start_6 = _range_12.getStart(); - int _line_6 = _start_6.getLine(); - Assert.assertEquals(2, _line_6); - DocumentHighlight _get_16 = input.get(3); - Range _range_13 = _get_16.getRange(); - Position _start_7 = _range_13.getStart(); - int _character_6 = _start_7.getCharacter(); - Assert.assertEquals(2, _character_6); - DocumentHighlight _get_17 = input.get(3); - Range _range_14 = _get_17.getRange(); - Position _end_6 = _range_14.getEnd(); - int _line_7 = _end_6.getLine(); - Assert.assertEquals(2, _line_7); - DocumentHighlight _get_18 = input.get(3); - Range _range_15 = _get_18.getRange(); - Position _end_7 = _range_15.getEnd(); - int _character_7 = _end_7.getCharacter(); - Assert.assertEquals(2, _character_7); - DocumentHighlight _get_19 = input.get(3); - DocumentHighlightKind _kind_3 = _get_19.getKind(); - Assert.assertEquals(DocumentHighlightKind.Text, _kind_3); - DocumentHighlight _get_20 = input.get(4); - Range _range_16 = _get_20.getRange(); - Position _start_8 = _range_16.getStart(); - int _line_8 = _start_8.getLine(); - Assert.assertEquals(2, _line_8); - DocumentHighlight _get_21 = input.get(4); - Range _range_17 = _get_21.getRange(); - Position _start_9 = _range_17.getStart(); - int _character_8 = _start_9.getCharacter(); - Assert.assertEquals(2, _character_8); - DocumentHighlight _get_22 = input.get(4); - Range _range_18 = _get_22.getRange(); - Position _end_8 = _range_18.getEnd(); - int _line_9 = _end_8.getLine(); - Assert.assertEquals(2, _line_9); - DocumentHighlight _get_23 = input.get(4); - Range _range_19 = _get_23.getRange(); - Position _end_9 = _range_19.getEnd(); - int _character_9 = _end_9.getCharacter(); - Assert.assertEquals(2, _character_9); - DocumentHighlight _get_24 = input.get(4); - DocumentHighlightKind _kind_4 = _get_24.getKind(); - Assert.assertEquals(DocumentHighlightKind.Read, _kind_4); - DocumentHighlight _get_25 = input.get(5); - Range _range_20 = _get_25.getRange(); - Position _start_10 = _range_20.getStart(); - int _line_10 = _start_10.getLine(); - Assert.assertEquals(2, _line_10); - DocumentHighlight _get_26 = input.get(5); - Range _range_21 = _get_26.getRange(); - Position _start_11 = _range_21.getStart(); - int _character_10 = _start_11.getCharacter(); - Assert.assertEquals(2, _character_10); - DocumentHighlight _get_27 = input.get(5); - Range _range_22 = _get_27.getRange(); - Position _end_10 = _range_22.getEnd(); - int _line_11 = _end_10.getLine(); - Assert.assertEquals(2, _line_11); - DocumentHighlight _get_28 = input.get(5); - Range _range_23 = _get_28.getRange(); - Position _end_11 = _range_23.getEnd(); - int _character_11 = _end_11.getCharacter(); - Assert.assertEquals(2, _character_11); - DocumentHighlight _get_29 = input.get(5); - DocumentHighlightKind _kind_5 = _get_29.getKind(); - Assert.assertEquals(DocumentHighlightKind.Write, _kind_5); + final List input = this.sort(CollectionLiterals.newArrayList(this.newHighlight(DocumentHighlightKind.Text, this.newRange(2, 2, 2, 2)), this.newHighlight(DocumentHighlightKind.Text, this.newRange(1, 1, 1, 1)), + this.newHighlight(DocumentHighlightKind.Write, this.newRange(2, 2, 2, 2)), this.newHighlight(DocumentHighlightKind.Write, this.newRange(1, 1, 1, 1)), + this.newHighlight(DocumentHighlightKind.Read, this.newRange(2, 2, 2, 2)), this.newHighlight(DocumentHighlightKind.Read, this.newRange(1, 1, 1, 1)))); + Assert.assertEquals(1, input.get(0).getRange().getStart().getLine()); + Assert.assertEquals(1, input.get(0).getRange().getStart().getCharacter()); + Assert.assertEquals(1, input.get(0).getRange().getEnd().getLine()); + Assert.assertEquals(1, input.get(0).getRange().getEnd().getCharacter()); + Assert.assertEquals(DocumentHighlightKind.Text, input.get(0).getKind()); + Assert.assertEquals(1, input.get(1).getRange().getStart().getLine()); + Assert.assertEquals(1, input.get(1).getRange().getStart().getCharacter()); + Assert.assertEquals(1, input.get(1).getRange().getEnd().getLine()); + Assert.assertEquals(1, input.get(1).getRange().getEnd().getCharacter()); + Assert.assertEquals(DocumentHighlightKind.Read, input.get(1).getKind()); + Assert.assertEquals(1, input.get(2).getRange().getStart().getLine()); + Assert.assertEquals(1, input.get(2).getRange().getStart().getCharacter()); + Assert.assertEquals(1, input.get(2).getRange().getEnd().getLine()); + Assert.assertEquals(1, input.get(2).getRange().getEnd().getCharacter()); + Assert.assertEquals(DocumentHighlightKind.Write, input.get(2).getKind()); + Assert.assertEquals(2, input.get(3).getRange().getStart().getLine()); + Assert.assertEquals(2, input.get(3).getRange().getStart().getCharacter()); + Assert.assertEquals(2, input.get(3).getRange().getEnd().getLine()); + Assert.assertEquals(2, input.get(3).getRange().getEnd().getCharacter()); + Assert.assertEquals(DocumentHighlightKind.Text, input.get(3).getKind()); + Assert.assertEquals(2, input.get(4).getRange().getStart().getLine()); + Assert.assertEquals(2, input.get(4).getRange().getStart().getCharacter()); + Assert.assertEquals(2, input.get(4).getRange().getEnd().getLine()); + Assert.assertEquals(2, input.get(4).getRange().getEnd().getCharacter()); + Assert.assertEquals(DocumentHighlightKind.Read, input.get(4).getKind()); + Assert.assertEquals(2, input.get(5).getRange().getStart().getLine()); + Assert.assertEquals(2, input.get(5).getRange().getStart().getCharacter()); + Assert.assertEquals(2, input.get(5).getRange().getEnd().getLine()); + Assert.assertEquals(2, input.get(5).getRange().getEnd().getCharacter()); + Assert.assertEquals(DocumentHighlightKind.Write, input.get(5).getKind()); } @Test public void withNull() { - Range _newRange = this.newRange(1, 1, 1, 1); - DocumentHighlight _newHighlight = this.newHighlight(DocumentHighlightKind.Text, _newRange); - Range _newRange_1 = this.newRange(1, 1, 1, 1); - DocumentHighlight _newHighlight_1 = this.newHighlight(DocumentHighlightKind.Write, _newRange_1); - Range _newRange_2 = this.newRange(1, 1, 1, 1); - DocumentHighlight _newHighlight_2 = this.newHighlight(DocumentHighlightKind.Read, _newRange_2); - ArrayList _newArrayList = CollectionLiterals.newArrayList(null, _newHighlight, _newHighlight_1, _newHighlight_2); - final List input = this.sort(_newArrayList); - DocumentHighlight _get = input.get(0); - Range _range = _get.getRange(); - Position _start = _range.getStart(); - int _line = _start.getLine(); - Assert.assertEquals(1, _line); - DocumentHighlight _get_1 = input.get(0); - Range _range_1 = _get_1.getRange(); - Position _start_1 = _range_1.getStart(); - int _character = _start_1.getCharacter(); - Assert.assertEquals(1, _character); - DocumentHighlight _get_2 = input.get(0); - Range _range_2 = _get_2.getRange(); - Position _end = _range_2.getEnd(); - int _line_1 = _end.getLine(); - Assert.assertEquals(1, _line_1); - DocumentHighlight _get_3 = input.get(0); - Range _range_3 = _get_3.getRange(); - Position _end_1 = _range_3.getEnd(); - int _character_1 = _end_1.getCharacter(); - Assert.assertEquals(1, _character_1); - DocumentHighlight _get_4 = input.get(0); - DocumentHighlightKind _kind = _get_4.getKind(); - Assert.assertEquals(DocumentHighlightKind.Text, _kind); - DocumentHighlight _get_5 = input.get(1); - Range _range_4 = _get_5.getRange(); - Position _start_2 = _range_4.getStart(); - int _line_2 = _start_2.getLine(); - Assert.assertEquals(1, _line_2); - DocumentHighlight _get_6 = input.get(1); - Range _range_5 = _get_6.getRange(); - Position _start_3 = _range_5.getStart(); - int _character_2 = _start_3.getCharacter(); - Assert.assertEquals(1, _character_2); - DocumentHighlight _get_7 = input.get(1); - Range _range_6 = _get_7.getRange(); - Position _end_2 = _range_6.getEnd(); - int _line_3 = _end_2.getLine(); - Assert.assertEquals(1, _line_3); - DocumentHighlight _get_8 = input.get(1); - Range _range_7 = _get_8.getRange(); - Position _end_3 = _range_7.getEnd(); - int _character_3 = _end_3.getCharacter(); - Assert.assertEquals(1, _character_3); - DocumentHighlight _get_9 = input.get(1); - DocumentHighlightKind _kind_1 = _get_9.getKind(); - Assert.assertEquals(DocumentHighlightKind.Read, _kind_1); - DocumentHighlight _get_10 = input.get(2); - Range _range_8 = _get_10.getRange(); - Position _start_4 = _range_8.getStart(); - int _line_4 = _start_4.getLine(); - Assert.assertEquals(1, _line_4); - DocumentHighlight _get_11 = input.get(2); - Range _range_9 = _get_11.getRange(); - Position _start_5 = _range_9.getStart(); - int _character_4 = _start_5.getCharacter(); - Assert.assertEquals(1, _character_4); - DocumentHighlight _get_12 = input.get(2); - Range _range_10 = _get_12.getRange(); - Position _end_4 = _range_10.getEnd(); - int _line_5 = _end_4.getLine(); - Assert.assertEquals(1, _line_5); - DocumentHighlight _get_13 = input.get(2); - Range _range_11 = _get_13.getRange(); - Position _end_5 = _range_11.getEnd(); - int _character_5 = _end_5.getCharacter(); - Assert.assertEquals(1, _character_5); - DocumentHighlight _get_14 = input.get(2); - DocumentHighlightKind _kind_2 = _get_14.getKind(); - Assert.assertEquals(DocumentHighlightKind.Write, _kind_2); - DocumentHighlight _last = IterableExtensions.last(input); - Assert.assertNull(_last); + final List input = this.sort(CollectionLiterals.newArrayList(null, this.newHighlight(DocumentHighlightKind.Text, this.newRange(1, 1, 1, 1)), + this.newHighlight(DocumentHighlightKind.Write, this.newRange(1, 1, 1, 1)), this.newHighlight(DocumentHighlightKind.Read, this.newRange(1, 1, 1, 1)))); + Assert.assertEquals(1, input.get(0).getRange().getStart().getLine()); + Assert.assertEquals(1, input.get(0).getRange().getStart().getCharacter()); + Assert.assertEquals(1, input.get(0).getRange().getEnd().getLine()); + Assert.assertEquals(1, input.get(0).getRange().getEnd().getCharacter()); + Assert.assertEquals(DocumentHighlightKind.Text, input.get(0).getKind()); + Assert.assertEquals(1, input.get(1).getRange().getStart().getLine()); + Assert.assertEquals(1, input.get(1).getRange().getStart().getCharacter()); + Assert.assertEquals(1, input.get(1).getRange().getEnd().getLine()); + Assert.assertEquals(1, input.get(1).getRange().getEnd().getCharacter()); + Assert.assertEquals(DocumentHighlightKind.Read, input.get(1).getKind()); + Assert.assertEquals(1, input.get(2).getRange().getStart().getLine()); + Assert.assertEquals(1, input.get(2).getRange().getStart().getCharacter()); + Assert.assertEquals(1, input.get(2).getRange().getEnd().getLine()); + Assert.assertEquals(1, input.get(2).getRange().getEnd().getCharacter()); + Assert.assertEquals(DocumentHighlightKind.Write, input.get(2).getKind()); + Assert.assertNull(IterableExtensions.last(input)); } private DocumentHighlight newHighlight(final DocumentHighlightKind kind, final Range range) { diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/PositionComparatorTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/PositionComparatorTest.java index 66fdb5252..4aaa14f18 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/PositionComparatorTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/PositionComparatorTest.java @@ -7,7 +7,6 @@ */ package org.eclipse.xtext.ide.tests.util; -import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import org.eclipse.lsp4j.Position; @@ -39,54 +38,27 @@ public class PositionComparatorTest extends Assert { Position _position_1 = new Position(2, 1); Position _position_2 = new Position(1, 2); Position _position_3 = new Position(1, 1); - ArrayList _newArrayList = CollectionLiterals.newArrayList(_position, _position_1, _position_2, _position_3); - final List input = this.sort(_newArrayList); - Position _get = input.get(0); - int _line = _get.getLine(); - Assert.assertEquals(1, _line); - Position _get_1 = input.get(0); - int _character = _get_1.getCharacter(); - Assert.assertEquals(1, _character); - Position _get_2 = input.get(1); - int _line_1 = _get_2.getLine(); - Assert.assertEquals(1, _line_1); - Position _get_3 = input.get(1); - int _character_1 = _get_3.getCharacter(); - Assert.assertEquals(2, _character_1); - Position _get_4 = input.get(2); - int _line_2 = _get_4.getLine(); - Assert.assertEquals(2, _line_2); - Position _get_5 = input.get(2); - int _character_2 = _get_5.getCharacter(); - Assert.assertEquals(1, _character_2); - Position _get_6 = input.get(3); - int _line_3 = _get_6.getLine(); - Assert.assertEquals(2, _line_3); - Position _get_7 = input.get(3); - int _character_3 = _get_7.getCharacter(); - Assert.assertEquals(2, _character_3); + final List input = this.sort(CollectionLiterals.newArrayList(_position, _position_1, _position_2, _position_3)); + Assert.assertEquals(1, input.get(0).getLine()); + Assert.assertEquals(1, input.get(0).getCharacter()); + Assert.assertEquals(1, input.get(1).getLine()); + Assert.assertEquals(2, input.get(1).getCharacter()); + Assert.assertEquals(2, input.get(2).getLine()); + Assert.assertEquals(1, input.get(2).getCharacter()); + Assert.assertEquals(2, input.get(3).getLine()); + Assert.assertEquals(2, input.get(3).getCharacter()); } @Test public void withNull() { Position _position = new Position(2, 2); Position _position_1 = new Position(1, 1); - ArrayList _newArrayList = CollectionLiterals.newArrayList(_position, null, _position_1); - final List input = this.sort(_newArrayList); - Position _get = input.get(0); - int _line = _get.getLine(); - Assert.assertEquals(1, _line); - Position _get_1 = input.get(0); - int _character = _get_1.getCharacter(); - Assert.assertEquals(1, _character); - Position _get_2 = input.get(1); - int _line_1 = _get_2.getLine(); - Assert.assertEquals(2, _line_1); - Position _get_3 = input.get(1); - int _character_1 = _get_3.getCharacter(); - Assert.assertEquals(2, _character_1); - Position _last = IterableExtensions.last(input); - Assert.assertNull(_last); + final List input = this.sort(CollectionLiterals.newArrayList(_position, null, _position_1)); + Assert.assertEquals(1, input.get(0).getLine()); + Assert.assertEquals(1, input.get(0).getCharacter()); + Assert.assertEquals(2, input.get(1).getLine()); + Assert.assertEquals(2, input.get(1).getCharacter()); + Assert.assertNull(IterableExtensions.last(input)); } private List sort(final List toSort) { diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/RangeComparatorTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/RangeComparatorTest.java index 056963f30..70f770a75 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/RangeComparatorTest.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/util/RangeComparatorTest.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.ide.tests.util; import com.google.inject.Inject; -import java.util.ArrayList; import java.util.List; import org.eclipse.lsp4j.Position; import org.eclipse.lsp4j.Range; @@ -36,135 +35,42 @@ public class RangeComparatorTest extends Assert { @Test public void withoutNull() { - Range _newRange = this.newRange(1, 2, 1, 2); - Range _newRange_1 = this.newRange(1, 1, 2, 1); - Range _newRange_2 = this.newRange(1, 1, 1, 2); - Range _newRange_3 = this.newRange(1, 1, 1, 1); - Range _newRange_4 = this.newRange(2, 2, 2, 3); - ArrayList _newArrayList = CollectionLiterals.newArrayList(_newRange, _newRange_1, _newRange_2, _newRange_3, _newRange_4); - final List input = this.sort(_newArrayList); - Range _get = input.get(0); - Position _start = _get.getStart(); - int _line = _start.getLine(); - Assert.assertEquals(1, _line); - Range _get_1 = input.get(0); - Position _start_1 = _get_1.getStart(); - int _character = _start_1.getCharacter(); - Assert.assertEquals(1, _character); - Range _get_2 = input.get(0); - Position _end = _get_2.getEnd(); - int _line_1 = _end.getLine(); - Assert.assertEquals(1, _line_1); - Range _get_3 = input.get(0); - Position _end_1 = _get_3.getEnd(); - int _character_1 = _end_1.getCharacter(); - Assert.assertEquals(1, _character_1); - Range _get_4 = input.get(1); - Position _start_2 = _get_4.getStart(); - int _line_2 = _start_2.getLine(); - Assert.assertEquals(1, _line_2); - Range _get_5 = input.get(1); - Position _start_3 = _get_5.getStart(); - int _character_2 = _start_3.getCharacter(); - Assert.assertEquals(1, _character_2); - Range _get_6 = input.get(1); - Position _end_2 = _get_6.getEnd(); - int _line_3 = _end_2.getLine(); - Assert.assertEquals(1, _line_3); - Range _get_7 = input.get(1); - Position _end_3 = _get_7.getEnd(); - int _character_3 = _end_3.getCharacter(); - Assert.assertEquals(2, _character_3); - Range _get_8 = input.get(2); - Position _start_4 = _get_8.getStart(); - int _line_4 = _start_4.getLine(); - Assert.assertEquals(1, _line_4); - Range _get_9 = input.get(2); - Position _start_5 = _get_9.getStart(); - int _character_4 = _start_5.getCharacter(); - Assert.assertEquals(1, _character_4); - Range _get_10 = input.get(2); - Position _end_4 = _get_10.getEnd(); - int _line_5 = _end_4.getLine(); - Assert.assertEquals(2, _line_5); - Range _get_11 = input.get(2); - Position _end_5 = _get_11.getEnd(); - int _character_5 = _end_5.getCharacter(); - Assert.assertEquals(1, _character_5); - Range _get_12 = input.get(3); - Position _start_6 = _get_12.getStart(); - int _line_6 = _start_6.getLine(); - Assert.assertEquals(1, _line_6); - Range _get_13 = input.get(3); - Position _start_7 = _get_13.getStart(); - int _character_6 = _start_7.getCharacter(); - Assert.assertEquals(2, _character_6); - Range _get_14 = input.get(3); - Position _end_6 = _get_14.getEnd(); - int _line_7 = _end_6.getLine(); - Assert.assertEquals(1, _line_7); - Range _get_15 = input.get(3); - Position _end_7 = _get_15.getEnd(); - int _character_7 = _end_7.getCharacter(); - Assert.assertEquals(2, _character_7); - Range _get_16 = input.get(4); - Position _start_8 = _get_16.getStart(); - int _line_8 = _start_8.getLine(); - Assert.assertEquals(2, _line_8); - Range _get_17 = input.get(4); - Position _start_9 = _get_17.getStart(); - int _character_8 = _start_9.getCharacter(); - Assert.assertEquals(2, _character_8); - Range _get_18 = input.get(4); - Position _end_8 = _get_18.getEnd(); - int _line_9 = _end_8.getLine(); - Assert.assertEquals(2, _line_9); - Range _get_19 = input.get(4); - Position _end_9 = _get_19.getEnd(); - int _character_9 = _end_9.getCharacter(); - Assert.assertEquals(3, _character_9); + final List input = this.sort(CollectionLiterals.newArrayList(this.newRange(1, 2, 1, 2), this.newRange(1, 1, 2, 1), this.newRange(1, 1, 1, 2), this.newRange(1, 1, 1, 1), + this.newRange(2, 2, 2, 3))); + Assert.assertEquals(1, input.get(0).getStart().getLine()); + Assert.assertEquals(1, input.get(0).getStart().getCharacter()); + Assert.assertEquals(1, input.get(0).getEnd().getLine()); + Assert.assertEquals(1, input.get(0).getEnd().getCharacter()); + Assert.assertEquals(1, input.get(1).getStart().getLine()); + Assert.assertEquals(1, input.get(1).getStart().getCharacter()); + Assert.assertEquals(1, input.get(1).getEnd().getLine()); + Assert.assertEquals(2, input.get(1).getEnd().getCharacter()); + Assert.assertEquals(1, input.get(2).getStart().getLine()); + Assert.assertEquals(1, input.get(2).getStart().getCharacter()); + Assert.assertEquals(2, input.get(2).getEnd().getLine()); + Assert.assertEquals(1, input.get(2).getEnd().getCharacter()); + Assert.assertEquals(1, input.get(3).getStart().getLine()); + Assert.assertEquals(2, input.get(3).getStart().getCharacter()); + Assert.assertEquals(1, input.get(3).getEnd().getLine()); + Assert.assertEquals(2, input.get(3).getEnd().getCharacter()); + Assert.assertEquals(2, input.get(4).getStart().getLine()); + Assert.assertEquals(2, input.get(4).getStart().getCharacter()); + Assert.assertEquals(2, input.get(4).getEnd().getLine()); + Assert.assertEquals(3, input.get(4).getEnd().getCharacter()); } @Test public void withNull() { - Range _newRange = this.newRange(2, 2, 2, 3); - Range _newRange_1 = this.newRange(1, 1, 1, 1); - ArrayList _newArrayList = CollectionLiterals.newArrayList(_newRange, null, _newRange_1); - final List input = this.sort(_newArrayList); - Range _get = input.get(0); - Position _start = _get.getStart(); - int _line = _start.getLine(); - Assert.assertEquals(1, _line); - Range _get_1 = input.get(0); - Position _start_1 = _get_1.getStart(); - int _character = _start_1.getCharacter(); - Assert.assertEquals(1, _character); - Range _get_2 = input.get(0); - Position _end = _get_2.getEnd(); - int _line_1 = _end.getLine(); - Assert.assertEquals(1, _line_1); - Range _get_3 = input.get(0); - Position _end_1 = _get_3.getEnd(); - int _character_1 = _end_1.getCharacter(); - Assert.assertEquals(1, _character_1); - Range _get_4 = input.get(1); - Position _start_2 = _get_4.getStart(); - int _line_2 = _start_2.getLine(); - Assert.assertEquals(2, _line_2); - Range _get_5 = input.get(1); - Position _start_3 = _get_5.getStart(); - int _character_2 = _start_3.getCharacter(); - Assert.assertEquals(2, _character_2); - Range _get_6 = input.get(1); - Position _end_2 = _get_6.getEnd(); - int _line_3 = _end_2.getLine(); - Assert.assertEquals(2, _line_3); - Range _get_7 = input.get(1); - Position _end_3 = _get_7.getEnd(); - int _character_3 = _end_3.getCharacter(); - Assert.assertEquals(3, _character_3); - Range _last = IterableExtensions.last(input); - Assert.assertNull(_last); + final List input = this.sort(CollectionLiterals.newArrayList(this.newRange(2, 2, 2, 3), null, this.newRange(1, 1, 1, 1))); + Assert.assertEquals(1, input.get(0).getStart().getLine()); + Assert.assertEquals(1, input.get(0).getStart().getCharacter()); + Assert.assertEquals(1, input.get(0).getEnd().getLine()); + Assert.assertEquals(1, input.get(0).getEnd().getCharacter()); + Assert.assertEquals(2, input.get(1).getStart().getLine()); + Assert.assertEquals(2, input.get(1).getStart().getCharacter()); + Assert.assertEquals(2, input.get(1).getEnd().getLine()); + Assert.assertEquals(3, input.get(1).getEnd().getCharacter()); + Assert.assertNull(IterableExtensions.last(input)); } private Range newRange(final int startLine, final int startChar, final int endLine, final int endChar) { diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/DefaultIdeModule.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/DefaultIdeModule.java index 35512b973..0feaffb1f 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/DefaultIdeModule.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/DefaultIdeModule.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.ide; import com.google.inject.Binder; -import com.google.inject.binder.AnnotatedBindingBuilder; import java.util.concurrent.ExecutorService; import org.eclipse.xtext.ide.ExecutorServiceProvider; import org.eclipse.xtext.service.AbstractGenericModule; @@ -19,7 +18,6 @@ import org.eclipse.xtext.service.AbstractGenericModule; @SuppressWarnings("all") public class DefaultIdeModule extends AbstractGenericModule { public void configureExecutorService(final Binder binder) { - AnnotatedBindingBuilder _bind = binder.bind(ExecutorService.class); - _bind.toProvider(ExecutorServiceProvider.class); + binder.bind(ExecutorService.class).toProvider(ExecutorServiceProvider.class); } } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/AbstractIdeTemplateProposalProvider.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/AbstractIdeTemplateProposalProvider.java index 5e3a38ed1..c6ede6719 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/AbstractIdeTemplateProposalProvider.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/AbstractIdeTemplateProposalProvider.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.ide.editor.contentassist; import com.google.inject.Inject; -import java.util.ArrayList; import java.util.List; import org.eclipse.xtend.lib.annotations.Data; import org.eclipse.xtend2.lib.StringConcatenation; @@ -19,7 +18,6 @@ import org.eclipse.xtext.ide.editor.contentassist.IIdeContentProposalAcceptor; import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalCreator; import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalPriorities; import org.eclipse.xtext.nodemodel.ICompositeNode; -import org.eclipse.xtext.util.ITextRegion; import org.eclipse.xtext.util.TextRegion; import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; @@ -115,19 +113,16 @@ public abstract class AbstractIdeTemplateProposalProvider { protected String getStringRepresentation(final Object object) { if ((object instanceof AbstractIdeTemplateProposalProvider.Variable)) { final String varName = ((AbstractIdeTemplateProposalProvider.Variable)object).name; - ITextRegion _replaceRegion = this.context.getReplaceRegion(); - int _offset = _replaceRegion.getOffset(); + int _offset = this.context.getReplaceRegion().getOffset(); int _currentOffset = this.getCurrentOffset(); final int offset = (_offset + _currentOffset); - ArrayList _editPositions = this.entry.getEditPositions(); int _length = varName.length(); TextRegion _textRegion = new TextRegion(offset, _length); - _editPositions.add(_textRegion); + this.entry.getEditPositions().add(_textRegion); return varName; } else { if ((object instanceof AbstractIdeTemplateProposalProvider.Cursor)) { - ITextRegion _replaceRegion_1 = this.context.getReplaceRegion(); - int _offset_1 = _replaceRegion_1.getOffset(); + int _offset_1 = this.context.getReplaceRegion().getOffset(); int _currentOffset_1 = this.getCurrentOffset(); final int offset_1 = (_offset_1 + _currentOffset_1); this.entry.setEscapePosition(Integer.valueOf(offset_1)); @@ -179,15 +174,12 @@ public abstract class AbstractIdeTemplateProposalProvider { if (_canAcceptProposal) { entry.setLabel(name); entry.setDescription(description); - int _defaultPriority = this.proposalPriorities.getDefaultPriority(entry); - acceptor.accept(entry, _defaultPriority); + acceptor.accept(entry, this.proposalPriorities.getDefaultPriority(entry)); } } protected boolean canAcceptProposal(final ContentAssistEntry entry, final ContentAssistContext context) { - String _proposal = entry.getProposal(); - String _prefix = entry.getPrefix(); - return this.proposalCreator.isValidProposal(_proposal, _prefix, context); + return this.proposalCreator.isValidProposal(entry.getProposal(), entry.getPrefix(), context); } protected ContentAssistEntry createProposal(final StringConcatenationClient template, final ContentAssistContext context, final boolean adaptIndentation) { @@ -223,14 +215,12 @@ public abstract class AbstractIdeTemplateProposalProvider { } final String text = _text; if (((text != null) && (text.length() >= context.getOffset()))) { - ITextRegion _replaceRegion = context.getReplaceRegion(); - int lineStart = _replaceRegion.getOffset(); + int lineStart = context.getReplaceRegion().getOffset(); int indentEnd = lineStart; while (((lineStart > 0) && (text.charAt((lineStart - 1)) != "\n".charAt(0)))) { { lineStart--; - char _charAt = text.charAt(lineStart); - boolean _isWhitespace = Character.isWhitespace(_charAt); + boolean _isWhitespace = Character.isWhitespace(text.charAt(lineStart)); boolean _not = (!_isWhitespace); if (_not) { indentEnd = lineStart; diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/FQNPrefixMatcher.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/FQNPrefixMatcher.java index ff47b5bf1..df6684145 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/FQNPrefixMatcher.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/FQNPrefixMatcher.java @@ -60,9 +60,7 @@ public class FQNPrefixMatcher implements IPrefixMatcher { return false; } for (int i = 0; (i < splitPrefix.size()); i++) { - String _get = splitName.get(i); - String _get_1 = splitPrefix.get(i); - boolean _isCandidateMatchingPrefix_1 = this.delegate.isCandidateMatchingPrefix(_get, _get_1); + boolean _isCandidateMatchingPrefix_1 = this.delegate.isCandidateMatchingPrefix(splitName.get(i), splitPrefix.get(i)); boolean _not = (!_isCandidateMatchingPrefix_1); if (_not) { return false; diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.java index 7c62f46c8..7fde23e34 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.java @@ -25,8 +25,7 @@ public interface IPrefixMatcher { public static class IgnoreCase implements IPrefixMatcher { @Override public boolean isCandidateMatchingPrefix(final String name, final String prefix) { - int _length = prefix.length(); - return name.regionMatches(true, 0, prefix, 0, _length); + return name.regionMatches(true, 0, prefix, 0, prefix.length()); } } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalAcceptor.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalAcceptor.java index ab72b9960..43734dd64 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalAcceptor.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalAcceptor.java @@ -45,31 +45,25 @@ public class IdeContentProposalAcceptor implements IIdeContentProposalAcceptor, @Override public int compare(final Pair p1, final Pair p2) { - Integer _key = p2.getKey(); - Integer _key_1 = p1.getKey(); - final int prioResult = _key.compareTo(_key_1); + final int prioResult = p2.getKey().compareTo(p1.getKey()); if ((prioResult != 0)) { return prioResult; } String _elvis = null; - ContentAssistEntry _value = p1.getValue(); - String _label = _value.getLabel(); + String _label = p1.getValue().getLabel(); if (_label != null) { _elvis = _label; } else { - ContentAssistEntry _value_1 = p1.getValue(); - String _proposal = _value_1.getProposal(); + String _proposal = p1.getValue().getProposal(); _elvis = _proposal; } final String s1 = _elvis; String _elvis_1 = null; - ContentAssistEntry _value_2 = p2.getValue(); - String _label_1 = _value_2.getLabel(); + String _label_1 = p2.getValue().getLabel(); if (_label_1 != null) { _elvis_1 = _label_1; } else { - ContentAssistEntry _value_3 = p2.getValue(); - String _proposal_1 = _value_3.getProposal(); + String _proposal_1 = p2.getValue().getProposal(); _elvis_1 = _proposal_1; } final String s2 = _elvis_1; diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalPriorities.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalPriorities.java index 2ba832c98..2e54d4995 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalPriorities.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalPriorities.java @@ -35,17 +35,15 @@ public class IdeContentProposalPriorities { return priority; } int adjustedPriority = priority; - String _proposal = entry.getProposal(); - char _charAt = _proposal.charAt(0); - boolean _isLetter = Character.isLetter(_charAt); + boolean _isLetter = Character.isLetter(entry.getProposal().charAt(0)); boolean _not = (!_isLetter); if (_not) { int _adjustedPriority = adjustedPriority; adjustedPriority = (_adjustedPriority - 30); } - String _proposal_1 = entry.getProposal(); + String _proposal = entry.getProposal(); String _prefix = entry.getPrefix(); - boolean _equals = Objects.equal(_proposal_1, _prefix); + boolean _equals = Objects.equal(_proposal, _prefix); if (_equals) { int _adjustedPriority_1 = adjustedPriority; adjustedPriority = (_adjustedPriority_1 - 20); diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalProvider.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalProvider.java index 4824b1cb0..c8678a531 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalProvider.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalProvider.java @@ -146,8 +146,7 @@ public class IdeContentProposalProvider { it.setDescription(rule.getName()); }; final ContentAssistEntry entry = this.proposalCreator.createProposal(proposal, context, _function); - int _defaultPriority = this.proposalPriorities.getDefaultPriority(entry); - acceptor.accept(entry, _defaultPriority); + acceptor.accept(entry, this.proposalPriorities.getDefaultPriority(entry)); } } } @@ -156,13 +155,10 @@ public class IdeContentProposalProvider { protected void _createProposals(final Keyword keyword, final ContentAssistContext context, final IIdeContentProposalAcceptor acceptor) { boolean _filterKeyword = this.filterKeyword(keyword, context); if (_filterKeyword) { - String _value = keyword.getValue(); - final ContentAssistEntry entry = this.proposalCreator.createProposal(_value, context); + final ContentAssistEntry entry = this.proposalCreator.createProposal(keyword.getValue(), context); if ((entry != null)) { entry.setKind(ContentAssistEntry.KIND_KEYWORD); - String _value_1 = keyword.getValue(); - int _keywordPriority = this.proposalPriorities.getKeywordPriority(_value_1, entry); - acceptor.accept(entry, _keywordPriority); + acceptor.accept(entry, this.proposalPriorities.getKeywordPriority(keyword.getValue(), entry)); } } } @@ -181,8 +177,8 @@ public class IdeContentProposalProvider { final EObject currentModel = context.getCurrentModel(); if (((ereference != null) && (currentModel != null))) { final IScope scope = this.scopeProvider.getScope(currentModel, ereference); - Predicate _crossrefFilter = this.getCrossrefFilter(reference, context); - this.crossrefProposalProvider.lookupCrossReference(scope, reference, context, acceptor, _crossrefFilter); + this.crossrefProposalProvider.lookupCrossReference(scope, reference, context, acceptor, + this.getCrossrefFilter(reference, context)); } } } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeCrossrefProposalProvider.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeCrossrefProposalProvider.java index 6bd23ae80..803236af8 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeCrossrefProposalProvider.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeCrossrefProposalProvider.java @@ -20,7 +20,6 @@ import org.eclipse.xtext.ide.editor.contentassist.IIdeContentProposalAcceptor; import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalCreator; import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalPriorities; import org.eclipse.xtext.naming.IQualifiedNameConverter; -import org.eclipse.xtext.naming.QualifiedName; import org.eclipse.xtext.resource.IEObjectDescription; import org.eclipse.xtext.scoping.IScope; import org.eclipse.xtext.xbase.lib.Exceptions; @@ -59,8 +58,7 @@ public class IdeCrossrefProposalProvider { boolean _apply = filter.apply(candidate); if (_apply) { final ContentAssistEntry entry = this.createProposal(candidate, crossReference, context); - int _crossRefPriority = this.proposalPriorities.getCrossRefPriority(candidate, entry); - acceptor.accept(entry, _crossRefPriority); + acceptor.accept(entry, this.proposalPriorities.getCrossRefPriority(candidate, entry)); } } } @@ -79,18 +77,16 @@ public class IdeCrossrefProposalProvider { } protected ContentAssistEntry createProposal(final IEObjectDescription candidate, final CrossReference crossRef, final ContentAssistContext context) { - QualifiedName _name = candidate.getName(); - String _string = this.qualifiedNameConverter.toString(_name); final Procedure1 _function = (ContentAssistEntry it) -> { it.setSource(candidate); EClass _eClass = candidate.getEClass(); - String _name_1 = null; + String _name = null; if (_eClass!=null) { - _name_1=_eClass.getName(); + _name=_eClass.getName(); } - it.setDescription(_name_1); + it.setDescription(_name); }; - return this.proposalCreator.createProposal(_string, context, _function); + return this.proposalCreator.createProposal(this.qualifiedNameConverter.toString(candidate.getName()), context, _function); } @Pure diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/AbstractHierarchyBuilder.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/AbstractHierarchyBuilder.java index 378756b68..d6bda3824 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/AbstractHierarchyBuilder.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/AbstractHierarchyBuilder.java @@ -59,36 +59,30 @@ public abstract class AbstractHierarchyBuilder implements IHierarchyBuilder { private IResourceServiceProvider.Registry resourceServiceProviderRegistry; protected R readOnly(final URI objectURI, final IUnitOfWork work) { - IReferenceFinder.IResourceAccess _resourceAccess = this.getResourceAccess(); final IUnitOfWork _function = (ResourceSet resourceSet) -> { final EObject targetObject = resourceSet.getEObject(objectURI, true); return work.exec(targetObject); }; - return _resourceAccess.readOnly(objectURI, _function); + return this.getResourceAccess().readOnly(objectURI, _function); } protected IEObjectDescription getDescription(final URI objectURI) { - IResourceDescriptions _indexData = this.getIndexData(); - URI _trimFragment = objectURI.trimFragment(); - final IResourceDescription resourceDescription = _indexData.getResourceDescription(_trimFragment); + final IResourceDescription resourceDescription = this.getIndexData().getResourceDescription(objectURI.trimFragment()); if ((resourceDescription == null)) { return null; } - Iterable _exportedObjects = resourceDescription.getExportedObjects(); final Function1 _function = (IEObjectDescription it) -> { URI _eObjectURI = it.getEObjectURI(); return Boolean.valueOf(Objects.equal(_eObjectURI, objectURI)); }; - return IterableExtensions.findFirst(_exportedObjects, _function); + return IterableExtensions.findFirst(resourceDescription.getExportedObjects(), _function); } protected IEObjectDescription getDescription(final EObject object) { if ((object == null)) { return null; } - IResourceDescriptions _indexData = this.getIndexData(); - Iterable _exportedObjectsByObject = _indexData.getExportedObjectsByObject(object); - return IterableExtensions.head(_exportedObjectsByObject); + return IterableExtensions.head(this.getIndexData().getExportedObjectsByObject(object)); } protected boolean isAssignable(final EClass superType, final EClassifier type) { diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultCallHierarchyBuilder.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultCallHierarchyBuilder.java index bc2250e22..e3596fabd 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultCallHierarchyBuilder.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultCallHierarchyBuilder.java @@ -11,29 +11,24 @@ import java.util.Collection; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; -import javax.inject.Provider; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.xtend.lib.annotations.Accessors; -import org.eclipse.xtext.findReferences.IReferenceFinder; import org.eclipse.xtext.findReferences.ReferenceAcceptor; -import org.eclipse.xtext.findReferences.TargetURICollector; import org.eclipse.xtext.findReferences.TargetURIs; import org.eclipse.xtext.ide.editor.hierarchy.AbstractHierarchyBuilder; import org.eclipse.xtext.ide.editor.hierarchy.DefaultHierarchyNode; import org.eclipse.xtext.ide.editor.hierarchy.DefaultHierarchyNodeReference; import org.eclipse.xtext.ide.editor.hierarchy.ICallHierarchyBuilder; import org.eclipse.xtext.ide.editor.hierarchy.IHierarchyNode; -import org.eclipse.xtext.ide.editor.hierarchy.IHierarchyNodeLocationProvider; import org.eclipse.xtext.ide.editor.hierarchy.IHierarchyNodeReference; import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; import org.eclipse.xtext.resource.IEObjectDescription; import org.eclipse.xtext.resource.IReferenceDescription; -import org.eclipse.xtext.resource.IResourceDescriptions; import org.eclipse.xtext.resource.IResourceServiceProvider; import org.eclipse.xtext.util.IAcceptor; import org.eclipse.xtext.util.ITextRegionWithLineInformation; @@ -105,7 +100,6 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem final IUnitOfWork _function = (EObject sourceDeclaration) -> { Object _xblockexpression = null; { - IReferenceFinder _referenceFinder = this.getReferenceFinder(); IResourceServiceProvider.Registry _resourceServiceProviderRegistry = this.getResourceServiceProviderRegistry(); final IAcceptor _function_1 = (IReferenceDescription reference) -> { boolean _filterReference = this.filterReference(reference); @@ -119,7 +113,7 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem } }; ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(_resourceServiceProviderRegistry, _function_1); - _referenceFinder.findAllReferences(sourceDeclaration, _referenceAcceptor, monitor); + this.getReferenceFinder().findAllReferences(sourceDeclaration, _referenceAcceptor, monitor); _xblockexpression = null; } return _xblockexpression; @@ -129,9 +123,6 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem protected void findSourceDeclarations(final URI targetDeclarationURI, final IProgressMonitor monitor, final Procedure2 acceptor) { final TargetURIs targetURIs = this.collectTargetURIs(targetDeclarationURI); - IReferenceFinder _referenceFinder = this.getReferenceFinder(); - IReferenceFinder.IResourceAccess _resourceAccess = this.getResourceAccess(); - IResourceDescriptions _indexData = this.getIndexData(); IResourceServiceProvider.Registry _resourceServiceProviderRegistry = this.getResourceServiceProviderRegistry(); final IAcceptor _function = (IReferenceDescription reference) -> { boolean _filterReference = this.filterReference(reference); @@ -145,12 +136,13 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem } }; ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(_resourceServiceProviderRegistry, _function); - _referenceFinder.findAllReferences(targetURIs, _resourceAccess, _indexData, _referenceAcceptor, monitor); + this.getReferenceFinder().findAllReferences(targetURIs, + this.getResourceAccess(), + this.getIndexData(), _referenceAcceptor, monitor); } protected TargetURIs collectTargetURIs(final URI targetURI) { - Provider _targetURIProvider = this.getTargetURIProvider(); - final TargetURIs targetURIs = _targetURIProvider.get(); + final TargetURIs targetURIs = this.getTargetURIProvider().get(); if ((targetURI == null)) { return targetURIs; } @@ -158,8 +150,7 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem if ((targetObject == null)) { return targetURIs; } - TargetURICollector _targetURICollector = this.getTargetURICollector(); - _targetURICollector.add(targetObject, targetURIs); + this.getTargetURICollector().add(targetObject, targetURIs); return targetURIs; }; return this.readOnly(targetURI, _function); @@ -174,13 +165,11 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem } protected IEObjectDescription findTargetDeclaration(final IReferenceDescription reference) { - URI _targetEObjectUri = reference.getTargetEObjectUri(); - return this.findDeclaration(_targetEObjectUri); + return this.findDeclaration(reference.getTargetEObjectUri()); } protected IEObjectDescription findSourceDeclaration(final IReferenceDescription reference) { - URI _containerEObjectURI = reference.getContainerEObjectURI(); - return this.findDeclaration(_containerEObjectURI); + return this.findDeclaration(reference.getContainerEObjectURI()); } /** @@ -210,12 +199,10 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem if ((declaration == null)) { return null; } - URI _eObjectURI = declaration.getEObjectURI(); - IHierarchyNode childNode = children.get(_eObjectURI); + IHierarchyNode childNode = children.get(declaration.getEObjectURI()); if ((childNode == null)) { childNode = this.createChild(declaration, parent); - URI _eObjectURI_1 = declaration.getEObjectURI(); - children.put(_eObjectURI_1, childNode); + children.put(declaration.getEObjectURI(), childNode); } return childNode; } @@ -224,11 +211,8 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem * @return a hierarchy node reference for the given reference; cannot be null */ protected IHierarchyNodeReference createNodeReference(final IReferenceDescription reference) { - URI _sourceEObjectUri = reference.getSourceEObjectUri(); final IUnitOfWork _function = (EObject sourceObject) -> { - EReference _eReference = reference.getEReference(); - int _indexInList = reference.getIndexInList(); - final ITextRegionWithLineInformation textRegion = this.getTextRegion(sourceObject, _eReference, _indexInList); + final ITextRegionWithLineInformation textRegion = this.getTextRegion(sourceObject, reference.getEReference(), reference.getIndexInList()); final String text = this.getText(sourceObject, textRegion); return new DefaultHierarchyNodeReference(text, textRegion, reference); }; @@ -236,26 +220,21 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem } protected ITextRegionWithLineInformation getTextRegion(final EObject obj, final EReference reference, final int indexInList) { - IHierarchyNodeLocationProvider _hierarchyNodeLocationProvider = this.getHierarchyNodeLocationProvider(); - return _hierarchyNodeLocationProvider.getTextRegion(obj, reference, indexInList); + return this.getHierarchyNodeLocationProvider().getTextRegion(obj, reference, indexInList); } protected String getText(final EObject obj, final ITextRegionWithLineInformation textRegion) { if (((obj == null) || (textRegion == ITextRegionWithLineInformation.EMPTY_REGION))) { return ""; } - EObject _rootContainer = EcoreUtil.getRootContainer(obj); - final ICompositeNode node = NodeModelUtils.getNode(_rootContainer); + final ICompositeNode node = NodeModelUtils.getNode(EcoreUtil.getRootContainer(obj)); if ((node == null)) { return ""; } int _offset = textRegion.getOffset(); int _length = textRegion.getLength(); final int endOffset = (_offset + _length); - ICompositeNode _rootNode = node.getRootNode(); - String _text = _rootNode.getText(); - int _offset_1 = textRegion.getOffset(); - return _text.substring(_offset_1, endOffset); + return node.getRootNode().getText().substring(textRegion.getOffset(), endOffset); } @Pure diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultHierarchyNode.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultHierarchyNode.java index 57ea53c8e..af453a76f 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultHierarchyNode.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultHierarchyNode.java @@ -64,8 +64,7 @@ public class DefaultHierarchyNode implements IHierarchyNode { IHierarchyNode node = this.parent; while ((node != null)) { { - IEObjectDescription _element = node.getElement(); - URI _eObjectURI = _element.getEObjectURI(); + URI _eObjectURI = node.getElement().getEObjectURI(); URI _eObjectURI_1 = this.element.getEObjectURI(); boolean _equals = Objects.equal(_eObjectURI, _eObjectURI_1); if (_equals) { diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultHierarchyNodeLocationProvider.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultHierarchyNodeLocationProvider.java index 9e0eb6b7e..53886f8e6 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultHierarchyNodeLocationProvider.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/DefaultHierarchyNodeLocationProvider.java @@ -17,7 +17,6 @@ import org.eclipse.xtext.nodemodel.util.NodeModelUtils; import org.eclipse.xtext.resource.ILocationInFileProvider; import org.eclipse.xtext.util.ITextRegion; import org.eclipse.xtext.util.ITextRegionWithLineInformation; -import org.eclipse.xtext.util.LineAndColumn; import org.eclipse.xtext.util.TextRegionWithLineInformation; /** @@ -61,18 +60,15 @@ public class DefaultHierarchyNodeLocationProvider implements IHierarchyNodeLocat int _length = textRegion.getLength(); return new TextRegionWithLineInformation(_offset, _length, 0, 0); } - int _offset_1 = textRegion.getOffset(); - LineAndColumn _lineAndColumn = NodeModelUtils.getLineAndColumn(node, _offset_1); - int _line = _lineAndColumn.getLine(); + int _line = NodeModelUtils.getLineAndColumn(node, textRegion.getOffset()).getLine(); final int startLine = (_line - 1); - int _offset_2 = textRegion.getOffset(); + int _offset_1 = textRegion.getOffset(); int _length_1 = textRegion.getLength(); - int _plus = (_offset_2 + _length_1); - LineAndColumn _lineAndColumn_1 = NodeModelUtils.getLineAndColumn(node, _plus); - int _line_1 = _lineAndColumn_1.getLine(); + int _plus = (_offset_1 + _length_1); + int _line_1 = NodeModelUtils.getLineAndColumn(node, _plus).getLine(); final int endLine = (_line_1 - 1); - int _offset_3 = textRegion.getOffset(); + int _offset_2 = textRegion.getOffset(); int _length_2 = textRegion.getLength(); - return new TextRegionWithLineInformation(_offset_3, _length_2, startLine, endLine); + return new TextRegionWithLineInformation(_offset_2, _length_2, startLine, endLine); } } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.java index d41c1eae2..5a066bbda 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.java @@ -39,8 +39,7 @@ public abstract class TokenTypeToStringMapper { if (_greaterEqualsThan) { Integer _key_1 = entry.getKey(); int _minus = ((_key_1).intValue() - Token.MIN_TOKEN_TYPE); - String _calculateId = this.calculateId(entry.getValue(), (entry.getKey()).intValue()); - this.mappedValues[_minus] = _calculateId; + this.mappedValues[_minus] = this.calculateId(entry.getValue(), (entry.getKey()).intValue()); } } } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/syntaxcoloring/DefaultAntlrTokenToAttributeIdMapper.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/syntaxcoloring/DefaultAntlrTokenToAttributeIdMapper.java index 2d2d4e1a6..3df111ff5 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/syntaxcoloring/DefaultAntlrTokenToAttributeIdMapper.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/syntaxcoloring/DefaultAntlrTokenToAttributeIdMapper.java @@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.editor.syntaxcoloring; import com.google.common.base.Objects; import com.google.inject.Singleton; -import java.util.regex.Matcher; import java.util.regex.Pattern; import org.eclipse.xtext.ide.editor.syntaxcoloring.AbstractAntlrTokenToAttributeIdMapper; import org.eclipse.xtext.ide.editor.syntaxcoloring.HighlightingStyles; @@ -29,15 +28,13 @@ public class DefaultAntlrTokenToAttributeIdMapper extends AbstractAntlrTokenToAt protected String calculateId(final String tokenName, final int tokenType) { String _switchResult = null; boolean _matched = false; - Matcher _matcher = DefaultAntlrTokenToAttributeIdMapper.PUNCTUATION.matcher(tokenName); - boolean _matches = _matcher.matches(); + boolean _matches = DefaultAntlrTokenToAttributeIdMapper.PUNCTUATION.matcher(tokenName).matches(); if (_matches) { _matched=true; _switchResult = HighlightingStyles.PUNCTUATION_ID; } if (!_matched) { - Matcher _matcher_1 = DefaultAntlrTokenToAttributeIdMapper.QUOTED.matcher(tokenName); - boolean _matches_1 = _matcher_1.matches(); + boolean _matches_1 = DefaultAntlrTokenToAttributeIdMapper.QUOTED.matcher(tokenName).matches(); if (_matches_1) { _matched=true; _switchResult = HighlightingStyles.KEYWORD_ID; diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/syntaxcoloring/IEditorHighlightingConfigurationProvider.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/syntaxcoloring/IEditorHighlightingConfigurationProvider.java index de2d3966f..2a3f11aa3 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/syntaxcoloring/IEditorHighlightingConfigurationProvider.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/syntaxcoloring/IEditorHighlightingConfigurationProvider.java @@ -10,10 +10,7 @@ package org.eclipse.xtext.ide.editor.syntaxcoloring; import com.google.common.base.Objects; import com.google.inject.ImplementedBy; import com.google.inject.Inject; -import java.util.List; -import java.util.Set; import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.IGrammarAccess; import org.eclipse.xtext.Keyword; @@ -50,8 +47,7 @@ public interface IEditorHighlightingConfigurationProvider { _builder.newLine(); _builder.append(" "); _builder.append("match: \"\\\\b(?:"); - Iterable _keywords = this.getKeywords(); - String _join = IterableExtensions.join(_keywords, "|"); + String _join = IterableExtensions.join(this.getKeywords(), "|"); _builder.append(_join, " "); _builder.append(")\\\\b\", "); _builder.newLineIfNotEmpty(); @@ -107,20 +103,13 @@ public interface IEditorHighlightingConfigurationProvider { } public Iterable getKeywords() { - Grammar _grammar = this.grammarAccess.getGrammar(); - List _containedKeywords = GrammarUtil.containedKeywords(_grammar); final Function1 _function = (Keyword it) -> { - String _value = it.getValue(); - char _charAt = _value.charAt(0); - return Boolean.valueOf(Character.isLetter(_charAt)); + return Boolean.valueOf(Character.isLetter(it.getValue().charAt(0))); }; - Iterable _filter = IterableExtensions.filter(_containedKeywords, _function); final Function1 _function_1 = (Keyword it) -> { return it.getValue(); }; - Iterable _map = IterableExtensions.map(_filter, _function_1); - Set _set = IterableExtensions.toSet(_map); - return IterableExtensions.sort(_set); + return IterableExtensions.sort(IterableExtensions.toSet(IterableExtensions.map(IterableExtensions.filter(GrammarUtil.containedKeywords(this.grammarAccess.getGrammar()), _function), _function_1))); } } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/labels/EClassImageDescriptionProvider.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/labels/EClassImageDescriptionProvider.java index 81568fe4e..08e3c8a33 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/labels/EClassImageDescriptionProvider.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/labels/EClassImageDescriptionProvider.java @@ -10,7 +10,6 @@ package org.eclipse.xtext.ide.labels; import com.google.common.collect.Iterables; import java.util.Collections; import java.util.List; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.ide.labels.AlternativeImageDescription; @@ -30,11 +29,10 @@ public class EClassImageDescriptionProvider implements IImageDescriptionProvider if (element instanceof EClass) { _matched=true; String _name = ((EClass)element).getName(); - EList _eAllSuperTypes = ((EClass)element).getEAllSuperTypes(); final Function1 _function = (EClass it) -> { return it.getName(); }; - List _map = ListExtensions.map(_eAllSuperTypes, _function); + List _map = ListExtensions.map(((EClass)element).getEAllSuperTypes(), _function); Iterable _plus = Iterables.concat(Collections.unmodifiableList(CollectionLiterals.newArrayList(_name)), _map); String _imageID = IImageDescription.DEFAULT.getImageID(); Iterable _plus_1 = Iterables.concat(_plus, Collections.unmodifiableList(CollectionLiterals.newArrayList(_imageID))); @@ -43,15 +41,13 @@ public class EClassImageDescriptionProvider implements IImageDescriptionProvider if (!_matched) { if (element instanceof EObject) { _matched=true; - EClass _eClass = ((EObject)element).eClass(); - _switchResult = this.getImageDescription(_eClass); + _switchResult = this.getImageDescription(((EObject)element).eClass()); } } if (!_matched) { if (element instanceof IEObjectDescription) { _matched=true; - EClass _eClass = ((IEObjectDescription)element).getEClass(); - _switchResult = this.getImageDescription(_eClass); + _switchResult = this.getImageDescription(((IEObjectDescription)element).getEClass()); } } if (!_matched) { diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/labels/SimpleNameLabelProvider.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/labels/SimpleNameLabelProvider.java index ea3637fdf..a0ffd220d 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/labels/SimpleNameLabelProvider.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/labels/SimpleNameLabelProvider.java @@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.labels; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.ide.labels.INameLabelProvider; -import org.eclipse.xtext.naming.QualifiedName; import org.eclipse.xtext.resource.IEObjectDescription; import org.eclipse.xtext.util.SimpleAttributeResolver; @@ -26,8 +25,7 @@ public class SimpleNameLabelProvider implements INameLabelProvider { if (!_matched) { if (element instanceof IEObjectDescription) { _matched=true; - QualifiedName _name = ((IEObjectDescription)element).getName(); - _switchResult = _name.getLastSegment(); + _switchResult = ((IEObjectDescription)element).getName().getLastSegment(); } } if (!_matched) { diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/BuildManager.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/BuildManager.java index 60cc7f04b..51d301eb6 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/BuildManager.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/BuildManager.java @@ -135,11 +135,8 @@ public class BuildManager { final ArrayList result = CollectionLiterals.newArrayList(); for (final ProjectDescription description : sortedDescriptions) { { - String _name = description.getName(); - ProjectManager _projectManager = this.workspaceManager.getProjectManager(_name); - final IncrementalBuilder.Result partialresult = _projectManager.doInitialBuild(indicator); - List _affectedResources = partialresult.getAffectedResources(); - result.addAll(_affectedResources); + final IncrementalBuilder.Result partialresult = this.workspaceManager.getProjectManager(description.getName()).doInitialBuild(indicator); + result.addAll(partialresult.getAffectedResources()); } } return result; @@ -150,16 +147,14 @@ public class BuildManager { final HashMultimap project2dirty = HashMultimap.create(); for (final URI dirty : allDirty) { { - ProjectManager _projectManager = this.workspaceManager.getProjectManager(dirty); - final ProjectDescription projectManager = _projectManager.getProjectDescription(); + final ProjectDescription projectManager = this.workspaceManager.getProjectManager(dirty).getProjectDescription(); project2dirty.put(projectManager, dirty); } } final HashMultimap project2deleted = HashMultimap.create(); for (final URI deleted : this.deletedFiles) { { - ProjectManager _projectManager = this.workspaceManager.getProjectManager(deleted); - final ProjectDescription projectManager = _projectManager.getProjectDescription(); + final ProjectDescription projectManager = this.workspaceManager.getProjectManager(deleted).getProjectDescription(); project2deleted.put(projectManager, deleted); } } @@ -170,37 +165,25 @@ public class BuildManager { final ArrayList result = CollectionLiterals.newArrayList(); for (final ProjectDescription it : sortedDescriptions) { { - String _name = it.getName(); - final ProjectManager projectManager = this.workspaceManager.getProjectManager(_name); - Set _get = project2dirty.get(it); - List _list = IterableExtensions.toList(_get); - Set _get_1 = project2deleted.get(it); - List _list_1 = IterableExtensions.toList(_get_1); - final IncrementalBuilder.Result partialResult = projectManager.doBuild(_list, _list_1, cancelIndicator); - List _affectedResources = partialResult.getAffectedResources(); + final ProjectManager projectManager = this.workspaceManager.getProjectManager(it.getName()); + final IncrementalBuilder.Result partialResult = projectManager.doBuild(IterableExtensions.toList(project2dirty.get(it)), IterableExtensions.toList(project2deleted.get(it)), cancelIndicator); final Function1 _function = (IResourceDescription.Delta it_1) -> { return it_1.getUri(); }; - List _map = ListExtensions.map(_affectedResources, _function); - allDirty.addAll(_map); + allDirty.addAll(ListExtensions.map(partialResult.getAffectedResources(), _function)); Iterables.removeAll(this.dirtyFiles, this.dirtyFiles); Iterables.removeAll(this.deletedFiles, this.deletedFiles); - List _affectedResources_1 = partialResult.getAffectedResources(); - result.addAll(_affectedResources_1); + result.addAll(partialResult.getAffectedResources()); } } return result; } protected List sortByDependencies(final Iterable projectDescriptions) { - TopologicalSorter _get = this.sorterProvider.get(); - List _list = IterableExtensions.toList(projectDescriptions); final Procedure1 _function = (ProjectDescription it) -> { - String _name = it.getName(); - ProjectManager _projectManager = this.workspaceManager.getProjectManager(_name); - this.reportDependencyCycle(_projectManager); + this.reportDependencyCycle(this.workspaceManager.getProjectManager(it.getName())); }; - return _get.sortByDependencies(_list, _function); + return this.sorterProvider.get().sortByDependencies(IterableExtensions.toList(projectDescriptions), _function); } protected void reportDependencyCycle(final ProjectManager manager) { diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/Document.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/Document.java index 16acc50d4..5eb5074c5 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/Document.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/Document.java @@ -86,18 +86,13 @@ public class Document { Range _range = change.getRange(); boolean _tripleEquals = (_range == null); if (_tripleEquals) { - String _newText = change.getNewText(); - newContent = _newText; + newContent = change.getNewText(); } else { - Range _range_1 = change.getRange(); - Position _start = _range_1.getStart(); - final int start = this.getOffSet(_start); - Range _range_2 = change.getRange(); - Position _end = _range_2.getEnd(); - final int end = this.getOffSet(_end); + final int start = this.getOffSet(change.getRange().getStart()); + final int end = this.getOffSet(change.getRange().getEnd()); String _substring = newContent.substring(0, start); - String _newText_1 = change.getNewText(); - String _plus = (_substring + _newText_1); + String _newText = change.getNewText(); + String _plus = (_substring + _newText); String _substring_1 = newContent.substring(end); String _plus_1 = (_plus + _substring_1); newContent = _plus_1; diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/DocumentExtensions.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/DocumentExtensions.java index ed2684398..349734896 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/DocumentExtensions.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/DocumentExtensions.java @@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.server; import com.google.inject.Inject; import com.google.inject.Singleton; -import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.resource.Resource; @@ -19,7 +18,6 @@ import org.eclipse.lsp4j.Range; import org.eclipse.xtext.ide.server.UriExtensions; import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; -import org.eclipse.xtext.parser.IParseResult; import org.eclipse.xtext.resource.ILocationInFileProvider; import org.eclipse.xtext.resource.XtextResource; import org.eclipse.xtext.util.ITextRegion; @@ -42,8 +40,7 @@ public class DocumentExtensions { public Position newPosition(final Resource resource, final int offset) { if ((resource instanceof XtextResource)) { - IParseResult _parseResult = ((XtextResource)resource).getParseResult(); - final ICompositeNode rootNode = _parseResult.getRootNode(); + final ICompositeNode rootNode = ((XtextResource)resource).getParseResult().getRootNode(); final LineAndColumn lineAndColumn = NodeModelUtils.getLineAndColumn(rootNode, offset); int _line = lineAndColumn.getLine(); int _minus = (_line - 1); @@ -73,11 +70,8 @@ public class DocumentExtensions { public Location newLocation(final Resource resource, final ITextRegion textRegion) { final Location location = new Location(); - URI _uRI = resource.getURI(); - String _path = this._uriExtensions.toPath(_uRI); - location.setUri(_path); - Range _newRange = this.newRange(resource, textRegion); - location.setRange(_newRange); + location.setUri(this._uriExtensions.toPath(resource.getURI())); + location.setRange(this.newRange(resource, textRegion)); return location; } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/LanguageServerImpl.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/LanguageServerImpl.java index 9feed4ab2..3d3fed6e4 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/LanguageServerImpl.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/LanguageServerImpl.java @@ -56,7 +56,6 @@ import org.eclipse.lsp4j.Location; import org.eclipse.lsp4j.Position; import org.eclipse.lsp4j.PublishDiagnosticsParams; import org.eclipse.lsp4j.Range; -import org.eclipse.lsp4j.ReferenceContext; import org.eclipse.lsp4j.ReferenceParams; import org.eclipse.lsp4j.RenameParams; import org.eclipse.lsp4j.ServerCapabilities; @@ -64,12 +63,9 @@ import org.eclipse.lsp4j.SignatureHelp; import org.eclipse.lsp4j.SignatureHelpOptions; import org.eclipse.lsp4j.SymbolInformation; import org.eclipse.lsp4j.TextDocumentContentChangeEvent; -import org.eclipse.lsp4j.TextDocumentIdentifier; -import org.eclipse.lsp4j.TextDocumentItem; import org.eclipse.lsp4j.TextDocumentPositionParams; import org.eclipse.lsp4j.TextDocumentSyncKind; import org.eclipse.lsp4j.TextEdit; -import org.eclipse.lsp4j.VersionedTextDocumentIdentifier; import org.eclipse.lsp4j.WorkspaceEdit; import org.eclipse.lsp4j.WorkspaceSymbolParams; import org.eclipse.lsp4j.jsonrpc.Endpoint; @@ -133,8 +129,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public boolean isCanceled() { if (((this.canceledSince == null) && this.delegate.isCanceled())) { - long _currentTimeMillis = System.currentTimeMillis(); - this.canceledSince = Long.valueOf(_currentTimeMillis); + this.canceledSince = Long.valueOf(System.currentTimeMillis()); return false; } return ((this.canceledSince != null) && (System.currentTimeMillis() > ((this.canceledSince).longValue() + 1000))); @@ -181,8 +176,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex if (_tripleEquals) { throw new IllegalArgumentException("Bad initialization request. rootPath must not be null."); } - Map _extensionToFactoryMap = this.languagesRegistry.getExtensionToFactoryMap(); - boolean _isEmpty = _extensionToFactoryMap.isEmpty(); + boolean _isEmpty = this.languagesRegistry.getExtensionToFactoryMap().isEmpty(); if (_isEmpty) { throw new IllegalStateException("No Xtext languages have been registered. Please make sure you have added the languages\'s setup class in \'/META-INF/services/org.eclipse.xtext.ISetup\'"); } @@ -212,10 +206,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex ServerCapabilities _doubleArrow = ObjectExtensions.operator_doubleArrow(_serverCapabilities, _function); result.setCapabilities(_doubleArrow); final Function1 _function_1 = (CancelIndicator cancelIndicator) -> { - String _rootPath_1 = params.getRootPath(); - URI _createFileURI = URI.createFileURI(_rootPath_1); - String _path = this._uriExtensions.toPath(_createFileURI); - final URI rootURI = this._uriExtensions.toUri(_path); + final URI rootURI = this._uriExtensions.toUri(this._uriExtensions.toPath(URI.createFileURI(params.getRootPath()))); final Procedure2> _function_2 = (URI $0, Iterable $1) -> { this.publishDiagnostics($0, $1); }; @@ -254,14 +245,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public void didOpen(final DidOpenTextDocumentParams params) { final Function1 _function = (CancelIndicator cancelIndicator) -> { - TextDocumentItem _textDocument = params.getTextDocument(); - String _uri = _textDocument.getUri(); - URI _uri_1 = this._uriExtensions.toUri(_uri); - TextDocumentItem _textDocument_1 = params.getTextDocument(); - int _version = _textDocument_1.getVersion(); - TextDocumentItem _textDocument_2 = params.getTextDocument(); - String _text = _textDocument_2.getText(); - this.workspaceManager.didOpen(_uri_1, _version, _text, cancelIndicator); + this.workspaceManager.didOpen(this._uriExtensions.toUri(params.getTextDocument().getUri()), params.getTextDocument().getVersion(), params.getTextDocument().getText(), cancelIndicator); return null; }; this.requestManager.runWrite(_function); @@ -270,19 +254,12 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public void didChange(final DidChangeTextDocumentParams params) { final Function1 _function = (CancelIndicator cancelIndicator) -> { - VersionedTextDocumentIdentifier _textDocument = params.getTextDocument(); - String _uri = _textDocument.getUri(); - URI _uri_1 = this._uriExtensions.toUri(_uri); - VersionedTextDocumentIdentifier _textDocument_1 = params.getTextDocument(); - int _version = _textDocument_1.getVersion(); - List _contentChanges = params.getContentChanges(); final Function1 _function_1 = (TextDocumentContentChangeEvent event) -> { Range _range = event.getRange(); String _text = event.getText(); return new TextEdit(_range, _text); }; - List _map = ListExtensions.map(_contentChanges, _function_1); - this.workspaceManager.didChange(_uri_1, _version, _map, cancelIndicator); + this.workspaceManager.didChange(this._uriExtensions.toUri(params.getTextDocument().getUri()), params.getTextDocument().getVersion(), ListExtensions.map(params.getContentChanges(), _function_1), cancelIndicator); return null; }; this.requestManager.runWrite(_function); @@ -291,10 +268,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public void didClose(final DidCloseTextDocumentParams params) { final Function1 _function = (CancelIndicator cancelIndicator) -> { - TextDocumentIdentifier _textDocument = params.getTextDocument(); - String _uri = _textDocument.getUri(); - URI _uri_1 = this._uriExtensions.toUri(_uri); - this.workspaceManager.didClose(_uri_1, cancelIndicator); + this.workspaceManager.didClose(this._uriExtensions.toUri(params.getTextDocument().getUri()), cancelIndicator); return null; }; this.requestManager.runWrite(_function); @@ -314,13 +288,11 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex FileChangeType _type = fileEvent.getType(); boolean _tripleEquals = (_type == FileChangeType.Deleted); if (_tripleEquals) { - String _uri = fileEvent.getUri(); - URI _uri_1 = this._uriExtensions.toUri(_uri); - deletedFiles.add(_uri_1); + URI _uri = this._uriExtensions.toUri(fileEvent.getUri()); + deletedFiles.add(_uri); } else { - String _uri_2 = fileEvent.getUri(); - URI _uri_3 = this._uriExtensions.toUri(_uri_2); - dirtyFiles.add(_uri_3); + URI _uri_1 = this._uriExtensions.toUri(fileEvent.getUri()); + dirtyFiles.add(_uri_1); } } this.workspaceManager.doBuild(dirtyFiles, deletedFiles, cancelIndicator); @@ -345,14 +317,11 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex private void publishDiagnostics(final URI uri, final Iterable issues) { PublishDiagnosticsParams _publishDiagnosticsParams = new PublishDiagnosticsParams(); final Procedure1 _function = (PublishDiagnosticsParams it) -> { - String _path = this._uriExtensions.toPath(uri); - it.setUri(_path); + it.setUri(this._uriExtensions.toPath(uri)); final Function1 _function_1 = (Issue it_1) -> { return this.toDiagnostic(it_1); }; - Iterable _map = IterableExtensions.map(issues, _function_1); - List _list = IterableExtensions.toList(_map); - it.setDiagnostics(_list); + it.setDiagnostics(IterableExtensions.toList(IterableExtensions.map(issues, _function_1))); }; final PublishDiagnosticsParams diagnostics = ObjectExtensions.operator_doubleArrow(_publishDiagnosticsParams, _function); this.client.publishDiagnostics(diagnostics); @@ -361,8 +330,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex private Diagnostic toDiagnostic(final Issue issue) { Diagnostic _diagnostic = new Diagnostic(); final Procedure1 _function = (Diagnostic it) -> { - String _code = issue.getCode(); - it.setCode(_code); + it.setCode(issue.getCode()); DiagnosticSeverity _switchResult = null; Severity _severity = issue.getSeverity(); if (_severity != null) { @@ -384,8 +352,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex _switchResult = DiagnosticSeverity.Hint; } it.setSeverity(_switchResult); - String _message = issue.getMessage(); - it.setMessage(_message); + it.setMessage(issue.getMessage()); Integer _elvis = null; Integer _lineNumber = issue.getLineNumber(); if (_lineNumber != null) { @@ -422,9 +389,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex public CompletableFuture completion(final TextDocumentPositionParams params) { final Function1 _function = (CancelIndicator origialCancelIndicator) -> { final LanguageServerImpl.BufferedCancelIndicator cancelIndicator = new LanguageServerImpl.BufferedCancelIndicator(origialCancelIndicator); - TextDocumentIdentifier _textDocument = params.getTextDocument(); - String _uri = _textDocument.getUri(); - final URI uri = this._uriExtensions.toUri(_uri); + final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri()); final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri); ContentAssistService _get = null; if (resourceServiceProvider!=null) { @@ -446,9 +411,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public CompletableFuture> definition(final TextDocumentPositionParams params) { final Function1> _function = (CancelIndicator cancelIndicator) -> { - TextDocumentIdentifier _textDocument = params.getTextDocument(); - String _uri = _textDocument.getUri(); - final URI uri = this._uriExtensions.toUri(_uri); + final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri()); final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri); DocumentSymbolService _get = null; if (resourceServiceProvider!=null) { @@ -459,8 +422,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex return CollectionLiterals.emptyList(); } final Function2> _function_1 = (Document document, XtextResource resource) -> { - Position _position = params.getPosition(); - final int offset = document.getOffSet(_position); + final int offset = document.getOffSet(params.getPosition()); return documentSymbolService.getDefinitions(resource, offset, this.resourceAccess, cancelIndicator); }; final List definitions = this.workspaceManager.>doRead(uri, _function_1); @@ -472,9 +434,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public CompletableFuture> references(final ReferenceParams params) { final Function1> _function = (CancelIndicator cancelIndicator) -> { - TextDocumentIdentifier _textDocument = params.getTextDocument(); - String _uri = _textDocument.getUri(); - final URI uri = this._uriExtensions.toUri(_uri); + final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri()); final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri); DocumentSymbolService _get = null; if (resourceServiceProvider!=null) { @@ -485,11 +445,9 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex return CollectionLiterals.emptyList(); } final Function2> _function_1 = (Document document, XtextResource resource) -> { - Position _position = params.getPosition(); - final int offset = document.getOffSet(_position); + final int offset = document.getOffSet(params.getPosition()); List _xifexpression = null; - ReferenceContext _context = params.getContext(); - boolean _isIncludeDeclaration = _context.isIncludeDeclaration(); + boolean _isIncludeDeclaration = params.getContext().isIncludeDeclaration(); if (_isIncludeDeclaration) { _xifexpression = documentSymbolService.getDefinitions(resource, offset, this.resourceAccess, cancelIndicator); } else { @@ -509,9 +467,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public CompletableFuture> documentSymbol(final DocumentSymbolParams params) { final Function1> _function = (CancelIndicator cancelIndicator) -> { - TextDocumentIdentifier _textDocument = params.getTextDocument(); - String _uri = _textDocument.getUri(); - final URI uri = this._uriExtensions.toUri(_uri); + final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri()); final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri); DocumentSymbolService _get = null; if (resourceServiceProvider!=null) { @@ -533,8 +489,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex public CompletableFuture> symbol(final WorkspaceSymbolParams params) { final Function1> _function = (CancelIndicator cancelIndicator) -> { final IResourceDescriptions indexData = this.workspaceManager.getIndex(); - String _query = params.getQuery(); - return this.workspaceSymbolService.getSymbols(_query, this.resourceAccess, indexData, cancelIndicator); + return this.workspaceSymbolService.getSymbols(params.getQuery(), this.resourceAccess, indexData, cancelIndicator); }; return this.requestManager.>runRead(_function); } @@ -542,9 +497,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public CompletableFuture hover(final TextDocumentPositionParams params) { final Function1 _function = (CancelIndicator cancelIndicator) -> { - TextDocumentIdentifier _textDocument = params.getTextDocument(); - String _uri = _textDocument.getUri(); - final URI uri = this._uriExtensions.toUri(_uri); + final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri()); final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri); HoverService _get = null; if (resourceServiceProvider!=null) { @@ -556,8 +509,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex return new Hover(_emptyList, null); } final Function2 _function_1 = (Document document, XtextResource resource) -> { - Position _position = params.getPosition(); - final int offset = document.getOffSet(_position); + final int offset = document.getOffSet(params.getPosition()); return hoverService.hover(resource, offset); }; return this.workspaceManager.doRead(uri, _function_1); @@ -573,9 +525,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public CompletableFuture signatureHelp(final TextDocumentPositionParams position) { final Function1 _function = (CancelIndicator cancelIndicator) -> { - TextDocumentIdentifier _textDocument = position.getTextDocument(); - String _uri = _textDocument.getUri(); - final URI uri = this._uriExtensions.toUri(_uri); + final URI uri = this._uriExtensions.toUri(position.getTextDocument().getUri()); final IResourceServiceProvider serviceProvider = this.languagesRegistry.getResourceServiceProvider(uri); ISignatureHelpService _get = null; if (serviceProvider!=null) { @@ -586,8 +536,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex return new SignatureHelp(); } final Function2 _function_1 = (Document doc, XtextResource resource) -> { - Position _position = position.getPosition(); - final int offset = doc.getOffSet(_position); + final int offset = doc.getOffSet(position.getPosition()); return helper.getSignatureHelp(resource, offset); }; return this.workspaceManager.doRead(uri, _function_1); @@ -598,9 +547,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public CompletableFuture> documentHighlight(final TextDocumentPositionParams position) { final Function1> _function = (CancelIndicator cancelIndicator) -> { - TextDocumentIdentifier _textDocument = position.getTextDocument(); - String _uri = _textDocument.getUri(); - final URI uri = this._uriExtensions.toUri(_uri); + final URI uri = this._uriExtensions.toUri(position.getTextDocument().getUri()); final IResourceServiceProvider serviceProvider = this.languagesRegistry.getResourceServiceProvider(uri); IDocumentHighlightService _get = null; if (serviceProvider!=null) { @@ -611,8 +558,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex return CollectionLiterals.emptyList(); } final Function2> _function_1 = (Document doc, XtextResource resource) -> { - Position _position = position.getPosition(); - final int offset = doc.getOffSet(_position); + final int offset = doc.getOffSet(position.getPosition()); return service.getDocumentHighlights(resource, offset); }; return this.workspaceManager.>doRead(uri, _function_1); @@ -638,9 +584,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public CompletableFuture> formatting(final DocumentFormattingParams params) { final Function1> _function = (CancelIndicator cancelIndicator) -> { - TextDocumentIdentifier _textDocument = params.getTextDocument(); - String _uri = _textDocument.getUri(); - final URI uri = this._uriExtensions.toUri(_uri); + final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri()); final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri); FormattingService _get = null; if (resourceServiceProvider!=null) { @@ -652,8 +596,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex } final Function2> _function_1 = (Document document, XtextResource resource) -> { final int offset = 0; - String _contents = document.getContents(); - final int length = _contents.length(); + final int length = document.getContents().length(); if (((length == 0) || resource.getContents().isEmpty())) { return CollectionLiterals.emptyList(); } @@ -667,9 +610,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public CompletableFuture> rangeFormatting(final DocumentRangeFormattingParams params) { final Function1> _function = (CancelIndicator cancelIndicator) -> { - TextDocumentIdentifier _textDocument = params.getTextDocument(); - String _uri = _textDocument.getUri(); - final URI uri = this._uriExtensions.toUri(_uri); + final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri()); final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri); FormattingService _get = null; if (resourceServiceProvider!=null) { @@ -680,12 +621,8 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex return Collections.emptyList(); } final Function2> _function_1 = (Document document, XtextResource resource) -> { - Range _range = params.getRange(); - Position _start = _range.getStart(); - final int offset = document.getOffSet(_start); - Range _range_1 = params.getRange(); - Position _end = _range_1.getEnd(); - int _offSet = document.getOffSet(_end); + final int offset = document.getOffSet(params.getRange().getStart()); + int _offSet = document.getOffSet(params.getRange().getEnd()); final int length = (_offSet - offset); return formatterService.format(resource, document, offset, length); }; @@ -759,14 +696,9 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex } synchronized (this.extensionProviders) { final LinkedHashMap supportedMethods = CollectionLiterals.newLinkedHashMap(); - Class _class = this.getClass(); - Map _supportedMethods = ServiceEndpoints.getSupportedMethods(_class); - supportedMethods.putAll(_supportedMethods); + supportedMethods.putAll(ServiceEndpoints.getSupportedMethods(this.getClass())); final LinkedHashMap extensions = CollectionLiterals.newLinkedHashMap(); - Map _extensionToFactoryMap = this.languagesRegistry.getExtensionToFactoryMap(); - Collection _values = _extensionToFactoryMap.values(); - Set _set = IterableExtensions.toSet(_values); - Iterable _filter = Iterables.filter(_set, IResourceServiceProvider.class); + Iterable _filter = Iterables.filter(IterableExtensions.toSet(this.languagesRegistry.getExtensionToFactoryMap().values()), IResourceServiceProvider.class); for (final IResourceServiceProvider resourceServiceProvider : _filter) { { final ILanguageServerExtension ext = resourceServiceProvider.get(ILanguageServerExtension.class); @@ -776,41 +708,33 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex if ((ext instanceof JsonRpcMethodProvider)) { _xifexpression = ((JsonRpcMethodProvider)ext).supportedMethods(); } else { - Class _class_1 = ext.getClass(); - _xifexpression = ServiceEndpoints.getSupportedMethods(_class_1); + _xifexpression = ServiceEndpoints.getSupportedMethods(ext.getClass()); } final Map supportedExtensions = _xifexpression; Set> _entrySet = supportedExtensions.entrySet(); for (final Map.Entry entry : _entrySet) { - String _key = entry.getKey(); - boolean _containsKey = supportedMethods.containsKey(_key); + boolean _containsKey = supportedMethods.containsKey(entry.getKey()); if (_containsKey) { - String _key_1 = entry.getKey(); - String _plus = ("The json rpc method \'" + _key_1); + String _key = entry.getKey(); + String _plus = ("The json rpc method \'" + _key); String _plus_1 = (_plus + "\' can not be an extension as it is already defined in the LSP standard."); LanguageServerImpl.LOG.error(_plus_1); } else { - String _key_2 = entry.getKey(); - JsonRpcMethod _value = entry.getValue(); - final JsonRpcMethod existing = extensions.put(_key_2, _value); + final JsonRpcMethod existing = extensions.put(entry.getKey(), entry.getValue()); if (((existing != null) && (!Objects.equal(existing, entry.getValue())))) { - String _key_3 = entry.getKey(); - String _plus_2 = ("An incompatible LSP extension \'" + _key_3); + String _key_1 = entry.getKey(); + String _plus_2 = ("An incompatible LSP extension \'" + _key_1); String _plus_3 = (_plus_2 + "\' has already been registered. Using 1 ignoring 2. \n1 : "); String _plus_4 = (_plus_3 + existing); String _plus_5 = (_plus_4 + " \n2 : "); - JsonRpcMethod _value_1 = entry.getValue(); - String _plus_6 = (_plus_5 + _value_1); + JsonRpcMethod _value = entry.getValue(); + String _plus_6 = (_plus_5 + _value); LanguageServerImpl.LOG.error(_plus_6); - String _key_4 = entry.getKey(); - extensions.put(_key_4, existing); + extensions.put(entry.getKey(), existing); } else { final Endpoint endpoint = ServiceEndpoints.toEndpoint(ext); - String _key_5 = entry.getKey(); - this.extensionProviders.put(_key_5, endpoint); - String _key_6 = entry.getKey(); - JsonRpcMethod _value_2 = entry.getValue(); - supportedMethods.put(_key_6, _value_2); + this.extensionProviders.put(entry.getKey(), endpoint); + supportedMethods.put(entry.getKey(), entry.getValue()); } } } @@ -826,14 +750,12 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex @Override public CompletableFuture doRead(final String uri, final Function function) { final Function1 _function = (CancelIndicator cancelIndicator) -> { - URI _uri = LanguageServerImpl.this._uriExtensions.toUri(uri); final Function2 _function_1 = (Document document, XtextResource resource) -> { - URI _uRI = resource.getURI(); - boolean _isDocumentOpen = LanguageServerImpl.this.workspaceManager.isDocumentOpen(_uRI); + boolean _isDocumentOpen = LanguageServerImpl.this.workspaceManager.isDocumentOpen(resource.getURI()); final ILanguageServerAccess.Context ctx = new ILanguageServerAccess.Context(resource, document, _isDocumentOpen, cancelIndicator); return function.apply(ctx); }; - return LanguageServerImpl.this.workspaceManager.doRead(_uri, _function_1); + return LanguageServerImpl.this.workspaceManager.doRead(LanguageServerImpl.this._uriExtensions.toUri(uri), _function_1); }; return LanguageServerImpl.this.requestManager.runRead(_function); } @@ -856,12 +778,9 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex IResourceDescription _new = it.getNew(); return Boolean.valueOf((_new != null)); }; - Iterable _filter = IterableExtensions.filter(deltas, _function); final Function1 _function_1 = (IResourceDescription.Delta it) -> { - URI _uri = it.getUri(); - return _uri.toString(); + return it.getUri().toString(); }; - Iterable _map = IterableExtensions.map(_filter, _function_1); final Consumer _function_2 = (String it) -> { final Function _function_3 = (ILanguageServerAccess.Context ctx) -> { boolean _isDocumentOpen = ctx.isDocumentOpen(); @@ -870,8 +789,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex if ((_resource instanceof XtextResource)) { Resource _resource_1 = ctx.getResource(); final XtextResource resource = ((XtextResource) _resource_1); - URI _uRI = resource.getURI(); - final IResourceServiceProvider serviceProvider = this.languagesRegistry.getResourceServiceProvider(_uRI); + final IResourceServiceProvider serviceProvider = this.languagesRegistry.getResourceServiceProvider(resource.getURI()); IColoringService _get = null; if (serviceProvider!=null) { _get=serviceProvider.get(IColoringService.class); @@ -883,8 +801,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex boolean _isNullOrEmpty = IterableExtensions.isNullOrEmpty(coloringInfos); boolean _not = (!_isNullOrEmpty); if (_not) { - URI _uRI_1 = resource.getURI(); - final String uri = _uRI_1.toString(); + final String uri = resource.getURI().toString(); ColoringParams _coloringParams = new ColoringParams(uri, coloringInfos); ((LanguageClientExtensions)this.client).updateColoring(_coloringParams); } @@ -896,7 +813,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex }; this.access.doRead(it, _function_3); }; - _map.forEach(_function_2); + IterableExtensions.map(IterableExtensions.filter(deltas, _function), _function_1).forEach(_function_2); } } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/MultiProjectWorkspaceConfig.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/MultiProjectWorkspaceConfig.java index ed1095e49..0256b924f 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/MultiProjectWorkspaceConfig.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/MultiProjectWorkspaceConfig.java @@ -37,17 +37,14 @@ public class MultiProjectWorkspaceConfig implements IWorkspaceConfig { @Override public IProjectConfig findProjectContaining(final URI member) { - Collection _values = this.name2config.values(); final Function1 _function = (IProjectConfig it) -> { ISourceFolder _findSourceFolderContaining = it.findSourceFolderContaining(member); return Boolean.valueOf((_findSourceFolderContaining != null)); }; - Iterable _filter = IterableExtensions.filter(_values, _function); final Function1 _function_1 = (IProjectConfig it) -> { - URI _path = it.getPath(); - return Integer.valueOf(_path.segmentCount()); + return Integer.valueOf(it.getPath().segmentCount()); }; - return IterableExtensions.maxBy(_filter, _function_1); + return IterableExtensions.maxBy(IterableExtensions.filter(this.name2config.values(), _function), _function_1); } public MultiProjectWorkspaceConfig(final Map name2config) { diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/MultiProjectWorkspaceConfigFactory.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/MultiProjectWorkspaceConfigFactory.java index eb3cd1bf8..79049d9d5 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/MultiProjectWorkspaceConfigFactory.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/MultiProjectWorkspaceConfigFactory.java @@ -37,19 +37,16 @@ public class MultiProjectWorkspaceConfigFactory implements IWorkspaceConfigFacto final HashMap name2config = CollectionLiterals.newHashMap(); final MultiProjectWorkspaceConfig result = new MultiProjectWorkspaceConfig(name2config); final IAcceptor _function = (IProjectConfig it) -> { - String _name = it.getName(); - name2config.put(_name, it); + name2config.put(it.getName(), it); }; final IAcceptor acceptor = _function; - File[] _listFiles = baseFile.listFiles(); final Function1 _function_1 = (File it) -> { return Boolean.valueOf(it.isDirectory()); }; - Iterable _filter = IterableExtensions.filter(((Iterable)Conversions.doWrapArray(_listFiles)), _function_1); final Consumer _function_2 = (File it) -> { this.addProjectConfigs(URI.createFileURI(it.getAbsolutePath()), result, acceptor); }; - _filter.forEach(_function_2); + IterableExtensions.filter(((Iterable)Conversions.doWrapArray(baseFile.listFiles())), _function_1).forEach(_function_2); return result; } return null; diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ProjectManager.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ProjectManager.java index c0ae38672..aa328c915 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ProjectManager.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ProjectManager.java @@ -13,7 +13,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.function.Consumer; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; @@ -96,15 +95,13 @@ public class ProjectManager { public IncrementalBuilder.Result doInitialBuild(final CancelIndicator cancelIndicator) { final ArrayList uris = CollectionLiterals.newArrayList(); - Set _sourceFolders = this.projectConfig.getSourceFolders(); final Consumer _function = (ISourceFolder it) -> { - URI _path = it.getPath(); final IAcceptor _function_1 = (URI it_1) -> { uris.add(it_1); }; - this.fileSystemScanner.scan(_path, _function_1); + this.fileSystemScanner.scan(it.getPath(), _function_1); }; - _sourceFolders.forEach(_function); + this.projectConfig.getSourceFolders().forEach(_function); return this.doBuild(uris, CollectionLiterals.emptyList(), cancelIndicator); } @@ -116,10 +113,7 @@ public class ProjectManager { final IncrementalBuilder.Result result = this.incrementalBuilder.build(request, _function); this.indexState = result.getIndexState(); this.resourceSet = request.getResourceSet(); - Map _get = this.indexProvider.get(); - String _name = this.projectDescription.getName(); - ResourceDescriptionsData _resourceDescriptions = this.indexState.getResourceDescriptions(); - _get.put(_name, _resourceDescriptions); + this.indexProvider.get().put(this.projectDescription.getName(), this.indexState.getResourceDescriptions()); return result; } @@ -127,10 +121,8 @@ public class ProjectManager { BuildRequest _buildRequest = new BuildRequest(); final Procedure1 _function = (BuildRequest it) -> { it.setBaseDir(this.baseDir); - ResourceDescriptionsData _resourceDescriptions = this.indexState.getResourceDescriptions(); - ResourceDescriptionsData _copy = _resourceDescriptions.copy(); - Source2GeneratedMapping _fileMappings = this.indexState.getFileMappings(); - Source2GeneratedMapping _copy_1 = _fileMappings.copy(); + ResourceDescriptionsData _copy = this.indexState.getResourceDescriptions().copy(); + Source2GeneratedMapping _copy_1 = this.indexState.getFileMappings().copy(); IndexState _indexState = new IndexState(_copy, _copy_1); it.setState(_indexState); it.setResourceSet(this.createFreshResourceSet(it.getState().getResourceDescriptions())); @@ -153,8 +145,7 @@ public class ProjectManager { ProjectConfigAdapter.install(it, this.projectConfig); Map _get_1 = this.indexProvider.get(); final ChunkedResourceDescriptions index = new ChunkedResourceDescriptions(_get_1, it); - String _name = this.projectDescription.getName(); - index.setContainer(_name, newIndex); + index.setContainer(this.projectDescription.getName(), newIndex); this.externalContentSupport.configureResourceSet(it, this.openedDocumentsContentProvider); }; return ObjectExtensions.operator_doubleArrow(_get, _function); diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerLauncher.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerLauncher.java index c18d91c8b..f38037813 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerLauncher.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerLauncher.java @@ -10,7 +10,6 @@ package org.eclipse.xtext.ide.server; import com.google.common.base.Objects; import com.google.inject.Guice; import com.google.inject.Inject; -import com.google.inject.Injector; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; @@ -38,15 +37,15 @@ public class ServerLauncher { private static boolean IS_DEBUG = false; public static void main(final String[] args) { - ServerLauncher.IS_DEBUG = IterableExtensions.exists(((Iterable)Conversions.doWrapArray(args)), ((Function1) (String it) -> { + final Function1 _function = (String it) -> { return Boolean.valueOf(Objects.equal(it, "debug")); - })); + }; + ServerLauncher.IS_DEBUG = IterableExtensions.exists(((Iterable)Conversions.doWrapArray(args)), _function); final InputStream stdin = System.in; final PrintStream stdout = System.out; ServerLauncher.redirectStandardStreams(); ServerModule _serverModule = new ServerModule(); - Injector _createInjector = Guice.createInjector(_serverModule); - final ServerLauncher launcher = _createInjector.getInstance(ServerLauncher.class); + final ServerLauncher launcher = Guice.createInjector(_serverModule).getInstance(ServerLauncher.class); launcher.start(stdin, stdout); } @@ -58,8 +57,7 @@ public class ServerLauncher { System.err.println("Starting Xtext Language Server."); PrintWriter _printWriter = new PrintWriter(System.out); final Launcher launcher = Launcher.createLauncher(this.languageServer, LanguageClient.class, in, out, true, _printWriter); - LanguageClient _remoteProxy = launcher.getRemoteProxy(); - this.languageServer.connect(_remoteProxy); + this.languageServer.connect(launcher.getRemoteProxy()); final Future future = launcher.startListening(); System.err.println("started."); while ((!future.isDone())) { diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerModule.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerModule.java index b1bc0e087..559a756a6 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerModule.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerModule.java @@ -8,8 +8,6 @@ package org.eclipse.xtext.ide.server; import com.google.inject.AbstractModule; -import com.google.inject.Binder; -import com.google.inject.binder.AnnotatedBindingBuilder; import java.util.concurrent.ExecutorService; import org.eclipse.lsp4j.services.LanguageServer; import org.eclipse.xtext.ide.ExecutorServiceProvider; @@ -31,18 +29,11 @@ import org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerMan public class ServerModule extends AbstractModule { @Override protected void configure() { - Binder _binder = this.binder(); - AnnotatedBindingBuilder _bind = _binder.bind(ExecutorService.class); - _bind.toProvider(ExecutorServiceProvider.class); - AnnotatedBindingBuilder _bind_1 = this.bind(LanguageServer.class); - _bind_1.to(LanguageServerImpl.class); - AnnotatedBindingBuilder _bind_2 = this.bind(IResourceServiceProvider.Registry.class); - _bind_2.toProvider(ResourceServiceProviderServiceLoader.class); - AnnotatedBindingBuilder _bind_3 = this.bind(IWorkspaceConfigFactory.class); - _bind_3.to(ProjectWorkspaceConfigFactory.class); - AnnotatedBindingBuilder _bind_4 = this.bind(IProjectDescriptionFactory.class); - _bind_4.to(DefaultProjectDescriptionFactory.class); - AnnotatedBindingBuilder _bind_5 = this.bind(IContainer.Manager.class); - _bind_5.to(ProjectDescriptionBasedContainerManager.class); + this.binder().bind(ExecutorService.class).toProvider(ExecutorServiceProvider.class); + this.bind(LanguageServer.class).to(LanguageServerImpl.class); + this.bind(IResourceServiceProvider.Registry.class).toProvider(ResourceServiceProviderServiceLoader.class); + this.bind(IWorkspaceConfigFactory.class).to(ProjectWorkspaceConfigFactory.class); + this.bind(IProjectDescriptionFactory.class).to(DefaultProjectDescriptionFactory.class); + this.bind(IContainer.Manager.class).to(ProjectDescriptionBasedContainerManager.class); } } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/TopologicalSorter.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/TopologicalSorter.java index 1c1fa4cbb..7782f79a8 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/TopologicalSorter.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/TopologicalSorter.java @@ -7,7 +7,6 @@ */ package org.eclipse.xtext.ide.server; -import java.util.Collection; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -59,17 +58,18 @@ public class TopologicalSorter { cyclicAcceptor.apply(t); } }; - this.name2entry = IterableExtensions.toMap(IterableExtensions.map(descriptions, ((Function1) (ProjectDescription it) -> { + final Function1 _function = (ProjectDescription it) -> { return new TopologicalSorter.Entry(it); - })), ((Function1) (TopologicalSorter.Entry it) -> { + }; + final Function1 _function_1 = (TopologicalSorter.Entry it) -> { return it.description.getName(); - })); + }; + this.name2entry = IterableExtensions.toMap(IterableExtensions.map(descriptions, _function), _function_1); this.result = CollectionLiterals.newLinkedHashSet(); - Collection _values = this.name2entry.values(); - final Consumer _function = (TopologicalSorter.Entry it) -> { + final Consumer _function_2 = (TopologicalSorter.Entry it) -> { this.visit(it); }; - _values.forEach(_function); + this.name2entry.values().forEach(_function_2); _xblockexpression = IterableExtensions.toList(this.result); } return _xblockexpression; diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/UriExtensions.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/UriExtensions.java index 06173d7f4..3c44cc7e8 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/UriExtensions.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/UriExtensions.java @@ -20,20 +20,15 @@ import org.eclipse.emf.common.util.URI; @SuppressWarnings("all") public class UriExtensions { public URI toUri(final String pathWithScheme) { - java.net.URI _create = java.net.URI.create(pathWithScheme); - String _path = this.toPath(_create); - return URI.createURI(_path); + return URI.createURI(this.toPath(java.net.URI.create(pathWithScheme))); } public String toPath(final URI uri) { - String _string = uri.toString(); - java.net.URI _create = java.net.URI.create(_string); - return this.toPath(_create); + return this.toPath(java.net.URI.create(uri.toString())); } public String toPath(final java.net.URI uri) { final Path path = Paths.get(uri); - java.net.URI _uri = path.toUri(); - return _uri.toString(); + return path.toUri().toString(); } } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/WorkspaceManager.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/WorkspaceManager.java index 0501b1140..14aecd8ed 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/WorkspaceManager.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/WorkspaceManager.java @@ -20,7 +20,6 @@ import java.util.function.Consumer; import org.apache.log4j.Logger; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.URIConverter; import org.eclipse.lsp4j.TextEdit; import org.eclipse.xtext.ide.server.BuildManager; import org.eclipse.xtext.ide.server.Document; @@ -28,13 +27,10 @@ import org.eclipse.xtext.ide.server.ILanguageServerAccess; import org.eclipse.xtext.ide.server.IProjectDescriptionFactory; import org.eclipse.xtext.ide.server.IWorkspaceConfigFactory; import org.eclipse.xtext.ide.server.ProjectManager; -import org.eclipse.xtext.nodemodel.ICompositeNode; -import org.eclipse.xtext.parser.IParseResult; import org.eclipse.xtext.resource.IExternalContentSupport; import org.eclipse.xtext.resource.IResourceDescription; import org.eclipse.xtext.resource.IResourceDescriptions; import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.resource.XtextResourceSet; import org.eclipse.xtext.resource.impl.ChunkedResourceDescriptions; import org.eclipse.xtext.resource.impl.ProjectDescription; import org.eclipse.xtext.resource.impl.ResourceDescriptionsData; @@ -118,18 +114,13 @@ public class WorkspaceManager { } protected void refreshWorkspaceConfig(final CancelIndicator cancelIndicator) { - IWorkspaceConfig _workspaceConfig = this.workspaceConfigFactory.getWorkspaceConfig(this.baseDir); - this.workspaceConfig = _workspaceConfig; + this.workspaceConfig = this.workspaceConfigFactory.getWorkspaceConfig(this.baseDir); final ArrayList newProjects = CollectionLiterals.newArrayList(); - Set _keySet = this.projectName2ProjectManager.keySet(); - final HashSet> remainingProjectNames = CollectionLiterals.>newHashSet(_keySet); - Set _projects = this.workspaceConfig.getProjects(); + final HashSet> remainingProjectNames = CollectionLiterals.>newHashSet(this.projectName2ProjectManager.keySet()); final Consumer _function = (IProjectConfig projectConfig) -> { - String _name = projectConfig.getName(); - boolean _containsKey = this.projectName2ProjectManager.containsKey(_name); + boolean _containsKey = this.projectName2ProjectManager.containsKey(projectConfig.getName()); if (_containsKey) { - String _name_1 = projectConfig.getName(); - remainingProjectNames.remove(_name_1); + remainingProjectNames.remove(projectConfig.getName()); } else { final ProjectManager projectManager = this.projectManagerProvider.get(); final ProjectDescription projectDescription = this.projectDescriptionFactory.getProjectDescription(projectConfig); @@ -137,12 +128,11 @@ public class WorkspaceManager { return this.fullIndex; }; projectManager.initialize(projectDescription, projectConfig, this.issueAcceptor, this.openedDocumentsContentProvider, _function_1, cancelIndicator); - String _name_2 = projectDescription.getName(); - this.projectName2ProjectManager.put(_name_2, projectManager); + this.projectName2ProjectManager.put(projectDescription.getName(), projectManager); newProjects.add(projectDescription); } }; - _projects.forEach(_function); + this.workspaceConfig.getProjects().forEach(_function); for (final Set deletedProject : remainingProjectNames) { { this.projectName2ProjectManager.remove(deletedProject); @@ -180,8 +170,7 @@ public class WorkspaceManager { public ProjectManager getProjectManager(final URI uri) { final IProjectConfig projectConfig = this.workspaceConfig.findProjectContaining(uri); - String _name = projectConfig.getName(); - return this.projectName2ProjectManager.get(_name); + return this.projectName2ProjectManager.get(projectConfig.getName()); } public ProjectManager getProjectManager(final String projectName) { @@ -201,10 +190,8 @@ public class WorkspaceManager { return; } final Document contents = this.openDocuments.get(uri); - Document _applyChanges = contents.applyChanges(changes); - this.openDocuments.put(uri, _applyChanges); - ArrayList _newArrayList = CollectionLiterals.newArrayList(); - this.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(uri)), _newArrayList, cancelIndicator); + this.openDocuments.put(uri, contents.applyChanges(changes)); + this.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(uri)), CollectionLiterals.newArrayList(), cancelIndicator); } public List didOpen(final URI uri, final int version, final String contents, final CancelIndicator cancelIndicator) { @@ -212,8 +199,7 @@ public class WorkspaceManager { { Document _document = new Document(version, contents); this.openDocuments.put(uri, _document); - ArrayList _newArrayList = CollectionLiterals.newArrayList(); - _xblockexpression = this.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(uri)), _newArrayList, cancelIndicator); + _xblockexpression = this.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(uri)), CollectionLiterals.newArrayList(), cancelIndicator); } return _xblockexpression; } @@ -225,11 +211,9 @@ public class WorkspaceManager { List _xifexpression = null; boolean _exists = this.exists(uri); if (_exists) { - ArrayList _newArrayList = CollectionLiterals.newArrayList(); - _xifexpression = this.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(uri)), _newArrayList, cancelIndicator); + _xifexpression = this.doBuild(Collections.unmodifiableList(CollectionLiterals.newArrayList(uri)), CollectionLiterals.newArrayList(), cancelIndicator); } else { - ArrayList _newArrayList_1 = CollectionLiterals.newArrayList(); - _xifexpression = this.doBuild(_newArrayList_1, Collections.unmodifiableList(CollectionLiterals.newArrayList(uri)), cancelIndicator); + _xifexpression = this.doBuild(CollectionLiterals.newArrayList(), Collections.unmodifiableList(CollectionLiterals.newArrayList(uri)), cancelIndicator); } _xblockexpression = _xifexpression; } @@ -237,10 +221,7 @@ public class WorkspaceManager { } protected boolean exists(final URI uri) { - ProjectManager _projectManager = this.getProjectManager(uri); - XtextResourceSet _resourceSet = _projectManager.getResourceSet(); - URIConverter _uRIConverter = _resourceSet.getURIConverter(); - return _uRIConverter.exists(uri, null); + return this.getProjectManager(uri).getResourceSet().getURIConverter().exists(uri, null); } public T doRead(final URI uri, final Function2 work) { @@ -255,14 +236,11 @@ public class WorkspaceManager { protected Document getDocument(final XtextResource resource) { Document _elvis = null; - URI _uRI = resource.getURI(); - Document _get = this.openDocuments.get(_uRI); + Document _get = this.openDocuments.get(resource.getURI()); if (_get != null) { _elvis = _get; } else { - IParseResult _parseResult = resource.getParseResult(); - ICompositeNode _rootNode = _parseResult.getRootNode(); - String _text = _rootNode.getText(); + String _text = resource.getParseResult().getRootNode().getText(); Document _document = new Document(1, _text); _elvis = _document; } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/contentassist/ContentAssistService.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/contentassist/ContentAssistService.java index 12077da3f..21bbca54b 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/contentassist/ContentAssistService.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/contentassist/ContentAssistService.java @@ -66,13 +66,11 @@ public class ContentAssistService { final CompletionList result = new CompletionList(); result.setIsIncomplete(true); final IdeContentProposalAcceptor acceptor = this.proposalAcceptorProvider.get(); - Position _position = params.getPosition(); - final int caretOffset = document.getOffSet(_position); + final int caretOffset = document.getOffSet(params.getPosition()); final Position caretPosition = params.getPosition(); final TextRegion position = new TextRegion(caretOffset, 0); try { - String _contents = document.getContents(); - this.createProposals(_contents, position, caretOffset, resource, acceptor); + this.createProposals(document.getContents(), position, caretOffset, resource, acceptor); } catch (final Throwable _t) { if (_t instanceof Throwable) { final Throwable t = (Throwable)_t; @@ -85,16 +83,13 @@ public class ContentAssistService { throw Exceptions.sneakyThrow(_t); } } - Iterable _entries = acceptor.getEntries(); final Procedure2 _function = (ContentAssistEntry it, Integer idx) -> { final CompletionItem item = this.toCompletionItem(it, caretOffset, caretPosition, document); - String _string = Integer.toString((idx).intValue()); - String _padStart = Strings.padStart(_string, 5, '0'); - item.setSortText(_padStart); + item.setSortText(Strings.padStart(Integer.toString((idx).intValue()), 5, '0')); List _items = result.getItems(); _items.add(item); }; - IterableExtensions.forEach(_entries, _function); + IterableExtensions.forEach(acceptor.getEntries(), _function); return result; } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -124,10 +119,8 @@ public class ContentAssistService { _elvis = _proposal; } completionItem.setLabel(_elvis); - String _description = entry.getDescription(); - completionItem.setDetail(_description); - String _documentation = entry.getDocumentation(); - completionItem.setDocumentation(_documentation); + completionItem.setDetail(entry.getDescription()); + completionItem.setDocumentation(entry.getDocumentation()); String _elvis_1 = null; String _prefix = entry.getPrefix(); if (_prefix != null) { @@ -142,8 +135,7 @@ public class ContentAssistService { String _proposal_1 = entry.getProposal(); TextEdit _textEdit = new TextEdit(_range, _proposal_1); completionItem.setTextEdit(_textEdit); - CompletionItemKind _translateKind = this.translateKind(entry); - completionItem.setKind(_translateKind); + completionItem.setKind(this.translateKind(entry)); return completionItem; } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/findReferences/WorkspaceResourceAccess.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/findReferences/WorkspaceResourceAccess.java index ac6d3ecf3..9d52189e0 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/findReferences/WorkspaceResourceAccess.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/findReferences/WorkspaceResourceAccess.java @@ -31,8 +31,7 @@ public class WorkspaceResourceAccess implements IReferenceFinder.IResourceAccess public R readOnly(final URI targetURI, final IUnitOfWork work) { final Function2 _function = (Document document, XtextResource resource) -> { try { - ResourceSet _resourceSet = resource.getResourceSet(); - return work.exec(_resourceSet); + return work.exec(resource.getResourceSet()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/formatting/FormattingService.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/formatting/FormattingService.java index 64a41303c..0ecc6166e 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/formatting/FormattingService.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/formatting/FormattingService.java @@ -11,7 +11,6 @@ import com.google.inject.Inject; import com.google.inject.Provider; import java.util.Collections; import java.util.List; -import org.eclipse.lsp4j.Position; import org.eclipse.lsp4j.Range; import org.eclipse.lsp4j.TextEdit; import org.eclipse.xtext.formatting2.FormatterRequest; @@ -53,13 +52,9 @@ public class FormattingService { TextRegion _textRegion = new TextRegion(offset, length); final List replacements = this.format2(resource, _textRegion, null); final Function1 _function = (ITextReplacement r) -> { - String _replacementText = r.getReplacementText(); - int _offset = r.getOffset(); - int _length = r.getLength(); - return this.toTextEdit(document, _replacementText, _offset, _length); + return this.toTextEdit(document, r.getReplacementText(), r.getOffset(), r.getLength()); }; - List _map = ListExtensions.map(replacements, _function); - return IterableExtensions.toList(_map); + return IterableExtensions.toList(ListExtensions.map(replacements, _function)); } else { return CollectionLiterals.newArrayList(); } @@ -71,10 +66,8 @@ public class FormattingService { it.setNewText(formattedText); Range _range = new Range(); final Procedure1 _function_1 = (Range it_1) -> { - Position _position = document.getPosition(startOffset); - it_1.setStart(_position); - Position _position_1 = document.getPosition((startOffset + length)); - it_1.setEnd(_position_1); + it_1.setStart(document.getPosition(startOffset)); + it_1.setEnd(document.getPosition((startOffset + length))); }; Range _doubleArrow = ObjectExtensions.operator_doubleArrow(_range, _function_1); it.setRange(_doubleArrow); @@ -92,8 +85,7 @@ public class FormattingService { if ((preferences != null)) { request.setPreferences(preferences); } - TextRegionAccessBuilder _forNodeModel = this.regionBuilder.forNodeModel(resource); - final ITextRegionAccess regionAccess = _forNodeModel.create(); + final ITextRegionAccess regionAccess = this.regionBuilder.forNodeModel(resource).create(); request.setTextRegionAccess(regionAccess); final IFormatter2 formatter2 = this.formatter2Provider.get(); final List replacements = formatter2.format(request); diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/hover/HoverService.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/hover/HoverService.java index 83b513e13..7885c3758 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/hover/HoverService.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/hover/HoverService.java @@ -16,7 +16,6 @@ import org.eclipse.lsp4j.Hover; import org.eclipse.lsp4j.Range; import org.eclipse.xtext.documentation.IEObjectDocumentationProvider; import org.eclipse.xtext.ide.server.DocumentExtensions; -import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.ILeafNode; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; import org.eclipse.xtext.parser.IParseResult; @@ -82,8 +81,7 @@ public class HoverService { final Function1 _function_1 = (String it) -> { return it; }; - List _map = ListExtensions.map(contents, _function_1); - b.setContents(_map); + b.setContents(ListExtensions.map(contents, _function_1)); }; return ObjectExtensions.operator_doubleArrow(_hover, _function); } @@ -111,12 +109,9 @@ public class HoverService { if (_not) { final IParseResult parseResult = resource.getParseResult(); if ((parseResult != null)) { - ICompositeNode _rootNode = parseResult.getRootNode(); - ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(_rootNode, offset); + ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(parseResult.getRootNode(), offset); if ((((leafNode != null) && leafNode.isHidden()) && (leafNode.getOffset() == offset))) { - ICompositeNode _rootNode_1 = parseResult.getRootNode(); - ILeafNode _findLeafNodeAtOffset = NodeModelUtils.findLeafNodeAtOffset(_rootNode_1, (offset - 1)); - leafNode = _findLeafNodeAtOffset; + leafNode = NodeModelUtils.findLeafNodeAtOffset(parseResult.getRootNode(), (offset - 1)); } if ((leafNode != null)) { final ITextRegion leafRegion = leafNode.getTextRegion(); diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/DocumentSymbolService.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/DocumentSymbolService.java index 19ddfab8b..0679ce6a5 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/DocumentSymbolService.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/DocumentSymbolService.java @@ -11,7 +11,6 @@ import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.Singleton; import java.util.ArrayList; -import java.util.Collection; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -19,7 +18,6 @@ import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.lsp4j.Location; @@ -111,14 +109,11 @@ public class DocumentSymbolService { final ArrayList locations = CollectionLiterals.newArrayList(); final TargetURIs targetURIs = this.collectTargetURIs(element); final IAcceptor _function = (IReferenceDescription reference) -> { - URI _sourceEObjectUri = reference.getSourceEObjectUri(); final Procedure1 _function_1 = (EObject obj) -> { - EReference _eReference = reference.getEReference(); - int _indexInList = reference.getIndexInList(); - Location _newLocation = this._documentExtensions.newLocation(obj, _eReference, _indexInList); + Location _newLocation = this._documentExtensions.newLocation(obj, reference.getEReference(), reference.getIndexInList()); locations.add(_newLocation); }; - this.doRead(resourceAccess, _sourceEObjectUri, _function_1); + this.doRead(resourceAccess, reference.getSourceEObjectUri(), _function_1); }; ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(this.resourceServiceProviderRegistry, _function); CancelIndicatorProgressMonitor _cancelIndicatorProgressMonitor = new CancelIndicatorProgressMonitor(cancelIndicator); @@ -153,8 +148,7 @@ public class DocumentSymbolService { } } } - Collection _values = symbols.values(); - return IterableExtensions.toList(_values); + return IterableExtensions.toList(symbols.values()); } protected EObject getContainer(final EObject obj) { @@ -168,21 +162,17 @@ public class DocumentSymbolService { } final SymbolInformation symbol = new SymbolInformation(); symbol.setName(symbolName); - SymbolKind _symbolKind = this.getSymbolKind(object); - symbol.setKind(_symbolKind); - Location _newLocation = this._documentExtensions.newLocation(object); - symbol.setLocation(_newLocation); + symbol.setKind(this.getSymbolKind(object)); + symbol.setLocation(this._documentExtensions.newLocation(object)); return symbol; } protected String getSymbolName(final EObject object) { - QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(object); - return this.getSymbolName(_fullyQualifiedName); + return this.getSymbolName(this._iQualifiedNameProvider.getFullyQualifiedName(object)); } protected SymbolKind getSymbolKind(final EObject object) { - EClass _eClass = object.eClass(); - return this.getSymbolKind(_eClass); + return this.getSymbolKind(object.eClass()); } public List getSymbols(final IResourceDescription resourceDescription, final String query, final IReferenceFinder.IResourceAccess resourceAccess, final CancelIndicator cancelIndicator) { @@ -196,12 +186,10 @@ public class DocumentSymbolService { final SymbolInformation symbol = this.createSymbol(description); if ((symbol != null)) { symbols.add(symbol); - URI _eObjectURI = description.getEObjectURI(); final Procedure1 _function = (EObject obj) -> { - Location _newLocation = this._documentExtensions.newLocation(obj); - symbol.setLocation(_newLocation); + symbol.setLocation(this._documentExtensions.newLocation(obj)); }; - this.doRead(resourceAccess, _eObjectURI, _function); + this.doRead(resourceAccess, description.getEObjectURI(), _function); } } } @@ -210,11 +198,7 @@ public class DocumentSymbolService { } protected boolean filter(final IEObjectDescription description, final String query) { - QualifiedName _qualifiedName = description.getQualifiedName(); - QualifiedName _lowerCase = _qualifiedName.toLowerCase(); - String _string = _lowerCase.toString(); - String _lowerCase_1 = query.toLowerCase(); - return _string.contains(_lowerCase_1); + return description.getQualifiedName().toLowerCase().toString().contains(query.toLowerCase()); } protected SymbolInformation createSymbol(final IEObjectDescription description) { @@ -224,19 +208,16 @@ public class DocumentSymbolService { } final SymbolInformation symbol = new SymbolInformation(); symbol.setName(symbolName); - SymbolKind _symbolKind = this.getSymbolKind(description); - symbol.setKind(_symbolKind); + symbol.setKind(this.getSymbolKind(description)); return symbol; } protected String getSymbolName(final IEObjectDescription description) { - QualifiedName _qualifiedName = description.getQualifiedName(); - return this.getSymbolName(_qualifiedName); + return this.getSymbolName(description.getQualifiedName()); } protected SymbolKind getSymbolKind(final IEObjectDescription description) { - EClass _eClass = description.getEClass(); - return this.getSymbolKind(_eClass); + return this.getSymbolKind(description.getEClass()); } protected String getSymbolName(final QualifiedName qualifiedName) { diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.java index b09bc9a01..f1b27d770 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.java +++ b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.java @@ -12,7 +12,6 @@ import com.google.inject.Inject; import com.google.inject.Singleton; import java.util.LinkedList; import java.util.List; -import org.eclipse.emf.common.util.URI; import org.eclipse.lsp4j.SymbolInformation; import org.eclipse.xtext.findReferences.IReferenceFinder; import org.eclipse.xtext.ide.server.symbol.DocumentSymbolService; @@ -44,8 +43,7 @@ public class WorkspaceSymbolService { for (final IResourceDescription resourceDescription : _allResourceDescriptions) { { this.operationCanceledManager.checkCanceled(cancelIndicator); - URI _uRI = resourceDescription.getURI(); - final IResourceServiceProvider resourceServiceProvider = this._registry.getResourceServiceProvider(_uRI); + final IResourceServiceProvider resourceServiceProvider = this._registry.getResourceServiceProvider(resourceDescription.getURI()); DocumentSymbolService _get = null; if (resourceServiceProvider!=null) { _get=resourceServiceProvider.get(DocumentSymbolService.class); diff --git a/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/AbstractLanguageServerTest.java b/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/AbstractLanguageServerTest.java index 4b9bd2b2a..b06ea2001 100644 --- a/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/AbstractLanguageServerTest.java +++ b/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/AbstractLanguageServerTest.java @@ -20,12 +20,10 @@ import java.io.FileWriter; import java.net.URI; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; import org.eclipse.lsp4j.ColoringInformation; @@ -47,7 +45,6 @@ import org.eclipse.lsp4j.Hover; import org.eclipse.lsp4j.InitializeParams; import org.eclipse.lsp4j.InitializeResult; import org.eclipse.lsp4j.Location; -import org.eclipse.lsp4j.ParameterInformation; import org.eclipse.lsp4j.Position; import org.eclipse.lsp4j.PublishDiagnosticsParams; import org.eclipse.lsp4j.Range; @@ -56,7 +53,6 @@ import org.eclipse.lsp4j.ReferenceParams; import org.eclipse.lsp4j.SignatureHelp; import org.eclipse.lsp4j.SignatureInformation; import org.eclipse.lsp4j.SymbolInformation; -import org.eclipse.lsp4j.SymbolKind; import org.eclipse.lsp4j.TextDocumentIdentifier; import org.eclipse.lsp4j.TextDocumentItem; import org.eclipse.lsp4j.TextDocumentPositionParams; @@ -128,8 +124,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { final CancelIndicator _function = () -> { return false; }; - V _apply = writeRequest.apply(_function); - return CompletableFuture.completedFuture(_apply); + return CompletableFuture.completedFuture(writeRequest.apply(_function)); } @Override @@ -137,27 +132,22 @@ public abstract class AbstractLanguageServerTest implements Endpoint { final CancelIndicator _function = () -> { return false; }; - V _apply = readRequest.apply(_function); - return CompletableFuture.completedFuture(_apply); + return CompletableFuture.completedFuture(readRequest.apply(_function)); } }); } }); final Injector injector = Guice.createInjector(module); injector.injectMembers(this); - Map _extensionToFactoryMap = this.resourceServerProviderRegistry.getExtensionToFactoryMap(); - final Object resourceServiceProvider = _extensionToFactoryMap.get(this.fileExtension); + final Object resourceServiceProvider = this.resourceServerProviderRegistry.getExtensionToFactoryMap().get(this.fileExtension); if ((resourceServiceProvider instanceof IResourceServiceProvider)) { - LanguageInfo _get = ((IResourceServiceProvider)resourceServiceProvider).get(LanguageInfo.class); - this.languageInfo = _get; + this.languageInfo = ((IResourceServiceProvider)resourceServiceProvider).get(LanguageInfo.class); } - LanguageClientExtensions _serviceObject = ServiceEndpoints.toServiceObject(this, LanguageClientExtensions.class); - this.languageServer.connect(_serviceObject); + this.languageServer.connect(ServiceEndpoints.toServiceObject(this, LanguageClientExtensions.class)); this.languageServer.supportedMethods(); - File _file = new File(""); - File _absoluteFile = _file.getAbsoluteFile(); - File _file_1 = new File(_absoluteFile, "/test-data/test-project"); - this.root = _file_1; + File _absoluteFile = new File("").getAbsoluteFile(); + File _file = new File(_absoluteFile, "/test-data/test-project"); + this.root = _file; boolean _mkdirs = this.root.mkdirs(); boolean _not = (!_mkdirs); if (_not) { @@ -186,9 +176,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { protected LanguageInfo languageInfo; protected Path getTestRootPath() { - Path _path = this.root.toPath(); - Path _absolutePath = _path.toAbsolutePath(); - return _absolutePath.normalize(); + return this.root.toPath().toAbsolutePath().normalize(); } protected Path relativize(final String uri) { @@ -197,8 +185,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { { URI _uRI = new URI(uri); final Path path = Paths.get(_uRI); - Path _testRootPath = this.getTestRootPath(); - _xblockexpression = _testRootPath.relativize(path); + _xblockexpression = this.getTestRootPath().relativize(path); } return _xblockexpression; } catch (Throwable _e) { @@ -215,24 +202,20 @@ public abstract class AbstractLanguageServerTest implements Endpoint { InitializeParams _initializeParams = new InitializeParams(); final Procedure1 _function = (InitializeParams it) -> { it.setProcessId(Integer.valueOf(1)); - Path _testRootPath = this.getTestRootPath(); - String _string = _testRootPath.toString(); - it.setRootPath(_string); + it.setRootPath(this.getTestRootPath().toString()); }; final InitializeParams params = ObjectExtensions.operator_doubleArrow(_initializeParams, _function); if (initializer!=null) { initializer.apply(((InitializeParams) params)); } - CompletableFuture _initialize = this.languageServer.initialize(params); - return _initialize.get(); + return this.languageServer.initialize(params).get(); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } } protected void open(final String fileUri, final String model) { - String _languageName = this.languageInfo.getLanguageName(); - this.open(fileUri, _languageName, model); + this.open(fileUri, this.languageInfo.getLanguageName(), model); } protected void open(final String fileUri, final String langaugeId, final String model) { @@ -284,16 +267,12 @@ public abstract class AbstractLanguageServerTest implements Endpoint { public String writeFile(final String path, final CharSequence contents) { try { final File file = new File(this.root, path); - File _parentFile = file.getParentFile(); - _parentFile.mkdirs(); + file.getParentFile().mkdirs(); file.createNewFile(); final FileWriter writer = new FileWriter(file); - String _string = contents.toString(); - writer.write(_string); + writer.write(contents.toString()); writer.close(); - URI _uRI = file.toURI(); - URI _normalize = _uRI.normalize(); - return this._uriExtensions.toPath(_normalize); + return this._uriExtensions.toPath(file.toURI().normalize()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -301,9 +280,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { public String getVirtualFile(final String path) { final File file = new File(this.root, path); - URI _uRI = file.toURI(); - URI _normalize = _uRI.normalize(); - return this._uriExtensions.toPath(_normalize); + return this._uriExtensions.toPath(file.toURI().normalize()); } protected String _toExpectation(final List elements) { @@ -334,12 +311,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint { protected String _toExpectation(final Location it) { StringConcatenation _builder = new StringConcatenation(); - String _uri = it.getUri(); - Path _relativize = this.relativize(_uri); + Path _relativize = this.relativize(it.getUri()); _builder.append(_relativize); _builder.append(" "); - Range _range = it.getRange(); - String _expectation = this.toExpectation(_range); + String _expectation = this.toExpectation(it.getRange()); _builder.append(_expectation); return _builder.toString(); } @@ -347,12 +322,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint { protected String _toExpectation(final Range it) { StringConcatenation _builder = new StringConcatenation(); _builder.append("["); - Position _start = it.getStart(); - String _expectation = this.toExpectation(_start); + String _expectation = this.toExpectation(it.getStart()); _builder.append(_expectation); _builder.append(" .. "); - Position _end = it.getEnd(); - String _expectation_1 = this.toExpectation(_end); + String _expectation_1 = this.toExpectation(it.getEnd()); _builder.append(_expectation_1); _builder.append("]"); return _builder.toString(); @@ -379,25 +352,22 @@ public abstract class AbstractLanguageServerTest implements Endpoint { _builder.newLineIfNotEmpty(); _builder.append(" "); _builder.append("kind: "); - SymbolKind _kind = it.getKind(); - int _value = _kind.getValue(); + int _value = it.getKind().getValue(); _builder.append(_value, " "); _builder.newLineIfNotEmpty(); _builder.append(" "); _builder.append("location: "); - Location _location = it.getLocation(); - String _expectation = this.toExpectation(_location); + String _expectation = this.toExpectation(it.getLocation()); _builder.append(_expectation, " "); _builder.newLineIfNotEmpty(); { - String _containerName = it.getContainerName(); - boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_containerName); + boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(it.getContainerName()); boolean _not = (!_isNullOrEmpty); if (_not) { _builder.append(" "); _builder.append("container: \""); - String _containerName_1 = it.getContainerName(); - _builder.append(_containerName_1, " "); + String _containerName = it.getContainerName(); + _builder.append(_containerName, " "); _builder.append("\""); _builder.newLineIfNotEmpty(); } @@ -412,13 +382,12 @@ public abstract class AbstractLanguageServerTest implements Endpoint { String _label = it.getLabel(); _builder.append(_label); { - String _detail = it.getDetail(); - boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_detail); + boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(it.getDetail()); boolean _not = (!_isNullOrEmpty); if (_not) { _builder.append(" ("); - String _detail_1 = it.getDetail(); - _builder.append(_detail_1); + String _detail = it.getDetail(); + _builder.append(_detail); _builder.append(")"); } } @@ -427,8 +396,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { boolean _tripleNotEquals = (_textEdit != null); if (_tripleNotEquals) { _builder.append(" -> "); - TextEdit _textEdit_1 = it.getTextEdit(); - String _expectation = this.toExpectation(_textEdit_1); + String _expectation = this.toExpectation(it.getTextEdit()); _builder.append(_expectation); } else { if (((it.getInsertText() != null) && (!Objects.equal(it.getInsertText(), it.getLabel())))) { @@ -447,8 +415,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { String _newText = it.getNewText(); _builder.append(_newText); _builder.append(" "); - Range _range = it.getRange(); - String _expectation = this.toExpectation(_range); + String _expectation = this.toExpectation(it.getRange()); _builder.append(_expectation); _builder.newLineIfNotEmpty(); return _builder.toString(); @@ -456,8 +423,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { protected String _toExpectation(final Hover it) { StringConcatenation _builder = new StringConcatenation(); - Range _range = it.getRange(); - String _expectation = this.toExpectation(_range); + String _expectation = this.toExpectation(it.getRange()); _builder.append(_expectation); _builder.newLineIfNotEmpty(); { @@ -474,8 +440,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { protected String _toExpectation(final SignatureHelp it) { String _xblockexpression = null; { - List _signatures = it.getSignatures(); - int _size = _signatures.size(); + int _size = it.getSignatures().size(); boolean _tripleEquals = (_size == 0); if (_tripleEquals) { StringConcatenation _builder = new StringConcatenation(); @@ -483,34 +448,26 @@ public abstract class AbstractLanguageServerTest implements Endpoint { Integer _activeSignature = it.getActiveSignature(); _builder.append(_activeSignature); _builder.append("."); - Integer _activeSignature_1 = it.getActiveSignature(); - Assert.assertNull(_builder.toString(), _activeSignature_1); + Assert.assertNull(_builder.toString(), + it.getActiveSignature()); return ""; } - Integer _activeSignature_2 = it.getActiveSignature(); - Assert.assertNotNull("Active signature index must not be null when signatures are available.", _activeSignature_2); + Assert.assertNotNull("Active signature index must not be null when signatures are available.", it.getActiveSignature()); String _xifexpression = null; Integer _activeParameter = it.getActiveParameter(); boolean _tripleEquals_1 = (_activeParameter == null); if (_tripleEquals_1) { _xifexpression = ""; } else { - List _signatures_1 = it.getSignatures(); - Integer _activeSignature_3 = it.getActiveSignature(); - SignatureInformation _get = _signatures_1.get((_activeSignature_3).intValue()); - List _parameters = _get.getParameters(); - Integer _activeParameter_1 = it.getActiveParameter(); - ParameterInformation _get_1 = _parameters.get((_activeParameter_1).intValue()); - _xifexpression = _get_1.getLabel(); + _xifexpression = it.getSignatures().get((it.getActiveSignature()).intValue()).getParameters().get( + (it.getActiveParameter()).intValue()).getLabel(); } final String param = _xifexpression; StringConcatenation _builder_1 = new StringConcatenation(); - List _signatures_2 = it.getSignatures(); final Function1 _function = (SignatureInformation it_1) -> { return it_1.getLabel(); }; - List _map = ListExtensions.map(_signatures_2, _function); - String _join = IterableExtensions.join(_map, " | "); + String _join = IterableExtensions.join(ListExtensions.map(it.getSignatures(), _function), " | "); _builder_1.append(_join); _builder_1.append(" | "); _builder_1.append(param); @@ -529,8 +486,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { if (_tripleEquals) { _builder.append("[NaN, NaN]:[NaN, NaN]"); } else { - Range _range_1 = it.getRange(); - String _expectation = this.toExpectation(_range_1); + String _expectation = this.toExpectation(it.getRange()); _builder.append(_expectation); } } @@ -542,8 +498,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { if (_tripleEquals_1) { _builder_1.append("NaN"); } else { - DocumentHighlightKind _kind_1 = it.getKind(); - String _expectation_1 = this.toExpectation(_kind_1); + String _expectation_1 = this.toExpectation(it.getKind()); _builder_1.append(_expectation_1); } } @@ -555,52 +510,42 @@ public abstract class AbstractLanguageServerTest implements Endpoint { } protected String _toExpectation(final DocumentHighlightKind kind) { - String _string = kind.toString(); - String _substring = _string.substring(0, 1); - return _substring.toUpperCase(); + return kind.toString().substring(0, 1).toUpperCase(); } protected String _toExpectation(final Map it) { final StringBuilder sb = new StringBuilder(); - Set> _entrySet = it.entrySet(); final Consumer> _function = (Map.Entry it_1) -> { int _length = sb.length(); boolean _greaterThan = (_length > 0); if (_greaterThan) { sb.append("\n"); } - Object _key = it_1.getKey(); - String _expectation = this.toExpectation(_key); - sb.append(_expectation); + sb.append(this.toExpectation(it_1.getKey())); sb.append(" ->"); Object _value = it_1.getValue(); if ((_value instanceof Iterable)) { Object _value_1 = it_1.getValue(); final Consumer _function_1 = (Object it_2) -> { sb.append("\n * "); - String _expectation_1 = this.toExpectation(it_2); - sb.append(_expectation_1); + sb.append(this.toExpectation(it_2)); }; ((Iterable) _value_1).forEach(_function_1); } else { sb.append(" "); - Object _value_2 = it_1.getValue(); - String _expectation_1 = this.toExpectation(_value_2); - sb.append(_expectation_1); + sb.append(this.toExpectation(it_1.getValue())); } }; - _entrySet.forEach(_function); + it.entrySet().forEach(_function); return sb.toString(); } protected String _toExpectation(final ColoringInformation it) { StringConcatenation _builder = new StringConcatenation(); - Range _range = it.getRange(); - String _expectation = this.toExpectation(_range); + String _expectation = this.toExpectation(it.getRange()); _builder.append(_expectation); _builder.append(" -> ["); - List _styles = it.getStyles(); - String _join = IterableExtensions.join(_styles, ", "); + String _join = IterableExtensions.join(it.getStyles(), ", "); _builder.append(_join); _builder.append("]"); return _builder.toString(); @@ -612,8 +557,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { final TestCompletionConfiguration configuration = new TestCompletionConfiguration(); configuration.setFilePath(("MyModel." + this.fileExtension)); configurator.apply(configuration); - FileInfo _initializeContext = this.initializeContext(configuration); - final String filePath = _initializeContext.getUri(); + final String filePath = this.initializeContext(configuration).getUri(); TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams(); final Procedure1 _function = (TextDocumentPositionParams it) -> { TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(filePath); @@ -626,24 +570,17 @@ public abstract class AbstractLanguageServerTest implements Endpoint { TextDocumentPositionParams _doubleArrow = ObjectExtensions.operator_doubleArrow(_textDocumentPositionParams, _function); final CompletableFuture completionItems = this.languageServer.completion(_doubleArrow); final CompletionList list = completionItems.get(); - List _items = list.getItems(); - List _items_1 = list.getItems(); final Function1 _function_1 = (CompletionItem it) -> { return it.getSortText(); }; - List _sortBy = IterableExtensions.sortBy(_items_1, _function_1); - List _list = IterableExtensions.toList(_sortBy); - Assert.assertEquals(_items, _list); + Assert.assertEquals(list.getItems(), IterableExtensions.toList(IterableExtensions.sortBy(list.getItems(), _function_1))); Procedure1 _assertCompletionList = configuration.getAssertCompletionList(); boolean _tripleNotEquals = (_assertCompletionList != null); if (_tripleNotEquals) { - Procedure1 _assertCompletionList_1 = configuration.getAssertCompletionList(); - _assertCompletionList_1.apply(list); + configuration.getAssertCompletionList().apply(list); } else { - List _items_2 = list.getItems(); - final String actualCompletionItems = this.toExpectation(_items_2); - String _expectedCompletionItems = configuration.getExpectedCompletionItems(); - this.assertEquals(_expectedCompletionItems, actualCompletionItems); + final String actualCompletionItems = this.toExpectation(list.getItems()); + this.assertEquals(configuration.getExpectedCompletionItems(), actualCompletionItems); } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -652,41 +589,27 @@ public abstract class AbstractLanguageServerTest implements Endpoint { protected FileInfo initializeContext(final TextDocumentConfiguration configuration) { this.initialize(); - Map _filesInScope = configuration.getFilesInScope(); - boolean _isEmpty = _filesInScope.isEmpty(); + boolean _isEmpty = configuration.getFilesInScope().isEmpty(); boolean _not = (!_isEmpty); if (_not) { - Map _filesInScope_1 = configuration.getFilesInScope(); - Set> _entrySet = _filesInScope_1.entrySet(); final Function1, String> _function = (Map.Entry it) -> { - String _key = it.getKey(); - CharSequence _value = it.getValue(); - String _string = _value.toString(); - return this.writeFile(_key, _string); + return this.writeFile(it.getKey(), it.getValue().toString()); }; - final Iterable createdFiles = IterableExtensions., String>map(_entrySet, _function); + final Iterable createdFiles = IterableExtensions., String>map(configuration.getFilesInScope().entrySet(), _function); this.didCreateWatchedFiles(((String[])Conversions.unwrapArray(createdFiles, String.class))); String _model = configuration.getModel(); boolean _tripleEquals = (_model == null); if (_tripleEquals) { String _head = IterableExtensions.head(createdFiles); - Map _filesInScope_2 = configuration.getFilesInScope(); - Set> _entrySet_1 = _filesInScope_2.entrySet(); - Map.Entry _head_1 = IterableExtensions.>head(_entrySet_1); - CharSequence _value = _head_1.getValue(); - String _string = _value.toString(); + String _string = IterableExtensions.>head(configuration.getFilesInScope().entrySet()).getValue().toString(); return new FileInfo(_head, _string); } } + Assert.assertNotNull(configuration.getModel()); + final String filePath = this.writeFile(configuration.getFilePath(), configuration.getModel()); + this.open(filePath, configuration.getModel()); String _model_1 = configuration.getModel(); - Assert.assertNotNull(_model_1); - String _filePath = configuration.getFilePath(); - String _model_2 = configuration.getModel(); - final String filePath = this.writeFile(_filePath, _model_2); - String _model_3 = configuration.getModel(); - this.open(filePath, _model_3); - String _model_4 = configuration.getModel(); - return new FileInfo(filePath, _model_4); + return new FileInfo(filePath, _model_1); } protected void testDefinition(final Procedure1 configurator) { @@ -695,8 +618,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { final DefinitionTestConfiguration configuration = new DefinitionTestConfiguration(); configuration.setFilePath(("MyModel." + this.fileExtension)); configurator.apply(configuration); - FileInfo _initializeContext = this.initializeContext(configuration); - final String fileUri = _initializeContext.getUri(); + final String fileUri = this.initializeContext(configuration).getUri(); TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams(); final Procedure1 _function = (TextDocumentPositionParams it) -> { TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri); @@ -712,12 +634,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint { Procedure1> _assertDefinitions = configuration.getAssertDefinitions(); boolean _tripleNotEquals = (_assertDefinitions != null); if (_tripleNotEquals) { - Procedure1> _assertDefinitions_1 = configuration.getAssertDefinitions(); - _assertDefinitions_1.apply(definitions); + configuration.getAssertDefinitions().apply(definitions); } else { final String actualDefinitions = this.toExpectation(definitions); - String _expectedDefinitions = configuration.getExpectedDefinitions(); - this.assertEquals(_expectedDefinitions, actualDefinitions); + this.assertEquals(configuration.getExpectedDefinitions(), actualDefinitions); } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -730,8 +650,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { final HoverTestConfiguration configuration = new HoverTestConfiguration(); configuration.setFilePath(("MyModel." + this.fileExtension)); configurator.apply(configuration); - FileInfo _initializeContext = this.initializeContext(configuration); - final String fileUri = _initializeContext.getUri(); + final String fileUri = this.initializeContext(configuration).getUri(); TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams(); final Procedure1 _function = (TextDocumentPositionParams it) -> { TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri); @@ -747,12 +666,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint { Procedure1 _assertHover = configuration.getAssertHover(); boolean _tripleNotEquals = (_assertHover != null); if (_tripleNotEquals) { - Procedure1 _assertHover_1 = configuration.getAssertHover(); - _assertHover_1.apply(hover); + configuration.getAssertHover().apply(hover); } else { final String actualHover = this.toExpectation(hover); - String _expectedHover = configuration.getExpectedHover(); - this.assertEquals(_expectedHover, actualHover); + this.assertEquals(configuration.getExpectedHover(), actualHover); } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -765,8 +682,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { final SignatureHelpConfiguration configuration = new SignatureHelpConfiguration(); configuration.setFilePath(("MyModel." + this.fileExtension)); configurator.apply(configuration); - FileInfo _initializeContext = this.initializeContext(configuration); - final String fileUri = _initializeContext.getUri(); + final String fileUri = this.initializeContext(configuration).getUri(); TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams(); final Procedure1 _function = (TextDocumentPositionParams it) -> { TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri); @@ -782,14 +698,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint { Procedure1 _assertSignatureHelp = configuration.getAssertSignatureHelp(); boolean _tripleNotEquals = (_assertSignatureHelp != null); if (_tripleNotEquals) { - Procedure1 _assertSignatureHelp_1 = configuration.getAssertSignatureHelp(); - _assertSignatureHelp_1.apply(signatureHelp); + configuration.getAssertSignatureHelp().apply(signatureHelp); } else { final String actualSignatureHelp = this.toExpectation(signatureHelp); - String _expectedSignatureHelp = configuration.getExpectedSignatureHelp(); - String _trim = _expectedSignatureHelp.trim(); - String _trim_1 = actualSignatureHelp.trim(); - this.assertEquals(_trim, _trim_1); + this.assertEquals(configuration.getExpectedSignatureHelp().trim(), actualSignatureHelp.trim()); } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -808,8 +720,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { @Extension final DocumentHighlightConfiguration configuration = ObjectExtensions.operator_doubleArrow(_documentHighlightConfiguration, _function); configurator.apply(configuration); - FileInfo _initializeContext = this.initializeContext(configuration); - final String fileUri = _initializeContext.getUri(); + final String fileUri = this.initializeContext(configuration).getUri(); TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams(); final Procedure1 _function_1 = (TextDocumentPositionParams it) -> { TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri); @@ -821,14 +732,11 @@ public abstract class AbstractLanguageServerTest implements Endpoint { }; TextDocumentPositionParams _doubleArrow = ObjectExtensions.operator_doubleArrow(_textDocumentPositionParams, _function_1); final CompletableFuture> highlights = this.languageServer.documentHighlight(_doubleArrow); - List _get = highlights.get(); final Function1 _function_2 = (DocumentHighlight it) -> { return this.toExpectation(it); }; - List _map = ListExtensions.map(_get, _function_2); - final String actualDocumentHighlight = IterableExtensions.join(_map, " | "); - String _expectedDocumentHighlight = configuration.getExpectedDocumentHighlight(); - this.assertEquals(_expectedDocumentHighlight, actualDocumentHighlight); + final String actualDocumentHighlight = IterableExtensions.join(ListExtensions.map(highlights.get(), _function_2), " | "); + this.assertEquals(configuration.getExpectedDocumentHighlight(), actualDocumentHighlight); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -840,8 +748,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { final DocumentSymbolConfiguraiton configuration = new DocumentSymbolConfiguraiton(); configuration.setFilePath(("MyModel." + this.fileExtension)); configurator.apply(configuration); - FileInfo _initializeContext = this.initializeContext(configuration); - final String fileUri = _initializeContext.getUri(); + final String fileUri = this.initializeContext(configuration).getUri(); TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri); DocumentSymbolParams _documentSymbolParams = new DocumentSymbolParams(_textDocumentIdentifier); final CompletableFuture> symbolsFuture = this.languageServer.documentSymbol(_documentSymbolParams); @@ -849,12 +756,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint { Procedure1> _assertSymbols = configuration.getAssertSymbols(); boolean _tripleNotEquals = (_assertSymbols != null); if (_tripleNotEquals) { - Procedure1> _assertSymbols_1 = configuration.getAssertSymbols(); - _assertSymbols_1.apply(symbols); + configuration.getAssertSymbols().apply(symbols); } else { final String actualSymbols = this.toExpectation(symbols); - String _expectedSymbols = configuration.getExpectedSymbols(); - this.assertEquals(_expectedSymbols, actualSymbols); + this.assertEquals(configuration.getExpectedSymbols(), actualSymbols); } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -870,17 +775,14 @@ public abstract class AbstractLanguageServerTest implements Endpoint { this.initializeContext(configuration); String _query = configuration.getQuery(); WorkspaceSymbolParams _workspaceSymbolParams = new WorkspaceSymbolParams(_query); - CompletableFuture> _symbol = this.languageServer.symbol(_workspaceSymbolParams); - final List symbols = _symbol.get(); + final List symbols = this.languageServer.symbol(_workspaceSymbolParams).get(); Procedure1> _assertSymbols = configuration.getAssertSymbols(); boolean _tripleNotEquals = (_assertSymbols != null); if (_tripleNotEquals) { - Procedure1> _assertSymbols_1 = configuration.getAssertSymbols(); - _assertSymbols_1.apply(symbols); + configuration.getAssertSymbols().apply(symbols); } else { final String actualSymbols = this.toExpectation(symbols); - String _expectedSymbols = configuration.getExpectedSymbols(); - this.assertEquals(_expectedSymbols, actualSymbols); + this.assertEquals(configuration.getExpectedSymbols(), actualSymbols); } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -893,8 +795,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { final ReferenceTestConfiguration configuration = new ReferenceTestConfiguration(); configuration.setFilePath(("MyModel." + this.fileExtension)); configurator.apply(configuration); - FileInfo _initializeContext = this.initializeContext(configuration); - final String fileUri = _initializeContext.getUri(); + final String fileUri = this.initializeContext(configuration).getUri(); ReferenceParams _referenceParams = new ReferenceParams(); final Procedure1 _function = (ReferenceParams it) -> { TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri); @@ -913,12 +814,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint { Procedure1> _assertReferences = configuration.getAssertReferences(); boolean _tripleNotEquals = (_assertReferences != null); if (_tripleNotEquals) { - Procedure1> _assertReferences_1 = configuration.getAssertReferences(); - _assertReferences_1.apply(references); + configuration.getAssertReferences().apply(references); } else { final String actualReferences = this.toExpectation(references); - String _expectedReferences = configuration.getExpectedReferences(); - this.assertEquals(_expectedReferences, actualReferences); + this.assertEquals(configuration.getExpectedReferences(), actualReferences); } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -926,9 +825,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint { } public void assertEquals(final String expected, final String actual) { - String _replace = expected.replace("\t", " "); - String _replace_1 = actual.replace("\t", " "); - Assert.assertEquals(_replace, _replace_1); + Assert.assertEquals(expected.replace("\t", " "), actual.replace("\t", " ")); } protected void testFormatting(final Procedure1 configurator) { @@ -947,14 +844,8 @@ public abstract class AbstractLanguageServerTest implements Endpoint { DocumentFormattingParams _doubleArrow = ObjectExtensions.operator_doubleArrow(_documentFormattingParams, _function); final CompletableFuture> changes = this.languageServer.formatting(_doubleArrow); String _contents = fileInfo.getContents(); - Document _document = new Document(1, _contents); - List _get = changes.get(); - ArrayList _newArrayList = CollectionLiterals.newArrayList(((TextEdit[])Conversions.unwrapArray(_get, TextEdit.class))); - List _reverse = ListExtensions.reverse(_newArrayList); - final Document result = _document.applyChanges(_reverse); - String _expectedText = configuration.getExpectedText(); - String _contents_1 = result.getContents(); - this.assertEquals(_expectedText, _contents_1); + final Document result = new Document(1, _contents).applyChanges(ListExtensions.reverse(CollectionLiterals.newArrayList(((TextEdit[])Conversions.unwrapArray(changes.get(), TextEdit.class))))); + this.assertEquals(configuration.getExpectedText(), result.getContents()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -972,20 +863,13 @@ public abstract class AbstractLanguageServerTest implements Endpoint { String _uri = fileInfo.getUri(); TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(_uri); it.setTextDocument(_textDocumentIdentifier); - Range _range = configuration.getRange(); - it.setRange(_range); + it.setRange(configuration.getRange()); }; DocumentRangeFormattingParams _doubleArrow = ObjectExtensions.operator_doubleArrow(_documentRangeFormattingParams, _function); final CompletableFuture> changes = this.languageServer.rangeFormatting(_doubleArrow); String _contents = fileInfo.getContents(); - Document _document = new Document(1, _contents); - List _get = changes.get(); - ArrayList _newArrayList = CollectionLiterals.newArrayList(((TextEdit[])Conversions.unwrapArray(_get, TextEdit.class))); - List _reverse = ListExtensions.reverse(_newArrayList); - final Document result = _document.applyChanges(_reverse); - String _expectedText = configuration.getExpectedText(); - String _contents_1 = result.getContents(); - this.assertEquals(_expectedText, _contents_1); + final Document result = new Document(1, _contents).applyChanges(ListExtensions.reverse(CollectionLiterals.newArrayList(((TextEdit[])Conversions.unwrapArray(changes.get(), TextEdit.class))))); + this.assertEquals(configuration.getExpectedText(), result.getContents()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -1007,12 +891,9 @@ public abstract class AbstractLanguageServerTest implements Endpoint { final Function1, Object> _function = (Pair it) -> { return it.getValue(); }; - List _map = ListExtensions., Object>map(this.notifications, _function); - Iterable _filter = Iterables.filter(_map, PublishDiagnosticsParams.class); + Iterable _filter = Iterables.filter(ListExtensions., Object>map(this.notifications, _function), PublishDiagnosticsParams.class); for (final PublishDiagnosticsParams diagnostic : _filter) { - String _uri = diagnostic.getUri(); - List _diagnostics = diagnostic.getDiagnostics(); - result.put(_uri, _diagnostics); + result.put(diagnostic.getUri(), diagnostic.getDiagnostics()); } return result; } @@ -1021,15 +902,13 @@ public abstract class AbstractLanguageServerTest implements Endpoint { final Function1, Object> _function = (Pair it) -> { return it.getValue(); }; - List _map = ListExtensions., Object>map(this.notifications, _function); - Iterable _filter = Iterables.filter(_map, ColoringParams.class); final Function1 _function_1 = (ColoringParams it) -> { return it.getUri(); }; final Function1> _function_2 = (ColoringParams it) -> { return it.getInfos(); }; - return IterableExtensions.>toMap(_filter, _function_1, _function_2); + return IterableExtensions.>toMap(Iterables.filter(ListExtensions., Object>map(this.notifications, _function), ColoringParams.class), _function_1, _function_2); } protected String toExpectation(final Object it) { diff --git a/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/builder/AbstractIncrementalBuilderTest.java b/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/builder/AbstractIncrementalBuilderTest.java index 23c58fbc0..53dc1927e 100644 --- a/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/builder/AbstractIncrementalBuilderTest.java +++ b/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/builder/AbstractIncrementalBuilderTest.java @@ -15,7 +15,6 @@ import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.name.Named; import java.io.OutputStream; -import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; @@ -23,7 +22,6 @@ import java.util.Set; 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.URIConverter; import org.eclipse.emf.ecore.resource.URIHandler; import org.eclipse.xtext.Constants; import org.eclipse.xtext.build.BuildRequest; @@ -94,12 +92,9 @@ public abstract class AbstractIncrementalBuilderTest { protected List clean() { List _xblockexpression = null; { - ArrayListMultimap _create = ArrayListMultimap.create(); - this.generated = _create; - ArrayList _newArrayList = CollectionLiterals.newArrayList(); - this.deleted = _newArrayList; - ArrayList _newArrayList_1 = CollectionLiterals.newArrayList(); - _xblockexpression = this.issues = _newArrayList_1; + this.generated = ArrayListMultimap.create(); + this.deleted = CollectionLiterals.newArrayList(); + _xblockexpression = this.issues = CollectionLiterals.newArrayList(); } return _xblockexpression; } @@ -107,23 +102,18 @@ public abstract class AbstractIncrementalBuilderTest { protected IndexState build(final BuildRequest buildRequest) { this.clean(); final Function1 _function = (URI it) -> { - IResourceServiceProvider.Registry _languages = this.getLanguages(); - return _languages.getResourceServiceProvider(it); + return this.getLanguages().getResourceServiceProvider(it); }; - IncrementalBuilder.Result _build = this.incrementalBuilder.build(buildRequest, _function); - IndexState _indexState = _build.getIndexState(); - this.indexState = _indexState; + this.indexState = this.incrementalBuilder.build(buildRequest, _function).getIndexState(); return this.indexState; } protected void withOutputConfig(final BuildRequest it, final Procedure1 init) { - Set _outputConfigurations = this.configurationProvider.getOutputConfigurations(); - final OutputConfiguration config = IterableExtensions.head(_outputConfigurations); + final OutputConfiguration config = IterableExtensions.head(this.configurationProvider.getOutputConfigurations()); init.apply(config); Pair> _mappedTo = Pair.>of(this.languageName, Collections.unmodifiableSet(CollectionLiterals.newHashSet(config))); final OutputConfigurationAdapter adapter = new OutputConfigurationAdapter(Collections.>unmodifiableMap(CollectionLiterals.>newHashMap(_mappedTo))); - XtextResourceSet _resourceSet = it.getResourceSet(); - EList _eAdapters = _resourceSet.eAdapters(); + EList _eAdapters = it.getResourceSet().eAdapters(); _eAdapters.add(adapter); } @@ -132,20 +122,14 @@ public abstract class AbstractIncrementalBuilderTest { protected BuildRequest newBuildRequest(final Procedure1 init) { BuildRequest _buildRequest = new BuildRequest(); final Procedure1 _function = (BuildRequest it) -> { - ResourceDescriptionsData _resourceDescriptions = this.indexState.getResourceDescriptions(); - final ResourceDescriptionsData newIndex = _resourceDescriptions.copy(); - URI _uri = this.uri(""); - it.setBaseDir(_uri); + final ResourceDescriptionsData newIndex = this.indexState.getResourceDescriptions().copy(); + it.setBaseDir(this.uri("")); XtextResourceSet _get = this.resourceSetProvider.get(); final Procedure1 _function_1 = (XtextResourceSet it_1) -> { - URIConverter _uRIConverter = it_1.getURIConverter(); - EList _uRIHandlers = _uRIConverter.getURIHandlers(); - _uRIHandlers.clear(); - URIConverter _uRIConverter_1 = it_1.getURIConverter(); - EList _uRIHandlers_1 = _uRIConverter_1.getURIHandlers(); - _uRIHandlers_1.add(this.inMemoryURIHandler); - ClassLoader _classLoader = AbstractIncrementalBuilderTest.class.getClassLoader(); - it_1.setClasspathURIContext(_classLoader); + it_1.getURIConverter().getURIHandlers().clear(); + EList _uRIHandlers = it_1.getURIConverter().getURIHandlers(); + _uRIHandlers.add(this.inMemoryURIHandler); + it_1.setClasspathURIContext(AbstractIncrementalBuilderTest.class.getClassLoader()); ProjectDescription _projectDescription = new ProjectDescription(); final Procedure1 _function_2 = (ProjectDescription it_2) -> { it_2.setName("test-project"); @@ -154,8 +138,7 @@ public abstract class AbstractIncrementalBuilderTest { projectDescription.attachToEmfObject(it_1); Map _emptyMap = CollectionLiterals.emptyMap(); final ChunkedResourceDescriptions index = new ChunkedResourceDescriptions(_emptyMap, it_1); - String _name = projectDescription.getName(); - index.setContainer(_name, newIndex); + index.setContainer(projectDescription.getName(), newIndex); }; XtextResourceSet _doubleArrow = ObjectExtensions.operator_doubleArrow(_get, _function_1); it.setResourceSet(_doubleArrow); @@ -174,8 +157,7 @@ public abstract class AbstractIncrementalBuilderTest { this.generated.put(source, target); }; it.setAfterGenerateFile(_function_4); - Source2GeneratedMapping _fileMappings = this.indexState.getFileMappings(); - Source2GeneratedMapping _copy = _fileMappings.copy(); + Source2GeneratedMapping _copy = this.indexState.getFileMappings().copy(); IndexState _indexState = new IndexState(newIndex, _copy); it.setState(_indexState); }; @@ -186,8 +168,7 @@ public abstract class AbstractIncrementalBuilderTest { protected URI delete(final URI uri) { try { - Map _emptyMap = CollectionLiterals.emptyMap(); - this.inMemoryURIHandler.delete(uri, _emptyMap); + this.inMemoryURIHandler.delete(uri, CollectionLiterals.emptyMap()); return uri; } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -201,12 +182,10 @@ public abstract class AbstractIncrementalBuilderTest { protected URI operator_minus(final String path, final String content) { try { final URI uri = this.uri(path); - Map _emptyMap = CollectionLiterals.emptyMap(); - OutputStream _createOutputStream = this.inMemoryURIHandler.createOutputStream(uri, _emptyMap); + OutputStream _createOutputStream = this.inMemoryURIHandler.createOutputStream(uri, CollectionLiterals.emptyMap()); final Procedure1 _function = (OutputStream it) -> { try { - byte[] _bytes = content.getBytes(); - it.write(_bytes); + it.write(content.getBytes()); it.close(); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -222,8 +201,7 @@ public abstract class AbstractIncrementalBuilderTest { protected boolean containsSuffix(final Iterable uris, final String... suffixes) { final Function1 _function = (String suffix) -> { final Function1 _function_1 = (URI uri) -> { - String _string = uri.toString(); - return Boolean.valueOf(_string.endsWith(suffix)); + return Boolean.valueOf(uri.toString().endsWith(suffix)); }; return Boolean.valueOf(IterableExtensions.exists(uris, _function_1)); }; diff --git a/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/logging/LoggingTester.java b/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/logging/LoggingTester.java index ca38571fb..4d0302699 100644 --- a/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/logging/LoggingTester.java +++ b/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/logging/LoggingTester.java @@ -13,7 +13,6 @@ import com.google.common.primitives.Longs; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; -import java.util.Enumeration; import java.util.List; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @@ -360,8 +359,7 @@ public class LoggingTester { logger.addAppender(appender); logger.setLevel(level); action.run(); - List _list = IterableExtensions.toList(appender.events); - final List events = IterableExtensions.sortWith(_list, LoggingTester.TEMPORAL_ORDER); + final List events = IterableExtensions.sortWith(IterableExtensions.toList(appender.events), LoggingTester.TEMPORAL_ORDER); return new LoggingTester.LogCapture(events); } finally { logger.removeAppender(appender); @@ -378,9 +376,7 @@ public class LoggingTester { { final ArrayList appenders = CollectionLiterals.newArrayList(); for (Category current = logger; (current != null); current = current.getParent()) { - Enumeration _allAppenders = current.getAllAppenders(); - ArrayList _list = Collections.list(_allAppenders); - appenders.addAll(_list); + appenders.addAll(Collections.list(current.getAllAppenders())); } _xblockexpression = appenders; } @@ -392,15 +388,13 @@ public class LoggingTester { boolean _equals = Objects.equal(_filter, filter); if (_equals) { appender.clearFilters(); - Filter _next = filter.getNext(); - appender.addFilter(_next); + appender.addFilter(filter.getNext()); } else { for (Filter current = appender.getFilter(); (current != null); current = current.getNext()) { - Filter _next_1 = current.getNext(); - boolean _equals_1 = Objects.equal(_next_1, filter); + Filter _next = current.getNext(); + boolean _equals_1 = Objects.equal(_next, filter); if (_equals_1) { - Filter _next_2 = filter.getNext(); - current.setNext(_next_2); + current.setNext(filter.getNext()); return; } } diff --git a/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/util/InMemoryURIHandler.java b/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/util/InMemoryURIHandler.java index aaea583fb..38d3549ac 100644 --- a/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/util/InMemoryURIHandler.java +++ b/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/util/InMemoryURIHandler.java @@ -104,14 +104,12 @@ public class InMemoryURIHandler implements URIHandler { @Override public InputStream createInputStream(final URI uri, final Map options) throws IOException { - InMemoryURIHandler.InMemFile _inMemoryFile = this.getInMemoryFile(uri); - return _inMemoryFile.createInputStream(); + return this.getInMemoryFile(uri).createInputStream(); } @Override public OutputStream createOutputStream(final URI uri, final Map options) throws IOException { - InMemoryURIHandler.InMemFile _inMemoryFile = this.getInMemoryFile(uri); - return _inMemoryFile.createOutputstream(); + return this.getInMemoryFile(uri).createOutputstream(); } @Override @@ -122,8 +120,7 @@ public class InMemoryURIHandler implements URIHandler { @Override public boolean exists(final URI uri, final Map options) { - InMemoryURIHandler.InMemFile _inMemoryFile = this.getInMemoryFile(uri); - return _inMemoryFile.exists; + return this.getInMemoryFile(uri).exists; } @Override diff --git a/org.eclipse.xtext.tests/generator/xtend-gen/org/eclipse/xtext/tests/ImportURIScopingFragment2.java b/org.eclipse.xtext.tests/generator/xtend-gen/org/eclipse/xtext/tests/ImportURIScopingFragment2.java index 85b8736b2..5251e7963 100644 --- a/org.eclipse.xtext.tests/generator/xtend-gen/org/eclipse/xtext/tests/ImportURIScopingFragment2.java +++ b/org.eclipse.xtext.tests/generator/xtend-gen/org/eclipse/xtext/tests/ImportURIScopingFragment2.java @@ -8,11 +8,9 @@ package org.eclipse.xtext.tests; import com.google.inject.Inject; -import org.eclipse.xtext.Grammar; import org.eclipse.xtext.scoping.impl.ImportUriGlobalScopeProvider; import org.eclipse.xtext.scoping.impl.SimpleLocalScopeProvider; import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2; import org.eclipse.xtext.xtext.generator.xbase.XbaseUsageDetector; @@ -26,9 +24,7 @@ public class ImportURIScopingFragment2 extends ImportNamespacesScopingFragment2 @Override public TypeReference getDelegateScopeProvider() { TypeReference _xifexpression = null; - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(_grammar); + boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getLanguage().getGrammar()); if (_inheritsXbase) { _xifexpression = TypeReference.typeRef("org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider"); } else { diff --git a/org.eclipse.xtext.tests/generator/xtend-gen/org/eclipse/xtext/tests/TestsEMFGeneratorFragment.java b/org.eclipse.xtext.tests/generator/xtend-gen/org/eclipse/xtext/tests/TestsEMFGeneratorFragment.java index 5ec28ec5d..b4d1a7650 100644 --- a/org.eclipse.xtext.tests/generator/xtend-gen/org/eclipse/xtext/tests/TestsEMFGeneratorFragment.java +++ b/org.eclipse.xtext.tests/generator/xtend-gen/org/eclipse/xtext/tests/TestsEMFGeneratorFragment.java @@ -39,11 +39,7 @@ public class TestsEMFGeneratorFragment extends EMFGeneratorFragment2 { } else { String _javaModelDirectory = this.getJavaModelDirectory(); String _plus = (_javaModelDirectory + "/"); - String _name = grammar.getName(); - String _name_1 = grammar.getName(); - int _lastIndexOf = _name_1.lastIndexOf("."); - String _substring = _name.substring(0, _lastIndexOf); - String _replace = _substring.replace(".", "/"); + String _replace = grammar.getName().substring(0, grammar.getName().lastIndexOf(".")).replace(".", "/"); String _plus_1 = (_plus + _replace); String _plus_2 = (_plus_1 + "/"); String _modelName = this.getModelName(grammar); @@ -63,11 +59,7 @@ public class TestsEMFGeneratorFragment extends EMFGeneratorFragment2 { } else { String _javaModelDirectory = this.getJavaModelDirectory(); String _plus = (_javaModelDirectory + "/"); - String _name = grammar.getName(); - String _name_1 = grammar.getName(); - int _lastIndexOf = _name_1.lastIndexOf("."); - String _substring = _name.substring(0, _lastIndexOf); - String _replace = _substring.replace(".", "/"); + String _replace = grammar.getName().substring(0, grammar.getName().lastIndexOf(".")).replace(".", "/"); String _plus_1 = (_plus + _replace); String _plus_2 = (_plus_1 + "/"); String _modelName = this.getModelName(grammar); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/GrammarUtilTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/GrammarUtilTest.java index 4210273c5..34cb5ea82 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/GrammarUtilTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/GrammarUtilTest.java @@ -9,8 +9,6 @@ package org.eclipse.xtext; import java.util.Collections; import java.util.List; -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.EReference; @@ -29,7 +27,6 @@ import org.eclipse.xtext.ReferencedMetamodel; import org.eclipse.xtext.XtextStandaloneSetup; import org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup; import org.eclipse.xtext.linking.langATestLanguage.Main; -import org.eclipse.xtext.linking.langATestLanguage.Type; import org.eclipse.xtext.linking.services.LangATestLanguageGrammarAccess; import org.eclipse.xtext.resource.XtextResource; import org.eclipse.xtext.tests.AbstractXtextTests; @@ -63,11 +60,9 @@ public class GrammarUtilTest extends AbstractXtextTests { _builder.newLine(); String model = _builder.toString(); final XtextResource r = this.getResourceFromString(model); - EList _contents = r.getContents(); - EObject _get = _contents.get(0); + EObject _get = r.getContents().get(0); final Grammar grammar = ((Grammar) _get); - EList _rules = grammar.getRules(); - final AbstractRule rule = IterableExtensions.head(_rules); + final AbstractRule rule = IterableExtensions.head(grammar.getRules()); final AbstractElement fragmentCall = rule.getAlternatives(); final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall); Assert.assertEquals("Rule", currentType.getName()); @@ -90,11 +85,9 @@ public class GrammarUtilTest extends AbstractXtextTests { _builder.newLine(); String model = _builder.toString(); final XtextResource r = this.getResourceFromString(model); - EList _contents = r.getContents(); - EObject _get = _contents.get(0); + EObject _get = r.getContents().get(0); final Grammar grammar = ((Grammar) _get); - EList _rules = grammar.getRules(); - final AbstractRule rule = IterableExtensions.head(_rules); + final AbstractRule rule = IterableExtensions.head(grammar.getRules()); final AbstractElement fragmentCall = rule.getAlternatives(); final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall); Assert.assertEquals("SubRule", currentType.getName()); @@ -119,11 +112,9 @@ public class GrammarUtilTest extends AbstractXtextTests { _builder.newLine(); String model = _builder.toString(); final XtextResource r = this.getResourceFromString(model); - EList _contents = r.getContents(); - EObject _get = _contents.get(0); + EObject _get = r.getContents().get(0); final Grammar grammar = ((Grammar) _get); - EList _rules = grammar.getRules(); - final AbstractRule rule = IterableExtensions.head(_rules); + final AbstractRule rule = IterableExtensions.head(grammar.getRules()); final AbstractElement fragmentCall = rule.getAlternatives(); final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall); Assert.assertEquals("SubRule", currentType.getName()); @@ -148,11 +139,9 @@ public class GrammarUtilTest extends AbstractXtextTests { _builder.newLine(); String model = _builder.toString(); final XtextResource r = this.getResourceFromString(model); - EList _contents = r.getContents(); - EObject _get = _contents.get(0); + EObject _get = r.getContents().get(0); final Grammar grammar = ((Grammar) _get); - EList _rules = grammar.getRules(); - final AbstractRule rule = IterableExtensions.head(_rules); + final AbstractRule rule = IterableExtensions.head(grammar.getRules()); final AbstractElement fragmentCall = rule.getAlternatives(); final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall); Assert.assertEquals("Rule", currentType.getName()); @@ -180,11 +169,9 @@ public class GrammarUtilTest extends AbstractXtextTests { _builder.newLine(); String model = _builder.toString(); final XtextResource r = this.getResourceFromString(model); - EList _contents = r.getContents(); - EObject _get = _contents.get(0); + EObject _get = r.getContents().get(0); final Grammar grammar = ((Grammar) _get); - EList _rules = grammar.getRules(); - final AbstractRule rule = IterableExtensions.head(_rules); + final AbstractRule rule = IterableExtensions.head(grammar.getRules()); final AbstractElement fragmentCall = rule.getAlternatives(); final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall); Assert.assertEquals("Rule", currentType.getName()); @@ -212,14 +199,11 @@ public class GrammarUtilTest extends AbstractXtextTests { _builder.newLine(); String model = _builder.toString(); final XtextResource r = this.getResourceFromString(model); - EList _contents = r.getContents(); - EObject _get = _contents.get(0); + EObject _get = r.getContents().get(0); final Grammar grammar = ((Grammar) _get); - EList _rules = grammar.getRules(); - final AbstractRule rule = IterableExtensions.last(_rules); + final AbstractRule rule = IterableExtensions.last(grammar.getRules()); AbstractElement _alternatives = rule.getAlternatives(); - EList _elements = ((Group) _alternatives).getElements(); - final AbstractElement fragmentCall = IterableExtensions.last(_elements); + final AbstractElement fragmentCall = IterableExtensions.last(((Group) _alternatives).getElements()); final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall); Assert.assertEquals("Rule", currentType.getName()); } @@ -241,15 +225,15 @@ public class GrammarUtilTest extends AbstractXtextTests { _builder.newLine(); String model = _builder.toString(); final XtextResource r = this.getResourceFromString(model); - EList _contents = r.getContents(); - EObject _get = _contents.get(0); + EObject _get = r.getContents().get(0); final Grammar grammar = ((Grammar) _get); final List allRules = GrammarUtil.allRules(grammar); + final Function1 _function = (AbstractRule it) -> { + return it.getName(); + }; Assert.assertEquals( Collections.unmodifiableList(CollectionLiterals.newArrayList("Rule", "STRING", "ID", "INT", "STRING", "ML_COMMENT", "SL_COMMENT", "WS", "ANY_OTHER")).toString(), - ListExtensions.map(allRules, ((Function1) (AbstractRule it) -> { - return it.getName(); - })).toString()); + ListExtensions.map(allRules, _function).toString()); } @Test @@ -269,8 +253,7 @@ public class GrammarUtilTest extends AbstractXtextTests { _builder.newLine(); String model = _builder.toString(); XtextResource r = this.getResourceFromString(model); - EList _contents = r.getContents(); - EObject _get = _contents.get(0); + EObject _get = r.getContents().get(0); Grammar grammar = ((Grammar) _get); Assert.assertEquals(grammar, GrammarUtil.findRuleForName(grammar, "Rule").eContainer()); Assert.assertNull(GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.Rule")); @@ -293,8 +276,7 @@ public class GrammarUtilTest extends AbstractXtextTests { _builder.newLine(); String model = _builder.toString(); Resource r = this.getResourceFromString(model); - EList _contents = r.getContents(); - EObject _get = _contents.get(0); + EObject _get = r.getContents().get(0); Grammar g = ((Grammar) _get); List decls = GrammarUtil.allMetamodelDeclarations(g); Assert.assertEquals(2, decls.size()); @@ -323,8 +305,7 @@ public class GrammarUtilTest extends AbstractXtextTests { _builder.newLine(); String model = _builder.toString(); Resource r = this.getResourceFromString(model); - EList _contents = r.getContents(); - EObject _get = _contents.get(0); + EObject _get = r.getContents().get(0); Grammar g = ((Grammar) _get); List decls = GrammarUtil.allMetamodelDeclarations(g); Assert.assertEquals(3, decls.size()); @@ -342,8 +323,7 @@ public class GrammarUtilTest extends AbstractXtextTests { Assert.assertNotNull(decl.getEPackage()); Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", decl.getEPackage().getNsURI()); Assert.assertEquals("ecore", decl.getAlias()); - EList _rules = g.getRules(); - AbstractRule abstractRule = _rules.get(0); + AbstractRule abstractRule = g.getRules().get(0); Assert.assertSame(decls.get(1), abstractRule.getType().getMetamodel()); } @@ -361,8 +341,7 @@ public class GrammarUtilTest extends AbstractXtextTests { _builder.newLine(); String model = _builder.toString(); Resource r = this.getResourceFromString(model); - EList _contents = r.getContents(); - EObject _get = _contents.get(0); + EObject _get = r.getContents().get(0); Grammar g = ((Grammar) _get); List decls = GrammarUtil.allMetamodelDeclarations(g); Assert.assertEquals(3, decls.size()); @@ -381,8 +360,7 @@ public class GrammarUtilTest extends AbstractXtextTests { Assert.assertNotNull(decl.getEPackage()); Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", decl.getEPackage().getNsURI()); Assert.assertEquals("ecore", decl.getAlias()); - EList _rules = g.getRules(); - AbstractRule abstractRule = _rules.get(0); + AbstractRule abstractRule = g.getRules().get(0); Assert.assertSame(decls.get(0), abstractRule.getType().getMetamodel()); } @@ -390,17 +368,13 @@ public class GrammarUtilTest extends AbstractXtextTests { public void testGetReference() throws Exception { this.with(LangATestLanguageStandaloneSetup.class); XtextResource resource = this.getResourceFromStringAndExpect("type A extends B", 1); - LangATestLanguageGrammarAccess _get = this.get(LangATestLanguageGrammarAccess.class); - LangATestLanguageGrammarAccess.TypeElements _typeAccess = _get.getTypeAccess(); - Assignment asExtends = _typeAccess.getExtendsAssignment_2_1(); + Assignment asExtends = this.get(LangATestLanguageGrammarAccess.class).getTypeAccess().getExtendsAssignment_2_1(); AbstractElement _terminal = asExtends.getTerminal(); CrossReference xref = ((CrossReference) _terminal); EObject _model = this.getModel(resource); Main model = ((Main) _model); - EList _types = model.getTypes(); - EObject typeA = _types.get(0); - EClass _eClass = typeA.eClass(); - EReference ref = GrammarUtil.getReference(xref, _eClass); + EObject typeA = model.getTypes().get(0); + EReference ref = GrammarUtil.getReference(xref, typeA.eClass()); Assert.assertNotNull(ref); Assert.assertEquals("extends", ref.getName()); Assert.assertFalse(ref.isMany()); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/build/IncrementalBuilderTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/build/IncrementalBuilderTest.java index 16f28a065..8439f9f50 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/build/IncrementalBuilderTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/build/IncrementalBuilderTest.java @@ -8,21 +8,16 @@ package org.eclipse.xtext.build; import com.google.inject.Inject; -import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.emf.common.util.URI; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.build.BuildRequest; import org.eclipse.xtext.build.IndexState; -import org.eclipse.xtext.build.Source2GeneratedMapping; import org.eclipse.xtext.generator.OutputConfiguration; import org.eclipse.xtext.index.IndexTestLanguageInjectorProvider; -import org.eclipse.xtext.resource.IResourceDescription; import org.eclipse.xtext.resource.IResourceServiceProvider; -import org.eclipse.xtext.resource.impl.ResourceDescriptionsData; import org.eclipse.xtext.testing.InjectWith; import org.eclipse.xtext.testing.XtextRunner; import org.eclipse.xtext.testing.builder.AbstractIncrementalBuilderTest; @@ -96,38 +91,23 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest { }; final BuildRequest buildRequest = this.newBuildRequest(_function); this.build(buildRequest); - String _string = this.issues.toString(); - boolean _isEmpty = this.issues.isEmpty(); - Assert.assertTrue(_string, _isEmpty); - int _size = this.generated.size(); - Assert.assertEquals(2, _size); - Collection _values = this.generated.values(); - boolean _containsSuffix = this.containsSuffix(_values, "src-gen/B.txt"); - Assert.assertTrue(_containsSuffix); - Collection _values_1 = this.generated.values(); - boolean _containsSuffix_1 = this.containsSuffix(_values_1, "src-gen/A.txt"); - Assert.assertTrue(_containsSuffix_1); + Assert.assertTrue(this.issues.toString(), this.issues.isEmpty()); + Assert.assertEquals(2, this.generated.size()); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt")); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt")); final Procedure1 _function_1 = (BuildRequest it) -> { final Procedure1 _function_2 = (OutputConfiguration it_1) -> { it_1.setCleanUpDerivedResources(false); }; this.withOutputConfig(it, _function_2); - URI _uri = this.uri("src/A.indextestlanguage"); - URI _delete = this.delete(_uri); + URI _delete = this.delete(this.uri("src/A.indextestlanguage")); it.setDeletedFiles(Collections.unmodifiableList(CollectionLiterals.newArrayList(_delete))); }; this.newBuildRequest(_function_1); - String _string_1 = this.issues.toString(); - boolean _isEmpty_1 = this.issues.isEmpty(); - Assert.assertTrue(_string_1, _isEmpty_1); - int _size_1 = this.generated.size(); - Assert.assertEquals(2, _size_1); - Collection _values_2 = this.generated.values(); - boolean _containsSuffix_2 = this.containsSuffix(_values_2, "src-gen/B.txt"); - Assert.assertTrue(_containsSuffix_2); - Collection _values_3 = this.generated.values(); - boolean _containsSuffix_3 = this.containsSuffix(_values_3, "src-gen/A.txt"); - Assert.assertTrue(_containsSuffix_3); + Assert.assertTrue(this.issues.toString(), this.issues.isEmpty()); + Assert.assertEquals(2, this.generated.size()); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt")); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt")); } @Test @@ -154,17 +134,10 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest { }; final BuildRequest buildRequest = this.newBuildRequest(_function); this.build(buildRequest); - String _string = this.issues.toString(); - boolean _isEmpty = this.issues.isEmpty(); - Assert.assertTrue(_string, _isEmpty); - int _size = this.generated.size(); - Assert.assertEquals(2, _size); - Collection _values = this.generated.values(); - boolean _containsSuffix = this.containsSuffix(_values, "src-gen/B.txt"); - Assert.assertTrue(_containsSuffix); - Collection _values_1 = this.generated.values(); - boolean _containsSuffix_1 = this.containsSuffix(_values_1, "src-gen/A.txt"); - Assert.assertTrue(_containsSuffix_1); + Assert.assertTrue(this.issues.toString(), this.issues.isEmpty()); + Assert.assertEquals(2, this.generated.size()); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt")); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt")); final Procedure1 _function_1 = (BuildRequest it) -> { final Procedure1 _function_2 = (OutputConfiguration it_1) -> { it_1.setOverrideExistingResources(false); @@ -212,17 +185,10 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest { }; final BuildRequest buildRequest = this.newBuildRequest(_function); this.build(buildRequest); - String _string = this.issues.toString(); - boolean _isEmpty = this.issues.isEmpty(); - Assert.assertTrue(_string, _isEmpty); - int _size = this.generated.size(); - Assert.assertEquals(2, _size); - Collection _values = this.generated.values(); - boolean _containsSuffix = this.containsSuffix(_values, "src-gen/B.txt"); - Assert.assertTrue(_containsSuffix); - Collection _values_1 = this.generated.values(); - boolean _containsSuffix_1 = this.containsSuffix(_values_1, "src-gen/A.txt"); - Assert.assertTrue(_containsSuffix_1); + Assert.assertTrue(this.issues.toString(), this.issues.isEmpty()); + Assert.assertEquals(2, this.generated.size()); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt")); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt")); } @Test(expected = OperationCanceledException.class) @@ -283,10 +249,7 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest { }; final BuildRequest buildRequest = this.newBuildRequest(_function); final IndexState result = this.build(buildRequest); - ResourceDescriptionsData _resourceDescriptions = result.getResourceDescriptions(); - Iterable _allResourceDescriptions = _resourceDescriptions.getAllResourceDescriptions(); - int _size = IterableExtensions.size(_allResourceDescriptions); - Assert.assertEquals(1, _size); + Assert.assertEquals(1, IterableExtensions.size(result.getResourceDescriptions().getAllResourceDescriptions())); } @Test @@ -314,29 +277,21 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest { "src/B.indextestlanguage", _builder_1.toString()); it.setDirtyFiles(Collections.unmodifiableList(CollectionLiterals.newArrayList(_minus, _minus_1))); }; - BuildRequest _newBuildRequest = this.newBuildRequest(_function); - this.build(_newBuildRequest); + this.build(this.newBuildRequest(_function)); final AtomicBoolean validateCalled = new AtomicBoolean(false); final Procedure1 _function_1 = (BuildRequest it) -> { URI _uri = this.uri("src/B.indextestlanguage"); it.setDeletedFiles(Collections.unmodifiableList(CollectionLiterals.newArrayList(_uri))); final BuildRequest.IPostValidationCallback _function_2 = (URI uri, Iterable issues) -> { - URI _uri_1 = this.uri("src/A.indextestlanguage"); - Assert.assertEquals(_uri_1, uri); - String _string = issues.toString(); - Issue _head = IterableExtensions.head(issues); - String _message = _head.getMessage(); - boolean _contains = _message.contains("Couldn\'t resolve reference to Type \'foo.B\'"); - Assert.assertTrue(_string, _contains); + Assert.assertEquals(this.uri("src/A.indextestlanguage"), uri); + Assert.assertTrue(issues.toString(), IterableExtensions.head(issues).getMessage().contains("Couldn\'t resolve reference to Type \'foo.B\'")); validateCalled.set(true); return false; }; it.setAfterValidate(_function_2); }; - BuildRequest _newBuildRequest_1 = this.newBuildRequest(_function_1); - this.build(_newBuildRequest_1); - boolean _get = validateCalled.get(); - Assert.assertTrue(_get); + this.build(this.newBuildRequest(_function_1)); + Assert.assertTrue(validateCalled.get()); } @Test @@ -364,19 +319,11 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest { "src/B.indextestlanguage", _builder_1.toString()); it.setDirtyFiles(Collections.unmodifiableList(CollectionLiterals.newArrayList(_minus, _minus_1))); }; - BuildRequest _newBuildRequest = this.newBuildRequest(_function); - this.build(_newBuildRequest); - String _string = this.issues.toString(); - boolean _isEmpty = this.issues.isEmpty(); - Assert.assertTrue(_string, _isEmpty); - int _size = this.generated.size(); - Assert.assertEquals(2, _size); - Collection _values = this.generated.values(); - boolean _containsSuffix = this.containsSuffix(_values, "src-gen/B.txt"); - Assert.assertTrue(_containsSuffix); - Collection _values_1 = this.generated.values(); - boolean _containsSuffix_1 = this.containsSuffix(_values_1, "src-gen/A.txt"); - Assert.assertTrue(_containsSuffix_1); + this.build(this.newBuildRequest(_function)); + Assert.assertTrue(this.issues.toString(), this.issues.isEmpty()); + Assert.assertEquals(2, this.generated.size()); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt")); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt")); final Procedure1 _function_1 = (BuildRequest it) -> { StringConcatenation _builder = new StringConcatenation(); _builder.append("foo {"); @@ -390,19 +337,11 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest { "src/A.indextestlanguage", _builder.toString()); it.setDirtyFiles(Collections.unmodifiableList(CollectionLiterals.newArrayList(_minus))); }; - BuildRequest _newBuildRequest_1 = this.newBuildRequest(_function_1); - this.build(_newBuildRequest_1); - String _string_1 = this.issues.toString(); - boolean _isEmpty_1 = this.issues.isEmpty(); - Assert.assertTrue(_string_1, _isEmpty_1); - int _size_1 = this.generated.size(); - Assert.assertEquals(1, _size_1); - Collection _values_2 = this.generated.values(); - boolean _containsSuffix_2 = this.containsSuffix(_values_2, "src-gen/B.txt"); - Assert.assertFalse(_containsSuffix_2); - Collection _values_3 = this.generated.values(); - boolean _containsSuffix_3 = this.containsSuffix(_values_3, "src-gen/A.txt"); - Assert.assertTrue(_containsSuffix_3); + this.build(this.newBuildRequest(_function_1)); + Assert.assertTrue(this.issues.toString(), this.issues.isEmpty()); + Assert.assertEquals(1, this.generated.size()); + Assert.assertFalse(this.containsSuffix(this.generated.values(), "src-gen/B.txt")); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt")); final Procedure1 _function_2 = (BuildRequest it) -> { StringConcatenation _builder = new StringConcatenation(); _builder.append("foo {"); @@ -416,28 +355,14 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest { "src/A.indextestlanguage", _builder.toString()); it.setDirtyFiles(Collections.unmodifiableList(CollectionLiterals.newArrayList(_minus))); }; - BuildRequest _newBuildRequest_2 = this.newBuildRequest(_function_2); - this.build(_newBuildRequest_2); - String _string_2 = this.issues.toString(); - int _size_2 = this.issues.size(); - Assert.assertEquals(_string_2, 1, _size_2); - int _size_3 = this.generated.size(); - Assert.assertEquals(1, _size_3); - Collection _values_4 = this.generated.values(); - boolean _containsSuffix_4 = this.containsSuffix(_values_4, "src-gen/B.txt"); - Assert.assertFalse(_containsSuffix_4); - Collection _values_5 = this.generated.values(); - boolean _containsSuffix_5 = this.containsSuffix(_values_5, "src-gen/X.txt"); - Assert.assertTrue(_containsSuffix_5); - Source2GeneratedMapping _fileMappings = this.indexState.getFileMappings(); - URI _uri = this.uri("src/A.indextestlanguage"); - List _generated = _fileMappings.getGenerated(_uri); - int _size_4 = _generated.size(); - Assert.assertEquals(1, _size_4); - int _size_5 = this.deleted.size(); - Assert.assertEquals(1, _size_5); - boolean _containsSuffix_6 = this.containsSuffix(this.deleted, "src-gen/A.txt"); - Assert.assertTrue(_containsSuffix_6); + this.build(this.newBuildRequest(_function_2)); + Assert.assertEquals(this.issues.toString(), 1, this.issues.size()); + Assert.assertEquals(1, this.generated.size()); + Assert.assertFalse(this.containsSuffix(this.generated.values(), "src-gen/B.txt")); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/X.txt")); + Assert.assertEquals(1, this.indexState.getFileMappings().getGenerated(this.uri("src/A.indextestlanguage")).size()); + Assert.assertEquals(1, this.deleted.size()); + Assert.assertTrue(this.containsSuffix(this.deleted, "src-gen/A.txt")); final Procedure1 _function_3 = (BuildRequest it) -> { StringConcatenation _builder = new StringConcatenation(); _builder.append("foo {"); @@ -451,36 +376,20 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest { "src/A.indextestlanguage", _builder.toString()); it.setDirtyFiles(Collections.unmodifiableList(CollectionLiterals.newArrayList(_minus))); }; - BuildRequest _newBuildRequest_3 = this.newBuildRequest(_function_3); - this.build(_newBuildRequest_3); - String _string_3 = this.issues.toString(); - boolean _isEmpty_2 = this.issues.isEmpty(); - Assert.assertTrue(_string_3, _isEmpty_2); - int _size_6 = this.generated.size(); - Assert.assertEquals(2, _size_6); - Collection _values_6 = this.generated.values(); - boolean _containsSuffix_7 = this.containsSuffix(_values_6, "src-gen/B.txt"); - Assert.assertTrue(_containsSuffix_7); - Collection _values_7 = this.generated.values(); - boolean _containsSuffix_8 = this.containsSuffix(_values_7, "src-gen/A.txt"); - Assert.assertTrue(_containsSuffix_8); - boolean _containsSuffix_9 = this.containsSuffix(this.deleted, "src-gen/X.txt"); - Assert.assertTrue(_containsSuffix_9); + this.build(this.newBuildRequest(_function_3)); + Assert.assertTrue(this.issues.toString(), this.issues.isEmpty()); + Assert.assertEquals(2, this.generated.size()); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt")); + Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt")); + Assert.assertTrue(this.containsSuffix(this.deleted, "src-gen/X.txt")); final Procedure1 _function_4 = (BuildRequest it) -> { - URI _uri_1 = this.uri("src/A.indextestlanguage"); - URI _delete = this.delete(_uri_1); + URI _delete = this.delete(this.uri("src/A.indextestlanguage")); it.setDeletedFiles(Collections.unmodifiableList(CollectionLiterals.newArrayList(_delete))); }; - BuildRequest _newBuildRequest_4 = this.newBuildRequest(_function_4); - this.build(_newBuildRequest_4); - String _string_4 = this.issues.toString(); - int _size_7 = this.issues.size(); - Assert.assertEquals(_string_4, 1, _size_7); - int _size_8 = this.generated.size(); - Assert.assertEquals(0, _size_8); - int _size_9 = this.deleted.size(); - Assert.assertEquals(1, _size_9); - boolean _containsSuffix_10 = this.containsSuffix(this.deleted, "src-gen/A.txt"); - Assert.assertTrue(_containsSuffix_10); + this.build(this.newBuildRequest(_function_4)); + Assert.assertEquals(this.issues.toString(), 1, this.issues.size()); + Assert.assertEquals(0, this.generated.size()); + Assert.assertEquals(1, this.deleted.size()); + Assert.assertTrue(this.containsSuffix(this.deleted, "src-gen/A.txt")); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/filesystem/URIBasedFileSystemAccessTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/filesystem/URIBasedFileSystemAccessTest.java index 0fff6cc0f..7afae2909 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/filesystem/URIBasedFileSystemAccessTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/filesystem/URIBasedFileSystemAccessTest.java @@ -9,12 +9,10 @@ package org.eclipse.xtext.filesystem; import com.google.common.base.StandardSystemProperty; import com.google.inject.Inject; -import java.io.File; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collections; -import java.util.Set; import java.util.UUID; import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl; import org.eclipse.xtend2.lib.StringConcatenation; @@ -58,21 +56,16 @@ public class URIBasedFileSystemAccessTest { @Before public void before() { try { - String _value = StandardSystemProperty.JAVA_IO_TMPDIR.value(); - final Path tmpPath = Paths.get(_value); + final Path tmpPath = Paths.get(StandardSystemProperty.JAVA_IO_TMPDIR.value()); StringConcatenation _builder = new StringConcatenation(); _builder.append("tempFolder_"); UUID _randomUUID = UUID.randomUUID(); _builder.append(_randomUUID); final Path output = Files.createTempDirectory(tmpPath, _builder.toString()); - Path _resolve = output.resolve(URIBasedFileSystemAccessTest.EXISTING_RESOURCE_NAME); - final Path resource = Files.createFile(_resolve); - File _file = resource.toFile(); - _file.deleteOnExit(); - File _file_1 = output.toFile(); - _file_1.deleteOnExit(); - Set _outputConfigurations = this.configProvider.getOutputConfigurations(); - final OutputConfiguration config = IterableExtensions.head(_outputConfigurations); + final Path resource = Files.createFile(output.resolve(URIBasedFileSystemAccessTest.EXISTING_RESOURCE_NAME)); + resource.toFile().deleteOnExit(); + output.toFile().deleteOnExit(); + final OutputConfiguration config = IterableExtensions.head(this.configProvider.getOutputConfigurations()); config.setOutputDirectory(output.toString()); Pair _mappedTo = Pair.of(IFileSystemAccess.DEFAULT_OUTPUT, config); this.fsa.setOutputConfigurations(Collections.unmodifiableMap(CollectionLiterals.newHashMap(_mappedTo))); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormattableDocumentTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormattableDocumentTest.java index de91636b4..3ed93422d 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormattableDocumentTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormattableDocumentTest.java @@ -9,13 +9,10 @@ package org.eclipse.xtext.formatting2.internal; import com.google.inject.Inject; import java.util.Collection; -import java.util.List; import java.util.function.Consumer; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.TerminalRule; import org.eclipse.xtext.formatting2.FormatterPreferenceKeys; -import org.eclipse.xtext.formatting2.FormatterRequest; import org.eclipse.xtext.formatting2.IFormattableDocument; import org.eclipse.xtext.formatting2.IFormattableSubDocument; import org.eclipse.xtext.formatting2.IHiddenRegionFormatter; @@ -28,7 +25,6 @@ import org.eclipse.xtext.formatting2.internal.formattertestlanguage.KWList; import org.eclipse.xtext.formatting2.internal.services.FormatterTestLanguageGrammarAccess; 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.ITextRegionExtensions; import org.eclipse.xtext.preferences.MapBasedPreferenceValues; import org.eclipse.xtext.testing.InjectWith; @@ -65,12 +61,10 @@ public class FormattableDocumentTest { final GenericFormatter _function_1 = new GenericFormatter() { @Override protected void format(final IDList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = regions.regionFor(model); - ISemanticRegion _keyword = _regionFor.keyword("idlist"); final Procedure1 _function = (IHiddenRegionFormatter it_1) -> { it_1.oneSpace(); }; - document.append(_keyword, _function); + document.append(regions.regionFor(model).keyword("idlist"), _function); } }; it.setFormatter(_function_1); @@ -96,9 +90,6 @@ public class FormattableDocumentTest { final GenericFormatter _function_2 = new GenericFormatter() { @Override protected void format(final IDList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = regions.regionFor(model); - TerminalRule _iDRule = FormattableDocumentTest.this._formatterTestLanguageGrammarAccess.getIDRule(); - List _ruleCallsTo = _regionFor.ruleCallsTo(_iDRule); final Consumer _function = (ISemanticRegion it_1) -> { final Procedure1 _function_1 = (IHiddenRegionFormatter it_2) -> { it_2.autowrap(); @@ -106,7 +97,7 @@ public class FormattableDocumentTest { }; document.prepend(it_1, _function_1); }; - _ruleCallsTo.forEach(_function); + regions.regionFor(model).ruleCallsTo(FormattableDocumentTest.this._formatterTestLanguageGrammarAccess.getIDRule()).forEach(_function); } }; it.setFormatter(_function_2); @@ -138,19 +129,15 @@ public class FormattableDocumentTest { final GenericFormatter _function_2 = new GenericFormatter() { @Override protected void format(final KWList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = regions.regionFor(model); - ISemanticRegion _keyword = _regionFor.keyword("kwlist"); final Procedure1 _function = (IHiddenRegionFormatter it_1) -> { it_1.autowrap(); it_1.oneSpace(); }; - document.append(_keyword, _function); - ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model); - ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw4"); + document.append(regions.regionFor(model).keyword("kwlist"), _function); final Procedure1 _function_1 = (IHiddenRegionFormatter it_1) -> { it_1.oneSpace(); }; - document.append(_keyword_1, _function_1); + document.append(regions.regionFor(model).keyword("kw4"), _function_1); } }; it.setFormatter(_function_2); @@ -178,25 +165,19 @@ public class FormattableDocumentTest { final GenericFormatter _function_2 = new GenericFormatter() { @Override protected void format(final KWList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = regions.regionFor(model); - ISemanticRegion _keyword = _regionFor.keyword("kwlist"); final Procedure1 _function = (IHiddenRegionFormatter it_1) -> { it_1.autowrap(); it_1.oneSpace(); }; - document.append(_keyword, _function); - ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model); - ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1"); + document.append(regions.regionFor(model).keyword("kwlist"), _function); final Procedure1 _function_1 = (IHiddenRegionFormatter it_1) -> { it_1.newLine(); }; - document.append(_keyword_1, _function_1); - ISemanticRegionsFinder _regionFor_2 = regions.regionFor(model); - ISemanticRegion _keyword_2 = _regionFor_2.keyword("kw4"); + document.append(regions.regionFor(model).keyword("kw1"), _function_1); final Procedure1 _function_2 = (IHiddenRegionFormatter it_1) -> { it_1.oneSpace(); }; - document.append(_keyword_2, _function_2); + document.append(regions.regionFor(model).keyword("kw4"), _function_2); } }; it.setFormatter(_function_2); @@ -224,41 +205,31 @@ public class FormattableDocumentTest { final GenericFormatter _function_2 = new GenericFormatter() { @Override protected void format(final KWList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = regions.regionFor(model); - ISemanticRegion _keyword = _regionFor.keyword("kwlist"); final Procedure1 _function = (IHiddenRegionFormatter it_1) -> { it_1.autowrap(6); it_1.oneSpace(); }; - document.append(_keyword, _function); - ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model); - ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1"); + document.append(regions.regionFor(model).keyword("kwlist"), _function); final Procedure1 _function_1 = (IHiddenRegionFormatter it_1) -> { it_1.autowrap(); it_1.oneSpace(); }; - document.append(_keyword_1, _function_1); - ISemanticRegionsFinder _regionFor_2 = regions.regionFor(model); - ISemanticRegion _keyword_2 = _regionFor_2.keyword("kw2"); + document.append(regions.regionFor(model).keyword("kw1"), _function_1); final Procedure1 _function_2 = (IHiddenRegionFormatter it_1) -> { it_1.autowrap(); it_1.oneSpace(); }; - document.append(_keyword_2, _function_2); - ISemanticRegionsFinder _regionFor_3 = regions.regionFor(model); - ISemanticRegion _keyword_3 = _regionFor_3.keyword("kw3"); + document.append(regions.regionFor(model).keyword("kw2"), _function_2); final Procedure1 _function_3 = (IHiddenRegionFormatter it_1) -> { it_1.autowrap(); it_1.oneSpace(); }; - document.append(_keyword_3, _function_3); - ISemanticRegionsFinder _regionFor_4 = regions.regionFor(model); - ISemanticRegion _keyword_4 = _regionFor_4.keyword("kw4"); + document.append(regions.regionFor(model).keyword("kw3"), _function_3); final Procedure1 _function_4 = (IHiddenRegionFormatter it_1) -> { it_1.autowrap(); it_1.newLine(); }; - document.append(_keyword_4, _function_4); + document.append(regions.regionFor(model).keyword("kw4"), _function_4); } }; it.setFormatter(_function_2); @@ -291,32 +262,24 @@ public class FormattableDocumentTest { final ISubFormatter _function = (IFormattableSubDocument doc) -> { @Extension final IFormattableSubDocument fits = doc.requireFitsInLine(); - ISemanticRegionsFinder _regionFor = regions.regionFor(model); - ISemanticRegion _keyword = _regionFor.keyword("kwlist"); final Procedure1 _function_1 = (IHiddenRegionFormatter it_1) -> { it_1.oneSpace(); }; - fits.append(_keyword, _function_1); - ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model); - ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1"); + fits.append(regions.regionFor(model).keyword("kwlist"), _function_1); final Procedure1 _function_2 = (IHiddenRegionFormatter it_1) -> { it_1.oneSpace(); }; - fits.append(_keyword_1, _function_2); + fits.append(regions.regionFor(model).keyword("kw1"), _function_2); }; final ISubFormatter _function_1 = (IFormattableSubDocument doc) -> { - ISemanticRegionsFinder _regionFor = regions.regionFor(model); - ISemanticRegion _keyword = _regionFor.keyword("kwlist"); final Procedure1 _function_2 = (IHiddenRegionFormatter it_1) -> { it_1.newLine(); }; - doc.append(_keyword, _function_2); - ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model); - ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1"); + doc.append(regions.regionFor(model).keyword("kwlist"), _function_2); final Procedure1 _function_3 = (IHiddenRegionFormatter it_1) -> { it_1.newLine(); }; - doc.append(_keyword_1, _function_3); + doc.append(regions.regionFor(model).keyword("kw1"), _function_3); }; document.formatConditionally(model, _function, _function_1); } @@ -351,32 +314,24 @@ public class FormattableDocumentTest { final ISubFormatter _function = (IFormattableSubDocument doc) -> { @Extension final IFormattableSubDocument fits = doc.requireFitsInLine(); - ISemanticRegionsFinder _regionFor = regions.regionFor(model); - ISemanticRegion _keyword = _regionFor.keyword("kwlist"); final Procedure1 _function_1 = (IHiddenRegionFormatter it_1) -> { it_1.oneSpace(); }; - fits.append(_keyword, _function_1); - ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model); - ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1"); + fits.append(regions.regionFor(model).keyword("kwlist"), _function_1); final Procedure1 _function_2 = (IHiddenRegionFormatter it_1) -> { it_1.oneSpace(); }; - fits.append(_keyword_1, _function_2); + fits.append(regions.regionFor(model).keyword("kw1"), _function_2); }; final ISubFormatter _function_1 = (IFormattableSubDocument doc) -> { - ISemanticRegionsFinder _regionFor = regions.regionFor(model); - ISemanticRegion _keyword = _regionFor.keyword("kwlist"); final Procedure1 _function_2 = (IHiddenRegionFormatter it_1) -> { it_1.newLine(); }; - doc.append(_keyword, _function_2); - ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model); - ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1"); + doc.append(regions.regionFor(model).keyword("kwlist"), _function_2); final Procedure1 _function_3 = (IHiddenRegionFormatter it_1) -> { it_1.newLine(); }; - doc.append(_keyword_1, _function_3); + doc.append(regions.regionFor(model).keyword("kw1"), _function_3); }; document.formatConditionally(model, _function, _function_1); } @@ -393,8 +348,7 @@ public class FormattableDocumentTest { @Test public void aroundDocument() { final Procedure1 _function = (GenericFormatterTestRequest it) -> { - FormatterRequest _request = it.getRequest(); - Collection _regions = _request.getRegions(); + Collection _regions = it.getRequest().getRegions(); TextRegion _textRegion = new TextRegion(0, 6); _regions.add(_textRegion); StringConcatenation _builder = new StringConcatenation(); @@ -403,12 +357,10 @@ public class FormattableDocumentTest { final GenericFormatter _function_1 = new GenericFormatter() { @Override protected void format(final IDList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = regions.regionFor(model); - ISemanticRegion _keyword = _regionFor.keyword("idlist"); final Procedure1 _function = (IHiddenRegionFormatter it_1) -> { it_1.setSpace("!"); }; - document.surround(_keyword, _function); + document.surround(regions.regionFor(model).keyword("idlist"), _function); } }; it.setFormatter(_function_1); @@ -422,8 +374,7 @@ public class FormattableDocumentTest { @Test public void shouldFormat() { final Procedure1 _function = (GenericFormatterTestRequest it) -> { - FormatterRequest _request = it.getRequest(); - Collection _regions = _request.getRegions(); + Collection _regions = it.getRequest().getRegions(); TextRegion _textRegion = new TextRegion(0, 6); _regions.add(_textRegion); StringConcatenation _builder = new StringConcatenation(); @@ -450,8 +401,7 @@ public class FormattableDocumentTest { @Test(expected = IllegalStateException.class) public void shouldFormat_02() { final Procedure1 _function = (GenericFormatterTestRequest it) -> { - FormatterRequest _request = it.getRequest(); - Collection _regions = _request.getRegions(); + Collection _regions = it.getRequest().getRegions(); TextRegion _textRegion = new TextRegion(0, 6); _regions.add(_textRegion); StringConcatenation _builder = new StringConcatenation(); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormatterReplacementsTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormatterReplacementsTest.java index a55eba17f..4f7a789aa 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormatterReplacementsTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormatterReplacementsTest.java @@ -11,8 +11,8 @@ 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; import org.eclipse.xtext.formatting2.IFormattableDocument; import org.eclipse.xtext.formatting2.IHiddenRegionFormatter; @@ -21,7 +21,6 @@ import org.eclipse.xtext.formatting2.internal.formattertestlanguage.IDList; import org.eclipse.xtext.formatting2.internal.services.FormatterTestLanguageGrammarAccess; 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.ITextRegionExtensions; import org.eclipse.xtext.formatting2.regionaccess.ITextReplacement; import org.eclipse.xtext.formatting2.regionaccess.TextRegionAccessBuilder; @@ -65,9 +64,6 @@ public class FormatterReplacementsTest { final GenericFormatter _function = new GenericFormatter() { @Override protected void format(final IDList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = regions.regionFor(model); - TerminalRule _iDRule = FormatterReplacementsTest.this._formatterTestLanguageGrammarAccess.getIDRule(); - List _ruleCallsTo = _regionFor.ruleCallsTo(_iDRule); final Consumer _function = (ISemanticRegion it) -> { final Procedure1 _function_1 = (IHiddenRegionFormatter it_1) -> { it_1.autowrap(); @@ -75,14 +71,15 @@ public class FormatterReplacementsTest { }; document.prepend(it, _function_1); }; - _ruleCallsTo.forEach(_function); + regions.regionFor(model).ruleCallsTo(FormatterReplacementsTest.this._formatterTestLanguageGrammarAccess.getIDRule()).forEach(_function); } }; final GenericFormatter formatter = _function; final IDList parsed = this.parseHelper.parse("idlist aaa bbb"); final FormatterRequest request = this.requestProvider.get(); request.setAllowIdentityEdits(false); - request.setTextRegionAccess(this.regionBuilder.forNodeModel(((XtextResource) parsed.eResource())).create()); + Resource _eResource = parsed.eResource(); + request.setTextRegionAccess(this.regionBuilder.forNodeModel(((XtextResource) _eResource)).create()); final List replacements = formatter.format(request); final Function1 _function_1 = (ITextReplacement it) -> { StringConcatenation _builder = new StringConcatenation(); @@ -96,8 +93,7 @@ public class FormatterReplacementsTest { _builder.append("\n"); return _builder.toString(); }; - List _map = ListExtensions.map(replacements, _function_1); - final String actual = IterableExtensions.join(_map); + final String actual = IterableExtensions.join(ListExtensions.map(replacements, _function_1)); StringConcatenation _builder = new StringConcatenation(); _builder.append("\" \" -> \" \""); _builder.newLine(); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormatterSerializerIntegrationTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormatterSerializerIntegrationTest.java index 3f8c780df..b929c5942 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormatterSerializerIntegrationTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/FormatterSerializerIntegrationTest.java @@ -14,7 +14,6 @@ import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.util.Arrays; import java.util.Collections; -import java.util.Map; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; @@ -29,8 +28,6 @@ import org.eclipse.xtext.formatting2.internal.FormatterTestLanguageStandaloneSet import org.eclipse.xtext.formatting2.internal.formattertestlanguage.FormattertestlanguageFactory; import org.eclipse.xtext.formatting2.internal.formattertestlanguage.IDList; 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.resource.IResourceFactory; import org.eclipse.xtext.resource.XtextResource; import org.eclipse.xtext.testing.InjectWith; @@ -52,8 +49,7 @@ public class FormatterSerializerIntegrationTest { public static class InjectorProvider extends FormatterTestLanguageInjectorProvider { @Override protected Injector internalCreateInjector() { - FormatterSerializerIntegrationTest.Setup _setup = new FormatterSerializerIntegrationTest.Setup(); - return _setup.createInjectorAndDoEMFRegistration(); + return new FormatterSerializerIntegrationTest.Setup().createInjectorAndDoEMFRegistration(); } } @@ -73,12 +69,10 @@ public class FormatterSerializerIntegrationTest { public static class Formatter extends AbstractFormatter2 { protected void _format(final IDList model, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(model); - ISemanticRegion _keyword = _regionFor.keyword("idlist"); final Procedure1 _function = (IHiddenRegionFormatter it) -> { it.setSpace(" "); }; - document.append(_keyword, _function); + document.append(this.textRegionExtensions.regionFor(model).keyword("idlist"), _function); } public void format(final Object model, final IFormattableDocument document) { @@ -110,11 +104,8 @@ public class FormatterSerializerIntegrationTest { @Test public void testFormatterIntegrationWithSerializer() { try { - URI _createURI = URI.createURI("dummy.ext"); - final Resource resource = this.factory.createResource(_createURI); - ResourceSetImpl _resourceSetImpl = new ResourceSetImpl(); - EList _resources = _resourceSetImpl.getResources(); - _resources.add(resource); + final Resource resource = this.factory.createResource(URI.createURI("dummy.ext")); + new ResourceSetImpl().getResources().add(resource); final IDList model = FormattertestlanguageFactory.eINSTANCE.createIDList(); EList _ids = model.getIds(); _ids.add("foo"); @@ -122,10 +113,8 @@ public class FormatterSerializerIntegrationTest { _contents.add(model); final ByteArrayOutputStream out = new ByteArrayOutputStream(); BufferedOutputStream _bufferedOutputStream = new BufferedOutputStream(out); - Map _emptyMap = Collections.emptyMap(); - resource.save(_bufferedOutputStream, _emptyMap); - String _string = out.toString(); - Assert.assertEquals("idlist foo", _string); + resource.save(_bufferedOutputStream, Collections.emptyMap()); + Assert.assertEquals("idlist foo", out.toString()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/TestableTextSegmentSet.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/TestableTextSegmentSet.java index 070a9a5e7..4d4442561 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/TestableTextSegmentSet.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/internal/TestableTextSegmentSet.java @@ -7,7 +7,6 @@ */ package org.eclipse.xtext.formatting2.internal; -import java.util.Collection; import java.util.List; import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; import org.eclipse.xtend2.lib.StringConcatenation; @@ -61,9 +60,7 @@ public class TestableTextSegmentSet { _builder_1.append("]"); return _builder_1.toString(); }; - Iterable _map = IterableExtensions.map(this.set, _function); - String _string = _map.toString(); - String _replace = _string.replace("\n", ", "); + String _replace = IterableExtensions.map(this.set, _function).toString().replace("\n", ", "); _builder.append(_replace); _builder.newLineIfNotEmpty(); return _builder.toString(); @@ -75,18 +72,16 @@ public class TestableTextSegmentSet { } catch (final Throwable _t) { if (_t instanceof ConflictingRegionsException) { final ConflictingRegionsException e = (ConflictingRegionsException)_t; - Collection _traces = e.getTraces(); final Function1 _function = (RegionTrace it) -> { return it.getRegion(); }; - final Iterable conflicting = IterableExtensions.map(_traces, _function); + final Iterable conflicting = IterableExtensions.map(e.getTraces(), _function); StringConcatenation _builder = new StringConcatenation(); _builder.append("mergeConflict:"); final Function1 _function_1 = (ITextSegment it) -> { return this.fmt(it); }; - Iterable _map = IterableExtensions.map(conflicting, _function_1); - String _join = IterableExtensions.join(_map, "<>"); + String _join = IterableExtensions.join(IterableExtensions.map(conflicting, _function_1), "<>"); _builder.append(_join); this.issues.add(_builder.toString()); } else { diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/regionaccess/internal/RegionAccessBuilderTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/regionaccess/internal/RegionAccessBuilderTest.java index 20a4e4f74..61a687400 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/regionaccess/internal/RegionAccessBuilderTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/regionaccess/internal/RegionAccessBuilderTest.java @@ -54,8 +54,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("1 foo"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("0 0 H"); _builder_1.newLine(); @@ -81,8 +80,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("1 /**/ foo"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -118,8 +116,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("2 foo"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("0 0 H"); _builder_1.newLine(); @@ -151,8 +148,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("3 foo"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("0 0 H"); _builder_1.newLine(); @@ -178,8 +174,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("4 prefix foo"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -221,8 +216,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("5 a + b"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("0 0 H"); _builder_1.newLine(); @@ -268,8 +262,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("5 (a + b) + c"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -356,8 +349,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (unassigned foo)"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -401,8 +393,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (unassigned datatype foo)"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -446,8 +437,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (unassigned datatype datatype foo)"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -491,8 +481,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 ()"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("0 0 H"); _builder_1.newLine(); @@ -522,8 +511,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (())"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("0 0 H"); _builder_1.newLine(); @@ -561,8 +549,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 ((()))"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("0 0 H"); _builder_1.newLine(); @@ -608,8 +595,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (((foo)))"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -673,8 +659,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (child(((foo))))"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -752,8 +737,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (datatype foo)"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -793,8 +777,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (datatype datatype foo)"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -834,8 +817,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (foo) action (ref foo) end"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -915,8 +897,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (lit1)"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("0 0 H"); _builder_1.newLine(); @@ -950,8 +931,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (foo) action"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -1005,8 +985,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (foo) action action"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -1070,8 +1049,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 () action action"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -1129,8 +1107,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (fragment foo)"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -1174,8 +1151,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (fragment recursion foo)"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -1223,8 +1199,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (fragment child ())"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -1282,8 +1257,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (fragment child (foo))"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -1345,8 +1319,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (fragment recursion child ())"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -1408,8 +1381,7 @@ public class RegionAccessBuilderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("7 action (foo)"); _builder.newLine(); - String _string = _builder.toString(); - String _trim = _string.trim(); + String _trim = _builder.toString().trim(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(" "); _builder_1.append("0 0 H"); @@ -1461,14 +1433,10 @@ public class RegionAccessBuilderTest { this.validationTestHelper.assertNoErrors(obj); final ITextRegionAccess access1 = this.createFromNodeModel(obj); final ITextRegionAccess access2 = this.serializer.serializeToRegions(obj); - TextRegionAccessToString _textRegionAccessToString = new TextRegionAccessToString(); - TextRegionAccessToString _withRegionAccess = _textRegionAccessToString.withRegionAccess(access1); - TextRegionAccessToString _cfg = this.cfg(_withRegionAccess); + TextRegionAccessToString _cfg = this.cfg(new TextRegionAccessToString().withRegionAccess(access1)); String _plus = (_cfg + "\n"); Assert.assertEquals(exp, _plus); - TextRegionAccessToString _textRegionAccessToString_1 = new TextRegionAccessToString(); - TextRegionAccessToString _withRegionAccess_1 = _textRegionAccessToString_1.withRegionAccess(access2); - TextRegionAccessToString _cfg_1 = this.cfg(_withRegionAccess_1); + TextRegionAccessToString _cfg_1 = this.cfg(new TextRegionAccessToString().withRegionAccess(access2)); String _plus_1 = (_cfg_1 + "\n"); Assert.assertEquals(exp, _plus_1); } catch (Throwable _e) { @@ -1477,14 +1445,11 @@ public class RegionAccessBuilderTest { } private TextRegionAccessToString cfg(final TextRegionAccessToString toStr) { - TextRegionAccessToString _hideColumnExplanation = toStr.hideColumnExplanation(); - return _hideColumnExplanation.withTextWidth(10); + return toStr.hideColumnExplanation().withTextWidth(10); } private ITextRegionAccess createFromNodeModel(final EObject obj) { - TextRegionAccessBuilder _get = this.textRegionAccessBuilder.get(); Resource _eResource = obj.eResource(); - TextRegionAccessBuilder _forNodeModel = _get.forNodeModel(((XtextResource) _eResource)); - return _forNodeModel.create(); + return this.textRegionAccessBuilder.get().forNodeModel(((XtextResource) _eResource)).create(); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/regionaccess/internal/SemanticRegionFinderTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/regionaccess/internal/SemanticRegionFinderTest.java index efc5678cb..03433fa51 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/regionaccess/internal/SemanticRegionFinderTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/regionaccess/internal/SemanticRegionFinderTest.java @@ -15,12 +15,6 @@ import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.Assignment; -import org.eclipse.xtext.CrossReference; -import org.eclipse.xtext.Keyword; -import org.eclipse.xtext.ParserRule; -import org.eclipse.xtext.RuleCall; -import org.eclipse.xtext.TerminalRule; import org.eclipse.xtext.formatting2.regionaccess.IEObjectRegion; import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion; import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder; @@ -75,9 +69,7 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); final ISemanticRegion actual = finder.feature(RegionaccesstestlanguagePackage.Literals.MIXED__NAME); final List actuals = finder.features(RegionaccesstestlanguagePackage.Literals.MIXED__NAME); this.assertEquals("foo", actual, actuals); @@ -88,13 +80,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (ref foo) action (foo) end"); final AssignedAction mixed = this.parseAs(_builder, AssignedAction.class); - ITextRegionAccess _access = this.toAccess(mixed); - Mixed _child = mixed.getChild(); - final IEObjectRegion finder = _access.regionForEObject(_child); - ISemanticRegionsFinder _regionFor = finder.getRegionFor(); - final ISemanticRegion actual = _regionFor.feature(RegionaccesstestlanguagePackage.Literals.MIXED__REF); - ISemanticRegionsFinder _regionFor_1 = finder.getRegionFor(); - final List actuals = _regionFor_1.features(RegionaccesstestlanguagePackage.Literals.MIXED__REF); + final IEObjectRegion finder = this.toAccess(mixed).regionForEObject(mixed.getChild()); + final ISemanticRegion actual = finder.getRegionFor().feature(RegionaccesstestlanguagePackage.Literals.MIXED__REF); + final List actuals = finder.getRegionFor().features(RegionaccesstestlanguagePackage.Literals.MIXED__REF); this.assertEquals("foo", actual, actuals); } @@ -103,9 +91,7 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (foo) action"); final AssignedAction mixed = this.parseAs(_builder, AssignedAction.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); try { finder.feature(RegionaccesstestlanguagePackage.Literals.ASSIGNED_ACTION__CHILD); Assert.fail(); @@ -133,15 +119,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (unassigned foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _iDTerminalRuleCall_1_1_0 = _mixedAccess.getIDTerminalRuleCall_1_1_0(); - final ISemanticRegion actual = finder.ruleCall(_iDTerminalRuleCall_1_1_0); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _iDTerminalRuleCall_1_1_0_1 = _mixedAccess_1.getIDTerminalRuleCall_1_1_0(); - final List actuals = finder.ruleCalls(_iDTerminalRuleCall_1_1_0_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); + final ISemanticRegion actual = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getIDTerminalRuleCall_1_1_0()); + final List actuals = finder.ruleCalls(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getIDTerminalRuleCall_1_1_0()); this.assertEquals("foo", actual, actuals); } @@ -150,13 +130,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (unassigned foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - TerminalRule _iDRule = this._regionAccessTestLanguageGrammarAccess.getIDRule(); - final ISemanticRegion actual = finder.ruleCallTo(_iDRule); - TerminalRule _iDRule_1 = this._regionAccessTestLanguageGrammarAccess.getIDRule(); - final List actuals = finder.ruleCallsTo(_iDRule_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); + final ISemanticRegion actual = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getIDRule()); + final List actuals = finder.ruleCallsTo(this._regionAccessTestLanguageGrammarAccess.getIDRule()); this.assertEquals("foo", actual, actuals); } @@ -165,15 +141,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (unassigned datatype foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _datatypeParserRuleCall_1_1_1 = _mixedAccess.getDatatypeParserRuleCall_1_1_1(); - final ISemanticRegion actual = finder.ruleCall(_datatypeParserRuleCall_1_1_1); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _datatypeParserRuleCall_1_1_1_1 = _mixedAccess_1.getDatatypeParserRuleCall_1_1_1(); - final List actuals = finder.ruleCalls(_datatypeParserRuleCall_1_1_1_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); + final ISemanticRegion actual = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getDatatypeParserRuleCall_1_1_1()); + final List actuals = finder.ruleCalls(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getDatatypeParserRuleCall_1_1_1()); this.assertEquals("datatype foo", actual, actuals); } @@ -182,13 +152,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (unassigned datatype foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - ParserRule _datatypeRule = this._regionAccessTestLanguageGrammarAccess.getDatatypeRule(); - final ISemanticRegion actual = finder.ruleCallTo(_datatypeRule); - ParserRule _datatypeRule_1 = this._regionAccessTestLanguageGrammarAccess.getDatatypeRule(); - final List actuals = finder.ruleCallsTo(_datatypeRule_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); + final ISemanticRegion actual = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getDatatypeRule()); + final List actuals = finder.ruleCallsTo(this._regionAccessTestLanguageGrammarAccess.getDatatypeRule()); this.assertEquals("datatype foo", actual, actuals); } @@ -197,15 +163,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _nameIDTerminalRuleCall_2_2_0_0 = _mixedAccess.getNameIDTerminalRuleCall_2_2_0_0(); - final ISemanticRegion actual = finder.ruleCall(_nameIDTerminalRuleCall_2_2_0_0); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _nameIDTerminalRuleCall_2_2_0_0_1 = _mixedAccess_1.getNameIDTerminalRuleCall_2_2_0_0(); - final ISemanticRegion actuals = finder.ruleCall(_nameIDTerminalRuleCall_2_2_0_0_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); + final ISemanticRegion actual = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getNameIDTerminalRuleCall_2_2_0_0()); + final ISemanticRegion actuals = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getNameIDTerminalRuleCall_2_2_0_0()); Assert.assertEquals("foo", actual, actuals); } @@ -214,13 +174,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - TerminalRule _iDRule = this._regionAccessTestLanguageGrammarAccess.getIDRule(); - final ISemanticRegion actual = finder.ruleCallTo(_iDRule); - TerminalRule _iDRule_1 = this._regionAccessTestLanguageGrammarAccess.getIDRule(); - final ISemanticRegion actuals = finder.ruleCallTo(_iDRule_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); + final ISemanticRegion actual = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getIDRule()); + final ISemanticRegion actuals = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getIDRule()); Assert.assertEquals("foo", actual, actuals); } @@ -229,15 +185,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (datatype foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _datatypeDatatypeParserRuleCall_2_2_2_0 = _mixedAccess.getDatatypeDatatypeParserRuleCall_2_2_2_0(); - final ISemanticRegion actual = finder.ruleCall(_datatypeDatatypeParserRuleCall_2_2_2_0); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _datatypeDatatypeParserRuleCall_2_2_2_0_1 = _mixedAccess_1.getDatatypeDatatypeParserRuleCall_2_2_2_0(); - final ISemanticRegion actuals = finder.ruleCall(_datatypeDatatypeParserRuleCall_2_2_2_0_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); + final ISemanticRegion actual = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getDatatypeDatatypeParserRuleCall_2_2_2_0()); + final ISemanticRegion actuals = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getDatatypeDatatypeParserRuleCall_2_2_2_0()); Assert.assertEquals("datatype foo", actual, actuals); } @@ -246,13 +196,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (datatype foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - ParserRule _datatypeRule = this._regionAccessTestLanguageGrammarAccess.getDatatypeRule(); - final ISemanticRegion actual = finder.ruleCallTo(_datatypeRule); - ParserRule _datatypeRule_1 = this._regionAccessTestLanguageGrammarAccess.getDatatypeRule(); - final ISemanticRegion actuals = finder.ruleCallTo(_datatypeRule_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); + final ISemanticRegion actual = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getDatatypeRule()); + final ISemanticRegion actuals = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getDatatypeRule()); Assert.assertEquals("datatype foo", actual, actuals); } @@ -261,16 +207,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (ref foo) action (foo) end"); final AssignedAction mixed = this.parseAs(_builder, AssignedAction.class); - ITextRegionAccess _access = this.toAccess(mixed); - Mixed _child = mixed.getChild(); - IEObjectRegion _regionForEObject = _access.regionForEObject(_child); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _refMixedIDTerminalRuleCall_2_2_3_1_0_1 = _mixedAccess.getRefMixedIDTerminalRuleCall_2_2_3_1_0_1(); - final ISemanticRegion actual = finder.ruleCall(_refMixedIDTerminalRuleCall_2_2_3_1_0_1); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _refMixedIDTerminalRuleCall_2_2_3_1_0_1_1 = _mixedAccess_1.getRefMixedIDTerminalRuleCall_2_2_3_1_0_1(); - final List actuals = finder.ruleCalls(_refMixedIDTerminalRuleCall_2_2_3_1_0_1_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed.getChild()).getRegionFor(); + final ISemanticRegion actual = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getRefMixedIDTerminalRuleCall_2_2_3_1_0_1()); + final List actuals = finder.ruleCalls(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getRefMixedIDTerminalRuleCall_2_2_3_1_0_1()); this.assertEquals("foo", actual, actuals); } @@ -279,14 +218,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (ref foo) action (foo) end"); final AssignedAction mixed = this.parseAs(_builder, AssignedAction.class); - ITextRegionAccess _access = this.toAccess(mixed); - Mixed _child = mixed.getChild(); - IEObjectRegion _regionForEObject = _access.regionForEObject(_child); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - TerminalRule _iDRule = this._regionAccessTestLanguageGrammarAccess.getIDRule(); - final ISemanticRegion actual = finder.ruleCallTo(_iDRule); - TerminalRule _iDRule_1 = this._regionAccessTestLanguageGrammarAccess.getIDRule(); - final List actuals = finder.ruleCallsTo(_iDRule_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed.getChild()).getRegionFor(); + final ISemanticRegion actual = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getIDRule()); + final List actuals = finder.ruleCallsTo(this._regionAccessTestLanguageGrammarAccess.getIDRule()); this.assertEquals("foo", actual, actuals); } @@ -295,13 +229,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (child (foo))"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); try { - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _eobjMixedParserRuleCall_2_2_1_1_0 = _mixedAccess.getEobjMixedParserRuleCall_2_2_1_1_0(); - finder.ruleCall(_eobjMixedParserRuleCall_2_2_1_1_0); + finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getEobjMixedParserRuleCall_2_2_1_1_0()); Assert.fail(); } catch (final Throwable _t) { if (_t instanceof IllegalStateException) { @@ -311,9 +241,7 @@ public class SemanticRegionFinderTest { } } try { - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - RuleCall _eobjMixedParserRuleCall_2_2_1_1_0_1 = _mixedAccess_1.getEobjMixedParserRuleCall_2_2_1_1_0(); - finder.ruleCalls(_eobjMixedParserRuleCall_2_2_1_1_0_1); + finder.ruleCalls(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getEobjMixedParserRuleCall_2_2_1_1_0()); Assert.fail(); } catch (final Throwable _t_1) { if (_t_1 instanceof IllegalStateException) { @@ -329,12 +257,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (child (foo))"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); try { - ParserRule _mixedRule = this._regionAccessTestLanguageGrammarAccess.getMixedRule(); - finder.ruleCallTo(_mixedRule); + finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getMixedRule()); Assert.fail(); } catch (final Throwable _t) { if (_t instanceof IllegalStateException) { @@ -344,8 +269,7 @@ public class SemanticRegionFinderTest { } } try { - ParserRule _mixedRule_1 = this._regionAccessTestLanguageGrammarAccess.getMixedRule(); - finder.ruleCallsTo(_mixedRule_1); + finder.ruleCallsTo(this._regionAccessTestLanguageGrammarAccess.getMixedRule()); Assert.fail(); } catch (final Throwable _t_1) { if (_t_1 instanceof IllegalStateException) { @@ -361,9 +285,7 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); final ISemanticRegion actual = finder.keyword("("); final List actuals = finder.keywords("("); this.assertEquals("(", actual, actuals); @@ -374,15 +296,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - Keyword _leftParenthesisKeyword_0 = _mixedAccess.getLeftParenthesisKeyword_0(); - final ISemanticRegion actual = finder.keyword(_leftParenthesisKeyword_0); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - Keyword _leftParenthesisKeyword_0_1 = _mixedAccess_1.getLeftParenthesisKeyword_0(); - final List actuals = finder.keywords(_leftParenthesisKeyword_0_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); + final ISemanticRegion actual = finder.keyword(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getLeftParenthesisKeyword_0()); + final List actuals = finder.keywords(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getLeftParenthesisKeyword_0()); this.assertEquals("(", actual, actuals); } @@ -391,16 +307,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (ref foo) action (foo) end"); final AssignedAction mixed = this.parseAs(_builder, AssignedAction.class); - ITextRegionAccess _access = this.toAccess(mixed); - Mixed _child = mixed.getChild(); - IEObjectRegion _regionForEObject = _access.regionForEObject(_child); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - CrossReference _refMixedCrossReference_2_2_3_1_0 = _mixedAccess.getRefMixedCrossReference_2_2_3_1_0(); - final ISemanticRegion actual = finder.crossRef(_refMixedCrossReference_2_2_3_1_0); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - CrossReference _refMixedCrossReference_2_2_3_1_0_1 = _mixedAccess_1.getRefMixedCrossReference_2_2_3_1_0(); - final List actuals = finder.crossRefs(_refMixedCrossReference_2_2_3_1_0_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed.getChild()).getRegionFor(); + final ISemanticRegion actual = finder.crossRef(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getRefMixedCrossReference_2_2_3_1_0()); + final List actuals = finder.crossRefs(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getRefMixedCrossReference_2_2_3_1_0()); this.assertEquals("foo", actual, actuals); } @@ -409,15 +318,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("6 (foo)"); final Mixed mixed = this.parseAs(_builder, Mixed.class); - ITextRegionAccess _access = this.toAccess(mixed); - IEObjectRegion _regionForEObject = _access.regionForEObject(mixed); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - Assignment _nameAssignment_2_2_0 = _mixedAccess.getNameAssignment_2_2_0(); - final ISemanticRegion actual = finder.assignment(_nameAssignment_2_2_0); - RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess(); - Assignment _nameAssignment_2_2_0_1 = _mixedAccess_1.getNameAssignment_2_2_0(); - final List actuals = finder.assignments(_nameAssignment_2_2_0_1); + final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor(); + final ISemanticRegion actual = finder.assignment(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getNameAssignment_2_2_0()); + final List actuals = finder.assignments(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getNameAssignment_2_2_0()); this.assertEquals("foo", actual, actuals); } @@ -428,15 +331,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("5 (foo)"); final Expression expr = this.parseAs(_builder, Expression.class); - ITextRegionAccess _access = this.toAccess(expr); - IEObjectRegion _regionForEObject = _access.regionForEObject(expr); - final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor(); - List> _keywordPairs = finder.keywordPairs("(", ")"); - final String actual1 = this.pairsToString(_keywordPairs); - Keyword _leftParenthesisKeyword_0 = rule.getLeftParenthesisKeyword_0(); - Keyword _rightParenthesisKeyword_2 = rule.getRightParenthesisKeyword_2(); - List> _keywordPairs_1 = finder.keywordPairs(_leftParenthesisKeyword_0, _rightParenthesisKeyword_2); - final String actual2 = this.pairsToString(_keywordPairs_1); + final ISemanticRegionsFinder finder = this.toAccess(expr).regionForEObject(expr).getRegionFor(); + final String actual1 = this.pairsToString(finder.keywordPairs("(", ")")); + final String actual2 = this.pairsToString(finder.keywordPairs(rule.getLeftParenthesisKeyword_0(), rule.getRightParenthesisKeyword_2())); final String expected = "(foo)"; Assert.assertEquals(expected, actual1); Assert.assertEquals(expected, actual2); @@ -449,15 +346,9 @@ public class SemanticRegionFinderTest { StringConcatenation _builder = new StringConcatenation(); _builder.append("5 (a + ((b) + c) + d)"); final Expression expr = this.parseAs(_builder, Expression.class); - ITextRegionAccess _access = this.toAccess(expr); - IEObjectRegion _regionForRootEObject = _access.regionForRootEObject(); - final ISemanticRegionsFinder finder = _regionForRootEObject.getAllRegionsFor(); - List> _keywordPairs = finder.keywordPairs("(", ")"); - final String actual1 = this.pairsToString(_keywordPairs); - Keyword _leftParenthesisKeyword_0 = rule.getLeftParenthesisKeyword_0(); - Keyword _rightParenthesisKeyword_2 = rule.getRightParenthesisKeyword_2(); - List> _keywordPairs_1 = finder.keywordPairs(_leftParenthesisKeyword_0, _rightParenthesisKeyword_2); - final String actual2 = this.pairsToString(_keywordPairs_1); + final ISemanticRegionsFinder finder = this.toAccess(expr).regionForRootEObject().getAllRegionsFor(); + final String actual1 = this.pairsToString(finder.keywordPairs("(", ")")); + final String actual2 = this.pairsToString(finder.keywordPairs(rule.getLeftParenthesisKeyword_0(), rule.getRightParenthesisKeyword_2())); final String expected = "(b); ((b) + c); (a + ((b) + c) + d)"; Assert.assertEquals(expected, actual1); Assert.assertEquals(expected, actual2); @@ -465,13 +356,9 @@ public class SemanticRegionFinderTest { private String pairsToString(final Iterable> pairs) { final Function1, String> _function = (Pair it) -> { - ISemanticRegion _key = it.getKey(); - ISemanticRegion _value = it.getValue(); - ITextSegment _merge = _key.merge(_value); - return _merge.getText(); + return it.getKey().merge(it.getValue()).getText(); }; - Iterable _map = IterableExtensions., String>map(pairs, _function); - return IterableExtensions.join(_map, "; "); + return IterableExtensions.join(IterableExtensions., String>map(pairs, _function), "; "); } private T parseAs(final CharSequence seq, final Class cls) { @@ -485,10 +372,8 @@ public class SemanticRegionFinderTest { } private ITextRegionAccess toAccess(final EObject obj) { - TextRegionAccessBuilder _get = this.textRegionAccessBuilder.get(); Resource _eResource = obj.eResource(); - TextRegionAccessBuilder _forNodeModel = _get.forNodeModel(((XtextResource) _eResource)); - return _forNodeModel.create(); + return this.textRegionAccessBuilder.get().forNodeModel(((XtextResource) _eResource)).create(); } private void assertEquals(final String expected, final ITextSegment single, final Collection regions) { diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/TypeReferenceTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/TypeReferenceTest.java index 78c126272..f72024772 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/TypeReferenceTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/TypeReferenceTest.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.generator; import java.util.Collections; -import java.util.List; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.xtext.xbase.lib.CollectionLiterals; @@ -25,51 +24,37 @@ public class TypeReferenceTest { @Test public void testDefaultPackage() { final TypeReference ref = TypeReference.typeRef("EString"); - String _packageName = ref.getPackageName(); - Assert.assertEquals("", _packageName); - String _simpleName = ref.getSimpleName(); - Assert.assertEquals("EString", _simpleName); + Assert.assertEquals("", ref.getPackageName()); + Assert.assertEquals("EString", ref.getSimpleName()); } @Test public void testUnderscopresAnd$() { final TypeReference ref = TypeReference.typeRef("E_$tring"); - String _packageName = ref.getPackageName(); - Assert.assertEquals("", _packageName); - String _simpleName = ref.getSimpleName(); - Assert.assertEquals("E_$tring", _simpleName); + Assert.assertEquals("", ref.getPackageName()); + Assert.assertEquals("E_$tring", ref.getSimpleName()); } @Test public void testUnderscopresAnd$02() { final TypeReference ref = TypeReference.typeRef("$.$._$.E_$tring"); - String _packageName = ref.getPackageName(); - Assert.assertEquals("$.$._$", _packageName); - String _simpleName = ref.getSimpleName(); - Assert.assertEquals("E_$tring", _simpleName); + Assert.assertEquals("$.$._$", ref.getPackageName()); + Assert.assertEquals("E_$tring", ref.getSimpleName()); } @Test public void testPackageName() { final TypeReference ref = TypeReference.typeRef("org.example.MyType"); - String _simpleName = ref.getSimpleName(); - Assert.assertEquals("MyType", _simpleName); - String _packageName = ref.getPackageName(); - Assert.assertEquals("org.example", _packageName); + Assert.assertEquals("MyType", ref.getSimpleName()); + Assert.assertEquals("org.example", ref.getPackageName()); } @Test public void testParametrizedType() { - TypeReference _typeRef = TypeReference.typeRef("String"); - final TypeReference ref = TypeReference.typeRef("java.util.List", _typeRef); - String _simpleName = ref.getSimpleName(); - Assert.assertEquals("List", _simpleName); - String _packageName = ref.getPackageName(); - Assert.assertEquals("java.util", _packageName); - List _typeArguments = ref.getTypeArguments(); - TypeReference _head = IterableExtensions.head(_typeArguments); - String _simpleName_1 = _head.getSimpleName(); - Assert.assertEquals("String", _simpleName_1); + final TypeReference ref = TypeReference.typeRef("java.util.List", TypeReference.typeRef("String")); + Assert.assertEquals("List", ref.getSimpleName()); + Assert.assertEquals("java.util", ref.getPackageName()); + Assert.assertEquals("String", IterableExtensions.head(ref.getTypeArguments()).getSimpleName()); } @Test(expected = IllegalArgumentException.class) @@ -80,34 +65,25 @@ public class TypeReferenceTest { @Test public void testNestedType() { final TypeReference ref = new TypeReference("java.util", "Map.Entry"); - String _packageName = ref.getPackageName(); - Assert.assertEquals("java.util", _packageName); - String _simpleName = ref.getSimpleName(); - Assert.assertEquals("Entry", _simpleName); - List _simpleNames = ref.getSimpleNames(); - Assert.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList("Map", "Entry")), _simpleNames); + Assert.assertEquals("java.util", ref.getPackageName()); + Assert.assertEquals("Entry", ref.getSimpleName()); + Assert.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList("Map", "Entry")), ref.getSimpleNames()); } @Test public void testLowerCaseNestedType() { final TypeReference ref = new TypeReference("java.util", "Map.entry"); - String _packageName = ref.getPackageName(); - Assert.assertEquals("java.util", _packageName); - String _simpleName = ref.getSimpleName(); - Assert.assertEquals("entry", _simpleName); - List _simpleNames = ref.getSimpleNames(); - Assert.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList("Map", "entry")), _simpleNames); + Assert.assertEquals("java.util", ref.getPackageName()); + Assert.assertEquals("entry", ref.getSimpleName()); + Assert.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList("Map", "entry")), ref.getSimpleNames()); } @Test public void testGuessTypeRef() { final TypeReference ref = TypeReference.guessTypeRef("java.util.Map.Entry"); - String _packageName = ref.getPackageName(); - Assert.assertEquals("java.util", _packageName); - String _simpleName = ref.getSimpleName(); - Assert.assertEquals("Entry", _simpleName); - List _simpleNames = ref.getSimpleNames(); - Assert.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList("Map", "Entry")), _simpleNames); + Assert.assertEquals("java.util", ref.getPackageName()); + Assert.assertEquals("Entry", ref.getSimpleName()); + Assert.assertEquals(Collections.unmodifiableList(CollectionLiterals.newArrayList("Map", "Entry")), ref.getSimpleNames()); } @Test(expected = IllegalArgumentException.class) @@ -118,22 +94,19 @@ public class TypeReferenceTest { @Test public void testJavaPath() { final TypeReference ref = TypeReference.typeRef("org.example.MyType"); - String _javaPath = ref.getJavaPath(); - Assert.assertEquals("org/example/MyType.java", _javaPath); + Assert.assertEquals("org/example/MyType.java", ref.getJavaPath()); } @Test public void testXtendPath() { final TypeReference ref = TypeReference.typeRef("org.example.MyType"); - String _xtendPath = ref.getXtendPath(); - Assert.assertEquals("org/example/MyType.xtend", _xtendPath); + Assert.assertEquals("org/example/MyType.xtend", ref.getXtendPath()); } @Test public void testEObject() { final ResourceSetImpl rs = new ResourceSetImpl(); final TypeReference ref = new TypeReference(EcorePackage.Literals.EOBJECT, rs); - String _name = ref.getName(); - Assert.assertEquals("org.eclipse.emf.ecore.EObject", _name); + Assert.assertEquals("org.eclipse.emf.ecore.EObject", ref.getName()); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/parser/AntlrGrammarComparatorTestHelper.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/parser/AntlrGrammarComparatorTestHelper.java index 8380ffb48..ba1d821c8 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/parser/AntlrGrammarComparatorTestHelper.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/parser/AntlrGrammarComparatorTestHelper.java @@ -37,34 +37,27 @@ public class AntlrGrammarComparatorTestHelper { private static class TestErrorHandler implements AntlrGrammarComparator.IErrorHandler { @Override public void handleMismatch(final String match, final String matchReference, final AntlrGrammarComparator.ErrorContext context) { - AntlrGrammarComparator.MatchState _testedGrammar = context.getTestedGrammar(); - int _lineNumber = _testedGrammar.getLineNumber(); - AntlrGrammarComparator.MatchState _referenceGrammar = context.getReferenceGrammar(); - int _lineNumber_1 = _referenceGrammar.getLineNumber(); StringConcatenation _builder = new StringConcatenation(); _builder.append("Inputs differs at token "); _builder.append(match); _builder.append(" (line "); - AntlrGrammarComparator.MatchState _testedGrammar_1 = context.getTestedGrammar(); - int _lineNumber_2 = _testedGrammar_1.getLineNumber(); - _builder.append(_lineNumber_2); + int _lineNumber = context.getTestedGrammar().getLineNumber(); + _builder.append(_lineNumber); _builder.append("), expected token "); _builder.append(matchReference); _builder.append(" (line "); - AntlrGrammarComparator.MatchState _referenceGrammar_1 = context.getReferenceGrammar(); - int _lineNumber_3 = _referenceGrammar_1.getLineNumber(); - _builder.append(_lineNumber_3); + int _lineNumber_1 = context.getReferenceGrammar().getLineNumber(); + _builder.append(_lineNumber_1); _builder.append(")."); _builder.newLineIfNotEmpty(); - AntlrGrammarComparatorTestHelper.fail(_lineNumber, _lineNumber_1, _builder.toString()); + AntlrGrammarComparatorTestHelper.fail(context.getTestedGrammar().getLineNumber(), context.getReferenceGrammar().getLineNumber(), _builder.toString()); } @Override public void handleInvalidGeneratedGrammarFile(final AntlrGrammarComparator.ErrorContext context) { StringConcatenation _builder = new StringConcatenation(); _builder.append("Noticed an unmatched character sequence in \'testee\' in/before line "); - AntlrGrammarComparator.MatchState _testedGrammar = context.getTestedGrammar(); - int _lineNumber = _testedGrammar.getLineNumber(); + int _lineNumber = context.getTestedGrammar().getLineNumber(); _builder.append(_lineNumber); _builder.append("."); _builder.newLineIfNotEmpty(); @@ -75,8 +68,7 @@ public class AntlrGrammarComparatorTestHelper { public void handleInvalidReferenceGrammarFile(final AntlrGrammarComparator.ErrorContext context) { StringConcatenation _builder = new StringConcatenation(); _builder.append("Noticed an unmatched character sequence in \'expected\' in/before line "); - AntlrGrammarComparator.MatchState _referenceGrammar = context.getReferenceGrammar(); - int _lineNumber = _referenceGrammar.getLineNumber(); + int _lineNumber = context.getReferenceGrammar().getLineNumber(); _builder.append(_lineNumber); _builder.append("."); _builder.newLineIfNotEmpty(); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/trace/TraceRegionMergerTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/trace/TraceRegionMergerTest.java index a1d026b11..38079c4da 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/trace/TraceRegionMergerTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/trace/TraceRegionMergerTest.java @@ -43,16 +43,14 @@ public class TraceRegionMergerTest { TraceRegionMergerTest.TestBuilder _xblockexpression = null; { final TraceRegionMergerTest.TraceBuilder traceBuilder = new TraceRegionMergerTest.TraceBuilder(this, uri); - AbstractTraceRegion _apply = init.apply(traceBuilder); - this.roots.add(_apply); + this.roots.add(init.apply(traceBuilder)); _xblockexpression = this; } return _xblockexpression; } public void assertMerged(final Procedure1 init) { - TraceRegionMerger _traceRegionMerger = new TraceRegionMerger(); - final AbstractTraceRegion mergedRoot = _traceRegionMerger.mergeTraceRegions(this.roots); + final AbstractTraceRegion mergedRoot = new TraceRegionMerger().mergeTraceRegions(this.roots); Assert.assertNotNull(mergedRoot); LinkedList _newLinkedList = CollectionLiterals.newLinkedList(mergedRoot); final TraceRegionMergerTest.AssertBuilder assertBuilder = new TraceRegionMergerTest.AssertBuilder(this, _newLinkedList); @@ -133,15 +131,15 @@ public class TraceRegionMergerTest { Assert.assertEquals(head.toString(), length, head.getMyLength()); Assert.assertEquals(head.toString(), startLine, head.getMyLineNumber()); Assert.assertEquals(head.toString(), endLine, head.getMyEndLineNumber()); - List _associatedLocations = head.getAssociatedLocations(); final Function1 _function = (ILocationData it) -> { return it.getSrcRelativePath(); }; - List _map = ListExtensions.map(_associatedLocations, _function); - final Set associatedLocations = IterableExtensions.toSet(_map); + final Set associatedLocations = IterableExtensions.toSet(ListExtensions.map(head.getAssociatedLocations(), _function)); Assert.assertEquals(head.toString(), ((Object[])Conversions.unwrapArray(uris, Object.class)).length, ((Object[])Conversions.unwrapArray(associatedLocations, Object.class)).length); for (final String uri : uris) { - Assert.assertTrue(("Missing " + uri), associatedLocations.contains(new SourceRelativeURI(URI.createURI(uri)))); + URI _createURI = URI.createURI(uri); + SourceRelativeURI _sourceRelativeURI = new SourceRelativeURI(_createURI); + Assert.assertTrue(("Missing " + uri), associatedLocations.contains(_sourceRelativeURI)); } if ((init == null)) { Assert.assertTrue(head.getNestedRegions().isEmpty()); @@ -176,7 +174,6 @@ public class TraceRegionMergerTest { }; return it.region(2, 6, 1, 3, _function_1); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Procedure1 _function_1 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_2 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(2, 2, 1, 2, "foo"); @@ -185,7 +182,7 @@ public class TraceRegionMergerTest { }; it.region(2, 6, 1, 3, _function_2); }; - _traceTo.assertMerged(_function_1); + this.traceTo("foo", _function).assertMerged(_function_1); } @Test @@ -197,7 +194,6 @@ public class TraceRegionMergerTest { }; return it.region(0, 4, 0, 2, _function_1); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Function1 _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> { final Procedure1 _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> { it_1.region(0, 2, 0, 1); @@ -205,7 +201,6 @@ public class TraceRegionMergerTest { }; return it.region(0, 4, 0, 2, _function_2); }; - TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1); final Procedure1 _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(0, 2, 0, 1, "foo", "bar"); @@ -213,7 +208,7 @@ public class TraceRegionMergerTest { }; it.region(0, 4, 0, 2, _function_3); }; - _traceTo_1.assertMerged(_function_2); + this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2); } @Test @@ -224,14 +219,12 @@ public class TraceRegionMergerTest { }; return it.region(0, 2, 0, 1, _function_1); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Function1 _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> { final Procedure1 _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> { it_1.region(2, 2, 1, 2); }; return it.region(2, 2, 1, 2, _function_2); }; - TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1); final Procedure1 _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(0, 2, 0, 1, "foo"); @@ -239,7 +232,7 @@ public class TraceRegionMergerTest { }; it.region(0, 4, 0, 2, _function_3); }; - _traceTo_1.assertMerged(_function_2); + this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2); } @Test @@ -251,14 +244,12 @@ public class TraceRegionMergerTest { }; return it.region(0, 4, 0, 2, _function_1); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Function1 _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> { final Procedure1 _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> { it_1.region(2, 2, 1, 2); }; return it.region(2, 2, 1, 2, _function_2); }; - TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1); final Procedure1 _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(0, 2, 0, 1, "foo"); @@ -266,7 +257,7 @@ public class TraceRegionMergerTest { }; it.region(0, 4, 0, 2, _function_3); }; - _traceTo_1.assertMerged(_function_2); + this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2); } @Test @@ -278,11 +269,9 @@ public class TraceRegionMergerTest { }; return it.region(2, 6, 1, 3, _function_1); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Function1 _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> { return it.region(0, 3, 0, 1); }; - TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1); final Procedure1 _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(0, 2, 0, 1, "bar"); @@ -293,7 +282,7 @@ public class TraceRegionMergerTest { }; it.region(0, 8, 0, 3, _function_3); }; - _traceTo_1.assertMerged(_function_2); + this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2); } @Test @@ -301,11 +290,9 @@ public class TraceRegionMergerTest { final Function1 _function = (TraceRegionMergerTest.TraceBuilder it) -> { return it.region(0, 6, 0, 2); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Function1 _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> { return it.region(2, 2, 0, 1); }; - TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1); final Procedure1 _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(0, 2, 0, 0, "foo"); @@ -314,7 +301,7 @@ public class TraceRegionMergerTest { }; it.region(0, 6, 0, 2, _function_3); }; - _traceTo_1.assertMerged(_function_2); + this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2); } @Test @@ -322,11 +309,9 @@ public class TraceRegionMergerTest { final Function1 _function = (TraceRegionMergerTest.TraceBuilder it) -> { return it.region(0, 6, 0, 2); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Function1 _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> { return it.region(3, 2, 1, 1); }; - TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1); final Procedure1 _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(0, 3, 0, 1, "foo"); @@ -335,7 +320,7 @@ public class TraceRegionMergerTest { }; it.region(0, 6, 0, 2, _function_3); }; - _traceTo_1.assertMerged(_function_2); + this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2); } @Test @@ -343,11 +328,9 @@ public class TraceRegionMergerTest { final Function1 _function = (TraceRegionMergerTest.TraceBuilder it) -> { return it.region(0, 4, 0, 1); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Function1 _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> { return it.region(2, 4, 0, 2); }; - TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1); final Procedure1 _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(0, 2, 0, 0, "foo"); @@ -356,7 +339,7 @@ public class TraceRegionMergerTest { }; it.region(0, 6, 0, 2, _function_3); }; - _traceTo_1.assertMerged(_function_2); + this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2); } @Test @@ -364,11 +347,9 @@ public class TraceRegionMergerTest { final Function1 _function = (TraceRegionMergerTest.TraceBuilder it) -> { return it.region(0, 4, 0, 1); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Function1 _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> { return it.region(3, 3, 1, 2); }; - TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1); final Procedure1 _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(0, 3, 0, 1, "foo"); @@ -377,7 +358,7 @@ public class TraceRegionMergerTest { }; it.region(0, 6, 0, 2, _function_3); }; - _traceTo_1.assertMerged(_function_2); + this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2); } @Test @@ -390,7 +371,6 @@ public class TraceRegionMergerTest { }; return it.region(0, 9, 0, 3, _function_1); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Function1 _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> { final Procedure1 _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> { it_1.region(1, 3, 0, 1); @@ -398,7 +378,6 @@ public class TraceRegionMergerTest { }; return it.region(1, 6, 0, 2, _function_2); }; - TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1); final Procedure1 _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(0, 1, 0, 0, "foo"); @@ -410,7 +389,7 @@ public class TraceRegionMergerTest { }; it.region(0, 9, 0, 3, _function_3); }; - _traceTo_1.assertMerged(_function_2); + this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2); } @Test @@ -423,7 +402,6 @@ public class TraceRegionMergerTest { }; return it.region(0, 9, 0, 3, _function_1); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Function1 _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> { final Procedure1 _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> { it_1.region(2, 3, 0, 1); @@ -431,7 +409,6 @@ public class TraceRegionMergerTest { }; return it.region(2, 6, 0, 2, _function_2); }; - TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1); final Procedure1 _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(0, 2, 0, 0, "foo"); @@ -443,7 +420,7 @@ public class TraceRegionMergerTest { }; it.region(0, 9, 0, 3, _function_3); }; - _traceTo_1.assertMerged(_function_2); + this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2); } @Test @@ -456,7 +433,6 @@ public class TraceRegionMergerTest { }; return it.region(0, 9, 0, 3, _function_1); }; - TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function); final Function1 _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> { final Procedure1 _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> { it_1.region(1, 3, 0, 1); @@ -464,7 +440,6 @@ public class TraceRegionMergerTest { }; return it.region(1, 6, 0, 2, _function_2); }; - TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1); final Function1 _function_2 = (TraceRegionMergerTest.TraceBuilder it) -> { final Procedure1 _function_3 = (TraceRegionMergerTest.TraceBuilder it_1) -> { it_1.region(2, 3, 0, 1); @@ -472,7 +447,6 @@ public class TraceRegionMergerTest { }; return it.region(2, 6, 0, 2, _function_3); }; - TraceRegionMergerTest.TestBuilder _traceTo_2 = _traceTo_1.traceTo("baz", _function_2); final Procedure1 _function_3 = (TraceRegionMergerTest.AssertBuilder it) -> { final Procedure1 _function_4 = (TraceRegionMergerTest.AssertBuilder it_1) -> { it_1.region(0, 1, 0, 0, "foo"); @@ -487,11 +461,10 @@ public class TraceRegionMergerTest { }; it.region(0, 9, 0, 3, _function_4); }; - _traceTo_2.assertMerged(_function_3); + this.traceTo("foo", _function).traceTo("bar", _function_1).traceTo("baz", _function_2).assertMerged(_function_3); } public TraceRegionMergerTest.TestBuilder traceTo(final String uri, final Function1 init) { - TraceRegionMergerTest.TestBuilder _testBuilder = new TraceRegionMergerTest.TestBuilder(); - return _testBuilder.traceTo(uri, init); + return new TraceRegionMergerTest.TestBuilder().traceTo(uri, init); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/trace/TraceRegionToStringTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/trace/TraceRegionToStringTest.java index e7e072abc..034793104 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/trace/TraceRegionToStringTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/generator/trace/TraceRegionToStringTest.java @@ -292,8 +292,6 @@ public class TraceRegionToStringTest { public void operator_tripleEquals(final TraceRegionToStringTester actual, final CharSequence expectation) { final String rendered = actual.toString(); - String _string = expectation.toString(); - String _trim = _string.trim(); - Assert.assertEquals(_trim, rendered); + Assert.assertEquals(expectation.toString().trim(), rendered); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.java index 2e441050f..484a1b703 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.java @@ -39,8 +39,7 @@ public class IndexTestLanguageInjectorProvider implements IInjectorProvider, IRe } protected Injector internalCreateInjector() { - IndexTestLanguageStandaloneSetup _indexTestLanguageStandaloneSetup = new IndexTestLanguageStandaloneSetup(); - return _indexTestLanguageStandaloneSetup.createInjectorAndDoEMFRegistration(); + return new IndexTestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration(); } @Override diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/Bug410560Test.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/Bug410560Test.java index 64a19c922..1e7f4fcdc 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/Bug410560Test.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/Bug410560Test.java @@ -104,8 +104,7 @@ public class Bug410560Test extends AbstractXtextTests { final Model model = ((Model) _model); Resource _eResource = model.eResource(); final XtextResource res = ((XtextResource) _eResource); - int _indexOf = modelAsString.indexOf("a"); - res.update(_indexOf, 1, "b"); + res.update(modelAsString.indexOf("a"), 1, "b"); Assert.assertSame(model, IterableExtensions.head(res.getContents())); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -120,9 +119,7 @@ public class Bug410560Test extends AbstractXtextTests { final Model model = ((Model) _model); Resource _eResource = model.eResource(); final XtextResource res = ((XtextResource) _eResource); - int _indexOf = modelAsString.indexOf("t"); - int _length = "tworequired a b".length(); - res.update(_indexOf, _length, " "); + res.update(modelAsString.indexOf("t"), "tworequired a b".length(), " "); Assert.assertSame(model, IterableExtensions.head(res.getContents())); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -137,9 +134,7 @@ public class Bug410560Test extends AbstractXtextTests { final Model model = ((Model) _model); Resource _eResource = model.eResource(); final XtextResource res = ((XtextResource) _eResource); - int _indexOf = modelAsString.indexOf("t"); - int _length = "tworequired a b".length(); - res.update(_indexOf, _length, " "); + res.update(modelAsString.indexOf("t"), "tworequired a b".length(), " "); Assert.assertSame(model, IterableExtensions.head(res.getContents())); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -150,10 +145,7 @@ public class Bug410560Test extends AbstractXtextTests { public void testPartialParsingRemoveNestedIndent_01() { try { final String modelAsString = "({{ tworequired a b }})"; - PartialParsingProcessor _get = this.get(PartialParsingProcessor.class); - int _indexOf = modelAsString.indexOf("t"); - int _length = "tworequired a b".length(); - _get.processFile(modelAsString, modelAsString, _indexOf, _length, " "); + this.get(PartialParsingProcessor.class).processFile(modelAsString, modelAsString, modelAsString.indexOf("t"), "tworequired a b".length(), " "); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/fragments/AbstractFragmentsTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/fragments/AbstractFragmentsTest.java index b7116494c..985e23f64 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/fragments/AbstractFragmentsTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/fragments/AbstractFragmentsTest.java @@ -14,7 +14,6 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.impl.InvariantChecker; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; -import org.eclipse.xtext.parser.IParseResult; import org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamed; import org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamedWithAction; import org.eclipse.xtext.parser.fragments.fragmentTestLanguage.ParserRuleFragments; @@ -95,7 +94,8 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests { final ParserRuleFragments fragments = this.parseAndValidate("#4 prev current"); Assert.assertNotNull(fragments); Assert.assertEquals("current", fragments.getElement().getName()); - Assert.assertEquals("prev", ((PRFNamedWithAction) fragments.getElement()).getPrev().getName()); + PRFNamed _element = fragments.getElement(); + Assert.assertEquals("prev", ((PRFNamedWithAction) _element).getPrev().getName()); } @Test @@ -116,7 +116,8 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests { final ParserRuleFragments fragments = this.parseAndValidate("#5 prev current"); Assert.assertNotNull(fragments); Assert.assertEquals("current", fragments.getElement().getName()); - Assert.assertEquals("prev", ((PRFNamedWithAction) fragments.getElement()).getPrev().getName()); + PRFNamed _element = fragments.getElement(); + Assert.assertEquals("prev", ((PRFNamedWithAction) _element).getPrev().getName()); } @Test @@ -125,7 +126,8 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests { final ParserRuleFragments fragments = this.parseAndValidate("#6 prev current"); Assert.assertNotNull(fragments); Assert.assertEquals("current", fragments.getElement().getName()); - Assert.assertEquals("prev", ((PRFNamedWithAction) fragments.getElement()).getPrev().getName()); + PRFNamed _element = fragments.getElement(); + Assert.assertEquals("prev", ((PRFNamedWithAction) _element).getPrev().getName()); } @Test @@ -263,8 +265,7 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests { this.validationTestHelper.assertNoIssues(result); Resource _eResource = result.eResource(); final XtextResource resource = ((XtextResource) _eResource); - IParseResult _parseResult = resource.getParseResult(); - final ICompositeNode node = _parseResult.getRootNode(); + final ICompositeNode node = resource.getParseResult().getRootNode(); this.invariantChecker.checkInvariant(node); return result; } catch (Throwable _e) { diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.java index 550d9c8ca..e9f814eda 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.java @@ -13,7 +13,6 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.impl.InvariantChecker; -import org.eclipse.xtext.parser.IParseResult; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode; import org.eclipse.xtext.parser.indentation.tests.IndentationAwareTestLanguageInjectorProvider; @@ -109,9 +108,7 @@ public class IndentationAwareLanguageTest { _builder_1.append("\t"); _builder_1.append("child"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _asText = this.asText(tree); - Assert.assertEquals(_string, _asText); + Assert.assertEquals(_builder_1.toString(), this.asText(tree)); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -139,9 +136,7 @@ public class IndentationAwareLanguageTest { _builder_1.append("\t"); _builder_1.append("child"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _asText = this.asText(tree); - Assert.assertEquals(_string, _asText); + Assert.assertEquals(_builder_1.toString(), this.asText(tree)); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -174,9 +169,7 @@ public class IndentationAwareLanguageTest { _builder_1.append("\t"); _builder_1.append("d"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _asText = this.asText(tree); - Assert.assertEquals(_string, _asText); + Assert.assertEquals(_builder_1.toString(), this.asText(tree)); } @Test @@ -228,9 +221,7 @@ public class IndentationAwareLanguageTest { _builder_1.newLine(); _builder_1.append("h"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _asText = this.asText(tree); - Assert.assertEquals(_string, _asText); + Assert.assertEquals(_builder_1.toString(), this.asText(tree)); } @Test @@ -258,9 +249,7 @@ public class IndentationAwareLanguageTest { _builder_1.newLine(); _builder_1.append("d"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _asText = this.asText(tree); - Assert.assertEquals(_string, _asText); + Assert.assertEquals(_builder_1.toString(), this.asText(tree)); } @Test @@ -372,9 +361,7 @@ public class IndentationAwareLanguageTest { _builder_1.append("\t\t\t\t"); _builder_1.append("level4_9"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _asText = this.asText(tree); - Assert.assertEquals(_string, _asText); + Assert.assertEquals(_builder_1.toString(), this.asText(tree)); } @Test @@ -410,9 +397,7 @@ public class IndentationAwareLanguageTest { _builder_1.append("\t"); _builder_1.append("y"); _builder_1.newLine(); - String _string = _builder_1.toString(); - String _asText = this.asText(tree); - Assert.assertEquals(_string, _asText); + Assert.assertEquals(_builder_1.toString(), this.asText(tree)); } private Tree parseAndValidate(final CharSequence s) { @@ -421,8 +406,7 @@ public class IndentationAwareLanguageTest { this.validationTestHelper.assertNoIssues(result); Resource _eResource = result.eResource(); final XtextResource resource = ((XtextResource) _eResource); - IParseResult _parseResult = resource.getParseResult(); - final ICompositeNode node = _parseResult.getRootNode(); + final ICompositeNode node = resource.getParseResult().getRootNode(); this.invariantChecker.checkInvariant(node); return result; } catch (Throwable _e) { diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingErrorTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingErrorTest.java index f15d8418a..b9719f8ae 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingErrorTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingErrorTest.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.parser.indentation; import com.google.inject.Inject; -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; @@ -56,8 +55,7 @@ public class IndentationAwarePartialParsingErrorTest { final XtextResource resource = ((XtextResource) _eResource); final int idx = model.indexOf(" // 8"); resource.update(idx, 0, "c"); - EList _contents = resource.getContents(); - EObject _head = IterableExtensions.head(_contents); + EObject _head = IterableExtensions.head(resource.getContents()); final Tree reparsed = ((Tree) _head); Assert.assertNotSame(tree, reparsed); } catch (Throwable _e) { @@ -89,8 +87,7 @@ public class IndentationAwarePartialParsingErrorTest { final XtextResource resource = ((XtextResource) _eResource); final int idx = model.indexOf(" // tab"); resource.update(idx, 0, "c"); - EList _contents = resource.getContents(); - EObject _head = IterableExtensions.head(_contents); + EObject _head = IterableExtensions.head(resource.getContents()); final Tree reparsed = ((Tree) _head); Assert.assertNotSame(tree, reparsed); } catch (Throwable _e) { diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/AbstractResourceSetTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/AbstractResourceSetTest.java index bf8c48194..8c56ff679 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/AbstractResourceSetTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/AbstractResourceSetTest.java @@ -7,7 +7,6 @@ */ package org.eclipse.xtext.resource; -import java.util.Map; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; @@ -35,9 +34,7 @@ public abstract class AbstractResourceSetTest { return _xblockexpression; }; final Resource.Factory nullFactory = _function; - Resource.Factory.Registry _resourceFactoryRegistry = rs.getResourceFactoryRegistry(); - Map _extensionToFactoryMap = _resourceFactoryRegistry.getExtensionToFactoryMap(); - _extensionToFactoryMap.put("xmi", nullFactory); + rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", nullFactory); Assert.assertEquals(0, rs.getURIResourceMap().size()); final URI uri = URI.createURI("file:/does/not/exist.xmi"); final Resource demandLoaded = rs.getResource(uri, true); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/AbstractXtextResourceSetTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/AbstractXtextResourceSetTest.java index 0005c3907..6de042da4 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/AbstractXtextResourceSetTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/AbstractXtextResourceSetTest.java @@ -34,8 +34,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe EList _resources = rs.getResources(); _resources.add(resource); Assert.assertEquals(1, rs.getURIResourceMap().size()); - EList _resources_1 = rs.getResources(); - _resources_1.remove(resource); + rs.getResources().remove(resource); Assert.assertTrue(resource.eAdapters().isEmpty()); Assert.assertEquals(0, rs.getURIResourceMap().size()); } @@ -50,8 +49,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe ArrayList _newArrayList = CollectionLiterals.newArrayList(resource); Iterables.addAll(_resources, _newArrayList); Assert.assertEquals(1, rs.getURIResourceMap().size()); - EList _resources_1 = rs.getResources(); - _resources_1.remove(resource); + rs.getResources().remove(resource); Assert.assertTrue(resource.eAdapters().isEmpty()); Assert.assertEquals(0, rs.getURIResourceMap().size()); } @@ -78,8 +76,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe resource.setURI(null); Assert.assertEquals(1, rs.getURIResourceMap().size()); Assert.assertEquals(resource, rs.getURIResourceMap().get(null)); - EList _resources_1 = rs.getResources(); - _resources_1.remove(resource); + rs.getResources().remove(resource); Assert.assertTrue(resource.eAdapters().isEmpty()); Assert.assertEquals(0, rs.getURIResourceMap().size()); } @@ -94,8 +91,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe ArrayList _newArrayList = CollectionLiterals.newArrayList(resource); Iterables.addAll(_resources, _newArrayList); Assert.assertEquals(1, rs.getURIResourceMap().size()); - EList _resources_1 = rs.getResources(); - _resources_1.clear(); + rs.getResources().clear(); Assert.assertTrue(resource.eAdapters().isEmpty()); Assert.assertEquals(0, rs.getURIResourceMap().size()); } @@ -111,8 +107,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe Iterables.addAll(_resources, _newArrayList); Assert.assertEquals(1, rs.getURIResourceMap().size()); rs.eSetDeliver(false); - EList _resources_1 = rs.getResources(); - _resources_1.clear(); + rs.getResources().clear(); Assert.assertTrue(resource.eAdapters().isEmpty()); Assert.assertEquals(0, rs.getURIResourceMap().size()); } @@ -126,8 +121,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe EList _resources = rs.getResources(); _resources.add(resource); Assert.assertEquals(2, rs.getURIResourceMap().size()); - EList _resources_1 = rs.getResources(); - _resources_1.remove(resource); + rs.getResources().remove(resource); Assert.assertTrue(resource.eAdapters().isEmpty()); Assert.assertEquals(0, rs.getURIResourceMap().size()); } @@ -142,8 +136,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe ArrayList _newArrayList = CollectionLiterals.newArrayList(resource); Iterables.addAll(_resources, _newArrayList); Assert.assertEquals(2, rs.getURIResourceMap().size()); - EList _resources_1 = rs.getResources(); - _resources_1.remove(resource); + rs.getResources().remove(resource); Assert.assertTrue(resource.eAdapters().isEmpty()); Assert.assertEquals(0, rs.getURIResourceMap().size()); } @@ -176,8 +169,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe Assert.assertEquals(1, rs.getURIResourceMap().size()); Assert.assertEquals(resource, rs.getURIResourceMap().get(null)); Assert.assertEquals(0, rs.getNormalizationMap().size()); - EList _resources_1 = rs.getResources(); - _resources_1.remove(resource); + rs.getResources().remove(resource); Assert.assertTrue(resource.eAdapters().isEmpty()); Assert.assertEquals(0, rs.getURIResourceMap().size()); Assert.assertEquals(0, rs.getNormalizationMap().size()); @@ -193,8 +185,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe ArrayList _newArrayList = CollectionLiterals.newArrayList(resource); Iterables.addAll(_resources, _newArrayList); Assert.assertEquals(2, rs.getURIResourceMap().size()); - EList _resources_1 = rs.getResources(); - _resources_1.clear(); + rs.getResources().clear(); Assert.assertTrue(resource.eAdapters().isEmpty()); Assert.assertEquals(0, rs.getURIResourceMap().size()); } @@ -210,8 +201,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe Iterables.addAll(_resources, _newArrayList); Assert.assertEquals(2, rs.getURIResourceMap().size()); rs.eSetDeliver(false); - EList _resources_1 = rs.getResources(); - _resources_1.clear(); + rs.getResources().clear(); Assert.assertTrue(resource.eAdapters().isEmpty()); Assert.assertEquals(0, rs.getURIResourceMap().size()); } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/Bug451668Test.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/Bug451668Test.java index 188fe856b..6de859c3d 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/Bug451668Test.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/Bug451668Test.java @@ -39,8 +39,7 @@ public class Bug451668Test extends AbstractXtextTests { try { this.with(OptionalEmptyTestLanguageStandaloneSetup.class); Bug451668Test.TestResource r = this.get(Bug451668Test.TestResource.class); - URI _createURI = URI.createURI("foo.dummy"); - r.setURI(_createURI); + r.setURI(URI.createURI("foo.dummy")); StringInputStream _stringInputStream = new StringInputStream(""); r.load(_stringInputStream, null); Assert.assertTrue(r.isLoaded()); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/SetEntryPointOnXtextResourceTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/SetEntryPointOnXtextResourceTest.java index 372d63925..28a1b95bd 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/SetEntryPointOnXtextResourceTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/SetEntryPointOnXtextResourceTest.java @@ -7,14 +7,10 @@ */ package org.eclipse.xtext.resource; -import java.util.Map; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtext.ParserRule; -import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; -import org.eclipse.xtext.parser.IParseResult; import org.eclipse.xtext.resource.IResourceFactory; import org.eclipse.xtext.resource.XtextResource; import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup; @@ -36,49 +32,30 @@ public class SetEntryPointOnXtextResourceTest extends AbstractXtextTests { try { this.with(ReferenceGrammarTestLanguageStandaloneSetup.class); final String model = "kind (Hugo 13)"; - ReferenceGrammarTestLanguageGrammarAccess _get = this.get(ReferenceGrammarTestLanguageGrammarAccess.class); - final ParserRule kindRule = _get.getKindRule(); + final ParserRule kindRule = this.get(ReferenceGrammarTestLanguageGrammarAccess.class).getKindRule(); final XtextResource resource = this.createResource(); resource.setEntryPoint(kindRule); StringInputStream _stringInputStream = new StringInputStream(model); - Map _emptyMap = CollectionLiterals.emptyMap(); - resource.load(_stringInputStream, _emptyMap); - EList _errors = resource.getErrors(); - boolean _isEmpty = _errors.isEmpty(); - Assert.assertTrue(_isEmpty); - IParseResult _parseResult = resource.getParseResult(); - ICompositeNode _rootNode = _parseResult.getRootNode(); - ParserRule _entryParserRule = NodeModelUtils.getEntryParserRule(_rootNode); - Assert.assertEquals(kindRule, _entryParserRule); - IParseResult _parseResult_1 = resource.getParseResult(); - ICompositeNode _rootNode_1 = _parseResult_1.getRootNode(); - final String originalNodeModel = NodeModelUtils.compactDump(_rootNode_1, false); - int _length = model.length(); - resource.update(0, _length, ((" " + model) + " ")); - IParseResult _parseResult_2 = resource.getParseResult(); - ICompositeNode _rootNode_2 = _parseResult_2.getRootNode(); - final String reparsedNodeModel = NodeModelUtils.compactDump(_rootNode_2, false); + resource.load(_stringInputStream, CollectionLiterals.emptyMap()); + Assert.assertTrue(resource.getErrors().isEmpty()); + Assert.assertEquals(kindRule, NodeModelUtils.getEntryParserRule(resource.getParseResult().getRootNode())); + final String originalNodeModel = NodeModelUtils.compactDump(resource.getParseResult().getRootNode(), false); + resource.update(0, model.length(), ((" " + model) + " ")); + final String reparsedNodeModel = NodeModelUtils.compactDump(resource.getParseResult().getRootNode(), false); Assert.assertEquals(originalNodeModel, reparsedNodeModel); - ReferenceGrammarTestLanguageGrammarAccess _get_1 = this.get(ReferenceGrammarTestLanguageGrammarAccess.class); - final ParserRule erwachsenerRule = _get_1.getErwachsenerRule(); + final ParserRule erwachsenerRule = this.get(ReferenceGrammarTestLanguageGrammarAccess.class).getErwachsenerRule(); resource.setEntryPoint(erwachsenerRule); - int _length_1 = model.length(); - resource.update(0, _length_1, "erwachsener (Peter 30)"); - IParseResult _parseResult_3 = resource.getParseResult(); - ICompositeNode _rootNode_3 = _parseResult_3.getRootNode(); - ParserRule _entryParserRule_1 = NodeModelUtils.getEntryParserRule(_rootNode_3); - Assert.assertEquals(erwachsenerRule, _entryParserRule_1); + resource.update(0, model.length(), "erwachsener (Peter 30)"); + Assert.assertEquals(erwachsenerRule, NodeModelUtils.getEntryParserRule(resource.getParseResult().getRootNode())); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } } private XtextResource createResource() { - IResourceFactory _get = this.get(IResourceFactory.class); String _currentFileExtension = this.getCurrentFileExtension(); String _plus = ("dummy." + _currentFileExtension); - URI _createURI = URI.createURI(_plus); - Resource _createResource = _get.createResource(_createURI); + Resource _createResource = this.get(IResourceFactory.class).createResource(URI.createURI(_plus)); return ((XtextResource) _createResource); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/SynchronizedXtextResourceSetTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/SynchronizedXtextResourceSetTest.java index e4d91c766..700c9e7d4 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/SynchronizedXtextResourceSetTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/SynchronizedXtextResourceSetTest.java @@ -9,16 +9,11 @@ package org.eclipse.xtext.resource; import com.google.common.collect.Iterables; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.List; -import java.util.Map; -import java.util.Set; import java.util.function.Consumer; -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.AbstractXtextResourceSetTest; import org.eclipse.xtext.resource.NullResource; import org.eclipse.xtext.resource.SynchronizedXtextResourceSet; @@ -54,11 +49,8 @@ public class SynchronizedXtextResourceSetTest extends AbstractXtextResourceSetTe return _xblockexpression; }; final Resource.Factory nullFactory = _function; - Resource.Factory.Registry _resourceFactoryRegistry = resourceSet.getResourceFactoryRegistry(); - Map _extensionToFactoryMap = _resourceFactoryRegistry.getExtensionToFactoryMap(); - _extensionToFactoryMap.put("xmi", nullFactory); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", nullFactory); final ArrayList threads = CollectionLiterals.newArrayList(); - IntegerRange _upTo = new IntegerRange(1, 10); final Consumer _function_1 = (Integer i) -> { final Runnable _function_2 = () -> { final ArrayList resources = CollectionLiterals.newArrayList(); @@ -67,71 +59,40 @@ public class SynchronizedXtextResourceSetTest extends AbstractXtextResourceSetTe String _plus = (i + " "); String _plus_1 = (_plus + Integer.valueOf(j)); String _plus_2 = (_plus_1 + ".xmi"); - URI _createURI = URI.createURI(_plus_2); - final Resource resource = resourceSet.createResource(_createURI); + final Resource resource = resourceSet.createResource(URI.createURI(_plus_2)); Assert.assertNotNull(resource); resources.add(resource); URI _uRI = resource.getURI(); String _plus_3 = (_uRI + "b"); - URI _createURI_1 = URI.createURI(_plus_3); - resource.setURI(_createURI_1); + resource.setURI(URI.createURI(_plus_3)); } } }; Thread _thread = new Thread(_function_2); threads.add(_thread); }; - _upTo.forEach(_function_1); + new IntegerRange(1, 10).forEach(_function_1); for (final Thread thread : threads) { thread.start(); } for (final Thread thread_1 : threads) { thread_1.join(); } - EList _resources = resourceSet.getResources(); - int _size = _resources.size(); - Assert.assertEquals(50000, _size); - EList _resources_1 = resourceSet.getResources(); - Set _set = IterableExtensions.toSet(_resources_1); - int _size_1 = _set.size(); - Map _uRIResourceMap = resourceSet.getURIResourceMap(); - Collection _values = _uRIResourceMap.values(); - Set _set_1 = IterableExtensions.toSet(_values); - int _size_2 = _set_1.size(); - Assert.assertEquals(_size_1, _size_2); - EList _resources_2 = resourceSet.getResources(); + Assert.assertEquals(50000, resourceSet.getResources().size()); + Assert.assertEquals(IterableExtensions.toSet(resourceSet.getResources()).size(), IterableExtensions.toSet(resourceSet.getURIResourceMap().values()).size()); final Function1> _function_2 = (Resource it) -> { URI _uRI = it.getURI(); - URIConverter _uRIConverter = resourceSet.getURIConverter(); - URI _uRI_1 = it.getURI(); - URI _normalize = _uRIConverter.normalize(_uRI_1); + URI _normalize = resourceSet.getURIConverter().normalize(it.getURI()); return Collections.unmodifiableList(CollectionLiterals.newArrayList(_uRI, _normalize)); }; - List> _map = ListExtensions.>map(_resources_2, _function_2); - Iterable _flatten = Iterables.concat(_map); - Set _set_2 = IterableExtensions.toSet(_flatten); - Map _uRIResourceMap_1 = resourceSet.getURIResourceMap(); - Set _keySet = _uRIResourceMap_1.keySet(); - Assert.assertEquals(_set_2, _keySet); - EList _resources_3 = resourceSet.getResources(); + Assert.assertEquals(IterableExtensions.toSet(Iterables.concat(ListExtensions.>map(resourceSet.getResources(), _function_2))), resourceSet.getURIResourceMap().keySet()); final Function1 _function_3 = (Resource it) -> { - URI _uRI = it.getURI(); - return _uRI.toString(); + return it.getURI().toString(); }; - List _map_1 = ListExtensions.map(_resources_3, _function_3); - List _list = IterableExtensions.toList(_map_1); - List _sort = IterableExtensions.sort(_list); - String _join = IterableExtensions.join(_sort, "\n"); - Map _normalizationMap = resourceSet.getNormalizationMap(); - Set _keySet_1 = _normalizationMap.keySet(); final Function1 _function_4 = (URI it) -> { return it.toString(); }; - Iterable _map_2 = IterableExtensions.map(_keySet_1, _function_4); - List _list_1 = IterableExtensions.toList(_map_2); - List _sort_1 = IterableExtensions.sort(_list_1); - String _join_1 = IterableExtensions.join(_sort_1, "\n"); - Assert.assertEquals(_join, _join_1); + Assert.assertEquals(IterableExtensions.join(IterableExtensions.sort(IterableExtensions.toList(ListExtensions.map(resourceSet.getResources(), _function_3))), "\n"), IterableExtensions.join(IterableExtensions.sort(IterableExtensions.toList(IterableExtensions.map(resourceSet.getNormalizationMap().keySet(), _function_4))), "\n")); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/persistence/PortableURIsTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/persistence/PortableURIsTest.java index 9dd723222..1622c9410 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/persistence/PortableURIsTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/persistence/PortableURIsTest.java @@ -10,8 +10,6 @@ package org.eclipse.xtext.resource.persistence; import com.google.common.collect.Iterables; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -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.EcorePackage; @@ -22,9 +20,7 @@ import org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup; import org.eclipse.xtext.linking.langATestLanguage.Main; import org.eclipse.xtext.linking.langATestLanguage.Type; import org.eclipse.xtext.resource.IReferenceDescription; -import org.eclipse.xtext.resource.IResourceDescription; import org.eclipse.xtext.resource.XtextResourceSet; -import org.eclipse.xtext.resource.persistence.IResourceStorageFacade; import org.eclipse.xtext.resource.persistence.PortableURIs; import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable; import org.eclipse.xtext.resource.persistence.ResourceStorageWritable; @@ -51,34 +47,24 @@ public class PortableURIsTest extends AbstractXtextTests { public void testPortableUris() { try { final XtextResourceSet resourceSet = this.get(XtextResourceSet.class); - URI _createURI = URI.createURI("hubba:/bubba.langatestlanguage"); - Resource _createResource = resourceSet.createResource(_createURI); + Resource _createResource = resourceSet.createResource(URI.createURI("hubba:/bubba.langatestlanguage")); final StorageAwareResource resourceA = ((StorageAwareResource) _createResource); - URI _createURI_1 = URI.createURI("hubba:/bubba2.langatestlanguage"); - Resource _createResource_1 = resourceSet.createResource(_createURI_1); + Resource _createResource_1 = resourceSet.createResource(URI.createURI("hubba:/bubba2.langatestlanguage")); final StorageAwareResource resourceB = ((StorageAwareResource) _createResource_1); StringConcatenation _builder = new StringConcatenation(); _builder.append("type B"); _builder.newLine(); - InputStream _asStream = this.getAsStream(_builder.toString()); - resourceB.load(_asStream, null); + resourceB.load(this.getAsStream(_builder.toString()), null); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("import \'hubba:/bubba2.langatestlanguage\'"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("type A extends B"); _builder_1.newLine(); - InputStream _asStream_1 = this.getAsStream(_builder_1.toString()); - resourceA.load(_asStream_1, null); - EList _contents = resourceA.getContents(); - Iterable
_filter = Iterables.
filter(_contents, Main.class); - Main _head = IterableExtensions.
head(_filter); - EList _types = _head.getTypes(); - Type _head_1 = IterableExtensions.head(_types); - final Type extended = _head_1.getExtends(); + resourceA.load(this.getAsStream(_builder_1.toString()), null); + final Type extended = IterableExtensions.head(IterableExtensions.
head(Iterables.
filter(resourceA.getContents(), Main.class)).getTypes()).getExtends(); final URI uri = EcoreUtil.getURI(extended); - PortableURIs _portableURIs = resourceA.getPortableURIs(); - final URI portableURI = _portableURIs.toPortableURI(resourceA, uri); + final URI portableURI = resourceA.getPortableURIs().toPortableURI(resourceA, uri); Assert.assertEquals(resourceA.getURI(), portableURI.trimFragment()); Assert.assertTrue(resourceA.getPortableURIs().isPortableURIFragment(portableURI.fragment())); Assert.assertSame(extended, resourceA.getEObject(portableURI.fragment())); @@ -91,42 +77,35 @@ public class PortableURIsTest extends AbstractXtextTests { public void testPortableReferenceDescriptions() { try { final XtextResourceSet resourceSet = this.get(XtextResourceSet.class); - URI _createURI = URI.createURI("hubba:/bubba.langatestlanguage"); - Resource _createResource = resourceSet.createResource(_createURI); + Resource _createResource = resourceSet.createResource(URI.createURI("hubba:/bubba.langatestlanguage")); final StorageAwareResource resourceA = ((StorageAwareResource) _createResource); - URI _createURI_1 = URI.createURI("hubba:/bubba2.langatestlanguage"); - Resource _createResource_1 = resourceSet.createResource(_createURI_1); + Resource _createResource_1 = resourceSet.createResource(URI.createURI("hubba:/bubba2.langatestlanguage")); final StorageAwareResource resourceB = ((StorageAwareResource) _createResource_1); StringConcatenation _builder = new StringConcatenation(); _builder.append("type B"); _builder.newLine(); - InputStream _asStream = this.getAsStream(_builder.toString()); - resourceB.load(_asStream, null); + resourceB.load(this.getAsStream(_builder.toString()), null); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("import \'hubba:/bubba2.langatestlanguage\'"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("type A extends B"); _builder_1.newLine(); - InputStream _asStream_1 = this.getAsStream(_builder_1.toString()); - resourceA.load(_asStream_1, null); + resourceA.load(this.getAsStream(_builder_1.toString()), null); final ByteArrayOutputStream bout = new ByteArrayOutputStream(); - IResourceStorageFacade _resourceStorageFacade = resourceA.getResourceStorageFacade(); - final ResourceStorageWritable writable = _resourceStorageFacade.createResourceStorageWritable(bout); + final ResourceStorageWritable writable = resourceA.getResourceStorageFacade().createResourceStorageWritable(bout); writable.writeResource(resourceA); - IResourceStorageFacade _resourceStorageFacade_1 = resourceA.getResourceStorageFacade(); byte[] _byteArray = bout.toByteArray(); ByteArrayInputStream _byteArrayInputStream = new ByteArrayInputStream(_byteArray); - final ResourceStorageLoadable loadable = _resourceStorageFacade_1.createResourceStorageLoadable(_byteArrayInputStream); - URI _createURI_2 = URI.createURI("hubba:/bubba3.langatestlanguage"); - Resource _createResource_2 = resourceSet.createResource(_createURI_2); + final ResourceStorageLoadable loadable = resourceA.getResourceStorageFacade().createResourceStorageLoadable(_byteArrayInputStream); + Resource _createResource_2 = resourceSet.createResource(URI.createURI("hubba:/bubba3.langatestlanguage")); final StorageAwareResource resourceC = ((StorageAwareResource) _createResource_2); resourceC.loadFromStorage(loadable); - IResourceDescription _resourceDescription = resourceC.getResourceDescription(); - Iterable _referenceDescriptions = _resourceDescription.getReferenceDescriptions(); - final IReferenceDescription refDesc = IterableExtensions.head(_referenceDescriptions); - Assert.assertSame(IterableExtensions.head(((Main) IterableExtensions.head(resourceB.getContents())).getTypes()), resourceSet.getEObject(refDesc.getTargetEObjectUri(), false)); - Assert.assertSame(IterableExtensions.head(((Main) IterableExtensions.head(resourceC.getContents())).getTypes()), resourceSet.getEObject(refDesc.getSourceEObjectUri(), false)); + final IReferenceDescription refDesc = IterableExtensions.head(resourceC.getResourceDescription().getReferenceDescriptions()); + EObject _head = IterableExtensions.head(resourceB.getContents()); + Assert.assertSame(IterableExtensions.head(((Main) _head).getTypes()), resourceSet.getEObject(refDesc.getTargetEObjectUri(), false)); + EObject _head_1 = IterableExtensions.head(resourceC.getContents()); + Assert.assertSame(IterableExtensions.head(((Main) _head_1).getTypes()), resourceSet.getEObject(refDesc.getSourceEObjectUri(), false)); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -151,7 +130,6 @@ public class PortableURIsTest extends AbstractXtextTests { public void checkFragmentBothDirections(final EObject container, final EObject child) { final PortableURIs portableURIs = new PortableURIs(); final String fragment = portableURIs.getFragment(container, child); - EObject _eObject = portableURIs.getEObject(container, fragment); - Assert.assertSame(child, _eObject); + Assert.assertSame(child, portableURIs.getEObject(container, fragment)); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableResourceDescriptionTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableResourceDescriptionTest.java index 8cc929bda..9648bcd18 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableResourceDescriptionTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableResourceDescriptionTest.java @@ -12,7 +12,6 @@ import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Collections; -import java.util.List; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.xtext.naming.QualifiedName; @@ -64,7 +63,8 @@ public class SerializableResourceDescriptionTest { it_1.setEObjectURI(uri.appendFragment("baz")); it_1.qualifiedName = QualifiedName.create("foo", "baz"); it_1.setEClass(EcorePackage.eINSTANCE.getEAttribute()); - it_1.userData = CollectionLiterals.newHashMap(Pair.of("myKey", "myValue")); + Pair _mappedTo = Pair.of("myKey", "myValue"); + it_1.userData = CollectionLiterals.newHashMap(_mappedTo); }; SerializableEObjectDescription _doubleArrow_2 = ObjectExtensions.operator_doubleArrow(_serializableEObjectDescription, _function_3); it.setDescriptions(Collections.unmodifiableList(CollectionLiterals.newArrayList(_doubleArrow_2))); @@ -91,15 +91,12 @@ public class SerializableResourceDescriptionTest { Assert.assertEquals(before.getURI(), after.getURI()); Assert.assertEquals(before.getImportedNames(), after.getImportedNames()); Assert.assertEquals(before.getReferences().size(), after.getReferences().size()); - List _references = before.getReferences(); - int _size = _references.size(); + int _size = before.getReferences().size(); ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true); for (final int i : _doubleDotLessThan) { { - List _references_1 = before.getReferences(); - final SerializableReferenceDescription beforeRef = _references_1.get(i); - List _references_2 = after.getReferences(); - final SerializableReferenceDescription afterRef = _references_2.get(i); + final SerializableReferenceDescription beforeRef = before.getReferences().get(i); + final SerializableReferenceDescription afterRef = after.getReferences().get(i); Assert.assertEquals(beforeRef.getContainerEObjectURI(), afterRef.getContainerEObjectURI()); Assert.assertEquals(beforeRef.getSourceEObjectUri(), afterRef.getSourceEObjectUri()); Assert.assertEquals(beforeRef.getTargetEObjectUri(), afterRef.getTargetEObjectUri()); @@ -108,15 +105,12 @@ public class SerializableResourceDescriptionTest { } } Assert.assertEquals(before.getDescriptions().size(), after.getDescriptions().size()); - List _descriptions = before.getDescriptions(); - int _size_1 = _descriptions.size(); + int _size_1 = before.getDescriptions().size(); ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, _size_1, true); for (final int i_1 : _doubleDotLessThan_1) { { - List _descriptions_1 = before.getDescriptions(); - final SerializableEObjectDescription beforeDesc = _descriptions_1.get(i_1); - List _descriptions_2 = after.getDescriptions(); - final SerializableEObjectDescription afterDesc = _descriptions_2.get(i_1); + final SerializableEObjectDescription beforeDesc = before.getDescriptions().get(i_1); + final SerializableEObjectDescription afterDesc = after.getDescriptions().get(i_1); Assert.assertEquals(beforeDesc.getEClass(), afterDesc.getEClass()); Assert.assertEquals(beforeDesc.getName(), afterDesc.getName()); Assert.assertEquals(beforeDesc.qualifiedName, afterDesc.qualifiedName); @@ -184,7 +178,8 @@ public class SerializableResourceDescriptionTest { it_1.setEObjectURI(uri.appendFragment("baz")); it_1.qualifiedName = QualifiedName.create("foo", "baz"); it_1.setEClass(EcorePackage.eINSTANCE.getEAttribute()); - it_1.userData = CollectionLiterals.newHashMap(Pair.of("myKey", "myValue")); + Pair _mappedTo = Pair.of("myKey", "myValue"); + it_1.userData = CollectionLiterals.newHashMap(_mappedTo); }; SerializableEObjectDescription _doubleArrow_5 = ObjectExtensions.operator_doubleArrow(_serializableEObjectDescription, _function_6); it.setDescriptions(Collections.unmodifiableList(CollectionLiterals.newArrayList(_doubleArrow_5))); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/GrammarConstraintProviderFeatureTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/GrammarConstraintProviderFeatureTest.java index c6b50f7cb..970aec13d 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/GrammarConstraintProviderFeatureTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/GrammarConstraintProviderFeatureTest.java @@ -9,7 +9,6 @@ package org.eclipse.xtext.serializer; import com.google.inject.Inject; import java.util.List; -import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider; @@ -297,26 +296,21 @@ public class GrammarConstraintProviderFeatureTest { _builder.newLineIfNotEmpty(); final Grammar grammar = this.parser.parse(_builder); this.validator.assertNoErrors(grammar); - SerializationContextMap _constraints = this.constraintProvider.getConstraints(grammar); - List> _values = _constraints.values(); final Function1, IGrammarConstraintProvider.IConstraint> _function = (SerializationContextMap.Entry it) -> { return it.getValue(); }; - final List constraints = ListExtensions., IGrammarConstraintProvider.IConstraint>map(_values, _function); + final List constraints = ListExtensions., IGrammarConstraintProvider.IConstraint>map(this.constraintProvider.getConstraints(grammar).values(), _function); final Function1 _function_1 = (IGrammarConstraintProvider.IConstraint it) -> { String _name = it.getName(); String _plus = (_name + "{\n "); - IGrammarConstraintProvider.IFeatureInfo[] _features = it.getFeatures(); final Function1 _function_2 = (IGrammarConstraintProvider.IFeatureInfo it_1) -> { return this.asString(it_1); }; - List _map = ListExtensions.map(((List)Conversions.doWrapArray(_features)), _function_2); - String _join = IterableExtensions.join(_map, "\n "); + String _join = IterableExtensions.join(ListExtensions.map(((List)Conversions.doWrapArray(it.getFeatures())), _function_2), "\n "); String _plus_1 = (_plus + _join); return (_plus_1 + "\n}"); }; - List _map = ListExtensions.map(constraints, _function_1); - String _join = IterableExtensions.join(_map, "\n"); + String _join = IterableExtensions.join(ListExtensions.map(constraints, _function_1), "\n"); return (_join + "\n"); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -333,8 +327,7 @@ public class GrammarConstraintProviderFeatureTest { _xifexpression = Integer.valueOf(it.getUpperBound()); } final Object upper = ((Object)_xifexpression); - EStructuralFeature _feature = it.getFeature(); - String _name = _feature.getName(); + String _name = it.getFeature().getName(); String _plus = (_name + "["); int _lowerBound = it.getLowerBound(); String _plus_1 = (_plus + Integer.valueOf(_lowerBound)); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/GrammarPDAProviderTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/GrammarPDAProviderTest.java index 89e5a8e38..ec08807ea 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/GrammarPDAProviderTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/GrammarPDAProviderTest.java @@ -11,7 +11,6 @@ import com.google.common.base.Function; import com.google.common.collect.Iterables; import com.google.inject.Inject; import java.util.List; -import java.util.Set; import java.util.function.Consumer; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.AbstractElement; @@ -941,45 +940,35 @@ public class GrammarPDAProviderTest { final Grammar grammar = this.parser.parse(_builder); this.validator.assertNoErrors(grammar); final SerializationContextMap> pdas = this.pdaProvider.getGrammarPDAs(grammar); - List>> _values = pdas.values(); final Consumer>> _function = (SerializationContextMap.Entry> it) -> { this.assertNoLeakedGrammarElements(grammar, it.getValue()); }; - _values.forEach(_function); - List>> _values_1 = pdas.values(); + pdas.values().forEach(_function); final Function1>, List> _function_1 = (SerializationContextMap.Entry> it) -> { return it.getContexts(); }; - List> _map = ListExtensions.>, List>map(_values_1, _function_1); - Iterable _flatten = Iterables.concat(_map); - List _sort = IterableExtensions.sort(_flatten); final Function1 _function_2 = (ISerializationContext it) -> { StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(it); _builder_1.append(":"); _builder_1.newLineIfNotEmpty(); _builder_1.append("\t"); - Pda _get = pdas.get(it); - String _listString = this.toListString(_get); + String _listString = this.toListString(pdas.get(it)); _builder_1.append(_listString, "\t"); _builder_1.newLineIfNotEmpty(); return _builder_1.toString(); }; - List _map_1 = ListExtensions.map(_sort, _function_2); - return IterableExtensions.join(_map_1); + return IterableExtensions.join(ListExtensions.map(IterableExtensions.sort(Iterables.concat(ListExtensions.>, List>map(pdas.values(), _function_1))), _function_2)); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } } private void assertNoLeakedGrammarElements(final Grammar grammar, final Pda pda) { - NfaUtil _nfaUtil = new NfaUtil(); - Set _collect = _nfaUtil.collect(pda); final Function1 _function = (ISerState it) -> { return it.getGrammarElement(); }; - Iterable _map = IterableExtensions.map(_collect, _function); - Iterable _filterNull = IterableExtensions.filterNull(_map); + Iterable _filterNull = IterableExtensions.filterNull(IterableExtensions.map(new NfaUtil().collect(pda), _function)); for (final AbstractElement ele : _filterNull) { { final Grammar actual = GrammarUtil.getGrammar(ele); @@ -995,22 +984,15 @@ public class GrammarPDAProviderTest { protected void toDot(final Pda pda, final String name) { try { - Thread _currentThread = Thread.currentThread(); - StackTraceElement[] _stackTrace = _currentThread.getStackTrace(); - StackTraceElement _get = _stackTrace[6]; - final String test = _get.getMethodName(); - PdaToDot _pdaToDot = new PdaToDot(); - _pdaToDot.draw(pda, (((("dot2/" + test) + "_") + name) + ".pdf"), "-T pdf"); + final String test = Thread.currentThread().getStackTrace()[6].getMethodName(); + new PdaToDot().draw(pda, (((("dot2/" + test) + "_") + name) + ".pdf"), "-T pdf"); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } } private String toListString(final Pda pda) { - GrammarElementTitleSwitch _grammarElementTitleSwitch = new GrammarElementTitleSwitch(); - GrammarElementTitleSwitch _showAssignments = _grammarElementTitleSwitch.showAssignments(); - GrammarElementTitleSwitch _hideCardinality = _showAssignments.hideCardinality(); - final GrammarElementTitleSwitch ts = _hideCardinality.showQualified(); + final GrammarElementTitleSwitch ts = new GrammarElementTitleSwitch().showAssignments().hideCardinality().showQualified(); final PdaListFormatter formatter = new PdaListFormatter(); final Function _function = (ISerState it) -> { String _switchResult = null; @@ -1024,21 +1006,16 @@ public class GrammarPDAProviderTest { _switchResult = "stop"; break; default: - AbstractElement _grammarElement = it.getGrammarElement(); - _switchResult = ts.apply(_grammarElement); + _switchResult = ts.apply(it.getGrammarElement()); break; } } else { - AbstractElement _grammarElement = it.getGrammarElement(); - _switchResult = ts.apply(_grammarElement); + _switchResult = ts.apply(it.getGrammarElement()); } return _switchResult; }; formatter.setStateFormatter(_function); - GrammarElementTitleSwitch _grammarElementTitleSwitch_1 = new GrammarElementTitleSwitch(); - GrammarElementTitleSwitch _showAssignments_1 = _grammarElementTitleSwitch_1.showAssignments(); - GrammarElementTitleSwitch _hideCardinality_1 = _showAssignments_1.hideCardinality(); - formatter.setStackitemFormatter(_hideCardinality_1); + formatter.setStackitemFormatter(new GrammarElementTitleSwitch().showAssignments().hideCardinality()); formatter.sortFollowers(); String _format = formatter.format(pda); return (_format + "\n"); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializationAfterModelChangeTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializationAfterModelChangeTest.java index 67fa43699..22d80a2ff 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializationAfterModelChangeTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializationAfterModelChangeTest.java @@ -8,11 +8,9 @@ package org.eclipse.xtext.serializer; import com.google.inject.Inject; -import org.eclipse.emf.common.util.EList; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.serializer.HiddenTokenSequencerTestLanguageInjectorProvider; import org.eclipse.xtext.serializer.ISerializer; -import org.eclipse.xtext.serializer.hiddentokensequencertest.DomainModel; import org.eclipse.xtext.serializer.hiddentokensequencertest.Entity; import org.eclipse.xtext.serializer.hiddentokensequencertest.HiddentokensequencertestFactory; import org.eclipse.xtext.serializer.hiddentokensequencertest.Model; @@ -97,15 +95,9 @@ public class SerializationAfterModelChangeTest { it.setDescription("BBB"); }; final Entity event = ObjectExtensions.operator_doubleArrow(_createEntity, _function); - DomainModel _domainModel = model.getDomainModel(); - EList _entities = _domainModel.getEntities(); - _entities.remove(1); - DomainModel _domainModel_1 = model.getDomainModel(); - EList _entities_1 = _domainModel_1.getEntities(); - _entities_1.remove(1); - DomainModel _domainModel_2 = model.getDomainModel(); - EList _entities_2 = _domainModel_2.getEntities(); - _entities_2.add(event); + model.getDomainModel().getEntities().remove(1); + model.getDomainModel().getEntities().remove(1); + model.getDomainModel().getEntities().add(event); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities"); _builder_1.newLine(); @@ -172,12 +164,8 @@ public class SerializationAfterModelChangeTest { _builder.append("end"); _builder.newLine(); final Model model = this._parseHelper.parse(_builder); - DomainModel _domainModel = model.getDomainModel(); - EList _entities = _domainModel.getEntities(); - final Entity head = IterableExtensions.head(_entities); - DomainModel _domainModel_1 = model.getDomainModel(); - EList _entities_1 = _domainModel_1.getEntities(); - _entities_1.move(1, head); + final Entity head = IterableExtensions.head(model.getDomainModel().getEntities()); + model.getDomainModel().getEntities().move(1, head); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities"); _builder_1.newLine(); @@ -219,9 +207,7 @@ public class SerializationAfterModelChangeTest { it.setDescription("Fizzle"); }; final Entity event = ObjectExtensions.operator_doubleArrow(_createEntity, _function); - DomainModel _domainModel = model.getDomainModel(); - EList _entities = _domainModel.getEntities(); - _entities.add(event); + model.getDomainModel().getEntities().add(event); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities"); _builder_1.newLine(); @@ -258,9 +244,7 @@ public class SerializationAfterModelChangeTest { it.setDescription("Fizzle"); }; final Entity event = ObjectExtensions.operator_doubleArrow(_createEntity, _function); - DomainModel _domainModel = model.getDomainModel(); - EList _entities = _domainModel.getEntities(); - _entities.add(event); + model.getDomainModel().getEntities().add(event); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities"); _builder_1.newLine(); @@ -297,9 +281,7 @@ public class SerializationAfterModelChangeTest { it.setDescription("Fizzle"); }; final Entity event = ObjectExtensions.operator_doubleArrow(_createEntity, _function); - DomainModel _domainModel = model.getDomainModel(); - EList _entities = _domainModel.getEntities(); - _entities.add(event); + model.getDomainModel().getEntities().add(event); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities"); _builder_1.newLine(); @@ -340,9 +322,7 @@ public class SerializationAfterModelChangeTest { _builder.append("end"); _builder.newLine(); final Model model = this._parseHelper.parse(_builder); - DomainModel _domainModel = model.getDomainModel(); - EList _entities = _domainModel.getEntities(); - _entities.remove(1); + model.getDomainModel().getEntities().remove(1); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities"); _builder_1.newLine(); @@ -379,9 +359,7 @@ public class SerializationAfterModelChangeTest { _builder.append("end"); _builder.newLine(); final Model model = this._parseHelper.parse(_builder); - DomainModel _domainModel = model.getDomainModel(); - EList _entities = _domainModel.getEntities(); - _entities.remove(1); + model.getDomainModel().getEntities().remove(1); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities"); _builder_1.newLine(); @@ -421,9 +399,7 @@ public class SerializationAfterModelChangeTest { _builder.append("end"); _builder.newLine(); final Model model = this._parseHelper.parse(_builder); - DomainModel _domainModel = model.getDomainModel(); - EList _entities = _domainModel.getEntities(); - _entities.remove(1); + model.getDomainModel().getEntities().remove(1); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities"); _builder_1.newLine(); @@ -458,9 +434,7 @@ public class SerializationAfterModelChangeTest { _builder.append("end"); _builder.newLine(); final Model model = this._parseHelper.parse(_builder); - DomainModel _domainModel = model.getDomainModel(); - EList _entities = _domainModel.getEntities(); - _entities.remove(1); + model.getDomainModel().getEntities().remove(1); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities"); _builder_1.newLine(); @@ -489,9 +463,7 @@ public class SerializationAfterModelChangeTest { _builder.append("end"); _builder.newLine(); final Model model = this._parseHelper.parse(_builder); - DomainModel _domainModel = model.getDomainModel(); - EList _entities = _domainModel.getEntities(); - _entities.remove(1); + model.getDomainModel().getEntities().remove(1); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities"); _builder_1.newLine(); @@ -526,9 +498,7 @@ public class SerializationAfterModelChangeTest { it.setDescription("Fizzle"); }; final Entity event = ObjectExtensions.operator_doubleArrow(_createEntity, _function); - DomainModel _domainModel = model.getDomainModel(); - EList _entities = _domainModel.getEntities(); - _entities.add(0, event); + model.getDomainModel().getEntities().add(0, event); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities Baz \"Fizzle\""); _builder_1.newLine(); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializerPerformanceTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializerPerformanceTest.java index f5f587d8f..0de568108 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializerPerformanceTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializerPerformanceTest.java @@ -13,7 +13,6 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.serializer.HiddenTokenSequencerTestLanguageInjectorProvider; import org.eclipse.xtext.serializer.ISerializer; -import org.eclipse.xtext.serializer.hiddentokensequencertest.DomainModel; import org.eclipse.xtext.serializer.hiddentokensequencertest.Entity; import org.eclipse.xtext.serializer.hiddentokensequencertest.Model; import org.eclipse.xtext.testing.InjectWith; @@ -74,19 +73,15 @@ public class SerializerPerformanceTest { } _builder.append("end"); _builder.newLine(); - Model _parse = this._parseHelper.parse(_builder); - this.model = _parse; - DomainModel _domainModel = this.model.getDomainModel(); - final EList entities = _domainModel.getEntities(); - ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, SerializerPerformanceTest.numberOfElements, true); + this.model = this._parseHelper.parse(_builder); + final EList entities = this.model.getDomainModel().getEntities(); final Function1 _function = (Integer it) -> { return Boolean.valueOf((((it).intValue() % SerializerPerformanceTest.editEvery) == 0)); }; - Iterable _filter = IterableExtensions.filter(_doubleDotLessThan_1, _function); final Function1 _function_1 = (Integer it) -> { return entities.get((it).intValue()); }; - final Iterable removeUs = IterableExtensions.map(_filter, _function_1); + final Iterable removeUs = IterableExtensions.map(IterableExtensions.filter(new ExclusiveRange(0, SerializerPerformanceTest.numberOfElements, true), _function), _function_1); CollectionExtensions.removeAll(entities, removeUs); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializerValidationDiagnosticsTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializerValidationDiagnosticsTest.java index c74081c2b..6f2789f05 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializerValidationDiagnosticsTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/serializer/SerializerValidationDiagnosticsTest.java @@ -127,8 +127,7 @@ public class SerializerValidationDiagnosticsTest { final Model model = this._parseHelper.parse(_builder); EObject _x11 = model.getX11(); final MultiKeywordsOrID mt = ((MultiKeywordsOrID) _x11); - EList _val = mt.getVal(); - _val.clear(); + mt.getVal().clear(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("Could not serialize MultiKeywordsOrID:"); _builder_1.newLine(); @@ -181,10 +180,7 @@ public class SerializerValidationDiagnosticsTest { } catch (final Throwable _t) { if (_t instanceof Throwable) { final Throwable t = (Throwable)_t; - String _string = expected.toString(); - String _trim = _string.trim(); - String _message = t.getMessage(); - Assert.assertEquals(_trim, _message); + Assert.assertEquals(expected.toString().trim(), t.getMessage()); } else { throw Exceptions.sneakyThrow(_t); } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskFinderTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskFinderTest.java index 339a41973..7d88e1461 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskFinderTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskFinderTest.java @@ -12,7 +12,6 @@ import java.util.List; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.impl.ResourceImpl; import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.resource.XtextResource; import org.eclipse.xtext.tasks.DefaultTaskFinder; import org.eclipse.xtext.tasks.ITaskFinder; import org.eclipse.xtext.tasks.Priority; @@ -42,8 +41,7 @@ public class DefaultTaskFinderTest extends AbstractXtextTests { public void setup() { try { this.with(NoJdtTestLanguageStandaloneSetup.class); - DefaultTaskFinder _get = this.get(DefaultTaskFinder.class); - this.finder = _get; + this.finder = this.get(DefaultTaskFinder.class); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -51,8 +49,7 @@ public class DefaultTaskFinderTest extends AbstractXtextTests { @Test public void testNonXtextResource() { - ResourceImpl _resourceImpl = new ResourceImpl(); - this.assertContainsTasks(_resourceImpl, Collections.unmodifiableList(CollectionLiterals.newArrayList())); + this.assertContainsTasks(new ResourceImpl(), Collections.unmodifiableList(CollectionLiterals.newArrayList())); } @Test @@ -77,8 +74,6 @@ public class DefaultTaskFinderTest extends AbstractXtextTests { _builder.newLine(); _builder.append("Hello notATODO!"); _builder.newLine(); - String _unix = LineDelimiters.toUnix(_builder.toString()); - XtextResource _resourceFromString = this.getResourceFromString(_unix); Task _task = new Task(); final Procedure1 _function = (Task it) -> { TaskTag _taskTag = new TaskTag(); @@ -107,7 +102,8 @@ public class DefaultTaskFinderTest extends AbstractXtextTests { it.setLineNumber(3); }; Task _doubleArrow_1 = ObjectExtensions.operator_doubleArrow(_task_1, _function_1); - this.assertContainsTasks(_resourceFromString, + this.assertContainsTasks(this.getResourceFromString( + LineDelimiters.toUnix(_builder.toString())), Collections.unmodifiableList(CollectionLiterals.newArrayList(_doubleArrow, _doubleArrow_1))); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -116,15 +112,11 @@ public class DefaultTaskFinderTest extends AbstractXtextTests { private void assertContainsTasks(final Resource resource, final List expectedTasks) { final List actualTasks = this.finder.findTasks(resource); + 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())); } } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskParserTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskParserTest.java index efc34a5eb..5fed38c96 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskParserTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskParserTest.java @@ -172,8 +172,7 @@ public class DefaultTaskParserTest { _builder.append("*/"); _builder.newLine(); final String source = _builder.toString(); - String _unix = LineDelimiters.toUnix(source); - final List parsed = this.parser.parseTasks(_unix, this.definitions); + final List parsed = this.parser.parseTasks(LineDelimiters.toUnix(source), this.definitions); Assert.assertEquals(expectation, parsed.size()); ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, expectation, true); for (final Integer i_1 : _doubleDotLessThan) { @@ -182,9 +181,7 @@ public class DefaultTaskParserTest { } private void assertContainsTasks(final CharSequence source, final List expectedTasks) { - String _string = source.toString(); - String _unix = LineDelimiters.toUnix(_string); - final List actualTasks = this.parser.parseTasks(_unix, this.definitions); + final List actualTasks = this.parser.parseTasks(LineDelimiters.toUnix(source.toString()), this.definitions); Assert.assertEquals(expectedTasks.size(), actualTasks.size()); int _size = expectedTasks.size(); ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/PreferenceTaskTagProviderTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/PreferenceTaskTagProviderTest.java index d3ab31bc2..c807b3186 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/PreferenceTaskTagProviderTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/tasks/PreferenceTaskTagProviderTest.java @@ -55,26 +55,18 @@ public class PreferenceTaskTagProviderTest { final String prios = PreferenceTaskTagProvider.serializePriorities(tags); final IPreferenceValuesProvider.SingletonPreferenceValuesProvider valueProvider = new IPreferenceValuesProvider.SingletonPreferenceValuesProvider(); final MapBasedPreferenceValues values = valueProvider.getPreferenceValues(null); - String _id = PreferenceTaskTagProvider.TAGS_KEY.getId(); - values.put(_id, names); - String _id_1 = PreferenceTaskTagProvider.PRIORITIES_KEY.getId(); - values.put(_id_1, prios); - String _id_2 = PreferenceTaskTagProvider.CASE_SENSITIVE_KEY.getId(); - values.put(_id_2, "false"); + values.put(PreferenceTaskTagProvider.TAGS_KEY.getId(), names); + values.put(PreferenceTaskTagProvider.PRIORITIES_KEY.getId(), prios); + values.put(PreferenceTaskTagProvider.CASE_SENSITIVE_KEY.getId(), "false"); final PreferenceTaskTagProvider tagProvider = new PreferenceTaskTagProvider(); tagProvider.setPreferenceValuesProvider(valueProvider); final TaskTags parsedTags = tagProvider.getTaskTags(null); - boolean _isCaseSensitive = parsedTags.isCaseSensitive(); - Assert.assertEquals(Boolean.valueOf(false), Boolean.valueOf(_isCaseSensitive)); + Assert.assertEquals(Boolean.valueOf(false), Boolean.valueOf(parsedTags.isCaseSensitive())); + Assert.assertEquals(tags.size(), IterableExtensions.size(parsedTags)); int _size = tags.size(); - int _size_1 = IterableExtensions.size(parsedTags); - Assert.assertEquals(_size, _size_1); - int _size_2 = tags.size(); - ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size_2, true); + ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true); for (final Integer i : _doubleDotLessThan) { - TaskTag _get = tags.get((i).intValue()); - TaskTag _get_1 = ((TaskTag[])Conversions.unwrapArray(parsedTags, TaskTag.class))[(i).intValue()]; - TaskAssert.assertExactMatch(_get, _get_1); + TaskAssert.assertExactMatch(tags.get((i).intValue()), ((TaskTag[])Conversions.unwrapArray(parsedTags, TaskTag.class))[(i).intValue()]); } } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/util/UriUtilTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/util/UriUtilTest.java index 42f7bb713..87a588fc0 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/util/UriUtilTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/util/UriUtilTest.java @@ -48,6 +48,8 @@ public class UriUtilTest { final File folder = new File("."); final URI uri = UriUtil.createFolderURI(folder); Assert.assertTrue(uri.hasTrailingPathSeparator()); - Assert.assertEquals(".", uri.segment((uri.segmentCount() - 2))); + int _segmentCount = uri.segmentCount(); + int _minus = (_segmentCount - 2); + Assert.assertEquals(".", uri.segment(_minus)); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/Bug456789Test.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/Bug456789Test.java index a356a8f15..5b0c9cb99 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/Bug456789Test.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/Bug456789Test.java @@ -8,8 +8,6 @@ package org.eclipse.xtext.xtext; import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.Diagnostician; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.XtextStandaloneSetup; @@ -111,9 +109,7 @@ public class Bug456789Test extends AbstractXtextTests { _builder.append("(test (comp_for | (\',\' test)* (\',\')?)) );"); _builder.newLine(); final XtextResource resource = this.getResourceFromStringAndExpect(_builder.toString(), AbstractXtextTests.UNKNOWN_EXPECTATION); - EList _contents = resource.getContents(); - EObject _get = _contents.get(0); - final Diagnostic diag = Diagnostician.INSTANCE.validate(_get); + final Diagnostic diag = Diagnostician.INSTANCE.validate(resource.getContents().get(0)); Assert.assertNotNull("diag", diag); Assert.assertEquals("diag.isError", diag.getSeverity(), Diagnostic.ERROR); } catch (Throwable _e) { @@ -391,9 +387,7 @@ public class Bug456789Test extends AbstractXtextTests { _builder.append("*/"); _builder.newLine(); final XtextResource resource = this.getResourceFromStringAndExpect(_builder.toString(), AbstractXtextTests.UNKNOWN_EXPECTATION); - EList _contents = resource.getContents(); - EObject _get = _contents.get(0); - final Diagnostic diag = Diagnostician.INSTANCE.validate(_get); + final Diagnostic diag = Diagnostician.INSTANCE.validate(resource.getContents().get(0)); Assert.assertNotNull("diag", diag); Assert.assertEquals("diag.isError", diag.getSeverity(), Diagnostic.ERROR); } catch (Throwable _e) { diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/GrammarFlatteningTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/GrammarFlatteningTest.java index cdc56031f..261bf8b3b 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/GrammarFlatteningTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/GrammarFlatteningTest.java @@ -7,14 +7,12 @@ */ package org.eclipse.xtext.xtext; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.XtextStandaloneSetup; import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.serializer.ISerializer; import org.eclipse.xtext.tests.AbstractXtextTests; import org.eclipse.xtext.xtext.FlattenedGrammarAccess; import org.eclipse.xtext.xtext.RuleFilter; @@ -45,13 +43,10 @@ public class GrammarFlatteningTest extends AbstractXtextTests { RuleNames ruleNames = RuleNames.getRuleNames(grammar, false); RuleFilter filter = new RuleFilter(); filter.setDiscardUnreachableRules(dropUnreachable); - FlattenedGrammarAccess _flattenedGrammarAccess = new FlattenedGrammarAccess(ruleNames, filter); - Grammar result = _flattenedGrammarAccess.getFlattenedGrammar(); + Grammar result = new FlattenedGrammarAccess(ruleNames, filter).getFlattenedGrammar(); XtextResource resource = this.get(XtextResource.class); - EList _contents = resource.getContents(); - _contents.add(result); - URI _createURI = URI.createURI("synthetic://flattened.xtext"); - resource.setURI(_createURI); + resource.getContents().add(result); + resource.setURI(URI.createURI("synthetic://flattened.xtext")); return result; } @@ -65,8 +60,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append("Rule: name=ID;"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString()); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -117,8 +111,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } @Test @@ -133,8 +126,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append("terminal ID: super;"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString()); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -191,8 +183,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } @Test @@ -205,8 +196,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append("Rule: name=ID | name=ID | name=STRING;"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString()); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -275,8 +265,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } @Test @@ -289,8 +278,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append("Rule: name=ID child=Rule?;"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString()); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -347,8 +335,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } @Test @@ -361,8 +348,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append("Rule: name=ID (child=Rule|child=Rule+)?;"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString()); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -419,8 +405,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } @Test @@ -433,8 +418,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append("Rule: name=ID (child=Rule)?;"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString()); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -491,8 +475,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } @Test @@ -505,8 +488,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append("Rule: name=ID (child=Rule)?;"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString(), true); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -557,8 +539,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } @Test @@ -571,8 +552,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append("Rule: name=ID =>( ->child=Rule | ->\'keyword\')?;"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString(), true); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -623,8 +603,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } @Test @@ -637,8 +616,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append("Rule: name=ID ->( =>child=Rule | =>\'keyword\')?;"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString(), true); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -689,8 +667,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } @Test @@ -793,8 +770,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append(";"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString(), true); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -917,8 +893,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } @Ignore("Flattened grammar access produces bad grammar?") @@ -932,8 +907,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append("Rule: name=ID =>( ->child=Rule | ->(\'a\' \'b\'))?;"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString(), true); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -984,8 +958,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } @Test @@ -998,8 +971,7 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder.append("Rule: =>(name+=ID*);"); _builder.newLine(); Grammar flattened = this.getModel(_builder.toString(), true); - ISerializer _serializer = this.getSerializer(); - String serialized = _serializer.serialize(flattened); + String serialized = this.getSerializer().serialize(flattened); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar com.foo.bar hidden(RULE_WS, RULE_ML_COMMENT, RULE_SL_COMMENT)"); _builder_1.newLine(); @@ -1050,7 +1022,6 @@ public class GrammarFlatteningTest extends AbstractXtextTests { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append(".;"); - String _string = _builder_1.toString(); - Assert.assertEquals(_string, serialized); + Assert.assertEquals(_builder_1.toString(), serialized); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/OverriddenValueInspectorTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/OverriddenValueInspectorTest.java index ad9c9a697..15bcd5238 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/OverriddenValueInspectorTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/OverriddenValueInspectorTest.java @@ -95,15 +95,17 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First"); final ParserRule rule = ((ParserRule) _findRuleForName); this.validateRule(rule); - Assert.assertEquals(ListExtensions., String>map(this.warnings, ((Function1, String>) (Triple it) -> { + final Function1, String> _function = (Triple it) -> { return it.getFirst(); - })).toString(), 0, this.warnings.size()); + }; + Assert.assertEquals(ListExtensions., String>map(this.warnings, _function).toString(), 0, this.warnings.size()); AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "Named"); final ParserRule fragment = ((ParserRule) _findRuleForName_1); this.validateRule(fragment); - Assert.assertEquals(ListExtensions., String>map(this.warnings, ((Function1, String>) (Triple it) -> { + final Function1, String> _function_1 = (Triple it) -> { return it.getFirst(); - })).toString(), 2, this.warnings.size()); + }; + Assert.assertEquals(ListExtensions., String>map(this.warnings, _function_1).toString(), 2, this.warnings.size()); } @Test @@ -124,21 +126,24 @@ public class OverriddenValueInspectorTest extends AbstractXtextRuleInspectorTest AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First"); final ParserRule rule = ((ParserRule) _findRuleForName); this.validateRule(rule); - Assert.assertEquals(ListExtensions., String>map(this.warnings, ((Function1, String>) (Triple it) -> { + final Function1, String> _function = (Triple it) -> { return it.getFirst(); - })).toString(), 0, this.warnings.size()); + }; + Assert.assertEquals(ListExtensions., String>map(this.warnings, _function).toString(), 0, this.warnings.size()); AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "Named"); final ParserRule fragment = ((ParserRule) _findRuleForName_1); this.validateRule(fragment); - Assert.assertEquals(ListExtensions., String>map(this.warnings, ((Function1, String>) (Triple it) -> { + final Function1, String> _function_1 = (Triple it) -> { return it.getFirst(); - })).toString(), 2, this.warnings.size()); + }; + Assert.assertEquals(ListExtensions., String>map(this.warnings, _function_1).toString(), 2, this.warnings.size()); AbstractRule _findRuleForName_2 = GrammarUtil.findRuleForName(grammar, "NamedAgain"); final ParserRule otherFragment = ((ParserRule) _findRuleForName_2); this.validateRule(otherFragment); - Assert.assertEquals(ListExtensions., String>map(this.warnings, ((Function1, String>) (Triple it) -> { + final Function1, String> _function_2 = (Triple it) -> { return it.getFirst(); - })).toString(), 0, this.warnings.size()); + }; + Assert.assertEquals(ListExtensions., String>map(this.warnings, _function_2).toString(), 0, this.warnings.size()); } @Test diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/PredicatedElementTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/PredicatedElementTest.java index 2340d9449..e86cd11d9 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/PredicatedElementTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/PredicatedElementTest.java @@ -127,9 +127,7 @@ public class PredicatedElementTest extends AbstractXtextTests { try { EObject _model = this.getModel(grammar); final Grammar parsed = ((Grammar) _model); - EList _rules = parsed.getRules(); - AbstractRule _head = IterableExtensions.head(_rules); - final AbstractElement body = _head.getAlternatives(); + final AbstractElement body = IterableExtensions.head(parsed.getRules()).getAlternatives(); final AbstractElement predicate = AntlrGrammarGenUtil.getPredicatedElement(body); Assert.assertEquals(expectation, this.toXtext(predicate)); } catch (Throwable _e) { @@ -142,19 +140,18 @@ public class PredicatedElementTest extends AbstractXtextTests { String _cardinality = group.getCardinality(); boolean _tripleEquals = (_cardinality == null); if (_tripleEquals) { - EList _elements = group.getElements(); final Function1 _function = (AbstractElement it) -> { return this.toXtext(it); }; - _xifexpression = IterableExtensions.join(_elements, " ", _function); + _xifexpression = IterableExtensions.join(group.getElements(), " ", _function); } else { - EList _elements_1 = group.getElements(); + EList _elements = group.getElements(); String _cardinality_1 = group.getCardinality(); String _plus = (")" + _cardinality_1); final Function1 _function_1 = (AbstractElement it) -> { return this.toXtext(it); }; - _xifexpression = IterableExtensions.join(_elements_1, "(", " ", _plus, _function_1); + _xifexpression = IterableExtensions.join(_elements, "(", " ", _plus, _function_1); } return _xifexpression; } @@ -190,8 +187,7 @@ public class PredicatedElementTest extends AbstractXtextTests { } protected String _toXtext(final RuleCall rc) { - AbstractRule _rule = rc.getRule(); - String _name = _rule.getName(); + String _name = rc.getRule().getName(); String _elvis = null; String _cardinality = rc.getCardinality(); if (_cardinality != null) { @@ -203,8 +199,7 @@ public class PredicatedElementTest extends AbstractXtextTests { } protected String _toXtext(final Assignment ass) { - AbstractElement _terminal = ass.getTerminal(); - String _xtext = this.toXtext(_terminal); + String _xtext = this.toXtext(ass.getTerminal()); String _elvis = null; String _cardinality = ass.getCardinality(); if (_cardinality != null) { @@ -216,8 +211,7 @@ public class PredicatedElementTest extends AbstractXtextTests { } protected String _toXtext(final CrossReference cr) { - AbstractElement _terminal = cr.getTerminal(); - return this.toXtext(_terminal); + return this.toXtext(cr.getTerminal()); } public String toXtext(final AbstractElement alt) { diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/ReducedXtextResourceValidatorTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/ReducedXtextResourceValidatorTest.java index 1d363fcd9..e8ee2d9b5 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/ReducedXtextResourceValidatorTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/ReducedXtextResourceValidatorTest.java @@ -7,9 +7,7 @@ */ package org.eclipse.xtext.xtext; -import java.io.InputStream; import java.util.List; -import org.eclipse.emf.common.util.URI; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.XtextStandaloneSetup; import org.eclipse.xtext.resource.XtextResource; @@ -48,8 +46,7 @@ public class ReducedXtextResourceValidatorTest extends AbstractXtextTests { _builder.append("Root returns test::Foo: name=ID;"); _builder.newLine(); final String grammarAsString = _builder.toString(); - XtextResource _erroneousResource = this.getErroneousResource(grammarAsString); - final List issues = this.resourceValidator.validate(_erroneousResource, CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl); + final List issues = this.resourceValidator.validate(this.getErroneousResource(grammarAsString), CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl); Assert.assertEquals(issues.toString(), 0, issues.size()); } @@ -63,8 +60,7 @@ public class ReducedXtextResourceValidatorTest extends AbstractXtextTests { _builder.append("Root returns test::Foo: name=ID;;"); _builder.newLine(); final String grammarAsString = _builder.toString(); - XtextResource _erroneousResource = this.getErroneousResource(grammarAsString); - final List issues = this.resourceValidator.validate(_erroneousResource, CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl); + final List issues = this.resourceValidator.validate(this.getErroneousResource(grammarAsString), CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl); Assert.assertEquals(issues.toString(), 1, issues.size()); Assert.assertTrue(issues.toString(), IterableExtensions.head(issues).getMessage().contains("extraneous input \';\'")); } @@ -79,8 +75,7 @@ public class ReducedXtextResourceValidatorTest extends AbstractXtextTests { _builder.append("Root returns test::Foo : name=IDS;"); _builder.newLine(); final String grammarAsString = _builder.toString(); - XtextResource _erroneousResource = this.getErroneousResource(grammarAsString); - final List issues = this.resourceValidator.validate(_erroneousResource, CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl); + final List issues = this.resourceValidator.validate(this.getErroneousResource(grammarAsString), CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl); Assert.assertEquals(issues.toString(), 1, issues.size()); Assert.assertTrue(issues.toString(), IterableExtensions.head(issues).getMessage().contains("IDS")); } @@ -95,18 +90,14 @@ public class ReducedXtextResourceValidatorTest extends AbstractXtextTests { _builder.append("Root returns test::Foo : name=\'foo\';"); _builder.newLine(); final String grammarAsString = _builder.toString(); - XtextResource _erroneousResource = this.getErroneousResource(grammarAsString); - final List issues = this.resourceValidator.validate(_erroneousResource, CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl); + final List issues = this.resourceValidator.validate(this.getErroneousResource(grammarAsString), CheckMode.NORMAL_AND_FAST, CancelIndicator.NullImpl); Assert.assertEquals(issues.toString(), 1, issues.size()); Assert.assertTrue(issues.toString(), IterableExtensions.head(issues).getMessage().contains("Trminals")); } public XtextResource getErroneousResource(final CharSequence seq) { try { - String _string = seq.toString(); - InputStream _asStream = this.getAsStream(_string); - URI _testModelURI = this.getTestModelURI(); - return this.doGetResource(_asStream, _testModelURI); + return this.doGetResource(this.getAsStream(seq.toString()), this.getTestModelURI()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/SuperCallScopeTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/SuperCallScopeTest.java index beb906bb7..16821b1c1 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/SuperCallScopeTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/SuperCallScopeTest.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.xtext; import java.util.List; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.AbstractRule; @@ -54,8 +53,7 @@ public class SuperCallScopeTest extends AbstractXtextTests { EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); final SuperCallScope scope = new SuperCallScope(grammar); - Iterable _allElements = scope.getAllElements(); - this.assertElementNames(_allElements, + this.assertElementNames(scope.getAllElements(), "Lang.Rule", "test.Lang.Rule", "Lang.ID", "test.Lang.ID", "super.ID", "Terminals.ID", "org.eclipse.xtext.common.Terminals.ID", @@ -81,11 +79,9 @@ public class SuperCallScopeTest extends AbstractXtextTests { final String grammarAsString = _builder.toString(); EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); - EList _rules = grammar.getRules(); - AbstractRule _last = IterableExtensions.last(_rules); + AbstractRule _last = IterableExtensions.last(grammar.getRules()); final SuperCallScope scope = new SuperCallScope(_last); - Iterable _allElements = scope.getAllElements(); - this.assertElementNames(_allElements, + this.assertElementNames(scope.getAllElements(), "Lang.Rule", "test.Lang.Rule", "Lang.ID", "test.Lang.ID", "super", @@ -113,9 +109,7 @@ public class SuperCallScopeTest extends AbstractXtextTests { EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); final SuperCallScope scope = new SuperCallScope(grammar); - QualifiedName _create = QualifiedName.create("ID"); - Iterable _elements = scope.getElements(_create); - this.assertElements(_elements); + this.assertElements(scope.getElements(QualifiedName.create("ID"))); } @Test @@ -133,9 +127,7 @@ public class SuperCallScopeTest extends AbstractXtextTests { EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); final SuperCallScope scope = new SuperCallScope(grammar); - QualifiedName _create = QualifiedName.create("super"); - Iterable _elements = scope.getElements(_create); - this.assertElements(_elements); + this.assertElements(scope.getElements(QualifiedName.create("super"))); } @Test @@ -152,12 +144,9 @@ public class SuperCallScopeTest extends AbstractXtextTests { final String grammarAsString = _builder.toString(); EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); - EList _rules = grammar.getRules(); - AbstractRule _head = IterableExtensions.head(_rules); + AbstractRule _head = IterableExtensions.head(grammar.getRules()); final SuperCallScope scope = new SuperCallScope(_head); - QualifiedName _create = QualifiedName.create("super"); - Iterable _elements = scope.getElements(_create); - this.assertElements(_elements); + this.assertElements(scope.getElements(QualifiedName.create("super"))); } @Test @@ -174,11 +163,9 @@ public class SuperCallScopeTest extends AbstractXtextTests { final String grammarAsString = _builder.toString(); EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); - EList _rules = grammar.getRules(); - AbstractRule _last = IterableExtensions.last(_rules); + AbstractRule _last = IterableExtensions.last(grammar.getRules()); final SuperCallScope scope = new SuperCallScope(_last); - QualifiedName _create = QualifiedName.create("super"); - Iterable _elements = scope.getElements(_create); + Iterable _elements = scope.getElements(QualifiedName.create("super")); AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID"); Pair _mappedTo = Pair.of("super", _findRuleForName); this.assertElements(_elements, _mappedTo); @@ -199,8 +186,7 @@ public class SuperCallScopeTest extends AbstractXtextTests { EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); final SuperCallScope scope = new SuperCallScope(grammar); - QualifiedName _create = QualifiedName.create("super", "ID"); - Iterable _elements = scope.getElements(_create); + Iterable _elements = scope.getElements(QualifiedName.create("super", "ID")); AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID"); Pair _mappedTo = Pair.of("super.ID", _findRuleForName); this.assertElements(_elements, _mappedTo); @@ -221,8 +207,7 @@ public class SuperCallScopeTest extends AbstractXtextTests { EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); final SuperCallScope scope = new SuperCallScope(grammar); - QualifiedName _create = QualifiedName.create("Lang", "ID"); - Iterable _elements = scope.getElements(_create); + Iterable _elements = scope.getElements(QualifiedName.create("Lang", "ID")); AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "test.Lang.ID"); Pair _mappedTo = Pair.of("Lang.ID", _findRuleForName); this.assertElements(_elements, _mappedTo); @@ -243,8 +228,7 @@ public class SuperCallScopeTest extends AbstractXtextTests { EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); final SuperCallScope scope = new SuperCallScope(grammar); - QualifiedName _create = QualifiedName.create("test", "Lang", "ID"); - Iterable _elements = scope.getElements(_create); + Iterable _elements = scope.getElements(QualifiedName.create("test", "Lang", "ID")); AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "test.Lang.ID"); Pair _mappedTo = Pair.of("test.Lang.ID", _findRuleForName); this.assertElements(_elements, _mappedTo); @@ -288,8 +272,7 @@ public class SuperCallScopeTest extends AbstractXtextTests { final String grammarAsString = _builder.toString(); EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); - EList _rules = grammar.getRules(); - AbstractRule _head = IterableExtensions.head(_rules); + AbstractRule _head = IterableExtensions.head(grammar.getRules()); final SuperCallScope scope = new SuperCallScope(_head); final AbstractRule id = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID"); Iterable _elements = scope.getElements(id); @@ -316,8 +299,7 @@ public class SuperCallScopeTest extends AbstractXtextTests { final String grammarAsString = _builder.toString(); EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); - EList _rules = grammar.getRules(); - AbstractRule _last = IterableExtensions.last(_rules); + AbstractRule _last = IterableExtensions.last(grammar.getRules()); final SuperCallScope scope = new SuperCallScope(_last); final AbstractRule id = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID"); Iterable _elements = scope.getElements(id); @@ -333,46 +315,34 @@ public class SuperCallScopeTest extends AbstractXtextTests { } public void assertElementNames(final Iterable descriptions, final String... expectedNames) { - String _join = IterableExtensions.join(((Iterable)Conversions.doWrapArray(expectedNames)), "\n"); final Function1 _function = (IEObjectDescription it) -> { - QualifiedName _name = it.getName(); - return _name.toString(); + return it.getName().toString(); }; - Iterable _map = IterableExtensions.map(descriptions, _function); - String _join_1 = IterableExtensions.join(_map, "\n"); - Assert.assertEquals(_join, _join_1); + Assert.assertEquals(IterableExtensions.join(((Iterable)Conversions.doWrapArray(expectedNames)), "\n"), IterableExtensions.join(IterableExtensions.map(descriptions, _function), "\n")); } public void assertElements(final Iterable descriptions, final Pair... expected) { final Function1, String> _function = (Pair it) -> { String _key = it.getKey(); String _plus = (_key + "->"); - AbstractRule _value = it.getValue(); - Grammar _grammar = GrammarUtil.getGrammar(_value); - String _name = _grammar.getName(); + String _name = GrammarUtil.getGrammar(it.getValue()).getName(); String _plus_1 = (_plus + _name); String _plus_2 = (_plus_1 + "."); - AbstractRule _value_1 = it.getValue(); - String _name_1 = _value_1.getName(); + String _name_1 = it.getValue().getName(); return (_plus_2 + _name_1); }; - List _map = ListExtensions., String>map(((List>)Conversions.doWrapArray(expected)), _function); - String _join = IterableExtensions.join(_map, "\n"); final Function1 _function_1 = (IEObjectDescription it) -> { - QualifiedName _name = it.getName(); - String _string = _name.toString(); + String _string = it.getName().toString(); String _plus = (_string + "->"); - EObject _eObjectOrProxy = it.getEObjectOrProxy(); - Grammar _grammar = GrammarUtil.getGrammar(_eObjectOrProxy); - String _name_1 = _grammar.getName(); - String _plus_1 = (_plus + _name_1); + String _name = GrammarUtil.getGrammar(it.getEObjectOrProxy()).getName(); + String _plus_1 = (_plus + _name); String _plus_2 = (_plus_1 + "."); - EObject _eObjectOrProxy_1 = it.getEObjectOrProxy(); - String _name_2 = ((AbstractRule) _eObjectOrProxy_1).getName(); - return (_plus_2 + _name_2); + EObject _eObjectOrProxy = it.getEObjectOrProxy(); + String _name_1 = ((AbstractRule) _eObjectOrProxy).getName(); + return (_plus_2 + _name_1); }; - Iterable _map_1 = IterableExtensions.map(descriptions, _function_1); - String _join_1 = IterableExtensions.join(_map_1, "\n"); - Assert.assertEquals(_join, _join_1); + Assert.assertEquals( + IterableExtensions.join(ListExtensions., String>map(((List>)Conversions.doWrapArray(expected)), _function), "\n"), + IterableExtensions.join(IterableExtensions.map(descriptions, _function_1), "\n")); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/XtextGrammarSerializationTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/XtextGrammarSerializationTest.java index aecebf84a..e17c39b23 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/XtextGrammarSerializationTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/XtextGrammarSerializationTest.java @@ -3,8 +3,6 @@ package org.eclipse.xtext.xtext; import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.util.Collections; -import java.util.Map; -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.resource.ContentHandler; @@ -12,7 +10,6 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.XtextStandaloneSetup; -import org.eclipse.xtext.parser.IParseResult; import org.eclipse.xtext.resource.SaveOptions; import org.eclipse.xtext.resource.XtextResource; import org.eclipse.xtext.resource.XtextResourceSet; @@ -243,16 +240,11 @@ public class XtextGrammarSerializationTest extends AbstractXtextTests { private void doTestSerialization(final String model, final String expectedModel) throws Exception { final XtextResource resource = this.getResourceFromString(model); Assert.assertTrue(resource.getErrors().isEmpty()); - IParseResult _parseResult = resource.getParseResult(); - EObject _rootASTElement = _parseResult.getRootASTElement(); + EObject _rootASTElement = resource.getParseResult().getRootASTElement(); final Grammar g = ((Grammar) _rootASTElement); Assert.assertNotNull(g); final OutputStream outputStream = new ByteArrayOutputStream(); - SaveOptions.Builder _newBuilder = SaveOptions.newBuilder(); - SaveOptions.Builder _format = _newBuilder.format(); - SaveOptions _options = _format.getOptions(); - Map _optionsMap = _options.toOptionsMap(); - resource.save(outputStream, _optionsMap); + resource.save(outputStream, SaveOptions.newBuilder().format().getOptions().toOptionsMap()); final String serializedModel = outputStream.toString(); Assert.assertEquals(LineDelimiters.toPlatform(expectedModel), serializedModel); } @@ -303,16 +295,10 @@ public class XtextGrammarSerializationTest extends AbstractXtextTests { } public void _testXtestSerializationSelfTest() throws Exception { - XtextResourceSet _get = this.get(XtextResourceSet.class); - URI _createURI = URI.createURI("myfile.xtext"); - Resource res = _get.createResource(_createURI, + Resource res = this.get(XtextResourceSet.class).createResource(URI.createURI("myfile.xtext"), ContentHandler.UNSPECIFIED_CONTENT_TYPE); - EList _contents = res.getContents(); - XtextGrammarAccess _get_1 = this.get(XtextGrammarAccess.class); - Grammar _grammar = _get_1.getGrammar(); - _contents.add(_grammar); + res.getContents().add(this.get(XtextGrammarAccess.class).getGrammar()); OutputStream outputStream = new ByteArrayOutputStream(); - Map _emptyMap = Collections.emptyMap(); - res.save(outputStream, _emptyMap); + res.save(outputStream, Collections.emptyMap()); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/XtextLinkerTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/XtextLinkerTest.java index f13eb30f1..436da7945 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/XtextLinkerTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/XtextLinkerTest.java @@ -9,9 +9,6 @@ package org.eclipse.xtext.xtext; import com.google.common.base.Objects; import com.google.common.collect.Iterators; -import java.util.Iterator; -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.emf.ecore.EPackage; @@ -70,21 +67,19 @@ public class XtextLinkerTest extends AbstractXtextTests { final String grammarAsString = _builder.toString(); EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); - EList _rules = grammar.getRules(); - AbstractRule _head = IterableExtensions.head(_rules); + AbstractRule _head = IterableExtensions.head(grammar.getRules()); final ParserRule rootRule = ((ParserRule) _head); AbstractElement _alternatives = rootRule.getAlternatives(); final Alternatives alternatives = ((Alternatives) _alternatives); - EList _elements = alternatives.getElements(); - AbstractElement _head_1 = IterableExtensions.head(_elements); + AbstractElement _head_1 = IterableExtensions.head(alternatives.getElements()); Condition _guardCondition = ((Group) _head_1).getGuardCondition(); final ParameterReference firstGuard = ((ParameterReference) _guardCondition); Assert.assertEquals(IterableExtensions.head(rootRule.getParameters()), firstGuard.getParameter()); - EList _elements_1 = alternatives.getElements(); - AbstractElement _last = IterableExtensions.last(_elements_1); + AbstractElement _last = IterableExtensions.last(alternatives.getElements()); Condition _guardCondition_1 = ((Group) _last).getGuardCondition(); final Negation secondGuard = ((Negation) _guardCondition_1); - Assert.assertEquals(IterableExtensions.head(rootRule.getParameters()), ((ParameterReference) secondGuard.getValue()).getParameter()); + Condition _value = secondGuard.getValue(); + Assert.assertEquals(IterableExtensions.head(rootRule.getParameters()), ((ParameterReference) _value).getParameter()); } @Test @@ -101,22 +96,19 @@ public class XtextLinkerTest extends AbstractXtextTests { final String grammarAsString = _builder.toString(); EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); - EList _rules = grammar.getRules(); - AbstractRule _head = IterableExtensions.head(_rules); + AbstractRule _head = IterableExtensions.head(grammar.getRules()); final ParserRule rootRule = ((ParserRule) _head); - EList _rules_1 = grammar.getRules(); - AbstractRule _last = IterableExtensions.last(_rules_1); + AbstractRule _last = IterableExtensions.last(grammar.getRules()); final ParserRule lastRule = ((ParserRule) _last); AbstractElement _alternatives = lastRule.getAlternatives(); - EList _elements = ((Group) _alternatives).getElements(); - AbstractElement _last_1 = IterableExtensions.last(_elements); + AbstractElement _last_1 = IterableExtensions.last(((Group) _alternatives).getElements()); final Assignment lastAssignment = ((Assignment) _last_1); AbstractElement _terminal = lastAssignment.getTerminal(); final RuleCall ruleCall = ((RuleCall) _terminal); - EList _arguments = ruleCall.getArguments(); - final NamedArgument argument = IterableExtensions.head(_arguments); + final NamedArgument argument = IterableExtensions.head(ruleCall.getArguments()); Assert.assertEquals(IterableExtensions.head(rootRule.getParameters()), argument.getParameter()); - Assert.assertEquals(IterableExtensions.head(lastRule.getParameters()), ((ParameterReference) argument.getValue()).getParameter()); + Condition _value = argument.getValue(); + Assert.assertEquals(IterableExtensions.head(lastRule.getParameters()), ((ParameterReference) _value).getParameter()); } @Test @@ -133,22 +125,19 @@ public class XtextLinkerTest extends AbstractXtextTests { final String grammarAsString = _builder.toString(); EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); - EList _rules = grammar.getRules(); - AbstractRule _head = IterableExtensions.head(_rules); + AbstractRule _head = IterableExtensions.head(grammar.getRules()); final ParserRule rootRule = ((ParserRule) _head); - EList _rules_1 = grammar.getRules(); - AbstractRule _last = IterableExtensions.last(_rules_1); + AbstractRule _last = IterableExtensions.last(grammar.getRules()); final ParserRule lastRule = ((ParserRule) _last); AbstractElement _alternatives = lastRule.getAlternatives(); - EList _elements = ((Group) _alternatives).getElements(); - AbstractElement _last_1 = IterableExtensions.last(_elements); + AbstractElement _last_1 = IterableExtensions.last(((Group) _alternatives).getElements()); final Assignment lastAssignment = ((Assignment) _last_1); AbstractElement _terminal = lastAssignment.getTerminal(); final RuleCall ruleCall = ((RuleCall) _terminal); - EList _arguments = ruleCall.getArguments(); - final NamedArgument argument = IterableExtensions.head(_arguments); + final NamedArgument argument = IterableExtensions.head(ruleCall.getArguments()); Assert.assertEquals(IterableExtensions.head(rootRule.getParameters()), argument.getParameter()); - Assert.assertEquals(IterableExtensions.head(lastRule.getParameters()), ((ParameterReference) argument.getValue()).getParameter()); + Condition _value = argument.getValue(); + Assert.assertEquals(IterableExtensions.head(lastRule.getParameters()), ((ParameterReference) _value).getParameter()); } @Test @@ -165,22 +154,19 @@ public class XtextLinkerTest extends AbstractXtextTests { final String grammarAsString = _builder.toString(); EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); - EList _rules = grammar.getRules(); - AbstractRule _head = IterableExtensions.head(_rules); + AbstractRule _head = IterableExtensions.head(grammar.getRules()); final ParserRule rootRule = ((ParserRule) _head); - EList _rules_1 = grammar.getRules(); - AbstractRule _last = IterableExtensions.last(_rules_1); + AbstractRule _last = IterableExtensions.last(grammar.getRules()); final ParserRule lastRule = ((ParserRule) _last); AbstractElement _alternatives = lastRule.getAlternatives(); - EList _elements = ((Group) _alternatives).getElements(); - AbstractElement _last_1 = IterableExtensions.last(_elements); + AbstractElement _last_1 = IterableExtensions.last(((Group) _alternatives).getElements()); final Assignment lastAssignment = ((Assignment) _last_1); AbstractElement _terminal = lastAssignment.getTerminal(); final RuleCall ruleCall = ((RuleCall) _terminal); - EList _arguments = ruleCall.getArguments(); - final NamedArgument argument = IterableExtensions.head(_arguments); + final NamedArgument argument = IterableExtensions.head(ruleCall.getArguments()); Assert.assertEquals(IterableExtensions.head(rootRule.getParameters()), argument.getParameter()); - Assert.assertFalse(((LiteralCondition) argument.getValue()).isTrue()); + Condition _value = argument.getValue(); + Assert.assertFalse(((LiteralCondition) _value).isTrue()); } @Test @@ -197,10 +183,8 @@ public class XtextLinkerTest extends AbstractXtextTests { final String grammarAsString = _builder.toString(); EObject _model = this.getModel(grammarAsString); final Grammar grammar = ((Grammar) _model); - Resource _eResource = grammar.eResource(); - final ResourceSet resourceSet = _eResource.getResourceSet(); - URI _createURI = URI.createURI("other.xtext"); - final Resource otherResource = resourceSet.createResource(_createURI); + final ResourceSet resourceSet = grammar.eResource().getResourceSet(); + final Resource otherResource = resourceSet.createResource(URI.createURI("other.xtext")); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("grammar test.SubLang with test.Lang"); _builder_1.newLine(); @@ -210,25 +194,21 @@ public class XtextLinkerTest extends AbstractXtextTests { _builder_1.newLine(); LazyStringInputStream _lazyStringInputStream = new LazyStringInputStream(_builder_1.toString()); otherResource.load(_lazyStringInputStream, null); - EList _contents = otherResource.getContents(); - EObject _head = IterableExtensions.head(_contents); + EObject _head = IterableExtensions.head(otherResource.getContents()); final Grammar subGrammar = ((Grammar) _head); - EList _rules = subGrammar.getRules(); - AbstractRule _head_1 = IterableExtensions.head(_rules); + AbstractRule _head_1 = IterableExtensions.head(subGrammar.getRules()); final ParserRule rootRule = ((ParserRule) _head_1); - EList _rules_1 = grammar.getRules(); - AbstractRule _last = IterableExtensions.last(_rules_1); + AbstractRule _last = IterableExtensions.last(grammar.getRules()); final ParserRule parentRule = ((ParserRule) _last); AbstractElement _alternatives = parentRule.getAlternatives(); - EList _elements = ((Group) _alternatives).getElements(); - AbstractElement _last_1 = IterableExtensions.last(_elements); + AbstractElement _last_1 = IterableExtensions.last(((Group) _alternatives).getElements()); final Assignment lastAssignment = ((Assignment) _last_1); AbstractElement _terminal = lastAssignment.getTerminal(); final RuleCall ruleCall = ((RuleCall) _terminal); - EList _arguments = ruleCall.getArguments(); - final NamedArgument argument = IterableExtensions.head(_arguments); + final NamedArgument argument = IterableExtensions.head(ruleCall.getArguments()); Assert.assertEquals(IterableExtensions.head(rootRule.getParameters()), argument.getParameter()); - Assert.assertFalse(((LiteralCondition) argument.getValue()).isTrue()); + Condition _value = argument.getValue(); + Assert.assertFalse(((LiteralCondition) _value).isTrue()); } @Test @@ -246,27 +226,16 @@ public class XtextLinkerTest extends AbstractXtextTests { _builder.newLine(); final String grammarAsString = _builder.toString(); final XtextResource resource = this.getResourceFromString(grammarAsString); - EList _contents = resource.getContents(); - EObject _get = _contents.get(0); + EObject _get = resource.getContents().get(0); Grammar grammar = ((Grammar) _get); - EList _rules = grammar.getRules(); - final AbstractRule firstRule = IterableExtensions.head(_rules); - TreeIterator _eAllContents = firstRule.eAllContents(); - Iterator _filter = Iterators.filter(_eAllContents, RuleCall.class); - final RuleCall firstRuleCall = IteratorExtensions.head(_filter); + final AbstractRule firstRule = IterableExtensions.head(grammar.getRules()); + final RuleCall firstRuleCall = IteratorExtensions.head(Iterators.filter(firstRule.eAllContents(), RuleCall.class)); Assert.assertTrue(firstRuleCall.isExplicitlyCalled()); - TreeIterator _eAllContents_1 = firstRule.eAllContents(); - Iterator _filter_1 = Iterators.filter(_eAllContents_1, RuleCall.class); - final RuleCall secondRuleCall = IteratorExtensions.last(_filter_1); + final RuleCall secondRuleCall = IteratorExtensions.last(Iterators.filter(firstRule.eAllContents(), RuleCall.class)); Assert.assertFalse(secondRuleCall.isExplicitlyCalled()); - EList _rules_1 = grammar.getRules(); - AbstractRule _get_1 = _rules_1.get(1); - TreeIterator _eAllContents_2 = _get_1.eAllContents(); - Iterator _filter_2 = Iterators.filter(_eAllContents_2, RuleCall.class); - final RuleCall thirdRuleCall = IteratorExtensions.head(_filter_2); + final RuleCall thirdRuleCall = IteratorExtensions.head(Iterators.filter(grammar.getRules().get(1).eAllContents(), RuleCall.class)); Assert.assertTrue(thirdRuleCall.isExplicitlyCalled()); - int _indexOf = grammarAsString.indexOf("_super"); - resource.update(_indexOf, 1, " "); + resource.update(grammarAsString.indexOf("_super"), 1, " "); Assert.assertEquals(resource, firstRuleCall.eResource()); Assert.assertEquals(resource, secondRuleCall.eResource()); Assert.assertEquals(resource, thirdRuleCall.eResource()); @@ -301,43 +270,32 @@ public class XtextLinkerTest extends AbstractXtextTests { _builder.newLine(); final String grammarAsString = _builder.toString(); final XtextResource resource = this.getResourceFromString(grammarAsString); - EList _contents = resource.getContents(); - EObject _get = _contents.get(0); + EObject _get = resource.getContents().get(0); Grammar grammar = ((Grammar) _get); - EList _rules = grammar.getRules(); - final AbstractRule firstRule = IterableExtensions.head(_rules); - EList _usedGrammars = grammar.getUsedGrammars(); - Grammar _head = IterableExtensions.head(_usedGrammars); - final AbstractRule idRule = GrammarUtil.findRuleForName(_head, "ID"); + final AbstractRule firstRule = IterableExtensions.head(grammar.getRules()); + final AbstractRule idRule = GrammarUtil.findRuleForName(IterableExtensions.head(grammar.getUsedGrammars()), "ID"); + final Function1 _function = (RuleCall it) -> { + AbstractRule _rule = it.getRule(); + return Boolean.valueOf(Objects.equal(_rule, idRule)); + }; Assert.assertTrue( - IterableExtensions.forall(GrammarUtil.containedRuleCalls(firstRule), - ((Function1) (RuleCall it) -> { - AbstractRule _rule = it.getRule(); - return Boolean.valueOf(Objects.equal(_rule, idRule)); - }))); - EList _rules_1 = grammar.getRules(); - Iterable _tail = IterableExtensions.tail(_rules_1); - final AbstractRule secondRule = IterableExtensions.head(_tail); - EList _rules_2 = grammar.getRules(); - final AbstractRule stringRule = IterableExtensions.last(_rules_2); + IterableExtensions.forall(GrammarUtil.containedRuleCalls(firstRule), _function)); + final AbstractRule secondRule = IterableExtensions.head(IterableExtensions.tail(grammar.getRules())); + final AbstractRule stringRule = IterableExtensions.last(grammar.getRules()); + final Function1 _function_1 = (RuleCall it) -> { + AbstractRule _rule = it.getRule(); + return Boolean.valueOf(Objects.equal(_rule, stringRule)); + }; Assert.assertTrue( - IterableExtensions.forall(GrammarUtil.containedRuleCalls(secondRule), - ((Function1) (RuleCall it) -> { - AbstractRule _rule = it.getRule(); - return Boolean.valueOf(Objects.equal(_rule, stringRule)); - }))); - EList _rules_3 = grammar.getRules(); - Iterable _drop = IterableExtensions.drop(_rules_3, 2); - final AbstractRule thirdRule = IterableExtensions.head(_drop); - EList _usedGrammars_1 = grammar.getUsedGrammars(); - Grammar _head_1 = IterableExtensions.head(_usedGrammars_1); - final AbstractRule inheritedString = GrammarUtil.findRuleForName(_head_1, "STRING"); + IterableExtensions.forall(GrammarUtil.containedRuleCalls(secondRule), _function_1)); + final AbstractRule thirdRule = IterableExtensions.head(IterableExtensions.drop(grammar.getRules(), 2)); + final AbstractRule inheritedString = GrammarUtil.findRuleForName(IterableExtensions.head(grammar.getUsedGrammars()), "STRING"); + final Function1 _function_2 = (RuleCall it) -> { + AbstractRule _rule = it.getRule(); + return Boolean.valueOf(Objects.equal(_rule, inheritedString)); + }; Assert.assertTrue( - IterableExtensions.forall(GrammarUtil.containedRuleCalls(thirdRule), - ((Function1) (RuleCall it) -> { - AbstractRule _rule = it.getRule(); - return Boolean.valueOf(Objects.equal(_rule, inheritedString)); - }))); + IterableExtensions.forall(GrammarUtil.containedRuleCalls(thirdRule), _function_2)); } @Test @@ -353,11 +311,9 @@ public class XtextLinkerTest extends AbstractXtextTests { _builder.newLine(); final String grammarAsString = _builder.toString(); final XtextResource resource = this.getResourceFromString(grammarAsString); - EList _contents = resource.getContents(); - EObject _get = _contents.get(0); + EObject _get = resource.getContents().get(0); Grammar grammar = ((Grammar) _get); - EList _rules = grammar.getRules(); - AbstractRule _get_1 = _rules.get(1); + AbstractRule _get_1 = grammar.getRules().get(1); final TerminalRule string = ((TerminalRule) _get_1); AbstractElement _alternatives = string.getAlternatives(); final RuleCall callToSuper = ((RuleCall) _alternatives); @@ -379,11 +335,9 @@ public class XtextLinkerTest extends AbstractXtextTests { _builder.newLine(); final String grammarAsString = _builder.toString(); final XtextResource resource = this.getResourceFromString(grammarAsString); - EList _contents = resource.getContents(); - EObject _get = _contents.get(0); + EObject _get = resource.getContents().get(0); Grammar grammar = ((Grammar) _get); - EList _rules = grammar.getRules(); - AbstractRule _get_1 = _rules.get(1); + AbstractRule _get_1 = grammar.getRules().get(1); final TerminalRule string = ((TerminalRule) _get_1); AbstractElement _alternatives = string.getAlternatives(); final RuleCall callToSuper = ((RuleCall) _alternatives); @@ -422,11 +376,9 @@ public class XtextLinkerTest extends AbstractXtextTests { private void checkPackageRemovalAfterGrammarChange(final boolean isRemoved, final String originalGrammar, final int offset, final int length, final String replacement) throws Exception { final XtextResource resource = this.getResourceFromStringAndExpect(originalGrammar, 1); - EList _contents = resource.getContents(); - EObject _get = _contents.get(0); + EObject _get = resource.getContents().get(0); Grammar grammar = ((Grammar) _get); - EList _metamodelDeclarations = grammar.getMetamodelDeclarations(); - AbstractMetamodelDeclaration generatedMetamodel = _metamodelDeclarations.get(0); + AbstractMetamodelDeclaration generatedMetamodel = grammar.getMetamodelDeclarations().get(0); EPackage ePackage = generatedMetamodel.getEPackage(); Assert.assertEquals(ePackage.eResource().getResourceSet(), resource.getResourceSet()); resource.update(offset, length, replacement); @@ -435,8 +387,7 @@ public class XtextLinkerTest extends AbstractXtextTests { } else { Assert.assertEquals(ePackage.eResource().getResourceSet(), resource.getResourceSet()); } - EList _contents_1 = resource.getContents(); - EObject _get_1 = _contents_1.get(0); + EObject _get_1 = resource.getContents().get(0); grammar = ((Grammar) _get_1); generatedMetamodel = grammar.getMetamodelDeclarations().get(0); ePackage = generatedMetamodel.getEPackage(); @@ -445,11 +396,9 @@ public class XtextLinkerTest extends AbstractXtextTests { private void checkRegisteredPackageNotUnloadedAfterGrammarChange(final String originalGrammar, final int offset, final int length, final String replacement) throws Exception { final XtextResource resource = this.getResourceFromString(originalGrammar); - EList _contents = resource.getContents(); - EObject _get = _contents.get(0); + EObject _get = resource.getContents().get(0); final Grammar grammar = ((Grammar) _get); - EList _metamodelDeclarations = grammar.getMetamodelDeclarations(); - final AbstractMetamodelDeclaration generatedMetamodel = _metamodelDeclarations.get(0); + final AbstractMetamodelDeclaration generatedMetamodel = grammar.getMetamodelDeclarations().get(0); final EPackage ePackage = generatedMetamodel.getEPackage(); Assert.assertNull(((InternalEObject) ePackage).eProxyURI()); resource.update(offset, length, replacement); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/ecoreInference/Xtext2EcoreTransformerTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/ecoreInference/Xtext2EcoreTransformerTest.java index 9449143d5..f75a8ef3a 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/ecoreInference/Xtext2EcoreTransformerTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/ecoreInference/Xtext2EcoreTransformerTest.java @@ -35,14 +35,10 @@ import org.eclipse.xtext.XtextStandaloneSetup; import org.eclipse.xtext.diagnostics.ExceptionDiagnostic; import org.eclipse.xtext.diagnostics.IDiagnosticConsumer; import org.eclipse.xtext.linking.ILinker; -import org.eclipse.xtext.linking.ILinkingService; import org.eclipse.xtext.linking.impl.Linker; import org.eclipse.xtext.linking.impl.LinkingDiagnosticMessageProvider; -import org.eclipse.xtext.linking.impl.LinkingHelper; -import org.eclipse.xtext.resource.IResourceFactory; import org.eclipse.xtext.resource.XtextResource; import org.eclipse.xtext.resource.XtextResourceSet; -import org.eclipse.xtext.scoping.IScopeProvider; import org.eclipse.xtext.tests.AbstractXtextTests; import org.eclipse.xtext.tests.TestErrorAcceptor; import org.eclipse.xtext.util.OnChangeEvictingCache; @@ -142,13 +138,10 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { @Override public XtextResource doGetResource(final InputStream in, final URI uri) throws Exception { XtextResourceSet rs = this.get(XtextResourceSet.class); - Class _class = this.getClass(); - rs.setClasspathURIContext(_class); - IResourceFactory _resourceFactory = this.getResourceFactory(); - Resource _createResource = _resourceFactory.createResource(uri); + rs.setClasspathURIContext(this.getClass()); + Resource _createResource = this.getResourceFactory().createResource(uri); final XtextResource resource = ((XtextResource) _createResource); - EList _resources = rs.getResources(); - _resources.add(resource); + rs.getResources().add(resource); XtextLinker linker = new XtextLinker() { @Override protected Xtext2EcoreTransformer createTransformer(final Grammar grammar, final IDiagnosticConsumer consumer) { @@ -160,14 +153,11 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { } }; ILinker _linker = resource.getLinker(); - IScopeProvider _scopeProvider = ((XtextLinker) _linker).getScopeProvider(); - linker.setScopeProvider(_scopeProvider); + linker.setScopeProvider(((XtextLinker) _linker).getScopeProvider()); ILinker _linker_1 = resource.getLinker(); - ILinkingService _linkingService = ((Linker) _linker_1).getLinkingService(); - linker.setLinkingService(_linkingService); + linker.setLinkingService(((Linker) _linker_1).getLinkingService()); ILinker _linker_2 = resource.getLinker(); - LinkingHelper _linkingHelper = ((Linker) _linker_2).getLinkingHelper(); - linker.setLinkingHelper(_linkingHelper); + linker.setLinkingHelper(((Linker) _linker_2).getLinkingHelper()); XtextLinker.PackageRemover _packageRemover = new XtextLinker.PackageRemover(); linker.setPackageRemover(_packageRemover); LinkingDiagnosticMessageProvider _linkingDiagnosticMessageProvider = new LinkingDiagnosticMessageProvider(); @@ -190,8 +180,7 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { } private EAttribute assertAttributeConfiguration(final EClass eClass, final int attributeIndex, final String featureName, final String featureTypeName) { - EList _eAttributes = eClass.getEAttributes(); - final EAttribute feature = _eAttributes.get(attributeIndex); + final EAttribute feature = eClass.getEAttributes().get(attributeIndex); Assert.assertEquals(featureName, feature.getName()); Assert.assertNotNull(feature.getEType()); Assert.assertEquals(featureTypeName, feature.getEType().getName()); @@ -206,8 +195,7 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { } private EReference assertReferenceConfiguration(final EClass eClass, final int referenceIndex, final String featureName, final String featureTypeName, final boolean isContainment, final int lowerBound, final int upperBound) { - EList _eReferences = eClass.getEReferences(); - final EReference reference = _eReferences.get(referenceIndex); + final EReference reference = eClass.getEReferences().get(referenceIndex); Assert.assertEquals(featureName, reference.getName()); Assert.assertNotNull(reference.getEType()); Assert.assertEquals(featureTypeName, reference.getEType().getName()); @@ -536,21 +524,17 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { final Xtext2EcoreTransformer transformer = new Xtext2EcoreTransformer(grammar); transformer.removeGeneratedPackages(); transformer.transform(); - EList _rules = grammar.getRules(); - final AbstractRule rule = IterableExtensions.head(_rules); + final AbstractRule rule = IterableExtensions.head(grammar.getRules()); TypeRef type = rule.getType(); Assert.assertNotNull(type); Assert.assertNotNull(transformer.getEClassifierInfos().getInfo(type)); - List _allMetamodelDeclarations = GrammarUtil.allMetamodelDeclarations(grammar); - AbstractMetamodelDeclaration _get = _allMetamodelDeclarations.get(1); + AbstractMetamodelDeclaration _get = GrammarUtil.allMetamodelDeclarations(grammar).get(1); final ReferencedMetamodel referenced = ((ReferencedMetamodel) _get); Assert.assertNotNull(referenced); Assert.assertEquals("ecore", referenced.getAlias()); Assert.assertNull(transformer.getEClassifierInfos().getInfo(referenced, "EString")); Assert.assertNull(transformer.getEClassifierInfos().getInfo(referenced, "EInt")); - EClassifierInfos _eClassifierInfos = transformer.getEClassifierInfos(); - List _parents = _eClassifierInfos.getParents(); - EClassifierInfos parentInfos = IterableExtensions.head(_parents); + EClassifierInfos parentInfos = IterableExtensions.head(transformer.getEClassifierInfos().getParents()); Assert.assertNotNull(parentInfos.getInfo(referenced, "EString")); Assert.assertNotNull(parentInfos.getInfo(referenced, "EInt")); } @@ -633,8 +617,7 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { Assert.assertNotNull(ruleB); Assert.assertTrue(ruleA.getESuperTypes().isEmpty()); Assert.assertEquals(1, ruleB.getESuperTypes().size()); - EList _eSuperTypes = ruleB.getESuperTypes(); - EClass superClass = IterableExtensions.head(_eSuperTypes); + EClass superClass = IterableExtensions.head(ruleB.getESuperTypes()); Assert.assertEquals(ruleA, superClass); } @@ -1543,14 +1526,12 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { String grammar = _builder.toString(); final XtextResource resource = this.getResourceFromString(grammar); Assert.assertTrue(resource.getErrors().isEmpty()); - EList _contents = resource.getContents(); - EObject _head = IterableExtensions.head(_contents); + EObject _head = IterableExtensions.head(resource.getContents()); final Grammar parsedGrammar = ((Grammar) _head); EList _rules = parsedGrammar.getRules(); for (final AbstractRule rule : _rules) { { - TypeRef _type = rule.getType(); - final EClassifier classifier = _type.getClassifier(); + final EClassifier classifier = rule.getType().getClassifier(); EPackage pack = classifier.getEPackage(); Assert.assertEquals("bugreport", pack.getName()); } @@ -1560,22 +1541,14 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { @Test public void testBug_266807() throws Exception { final XtextResourceSet rs = this.get(XtextResourceSet.class); - Class _class = this.getClass(); - rs.setClasspathURIContext(_class); + rs.setClasspathURIContext(this.getClass()); StringConcatenation _builder = new StringConcatenation(); _builder.append("classpath:/"); - Class _class_1 = this.getClass(); - Package _package = _class_1.getPackage(); - String _name = _package.getName(); - Character _valueOf = Character.valueOf('.'); - char _charValue = _valueOf.charValue(); - Character _valueOf_1 = Character.valueOf('/'); - char _charValue_1 = _valueOf_1.charValue(); - String _replace = _name.replace(_charValue, _charValue_1); + String _replace = this.getClass().getPackage().getName().replace(Character.valueOf('.').charValue(), Character.valueOf('/').charValue()); _builder.append(_replace); _builder.append("/Test.xtext"); - URI _createURI = URI.createURI(_builder.toString()); - Resource _createResource = rs.createResource(_createURI, + Resource _createResource = rs.createResource( + URI.createURI(_builder.toString()), ContentHandler.UNSPECIFIED_CONTENT_TYPE); final XtextResource resource = ((XtextResource) _createResource); resource.load(null); @@ -1717,8 +1690,7 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { EObject _model = this.getModel(xtextGrammar); final Grammar grammar = ((Grammar) _model); final Xtext2EcoreTransformer transformer = new Xtext2EcoreTransformer(grammar); - EList _metamodelDeclarations = grammar.getMetamodelDeclarations(); - AbstractMetamodelDeclaration _get = _metamodelDeclarations.get(1); + AbstractMetamodelDeclaration _get = grammar.getMetamodelDeclarations().get(1); GeneratedMetamodel testMetamodel = ((GeneratedMetamodel) _get); final Xtext2EcoreTransformerTest.MockedXtext2EcorePostProcessor postProcessor = new Xtext2EcoreTransformerTest.MockedXtext2EcorePostProcessor(testMetamodel); transformer.setPostProcessor(postProcessor); @@ -1786,8 +1758,7 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { final String grammar = _builder.toString(); final XtextResource resource = this.getResourceFromStringAndExpect(grammar, 1); Assert.assertEquals(resource.getErrors().toString(), 1, resource.getErrors().size()); - EList _errors = resource.getErrors(); - Resource.Diagnostic _get = _errors.get( + Resource.Diagnostic _get = resource.getErrors().get( 0); TransformationDiagnostic diagnostic = ((TransformationDiagnostic) _get); Assert.assertEquals(grammar.indexOf("mm::Atom"), diagnostic.getOffset()); @@ -2105,15 +2076,12 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { final String grammarAsString = _builder.toString(); final XtextResource resource = this.getResourceFromStringAndExpect(grammarAsString, 0); Assert.assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty()); - EList _contents = resource.getContents(); - EObject _head = IterableExtensions.head(_contents); + EObject _head = IterableExtensions.head(resource.getContents()); final Grammar grammar = ((Grammar) _head); - EList _metamodelDeclarations = grammar.getMetamodelDeclarations(); - AbstractMetamodelDeclaration _get = _metamodelDeclarations.get(1); + AbstractMetamodelDeclaration _get = grammar.getMetamodelDeclarations().get(1); GeneratedMetamodel generatedMetamodel = ((GeneratedMetamodel) _get); Assert.assertEquals("myDsl", generatedMetamodel.getName()); - EPackage _ePackage = generatedMetamodel.getEPackage(); - EClassifier _type = this.type(_ePackage, "CreatedType"); + EClassifier _type = this.type(generatedMetamodel.getEPackage(), "CreatedType"); EClass createdType = ((EClass) _type); Assert.assertEquals(this.feature(createdType, "enumFeature").getEType(), this.feature(createdType, "otherEnumFeature").getEType()); @@ -2132,16 +2100,13 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { _builder.newLine(); final String grammarAsString = _builder.toString(); final XtextResource resource = this.getResourceFromString(grammarAsString); - EList _contents = resource.getContents(); - EObject _head = IterableExtensions.head(_contents); + EObject _head = IterableExtensions.head(resource.getContents()); final Grammar grammar = ((Grammar) _head); - EList _metamodelDeclarations = grammar.getMetamodelDeclarations(); - AbstractMetamodelDeclaration _head_1 = IterableExtensions.head(_metamodelDeclarations); + AbstractMetamodelDeclaration _head_1 = IterableExtensions.head(grammar.getMetamodelDeclarations()); GeneratedMetamodel generatedMetamodel = ((GeneratedMetamodel) _head_1); Assert.assertEquals("myDsl", generatedMetamodel.getName()); Assert.assertEquals(1, generatedMetamodel.getEPackage().getEClassifiers().size()); - EPackage _ePackage = generatedMetamodel.getEPackage(); - EClassifier _type = this.type(_ePackage, "Model"); + EClassifier _type = this.type(generatedMetamodel.getEPackage(), "Model"); EClass createdModel = ((EClass) _type); Assert.assertEquals(EcorePackage.Literals.ESTRING, this.feature(createdModel, "name").getEType()); EList _rules = grammar.getRules(); @@ -2833,10 +2798,8 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { public void testBug413171_01() throws Exception { EObject _model = this.getModel(this.readFileIntoString("org/eclipse/xtext/xtext/ecoreInference/Bug413171_01.xtext.txt")); final Grammar grammar = ((Grammar) _model); - EList _rules = grammar.getRules(); - final AbstractRule parserRule = _rules.get(2); - TypeRef _type = parserRule.getType(); - final EClassifier classifier = _type.getClassifier(); + final AbstractRule parserRule = grammar.getRules().get(2); + final EClassifier classifier = parserRule.getType().getClassifier(); Assert.assertTrue(parserRule.getName(), (classifier instanceof EDataType)); } @@ -2844,10 +2807,8 @@ public class Xtext2EcoreTransformerTest extends AbstractXtextTests { public void testBug413171_02() throws Exception { EObject _model = this.getModel(this.readFileIntoString("org/eclipse/xtext/xtext/ecoreInference/Bug413171_02.xtext.txt")); final Grammar grammar = ((Grammar) _model); - EList _rules = grammar.getRules(); - final AbstractRule parserRule = _rules.get(2); - TypeRef _type = parserRule.getType(); - final EClassifier classifier = _type.getClassifier(); + final AbstractRule parserRule = grammar.getRules().get(2); + final EClassifier classifier = parserRule.getType().getClassifier(); Assert.assertTrue(parserRule.getName(), (classifier instanceof EDataType)); } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/AntlrGeneratorFragmentTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/AntlrGeneratorFragmentTest.java index 12cc5c804..6a973c747 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/AntlrGeneratorFragmentTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/AntlrGeneratorFragmentTest.java @@ -246,15 +246,13 @@ public class AntlrGeneratorFragmentTest extends AbstractXtextTests { protected void asserTranslatesToDebugGrammar(final CharSequence xtextGrammar, final String expectedDebugGrammar) { try { - String _string = xtextGrammar.toString(); - EObject _model = super.getModel(_string); + EObject _model = super.getModel(xtextGrammar.toString()); final Grammar grammar = ((Grammar) _model); DefaultGeneratorModule _defaultGeneratorModule = new DefaultGeneratorModule(); final Injector injector = Guice.createInjector(_defaultGeneratorModule); final AntlrGeneratorFragmentTest.InMemFSA inMem = new AntlrGeneratorFragmentTest.InMemFSA(); final AntlrOptions options = new AntlrOptions(); - AntlrDebugGrammarGenerator _instance = injector.getInstance(AntlrDebugGrammarGenerator.class); - _instance.generate(grammar, options, inMem); + injector.getInstance(AntlrDebugGrammarGenerator.class).generate(grammar, options, inMem); Assert.assertEquals(expectedDebugGrammar, IterableExtensions.head(inMem.getAllFiles().values()).toString()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/EMFGeneratorFragment2Test.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/EMFGeneratorFragment2Test.java index 14b837c55..a24b9e613 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/EMFGeneratorFragment2Test.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/EMFGeneratorFragment2Test.java @@ -68,7 +68,6 @@ public class EMFGeneratorFragment2Test { } public void assertTrim(final String expected, final String original) { - String _trimMultiLineComment = EMFGeneratorFragment2.trimMultiLineComment(original); - Assert.assertEquals(expected, _trimMultiLineComment); + Assert.assertEquals(expected, EMFGeneratorFragment2.trimMultiLineComment(original)); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/Formatter2Fragment2Test.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/Formatter2Fragment2Test.java index 6b694b1e0..2fdff17b1 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/Formatter2Fragment2Test.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/Formatter2Fragment2Test.java @@ -7,10 +7,7 @@ */ package org.eclipse.xtext.xtext.generator; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2; import org.junit.Assert; @@ -32,29 +29,21 @@ public class Formatter2Fragment2Test { @Test public void testVarNameWithEClass() { - EClass _eClass = EcorePackage.eINSTANCE.getEClass(); - String _varName = this.fragment.toVarName(_eClass); - Assert.assertEquals("eClass", _varName); + Assert.assertEquals("eClass", this.fragment.toVarName(EcorePackage.eINSTANCE.getEClass())); } @Test public void testVarNameWithMultiReference() { - EReference _eClass_EAllOperations = EcorePackage.eINSTANCE.getEClass_EAllOperations(); - String _varName = this.fragment.toVarName(_eClass_EAllOperations); - Assert.assertEquals("eOperation", _varName); + Assert.assertEquals("eOperation", this.fragment.toVarName(EcorePackage.eINSTANCE.getEClass_EAllOperations())); } @Test public void testVarNameWithSingleReference() { - EAttribute _eNamedElement_Name = EcorePackage.eINSTANCE.getENamedElement_Name(); - String _varName = this.fragment.toVarName(_eNamedElement_Name); - Assert.assertEquals("name", _varName); + Assert.assertEquals("name", this.fragment.toVarName(EcorePackage.eINSTANCE.getENamedElement_Name())); } @Test public void testVarNameConflictingWithXtendKeyword() { - EAttribute _eClass_Abstract = EcorePackage.eINSTANCE.getEClass_Abstract(); - String _varName = this.fragment.toVarName(_eClass_Abstract); - Assert.assertEquals("_abstract", _varName); + Assert.assertEquals("_abstract", this.fragment.toVarName(EcorePackage.eINSTANCE.getEClass_Abstract())); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/WizardConfigTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/WizardConfigTest.java index 1ace2614c..d8e4adda9 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/WizardConfigTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/generator/WizardConfigTest.java @@ -27,7 +27,8 @@ public class WizardConfigTest { @Before public void createInjector() { - this.injector = Guice.createInjector(new DefaultGeneratorModule()); + DefaultGeneratorModule _defaultGeneratorModule = new DefaultGeneratorModule(); + this.injector = Guice.createInjector(_defaultGeneratorModule); } @Test @@ -45,12 +46,8 @@ public class WizardConfigTest { }; final StandardProjectConfig cfg = ObjectExtensions.operator_doubleArrow(_standardProjectConfig, _function); cfg.initialize(this.injector); - BundleProjectConfig _runtimeTest = cfg.getRuntimeTest(); - String _name = _runtimeTest.getName(); - Assert.assertEquals("com.acme", _name); - BundleProjectConfig _eclipsePluginTest = cfg.getEclipsePluginTest(); - String _name_1 = _eclipsePluginTest.getName(); - Assert.assertEquals("com.acme.ui", _name_1); + Assert.assertEquals("com.acme", cfg.getRuntimeTest().getName()); + Assert.assertEquals("com.acme.ui", cfg.getEclipsePluginTest().getName()); } @Test @@ -67,11 +64,7 @@ public class WizardConfigTest { }; final StandardProjectConfig cfg = ObjectExtensions.operator_doubleArrow(_standardProjectConfig, _function); cfg.initialize(this.injector); - BundleProjectConfig _runtimeTest = cfg.getRuntimeTest(); - String _name = _runtimeTest.getName(); - Assert.assertEquals("com.acme.tests", _name); - BundleProjectConfig _eclipsePluginTest = cfg.getEclipsePluginTest(); - String _name_1 = _eclipsePluginTest.getName(); - Assert.assertEquals("com.acme.ui.tests", _name_1); + Assert.assertEquals("com.acme.tests", cfg.getRuntimeTest().getName()); + Assert.assertEquals("com.acme.ui.tests", cfg.getEclipsePluginTest().getName()); } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/wizard/WizardConfigurationTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/wizard/WizardConfigurationTest.java index 4401e6eab..d7518dcbe 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/wizard/WizardConfigurationTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/wizard/WizardConfigurationTest.java @@ -11,7 +11,6 @@ import com.google.common.base.Objects; import com.google.common.collect.Iterables; import java.util.Collections; import java.util.List; -import java.util.Set; import java.util.function.Consumer; import org.eclipse.xtext.util.JavaVersion; import org.eclipse.xtext.util.XtextVersion; @@ -24,12 +23,10 @@ import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; import org.eclipse.xtext.xtext.wizard.AbstractFile; import org.eclipse.xtext.xtext.wizard.BuildSystem; import org.eclipse.xtext.xtext.wizard.ExternalDependency; -import org.eclipse.xtext.xtext.wizard.GradleBuildFile; import org.eclipse.xtext.xtext.wizard.IdeProjectDescriptor; import org.eclipse.xtext.xtext.wizard.IntellijProjectDescriptor; import org.eclipse.xtext.xtext.wizard.LanguageDescriptor; import org.eclipse.xtext.xtext.wizard.P2RepositoryProject; -import org.eclipse.xtext.xtext.wizard.ParentProjectDescriptor; import org.eclipse.xtext.xtext.wizard.PomFile; import org.eclipse.xtext.xtext.wizard.ProjectDescriptor; import org.eclipse.xtext.xtext.wizard.ProjectLayout; @@ -72,14 +69,14 @@ public class WizardConfigurationTest { 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 it) -> { + final Function1 _function = (ProjectDescriptor it) -> { boolean _isEclipsePluginProject = it.isEclipsePluginProject(); return Boolean.valueOf((!_isEclipsePluginProject)); - })), ((Function1) (ProjectDescriptor it) -> { - PomFile _pom = it.pom(); - String _content = _pom.getContent(); - return Boolean.valueOf(_content.contains("tycho")); - }))); + }; + final Function1 _function_1 = (ProjectDescriptor it) -> { + return Boolean.valueOf(it.pom().getContent().contains("tycho")); + }; + Assert.assertFalse(IterableExtensions.exists(IterableExtensions.filter(this.allJavaProjects(), _function), _function_1)); } @Test @@ -128,9 +125,7 @@ public class WizardConfigurationTest { _p2Project.setEnabled(true); this.config.setPreferredBuildSystem(BuildSystem.MAVEN); Assert.assertTrue(this.config.needsTychoBuild()); - ParentProjectDescriptor _parentProject = this.config.getParentProject(); - PomFile _pom = _parentProject.pom(); - String _content = _pom.getContent(); + String _content = this.config.getParentProject().pom().getContent(); final Procedure1 _function = (String it) -> { Assert.assertTrue(it.contains("tycho-source-plugin")); Assert.assertTrue(it.contains("tycho-source-feature-plugin")); @@ -148,8 +143,7 @@ public class WizardConfigurationTest { @Test public void testProjectIsPluginProjectWhenRuntimeProjectIsPluginProject() { - RuntimeProjectDescriptor _runtimeProject = this.config.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); + TestProjectDescriptor _testProject = this.config.getRuntimeProject().getTestProject(); _testProject.setEnabled(true); Assert.assertTrue(this.config.getRuntimeProject().getTestProject().isEclipsePluginProject()); } @@ -200,119 +194,107 @@ public class WizardConfigurationTest { @Test public void inlinedTestProjectsDontOverrideMainSources() { - RuntimeProjectDescriptor _runtimeProject = this.config.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); + TestProjectDescriptor _testProject = this.config.getRuntimeProject().getTestProject(); _testProject.setEnabled(true); this.config.setPreferredBuildSystem(BuildSystem.MAVEN); this.config.setSourceLayout(SourceLayout.MAVEN); - RuntimeProjectDescriptor _runtimeProject_1 = this.config.getRuntimeProject(); - Iterable _files = _runtimeProject_1.getFiles(); final Function1 _function = (AbstractFile it) -> { String _relativePath = it.getRelativePath(); return Boolean.valueOf(Objects.equal(_relativePath, "pom.xml")); }; - final AbstractFile pom = IterableExtensions.findFirst(_files, _function); + final AbstractFile pom = IterableExtensions.findFirst(this.config.getRuntimeProject().getFiles(), _function); Assert.assertTrue((pom instanceof PomFile)); Assert.assertTrue(((PomFile) pom).getContent().toString().contains("org.example.mydsl")); } @Test public void inlinedTestProjectsAddTheirDependenciesToTheMainProject() { - RuntimeProjectDescriptor _runtimeProject = this.config.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); + TestProjectDescriptor _testProject = this.config.getRuntimeProject().getTestProject(); _testProject.setEnabled(true); this.config.setSourceLayout(SourceLayout.MAVEN); - RuntimeProjectDescriptor _runtimeProject_1 = this.config.getRuntimeProject(); - TestProjectDescriptor _testProject_1 = _runtimeProject_1.getTestProject(); - Set _externalDependencies = _testProject_1.getExternalDependencies(); final Consumer _function = (ExternalDependency testDependency) -> { + final Function1 _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()))); + }; Assert.assertTrue( - IterableExtensions.exists(this.config.getRuntimeProject().getExternalDependencies(), - ((Function1) (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()))); - }))); + IterableExtensions.exists(this.config.getRuntimeProject().getExternalDependencies(), _function_1)); }; - _externalDependencies.forEach(_function); + this.config.getRuntimeProject().getTestProject().getExternalDependencies().forEach(_function); } @Test public void inlinedTestProjectsAddTheirSourceFoldersToTheMainProject() { - RuntimeProjectDescriptor _runtimeProject = this.config.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); + TestProjectDescriptor _testProject = this.config.getRuntimeProject().getTestProject(); _testProject.setEnabled(true); this.config.setSourceLayout(SourceLayout.MAVEN); - RuntimeProjectDescriptor _runtimeProject_1 = this.config.getRuntimeProject(); - TestProjectDescriptor _testProject_1 = _runtimeProject_1.getTestProject(); - Set _sourceFolders = _testProject_1.getSourceFolders(); final Consumer _function = (String testFolder) -> { Assert.assertTrue(this.config.getRuntimeProject().getSourceFolders().contains(testFolder)); }; - _sourceFolders.forEach(_function); + this.config.getRuntimeProject().getTestProject().getSourceFolders().forEach(_function); } @Test public void mavenProjectsHaveAPom() { this.config.setPreferredBuildSystem(BuildSystem.MAVEN); - List _allJavaProjects = this.allJavaProjects(); final Function1 _function = (ProjectDescriptor it) -> { return Boolean.valueOf(it.isPartOfMavenBuild()); }; - Iterable _filter = IterableExtensions.filter(_allJavaProjects, _function); final Consumer _function_1 = (ProjectDescriptor it) -> { it.setEnabled(true); - Assert.assertTrue(IterableExtensions.exists(it.getFiles(), ((Function1) (AbstractFile it_1) -> { + final Function1 _function_2 = (AbstractFile it_1) -> { String _relativePath = it_1.getRelativePath(); return Boolean.valueOf(Objects.equal(_relativePath, "pom.xml")); - }))); + }; + Assert.assertTrue(IterableExtensions.exists(it.getFiles(), _function_2)); }; - _filter.forEach(_function_1); + IterableExtensions.filter(this.allJavaProjects(), _function).forEach(_function_1); } @Test public void gradleProjectsHaveABuildFile() { this.config.setPreferredBuildSystem(BuildSystem.GRADLE); - List _allJavaProjects = this.allJavaProjects(); final Function1 _function = (ProjectDescriptor it) -> { return Boolean.valueOf(it.isPartOfGradleBuild()); }; - Iterable _filter = IterableExtensions.filter(_allJavaProjects, _function); final Consumer _function_1 = (ProjectDescriptor it) -> { it.setEnabled(true); - Assert.assertTrue(IterableExtensions.exists(it.getFiles(), ((Function1) (AbstractFile it_1) -> { + final Function1 _function_2 = (AbstractFile it_1) -> { String _relativePath = it_1.getRelativePath(); return Boolean.valueOf(Objects.equal(_relativePath, "build.gradle")); - }))); + }; + Assert.assertTrue(IterableExtensions.exists(it.getFiles(), _function_2)); }; - _filter.forEach(_function_1); + IterableExtensions.filter(this.allJavaProjects(), _function).forEach(_function_1); } @Test public void pluginProjectsHaveEclipseMetaData() { - List _allJavaProjects = this.allJavaProjects(); final Function1 _function = (ProjectDescriptor it) -> { return Boolean.valueOf(it.isEclipsePluginProject()); }; - Iterable _filter = IterableExtensions.filter(_allJavaProjects, _function); final Consumer _function_1 = (ProjectDescriptor it) -> { it.setEnabled(true); - Assert.assertTrue(IterableExtensions.exists(it.getFiles(), ((Function1) (AbstractFile it_1) -> { + final Function1 _function_2 = (AbstractFile it_1) -> { String _relativePath = it_1.getRelativePath(); return Boolean.valueOf(Objects.equal(_relativePath, "MANIFEST.MF")); - }))); - Assert.assertTrue(IterableExtensions.exists(it.getFiles(), ((Function1) (AbstractFile it_1) -> { + }; + Assert.assertTrue(IterableExtensions.exists(it.getFiles(), _function_2)); + final Function1 _function_3 = (AbstractFile it_1) -> { String _relativePath = it_1.getRelativePath(); return Boolean.valueOf(Objects.equal(_relativePath, "build.properties")); - }))); + }; + Assert.assertTrue(IterableExtensions.exists(it.getFiles(), _function_3)); }; - _filter.forEach(_function_1); + IterableExtensions.filter(this.allJavaProjects(), _function).forEach(_function_1); } @Test public void featureProjectsHaveEclipseBuildProperties() { - Assert.assertTrue(IterableExtensions.exists(this.config.getSdkProject().getFiles(), ((Function1) (AbstractFile it) -> { + final Function1 _function = (AbstractFile it) -> { String _relativePath = it.getRelativePath(); return Boolean.valueOf(Objects.equal(_relativePath, "build.properties")); - }))); + }; + Assert.assertTrue(IterableExtensions.exists(this.config.getSdkProject().getFiles(), _function)); } @Test @@ -358,36 +340,35 @@ public class WizardConfigurationTest { _uiProject.setEnabled(true); IdeProjectDescriptor _ideProject = this.config.getIdeProject(); _ideProject.setEnabled(true); - Set _enabledProjects = this.config.getEnabledProjects(); final Function1 _function = (ProjectDescriptor it) -> { return Boolean.valueOf(it.isEclipsePluginProject()); }; - Iterable _filter = IterableExtensions.filter(_enabledProjects, _function); final Consumer _function_1 = (ProjectDescriptor it) -> { Assert.assertTrue(it.buildGradle().getContent().contains("eclipseClasspath.enabled=false")); }; - _filter.forEach(_function_1); + IterableExtensions.filter(this.config.getEnabledProjects(), _function).forEach(_function_1); } @Test public void parentContainsOtherProjectsInHierarchicallayout() { this.config.setProjectLayout(ProjectLayout.HIERARCHICAL); - List _allJavaProjects = this.allJavaProjects(); final Consumer _function = (ProjectDescriptor it) -> { - Assert.assertTrue(it.getLocation().startsWith((this.config.getParentProject().getLocation() + "/"))); + String _location = it.getLocation(); + String _location_1 = this.config.getParentProject().getLocation(); + String _plus = (_location_1 + "/"); + Assert.assertTrue(_location.startsWith(_plus)); }; - _allJavaProjects.forEach(_function); + this.allJavaProjects().forEach(_function); } @Test public void plainMavenProjectsCanBeBuiltWithEclipseLayout() { this.config.setPreferredBuildSystem(BuildSystem.MAVEN); this.config.setSourceLayout(SourceLayout.PLAIN); - List _allJavaProjects = this.allJavaProjects(); final Function1 _function = (ProjectDescriptor it) -> { return Boolean.valueOf(((!it.isEclipsePluginProject()) && it.isPartOfMavenBuild())); }; - final Iterable plainMavenProjects = IterableExtensions.filter(_allJavaProjects, _function); + final Iterable plainMavenProjects = IterableExtensions.filter(this.allJavaProjects(), _function); final Consumer _function_1 = (ProjectDescriptor it) -> { Assert.assertTrue(it.pom().getContent().contains("src")); Assert.assertTrue(it.pom().getContent().contains("src-gen")); @@ -397,7 +378,6 @@ public class WizardConfigurationTest { final Function1 _function_2 = (ProjectDescriptor it) -> { return Boolean.valueOf((!(it instanceof TestProjectDescriptor))); }; - Iterable _filter = IterableExtensions.filter(plainMavenProjects, _function_2); final Consumer _function_3 = (ProjectDescriptor it) -> { Assert.assertTrue(it.pom().getContent().contains("src")); Assert.assertTrue(it.pom().getContent().contains("add-source")); @@ -405,8 +385,7 @@ public class WizardConfigurationTest { Assert.assertFalse(it.pom().getContent().contains("add-test-source")); Assert.assertFalse(it.pom().getContent().contains("add-test-resource")); }; - _filter.forEach(_function_3); - Iterable _filter_1 = Iterables.filter(plainMavenProjects, TestProjectDescriptor.class); + IterableExtensions.filter(plainMavenProjects, _function_2).forEach(_function_3); final Consumer _function_4 = (TestProjectDescriptor it) -> { Assert.assertTrue(it.pom().getContent().contains("src")); Assert.assertTrue(it.pom().getContent().contains("add-test-source")); @@ -414,18 +393,17 @@ public class WizardConfigurationTest { Assert.assertFalse(it.pom().getContent().contains("add-source")); Assert.assertFalse(it.pom().getContent().contains("add-resource")); }; - _filter_1.forEach(_function_4); + Iterables.filter(plainMavenProjects, TestProjectDescriptor.class).forEach(_function_4); } @Test public void plainMavenProjectsCanBeBuiltWithMavenLayout() { this.config.setPreferredBuildSystem(BuildSystem.MAVEN); this.config.setSourceLayout(SourceLayout.MAVEN); - List _allJavaProjects = this.allJavaProjects(); final Function1 _function = (ProjectDescriptor it) -> { return Boolean.valueOf(((!it.isEclipsePluginProject()) && it.isPartOfMavenBuild())); }; - final Iterable plainMavenProjects = IterableExtensions.filter(_allJavaProjects, _function); + final Iterable plainMavenProjects = IterableExtensions.filter(this.allJavaProjects(), _function); final Function1 _function_1 = (ProjectDescriptor it) -> { return Boolean.valueOf((!(it instanceof TestProjectDescriptor))); }; @@ -434,35 +412,34 @@ public class WizardConfigurationTest { it.setEnabled(true); }; plainMavenProjects.forEach(_function_2); - Assert.assertTrue(IterableExtensions.forall(Iterables.filter(plainMavenProjects, TestProjectDescriptor.class), ((Function1) (TestProjectDescriptor it) -> { + final Function1 _function_3 = (TestProjectDescriptor it) -> { return Boolean.valueOf(it.isInlined()); - }))); - final Consumer _function_3 = (ProjectDescriptor it) -> { + }; + Assert.assertTrue(IterableExtensions.forall(Iterables.filter(plainMavenProjects, TestProjectDescriptor.class), _function_3)); + final Consumer _function_4 = (ProjectDescriptor it) -> { Assert.assertTrue(it.pom().getContent().contains("add-source")); Assert.assertTrue(it.pom().getContent().contains("add-resource")); Assert.assertTrue(it.pom().getContent().contains("src/main/xtext-gen")); Assert.assertTrue(it.pom().getContent().contains("src/main/xtext-gen")); }; - mainProjects.forEach(_function_3); - Iterable _filter = Iterables.filter(mainProjects, TestedProjectDescriptor.class); - final Consumer _function_4 = (TestedProjectDescriptor it) -> { + mainProjects.forEach(_function_4); + final Consumer _function_5 = (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("src/test/xtext-gen")); Assert.assertTrue(it.pom().getContent().contains("src/test/xtext-gen")); }; - _filter.forEach(_function_4); + Iterables.filter(mainProjects, TestedProjectDescriptor.class).forEach(_function_5); } @Test public void pomFileDontDuplicateMavenDefaults() { this.config.setPreferredBuildSystem(BuildSystem.MAVEN); this.config.setSourceLayout(SourceLayout.MAVEN); - List _allJavaProjects = this.allJavaProjects(); final Function1 _function = (ProjectDescriptor it) -> { return Boolean.valueOf(((!it.isEclipsePluginProject()) && it.isPartOfMavenBuild())); }; - final Iterable plainMavenProjects = IterableExtensions.filter(_allJavaProjects, _function); + final Iterable plainMavenProjects = IterableExtensions.filter(this.allJavaProjects(), _function); final Function1 _function_1 = (ProjectDescriptor it) -> { return Boolean.valueOf((!(it instanceof TestProjectDescriptor))); }; @@ -485,10 +462,7 @@ public class WizardConfigurationTest { this.config.setPreferredBuildSystem(BuildSystem.MAVEN); UiProjectDescriptor _uiProject = this.config.getUiProject(); _uiProject.setEnabled(true); - UiProjectDescriptor _uiProject_1 = this.config.getUiProject(); - TestProjectDescriptor _testProject = _uiProject_1.getTestProject(); - PomFile _pom = _testProject.pom(); - final String pom = _pom.getContent(); + final String pom = this.config.getUiProject().getTestProject().pom().getContent(); Assert.assertTrue(pom.contains("useUIHarness")); } @@ -497,10 +471,7 @@ public class WizardConfigurationTest { this.config.setPreferredBuildSystem(BuildSystem.MAVEN); UiProjectDescriptor _uiProject = this.config.getUiProject(); _uiProject.setEnabled(true); - RuntimeProjectDescriptor _runtimeProject = this.config.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); - PomFile _pom = _testProject.pom(); - final String pom = _pom.getContent(); + final String pom = this.config.getRuntimeProject().getTestProject().pom().getContent(); Assert.assertFalse(pom.contains("useUIHarness")); } @@ -509,16 +480,13 @@ public class WizardConfigurationTest { this.config.setPreferredBuildSystem(BuildSystem.MAVEN); UiProjectDescriptor _uiProject = this.config.getUiProject(); _uiProject.setEnabled(true); - List _allJavaProjects = this.allJavaProjects(); - Iterable _filter = Iterables.filter(_allJavaProjects, TestProjectDescriptor.class); final Function1 _function = (TestProjectDescriptor it) -> { return Boolean.valueOf(it.isEclipsePluginProject()); }; - Iterable _filter_1 = IterableExtensions.filter(_filter, _function); final Function1 _function_1 = (TestProjectDescriptor it) -> { return it.pom(); }; - final Iterable poms = IterableExtensions.map(_filter_1, _function_1); + final Iterable poms = IterableExtensions.map(IterableExtensions.filter(Iterables.filter(this.allJavaProjects(), TestProjectDescriptor.class), _function), _function_1); final Consumer _function_2 = (PomFile it) -> { Assert.assertTrue(it.getContent().contains("failIfNoTests")); }; @@ -527,58 +495,44 @@ public class WizardConfigurationTest { @Test public void allBuildSystemsUseJava8() { - ParentProjectDescriptor _parentProject = this.config.getParentProject(); - PomFile _pom = _parentProject.pom(); - final String parentPom = _pom.getContent(); + final String parentPom = this.config.getParentProject().pom().getContent(); Assert.assertTrue(parentPom.contains("1.8")); Assert.assertTrue(parentPom.contains("1.8")); - ParentProjectDescriptor _parentProject_1 = this.config.getParentProject(); - GradleBuildFile _buildGradle = _parentProject_1.buildGradle(); - final String parentGradle = _buildGradle.getContent(); + final String parentGradle = this.config.getParentProject().buildGradle().getContent(); Assert.assertTrue(parentGradle.contains("sourceCompatibility = \'1.8\'")); Assert.assertTrue(parentGradle.contains("targetCompatibility = \'1.8\'")); - List _allJavaProjects = this.allJavaProjects(); final Function1 _function = (ProjectDescriptor it) -> { return it.manifest(); }; - List _map = ListExtensions.map(_allJavaProjects, _function); final Consumer _function_1 = (String it) -> { Assert.assertTrue(it.contains("Bundle-RequiredExecutionEnvironment: JavaSE-1.8")); }; - _map.forEach(_function_1); + ListExtensions.map(this.allJavaProjects(), _function).forEach(_function_1); } @Test public void allBuildSystemsUseOtherJava() { this.config.setJavaVersion(JavaVersion.JAVA7); - ParentProjectDescriptor _parentProject = this.config.getParentProject(); - PomFile _pom = _parentProject.pom(); - final String parentPom = _pom.getContent(); + final String parentPom = this.config.getParentProject().pom().getContent(); Assert.assertTrue(parentPom.contains("1.7")); Assert.assertTrue(parentPom.contains("1.7")); - ParentProjectDescriptor _parentProject_1 = this.config.getParentProject(); - GradleBuildFile _buildGradle = _parentProject_1.buildGradle(); - final String parentGradle = _buildGradle.getContent(); + final String parentGradle = this.config.getParentProject().buildGradle().getContent(); Assert.assertTrue(parentGradle.contains("sourceCompatibility = \'1.7\'")); Assert.assertTrue(parentGradle.contains("targetCompatibility = \'1.7\'")); - List _allJavaProjects = this.allJavaProjects(); final Function1 _function = (ProjectDescriptor it) -> { return it.manifest(); }; - List _map = ListExtensions.map(_allJavaProjects, _function); final Consumer _function_1 = (String it) -> { Assert.assertTrue(it.contains("Bundle-RequiredExecutionEnvironment: JavaSE-1.7")); }; - _map.forEach(_function_1); + ListExtensions.map(this.allJavaProjects(), _function).forEach(_function_1); } public List allJavaProjects() { RuntimeProjectDescriptor _runtimeProject = this.config.getRuntimeProject(); - RuntimeProjectDescriptor _runtimeProject_1 = this.config.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject_1.getTestProject(); + TestProjectDescriptor _testProject = this.config.getRuntimeProject().getTestProject(); UiProjectDescriptor _uiProject = this.config.getUiProject(); - UiProjectDescriptor _uiProject_1 = this.config.getUiProject(); - TestProjectDescriptor _testProject_1 = _uiProject_1.getTestProject(); + TestProjectDescriptor _testProject_1 = this.config.getUiProject().getTestProject(); IdeProjectDescriptor _ideProject = this.config.getIdeProject(); IntellijProjectDescriptor _intellijProject = this.config.getIntellijProject(); WebProjectDescriptor _webProject = this.config.getWebProject(); diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/wizard/cli/CliWizardIntegrationTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/wizard/cli/CliWizardIntegrationTest.java index e65afe235..5705030e0 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/wizard/cli/CliWizardIntegrationTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/xtext/wizard/cli/CliWizardIntegrationTest.java @@ -10,7 +10,6 @@ package org.eclipse.xtext.xtext.wizard.cli; import com.google.common.base.Charsets; import com.google.common.collect.Sets; import java.io.File; -import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -41,7 +40,6 @@ import org.eclipse.xtext.xtext.wizard.IntellijProjectDescriptor; import org.eclipse.xtext.xtext.wizard.LanguageDescriptor; import org.eclipse.xtext.xtext.wizard.P2RepositoryProject; import org.eclipse.xtext.xtext.wizard.ProjectLayout; -import org.eclipse.xtext.xtext.wizard.RuntimeProjectDescriptor; import org.eclipse.xtext.xtext.wizard.SourceLayout; import org.eclipse.xtext.xtext.wizard.TestProjectDescriptor; import org.eclipse.xtext.xtext.wizard.UiProjectDescriptor; @@ -132,8 +130,7 @@ public class CliWizardIntegrationTest { final File targetLocation = new File("testdata/wizard-expectations", _baseName); targetLocation.mkdirs(); Files.sweepFolder(targetLocation); - String _path = targetLocation.getPath(); - config.setRootLocation(_path); + config.setRootLocation(targetLocation.getPath()); creator.createProjects(config); String _baseName_1 = config.getBaseName(); String _plus = ("Updating expectations for " + _baseName_1); @@ -151,8 +148,7 @@ public class CliWizardIntegrationTest { it.setPreferredBuildSystem(BuildSystem.MAVEN); it.setSourceLayout(SourceLayout.MAVEN); it.setProjectLayout(ProjectLayout.HIERARCHICAL); - RuntimeProjectDescriptor _runtimeProject = it.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); + TestProjectDescriptor _testProject = it.getRuntimeProject().getTestProject(); _testProject.setEnabled(true); IdeProjectDescriptor _ideProject = it.getIdeProject(); _ideProject.setEnabled(true); @@ -164,13 +160,11 @@ public class CliWizardIntegrationTest { it.setPreferredBuildSystem(BuildSystem.MAVEN); it.setSourceLayout(SourceLayout.PLAIN); it.setProjectLayout(ProjectLayout.HIERARCHICAL); - RuntimeProjectDescriptor _runtimeProject = it.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); + TestProjectDescriptor _testProject = it.getRuntimeProject().getTestProject(); _testProject.setEnabled(true); UiProjectDescriptor _uiProject = it.getUiProject(); _uiProject.setEnabled(true); - UiProjectDescriptor _uiProject_1 = it.getUiProject(); - TestProjectDescriptor _testProject_1 = _uiProject_1.getTestProject(); + TestProjectDescriptor _testProject_1 = it.getUiProject().getTestProject(); _testProject_1.setEnabled(true); IdeProjectDescriptor _ideProject = it.getIdeProject(); _ideProject.setEnabled(true); @@ -182,8 +176,7 @@ public class CliWizardIntegrationTest { it.setPreferredBuildSystem(BuildSystem.GRADLE); it.setSourceLayout(SourceLayout.MAVEN); it.setProjectLayout(ProjectLayout.HIERARCHICAL); - RuntimeProjectDescriptor _runtimeProject = it.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); + TestProjectDescriptor _testProject = it.getRuntimeProject().getTestProject(); _testProject.setEnabled(true); IdeProjectDescriptor _ideProject = it.getIdeProject(); _ideProject.setEnabled(true); @@ -197,15 +190,13 @@ public class CliWizardIntegrationTest { it.setPreferredBuildSystem(BuildSystem.NONE); it.setSourceLayout(SourceLayout.PLAIN); it.setProjectLayout(ProjectLayout.FLAT); - RuntimeProjectDescriptor _runtimeProject = it.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); + TestProjectDescriptor _testProject = it.getRuntimeProject().getTestProject(); _testProject.setEnabled(true); IdeProjectDescriptor _ideProject = it.getIdeProject(); _ideProject.setEnabled(true); UiProjectDescriptor _uiProject = it.getUiProject(); _uiProject.setEnabled(true); - UiProjectDescriptor _uiProject_1 = it.getUiProject(); - TestProjectDescriptor _testProject_1 = _uiProject_1.getTestProject(); + TestProjectDescriptor _testProject_1 = it.getUiProject().getTestProject(); _testProject_1.setEnabled(true); })), ObjectExtensions.operator_doubleArrow( CliWizardIntegrationTest.newProjectConfig(), ((Procedure1) (WizardConfiguration it) -> { @@ -213,15 +204,13 @@ public class CliWizardIntegrationTest { it.setPreferredBuildSystem(BuildSystem.NONE); it.setSourceLayout(SourceLayout.PLAIN); it.setProjectLayout(ProjectLayout.FLAT); - RuntimeProjectDescriptor _runtimeProject = it.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); + TestProjectDescriptor _testProject = it.getRuntimeProject().getTestProject(); _testProject.setEnabled(true); IdeProjectDescriptor _ideProject = it.getIdeProject(); _ideProject.setEnabled(true); UiProjectDescriptor _uiProject = it.getUiProject(); _uiProject.setEnabled(true); - UiProjectDescriptor _uiProject_1 = it.getUiProject(); - TestProjectDescriptor _testProject_1 = _uiProject_1.getTestProject(); + TestProjectDescriptor _testProject_1 = it.getUiProject().getTestProject(); _testProject_1.setEnabled(true); P2RepositoryProject _p2Project = it.getP2Project(); _p2Project.setEnabled(true); @@ -231,13 +220,11 @@ public class CliWizardIntegrationTest { it.setPreferredBuildSystem(BuildSystem.MAVEN); it.setSourceLayout(SourceLayout.PLAIN); it.setProjectLayout(ProjectLayout.HIERARCHICAL); - RuntimeProjectDescriptor _runtimeProject = it.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); + TestProjectDescriptor _testProject = it.getRuntimeProject().getTestProject(); _testProject.setEnabled(true); UiProjectDescriptor _uiProject = it.getUiProject(); _uiProject.setEnabled(true); - UiProjectDescriptor _uiProject_1 = it.getUiProject(); - TestProjectDescriptor _testProject_1 = _uiProject_1.getTestProject(); + TestProjectDescriptor _testProject_1 = it.getUiProject().getTestProject(); _testProject_1.setEnabled(true); IdeProjectDescriptor _ideProject = it.getIdeProject(); _ideProject.setEnabled(true); @@ -251,13 +238,11 @@ public class CliWizardIntegrationTest { it.setPreferredBuildSystem(BuildSystem.GRADLE); it.setSourceLayout(SourceLayout.PLAIN); it.setProjectLayout(ProjectLayout.HIERARCHICAL); - RuntimeProjectDescriptor _runtimeProject = it.getRuntimeProject(); - TestProjectDescriptor _testProject = _runtimeProject.getTestProject(); + TestProjectDescriptor _testProject = it.getRuntimeProject().getTestProject(); _testProject.setEnabled(true); UiProjectDescriptor _uiProject = it.getUiProject(); _uiProject.setEnabled(true); - UiProjectDescriptor _uiProject_1 = it.getUiProject(); - TestProjectDescriptor _testProject_1 = _uiProject_1.getTestProject(); + TestProjectDescriptor _testProject_1 = it.getUiProject().getTestProject(); _testProject_1.setEnabled(true); IdeProjectDescriptor _ideProject = it.getIdeProject(); _ideProject.setEnabled(true); @@ -278,8 +263,7 @@ public class CliWizardIntegrationTest { LanguageDescriptor _language = it.getLanguage(); final Procedure1 _function_1 = (LanguageDescriptor it_1) -> { it_1.setName("org.xtext.example.mydsl.MyDsl"); - LanguageDescriptor.FileExtensions _fromString = LanguageDescriptor.FileExtensions.fromString("mydsl"); - it_1.setFileExtensions(_fromString); + it_1.setFileExtensions(LanguageDescriptor.FileExtensions.fromString("mydsl")); }; ObjectExtensions.operator_doubleArrow(_language, _function_1); }; @@ -303,8 +287,7 @@ public class CliWizardIntegrationTest { @Test public void testProjectCreation() { - CliProjectsCreator _newProjectCreator = CliWizardIntegrationTest.newProjectCreator(); - this.creator = _newProjectCreator; + this.creator = CliWizardIntegrationTest.newProjectCreator(); final Consumer _function = (WizardConfiguration config) -> { this.config = config; this.validateCreatedProjects(); @@ -316,8 +299,7 @@ public class CliWizardIntegrationTest { File _root = this.temp.getRoot(); String _baseName = this.config.getBaseName(); final File targetLocation = new File(_root, _baseName); - String _path = targetLocation.getPath(); - this.config.setRootLocation(_path); + this.config.setRootLocation(targetLocation.getPath()); this.creator.createProjects(this.config); String _baseName_1 = this.config.getBaseName(); final File expectationLocation = new File("testdata/wizard-expectations", _baseName_1); @@ -334,9 +316,7 @@ public class CliWizardIntegrationTest { final Function1 _function = (File it) -> { CliWizardIntegrationTest.GeneratedFile _xblockexpression_1 = null; { - String _path = it.getPath(); - String _path_1 = root.getPath(); - final String relativePath = _path.replace(_path_1, ""); + final String relativePath = it.getPath().replace(root.getPath(), ""); _xblockexpression_1 = this.toGeneratedFile(it, relativePath); } return _xblockexpression_1; @@ -354,11 +334,10 @@ public class CliWizardIntegrationTest { private void collectAllFiles(final File root, final List children) { boolean _isDirectory = root.isDirectory(); if (_isDirectory) { - File[] _listFiles = root.listFiles(); final Consumer _function = (File it) -> { this.collectAllFiles(it, children); }; - ((List)Conversions.doWrapArray(_listFiles)).forEach(_function); + ((List)Conversions.doWrapArray(root.listFiles())).forEach(_function); } else { children.add(root); } @@ -371,8 +350,7 @@ public class CliWizardIntegrationTest { if (_isDirectory) { _xifexpression = ""; } else { - Charset _encoding = this.config.getEncoding(); - _xifexpression = com.google.common.io.Files.toString(file, _encoding); + _xifexpression = com.google.common.io.Files.toString(file, this.config.getEncoding()); } return new CliWizardIntegrationTest.GeneratedFile(relativePath, _xifexpression); } catch (Throwable _e) { @@ -407,10 +385,8 @@ public class CliWizardIntegrationTest { }; unexpectedFiles.forEach(_function_3); final Consumer _function_4 = (CliWizardIntegrationTest.GeneratedFile it) -> { - CliWizardIntegrationTest.GeneratedFile _get = expectedFilesByPath.get(it.relativePath); - final String expectedContent = LineDelimiters.toUnix(_get.content); - CliWizardIntegrationTest.GeneratedFile _get_1 = actualFilesByPath.get(it.relativePath); - final String actualContent = LineDelimiters.toUnix(_get_1.content); + final String expectedContent = LineDelimiters.toUnix(expectedFilesByPath.get(it.relativePath).content); + final String actualContent = LineDelimiters.toUnix(actualFilesByPath.get(it.relativePath).content); Assert.assertEquals(it.relativePath, expectedContent, actualContent); }; comparableFiles.forEach(_function_4); diff --git a/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/IFileSystemScanner.java b/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/IFileSystemScanner.java index 6c12981f8..68485f395 100644 --- a/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/IFileSystemScanner.java +++ b/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/IFileSystemScanner.java @@ -30,12 +30,8 @@ public interface IFileSystemScanner { } public void scanRec(final File file, final IAcceptor acceptor) { - File _absoluteFile = file.getAbsoluteFile(); - java.net.URI _uRI = _absoluteFile.toURI(); - final Path path = Paths.get(_uRI); - java.net.URI _uri = path.toUri(); - String _string = _uri.toString(); - final URI uri = URI.createURI(_string); + final Path path = Paths.get(file.getAbsoluteFile().toURI()); + final URI uri = URI.createURI(path.toUri().toString()); acceptor.accept(uri); boolean _isDirectory = file.isDirectory(); if (_isDirectory) { diff --git a/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/XtextVersion.java b/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/XtextVersion.java index 516ba4870..243601752 100644 --- a/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/XtextVersion.java +++ b/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/XtextVersion.java @@ -3,7 +3,6 @@ package org.eclipse.xtext.util; import java.io.IOException; import java.io.InputStream; import java.net.URL; -import java.util.jar.Attributes; import java.util.jar.Manifest; import org.eclipse.emf.common.EMFPlugin; import org.eclipse.emf.common.util.ResourceLocator; @@ -95,8 +94,7 @@ public class XtextVersion { final URL url = new URL(_plus); is = url.openStream(); final Manifest manifest = new Manifest(is); - Attributes _mainAttributes = manifest.getMainAttributes(); - return _mainAttributes.getValue("Maven-Version"); + return manifest.getMainAttributes().getValue("Maven-Version"); } catch (final Throwable _t) { if (_t instanceof Exception) { final Exception e = (Exception)_t; diff --git a/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/internal/AlternateJdkLoader.java b/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/internal/AlternateJdkLoader.java index d0b689486..85f7148e0 100644 --- a/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/internal/AlternateJdkLoader.java +++ b/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/internal/AlternateJdkLoader.java @@ -10,7 +10,6 @@ package org.eclipse.xtext.util.internal; import com.google.common.collect.Maps; import java.io.File; import java.io.IOException; -import java.net.URI; import java.net.URL; import java.net.URLClassLoader; import java.util.Enumeration; @@ -27,8 +26,7 @@ public class AlternateJdkLoader extends URLClassLoader { public AlternateJdkLoader(final Iterable files) { super(((URL[])Conversions.unwrapArray(IterableExtensions.map(files, ((Function1) (File it) -> { try { - URI _uRI = it.toURI(); - return _uRI.toURL(); + return it.toURI().toURL(); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } diff --git a/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/internal/EmfAdaptableProcessor.java b/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/internal/EmfAdaptableProcessor.java index 5e8eaa863..0f3673965 100644 --- a/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/internal/EmfAdaptableProcessor.java +++ b/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/internal/EmfAdaptableProcessor.java @@ -27,8 +27,7 @@ import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; public class EmfAdaptableProcessor extends AbstractClassProcessor { @Override public void doRegisterGlobals(final ClassDeclaration annotatedClass, @Extension final RegisterGlobalsContext context) { - String _adapterClassName = this.getAdapterClassName(annotatedClass); - context.registerClass(_adapterClassName); + context.registerClass(this.getAdapterClassName(annotatedClass)); } @Override diff --git a/org.eclipse.xtext.xtext.bootstrap/xtend-gen/org/eclipse/xtext/xtext/bootstrap/XtextLangGeneratorModule.java b/org.eclipse.xtext.xtext.bootstrap/xtend-gen/org/eclipse/xtext/xtext/bootstrap/XtextLangGeneratorModule.java index ccdc5d82a..8db975d72 100644 --- a/org.eclipse.xtext.xtext.bootstrap/xtend-gen/org/eclipse/xtext/xtext/bootstrap/XtextLangGeneratorModule.java +++ b/org.eclipse.xtext.xtext.bootstrap/xtend-gen/org/eclipse/xtext/xtext/bootstrap/XtextLangGeneratorModule.java @@ -34,8 +34,7 @@ public class XtextLangGeneratorModule extends DefaultGeneratorModule { } public boolean isXtext(final Grammar grammar) { - String _name = grammar.getName(); - return _name.equals("org.eclipse.xtext.Xtext"); + return grammar.getName().equals("org.eclipse.xtext.Xtext"); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/CodeConfig.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/CodeConfig.java index 18d58f7a2..81a5e3c85 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/CodeConfig.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/CodeConfig.java @@ -131,10 +131,7 @@ public class CodeConfig implements IGuiceAwareGeneratorComponent { } final StringBuilder stringBuilder = new StringBuilder(); for (final IClassAnnotation annotation : this.classAnnotations) { - String _string = annotation.toString(); - StringBuilder _append = stringBuilder.append(_string); - String _newLine = Strings.newLine(); - _append.append(_newLine); + stringBuilder.append(annotation.toString()).append(Strings.newLine()); } return stringBuilder.toString(); } @@ -149,11 +146,7 @@ public class CodeConfig implements IGuiceAwareGeneratorComponent { { final TypeReference importString = annotation.getAnnotationImport(); if ((importString != null)) { - StringBuilder _append = stringBuilder.append("import "); - StringBuilder _append_1 = _append.append(importString); - StringBuilder _append_2 = _append_1.append(";"); - String _newLine = Strings.newLine(); - _append_2.append(_newLine); + stringBuilder.append("import ").append(importString).append(";").append(Strings.newLine()); } } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/DefaultGeneratorModule.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/DefaultGeneratorModule.java index b1f3f2dd1..24acd99d4 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/DefaultGeneratorModule.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/DefaultGeneratorModule.java @@ -40,26 +40,22 @@ public class DefaultGeneratorModule extends AbstractGenericModule { } public void configureXtextProjectConfig(final Binder binder) { - AnnotatedBindingBuilder _bind = binder.bind(IXtextProjectConfig.class); - _bind.toInstance(this.project); + binder.bind(IXtextProjectConfig.class).toInstance(this.project); } public void configureCodeConfig(final Binder binder) { - AnnotatedBindingBuilder _bind = binder.bind(CodeConfig.class); - _bind.toInstance(this.code); + binder.bind(CodeConfig.class).toInstance(this.code); } public void configureResourceSet(final Binder binder) { - AnnotatedBindingBuilder _bind = binder.bind(ResourceSet.class); - _bind.to(XtextResourceSet.class); + binder.bind(ResourceSet.class).to(XtextResourceSet.class); } public void configureLineSeparatorInformation(final Binder binder) { - AnnotatedBindingBuilder _bind = binder.bind(ILineSeparatorInformation.class); final ILineSeparatorInformation _function = () -> { return this.code.getLineDelimiter(); }; - _bind.toInstance(_function); + binder.bind(ILineSeparatorInformation.class).toInstance(_function); } public void configureIEncodingProvider(final Binder binder) { diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ImplicitFragment.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ImplicitFragment.java index c87cfd65c..508359621 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ImplicitFragment.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ImplicitFragment.java @@ -20,15 +20,11 @@ import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xtext.generator.AbstractStubGeneratingFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.xbase.XbaseUsageDetector; @SuppressWarnings("all") @@ -43,67 +39,35 @@ class ImplicitFragment extends AbstractStubGeneratingFragment { @Override public void generate() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - ManifestAccess _manifest = _runtime.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - ManifestAccess _manifest_1 = _runtime_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); - _requiredBundles.addAll( + this.getProjectConfig().getRuntime().getManifest().getRequiredBundles().addAll( Collections.unmodifiableList(CollectionLiterals.newArrayList("org.eclipse.xtext", "org.eclipse.xtext.util"))); boolean _isGenerateXtendStub = this.isGenerateXtendStub(); if (_isGenerateXtendStub) { - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_2 = _projectConfig_2.getRuntime(); - ManifestAccess _manifest_2 = _runtime_2.getManifest(); - Set _requiredBundles_1 = _manifest_2.getRequiredBundles(); - _requiredBundles_1.add("org.eclipse.xtend.lib"); + Set _requiredBundles = this.getProjectConfig().getRuntime().getManifest().getRequiredBundles(); + _requiredBundles.add("org.eclipse.xtend.lib"); } - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_3 = _projectConfig_3.getRuntime(); - ManifestAccess _manifest_3 = _runtime_3.getManifest(); - Set _importedPackages = _manifest_3.getImportedPackages(); - _importedPackages.add("org.apache.log4j"); + this.getProjectConfig().getRuntime().getManifest().getImportedPackages().add("org.apache.log4j"); } - IXtextProjectConfig _projectConfig_4 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig_4.getEclipsePlugin(); - ManifestAccess _manifest_4 = _eclipsePlugin.getManifest(); - boolean _tripleNotEquals_1 = (_manifest_4 != null); + ManifestAccess _manifest_1 = this.getProjectConfig().getEclipsePlugin().getManifest(); + boolean _tripleNotEquals_1 = (_manifest_1 != null); if (_tripleNotEquals_1) { - IXtextProjectConfig _projectConfig_5 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_5.getEclipsePlugin(); - ManifestAccess _manifest_5 = _eclipsePlugin_1.getManifest(); - Set _requiredBundles_2 = _manifest_5.getRequiredBundles(); - _requiredBundles_2.addAll( + this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles().addAll( Collections.unmodifiableList(CollectionLiterals.newArrayList("org.eclipse.xtext.ui", "org.eclipse.xtext.ui.shared", "org.eclipse.ui.editors", "org.eclipse.ui"))); boolean _isGenerateXtendStub_1 = this.isGenerateXtendStub(); if (_isGenerateXtendStub_1) { - IXtextProjectConfig _projectConfig_6 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_2 = _projectConfig_6.getEclipsePlugin(); - ManifestAccess _manifest_6 = _eclipsePlugin_2.getManifest(); - Set _requiredBundles_3 = _manifest_6.getRequiredBundles(); - _requiredBundles_3.add("org.eclipse.xtend.lib"); + Set _requiredBundles_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); + _requiredBundles_1.add("org.eclipse.xtend.lib"); } - IXtextProjectConfig _projectConfig_7 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_3 = _projectConfig_7.getEclipsePlugin(); - ManifestAccess _manifest_7 = _eclipsePlugin_3.getManifest(); - Set _importedPackages_1 = _manifest_7.getImportedPackages(); - _importedPackages_1.add("org.apache.log4j"); + this.getProjectConfig().getEclipsePlugin().getManifest().getImportedPackages().add("org.apache.log4j"); } - IXtextProjectConfig _projectConfig_8 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_4 = _projectConfig_8.getEclipsePlugin(); - PluginXmlAccess _pluginXml = _eclipsePlugin_4.getPluginXml(); + PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml(); boolean _tripleNotEquals_2 = (_pluginXml != null); if (_tripleNotEquals_2) { - IXtextProjectConfig _projectConfig_9 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_5 = _projectConfig_9.getEclipsePlugin(); - PluginXmlAccess _pluginXml_1 = _eclipsePlugin_5.getPluginXml(); - List _entries = _pluginXml_1.getEntries(); - Grammar _grammar = this.getGrammar(); - CharSequence _implicitPluginXmlEnties = this.getImplicitPluginXmlEnties(_grammar); + List _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); + CharSequence _implicitPluginXmlEnties = this.getImplicitPluginXmlEnties(this.getGrammar()); _entries.add(_implicitPluginXmlEnties); } StringConcatenationClient _client = new StringConcatenationClient() { @@ -115,24 +79,15 @@ class ImplicitFragment extends AbstractStubGeneratingFragment { } }; final StringConcatenationClient expression = _client; - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef(IAllContainersState.class); - final GuiceModuleAccess.BindingFactory bindingFactory = _bindingFactory.addTypeToProviderInstance(_typeRef, expression); + final GuiceModuleAccess.BindingFactory bindingFactory = new GuiceModuleAccess.BindingFactory().addTypeToProviderInstance(TypeReference.typeRef(IAllContainersState.class), expression); 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"); - GuiceModuleAccess.BindingFactory _addTypeToType = bindingFactory.addTypeToType(_typeRef_1, _typeRef_2); - TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.model.XtextDocumentProvider"); - TypeReference _typeRef_4 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.editor.XbaseDocumentProvider"); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeRef_3, _typeRef_4); - TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.ui.generator.trace.OpenGeneratedFileHandler"); - TypeReference _typeRef_6 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.generator.trace.XbaseOpenGeneratedFileHandler"); - _addTypeToType_1.addTypeToType(_typeRef_5, _typeRef_6); + bindingFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.XtextEditor"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.editor.XbaseEditor")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.model.XtextDocumentProvider"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.editor.XbaseDocumentProvider")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.generator.trace.OpenGeneratedFileHandler"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.generator.trace.XbaseOpenGeneratedFileHandler")); } - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule(); - bindingFactory.contributeTo(_eclipsePluginGenModule); + bindingFactory.contributeTo(this.getLanguage().getEclipsePluginGenModule()); } public CharSequence getImplicitPluginXmlEnties(final Grammar it) { @@ -159,9 +114,7 @@ class ImplicitFragment extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("extensions=\""); - IXtextGeneratorLanguage _language = this.getLanguage(); - List _fileExtensions = _language.getFileExtensions(); - String _join = IterableExtensions.join(_fileExtensions, ","); + String _join = IterableExtensions.join(this.getLanguage().getFileExtensions(), ","); _builder.append(_join, "\t\t"); _builder.append("\""); _builder.newLineIfNotEmpty(); @@ -172,8 +125,7 @@ class ImplicitFragment extends AbstractStubGeneratingFragment { _builder.append("\""); _builder.newLineIfNotEmpty(); { - Grammar _grammar = this.getGrammar(); - boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(_grammar); + boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getGrammar()); if (_inheritsXbase) { _builder.append("\t\t"); _builder.append("matchingStrategy=\""); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/LanguageModule.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/LanguageModule.java index 10b34a4d8..06d51e892 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/LanguageModule.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/LanguageModule.java @@ -8,9 +8,7 @@ package org.eclipse.xtext.xtext.generator; import com.google.inject.Binder; -import com.google.inject.Module; import com.google.inject.Provider; -import com.google.inject.binder.AnnotatedBindingBuilder; import com.google.inject.binder.ScopedBindingBuilder; import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; import org.eclipse.xtext.Grammar; @@ -25,29 +23,25 @@ class LanguageModule extends AbstractGenericModule { private final XtextGeneratorLanguage language; public void configureLanguage(final Binder binder) { - AnnotatedBindingBuilder _bind = binder.bind(IXtextGeneratorLanguage.class); - _bind.toInstance(this.language); + binder.bind(IXtextGeneratorLanguage.class).toInstance(this.language); } public ScopedBindingBuilder configureGrammar(final Binder binder) { - AnnotatedBindingBuilder _bind = binder.bind(Grammar.class); final Provider _function = () -> { return this.language.getGrammar(); }; - return _bind.toProvider(_function); + return binder.bind(Grammar.class).toProvider(_function); } public ScopedBindingBuilder configureRuleNames(final Binder binder) { - AnnotatedBindingBuilder _bind = binder.bind(RuleNames.class); final Provider _function = () -> { return this.language.getRuleNames(); }; - return _bind.toProvider(_function); + return binder.bind(RuleNames.class).toProvider(_function); } public void configureAdditionalBindings(final Binder binder) { - Module _guiceModule = this.language.getGuiceModule(); - binder.install(_guiceModule); + binder.install(this.language.getGuiceModule()); } public LanguageModule(final XtextGeneratorLanguage language) { diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/StandardLanguage.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/StandardLanguage.java index 912cd36da..cdac4145c 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/StandardLanguage.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/StandardLanguage.java @@ -43,8 +43,6 @@ import org.eclipse.xtext.xtext.generator.ui.projectWizard.SimpleProjectWizardFra import org.eclipse.xtext.xtext.generator.ui.quickfix.QuickfixProviderFragment2; import org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2; import org.eclipse.xtext.xtext.generator.ui.templates.CodetemplatesGeneratorFragment2; -import org.eclipse.xtext.xtext.generator.util.BooleanGeneratorOption; -import org.eclipse.xtext.xtext.generator.util.GeneratorOption; import org.eclipse.xtext.xtext.generator.validation.ValidatorFragment2; import org.eclipse.xtext.xtext.generator.web.WebIntegrationFragment; import org.eclipse.xtext.xtext.generator.xbase.XbaseGeneratorFragment2; @@ -114,9 +112,7 @@ public class StandardLanguage extends XtextGeneratorLanguage { public StandardLanguage() { try { - Class _class = this.getClass(); - ClassLoader _classLoader = _class.getClassLoader(); - _classLoader.loadClass("org.eclipse.xtext.xbase.XbaseRuntimeModule"); + this.getClass().getClassLoader().loadClass("org.eclipse.xtext.xbase.XbaseRuntimeModule"); this.addReferencedResource("platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"); } catch (final Throwable _t) { if (_t instanceof ClassNotFoundException) { @@ -130,38 +126,32 @@ public class StandardLanguage extends XtextGeneratorLanguage { @Override public void initialize(final Injector injector) { - BooleanGeneratorOption _generateStub = this.formatter.getGenerateStub(); - boolean _isSet = _generateStub.isSet(); + boolean _isSet = this.formatter.getGenerateStub().isSet(); boolean _not = (!_isSet); if (_not) { this.formatter.setGenerateStub(false); } - BooleanGeneratorOption _onlyEnabledIfGrammarIsUsed = this.commonTypesSupport.getOnlyEnabledIfGrammarIsUsed(); - boolean _isSet_1 = _onlyEnabledIfGrammarIsUsed.isSet(); + boolean _isSet_1 = this.commonTypesSupport.getOnlyEnabledIfGrammarIsUsed().isSet(); boolean _not_1 = (!_isSet_1); if (_not_1) { this.commonTypesSupport.setOnlyEnabledIfGrammarIsUsed(true); } - GeneratorOption _framework = this.webSupport.getFramework(); - boolean _isSet_2 = _framework.isSet(); + boolean _isSet_2 = this.webSupport.getFramework().isSet(); boolean _not_2 = (!_isSet_2); if (_not_2) { this.webSupport.setFramework("Ace"); } - BooleanGeneratorOption _generateServlet = this.webSupport.getGenerateServlet(); - boolean _isSet_3 = _generateServlet.isSet(); + boolean _isSet_3 = this.webSupport.getGenerateServlet().isSet(); boolean _not_3 = (!_isSet_3); if (_not_3) { this.webSupport.setGenerateServlet(true); } - BooleanGeneratorOption _generateJettyLauncher = this.webSupport.getGenerateJettyLauncher(); - boolean _isSet_4 = _generateJettyLauncher.isSet(); + boolean _isSet_4 = this.webSupport.getGenerateJettyLauncher().isSet(); boolean _not_4 = (!_isSet_4); if (_not_4) { this.webSupport.setGenerateJettyLauncher(true); } - BooleanGeneratorOption _generateHtmlExample = this.webSupport.getGenerateHtmlExample(); - boolean _isSet_5 = _generateHtmlExample.isSet(); + boolean _isSet_5 = this.webSupport.getGenerateHtmlExample().isSet(); boolean _not_5 = (!_isSet_5); if (_not_5) { this.webSupport.setGenerateHtmlExample(true); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextDirectoryCleaner.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextDirectoryCleaner.java index a9717df1d..a163a434f 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextDirectoryCleaner.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextDirectoryCleaner.java @@ -25,7 +25,6 @@ import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.ListExtensions; import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent; import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; import org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig; import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; @@ -60,24 +59,18 @@ public class XtextDirectoryCleaner implements IGuiceAwareGeneratorComponent { return; } final ArrayList directories = CollectionLiterals.newArrayList(); - List _enabledProjects = this.config.getEnabledProjects(); final Function1 _function = (ISubProjectConfig it) -> { return it.getSrcGen(); }; - List _map = ListExtensions.map(_enabledProjects, _function); - IRuntimeProjectConfig _runtime = this.config.getRuntime(); - IXtextGeneratorFileSystemAccess _ecoreModel = _runtime.getEcoreModel(); - Iterable _plus = Iterables.concat(_map, Collections.unmodifiableList(CollectionLiterals.newArrayList(_ecoreModel))); - Iterable _filterNull = IterableExtensions.filterNull(_plus); + List _map = ListExtensions.map(this.config.getEnabledProjects(), _function); + IXtextGeneratorFileSystemAccess _ecoreModel = this.config.getRuntime().getEcoreModel(); final Function1 _function_1 = (IXtextGeneratorFileSystemAccess it) -> { return it.getPath(); }; - Iterable _map_1 = IterableExtensions.map(_filterNull, _function_1); final Function1 _function_2 = (String it) -> { - File _file = new File(it); - return Boolean.valueOf(_file.isDirectory()); + return Boolean.valueOf(new File(it).isDirectory()); }; - Iterable _filter = IterableExtensions.filter(_map_1, _function_2); + Iterable _filter = IterableExtensions.filter(IterableExtensions.map(IterableExtensions.filterNull(Iterables.concat(_map, Collections.unmodifiableList(CollectionLiterals.newArrayList(_ecoreModel)))), _function_1), _function_2); Iterables.addAll(directories, _filter); Iterables.addAll(directories, this.extraDirectories); final DirectoryCleaner delegate = new DirectoryCleaner(); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGenerator.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGenerator.java index fefdda9b3..610b20262 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGenerator.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGenerator.java @@ -20,13 +20,9 @@ import java.io.InputStream; import java.util.HashMap; import java.util.List; import java.util.ListIterator; -import java.util.Map; -import java.util.Set; import java.util.function.Consumer; import org.apache.log4j.Logger; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.mwe.core.WorkflowContext; import org.eclipse.emf.mwe.core.issues.Issues; import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2; @@ -34,7 +30,6 @@ import org.eclipse.emf.mwe.core.monitor.ProgressMonitor; import org.eclipse.emf.mwe.utils.StandaloneSetup; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend2.lib.StringConcatenationClient; -import org.eclipse.xtext.AbstractMetamodelDeclaration; import org.eclipse.xtext.GeneratedMetamodel; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.XtextStandaloneSetup; @@ -65,16 +60,11 @@ import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.XtextGeneratorStandaloneSetup; import org.eclipse.xtext.xtext.generator.XtextGeneratorTemplates; import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; -import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; import org.eclipse.xtext.xtext.generator.model.TextFileAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.model.project.BundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IWebProjectConfig; import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; /** @@ -116,8 +106,7 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { private CodeConfig codeConfig; public XtextGenerator() { - XtextStandaloneSetup _xtextStandaloneSetup = new XtextStandaloneSetup(); - _xtextStandaloneSetup.createInjectorAndDoEMFRegistration(); + new XtextStandaloneSetup().createInjectorAndDoEMFRegistration(); } /** @@ -136,26 +125,20 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { for (final XtextGeneratorLanguage language : this.languageConfigs) { { language.checkConfiguration(generatorIssues); - Grammar _grammar = language.getGrammar(); - EList _metamodelDeclarations = _grammar.getMetamodelDeclarations(); - Iterable _filter = Iterables.filter(_metamodelDeclarations, GeneratedMetamodel.class); + Iterable _filter = Iterables.filter(language.getGrammar().getMetamodelDeclarations(), GeneratedMetamodel.class); for (final GeneratedMetamodel generatedMetamodel : _filter) { { - EPackage _ePackage = generatedMetamodel.getEPackage(); - final String nsURI = _ePackage.getNsURI(); + final String nsURI = generatedMetamodel.getEPackage().getNsURI(); boolean _containsKey = uris.containsKey(nsURI); if (_containsKey) { - Grammar _get = uris.get(nsURI); - String _name = _get.getName(); + String _name = uris.get(nsURI).getName(); String _plus = ((("Duplicate generated grammar with nsURI \'" + nsURI) + "\' in ") + _name); String _plus_1 = (_plus + " and "); - Grammar _grammar_1 = language.getGrammar(); - String _name_1 = _grammar_1.getName(); + String _name_1 = language.getGrammar().getName(); String _plus_2 = (_plus_1 + _name_1); generatorIssues.addError(_plus_2); } else { - Grammar _grammar_2 = language.getGrammar(); - uris.put(nsURI, _grammar_2); + uris.put(nsURI, language.getGrammar()); } } } @@ -166,8 +149,7 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { public void initialize() { if ((this.injector == null)) { XtextGenerator.LOG.info("Initializing Xtext generator"); - StandaloneSetup _standaloneSetup = new StandaloneSetup(); - _standaloneSetup.addRegisterGeneratedEPackage("org.eclipse.xtext.common.types.TypesPackage"); + new StandaloneSetup().addRegisterGeneratedEPackage("org.eclipse.xtext.common.types.TypesPackage"); this.initializeEncoding(); this.injector = this.createInjector(); this.injector.injectMembers(this); @@ -190,15 +172,13 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { protected void initializeEncoding() { final IResourceServiceProvider.Registry serviceProviderRegistry = IResourceServiceProvider.Registry.INSTANCE; - Map _extensionToFactoryMap = serviceProviderRegistry.getExtensionToFactoryMap(); - Object _get = _extensionToFactoryMap.get("xtext"); + Object _get = serviceProviderRegistry.getExtensionToFactoryMap().get("xtext"); final IResourceServiceProvider serviceProvider = ((IResourceServiceProvider) _get); String _elvis = null; if (this.grammarEncoding != null) { _elvis = this.grammarEncoding; } else { - CodeConfig _code = this.configuration.getCode(); - String _encoding = _code.getEncoding(); + String _encoding = this.configuration.getCode().getEncoding(); _elvis = _encoding; } final String encoding = _elvis; @@ -226,8 +206,7 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { this.cleaner.clean(); for (final XtextGeneratorLanguage language : this.languageConfigs) { try { - Grammar _grammar = language.getGrammar(); - String _name = _grammar.getName(); + String _name = language.getGrammar().getName(); String _plus = ("Generating " + _name); XtextGenerator.LOG.info(_plus); language.generate(); @@ -260,105 +239,50 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { private void handleException(final Exception ex, final Issues issues) { if ((ex instanceof CompositeGeneratorException)) { - List _exceptions = ((CompositeGeneratorException)ex).getExceptions(); final Consumer _function = (Exception it) -> { this.handleException(it, issues); }; - _exceptions.forEach(_function); + ((CompositeGeneratorException)ex).getExceptions().forEach(_function); } else { issues.addError(this, "GeneratorException: ", null, ex, null); } } protected void generateSetups(final IXtextGeneratorLanguage language) { - JavaFileAccess _createRuntimeGenSetup = this.templates.createRuntimeGenSetup(language); - IRuntimeProjectConfig _runtime = this.projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen = _runtime.getSrcGen(); - _createRuntimeGenSetup.writeTo(_srcGen); - JavaFileAccess _createRuntimeSetup = this.templates.createRuntimeSetup(language); - IRuntimeProjectConfig _runtime_1 = this.projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime_1.getSrc(); - _createRuntimeSetup.writeTo(_src); - JavaFileAccess _createIdeSetup = this.templates.createIdeSetup(language); - IBundleProjectConfig _genericIde = this.projectConfig.getGenericIde(); - IXtextGeneratorFileSystemAccess _src_1 = _genericIde.getSrc(); - _createIdeSetup.writeTo(_src_1); - JavaFileAccess _createWebSetup = this.templates.createWebSetup(language); - IWebProjectConfig _web = this.projectConfig.getWeb(); - IXtextGeneratorFileSystemAccess _src_2 = _web.getSrc(); - _createWebSetup.writeTo(_src_2); + this.templates.createRuntimeGenSetup(language).writeTo(this.projectConfig.getRuntime().getSrcGen()); + this.templates.createRuntimeSetup(language).writeTo(this.projectConfig.getRuntime().getSrc()); + this.templates.createIdeSetup(language).writeTo(this.projectConfig.getGenericIde().getSrc()); + this.templates.createWebSetup(language).writeTo(this.projectConfig.getWeb().getSrc()); } protected void generateModules(final IXtextGeneratorLanguage language) { - JavaFileAccess _createRuntimeGenModule = this.templates.createRuntimeGenModule(language); - IRuntimeProjectConfig _runtime = this.projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen = _runtime.getSrcGen(); - _createRuntimeGenModule.writeTo(_srcGen); - JavaFileAccess _createRuntimeModule = this.templates.createRuntimeModule(language); - IRuntimeProjectConfig _runtime_1 = this.projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime_1.getSrc(); - _createRuntimeModule.writeTo(_src); - JavaFileAccess _createIdeModule = this.templates.createIdeModule(language); - IBundleProjectConfig _genericIde = this.projectConfig.getGenericIde(); - IXtextGeneratorFileSystemAccess _src_1 = _genericIde.getSrc(); - _createIdeModule.writeTo(_src_1); - JavaFileAccess _createIdeGenModule = this.templates.createIdeGenModule(language); - IBundleProjectConfig _genericIde_1 = this.projectConfig.getGenericIde(); - IXtextGeneratorFileSystemAccess _srcGen_1 = _genericIde_1.getSrcGen(); - _createIdeGenModule.writeTo(_srcGen_1); - JavaFileAccess _createEclipsePluginGenModule = this.templates.createEclipsePluginGenModule(language); - IBundleProjectConfig _eclipsePlugin = this.projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _srcGen_2 = _eclipsePlugin.getSrcGen(); - _createEclipsePluginGenModule.writeTo(_srcGen_2); - JavaFileAccess _createEclipsePluginModule = this.templates.createEclipsePluginModule(language); - IBundleProjectConfig _eclipsePlugin_1 = this.projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src_2 = _eclipsePlugin_1.getSrc(); - _createEclipsePluginModule.writeTo(_src_2); - JavaFileAccess _createIdeaGenModule = this.templates.createIdeaGenModule(language); - ISubProjectConfig _ideaPlugin = this.projectConfig.getIdeaPlugin(); - IXtextGeneratorFileSystemAccess _srcGen_3 = _ideaPlugin.getSrcGen(); - _createIdeaGenModule.writeTo(_srcGen_3); - JavaFileAccess _createIdeaModule = this.templates.createIdeaModule(language); - ISubProjectConfig _ideaPlugin_1 = this.projectConfig.getIdeaPlugin(); - IXtextGeneratorFileSystemAccess _src_3 = _ideaPlugin_1.getSrc(); - _createIdeaModule.writeTo(_src_3); - JavaFileAccess _createWebGenModule = this.templates.createWebGenModule(language); - IWebProjectConfig _web = this.projectConfig.getWeb(); - IXtextGeneratorFileSystemAccess _srcGen_4 = _web.getSrcGen(); - _createWebGenModule.writeTo(_srcGen_4); - JavaFileAccess _createWebModule = this.templates.createWebModule(language); - IWebProjectConfig _web_1 = this.projectConfig.getWeb(); - IXtextGeneratorFileSystemAccess _src_4 = _web_1.getSrc(); - _createWebModule.writeTo(_src_4); + this.templates.createRuntimeGenModule(language).writeTo(this.projectConfig.getRuntime().getSrcGen()); + this.templates.createRuntimeModule(language).writeTo(this.projectConfig.getRuntime().getSrc()); + this.templates.createIdeModule(language).writeTo(this.projectConfig.getGenericIde().getSrc()); + this.templates.createIdeGenModule(language).writeTo(this.projectConfig.getGenericIde().getSrcGen()); + this.templates.createEclipsePluginGenModule(language).writeTo(this.projectConfig.getEclipsePlugin().getSrcGen()); + this.templates.createEclipsePluginModule(language).writeTo(this.projectConfig.getEclipsePlugin().getSrc()); + this.templates.createIdeaGenModule(language).writeTo(this.projectConfig.getIdeaPlugin().getSrcGen()); + this.templates.createIdeaModule(language).writeTo(this.projectConfig.getIdeaPlugin().getSrc()); + this.templates.createWebGenModule(language).writeTo(this.projectConfig.getWeb().getSrcGen()); + this.templates.createWebModule(language).writeTo(this.projectConfig.getWeb().getSrc()); } protected void generateExecutableExtensionFactory(final IXtextGeneratorLanguage language) { - IBundleProjectConfig _eclipsePlugin = this.projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _srcGen = _eclipsePlugin.getSrcGen(); + IXtextGeneratorFileSystemAccess _srcGen = this.projectConfig.getEclipsePlugin().getSrcGen(); boolean _tripleNotEquals = (_srcGen != null); if (_tripleNotEquals) { - XtextGeneratorLanguage _head = IterableExtensions.head(this.languageConfigs); - JavaFileAccess _createEclipsePluginExecutableExtensionFactory = this.templates.createEclipsePluginExecutableExtensionFactory(language, _head); - IBundleProjectConfig _eclipsePlugin_1 = this.projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _srcGen_1 = _eclipsePlugin_1.getSrcGen(); - _createEclipsePluginExecutableExtensionFactory.writeTo(_srcGen_1); + this.templates.createEclipsePluginExecutableExtensionFactory(language, IterableExtensions.head(this.languageConfigs)).writeTo(this.projectConfig.getEclipsePlugin().getSrcGen()); } } protected void generateManifests() { try { - List _enabledProjects = this.projectConfig.getEnabledProjects(); - Iterable _filter = Iterables.filter(_enabledProjects, BundleProjectConfig.class); final Function1> _function = (BundleProjectConfig it) -> { - ManifestAccess _manifest = it.getManifest(); - IXtextGeneratorFileSystemAccess _metaInf = it.getMetaInf(); - String _name = it.getName(); - return Tuples.create(_manifest, _metaInf, _name); + return Tuples.create(it.getManifest(), it.getMetaInf(), it.getName()); }; - Iterable> _map = IterableExtensions.>map(_filter, _function); - final List> manifests = IterableExtensions.>toList(_map); - int _size = manifests.size(); - final HashMap uri2Manifest = Maps.newHashMapWithExpectedSize(_size); + final List> manifests = IterableExtensions.>toList(IterableExtensions.>map(Iterables.filter(this.projectConfig.getEnabledProjects(), BundleProjectConfig.class), _function)); + final HashMap uri2Manifest = Maps.newHashMapWithExpectedSize(manifests.size()); final ListIterator> manifestIter = manifests.listIterator(); while (manifestIter.hasNext()) { { @@ -371,12 +295,10 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { if (((manifest.getActivator() == null) && (manifest == this.projectConfig.getEclipsePlugin().getManifest()))) { manifest.setActivator(this.naming.getEclipsePluginActivator()); } - String _path = manifest.getPath(); - final URI uri = metaInf.getURI(_path); + final URI uri = metaInf.getURI(manifest.getPath()); boolean _containsKey = uri2Manifest.containsKey(uri); if (_containsKey) { - ManifestAccess _get = uri2Manifest.get(uri); - _get.merge(manifest); + uri2Manifest.get(uri).merge(manifest); manifestIter.remove(); } else { uri2Manifest.put(uri, manifest); @@ -393,18 +315,16 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { if (_tripleEquals) { manifest.setBundleName(entry.getThird()); } - String _path = manifest.getPath(); - boolean _isFile = metaInf.isFile(_path); + boolean _isFile = metaInf.isFile(manifest.getPath()); if (_isFile) { boolean _isMerge = manifest.isMerge(); if (_isMerge) { this.mergeManifest(manifest, metaInf); } else { - String _path_1 = manifest.getPath(); - boolean _endsWith = _path_1.endsWith(".MF"); + boolean _endsWith = manifest.getPath().endsWith(".MF"); if (_endsWith) { - String _path_2 = manifest.getPath(); - String _plus = (_path_2 + "_gen"); + String _path = manifest.getPath(); + String _plus = (_path + "_gen"); manifest.setPath(_plus); manifest.writeTo(metaInf); } @@ -426,12 +346,9 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { String _bundleName = manifest.getBundleName(); final MergeableManifest merge = new MergeableManifest(in, _bundleName); merge.setLineDelimiter(this.codeConfig.getLineDelimiter()); - Set _exportedPackages = manifest.getExportedPackages(); - merge.addExportedPackages(_exportedPackages); - Set _requiredBundles = manifest.getRequiredBundles(); - merge.addRequiredBundles(_requiredBundles); - Set _importedPackages = manifest.getImportedPackages(); - merge.addImportedPackages(_importedPackages); + merge.addExportedPackages(manifest.getExportedPackages()); + merge.addRequiredBundles(manifest.getRequiredBundles()); + merge.addImportedPackages(manifest.getImportedPackages()); if (((manifest.getActivator() != null) && StringExtensions.isNullOrEmpty(merge.getBundleActivator()))) { merge.setBundleActivator(manifest.getActivator().getName()); } @@ -439,10 +356,9 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { if (_isModified) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); merge.write(out); - String _path = manifest.getPath(); byte[] _byteArray = out.toByteArray(); ByteArrayInputStream _byteArrayInputStream = new ByteArrayInputStream(_byteArray); - metaInf.generateFile(_path, _byteArrayInputStream); + metaInf.generateFile(manifest.getPath(), _byteArrayInputStream); } } finally { if ((in != null)) { @@ -462,8 +378,7 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { { for(final XtextGeneratorLanguage lang : XtextGenerator.this.languageConfigs) { - Grammar _grammar = lang.getGrammar(); - TypeReference _genericIdeSetup = XtextGenerator.this.naming.getGenericIdeSetup(_grammar); + TypeReference _genericIdeSetup = XtextGenerator.this.naming.getGenericIdeSetup(lang.getGrammar()); _builder.append(_genericIdeSetup); _builder.newLineIfNotEmpty(); } @@ -471,32 +386,23 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { } }; file.setContent(_client); - IBundleProjectConfig _genericIde = this.projectConfig.getGenericIde(); - IXtextGeneratorFileSystemAccess _srcGen = _genericIde.getSrcGen(); - file.writeTo(_srcGen); + file.writeTo(this.projectConfig.getGenericIde().getSrcGen()); } protected void generateActivator() { if (((this.projectConfig.getEclipsePlugin().getSrcGen() != null) && (!this.languageConfigs.isEmpty()))) { - JavaFileAccess _createEclipsePluginActivator = this.templates.createEclipsePluginActivator(this.languageConfigs); - IBundleProjectConfig _eclipsePlugin = this.projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _srcGen = _eclipsePlugin.getSrcGen(); - _createEclipsePluginActivator.writeTo(_srcGen); + this.templates.createEclipsePluginActivator(this.languageConfigs).writeTo(this.projectConfig.getEclipsePlugin().getSrcGen()); } } protected void generatePluginXmls() { - List _enabledProjects = this.projectConfig.getEnabledProjects(); - Iterable _filter = Iterables.filter(_enabledProjects, BundleProjectConfig.class); final Function1> _function = (BundleProjectConfig it) -> { PluginXmlAccess _pluginXml = it.getPluginXml(); IXtextGeneratorFileSystemAccess _root = it.getRoot(); return Pair.of(_pluginXml, _root); }; - Iterable> _map = IterableExtensions.>map(_filter, _function); - final List> pluginXmls = IterableExtensions.>toList(_map); - int _size = pluginXmls.size(); - final HashMap uri2PluginXml = Maps.newHashMapWithExpectedSize(_size); + final List> pluginXmls = IterableExtensions.>toList(IterableExtensions.>map(Iterables.filter(this.projectConfig.getEnabledProjects(), BundleProjectConfig.class), _function)); + final HashMap uri2PluginXml = Maps.newHashMapWithExpectedSize(pluginXmls.size()); final ListIterator> pluginXmlIter = pluginXmls.listIterator(); while (pluginXmlIter.hasNext()) { { @@ -506,12 +412,10 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { if (((pluginXml == null) || (root == null))) { pluginXmlIter.remove(); } else { - String _path = pluginXml.getPath(); - final URI uri = root.getURI(_path); + final URI uri = root.getURI(pluginXml.getPath()); boolean _containsKey = uri2PluginXml.containsKey(uri); if (_containsKey) { - PluginXmlAccess _get = uri2PluginXml.get(uri); - _get.merge(pluginXml); + uri2PluginXml.get(uri).merge(pluginXml); pluginXmlIter.remove(); } else { uri2PluginXml.put(uri, pluginXml); @@ -523,12 +427,11 @@ public class XtextGenerator extends AbstractWorkflowComponent2 { { final PluginXmlAccess pluginXml = entry.getKey(); final IXtextGeneratorFileSystemAccess root = entry.getValue(); - String _path = pluginXml.getPath(); - boolean _isFile = root.isFile(_path); + boolean _isFile = root.isFile(pluginXml.getPath()); if (_isFile) { if ((((!pluginXml.getEntries().isEmpty()) && (!Objects.equal(root.readTextFile(pluginXml.getPath()), pluginXml.getContent()))) && pluginXml.getPath().endsWith(".xml"))) { - String _path_1 = pluginXml.getPath(); - String _plus = (_path_1 + "_gen"); + String _path = pluginXml.getPath(); + String _plus = (_path + "_gen"); pluginXml.setPath(_plus); pluginXml.writeTo(root); } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorLanguage.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorLanguage.java index a7a433d87..a9e918462 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorLanguage.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorLanguage.java @@ -15,7 +15,6 @@ import com.google.inject.Injector; import com.google.inject.Module; import com.google.inject.Provider; import java.io.File; -import java.net.URI; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -23,8 +22,8 @@ import java.util.List; import org.apache.log4j.Logger; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.DiagnosticChain; -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.emf.ecore.EReference; import org.eclipse.emf.ecore.EValidator; @@ -57,9 +56,7 @@ import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.ImplicitFragment; import org.eclipse.xtext.xtext.generator.XtextGeneratorResourceSetInitializer; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.StandaloneSetupAccess; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; /** @@ -133,14 +130,10 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen if (this.grammarUri != null) { _elvis = this.grammarUri; } else { - IRuntimeProjectConfig _runtime = this.projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - String _path = _src.getPath(); + String _path = this.projectConfig.getRuntime().getSrc().getPath(); String _replace = this.name.replace(".", "/"); String _plus = (_replace + ".xtext"); - File _file = new File(_path, _plus); - URI _uRI = _file.toURI(); - String _string = _uRI.toString(); + String _string = new File(_path, _plus).toURI().toString(); _elvis = _string; } return _elvis; @@ -180,46 +173,37 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen @Override public void initialize(final Injector injector) { - List _fragments = this.getFragments(); - List _implicitFragments = this.getImplicitFragments(); - _fragments.addAll(0, _implicitFragments); + this.getFragments().addAll(0, this.getImplicitFragments()); injector.injectMembers(XtextGeneratorLanguage.class); if ((this.resourceSet == null)) { this.resourceSet = this.resourceSetProvider.get(); } this.resourceSetInitializer.initialize(this.resourceSet, this.referencedResources); - EList _resources = this.resourceSet.getResources(); - boolean _isEmpty = _resources.isEmpty(); + boolean _isEmpty = this.resourceSet.getResources().isEmpty(); boolean _not = (!_isEmpty); if (_not) { this.installIndex(); { int i = 0; - EList _resources_1 = this.resourceSet.getResources(); - int size = _resources_1.size(); + int size = this.resourceSet.getResources().size(); boolean _while = (i < size); while (_while) { { - EList _resources_2 = this.resourceSet.getResources(); - final Resource res = _resources_2.get(i); - EList _contents = res.getContents(); - boolean _isEmpty_1 = _contents.isEmpty(); + final Resource res = this.resourceSet.getResources().get(i); + boolean _isEmpty_1 = res.getContents().isEmpty(); if (_isEmpty_1) { - org.eclipse.emf.common.util.URI _uRI = res.getURI(); + URI _uRI = res.getURI(); String _plus = ("Error loading \'" + _uRI); String _plus_1 = (_plus + "\'"); XtextGeneratorLanguage.LOG.error(_plus_1); } else { - EList _errors = res.getErrors(); - boolean _isEmpty_2 = _errors.isEmpty(); + boolean _isEmpty_2 = res.getErrors().isEmpty(); boolean _not_1 = (!_isEmpty_2); if (_not_1) { - org.eclipse.emf.common.util.URI _uRI_1 = res.getURI(); + URI _uRI_1 = res.getURI(); String _plus_2 = ("Error loading \'" + _uRI_1); String _plus_3 = (_plus_2 + "\':\n"); - Joiner _on = Joiner.on("\n"); - EList _errors_1 = res.getErrors(); - String _join = _on.join(_errors_1); + String _join = Joiner.on("\n").join(res.getErrors()); String _plus_4 = (_plus_3 + _join); XtextGeneratorLanguage.LOG.error(_plus_4); } @@ -236,35 +220,27 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen if (_tripleEquals) { throw new IllegalStateException("No grammarUri or language name given"); } - String _grammarUri_1 = this.getGrammarUri(); - org.eclipse.emf.common.util.URI _createURI = org.eclipse.emf.common.util.URI.createURI(_grammarUri_1); - Resource _resource = this.resourceSet.getResource(_createURI, true); + Resource _resource = this.resourceSet.getResource(URI.createURI(this.getGrammarUri()), true); final XtextResource resource = ((XtextResource) _resource); - EList _contents = resource.getContents(); - boolean _isEmpty_1 = _contents.isEmpty(); + boolean _isEmpty_1 = resource.getContents().isEmpty(); if (_isEmpty_1) { - String _grammarUri_2 = this.getGrammarUri(); - String _plus = ("Couldn\'t load grammar for \'" + _grammarUri_2); + String _grammarUri_1 = this.getGrammarUri(); + String _plus = ("Couldn\'t load grammar for \'" + _grammarUri_1); String _plus_1 = (_plus + "\'."); throw new IllegalArgumentException(_plus_1); } - EList _errors = resource.getErrors(); - boolean _isEmpty_2 = _errors.isEmpty(); + boolean _isEmpty_2 = resource.getErrors().isEmpty(); boolean _not_1 = (!_isEmpty_2); if (_not_1) { - EList _errors_1 = resource.getErrors(); - XtextGeneratorLanguage.LOG.error(_errors_1); - String _grammarUri_3 = this.getGrammarUri(); - String _plus_2 = ("Problem parsing \'" + _grammarUri_3); + XtextGeneratorLanguage.LOG.error(resource.getErrors()); + String _grammarUri_2 = this.getGrammarUri(); + String _plus_2 = ("Problem parsing \'" + _grammarUri_2); String _plus_3 = (_plus_2 + "\':\n"); - Joiner _on = Joiner.on("\n"); - EList _errors_2 = resource.getErrors(); - String _join = _on.join(_errors_2); + String _join = Joiner.on("\n").join(resource.getErrors()); String _plus_4 = (_plus_3 + _join); throw new IllegalStateException(_plus_4); } - EList _contents_1 = resource.getContents(); - EObject _get = _contents_1.get(0); + EObject _get = resource.getContents().get(0); final Grammar grammar = ((Grammar) _get); this.validateGrammar(grammar); this.initialize(grammar); @@ -290,19 +266,17 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen private void installIndex() { List _emptyList = Collections.emptyList(); final ResourceDescriptionsData index = new ResourceDescriptionsData(_emptyList); - EList _resources = this.resourceSet.getResources(); - final ArrayList resources = Lists.newArrayList(_resources); + final ArrayList resources = Lists.newArrayList(this.resourceSet.getResources()); for (final Resource resource : resources) { this.index(resource, resource.getURI(), index); } ResourceDescriptionsData.ResourceSetAdapter.installResourceDescriptionsData(this.resourceSet, index); } - private void index(final Resource resource, final org.eclipse.emf.common.util.URI uri, final ResourceDescriptionsData index) { + private void index(final Resource resource, final URI uri, final ResourceDescriptionsData index) { final IResourceServiceProvider serviceProvider = IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(uri); if ((serviceProvider != null)) { - IResourceDescription.Manager _resourceDescriptionManager = serviceProvider.getResourceDescriptionManager(); - final IResourceDescription resourceDescription = _resourceDescriptionManager.getResourceDescription(resource); + final IResourceDescription resourceDescription = serviceProvider.getResourceDescriptionManager().getResourceDescription(resource); if ((resourceDescription != null)) { index.addDescription(uri, resourceDescription); } @@ -377,12 +351,10 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen if (_isEmpty) { _xifexpression = "(unknown)"; } else { - INode _get = nodes.get(0); - _xifexpression = NodeModelUtils.getTokenText(_get); + _xifexpression = NodeModelUtils.getTokenText(nodes.get(0)); } final String refName = _xifexpression; - Grammar _grammar = GrammarUtil.getGrammar(ref); - final String grammarName = _grammar.getName(); + final String grammarName = GrammarUtil.getGrammar(ref).getName(); final String msg = ((((("The EPackage " + refName) + " in grammar ") + grammarName) + " could not be found. ") + "You might want to register that EPackage in your workflow file."); throw new IllegalStateException(msg); } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorNaming.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorNaming.java index fe2eef34a..28062005d 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorNaming.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorNaming.java @@ -12,7 +12,6 @@ import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.xbase.lib.StringExtensions; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; /** @@ -143,16 +142,14 @@ public class XtextGeneratorNaming { public TypeReference getEclipsePluginActivator() { TypeReference _xblockexpression = null; { - IBundleProjectConfig _eclipsePlugin = this.projectConfig.getEclipsePlugin(); - final String pluginName = _eclipsePlugin.getName(); + final String pluginName = this.projectConfig.getEclipsePlugin().getName(); if ((pluginName == null)) { return null; } String activatorName = pluginName.replaceAll("\\.ui$", ""); int _lastIndexOf = activatorName.lastIndexOf("."); int _plus = (_lastIndexOf + 1); - String _substring = activatorName.substring(_plus); - String _firstUpper = StringExtensions.toFirstUpper(_substring); + String _firstUpper = StringExtensions.toFirstUpper(activatorName.substring(_plus)); String _plus_1 = (_firstUpper + "Activator"); activatorName = _plus_1; _xblockexpression = new TypeReference((pluginName + ".internal"), activatorName); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorResourceSetInitializer.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorResourceSetInitializer.java index 6a3edc15a..d8c03bf06 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorResourceSetInitializer.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorResourceSetInitializer.java @@ -8,16 +8,13 @@ package org.eclipse.xtext.xtext.generator; import com.google.common.collect.Iterables; -import java.lang.reflect.Method; import java.util.List; import java.util.function.Consumer; import org.apache.log4j.Logger; import org.eclipse.emf.codegen.ecore.genmodel.GenModel; import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.common.util.WrappedException; -import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.emf.ecore.resource.Resource; @@ -39,8 +36,7 @@ public class XtextGeneratorResourceSetInitializer { public void initialize(final ResourceSet resourceSet, final List referencedResources) { final StandaloneSetup delegate = new StandaloneSetup(); delegate.setResourceSet(resourceSet); - EPackage.Registry _packageRegistry = resourceSet.getPackageRegistry(); - _packageRegistry.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE); + resourceSet.getPackageRegistry().put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE); final Consumer _function = (String it) -> { this.loadResource(it, resourceSet); }; @@ -66,8 +62,7 @@ public class XtextGeneratorResourceSetInitializer { try { final Class genModelSupport = Class.forName("org.eclipse.emf.codegen.ecore.xtext.GenModelSupport"); final Object instance = genModelSupport.newInstance(); - Method _declaredMethod = genModelSupport.getDeclaredMethod("createInjectorAndDoEMFRegistration"); - _declaredMethod.invoke(instance); + genModelSupport.getDeclaredMethod("createInjectorAndDoEMFRegistration").invoke(instance); } catch (final Throwable _t) { if (_t instanceof ClassNotFoundException) { final ClassNotFoundException e = (ClassNotFoundException)_t; @@ -86,14 +81,12 @@ public class XtextGeneratorResourceSetInitializer { if ((resourceServiceProvider_1 == null)) { try { final Class ecore = Class.forName("org.eclipse.xtext.ecore.EcoreSupportStandaloneSetup"); - Method _declaredMethod_1 = ecore.getDeclaredMethod("setup", new Class[] {}); - _declaredMethod_1.invoke(null); + ecore.getDeclaredMethod("setup", new Class[] {}).invoke(null); } catch (final Throwable _t_1) { if (_t_1 instanceof ClassNotFoundException) { final ClassNotFoundException e_2 = (ClassNotFoundException)_t_1; XtextGeneratorResourceSetInitializer.LOG.error("Couldn\'t initialize Ecore support. Is \'org.eclipse.xtext.ecore\' on the classpath?"); - String _message = e_2.getMessage(); - XtextGeneratorResourceSetInitializer.LOG.debug(_message, e_2); + XtextGeneratorResourceSetInitializer.LOG.debug(e_2.getMessage(), e_2); } else if (_t_1 instanceof Exception) { final Exception e_3 = (Exception)_t_1; XtextGeneratorResourceSetInitializer.LOG.error("Couldn\'t initialize Ecore support.", e_3); @@ -108,14 +101,12 @@ public class XtextGeneratorResourceSetInitializer { if ((resourceServiceProvider_2 == null)) { try { final Class xcore = Class.forName("org.eclipse.emf.ecore.xcore.XcoreStandaloneSetup"); - Method _declaredMethod_2 = xcore.getDeclaredMethod("doSetup", new Class[] {}); - _declaredMethod_2.invoke(null); + xcore.getDeclaredMethod("doSetup", new Class[] {}).invoke(null); } catch (final Throwable _t_2) { if (_t_2 instanceof ClassNotFoundException) { final ClassNotFoundException e_4 = (ClassNotFoundException)_t_2; XtextGeneratorResourceSetInitializer.LOG.error("Couldn\'t initialize Xcore support. Is it on the classpath?"); - String _message_1 = e_4.getMessage(); - XtextGeneratorResourceSetInitializer.LOG.debug(_message_1, e_4); + XtextGeneratorResourceSetInitializer.LOG.debug(e_4.getMessage(), e_4); } else if (_t_2 instanceof Exception) { final Exception e_5 = (Exception)_t_2; XtextGeneratorResourceSetInitializer.LOG.error("Couldn\'t initialize Xcore support.", e_5); @@ -132,8 +123,7 @@ public class XtextGeneratorResourceSetInitializer { final WrappedException e_6 = (WrappedException)_t_3; XtextGeneratorResourceSetInitializer.LOG.error("Could not load XcoreLang.xcore.", e_6); final Resource brokenResource = resourceSet.getResource(xcoreLangURI, false); - EList _resources = resourceSet.getResources(); - _resources.remove(brokenResource); + resourceSet.getResources().remove(brokenResource); } else { throw Exceptions.sneakyThrow(_t_3); } @@ -151,15 +141,11 @@ public class XtextGeneratorResourceSetInitializer { } private void register(final EPackage ePackage) { - Resource _eResource = ePackage.eResource(); - ResourceSet _resourceSet = _eResource.getResourceSet(); - final EPackage.Registry registry = _resourceSet.getPackageRegistry(); - String _nsURI = ePackage.getNsURI(); - Object _get = registry.get(_nsURI); + final EPackage.Registry registry = ePackage.eResource().getResourceSet().getPackageRegistry(); + Object _get = registry.get(ePackage.getNsURI()); boolean _tripleEquals = (_get == null); if (_tripleEquals) { - String _nsURI_1 = ePackage.getNsURI(); - registry.put(_nsURI_1, ePackage); + registry.put(ePackage.getNsURI(), ePackage); } } @@ -171,21 +157,17 @@ public class XtextGeneratorResourceSetInitializer { } private void register(final GenModel genModel) { - GenModelHelper _genModelHelper = new GenModelHelper(); - _genModelHelper.registerGenModel(genModel); + new GenModelHelper().registerGenModel(genModel); } private void each(final ResourceSet resourceSet, final Class type, final Procedure1 strategy) { for (int i = 0; (i < resourceSet.getResources().size()); i++) { { - EList _resources = resourceSet.getResources(); - final Resource resource = _resources.get(i); - EList _contents = resource.getContents(); - Iterable _filter = Iterables.filter(_contents, type); + final Resource resource = resourceSet.getResources().get(i); final Consumer _function = (Type it) -> { strategy.apply(it); }; - _filter.forEach(_function); + Iterables.filter(resource.getContents(), type).forEach(_function); } } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorStandaloneSetup.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorStandaloneSetup.java index 9acb3bbc3..cc292cf99 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorStandaloneSetup.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorStandaloneSetup.java @@ -9,7 +9,6 @@ package org.eclipse.xtext.xtext.generator; import com.google.inject.Inject; import com.google.inject.Injector; -import java.util.List; import java.util.function.Consumer; import org.apache.log4j.Logger; import org.eclipse.emf.mwe.utils.ProjectMapping; @@ -23,7 +22,6 @@ import org.eclipse.xtext.xbase.lib.Pair; import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig; import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; @@ -48,7 +46,6 @@ public class XtextGeneratorStandaloneSetup implements IGuiceAwareGeneratorCompon private void setup() { final StandaloneSetup delegate = new StandaloneSetup(); delegate.setScanClassPath(this.scanClasspath); - Iterable> _projectMappings = this.getProjectMappings(); final Consumer> _function = (Pair mapping) -> { ProjectMapping _projectMapping = new ProjectMapping(); final Procedure1 _function_1 = (ProjectMapping it) -> { @@ -58,22 +55,19 @@ public class XtextGeneratorStandaloneSetup implements IGuiceAwareGeneratorCompon ProjectMapping _doubleArrow = ObjectExtensions.operator_doubleArrow(_projectMapping, _function_1); delegate.addProjectMapping(_doubleArrow); }; - _projectMappings.forEach(_function); + this.getProjectMappings().forEach(_function); } private Iterable> getProjectMappings() { - List _enabledProjects = this.projectConfig.getEnabledProjects(); final Function1 _function = (ISubProjectConfig it) -> { return Boolean.valueOf(((it.getName() != null) && (it.getRoot() != null))); }; - Iterable _filter = IterableExtensions.filter(_enabledProjects, _function); final Function1> _function_1 = (ISubProjectConfig it) -> { String _name = it.getName(); - IXtextGeneratorFileSystemAccess _root = it.getRoot(); - String _path = _root.getPath(); + String _path = it.getRoot().getPath(); return Pair.of(_name, _path); }; - return IterableExtensions.map(_filter, _function_1); + return IterableExtensions.map(IterableExtensions.filter(this.projectConfig.getEnabledProjects(), _function), _function_1); } private final static Logger LOG = Logger.getLogger(XtextGeneratorStandaloneSetup.class); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorTemplates.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorTemplates.java index d455b0e18..cc0c9e01a 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorTemplates.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorTemplates.java @@ -42,7 +42,6 @@ import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; -import org.eclipse.xtext.xtext.generator.model.StandaloneSetupAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.model.annotations.IClassAnnotation; import org.eclipse.xtext.xtext.generator.model.annotations.SuppressWarningsAnnotation; @@ -77,8 +76,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - TypeReference _runtimeSetup = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it); - String _simpleName = _runtimeSetup.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _runtimeGenSetup = XtextGeneratorTemplates.this.naming.getRuntimeGenSetup(it); @@ -91,8 +89,7 @@ public class XtextGeneratorTemplates { _builder.newLine(); _builder.append("\t\t"); _builder.append("new "); - TypeReference _runtimeSetup_1 = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it); - String _simpleName_1 = _runtimeSetup_1.getSimpleName(); + String _simpleName_1 = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it).getSimpleName(); _builder.append(_simpleName_1, "\t\t"); _builder.append("().createInjectorAndDoEMFRegistration()"); _builder.newLineIfNotEmpty(); @@ -118,8 +115,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - TypeReference _runtimeSetup = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it); - String _simpleName = _runtimeSetup.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _runtimeGenSetup = XtextGeneratorTemplates.this.naming.getRuntimeGenSetup(it); @@ -132,8 +128,7 @@ public class XtextGeneratorTemplates { _builder.newLine(); _builder.append("\t\t"); _builder.append("new "); - TypeReference _runtimeSetup_1 = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it); - String _simpleName_1 = _runtimeSetup_1.getSimpleName(); + String _simpleName_1 = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it).getSimpleName(); _builder.append(_simpleName_1, "\t\t"); _builder.append("().createInjectorAndDoEMFRegistration();"); _builder.newLineIfNotEmpty(); @@ -150,10 +145,8 @@ public class XtextGeneratorTemplates { public JavaFileAccess createRuntimeGenSetup(final IXtextGeneratorLanguage langConfig) { final Grammar it = langConfig.getGrammar(); - TypeReference _runtimeGenSetup = this.naming.getRuntimeGenSetup(it); - final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(_runtimeGenSetup); - StandaloneSetupAccess _runtimeGenSetup_1 = langConfig.getRuntimeGenSetup(); - Set _imports = _runtimeGenSetup_1.getImports(); + final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(this.naming.getRuntimeGenSetup(it)); + Set _imports = langConfig.getRuntimeGenSetup().getImports(); for (final TypeReference type : _imports) { file.importType(type); } @@ -164,8 +157,7 @@ public class XtextGeneratorTemplates { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _runtimeGenSetup = XtextGeneratorTemplates.this.naming.getRuntimeGenSetup(it); - String _simpleName = _runtimeGenSetup.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getRuntimeGenSetup(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" implements "); _builder.append(ISetup.class); @@ -181,8 +173,7 @@ public class XtextGeneratorTemplates { _builder.append(" createInjectorAndDoEMFRegistration() {"); _builder.newLineIfNotEmpty(); { - Grammar _grammar = langConfig.getGrammar(); - EList _usedGrammars = _grammar.getUsedGrammars(); + EList _usedGrammars = langConfig.getGrammar().getUsedGrammars(); for(final Grammar usedGrammar : _usedGrammars) { _builder.append("\t\t"); TypeReference _runtimeSetup = XtextGeneratorTemplates.this.naming.getRuntimeSetup(usedGrammar); @@ -192,9 +183,7 @@ public class XtextGeneratorTemplates { } } { - Grammar _grammar_1 = langConfig.getGrammar(); - EList _usedGrammars_1 = _grammar_1.getUsedGrammars(); - boolean _isEmpty = _usedGrammars_1.isEmpty(); + boolean _isEmpty = langConfig.getGrammar().getUsedGrammars().isEmpty(); if (_isEmpty) { _builder.append("\t\t"); _builder.append("// register default ePackages"); @@ -315,8 +304,7 @@ public class XtextGeneratorTemplates { _builder.append(" injector) {"); _builder.newLineIfNotEmpty(); { - StandaloneSetupAccess _runtimeGenSetup_1 = langConfig.getRuntimeGenSetup(); - List _registrations = _runtimeGenSetup_1.getRegistrations(); + List _registrations = langConfig.getRuntimeGenSetup().getRegistrations(); for(final StringConcatenationClient reg : _registrations) { _builder.append("\t\t"); _builder.append(reg, "\t\t"); @@ -340,9 +328,7 @@ public class XtextGeneratorTemplates { if (((!it.getValue().isProvider()) && it.getValue().getStatements().isEmpty())) { _builder.append("bind"); } else { - GuiceModuleAccess.BindValue _value = it.getValue(); - List _statements = _value.getStatements(); - boolean _isEmpty = _statements.isEmpty(); + boolean _isEmpty = it.getValue().getStatements().isEmpty(); if (_isEmpty) { _builder.append("provide"); } else { @@ -351,8 +337,7 @@ public class XtextGeneratorTemplates { } } String _elvis = null; - GuiceModuleAccess.BindKey _key = it.getKey(); - String _name = _key.getName(); + String _name = it.getKey().getName(); String _replace = null; if (_name!=null) { _replace=_name.replace(".", "$"); @@ -360,9 +345,7 @@ public class XtextGeneratorTemplates { if (_replace != null) { _elvis = _replace; } else { - GuiceModuleAccess.BindKey _key_1 = it.getKey(); - TypeReference _type = _key_1.getType(); - String _simpleMethodName = this.getSimpleMethodName(_type); + String _simpleMethodName = this.getSimpleMethodName(it.getKey().getType()); _elvis = _simpleMethodName; } _builder.append(_elvis); @@ -375,13 +358,11 @@ public class XtextGeneratorTemplates { } private String getSimpleMethodName(final TypeReference type) { - List _simpleNames = type.getSimpleNames(); - String _join = IterableExtensions.join(_simpleNames, "$"); - List _typeArguments = type.getTypeArguments(); + String _join = IterableExtensions.join(type.getSimpleNames(), "$"); final Function1 _function = (TypeReference it) -> { return this.getSimpleMethodName(it); }; - String _join_1 = IterableExtensions.join(_typeArguments, "$", "$", "", _function); + String _join_1 = IterableExtensions.join(type.getTypeArguments(), "$", "$", "", _function); return (_join + _join_1); } @@ -396,14 +377,12 @@ public class XtextGeneratorTemplates { _builder.append(_contributedBy); _builder.newLineIfNotEmpty(); { - GuiceModuleAccess.BindKey _key = it.getKey(); - boolean _isSingleton = _key.isSingleton(); + boolean _isSingleton = it.getKey().isSingleton(); if (_isSingleton) { _builder.append("@"); _builder.append(SingletonBinding.class); { - GuiceModuleAccess.BindKey _key_1 = it.getKey(); - boolean _isEagerSingleton = _key_1.isEagerSingleton(); + boolean _isEagerSingleton = it.getKey().isEagerSingleton(); if (_isEagerSingleton) { _builder.append("(eager=true)"); } @@ -413,18 +392,15 @@ public class XtextGeneratorTemplates { _builder.newLineIfNotEmpty(); _builder.append("public "); { - GuiceModuleAccess.BindValue _value = it.getValue(); - Object _expression = _value.getExpression(); + Object _expression = it.getValue().getExpression(); boolean _tripleEquals = (_expression == null); if (_tripleEquals) { _builder.append("Class"); } else { - GuiceModuleAccess.BindKey _key_3 = it.getKey(); - TypeReference _type_1 = _key_3.getType(); + TypeReference _type_1 = it.getKey().getType(); _builder.append(_type_1); } } @@ -436,16 +412,13 @@ public class XtextGeneratorTemplates { _builder.append("\t"); _builder.append("return "); { - GuiceModuleAccess.BindValue _value_1 = it.getValue(); - Object _expression_1 = _value_1.getExpression(); + Object _expression_1 = it.getValue().getExpression(); boolean _tripleNotEquals = (_expression_1 != null); if (_tripleNotEquals) { - GuiceModuleAccess.BindValue _value_2 = it.getValue(); - Object _expression_2 = _value_2.getExpression(); + Object _expression_2 = it.getValue().getExpression(); _builder.append(_expression_2, "\t"); } else { - GuiceModuleAccess.BindValue _value_3 = it.getValue(); - TypeReference _type_2 = _value_3.getType(); + TypeReference _type_2 = it.getValue().getType(); _builder.append(_type_2, "\t"); _builder.append(".class"); } @@ -455,23 +428,19 @@ public class XtextGeneratorTemplates { _builder.append("}"); _builder.newLine(); } else { - GuiceModuleAccess.BindValue _value_4 = it.getValue(); - List _statements = _value_4.getStatements(); - boolean _isEmpty = _statements.isEmpty(); + boolean _isEmpty = it.getValue().getStatements().isEmpty(); if (_isEmpty) { _builder.append("// contributed by "); String _contributedBy_1 = it.getContributedBy(); _builder.append(_contributedBy_1); _builder.newLineIfNotEmpty(); { - GuiceModuleAccess.BindKey _key_4 = it.getKey(); - boolean _isSingleton_1 = _key_4.isSingleton(); + boolean _isSingleton_1 = it.getKey().isSingleton(); if (_isSingleton_1) { _builder.append("@"); _builder.append(SingletonBinding.class); { - GuiceModuleAccess.BindKey _key_5 = it.getKey(); - boolean _isEagerSingleton_1 = _key_5.isEagerSingleton(); + boolean _isEagerSingleton_1 = it.getKey().isEagerSingleton(); if (_isEagerSingleton_1) { _builder.append("(eager=true)"); } @@ -481,22 +450,19 @@ public class XtextGeneratorTemplates { _builder.newLineIfNotEmpty(); _builder.append("public "); { - GuiceModuleAccess.BindValue _value_5 = it.getValue(); - Object _expression_3 = _value_5.getExpression(); + Object _expression_3 = it.getValue().getExpression(); boolean _tripleEquals_1 = (_expression_3 == null); if (_tripleEquals_1) { _builder.append("Class>"); } else { _builder.append(Provider.class); _builder.append(""); } @@ -509,16 +475,13 @@ public class XtextGeneratorTemplates { _builder.append("\t"); _builder.append("return "); { - GuiceModuleAccess.BindValue _value_6 = it.getValue(); - Object _expression_4 = _value_6.getExpression(); + Object _expression_4 = it.getValue().getExpression(); boolean _tripleNotEquals_1 = (_expression_4 != null); if (_tripleNotEquals_1) { - GuiceModuleAccess.BindValue _value_7 = it.getValue(); - Object _expression_5 = _value_7.getExpression(); + Object _expression_5 = it.getValue().getExpression(); _builder.append(_expression_5, "\t"); } else { - GuiceModuleAccess.BindValue _value_8 = it.getValue(); - TypeReference _type_5 = _value_8.getType(); + TypeReference _type_5 = it.getValue().getType(); _builder.append(_type_5, "\t"); _builder.append(".class"); } @@ -540,9 +503,8 @@ public class XtextGeneratorTemplates { _builder.append(" binder) {"); _builder.newLineIfNotEmpty(); { - GuiceModuleAccess.BindValue _value_9 = it.getValue(); - List _statements_1 = _value_9.getStatements(); - for(final Object statement : _statements_1) { + List _statements = it.getValue().getStatements(); + for(final Object statement : _statements) { _builder.append("\t"); _builder.append(statement, "\t"); _builder.newLineIfNotEmpty(); @@ -575,8 +537,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - TypeReference _runtimeModule = XtextGeneratorTemplates.this.naming.getRuntimeModule(it); - String _simpleName = _runtimeModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getRuntimeModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _runtimeGenModule = XtextGeneratorTemplates.this.naming.getRuntimeGenModule(it); @@ -602,8 +563,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - TypeReference _runtimeModule = XtextGeneratorTemplates.this.naming.getRuntimeModule(it); - String _simpleName = _runtimeModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getRuntimeModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _runtimeGenModule = XtextGeneratorTemplates.this.naming.getRuntimeGenModule(it); @@ -621,8 +581,7 @@ public class XtextGeneratorTemplates { public JavaFileAccess createRuntimeGenModule(final IXtextGeneratorLanguage langConfig) { final Grammar it = langConfig.getGrammar(); TypeReference _elvis = null; - GuiceModuleAccess _runtimeGenModule = langConfig.getRuntimeGenModule(); - TypeReference _superClass = _runtimeGenModule.getSuperClass(); + TypeReference _superClass = langConfig.getRuntimeGenModule().getSuperClass(); if (_superClass != null) { _elvis = _superClass; } else { @@ -630,8 +589,7 @@ public class XtextGeneratorTemplates { _elvis = _runtimeDefaultModule; } final TypeReference superClass = _elvis; - TypeReference _runtimeGenModule_1 = this.naming.getRuntimeGenModule(it); - final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(_runtimeGenModule_1); + final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(this.naming.getRuntimeGenModule(it)); file.setImportNestedTypeThreshold(JavaFileAccess.DONT_IMPORT_NESTED_TYPES); StringConcatenationClient _client = new StringConcatenationClient() { @Override @@ -640,8 +598,7 @@ public class XtextGeneratorTemplates { _builder.newLine(); _builder.append(" "); _builder.append("* Manual modifications go to {@link "); - TypeReference _runtimeModule = XtextGeneratorTemplates.this.naming.getRuntimeModule(it); - String _simpleName = _runtimeModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getRuntimeModule(it).getSimpleName(); _builder.append(_simpleName, " "); _builder.append("}."); _builder.newLineIfNotEmpty(); @@ -658,8 +615,7 @@ public class XtextGeneratorTemplates { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public abstract class "); - TypeReference _runtimeGenModule = XtextGeneratorTemplates.this.naming.getRuntimeGenModule(it); - String _simpleName = _runtimeGenModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getRuntimeGenModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(superClass); @@ -682,9 +638,7 @@ public class XtextGeneratorTemplates { _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("properties = tryBindProperties(binder, \""); - Grammar _grammar = langConfig.getGrammar(); - String _name = _grammar.getName(); - String _replaceAll = _name.replaceAll("\\.", "/"); + String _replaceAll = langConfig.getGrammar().getName().replaceAll("\\.", "/"); _builder.append(_replaceAll, "\t\t"); _builder.append(".properties\");"); _builder.newLineIfNotEmpty(); @@ -707,9 +661,8 @@ public class XtextGeneratorTemplates { _builder.append(".named("); _builder.append(Constants.class, "\t\t"); _builder.append(".LANGUAGE_NAME)).toInstance(\""); - Grammar _grammar_1 = langConfig.getGrammar(); - String _name_1 = _grammar_1.getName(); - _builder.append(_name_1, "\t\t"); + String _name = langConfig.getGrammar().getName(); + _builder.append(_name, "\t\t"); _builder.append("\");"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -731,8 +684,7 @@ public class XtextGeneratorTemplates { _builder.append(".named("); _builder.append(Constants.class, "\t\t\t"); _builder.append(".FILE_EXTENSIONS)).toInstance(\""); - List _fileExtensions = langConfig.getFileExtensions(); - String _join = IterableExtensions.join(_fileExtensions, ","); + String _join = IterableExtensions.join(langConfig.getFileExtensions(), ","); _builder.append(_join, "\t\t\t"); _builder.append("\");"); _builder.newLineIfNotEmpty(); @@ -742,8 +694,7 @@ public class XtextGeneratorTemplates { _builder.append("\t"); _builder.newLine(); { - GuiceModuleAccess _runtimeGenModule_1 = langConfig.getRuntimeGenModule(); - Set _bindings = _runtimeGenModule_1.getBindings(); + Set _bindings = langConfig.getRuntimeGenModule().getBindings(); for(final GuiceModuleAccess.Binding binding : _bindings) { _builder.append("\t"); StringConcatenationClient _createBindingMethod = XtextGeneratorTemplates.this.createBindingMethod(binding); @@ -779,8 +730,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - TypeReference _genericIdeModule = XtextGeneratorTemplates.this.naming.getGenericIdeModule(it); - String _simpleName = _genericIdeModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getGenericIdeModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _genericIdeGenModule = XtextGeneratorTemplates.this.naming.getGenericIdeGenModule(it); @@ -806,8 +756,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - TypeReference _genericIdeModule = XtextGeneratorTemplates.this.naming.getGenericIdeModule(it); - String _simpleName = _genericIdeModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getGenericIdeModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _genericIdeGenModule = XtextGeneratorTemplates.this.naming.getGenericIdeGenModule(it); @@ -825,8 +774,7 @@ public class XtextGeneratorTemplates { public JavaFileAccess createIdeGenModule(final IXtextGeneratorLanguage langConfig) { final Grammar it = langConfig.getGrammar(); TypeReference _elvis = null; - GuiceModuleAccess _ideGenModule = langConfig.getIdeGenModule(); - TypeReference _superClass = _ideGenModule.getSuperClass(); + TypeReference _superClass = langConfig.getIdeGenModule().getSuperClass(); if (_superClass != null) { _elvis = _superClass; } else { @@ -834,8 +782,7 @@ public class XtextGeneratorTemplates { _elvis = _genericIdeDefaultModule; } final TypeReference superClass = _elvis; - TypeReference _genericIdeGenModule = this.naming.getGenericIdeGenModule(it); - final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(_genericIdeGenModule); + final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(this.naming.getGenericIdeGenModule(it)); file.setImportNestedTypeThreshold(JavaFileAccess.DONT_IMPORT_NESTED_TYPES); StringConcatenationClient _client = new StringConcatenationClient() { @Override @@ -844,8 +791,7 @@ public class XtextGeneratorTemplates { _builder.newLine(); _builder.append(" "); _builder.append("* Manual modifications go to {@link "); - TypeReference _genericIdeModule = XtextGeneratorTemplates.this.naming.getGenericIdeModule(it); - String _simpleName = _genericIdeModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getGenericIdeModule(it).getSimpleName(); _builder.append(_simpleName, " "); _builder.append("}."); _builder.newLineIfNotEmpty(); @@ -862,8 +808,7 @@ public class XtextGeneratorTemplates { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public abstract class "); - TypeReference _genericIdeGenModule = XtextGeneratorTemplates.this.naming.getGenericIdeGenModule(it); - String _simpleName = _genericIdeGenModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getGenericIdeGenModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(superClass); @@ -871,8 +816,7 @@ public class XtextGeneratorTemplates { _builder.newLineIfNotEmpty(); _builder.newLine(); { - GuiceModuleAccess _ideGenModule = langConfig.getIdeGenModule(); - Set _bindings = _ideGenModule.getBindings(); + Set _bindings = langConfig.getIdeGenModule().getBindings(); for(final GuiceModuleAccess.Binding binding : _bindings) { _builder.append("\t"); StringConcatenationClient _createBindingMethod = XtextGeneratorTemplates.this.createBindingMethod(binding); @@ -908,8 +852,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - TypeReference _genericIdeSetup = XtextGeneratorTemplates.this.naming.getGenericIdeSetup(it); - String _simpleName = _genericIdeSetup.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getGenericIdeSetup(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _runtimeSetup = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it); @@ -956,8 +899,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - TypeReference _genericIdeSetup = XtextGeneratorTemplates.this.naming.getGenericIdeSetup(it); - String _simpleName = _genericIdeSetup.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getGenericIdeSetup(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _runtimeSetup = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it); @@ -1019,8 +961,7 @@ public class XtextGeneratorTemplates { _builder.append(FinalFieldsConstructor.class); _builder.newLineIfNotEmpty(); _builder.append("class "); - TypeReference _eclipsePluginModule = XtextGeneratorTemplates.this.naming.getEclipsePluginModule(it); - String _simpleName = _eclipsePluginModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getEclipsePluginModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _eclipsePluginGenModule = XtextGeneratorTemplates.this.naming.getEclipsePluginGenModule(it); @@ -1046,8 +987,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - TypeReference _eclipsePluginModule = XtextGeneratorTemplates.this.naming.getEclipsePluginModule(it); - String _simpleName = _eclipsePluginModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getEclipsePluginModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _eclipsePluginGenModule = XtextGeneratorTemplates.this.naming.getEclipsePluginGenModule(it); @@ -1057,8 +997,7 @@ public class XtextGeneratorTemplates { _builder.newLine(); _builder.append("\t"); _builder.append("public "); - TypeReference _eclipsePluginModule_1 = XtextGeneratorTemplates.this.naming.getEclipsePluginModule(it); - String _simpleName_1 = _eclipsePluginModule_1.getSimpleName(); + String _simpleName_1 = XtextGeneratorTemplates.this.naming.getEclipsePluginModule(it).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("("); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.ui.plugin.AbstractUIPlugin"); @@ -1082,8 +1021,7 @@ public class XtextGeneratorTemplates { public JavaFileAccess createEclipsePluginGenModule(final IXtextGeneratorLanguage langConfig) { final Grammar it = langConfig.getGrammar(); TypeReference _elvis = null; - GuiceModuleAccess _eclipsePluginGenModule = langConfig.getEclipsePluginGenModule(); - TypeReference _superClass = _eclipsePluginGenModule.getSuperClass(); + TypeReference _superClass = langConfig.getEclipsePluginGenModule().getSuperClass(); if (_superClass != null) { _elvis = _superClass; } else { @@ -1091,8 +1029,7 @@ public class XtextGeneratorTemplates { _elvis = _eclipsePluginDefaultModule; } final TypeReference superClass = _elvis; - TypeReference _eclipsePluginGenModule_1 = this.naming.getEclipsePluginGenModule(it); - final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(_eclipsePluginGenModule_1); + final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(this.naming.getEclipsePluginGenModule(it)); file.setImportNestedTypeThreshold(JavaFileAccess.DONT_IMPORT_NESTED_TYPES); StringConcatenationClient _client = new StringConcatenationClient() { @Override @@ -1101,8 +1038,7 @@ public class XtextGeneratorTemplates { _builder.newLine(); _builder.append(" "); _builder.append("* Manual modifications go to {@link "); - TypeReference _eclipsePluginModule = XtextGeneratorTemplates.this.naming.getEclipsePluginModule(it); - String _simpleName = _eclipsePluginModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getEclipsePluginModule(it).getSimpleName(); _builder.append(_simpleName, " "); _builder.append("}."); _builder.newLineIfNotEmpty(); @@ -1119,8 +1055,7 @@ public class XtextGeneratorTemplates { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public abstract class "); - TypeReference _eclipsePluginGenModule = XtextGeneratorTemplates.this.naming.getEclipsePluginGenModule(it); - String _simpleName = _eclipsePluginGenModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getEclipsePluginGenModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(superClass); @@ -1129,8 +1064,7 @@ public class XtextGeneratorTemplates { _builder.newLine(); _builder.append("\t"); _builder.append("public "); - TypeReference _eclipsePluginGenModule_1 = XtextGeneratorTemplates.this.naming.getEclipsePluginGenModule(it); - String _simpleName_1 = _eclipsePluginGenModule_1.getSimpleName(); + String _simpleName_1 = XtextGeneratorTemplates.this.naming.getEclipsePluginGenModule(it).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("("); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.ui.plugin.AbstractUIPlugin"); @@ -1146,8 +1080,7 @@ public class XtextGeneratorTemplates { _builder.append("\t"); _builder.newLine(); { - GuiceModuleAccess _eclipsePluginGenModule_2 = langConfig.getEclipsePluginGenModule(); - Set _bindings = _eclipsePluginGenModule_2.getBindings(); + Set _bindings = langConfig.getEclipsePluginGenModule().getBindings(); for(final GuiceModuleAccess.Binding binding : _bindings) { _builder.append("\t"); StringConcatenationClient _createBindingMethod = XtextGeneratorTemplates.this.createBindingMethod(binding); @@ -1183,8 +1116,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - TypeReference _ideaModule = XtextGeneratorTemplates.this.naming.getIdeaModule(it); - String _simpleName = _ideaModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getIdeaModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _ideaGenModule = XtextGeneratorTemplates.this.naming.getIdeaGenModule(it); @@ -1210,8 +1142,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - TypeReference _ideaModule = XtextGeneratorTemplates.this.naming.getIdeaModule(it); - String _simpleName = _ideaModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getIdeaModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _ideaGenModule = XtextGeneratorTemplates.this.naming.getIdeaGenModule(it); @@ -1229,8 +1160,7 @@ public class XtextGeneratorTemplates { public JavaFileAccess createIdeaGenModule(final IXtextGeneratorLanguage langConfig) { final Grammar it = langConfig.getGrammar(); TypeReference _elvis = null; - GuiceModuleAccess _ideaGenModule = langConfig.getIdeaGenModule(); - TypeReference _superClass = _ideaGenModule.getSuperClass(); + TypeReference _superClass = langConfig.getIdeaGenModule().getSuperClass(); if (_superClass != null) { _elvis = _superClass; } else { @@ -1238,8 +1168,7 @@ public class XtextGeneratorTemplates { _elvis = _ideaDefaultModule; } final TypeReference superClass = _elvis; - TypeReference _ideaGenModule_1 = this.naming.getIdeaGenModule(it); - final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(_ideaGenModule_1); + final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(this.naming.getIdeaGenModule(it)); file.setImportNestedTypeThreshold(JavaFileAccess.DONT_IMPORT_NESTED_TYPES); StringConcatenationClient _client = new StringConcatenationClient() { @Override @@ -1248,8 +1177,7 @@ public class XtextGeneratorTemplates { _builder.newLine(); _builder.append(" "); _builder.append("* Manual modifications go to {@link "); - TypeReference _ideaModule = XtextGeneratorTemplates.this.naming.getIdeaModule(it); - String _simpleName = _ideaModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getIdeaModule(it).getSimpleName(); _builder.append(_simpleName, " "); _builder.append("}."); _builder.newLineIfNotEmpty(); @@ -1266,8 +1194,7 @@ public class XtextGeneratorTemplates { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public abstract class "); - TypeReference _ideaGenModule = XtextGeneratorTemplates.this.naming.getIdeaGenModule(it); - String _simpleName = _ideaGenModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getIdeaGenModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(superClass); @@ -1276,8 +1203,7 @@ public class XtextGeneratorTemplates { _builder.append("\t"); _builder.newLine(); { - GuiceModuleAccess _ideaGenModule_1 = langConfig.getIdeaGenModule(); - Set _bindings = _ideaGenModule_1.getBindings(); + Set _bindings = langConfig.getIdeaGenModule().getBindings(); for(final GuiceModuleAccess.Binding binding : _bindings) { _builder.append("\t"); StringConcatenationClient _createBindingMethod = XtextGeneratorTemplates.this.createBindingMethod(binding); @@ -1312,8 +1238,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - TypeReference _webModule = XtextGeneratorTemplates.this.naming.getWebModule(it); - String _simpleName = _webModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getWebModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _webGenModule = XtextGeneratorTemplates.this.naming.getWebGenModule(it); @@ -1339,8 +1264,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - TypeReference _webModule = XtextGeneratorTemplates.this.naming.getWebModule(it); - String _simpleName = _webModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getWebModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _webGenModule = XtextGeneratorTemplates.this.naming.getWebGenModule(it); @@ -1358,8 +1282,7 @@ public class XtextGeneratorTemplates { public JavaFileAccess createWebGenModule(final IXtextGeneratorLanguage langConfig) { final Grammar it = langConfig.getGrammar(); TypeReference _elvis = null; - GuiceModuleAccess _webGenModule = langConfig.getWebGenModule(); - TypeReference _superClass = _webGenModule.getSuperClass(); + TypeReference _superClass = langConfig.getWebGenModule().getSuperClass(); if (_superClass != null) { _elvis = _superClass; } else { @@ -1367,8 +1290,7 @@ public class XtextGeneratorTemplates { _elvis = _webDefaultModule; } final TypeReference superClass = _elvis; - TypeReference _webGenModule_1 = this.naming.getWebGenModule(it); - final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(_webGenModule_1); + final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(this.naming.getWebGenModule(it)); file.setImportNestedTypeThreshold(JavaFileAccess.DONT_IMPORT_NESTED_TYPES); StringConcatenationClient _client = new StringConcatenationClient() { @Override @@ -1377,8 +1299,7 @@ public class XtextGeneratorTemplates { _builder.newLine(); _builder.append(" "); _builder.append("* Manual modifications go to {@link "); - TypeReference _webModule = XtextGeneratorTemplates.this.naming.getWebModule(it); - String _simpleName = _webModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getWebModule(it).getSimpleName(); _builder.append(_simpleName, " "); _builder.append("}."); _builder.newLineIfNotEmpty(); @@ -1395,8 +1316,7 @@ public class XtextGeneratorTemplates { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public abstract class "); - TypeReference _webGenModule = XtextGeneratorTemplates.this.naming.getWebGenModule(it); - String _simpleName = _webGenModule.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getWebGenModule(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(superClass); @@ -1404,8 +1324,7 @@ public class XtextGeneratorTemplates { _builder.newLineIfNotEmpty(); _builder.newLine(); { - GuiceModuleAccess _webGenModule_1 = langConfig.getWebGenModule(); - Set _bindings = _webGenModule_1.getBindings(); + Set _bindings = langConfig.getWebGenModule().getBindings(); for(final GuiceModuleAccess.Binding binding : _bindings) { _builder.append("\t"); StringConcatenationClient _createBindingMethod = XtextGeneratorTemplates.this.createBindingMethod(binding); @@ -1441,8 +1360,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - TypeReference _webSetup = XtextGeneratorTemplates.this.naming.getWebSetup(it); - String _simpleName = _webSetup.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getWebSetup(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _runtimeSetup = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it); @@ -1496,8 +1414,7 @@ public class XtextGeneratorTemplates { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - TypeReference _webSetup = XtextGeneratorTemplates.this.naming.getWebSetup(it); - String _simpleName = _webSetup.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getWebSetup(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _runtimeSetup = XtextGeneratorTemplates.this.naming.getRuntimeSetup(it); @@ -1545,8 +1462,7 @@ public class XtextGeneratorTemplates { public JavaFileAccess createEclipsePluginExecutableExtensionFactory(final IXtextGeneratorLanguage langConfig, final IXtextGeneratorLanguage activatorLanguage) { final Grammar grammar = langConfig.getGrammar(); - TypeReference _eclipsePluginExecutableExtensionFactory = this.naming.getEclipsePluginExecutableExtensionFactory(grammar); - final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(_eclipsePluginExecutableExtensionFactory); + final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(this.naming.getEclipsePluginExecutableExtensionFactory(grammar)); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -1568,8 +1484,7 @@ public class XtextGeneratorTemplates { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _eclipsePluginExecutableExtensionFactory = XtextGeneratorTemplates.this.naming.getEclipsePluginExecutableExtensionFactory(grammar); - String _simpleName = _eclipsePluginExecutableExtensionFactory.getSimpleName(); + String _simpleName = XtextGeneratorTemplates.this.naming.getEclipsePluginExecutableExtensionFactory(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory"); @@ -1613,10 +1528,7 @@ public class XtextGeneratorTemplates { TypeReference _eclipsePluginActivator_2 = XtextGeneratorTemplates.this.naming.getEclipsePluginActivator(); _builder.append(_eclipsePluginActivator_2, "\t\t"); _builder.append("."); - Grammar _grammar = langConfig.getGrammar(); - String _name = _grammar.getName(); - String _upperCase = _name.toUpperCase(); - String _replaceAll = _upperCase.replaceAll("\\.", "_"); + String _replaceAll = langConfig.getGrammar().getName().toUpperCase().replaceAll("\\.", "_"); _builder.append(_replaceAll, "\t\t"); _builder.append(");"); _builder.newLineIfNotEmpty(); @@ -1669,15 +1581,11 @@ public class XtextGeneratorTemplates { for(final IXtextGeneratorLanguage lang : langConfigs) { _builder.append("\t"); _builder.append("public static final String "); - Grammar _grammar = lang.getGrammar(); - String _name = _grammar.getName(); - String _upperCase = _name.toUpperCase(); - String _replaceAll = _upperCase.replaceAll("\\.", "_"); + String _replaceAll = lang.getGrammar().getName().toUpperCase().replaceAll("\\.", "_"); _builder.append(_replaceAll, "\t"); _builder.append(" = \""); - Grammar _grammar_1 = lang.getGrammar(); - String _name_1 = _grammar_1.getName(); - _builder.append(_name_1, "\t"); + String _name = lang.getGrammar().getName(); + _builder.append(_name, "\t"); _builder.append("\";"); _builder.newLineIfNotEmpty(); } @@ -1866,10 +1774,7 @@ public class XtextGeneratorTemplates { for(final IXtextGeneratorLanguage lang_1 : langConfigs) { _builder.append("\t\t"); _builder.append("if ("); - Grammar _grammar_2 = lang_1.getGrammar(); - String _name_2 = _grammar_2.getName(); - String _upperCase_1 = _name_2.toUpperCase(); - String _replaceAll_1 = _upperCase_1.replaceAll("\\.", "_"); + String _replaceAll_1 = lang_1.getGrammar().getName().toUpperCase().replaceAll("\\.", "_"); _builder.append(_replaceAll_1, "\t\t"); _builder.append(".equals(grammar)) {"); _builder.newLineIfNotEmpty(); @@ -1902,10 +1807,7 @@ public class XtextGeneratorTemplates { for(final IXtextGeneratorLanguage lang_2 : langConfigs) { _builder.append("\t\t"); _builder.append("if ("); - Grammar _grammar_3 = lang_2.getGrammar(); - String _name_3 = _grammar_3.getName(); - String _upperCase_2 = _name_3.toUpperCase(); - String _replaceAll_2 = _upperCase_2.replaceAll("\\.", "_"); + String _replaceAll_2 = lang_2.getGrammar().getName().toUpperCase().replaceAll("\\.", "_"); _builder.append(_replaceAll_2, "\t\t"); _builder.append(".equals(grammar)) {"); _builder.newLineIfNotEmpty(); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/builder/BuilderIntegrationFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/builder/BuilderIntegrationFragment2.java index d801e41b2..871315870 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/builder/BuilderIntegrationFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/builder/BuilderIntegrationFragment2.java @@ -9,7 +9,6 @@ package org.eclipse.xtext.xtext.generator.builder; import com.google.inject.name.Names; import java.util.Collections; -import java.util.Set; import org.eclipse.xtend2.lib.StringConcatenationClient; import org.eclipse.xtext.resource.IContainer; import org.eclipse.xtext.resource.IResourceDescriptions; @@ -20,12 +19,9 @@ import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider; import org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions; import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; @SuppressWarnings("all") public class BuilderIntegrationFragment2 extends AbstractXtextGeneratorFragment { @@ -33,16 +29,10 @@ public class BuilderIntegrationFragment2 extends AbstractXtextGeneratorFragment public void generate() { this.addRuntimeGuiceBindings(); this.addEclipsePluginGuiceBindings(); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - ManifestAccess _manifest = _eclipsePlugin.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_1.getEclipsePlugin(); - ManifestAccess _manifest_1 = _eclipsePlugin_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); - _requiredBundles.addAll( + this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles().addAll( Collections.unmodifiableList(CollectionLiterals.newArrayList("org.eclipse.xtext.builder", "org.eclipse.xtext.ui"))); } } @@ -74,21 +64,12 @@ public class BuilderIntegrationFragment2 extends AbstractXtextGeneratorFragment } }; final StringConcatenationClient statement2 = _client_1; - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef(IContainer.Manager.class); - TypeReference _typeRef_1 = TypeReference.typeRef(StateBasedContainerManager.class); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeRef, _typeRef_1); - TypeReference _typeRef_2 = TypeReference.typeRef(IAllContainersState.Provider.class); - TypeReference _typeRef_3 = TypeReference.typeRef(ResourceSetBasedAllContainersStateProvider.class); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeRef_2, _typeRef_3); + GuiceModuleAccess.BindingFactory _addConfiguredBinding = new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IContainer.Manager.class), + TypeReference.typeRef(StateBasedContainerManager.class)).addTypeToType(TypeReference.typeRef(IAllContainersState.Provider.class), + TypeReference.typeRef(ResourceSetBasedAllContainersStateProvider.class)).addConfiguredBinding(IResourceDescriptions.class.getSimpleName(), statement1); String _simpleName = IResourceDescriptions.class.getSimpleName(); - GuiceModuleAccess.BindingFactory _addConfiguredBinding = _addTypeToType_1.addConfiguredBinding(_simpleName, statement1); - String _simpleName_1 = IResourceDescriptions.class.getSimpleName(); - String _plus = (_simpleName_1 + "Persisted"); - GuiceModuleAccess.BindingFactory _addConfiguredBinding_1 = _addConfiguredBinding.addConfiguredBinding(_plus, statement2); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language.getRuntimeGenModule(); - _addConfiguredBinding_1.contributeTo(_runtimeGenModule); + String _plus = (_simpleName + "Persisted"); + _addConfiguredBinding.addConfiguredBinding(_plus, statement2).contributeTo(this.getLanguage().getRuntimeGenModule()); } protected void addEclipsePluginGuiceBindings() { @@ -127,21 +108,12 @@ public class BuilderIntegrationFragment2 extends AbstractXtextGeneratorFragment GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); String _simpleName = IResourceDescriptions.class.getSimpleName(); String _plus = (_simpleName + "BuilderScope"); - GuiceModuleAccess.BindingFactory _addConfiguredBinding = _bindingFactory.addConfiguredBinding(_plus, statement1); - TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.editor.IXtextEditorCallback"); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.builder.nature.NatureAddingEditorCallback"); - GuiceModuleAccess.BindingFactory _addTypeToType = _addConfiguredBinding.addTypeToType(_typeRef, _typeRef_1); - TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.generator.IContextualOutputConfigurationProvider"); - TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.builder.EclipseOutputConfigurationProvider"); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeRef_2, _typeRef_3); + GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addConfiguredBinding(_plus, statement1).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.IXtextEditorCallback"), + TypeReference.typeRef("org.eclipse.xtext.builder.nature.NatureAddingEditorCallback")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.generator.IContextualOutputConfigurationProvider"), + TypeReference.typeRef("org.eclipse.xtext.builder.EclipseOutputConfigurationProvider")); String _simpleName_1 = IResourceDescriptions.class.getSimpleName(); String _plus_1 = (_simpleName_1 + "Persisted"); - GuiceModuleAccess.BindingFactory _addConfiguredBinding_1 = _addTypeToType_1.addConfiguredBinding(_plus_1, statement2); - TypeReference _typeRef_4 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.DocumentBasedDirtyResource"); - TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.builder.impl.PersistentDataAwareDirtyResource"); - GuiceModuleAccess.BindingFactory _addTypeToType_2 = _addConfiguredBinding_1.addTypeToType(_typeRef_4, _typeRef_5); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule(); - _addTypeToType_2.contributeTo(_eclipsePluginGenModule); + _addTypeToType.addConfiguredBinding(_plus_1, statement2).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.DocumentBasedDirtyResource"), + TypeReference.typeRef("org.eclipse.xtext.builder.impl.PersistentDataAwareDirtyResource")).contributeTo(this.getLanguage().getEclipsePluginGenModule()); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ecore/EMFGeneratorFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ecore/EMFGeneratorFragment2.java index 38da82a90..e5284710f 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ecore/EMFGeneratorFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ecore/EMFGeneratorFragment2.java @@ -46,7 +46,6 @@ import org.eclipse.emf.common.util.Diagnostic; 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.EClass; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EFactory; import org.eclipse.emf.ecore.EObject; @@ -73,7 +72,6 @@ import org.eclipse.xtend.lib.annotations.AccessorType; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtend2.lib.StringConcatenationClient; -import org.eclipse.xtext.AbstractMetamodelDeclaration; import org.eclipse.xtext.EcoreUtil2; import org.eclipse.xtext.GeneratedMetamodel; import org.eclipse.xtext.Grammar; @@ -90,15 +88,11 @@ import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.StringExtensions; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; import org.eclipse.xtext.xtext.generator.CodeConfig; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; -import org.eclipse.xtext.xtext.generator.model.StandaloneSetupAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.util.GenModelUtil2; @Log @@ -244,9 +238,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { if (this.modelPluginID != null) { _elvis = this.modelPluginID; } else { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - String _name = _runtime.getName(); + String _name = this.getProjectConfig().getRuntime().getName(); _elvis = _name; } return _elvis; @@ -256,19 +248,12 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { if ((this.javaModelDirectory != null)) { return this.javaModelDirectory; } - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen = _runtime.getSrcGen(); - final String srcGenPath = _srcGen.getPath(); - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - IXtextGeneratorFileSystemAccess _root = _runtime_1.getRoot(); - final String rootPath = _root.getPath(); + final String srcGenPath = this.getProjectConfig().getRuntime().getSrcGen().getPath(); + final String rootPath = this.getProjectConfig().getRuntime().getRoot().getPath(); if (((!StringExtensions.isNullOrEmpty(rootPath)) && srcGenPath.startsWith(rootPath))) { String _modelPluginID = this.getModelPluginID(); String _plus = ("/" + _modelPluginID); - int _length = rootPath.length(); - String _substring = srcGenPath.substring(_length); + String _substring = srcGenPath.substring(rootPath.length()); return (_plus + _substring); } throw new RuntimeException( @@ -278,8 +263,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { protected String getModelName(final Grammar grammar) { String _xifexpression = null; if (this.longFileNames) { - String _name = grammar.getName(); - _xifexpression = _name.replace(".", "_"); + _xifexpression = grammar.getName().replace(".", "_"); } else { _xifexpression = GrammarUtil.getSimpleName(grammar); } @@ -289,9 +273,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { protected String getEcoreFilePath(final Grammar grammar) { String _xblockexpression = null; { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - final String ecoreModelFolder = _runtime.getEcoreModelFolder(); + final String ecoreModelFolder = this.getProjectConfig().getRuntime().getEcoreModelFolder(); String _modelPluginID = this.getModelPluginID(); String _plus = ("/" + _modelPluginID); String _plus_1 = (_plus + "/"); @@ -305,8 +287,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { } protected URI getEcoreFileUri(final Grammar grammar) { - String _ecoreFilePath = this.getEcoreFilePath(grammar); - return URI.createPlatformResourceURI(_ecoreFilePath, true); + return URI.createPlatformResourceURI(this.getEcoreFilePath(grammar), true); } protected String getGenModelPath(final Grammar grammar) { @@ -316,9 +297,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { } else { String _xblockexpression = null; { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - final String ecoreModelFolder = _runtime.getEcoreModelFolder(); + final String ecoreModelFolder = this.getProjectConfig().getRuntime().getEcoreModelFolder(); String _modelPluginID = this.getModelPluginID(); String _plus = ("/" + _modelPluginID); String _plus_1 = (_plus + "/"); @@ -334,16 +313,13 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { } protected URI getGenModelUri(final Grammar grammar) { - String _genModelPath = this.getGenModelPath(grammar); - return URI.createPlatformResourceURI(_genModelPath, true); + return URI.createPlatformResourceURI(this.getGenModelPath(grammar), true); } protected String getRelativePath(final String pathInRoot) { String _xblockexpression = null; { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - String _name = _runtime.getName(); + String _name = this.getProjectConfig().getRuntime().getName(); final String projectPath = ("/" + _name); String _xifexpression = null; boolean _startsWith = pathInRoot.startsWith(projectPath); @@ -422,37 +398,29 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { @Override public void initialize(final Injector injector) { super.initialize(injector); - Map _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); - boolean _containsKey = _extensionToFactoryMap.containsKey("genmodel"); + boolean _containsKey = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("genmodel"); boolean _not = (!_containsKey); if (_not) { - Map _extensionToFactoryMap_1 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); + Map _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); EcoreResourceFactoryImpl _ecoreResourceFactoryImpl = new EcoreResourceFactoryImpl(); - _extensionToFactoryMap_1.put("genmodel", _ecoreResourceFactoryImpl); + _extensionToFactoryMap.put("genmodel", _ecoreResourceFactoryImpl); } GenModelPackage.eINSTANCE.getGenAnnotation(); } @Override public void generate() { - Grammar _grammar = this.getGrammar(); - EList _metamodelDeclarations = _grammar.getMetamodelDeclarations(); - Iterable _filter = Iterables.filter(_metamodelDeclarations, GeneratedMetamodel.class); - boolean _isEmpty = IterableExtensions.isEmpty(_filter); + boolean _isEmpty = IterableExtensions.isEmpty(Iterables.filter(this.getGrammar().getMetamodelDeclarations(), GeneratedMetamodel.class)); if (_isEmpty) { return; } try { final Grammar clonedGrammar = this.cloneGrammarIntoNewResourceSet(this.getGrammar()); - Resource _eResource = clonedGrammar.eResource(); - final ResourceSet workingResourceSet = _eResource.getResourceSet(); - EList _metamodelDeclarations_1 = clonedGrammar.getMetamodelDeclarations(); - Iterable _filter_1 = Iterables.filter(_metamodelDeclarations_1, GeneratedMetamodel.class); + final ResourceSet workingResourceSet = clonedGrammar.eResource().getResourceSet(); final Function1 _function = (GeneratedMetamodel it) -> { return it.getEPackage(); }; - Iterable _map = IterableExtensions.map(_filter_1, _function); - final List generatedPackages = IterableExtensions.toList(_map); + final List generatedPackages = IterableExtensions.toList(IterableExtensions.map(Iterables.filter(clonedGrammar.getMetamodelDeclarations(), GeneratedMetamodel.class), _function)); if ((this.genModel != null)) { this.registerUsedGenModel(workingResourceSet.getURIConverter(), clonedGrammar); } @@ -494,8 +462,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { { final GenPackage genPkg = GenModelUtil2.getGenPackage(pkg, genModel.eResource().getResourceSet()); GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - String _qualifiedPackageInterfaceName = genPkg.getQualifiedPackageInterfaceName(); - TypeReference _typeRef = TypeReference.typeRef(_qualifiedPackageInterfaceName); + TypeReference _typeRef = TypeReference.typeRef(genPkg.getQualifiedPackageInterfaceName()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -505,8 +472,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { } }; GuiceModuleAccess.BindingFactory _addTypeToInstance = _bindingFactory.addTypeToInstance(_typeRef, _client); - String _qualifiedFactoryInterfaceName = genPkg.getQualifiedFactoryInterfaceName(); - TypeReference _typeRef_1 = TypeReference.typeRef(_qualifiedFactoryInterfaceName); + TypeReference _typeRef_1 = TypeReference.typeRef(genPkg.getQualifiedFactoryInterfaceName()); StringConcatenationClient _client_1 = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -515,10 +481,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { _builder.append(".eINSTANCE"); } }; - GuiceModuleAccess.BindingFactory _addTypeToInstance_1 = _addTypeToInstance.addTypeToInstance(_typeRef_1, _client_1); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language.getRuntimeGenModule(); - _addTypeToInstance_1.contributeTo(_runtimeGenModule); + _addTypeToInstance.addTypeToInstance(_typeRef_1, _client_1).contributeTo(this.getLanguage().getRuntimeGenModule()); } } } @@ -537,15 +500,10 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { } protected void addProjectContributions(final Grammar grammar, final List generatedPackages, final ResourceSet rs) { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - PluginXmlAccess _pluginXml = _runtime.getPluginXml(); + PluginXmlAccess _pluginXml = this.getProjectConfig().getRuntime().getPluginXml(); boolean _tripleNotEquals = (_pluginXml != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - PluginXmlAccess _pluginXml_1 = _runtime_1.getPluginXml(); - List _entries = _pluginXml_1.getEntries(); + List _entries = this.getProjectConfig().getRuntime().getPluginXml().getEntries(); StringConcatenation _builder = new StringConcatenation(); _builder.append(""); _builder.newLine(); @@ -564,16 +522,14 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { _builder.append("\t"); _builder.append("\t"); _builder.append("class = \""); - GenPackage _genPackage = GenModelUtil2.getGenPackage(pack, rs); - String _qualifiedPackageInterfaceName = _genPackage.getQualifiedPackageInterfaceName(); + String _qualifiedPackageInterfaceName = GenModelUtil2.getGenPackage(pack, rs).getQualifiedPackageInterfaceName(); _builder.append(_qualifiedPackageInterfaceName, "\t\t"); _builder.append("\""); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("\t"); _builder.append("genModel = \""); - String _genModelPath = this.getGenModelPath(grammar); - String _relativePath = this.getRelativePath(_genModelPath); + String _relativePath = this.getRelativePath(this.getGenModelPath(grammar)); _builder.append(_relativePath, "\t\t"); _builder.append("\" />"); _builder.newLineIfNotEmpty(); @@ -583,33 +539,20 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); _entries.add(_builder.toString()); } - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_2 = _projectConfig_2.getRuntime(); - ManifestAccess _manifest = _runtime_2.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest(); boolean _tripleNotEquals_1 = (_manifest != null); if (_tripleNotEquals_1) { - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_3 = _projectConfig_3.getRuntime(); - ManifestAccess _manifest_1 = _runtime_3.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); - CollectionExtensions.addAll(_requiredBundles, "org.eclipse.emf.ecore", "org.eclipse.emf.common"); + CollectionExtensions.addAll(this.getProjectConfig().getRuntime().getManifest().getRequiredBundles(), "org.eclipse.emf.ecore", "org.eclipse.emf.common"); } for (final EPackage pack_1 : generatedPackages) { { final GenPackage genPackage = GenModelUtil2.getGenPackage(pack_1, rs); if (((this.getProjectConfig().getRuntime().getManifest() != null) && (this.modelPluginID == null))) { - IXtextProjectConfig _projectConfig_4 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_4 = _projectConfig_4.getRuntime(); - ManifestAccess _manifest_2 = _runtime_4.getManifest(); - Set _exportedPackages = _manifest_2.getExportedPackages(); - String _interfacePackageName = genPackage.getInterfacePackageName(); - String _classPackageName = genPackage.getClassPackageName(); - String _utilitiesPackageName = genPackage.getUtilitiesPackageName(); - CollectionExtensions.addAll(_exportedPackages, _interfacePackageName, _classPackageName, _utilitiesPackageName); + CollectionExtensions.addAll(this.getProjectConfig().getRuntime().getManifest().getExportedPackages(), + genPackage.getInterfacePackageName(), + genPackage.getClassPackageName(), + genPackage.getUtilitiesPackageName()); } - IXtextGeneratorLanguage _language = this.getLanguage(); - StandaloneSetupAccess _runtimeGenSetup = _language.getRuntimeGenSetup(); - List _registrations = _runtimeGenSetup.getRegistrations(); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -635,7 +578,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); } }; - _registrations.add(_client); + this.getLanguage().getRuntimeGenSetup().getRegistrations().add(_client); } } } @@ -646,12 +589,9 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { private Grammar cloneGrammarIntoNewResourceSet(final Grammar original) { final Resource originalResource = original.eResource(); XtextResourceSet _xtextResourceSet = new XtextResourceSet(); - ResourceSet _resourceSet = originalResource.getResourceSet(); - final XtextResourceSet clonedResourceSet = EcoreUtil2.clone(_xtextResourceSet, _resourceSet); - URI _uRI = originalResource.getURI(); - final Resource clonedResource = clonedResourceSet.getResource(_uRI, false); - EList _contents = clonedResource.getContents(); - EObject _head = IterableExtensions.head(_contents); + final XtextResourceSet clonedResourceSet = EcoreUtil2.clone(_xtextResourceSet, originalResource.getResourceSet()); + final Resource clonedResource = clonedResourceSet.getResource(originalResource.getURI(), false); + EObject _head = IterableExtensions.head(clonedResource.getContents()); return ((Grammar) _head); } @@ -692,8 +632,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { boolean _contains = generatedPackages.contains(referencedPackage); boolean _not = (!_contains); if (_not) { - String _nsURI = referencedPackage.getNsURI(); - result.put(_nsURI, referencedPackage); + result.put(referencedPackage.getNsURI(), referencedPackage); } } } @@ -709,13 +648,10 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { { final Resource resource = GenModelUtil2.getGenModelResource(null, nsURI, resourceSet); if ((resource != null)) { - EList _contents = resource.getContents(); - Iterable _filter = Iterables.filter(_contents, GenModel.class); - final GenModel loadedGenModel = IterableExtensions.head(_filter); + final GenModel loadedGenModel = IterableExtensions.head(Iterables.filter(resource.getContents(), GenModel.class)); if ((loadedGenModel != null)) { final GenPackage genPackage = this.findGenPackageByNsURI(loadedGenModel, nsURI); - EPackage _ecorePackage = genPackage.getEcorePackage(); - result.put(nsURI, _ecorePackage); + result.put(nsURI, genPackage.getEcorePackage()); } } } @@ -729,8 +665,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { { final EPackage ecorePackage = genPackage.getEcorePackage(); if (((ecorePackage == null) || ecorePackage.eIsProxy())) { - Resource _eResource = genModel.eResource(); - URI _uRI = _eResource.getURI(); + URI _uRI = genModel.eResource().getURI(); String _plus = ((("Unresolved proxy: " + ecorePackage) + " in ") + _uRI); throw new RuntimeException(_plus); } @@ -741,8 +676,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { } } } - Resource _eResource = genModel.eResource(); - URI _uRI = _eResource.getURI(); + URI _uRI = genModel.eResource().getURI(); String _plus = ((("No GenPackage for NsURI " + nsURI) + " found in ") + _uRI); throw new RuntimeException(_plus); } @@ -762,14 +696,12 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { EList _eClassifiers = usedEPackage.getEClassifiers(); for (final EClassifier usedClassifier : _eClassifiers) { { - String _name = usedClassifier.getName(); - final EClassifier loadedClassifier = loadedEPackage.getEClassifier(_name); + final EClassifier loadedClassifier = loadedEPackage.getEClassifier(usedClassifier.getName()); if ((loadedClassifier == null)) { - String _name_1 = usedClassifier.getName(); - String _plus = ("Cannot find classifier \'" + _name_1); + String _name = usedClassifier.getName(); + String _plus = ("Cannot find classifier \'" + _name); String _plus_1 = (_plus + "\' in loaded EPackage from "); - Resource _eResource = loadedEPackage.eResource(); - URI _uRI = _eResource.getURI(); + URI _uRI = loadedEPackage.eResource().getURI(); String _plus_2 = (_plus_1 + _uRI); throw new RuntimeException(_plus_2); } @@ -779,13 +711,12 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { EList _eSubpackages = usedEPackage.getESubpackages(); for (final EPackage usedNestedPackage : _eSubpackages) { { - EList _eSubpackages_1 = loadedEPackage.getESubpackages(); final Function1 _function = (EPackage it) -> { String _name = it.getName(); String _name_1 = usedNestedPackage.getName(); return Boolean.valueOf(Objects.equal(_name, _name_1)); }; - final EPackage loadedNestedPackage = IterableExtensions.findFirst(_eSubpackages_1, _function); + final EPackage loadedNestedPackage = IterableExtensions.findFirst(loadedEPackage.getESubpackages(), _function); if ((loadedNestedPackage != null)) { this.putMappingData(result, usedNestedPackage, loadedNestedPackage); } @@ -799,8 +730,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { while (packageContentIterator.hasNext()) { { final EObject current = packageContentIterator.next(); - EClass _eClass = current.eClass(); - EList _eAllStructuralFeatures = _eClass.getEAllStructuralFeatures(); + EList _eAllStructuralFeatures = current.eClass().getEAllStructuralFeatures(); final EStructuralFeature[] crossReferenceFeatures = ((EClassImpl.FeatureSubsetSupplier) _eAllStructuralFeatures).crossReferences(); if ((crossReferenceFeatures != null)) { for (final EStructuralFeature crossReferenceFeature : crossReferenceFeatures) { @@ -814,8 +744,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { for (final EObject value : values) { boolean _containsKey = eNamedElementMapping.containsKey(value); if (_containsKey) { - EObject _get = eNamedElementMapping.get(value); - EcoreUtil.replace(current, reference, value, _get); + EcoreUtil.replace(current, reference, value, eNamedElementMapping.get(value)); } } } else { @@ -823,8 +752,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { final EObject value_1 = ((EObject) _eGet_1); boolean _containsKey_1 = eNamedElementMapping.containsKey(value_1); if (_containsKey_1) { - EObject _get_1 = eNamedElementMapping.get(value_1); - EcoreUtil.replace(current, reference, value_1, _get_1); + EcoreUtil.replace(current, reference, value_1, eNamedElementMapping.get(value_1)); } } } @@ -839,12 +767,10 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { final Resource existing = rs.getResource(ecoreFileUri, false); if ((existing != null)) { existing.unload(); - EList _resources = rs.getResources(); - _resources.remove(existing); + rs.getResources().remove(existing); } final Resource ecoreFile = rs.createResource(ecoreFileUri, ContentHandler.UNSPECIFIED_CONTENT_TYPE); - EList _contents = ecoreFile.getContents(); - _contents.addAll(packs); + ecoreFile.getContents().addAll(packs); return ecoreFile; } @@ -866,17 +792,14 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { final Set referencedEPackages = this.getReferencedEPackages(packs); final List usedGenPackages = this.getGenPackagesForPackages(genModel, referencedEPackages); this.reconcileMissingGenPackagesInUsedModels(usedGenPackages); - EList _usedGenPackages = genModel.getUsedGenPackages(); - _usedGenPackages.addAll(usedGenPackages); + genModel.getUsedGenPackages().addAll(usedGenPackages); this.saveResource(genModel.eResource()); - GenModelHelper _genModelHelper = new GenModelHelper(); - _genModelHelper.registerGenModel(genModel); + new GenModelHelper().registerGenModel(genModel); return genModel; } private void reconcileMissingGenPackagesInUsedModels(final List usedGenPackages) { - int _size = usedGenPackages.size(); - final HashSet processedModels = Sets.newHashSetWithExpectedSize(_size); + final HashSet processedModels = Sets.newHashSetWithExpectedSize(usedGenPackages.size()); for (final GenPackage usedGenPackage : usedGenPackages) { { final GenModel genModel = usedGenPackage.getGenModel(); @@ -884,8 +807,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { if (_add) { final List missingPackages = genModel.getMissingPackages(); final List missingGenPackages = this.getGenPackagesForPackages(genModel, missingPackages); - EList _usedGenPackages = genModel.getUsedGenPackages(); - _usedGenPackages.addAll(missingGenPackages); + genModel.getUsedGenPackages().addAll(missingGenPackages); } } } @@ -897,23 +819,19 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { final Resource resource = rs.getResource(genModelUri, false); if ((resource != null)) { resource.unload(); - EList _resources = rs.getResources(); - _resources.remove(resource); + rs.getResources().remove(resource); } final Resource genModelFile = rs.createResource(genModelUri, ContentHandler.UNSPECIFIED_CONTENT_TYPE); GenModel genModel = null; - URIConverter _uRIConverter = rs.getURIConverter(); - boolean _exists = _uRIConverter.exists(genModelUri, null); + boolean _exists = rs.getURIConverter().exists(genModelUri, null); if (_exists) { genModelFile.load(null); boolean _hasFragment = genModelUri.hasFragment(); if (_hasFragment) { - String _fragment = genModelUri.fragment(); - EObject _eObject = genModelFile.getEObject(_fragment); + EObject _eObject = genModelFile.getEObject(genModelUri.fragment()); genModel = ((GenModel) _eObject); } else { - EList _contents = genModelFile.getContents(); - EObject _head = IterableExtensions.head(_contents); + EObject _head = IterableExtensions.head(genModelFile.getContents()); genModel = ((GenModel) _head); } } else { @@ -955,8 +873,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { genModel.setCopyrightText(EMFGeneratorFragment2.trimMultiLineComment(this.codeConfig.getFileHeader())); } } - EList _contents_1 = genModelFile.getContents(); - _contents_1.add(genModel); + genModelFile.getContents().add(genModel); return genModel; } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -964,10 +881,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { } public static String trimMultiLineComment(final String string) { - String _replace = string.replace("*/", ""); - String _replace_1 = _replace.replace("/*", ""); - String _replace_2 = _replace_1.replace(" * ", ""); - return _replace_2.trim(); + return string.replace("*/", "").replace("/*", "").replace(" * ", "").trim(); } protected Set getReferencedEPackages(final List packs) { @@ -1007,7 +921,6 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { protected List getGenPackagesForPackages(final GenModel existingGenModel, final Collection packs) { final ArrayList result = CollectionLiterals.newArrayList(); for (final EPackage pkg : packs) { - EList _genPackages = existingGenModel.getGenPackages(); final Function1 _function = (GenPackage it) -> { EPackage _ecorePackage = it.getEcorePackage(); String _nsURI = null; @@ -1017,19 +930,14 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { String _nsURI_1 = pkg.getNsURI(); return Boolean.valueOf(Objects.equal(_nsURI, _nsURI_1)); }; - boolean _exists = IterableExtensions.exists(_genPackages, _function); + boolean _exists = IterableExtensions.exists(existingGenModel.getGenPackages(), _function); boolean _not = (!_exists); if (_not) { - GenPackage _genPackage = GenModelUtil2.getGenPackage(pkg, existingGenModel.eResource().getResourceSet()); - result.add(_genPackage); + result.add(GenModelUtil2.getGenPackage(pkg, existingGenModel.eResource().getResourceSet())); } } final Comparator _function_1 = (GenPackage o1, GenPackage o2) -> { - URI _uRI = EcoreUtil.getURI(o1); - String _string = _uRI.toString(); - URI _uRI_1 = EcoreUtil.getURI(o2); - String _string_1 = _uRI_1.toString(); - return _string.compareTo(_string_1); + return EcoreUtil.getURI(o1).toString().compareTo(EcoreUtil.getURI(o2).toString()); }; Collections.sort(result, _function_1); return result; @@ -1044,16 +952,14 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { boolean _isPlatform = uri.isPlatform(); boolean _not = (!_isPlatform); if (_not) { - Map _platformResourceMap = EcorePlugin.getPlatformResourceMap(); - Set> _entrySet = _platformResourceMap.entrySet(); + Set> _entrySet = EcorePlugin.getPlatformResourceMap().entrySet(); for (final Map.Entry entry : _entrySet) { { String _key = entry.getKey(); String _plus = ("platform:/resource/" + _key); String _plus_1 = (_plus + "/"); final URI newPrefix = URI.createURI(_plus_1); - URI _value = entry.getValue(); - final URI uri2 = uri.replacePrefix(_value, newPrefix); + final URI uri2 = uri.replacePrefix(entry.getValue(), newPrefix); if ((uri2 != null)) { return super.deresolve(uri2); } @@ -1063,8 +969,7 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { return super.deresolve(uri); } }); - String _lineDelimiter = this.codeConfig.getLineDelimiter(); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, _lineDelimiter); + saveOptions.put(Resource.OPTION_LINE_DELIMITER, this.codeConfig.getLineDelimiter()); resource.save(saveOptions); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -1121,19 +1026,14 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { if ((((!this.updateBuildProperties) || (this.modelPluginID != null)) || (this.getProjectConfig().getRuntime().getManifest() == null))) { return; } - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - final IXtextGeneratorFileSystemAccess rootOutlet = _runtime.getRoot(); + final IXtextGeneratorFileSystemAccess rootOutlet = this.getProjectConfig().getRuntime().getRoot(); String _path = rootOutlet.getPath(); final String buildPropertiesPath = (_path + "/build.properties"); - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - final String modelContainer = _runtime_1.getEcoreModelFolder(); + final String modelContainer = this.getProjectConfig().getRuntime().getEcoreModelFolder(); final Properties buildProperties = new Properties(); File _file = new File(buildPropertiesPath); FileInputStream _fileInputStream = new FileInputStream(_file); - String _encoding = this.codeConfig.getEncoding(); - Charset _forName = Charset.forName(_encoding); + Charset _forName = Charset.forName(this.codeConfig.getEncoding()); final InputStreamReader reader = new InputStreamReader(_fileInputStream, _forName); try { String existingContent = CharStreams.toString(reader); @@ -1152,16 +1052,17 @@ public class EMFGeneratorFragment2 extends AbstractXtextGeneratorFragment { boolean _contains = binIncludes.contains(modelContainer); boolean _not = (!_contains); if (_not) { - existingContent = existingContent.replace("bin.includes = ", - (((("bin.includes = " + modelContainer) + "/,\\") + Strings.newLine()) + " ")); + String _newLine_1 = Strings.newLine(); + String _plus_2 = ((("bin.includes = " + modelContainer) + "/,\\") + _newLine_1); + String _plus_3 = (_plus_2 + " "); + existingContent = existingContent.replace("bin.includes = ", _plus_3); changed = true; } } if (changed) { File _file_1 = new File(buildPropertiesPath); FileOutputStream _fileOutputStream = new FileOutputStream(_file_1); - String _encoding_1 = this.codeConfig.getEncoding(); - Charset _forName_1 = Charset.forName(_encoding_1); + Charset _forName_1 = Charset.forName(this.codeConfig.getEncoding()); final OutputStreamWriter writer = new OutputStreamWriter(_fileOutputStream, _forName_1); writer.write(existingContent); writer.close(); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ecore2xtext/Ecore2XtextValueConverterServiceFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ecore2xtext/Ecore2XtextValueConverterServiceFragment2.java index 83c442203..0cb584180 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ecore2xtext/Ecore2XtextValueConverterServiceFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ecore2xtext/Ecore2XtextValueConverterServiceFragment2.java @@ -10,7 +10,6 @@ package org.eclipse.xtext.xtext.generator.ecore2xtext; import org.eclipse.xtext.common.services.Ecore2XtextTerminalConverters; import org.eclipse.xtext.conversion.IValueConverterService; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; @@ -23,12 +22,6 @@ import org.eclipse.xtext.xtext.generator.model.TypeReference; public class Ecore2XtextValueConverterServiceFragment2 extends AbstractXtextGeneratorFragment { @Override public void generate() { - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef(IValueConverterService.class); - TypeReference _typeRef_1 = TypeReference.typeRef(Ecore2XtextTerminalConverters.class); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeRef, _typeRef_1); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language.getRuntimeGenModule(); - _addTypeToType.contributeTo(_runtimeGenModule); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IValueConverterService.class), TypeReference.typeRef(Ecore2XtextTerminalConverters.class)).contributeTo(this.getLanguage().getRuntimeGenModule()); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/exporting/QualifiedNamesFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/exporting/QualifiedNamesFragment2.java index fa5f48478..a2093cfbd 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/exporting/QualifiedNamesFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/exporting/QualifiedNamesFragment2.java @@ -10,7 +10,6 @@ package org.eclipse.xtext.xtext.generator.exporting; import org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider; import org.eclipse.xtext.naming.IQualifiedNameProvider; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; @@ -18,29 +17,11 @@ import org.eclipse.xtext.xtext.generator.model.TypeReference; public class QualifiedNamesFragment2 extends AbstractXtextGeneratorFragment { @Override public void generate() { - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef(IQualifiedNameProvider.class); - TypeReference _typeRef_1 = TypeReference.typeRef(DefaultDeclarativeQualifiedNameProvider.class); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeRef, _typeRef_1); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language.getRuntimeGenModule(); - _addTypeToType.contributeTo(_runtimeGenModule); - GuiceModuleAccess.BindingFactory _bindingFactory_1 = new GuiceModuleAccess.BindingFactory(); - 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); - TypeReference _typeRef_4 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator"); - TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultDependentElementsCalculator"); - GuiceModuleAccess.BindingFactory _addTypeToType_2 = _addTypeToType_1.addTypeToType(_typeRef_4, _typeRef_5); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language_1.getEclipsePluginGenModule(); - _addTypeToType_2.contributeTo(_eclipsePluginGenModule); - GuiceModuleAccess.BindingFactory _bindingFactory_2 = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef_6 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.IPrefixMatcher"); - TypeReference _typeRef_7 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.FQNPrefixMatcher"); - GuiceModuleAccess.BindingFactory _addTypeToType_3 = _bindingFactory_2.addTypeToType(_typeRef_6, _typeRef_7); - IXtextGeneratorLanguage _language_2 = this.getLanguage(); - GuiceModuleAccess _ideGenModule = _language_2.getIdeGenModule(); - _addTypeToType_3.contributeTo(_ideGenModule); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IQualifiedNameProvider.class), TypeReference.typeRef(DefaultDeclarativeQualifiedNameProvider.class)).contributeTo(this.getLanguage().getRuntimeGenModule()); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.PrefixMatcher"), + TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.FQNPrefixMatcher")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator"), + TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultDependentElementsCalculator")).contributeTo(this.getLanguage().getEclipsePluginGenModule()); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.IPrefixMatcher"), + TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.FQNPrefixMatcher")).contributeTo(this.getLanguage().getIdeGenModule()); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/exporting/SimpleNamesFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/exporting/SimpleNamesFragment2.java index 03e9514f1..90831fd0f 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/exporting/SimpleNamesFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/exporting/SimpleNamesFragment2.java @@ -10,7 +10,6 @@ package org.eclipse.xtext.xtext.generator.exporting; import org.eclipse.xtext.naming.IQualifiedNameProvider; import org.eclipse.xtext.naming.SimpleNameProvider; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; @@ -18,19 +17,8 @@ import org.eclipse.xtext.xtext.generator.model.TypeReference; public class SimpleNamesFragment2 extends AbstractXtextGeneratorFragment { @Override public void generate() { - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef(IQualifiedNameProvider.class); - TypeReference _typeRef_1 = TypeReference.typeRef(SimpleNameProvider.class); - GuiceModuleAccess.BindingFactory _addfinalTypeToType = _bindingFactory.addfinalTypeToType(_typeRef, _typeRef_1); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language.getRuntimeGenModule(); - _addfinalTypeToType.contributeTo(_runtimeGenModule); - GuiceModuleAccess.BindingFactory _bindingFactory_1 = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator"); - TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultDependentElementsCalculator"); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory_1.addTypeToType(_typeRef_2, _typeRef_3); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language_1.getEclipsePluginGenModule(); - _addTypeToType.contributeTo(_eclipsePluginGenModule); + new GuiceModuleAccess.BindingFactory().addfinalTypeToType(TypeReference.typeRef(IQualifiedNameProvider.class), TypeReference.typeRef(SimpleNameProvider.class)).contributeTo(this.getLanguage().getRuntimeGenModule()); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator"), + TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultDependentElementsCalculator")).contributeTo(this.getLanguage().getEclipsePluginGenModule()); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/formatting/Formatter2Fragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/formatting/Formatter2Fragment2.java index 32ecd9282..ccde0884d 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/formatting/Formatter2Fragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/formatting/Formatter2Fragment2.java @@ -14,20 +14,17 @@ import java.util.Collection; import java.util.List; import java.util.Set; import org.apache.log4j.Logger; -import org.eclipse.emf.codegen.ecore.genmodel.GenFeature; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.ENamedElement; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.xtend2.lib.StringConcatenationClient; import org.eclipse.xtext.Action; import org.eclipse.xtext.Assignment; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; -import org.eclipse.xtext.TypeRef; import org.eclipse.xtext.formatting2.AbstractFormatter2; import org.eclipse.xtext.formatting2.FormatterPreferenceValuesProvider; import org.eclipse.xtext.formatting2.FormatterPreferences; @@ -41,17 +38,13 @@ import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.StringExtensions; import org.eclipse.xtext.xtext.generator.AbstractStubGeneratingFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessExtensions; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.model.XtendFileAccess; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.util.GenModelUtil2; import org.eclipse.xtext.xtext.generator.util.GrammarUtil2; @@ -98,35 +91,14 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { } }; final StringConcatenationClient statement = _client; - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef(IFormatter2.class); - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - TypeReference _formatter2Stub = this.getFormatter2Stub(_grammar); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeRef, _formatter2Stub); - String _simpleName = FormatterPreferences.class.getSimpleName(); - GuiceModuleAccess.BindingFactory _addConfiguredBinding = _addTypeToType.addConfiguredBinding(_simpleName, statement); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language_1.getRuntimeGenModule(); - _addConfiguredBinding.contributeTo(_runtimeGenModule); - GuiceModuleAccess.BindingFactory _bindingFactory_1 = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.formatting.IContentFormatterFactory"); - TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.formatting2.ContentFormatterFactory"); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _bindingFactory_1.addTypeToType(_typeRef_1, _typeRef_2); - IXtextGeneratorLanguage _language_2 = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language_2.getEclipsePluginGenModule(); - _addTypeToType_1.contributeTo(_eclipsePluginGenModule); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - ManifestAccess _manifest = _runtime.getManifest(); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IFormatter2.class), this.getFormatter2Stub(this.getLanguage().getGrammar())).addConfiguredBinding(FormatterPreferences.class.getSimpleName(), statement).contributeTo(this.getLanguage().getRuntimeGenModule()); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.formatting.IContentFormatterFactory"), + TypeReference.typeRef("org.eclipse.xtext.ui.editor.formatting2.ContentFormatterFactory")).contributeTo(this.getLanguage().getEclipsePluginGenModule()); + ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - ManifestAccess _manifest_1 = _runtime_1.getManifest(); - Set _exportedPackages = _manifest_1.getExportedPackages(); - Grammar _grammar_1 = this.getGrammar(); - String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(_grammar_1); + Set _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages(); + String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar()); String _plus = (_runtimeBasePackage + ".formatting2"); _exportedPackages.add(_plus); } @@ -141,9 +113,7 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { } boolean _isGenerateXtendStub = this.isGenerateXtendStub(); if (_isGenerateXtendStub) { - Grammar _grammar = this.getGrammar(); - TypeReference _formatter2Stub = this.getFormatter2Stub(_grammar); - final XtendFileAccess xtendFile = this.fileAccessFactory.createXtendFile(_formatter2Stub); + final XtendFileAccess xtendFile = this.fileAccessFactory.createXtendFile(this.getFormatter2Stub(this.getGrammar())); xtendFile.setResourceSet(this.getLanguage().getResourceSet()); final LinkedHashMultimap type2ref = LinkedHashMultimap.create(); this.getLocallyAssignedContainmentReferences(this.getLanguage().getGrammar(), type2ref); @@ -154,9 +124,7 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("class "); - Grammar _grammar = Formatter2Fragment2.this.getGrammar(); - TypeReference _formatter2Stub = Formatter2Fragment2.this.getFormatter2Stub(_grammar); - String _simpleName = _formatter2Stub.getSimpleName(); + String _simpleName = Formatter2Fragment2.this.getFormatter2Stub(Formatter2Fragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _stubSuperClass = Formatter2Fragment2.this.getStubSuperClass(); @@ -169,8 +137,7 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { _builder.append("@"); _builder.append(Inject.class, "\t"); _builder.append(" extension "); - Grammar _grammar_1 = Formatter2Fragment2.this.getGrammar(); - TypeReference _grammarAccess = Formatter2Fragment2.this._grammarAccessExtensions.getGrammarAccess(_grammar_1); + TypeReference _grammarAccess = Formatter2Fragment2.this._grammarAccessExtensions.getGrammarAccess(Formatter2Fragment2.this.getGrammar()); _builder.append(_grammarAccess, "\t"); _builder.newLineIfNotEmpty(); { @@ -178,9 +145,7 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { for(final EClass type : _take) { _builder.newLine(); _builder.append("\t"); - Set _get = type2ref.get(type); - boolean _containsKey = inheritedTypes.containsKey(type); - StringConcatenationClient _generateFormatMethod = Formatter2Fragment2.this.generateFormatMethod(type, _get, _containsKey); + StringConcatenationClient _generateFormatMethod = Formatter2Fragment2.this.generateFormatMethod(type, type2ref.get(type), inheritedTypes.containsKey(type)); _builder.append(_generateFormatMethod, "\t"); _builder.newLineIfNotEmpty(); } @@ -189,12 +154,10 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("// TODO: implement for "); - Iterable _drop = IterableExtensions.drop(types, 2); final Function1 _function = (EClass it) -> { return it.getName(); }; - Iterable _map = IterableExtensions.map(_drop, _function); - String _join = IterableExtensions.join(_map, ", "); + String _join = IterableExtensions.join(IterableExtensions.map(IterableExtensions.drop(types, 2), _function), ", "); _builder.append(_join, "\t"); _builder.newLineIfNotEmpty(); _builder.append("}"); @@ -202,13 +165,9 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { } }; xtendFile.setContent(_client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - xtendFile.writeTo(_src); + xtendFile.writeTo(this.getProjectConfig().getRuntime().getSrc()); } else { - Class _class = this.getClass(); - String _name = _class.getName(); + String _name = this.getClass().getName(); String _plus = (_name + " has been configured to generate a Java stub, but that\'s not yet supported. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=481563"); Formatter2Fragment2.LOG.error(_plus); } @@ -292,8 +251,7 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { { final EClassifier type = GrammarUtil.findCurrentType(assignment); if ((type instanceof EClass)) { - String _feature = assignment.getFeature(); - final EStructuralFeature feature = ((EClass)type).getEStructuralFeature(_feature); + final EStructuralFeature feature = ((EClass)type).getEStructuralFeature(assignment.getFeature()); if (((feature instanceof EReference) && ((EReference) feature).isContainment())) { type2ref.put(((EClass)type), ((EReference) feature)); } @@ -305,8 +263,7 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { { final String featureName = action.getFeature(); if ((featureName != null)) { - TypeRef _type = action.getType(); - final EClassifier type = _type.getClassifier(); + final EClassifier type = action.getType().getClassifier(); if ((type instanceof EClass)) { final EStructuralFeature feature = ((EClass)type).getEStructuralFeature(featureName); if (((feature instanceof EReference) && ((EReference) feature).isContainment())) { @@ -332,9 +289,7 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { } protected TypeReference getStubSuperClass() { - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - final Grammar superGrammar = GrammarUtil2.getNonTerminalsSuperGrammar(_grammar); + final Grammar superGrammar = GrammarUtil2.getNonTerminalsSuperGrammar(this.getLanguage().getGrammar()); if ((superGrammar != null)) { return this.getFormatter2Stub(superGrammar); } else { @@ -346,11 +301,9 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { String _xblockexpression = null; { if ((element instanceof EReference)) { - EClass _eReferenceType = ((EReference)element).getEReferenceType(); - return this.toVarName(_eReferenceType); + return this.toVarName(((EReference)element).getEReferenceType()); } - String _name = element.getName(); - final String name = StringExtensions.toFirstLower(_name); + final String name = StringExtensions.toFirstLower(element.getName()); String _xifexpression = null; boolean _contains = XtendFileAccess.XTEND_KEYWORDS.contains(name); if (_contains) { @@ -364,10 +317,7 @@ public class Formatter2Fragment2 extends AbstractStubGeneratingFragment { } protected String getGetAccessor(final EStructuralFeature feature) { - IXtextGeneratorLanguage _language = this.getLanguage(); - ResourceSet _resourceSet = _language.getResourceSet(); - GenFeature _genFeature = GenModelUtil2.getGenFeature(feature, _resourceSet); - return _genFeature.getGetAccessor(); + return GenModelUtil2.getGenFeature(feature, this.getLanguage().getResourceSet()).getGetAccessor(); } private final static Logger LOG = Logger.getLogger(Formatter2Fragment2.class); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/generator/GeneratorFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/generator/GeneratorFragment2.java index 1f350148e..045338ce4 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/generator/GeneratorFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/generator/GeneratorFragment2.java @@ -37,21 +37,13 @@ import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xtext.generator.AbstractStubGeneratingFragment; import org.eclipse.xtext.xtext.generator.CodeConfig; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.Issues; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; -import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; -import org.eclipse.xtext.xtext.generator.model.TextFileAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.XtendFileAccess; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.xbase.XbaseUsageDetector; @SuppressWarnings("all") @@ -106,8 +98,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { } protected TypeReference getJavaMain(final Grammar grammar) { - TypeReference _generatorStub = this.getGeneratorStub(grammar); - String _packageName = _generatorStub.getPackageName(); + String _packageName = this.getGeneratorStub(grammar).getPackageName(); String _plus = (_packageName + ".Main"); return new TypeReference(_plus); } @@ -125,24 +116,11 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { public void generate() { boolean _isGenerateStub = this.isGenerateStub(); if (_isGenerateStub) { - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef(IGenerator2.class); - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - TypeReference _generatorStub = this.getGeneratorStub(_grammar); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeRef, _generatorStub); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language_1.getRuntimeGenModule(); - _addTypeToType.contributeTo(_runtimeGenModule); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - ManifestAccess _manifest = _runtime.getManifest(); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IGenerator2.class), this.getGeneratorStub(this.getLanguage().getGrammar())).contributeTo(this.getLanguage().getRuntimeGenModule()); + ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - ManifestAccess _manifest_1 = _runtime_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); + Set _requiredBundles = this.getProjectConfig().getRuntime().getManifest().getRequiredBundles(); _requiredBundles.add("org.eclipse.xtext.xbase.lib"); } boolean _isGenerateXtendStub = this.isGenerateXtendStub(); @@ -153,19 +131,11 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { } } if ((this.isGenerateStub() || this.isGenerateJavaMain())) { - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_2 = _projectConfig_2.getRuntime(); - ManifestAccess _manifest_2 = _runtime_2.getManifest(); - boolean _tripleNotEquals_1 = (_manifest_2 != null); + ManifestAccess _manifest_1 = this.getProjectConfig().getRuntime().getManifest(); + boolean _tripleNotEquals_1 = (_manifest_1 != null); if (_tripleNotEquals_1) { - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_3 = _projectConfig_3.getRuntime(); - ManifestAccess _manifest_3 = _runtime_3.getManifest(); - Set _exportedPackages = _manifest_3.getExportedPackages(); - IXtextGeneratorLanguage _language_2 = this.getLanguage(); - Grammar _grammar_1 = _language_2.getGrammar(); - TypeReference _generatorStub_1 = this.getGeneratorStub(_grammar_1); - String _packageName = _generatorStub_1.getPackageName(); + Set _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages(); + String _packageName = this.getGeneratorStub(this.getLanguage().getGrammar()).getPackageName(); _exportedPackages.add(_packageName); } } @@ -182,20 +152,13 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { this.doGenerateMweFile(); } this.contributeEclipsePluginGuiceBindings(); - IXtextProjectConfig _projectConfig_4 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig_4.getEclipsePlugin(); - ManifestAccess _manifest_4 = _eclipsePlugin.getManifest(); - boolean _tripleNotEquals_2 = (_manifest_4 != null); + ManifestAccess _manifest_2 = this.getProjectConfig().getEclipsePlugin().getManifest(); + boolean _tripleNotEquals_2 = (_manifest_2 != null); if (_tripleNotEquals_2) { - IXtextProjectConfig _projectConfig_5 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_5.getEclipsePlugin(); - ManifestAccess _manifest_5 = _eclipsePlugin_1.getManifest(); - Set _requiredBundles_1 = _manifest_5.getRequiredBundles(); + Set _requiredBundles_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); _requiredBundles_1.add("org.eclipse.xtext.builder"); } - IXtextProjectConfig _projectConfig_6 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_2 = _projectConfig_6.getEclipsePlugin(); - PluginXmlAccess _pluginXml = _eclipsePlugin_2.getPluginXml(); + PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml(); boolean _tripleNotEquals_3 = (_pluginXml != null); if (_tripleNotEquals_3) { this.contributeEclipsePluginExtensions(); @@ -234,21 +197,12 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { } }; final StringConcatenationClient statement = _client_1; - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.builder.IXtextBuilderParticipant"); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.builder.BuilderParticipant"); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeRef, _typeRef_1); - TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.core.resources.IWorkspaceRoot"); - GuiceModuleAccess.BindingFactory _addTypeToInstance = _addTypeToType.addTypeToInstance(_typeRef_2, expression); - GuiceModuleAccess.BindingFactory _addConfiguredBinding = _addTypeToInstance.addConfiguredBinding("BuilderPreferenceStoreInitializer", statement); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule(); - _addConfiguredBinding.contributeTo(_eclipsePluginGenModule); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.builder.IXtextBuilderParticipant"), + TypeReference.typeRef("org.eclipse.xtext.builder.BuilderParticipant")).addTypeToInstance(TypeReference.typeRef("org.eclipse.core.resources.IWorkspaceRoot"), expression).addConfiguredBinding("BuilderPreferenceStoreInitializer", statement).contributeTo(this.getLanguage().getEclipsePluginGenModule()); } protected void doGenerateXtendStubFile() { - Grammar _grammar = this.getGrammar(); - TypeReference _generatorStub = this.getGeneratorStub(_grammar); + TypeReference _generatorStub = this.getGeneratorStub(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -267,10 +221,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - IXtextGeneratorLanguage _language = GeneratorFragment2.this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - TypeReference _generatorStub = GeneratorFragment2.this.getGeneratorStub(_grammar); - String _simpleName = _generatorStub.getSimpleName(); + String _simpleName = GeneratorFragment2.this.getGeneratorStub(GeneratorFragment2.this.getLanguage().getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(AbstractGenerator.class); @@ -303,16 +254,11 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_generatorStub, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_generatorStub, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } protected void doGenerateJavaStubFile() { - Grammar _grammar = this.getGrammar(); - TypeReference _generatorStub = this.getGeneratorStub(_grammar); + TypeReference _generatorStub = this.getGeneratorStub(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -331,10 +277,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - IXtextGeneratorLanguage _language = GeneratorFragment2.this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - TypeReference _generatorStub = GeneratorFragment2.this.getGeneratorStub(_grammar); - String _simpleName = _generatorStub.getSimpleName(); + String _simpleName = GeneratorFragment2.this.getGeneratorStub(GeneratorFragment2.this.getLanguage().getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(AbstractGenerator.class); @@ -380,16 +323,11 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - JavaFileAccess _createJavaFile = this.fileAccessFactory.createJavaFile(_generatorStub, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createJavaFile.writeTo(_src); + this.fileAccessFactory.createJavaFile(_generatorStub, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } protected void doGenerateJavaMain() { - Grammar _grammar = this.getGrammar(); - TypeReference _javaMain = this.getJavaMain(_grammar); + TypeReference _javaMain = this.getJavaMain(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -414,8 +352,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.append("\t\t"); _builder.append(Injector.class, "\t\t"); _builder.append(" injector = new "); - Grammar _grammar = GeneratorFragment2.this.getGrammar(); - TypeReference _runtimeSetup = GeneratorFragment2.this._xtextGeneratorNaming.getRuntimeSetup(_grammar); + TypeReference _runtimeSetup = GeneratorFragment2.this._xtextGeneratorNaming.getRuntimeSetup(GeneratorFragment2.this.getGrammar()); _builder.append(_runtimeSetup, "\t\t"); _builder.append("().createInjectorAndDoEMFRegistration();"); _builder.newLineIfNotEmpty(); @@ -554,16 +491,11 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - JavaFileAccess _createJavaFile = this.fileAccessFactory.createJavaFile(_javaMain, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createJavaFile.writeTo(_src); + this.fileAccessFactory.createJavaFile(_javaMain, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } protected void doGenerateXtendMain() { - Grammar _grammar = this.getGrammar(); - TypeReference _javaMain = this.getJavaMain(_grammar); + TypeReference _javaMain = this.getJavaMain(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -587,8 +519,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("val injector = new "); - Grammar _grammar = GeneratorFragment2.this.getGrammar(); - TypeReference _runtimeSetup = GeneratorFragment2.this._xtextGeneratorNaming.getRuntimeSetup(_grammar); + TypeReference _runtimeSetup = GeneratorFragment2.this._xtextGeneratorNaming.getRuntimeSetup(GeneratorFragment2.this.getGrammar()); _builder.append(_runtimeSetup, "\t\t"); _builder.append("().createInjectorAndDoEMFRegistration"); _builder.newLineIfNotEmpty(); @@ -706,18 +637,11 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_javaMain, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_javaMain, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } protected void doGenerateMweFile() { - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - TypeReference _generatorStub = this.getGeneratorStub(_grammar); - String _path = _generatorStub.getPath(); + String _path = this.getGeneratorStub(this.getLanguage().getGrammar()).getPath(); String _plus = (_path + "MWE.mwe2"); StringConcatenationClient _client = new StringConcatenationClient() { @Override @@ -726,10 +650,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.append(_fileHeader); _builder.newLineIfNotEmpty(); _builder.append("module "); - IXtextGeneratorLanguage _language = GeneratorFragment2.this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - TypeReference _generatorStub = GeneratorFragment2.this.getGeneratorStub(_grammar); - String _name = _generatorStub.getName(); + String _name = GeneratorFragment2.this.getGeneratorStub(GeneratorFragment2.this.getLanguage().getGrammar()).getName(); _builder.append(_name); _builder.append("MWE"); _builder.newLineIfNotEmpty(); @@ -737,9 +658,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.append("import org.eclipse.emf.mwe.utils.*"); _builder.newLine(); _builder.append("import "); - Grammar _grammar_1 = GeneratorFragment2.this.getGrammar(); - TypeReference _runtimeSetup = GeneratorFragment2.this._xtextGeneratorNaming.getRuntimeSetup(_grammar_1); - String _packageName = _runtimeSetup.getPackageName(); + String _packageName = GeneratorFragment2.this._xtextGeneratorNaming.getRuntimeSetup(GeneratorFragment2.this.getGrammar()).getPackageName(); _builder.append(_packageName); _builder.append(".*"); _builder.newLineIfNotEmpty(); @@ -774,9 +693,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("register = "); - Grammar _grammar_2 = GeneratorFragment2.this.getGrammar(); - TypeReference _runtimeSetup_1 = GeneratorFragment2.this._xtextGeneratorNaming.getRuntimeSetup(_grammar_2); - String _simpleName = _runtimeSetup_1.getSimpleName(); + String _simpleName = GeneratorFragment2.this._xtextGeneratorNaming.getRuntimeSetup(GeneratorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName, "\t\t"); _builder.append(" {}"); _builder.newLineIfNotEmpty(); @@ -798,9 +715,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("register = "); - Grammar _grammar_3 = GeneratorFragment2.this.getGrammar(); - TypeReference _runtimeSetup_2 = GeneratorFragment2.this._xtextGeneratorNaming.getRuntimeSetup(_grammar_3); - String _simpleName_1 = _runtimeSetup_2.getSimpleName(); + String _simpleName_1 = GeneratorFragment2.this._xtextGeneratorNaming.getRuntimeSetup(GeneratorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName_1, "\t\t"); _builder.append(" {}"); _builder.newLineIfNotEmpty(); @@ -823,23 +738,14 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - TextFileAccess _createTextFile = this.fileAccessFactory.createTextFile(_plus, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createTextFile.writeTo(_src); + this.fileAccessFactory.createTextFile(_plus, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } protected boolean contributeEclipsePluginExtensions() { boolean _xblockexpression = false; { - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - final String name = _grammar.getName(); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - PluginXmlAccess _pluginXml = _eclipsePlugin.getPluginXml(); - List _entries = _pluginXml.getEntries(); + final String name = this.getLanguage().getGrammar().getName(); + List _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); StringConcatenation _builder = new StringConcatenation(); _builder.append(""); _builder.newLine(); @@ -848,16 +754,13 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("class=\""); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(_grammar_1); + TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar()); _builder.append(_eclipsePluginExecutableExtensionFactory, "\t\t"); _builder.append(":org.eclipse.xtext.builder.IXtextBuilderParticipant\""); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("fileExtensions=\""); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - List _fileExtensions = _language_1.getFileExtensions(); - String _join = IterableExtensions.join(_fileExtensions, ","); + String _join = IterableExtensions.join(this.getLanguage().getFileExtensions(), ","); _builder.append(_join, "\t\t"); _builder.append("\"/>"); _builder.newLineIfNotEmpty(); @@ -875,8 +778,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("class=\""); - Grammar _grammar_2 = this.getGrammar(); - TypeReference _eclipsePluginExecutableExtensionFactory_1 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(_grammar_2); + TypeReference _eclipsePluginExecutableExtensionFactory_1 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar()); _builder.append(_eclipsePluginExecutableExtensionFactory_1, "\t\t"); _builder.append(":org.eclipse.xtext.builder.preferences.BuilderPreferencePage\""); _builder.newLineIfNotEmpty(); @@ -890,13 +792,9 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append(""); @@ -918,8 +816,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("class=\""); - Grammar _grammar_5 = this.getGrammar(); - TypeReference _eclipsePluginExecutableExtensionFactory_2 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(_grammar_5); + TypeReference _eclipsePluginExecutableExtensionFactory_2 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar()); _builder.append(_eclipsePluginExecutableExtensionFactory_2, "\t\t"); _builder.append(":org.eclipse.xtext.builder.preferences.BuilderPreferencePage\""); _builder.newLineIfNotEmpty(); @@ -933,13 +830,9 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append(""); @@ -1006,8 +899,7 @@ public class GeneratorFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("class=\""); - Grammar _grammar_8 = this.getGrammar(); - TypeReference _eclipsePluginExecutableExtensionFactory_3 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(_grammar_8); + TypeReference _eclipsePluginExecutableExtensionFactory_3 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar()); _builder.append(_eclipsePluginExecutableExtensionFactory_3, "\t\t"); _builder.append(":org.eclipse.xtext.ui.generator.trace.OpenGeneratedFileHandler\""); _builder.newLineIfNotEmpty(); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/FragmentFakingEcoreResource.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/FragmentFakingEcoreResource.java index 4a9c6228d..f893dbcaf 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/FragmentFakingEcoreResource.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/FragmentFakingEcoreResource.java @@ -9,7 +9,6 @@ package org.eclipse.xtext.xtext.generator.grammarAccess; import java.util.Map; import java.util.Set; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; @@ -48,13 +47,11 @@ public class FragmentFakingEcoreResource extends XMIResourceImpl { super(uri); this.isSaving = isSaving; this.encoding = "UTF-8"; + this.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.valueOf(true)); + this.getDefaultSaveOptions().put(XMLResource.OPTION_LINE_WIDTH, Integer.valueOf(80)); Map _defaultSaveOptions = this.getDefaultSaveOptions(); - _defaultSaveOptions.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.valueOf(true)); - Map _defaultSaveOptions_1 = this.getDefaultSaveOptions(); - _defaultSaveOptions_1.put(XMLResource.OPTION_LINE_WIDTH, Integer.valueOf(80)); - Map _defaultSaveOptions_2 = this.getDefaultSaveOptions(); URIHandlerImpl.PlatformSchemeAware _platformSchemeAware = new URIHandlerImpl.PlatformSchemeAware(); - _defaultSaveOptions_2.put(XMLResource.OPTION_URI_HANDLER, _platformSchemeAware); + _defaultSaveOptions.put(XMLResource.OPTION_URI_HANDLER, _platformSchemeAware); } @Override @@ -77,14 +74,12 @@ public class FragmentFakingEcoreResource extends XMIResourceImpl { } public String getURIFragment(final EClassifier classifier) { - EPackage _ePackage = classifier.getEPackage(); - EPackage _eSuperPackage = _ePackage.getESuperPackage(); + EPackage _eSuperPackage = classifier.getEPackage().getESuperPackage(); boolean _tripleNotEquals = (_eSuperPackage != null); if (_tripleNotEquals) { final StringBuilder result = new StringBuilder(60); this.calculateURIFragment(classifier.getEPackage(), result, CollectionLiterals.newHashSet()); - String _name = classifier.getName(); - result.append(_name); + result.append(classifier.getName()); return result.toString(); } return null; @@ -100,21 +95,17 @@ public class FragmentFakingEcoreResource extends XMIResourceImpl { boolean _tripleNotEquals = (_eSuperPackage != null); if (_tripleNotEquals) { Resource _eResource = ePackage.eResource(); - EPackage _eSuperPackage_1 = ePackage.getESuperPackage(); - Resource _eResource_1 = _eSuperPackage_1.eResource(); + Resource _eResource_1 = ePackage.getESuperPackage().eResource(); boolean _tripleEquals = (_eResource == _eResource_1); if (_tripleEquals) { this.calculateURIFragment(ePackage.getESuperPackage(), result, visited); - EList _eClassifiers = ePackage.getEClassifiers(); - boolean _isEmpty = _eClassifiers.isEmpty(); + boolean _isEmpty = ePackage.getEClassifiers().isEmpty(); boolean _not_1 = (!_isEmpty); if (_not_1) { int _length = result.length(); boolean _tripleNotEquals_1 = (_length != 0); if (_tripleNotEquals_1) { - String _name = ePackage.getName(); - StringBuilder _append = result.append(_name); - _append.append("/"); + result.append(ePackage.getName()).append("/"); } else { result.append("//"); } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/GrammarAccessExtensions.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/GrammarAccessExtensions.java index d6715dfc1..6686512b3 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/GrammarAccessExtensions.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/GrammarAccessExtensions.java @@ -21,10 +21,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EEnumLiteral; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; import org.eclipse.xtend2.lib.StringConcatenation; @@ -37,7 +34,6 @@ import org.eclipse.xtext.CompoundElement; import org.eclipse.xtext.CrossReference; import org.eclipse.xtext.EcoreUtil2; import org.eclipse.xtext.EnumLiteralDeclaration; -import org.eclipse.xtext.EnumRule; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.Group; @@ -128,8 +124,7 @@ public class GrammarAccessExtensions { StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { - Grammar _grammar = GrammarUtil.getGrammar(ele); - TypeReference _grammarAccess = GrammarAccessExtensions.this.getGrammarAccess(_grammar); + TypeReference _grammarAccess = GrammarAccessExtensions.this.getGrammarAccess(GrammarUtil.getGrammar(ele)); _builder.append(_grammarAccess); _builder.append(".INSTANCE."); String _gaRuleElementAccessor = GrammarAccessExtensions.this.gaRuleElementAccessor(ele); @@ -166,8 +161,7 @@ public class GrammarAccessExtensions { String _javaIdentifierSegment = this.toJavaIdentifierSegment(i.next(), true, uppercaseFirst); final StringBuilder b = new StringBuilder(_javaIdentifierSegment); while (i.hasNext()) { - String _javaIdentifierSegment_1 = this.toJavaIdentifierSegment(i.next(), false, true); - b.append(_javaIdentifierSegment_1); + b.append(this.toJavaIdentifierSegment(i.next(), false, true)); } return b.toString(); } @@ -206,8 +200,7 @@ public class GrammarAccessExtensions { * Returns the Unicode string name for a character. */ public String getUnicodeName(final char character) { - String _valueOf = String.valueOf(character); - final String transliterated = this.transliterator.transliterate(_valueOf); + final String transliterated = this.transliterator.transliterate(String.valueOf(character)); int _length = "\\N{".length(); int _length_1 = transliterated.length(); int _length_2 = "}".length(); @@ -271,8 +264,7 @@ public class GrammarAccessExtensions { * the Rule's grammar and its super grammars. */ public String gaRuleIdentifier(final AbstractRule rule) { - RuleNames _ruleNames = RuleNames.getRuleNames(rule); - final String plainName = _ruleNames.getUniqueRuleName(rule); + final String plainName = RuleNames.getRuleNames(rule).getUniqueRuleName(rule); return this.toJavaIdentifier(plainName, true); } @@ -281,8 +273,7 @@ public class GrammarAccessExtensions { * the grammar that defines the rule. */ public String gaBaseRuleIdentifier(final AbstractRule rule) { - String _name = rule.getName(); - return this.toJavaIdentifier(_name, true); + return this.toJavaIdentifier(rule.getName(), true); } /** @@ -296,12 +287,9 @@ public class GrammarAccessExtensions { return "null"; } final ArrayList result = new ArrayList(); - List _elementDescription = this.getElementDescription(element); - result.addAll(_elementDescription); - String _elementTypeDescription = this.getElementTypeDescription(element); - result.add(_elementTypeDescription); - String _elementPath = this.getElementPath(element); - result.add(_elementPath); + result.addAll(this.getElementDescription(element)); + result.add(this.getElementTypeDescription(element)); + result.add(this.getElementPath(element)); return this.toJavaIdentifier(result, true); } catch (final Throwable _t) { if (_t instanceof Throwable) { @@ -319,8 +307,7 @@ public class GrammarAccessExtensions { AbstractElement container = element; while ((container != null)) { { - List _singleElementDescription = this.getSingleElementDescription(container); - result.addAll(0, _singleElementDescription); + result.addAll(0, this.getSingleElementDescription(container)); final EObject eContainer = container.eContainer(); AbstractElement _xifexpression = null; if ((eContainer instanceof AbstractElement)) { @@ -352,8 +339,7 @@ public class GrammarAccessExtensions { if (!_matched) { if (ele instanceof RuleCall) { _matched=true; - AbstractRule _rule = ((RuleCall)ele).getRule(); - String _name = _rule.getName(); + String _name = ((RuleCall)ele).getRule().getName(); r.add(_name); } } @@ -367,17 +353,14 @@ public class GrammarAccessExtensions { } boolean _tripleNotEquals = (_classifier != null); if (_tripleNotEquals) { - TypeRef _type_1 = ((Action)ele).getType(); - EClassifier _classifier_1 = _type_1.getClassifier(); - String _name = _classifier_1.getName(); + String _name = ((Action)ele).getType().getClassifier().getName(); r.add(_name); } - String _feature = ((Action)ele).getFeature(); - boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_feature); + boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(((Action)ele).getFeature()); boolean _not = (!_isNullOrEmpty); if (_not) { - String _feature_1 = ((Action)ele).getFeature(); - r.add(_feature_1); + String _feature = ((Action)ele).getFeature(); + r.add(_feature); } } } @@ -391,9 +374,7 @@ public class GrammarAccessExtensions { } boolean _tripleNotEquals = (_classifier != null); if (_tripleNotEquals) { - TypeRef _type_1 = ((CrossReference)ele).getType(); - EClassifier _classifier_1 = _type_1.getClassifier(); - String _name = _classifier_1.getName(); + String _name = ((CrossReference)ele).getType().getClassifier().getName(); r.add(_name); } } @@ -401,8 +382,7 @@ public class GrammarAccessExtensions { if (!_matched) { if (ele instanceof EnumLiteralDeclaration) { _matched=true; - EEnumLiteral _enumLiteral = ((EnumLiteralDeclaration)ele).getEnumLiteral(); - String _name = _enumLiteral.getName(); + String _name = ((EnumLiteralDeclaration)ele).getEnumLiteral().getName(); r.add(_name); } } @@ -412,13 +392,10 @@ public class GrammarAccessExtensions { private String getElementTypeDescription(final AbstractElement ele) { String _xifexpression = null; if ((ele instanceof RuleCall)) { - AbstractRule _rule = ((RuleCall)ele).getRule(); - EClass _eClass = _rule.eClass(); - String _name = _eClass.getName(); + String _name = ((RuleCall)ele).getRule().eClass().getName(); _xifexpression = (_name + "Call"); } else { - EClass _eClass_1 = ele.eClass(); - _xifexpression = _eClass_1.getName(); + _xifexpression = ele.eClass().getName(); } return _xifexpression; } @@ -429,9 +406,7 @@ public class GrammarAccessExtensions { while (((!(obj.eContainer() instanceof AbstractRule)) && (obj.eContainer() != null))) { { final EObject eContainer = obj.eContainer(); - EList _eContents = eContainer.eContents(); - int _indexOf = _eContents.indexOf(obj); - result.insert(0, _indexOf); + result.insert(0, eContainer.eContents().indexOf(obj)); result.insert(0, "_"); obj = eContainer; } @@ -514,8 +489,7 @@ public class GrammarAccessExtensions { */ public String gaRuleParameterAccessor(final Parameter parameter) { final ParserRule rule = GrammarUtil.containingParserRule(parameter); - EList _parameters = rule.getParameters(); - final int index = _parameters.indexOf(parameter); + final int index = rule.getParameters().indexOf(parameter); String _gaRuleAccessor = this.gaRuleAccessor(rule); String _plus = (_gaRuleAccessor + ".getParameters().get("); String _plus_1 = (_plus + Integer.valueOf(index)); @@ -565,8 +539,7 @@ public class GrammarAccessExtensions { * Example: prStatemachine().ele1AssignmentStates() */ public String gaRuleElementAccessor(final AbstractElement ele) { - AbstractRule _containingRule = GrammarUtil.containingRule(ele); - String _gaElementsAccessor = this.gaElementsAccessor(_containingRule); + String _gaElementsAccessor = this.gaElementsAccessor(GrammarUtil.containingRule(ele)); String _plus = (_gaElementsAccessor + "."); String _gaElementAccessor = this.gaElementAccessor(ele); return (_plus + _gaElementAccessor); @@ -595,9 +568,7 @@ public class GrammarAccessExtensions { } } if (!_matched) { - EObject _eContainer_1 = ele.eContainer(); - EClass _eClass = _eContainer_1.eClass(); - String _name = _eClass.getName(); + String _name = ele.eContainer().eClass().getName(); String _plus = (""); } @@ -629,8 +600,7 @@ public class GrammarAccessExtensions { } } if (!_matched) { - EClass _eClass = ele.eClass(); - String _name = _eClass.getName(); + String _name = ele.eClass().getName(); String _plus = (""); } @@ -638,8 +608,7 @@ public class GrammarAccessExtensions { } public String grammarFragmentToString(final EObject ele, final String prefix) { - ISerializer _serializer = this.getSerializer(); - return GrammarAccessExtensions.grammarFragmentToString(_serializer, ele, prefix); + return GrammarAccessExtensions.grammarFragmentToString(this.getSerializer(), ele, prefix); } /** @@ -648,9 +617,7 @@ public class GrammarAccessExtensions { public static String grammarFragmentToString(final ISerializer serializer, final EObject object, final String prefix) { String s = null; try { - SaveOptions.Builder _newBuilder = SaveOptions.newBuilder(); - SaveOptions.Builder _format = _newBuilder.format(); - final SaveOptions options = _format.getOptions(); + final SaveOptions options = SaveOptions.newBuilder().format().getOptions(); s = serializer.serialize(object, options); } catch (final Throwable _t) { if (_t instanceof Exception) { @@ -660,9 +627,7 @@ public class GrammarAccessExtensions { throw Exceptions.sneakyThrow(_t); } } - String _trim = s.trim(); - String _replaceAll = _trim.replaceAll("(\\r?\\n)", ("$1" + prefix)); - String _replace = _replaceAll.replace("\\u", "\\\\u"); + String _replace = s.trim().replaceAll("(\\r?\\n)", ("$1" + prefix)).replace("\\u", "\\\\u"); String _plus = (prefix + _replace); s = _plus; return s; @@ -678,8 +643,7 @@ public class GrammarAccessExtensions { } protected String _grammarElementIdentifier(final AbstractElement it) { - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _grammarElementIdentifier = this.grammarElementIdentifier(_containingRule); + String _grammarElementIdentifier = this.grammarElementIdentifier(GrammarUtil.containingRule(it)); String _plus = (_grammarElementIdentifier + "_"); String _gaElementIdentifier = this.gaElementIdentifier(it); return (_plus + _gaElementIdentifier); @@ -703,15 +667,12 @@ public class GrammarAccessExtensions { { boolean _isDefinesHiddenTokens = it.isDefinesHiddenTokens(); if (_isDefinesHiddenTokens) { - EList _hiddenTokens = it.getHiddenTokens(); final Function1 _function = (AbstractRule it_1) -> { return this.ruleName(it_1); }; - List _map = ListExtensions.map(_hiddenTokens, _function); - return IterableExtensions.toList(_map); + return IterableExtensions.toList(ListExtensions.map(it.getHiddenTokens(), _function)); } - EList _usedGrammars = it.getUsedGrammars(); - int _size = _usedGrammars.size(); + int _size = it.getUsedGrammars().size(); boolean _equals = (_size == 1); if (_equals) { return this.initialHiddenTokens(IterableExtensions.head(it.getUsedGrammars())); @@ -775,13 +736,10 @@ public class GrammarAccessExtensions { } else { boolean _xblockexpression = false; { - AbstractRule _rule = it.getRule(); - final AbstractElement group = _rule.getAlternatives(); + final AbstractElement group = it.getRule().getAlternatives(); boolean _xifexpression = false; if ((group instanceof Group)) { - EList _elements = ((Group)group).getElements(); - AbstractElement _head = IterableExtensions.head(_elements); - _xifexpression = this.predicated(_head); + _xifexpression = this.predicated(IterableExtensions.head(((Group)group).getElements())); } else { _xifexpression = false; } @@ -800,25 +758,18 @@ public class GrammarAccessExtensions { String _feature = it.getFeature(); String _plus = ("lv_" + _feature); String _plus_1 = (_plus + "_"); - ParserRule _containingParserRule = GrammarUtil.containingParserRule(it); - List _contentsAsList = this.contentsAsList(_containingParserRule); - int _indexOf = _contentsAsList.indexOf(it); + int _indexOf = this.contentsAsList(GrammarUtil.containingParserRule(it)).indexOf(it); String _plus_2 = (_plus_1 + Integer.valueOf(_indexOf)); String _plus_3 = (_plus_2 + "_"); - List _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(it); - int _indexOf_1 = _eAllContentsAsList.indexOf(terminal); + int _indexOf_1 = EcoreUtil2.eAllContentsAsList(it).indexOf(terminal); return (_plus_3 + Integer.valueOf(_indexOf_1)); } protected String _localVar(final RuleCall it) { - AbstractRule _rule = it.getRule(); - AbstractRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(_rule); - String _name = _originalElement.getName(); + String _name = AntlrGrammarGenUtil.getOriginalElement(it.getRule()).getName(); String _plus = ("this_" + _name); String _plus_1 = (_plus + "_"); - ParserRule _containingParserRule = GrammarUtil.containingParserRule(it); - List _contentsAsList = this.contentsAsList(_containingParserRule); - int _indexOf = _contentsAsList.indexOf(it); + int _indexOf = this.contentsAsList(GrammarUtil.containingParserRule(it)).indexOf(it); return (_plus_1 + Integer.valueOf(_indexOf)); } @@ -826,24 +777,19 @@ public class GrammarAccessExtensions { String _xblockexpression = null; { final ParserRule rule = GrammarUtil.containingParserRule(it); - List _contentsAsList = this.contentsAsList(rule); - final int index = _contentsAsList.indexOf(it); + final int index = this.contentsAsList(rule).indexOf(it); _xblockexpression = ("otherlv_" + Integer.valueOf(index)); } return _xblockexpression; } protected String _localVar(final EnumLiteralDeclaration it) { - EnumRule _containingEnumRule = GrammarUtil.containingEnumRule(it); - AbstractElement _alternatives = _containingEnumRule.getAlternatives(); - List _contentsAsList = this.contentsAsList(_alternatives); - int _indexOf = _contentsAsList.indexOf(it); + int _indexOf = this.contentsAsList(GrammarUtil.containingEnumRule(it).getAlternatives()).indexOf(it); return ("enumLiteral_" + Integer.valueOf(_indexOf)); } protected List _contentsAsList(final ParserRule it) { - AbstractElement _alternatives = it.getAlternatives(); - return this.contentsAsList(_alternatives); + return this.contentsAsList(it.getAlternatives()); } protected List _contentsAsList(final AbstractElement it) { @@ -851,26 +797,20 @@ public class GrammarAccessExtensions { } protected List _contentsAsList(final CompoundElement it) { - EList _elements = it.getElements(); final Function1> _function = (AbstractElement it_1) -> { return this.contentsAsList(it_1); }; - List> _map = ListExtensions.>map(_elements, _function); - Iterable _flatten = Iterables.concat(_map); - return IterableExtensions.toList(_flatten); + return IterableExtensions.toList(Iterables.concat(ListExtensions.>map(it.getElements(), _function))); } protected List _contentsAsList(final UnorderedGroup it) { ArrayList _xblockexpression = null; { final ArrayList result = CollectionLiterals.newArrayList(it); - EList _elements = it.getElements(); final Function1> _function = (AbstractElement it_1) -> { return this.contentsAsList(it_1); }; - List> _map = ListExtensions.>map(_elements, _function); - Iterable _flatten = Iterables.concat(_map); - List _list = IterableExtensions.toList(_flatten); + List _list = IterableExtensions.toList(Iterables.concat(ListExtensions.>map(it.getElements(), _function))); Iterables.addAll(result, _list); _xblockexpression = result; } @@ -917,8 +857,7 @@ public class GrammarAccessExtensions { _matched=true; StringConcatenation _builder = new StringConcatenation(); _builder.append("\""); - String _value = ((Keyword)it).getValue(); - String _stringInAntlrAction = AntlrGrammarGenUtil.toStringInAntlrAction(_value); + String _stringInAntlrAction = AntlrGrammarGenUtil.toStringInAntlrAction(((Keyword)it).getValue()); _builder.append(_stringInAntlrAction); _builder.append("\""); _switchResult = _builder; diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/GrammarAccessFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/GrammarAccessFragment2.java index daa06d08d..40534da93 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/GrammarAccessFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/grammarAccess/GrammarAccessFragment2.java @@ -20,8 +20,6 @@ import java.util.Set; import org.apache.log4j.Logger; 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.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.resource.ContentHandler; @@ -54,20 +52,16 @@ import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.ListExtensions; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.grammarAccess.FragmentFakingEcoreResource; import org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessExtensions; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.model.annotations.IClassAnnotation; import org.eclipse.xtext.xtext.generator.model.annotations.SingletonClassAnnotation; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; @Log @SuppressWarnings("all") @@ -89,9 +83,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { @Override public void generate() { final GuiceModuleAccess.BindingFactory bindingFactory = new GuiceModuleAccess.BindingFactory(); - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - String _name = _grammar.getName(); + String _name = this.getLanguage().getGrammar().getName(); boolean _notEquals = (!Objects.equal(_name, "org.eclipse.xtext.common.Terminals")); if (_notEquals) { TypeReference _typeRef = TypeReference.typeRef(ClassLoader.class); @@ -103,29 +95,14 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { }; bindingFactory.addTypeToInstance(_typeRef, _client); } - TypeReference _typeRef_1 = TypeReference.typeRef(IGrammarAccess.class); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - Grammar _grammar_1 = _language_1.getGrammar(); - TypeReference _grammarAccess = this._grammarAccessExtensions.getGrammarAccess(_grammar_1); - GuiceModuleAccess.BindingFactory _addTypeToType = bindingFactory.addTypeToType(_typeRef_1, _grammarAccess); - IXtextGeneratorLanguage _language_2 = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language_2.getRuntimeGenModule(); - _addTypeToType.contributeTo(_runtimeGenModule); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - ManifestAccess _manifest = _runtime.getManifest(); + bindingFactory.addTypeToType(TypeReference.typeRef(IGrammarAccess.class), this._grammarAccessExtensions.getGrammarAccess(this.getLanguage().getGrammar())).contributeTo(this.getLanguage().getRuntimeGenModule()); + ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - ManifestAccess _manifest_1 = _runtime_1.getManifest(); - Set _exportedPackages = _manifest_1.getExportedPackages(); - Grammar _grammar_2 = this.getGrammar(); - String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(_grammar_2); - Grammar _grammar_3 = this.getGrammar(); - String _runtimeBasePackage_1 = this._xtextGeneratorNaming.getRuntimeBasePackage(_grammar_3); + String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar()); + String _runtimeBasePackage_1 = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar()); String _plus = (_runtimeBasePackage_1 + ".services"); - _exportedPackages.addAll( + this.getProjectConfig().getRuntime().getManifest().getExportedPackages().addAll( Collections.unmodifiableList(CollectionLiterals.newArrayList(_runtimeBasePackage, _plus))); } this.doGenerateGrammarAccess(); @@ -133,8 +110,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { } protected String getQualifiedName(final AbstractRule rule) { - Grammar _grammar = GrammarUtil.getGrammar(rule); - String _name = _grammar.getName(); + String _name = GrammarUtil.getGrammar(rule).getName(); String _plus = (_name + "."); String _name_1 = rule.getName(); return (_plus + _name_1); @@ -143,23 +119,12 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { protected void writeGrammar() { final Wrapper isSaving = Wrapper.wrap(Boolean.valueOf(false)); final ResourceSet cloneInto = new ResourceSetImpl(); - Resource.Factory.Registry _resourceFactoryRegistry = cloneInto.getResourceFactoryRegistry(); - Map _extensionToFactoryMap = _resourceFactoryRegistry.getExtensionToFactoryMap(); + Map _extensionToFactoryMap = cloneInto.getResourceFactoryRegistry().getExtensionToFactoryMap(); FragmentFakingEcoreResource.FactoryImpl _factoryImpl = new FragmentFakingEcoreResource.FactoryImpl(isSaving); _extensionToFactoryMap.put( FragmentFakingEcoreResource.FactoryImpl.ECORE_SUFFIX, _factoryImpl); - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - Resource _eResource = _grammar.eResource(); - ResourceSet _resourceSet = _eResource.getResourceSet(); - final ResourceSet resourceSet = EcoreUtil2.clone(cloneInto, _resourceSet); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - Grammar _grammar_1 = _language_1.getGrammar(); - Resource _eResource_1 = _grammar_1.eResource(); - URI _uRI = _eResource_1.getURI(); - Resource _resource = resourceSet.getResource(_uRI, true); - EList _contents = _resource.getContents(); - EObject _head = IterableExtensions.head(_contents); + final ResourceSet resourceSet = EcoreUtil2.clone(cloneInto, this.getLanguage().getGrammar().eResource().getResourceSet()); + EObject _head = IterableExtensions.head(resourceSet.getResource(this.getLanguage().getGrammar().eResource().getURI(), true).getContents()); final Grammar copy = ((Grammar) _head); String _xifexpression = null; if ((this.xmlVersion == null)) { @@ -176,10 +141,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _xifexpression = _xblockexpression; } final String path = _xifexpression; - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen = _runtime.getSrcGen(); - final URI uri = _srcGen.getURI(path); + final URI uri = this.getProjectConfig().getRuntime().getSrcGen().getURI(path); final Resource resource = resourceSet.createResource(uri, ContentHandler.UNSPECIFIED_CONTENT_TYPE); HashSet _hashSet = new HashSet(); this.addAllGrammarsToResource(resource, copy, _hashSet); @@ -204,8 +166,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { } catch (final Throwable _t) { if (_t instanceof IOException) { final IOException e = (IOException)_t; - String _message = e.getMessage(); - GrammarAccessFragment2.LOG.error(_message, e); + GrammarAccessFragment2.LOG.error(e.getMessage(), e); } else { throw Exceptions.sneakyThrow(_t); } @@ -220,15 +181,13 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { if (_not) { return; } - EList _contents = resource.getContents(); - _contents.add(grammar); + resource.getContents().add(grammar); EList _metamodelDeclarations = grammar.getMetamodelDeclarations(); for (final AbstractMetamodelDeclaration metamodelDecl : _metamodelDeclarations) { { final EPackage pack = metamodelDecl.getEPackage(); final Resource packResource = pack.eResource(); - URI _uRI = packResource.getURI(); - String _string = _uRI.toString(); + String _string = packResource.getURI().toString(); String _nsURI = pack.getNsURI(); boolean _notEquals = (!Objects.equal(_string, _nsURI)); if (_notEquals) { @@ -239,22 +198,15 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { topMost = topMost.getESuperPackage(); } if ((packResource.getContents().contains(topMost) && (packResource.getContents().size() == 1))) { - EList _eClassifiers = topMost.getEClassifiers(); - boolean _isEmpty = _eClassifiers.isEmpty(); + boolean _isEmpty = topMost.getEClassifiers().isEmpty(); boolean _not_1 = (!_isEmpty); if (_not_1) { - String _nsURI_1 = topMost.getNsURI(); - URI _createURI = URI.createURI(_nsURI_1); - packResource.setURI(_createURI); + packResource.setURI(URI.createURI(topMost.getNsURI())); } else { this.moveSubpackagesToNewResource(topMost, resource.getResourceSet()); } } - Resource _eResource = topMost.eResource(); - URI _uRI_1 = _eResource.getURI(); - String _string_1 = _uRI_1.toString(); - String _nsURI_2 = topMost.getNsURI(); - boolean _equals = _string_1.equals(_nsURI_2); + boolean _equals = topMost.eResource().getURI().toString().equals(topMost.getNsURI()); boolean _not_2 = (!_equals); if (_not_2) { this.movePackageToNewResource(topMost, resource.getResourceSet()); @@ -272,20 +224,17 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { protected void moveSubpackagesToNewResource(final EPackage pack, final ResourceSet set) { for (int i = (pack.getESubpackages().size() - 1); (i >= 0); i--) { { - EList _eSubpackages = pack.getESubpackages(); - final EPackage sub = _eSubpackages.get(i); + final EPackage sub = pack.getESubpackages().get(i); Resource _eResource = sub.eResource(); Resource _eResource_1 = pack.eResource(); boolean _tripleEquals = (_eResource == _eResource_1); if (_tripleEquals) { - EList _eClassifiers = sub.getEClassifiers(); - boolean _isEmpty = _eClassifiers.isEmpty(); + boolean _isEmpty = sub.getEClassifiers().isEmpty(); if (_isEmpty) { this.moveSubpackagesToNewResource(sub, set); } else { this.movePackageToNewResource(sub, set); - EList _eSubpackages_1 = pack.getESubpackages(); - _eSubpackages_1.remove(i); + pack.getESubpackages().remove(i); } } } @@ -293,20 +242,15 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { } protected void movePackageToNewResource(final EPackage pack, final ResourceSet set) { - URI _createURI = URI.createURI(("___temp___." + FragmentFakingEcoreResource.FactoryImpl.ECORE_SUFFIX)); - final Resource resource = set.createResource(_createURI, + final Resource resource = set.createResource( + URI.createURI(("___temp___." + FragmentFakingEcoreResource.FactoryImpl.ECORE_SUFFIX)), ContentHandler.UNSPECIFIED_CONTENT_TYPE); - String _nsURI = pack.getNsURI(); - URI _createURI_1 = URI.createURI(_nsURI); - resource.setURI(_createURI_1); - EList _contents = resource.getContents(); - _contents.add(pack); + resource.setURI(URI.createURI(pack.getNsURI())); + resource.getContents().add(pack); } protected void doGenerateGrammarAccess() { - Grammar _grammar = this.getGrammar(); - TypeReference _grammarAccess = this._grammarAccessExtensions.getGrammarAccess(_grammar); - final GeneratedJavaFileAccess javaFile = this.fileAccessFactory.createGeneratedJavaFile(_grammarAccess); + final GeneratedJavaFileAccess javaFile = this.fileAccessFactory.createGeneratedJavaFile(this._grammarAccessExtensions.getGrammarAccess(this.getGrammar())); List _annotations = javaFile.getAnnotations(); SingletonClassAnnotation _singletonClassAnnotation = new SingletonClassAnnotation(); _annotations.add(_singletonClassAnnotation); @@ -314,10 +258,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - IXtextGeneratorLanguage _language = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - TypeReference _grammarAccess = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(_grammar); - String _simpleName = _grammarAccess.getSimpleName(); + String _simpleName = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(GrammarAccessFragment2.this.getLanguage().getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(AbstractElementFinder.AbstractGrammarElementFinder.class); @@ -326,10 +267,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.append("\t"); _builder.newLine(); { - IXtextGeneratorLanguage _language_1 = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar_1 = _language_1.getGrammar(); - EList _rules = _grammar_1.getRules(); - Iterable _filter = Iterables.filter(_rules, ParserRule.class); + Iterable _filter = Iterables.filter(GrammarAccessFragment2.this.getLanguage().getGrammar().getRules(), ParserRule.class); for(final ParserRule r : _filter) { _builder.append("\t"); StringConcatenationClient _parserRuleClasses = GrammarAccessFragment2.this.parserRuleClasses(r); @@ -340,10 +278,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.append("\t"); _builder.newLine(); { - IXtextGeneratorLanguage _language_2 = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar_2 = _language_2.getGrammar(); - EList _rules_1 = _grammar_2.getRules(); - Iterable _filter_1 = Iterables.filter(_rules_1, EnumRule.class); + Iterable _filter_1 = Iterables.filter(GrammarAccessFragment2.this.getLanguage().getGrammar().getRules(), EnumRule.class); for(final EnumRule r_1 : _filter_1) { _builder.append("\t"); StringConcatenationClient _parserRuleClasses_1 = GrammarAccessFragment2.this.parserRuleClasses(r_1); @@ -354,10 +289,8 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.append("\t"); _builder.newLine(); { - IXtextGeneratorLanguage _language_3 = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar_3 = _language_3.getGrammar(); - EList _rules_2 = _grammar_3.getRules(); - for(final AbstractRule r_2 : _rules_2) { + EList _rules = GrammarAccessFragment2.this.getLanguage().getGrammar().getRules(); + for(final AbstractRule r_2 : _rules) { _builder.append("\t"); StringConcatenationClient _cache = GrammarAccessFragment2.this.cache(r_2); _builder.append(_cache, "\t"); @@ -372,16 +305,14 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.append(" grammar;"); _builder.newLineIfNotEmpty(); { - IXtextGeneratorLanguage _language_4 = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar_4 = _language_4.getGrammar(); - List _effectivelyUsedGrammars = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(_grammar_4); + List _effectivelyUsedGrammars = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(GrammarAccessFragment2.this.getLanguage().getGrammar()); for(final Grammar g : _effectivelyUsedGrammars) { _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("private final "); - TypeReference _grammarAccess_1 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g); - _builder.append(_grammarAccess_1, "\t"); + TypeReference _grammarAccess = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g); + _builder.append(_grammarAccess, "\t"); _builder.append(" "); String _gaGrammarAccessLocalVarName = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(g); _builder.append(_gaGrammarAccessLocalVarName, "\t"); @@ -396,25 +327,20 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("public "); - IXtextGeneratorLanguage _language_5 = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar_5 = _language_5.getGrammar(); - TypeReference _grammarAccess_2 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(_grammar_5); - String _simpleName_1 = _grammarAccess_2.getSimpleName(); + String _simpleName_1 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(GrammarAccessFragment2.this.getLanguage().getGrammar()).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("("); _builder.append(GrammarProvider.class, "\t"); _builder.append(" grammarProvider"); { - IXtextGeneratorLanguage _language_6 = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar_6 = _language_6.getGrammar(); - List _effectivelyUsedGrammars_1 = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(_grammar_6); + List _effectivelyUsedGrammars_1 = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(GrammarAccessFragment2.this.getLanguage().getGrammar()); for(final Grammar g_1 : _effectivelyUsedGrammars_1) { _builder.append(","); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("\t\t"); - TypeReference _grammarAccess_3 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g_1); - _builder.append(_grammarAccess_3, "\t\t\t"); + TypeReference _grammarAccess_1 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g_1); + _builder.append(_grammarAccess_1, "\t\t\t"); _builder.append(" "); String _gaGrammarAccessLocalVarName_1 = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(g_1); _builder.append(_gaGrammarAccessLocalVarName_1, "\t\t\t"); @@ -426,9 +352,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.append("this.grammar = internalFindGrammar(grammarProvider);"); _builder.newLine(); { - IXtextGeneratorLanguage _language_7 = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar_7 = _language_7.getGrammar(); - List _effectivelyUsedGrammars_2 = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(_grammar_7); + List _effectivelyUsedGrammars_2 = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(GrammarAccessFragment2.this.getLanguage().getGrammar()); for(final Grammar g_2 : _effectivelyUsedGrammars_2) { _builder.append("\t\t"); _builder.append("this."); @@ -442,10 +366,8 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { } } { - IXtextGeneratorLanguage _language_8 = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar_8 = _language_8.getGrammar(); - EList _rules_3 = _grammar_8.getRules(); - for(final AbstractRule r_3 : _rules_3) { + EList _rules_1 = GrammarAccessFragment2.this.getLanguage().getGrammar().getRules(); + for(final AbstractRule r_3 : _rules_1) { _builder.append("\t\t"); StringConcatenationClient _initializer = GrammarAccessFragment2.this.initializer(r_3); _builder.append(_initializer, "\t\t"); @@ -473,9 +395,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); _builder.append("\t\t\t"); _builder.append("if (\""); - IXtextGeneratorLanguage _language_9 = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar_9 = _language_9.getGrammar(); - String _name = _grammar_9.getName(); + String _name = GrammarAccessFragment2.this.getLanguage().getGrammar().getName(); _builder.append(_name, "\t\t\t"); _builder.append("\".equals(grammar.getName())) {"); _builder.newLineIfNotEmpty(); @@ -534,19 +454,16 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.append("\t"); _builder.newLine(); { - IXtextGeneratorLanguage _language_10 = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar_10 = _language_10.getGrammar(); - List _effectivelyUsedGrammars_3 = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(_grammar_10); + List _effectivelyUsedGrammars_3 = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(GrammarAccessFragment2.this.getLanguage().getGrammar()); for(final Grammar g_3 : _effectivelyUsedGrammars_3) { _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("public "); - TypeReference _grammarAccess_4 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g_3); - _builder.append(_grammarAccess_4, "\t"); + TypeReference _grammarAccess_2 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g_3); + _builder.append(_grammarAccess_2, "\t"); _builder.append(" get"); - TypeReference _grammarAccess_5 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g_3); - String _simpleName_2 = _grammarAccess_5.getSimpleName(); + String _simpleName_2 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g_3).getSimpleName(); _builder.append(_simpleName_2, "\t"); _builder.append("() {"); _builder.newLineIfNotEmpty(); @@ -564,9 +481,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { } _builder.newLine(); { - IXtextGeneratorLanguage _language_11 = GrammarAccessFragment2.this.getLanguage(); - Grammar _grammar_11 = _language_11.getGrammar(); - List _allRules = GrammarUtil.allRules(_grammar_11); + List _allRules = GrammarUtil.allRules(GrammarAccessFragment2.this.getLanguage().getGrammar()); for(final AbstractRule r_4 : _allRules) { _builder.append("\t"); _builder.newLine(); @@ -581,10 +496,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { } }; javaFile.setContent(_client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen = _runtime.getSrcGen(); - javaFile.writeTo(_srcGen); + javaFile.writeTo(this.getProjectConfig().getRuntime().getSrcGen()); } protected StringConcatenationClient parserRuleClasses(final ParserRule it) { @@ -613,9 +525,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { for(final AbstractElement e : _containedAbstractElements) { _builder.append("\t"); _builder.append("private final "); - EClass _eClass = e.eClass(); - IXtextGeneratorLanguage _language = GrammarAccessFragment2.this.getLanguage(); - TypeReference _typeRef = TypeReference.typeRef(_eClass, _language); + TypeReference _typeRef = TypeReference.typeRef(e.eClass(), GrammarAccessFragment2.this.getLanguage()); _builder.append(_typeRef, "\t"); _builder.append(" "); String _gaElementAccessorLocalVarName = GrammarAccessFragment2.this.gaElementAccessorLocalVarName(e); @@ -649,9 +559,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("public "); - EClass _eClass_1 = e_1.eClass(); - IXtextGeneratorLanguage _language_1 = GrammarAccessFragment2.this.getLanguage(); - TypeReference _typeRef_1 = TypeReference.typeRef(_eClass_1, _language_1); + TypeReference _typeRef_1 = TypeReference.typeRef(e_1.eClass(), GrammarAccessFragment2.this.getLanguage()); _builder.append(_typeRef_1, "\t"); _builder.append(" "); String _gaElementAccessMethodName = GrammarAccessFragment2.this._grammarAccessExtensions.gaElementAccessMethodName(e_1); @@ -698,9 +606,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { for(final AbstractElement e : _containedAbstractElements) { _builder.append("\t"); _builder.append("private final "); - EClass _eClass = e.eClass(); - IXtextGeneratorLanguage _language = GrammarAccessFragment2.this.getLanguage(); - TypeReference _typeRef = TypeReference.typeRef(_eClass, _language); + TypeReference _typeRef = TypeReference.typeRef(e.eClass(), GrammarAccessFragment2.this.getLanguage()); _builder.append(_typeRef, "\t"); _builder.append(" "); String _gaElementAccessorLocalVarName = GrammarAccessFragment2.this.gaElementAccessorLocalVarName(e); @@ -732,9 +638,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("public "); - EClass _eClass_1 = e_1.eClass(); - IXtextGeneratorLanguage _language_1 = GrammarAccessFragment2.this.getLanguage(); - TypeReference _typeRef_1 = TypeReference.typeRef(_eClass_1, _language_1); + TypeReference _typeRef_1 = TypeReference.typeRef(e_1.eClass(), GrammarAccessFragment2.this.getLanguage()); _builder.append(_typeRef_1, "\t"); _builder.append(" "); String _gaElementAccessMethodName = GrammarAccessFragment2.this._grammarAccessExtensions.gaElementAccessMethodName(e_1); @@ -887,8 +791,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); } else { _builder.append("public "); - Grammar _grammar_1 = GrammarUtil.getGrammar(it); - TypeReference _grammarAccess = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(_grammar_1); + TypeReference _grammarAccess = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(GrammarUtil.getGrammar(it)); _builder.append(_grammarAccess); _builder.append("."); String _gaBaseRuleAccessorClassName = GrammarAccessFragment2.this._grammarAccessExtensions.gaBaseRuleAccessorClassName(it); @@ -900,8 +803,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("return "); - Grammar _grammar_2 = GrammarUtil.getGrammar(it); - String _gaGrammarAccessLocalVarName = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(_grammar_2); + String _gaGrammarAccessLocalVarName = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(GrammarUtil.getGrammar(it)); _builder.append(_gaGrammarAccessLocalVarName, "\t"); _builder.append("."); String _gaBaseElementsAccessor = GrammarAccessFragment2.this._grammarAccessExtensions.gaBaseElementsAccessor(it); @@ -960,8 +862,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); } else { _builder.append("public "); - Grammar _grammar_1 = GrammarUtil.getGrammar(it); - TypeReference _grammarAccess = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(_grammar_1); + TypeReference _grammarAccess = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(GrammarUtil.getGrammar(it)); _builder.append(_grammarAccess); _builder.append("."); String _gaRuleAccessorClassName_1 = GrammarAccessFragment2.this._grammarAccessExtensions.gaRuleAccessorClassName(it); @@ -973,8 +874,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("return "); - Grammar _grammar_2 = GrammarUtil.getGrammar(it); - String _gaGrammarAccessLocalVarName = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(_grammar_2); + String _gaGrammarAccessLocalVarName = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(GrammarUtil.getGrammar(it)); _builder.append(_gaGrammarAccessLocalVarName, "\t"); _builder.append("."); String _gaElementsAccessor_2 = GrammarAccessFragment2.this._grammarAccessExtensions.gaElementsAccessor(it); @@ -1033,8 +933,7 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { } else { _builder.append("\t"); _builder.append("return "); - Grammar _grammar_1 = GrammarUtil.getGrammar(it); - String _gaGrammarAccessLocalVarName = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(_grammar_1); + String _gaGrammarAccessLocalVarName = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(GrammarUtil.getGrammar(it)); _builder.append(_gaGrammarAccessLocalVarName, "\t"); _builder.append("."); String _gaBaseRuleAccessor = GrammarAccessFragment2.this._grammarAccessExtensions.gaBaseRuleAccessor(it); @@ -1080,17 +979,13 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("("); - EClass _eClass = ele.eClass(); - IXtextGeneratorLanguage _language = GrammarAccessFragment2.this.getLanguage(); - TypeReference _typeRef = TypeReference.typeRef(_eClass, _language); + TypeReference _typeRef = TypeReference.typeRef(ele.eClass(), GrammarAccessFragment2.this.getLanguage()); _builder.append(_typeRef); _builder.append(")"); String _loadElementParentStatement = GrammarAccessFragment2.this.loadElementParentStatement(ele); _builder.append(_loadElementParentStatement); _builder.append(".eContents().get("); - EObject _eContainer = ele.eContainer(); - EList _eContents = _eContainer.eContents(); - int _indexOf = _eContents.indexOf(ele); + int _indexOf = ele.eContainer().eContents().indexOf(ele); _builder.append(_indexOf); _builder.append(")"); } @@ -1114,17 +1009,13 @@ public class GrammarAccessFragment2 extends AbstractXtextGeneratorFragment { * Returns all grammars from the hierarchy that are used from rules of this grammar. */ protected List getEffectivelyUsedGrammars(final Grammar grammar) { - List _allRules = GrammarUtil.allRules(grammar); final Function1 _function = (AbstractRule it) -> { return GrammarUtil.getGrammar(it); }; - List _map = ListExtensions.map(_allRules, _function); final Function1 _function_1 = (Grammar it) -> { return Boolean.valueOf((it != grammar)); }; - Iterable _filter = IterableExtensions.filter(_map, _function_1); - Set _set = IterableExtensions.toSet(_filter); - return IterableExtensions.toList(_set); + return IterableExtensions.toList(IterableExtensions.toSet(IterableExtensions.filter(ListExtensions.map(GrammarUtil.allRules(grammar), _function), _function_1))); } protected StringConcatenationClient cache(final AbstractRule it) { diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginClassNames.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginClassNames.java index 04800687e..f43f6249a 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginClassNames.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginClassNames.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.xtext.generator.idea; import com.google.inject.Inject; -import org.eclipse.emf.common.util.EList; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.xbase.lib.Extension; @@ -179,8 +178,7 @@ public class IdeaPluginClassNames { String _ideaBasePackage = this._xtextGeneratorNaming.getIdeaBasePackage(it); String _plus = (_ideaBasePackage + ".parser.antlr.internal.PsiInternal"); String _simpleName = GrammarUtil.getSimpleName(it); - String _plus_1 = (_plus + _simpleName); - String _path = this.toPath(_plus_1); + String _path = this.toPath((_plus + _simpleName)); return (_path + ".tokens"); } @@ -221,8 +219,7 @@ public class IdeaPluginClassNames { public TypeReference getCompletionContributorSuperClass(final Grammar it) { TypeReference _elvis = null; - EList _usedGrammars = it.getUsedGrammars(); - Grammar _head = IterableExtensions.head(_usedGrammars); + Grammar _head = IterableExtensions.head(it.getUsedGrammars()); TypeReference _completionContributor = null; if (_head!=null) { _completionContributor=this.getCompletionContributor(_head); @@ -278,8 +275,7 @@ public class IdeaPluginClassNames { } public TypeReference colorSettingsPage(final Grammar it) { - TypeReference _baseColorSettingsPage = this.baseColorSettingsPage(it); - String _packageName = _baseColorSettingsPage.getPackageName(); + String _packageName = this.baseColorSettingsPage(it).getPackageName(); String _simpleName = GrammarUtil.getSimpleName(it); String _plus = (_simpleName + "ColorSettingsPage"); return new TypeReference(_packageName, _plus); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginExtension.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginExtension.java index 5f5fc2fbe..b6b0733f4 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginExtension.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginExtension.java @@ -7,7 +7,6 @@ */ package org.eclipse.xtext.xtext.generator.idea; -import java.util.List; import org.eclipse.xtext.AbstractRule; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; @@ -18,11 +17,10 @@ import org.eclipse.xtext.xbase.lib.IterableExtensions; @SuppressWarnings("all") public class IdeaPluginExtension { public Iterable getAllNonTerminalRules(final Grammar grammar) { - List _allRules = GrammarUtil.allRules(grammar); final Function1 _function = (AbstractRule it) -> { return Boolean.valueOf((!(it instanceof TerminalRule))); }; - return IterableExtensions.filter(_allRules, _function); + return IterableExtensions.filter(GrammarUtil.allRules(grammar), _function); } public String getSimpleName(final Grammar grammar) { diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginGenerator.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginGenerator.java index 163ed51c5..907ce6f07 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginGenerator.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/IdeaPluginGenerator.java @@ -21,25 +21,20 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.Consumer; import org.antlr.runtime.Token; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EAttribute; 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.EStructuralFeature; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtend2.lib.StringConcatenationClient; import org.eclipse.xtext.AbstractElement; -import org.eclipse.xtext.AbstractMetamodelDeclaration; import org.eclipse.xtext.AbstractRule; import org.eclipse.xtext.Action; import org.eclipse.xtext.EcoreUtil2; @@ -63,19 +58,15 @@ import org.eclipse.xtext.xbase.lib.IteratorExtensions; import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xbase.lib.StringExtensions; import org.eclipse.xtext.xtext.generator.AbstractStubGeneratingFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessExtensions; import org.eclipse.xtext.xtext.generator.idea.IdeaPluginClassNames; import org.eclipse.xtext.xtext.generator.idea.IdeaPluginExtension; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; import org.eclipse.xtext.xtext.generator.model.TextFileAccess; 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.ContentAssistGrammarNaming; import org.eclipse.xtext.xtext.generator.xbase.XbaseUsageDetector; @@ -118,25 +109,16 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override public void generate() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - ISubProjectConfig _ideaPlugin = _projectConfig.getIdeaPlugin(); - boolean _isEnabled = _ideaPlugin.isEnabled(); + boolean _isEnabled = this.getProjectConfig().getIdeaPlugin().isEnabled(); boolean _not = (!_isEnabled); if (_not) { return; } - IXtextGeneratorLanguage _language = this.getLanguage(); - List _fileExtensions = _language.getFileExtensions(); - final String fileExtension = IterableExtensions.head(_fileExtensions); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - final Grammar grammar = _language_1.getGrammar(); + final String fileExtension = IterableExtensions.head(this.getLanguage().getFileExtensions()); + final Grammar grammar = this.getLanguage().getGrammar(); final GuiceModuleAccess.BindingFactory bindFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider"); - TypeReference _antlrTokenFileProvider = this._ideaPluginClassNames.getAntlrTokenFileProvider(grammar); - bindFactory.addTypeToType(_typeRef, _antlrTokenFileProvider); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.parser.antlr.Lexer"); - TypeReference _psiInternalLexer = this._ideaPluginClassNames.getPsiInternalLexer(grammar); - bindFactory.addTypeToType(_typeRef_1, _psiInternalLexer); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider"), this._ideaPluginClassNames.getAntlrTokenFileProvider(grammar)); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.parser.antlr.Lexer"), this._ideaPluginClassNames.getPsiInternalLexer(grammar)); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -160,22 +142,12 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { } }; bindFactory.addConfiguredBinding("RuntimeLexer", _client); - TypeReference _typeRef_2 = TypeReference.typeRef("com.intellij.lang.PsiParser"); - TypeReference _psiParser = this._ideaPluginClassNames.getPsiParser(grammar); - bindFactory.addTypeToType(_typeRef_2, _psiParser); - TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.idea.parser.TokenTypeProvider"); - TypeReference _tokenTypeProvider = this._ideaPluginClassNames.getTokenTypeProvider(grammar); - bindFactory.addTypeToType(_typeRef_3, _tokenTypeProvider); - TypeReference _typeRef_4 = TypeReference.typeRef("com.intellij.lang.ParserDefinition"); - TypeReference _parserDefinition = this._ideaPluginClassNames.getParserDefinition(grammar); - bindFactory.addTypeToType(_typeRef_4, _parserDefinition); - TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.idea.lang.IElementTypeProvider"); - TypeReference _elementTypeProvider = this._ideaPluginClassNames.getElementTypeProvider(grammar); - bindFactory.addTypeToTypeSingleton(_typeRef_5, _elementTypeProvider); - TypeReference _typeRef_6 = TypeReference.typeRef("org.eclipse.xtext.idea.facet.AbstractFacetConfiguration"); - TypeReference _facetConfiguration = this._ideaPluginClassNames.getFacetConfiguration(grammar); - bindFactory.addTypeToType(_typeRef_6, _facetConfiguration); - TypeReference _typeRef_7 = TypeReference.typeRef("com.intellij.facet.FacetTypeId"); + bindFactory.addTypeToType(TypeReference.typeRef("com.intellij.lang.PsiParser"), this._ideaPluginClassNames.getPsiParser(grammar)); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.parser.TokenTypeProvider"), this._ideaPluginClassNames.getTokenTypeProvider(grammar)); + bindFactory.addTypeToType(TypeReference.typeRef("com.intellij.lang.ParserDefinition"), this._ideaPluginClassNames.getParserDefinition(grammar)); + bindFactory.addTypeToTypeSingleton(TypeReference.typeRef("org.eclipse.xtext.idea.lang.IElementTypeProvider"), this._ideaPluginClassNames.getElementTypeProvider(grammar)); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.facet.AbstractFacetConfiguration"), this._ideaPluginClassNames.getFacetConfiguration(grammar)); + TypeReference _typeRef = TypeReference.typeRef("com.intellij.facet.FacetTypeId"); StringConcatenationClient _client_1 = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -184,10 +156,8 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append(".TYPEID"); } }; - bindFactory.addTypeToInstance(_typeRef_7, _client_1); - TypeReference _typeRef_8 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser"); - TypeReference _parserClass = this.caNaming.getParserClass(grammar); - bindFactory.addTypeToType(_typeRef_8, _parserClass); + bindFactory.addTypeToInstance(_typeRef, _client_1); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser"), this.caNaming.getParserClass(grammar)); StringConcatenationClient _client_2 = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -208,12 +178,9 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { bindFactory.addConfiguredBinding("ContentAssistLexer", _client_2); boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(grammar); if (_inheritsXbase) { - TypeReference _typeRef_9 = TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.AbstractTypeScopeProvider"); - TypeReference _typeRef_10 = TypeReference.typeRef("org.eclipse.xtext.idea.common.types.StubBasedTypeScopeProvider"); - bindFactory.addTypeToType(_typeRef_9, _typeRef_10); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.AbstractTypeScopeProvider"), TypeReference.typeRef("org.eclipse.xtext.idea.common.types.StubBasedTypeScopeProvider")); TypeReference _typeReference = new TypeReference("org.eclipse.xtext.xbase.typesystem.internal", "IFeatureScopeTracker.Provider"); - TypeReference _typeRef_11 = TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.OptimizingFeatureScopeTrackerProvider"); - bindFactory.addTypeToType(_typeReference, _typeRef_11); + bindFactory.addTypeToType(_typeReference, TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.OptimizingFeatureScopeTrackerProvider")); StringConcatenationClient _client_3 = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -236,31 +203,17 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { } }; bindFactory.addConfiguredBinding("LanguageSpecificPsiModelAssociations", _client_3); - TypeReference _typeRef_12 = TypeReference.typeRef("org.eclipse.xtext.idea.highlighting.IHighlightingConfiguration"); - TypeReference _typeRef_13 = TypeReference.typeRef("org.eclipse.xtext.xbase.idea.highlighting.XbaseHighlightingConfiguration"); - bindFactory.addTypeToType(_typeRef_12, _typeRef_13); - TypeReference _typeRef_14 = TypeReference.typeRef("org.eclipse.xtext.idea.formatting.BlockFactory"); - TypeReference _typeRef_15 = TypeReference.typeRef("org.eclipse.xtext.xbase.idea.formatting.XbaseBlockFactory"); - bindFactory.addTypeToType(_typeRef_14, _typeRef_15); - TypeReference _typeRef_16 = TypeReference.typeRef("org.eclipse.xtext.idea.formatting.ChildAttributesProvider"); - TypeReference _typeRef_17 = TypeReference.typeRef("org.eclipse.xtext.xbase.idea.formatting.XbaseChildAttributesProvider"); - bindFactory.addTypeToType(_typeRef_16, _typeRef_17); - TypeReference _typeRef_18 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.bracketmatching.IBracePairProvider"); - TypeReference _typeRef_19 = TypeReference.typeRef("org.eclipse.xtext.xbase.idea.bracketmatching.XbaseBracePairProvider"); - bindFactory.addTypeToType(_typeRef_18, _typeRef_19); - TypeReference _typeRef_20 = TypeReference.typeRef("org.eclipse.xtext.idea.findusages.IReferenceSearcher"); - TypeReference _typeRef_21 = TypeReference.typeRef("org.eclipse.xtext.xbase.idea.findusages.JvmElementAwareReferenceSearcher"); - bindFactory.addTypeToType(_typeRef_20, _typeRef_21); - TypeReference _typeRef_22 = TypeReference.typeRef("org.eclipse.xtext.xbase.compiler.IGeneratorConfigProvider"); - TypeReference _typeRef_23 = TypeReference.typeRef("org.eclipse.xtext.xbase.idea.facet.XbaseGeneratorConfigProvider"); - bindFactory.addTypeToType(_typeRef_22, _typeRef_23); - TypeReference _typeRef_24 = TypeReference.typeRef("org.eclipse.xtext.idea.findusages.WordsScannerProvider"); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.highlighting.IHighlightingConfiguration"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.highlighting.XbaseHighlightingConfiguration")); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.formatting.BlockFactory"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.formatting.XbaseBlockFactory")); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.formatting.ChildAttributesProvider"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.formatting.XbaseChildAttributesProvider")); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ide.editor.bracketmatching.IBracePairProvider"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.bracketmatching.XbaseBracePairProvider")); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.idea.findusages.IReferenceSearcher"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.findusages.JvmElementAwareReferenceSearcher")); + bindFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.compiler.IGeneratorConfigProvider"), TypeReference.typeRef("org.eclipse.xtext.xbase.idea.facet.XbaseGeneratorConfigProvider")); + TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.idea.findusages.WordsScannerProvider"); TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.xbase.idea.findusages", "XbaseWordsScanner.XbaseWordsScannerProvider"); - bindFactory.addTypeToType(_typeRef_24, _typeReference_1); + bindFactory.addTypeToType(_typeRef_1, _typeReference_1); } - IXtextGeneratorLanguage _language_2 = this.getLanguage(); - GuiceModuleAccess _ideaGenModule = _language_2.getIdeaGenModule(); - bindFactory.contributeTo(_ideaGenModule); + bindFactory.contributeTo(this.getLanguage().getIdeaGenModule()); JavaFileAccess _compileStandaloneSetup = this.compileStandaloneSetup(grammar); JavaFileAccess _compileIdeaSetup = this.compileIdeaSetup(grammar); JavaFileAccess _compileCompletionContributor = this.compileCompletionContributor(grammar); @@ -295,23 +248,12 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { Collections.unmodifiableList(CollectionLiterals.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) { final TextFileAccess pluginXml = this.compilePluginXml(grammar); - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - ISubProjectConfig _ideaPlugin_1 = _projectConfig_1.getIdeaPlugin(); - IXtextGeneratorFileSystemAccess _metaInf = _ideaPlugin_1.getMetaInf(); - String _path = pluginXml.getPath(); - boolean _isFile = _metaInf.isFile(_path); + boolean _isFile = this.getProjectConfig().getIdeaPlugin().getMetaInf().isFile(pluginXml.getPath()); boolean _not_1 = (!_isFile); if (_not_1) { - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - ISubProjectConfig _ideaPlugin_2 = _projectConfig_2.getIdeaPlugin(); - IXtextGeneratorFileSystemAccess _metaInf_1 = _ideaPlugin_2.getMetaInf(); - pluginXml.writeTo(_metaInf_1); + pluginXml.writeTo(this.getProjectConfig().getIdeaPlugin().getMetaInf()); } - TextFileAccess _compilePluginGenXml = this.compilePluginGenXml(grammar); - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - ISubProjectConfig _ideaPlugin_3 = _projectConfig_3.getIdeaPlugin(); - IXtextGeneratorFileSystemAccess _metaInf_2 = _ideaPlugin_3.getMetaInf(); - _compilePluginGenXml.writeTo(_metaInf_2); + this.compilePluginGenXml(grammar).writeTo(this.getProjectConfig().getIdeaPlugin().getMetaInf()); } } @@ -325,8 +267,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _extensionFactory = IdeaPluginGenerator.this._ideaPluginClassNames.getExtensionFactory(grammar); - String _simpleName = _extensionFactory.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getExtensionFactory(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" implements "); TypeReference _typeRef = TypeReference.typeRef("com.intellij.openapi.extensions.ExtensionFactory"); @@ -390,8 +331,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _codeBlockModificationListener = IdeaPluginGenerator.this._ideaPluginClassNames.getCodeBlockModificationListener(grammar); - String _simpleName = _codeBlockModificationListener.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getCodeBlockModificationListener(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.psi.BaseXtextCodeBlockModificationListener"); @@ -401,8 +341,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("public "); - TypeReference _codeBlockModificationListener_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getCodeBlockModificationListener(grammar); - String _simpleName_1 = _codeBlockModificationListener_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getCodeBlockModificationListener(grammar).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("("); TypeReference _typeRef_1 = TypeReference.typeRef("com.intellij.psi.util.PsiModificationTracker"); @@ -450,8 +389,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _pomDeclarationSearcher = IdeaPluginGenerator.this._ideaPluginClassNames.getPomDeclarationSearcher(it); - String _simpleName = _pomDeclarationSearcher.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getPomDeclarationSearcher(it).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.pom.AbstractXtextPomDeclarationSearcher"); @@ -461,15 +399,13 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("public "); - TypeReference _pomDeclarationSearcher_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getPomDeclarationSearcher(it); - String _simpleName_1 = _pomDeclarationSearcher_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getPomDeclarationSearcher(it).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("() {"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("super("); - Grammar _grammar = IdeaPluginGenerator.this.getGrammar(); - TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(_grammar); + TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(IdeaPluginGenerator.this.getGrammar()); _builder.append(_ideaLanguage, "\t\t"); _builder.append(".INSTANCE);"); _builder.newLineIfNotEmpty(); @@ -489,8 +425,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _psiParser = IdeaPluginGenerator.this._ideaPluginClassNames.getPsiParser(grammar); - String _simpleName = _psiParser.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getPsiParser(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.parser.AbstractXtextPsiParser"); @@ -499,8 +434,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.newLine(); { - List _initialHiddenTokens = IdeaPluginGenerator.this._grammarAccessExtensions.initialHiddenTokens(grammar); - boolean _isEmpty = _initialHiddenTokens.isEmpty(); + boolean _isEmpty = IdeaPluginGenerator.this._grammarAccessExtensions.initialHiddenTokens(grammar).isEmpty(); boolean _not = (!_isEmpty); if (_not) { _builder.append("\t"); @@ -516,9 +450,9 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append(Arrays.class, "\t"); _builder.append(".asList("); { - List _initialHiddenTokens_1 = IdeaPluginGenerator.this._grammarAccessExtensions.initialHiddenTokens(grammar); + List _initialHiddenTokens = IdeaPluginGenerator.this._grammarAccessExtensions.initialHiddenTokens(grammar); boolean _hasElements = false; - for(final String hidden : _initialHiddenTokens_1) { + for(final String hidden : _initialHiddenTokens) { if (!_hasElements) { _hasElements = true; } else { @@ -624,8 +558,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _antlrTokenFileProvider = IdeaPluginGenerator.this._ideaPluginClassNames.getAntlrTokenFileProvider(grammar); - String _simpleName = _antlrTokenFileProvider.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getAntlrTokenFileProvider(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" implements "); _builder.append(IAntlrTokenFileProvider.class); @@ -724,8 +657,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append(""); _builder.newLine(); { - EList _metamodelDeclarations = grammar.getMetamodelDeclarations(); - Iterable _filter = Iterables.filter(_metamodelDeclarations, GeneratedMetamodel.class); + Iterable _filter = Iterables.filter(grammar.getMetamodelDeclarations(), GeneratedMetamodel.class); for(final GeneratedMetamodel generatedMetamodel : _filter) { _builder.append("\t\t"); _builder.append(" _fileExtensions = _language.getFileExtensions(); - String _head = IterableExtensions.head(_fileExtensions); + String _head = IterableExtensions.head(IdeaPluginGenerator.this.getLanguage().getFileExtensions()); _builder.append(_head, "\t\t\t"); _builder.append("\""); _builder.newLineIfNotEmpty(); @@ -785,9 +713,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t\t\t"); _builder.append("uriExtension=\""); - IXtextGeneratorLanguage _language_1 = IdeaPluginGenerator.this.getLanguage(); - List _fileExtensions_1 = _language_1.getFileExtensions(); - String _head_1 = IterableExtensions.head(_fileExtensions_1); + String _head_1 = IterableExtensions.head(IdeaPluginGenerator.this.getLanguage().getFileExtensions()); _builder.append(_head_1, "\t\t\t"); _builder.append("\""); _builder.newLineIfNotEmpty(); @@ -849,28 +775,23 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append("\"/>"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); - TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.lang.BaseXtextASTFactory"); - CharSequence _compileExtension = IdeaPluginGenerator.this.compileExtension(grammar, "lang.ast.factory", _typeRef); + CharSequence _compileExtension = IdeaPluginGenerator.this.compileExtension(grammar, "lang.ast.factory", TypeReference.typeRef("org.eclipse.xtext.idea.lang.BaseXtextASTFactory")); _builder.append(_compileExtension, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); - TypeReference _parserDefinition = IdeaPluginGenerator.this._ideaPluginClassNames.getParserDefinition(grammar); - CharSequence _compileExtension_1 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.parserDefinition", _parserDefinition); + CharSequence _compileExtension_1 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.parserDefinition", IdeaPluginGenerator.this._ideaPluginClassNames.getParserDefinition(grammar)); _builder.append(_compileExtension_1, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.idea.findusages.BaseXtextFindUsageProvider"); - CharSequence _compileExtension_2 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.findUsagesProvider", _typeRef_1); + CharSequence _compileExtension_2 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.findUsagesProvider", TypeReference.typeRef("org.eclipse.xtext.idea.findusages.BaseXtextFindUsageProvider")); _builder.append(_compileExtension_2, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); - TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.idea.refactoring.BaseXtextRefactoringSupportProvider"); - CharSequence _compileExtension_3 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.refactoringSupport", _typeRef_2); + CharSequence _compileExtension_3 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.refactoringSupport", TypeReference.typeRef("org.eclipse.xtext.idea.refactoring.BaseXtextRefactoringSupportProvider")); _builder.append(_compileExtension_3, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); - TypeReference _typeRef_3 = TypeReference.typeRef("com.intellij.lang.refactoring.NamesValidator"); - CharSequence _compileExtension_4 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.namesValidator", _typeRef_3); + CharSequence _compileExtension_4 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.namesValidator", TypeReference.typeRef("com.intellij.lang.refactoring.NamesValidator")); _builder.append(_compileExtension_4, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); @@ -883,13 +804,11 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append("\" />"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); - TypeReference _typeRef_4 = TypeReference.typeRef("com.intellij.lang.PairedBraceMatcher"); - CharSequence _compileExtension_5 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.braceMatcher", _typeRef_4); + CharSequence _compileExtension_5 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.braceMatcher", TypeReference.typeRef("com.intellij.lang.PairedBraceMatcher")); _builder.append(_compileExtension_5, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); - TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.idea.annotation.IssueAnnotator"); - CharSequence _compileExtension_6 = IdeaPluginGenerator.this.compileExtension(grammar, "annotator", _typeRef_5); + CharSequence _compileExtension_6 = IdeaPluginGenerator.this.compileExtension(grammar, "annotator", TypeReference.typeRef("org.eclipse.xtext.idea.annotation.IssueAnnotator")); _builder.append(_compileExtension_6, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); @@ -909,8 +828,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("\t\t"); - TypeReference _typeRef_6 = TypeReference.typeRef("com.intellij.lang.PsiStructureViewFactory"); - CharSequence _compileExtension_7 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.psiStructureViewFactory", _typeRef_6); + CharSequence _compileExtension_7 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.psiStructureViewFactory", TypeReference.typeRef("com.intellij.lang.PsiStructureViewFactory")); _builder.append(_compileExtension_7, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); @@ -920,8 +838,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append("\"/>"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); - TypeReference _typeRef_7 = TypeReference.typeRef("org.eclipse.xtext.idea.documentation.IdeaDocumentationProvider"); - CharSequence _compileExtension_8 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.documentationProvider", _typeRef_7); + CharSequence _compileExtension_8 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.documentationProvider", TypeReference.typeRef("org.eclipse.xtext.idea.documentation.IdeaDocumentationProvider")); _builder.append(_compileExtension_8, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); @@ -938,13 +855,11 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("\t\t"); - TypeReference _typeRef_8 = TypeReference.typeRef("com.intellij.formatting.FormattingModelBuilder"); - CharSequence _compileExtension_9 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.formatter", _typeRef_8); + CharSequence _compileExtension_9 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.formatter", TypeReference.typeRef("com.intellij.formatting.FormattingModelBuilder")); _builder.append(_compileExtension_9, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); - TypeReference _typeRef_9 = TypeReference.typeRef("com.intellij.lang.CodeDocumentationAwareCommenter"); - CharSequence _compileExtension_10 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.commenter", _typeRef_9); + CharSequence _compileExtension_10 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.commenter", TypeReference.typeRef("com.intellij.lang.CodeDocumentationAwareCommenter")); _builder.append(_compileExtension_10, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -991,8 +906,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public final class "); - TypeReference _fileImpl = IdeaPluginGenerator.this._ideaPluginClassNames.getFileImpl(grammar); - String _simpleName = _fileImpl.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getFileImpl(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.psi.impl.BaseXtextFile"); @@ -1002,8 +916,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("public "); - TypeReference _fileImpl_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileImpl(grammar); - String _simpleName_1 = _fileImpl_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileImpl(grammar).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("("); TypeReference _typeRef_1 = TypeReference.typeRef("com.intellij.psi.FileViewProvider"); @@ -1051,8 +964,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _fileTypeFactory = IdeaPluginGenerator.this._ideaPluginClassNames.getFileTypeFactory(grammar); - String _simpleName = _fileTypeFactory.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getFileTypeFactory(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("com.intellij.openapi.fileTypes.FileTypeFactory"); @@ -1098,8 +1010,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _abstractFileType = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractFileType(grammar); - String _simpleName = _abstractFileType.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractFileType(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("com.intellij.openapi.fileTypes.LanguageFileType"); @@ -1121,8 +1032,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("protected "); - TypeReference _abstractFileType_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractFileType(grammar); - String _simpleName_1 = _abstractFileType_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractFileType(grammar).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("(final "); TypeReference _typeRef_2 = TypeReference.typeRef("com.intellij.lang.Language"); @@ -1216,8 +1126,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("class "); - TypeReference _fileType = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar); - String _simpleName = _fileType.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _abstractFileType = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractFileType(grammar); @@ -1226,12 +1135,10 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("public static final "); - TypeReference _fileType_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar); - String _simpleName_1 = _fileType_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append(" INSTANCE = new "); - TypeReference _fileType_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar); - String _simpleName_2 = _fileType_2.getSimpleName(); + String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName(); _builder.append(_simpleName_2, "\t"); _builder.append("()"); _builder.newLineIfNotEmpty(); @@ -1260,8 +1167,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _fileType = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar); - String _simpleName = _fileType.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _abstractFileType = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractFileType(grammar); @@ -1270,12 +1176,10 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("public static final "); - TypeReference _fileType_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar); - String _simpleName_1 = _fileType_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append(" INSTANCE = new "); - TypeReference _fileType_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar); - String _simpleName_2 = _fileType_2.getSimpleName(); + String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName(); _builder.append(_simpleName_2, "\t"); _builder.append("();"); _builder.newLineIfNotEmpty(); @@ -1283,8 +1187,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("public "); - TypeReference _fileType_3 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar); - String _simpleName_3 = _fileType_3.getSimpleName(); + String _simpleName_3 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName(); _builder.append(_simpleName_3, "\t"); _builder.append("() {"); _builder.newLineIfNotEmpty(); @@ -1312,8 +1215,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public final class "); - TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar); - String _simpleName = _ideaLanguage.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.lang.AbstractXtextLanguage"); @@ -1323,20 +1225,17 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("public static final "); - TypeReference _ideaLanguage_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar); - String _simpleName_1 = _ideaLanguage_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append(" INSTANCE = new "); - TypeReference _ideaLanguage_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar); - String _simpleName_2 = _ideaLanguage_2.getSimpleName(); + String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName(); _builder.append(_simpleName_2, "\t"); _builder.append("();"); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("\t"); _builder.append("private "); - TypeReference _ideaLanguage_3 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar); - String _simpleName_3 = _ideaLanguage_3.getSimpleName(); + String _simpleName_3 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName(); _builder.append(_simpleName_3, "\t"); _builder.append("() {"); _builder.newLineIfNotEmpty(); @@ -1366,8 +1265,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("class "); - TypeReference _ideaStandaloneSetup = IdeaPluginGenerator.this._xtextGeneratorNaming.getIdeaStandaloneSetup(grammar); - String _simpleName = _ideaStandaloneSetup.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._xtextGeneratorNaming.getIdeaStandaloneSetup(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _runtimeGenSetup = IdeaPluginGenerator.this._xtextGeneratorNaming.getRuntimeGenSetup(grammar); @@ -1413,8 +1311,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _ideaStandaloneSetup = IdeaPluginGenerator.this._xtextGeneratorNaming.getIdeaStandaloneSetup(grammar); - String _simpleName = _ideaStandaloneSetup.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._xtextGeneratorNaming.getIdeaStandaloneSetup(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _runtimeGenSetup = IdeaPluginGenerator.this._xtextGeneratorNaming.getRuntimeGenSetup(grammar); @@ -1477,8 +1374,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("class "); - TypeReference _ideaSetup = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaSetup(grammar); - String _simpleName = _ideaSetup.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaSetup(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" implements "); _builder.append(ISetup.class); @@ -1514,8 +1410,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _ideaSetup = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaSetup(grammar); - String _simpleName = _ideaSetup.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaSetup(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" implements "); _builder.append(ISetup.class); @@ -1555,24 +1450,17 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { } public JavaFileAccess compileElementTypeProvider(final Grammar grammar) { - TypeReference _elementTypeProvider = this._ideaPluginClassNames.getElementTypeProvider(grammar); - final JavaFileAccess file = this.fileAccessFactory.createJavaFile(_elementTypeProvider); - TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.lang.IElementTypeProvider"); - file.importType(_typeRef); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.psi.stubs.XtextFileElementType"); - file.importType(_typeRef_1); - TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.psi.stubs.XtextFileStub"); - file.importType(_typeRef_2); - TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.psi.tree.IGrammarAwareElementType"); - file.importType(_typeRef_3); - TypeReference _typeRef_4 = TypeReference.typeRef("com.intellij.psi.tree.IFileElementType"); - file.importType(_typeRef_4); + final JavaFileAccess file = this.fileAccessFactory.createJavaFile(this._ideaPluginClassNames.getElementTypeProvider(grammar)); + file.importType(TypeReference.typeRef("org.eclipse.xtext.idea.lang.IElementTypeProvider")); + file.importType(TypeReference.typeRef("org.eclipse.xtext.psi.stubs.XtextFileElementType")); + file.importType(TypeReference.typeRef("org.eclipse.xtext.psi.stubs.XtextFileStub")); + file.importType(TypeReference.typeRef("org.eclipse.xtext.psi.tree.IGrammarAwareElementType")); + file.importType(TypeReference.typeRef("com.intellij.psi.tree.IFileElementType")); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _elementTypeProvider = IdeaPluginGenerator.this._ideaPluginClassNames.getElementTypeProvider(grammar); - String _simpleName = _elementTypeProvider.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getElementTypeProvider(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" implements IElementTypeProvider {"); _builder.newLineIfNotEmpty(); @@ -1659,9 +1547,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append("}"); _builder.newLine(); { - TreeIterator _eAllContents = rule.eAllContents(); - Iterator _filter = Iterators.filter(_eAllContents, AbstractElement.class); - Iterable _iterable = IteratorExtensions.toIterable(_filter); + Iterable _iterable = IteratorExtensions.toIterable(Iterators.filter(rule.eAllContents(), AbstractElement.class)); for(final AbstractElement element : _iterable) { _builder.append("\t"); _builder.append("\t"); @@ -1710,9 +1596,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append("ElementType());"); _builder.newLineIfNotEmpty(); { - TreeIterator _eAllContents_1 = rule.eAllContents(); - Iterator _filter_1 = Iterators.filter(_eAllContents_1, AbstractElement.class); - Iterable _iterable_1 = IteratorExtensions.toIterable(_filter_1); + Iterable _iterable_1 = IteratorExtensions.toIterable(Iterators.filter(rule.eAllContents(), AbstractElement.class)); for(final AbstractElement element_1 : _iterable_1) { _builder.newLine(); _builder.append("\t"); @@ -1781,9 +1665,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append("}"); _builder.newLine(); { - TreeIterator _eAllContents_2 = rule_1.eAllContents(); - Iterator _filter_2 = Iterators.filter(_eAllContents_2, AbstractElement.class); - Iterable _iterable_2 = IteratorExtensions.toIterable(_filter_2); + Iterable _iterable_2 = IteratorExtensions.toIterable(Iterators.filter(rule_1.eAllContents(), AbstractElement.class)); for(final AbstractElement element_2 : _iterable_2) { _builder.append("\t"); _builder.newLine(); @@ -1828,8 +1710,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append(Singleton.class); _builder.newLineIfNotEmpty(); _builder.append("public class "); - TypeReference _tokenTypeProvider = IdeaPluginGenerator.this._ideaPluginClassNames.getTokenTypeProvider(grammar); - String _simpleName = _tokenTypeProvider.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getTokenTypeProvider(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" implements "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.parser.TokenTypeProvider"); @@ -1875,12 +1756,11 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.newLine(); { - List _allTerminalRules = GrammarUtil.allTerminalRules(grammar); final Function1 _function = (TerminalRule it) -> { String _name = it.getName(); return Boolean.valueOf(Objects.equal(_name, "WS")); }; - boolean _exists = IterableExtensions.exists(_allTerminalRules, _function); + boolean _exists = IterableExtensions.exists(GrammarUtil.allTerminalRules(grammar), _function); if (_exists) { _builder.append("\t"); _builder.append("private static final "); @@ -1924,12 +1804,11 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append(".RULE_ML_COMMENT]);"); _builder.newLineIfNotEmpty(); } else { - List _allTerminalRules_1 = GrammarUtil.allTerminalRules(grammar); final Function1 _function_1 = (TerminalRule it) -> { String _name = it.getName(); return Boolean.valueOf(Objects.equal(_name, "SL_COMMENT")); }; - boolean _exists_1 = IterableExtensions.exists(_allTerminalRules_1, _function_1); + boolean _exists_1 = IterableExtensions.exists(GrammarUtil.allTerminalRules(grammar), _function_1); if (_exists_1) { _builder.append("\t"); _builder.append("private static final "); @@ -1942,12 +1821,11 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.append(".RULE_SL_COMMENT]);"); _builder.newLineIfNotEmpty(); } else { - List _allTerminalRules_2 = GrammarUtil.allTerminalRules(grammar); final Function1 _function_2 = (TerminalRule it) -> { String _name = it.getName(); return Boolean.valueOf(Objects.equal(_name, "ML_COMMENT")); }; - boolean _exists_2 = IterableExtensions.exists(_allTerminalRules_2, _function_2); + boolean _exists_2 = IterableExtensions.exists(GrammarUtil.allTerminalRules(grammar), _function_2); if (_exists_2) { _builder.append("\t"); _builder.append("private static final "); @@ -1972,12 +1850,11 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { } } { - List _allTerminalRules_3 = GrammarUtil.allTerminalRules(grammar); final Function1 _function_3 = (TerminalRule it) -> { String _name = it.getName(); return Boolean.valueOf(Objects.equal(_name, "STRING")); }; - boolean _exists_3 = IterableExtensions.exists(_allTerminalRules_3, _function_3); + boolean _exists_3 = IterableExtensions.exists(GrammarUtil.allTerminalRules(grammar), _function_3); if (_exists_3) { _builder.append("\t"); _builder.append("private static final "); @@ -2096,8 +1973,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _syntaxHighlighterFactory = IdeaPluginGenerator.this._ideaPluginClassNames.getSyntaxHighlighterFactory(grammar); - String _simpleName = _syntaxHighlighterFactory.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getSyntaxHighlighterFactory(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(lazySyntaxHighlighter); @@ -2142,8 +2018,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _semanticHighlightVisitor = IdeaPluginGenerator.this._ideaPluginClassNames.getSemanticHighlightVisitor(grammar); - String _simpleName = _semanticHighlightVisitor.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getSemanticHighlightVisitor(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.highlighting.SemanticHighlightVisitor"); @@ -2152,8 +2027,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("public "); - TypeReference _semanticHighlightVisitor_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getSemanticHighlightVisitor(grammar); - String _simpleName_1 = _semanticHighlightVisitor_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getSemanticHighlightVisitor(grammar).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("() {"); _builder.newLineIfNotEmpty(); @@ -2173,18 +2047,16 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { } public JavaFileAccess compileParserDefinition(final Grammar grammar) { - List _allRules = GrammarUtil.allRules(grammar); final Function1 _function = (AbstractRule it) -> { return Boolean.valueOf(GrammarUtil.isEObjectRule(it)); }; - final Iterable EObjectRules = IterableExtensions.filter(_allRules, _function); + final Iterable EObjectRules = IterableExtensions.filter(GrammarUtil.allRules(grammar), _function); TypeReference _parserDefinition = this._ideaPluginClassNames.getParserDefinition(grammar); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _parserDefinition = IdeaPluginGenerator.this._ideaPluginClassNames.getParserDefinition(grammar); - String _simpleName = _parserDefinition.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getParserDefinition(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _superParserDefinition = IdeaPluginGenerator.this._ideaPluginClassNames.getSuperParserDefinition(grammar); @@ -2373,7 +2245,6 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { } protected Iterable getEObjectElements(final AbstractRule rule) { - List _eAllOfType = EcoreUtil2.eAllOfType(rule, AbstractElement.class); final Function1 _function = (AbstractElement element) -> { boolean _switchResult = false; boolean _matched = false; @@ -2396,7 +2267,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { } return Boolean.valueOf(_switchResult); }; - return IterableExtensions.filter(_eAllOfType, _function); + return IterableExtensions.filter(EcoreUtil2.eAllOfType(rule, AbstractElement.class), _function); } protected boolean isNamed(final EObject element) { @@ -2455,9 +2326,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { if (!_and_1) { _and = false; } else { - EClassifier _eType_1 = feature.getEType(); - Class _instanceClass_1 = _eType_1.getInstanceClass(); - boolean _isAssignableFrom = String.class.isAssignableFrom(_instanceClass_1); + boolean _isAssignableFrom = String.class.isAssignableFrom(feature.getEType().getInstanceClass()); _and = _isAssignableFrom; } _xblockexpression = _and; @@ -2471,8 +2340,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _abstractCompletionContributor = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractCompletionContributor(grammar); - String _simpleName = _abstractCompletionContributor.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractCompletionContributor(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _completionContributorSuperClass = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributorSuperClass(grammar); @@ -2481,8 +2349,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("public "); - TypeReference _abstractCompletionContributor_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractCompletionContributor(grammar); - String _simpleName_1 = _abstractCompletionContributor_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractCompletionContributor(grammar).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("("); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.lang.AbstractXtextLanguage"); @@ -2511,8 +2378,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("class "); - TypeReference _completionContributor = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar); - String _simpleName = _completionContributor.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _abstractCompletionContributor = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractCompletionContributor(grammar); @@ -2559,8 +2425,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _completionContributor = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar); - String _simpleName = _completionContributor.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _abstractCompletionContributor = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractCompletionContributor(grammar); @@ -2569,8 +2434,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("public "); - TypeReference _completionContributor_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar); - String _simpleName_1 = _completionContributor_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("() {"); _builder.newLineIfNotEmpty(); @@ -2587,8 +2451,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("public "); - TypeReference _completionContributor_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar); - String _simpleName_2 = _completionContributor_2.getSimpleName(); + String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar).getSimpleName(); _builder.append(_simpleName_2, "\t"); _builder.append("("); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.lang.AbstractXtextLanguage"); @@ -2633,34 +2496,23 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { JavaFileAccess _xifexpression = null; boolean _isGenerateXtendStub = this.isGenerateXtendStub(); if (_isGenerateXtendStub) { - TypeReference _facetConfiguration = this._ideaPluginClassNames.getFacetConfiguration(grammar); - _xifexpression = this.fileAccessFactory.createXtendFile(_facetConfiguration); + _xifexpression = this.fileAccessFactory.createXtendFile(this._ideaPluginClassNames.getFacetConfiguration(grammar)); } else { - TypeReference _facetConfiguration_1 = this._ideaPluginClassNames.getFacetConfiguration(grammar); - _xifexpression = this.fileAccessFactory.createJavaFile(_facetConfiguration_1); + _xifexpression = this.fileAccessFactory.createJavaFile(this._ideaPluginClassNames.getFacetConfiguration(grammar)); } final JavaFileAccess file = _xifexpression; - TypeReference _typeRef = TypeReference.typeRef("com.intellij.openapi.components.PersistentStateComponent"); - file.importType(_typeRef); - TypeReference _typeRef_1 = TypeReference.typeRef("com.intellij.openapi.components.State"); - file.importType(_typeRef_1); - TypeReference _typeRef_2 = TypeReference.typeRef("com.intellij.openapi.components.Storage"); - file.importType(_typeRef_2); - TypeReference _typeRef_3 = TypeReference.typeRef("com.intellij.openapi.components.StoragePathMacros"); - file.importType(_typeRef_3); - TypeReference _typeRef_4 = TypeReference.typeRef("com.intellij.openapi.components.StorageScheme"); - file.importType(_typeRef_4); + file.importType(TypeReference.typeRef("com.intellij.openapi.components.PersistentStateComponent")); + file.importType(TypeReference.typeRef("com.intellij.openapi.components.State")); + file.importType(TypeReference.typeRef("com.intellij.openapi.components.Storage")); + file.importType(TypeReference.typeRef("com.intellij.openapi.components.StoragePathMacros")); + file.importType(TypeReference.typeRef("com.intellij.openapi.components.StorageScheme")); boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(grammar); if (_inheritsXbase) { - TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.xbase.idea.facet.XbaseFacetConfiguration"); - file.importType(_typeRef_5); - TypeReference _typeRef_6 = TypeReference.typeRef("org.eclipse.xtext.xbase.idea.facet.XbaseGeneratorConfigurationState"); - file.importType(_typeRef_6); + file.importType(TypeReference.typeRef("org.eclipse.xtext.xbase.idea.facet.XbaseFacetConfiguration")); + file.importType(TypeReference.typeRef("org.eclipse.xtext.xbase.idea.facet.XbaseGeneratorConfigurationState")); } else { - TypeReference _typeRef_7 = TypeReference.typeRef("org.eclipse.xtext.idea.facet.AbstractFacetConfiguration"); - file.importType(_typeRef_7); - TypeReference _typeRef_8 = TypeReference.typeRef("org.eclipse.xtext.idea.facet.GeneratorConfigurationState"); - file.importType(_typeRef_8); + file.importType(TypeReference.typeRef("org.eclipse.xtext.idea.facet.AbstractFacetConfiguration")); + file.importType(TypeReference.typeRef("org.eclipse.xtext.idea.facet.GeneratorConfigurationState")); } StringConcatenationClient _client = new StringConcatenationClient() { @Override @@ -2713,8 +2565,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { } } _builder.append(" class "); - TypeReference _facetConfiguration = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetConfiguration(grammar); - String _simpleName_2 = _facetConfiguration.getSimpleName(); + String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetConfiguration(grammar).getSimpleName(); _builder.append(_simpleName_2); _builder.append(" extends "); { @@ -2737,20 +2588,16 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { } public JavaFileAccess compileFacetType(final Grammar grammar) { - TypeReference _facetConfiguration = this._ideaPluginClassNames.getFacetConfiguration(grammar); - TypeReference _typeRef = TypeReference.typeRef("com.intellij.facet.Facet", _facetConfiguration); - final TypeReference faceTypeId = TypeReference.typeRef("com.intellij.facet.FacetTypeId", _typeRef); + final TypeReference faceTypeId = TypeReference.typeRef("com.intellij.facet.FacetTypeId", TypeReference.typeRef("com.intellij.facet.Facet", this._ideaPluginClassNames.getFacetConfiguration(grammar))); TypeReference _facetType = this._ideaPluginClassNames.getFacetType(grammar); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _facetType = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetType(grammar); - String _simpleName = _facetType.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetType(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - TypeReference _facetConfiguration = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetConfiguration(grammar); - TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.facet.AbstractFacetType", _facetConfiguration); + TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.facet.AbstractFacetType", IdeaPluginGenerator.this._ideaPluginClassNames.getFacetConfiguration(grammar)); _builder.append(_typeRef); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -2768,8 +2615,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("public "); - TypeReference _facetType_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetType(grammar); - String _simpleName_1 = _facetType_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetType(grammar).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("() {"); _builder.newLineIfNotEmpty(); @@ -2803,8 +2649,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _baseColorSettingsPage = IdeaPluginGenerator.this._ideaPluginClassNames.baseColorSettingsPage(grammar); - String _simpleName = _baseColorSettingsPage.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.baseColorSettingsPage(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.highlighting.AbstractColorSettingsPage"); @@ -2815,8 +2660,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("public "); - TypeReference _baseColorSettingsPage_1 = IdeaPluginGenerator.this._ideaPluginClassNames.baseColorSettingsPage(grammar); - String _simpleName_1 = _baseColorSettingsPage_1.getSimpleName(); + String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.baseColorSettingsPage(grammar).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("() {"); _builder.newLineIfNotEmpty(); @@ -2860,8 +2704,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("class "); - TypeReference _colorSettingsPage = IdeaPluginGenerator.this._ideaPluginClassNames.colorSettingsPage(grammar); - String _simpleName = _colorSettingsPage.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.colorSettingsPage(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _baseColorSettingsPage = IdeaPluginGenerator.this._ideaPluginClassNames.baseColorSettingsPage(grammar); @@ -2879,8 +2722,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _colorSettingsPage = IdeaPluginGenerator.this._ideaPluginClassNames.colorSettingsPage(grammar); - String _simpleName = _colorSettingsPage.getSimpleName(); + String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.colorSettingsPage(grammar).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _baseColorSettingsPage = IdeaPluginGenerator.this._ideaPluginClassNames.baseColorSettingsPage(grammar); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/parser/antlr/PsiAntlrGrammarGenerator.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/parser/antlr/PsiAntlrGrammarGenerator.java index 011a6e1a3..42916300b 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/parser/antlr/PsiAntlrGrammarGenerator.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/parser/antlr/PsiAntlrGrammarGenerator.java @@ -60,15 +60,12 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen StringConcatenation _builder = new StringConcatenation(); _builder.newLine(); _builder.append("import "); - GrammarNaming _grammarNaming = this.getGrammarNaming(); - TypeReference _internalParserSuperClass = _grammarNaming.getInternalParserSuperClass(it); - String _name = _internalParserSuperClass.getName(); + String _name = this.getGrammarNaming().getInternalParserSuperClass(it).getName(); _builder.append(_name); _builder.append(";"); _builder.newLineIfNotEmpty(); _builder.append("import "); - Grammar _grammar = GrammarUtil.getGrammar(it); - TypeReference _elementTypeProvider = this._ideaPluginClassNames.getElementTypeProvider(_grammar); + TypeReference _elementTypeProvider = this._ideaPluginClassNames.getElementTypeProvider(GrammarUtil.getGrammar(it)); _builder.append(_elementTypeProvider); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -87,8 +84,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen } } _builder.append("import "); - TypeReference _grammarAccess = this._grammarAccessExtensions.getGrammarAccess(it); - String _name_1 = _grammarAccess.getName(); + String _name_1 = this._grammarAccessExtensions.getGrammarAccess(it).getName(); _builder.append(_name_1); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -123,35 +119,27 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen } _builder.append("\t"); _builder.append("protected "); - TypeReference _grammarAccess = this._grammarAccessExtensions.getGrammarAccess(it); - String _simpleName = _grammarAccess.getSimpleName(); + String _simpleName = this._grammarAccessExtensions.getGrammarAccess(it).getSimpleName(); _builder.append(_simpleName, "\t"); _builder.append(" grammarAccess;"); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("\t"); _builder.append("protected "); - Grammar _grammar = GrammarUtil.getGrammar(it); - TypeReference _elementTypeProvider = this._ideaPluginClassNames.getElementTypeProvider(_grammar); - String _simpleName_1 = _elementTypeProvider.getSimpleName(); + String _simpleName_1 = this._ideaPluginClassNames.getElementTypeProvider(GrammarUtil.getGrammar(it)).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append(" elementTypeProvider;"); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("\t"); _builder.append("public "); - Grammar _grammar_1 = GrammarUtil.getGrammar(it); - TypeReference _psiInternalParser = this._ideaPluginClassNames.getPsiInternalParser(_grammar_1); - String _simpleName_2 = _psiInternalParser.getSimpleName(); + String _simpleName_2 = this._ideaPluginClassNames.getPsiInternalParser(GrammarUtil.getGrammar(it)).getSimpleName(); _builder.append(_simpleName_2, "\t"); _builder.append("(PsiBuilder builder, TokenStream input, "); - Grammar _grammar_2 = GrammarUtil.getGrammar(it); - TypeReference _elementTypeProvider_1 = this._ideaPluginClassNames.getElementTypeProvider(_grammar_2); - String _simpleName_3 = _elementTypeProvider_1.getSimpleName(); + String _simpleName_3 = this._ideaPluginClassNames.getElementTypeProvider(GrammarUtil.getGrammar(it)).getSimpleName(); _builder.append(_simpleName_3, "\t"); _builder.append(" elementTypeProvider, "); - TypeReference _grammarAccess_1 = this._grammarAccessExtensions.getGrammarAccess(it); - String _simpleName_4 = _grammarAccess_1.getSimpleName(); + String _simpleName_4 = this._grammarAccessExtensions.getGrammarAccess(it).getSimpleName(); _builder.append(_simpleName_4, "\t"); _builder.append(" grammarAccess) {"); _builder.newLineIfNotEmpty(); @@ -179,9 +167,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen _builder.newLine(); _builder.append("\t\t"); _builder.append("return \""); - List _allParserRules = GrammarUtil.allParserRules(it); - ParserRule _head = IterableExtensions.head(_allParserRules); - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(_head); + ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(IterableExtensions.head(GrammarUtil.allParserRules(it))); String _name = ((AbstractRule) _originalElement).getName(); _builder.append(_name, "\t\t"); _builder.append("\";"); @@ -228,20 +214,17 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("iv_"); - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _ruleName = this._grammarAccessExtensions.ruleName(_originalElement); + String _ruleName = this._grammarAccessExtensions.ruleName(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_ruleName, "\t"); _builder.append("="); - ParserRule _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _ruleName_1 = this._grammarAccessExtensions.ruleName(_originalElement_1); + String _ruleName_1 = this._grammarAccessExtensions.ruleName(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_ruleName_1, "\t"); String _defaultArgumentList = AntlrGrammarGenUtil.getDefaultArgumentList(it); _builder.append(_defaultArgumentList, "\t"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("{ $current=$iv_"); - ParserRule _originalElement_2 = AntlrGrammarGenUtil.getOriginalElement(it); - String _ruleName_2 = this._grammarAccessExtensions.ruleName(_originalElement_2); + String _ruleName_2 = this._grammarAccessExtensions.ruleName(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_ruleName_2, "\t"); _builder.append(".current; }"); _builder.newLineIfNotEmpty(); @@ -491,8 +474,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen _builder.newLineIfNotEmpty(); _builder.append("}"); _builder.newLine(); - Assignment _containingAssignment = GrammarUtil.containingAssignment(it); - String _localVar = this._grammarAccessExtensions.localVar(_containingAssignment, it); + String _localVar = this._grammarAccessExtensions.localVar(GrammarUtil.containingAssignment(it), it); _builder.append(_localVar); _builder.append("="); String __ebnf2 = super._ebnf2(it, options, supportActions); @@ -602,9 +584,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen } if (!_matched) { if (_rule instanceof ParserRule) { - AbstractRule _rule_1 = it.getRule(); - AbstractRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(_rule_1); - boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(_originalElement); + boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(AntlrGrammarGenUtil.getOriginalElement(it.getRule())); if (_isDatatypeRule) { _matched=true; } @@ -801,8 +781,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen _builder_1.newLineIfNotEmpty(); _builder_1.append("}"); _builder_1.newLine(); - Assignment _containingAssignment = GrammarUtil.containingAssignment(ref); - String _localVar = this._grammarAccessExtensions.localVar(_containingAssignment); + String _localVar = this._grammarAccessExtensions.localVar(GrammarUtil.containingAssignment(ref)); _builder_1.append(_localVar); _builder_1.append("="); String _crossrefEbnf_1 = super.crossrefEbnf(it, call, ref, supportActions); @@ -811,9 +790,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen _builder_1.append("{"); _builder_1.newLine(); _builder_1.append("\t"); - Assignment _containingAssignment_1 = GrammarUtil.containingAssignment(ref); - String _localVar_1 = this._grammarAccessExtensions.localVar(_containingAssignment_1); - CharSequence _doneLeaf = this.doneLeaf(ref, _localVar_1); + CharSequence _doneLeaf = this.doneLeaf(ref, this._grammarAccessExtensions.localVar(GrammarUtil.containingAssignment(ref))); _builder_1.append(_doneLeaf, "\t"); _builder_1.newLineIfNotEmpty(); _builder_1.append("}"); @@ -1019,8 +996,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen protected CharSequence markLeaf(final EObject it) { StringConcatenation _builder = new StringConcatenation(); _builder.append("markLeaf(elementTypeProvider.get"); - EObject _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementIdentifier = this._grammarAccessExtensions.grammarElementIdentifier(_originalElement); + String _grammarElementIdentifier = this._grammarAccessExtensions.grammarElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementIdentifier); _builder.append("ElementType());"); return _builder; @@ -1037,8 +1013,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen protected CharSequence markComposite(final EObject it) { StringConcatenation _builder = new StringConcatenation(); _builder.append("markComposite(elementTypeProvider.get"); - EObject _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementIdentifier = this._grammarAccessExtensions.grammarElementIdentifier(_originalElement); + String _grammarElementIdentifier = this._grammarAccessExtensions.grammarElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementIdentifier); _builder.append("ElementType());"); return _builder; @@ -1053,8 +1028,7 @@ public class PsiAntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGen protected CharSequence precedeComposite(final EObject it) { StringConcatenation _builder = new StringConcatenation(); _builder.append("precedeComposite(elementTypeProvider.get"); - EObject _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementIdentifier = this._grammarAccessExtensions.grammarElementIdentifier(_originalElement); + String _grammarElementIdentifier = this._grammarAccessExtensions.grammarElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementIdentifier); _builder.append("ElementType());"); return _builder; diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/parser/antlr/XtextAntlrIDEAGeneratorFragment.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/parser/antlr/XtextAntlrIDEAGeneratorFragment.java index a813d0b91..fcea3dc36 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/parser/antlr/XtextAntlrIDEAGeneratorFragment.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/idea/parser/antlr/XtextAntlrIDEAGeneratorFragment.java @@ -9,18 +9,11 @@ package org.eclipse.xtext.xtext.generator.idea.parser.antlr; import com.google.inject.Inject; import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.Grammar; import org.eclipse.xtext.xbase.lib.Extension; -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.project.ISubProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2; -import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar; -import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrOptions; -import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrToolFacade; @SuppressWarnings("all") public class XtextAntlrIDEAGeneratorFragment extends AbstractAntlrGeneratorFragment2 { @@ -33,24 +26,15 @@ public class XtextAntlrIDEAGeneratorFragment extends AbstractAntlrGeneratorFragm @Override protected void doGenerate() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - ISubProjectConfig _ideaPlugin = _projectConfig.getIdeaPlugin(); - boolean _isEnabled = _ideaPlugin.isEnabled(); + boolean _isEnabled = this.getProjectConfig().getIdeaPlugin().isEnabled(); boolean _not = (!_isEnabled); if (_not) { return; } - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - ISubProjectConfig _ideaPlugin_1 = _projectConfig_1.getIdeaPlugin(); - final IXtextGeneratorFileSystemAccess fsa = _ideaPlugin_1.getSrcGen(); - Grammar _grammar = this.getGrammar(); - AntlrOptions _options = this.getOptions(); - this.generator.generate(_grammar, _options, fsa); - CodeConfig _codeConfig = this.getCodeConfig(); - final String encoding = _codeConfig.getEncoding(); - Grammar _grammar_1 = this.getGrammar(); - AntlrGrammar _parserGrammar = this._psiGrammarNaming.getParserGrammar(_grammar_1); - final String grammarFileName = _parserGrammar.getGrammarFileName(); + final IXtextGeneratorFileSystemAccess fsa = this.getProjectConfig().getIdeaPlugin().getSrcGen(); + this.generator.generate(this.getGrammar(), this.getOptions(), fsa); + final String encoding = this.getCodeConfig().getEncoding(); + final String grammarFileName = this._psiGrammarNaming.getParserGrammar(this.getGrammar()).getGrammarFileName(); StringConcatenation _builder = new StringConcatenation(); String _path = fsa.getPath(); _builder.append(_path); @@ -59,9 +43,7 @@ public class XtextAntlrIDEAGeneratorFragment extends AbstractAntlrGeneratorFragm final String absoluteGrammarFileName = _builder.toString(); this.addAntlrParam("-fo"); this.addAntlrParam(absoluteGrammarFileName.substring(0, absoluteGrammarFileName.lastIndexOf("/"))); - AntlrToolFacade _antlrTool = this.getAntlrTool(); - String[] _antlrParams = this.getAntlrParams(); - _antlrTool.runWithEncodingAndParams(absoluteGrammarFileName, encoding, _antlrParams); + this.getAntlrTool().runWithEncodingAndParams(absoluteGrammarFileName, encoding, this.getAntlrParams()); 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()); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/junit/Junit4Fragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/junit/Junit4Fragment2.java index 7f03c94ea..1e4b54aa0 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/junit/Junit4Fragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/junit/Junit4Fragment2.java @@ -3,19 +3,12 @@ package org.eclipse.xtext.xtext.generator.junit; import com.google.inject.Inject; import com.google.inject.Injector; import java.util.Collections; -import java.util.Set; import java.util.function.Consumer; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.xtend.lib.annotations.AccessorType; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend2.lib.StringConcatenationClient; import org.eclipse.xtext.AbstractRule; -import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; -import org.eclipse.xtext.TypeRef; import org.eclipse.xtext.xbase.lib.CollectionExtensions; import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Extension; @@ -29,8 +22,6 @@ import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.util.GenModelUtil2; @SuppressWarnings("all") @@ -57,72 +48,44 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { @Override public void generate() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _runtimeTest = _projectConfig.getRuntimeTest(); - ManifestAccess _manifest = _runtimeTest.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getRuntimeTest().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _runtimeTest_1 = _projectConfig_1.getRuntimeTest(); - ManifestAccess _manifest_1 = _runtimeTest_1.getManifest(); + ManifestAccess _manifest_1 = this.getProjectConfig().getRuntimeTest().getManifest(); final Procedure1 _function = (ManifestAccess it) -> { - Set _requiredBundles = it.getRequiredBundles(); - String _testingPackage = this.getTestingPackage(); - CollectionExtensions.addAll(_requiredBundles, _testingPackage, + CollectionExtensions.addAll(it.getRequiredBundles(), + this.getTestingPackage(), "org.eclipse.xtext.xbase.lib"); - Set _exportedPackages = it.getExportedPackages(); - Grammar _grammar = this.getGrammar(); - String _runtimeTestBasePackage = this._xtextGeneratorNaming.getRuntimeTestBasePackage(_grammar); + String _runtimeTestBasePackage = this._xtextGeneratorNaming.getRuntimeTestBasePackage(this.getGrammar()); String _plus = (_runtimeTestBasePackage + ";x-internal=true"); - _exportedPackages.add(_plus); + it.getExportedPackages().add(_plus); }; ObjectExtensions.operator_doubleArrow(_manifest_1, _function); } - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePluginTest = _projectConfig_2.getEclipsePluginTest(); - ManifestAccess _manifest_2 = _eclipsePluginTest.getManifest(); + ManifestAccess _manifest_2 = this.getProjectConfig().getEclipsePluginTest().getManifest(); boolean _tripleNotEquals_1 = (_manifest_2 != null); if (_tripleNotEquals_1) { - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePluginTest_1 = _projectConfig_3.getEclipsePluginTest(); - ManifestAccess _manifest_3 = _eclipsePluginTest_1.getManifest(); + ManifestAccess _manifest_3 = this.getProjectConfig().getEclipsePluginTest().getManifest(); final Procedure1 _function_1 = (ManifestAccess it) -> { - Set _requiredBundles = it.getRequiredBundles(); - String _testingPackage = this.getTestingPackage(); - CollectionExtensions.addAll(_requiredBundles, _testingPackage, + CollectionExtensions.addAll(it.getRequiredBundles(), + this.getTestingPackage(), "org.eclipse.core.runtime", "org.eclipse.ui.workbench;resolution:=optional"); - Set _exportedPackages = it.getExportedPackages(); - Grammar _grammar = this.getGrammar(); - String _eclipsePluginTestBasePackage = this._xtextGeneratorNaming.getEclipsePluginTestBasePackage(_grammar); + String _eclipsePluginTestBasePackage = this._xtextGeneratorNaming.getEclipsePluginTestBasePackage(this.getGrammar()); String _plus = (_eclipsePluginTestBasePackage + ";x-internal=true"); - _exportedPackages.add(_plus); + it.getExportedPackages().add(_plus); }; ObjectExtensions.operator_doubleArrow(_manifest_3, _function_1); } - IXtextProjectConfig _projectConfig_4 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig_4.getEclipsePlugin(); - ManifestAccess _manifest_4 = _eclipsePlugin.getManifest(); + ManifestAccess _manifest_4 = this.getProjectConfig().getEclipsePlugin().getManifest(); boolean _tripleNotEquals_2 = (_manifest_4 != null); if (_tripleNotEquals_2) { - IXtextProjectConfig _projectConfig_5 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_5.getEclipsePlugin(); - ManifestAccess _manifest_5 = _eclipsePlugin_1.getManifest(); - Set _exportedPackages = _manifest_5.getExportedPackages(); - TypeReference _eclipsePluginActivator = this._xtextGeneratorNaming.getEclipsePluginActivator(); - String _packageName = _eclipsePluginActivator.getPackageName(); - _exportedPackages.add(_packageName); + this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages().add(this._xtextGeneratorNaming.getEclipsePluginActivator().getPackageName()); } - IXtextProjectConfig _projectConfig_6 = this.getProjectConfig(); - IBundleProjectConfig _runtimeTest_2 = _projectConfig_6.getRuntimeTest(); - ManifestAccess _manifest_6 = _runtimeTest_2.getManifest(); - IXtextProjectConfig _projectConfig_7 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePluginTest_2 = _projectConfig_7.getEclipsePluginTest(); - ManifestAccess _manifest_7 = _eclipsePluginTest_2.getManifest(); - Iterable _filterNull = IterableExtensions.filterNull(Collections.unmodifiableList(CollectionLiterals.newArrayList(_manifest_6, _manifest_7))); + ManifestAccess _manifest_5 = this.getProjectConfig().getRuntimeTest().getManifest(); + ManifestAccess _manifest_6 = this.getProjectConfig().getEclipsePluginTest().getManifest(); final Consumer _function_2 = (ManifestAccess it) -> { - Set _importedPackages = it.getImportedPackages(); - CollectionExtensions.addAll(_importedPackages, + CollectionExtensions.addAll(it.getImportedPackages(), "org.junit;version=\"4.5.0\"", "org.junit.runner;version=\"4.5.0\"", "org.junit.runner.manipulation;version=\"4.5.0\"", @@ -131,30 +94,16 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { "org.junit.runners.model;version=\"4.5.0\"", "org.hamcrest.core"); }; - _filterNull.forEach(_function_2); - JavaFileAccess _generateInjectorProvider = this.generateInjectorProvider(); - IXtextProjectConfig _projectConfig_8 = this.getProjectConfig(); - IBundleProjectConfig _runtimeTest_3 = _projectConfig_8.getRuntimeTest(); - IXtextGeneratorFileSystemAccess _srcGen = _runtimeTest_3.getSrcGen(); - _generateInjectorProvider.writeTo(_srcGen); + IterableExtensions.filterNull(Collections.unmodifiableList(CollectionLiterals.newArrayList(_manifest_5, _manifest_6))).forEach(_function_2); + this.generateInjectorProvider().writeTo(this.getProjectConfig().getRuntimeTest().getSrcGen()); boolean _isGenerateStub = this.isGenerateStub(); if (_isGenerateStub) { - JavaFileAccess _generateExampleRuntimeTest = this.generateExampleRuntimeTest(); - IXtextProjectConfig _projectConfig_9 = this.getProjectConfig(); - IBundleProjectConfig _runtimeTest_4 = _projectConfig_9.getRuntimeTest(); - IXtextGeneratorFileSystemAccess _src = _runtimeTest_4.getSrc(); - _generateExampleRuntimeTest.writeTo(_src); + this.generateExampleRuntimeTest().writeTo(this.getProjectConfig().getRuntimeTest().getSrc()); } - IXtextProjectConfig _projectConfig_10 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_2 = _projectConfig_10.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _srcGen_1 = _eclipsePlugin_2.getSrcGen(); - boolean _tripleNotEquals_3 = (_srcGen_1 != null); + IXtextGeneratorFileSystemAccess _srcGen = this.getProjectConfig().getEclipsePlugin().getSrcGen(); + boolean _tripleNotEquals_3 = (_srcGen != null); if (_tripleNotEquals_3) { - JavaFileAccess _generateUiInjectorProvider = this.generateUiInjectorProvider(); - IXtextProjectConfig _projectConfig_11 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePluginTest_3 = _projectConfig_11.getEclipsePluginTest(); - IXtextGeneratorFileSystemAccess _srcGen_2 = _eclipsePluginTest_3.getSrcGen(); - _generateUiInjectorProvider.writeTo(_srcGen_2); + this.generateUiInjectorProvider().writeTo(this.getProjectConfig().getEclipsePluginTest().getSrcGen()); } } @@ -171,15 +120,7 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { final TypeReference parseHelper = new TypeReference(_plus_2); final TypeReference test = new TypeReference("org.junit.Test"); final TypeReference assert_ = new TypeReference("org.junit.Assert"); - Grammar _grammar = this.getGrammar(); - EList _rules = _grammar.getRules(); - AbstractRule _head = IterableExtensions.head(_rules); - TypeRef _type = _head.getType(); - EClassifier _classifier = _type.getClassifier(); - Grammar _grammar_1 = this.getGrammar(); - Resource _eResource = _grammar_1.eResource(); - ResourceSet _resourceSet = _eResource.getResourceSet(); - String _javaTypeName = GenModelUtil2.getJavaTypeName(_classifier, _resourceSet); + String _javaTypeName = GenModelUtil2.getJavaTypeName(IterableExtensions.head(this.getGrammar().getRules()).getType().getClassifier(), this.getGrammar().eResource().getResourceSet()); final TypeReference rootType = new TypeReference(_javaTypeName); TypeReference _exampleRuntimeTest = this.exampleRuntimeTest(); StringConcatenationClient _client = new StringConcatenationClient() { @@ -252,10 +193,8 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { } protected TypeReference exampleRuntimeTest() { - Grammar _grammar = this.getGrammar(); - String _runtimeTestBasePackage = this._xtextGeneratorNaming.getRuntimeTestBasePackage(_grammar); - Grammar _grammar_1 = this.getGrammar(); - String _simpleName = GrammarUtil.getSimpleName(_grammar_1); + String _runtimeTestBasePackage = this._xtextGeneratorNaming.getRuntimeTestBasePackage(this.getGrammar()); + String _simpleName = GrammarUtil.getSimpleName(this.getGrammar()); String _plus = (_simpleName + "ParsingTest"); return new TypeReference(_runtimeTestBasePackage, _plus); } @@ -263,8 +202,7 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { protected JavaFileAccess generateInjectorProvider() { JavaFileAccess _xblockexpression = null; { - TypeReference _injectorProvider = this.injectorProvider(); - final JavaFileAccess file = this.fileAccessFactory.createJavaFile(_injectorProvider); + final JavaFileAccess file = this.fileAccessFactory.createJavaFile(this.injectorProvider()); String _testingPackage = this.getTestingPackage(); String _plus = (_testingPackage + ".GlobalRegistries"); final TypeReference globalRegistries = new TypeReference(_plus); @@ -279,8 +217,7 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _injectorProvider = Junit4Fragment2.this.injectorProvider(); - String _simpleName = _injectorProvider.getSimpleName(); + String _simpleName = Junit4Fragment2.this.injectorProvider().getSimpleName(); _builder.append(_simpleName); _builder.append(" implements "); TypeReference _iInjectorProvider = Junit4Fragment2.this.iInjectorProvider(); @@ -358,8 +295,7 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("return new "); - Grammar _grammar = Junit4Fragment2.this.getGrammar(); - TypeReference _runtimeSetup = Junit4Fragment2.this._xtextGeneratorNaming.getRuntimeSetup(_grammar); + TypeReference _runtimeSetup = Junit4Fragment2.this._xtextGeneratorNaming.getRuntimeSetup(Junit4Fragment2.this.getGrammar()); _builder.append(_runtimeSetup, "\t\t"); _builder.append("() {"); _builder.newLineIfNotEmpty(); @@ -386,8 +322,7 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("protected "); - Grammar _grammar_1 = Junit4Fragment2.this.getGrammar(); - TypeReference _runtimeModule = Junit4Fragment2.this._xtextGeneratorNaming.getRuntimeModule(_grammar_1); + TypeReference _runtimeModule = Junit4Fragment2.this._xtextGeneratorNaming.getRuntimeModule(Junit4Fragment2.this.getGrammar()); _builder.append(_runtimeModule, "\t"); _builder.append(" createRuntimeModule() {"); _builder.newLineIfNotEmpty(); @@ -399,8 +334,7 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("return new "); - Grammar _grammar_2 = Junit4Fragment2.this.getGrammar(); - TypeReference _runtimeModule_1 = Junit4Fragment2.this._xtextGeneratorNaming.getRuntimeModule(_grammar_2); + TypeReference _runtimeModule_1 = Junit4Fragment2.this._xtextGeneratorNaming.getRuntimeModule(Junit4Fragment2.this.getGrammar()); _builder.append(_runtimeModule_1, "\t\t"); _builder.append("() {"); _builder.newLineIfNotEmpty(); @@ -414,8 +348,7 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t\t\t\t"); _builder.append("return "); - TypeReference _injectorProvider_1 = Junit4Fragment2.this.injectorProvider(); - String _simpleName_1 = _injectorProvider_1.getSimpleName(); + String _simpleName_1 = Junit4Fragment2.this.injectorProvider().getSimpleName(); _builder.append(_simpleName_1, "\t\t\t\t"); _builder.append(".class"); _builder.newLineIfNotEmpty(); @@ -477,10 +410,8 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { } protected TypeReference injectorProvider() { - Grammar _grammar = this.getGrammar(); - String _runtimeTestBasePackage = this._xtextGeneratorNaming.getRuntimeTestBasePackage(_grammar); - Grammar _grammar_1 = this.getGrammar(); - String _simpleName = GrammarUtil.getSimpleName(_grammar_1); + String _runtimeTestBasePackage = this._xtextGeneratorNaming.getRuntimeTestBasePackage(this.getGrammar()); + String _simpleName = GrammarUtil.getSimpleName(this.getGrammar()); String _plus = (_simpleName + "InjectorProvider"); return new TypeReference(_runtimeTestBasePackage, _plus); } @@ -488,14 +419,12 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { protected JavaFileAccess generateUiInjectorProvider() { JavaFileAccess _xblockexpression = null; { - TypeReference _uiInjectorProvider = this.uiInjectorProvider(); - final JavaFileAccess file = this.fileAccessFactory.createJavaFile(_uiInjectorProvider); + final JavaFileAccess file = this.fileAccessFactory.createJavaFile(this.uiInjectorProvider()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - TypeReference _uiInjectorProvider = Junit4Fragment2.this.uiInjectorProvider(); - String _simpleName = _uiInjectorProvider.getSimpleName(); + String _simpleName = Junit4Fragment2.this.uiInjectorProvider().getSimpleName(); _builder.append(_simpleName); _builder.append(" implements "); TypeReference _iInjectorProvider = Junit4Fragment2.this.iInjectorProvider(); @@ -516,8 +445,7 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { TypeReference _eclipsePluginActivator = Junit4Fragment2.this._xtextGeneratorNaming.getEclipsePluginActivator(); _builder.append(_eclipsePluginActivator, "\t\t"); _builder.append(".getInstance().getInjector(\""); - Grammar _grammar = Junit4Fragment2.this.getGrammar(); - String _name = _grammar.getName(); + String _name = Junit4Fragment2.this.getGrammar().getName(); _builder.append(_name, "\t\t"); _builder.append("\");"); _builder.newLineIfNotEmpty(); @@ -536,10 +464,8 @@ public class Junit4Fragment2 extends AbstractStubGeneratingFragment { } protected TypeReference uiInjectorProvider() { - Grammar _grammar = this.getGrammar(); - String _eclipsePluginTestBasePackage = this._xtextGeneratorNaming.getEclipsePluginTestBasePackage(_grammar); - Grammar _grammar_1 = this.getGrammar(); - String _simpleName = GrammarUtil.getSimpleName(_grammar_1); + String _eclipsePluginTestBasePackage = this._xtextGeneratorNaming.getEclipsePluginTestBasePackage(this.getGrammar()); + String _simpleName = GrammarUtil.getSimpleName(this.getGrammar()); String _plus = (_simpleName + "UiInjectorProvider"); return new TypeReference(_eclipsePluginTestBasePackage, _plus); } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/GeneratedJavaFileAccess.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/GeneratedJavaFileAccess.java index a8fc6a26f..c62e17042 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/GeneratedJavaFileAccess.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/GeneratedJavaFileAccess.java @@ -53,22 +53,20 @@ public class GeneratedJavaFileAccess extends JavaFileAccess { public CharSequence getContent() { CharSequence _xblockexpression = null; { - Iterable _classAnnotations = this.getClassAnnotations(); final Consumer _function = (IClassAnnotation it) -> { this.importType(it.getAnnotationImport()); }; - _classAnnotations.forEach(_function); + this.getClassAnnotations().forEach(_function); _xblockexpression = super.getContent(); } return _xblockexpression; } private Iterable getClassAnnotations() { - List _classAnnotations = this.codeConfig.getClassAnnotations(); final Function1 _function = (IClassAnnotation it) -> { return Boolean.valueOf(it.appliesTo(this)); }; - Iterable _filter = IterableExtensions.filter(_classAnnotations, _function); + Iterable _filter = IterableExtensions.filter(this.codeConfig.getClassAnnotations(), _function); return Iterables.concat(this.annotations, _filter); } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/JavaFileAccess.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/JavaFileAccess.java index e68e0e603..30a75c17d 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/JavaFileAccess.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/JavaFileAccess.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.xtext.generator.model; import com.google.common.base.Objects; -import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; @@ -99,8 +98,7 @@ public class JavaFileAccess extends TextFileAccess { private ResourceSet resourceSet; protected JavaFileAccess(final TypeReference typeRef, final CodeConfig codeConfig) { - List _simpleNames = typeRef.getSimpleNames(); - int _length = ((Object[])Conversions.unwrapArray(_simpleNames, Object.class)).length; + int _length = ((Object[])Conversions.unwrapArray(typeRef.getSimpleNames(), Object.class)).length; boolean _greaterThan = (_length > 1); if (_greaterThan) { throw new IllegalArgumentException(("Nested type cannot be serialized: " + typeRef)); @@ -136,8 +134,7 @@ public class JavaFileAccess extends TextFileAccess { if (((!CodeGenUtil2.isJavaDefaultType(simpleName)) && (!((i > 0) && (simpleName.length() <= this.importNestedTypeThreshold))))) { String _packageName = typeRef.getPackageName(); String _plus = (_packageName + "."); - List _subList = simpleNames.subList(0, (i + 1)); - String _join = IterableExtensions.join(_subList, "."); + String _join = IterableExtensions.join(simpleNames.subList(0, (i + 1)), "."); final String importable = (_plus + _join); final String imported = this.imports.get(usableName); if ((imported == null)) { @@ -156,11 +153,10 @@ public class JavaFileAccess extends TextFileAccess { usableName = typeRef.getName(); } } - List _typeArguments = typeRef.getTypeArguments(); final Function1 _function = (TypeReference it) -> { return this.importType(it); }; - String _join = IterableExtensions.join(_typeArguments, "<", ", ", ">", _function); + String _join = IterableExtensions.join(typeRef.getTypeArguments(), "<", ", ", ">", _function); return (usableName + _join); } @@ -193,9 +189,7 @@ public class JavaFileAccess extends TextFileAccess { _builder.newLineIfNotEmpty(); _builder.newLine(); { - Collection _values = this.imports.values(); - Set _set = IterableExtensions.toSet(_values); - List _sort = IterableExtensions.sort(_set); + List _sort = IterableExtensions.sort(IterableExtensions.toSet(this.imports.values())); for(final String importName : _sort) { _builder.append("import "); _builder.append(importName); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/ManifestAccess.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/ManifestAccess.java index 62a0fc4f0..e4a37b77e 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/ManifestAccess.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/ManifestAccess.java @@ -114,8 +114,7 @@ public class ManifestAccess extends TextFileAccess implements IGuiceAwareGenerat this.exportedPackages.addAll(other.exportedPackages); this.requiredBundles.addAll(other.requiredBundles); if ((this.symbolicName != null)) { - String _effectiveSymbolicName = this.getEffectiveSymbolicName(); - this.requiredBundles.remove(_effectiveSymbolicName); + this.requiredBundles.remove(this.getEffectiveSymbolicName()); } _xblockexpression = this.importedPackages.addAll(other.importedPackages); } @@ -197,12 +196,11 @@ public class ManifestAccess extends TextFileAccess implements IGuiceAwareGenerat if (_not_2) { _builder.append("Require-Bundle: "); { - List _sort_1 = IterableExtensions.sort(this.requiredBundles); final Function1 _function = (String it) -> { String _effectiveSymbolicName = this.getEffectiveSymbolicName(); return Boolean.valueOf((!Objects.equal(it, _effectiveSymbolicName))); }; - Iterable _filter = IterableExtensions.filter(_sort_1, _function); + Iterable _filter = IterableExtensions.filter(IterableExtensions.sort(this.requiredBundles), _function); boolean _hasElements_1 = false; for(final String bundle : _filter) { if (!_hasElements_1) { @@ -222,9 +220,9 @@ public class ManifestAccess extends TextFileAccess implements IGuiceAwareGenerat if (_not_3) { _builder.append("Import-Package: "); { - List _sort_2 = IterableExtensions.sort(this.importedPackages); + List _sort_1 = IterableExtensions.sort(this.importedPackages); boolean _hasElements_2 = false; - for(final String pack_1 : _sort_2) { + for(final String pack_1 : _sort_1) { if (!_hasElements_2) { _hasElements_2 = true; } else { @@ -259,10 +257,9 @@ public class ManifestAccess extends TextFileAccess implements IGuiceAwareGenerat mergableManifest.setLineDelimiter(this.lineDelimiter); ByteArrayOutputStream bout = new ByteArrayOutputStream(); mergableManifest.write(bout); - String _path = this.getPath(); byte[] _byteArray = bout.toByteArray(); ByteArrayInputStream _byteArrayInputStream_1 = new ByteArrayInputStream(_byteArray); - fileSystemAccess.generateFile(_path, _byteArrayInputStream_1); + fileSystemAccess.generateFile(this.getPath(), _byteArrayInputStream_1); } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/TextFileAccess.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/TextFileAccess.java index 058727c91..7d08a8ffd 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/TextFileAccess.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/TextFileAccess.java @@ -37,8 +37,7 @@ public class TextFileAccess { public void writeTo(final IFileSystemAccess2 fileSystemAccess) { if ((fileSystemAccess != null)) { - CharSequence _content = this.getContent(); - fileSystemAccess.generateFile(this.path, _content); + fileSystemAccess.generateFile(this.path, this.getContent()); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/TypeReference.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/TypeReference.java index 46a285f6b..df2cbf252 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/TypeReference.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/TypeReference.java @@ -11,8 +11,6 @@ import com.google.common.base.Objects; import com.google.common.base.Splitter; import java.util.Collections; import java.util.List; -import org.eclipse.emf.codegen.ecore.genmodel.GenClass; -import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.resource.ResourceSet; @@ -128,8 +126,7 @@ public class TypeReference { Class c = clazz; do { { - String _simpleName = c.getSimpleName(); - this.simpleNames.add(0, _simpleName); + this.simpleNames.add(0, c.getSimpleName()); c = c.getDeclaringClass(); } } while((c != null)); @@ -144,9 +141,7 @@ public class TypeReference { } private static String getPackageName(final String qualifiedName, final boolean strict) { - Splitter _on = Splitter.on("."); - Iterable _split = _on.split(qualifiedName); - final List segments = IterableExtensions.toList(_split); + final List segments = IterableExtensions.toList(Splitter.on(".").split(qualifiedName)); int _size = segments.size(); boolean _equals = (_size == 1); if (_equals) { @@ -157,11 +152,9 @@ public class TypeReference { int _minus = (_length - 1); final List packageSegments = segments.subList(0, _minus); final Function1 _function = (String it) -> { - char _charAt = it.charAt(0); - return Boolean.valueOf(Character.isUpperCase(_charAt)); + return Boolean.valueOf(Character.isUpperCase(it.charAt(0))); }; - Iterable _filter = IterableExtensions.filter(packageSegments, _function); - boolean _isEmpty = IterableExtensions.isEmpty(_filter); + boolean _isEmpty = IterableExtensions.isEmpty(IterableExtensions.filter(packageSegments, _function)); boolean _not = (!_isEmpty); if (_not) { throw new IllegalArgumentException((("Cannot determine the package name of \'" + qualifiedName) + "\'. Please use the TypeReference(packageName, className) constructor")); @@ -172,11 +165,12 @@ public class TypeReference { int _minus_1 = (_length_1 - 1); List packageSegments_1 = segments.subList(0, _minus_1); while ((!packageSegments_1.isEmpty())) { - String _last = IterableExtensions.last(packageSegments_1); - char _charAt = _last.charAt(0); - boolean _isUpperCase = Character.isUpperCase(_charAt); + boolean _isUpperCase = Character.isUpperCase(IterableExtensions.last(packageSegments_1).charAt(0)); if (_isUpperCase) { - packageSegments_1 = packageSegments_1.subList(0, (((Object[])Conversions.unwrapArray(packageSegments_1, Object.class)).length - 1)); + final List _converted_packageSegments_1 = (List)packageSegments_1; + int _length_2 = ((Object[])Conversions.unwrapArray(_converted_packageSegments_1, Object.class)).length; + int _minus_2 = (_length_2 - 1); + packageSegments_1 = packageSegments_1.subList(0, _minus_2); } else { return IterableExtensions.join(packageSegments_1, "."); } @@ -196,8 +190,7 @@ public class TypeReference { } else { int _length = packageName.length(); int _plus = (_length + 1); - int _length_1 = qualifiedName.length(); - _xifexpression = qualifiedName.substring(_plus, _length_1); + _xifexpression = qualifiedName.substring(_plus, qualifiedName.length()); } _xblockexpression = _xifexpression; } @@ -206,23 +199,20 @@ public class TypeReference { private static String getQualifiedName(final EClass clazz, final ResourceSet resourceSet) { String _xifexpression = null; - EPackage _ePackage = clazz.getEPackage(); - String _nsURI = _ePackage.getNsURI(); + String _nsURI = clazz.getEPackage().getNsURI(); boolean _equals = Objects.equal(_nsURI, "http://www.eclipse.org/2008/Xtext"); if (_equals) { String _name = clazz.getName(); _xifexpression = ("org.eclipse.xtext." + _name); } else { String _xifexpression_1 = null; - EPackage _ePackage_1 = clazz.getEPackage(); - String _nsURI_1 = _ePackage_1.getNsURI(); + String _nsURI_1 = clazz.getEPackage().getNsURI(); boolean _equals_1 = Objects.equal(_nsURI_1, "http://www.eclipse.org/emf/2002/Ecore"); if (_equals_1) { String _name_1 = clazz.getName(); _xifexpression_1 = ("org.eclipse.emf.ecore." + _name_1); } else { - GenClass _genClass = GenModelUtil2.getGenClass(clazz, resourceSet); - _xifexpression_1 = _genClass.getQualifiedInterfaceName(); + _xifexpression_1 = GenModelUtil2.getGenClass(clazz, resourceSet).getQualifiedInterfaceName(); } _xifexpression = _xifexpression_1; } @@ -230,8 +220,7 @@ public class TypeReference { } private static String getQualifiedName(final EPackage epackage, final ResourceSet resourceSet) { - GenPackage _genPackage = GenModelUtil2.getGenPackage(epackage, resourceSet); - return _genPackage.getQualifiedPackageInterfaceName(); + return GenModelUtil2.getGenPackage(epackage, resourceSet).getQualifiedPackageInterfaceName(); } @Override diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/XtextGeneratorFileSystemAccess.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/XtextGeneratorFileSystemAccess.java index c797973ea..c3455a5b8 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/XtextGeneratorFileSystemAccess.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/XtextGeneratorFileSystemAccess.java @@ -8,8 +8,6 @@ package org.eclipse.xtext.xtext.generator.model; import com.google.inject.Injector; -import java.util.Collection; -import java.util.Map; import org.eclipse.xtext.generator.JavaIoFileSystemAccess; import org.eclipse.xtext.generator.OutputConfiguration; import org.eclipse.xtext.xbase.lib.IterableExtensions; @@ -37,9 +35,7 @@ public class XtextGeneratorFileSystemAccess extends JavaIoFileSystemAccess imple } private OutputConfiguration getDefaultOutput() { - Map _outputConfigurations = this.getOutputConfigurations(); - Collection _values = _outputConfigurations.values(); - return IterableExtensions.head(_values); + return IterableExtensions.head(this.getOutputConfigurations().values()); } @Override @@ -49,13 +45,11 @@ public class XtextGeneratorFileSystemAccess extends JavaIoFileSystemAccess imple @Override public String getPath() { - OutputConfiguration _defaultOutput = this.getDefaultOutput(); - return _defaultOutput.getOutputDirectory(); + return this.getDefaultOutput().getOutputDirectory(); } @Override public boolean isOverwrite() { - OutputConfiguration _defaultOutput = this.getDefaultOutput(); - return _defaultOutput.isOverrideExistingResources(); + return this.getDefaultOutput().isOverrideExistingResources(); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/GeneratedClassAnnotation.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/GeneratedClassAnnotation.java index 5efc6c030..772360a26 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/GeneratedClassAnnotation.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/GeneratedClassAnnotation.java @@ -77,8 +77,7 @@ public class GeneratedClassAnnotation implements IClassAnnotation { @Override public String toString() { - CharSequence _generate = this.generate(); - return _generate.toString(); + return this.generate().toString(); } @Pure diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/SingletonClassAnnotation.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/SingletonClassAnnotation.java index 295b59ef6..5428b90d2 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/SingletonClassAnnotation.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/SingletonClassAnnotation.java @@ -34,7 +34,6 @@ public class SingletonClassAnnotation implements IClassAnnotation { @Override public String toString() { - CharSequence _generate = this.generate(); - return _generate.toString(); + return this.generate().toString(); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/SuppressWarningsAnnotation.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/SuppressWarningsAnnotation.java index ff55741fc..e176500ab 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/SuppressWarningsAnnotation.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/annotations/SuppressWarningsAnnotation.java @@ -36,8 +36,7 @@ public class SuppressWarningsAnnotation implements IClassAnnotation { final Function1 _function = (String it) -> { return it; }; - String _join = IterableExtensions.join(((Iterable)Conversions.doWrapArray(suppressedWarnings)), "\"", "\", \"", "\"", _function); - stringBuilder.append(_join); + stringBuilder.append(IterableExtensions.join(((Iterable)Conversions.doWrapArray(suppressedWarnings)), "\"", "\", \"", "\"", _function)); int _length_1 = suppressedWarnings.length; boolean _notEquals_1 = (_length_1 != 1); if (_notEquals_1) { @@ -59,8 +58,7 @@ public class SuppressWarningsAnnotation implements IClassAnnotation { @Override public String toString() { - CharSequence _generate = this.generate(); - return _generate.toString(); + return this.generate().toString(); } @Pure diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/RuntimeProjectConfig.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/RuntimeProjectConfig.java index ad7a5f556..1ca78e8f3 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/RuntimeProjectConfig.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/RuntimeProjectConfig.java @@ -38,19 +38,10 @@ public class RuntimeProjectConfig extends BundleProjectConfig implements IRuntim */ @Override public String getEcoreModelFolder() { - String _path = this.ecoreModel.getPath(); - IXtextGeneratorFileSystemAccess _root = this.getRoot(); - String _path_1 = _root.getPath(); - boolean _startsWith = _path.startsWith(_path_1); + boolean _startsWith = this.ecoreModel.getPath().startsWith(this.getRoot().getPath()); if (_startsWith) { - String _path_2 = this.ecoreModel.getPath(); - IXtextGeneratorFileSystemAccess _root_1 = this.getRoot(); - String _path_3 = _root_1.getPath(); - int _length = _path_3.length(); - String _substring = _path_2.substring(_length); - final String relativePath = _substring.replace("\\", "/"); - CharMatcher _is = CharMatcher.is('/'); - return _is.trimFrom(relativePath); + final String relativePath = this.ecoreModel.getPath().substring(this.getRoot().getPath().length()).replace("\\", "/"); + return CharMatcher.is('/').trimFrom(relativePath); } StringConcatenation _builder = new StringConcatenation(); _builder.append("Could not derive the Ecore model folder from the project configuration. "); @@ -58,12 +49,11 @@ public class RuntimeProjectConfig extends BundleProjectConfig implements IRuntim _builder.append("Please make sure that \'root\' is a prefix of \'ecoreModel\'."); _builder.newLine(); _builder.append("was (root=\'"); - IXtextGeneratorFileSystemAccess _root_2 = this.getRoot(); - String _path_4 = _root_2.getPath(); - _builder.append(_path_4); + String _path = this.getRoot().getPath(); + _builder.append(_path); _builder.append("\', ecoreModel=\'"); - String _path_5 = this.ecoreModel.getPath(); - _builder.append(_path_5); + String _path_1 = this.ecoreModel.getPath(); + _builder.append(_path_1); _builder.append("\')"); _builder.newLineIfNotEmpty(); _builder.newLine(); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/StandardProjectConfig.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/StandardProjectConfig.java index 47cc8d33f..e570d1d83 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/StandardProjectConfig.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/StandardProjectConfig.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.xtext.generator.model.project; import com.google.common.base.Objects; -import java.util.List; import java.util.function.Consumer; import org.eclipse.emf.mwe2.runtime.Mandatory; import org.eclipse.xtend.lib.annotations.Accessors; @@ -63,7 +62,6 @@ public class StandardProjectConfig extends XtextProjectConfig { @Override public void setDefaults() { super.setDefaults(); - List _enabledProjects = this.getEnabledProjects(); final Consumer _function = (SubProjectConfig it) -> { String _name = it.getName(); boolean _tripleEquals = (_name == null); @@ -119,7 +117,7 @@ public class StandardProjectConfig extends XtextProjectConfig { } } }; - _enabledProjects.forEach(_function); + this.getEnabledProjects().forEach(_function); } protected String computeName(final SubProjectConfig project) { @@ -265,8 +263,7 @@ public class StandardProjectConfig extends XtextProjectConfig { protected String computeSourceSet(final SubProjectConfig project) { String _xifexpression = null; - List _testProjects = this.getTestProjects(); - boolean _contains = _testProjects.contains(project); + boolean _contains = this.getTestProjects().contains(project); if (_contains) { _xifexpression = "test"; } else { diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/XtextProjectConfig.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/XtextProjectConfig.java index 694b2a70d..e19dccff9 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/XtextProjectConfig.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/project/XtextProjectConfig.java @@ -56,11 +56,10 @@ public class XtextProjectConfig implements IXtextProjectConfig { private CodeConfig codeConfig; public void checkConfiguration(final Issues issues) { - List _enabledProjects = this.getEnabledProjects(); final Consumer _function = (SubProjectConfig it) -> { it.checkConfiguration(issues); }; - _enabledProjects.forEach(_function); + this.getEnabledProjects().forEach(_function); } public List getAllProjects() { @@ -89,11 +88,10 @@ public class XtextProjectConfig implements IXtextProjectConfig { ArrayList _xblockexpression = null; { final ArrayList enabledProjects = CollectionLiterals.newArrayList(); - List _allProjects = this.getAllProjects(); final Function1 _function = (SubProjectConfig it) -> { return Boolean.valueOf(it.isEnabled()); }; - Iterable _filter = IterableExtensions.filter(_allProjects, _function); + Iterable _filter = IterableExtensions.filter(this.getAllProjects(), _function); Iterables.addAll(enabledProjects, _filter); _xblockexpression = enabledProjects; } @@ -104,11 +102,10 @@ public class XtextProjectConfig implements IXtextProjectConfig { public void initialize(final Injector injector) { this.setDefaults(); injector.injectMembers(this); - List _enabledProjects = this.getEnabledProjects(); final Consumer _function = (SubProjectConfig it) -> { it.initialize(injector); }; - _enabledProjects.forEach(_function); + this.getEnabledProjects().forEach(_function); } public void setDefaults() { diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGeneratorFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGeneratorFragment2.java index 8ae7d0b78..d88f4d79b 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGeneratorFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGeneratorFragment2.java @@ -9,7 +9,6 @@ package org.eclipse.xtext.xtext.generator.parser.antlr; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; -import com.google.common.collect.UnmodifiableIterator; import com.google.inject.Inject; import java.io.CharArrayWriter; import java.io.PrintWriter; @@ -21,15 +20,11 @@ import java.util.List; import java.util.Map; 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.ecore.EObject; import org.eclipse.xtend.lib.annotations.AccessorType; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtext.AbstractRule; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; -import org.eclipse.xtext.Parameter; import org.eclipse.xtext.ParserRule; import org.eclipse.xtext.UnorderedGroup; import org.eclipse.xtext.generator.LineSeparatorHarmonizer; @@ -125,37 +120,25 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener } protected boolean hasProductionRules(final Grammar grammar) { - EList _rules = grammar.getRules(); - AbstractRule firstRule = _rules.get(0); + AbstractRule firstRule = grammar.getRules().get(0); return ((firstRule instanceof ParserRule) && (!GrammarUtil.isDatatypeRule(((ParserRule) firstRule)))); } protected void splitLexerClassFile(final IXtextGeneratorFileSystemAccess fsa, final TypeReference lexer) { - String _javaPath = lexer.getJavaPath(); - CharSequence _readTextFile = fsa.readTextFile(_javaPath); - final String content = _readTextFile.toString(); + final String content = fsa.readTextFile(lexer.getJavaPath()).toString(); AntlrLexerSplitter splitter = new AntlrLexerSplitter(content); - int _casesPerSpecialStateSwitch = this.options.getCasesPerSpecialStateSwitch(); - splitter.setCasesPerSpecialStateSwitch(_casesPerSpecialStateSwitch); - String _javaPath_1 = lexer.getJavaPath(); - String _transform = splitter.transform(); - fsa.generateFile(_javaPath_1, _transform); + splitter.setCasesPerSpecialStateSwitch(this.options.getCasesPerSpecialStateSwitch()); + fsa.generateFile(lexer.getJavaPath(), splitter.transform()); } protected void splitParserClassFile(final IXtextGeneratorFileSystemAccess fsa, final TypeReference parser) { - String _javaPath = parser.getJavaPath(); - CharSequence _readTextFile = fsa.readTextFile(_javaPath); - final String content = _readTextFile.toString(); - AntlrOptions _options = this.getOptions(); - int _fieldsPerClass = _options.getFieldsPerClass(); + final String content = fsa.readTextFile(parser.getJavaPath()).toString(); + int _fieldsPerClass = this.getOptions().getFieldsPerClass(); final AntlrParserSplitter splitter = new AntlrParserSplitter(content, _fieldsPerClass); String _transform = splitter.transform(); - AntlrOptions _options_1 = this.getOptions(); - int _methodsPerClass = _options_1.getMethodsPerClass(); + int _methodsPerClass = this.getOptions().getMethodsPerClass(); final PartialClassExtractor extractor = new PartialClassExtractor(_transform, _methodsPerClass); - String _javaPath_1 = parser.getJavaPath(); - String _transform_1 = extractor.transform(); - fsa.generateFile(_javaPath_1, _transform_1); + fsa.generateFile(parser.getJavaPath(), extractor.transform()); } protected void simplifyUnorderedGroupPredicatesIfRequired(final Grammar grammar, final IXtextGeneratorFileSystemAccess fsa, final TypeReference parser) { @@ -167,8 +150,7 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener protected boolean hasParameterizedRules(final Grammar grammar) { List _allParserRules = GrammarUtil.allParserRules(grammar); for (final ParserRule rule : _allParserRules) { - EList _parameters = rule.getParameters(); - boolean _isEmpty = _parameters.isEmpty(); + boolean _isEmpty = rule.getParameters().isEmpty(); boolean _not = (!_isEmpty); if (_not) { return true; @@ -178,27 +160,20 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener } protected void simplifyUnorderedGroupPredicates(final IXtextGeneratorFileSystemAccess fsa, final TypeReference parser) { - String _javaPath = parser.getJavaPath(); - CharSequence _readTextFile = fsa.readTextFile(_javaPath); - final String content = _readTextFile.toString(); + final String content = fsa.readTextFile(parser.getJavaPath()).toString(); UnorderedGroupsSplitter splitter = new UnorderedGroupsSplitter(content); String transformed = splitter.transform(); SyntacticPredicateFixup fixup = new SyntacticPredicateFixup(transformed); transformed = fixup.transform(); BacktrackingGuardForUnorderedGroupsRemover remover = new BacktrackingGuardForUnorderedGroupsRemover(transformed); String newContent = remover.transform(); - String _javaPath_1 = parser.getJavaPath(); - fsa.generateFile(_javaPath_1, newContent); + fsa.generateFile(parser.getJavaPath(), newContent); } protected void suppressWarnings(final IXtextGeneratorFileSystemAccess fsa, final TypeReference type) { - String _javaPath = type.getJavaPath(); - CharSequence _readTextFile = fsa.readTextFile(_javaPath); - final String content = _readTextFile.toString(); - SuppressWarningsProcessor _suppressWarningsProcessor = new SuppressWarningsProcessor(); - final String newContent = _suppressWarningsProcessor.process(content); - String _javaPath_1 = type.getJavaPath(); - fsa.generateFile(_javaPath_1, newContent); + final String content = fsa.readTextFile(type.getJavaPath()).toString(); + final String newContent = new SuppressWarningsProcessor().process(content); + fsa.generateFile(type.getJavaPath(), newContent); } protected void suppressWarnings(final IXtextGeneratorFileSystemAccess fsa, final TypeReference... types) { @@ -209,13 +184,10 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener } protected void normalizeLineDelimiters(final IXtextGeneratorFileSystemAccess fsa, final TypeReference type) { - String _javaPath = type.getJavaPath(); - CharSequence _readTextFile = fsa.readTextFile(_javaPath); - String content = _readTextFile.toString(); + String content = fsa.readTextFile(type.getJavaPath()).toString(); content = this.newLineNormalizer.postProcess(fsa.getURI(type.getJavaPath()), content).toString(); content = content.replaceAll("\"\\+(\\r)?\\n\\s+\"", ""); - String _javaPath_1 = type.getJavaPath(); - fsa.generateFile(_javaPath_1, content); + fsa.generateFile(type.getJavaPath(), content); } protected void normalizeLineDelimiters(final IXtextGeneratorFileSystemAccess fsa, final TypeReference... types) { @@ -226,24 +198,20 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener } protected void normalizeTokens(final IXtextGeneratorFileSystemAccess fsa, final String tokenFile) { - CharSequence _readTextFile = fsa.readTextFile(tokenFile); - String content = _readTextFile.toString(); + String content = fsa.readTextFile(tokenFile).toString(); content = this.newLineNormalizer.postProcess(fsa.getURI(tokenFile), content).toString(); - String _lineDelimiter = this.codeConfig.getLineDelimiter(); - final List splitted = Strings.split(content, _lineDelimiter); + final List splitted = Strings.split(content, this.codeConfig.getLineDelimiter()); Collections.sort(splitted); - String _lineDelimiter_1 = this.codeConfig.getLineDelimiter(); - String _concat = Strings.concat(_lineDelimiter_1, splitted); - String _lineDelimiter_2 = this.codeConfig.getLineDelimiter(); - String _plus = (_concat + _lineDelimiter_2); + String _concat = Strings.concat(this.codeConfig.getLineDelimiter(), splitted); + String _lineDelimiter = this.codeConfig.getLineDelimiter(); + String _plus = (_concat + _lineDelimiter); content = _plus; fsa.generateFile(tokenFile, content); } protected void splitParserAndLexerIfEnabled(final IXtextGeneratorFileSystemAccess fsa, final TypeReference parser, final TypeReference lexer) { this.improveCodeQuality(fsa, lexer, parser); - AntlrOptions _options = this.getOptions(); - boolean _isClassSplitting = _options.isClassSplitting(); + boolean _isClassSplitting = this.getOptions().isClassSplitting(); if (_isClassSplitting) { this.splitLexerClassFile(fsa, lexer); this.splitParserClassFile(fsa, parser); @@ -251,20 +219,14 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener } protected void improveCodeQuality(final IXtextGeneratorFileSystemAccess fsa, final TypeReference lexer, final TypeReference parser) { - String _javaPath = lexer.getJavaPath(); - CharSequence _readTextFile = fsa.readTextFile(_javaPath); - String lexerContent = _readTextFile.toString(); + String lexerContent = fsa.readTextFile(lexer.getJavaPath()).toString(); 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(); + fsa.generateFile(lexer.getJavaPath(), lexerContent); + String parserContent = fsa.readTextFile(parser.getJavaPath()).toString(); 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); + fsa.generateFile(parser.getJavaPath(), parserContent); } protected void cleanupLexerTokensFile(final AntlrGrammar lexerGrammar, final KeywordHelper helper, final IXtextGeneratorFileSystemAccess fsa) { @@ -272,13 +234,10 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener boolean _isBacktrackLexer = this.options.isBacktrackLexer(); if (_isBacktrackLexer) { final MutableTokenDefProvider provider = this.createLexerTokensProvider(lexerGrammar, helper, fsa); - Map _tokenDefMap = provider.getTokenDefMap(); - Set> _entrySet = _tokenDefMap.entrySet(); - final Iterator> entries = _entrySet.iterator(); + final Iterator> entries = provider.getTokenDefMap().entrySet().iterator(); while (entries.hasNext()) { { - Map.Entry _next = entries.next(); - final String value = _next.getValue(); + final String value = entries.next().getValue(); if ((((!helper.isKeywordRule(value)) && (!value.startsWith("RULE_"))) && (!value.startsWith("SUPER_")))) { entries.remove(); } @@ -298,12 +257,10 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener } protected MutableTokenDefProvider createLexerTokensProvider(final AntlrGrammar lexerGrammar, final KeywordHelper helper, final IXtextGeneratorFileSystemAccess fsa) { - String _encoding = this.codeConfig.getEncoding(); - Charset _forName = Charset.forName(_encoding); + Charset _forName = Charset.forName(this.codeConfig.getEncoding()); final MutableTokenDefProvider provider = new MutableTokenDefProvider(helper, _forName); final IAntlrTokenFileProvider _function = () -> { - String _tokensFileName = lexerGrammar.getTokensFileName(); - return fsa.readBinaryFile(_tokensFileName); + return fsa.readBinaryFile(lexerGrammar.getTokensFileName()); }; provider.setAntlrTokenFileProvider(_function); return provider; @@ -312,15 +269,13 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener protected void cleanupParserTokensFile(final AntlrGrammar lexerGrammar, final AntlrGrammar parserGrammar, final KeywordHelper helper, final IXtextGeneratorFileSystemAccess fsa) { try { final MutableTokenDefProvider provider = this.createLexerTokensProvider(lexerGrammar, helper, fsa); - Map _tokenDefMap = provider.getTokenDefMap(); - Set> _entrySet = _tokenDefMap.entrySet(); + Set> _entrySet = provider.getTokenDefMap().entrySet(); for (final Map.Entry entry : _entrySet) { { final String value = entry.getValue(); boolean _isKeywordRule = helper.isKeywordRule(value); if (_isKeywordRule) { - String _keywordValue = helper.getKeywordValue(value); - final String keywordAsAntlrString = AntlrGrammarGenUtil.toAntlrString(_keywordValue); + final String keywordAsAntlrString = AntlrGrammarGenUtil.toAntlrString(helper.getKeywordValue(value)); entry.setValue((("\'" + keywordAsAntlrString) + "\'")); } else { boolean _startsWith = value.startsWith("\'"); @@ -346,21 +301,16 @@ public abstract class AbstractAntlrGeneratorFragment2 extends AbstractXtextGener } protected void removeBackTrackingGuards(final IXtextGeneratorFileSystemAccess fsa, final TypeReference parser, final int lookaheadThreshold) { - String _javaPath = parser.getJavaPath(); - CharSequence _readTextFile = fsa.readTextFile(_javaPath); - final String content = _readTextFile.toString(); + final String content = fsa.readTextFile(parser.getJavaPath()).toString(); final BacktrackingGuardRemover remover = new BacktrackingGuardRemover(content, lookaheadThreshold); final String newContent = remover.transform(); - String _javaPath_1 = parser.getJavaPath(); - fsa.generateFile(_javaPath_1, newContent); + fsa.generateFile(parser.getJavaPath(), newContent); } protected boolean containsUnorderedGroup(final Grammar grammar) { List _allParserRules = GrammarUtil.allParserRules(grammar); for (final ParserRule rule : _allParserRules) { - TreeIterator _eAllContents = rule.eAllContents(); - UnmodifiableIterator _filter = Iterators.filter(_eAllContents, UnorderedGroup.class); - boolean _hasNext = _filter.hasNext(); + boolean _hasNext = Iterators.filter(rule.eAllContents(), UnorderedGroup.class).hasNext(); if (_hasNext) { return true; } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGrammarGenerator.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGrammarGenerator.java index e1bcb1617..079862bf3 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGrammarGenerator.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGrammarGenerator.java @@ -14,7 +14,6 @@ import java.util.Arrays; import java.util.List; import java.util.Set; import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.AbstractElement; import org.eclipse.xtext.AbstractRule; @@ -45,7 +44,6 @@ import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessExtensions; import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar; import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil; import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrOptions; import org.eclipse.xtext.xtext.generator.parser.antlr.CombinedGrammarMarker; @@ -81,30 +79,19 @@ public abstract class AbstractAntlrGrammarGenerator { final RuleFilter filter = new RuleFilter(); filter.setDiscardUnreachableRules(options.isSkipUnusedRules()); final RuleNames ruleNames = RuleNames.getRuleNames(it, true); - FlattenedGrammarAccess _flattenedGrammarAccess = new FlattenedGrammarAccess(ruleNames, filter); - final Grammar flattened = _flattenedGrammarAccess.getFlattenedGrammar(); + final Grammar flattened = new FlattenedGrammarAccess(ruleNames, filter).getFlattenedGrammar(); boolean _isCombinedGrammar = this.isCombinedGrammar(); - CombinedGrammarMarker _combinedGrammarMarker = new CombinedGrammarMarker(_isCombinedGrammar); - _combinedGrammarMarker.attachToEmfObject(flattened); - GrammarNaming _grammarNaming = this.getGrammarNaming(); - AntlrGrammar _parserGrammar = _grammarNaming.getParserGrammar(it); - String _grammarFileName = _parserGrammar.getGrammarFileName(); - CharSequence _compileParser = this.compileParser(flattened, options); - fsa.generateFile(_grammarFileName, _compileParser); + new CombinedGrammarMarker(_isCombinedGrammar).attachToEmfObject(flattened); + fsa.generateFile(this.getGrammarNaming().getParserGrammar(it).getGrammarFileName(), this.compileParser(flattened, options)); boolean _isCombinedGrammar_1 = this.isCombinedGrammar(); boolean _not = (!_isCombinedGrammar_1); if (_not) { - GrammarNaming _grammarNaming_1 = this.getGrammarNaming(); - AntlrGrammar _lexerGrammar = _grammarNaming_1.getLexerGrammar(it); - String _grammarFileName_1 = _lexerGrammar.getGrammarFileName(); - CharSequence _compileLexer = this.compileLexer(flattened, options); - fsa.generateFile(_grammarFileName_1, _compileLexer); + fsa.generateFile(this.getGrammarNaming().getLexerGrammar(it).getGrammarFileName(), this.compileLexer(flattened, options)); } } protected boolean isCombinedGrammar() { - GrammarNaming _grammarNaming = this.getGrammarNaming(); - return _grammarNaming.isCombinedGrammar(this.originalGrammar); + return this.getGrammarNaming().isCombinedGrammar(this.originalGrammar); } protected abstract GrammarNaming getGrammarNaming(); @@ -122,9 +109,7 @@ public abstract class AbstractAntlrGrammarGenerator { } } _builder.append("grammar "); - GrammarNaming _grammarNaming = this.getGrammarNaming(); - AntlrGrammar _parserGrammar = _grammarNaming.getParserGrammar(it); - String _simpleName = _parserGrammar.getSimpleName(); + String _simpleName = this.getGrammarNaming().getParserGrammar(it).getSimpleName(); _builder.append(_simpleName); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -163,9 +148,7 @@ public abstract class AbstractAntlrGrammarGenerator { _builder.append(_fileHeader); _builder.newLineIfNotEmpty(); _builder.append("lexer grammar "); - GrammarNaming _grammarNaming = this.getGrammarNaming(); - AntlrGrammar _lexerGrammar = _grammarNaming.getLexerGrammar(it); - String _simpleName = _lexerGrammar.getSimpleName(); + String _simpleName = this.getGrammarNaming().getLexerGrammar(it).getSimpleName(); _builder.append(_simpleName); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -198,24 +181,19 @@ public abstract class AbstractAntlrGrammarGenerator { if (_not) { _builder.append("\t"); _builder.append("tokenVocab="); - GrammarNaming _grammarNaming = this.getGrammarNaming(); - AntlrGrammar _lexerGrammar = _grammarNaming.getLexerGrammar(it); - String _simpleName = _lexerGrammar.getSimpleName(); + String _simpleName = this.getGrammarNaming().getLexerGrammar(it).getSimpleName(); _builder.append(_simpleName, "\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); } } { - GrammarNaming _grammarNaming_1 = this.getGrammarNaming(); - TypeReference _internalParserSuperClass = _grammarNaming_1.getInternalParserSuperClass(it); + TypeReference _internalParserSuperClass = this.getGrammarNaming().getInternalParserSuperClass(it); boolean _tripleNotEquals = (_internalParserSuperClass != null); if (_tripleNotEquals) { _builder.append("\t"); _builder.append("superClass="); - GrammarNaming _grammarNaming_2 = this.getGrammarNaming(); - TypeReference _internalParserSuperClass_1 = _grammarNaming_2.getInternalParserSuperClass(it); - String _simpleName_1 = _internalParserSuperClass_1.getSimpleName(); + String _simpleName_1 = this.getGrammarNaming().getInternalParserSuperClass(it).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -330,9 +308,7 @@ public abstract class AbstractAntlrGrammarGenerator { _builder.append("header {"); _builder.newLineIfNotEmpty(); _builder.append("package "); - GrammarNaming _grammarNaming = this.getGrammarNaming(); - AntlrGrammar _lexerGrammar = _grammarNaming.getLexerGrammar(it); - String _packageName = _lexerGrammar.getPackageName(); + String _packageName = this.getGrammarNaming().getLexerGrammar(it).getPackageName(); _builder.append(_packageName); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -352,8 +328,7 @@ public abstract class AbstractAntlrGrammarGenerator { _builder.append("// Currently there is no other way to specify the superclass for the lexer."); _builder.newLine(); _builder.append("import "); - GrammarNaming _grammarNaming = this.getGrammarNaming(); - TypeReference _lexerSuperClass = _grammarNaming.getLexerSuperClass(it); + TypeReference _lexerSuperClass = this.getGrammarNaming().getLexerSuperClass(it); _builder.append(_lexerSuperClass); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -373,9 +348,7 @@ public abstract class AbstractAntlrGrammarGenerator { _builder.append("header {"); _builder.newLineIfNotEmpty(); _builder.append("package "); - GrammarNaming _grammarNaming = this.getGrammarNaming(); - AntlrGrammar _parserGrammar = _grammarNaming.getParserGrammar(it); - String _packageName = _parserGrammar.getPackageName(); + String _packageName = this.getGrammarNaming().getParserGrammar(it).getPackageName(); _builder.append(_packageName); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -404,11 +377,10 @@ public abstract class AbstractAntlrGrammarGenerator { { List _allParserRules = GrammarUtil.allParserRules(it); List _allEnumRules = GrammarUtil.allEnumRules(it); - Iterable _plus = Iterables.concat(_allParserRules, _allEnumRules); final Function1 _function = (AbstractRule rule) -> { return Boolean.valueOf(this._grammarAccessExtensions.isCalled(rule, it)); }; - Iterable _filter = IterableExtensions.filter(_plus, _function); + Iterable _filter = IterableExtensions.filter(Iterables.concat(_allParserRules, _allEnumRules), _function); for(final AbstractRule rule : _filter) { _builder.newLine(); CharSequence _compileRule = this.compileRule(rule, it, options); @@ -433,10 +405,8 @@ public abstract class AbstractAntlrGrammarGenerator { final Set allKeywords = this.keywordHelper.getAllKeywords(); final List allTerminalRules = GrammarUtil.allTerminalRules(it); final ArrayList synthetic_kw_alternatives = CollectionLiterals.newArrayList(); - Iterable> _indexed = IterableExtensions.indexed(allKeywords); final Function1, String> _function = (Pair it_1) -> { - String _value = it_1.getValue(); - final String ruleName = this.keywordHelper.getRuleName(_value); + final String ruleName = this.keywordHelper.getRuleName(it_1.getValue()); StringConcatenation _builder = new StringConcatenation(); _builder.append("(FRAGMENT_"); _builder.append(ruleName); @@ -447,33 +417,27 @@ public abstract class AbstractAntlrGrammarGenerator { _builder.append("; }"); return _builder.toString(); }; - Iterable _map = IterableExtensions., String>map(_indexed, _function); - Iterables.addAll(synthetic_kw_alternatives, _map); - Iterable> _indexed_1 = IterableExtensions.indexed(allTerminalRules); + Iterables.addAll(synthetic_kw_alternatives, + IterableExtensions., String>map(IterableExtensions.indexed(allKeywords), _function)); final Function1, String> _function_1 = (Pair it_1) -> { if (((!this._syntheticTerminalDetector.isSyntheticTerminalRule(it_1.getValue())) && (!it_1.getValue().isFragment()))) { StringConcatenation _builder = new StringConcatenation(); _builder.append("(FRAGMENT_"); - TerminalRule _value = it_1.getValue(); - String _ruleName = this._grammarAccessExtensions.ruleName(_value); + String _ruleName = this._grammarAccessExtensions.ruleName(it_1.getValue()); _builder.append(_ruleName); _builder.append(")=> FRAGMENT_"); - TerminalRule _value_1 = it_1.getValue(); - String _ruleName_1 = this._grammarAccessExtensions.ruleName(_value_1); + String _ruleName_1 = this._grammarAccessExtensions.ruleName(it_1.getValue()); _builder.append(_ruleName_1); _builder.append(" {$type = "); - TerminalRule _value_2 = it_1.getValue(); - String _ruleName_2 = this._grammarAccessExtensions.ruleName(_value_2); + String _ruleName_2 = this._grammarAccessExtensions.ruleName(it_1.getValue()); _builder.append(_ruleName_2); _builder.append("; }"); return _builder.toString(); } return null; }; - Iterable _map_1 = IterableExtensions., String>map(_indexed_1, _function_1); - Iterable _filterNull = IterableExtensions.filterNull(_map_1); - List _list = IterableExtensions.toList(_filterNull); - synthetic_kw_alternatives.addAll(_list); + synthetic_kw_alternatives.addAll( + IterableExtensions.toList(IterableExtensions.filterNull(IterableExtensions., String>map(IterableExtensions.indexed(allTerminalRules), _function_1)))); StringConcatenation _builder = new StringConcatenation(); { boolean _isBacktrackLexer = options.isBacktrackLexer(); @@ -662,8 +626,7 @@ public abstract class AbstractAntlrGrammarGenerator { protected String compileEBNF(final AbstractRule it, final AntlrOptions options) { StringConcatenation _builder = new StringConcatenation(); _builder.append("// Rule "); - AbstractRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _name = _originalElement.getName(); + String _name = AntlrGrammarGenUtil.getOriginalElement(it).getName(); _builder.append(_name); _builder.newLineIfNotEmpty(); String _ruleName = this._grammarAccessExtensions.ruleName(it); @@ -734,8 +697,7 @@ public abstract class AbstractAntlrGrammarGenerator { { boolean _predicated = this._grammarAccessExtensions.predicated(it); if (_predicated) { - AbstractElement _predicatedElement = this._grammarAccessExtensions.predicatedElement(it); - String _ebnf2 = this.ebnf2(_predicatedElement, options, false); + String _ebnf2 = this.ebnf2(this._grammarAccessExtensions.predicatedElement(it), options, false); _builder.append(_ebnf2); } else { { @@ -793,8 +755,7 @@ public abstract class AbstractAntlrGrammarGenerator { { boolean _predicated = this._grammarAccessExtensions.predicated(it); if (_predicated) { - AbstractElement _predicatedElement = this._grammarAccessExtensions.predicatedElement(it); - String _dataTypeEbnf2 = this.dataTypeEbnf2(_predicatedElement, false); + String _dataTypeEbnf2 = this.dataTypeEbnf2(this._grammarAccessExtensions.predicatedElement(it), false); _builder.append(_dataTypeEbnf2); } else { { @@ -822,8 +783,7 @@ public abstract class AbstractAntlrGrammarGenerator { protected String _dataTypeEbnf2(final AbstractElement it, final boolean supportActions) { StringConcatenation _builder = new StringConcatenation(); _builder.append("ERROR "); - EClass _eClass = it.eClass(); - String _name = _eClass.getName(); + String _name = it.eClass().getName(); _builder.append(_name); _builder.append(" not matched"); return _builder.toString(); @@ -886,27 +846,23 @@ public abstract class AbstractAntlrGrammarGenerator { String _xifexpression = null; boolean _isCombinedGrammar = this.isCombinedGrammar(); if (_isCombinedGrammar) { - String _value = it.getValue(); - String _antlrString = AntlrGrammarGenUtil.toAntlrString(_value); + String _antlrString = AntlrGrammarGenUtil.toAntlrString(it.getValue()); String _plus = ("\'" + _antlrString); _xifexpression = (_plus + "\'"); } else { - String _value_1 = it.getValue(); - _xifexpression = this.keywordHelper.getRuleName(_value_1); + _xifexpression = this.keywordHelper.getRuleName(it.getValue()); } return _xifexpression; } protected String _dataTypeEbnf2(final RuleCall it, final boolean supportActions) { - AbstractRule _rule = it.getRule(); - return this._grammarAccessExtensions.ruleName(_rule); + return this._grammarAccessExtensions.ruleName(it.getRule()); } protected String _ebnf2(final AbstractElement it, final AntlrOptions options, final boolean supportActions) { StringConcatenation _builder = new StringConcatenation(); _builder.append("ERROR "); - EClass _eClass = it.eClass(); - String _name = _eClass.getName(); + String _name = it.eClass().getName(); _builder.append(_name); _builder.append(" not matched"); return _builder.toString(); @@ -967,8 +923,7 @@ public abstract class AbstractAntlrGrammarGenerator { protected String _ebnf2(final Assignment it, final AntlrOptions options, final boolean supportActions) { StringConcatenation _builder = new StringConcatenation(); - AbstractElement _terminal = it.getTerminal(); - String _assignmentEbnf = this.assignmentEbnf(_terminal, it, options, supportActions); + String _assignmentEbnf = this.assignmentEbnf(it.getTerminal(), it, options, supportActions); _builder.append(_assignmentEbnf); _builder.newLineIfNotEmpty(); return _builder.toString(); @@ -982,35 +937,28 @@ public abstract class AbstractAntlrGrammarGenerator { String _xifexpression = null; boolean _isCombinedGrammar = this.isCombinedGrammar(); if (_isCombinedGrammar) { - String _value = it.getValue(); - String _antlrString = AntlrGrammarGenUtil.toAntlrString(_value); + String _antlrString = AntlrGrammarGenUtil.toAntlrString(it.getValue()); String _plus = ("\'" + _antlrString); _xifexpression = (_plus + "\'"); } else { - String _value_1 = it.getValue(); - _xifexpression = this.keywordHelper.getRuleName(_value_1); + _xifexpression = this.keywordHelper.getRuleName(it.getValue()); } return _xifexpression; } protected String _ebnf2(final RuleCall it, final AntlrOptions options, final boolean supportActions) { - AbstractRule _rule = it.getRule(); - return this._grammarAccessExtensions.ruleName(_rule); + return this._grammarAccessExtensions.ruleName(it.getRule()); } protected String _ebnf2(final EnumLiteralDeclaration it, final AntlrOptions options, final boolean supportActions) { String _xifexpression = null; boolean _isCombinedGrammar = this.isCombinedGrammar(); if (_isCombinedGrammar) { - Keyword _literal = it.getLiteral(); - String _value = _literal.getValue(); - String _antlrString = AntlrGrammarGenUtil.toAntlrString(_value); + String _antlrString = AntlrGrammarGenUtil.toAntlrString(it.getLiteral().getValue()); String _plus = ("\'" + _antlrString); _xifexpression = (_plus + "\'"); } else { - Keyword _literal_1 = it.getLiteral(); - String _value_1 = _literal_1.getValue(); - _xifexpression = this.keywordHelper.getRuleName(_value_1); + _xifexpression = this.keywordHelper.getRuleName(it.getLiteral().getValue()); } return _xifexpression; } @@ -1139,8 +1087,7 @@ public abstract class AbstractAntlrGrammarGenerator { } protected String _assignmentEbnf(final CrossReference it, final Assignment assignment, final AntlrOptions options, final boolean supportActions) { - AbstractElement _terminal = it.getTerminal(); - return this.crossrefEbnf(_terminal, it, supportActions); + return this.crossrefEbnf(it.getTerminal(), it, supportActions); } protected String _assignmentEbnf(final AbstractElement it, final Assignment assignment, final AntlrOptions options, final boolean supportActions) { diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGrammarWithActionsGenerator.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGrammarWithActionsGenerator.java index a42e6bb7c..e8f494b75 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGrammarWithActionsGenerator.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AbstractAntlrGrammarWithActionsGenerator.java @@ -9,9 +9,7 @@ package org.eclipse.xtext.xtext.generator.parser.antlr; import com.google.common.collect.Iterables; import java.util.Arrays; -import java.util.List; import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.AbstractElement; import org.eclipse.xtext.AbstractRule; @@ -43,8 +41,7 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA boolean _matched = false; if (it instanceof ParserRule) { _matched=true; - CharSequence _compileEntryInit = this.compileEntryInit(((ParserRule)it), options); - _switchResult = _compileEntryInit.toString(); + _switchResult = this.compileEntryInit(((ParserRule)it), options).toString(); } if (!_matched) { _switchResult = super.compileInit(it, options); @@ -116,8 +113,7 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA _builder.append("UnorderedGroupState myUnorderedGroupState = getUnorderedGroupHelper().snapShot("); _builder.newLine(); { - List _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(it); - Iterable _filter = Iterables.filter(_eAllContentsAsList, UnorderedGroup.class); + Iterable _filter = Iterables.filter(EcoreUtil2.eAllContentsAsList(it), UnorderedGroup.class); boolean _hasElements = false; for(final UnorderedGroup group : _filter) { if (!_hasElements) { @@ -144,8 +140,7 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA boolean _matched = false; if (it instanceof ParserRule) { _matched=true; - CharSequence _compileEntryFinally = this.compileEntryFinally(((ParserRule)it), options); - _switchResult = _compileEntryFinally.toString(); + _switchResult = this.compileEntryFinally(((ParserRule)it), options).toString(); } if (!_matched) { _switchResult = super.compileFinally(it, options); @@ -226,13 +221,11 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA if (supportActions) { String _xblockexpression = null; { - EList _elements = it.getElements(); final Function1 _function = (AbstractElement it_1) -> { boolean _isOptionalCardinality = GrammarUtil.isOptionalCardinality(it_1); return Boolean.valueOf((!_isOptionalCardinality)); }; - Iterable _filter = IterableExtensions.filter(_elements, _function); - final int mandatoryContent = IterableExtensions.size(_filter); + final int mandatoryContent = IterableExtensions.size(IterableExtensions.filter(it.getElements(), _function)); StringConcatenation _builder = new StringConcatenation(); _builder.append("("); _builder.newLine(); @@ -256,8 +249,7 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA _builder.append("("); _builder.newLine(); { - EList _elements_1 = it.getElements(); - Iterable> _indexed = IterableExtensions.indexed(_elements_1); + Iterable> _indexed = IterableExtensions.indexed(it.getElements()); boolean _hasElements = false; for(final Pair element : _indexed) { if (!_hasElements) { @@ -295,13 +287,11 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA _builder.newLine(); _builder.append("\t\t\t\t\t"); _builder.append("({true}?=>("); - AbstractElement _value = element.getValue(); - String _dataTypeEbnf2 = this.dataTypeEbnf2(_value, supportActions); + String _dataTypeEbnf2 = this.dataTypeEbnf2(element.getValue(), supportActions); _builder.append(_dataTypeEbnf2, "\t\t\t\t\t"); _builder.append("))"); { - AbstractElement _value_1 = element.getValue(); - boolean _isMultipleCardinality = GrammarUtil.isMultipleCardinality(_value_1); + boolean _isMultipleCardinality = GrammarUtil.isMultipleCardinality(element.getValue()); if (_isMultipleCardinality) { _builder.append("+"); } @@ -394,13 +384,11 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA if (supportActions) { String _xblockexpression = null; { - EList _elements = it.getElements(); final Function1 _function = (AbstractElement it_1) -> { boolean _isOptionalCardinality = GrammarUtil.isOptionalCardinality(it_1); return Boolean.valueOf((!_isOptionalCardinality)); }; - Iterable _filter = IterableExtensions.filter(_elements, _function); - final int mandatoryContent = IterableExtensions.size(_filter); + final int mandatoryContent = IterableExtensions.size(IterableExtensions.filter(it.getElements(), _function)); StringConcatenation _builder = new StringConcatenation(); _builder.append("("); _builder.newLine(); @@ -424,8 +412,7 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA _builder.append("("); _builder.newLine(); { - EList _elements_1 = it.getElements(); - Iterable> _indexed = IterableExtensions.indexed(_elements_1); + Iterable> _indexed = IterableExtensions.indexed(it.getElements()); boolean _hasElements = false; for(final Pair element : _indexed) { if (!_hasElements) { @@ -463,13 +450,11 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA _builder.newLine(); _builder.append("\t\t\t\t\t"); _builder.append("({true}?=>("); - AbstractElement _value = element.getValue(); - String _ebnf2 = this.ebnf2(_value, options, supportActions); + String _ebnf2 = this.ebnf2(element.getValue(), options, supportActions); _builder.append(_ebnf2, "\t\t\t\t\t"); _builder.append("))"); { - AbstractElement _value_1 = element.getValue(); - boolean _isMultipleCardinality = GrammarUtil.isMultipleCardinality(_value_1); + boolean _isMultipleCardinality = GrammarUtil.isMultipleCardinality(element.getValue()); if (_isMultipleCardinality) { _builder.append("+"); } @@ -570,16 +555,14 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA @Override protected String crossrefEbnf(final AbstractRule it, final RuleCall call, final CrossReference ref, final boolean supportActions) { String _crossrefEbnf = super.crossrefEbnf(it, call, ref, supportActions); - boolean _isPassCurrentIntoFragment = this.isPassCurrentIntoFragment(); - String _argumentList = AntlrGrammarGenUtil.getArgumentList(call, _isPassCurrentIntoFragment, (!supportActions)); + String _argumentList = AntlrGrammarGenUtil.getArgumentList(call, this.isPassCurrentIntoFragment(), (!supportActions)); return (_crossrefEbnf + _argumentList); } @Override protected String _assignmentEbnf(final RuleCall it, final Assignment assignment, final AntlrOptions options, final boolean supportActions) { String __assignmentEbnf = super._assignmentEbnf(it, assignment, options, supportActions); - boolean _isPassCurrentIntoFragment = this.isPassCurrentIntoFragment(); - String _argumentList = AntlrGrammarGenUtil.getArgumentList(it, _isPassCurrentIntoFragment, (!supportActions)); + String _argumentList = AntlrGrammarGenUtil.getArgumentList(it, this.isPassCurrentIntoFragment(), (!supportActions)); return (__assignmentEbnf + _argumentList); } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrContentAssistGrammarGenerator.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrContentAssistGrammarGenerator.java index 186d59d89..3142cb535 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrContentAssistGrammarGenerator.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrContentAssistGrammarGenerator.java @@ -12,7 +12,6 @@ import com.google.inject.Inject; import java.util.Arrays; import java.util.Collection; import java.util.List; -import java.util.Set; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtend2.lib.StringConcatenation; @@ -36,7 +35,6 @@ import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.Pair; -import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGrammarWithActionsGenerator; import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil; import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrOptions; @@ -73,8 +71,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("private "); - TypeReference _grammarAccess = this._grammarAccessExtensions.getGrammarAccess(it); - String _simpleName = _grammarAccess.getSimpleName(); + String _simpleName = this._grammarAccessExtensions.getGrammarAccess(it).getSimpleName(); _builder.append(_simpleName, "\t"); _builder.append(" grammarAccess;"); _builder.newLineIfNotEmpty(); @@ -91,12 +88,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("{"); _builder.newLine(); { - Set _allKeywords = GrammarUtil.getAllKeywords(it); - List _sort = IterableExtensions.sort(_allKeywords); final Function1 _function = (String it_1) -> { return Integer.valueOf(it_1.length()); }; - List _sortBy = IterableExtensions.sortBy(_sort, _function); + List _sortBy = IterableExtensions.sortBy(IterableExtensions.sort(GrammarUtil.getAllKeywords(it)), _function); for(final String kw : _sortBy) { _builder.append("\t"); _builder.append("\t"); @@ -104,8 +99,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith String _ruleName = this.keywordHelper.getRuleName(kw); _builder.append(_ruleName, "\t\t"); _builder.append("\", \"\'"); - String _stringInAntlrAction = AntlrGrammarGenUtil.toStringInAntlrAction(kw); - String _replace = _stringInAntlrAction.replace("$", "\\u0024"); + String _replace = AntlrGrammarGenUtil.toStringInAntlrAction(kw).replace("$", "\\u0024"); _builder.append(_replace, "\t\t"); _builder.append("\'\");"); _builder.newLineIfNotEmpty(); @@ -119,8 +113,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t"); _builder.append("public void setGrammarAccess("); - TypeReference _grammarAccess_1 = this._grammarAccessExtensions.getGrammarAccess(it); - String _simpleName_1 = _grammarAccess_1.getSimpleName(); + String _simpleName_1 = this._grammarAccessExtensions.getGrammarAccess(it).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append(" grammarAccess) {"); _builder.newLineIfNotEmpty(); @@ -211,17 +204,14 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;"); _builder.newLine(); _builder.append("import "); - GrammarNaming _grammarNaming = this.getGrammarNaming(); - TypeReference _internalParserSuperClass = _grammarNaming.getInternalParserSuperClass(it); - String _name = _internalParserSuperClass.getName(); + String _name = this.getGrammarNaming().getInternalParserSuperClass(it).getName(); _builder.append(_name); _builder.append(";"); _builder.newLineIfNotEmpty(); _builder.append("import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.DFA;"); _builder.newLine(); _builder.append("import "); - TypeReference _grammarAccess = this._grammarAccessExtensions.getGrammarAccess(it); - String _name_1 = _grammarAccess.getName(); + String _name_1 = this._grammarAccessExtensions.getGrammarAccess(it).getName(); _builder.append(_name_1); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -243,12 +233,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith Collection _allUnorderedGroups = GrammarUtil.getAllUnorderedGroups(g); Iterable _plus_3 = Iterables.concat(_plus_2, _allUnorderedGroups); Collection _allAssignments = GrammarUtil.getAllAssignments(g); - Iterable _plus_4 = Iterables.concat(_plus_3, _allAssignments); final Function1 _function = (EObject it) -> { - AbstractRule _containingRule = GrammarUtil.containingRule(it); - return Boolean.valueOf(this._grammarAccessExtensions.isCalled(_containingRule, g)); + return Boolean.valueOf(this._grammarAccessExtensions.isCalled(GrammarUtil.containingRule(it), g)); }; - Iterable _filter = IterableExtensions.filter(_plus_4, _function); + Iterable _filter = IterableExtensions.filter(Iterables.concat(_plus_3, _allAssignments), _function); for(final EObject rule : _filter) { _builder.newLine(); CharSequence _compileRule = this.compileRule(rule, g, options); @@ -296,8 +284,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append(":"); _builder.newLine(); _builder.append("{ before(grammarAccess."); - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -306,8 +293,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append(_ruleName, "\t "); _builder.newLineIfNotEmpty(); _builder.append("{ after(grammarAccess."); - ParserRule _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_1); + String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess_1); _builder.append("); } "); _builder.newLineIfNotEmpty(); @@ -333,8 +319,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith } _builder.newLine(); _builder.append("// Rule "); - ParserRule _originalElement_2 = AntlrGrammarGenUtil.getOriginalElement(it); - String _name = _originalElement_2.getName(); + String _name = AntlrGrammarGenUtil.getOriginalElement(it).getName(); _builder.append(_name); _builder.newLineIfNotEmpty(); String _ruleName_1 = this._grammarAccessExtensions.ruleName(it); @@ -358,8 +343,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append(":"); _builder.newLine(); _builder.append("\t"); - AbstractElement _alternatives = it.getAlternatives(); - String _ebnf = this.ebnf(_alternatives, options, false); + String _ebnf = this.ebnf(it.getAlternatives(), options, false); _builder.append(_ebnf, "\t"); _builder.newLineIfNotEmpty(); _builder.append(";"); @@ -382,8 +366,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith protected CharSequence _compileRule(final EnumRule it, final Grammar grammar, final AntlrOptions options) { StringConcatenation _builder = new StringConcatenation(); _builder.append("// Rule "); - EnumRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _name = _originalElement.getName(); + String _name = AntlrGrammarGenUtil.getOriginalElement(it).getName(); _builder.append(_name); _builder.newLineIfNotEmpty(); String _ruleName = this._grammarAccessExtensions.ruleName(it); @@ -401,8 +384,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append(":"); _builder.newLine(); _builder.append("\t"); - AbstractElement _alternatives = it.getAlternatives(); - String _ebnf = this.ebnf(_alternatives, options, false); + String _ebnf = this.ebnf(it.getAlternatives(), options, false); _builder.append(_ebnf, "\t"); _builder.newLineIfNotEmpty(); _builder.append(";"); @@ -419,12 +401,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith protected CharSequence _compileRule(final Alternatives it, final Grammar grammar, final AntlrOptions options) { StringConcatenation _builder = new StringConcatenation(); - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); - Alternatives _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_originalElement); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -467,12 +447,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith protected CharSequence _compileRule(final Assignment it, final Grammar grammar, final AntlrOptions options) { StringConcatenation _builder = new StringConcatenation(); - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); - Assignment _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_originalElement); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -487,8 +465,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append(":"); _builder.newLine(); _builder.append("\t"); - AbstractElement _terminal = it.getTerminal(); - String _assignmentEbnf = this.assignmentEbnf(_terminal, it, options, false); + String _assignmentEbnf = this.assignmentEbnf(it.getTerminal(), it, options, false); _builder.append(_assignmentEbnf, "\t"); _builder.newLineIfNotEmpty(); _builder.append(";"); @@ -506,19 +483,16 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith protected CharSequence _compileRule(final UnorderedGroup it, final Grammar grammar, final AntlrOptions options) { CharSequence _xblockexpression = null; { - EList _elements = it.getElements(); final Function1 _function = (AbstractElement it_1) -> { boolean _isOptionalCardinality = GrammarUtil.isOptionalCardinality(it_1); return Boolean.valueOf((!_isOptionalCardinality)); }; - final boolean hasMandatoryContent = IterableExtensions.exists(_elements, _function); + final boolean hasMandatoryContent = IterableExtensions.exists(it.getElements(), _function); StringConcatenation _builder = new StringConcatenation(); - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); - UnorderedGroup _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_originalElement); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -529,8 +503,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t\t"); _builder.append("getUnorderedGroupHelper().enter(grammarAccess."); - UnorderedGroup _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaRuleElementAccessor = this._grammarAccessExtensions.gaRuleElementAccessor(_originalElement_1); + String _gaRuleElementAccessor = this._grammarAccessExtensions.gaRuleElementAccessor(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaRuleElementAccessor, "\t\t"); _builder.append(");"); _builder.newLineIfNotEmpty(); @@ -540,12 +513,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append(":"); _builder.newLine(); _builder.append("\t"); - AbstractRule _containingRule_1 = GrammarUtil.containingRule(it); - String _contentAssistRuleName_1 = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule_1); + String _contentAssistRuleName_1 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_1, "\t"); _builder.append("__"); - UnorderedGroup _originalElement_2 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier_1 = this._grammarAccessExtensions.gaElementIdentifier(_originalElement_2); + String _gaElementIdentifier_1 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier_1, "\t"); _builder.append("__0"); _builder.newLineIfNotEmpty(); @@ -553,8 +524,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith if (hasMandatoryContent) { _builder.append("\t"); _builder.append("{getUnorderedGroupHelper().canLeave(grammarAccess."); - UnorderedGroup _originalElement_3 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaRuleElementAccessor_1 = this._grammarAccessExtensions.gaRuleElementAccessor(_originalElement_3); + String _gaRuleElementAccessor_1 = this._grammarAccessExtensions.gaRuleElementAccessor(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaRuleElementAccessor_1, "\t"); _builder.append(")}?"); _builder.newLineIfNotEmpty(); @@ -570,8 +540,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t"); _builder.append("getUnorderedGroupHelper().leave(grammarAccess."); - UnorderedGroup _originalElement_4 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaRuleElementAccessor_2 = this._grammarAccessExtensions.gaRuleElementAccessor(_originalElement_4); + String _gaRuleElementAccessor_2 = this._grammarAccessExtensions.gaRuleElementAccessor(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaRuleElementAccessor_2, "\t"); _builder.append(");"); _builder.newLineIfNotEmpty(); @@ -603,12 +572,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith protected CharSequence ruleImpl(final UnorderedGroup it, final Grammar grammar, final AntlrOptions options) { StringConcatenation _builder = new StringConcatenation(); - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); - UnorderedGroup _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_originalElement); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.append("__Impl"); _builder.newLineIfNotEmpty(); @@ -630,8 +597,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("("); _builder.newLine(); { - EList _elements = it.getElements(); - Iterable> _indexed = IterableExtensions.indexed(_elements); + Iterable> _indexed = IterableExtensions.indexed(it.getElements()); boolean _hasElements = false; for(final Pair element : _indexed) { if (!_hasElements) { @@ -645,8 +611,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("\t\t"); _builder.append("\t"); _builder.append("{getUnorderedGroupHelper().canSelect(grammarAccess."); - UnorderedGroup _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaRuleElementAccessor = this._grammarAccessExtensions.gaRuleElementAccessor(_originalElement_1); + String _gaRuleElementAccessor = this._grammarAccessExtensions.gaRuleElementAccessor(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaRuleElementAccessor, "\t\t\t"); _builder.append(", "); Integer _key = element.getKey(); @@ -660,8 +625,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("\t\t"); _builder.append("\t\t\t"); _builder.append("getUnorderedGroupHelper().select(grammarAccess."); - UnorderedGroup _originalElement_2 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaRuleElementAccessor_1 = this._grammarAccessExtensions.gaRuleElementAccessor(_originalElement_2); + String _gaRuleElementAccessor_1 = this._grammarAccessExtensions.gaRuleElementAccessor(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaRuleElementAccessor_1, "\t\t\t\t\t"); _builder.append(", "); Integer _key_1 = element.getKey(); @@ -689,8 +653,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("("); _builder.newLine(); { - AbstractElement _value = element.getValue(); - boolean _isMultipleCardinality = GrammarUtil.isMultipleCardinality(_value); + boolean _isMultipleCardinality = GrammarUtil.isMultipleCardinality(element.getValue()); if (_isMultipleCardinality) { _builder.append("\t\t"); _builder.append("\t\t\t"); @@ -700,9 +663,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("\t\t\t"); _builder.append("\t"); _builder.append("{ before(grammarAccess."); - AbstractElement _value_1 = element.getValue(); - AbstractElement _originalElement_3 = AntlrGrammarGenUtil.getOriginalElement(_value_1); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement_3); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(element.getValue())); _builder.append(_grammarElementAccess, "\t\t\t\t\t\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -710,8 +671,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("\t\t\t"); _builder.append("\t"); _builder.append("("); - AbstractElement _value_2 = element.getValue(); - String _ebnf2 = this.ebnf2(_value_2, options, false); + String _ebnf2 = this.ebnf2(element.getValue(), options, false); _builder.append(_ebnf2, "\t\t\t\t\t\t"); _builder.append(")"); _builder.newLineIfNotEmpty(); @@ -719,9 +679,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("\t\t\t"); _builder.append("\t"); _builder.append("{ after(grammarAccess."); - AbstractElement _value_3 = element.getValue(); - AbstractElement _originalElement_4 = AntlrGrammarGenUtil.getOriginalElement(_value_3); - String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_4); + String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(element.getValue())); _builder.append(_grammarElementAccess_1, "\t\t\t\t\t\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -737,9 +695,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("\t\t\t"); _builder.append("\t"); _builder.append("{ before(grammarAccess."); - AbstractElement _value_4 = element.getValue(); - AbstractElement _originalElement_5 = AntlrGrammarGenUtil.getOriginalElement(_value_4); - String _grammarElementAccess_2 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_5); + String _grammarElementAccess_2 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(element.getValue())); _builder.append(_grammarElementAccess_2, "\t\t\t\t\t\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -747,12 +703,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("\t\t\t"); _builder.append("\t"); _builder.append("(("); - AbstractElement _value_5 = element.getValue(); - String _ebnf2_1 = this.ebnf2(_value_5, options, false); + String _ebnf2_1 = this.ebnf2(element.getValue(), options, false); _builder.append(_ebnf2_1, "\t\t\t\t\t\t"); _builder.append(")=>"); - AbstractElement _value_6 = element.getValue(); - String _ebnf2_2 = this.ebnf2(_value_6, options, false); + String _ebnf2_2 = this.ebnf2(element.getValue(), options, false); _builder.append(_ebnf2_2, "\t\t\t\t\t\t"); _builder.append(")*"); _builder.newLineIfNotEmpty(); @@ -760,9 +714,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("\t\t\t"); _builder.append("\t"); _builder.append("{ after(grammarAccess."); - AbstractElement _value_7 = element.getValue(); - AbstractElement _originalElement_6 = AntlrGrammarGenUtil.getOriginalElement(_value_7); - String _grammarElementAccess_3 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_6); + String _grammarElementAccess_3 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(element.getValue())); _builder.append(_grammarElementAccess_3, "\t\t\t\t\t\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -774,26 +726,21 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("\t\t"); _builder.append("\t\t\t"); _builder.append("{ before(grammarAccess."); - AbstractElement _value_8 = element.getValue(); - AbstractElement _originalElement_7 = AntlrGrammarGenUtil.getOriginalElement(_value_8); - String _grammarElementAccess_4 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_7); + String _grammarElementAccess_4 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(element.getValue())); _builder.append(_grammarElementAccess_4, "\t\t\t\t\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("\t\t\t"); _builder.append("("); - AbstractElement _value_9 = element.getValue(); - String _ebnf2_3 = this.ebnf2(_value_9, options, false); + String _ebnf2_3 = this.ebnf2(element.getValue(), options, false); _builder.append(_ebnf2_3, "\t\t\t\t\t"); _builder.append(")"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("\t\t\t"); _builder.append("{ after(grammarAccess."); - AbstractElement _value_10 = element.getValue(); - AbstractElement _originalElement_8 = AntlrGrammarGenUtil.getOriginalElement(_value_10); - String _grammarElementAccess_5 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_8); + String _grammarElementAccess_5 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(element.getValue())); _builder.append(_grammarElementAccess_5, "\t\t\t\t\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -824,8 +771,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t\t"); _builder.append("getUnorderedGroupHelper().returnFromSelection(grammarAccess."); - UnorderedGroup _originalElement_9 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaRuleElementAccessor_2 = this._grammarAccessExtensions.gaRuleElementAccessor(_originalElement_9); + String _gaRuleElementAccessor_2 = this._grammarAccessExtensions.gaRuleElementAccessor(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaRuleElementAccessor_2, "\t\t"); _builder.append(");"); _builder.newLineIfNotEmpty(); @@ -839,12 +785,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith protected CharSequence ruleImpl(final UnorderedGroup it, final Grammar grammar, final AntlrOptions options, final int index) { StringConcatenation _builder = new StringConcatenation(); - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); - UnorderedGroup _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_originalElement); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.append("__"); _builder.append(index); @@ -861,27 +805,22 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append(":"); _builder.newLine(); _builder.append("\t"); - AbstractRule _containingRule_1 = GrammarUtil.containingRule(it); - String _contentAssistRuleName_1 = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule_1); + String _contentAssistRuleName_1 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_1, "\t"); _builder.append("__"); - UnorderedGroup _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier_1 = this._grammarAccessExtensions.gaElementIdentifier(_originalElement_1); + String _gaElementIdentifier_1 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier_1, "\t"); _builder.append("__Impl"); _builder.newLineIfNotEmpty(); { - EList _elements = it.getElements(); - int _size = _elements.size(); + int _size = it.getElements().size(); boolean _greaterThan = (_size > (index + 1)); if (_greaterThan) { _builder.append("\t"); - AbstractRule _containingRule_2 = GrammarUtil.containingRule(it); - String _contentAssistRuleName_2 = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule_2); + String _contentAssistRuleName_2 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_2, "\t"); _builder.append("__"); - UnorderedGroup _originalElement_2 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier_2 = this._grammarAccessExtensions.gaElementIdentifier(_originalElement_2); + String _gaElementIdentifier_2 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier_2, "\t"); _builder.append("__"); _builder.append((index + 1), "\t"); @@ -900,8 +839,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.newLine(); { - EList _elements_1 = it.getElements(); - int _size_1 = _elements_1.size(); + int _size_1 = it.getElements().size(); boolean _greaterThan_1 = (_size_1 > (index + 1)); if (_greaterThan_1) { CharSequence _ruleImpl = this.ruleImpl(it, grammar, options, (index + 1)); @@ -914,12 +852,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith protected CharSequence ruleImpl(final Group it, final Grammar grammar, final AntlrOptions options, final int index) { StringConcatenation _builder = new StringConcatenation(); - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); - Group _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_originalElement); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.append("__"); _builder.append(index); @@ -936,29 +872,24 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append(":"); _builder.newLine(); _builder.append("\t"); - AbstractRule _containingRule_1 = GrammarUtil.containingRule(it); - String _contentAssistRuleName_1 = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule_1); + String _contentAssistRuleName_1 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_1, "\t"); _builder.append("__"); - Group _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier_1 = this._grammarAccessExtensions.gaElementIdentifier(_originalElement_1); + String _gaElementIdentifier_1 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier_1, "\t"); _builder.append("__"); _builder.append(index, "\t"); _builder.append("__Impl"); _builder.newLineIfNotEmpty(); { - EList _elements = it.getElements(); - int _size = _elements.size(); + int _size = it.getElements().size(); boolean _greaterThan = (_size > (index + 1)); if (_greaterThan) { _builder.append("\t"); - AbstractRule _containingRule_2 = GrammarUtil.containingRule(it); - String _contentAssistRuleName_2 = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule_2); + String _contentAssistRuleName_2 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_2, "\t"); _builder.append("__"); - Group _originalElement_2 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier_2 = this._grammarAccessExtensions.gaElementIdentifier(_originalElement_2); + String _gaElementIdentifier_2 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier_2, "\t"); _builder.append("__"); _builder.append((index + 1), "\t"); @@ -975,12 +906,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.append("}"); _builder.newLine(); _builder.newLine(); - AbstractRule _containingRule_3 = GrammarUtil.containingRule(it); - String _contentAssistRuleName_3 = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule_3); + String _contentAssistRuleName_3 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_3); _builder.append("__"); - Group _originalElement_3 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier_3 = this._grammarAccessExtensions.gaElementIdentifier(_originalElement_3); + String _gaElementIdentifier_3 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier_3); _builder.append("__"); _builder.append(index); @@ -997,9 +926,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append(":"); _builder.newLine(); - EList _elements_1 = it.getElements(); - AbstractElement _get = _elements_1.get(index); - String _ebnf = this.ebnf(_get, options, false); + String _ebnf = this.ebnf(it.getElements().get(index), options, false); _builder.append(_ebnf); _builder.newLineIfNotEmpty(); _builder.append(";"); @@ -1013,8 +940,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.newLine(); { - EList _elements_2 = it.getElements(); - int _size_1 = _elements_2.size(); + int _size_1 = it.getElements().size(); boolean _greaterThan_1 = (_size_1 > (index + 1)); if (_greaterThan_1) { CharSequence _ruleImpl = this.ruleImpl(it, grammar, options, (index + 1)); @@ -1037,8 +963,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t\t"); _builder.append("{ before(grammarAccess."); - AbstractElement _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess, "\t\t"); CharSequence _paramConfig = this.paramConfig(it); _builder.append(_paramConfig, "\t\t"); @@ -1052,8 +977,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("{ after(grammarAccess."); - AbstractElement _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_1); + String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess_1, "\t\t"); CharSequence _paramConfig_1 = this.paramConfig(it); _builder.append(_paramConfig_1, "\t\t"); @@ -1067,8 +991,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t\t"); _builder.append("{ before(grammarAccess."); - AbstractElement _originalElement_2 = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess_2 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_2); + String _grammarElementAccess_2 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess_2, "\t\t"); CharSequence _paramConfig_2 = this.paramConfig(it); _builder.append(_paramConfig_2, "\t\t"); @@ -1082,8 +1005,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("{ after(grammarAccess."); - AbstractElement _originalElement_3 = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess_3 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_3); + String _grammarElementAccess_3 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess_3, "\t\t"); CharSequence _paramConfig_3 = this.paramConfig(it); _builder.append(_paramConfig_3, "\t\t"); @@ -1099,8 +1021,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t"); _builder.append("{ before(grammarAccess."); - AbstractElement _originalElement_4 = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess_4 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_4); + String _grammarElementAccess_4 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess_4, "\t"); CharSequence _paramConfig_4 = this.paramConfig(it); _builder.append(_paramConfig_4, "\t"); @@ -1124,8 +1045,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("{ after(grammarAccess."); - AbstractElement _originalElement_5 = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess_5 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_5); + String _grammarElementAccess_5 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess_5, "\t"); CharSequence _paramConfig_5 = this.paramConfig(it); _builder.append(_paramConfig_5, "\t"); @@ -1159,8 +1079,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t"); _builder.append("{ before(grammarAccess."); - AbstractElement _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -1170,8 +1089,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("{ after(grammarAccess."); - AbstractElement _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_1); + String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess_1, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -1187,20 +1105,17 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t"); _builder.append("{ before(grammarAccess."); - CrossReference _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); _builder.append("\t"); - AbstractElement _terminal = it.getTerminal(); - String _crossrefEbnf = this.crossrefEbnf(_terminal, it, supportsActions); + String _crossrefEbnf = this.crossrefEbnf(it.getTerminal(), it, supportsActions); _builder.append(_crossrefEbnf, "\t"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("{ after(grammarAccess."); - CrossReference _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_1); + String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess_1, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -1216,26 +1131,22 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t"); _builder.append("{ before(grammarAccess."); - Alternatives _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("("); - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName, "\t"); _builder.append("__"); - Alternatives _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_originalElement_1); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier, "\t"); _builder.append(")"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("{ after(grammarAccess."); - Alternatives _originalElement_2 = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_2); + String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess_1, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -1251,20 +1162,17 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t"); _builder.append("{ before(grammarAccess."); - RuleCall _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); _builder.append("\t"); - AbstractRule _rule = it.getRule(); - String _ruleName = this._grammarAccessExtensions.ruleName(_rule); + String _ruleName = this._grammarAccessExtensions.ruleName(it.getRule()); _builder.append(_ruleName, "\t"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("{ after(grammarAccess."); - RuleCall _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_1); + String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess_1, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -1280,20 +1188,17 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith _builder.newLine(); _builder.append("\t"); _builder.append("{ before(grammarAccess."); - RuleCall _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); _builder.append("\t"); - AbstractRule _rule = it.getRule(); - String _crossrefEbnf = this.crossrefEbnf(_rule, it, ref, supportActions); + String _crossrefEbnf = this.crossrefEbnf(it.getRule(), it, ref, supportActions); _builder.append(_crossrefEbnf, "\t"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("{ after(grammarAccess."); - RuleCall _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(_originalElement_1); + String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess_1, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); @@ -1311,8 +1216,7 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith } protected String _crossrefEbnf(final AbstractRule it, final RuleCall call, final CrossReference ref, final boolean supportActions) { - AbstractRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(_originalElement); + boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(AntlrGrammarGenUtil.getOriginalElement(it)); if (_isDatatypeRule) { return this._grammarAccessExtensions.ruleName(it); } @@ -1324,12 +1228,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith @Override protected String _ebnf2(final Alternatives it, final AntlrOptions options, final boolean supportActions) { StringConcatenation _builder = new StringConcatenation(); - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); - Alternatives _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_originalElement); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier); return _builder.toString(); } @@ -1337,12 +1239,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith @Override protected String _ebnf2(final Assignment it, final AntlrOptions options, final boolean supportActions) { StringConcatenation _builder = new StringConcatenation(); - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); - Assignment _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_originalElement); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier); return _builder.toString(); } @@ -1350,12 +1250,10 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith @Override protected String _ebnf2(final Group it, final AntlrOptions options, final boolean supportActions) { StringConcatenation _builder = new StringConcatenation(); - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); - Group _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_originalElement); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.append("__0"); return _builder.toString(); @@ -1364,20 +1262,17 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith @Override protected String _ebnf2(final UnorderedGroup it, final AntlrOptions options, final boolean supportActions) { StringConcatenation _builder = new StringConcatenation(); - AbstractRule _containingRule = GrammarUtil.containingRule(it); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); - UnorderedGroup _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_originalElement); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_gaElementIdentifier); return _builder.toString(); } @Override protected String _ebnf2(final RuleCall it, final AntlrOptions options, final boolean supportActions) { - AbstractRule _rule = it.getRule(); - return this._grammarAccessExtensions.ruleName(_rule); + return this._grammarAccessExtensions.ruleName(it.getRule()); } @Override diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrGrammar.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrGrammar.java index ed2799322..08bb74530 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrGrammar.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrGrammar.java @@ -22,14 +22,12 @@ public class AntlrGrammar { } public String getGrammarFileName() { - String _name = this.getName(); - String _replace = _name.replace(".", "/"); + String _replace = this.getName().replace(".", "/"); return (_replace + ".g"); } public String getTokensFileName() { - String _name = this.getName(); - String _replace = _name.replace(".", "/"); + String _replace = this.getName().replace(".", "/"); return (_replace + ".tokens"); } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrGrammarGenerator.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrGrammarGenerator.java index 0413724ad..5399d4b96 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrGrammarGenerator.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/AntlrGrammarGenerator.java @@ -34,7 +34,6 @@ import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.ListExtensions; import org.eclipse.xtext.xbase.lib.StringExtensions; -import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGrammarWithActionsGenerator; import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil; import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrOptions; @@ -67,8 +66,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera _builder.append("import org.eclipse.emf.ecore.EObject;"); _builder.newLine(); { - List _allEnumRules = GrammarUtil.allEnumRules(it); - boolean _isEmpty = _allEnumRules.isEmpty(); + boolean _isEmpty = GrammarUtil.allEnumRules(it).isEmpty(); boolean _not = (!_isEmpty); if (_not) { _builder.append("import org.eclipse.emf.common.util.Enumerator;"); @@ -76,9 +74,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera } } _builder.append("import "); - GrammarNaming _grammarNaming = this.getGrammarNaming(); - TypeReference _internalParserSuperClass = _grammarNaming.getInternalParserSuperClass(it); - String _name = _internalParserSuperClass.getName(); + String _name = this.getGrammarNaming().getInternalParserSuperClass(it).getName(); _builder.append(_name); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -97,8 +93,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera _builder.append("import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken;"); _builder.newLine(); _builder.append("import "); - TypeReference _grammarAccess = this._grammarAccessExtensions.getGrammarAccess(it); - String _name_1 = _grammarAccess.getName(); + String _name_1 = this._grammarAccessExtensions.getGrammarAccess(it).getName(); _builder.append(_name_1); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -138,20 +133,17 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera } _builder.append(" \t"); _builder.append("private "); - TypeReference _grammarAccess = this._grammarAccessExtensions.getGrammarAccess(it); - String _simpleName = _grammarAccess.getSimpleName(); + String _simpleName = this._grammarAccessExtensions.getGrammarAccess(it).getSimpleName(); _builder.append(_simpleName, " \t"); _builder.append(" grammarAccess;"); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append(" "); _builder.append("public "); - TypeReference _internalParserClass = this.naming.getInternalParserClass(it); - String _simpleName_1 = _internalParserClass.getSimpleName(); + String _simpleName_1 = this.naming.getInternalParserClass(it).getSimpleName(); _builder.append(_simpleName_1, " "); _builder.append("(TokenStream input, "); - TypeReference _grammarAccess_1 = this._grammarAccessExtensions.getGrammarAccess(it); - String _simpleName_2 = _grammarAccess_1.getSimpleName(); + String _simpleName_2 = this._grammarAccessExtensions.getGrammarAccess(it).getSimpleName(); _builder.append(_simpleName_2, " "); _builder.append(" grammarAccess) {"); _builder.newLineIfNotEmpty(); @@ -176,10 +168,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera _builder.newLine(); _builder.append(" \t"); _builder.append("return \""); - List _allParserRules = GrammarUtil.allParserRules(it); - ParserRule _head = IterableExtensions.head(_allParserRules); - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(_head); - String _name = _originalElement.getName(); + String _name = AntlrGrammarGenUtil.getOriginalElement(IterableExtensions.head(GrammarUtil.allParserRules(it))).getName(); _builder.append(_name, " \t"); _builder.append("\";"); _builder.newLineIfNotEmpty(); @@ -192,8 +181,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera _builder.newLine(); _builder.append(" \t"); _builder.append("protected "); - TypeReference _grammarAccess_2 = this._grammarAccessExtensions.getGrammarAccess(it); - String _simpleName_3 = _grammarAccess_2.getSimpleName(); + String _simpleName_3 = this._grammarAccessExtensions.getGrammarAccess(it).getSimpleName(); _builder.append(_simpleName_3, " \t"); _builder.append(" getGrammarAccess() {"); _builder.newLineIfNotEmpty(); @@ -258,12 +246,10 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera protected String compileEntryRule(final ParserRule it, final Grammar grammar, final AntlrOptions options) { StringConcatenation _builder = new StringConcatenation(); _builder.append("// Entry rule "); - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _entryRuleName = this._grammarAccessExtensions.entryRuleName(_originalElement); + String _entryRuleName = this._grammarAccessExtensions.entryRuleName(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_entryRuleName); _builder.newLineIfNotEmpty(); - ParserRule _originalElement_1 = AntlrGrammarGenUtil.getOriginalElement(it); - String _entryRuleName_1 = this._grammarAccessExtensions.entryRuleName(_originalElement_1); + String _entryRuleName_1 = this._grammarAccessExtensions.entryRuleName(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_entryRuleName_1); _builder.append(" returns "); String _compileEntryReturns = this.compileEntryReturns(it, options); @@ -280,8 +266,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("iv_"); - ParserRule _originalElement_2 = AntlrGrammarGenUtil.getOriginalElement(it); - String _ruleName = this._grammarAccessExtensions.ruleName(_originalElement_2); + String _ruleName = this._grammarAccessExtensions.ruleName(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_ruleName, "\t"); _builder.append("="); String _ruleName_1 = this._grammarAccessExtensions.ruleName(it); @@ -295,8 +280,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera _builder.append(_ruleName_2, "\t"); _builder.append(".current"); { - ParserRule _originalElement_3 = AntlrGrammarGenUtil.getOriginalElement(it); - boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(_originalElement_3); + boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(AntlrGrammarGenUtil.getOriginalElement(it)); if (_isDatatypeRule) { _builder.append(".getText()"); } @@ -313,8 +297,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera } protected String compileEntryReturns(final ParserRule it, final AntlrOptions options) { - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(_originalElement); + boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(AntlrGrammarGenUtil.getOriginalElement(it)); if (_isDatatypeRule) { return "[String current=null]"; } else { @@ -375,8 +358,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera } if (!_matched) { if (it instanceof ParserRule) { - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(((ParserRule)it)); - boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(_originalElement); + boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(AntlrGrammarGenUtil.getOriginalElement(((ParserRule)it))); if (_isDatatypeRule) { _matched=true; _switchResult = "[AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()]"; @@ -385,8 +367,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera } if (!_matched) { if (it instanceof ParserRule) { - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(((ParserRule)it)); - boolean _isEObjectFragmentRule = GrammarUtil.isEObjectFragmentRule(_originalElement); + boolean _isEObjectFragmentRule = GrammarUtil.isEObjectFragmentRule(AntlrGrammarGenUtil.getOriginalElement(((ParserRule)it))); if (_isEObjectFragmentRule) { _matched=true; StringConcatenation _builder = new StringConcatenation(); @@ -580,8 +561,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera boolean _tripleNotEquals = (_feature != null); if (_tripleNotEquals) { _builder.append("And"); - String _setOrAdd = this._grammarAccessExtensions.setOrAdd(it); - String _firstUpper = StringExtensions.toFirstUpper(_setOrAdd); + String _firstUpper = StringExtensions.toFirstUpper(this._grammarAccessExtensions.setOrAdd(it)); _builder.append(_firstUpper, "\t"); } } @@ -589,8 +569,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("grammarAccess."); - Action _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess, "\t\t"); _builder.append(","); _builder.newLineIfNotEmpty(); @@ -716,8 +695,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera } if (!_matched) { if (rule instanceof ParserRule) { - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(((ParserRule)rule)); - boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(_originalElement); + boolean _isDatatypeRule = GrammarUtil.isDatatypeRule(AntlrGrammarGenUtil.getOriginalElement(((ParserRule)rule))); if (_isDatatypeRule) { _matched=true; } @@ -877,8 +855,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera _builder.newLine(); String _ruleName = this._grammarAccessExtensions.ruleName(it); _builder.append(_ruleName); - boolean _isPassCurrentIntoFragment = this.isPassCurrentIntoFragment(); - String _argumentList = AntlrGrammarGenUtil.getArgumentList(call, _isPassCurrentIntoFragment, (!supportActions)); + String _argumentList = AntlrGrammarGenUtil.getArgumentList(call, this.isPassCurrentIntoFragment(), (!supportActions)); _builder.append(_argumentList); _builder.newLineIfNotEmpty(); _builder.append("{"); @@ -894,8 +871,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera if (it instanceof TerminalRule) { _matched=true; StringConcatenation _builder_1 = new StringConcatenation(); - Assignment _containingAssignment = GrammarUtil.containingAssignment(ref); - String _localVar = this._grammarAccessExtensions.localVar(_containingAssignment); + String _localVar = this._grammarAccessExtensions.localVar(GrammarUtil.containingAssignment(ref)); _builder_1.append(_localVar); _builder_1.append("="); String _ruleName_1 = this._grammarAccessExtensions.ruleName(it); @@ -904,9 +880,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera _builder_1.append("{"); _builder_1.newLine(); _builder_1.append("\t"); - Assignment _containingAssignment_1 = GrammarUtil.containingAssignment(ref); - String _localVar_1 = this._grammarAccessExtensions.localVar(_containingAssignment_1); - CharSequence _newLeafNode = this.newLeafNode(ref, _localVar_1); + CharSequence _newLeafNode = this.newLeafNode(ref, this._grammarAccessExtensions.localVar(GrammarUtil.containingAssignment(ref))); _builder_1.append(_newLeafNode, "\t"); _builder_1.newLineIfNotEmpty(); _builder_1.append("}"); @@ -1008,8 +982,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera } } _builder.append(", "); - AbstractElement _terminal = assignment.getTerminal(); - CharSequence _stringLiteral = this._grammarAccessExtensions.toStringLiteral(_terminal); + CharSequence _stringLiteral = this._grammarAccessExtensions.toStringLiteral(assignment.getTerminal()); _builder.append(_stringLiteral, "\t"); _builder.append(");"); _builder.newLineIfNotEmpty(); @@ -1191,9 +1164,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera protected CharSequence createModelElement(final EObject grammarElement) { StringConcatenation _builder = new StringConcatenation(); _builder.append("createModelElement(grammarAccess."); - ParserRule _containingParserRule = GrammarUtil.containingParserRule(grammarElement); - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(_containingParserRule); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(GrammarUtil.containingParserRule(grammarElement))); _builder.append(_grammarElementAccess); _builder.append(")"); return _builder; @@ -1202,9 +1173,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera protected CharSequence createModelElementForParent(final EObject grammarElement) { StringConcatenation _builder = new StringConcatenation(); _builder.append("createModelElementForParent(grammarAccess."); - ParserRule _containingParserRule = GrammarUtil.containingParserRule(grammarElement); - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(_containingParserRule); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(GrammarUtil.containingParserRule(grammarElement))); _builder.append(_grammarElementAccess); _builder.append(")"); return _builder; @@ -1213,8 +1182,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera protected CharSequence newCompositeNode(final EObject it) { StringConcatenation _builder = new StringConcatenation(); _builder.append("newCompositeNode(grammarAccess."); - EObject _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess); _builder.append(");"); return _builder; @@ -1225,8 +1193,7 @@ public class AntlrGrammarGenerator extends AbstractAntlrGrammarWithActionsGenera _builder.append("newLeafNode("); _builder.append(token); _builder.append(", grammarAccess."); - EObject _originalElement = AntlrGrammarGenUtil.getOriginalElement(it); - String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(_originalElement); + String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.getOriginalElement(it)); _builder.append(_grammarElementAccess); _builder.append(");"); return _builder; diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/DebugGrammarToken.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/DebugGrammarToken.java index 61193a396..73f601861 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/DebugGrammarToken.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/DebugGrammarToken.java @@ -24,8 +24,7 @@ public class DebugGrammarToken { Boolean _get = DebugGrammarToken.store.get(); boolean _tripleNotEquals = (_get != null); if (_tripleNotEquals) { - Boolean _get_1 = DebugGrammarToken.store.get(); - String _valueOf = String.valueOf(_get_1); + String _valueOf = String.valueOf(DebugGrammarToken.store.get()); throw new IllegalStateException(_valueOf); } return new DebugGrammarToken(); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/GrammarNaming.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/GrammarNaming.java index 70484f9e3..7cf50533b 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/GrammarNaming.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/GrammarNaming.java @@ -26,8 +26,7 @@ public class GrammarNaming { private XtextGeneratorNaming _xtextGeneratorNaming; public boolean isCombinedGrammar(final Grammar it) { - CombinedGrammarMarker _findInEmfObject = CombinedGrammarMarker.findInEmfObject(it); - return _findInEmfObject.isCombinedGrammar(); + return CombinedGrammarMarker.findInEmfObject(it).isCombinedGrammar(); } protected String getParserPackage(final Grammar it) { @@ -87,11 +86,9 @@ public class GrammarNaming { } public TypeReference getLexerClass(final Grammar it) { - AntlrGrammar _lexerGrammar = this.getLexerGrammar(it); - String _packageName = _lexerGrammar.getPackageName(); + String _packageName = this.getLexerGrammar(it).getPackageName(); StringConcatenation _builder = new StringConcatenation(); - AntlrGrammar _lexerGrammar_1 = this.getLexerGrammar(it); - String _simpleName = _lexerGrammar_1.getSimpleName(); + String _simpleName = this.getLexerGrammar(it).getSimpleName(); _builder.append(_simpleName); { boolean _isCombinedGrammar = this.isCombinedGrammar(it); @@ -120,11 +117,9 @@ public class GrammarNaming { } public TypeReference getInternalParserClass(final Grammar it) { - AntlrGrammar _parserGrammar = this.getParserGrammar(it); - String _packageName = _parserGrammar.getPackageName(); + String _packageName = this.getParserGrammar(it).getPackageName(); StringConcatenation _builder = new StringConcatenation(); - AntlrGrammar _parserGrammar_1 = this.getParserGrammar(it); - String _simpleName = _parserGrammar_1.getSimpleName(); + String _simpleName = this.getParserGrammar(it).getSimpleName(); _builder.append(_simpleName); { boolean _isCombinedGrammar = this.isCombinedGrammar(it); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.java index e68cf8165..3958209a5 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.java @@ -27,7 +27,6 @@ import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtend2.lib.StringConcatenationClient; import org.eclipse.xtext.AbstractElement; -import org.eclipse.xtext.AbstractRule; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.Group; @@ -60,8 +59,6 @@ import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.ListExtensions; import org.eclipse.xtext.xbase.lib.ObjectExtensions; import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; -import org.eclipse.xtext.xtext.generator.CodeConfig; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.Issues; import org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessExtensions; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; @@ -71,17 +68,12 @@ import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2; import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrContentAssistGrammarGenerator; import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrDebugGrammarGenerator; import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar; import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil; import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenerator; -import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrOptions; -import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrToolFacade; import org.eclipse.xtext.xtext.generator.parser.antlr.CombinedGrammarMarker; import org.eclipse.xtext.xtext.generator.parser.antlr.ContentAssistGrammarNaming; import org.eclipse.xtext.xtext.generator.parser.antlr.GrammarNaming; @@ -150,57 +142,30 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment @Override protected void doGenerate() { Grammar _grammar = this.getGrammar(); - AntlrOptions _options = this.getOptions(); - boolean _isIgnoreCase = _options.isIgnoreCase(); + boolean _isIgnoreCase = this.getOptions().isIgnoreCase(); new KeywordHelper(_grammar, _isIgnoreCase, this.grammarUtil); boolean _isCombinedGrammar = this.isCombinedGrammar(); - CombinedGrammarMarker _combinedGrammarMarker = new CombinedGrammarMarker(_isCombinedGrammar); - Grammar _grammar_1 = this.getGrammar(); - _combinedGrammarMarker.attachToEmfObject(_grammar_1); + new CombinedGrammarMarker(_isCombinedGrammar).attachToEmfObject(this.getGrammar()); if (this.debugGrammar) { this.generateDebugGrammar(); } this.generateProductionGrammar(); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _genericIde = _projectConfig.getGenericIde(); - IXtextGeneratorFileSystemAccess _srcGen = _genericIde.getSrcGen(); + IXtextGeneratorFileSystemAccess _srcGen = this.getProjectConfig().getGenericIde().getSrcGen(); boolean _tripleNotEquals = (_srcGen != null); if (_tripleNotEquals) { this.generateContentAssistGrammar(); this.addIdeBindingsAndImports(); } - JavaFileAccess _generateProductionParser = this.generateProductionParser(); - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig_1.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen_1 = _runtime.getSrcGen(); - _generateProductionParser.writeTo(_srcGen_1); - JavaFileAccess _generateAntlrTokenFileProvider = this.generateAntlrTokenFileProvider(); - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_2.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen_2 = _runtime_1.getSrcGen(); - _generateAntlrTokenFileProvider.writeTo(_srcGen_2); - JavaFileAccess _generateContentAssistParser = this.generateContentAssistParser(); - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IBundleProjectConfig _genericIde_1 = _projectConfig_3.getGenericIde(); - IXtextGeneratorFileSystemAccess _srcGen_3 = _genericIde_1.getSrcGen(); - _generateContentAssistParser.writeTo(_srcGen_3); - Grammar _grammar_2 = this.getGrammar(); - List _allTerminalRules = GrammarUtil.allTerminalRules(_grammar_2); + this.generateProductionParser().writeTo(this.getProjectConfig().getRuntime().getSrcGen()); + this.generateAntlrTokenFileProvider().writeTo(this.getProjectConfig().getRuntime().getSrcGen()); + this.generateContentAssistParser().writeTo(this.getProjectConfig().getGenericIde().getSrcGen()); final Function1 _function = (TerminalRule it) -> { return Boolean.valueOf(this._syntheticTerminalDetector.isSyntheticTerminalRule(it)); }; - boolean _exists = IterableExtensions.exists(_allTerminalRules, _function); + boolean _exists = IterableExtensions.exists(GrammarUtil.allTerminalRules(this.getGrammar()), _function); if (_exists) { - JavaFileAccess _generateProductionTokenSource = this.generateProductionTokenSource(); - IXtextProjectConfig _projectConfig_4 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_2 = _projectConfig_4.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime_2.getSrc(); - _generateProductionTokenSource.writeTo(_src); - JavaFileAccess _generateContentAssistTokenSource = this.generateContentAssistTokenSource(); - IXtextProjectConfig _projectConfig_5 = this.getProjectConfig(); - IBundleProjectConfig _genericIde_2 = _projectConfig_5.getGenericIde(); - IXtextGeneratorFileSystemAccess _src_1 = _genericIde_2.getSrc(); - _generateContentAssistTokenSource.writeTo(_src_1); + this.generateProductionTokenSource().writeTo(this.getProjectConfig().getRuntime().getSrc()); + this.generateContentAssistTokenSource().writeTo(this.getProjectConfig().getGenericIde().getSrc()); } this.addRuntimeBindingsAndImports(); this.addIdeBindingsAndImports(); @@ -214,12 +179,8 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment protected void generateProductionGrammar() { @Extension final GrammarNaming naming = this.productionNaming; - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - final IXtextGeneratorFileSystemAccess fsa = _runtime.getSrcGen(); - Grammar _grammar = this.getGrammar(); - AntlrOptions _options = this.getOptions(); - this.productionGenerator.generate(_grammar, _options, fsa); + final IXtextGeneratorFileSystemAccess fsa = this.getProjectConfig().getRuntime().getSrcGen(); + this.productionGenerator.generate(this.getGrammar(), this.getOptions(), fsa); 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())); @@ -231,12 +192,8 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment protected void generateContentAssistGrammar() { @Extension final ContentAssistGrammarNaming naming = this.contentAssistNaming; - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _genericIde = _projectConfig.getGenericIde(); - final IXtextGeneratorFileSystemAccess fsa = _genericIde.getSrcGen(); - Grammar _grammar = this.getGrammar(); - AntlrOptions _options = this.getOptions(); - this.contentAssistGenerator.generate(_grammar, _options, fsa); + final IXtextGeneratorFileSystemAccess fsa = this.getProjectConfig().getGenericIde().getSrcGen(); + this.contentAssistGenerator.generate(this.getGrammar(), this.getOptions(), fsa); 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())); @@ -249,8 +206,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment } protected void runAntlr(final AntlrGrammar parserGrammar, final AntlrGrammar lexerGrammar, final IXtextGeneratorFileSystemAccess fsa) { - CodeConfig _codeConfig = this.getCodeConfig(); - final String encoding = _codeConfig.getEncoding(); + final String encoding = this.getCodeConfig().getEncoding(); StringConcatenation _builder = new StringConcatenation(); String _path = fsa.getPath(); _builder.append(_path); @@ -260,14 +216,12 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment final String lexerGrammarFile = _builder.toString(); final ArrayList lexerAntlrParams = CollectionLiterals.newArrayList(this.getAntlrParams()); lexerAntlrParams.add("-fo"); - int _lastIndexOf = lexerGrammarFile.lastIndexOf("/"); - final String lexerOutputDir = lexerGrammarFile.substring(0, _lastIndexOf); + final String lexerOutputDir = lexerGrammarFile.substring(0, lexerGrammarFile.lastIndexOf("/")); lexerAntlrParams.add(lexerOutputDir); boolean _isCombinedGrammar = this.isCombinedGrammar(); boolean _not = (!_isCombinedGrammar); if (_not) { - AntlrToolFacade _antlrTool = this.getAntlrTool(); - _antlrTool.runWithEncodingAndParams(lexerGrammarFile, encoding, ((String[])Conversions.unwrapArray(lexerAntlrParams, String.class))); + this.getAntlrTool().runWithEncodingAndParams(lexerGrammarFile, encoding, ((String[])Conversions.unwrapArray(lexerAntlrParams, String.class))); this.cleanupLexerTokensFile(lexerGrammar, KeywordHelper.getHelper(this.getGrammar()), fsa); } StringConcatenation _builder_1 = new StringConcatenation(); @@ -279,8 +233,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment final String parserGrammarFile = _builder_1.toString(); final ArrayList parserAntlrParams = CollectionLiterals.newArrayList(this.getAntlrParams()); parserAntlrParams.add("-fo"); - int _lastIndexOf_1 = parserGrammarFile.lastIndexOf("/"); - String _substring = parserGrammarFile.substring(0, _lastIndexOf_1); + String _substring = parserGrammarFile.substring(0, parserGrammarFile.lastIndexOf("/")); parserAntlrParams.add(_substring); boolean _isCombinedGrammar_1 = this.isCombinedGrammar(); boolean _not_1 = (!_isCombinedGrammar_1); @@ -288,8 +241,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment parserAntlrParams.add("-lib"); parserAntlrParams.add(lexerOutputDir); } - AntlrToolFacade _antlrTool_1 = this.getAntlrTool(); - _antlrTool_1.runWithEncodingAndParams(parserGrammarFile, encoding, ((String[])Conversions.unwrapArray(parserAntlrParams, String.class))); + this.getAntlrTool().runWithEncodingAndParams(parserGrammarFile, encoding, ((String[])Conversions.unwrapArray(parserAntlrParams, String.class))); boolean _isCombinedGrammar_2 = this.isCombinedGrammar(); boolean _not_2 = (!_isCombinedGrammar_2); if (_not_2) { @@ -298,12 +250,8 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment } protected void generateDebugGrammar() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - final IXtextGeneratorFileSystemAccess fsa = _runtime.getSrcGen(); - Grammar _grammar = this.getGrammar(); - AntlrOptions _options = this.getOptions(); - this.debugGenerator.generate(_grammar, _options, fsa); + final IXtextGeneratorFileSystemAccess fsa = this.getProjectConfig().getRuntime().getSrcGen(); + this.debugGenerator.generate(this.getGrammar(), this.getOptions(), fsa); } public JavaFileAccess generateProductionParser() { @@ -311,16 +259,12 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment { @Extension final GrammarNaming naming = this.productionNaming; - Grammar _grammar = this.getGrammar(); - TypeReference _parserClass = naming.getParserClass(_grammar); - final GeneratedJavaFileAccess file = this.fileFactory.createGeneratedJavaFile(_parserClass); + final GeneratedJavaFileAccess file = this.fileFactory.createGeneratedJavaFile(naming.getParserClass(this.getGrammar())); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - Grammar _grammar = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _parserClass = naming.getParserClass(_grammar); - String _simpleName = _parserClass.getSimpleName(); + String _simpleName = naming.getParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(AbstractAntlrParser.class); @@ -333,8 +277,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("private "); - Grammar _grammar_1 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _grammarAccess = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(_grammar_1); + TypeReference _grammarAccess = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_grammarAccess, "\t"); _builder.append(" grammarAccess;"); _builder.newLineIfNotEmpty(); @@ -350,8 +293,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.append("\t\t"); _builder.append("tokenStream.setInitialHiddenTokens("); { - Grammar _grammar_2 = XtextAntlrGeneratorFragment2.this.getGrammar(); - List _initialHiddenTokens = XtextAntlrGeneratorFragment2.this.grammarUtil.initialHiddenTokens(_grammar_2); + List _initialHiddenTokens = XtextAntlrGeneratorFragment2.this.grammarUtil.initialHiddenTokens(XtextAntlrGeneratorFragment2.this.getGrammar()); boolean _hasElements = false; for(final String hidden : _initialHiddenTokens) { if (!_hasElements) { @@ -372,12 +314,10 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.append("\t"); _builder.newLine(); { - Grammar _grammar_3 = XtextAntlrGeneratorFragment2.this.getGrammar(); - List _allTerminalRules = GrammarUtil.allTerminalRules(_grammar_3); final Function1 _function = (TerminalRule it) -> { return Boolean.valueOf(XtextAntlrGeneratorFragment2.this._syntheticTerminalDetector.isSyntheticTerminalRule(it)); }; - boolean _exists = IterableExtensions.exists(_allTerminalRules, _function); + boolean _exists = IterableExtensions.exists(GrammarUtil.allTerminalRules(XtextAntlrGeneratorFragment2.this.getGrammar()), _function); if (_exists) { _builder.append("\t"); _builder.append("@Override"); @@ -392,8 +332,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.append("\t"); _builder.append("\t"); _builder.append("return new "); - Grammar _grammar_4 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _tokenSourceClass = naming.getTokenSourceClass(_grammar_4); + TypeReference _tokenSourceClass = naming.getTokenSourceClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_tokenSourceClass, "\t\t"); _builder.append("(super.createLexer(stream));"); _builder.newLineIfNotEmpty(); @@ -438,8 +377,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t"); _builder.append("protected "); - Grammar _grammar_5 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _internalParserClass = naming.getInternalParserClass(_grammar_5); + TypeReference _internalParserClass = naming.getInternalParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_internalParserClass, "\t"); _builder.append(" createParser("); _builder.append(XtextTokenStream.class, "\t"); @@ -447,8 +385,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("return new "); - Grammar _grammar_6 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _internalParserClass_1 = naming.getInternalParserClass(_grammar_6); + TypeReference _internalParserClass_1 = naming.getInternalParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_internalParserClass_1, "\t\t"); _builder.append("(stream, getGrammarAccess());"); _builder.newLineIfNotEmpty(); @@ -464,11 +401,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t\t"); _builder.append("return \""); - Grammar _grammar_7 = XtextAntlrGeneratorFragment2.this.getGrammar(); - List _allParserRules = GrammarUtil.allParserRules(_grammar_7); - ParserRule _head = IterableExtensions.head(_allParserRules); - ParserRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(_head); - String _name = _originalElement.getName(); + String _name = AntlrGrammarGenUtil.getOriginalElement(IterableExtensions.head(GrammarUtil.allParserRules(XtextAntlrGeneratorFragment2.this.getGrammar()))).getName(); _builder.append(_name, "\t\t"); _builder.append("\";"); _builder.newLineIfNotEmpty(); @@ -478,8 +411,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t"); _builder.append("public "); - Grammar _grammar_8 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _grammarAccess_1 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(_grammar_8); + TypeReference _grammarAccess_1 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_grammarAccess_1, "\t"); _builder.append(" getGrammarAccess() {"); _builder.newLineIfNotEmpty(); @@ -492,8 +424,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t"); _builder.append("public void setGrammarAccess("); - Grammar _grammar_9 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _grammarAccess_2 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(_grammar_9); + TypeReference _grammarAccess_2 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_grammarAccess_2, "\t"); _builder.append(" grammarAccess) {"); _builder.newLineIfNotEmpty(); @@ -518,16 +449,12 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment { @Extension final GrammarNaming naming = this.productionNaming; - Grammar _grammar = this.getGrammar(); - TypeReference _antlrTokenFileProviderClass = naming.getAntlrTokenFileProviderClass(_grammar); - final GeneratedJavaFileAccess file = this.fileFactory.createGeneratedJavaFile(_antlrTokenFileProviderClass); + final GeneratedJavaFileAccess file = this.fileFactory.createGeneratedJavaFile(naming.getAntlrTokenFileProviderClass(this.getGrammar())); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - Grammar _grammar = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _antlrTokenFileProviderClass = naming.getAntlrTokenFileProviderClass(_grammar); - String _simpleName = _antlrTokenFileProviderClass.getSimpleName(); + String _simpleName = naming.getAntlrTokenFileProviderClass(XtextAntlrGeneratorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" implements "); _builder.append(IAntlrTokenFileProvider.class); @@ -548,9 +475,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("return classLoader.getResourceAsStream(\""); - Grammar _grammar_1 = XtextAntlrGeneratorFragment2.this.getGrammar(); - AntlrGrammar _parserGrammar = naming.getParserGrammar(_grammar_1); - String _tokensFileName = _parserGrammar.getTokensFileName(); + String _tokensFileName = naming.getParserGrammar(XtextAntlrGeneratorFragment2.this.getGrammar()).getTokensFileName(); _builder.append(_tokensFileName, "\t\t"); _builder.append("\");"); _builder.newLineIfNotEmpty(); @@ -572,32 +497,20 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment { @Extension final GrammarNaming naming = this.productionNaming; - Grammar _grammar = this.getGrammar(); - TypeReference _tokenSourceClass = naming.getTokenSourceClass(_grammar); - final JavaFileAccess file = this.fileFactory.createJavaFile(_tokenSourceClass); - Grammar _grammar_1 = this.getGrammar(); - List _allTerminalRules = GrammarUtil.allTerminalRules(_grammar_1); + final JavaFileAccess file = this.fileFactory.createJavaFile(naming.getTokenSourceClass(this.getGrammar())); final Function1 _function = (TerminalRule it) -> { - String _name = it.getName(); - String _upperCase = _name.toUpperCase(); - return Boolean.valueOf(Collections.unmodifiableSet(CollectionLiterals.newHashSet("BEGIN", "INDENT", "OPEN")).contains(_upperCase)); + return Boolean.valueOf(Collections.unmodifiableSet(CollectionLiterals.newHashSet("BEGIN", "INDENT", "OPEN")).contains(it.getName().toUpperCase())); }; - final Iterable open = IterableExtensions.filter(_allTerminalRules, _function); - Grammar _grammar_2 = this.getGrammar(); - List _allTerminalRules_1 = GrammarUtil.allTerminalRules(_grammar_2); + final Iterable open = IterableExtensions.filter(GrammarUtil.allTerminalRules(this.getGrammar()), _function); final Function1 _function_1 = (TerminalRule it) -> { - String _name = it.getName(); - String _upperCase = _name.toUpperCase(); - return Boolean.valueOf(Collections.unmodifiableSet(CollectionLiterals.newHashSet("END", "DEDENT", "CLOSE")).contains(_upperCase)); + return Boolean.valueOf(Collections.unmodifiableSet(CollectionLiterals.newHashSet("END", "DEDENT", "CLOSE")).contains(it.getName().toUpperCase())); }; - final Iterable close = IterableExtensions.filter(_allTerminalRules_1, _function_1); + final Iterable close = IterableExtensions.filter(GrammarUtil.allTerminalRules(this.getGrammar()), _function_1); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - Grammar _grammar = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _tokenSourceClass = naming.getTokenSourceClass(_grammar); - String _simpleName = _tokenSourceClass.getSimpleName(); + String _simpleName = naming.getTokenSourceClass(XtextAntlrGeneratorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(AbstractIndentationTokenSource.class); @@ -606,9 +519,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t"); _builder.append("public "); - Grammar _grammar_1 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _tokenSourceClass_1 = naming.getTokenSourceClass(_grammar_1); - String _simpleName_1 = _tokenSourceClass_1.getSimpleName(); + String _simpleName_1 = naming.getTokenSourceClass(XtextAntlrGeneratorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("("); _builder.append(TokenSource.class, "\t"); @@ -630,26 +541,21 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.append(" token) {"); _builder.newLineIfNotEmpty(); { - Grammar _grammar_2 = XtextAntlrGeneratorFragment2.this.getGrammar(); - List _allTerminalRules = GrammarUtil.allTerminalRules(_grammar_2); final Function1 _function = (TerminalRule it) -> { return AntlrGrammarGenUtil.getOriginalElement(it); }; - List _map = ListExtensions.map(_allTerminalRules, _function); final Function1 _function_1 = (TerminalRule it) -> { - String _name = it.getName(); - String _upperCase = _name.toUpperCase(); + String _upperCase = it.getName().toUpperCase(); return Boolean.valueOf(Objects.equal(_upperCase, "WS")); }; - boolean _exists = IterableExtensions.exists(_map, _function_1); + boolean _exists = IterableExtensions.exists(ListExtensions.map(GrammarUtil.allTerminalRules(XtextAntlrGeneratorFragment2.this.getGrammar()), _function), _function_1); if (_exists) { _builder.append("\t\t"); _builder.append("// TODO Review assumption"); _builder.newLine(); _builder.append("\t\t"); _builder.append("return token.getType() == "); - Grammar _grammar_3 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _internalParserClass = naming.getInternalParserClass(_grammar_3); + TypeReference _internalParserClass = naming.getInternalParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_internalParserClass, "\t\t"); _builder.append(".RULE_WS;"); _builder.newLineIfNotEmpty(); @@ -681,12 +587,10 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t\t"); _builder.append("return "); - Grammar _grammar_4 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _internalParserClass_1 = naming.getInternalParserClass(_grammar_4); + TypeReference _internalParserClass_1 = naming.getInternalParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_internalParserClass_1, "\t\t"); _builder.append("."); - TerminalRule _head = IterableExtensions.head(open); - String _ruleName = XtextAntlrGeneratorFragment2.this.grammarUtil.ruleName(_head); + String _ruleName = XtextAntlrGeneratorFragment2.this.grammarUtil.ruleName(IterableExtensions.head(open)); _builder.append(_ruleName, "\t\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -718,12 +622,10 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t\t"); _builder.append("return "); - Grammar _grammar_5 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _internalParserClass_2 = naming.getInternalParserClass(_grammar_5); + TypeReference _internalParserClass_2 = naming.getInternalParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_internalParserClass_2, "\t\t"); _builder.append("."); - TerminalRule _head_1 = IterableExtensions.head(close); - String _ruleName_1 = XtextAntlrGeneratorFragment2.this.grammarUtil.ruleName(_head_1); + String _ruleName_1 = XtextAntlrGeneratorFragment2.this.grammarUtil.ruleName(IterableExtensions.head(close)); _builder.append(_ruleName_1, "\t\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -755,20 +657,15 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment { @Extension final ContentAssistGrammarNaming naming = this.contentAssistNaming; - Grammar _grammar = this.getGrammar(); - TypeReference _parserClass = naming.getParserClass(_grammar); - final GeneratedJavaFileAccess file = this.fileFactory.createGeneratedJavaFile(_parserClass); + final GeneratedJavaFileAccess file = this.fileFactory.createGeneratedJavaFile(naming.getParserClass(this.getGrammar())); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - Grammar _grammar = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _parserClass = naming.getParserClass(_grammar); - String _simpleName = _parserClass.getSimpleName(); + String _simpleName = naming.getParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _parserSuperClass = naming.getParserSuperClass(_grammar_1, XtextAntlrGeneratorFragment2.this.partialParsing); + TypeReference _parserSuperClass = naming.getParserSuperClass(XtextAntlrGeneratorFragment2.this.getGrammar(), XtextAntlrGeneratorFragment2.this.partialParsing); _builder.append(_parserSuperClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -779,8 +676,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("private "); - Grammar _grammar_2 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _grammarAccess = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(_grammar_2); + TypeReference _grammarAccess = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_grammarAccess, "\t"); _builder.append(" grammarAccess;"); _builder.newLineIfNotEmpty(); @@ -798,18 +694,15 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t"); _builder.append("protected "); - Grammar _grammar_3 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _internalParserClass = naming.getInternalParserClass(_grammar_3); + TypeReference _internalParserClass = naming.getInternalParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_internalParserClass, "\t"); _builder.append(" createParser() {"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); - Grammar _grammar_4 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _internalParserClass_1 = naming.getInternalParserClass(_grammar_4); + TypeReference _internalParserClass_1 = naming.getInternalParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_internalParserClass_1, "\t\t"); _builder.append(" result = new "); - Grammar _grammar_5 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _internalParserClass_2 = naming.getInternalParserClass(_grammar_5); + TypeReference _internalParserClass_2 = naming.getInternalParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_internalParserClass_2, "\t\t"); _builder.append("(null);"); _builder.newLineIfNotEmpty(); @@ -824,12 +717,10 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.newLine(); { - Grammar _grammar_6 = XtextAntlrGeneratorFragment2.this.getGrammar(); - List _allTerminalRules = GrammarUtil.allTerminalRules(_grammar_6); final Function1 _function = (TerminalRule it) -> { return Boolean.valueOf(XtextAntlrGeneratorFragment2.this._syntheticTerminalDetector.isSyntheticTerminalRule(it)); }; - boolean _exists = IterableExtensions.exists(_allTerminalRules, _function); + boolean _exists = IterableExtensions.exists(GrammarUtil.allTerminalRules(XtextAntlrGeneratorFragment2.this.getGrammar()), _function); if (_exists) { _builder.append("\t"); _builder.append("@Override"); @@ -844,8 +735,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.append("\t"); _builder.append("\t"); _builder.append("return new "); - Grammar _grammar_7 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _tokenSourceClass = naming.getTokenSourceClass(_grammar_7); + TypeReference _tokenSourceClass = naming.getTokenSourceClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_tokenSourceClass, "\t\t"); _builder.append("(super.createLexer(stream));"); _builder.newLineIfNotEmpty(); @@ -881,26 +771,20 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.append("{"); _builder.newLine(); { - Grammar _grammar_8 = XtextAntlrGeneratorFragment2.this.getGrammar(); - Collection _allAlternatives = GrammarUtil.getAllAlternatives(_grammar_8); - Grammar _grammar_9 = XtextAntlrGeneratorFragment2.this.getGrammar(); - Collection _allGroups = GrammarUtil.getAllGroups(_grammar_9); + Collection _allAlternatives = GrammarUtil.getAllAlternatives(XtextAntlrGeneratorFragment2.this.getGrammar()); + Collection _allGroups = GrammarUtil.getAllGroups(XtextAntlrGeneratorFragment2.this.getGrammar()); Iterable _plus = Iterables.concat(_allAlternatives, _allGroups); - Grammar _grammar_10 = XtextAntlrGeneratorFragment2.this.getGrammar(); - Collection _allAssignments = GrammarUtil.getAllAssignments(_grammar_10); + Collection _allAssignments = GrammarUtil.getAllAssignments(XtextAntlrGeneratorFragment2.this.getGrammar()); Iterable _plus_1 = Iterables.concat(_plus, _allAssignments); - Grammar _grammar_11 = XtextAntlrGeneratorFragment2.this.getGrammar(); - Collection _allUnorderedGroups = GrammarUtil.getAllUnorderedGroups(_grammar_11); - Iterable _plus_2 = Iterables.concat(_plus_1, _allUnorderedGroups); - Iterable _filter = Iterables.filter(_plus_2, AbstractElement.class); + Collection _allUnorderedGroups = GrammarUtil.getAllUnorderedGroups(XtextAntlrGeneratorFragment2.this.getGrammar()); + Iterable _filter = Iterables.filter(Iterables.concat(_plus_1, _allUnorderedGroups), AbstractElement.class); for(final AbstractElement element : _filter) { _builder.append("\t\t\t\t\t"); _builder.append("put(grammarAccess."); String _grammarElementAccess = XtextAntlrGeneratorFragment2.this.grammarUtil.grammarElementAccess(element); _builder.append(_grammarElementAccess, "\t\t\t\t\t"); _builder.append(", \""); - AbstractRule _containingRule = GrammarUtil.containingRule(element); - String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(_containingRule); + String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(element)); _builder.append(_contentAssistRuleName, "\t\t\t\t\t"); _builder.append("__"); String _gaElementIdentifier = XtextAntlrGeneratorFragment2.this.grammarUtil.gaElementIdentifier(element); @@ -940,8 +824,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.append("\t\t"); _builder.append("return new String[] { "); { - Grammar _grammar_12 = XtextAntlrGeneratorFragment2.this.getGrammar(); - List _initialHiddenTokens = XtextAntlrGeneratorFragment2.this.grammarUtil.initialHiddenTokens(_grammar_12); + List _initialHiddenTokens = XtextAntlrGeneratorFragment2.this.grammarUtil.initialHiddenTokens(XtextAntlrGeneratorFragment2.this.getGrammar()); boolean _hasElements = false; for(final String hidden : _initialHiddenTokens) { if (!_hasElements) { @@ -962,8 +845,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t"); _builder.append("public "); - Grammar _grammar_13 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _grammarAccess_1 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(_grammar_13); + TypeReference _grammarAccess_1 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_grammarAccess_1, "\t"); _builder.append(" getGrammarAccess() {"); _builder.newLineIfNotEmpty(); @@ -976,8 +858,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t"); _builder.append("public void setGrammarAccess("); - Grammar _grammar_14 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _grammarAccess_2 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(_grammar_14); + TypeReference _grammarAccess_2 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_grammarAccess_2, "\t"); _builder.append(" grammarAccess) {"); _builder.newLineIfNotEmpty(); @@ -1002,32 +883,20 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment { @Extension final ContentAssistGrammarNaming naming = this.contentAssistNaming; - Grammar _grammar = this.getGrammar(); - TypeReference _tokenSourceClass = naming.getTokenSourceClass(_grammar); - final JavaFileAccess file = this.fileFactory.createJavaFile(_tokenSourceClass); - Grammar _grammar_1 = this.getGrammar(); - List _allTerminalRules = GrammarUtil.allTerminalRules(_grammar_1); + final JavaFileAccess file = this.fileFactory.createJavaFile(naming.getTokenSourceClass(this.getGrammar())); final Function1 _function = (TerminalRule it) -> { - String _name = it.getName(); - String _upperCase = _name.toUpperCase(); - return Boolean.valueOf(Collections.unmodifiableSet(CollectionLiterals.newHashSet("BEGIN", "INDENT", "OPEN")).contains(_upperCase)); + return Boolean.valueOf(Collections.unmodifiableSet(CollectionLiterals.newHashSet("BEGIN", "INDENT", "OPEN")).contains(it.getName().toUpperCase())); }; - final Iterable open = IterableExtensions.filter(_allTerminalRules, _function); - Grammar _grammar_2 = this.getGrammar(); - List _allTerminalRules_1 = GrammarUtil.allTerminalRules(_grammar_2); + final Iterable open = IterableExtensions.filter(GrammarUtil.allTerminalRules(this.getGrammar()), _function); final Function1 _function_1 = (TerminalRule it) -> { - String _name = it.getName(); - String _upperCase = _name.toUpperCase(); - return Boolean.valueOf(Collections.unmodifiableSet(CollectionLiterals.newHashSet("END", "DEDENT", "CLOSE")).contains(_upperCase)); + return Boolean.valueOf(Collections.unmodifiableSet(CollectionLiterals.newHashSet("END", "DEDENT", "CLOSE")).contains(it.getName().toUpperCase())); }; - final Iterable close = IterableExtensions.filter(_allTerminalRules_1, _function_1); + final Iterable close = IterableExtensions.filter(GrammarUtil.allTerminalRules(this.getGrammar()), _function_1); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - Grammar _grammar = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _tokenSourceClass = naming.getTokenSourceClass(_grammar); - String _simpleName = _tokenSourceClass.getSimpleName(); + String _simpleName = naming.getTokenSourceClass(XtextAntlrGeneratorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); _builder.append(AbstractIndentationTokenSource.class); @@ -1036,9 +905,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t"); _builder.append("public "); - Grammar _grammar_1 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _tokenSourceClass_1 = naming.getTokenSourceClass(_grammar_1); - String _simpleName_1 = _tokenSourceClass_1.getSimpleName(); + String _simpleName_1 = naming.getTokenSourceClass(XtextAntlrGeneratorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("("); _builder.append(TokenSource.class, "\t"); @@ -1060,26 +927,21 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.append(" token) {"); _builder.newLineIfNotEmpty(); { - Grammar _grammar_2 = XtextAntlrGeneratorFragment2.this.getGrammar(); - List _allTerminalRules = GrammarUtil.allTerminalRules(_grammar_2); final Function1 _function = (TerminalRule it) -> { return AntlrGrammarGenUtil.getOriginalElement(it); }; - List _map = ListExtensions.map(_allTerminalRules, _function); final Function1 _function_1 = (TerminalRule it) -> { - String _name = it.getName(); - String _upperCase = _name.toUpperCase(); + String _upperCase = it.getName().toUpperCase(); return Boolean.valueOf(Objects.equal(_upperCase, "WS")); }; - boolean _exists = IterableExtensions.exists(_map, _function_1); + boolean _exists = IterableExtensions.exists(ListExtensions.map(GrammarUtil.allTerminalRules(XtextAntlrGeneratorFragment2.this.getGrammar()), _function), _function_1); if (_exists) { _builder.append("\t\t"); _builder.append("// TODO Review assumption"); _builder.newLine(); _builder.append("\t\t"); _builder.append("return token.getType() == "); - Grammar _grammar_3 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _internalParserClass = naming.getInternalParserClass(_grammar_3); + TypeReference _internalParserClass = naming.getInternalParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_internalParserClass, "\t\t"); _builder.append(".RULE_WS;"); _builder.newLineIfNotEmpty(); @@ -1111,12 +973,10 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t\t"); _builder.append("return "); - Grammar _grammar_4 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _internalParserClass_1 = naming.getInternalParserClass(_grammar_4); + TypeReference _internalParserClass_1 = naming.getInternalParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_internalParserClass_1, "\t\t"); _builder.append("."); - TerminalRule _head = IterableExtensions.head(open); - String _ruleName = XtextAntlrGeneratorFragment2.this.grammarUtil.ruleName(_head); + String _ruleName = XtextAntlrGeneratorFragment2.this.grammarUtil.ruleName(IterableExtensions.head(open)); _builder.append(_ruleName, "\t\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -1148,12 +1008,10 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLine(); _builder.append("\t\t"); _builder.append("return "); - Grammar _grammar_5 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _internalParserClass_2 = naming.getInternalParserClass(_grammar_5); + TypeReference _internalParserClass_2 = naming.getInternalParserClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_internalParserClass_2, "\t\t"); _builder.append("."); - TerminalRule _head_1 = IterableExtensions.head(close); - String _ruleName_1 = XtextAntlrGeneratorFragment2.this.grammarUtil.ruleName(_head_1); + String _ruleName_1 = XtextAntlrGeneratorFragment2.this.grammarUtil.ruleName(IterableExtensions.head(close)); _builder.append(_ruleName_1, "\t\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -1209,65 +1067,34 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment protected void addRuntimeBindingsAndImports() { @Extension final GrammarNaming naming = this.productionNaming; - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - ManifestAccess _manifest = _runtime.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - ManifestAccess _manifest_1 = _runtime_1.getManifest(); + ManifestAccess _manifest_1 = this.getProjectConfig().getRuntime().getManifest(); final Procedure1 _function = (ManifestAccess it) -> { Set _exportedPackages = it.getExportedPackages(); - Grammar _grammar = this.getGrammar(); - TypeReference _lexerClass = naming.getLexerClass(_grammar); - String _packageName = _lexerClass.getPackageName(); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _parserClass = naming.getParserClass(_grammar_1); - String _packageName_1 = _parserClass.getPackageName(); - Grammar _grammar_2 = this.getGrammar(); - TypeReference _internalParserClass = naming.getInternalParserClass(_grammar_2); - String _packageName_2 = _internalParserClass.getPackageName(); + String _packageName = naming.getLexerClass(this.getGrammar()).getPackageName(); + String _packageName_1 = naming.getParserClass(this.getGrammar()).getPackageName(); + String _packageName_2 = naming.getInternalParserClass(this.getGrammar()).getPackageName(); Iterables.addAll(_exportedPackages, Collections.unmodifiableList(CollectionLiterals.newArrayList(_packageName, _packageName_1, _packageName_2))); Set _requiredBundles = it.getRequiredBundles(); _requiredBundles.add("org.antlr.runtime"); }; ObjectExtensions.operator_doubleArrow(_manifest_1, _function); } - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef(IParser.class); - Grammar _grammar = this.getGrammar(); - TypeReference _parserClass = naming.getParserClass(_grammar); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeRef, _parserClass); - TypeReference _typeRef_1 = TypeReference.typeRef(ITokenToStringConverter.class); - TypeReference _typeRef_2 = TypeReference.typeRef(AntlrTokenToStringConverter.class); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeRef_1, _typeRef_2); - TypeReference _typeRef_3 = TypeReference.typeRef(IAntlrTokenFileProvider.class); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _antlrTokenFileProviderClass = naming.getAntlrTokenFileProviderClass(_grammar_1); - GuiceModuleAccess.BindingFactory _addTypeToType_2 = _addTypeToType_1.addTypeToType(_typeRef_3, _antlrTokenFileProviderClass); - Grammar _grammar_2 = this.getGrammar(); - TypeReference _lexerSuperClass = naming.getLexerSuperClass(_grammar_2); - Grammar _grammar_3 = this.getGrammar(); - TypeReference _lexerClass = naming.getLexerClass(_grammar_3); - GuiceModuleAccess.BindingFactory _addTypeToType_3 = _addTypeToType_2.addTypeToType(_lexerSuperClass, _lexerClass); - TypeReference _typeRef_4 = TypeReference.typeRef(ITokenDefProvider.class); - TypeReference _typeRef_5 = TypeReference.typeRef(AntlrTokenDefProvider.class); - GuiceModuleAccess.BindingFactory _addTypeToType_4 = _addTypeToType_3.addTypeToType(_typeRef_4, _typeRef_5); - Grammar _grammar_4 = this.getGrammar(); - TypeReference _lexerClass_1 = naming.getLexerClass(_grammar_4); + GuiceModuleAccess.BindingFactory _addTypeToType = new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IParser.class), naming.getParserClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ITokenToStringConverter.class), TypeReference.typeRef(AntlrTokenToStringConverter.class)).addTypeToType(TypeReference.typeRef(IAntlrTokenFileProvider.class), naming.getAntlrTokenFileProviderClass(this.getGrammar())).addTypeToType(naming.getLexerSuperClass(this.getGrammar()), naming.getLexerClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ITokenDefProvider.class), TypeReference.typeRef(AntlrTokenDefProvider.class)); + TypeReference _lexerClass = naming.getLexerClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append(LexerProvider.class); _builder.append(".create("); - Grammar _grammar = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _lexerClass = naming.getLexerClass(_grammar); + TypeReference _lexerClass = naming.getLexerClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_lexerClass); _builder.append(".class)"); } }; - GuiceModuleAccess.BindingFactory _addTypeToProviderInstance = _addTypeToType_4.addTypeToProviderInstance(_lexerClass_1, _client); + GuiceModuleAccess.BindingFactory _addTypeToProviderInstance = _addTypeToType.addTypeToProviderInstance(_lexerClass, _client); StringConcatenationClient _client_1 = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -1284,8 +1111,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append(".to("); - Grammar _grammar = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _lexerClass = naming.getLexerClass(_grammar); + TypeReference _lexerClass = naming.getLexerClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_lexerClass, "\t"); _builder.append(".class);"); _builder.newLineIfNotEmpty(); @@ -1294,50 +1120,27 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment final GuiceModuleAccess.BindingFactory rtBindings = _addTypeToProviderInstance.addConfiguredBinding("RuntimeLexer", _client_1); boolean _containsUnorderedGroup = this.containsUnorderedGroup(this.getGrammar()); if (_containsUnorderedGroup) { - TypeReference _typeRef_6 = TypeReference.typeRef(IUnorderedGroupHelper.class); - TypeReference _typeRef_7 = TypeReference.typeRef(UnorderedGroupHelper.class); - rtBindings.addTypeToType(_typeRef_6, _typeRef_7); + rtBindings.addTypeToType(TypeReference.typeRef(IUnorderedGroupHelper.class), TypeReference.typeRef(UnorderedGroupHelper.class)); } - AntlrOptions _options = this.getOptions(); - boolean _isIgnoreCase = _options.isIgnoreCase(); + boolean _isIgnoreCase = this.getOptions().isIgnoreCase(); if (_isIgnoreCase) { - TypeReference _typeRef_8 = TypeReference.typeRef(ITokenSerializer.IKeywordSerializer.class); - TypeReference _typeRef_9 = TypeReference.typeRef(IgnoreCaseKeywordSerializer.class); - GuiceModuleAccess.BindingFactory _addTypeToType_5 = rtBindings.addTypeToType(_typeRef_8, _typeRef_9); - TypeReference _typeRef_10 = TypeReference.typeRef(IKeywordSerializer.class); - TypeReference _typeRef_11 = TypeReference.typeRef(org.eclipse.xtext.serializer.tokens.IgnoreCaseKeywordSerializer.class); - GuiceModuleAccess.BindingFactory _addTypeToType_6 = _addTypeToType_5.addTypeToType(_typeRef_10, _typeRef_11); - TypeReference _typeRef_12 = TypeReference.typeRef(AbstractIDValueConverter.class); - TypeReference _typeRef_13 = TypeReference.typeRef(IgnoreCaseIDValueConverter.class); - _addTypeToType_6.addTypeToType(_typeRef_12, _typeRef_13); + rtBindings.addTypeToType(TypeReference.typeRef(ITokenSerializer.IKeywordSerializer.class), TypeReference.typeRef(IgnoreCaseKeywordSerializer.class)).addTypeToType(TypeReference.typeRef(IKeywordSerializer.class), TypeReference.typeRef(org.eclipse.xtext.serializer.tokens.IgnoreCaseKeywordSerializer.class)).addTypeToType(TypeReference.typeRef(AbstractIDValueConverter.class), TypeReference.typeRef(IgnoreCaseIDValueConverter.class)); } - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language.getRuntimeGenModule(); - rtBindings.contributeTo(_runtimeGenModule); + rtBindings.contributeTo(this.getLanguage().getRuntimeGenModule()); } protected void addIdeBindingsAndImports() { @Extension final ContentAssistGrammarNaming naming = this.contentAssistNaming; - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _genericIde = _projectConfig.getGenericIde(); - ManifestAccess _manifest = _genericIde.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getGenericIde().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _genericIde_1 = _projectConfig_1.getGenericIde(); - ManifestAccess _manifest_1 = _genericIde_1.getManifest(); + ManifestAccess _manifest_1 = this.getProjectConfig().getGenericIde().getManifest(); final Procedure1 _function = (ManifestAccess it) -> { Set _exportedPackages = it.getExportedPackages(); - Grammar _grammar = this.getGrammar(); - TypeReference _lexerClass = naming.getLexerClass(_grammar); - String _packageName = _lexerClass.getPackageName(); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _parserClass = naming.getParserClass(_grammar_1); - String _packageName_1 = _parserClass.getPackageName(); - Grammar _grammar_2 = this.getGrammar(); - TypeReference _internalParserClass = naming.getInternalParserClass(_grammar_2); - String _packageName_2 = _internalParserClass.getPackageName(); + String _packageName = naming.getLexerClass(this.getGrammar()).getPackageName(); + String _packageName_1 = naming.getParserClass(this.getGrammar()).getPackageName(); + String _packageName_2 = naming.getInternalParserClass(this.getGrammar()).getPackageName(); Iterables.addAll(_exportedPackages, Collections.unmodifiableList(CollectionLiterals.newArrayList(_packageName, _packageName_1, _packageName_2))); Set _requiredBundles = it.getRequiredBundles(); _requiredBundles.add("org.antlr.runtime"); @@ -1349,8 +1152,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("binder.bind("); - Grammar _grammar = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _lexerSuperClass = naming.getLexerSuperClass(_grammar); + TypeReference _lexerSuperClass = naming.getLexerSuperClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_lexerSuperClass); _builder.append(".class)"); _builder.newLineIfNotEmpty(); @@ -1364,67 +1166,48 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append(".to("); - Grammar _grammar_1 = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _lexerClass = naming.getLexerClass(_grammar_1); + TypeReference _lexerClass = naming.getLexerClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_lexerClass, "\t"); _builder.append(".class);"); _builder.newLineIfNotEmpty(); } }; - GuiceModuleAccess.BindingFactory _addConfiguredBinding = _bindingFactory.addConfiguredBinding("ContentAssistLexer", _client); - TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser"); - Grammar _grammar = this.getGrammar(); - TypeReference _parserClass = naming.getParserClass(_grammar); - GuiceModuleAccess.BindingFactory _addTypeToType = _addConfiguredBinding.addTypeToType(_typeRef, _parserClass); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper"); - TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper"); - final GuiceModuleAccess.BindingFactory ideBindings = _addTypeToType.addTypeToType(_typeRef_1, _typeRef_2); + final GuiceModuleAccess.BindingFactory ideBindings = _bindingFactory.addConfiguredBinding("ContentAssistLexer", _client).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser"), naming.getParserClass(this.getGrammar())).addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper"), + TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper")); if (this.partialParsing) { - TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory"); - TypeReference _typeRef_4 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory"); - ideBindings.addTypeToType(_typeRef_3, _typeRef_4); + ideBindings.addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory"), + TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory")); } - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _ideGenModule = _language.getIdeGenModule(); - ideBindings.contributeTo(_ideGenModule); + ideBindings.contributeTo(this.getLanguage().getIdeGenModule()); } protected void addUiBindingsAndImports() { @Extension final ContentAssistGrammarNaming naming = this.contentAssistNaming; - Grammar _grammar = this.getGrammar(); - final TypeReference caLexerClass = naming.getLexerClass(_grammar); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _genericIde = _projectConfig.getGenericIde(); - ManifestAccess _manifest = _genericIde.getManifest(); + final TypeReference caLexerClass = naming.getLexerClass(this.getGrammar()); + ManifestAccess _manifest = this.getProjectConfig().getGenericIde().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _genericIde_1 = _projectConfig_1.getGenericIde(); - ManifestAccess _manifest_1 = _genericIde_1.getManifest(); + ManifestAccess _manifest_1 = this.getProjectConfig().getGenericIde().getManifest(); final Procedure1 _function = (ManifestAccess it) -> { Set _exportedPackages = it.getExportedPackages(); String _packageName = caLexerClass.getPackageName(); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _parserClass = naming.getParserClass(_grammar_1); - String _packageName_1 = _parserClass.getPackageName(); - Grammar _grammar_2 = this.getGrammar(); - TypeReference _internalParserClass = naming.getInternalParserClass(_grammar_2); - String _packageName_2 = _internalParserClass.getPackageName(); + String _packageName_1 = naming.getParserClass(this.getGrammar()).getPackageName(); + String _packageName_2 = naming.getInternalParserClass(this.getGrammar()).getPackageName(); Iterables.addAll(_exportedPackages, Collections.unmodifiableList(CollectionLiterals.newArrayList(_packageName, _packageName_1, _packageName_2))); }; ObjectExtensions.operator_doubleArrow(_manifest_1, _function); } - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.IProposalConflictHelper"); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.antlr.AntlrProposalConflictHelper"); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeRef, _typeRef_1); + GuiceModuleAccess.BindingFactory _addTypeToType = new GuiceModuleAccess.BindingFactory().addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.IProposalConflictHelper"), + TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.antlr.AntlrProposalConflictHelper")); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("binder.bind("); - Grammar _grammar = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _lexerSuperClass = naming.getLexerSuperClass(_grammar); + TypeReference _lexerSuperClass = naming.getLexerSuperClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_lexerSuperClass); _builder.append(".class)"); _builder.newLineIfNotEmpty(); @@ -1461,8 +1244,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append(".to("); - Grammar _grammar = XtextAntlrGeneratorFragment2.this.getGrammar(); - TypeReference _lexerClass = XtextAntlrGeneratorFragment2.this.productionNaming.getLexerClass(_grammar); + TypeReference _lexerClass = XtextAntlrGeneratorFragment2.this.productionNaming.getLexerClass(XtextAntlrGeneratorFragment2.this.getGrammar()); _builder.append(_lexerClass, "\t"); _builder.append(".class);"); _builder.newLineIfNotEmpty(); @@ -1493,12 +1275,10 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment }; GuiceModuleAccess.BindingFactory _addConfiguredBinding_2 = _addConfiguredBinding_1.addConfiguredBinding("HighlightingTokenDefProvider", _client_2); TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.editor.contentassist", "ContentAssistContext.Factory"); - TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.antlr.DelegatingContentAssistContextFactory"); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addConfiguredBinding_2.addTypeToType(_typeReference, _typeRef_2); - TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser"); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _parserClass = naming.getParserClass(_grammar_1); - GuiceModuleAccess.BindingFactory _addTypeToType_2 = _addTypeToType_1.addTypeToType(_typeRef_3, _parserClass); + GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addConfiguredBinding_2.addTypeToType(_typeReference, + TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.antlr.DelegatingContentAssistContextFactory")).addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser"), + naming.getParserClass(this.getGrammar())); StringConcatenationClient _client_3 = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -1512,10 +1292,8 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment _builder.newLineIfNotEmpty(); } }; - final GuiceModuleAccess.BindingFactory uiBindings = _addTypeToType_2.addConfiguredBinding("ContentAssistLexerProvider", _client_3); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule(); - uiBindings.contributeTo(_eclipsePluginGenModule); + final GuiceModuleAccess.BindingFactory uiBindings = _addTypeToType_1.addConfiguredBinding("ContentAssistLexerProvider", _client_3); + uiBindings.contributeTo(this.getLanguage().getEclipsePluginGenModule()); } public void setDebugGrammar(final boolean debugGrammar) { diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/resourceFactory/ResourceFactoryFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/resourceFactory/ResourceFactoryFragment2.java index 1791f294c..03c91a4b9 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/resourceFactory/ResourceFactoryFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/resourceFactory/ResourceFactoryFragment2.java @@ -12,18 +12,14 @@ import java.util.List; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtend2.lib.StringConcatenationClient; -import org.eclipse.xtext.Grammar; import org.eclipse.xtext.resource.IResourceFactory; import org.eclipse.xtext.resource.IResourceServiceProvider; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; -import org.eclipse.xtext.xtext.generator.model.StandaloneSetupAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; /** * Contributes the registration org.eclipse.emf.ecore.extension_parser @@ -41,9 +37,6 @@ public class ResourceFactoryFragment2 extends AbstractXtextGeneratorFragment { @Override public void generate() { - IXtextGeneratorLanguage _language = this.getLanguage(); - StandaloneSetupAccess _runtimeGenSetup = _language.getRuntimeGenSetup(); - List _registrations = _runtimeGenSetup.getRegistrations(); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -59,8 +52,7 @@ public class ResourceFactoryFragment2 extends AbstractXtextGeneratorFragment { _builder.newLineIfNotEmpty(); _builder.newLine(); { - IXtextGeneratorLanguage _language = ResourceFactoryFragment2.this.getLanguage(); - List _fileExtensions = _language.getFileExtensions(); + List _fileExtensions = ResourceFactoryFragment2.this.getLanguage().getFileExtensions(); for(final String fileExtension : _fileExtensions) { _builder.append(Resource.class); _builder.append(".Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(\""); @@ -76,25 +68,20 @@ public class ResourceFactoryFragment2 extends AbstractXtextGeneratorFragment { } } }; - _registrations.add(_client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); + this.getLanguage().getRuntimeGenSetup().getRegistrations().add(_client); + IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin(); PluginXmlAccess _pluginXml = null; if (_eclipsePlugin!=null) { _pluginXml=_eclipsePlugin.getPluginXml(); } boolean _tripleNotEquals = (_pluginXml != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_1.getEclipsePlugin(); - PluginXmlAccess _pluginXml_1 = _eclipsePlugin_1.getPluginXml(); - List _entries = _pluginXml_1.getEntries(); + List _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); StringConcatenation _builder = new StringConcatenation(); _builder.append(""); _builder.newLine(); { - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - List _fileExtensions = _language_1.getFileExtensions(); + List _fileExtensions = this.getLanguage().getFileExtensions(); for(final String fileExtension : _fileExtensions) { _builder.append(" _exportedPackages = _manifest_1.getExportedPackages(); - Grammar _grammar = this.getGrammar(); - TypeReference _scopeProviderClass = this.getScopeProviderClass(_grammar); - String _packageName = _scopeProviderClass.getPackageName(); + Set _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages(); + String _packageName = this.getScopeProviderClass(this.getGrammar()).getPackageName(); _exportedPackages.add(_packageName); boolean _isGenerateXtendStub_1 = this.isGenerateXtendStub(); if (_isGenerateXtendStub_1) { - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_2 = _projectConfig_2.getRuntime(); - ManifestAccess _manifest_2 = _runtime_2.getManifest(); - Set _requiredBundles = _manifest_2.getRequiredBundles(); + Set _requiredBundles = this.getProjectConfig().getRuntime().getManifest().getRequiredBundles(); _requiredBundles.add("org.eclipse.xtext.xbase.lib"); } } @@ -165,18 +145,14 @@ public class ImportNamespacesScopingFragment2 extends AbstractInheritingFragment protected void contributeRuntimeGuiceBindings() { final GuiceModuleAccess.BindingFactory bindingFactory = new GuiceModuleAccess.BindingFactory(); TypeReference _xifexpression = null; - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(_grammar); + boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getLanguage().getGrammar()); if (_inheritsXbase) { _xifexpression = TypeReference.typeRef("org.eclipse.xtext.xbase.scoping.batch.IBatchScopeProvider"); } else { _xifexpression = TypeReference.typeRef(IScopeProvider.class); } final TypeReference targetType = _xifexpression; - Grammar _grammar_1 = this.getGrammar(); - TypeReference _scopeProviderClass = this.getScopeProviderClass(_grammar_1); - bindingFactory.addTypeToType(targetType, _scopeProviderClass); + bindingFactory.addTypeToType(targetType, this.getScopeProviderClass(this.getGrammar())); String _simpleName = IScopeProvider.class.getSimpleName(); String _plus = (_simpleName + "Delegate"); StringConcatenationClient _client = new StringConcatenationClient() { @@ -195,9 +171,7 @@ public class ImportNamespacesScopingFragment2 extends AbstractInheritingFragment } }; bindingFactory.addConfiguredBinding(_plus, _client); - TypeReference _typeRef = TypeReference.typeRef(IGlobalScopeProvider.class); - TypeReference _globalScopeProvider = this.getGlobalScopeProvider(); - bindingFactory.addTypeToType(_typeRef, _globalScopeProvider); + bindingFactory.addTypeToType(TypeReference.typeRef(IGlobalScopeProvider.class), this.getGlobalScopeProvider()); String _simpleName_1 = IgnoreCaseLinking.class.getSimpleName(); StringConcatenationClient _client_1 = new StringConcatenationClient() { @Override @@ -210,20 +184,16 @@ public class ImportNamespacesScopingFragment2 extends AbstractInheritingFragment } }; bindingFactory.addConfiguredBinding(_simpleName_1, _client_1); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language_1.getRuntimeGenModule(); - bindingFactory.contributeTo(_runtimeGenModule); + bindingFactory.contributeTo(this.getLanguage().getRuntimeGenModule()); } protected void generateGenScopeProvider() { TypeReference _xifexpression = null; boolean _isGenerateStub = this.isGenerateStub(); if (_isGenerateStub) { - Grammar _grammar = this.getGrammar(); - _xifexpression = this.getAbstractScopeProviderClass(_grammar); + _xifexpression = this.getAbstractScopeProviderClass(this.getGrammar()); } else { - Grammar _grammar_1 = this.getGrammar(); - _xifexpression = this.getScopeProviderClass(_grammar_1); + _xifexpression = this.getScopeProviderClass(this.getGrammar()); } final TypeReference genClass = _xifexpression; final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(genClass); @@ -241,8 +211,7 @@ public class ImportNamespacesScopingFragment2 extends AbstractInheritingFragment String _simpleName = genClass.getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar = ImportNamespacesScopingFragment2.this.getGrammar(); - TypeReference _scopeProviderSuperClass = ImportNamespacesScopingFragment2.this.getScopeProviderSuperClass(_grammar); + TypeReference _scopeProviderSuperClass = ImportNamespacesScopingFragment2.this.getScopeProviderSuperClass(ImportNamespacesScopingFragment2.this.getGrammar()); _builder.append(_scopeProviderSuperClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -251,15 +220,11 @@ public class ImportNamespacesScopingFragment2 extends AbstractInheritingFragment } }; file.setContent(_client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen = _runtime.getSrcGen(); - file.writeTo(_srcGen); + file.writeTo(this.getProjectConfig().getRuntime().getSrcGen()); } protected void generateJavaScopeProvider() { - Grammar _grammar = this.getGrammar(); - TypeReference _scopeProviderClass = this.getScopeProviderClass(_grammar); + TypeReference _scopeProviderClass = this.getScopeProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -281,13 +246,10 @@ public class ImportNamespacesScopingFragment2 extends AbstractInheritingFragment _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - Grammar _grammar = ImportNamespacesScopingFragment2.this.getGrammar(); - TypeReference _scopeProviderClass = ImportNamespacesScopingFragment2.this.getScopeProviderClass(_grammar); - String _simpleName = _scopeProviderClass.getSimpleName(); + String _simpleName = ImportNamespacesScopingFragment2.this.getScopeProviderClass(ImportNamespacesScopingFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = ImportNamespacesScopingFragment2.this.getGrammar(); - TypeReference _abstractScopeProviderClass = ImportNamespacesScopingFragment2.this.getAbstractScopeProviderClass(_grammar_1); + TypeReference _abstractScopeProviderClass = ImportNamespacesScopingFragment2.this.getAbstractScopeProviderClass(ImportNamespacesScopingFragment2.this.getGrammar()); _builder.append(_abstractScopeProviderClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -296,16 +258,11 @@ public class ImportNamespacesScopingFragment2 extends AbstractInheritingFragment _builder.newLine(); } }; - JavaFileAccess _createJavaFile = this.fileAccessFactory.createJavaFile(_scopeProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createJavaFile.writeTo(_src); + this.fileAccessFactory.createJavaFile(_scopeProviderClass, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } protected void generateXtendScopeProvider() { - Grammar _grammar = this.getGrammar(); - TypeReference _scopeProviderClass = this.getScopeProviderClass(_grammar); + TypeReference _scopeProviderClass = this.getScopeProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -327,13 +284,10 @@ public class ImportNamespacesScopingFragment2 extends AbstractInheritingFragment _builder.append("*/"); _builder.newLine(); _builder.append("class "); - Grammar _grammar = ImportNamespacesScopingFragment2.this.getGrammar(); - TypeReference _scopeProviderClass = ImportNamespacesScopingFragment2.this.getScopeProviderClass(_grammar); - String _simpleName = _scopeProviderClass.getSimpleName(); + String _simpleName = ImportNamespacesScopingFragment2.this.getScopeProviderClass(ImportNamespacesScopingFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = ImportNamespacesScopingFragment2.this.getGrammar(); - TypeReference _abstractScopeProviderClass = ImportNamespacesScopingFragment2.this.getAbstractScopeProviderClass(_grammar_1); + TypeReference _abstractScopeProviderClass = ImportNamespacesScopingFragment2.this.getAbstractScopeProviderClass(ImportNamespacesScopingFragment2.this.getGrammar()); _builder.append(_abstractScopeProviderClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -342,11 +296,7 @@ public class ImportNamespacesScopingFragment2 extends AbstractInheritingFragment _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_scopeProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_scopeProviderClass, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } @Pure diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/DebugGraphGenerator.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/DebugGraphGenerator.java index 9e5f47266..57fcb24fc 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/DebugGraphGenerator.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/DebugGraphGenerator.java @@ -17,14 +17,11 @@ import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.RuleCall; -import org.eclipse.xtext.serializer.ISerializationContext; -import org.eclipse.xtext.serializer.analysis.GrammarAlias; import org.eclipse.xtext.serializer.analysis.IContextPDAProvider; import org.eclipse.xtext.serializer.analysis.IContextTypePDAProvider; import org.eclipse.xtext.serializer.analysis.ISemanticSequencerNfaProvider; import org.eclipse.xtext.serializer.analysis.ISerState; import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider; -import org.eclipse.xtext.serializer.analysis.SerializationContextMap; import org.eclipse.xtext.util.GraphvizDotBuilder; import org.eclipse.xtext.util.formallang.Nfa; import org.eclipse.xtext.util.formallang.NfaToDot; @@ -84,82 +81,70 @@ public class DebugGraphGenerator { final String dir_context_type = this.directory("context_type"); final String dir_syntactic_sequencer = this.directory("syntactic_sequencer"); final String dir_semantic_sequencer = this.directory("semantic_sequencer"); - SerializationContextMap> _contextPDAs = this.contextPDAProvider.getContextPDAs(this.grammar); - List>> _namedContexts = names.>getNamedContexts(_contextPDAs); + List>> _namedContexts = names.>getNamedContexts(this.contextPDAProvider.getContextPDAs(this.grammar)); for (final NamedSerializationContexts> e : _namedContexts) { { String _name = e.getName(); String _plus = (dir_context + _name); String _plus_1 = (_plus + ".dot"); - Pda _value = e.getValue(); - String _drawSafe = this.drawSafe(this.pdaToDot, _value); + String _drawSafe = this.drawSafe(this.pdaToDot, e.getValue()); Pair _mappedTo = Pair.of(_plus_1, _drawSafe); result.add(_mappedTo); String _name_1 = e.getName(); String _plus_2 = (dir_context + _name_1); String _plus_3 = (_plus_2 + ".txt"); - List _contexts = e.getContexts(); - String _join = IterableExtensions.join(_contexts, "\n"); + String _join = IterableExtensions.join(e.getContexts(), "\n"); Pair _mappedTo_1 = Pair.of(_plus_3, _join); result.add(_mappedTo_1); } } - SerializationContextMap> _contextTypePDAs = this.contextTypePDAProvider.getContextTypePDAs(this.grammar); - List>> _namedContexts_1 = names.>getNamedContexts(_contextTypePDAs); + List>> _namedContexts_1 = names.>getNamedContexts(this.contextTypePDAProvider.getContextTypePDAs(this.grammar)); for (final NamedSerializationContexts> e_1 : _namedContexts_1) { { String _name = e_1.getName(); String _plus = (dir_context_type + _name); String _plus_1 = (_plus + ".dot"); - Pda _value = e_1.getValue(); - String _drawSafe = this.drawSafe(this.pdaToDot, _value); + String _drawSafe = this.drawSafe(this.pdaToDot, e_1.getValue()); Pair _mappedTo = Pair.of(_plus_1, _drawSafe); result.add(_mappedTo); String _name_1 = e_1.getName(); String _plus_2 = (dir_context_type + _name_1); String _plus_3 = (_plus_2 + ".txt"); - List _contexts = e_1.getContexts(); - String _join = IterableExtensions.join(_contexts, "\n"); + String _join = IterableExtensions.join(e_1.getContexts(), "\n"); Pair _mappedTo_1 = Pair.of(_plus_3, _join); result.add(_mappedTo_1); } } - SerializationContextMap _syntacticSequencerPDAs = this.syntacticSequencerPDAProvider.getSyntacticSequencerPDAs(this.grammar); - List> _namedContexts_2 = names.getNamedContexts(_syntacticSequencerPDAs); + List> _namedContexts_2 = names.getNamedContexts(this.syntacticSequencerPDAProvider.getSyntacticSequencerPDAs(this.grammar)); for (final NamedSerializationContexts e_2 : _namedContexts_2) { { String _name = e_2.getName(); String _plus = (dir_syntactic_sequencer + _name); String _plus_1 = (_plus + ".dot"); - ISyntacticSequencerPDAProvider.ISynAbsorberState _value = e_2.getValue(); - String _drawSafe = this.drawSafe(this.syntacticSequencerPDA2Dot, _value); + String _drawSafe = this.drawSafe(this.syntacticSequencerPDA2Dot, e_2.getValue()); Pair _mappedTo = Pair.of(_plus_1, _drawSafe); result.add(_mappedTo); String _name_1 = e_2.getName(); String _plus_2 = (dir_syntactic_sequencer + _name_1); String _plus_3 = (_plus_2 + ".txt"); - List _contexts = e_2.getContexts(); - String _join = IterableExtensions.join(_contexts, "\n"); + String _join = IterableExtensions.join(e_2.getContexts(), "\n"); Pair _mappedTo_1 = Pair.of(_plus_3, _join); result.add(_mappedTo_1); } } - SerializationContextMap> _semanticSequencerNFAs = this.semanticSequencerNFAProvider.getSemanticSequencerNFAs(this.grammar); - List>> _namedContexts_3 = names.>getNamedContexts(_semanticSequencerNFAs); + List>> _namedContexts_3 = names.>getNamedContexts(this.semanticSequencerNFAProvider.getSemanticSequencerNFAs(this.grammar)); for (final NamedSerializationContexts> e_3 : _namedContexts_3) { { String _name = e_3.getName(); String _plus = (dir_semantic_sequencer + _name); String _plus_1 = (_plus + ".dot"); - Nfa _value = e_3.getValue(); - String _drawSafe = this.drawSafe(this.nfaToDot, _value); + String _drawSafe = this.drawSafe(this.nfaToDot, e_3.getValue()); Pair _mappedTo = Pair.of(_plus_1, _drawSafe); result.add(_mappedTo); String _name_1 = e_3.getName(); String _plus_2 = (dir_semantic_sequencer + _name_1); String _plus_3 = (_plus_2 + ".txt"); - List _contexts = e_3.getContexts(); - String _join = IterableExtensions.join(_contexts, "\n"); + String _join = IterableExtensions.join(e_3.getContexts(), "\n"); Pair _mappedTo_1 = Pair.of(_plus_3, _join); result.add(_mappedTo_1); } @@ -174,8 +159,7 @@ public class DebugGraphGenerator { String _directory = this.directory("syntactic_sequencer"); String _plus = (_directory + name); String _plus_1 = (_plus + ".dot"); - Nfa _ambiguousNfa = transition.getAmbiguousNfa(); - String _draw = this.nfaToDot.draw(_ambiguousNfa); + String _draw = this.nfaToDot.draw(transition.getAmbiguousNfa()); Pair _mappedTo = Pair.of(_plus_1, _draw); result.add(_mappedTo); trans2id.put(transition, name); @@ -194,9 +178,7 @@ public class DebugGraphGenerator { _builder.append("Ambiguous syntax:»:"); _builder.newLine(); _builder.append(" "); - GrammarAlias.AbstractElementAlias _elementAlias = group.getElementAlias(); - String _string = _elementAlias.toString(); - String _replace = _string.replace("\n", "\n "); + String _replace = group.getElementAlias().toString().replace("\n", "\n "); _builder.append(_replace, " "); _builder.newLineIfNotEmpty(); _builder.append(" "); @@ -212,8 +194,7 @@ public class DebugGraphGenerator { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append(" "); - String _ambiguityInsideTransition = group.ambiguityInsideTransition(trans); - String _replace_1 = _ambiguityInsideTransition.replace("\n", "\n "); + String _replace_1 = group.ambiguityInsideTransition(trans).replace("\n", "\n "); _builder.append(_replace_1, "\t "); _builder.newLineIfNotEmpty(); } @@ -225,8 +206,8 @@ public class DebugGraphGenerator { } String _directory = this.directory("syntactic_sequencer"); String _plus = (_directory + "ambiguities.txt"); - String _string_1 = ambiguities.toString(); - Pair _mappedTo = Pair.of(_plus, _string_1); + String _string = ambiguities.toString(); + Pair _mappedTo = Pair.of(_plus, _string); result.add(_mappedTo); } catch (final Throwable _t) { if (_t instanceof Exception) { @@ -257,11 +238,9 @@ public class DebugGraphGenerator { } private String directory(final String name) { - String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.grammar); - String _replace = _runtimeBasePackage.replace(".", "/"); + String _replace = this._xtextGeneratorNaming.getRuntimeBasePackage(this.grammar).replace(".", "/"); String _plus = (_replace + "/serializer/"); - String _simpleName = GrammarUtil.getSimpleName(this.grammar); - String _lowerCase = _simpleName.toLowerCase(); + String _lowerCase = GrammarUtil.getSimpleName(this.grammar).toLowerCase(); String _plus_1 = (_plus + _lowerCase); String _plus_2 = (_plus_1 + "_"); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/EqualAmbiguousTransitions.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/EqualAmbiguousTransitions.java index 2d8e65a8e..53750a883 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/EqualAmbiguousTransitions.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/EqualAmbiguousTransitions.java @@ -42,11 +42,8 @@ public class EqualAmbiguousTransitions implements Comparable _setTokenToString = new ProductionFormatter() { + final GrammarElementTitleSwitch tokenToString = new GrammarElementTitleSwitch().showAssignments().hideCardinality().setValueForNull(""); + final ProductionFormatter formatter = new ProductionFormatter() { @Override public String format(final Production adapter, final GrammarAlias.AbstractElementAlias grammarElement, final boolean needParenthesis) { String _switchResult = null; @@ -79,13 +76,10 @@ public class EqualAmbiguousTransitions implements Comparable _setAutoWrapChars = _setTokenToString.setAutoWrapChars(200); - final ProductionFormatter formatter = _setAutoWrapChars.setAutoWrapChildren(20); + }.setTokenToString(tokenToString).setAutoWrapChars(200).setAutoWrapChildren(20); GrammarAlias.AbstractElementAlias _ambiguousSyntax = trans.getAmbiguousSyntax(); final GrammarAlias.GrammarAliasAdapter adapter = new GrammarAlias.GrammarAliasAdapter(_ambiguousSyntax); - GrammarAlias.AbstractElementAlias _root = adapter.getRoot(); - return formatter.format(adapter, _root, false); + return formatter.format(adapter, adapter.getRoot(), false); } catch (final Throwable _t) { if (_t instanceof Exception) { final Exception e = (Exception)_t; diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/NamedSerializationContextProvider.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/NamedSerializationContextProvider.java index 306dfcf6c..f42c66200 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/NamedSerializationContextProvider.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/NamedSerializationContextProvider.java @@ -34,16 +34,12 @@ public class NamedSerializationContextProvider { private final Map rules; public NamedSerializationContextProvider(final Grammar grammar) { - List _allParserRules = GrammarUtil.allParserRules(grammar); - Iterable> _indexed = IterableExtensions.indexed(_allParserRules); final Function1, Pair> _function = (Pair it) -> { ParserRule _value = it.getValue(); Integer _key = it.getKey(); return Pair.of(_value, _key); }; - Iterable> _map = IterableExtensions., Pair>map(_indexed, _function); - HashMap _newHashMap = CollectionLiterals.newHashMap(((Pair[])Conversions.unwrapArray(_map, Pair.class))); - this.rules = _newHashMap; + this.rules = CollectionLiterals.newHashMap(((Pair[])Conversions.unwrapArray(IterableExtensions., Pair>map(IterableExtensions.indexed(GrammarUtil.allParserRules(grammar)), _function), Pair.class))); } public List> getNamedContexts(final SerializationContextMap map) { @@ -100,8 +96,7 @@ public class NamedSerializationContextProvider { if ((pr == null)) { final Action action = ctx.getAssignedAction(); if ((action != null)) { - ParserRule _containingParserRule = GrammarUtil.containingParserRule(action); - pr = _containingParserRule; + pr = GrammarUtil.containingParserRule(action); } } if ((pr != null)) { diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SemanticSequencerExtensions.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SemanticSequencerExtensions.java index a69df237a..36be77413 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SemanticSequencerExtensions.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SemanticSequencerExtensions.java @@ -80,8 +80,7 @@ public class SemanticSequencerExtensions { contexts = CollectionLiterals.newArrayList(); result.put(constraint, contexts); } - List _contexts = e.getContexts(clazz); - contexts.addAll(_contexts); + contexts.addAll(e.getContexts(clazz)); } } } @@ -101,8 +100,7 @@ public class SemanticSequencerExtensions { } public Grammar getSuperGrammar(final Grammar grammar) { - EList _usedGrammars = grammar.getUsedGrammars(); - boolean _isEmpty = _usedGrammars.isEmpty(); + boolean _isEmpty = grammar.getUsedGrammars().isEmpty(); if (_isEmpty) { return null; } @@ -111,15 +109,10 @@ public class SemanticSequencerExtensions { if ((sg != null)) { return sg.grammar; } - EList _usedGrammars_1 = grammar.getUsedGrammars(); - Grammar _head = IterableExtensions.head(_usedGrammars_1); - Resource _eResource = _head.eResource(); - final URI uri = _eResource.getURI(); - ResourceSet _cloneResourceSet = this.cloneResourceSet(grammar.eResource().getResourceSet()); - final Resource resource = _cloneResourceSet.getResource(uri, true); - EList _contents = resource.getContents(); - EObject _head_1 = IterableExtensions.head(_contents); - final Grammar result = ((Grammar) _head_1); + final URI uri = IterableExtensions.head(grammar.getUsedGrammars()).eResource().getURI(); + final Resource resource = this.cloneResourceSet(grammar.eResource().getResourceSet()).getResource(uri, true); + EObject _head = IterableExtensions.head(resource.getContents()); + final Grammar result = ((Grammar) _head); EList _eAdapters = grammar.eAdapters(); SemanticSequencerExtensions.SuperGrammar _superGrammar = new SemanticSequencerExtensions.SuperGrammar(result); _eAdapters.add(_superGrammar); @@ -130,12 +123,10 @@ public class SemanticSequencerExtensions { if ((grammar == null)) { return CollectionLiterals.emptySet(); } - SerializationContextMap _constraints = this.gcp.getConstraints(grammar); - List> _values = _constraints.values(); final Function1, IGrammarConstraintProvider.IConstraint> _function = (SerializationContextMap.Entry it) -> { return it.getValue(); }; - return ListExtensions., IGrammarConstraintProvider.IConstraint>map(_values, _function); + return ListExtensions., IGrammarConstraintProvider.IConstraint>map(this.gcp.getConstraints(grammar).values(), _function); } public List getLinearListOfMandatoryAssignments(final IGrammarConstraintProvider.IConstraint constraint) { @@ -157,8 +148,7 @@ public class SemanticSequencerExtensions { } return _xifexpression; } - List _followers = state.getFollowers(); - int _size = _followers.size(); + int _size = state.getFollowers().size(); boolean _tripleNotEquals = (_size != 1); if (_tripleNotEquals) { return null; diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SerializerFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SerializerFragment2.java index 11315b492..709a1f70c 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SerializerFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SerializerFragment2.java @@ -21,10 +21,7 @@ import java.util.Map; import java.util.Set; import java.util.function.Consumer; import org.apache.log4j.Logger; -import org.eclipse.emf.codegen.ecore.genmodel.GenClass; import org.eclipse.emf.codegen.ecore.genmodel.GenFeature; -import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; @@ -47,7 +44,6 @@ import org.eclipse.xtext.Parameter; import org.eclipse.xtext.ParserRule; import org.eclipse.xtext.RuleCall; import org.eclipse.xtext.TerminalRule; -import org.eclipse.xtext.nodemodel.BidiIterable; import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.ILeafNode; import org.eclipse.xtext.nodemodel.INode; @@ -78,22 +74,15 @@ import org.eclipse.xtext.xbase.lib.ListExtensions; import org.eclipse.xtext.xbase.lib.Pair; import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xtext.generator.AbstractStubGeneratingFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessExtensions; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; -import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; -import org.eclipse.xtext.xtext.generator.model.TextFileAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.XtendFileAccess; import org.eclipse.xtext.xtext.generator.model.annotations.IClassAnnotation; import org.eclipse.xtext.xtext.generator.model.annotations.SuppressWarningsAnnotation; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.serializer.DebugGraphGenerator; import org.eclipse.xtext.xtext.generator.serializer.EqualAmbiguousTransitions; import org.eclipse.xtext.xtext.generator.serializer.SemanticSequencerExtensions; @@ -109,9 +98,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { { final LinkedHashMap result = CollectionLiterals.newLinkedHashMap(); for (final Pair i : items) { - K _key = i.getKey(); - V _value = i.getValue(); - result.put(_key, _value); + result.put(i.getKey(), i.getValue()); } _xblockexpression = result; } @@ -201,8 +188,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { } protected String getGrammarConstraintsPath(final Grammar grammar) { - String _serializerBasePackage = this.getSerializerBasePackage(grammar); - String _replace = _serializerBasePackage.replace(".", "/"); + String _replace = this.getSerializerBasePackage(grammar).replace(".", "/"); String _plus = (_replace + "/"); String _simpleName = GrammarUtil.getSimpleName(grammar); String _plus_1 = (_plus + _simpleName); @@ -211,37 +197,14 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { @Override public void generate() { - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef(ISemanticSequencer.class); - Grammar _grammar = this.getGrammar(); - TypeReference _semanticSequencerClass = this.getSemanticSequencerClass(_grammar); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeRef, _semanticSequencerClass); - TypeReference _typeRef_1 = TypeReference.typeRef(ISyntacticSequencer.class); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _syntacticSequencerClass = this.getSyntacticSequencerClass(_grammar_1); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeRef_1, _syntacticSequencerClass); - TypeReference _typeRef_2 = TypeReference.typeRef(ISerializer.class); - TypeReference _typeRef_3 = TypeReference.typeRef(Serializer.class); - GuiceModuleAccess.BindingFactory _addTypeToType_2 = _addTypeToType_1.addTypeToType(_typeRef_2, _typeRef_3); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language.getRuntimeGenModule(); - _addTypeToType_2.contributeTo(_runtimeGenModule); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - ManifestAccess _manifest = _runtime.getManifest(); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(ISemanticSequencer.class), this.getSemanticSequencerClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ISyntacticSequencer.class), this.getSyntacticSequencerClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ISerializer.class), TypeReference.typeRef(Serializer.class)).contributeTo(this.getLanguage().getRuntimeGenModule()); + ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - ManifestAccess _manifest_1 = _runtime_1.getManifest(); - Set _exportedPackages = _manifest_1.getExportedPackages(); - Grammar _grammar_2 = this.getGrammar(); - String _serializerBasePackage = this.getSerializerBasePackage(_grammar_2); + Set _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages(); + String _serializerBasePackage = this.getSerializerBasePackage(this.getGrammar()); _exportedPackages.add(_serializerBasePackage); - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_2 = _projectConfig_2.getRuntime(); - ManifestAccess _manifest_2 = _runtime_2.getManifest(); - Set _requiredBundles = _manifest_2.getRequiredBundles(); + Set _requiredBundles = this.getProjectConfig().getRuntime().getManifest().getRequiredBundles(); _requiredBundles.add("org.eclipse.xtext.xbase.lib"); } this.generateAbstractSemanticSequencer(); @@ -255,12 +218,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { this.generateGrammarConstraints(); Iterable> _generateDebugGraphs = this.debugGraphGenerator.generateDebugGraphs(); for (final Pair fileToContent : _generateDebugGraphs) { - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_3 = _projectConfig_3.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen = _runtime_3.getSrcGen(); - String _key = fileToContent.getKey(); - String _value = fileToContent.getValue(); - _srcGen.generateFile(_key, _value); + this.getProjectConfig().getRuntime().getSrcGen().generateFile(fileToContent.getKey(), fileToContent.getValue()); } } } @@ -268,19 +226,15 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { protected void generateSemanticSequencer() { boolean _isGenerateXtendStub = this.isGenerateXtendStub(); if (_isGenerateXtendStub) { - Grammar _grammar = this.getGrammar(); - TypeReference _semanticSequencerClass = this.getSemanticSequencerClass(_grammar); + TypeReference _semanticSequencerClass = this.getSemanticSequencerClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("class "); - Grammar _grammar = SerializerFragment2.this.getGrammar(); - TypeReference _semanticSequencerClass = SerializerFragment2.this.getSemanticSequencerClass(_grammar); - String _simpleName = _semanticSequencerClass.getSimpleName(); + String _simpleName = SerializerFragment2.this.getSemanticSequencerClass(SerializerFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = SerializerFragment2.this.getGrammar(); - TypeReference _abstractSemanticSequencerClass = SerializerFragment2.this.getAbstractSemanticSequencerClass(_grammar_1); + TypeReference _abstractSemanticSequencerClass = SerializerFragment2.this.getAbstractSemanticSequencerClass(SerializerFragment2.this.getGrammar()); _builder.append(_abstractSemanticSequencerClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -288,25 +242,17 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_semanticSequencerClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_semanticSequencerClass, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } else { - Grammar _grammar_1 = this.getGrammar(); - TypeReference _semanticSequencerClass_1 = this.getSemanticSequencerClass(_grammar_1); + TypeReference _semanticSequencerClass_1 = this.getSemanticSequencerClass(this.getGrammar()); StringConcatenationClient _client_1 = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - Grammar _grammar = SerializerFragment2.this.getGrammar(); - TypeReference _semanticSequencerClass = SerializerFragment2.this.getSemanticSequencerClass(_grammar); - String _simpleName = _semanticSequencerClass.getSimpleName(); + String _simpleName = SerializerFragment2.this.getSemanticSequencerClass(SerializerFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = SerializerFragment2.this.getGrammar(); - TypeReference _abstractSemanticSequencerClass = SerializerFragment2.this.getAbstractSemanticSequencerClass(_grammar_1); + TypeReference _abstractSemanticSequencerClass = SerializerFragment2.this.getAbstractSemanticSequencerClass(SerializerFragment2.this.getGrammar()); _builder.append(_abstractSemanticSequencerClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -314,11 +260,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - JavaFileAccess _createJavaFile = this.fileAccessFactory.createJavaFile(_semanticSequencerClass_1, _client_1); - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - IXtextGeneratorFileSystemAccess _src_1 = _runtime_1.getSrc(); - _createJavaFile.writeTo(_src_1); + this.fileAccessFactory.createJavaFile(_semanticSequencerClass_1, _client_1).writeTo(this.getProjectConfig().getRuntime().getSrc()); } } @@ -334,31 +276,25 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { protected void generateSyntacticSequencer() { boolean _isGenerateXtendStub = this.isGenerateXtendStub(); if (_isGenerateXtendStub) { - Grammar _grammar = this.getGrammar(); - TypeReference _syntacticSequencerClass = this.getSyntacticSequencerClass(_grammar); + TypeReference _syntacticSequencerClass = this.getSyntacticSequencerClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("class "); - Grammar _grammar = SerializerFragment2.this.getGrammar(); - TypeReference _syntacticSequencerClass = SerializerFragment2.this.getSyntacticSequencerClass(_grammar); - String _simpleName = _syntacticSequencerClass.getSimpleName(); + String _simpleName = SerializerFragment2.this.getSyntacticSequencerClass(SerializerFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = SerializerFragment2.this.getGrammar(); - TypeReference _abstractSyntacticSequencerClass = SerializerFragment2.this.getAbstractSyntacticSequencerClass(_grammar_1); + TypeReference _abstractSyntacticSequencerClass = SerializerFragment2.this.getAbstractSyntacticSequencerClass(SerializerFragment2.this.getGrammar()); _builder.append(_abstractSyntacticSequencerClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); { if (SerializerFragment2.this.detectSyntheticTerminals) { { - Grammar _grammar_2 = SerializerFragment2.this.getGrammar(); - List _allTerminalRules = GrammarUtil.allTerminalRules(_grammar_2); final Function1 _function = (TerminalRule it) -> { return Boolean.valueOf(SerializerFragment2.this.syntheticTerminalDetector.isSyntheticTerminalRule(it)); }; - Iterable _filter = IterableExtensions.filter(_allTerminalRules, _function); + Iterable _filter = IterableExtensions.filter(GrammarUtil.allTerminalRules(SerializerFragment2.this.getGrammar()), _function); for(final TerminalRule rule : _filter) { _builder.append("\t"); _builder.newLine(); @@ -403,37 +339,27 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_syntacticSequencerClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_syntacticSequencerClass, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } else { - Grammar _grammar_1 = this.getGrammar(); - TypeReference _syntacticSequencerClass_1 = this.getSyntacticSequencerClass(_grammar_1); + TypeReference _syntacticSequencerClass_1 = this.getSyntacticSequencerClass(this.getGrammar()); StringConcatenationClient _client_1 = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - Grammar _grammar = SerializerFragment2.this.getGrammar(); - TypeReference _syntacticSequencerClass = SerializerFragment2.this.getSyntacticSequencerClass(_grammar); - String _simpleName = _syntacticSequencerClass.getSimpleName(); + String _simpleName = SerializerFragment2.this.getSyntacticSequencerClass(SerializerFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = SerializerFragment2.this.getGrammar(); - TypeReference _abstractSyntacticSequencerClass = SerializerFragment2.this.getAbstractSyntacticSequencerClass(_grammar_1); + TypeReference _abstractSyntacticSequencerClass = SerializerFragment2.this.getAbstractSyntacticSequencerClass(SerializerFragment2.this.getGrammar()); _builder.append(_abstractSyntacticSequencerClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); { if (SerializerFragment2.this.detectSyntheticTerminals) { { - Grammar _grammar_2 = SerializerFragment2.this.getGrammar(); - List _allTerminalRules = GrammarUtil.allTerminalRules(_grammar_2); final Function1 _function = (TerminalRule it) -> { return Boolean.valueOf(SerializerFragment2.this.syntheticTerminalDetector.isSyntheticTerminalRule(it)); }; - Iterable _filter = IterableExtensions.filter(_allTerminalRules, _function); + Iterable _filter = IterableExtensions.filter(GrammarUtil.allTerminalRules(SerializerFragment2.this.getGrammar()), _function); for(final TerminalRule rule : _filter) { _builder.append("\t"); _builder.newLine(); @@ -481,33 +407,23 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - JavaFileAccess _createJavaFile = this.fileAccessFactory.createJavaFile(_syntacticSequencerClass_1, _client_1); - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - IXtextGeneratorFileSystemAccess _src_1 = _runtime_1.getSrc(); - _createJavaFile.writeTo(_src_1); + this.fileAccessFactory.createJavaFile(_syntacticSequencerClass_1, _client_1).writeTo(this.getProjectConfig().getRuntime().getSrc()); } } protected void generateAbstractSemanticSequencer() { - Grammar _grammar = this.getGrammar(); - final Collection localConstraints = this._semanticSequencerExtensions.getGrammarConstraints(_grammar); - Grammar _grammar_1 = this.getGrammar(); - Grammar _superGrammar = this._semanticSequencerExtensions.getSuperGrammar(_grammar_1); - final Collection superConstraints = this._semanticSequencerExtensions.getGrammarConstraints(_superGrammar); + final Collection localConstraints = this._semanticSequencerExtensions.getGrammarConstraints(this.getGrammar()); + final Collection superConstraints = this._semanticSequencerExtensions.getGrammarConstraints(this._semanticSequencerExtensions.getSuperGrammar(this.getGrammar())); final Function1 _function = (IGrammarConstraintProvider.IConstraint it) -> { return Boolean.valueOf(((it.getType() != null) && (!superConstraints.contains(it)))); }; - Iterable _filter = IterableExtensions.filter(localConstraints, _function); - final Set newLocalConstraints = IterableExtensions.toSet(_filter); + final Set newLocalConstraints = IterableExtensions.toSet(IterableExtensions.filter(localConstraints, _function)); TypeReference _xifexpression = null; boolean _isGenerateStub = this.isGenerateStub(); if (_isGenerateStub) { - Grammar _grammar_2 = this.getGrammar(); - _xifexpression = this.getAbstractSemanticSequencerClass(_grammar_2); + _xifexpression = this.getAbstractSemanticSequencerClass(this.getGrammar()); } else { - Grammar _grammar_3 = this.getGrammar(); - _xifexpression = this.getSemanticSequencerClass(_grammar_3); + _xifexpression = this.getSemanticSequencerClass(this.getGrammar()); } final TypeReference clazz = _xifexpression; TypeReference _xifexpression_1 = null; @@ -516,10 +432,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { }; boolean _exists = IterableExtensions.exists(localConstraints, _function_1); if (_exists) { - Grammar _grammar_4 = this.getGrammar(); - EList _usedGrammars = _grammar_4.getUsedGrammars(); - Grammar _head = IterableExtensions.head(_usedGrammars); - _xifexpression_1 = this.getSemanticSequencerClass(_head); + _xifexpression_1 = this.getSemanticSequencerClass(IterableExtensions.head(this.getGrammar().getUsedGrammars())); } else { _xifexpression_1 = TypeReference.typeRef(AbstractDelegatingSemanticSequencer.class); } @@ -551,8 +464,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("private "); - Grammar _grammar = SerializerFragment2.this.getGrammar(); - TypeReference _grammarAccess = SerializerFragment2.this._grammarAccessExtensions.getGrammarAccess(_grammar); + TypeReference _grammarAccess = SerializerFragment2.this._grammarAccessExtensions.getGrammarAccess(SerializerFragment2.this.getGrammar()); _builder.append(_grammarAccess, "\t"); _builder.append(" grammarAccess;"); _builder.newLineIfNotEmpty(); @@ -601,61 +513,43 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { List _annotations = javaFile.getAnnotations(); SuppressWarningsAnnotation _suppressWarningsAnnotation = new SuppressWarningsAnnotation(); _annotations.add(_suppressWarningsAnnotation); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen = _runtime.getSrcGen(); - javaFile.writeTo(_srcGen); + javaFile.writeTo(this.getProjectConfig().getRuntime().getSrcGen()); } private Iterable getAccessedPackages() { - Grammar _grammar = this.getGrammar(); - Collection _grammarConstraints = this._semanticSequencerExtensions.getGrammarConstraints(_grammar); final Function1 _function = (IGrammarConstraintProvider.IConstraint it) -> { EClass _type = it.getType(); return Boolean.valueOf((_type != null)); }; - Iterable _filter = IterableExtensions.filter(_grammarConstraints, _function); final Function1 _function_1 = (IGrammarConstraintProvider.IConstraint it) -> { - EClass _type = it.getType(); - return _type.getEPackage(); + return it.getType().getEPackage(); }; - Iterable _map = IterableExtensions.map(_filter, _function_1); - Set _set = IterableExtensions.toSet(_map); final Function1 _function_2 = (EPackage it) -> { return it.getName(); }; - return IterableExtensions.sortBy(_set, _function_2); + return IterableExtensions.sortBy(IterableExtensions.toSet(IterableExtensions.map(IterableExtensions.filter(this._semanticSequencerExtensions.getGrammarConstraints(this.getGrammar()), _function), _function_1)), _function_2); } private Iterable getAccessedClasses(final EPackage pkg) { - Grammar _grammar = this.getGrammar(); - Collection _grammarConstraints = this._semanticSequencerExtensions.getGrammarConstraints(_grammar); final Function1 _function = (IGrammarConstraintProvider.IConstraint it) -> { return it.getType(); }; - Iterable _map = IterableExtensions.map(_grammarConstraints, _function); final Function1 _function_1 = (EClass it) -> { return Boolean.valueOf(((it != null) && Objects.equal(it.getEPackage(), pkg))); }; - Iterable _filter = IterableExtensions.filter(_map, _function_1); - Set _set = IterableExtensions.toSet(_filter); final Function1 _function_2 = (EClass it) -> { return it.getName(); }; - return IterableExtensions.sortBy(_set, _function_2); + return IterableExtensions.sortBy(IterableExtensions.toSet(IterableExtensions.filter(IterableExtensions.map(this._semanticSequencerExtensions.getGrammarConstraints(this.getGrammar()), _function), _function_1)), _function_2); } private StringConcatenationClient genMethodCreateSequence() { StringConcatenationClient _xblockexpression = null; { - Grammar _grammar = this.getGrammar(); - Grammar _superGrammar = this._semanticSequencerExtensions.getSuperGrammar(_grammar); - Collection _grammarConstraints = this._semanticSequencerExtensions.getGrammarConstraints(_superGrammar); final Function1> _function = (IGrammarConstraintProvider.IConstraint it) -> { return Pair.of(it, it); }; - Iterable> _map = IterableExtensions.>map(_grammarConstraints, _function); - final Map superConstraints = SerializerFragment2.toMap(_map); + final Map superConstraints = SerializerFragment2.toMap(IterableExtensions.>map(this._semanticSequencerExtensions.getGrammarConstraints(this._semanticSequencerExtensions.getSuperGrammar(this.getGrammar())), _function)); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -686,8 +580,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append("> parameters = context.getEnabledBooleanParameters();"); _builder.newLineIfNotEmpty(); { - Iterable _accessedPackages = SerializerFragment2.this.getAccessedPackages(); - Iterable> _indexed = IterableExtensions.indexed(_accessedPackages); + Iterable> _indexed = IterableExtensions.indexed(SerializerFragment2.this.getAccessedPackages()); for(final Pair pkg : _indexed) { _builder.append("\t"); { @@ -710,18 +603,15 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append("switch (semanticObject.eClass().getClassifierID()) {"); _builder.newLine(); { - EPackage _value_1 = pkg.getValue(); - Iterable _accessedClasses = SerializerFragment2.this.getAccessedClasses(_value_1); + Iterable _accessedClasses = SerializerFragment2.this.getAccessedClasses(pkg.getValue()); for(final EClass type : _accessedClasses) { _builder.append("\t"); _builder.append("\t"); _builder.append("case "); - EPackage _value_2 = pkg.getValue(); - _builder.append(_value_2, "\t\t"); + EPackage _value_1 = pkg.getValue(); + _builder.append(_value_1, "\t\t"); _builder.append("."); - IXtextGeneratorLanguage _language = SerializerFragment2.this.getLanguage(); - ResourceSet _resourceSet = _language.getResourceSet(); - String _intLiteral = GenModelUtil2.getIntLiteral(type, _resourceSet); + String _intLiteral = GenModelUtil2.getIntLiteral(type, SerializerFragment2.this.getLanguage().getResourceSet()); _builder.append(_intLiteral, "\t\t"); _builder.append(":"); _builder.newLineIfNotEmpty(); @@ -771,8 +661,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { String _gaAccessor = SerializerFragment2.this._grammarAccessExtensions.gaAccessor(it); return ("grammarAccess." + _gaAccessor); }; - Iterable _map = IterableExtensions.map(values, _function); - String _join = IterableExtensions.join(_map, ", "); + String _join = IterableExtensions.join(IterableExtensions.map(values, _function), ", "); _builder.append(_join); _builder.append(").equals(parameters)"); } @@ -780,13 +669,11 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _xifexpression = _client; } else { StringConcatenationClient _xifexpression_1 = null; - List _contexts = constraint.getContexts(); final Function1 _function = (ISerializationContext it) -> { - List _declaredParameters = ((SerializationContext) it).getDeclaredParameters(); - boolean _isEmpty_1 = _declaredParameters.isEmpty(); + boolean _isEmpty_1 = ((SerializationContext) it).getDeclaredParameters().isEmpty(); return Boolean.valueOf((!_isEmpty_1)); }; - boolean _exists = IterableExtensions.exists(_contexts, _function); + boolean _exists = IterableExtensions.exists(constraint.getContexts(), _function); if (_exists) { StringConcatenationClient _client_1 = new StringConcatenationClient() { @Override @@ -813,21 +700,15 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { private StringConcatenationClient genMethodCreateSequenceCaseBody(final Map superConstraints, final EClass type) { StringConcatenationClient _xblockexpression = null; { - Grammar _grammar = this.getGrammar(); - Map> _grammarConstraints = this._semanticSequencerExtensions.getGrammarConstraints(_grammar, type); - Set>> _entrySet = _grammarConstraints.entrySet(); final Function1>, String> _function = (Map.Entry> it) -> { - IGrammarConstraintProvider.IConstraint _key = it.getKey(); - return _key.getName(); + return it.getKey().getName(); }; - final List>> contexts = IterableExtensions.>, String>sortBy(_entrySet, _function); + final List>> contexts = IterableExtensions.>, String>sortBy(this._semanticSequencerExtensions.getGrammarConstraints(this.getGrammar(), type).entrySet(), _function); final LinkedHashMultimap context2constraint = LinkedHashMultimap.create(); for (final Map.Entry> e : contexts) { List _value = e.getValue(); for (final ISerializationContext ctx : _value) { - EObject _actionOrRule = ((SerializationContext) ctx).getActionOrRule(); - IGrammarConstraintProvider.IConstraint _key = e.getKey(); - context2constraint.put(_actionOrRule, _key); + context2constraint.put(((SerializationContext) ctx).getActionOrRule(), e.getKey()); } } StringConcatenationClient _client = new StringConcatenationClient() { @@ -888,8 +769,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { final List sorted = IterableExtensions.sort(contexts); final LinkedHashMultimap index = LinkedHashMultimap.create(); final Consumer _function = (ISerializationContext it) -> { - EObject _contextObject = this.getContextObject(it); - index.put(_contextObject, it); + index.put(this.getContextObject(it), it); }; sorted.forEach(_function); StringConcatenationClient _client = new StringConcatenationClient() { @@ -907,12 +787,10 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { StringConcatenationClient _genObjectSelector = SerializerFragment2.this.genObjectSelector(obj); _builder.append(_genObjectSelector); { - Collection _get = ctx2ctr.get(obj); - int _size = _get.size(); + int _size = ctx2ctr.get(obj).size(); boolean _greaterThan = (_size > 1); if (_greaterThan) { - Set _get_1 = index.get(obj); - StringConcatenationClient _genParameterSelector = SerializerFragment2.this.genParameterSelector(obj, _get_1, constraint); + StringConcatenationClient _genParameterSelector = SerializerFragment2.this.genParameterSelector(obj, index.get(obj), constraint); _builder.append(_genParameterSelector); } } @@ -1038,10 +916,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append("// Contexts:"); _builder.newLine(); _builder.append("// "); - List _contexts = c.getContexts(); - List _sort = IterableExtensions.sort(_contexts); - String _join = IterableExtensions.join(_sort, "\n"); - String _replaceAll = _join.replaceAll("\\n", "\n// "); + String _replaceAll = IterableExtensions.join(IterableExtensions.sort(c.getContexts()), "\n").replaceAll("\\n", "\n// "); _builder.append(_replaceAll); _builder.newLineIfNotEmpty(); _builder.append("//"); @@ -1054,14 +929,11 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { boolean _tripleEquals = (_body == null); if (_tripleEquals) { _builder.append("{"); - EClass _type = c.getType(); - String _name = _type.getName(); + String _name = c.getType().getName(); _builder.append(_name); _builder.append("}"); } else { - IGrammarConstraintProvider.IConstraintElement _body_1 = c.getBody(); - String _string = _body_1.toString(); - String _replaceAll_1 = _string.replaceAll("\\n", "\n// "); + String _replaceAll_1 = c.getBody().toString().replaceAll("\\n", "\n// "); _builder.append(_replaceAll_1); } } @@ -1074,8 +946,8 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append("("); _builder.append(ISerializationContext.class); _builder.append(" context, "); - EClass _type_1 = c.getType(); - _builder.append(_type_1); + EClass _type = c.getType(); + _builder.append(_type); _builder.append(" semanticObject) { }"); _builder.newLineIfNotEmpty(); } @@ -1086,12 +958,9 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { private StringConcatenationClient genMethodSequence(final IGrammarConstraintProvider.IConstraint c) { StringConcatenationClient _xblockexpression = null; { - IXtextGeneratorLanguage _language = this.getLanguage(); - final ResourceSet rs = _language.getResourceSet(); + final ResourceSet rs = this.getLanguage().getResourceSet(); StringConcatenationClient _xifexpression = null; - EClass _type = c.getType(); - GenClass _genClass = GenModelUtil2.getGenClass(_type, rs); - boolean _isEObjectExtension = _genClass.isEObjectExtension(); + boolean _isEObjectExtension = GenModelUtil2.getGenClass(c.getType(), rs).isEObjectExtension(); if (_isEObjectExtension) { StringConcatenationClient _client = new StringConcatenationClient() { @Override @@ -1122,10 +991,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append(" "); _builder.append("* "); - List _contexts = c.getContexts(); - List _sort = IterableExtensions.sort(_contexts); - String _join = IterableExtensions.join(_sort, "\n"); - String _replaceAll = _join.replaceAll("\\n", "\n* "); + String _replaceAll = IterableExtensions.join(IterableExtensions.sort(c.getContexts()), "\n").replaceAll("\\n", "\n* "); _builder.append(_replaceAll, " "); _builder.newLineIfNotEmpty(); _builder.append(" "); @@ -1141,14 +1007,11 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { boolean _tripleEquals = (_body == null); if (_tripleEquals) { _builder.append("{"); - EClass _type = c.getType(); - String _name = _type.getName(); + String _name = c.getType().getName(); _builder.append(_name, " "); _builder.append("}"); } else { - IGrammarConstraintProvider.IConstraintElement _body_1 = c.getBody(); - String _string = _body_1.toString(); - String _replaceAll_1 = _string.replaceAll("\\n", "\n* "); + String _replaceAll_1 = c.getBody().toString().replaceAll("\\n", "\n* "); _builder.append(_replaceAll_1, " "); } } @@ -1162,8 +1025,8 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append("("); _builder.append(ISerializationContext.class); _builder.append(" context, "); - EClass _type_1 = c.getType(); - _builder.append(_type_1); + EClass _type = c.getType(); + _builder.append(_type); _builder.append(" semanticObject) {"); _builder.newLineIfNotEmpty(); { @@ -1178,13 +1041,10 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append("if (transientValues.isValueTransient("); _builder.append(cast, "\t\t"); _builder.append("semanticObject, "); - EStructuralFeature _feature = s.getFeature(); - EClass _eContainingClass = _feature.getEContainingClass(); - EPackage _ePackage = _eContainingClass.getEPackage(); + EPackage _ePackage = s.getFeature().getEContainingClass().getEPackage(); _builder.append(_ePackage, "\t\t"); _builder.append("."); - EStructuralFeature _feature_1 = s.getFeature(); - String _featureLiteral = GenModelUtil2.getFeatureLiteral(_feature_1, rs); + String _featureLiteral = GenModelUtil2.getFeatureLiteral(s.getFeature(), rs); _builder.append(_featureLiteral, "\t\t"); _builder.append(") == "); _builder.append(ITransientValueService.ValueTransient.class, "\t\t"); @@ -1196,13 +1056,10 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append("errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing("); _builder.append(cast, "\t\t\t"); _builder.append("semanticObject, "); - EStructuralFeature _feature_2 = s.getFeature(); - EClass _eContainingClass_1 = _feature_2.getEContainingClass(); - EPackage _ePackage_1 = _eContainingClass_1.getEPackage(); + EPackage _ePackage_1 = s.getFeature().getEContainingClass().getEPackage(); _builder.append(_ePackage_1, "\t\t\t"); _builder.append("."); - EStructuralFeature _feature_3 = s.getFeature(); - String _featureLiteral_1 = GenModelUtil2.getFeatureLiteral(_feature_3, rs); + String _featureLiteral_1 = GenModelUtil2.getFeatureLiteral(s.getFeature(), rs); _builder.append(_featureLiteral_1, "\t\t\t"); _builder.append("));"); _builder.newLineIfNotEmpty(); @@ -1221,12 +1078,10 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { for(final ISemanticSequencerNfaProvider.ISemState f : states) { _builder.append("\t"); _builder.append("feeder.accept(grammarAccess."); - AbstractElement _assignedGrammarElement = f.getAssignedGrammarElement(); - String _gaAccessor = SerializerFragment2.this._grammarAccessExtensions.gaAccessor(_assignedGrammarElement); + String _gaAccessor = SerializerFragment2.this._grammarAccessExtensions.gaAccessor(f.getAssignedGrammarElement()); _builder.append(_gaAccessor, "\t"); _builder.append(", semanticObject."); - EStructuralFeature _feature_4 = f.getFeature(); - StringConcatenationClient _unresolvingGetAccessor = SerializerFragment2.this.getUnresolvingGetAccessor(_feature_4, rs); + StringConcatenationClient _unresolvingGetAccessor = SerializerFragment2.this.getUnresolvingGetAccessor(f.getFeature(), rs); _builder.append(_unresolvingGetAccessor, "\t"); _builder.append(");"); _builder.newLineIfNotEmpty(); @@ -1256,8 +1111,8 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append("("); _builder.append(EObject.class); _builder.append(" context, "); - EClass _type_2 = c.getType(); - _builder.append(_type_2); + EClass _type_1 = c.getType(); + _builder.append(_type_1); _builder.append(" semanticObject) {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -1285,8 +1140,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("eGet("); - GenPackage _genPackage = genFeature.getGenPackage(); - EPackage _ecorePackage = _genPackage.getEcorePackage(); + EPackage _ecorePackage = genFeature.getGenPackage().getEcorePackage(); _builder.append(_ecorePackage); _builder.append("."); String _featureLiteral = GenModelUtil2.getFeatureLiteral(genFeature, resourceSet); @@ -1312,11 +1166,9 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { TypeReference _xifexpression = null; boolean _isGenerateStub = this.isGenerateStub(); if (_isGenerateStub) { - Grammar _grammar = this.getGrammar(); - _xifexpression = this.getAbstractSyntacticSequencerClass(_grammar); + _xifexpression = this.getAbstractSyntacticSequencerClass(this.getGrammar()); } else { - Grammar _grammar_1 = this.getGrammar(); - _xifexpression = this.getSyntacticSequencerClass(_grammar_1); + _xifexpression = this.getSyntacticSequencerClass(this.getGrammar()); } final TypeReference clazz = _xifexpression; final GeneratedJavaFileAccess javaFile = this.fileAccessFactory.createGeneratedJavaFile(clazz); @@ -1341,8 +1193,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("protected "); - Grammar _grammar = SerializerFragment2.this.getGrammar(); - TypeReference _grammarAccess = SerializerFragment2.this._grammarAccessExtensions.getGrammarAccess(_grammar); + TypeReference _grammarAccess = SerializerFragment2.this._grammarAccessExtensions.getGrammarAccess(SerializerFragment2.this.getGrammar()); _builder.append(_grammarAccess, "\t"); _builder.append(" grammarAccess;"); _builder.newLineIfNotEmpty(); @@ -1373,8 +1224,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("grammarAccess = ("); - Grammar _grammar_1 = SerializerFragment2.this.getGrammar(); - TypeReference _grammarAccess_1 = SerializerFragment2.this._grammarAccessExtensions.getGrammarAccess(_grammar_1); + TypeReference _grammarAccess_1 = SerializerFragment2.this._grammarAccessExtensions.getGrammarAccess(SerializerFragment2.this.getGrammar()); _builder.append(_grammarAccess_1, "\t\t"); _builder.append(") access;"); _builder.newLineIfNotEmpty(); @@ -1386,8 +1236,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { String _identifier_1 = group_1.getIdentifier(); _builder.append(_identifier_1, "\t\t"); _builder.append(" = "); - GrammarAlias.AbstractElementAlias _elementAlias = group_1.getElementAlias(); - StringConcatenationClient _elementAliasToConstructor = SerializerFragment2.this._syntacticSequencerExtensions.elementAliasToConstructor(_elementAlias); + StringConcatenationClient _elementAliasToConstructor = SerializerFragment2.this._syntacticSequencerExtensions.elementAliasToConstructor(group_1.getElementAlias()); _builder.append(_elementAliasToConstructor, "\t\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -1439,9 +1288,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append("\t"); _builder.append(" "); _builder.append("* "); - GrammarAlias.AbstractElementAlias _elementAlias_1 = group_2.getElementAlias(); - String _string = _elementAlias_1.toString(); - String _replace = _string.replace("\n", "\n * "); + String _replace = group_2.getElementAlias().toString().replace("\n", "\n * "); _builder.append(_replace, "\t "); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -1453,20 +1300,15 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append("* This ambiguous syntax occurs at:"); _builder.newLine(); { - List _transitions = group_2.getTransitions(); final Function1 _function = (ISyntacticSequencerPDAProvider.ISynTransition it) -> { - String _ambiguityInsideTransition = group_2.ambiguityInsideTransition(it); - return _ambiguityInsideTransition.trim(); + return group_2.ambiguityInsideTransition(it).trim(); }; - List _map = ListExtensions.map(_transitions, _function); - Set _set = IterableExtensions.toSet(_map); - List _sort = IterableExtensions.sort(_set); + List _sort = IterableExtensions.sort(IterableExtensions.toSet(ListExtensions.map(group_2.getTransitions(), _function))); for(final String trans : _sort) { _builder.append("\t"); _builder.append(" "); _builder.append("* "); - String _string_1 = trans.toString(); - String _replace_1 = _string_1.replace("\n", "\n* "); + String _replace_1 = trans.toString().replace("\n", "\n* "); _builder.append(_replace_1, "\t "); _builder.newLineIfNotEmpty(); } @@ -1508,37 +1350,28 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { List _annotations = javaFile.getAnnotations(); SuppressWarningsAnnotation _suppressWarningsAnnotation = new SuppressWarningsAnnotation(); _annotations.add(_suppressWarningsAnnotation); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen = _runtime.getSrcGen(); - javaFile.writeTo(_srcGen); + javaFile.writeTo(this.getProjectConfig().getRuntime().getSrcGen()); } private List unassignedCalledTokenRules() { - Grammar _grammar = this.getGrammar(); - List _allRules = GrammarUtil.allRules(_grammar); final Function1 _function = (AbstractRule it) -> { return Boolean.valueOf(GrammarUtil.isEObjectRule(it)); }; - final Iterable rules = IterableExtensions.filter(_allRules, _function); + final Iterable rules = IterableExtensions.filter(GrammarUtil.allRules(this.getGrammar()), _function); final Function1> _function_1 = (AbstractRule it) -> { - List _containedRuleCalls = GrammarUtil.containedRuleCalls(it); final Function1 _function_2 = (RuleCall it_1) -> { return Boolean.valueOf(this.isUnassignedRuleCall(it_1)); }; - return IterableExtensions.filter(_containedRuleCalls, _function_2); + return IterableExtensions.filter(GrammarUtil.containedRuleCalls(it), _function_2); }; - Iterable> _map = IterableExtensions.>map(rules, _function_1); - final Iterable calls = Iterables.concat(_map); + final Iterable calls = Iterables.concat(IterableExtensions.>map(rules, _function_1)); final Function1 _function_2 = (RuleCall it) -> { return it.getRule(); }; - Iterable _map_1 = IterableExtensions.map(calls, _function_2); - Set _set = IterableExtensions.toSet(_map_1); final Function1 _function_3 = (AbstractRule it) -> { return it.getName(); }; - return IterableExtensions.sortBy(_set, _function_3); + return IterableExtensions.sortBy(IterableExtensions.toSet(IterableExtensions.map(calls, _function_2)), _function_3); } private boolean isUnassignedRuleCall(final RuleCall c) { @@ -1569,20 +1402,16 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { if (!_matched) { if (ele instanceof Alternatives) { _matched=true; - EList _elements = ((Alternatives)ele).getElements(); - AbstractElement _head = IterableExtensions.head(_elements); - _switchResult = this.defaultValue(_head, visited); + _switchResult = this.defaultValue(IterableExtensions.head(((Alternatives)ele).getElements()), visited); } } if (!_matched) { if (ele instanceof Group) { _matched=true; - EList _elements = ((Group)ele).getElements(); final Function1 _function = (AbstractElement it) -> { return this.defaultValue(it, visited); }; - List _map = ListExtensions.map(_elements, _function); - _switchResult = IterableExtensions.join(_map); + _switchResult = IterableExtensions.join(ListExtensions.map(((Group)ele).getElements(), _function)); } } if (!_matched) { @@ -1594,9 +1423,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { if (!_matched) { if (ele instanceof RuleCall) { _matched=true; - AbstractRule _rule = ((RuleCall)ele).getRule(); - AbstractElement _alternatives = _rule.getAlternatives(); - _switchResult = this.defaultValue(_alternatives, visited); + _switchResult = this.defaultValue(((RuleCall)ele).getRule().getAlternatives(), visited); } } if (!_matched) { @@ -1620,8 +1447,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append(" node) {"); _builder.newLineIfNotEmpty(); { - List _unassignedCalledTokenRules = SerializerFragment2.this.unassignedCalledTokenRules(); - Iterable> _indexed = IterableExtensions.indexed(_unassignedCalledTokenRules); + Iterable> _indexed = IterableExtensions.indexed(SerializerFragment2.this.unassignedCalledTokenRules()); for(final Pair rule : _indexed) { _builder.append("\t"); { @@ -1632,16 +1458,14 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { } } _builder.append("if (ruleCall.getRule() == grammarAccess."); - AbstractRule _value = rule.getValue(); - String _gaAccessor = SerializerFragment2.this._grammarAccessExtensions.gaAccessor(_value); + String _gaAccessor = SerializerFragment2.this._grammarAccessExtensions.gaAccessor(rule.getValue()); _builder.append(_gaAccessor, "\t"); _builder.append(")"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("\t"); _builder.append("return "); - AbstractRule _value_1 = rule.getValue(); - CharSequence _unassignedCalledTokenRuleName = SerializerFragment2.this.unassignedCalledTokenRuleName(_value_1); + CharSequence _unassignedCalledTokenRuleName = SerializerFragment2.this.unassignedCalledTokenRuleName(rule.getValue()); _builder.append(_unassignedCalledTokenRuleName, "\t\t"); _builder.append("(semanticObject, ruleCall, node);"); _builder.newLineIfNotEmpty(); @@ -1669,12 +1493,10 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { if (!_matched) { if (node instanceof ICompositeNode) { _matched=true; - BidiIterable _children = ((ICompositeNode)node).getChildren(); final Function1 _function = (INode it) -> { return this.textWithoutComments(it); }; - Iterable _map = IterableExtensions.map(_children, _function); - _switchResult = IterableExtensions.join(_map); + _switchResult = IterableExtensions.join(IterableExtensions.map(((ICompositeNode)node).getChildren(), _function)); } } if (!_matched) { @@ -1743,12 +1565,8 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append(" "); _builder.append("* "); - ICompositeNode _node = NodeModelUtils.getNode(rule); - String _textWithoutComments = SerializerFragment2.this.textWithoutComments(_node); - String _trim = _textWithoutComments.trim(); - String _replace = _trim.replace("\n", "\n* "); - String _replace_1 = _replace.replace("*/", "*/"); - _builder.append(_replace_1, " "); + String _replace = SerializerFragment2.this.textWithoutComments(NodeModelUtils.getNode(rule)).trim().replace("\n", "\n* ").replace("*/", "*/"); + _builder.append(_replace, " "); _builder.newLineIfNotEmpty(); _builder.append(" "); _builder.append("*/"); @@ -1772,10 +1590,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); _builder.append("\t"); _builder.append("return \""); - AbstractElement _alternatives = rule.getAlternatives(); - HashSet _newHashSet = CollectionLiterals.newHashSet(); - String _defaultValue = SerializerFragment2.this.defaultValue(_alternatives, _newHashSet); - String _convertToJavaString = Strings.convertToJavaString(_defaultValue); + String _convertToJavaString = Strings.convertToJavaString(SerializerFragment2.this.defaultValue(rule.getAlternatives(), CollectionLiterals.newHashSet())); _builder.append(_convertToJavaString, "\t"); _builder.append("\";"); _builder.newLineIfNotEmpty(); @@ -1823,8 +1638,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.append("> syntaxNodes = getNodesFor(transitionNodes, syntax);"); _builder.newLineIfNotEmpty(); { - List _allAmbiguousTransitionsBySyntax = SerializerFragment2.this._syntacticSequencerExtensions.getAllAmbiguousTransitionsBySyntax(); - Iterable> _indexed = IterableExtensions.indexed(_allAmbiguousTransitionsBySyntax); + Iterable> _indexed = IterableExtensions.indexed(SerializerFragment2.this._syntacticSequencerExtensions.getAllAmbiguousTransitionsBySyntax()); for(final Pair group : _indexed) { _builder.append("\t\t"); { @@ -1835,16 +1649,14 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { } } _builder.append("if (match_"); - EqualAmbiguousTransitions _value = group.getValue(); - String _identifier = _value.getIdentifier(); + String _identifier = group.getValue().getIdentifier(); _builder.append(_identifier, "\t\t"); _builder.append(".equals(syntax))"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("\t"); _builder.append("emit_"); - EqualAmbiguousTransitions _value_1 = group.getValue(); - String _identifier_1 = _value_1.getIdentifier(); + String _identifier_1 = group.getValue().getIdentifier(); _builder.append(_identifier_1, "\t\t\t"); _builder.append("(semanticObject, getLastNavigableState(), syntaxNodes);"); _builder.newLineIfNotEmpty(); @@ -1852,8 +1664,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { } _builder.append("\t\t"); { - List _allAmbiguousTransitionsBySyntax_1 = SerializerFragment2.this._syntacticSequencerExtensions.getAllAmbiguousTransitionsBySyntax(); - boolean _isEmpty = _allAmbiguousTransitionsBySyntax_1.isEmpty(); + boolean _isEmpty = SerializerFragment2.this._syntacticSequencerExtensions.getAllAmbiguousTransitionsBySyntax().isEmpty(); boolean _not = (!_isEmpty); if (_not) { _builder.append("else "); @@ -1872,16 +1683,12 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { } protected void generateGrammarConstraints() { - Grammar _grammar = this.getGrammar(); - String _grammarConstraintsPath = this.getGrammarConstraintsPath(_grammar); + String _grammarConstraintsPath = this.getGrammarConstraintsPath(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { { - Grammar _grammar = SerializerFragment2.this.getGrammar(); - SerializationContextMap _constraints = SerializerFragment2.this._iGrammarConstraintProvider.getConstraints(_grammar); - SerializationContextMap _sortedCopy = _constraints.sortedCopy(); - List> _values = _sortedCopy.values(); + List> _values = SerializerFragment2.this._iGrammarConstraintProvider.getConstraints(SerializerFragment2.this.getGrammar()).sortedCopy().values(); boolean _hasElements = false; for(final SerializationContextMap.Entry e : _values) { if (!_hasElements) { @@ -1889,20 +1696,17 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { } else { _builder.appendImmediate("\n", ""); } - List _contexts = e.getContexts(); - String _join = IterableExtensions.join(_contexts, ", "); + String _join = IterableExtensions.join(e.getContexts(), ", "); _builder.append(_join); _builder.append(":"); _builder.newLineIfNotEmpty(); { - IGrammarConstraintProvider.IConstraint _value = e.getValue(); - IGrammarConstraintProvider.IConstraintElement _body = _value.getBody(); + IGrammarConstraintProvider.IConstraintElement _body = e.getValue().getBody(); boolean _tripleEquals = (_body == null); if (_tripleEquals) { _builder.append("\t"); _builder.append("{"); - IGrammarConstraintProvider.IConstraint _value_1 = e.getValue(); - EClass _type = _value_1.getType(); + EClass _type = e.getValue().getType(); String _name = null; if (_type!=null) { _name=_type.getName(); @@ -1912,8 +1716,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); } else { _builder.append("\t"); - IGrammarConstraintProvider.IConstraint _value_2 = e.getValue(); - IGrammarConstraintProvider.IConstraintElement _body_1 = _value_2.getBody(); + IGrammarConstraintProvider.IConstraintElement _body_1 = e.getValue().getBody(); _builder.append(_body_1, "\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -1923,11 +1726,7 @@ public class SerializerFragment2 extends AbstractStubGeneratingFragment { } } }; - TextFileAccess _createTextFile = this.fileAccessFactory.createTextFile(_grammarConstraintsPath, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen = _runtime.getSrcGen(); - _createTextFile.writeTo(_srcGen); + this.fileAccessFactory.createTextFile(_grammarConstraintsPath, _client).writeTo(this.getProjectConfig().getRuntime().getSrcGen()); } private final static Logger LOG = Logger.getLogger(SerializerFragment2.class); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SyntacticSequencerExtensions.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SyntacticSequencerExtensions.java index ed016938b..72a669c97 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SyntacticSequencerExtensions.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/serializer/SyntacticSequencerExtensions.java @@ -8,16 +8,11 @@ package org.eclipse.xtext.xtext.generator.serializer; import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtend2.lib.StringConcatenationClient; -import org.eclipse.xtext.AbstractElement; -import org.eclipse.xtext.AbstractRule; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.serializer.analysis.GrammarAlias; @@ -51,13 +46,10 @@ public class SyntacticSequencerExtensions { private List ambiguousTransitions; protected List getAllPDAs() { - SerializationContextMap _syntacticSequencerPDAs = this.pdaProvider.getSyntacticSequencerPDAs(this.grammar); - List> _values = _syntacticSequencerPDAs.values(); final Function1, ISyntacticSequencerPDAProvider.ISynAbsorberState> _function = (SerializationContextMap.Entry it) -> { return it.getValue(); }; - List _map = ListExtensions., ISyntacticSequencerPDAProvider.ISynAbsorberState>map(_values, _function); - return CollectionLiterals.newArrayList(((ISyntacticSequencerPDAProvider.ISynAbsorberState[])Conversions.unwrapArray(_map, ISyntacticSequencerPDAProvider.ISynAbsorberState.class))); + return CollectionLiterals.newArrayList(((ISyntacticSequencerPDAProvider.ISynAbsorberState[])Conversions.unwrapArray(ListExtensions., ISyntacticSequencerPDAProvider.ISynAbsorberState>map(this.pdaProvider.getSyntacticSequencerPDAs(this.grammar).values(), _function), ISyntacticSequencerPDAProvider.ISynAbsorberState.class))); } protected void collectAllAmbiguousTransitions(final ISyntacticSequencerPDAProvider.ISynFollowerOwner state, final Set result, final Set visited) { @@ -86,8 +78,7 @@ public class SyntacticSequencerExtensions { final Set result = CollectionLiterals.newLinkedHashSet(); List _allPDAs = this.getAllPDAs(); for (final ISyntacticSequencerPDAProvider.ISynAbsorberState start : _allPDAs) { - HashSet _newHashSet = CollectionLiterals.newHashSet(); - this.collectAllAmbiguousTransitions(start, result, _newHashSet); + this.collectAllAmbiguousTransitions(start, result, CollectionLiterals.newHashSet()); } return result; } @@ -109,14 +100,11 @@ public class SyntacticSequencerExtensions { list = _equalAmbiguousTransitions; result.put(syntax, list); } - List _transitions = list.getTransitions(); - _transitions.add(transition); + list.getTransitions().add(transition); } } } - Collection _values = result.values(); - ArrayList _newArrayList = CollectionLiterals.newArrayList(((EqualAmbiguousTransitions[])Conversions.unwrapArray(_values, EqualAmbiguousTransitions.class))); - this.ambiguousTransitions = _newArrayList; + this.ambiguousTransitions = CollectionLiterals.newArrayList(((EqualAmbiguousTransitions[])Conversions.unwrapArray(result.values(), EqualAmbiguousTransitions.class))); ListExtensions.sortInplace(this.ambiguousTransitions); return this.ambiguousTransitions; } @@ -142,10 +130,7 @@ public class SyntacticSequencerExtensions { } String card = _xifexpression; if ((alias instanceof GrammarAlias.TokenAlias)) { - AbstractElement _token = ((GrammarAlias.TokenAlias)alias).getToken(); - AbstractRule _containingRule = GrammarUtil.containingRule(_token); - String _uniqueRuleName = this.ruleNames.getUniqueRuleName(_containingRule); - rules.add(_uniqueRuleName); + rules.add(this.ruleNames.getUniqueRuleName(GrammarUtil.containingRule(((GrammarAlias.TokenAlias)alias).getToken()))); String _xifexpression_3 = null; if ((card == null)) { _xifexpression_3 = ""; @@ -153,16 +138,14 @@ public class SyntacticSequencerExtensions { _xifexpression_3 = ("_" + card); } card = _xifexpression_3; - AbstractElement _token_1 = ((GrammarAlias.TokenAlias)alias).getToken(); - String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(_token_1); + String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(((GrammarAlias.TokenAlias)alias).getToken()); return (_gaElementIdentifier + card); } else { if ((alias instanceof GrammarAlias.GroupAlias)) { final List children = CollectionLiterals.newArrayList(); List _children = ((GrammarAlias.GroupAlias)alias).getChildren(); for (final GrammarAlias.AbstractElementAlias child : _children) { - String _elementAliasToIdentifier = this.elementAliasToIdentifier(child, rules, true); - children.add(_elementAliasToIdentifier); + children.add(this.elementAliasToIdentifier(child, rules, true)); } final String body = IterableExtensions.join(children, "_"); if ((isNested || (card != null))) { @@ -182,8 +165,7 @@ public class SyntacticSequencerExtensions { final List children_1 = CollectionLiterals.newArrayList(); Set _children_1 = ((GrammarAlias.AlternativeAlias)alias).getChildren(); for (final GrammarAlias.AbstractElementAlias child_1 : _children_1) { - String _elementAliasToIdentifier_1 = this.elementAliasToIdentifier(child_1, rules, true); - children_1.add(_elementAliasToIdentifier_1); + children_1.add(this.elementAliasToIdentifier(child_1, rules, true)); } ListExtensions.sortInplace(children_1); final String body_1 = IterableExtensions.join(children_1, "_or_"); @@ -206,10 +188,8 @@ public class SyntacticSequencerExtensions { } public StringConcatenationClient elementAliasToConstructor(final GrammarAlias.AbstractElementAlias alias) { - boolean _isMany = alias.isMany(); - final String many = String.valueOf(_isMany); - boolean _isOptional = alias.isOptional(); - final String optional = String.valueOf(_isOptional); + final String many = String.valueOf(alias.isMany()); + final String optional = String.valueOf(alias.isOptional()); if ((alias instanceof GrammarAlias.TokenAlias)) { StringConcatenationClient _client = new StringConcatenationClient() { @Override @@ -221,8 +201,7 @@ public class SyntacticSequencerExtensions { _builder.append(", "); _builder.append(optional); _builder.append(", grammarAccess."); - AbstractElement _token = ((GrammarAlias.TokenAlias)alias).getToken(); - String _gaAccessor = SyntacticSequencerExtensions.this._grammarAccessExtensions.gaAccessor(_token); + String _gaAccessor = SyntacticSequencerExtensions.this._grammarAccessExtensions.gaAccessor(((GrammarAlias.TokenAlias)alias).getToken()); _builder.append(_gaAccessor); _builder.append(")"); } @@ -233,8 +212,7 @@ public class SyntacticSequencerExtensions { final List children = CollectionLiterals.newArrayList(); List _children = ((GrammarAlias.GroupAlias)alias).getChildren(); for (final GrammarAlias.AbstractElementAlias child : _children) { - StringConcatenationClient _elementAliasToConstructor = this.elementAliasToConstructor(child); - children.add(_elementAliasToConstructor); + children.add(this.elementAliasToConstructor(child)); } StringConcatenationClient _client_1 = new StringConcatenationClient() { @Override @@ -266,8 +244,7 @@ public class SyntacticSequencerExtensions { final List children_1 = CollectionLiterals.newArrayList(); Set _children_1 = ((GrammarAlias.AlternativeAlias)alias).getChildren(); for (final GrammarAlias.AbstractElementAlias child_1 : _children_1) { - StringConcatenationClient _elementAliasToConstructor_1 = this.elementAliasToConstructor(child_1); - children_1.add(_elementAliasToConstructor_1); + children_1.add(this.elementAliasToConstructor(child_1)); } final Function1 _function = (StringConcatenationClient it) -> { StringConcatenation _builder = new StringConcatenation(); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/types/TypesGeneratorFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/types/TypesGeneratorFragment2.java index 6692cc3e2..af6a58127 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/types/TypesGeneratorFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/types/TypesGeneratorFragment2.java @@ -8,20 +8,15 @@ package org.eclipse.xtext.xtext.generator.types; import com.google.inject.Inject; -import java.util.Set; import org.eclipse.xtend.lib.annotations.AccessorType; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtext.scoping.IGlobalScopeProvider; import org.eclipse.xtext.xbase.lib.CollectionExtensions; import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.util.BooleanGeneratorOption; import org.eclipse.xtext.xtext.generator.xbase.XbaseUsageDetector; @@ -42,61 +37,31 @@ public class TypesGeneratorFragment2 extends AbstractXtextGeneratorFragment { if ((this.onlyEnabledIfGrammarIsUsed.get() && (!this.xbaseUsageDetector.inheritsXtype(this.getLanguage().getGrammar())))) { return; } - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef(IGlobalScopeProvider.class); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider"); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeRef, _typeRef_1); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language.getRuntimeGenModule(); - _addTypeToType.contributeTo(_runtimeGenModule); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule_1 = _language_1.getRuntimeGenModule(); - _runtimeGenModule_1.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.common.types.DefaultCommonTypesRuntimeModule")); - GuiceModuleAccess.BindingFactory _bindingFactory_1 = new GuiceModuleAccess.BindingFactory(); - 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(); - _eclipsePluginGenModule_1.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.common.types.ui.DefaultCommonTypesUiModule")); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - ManifestAccess _manifest = _runtime.getManifest(); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IGlobalScopeProvider.class), + TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider")).contributeTo(this.getLanguage().getRuntimeGenModule()); + GuiceModuleAccess _runtimeGenModule = this.getLanguage().getRuntimeGenModule(); + _runtimeGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.common.types.DefaultCommonTypesRuntimeModule")); + new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.PrefixMatcher"), + TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.FQNPrefixMatcher")).contributeTo(this.getLanguage().getEclipsePluginGenModule()); + GuiceModuleAccess _eclipsePluginGenModule = this.getLanguage().getEclipsePluginGenModule(); + _eclipsePluginGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.common.types.ui.DefaultCommonTypesUiModule")); + ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - ManifestAccess _manifest_1 = _runtime_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); - CollectionExtensions.addAll(_requiredBundles, + CollectionExtensions.addAll(this.getProjectConfig().getRuntime().getManifest().getRequiredBundles(), "org.eclipse.xtext.common.types", "org.objectweb.asm;bundle-version=\"[5.0.1,6.0.0)\";resolution:=optional"); } - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IBundleProjectConfig _runtimeTest = _projectConfig_2.getRuntimeTest(); - ManifestAccess _manifest_2 = _runtimeTest.getManifest(); - boolean _tripleNotEquals_1 = (_manifest_2 != null); + ManifestAccess _manifest_1 = this.getProjectConfig().getRuntimeTest().getManifest(); + boolean _tripleNotEquals_1 = (_manifest_1 != null); if (_tripleNotEquals_1) { - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IBundleProjectConfig _runtimeTest_1 = _projectConfig_3.getRuntimeTest(); - ManifestAccess _manifest_3 = _runtimeTest_1.getManifest(); - Set _requiredBundles_1 = _manifest_3.getRequiredBundles(); - _requiredBundles_1.add( + this.getProjectConfig().getRuntimeTest().getManifest().getRequiredBundles().add( "org.objectweb.asm;bundle-version=\"[5.0.1,6.0.0)\";resolution:=optional"); } - IXtextProjectConfig _projectConfig_4 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig_4.getEclipsePlugin(); - ManifestAccess _manifest_4 = _eclipsePlugin.getManifest(); - boolean _tripleNotEquals_2 = (_manifest_4 != null); + ManifestAccess _manifest_2 = this.getProjectConfig().getEclipsePlugin().getManifest(); + boolean _tripleNotEquals_2 = (_manifest_2 != null); if (_tripleNotEquals_2) { - IXtextProjectConfig _projectConfig_5 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_5.getEclipsePlugin(); - ManifestAccess _manifest_5 = _eclipsePlugin_1.getManifest(); - Set _requiredBundles_2 = _manifest_5.getRequiredBundles(); - _requiredBundles_2.add( + this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles().add( "org.eclipse.xtext.common.types.ui"); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/compare/CompareFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/compare/CompareFragment2.java index 42397125a..84b2fdf79 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/compare/CompareFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/compare/CompareFragment2.java @@ -13,20 +13,17 @@ import java.util.Collections; import java.util.List; import java.util.Set; import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; /** * Contributes the registration of compare infrastructure. @@ -41,61 +38,46 @@ public class CompareFragment2 extends AbstractXtextGeneratorFragment { @Override public void generate() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); + IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin(); ManifestAccess _manifest = null; if (_eclipsePlugin!=null) { _manifest=_eclipsePlugin.getManifest(); } boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_1.getEclipsePlugin(); - ManifestAccess _manifest_1 = _eclipsePlugin_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); + Set _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); Iterables.addAll(_requiredBundles, Collections.unmodifiableList(CollectionLiterals.newArrayList("org.eclipse.compare", "org.eclipse.xtext.ui"))); } GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); TypeReference _typeReference = new TypeReference("org.eclipse.compare.IViewerCreator"); TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.ui.compare.DefaultViewerCreator"); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeReference, _typeReference_1); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule(); - _addTypeToType.contributeTo(_eclipsePluginGenModule); - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_2 = _projectConfig_2.getEclipsePlugin(); + _bindingFactory.addTypeToType(_typeReference, _typeReference_1).contributeTo(this.getLanguage().getEclipsePluginGenModule()); + IBundleProjectConfig _eclipsePlugin_1 = this.getProjectConfig().getEclipsePlugin(); PluginXmlAccess _pluginXml = null; - if (_eclipsePlugin_2!=null) { - _pluginXml=_eclipsePlugin_2.getPluginXml(); + if (_eclipsePlugin_1!=null) { + _pluginXml=_eclipsePlugin_1.getPluginXml(); } boolean _tripleNotEquals_1 = (_pluginXml != null); if (_tripleNotEquals_1) { - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_3 = _projectConfig_3.getEclipsePlugin(); - PluginXmlAccess _pluginXml_1 = _eclipsePlugin_3.getPluginXml(); - List _entries = _pluginXml_1.getEntries(); + List _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); StringConcatenation _builder = new StringConcatenation(); _builder.append(""); _builder.newLine(); _builder.append("\t"); _builder.append(" _fileExtensions = _language_1.getFileExtensions(); - String _join = IterableExtensions.join(_fileExtensions, ","); + String _join = IterableExtensions.join(this.getLanguage().getFileExtensions(), ","); _builder.append(_join, "\t\t"); _builder.append("\">"); _builder.newLineIfNotEmpty(); @@ -108,27 +90,22 @@ public class CompareFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); _builder.append("\t"); _builder.append(" _fileExtensions_1 = _language_2.getFileExtensions(); - String _join_1 = IterableExtensions.join(_fileExtensions_1, ","); + String _join_1 = IterableExtensions.join(this.getLanguage().getFileExtensions(), ","); _builder.append(_join_1, "\t\t"); _builder.append("\" label=\""); - Grammar _grammar_4 = this.getGrammar(); - String _simpleName = GrammarUtil.getSimpleName(_grammar_4); + String _simpleName = GrammarUtil.getSimpleName(this.getGrammar()); _builder.append(_simpleName, "\t\t"); _builder.append(" Compare\">"); _builder.newLineIfNotEmpty(); @@ -141,23 +118,19 @@ public class CompareFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); _builder.append("\t"); _builder.append(" _fileExtensions_2 = _language_3.getFileExtensions(); - String _join_2 = IterableExtensions.join(_fileExtensions_2, ","); + String _join_2 = IterableExtensions.join(this.getLanguage().getFileExtensions(), ","); _builder.append(_join_2, "\t\t"); _builder.append("\">"); _builder.newLineIfNotEmpty(); @@ -169,9 +142,8 @@ public class CompareFragment2 extends AbstractXtextGeneratorFragment { _builder.append(""); _builder.newLine(); { - IXtextGeneratorLanguage _language_4 = this.getLanguage(); - List _fileExtensions_3 = _language_4.getFileExtensions(); - for(final String modelFileExtension : _fileExtensions_3) { + List _fileExtensions = this.getLanguage().getFileExtensions(); + for(final String modelFileExtension : _fileExtensions) { _builder.append("\t"); _builder.append(" _usedGrammars = g.getUsedGrammars(); - final Grammar superGrammar = IterableExtensions.head(_usedGrammars); + final Grammar superGrammar = IterableExtensions.head(g.getUsedGrammars()); TypeReference _xifexpression = null; if ((this.isInheritImplementation() && (superGrammar != null))) { _xifexpression = this.getProposalProviderClass(superGrammar); @@ -112,28 +104,17 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { @Override public void generate() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - ManifestAccess _manifest = _eclipsePlugin.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_1.getEclipsePlugin(); - ManifestAccess _manifest_1 = _eclipsePlugin_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); + Set _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); _requiredBundles.add("org.eclipse.xtext.ui"); } GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.editor.contentassist.IContentProposalProvider"); - Grammar _grammar = this.getGrammar(); - TypeReference _proposalProviderClass = this.getProposalProviderClass(_grammar); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeReference, _proposalProviderClass); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule(); - _addTypeToType.contributeTo(_eclipsePluginGenModule); - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_2 = _projectConfig_2.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _srcGen = _eclipsePlugin_2.getSrcGen(); + _bindingFactory.addTypeToType(_typeReference, + this.getProposalProviderClass(this.getGrammar())).contributeTo(this.getLanguage().getEclipsePluginGenModule()); + IXtextGeneratorFileSystemAccess _srcGen = this.getProjectConfig().getEclipsePlugin().getSrcGen(); boolean _tripleNotEquals_1 = (_srcGen != null); if (_tripleNotEquals_1) { this.generateGenJavaProposalProvider(); @@ -142,45 +123,29 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { boolean _isGenerateXtendStub = this.isGenerateXtendStub(); if (_isGenerateXtendStub) { this.generateXtendProposalProviderStub(); - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_3 = _projectConfig_3.getEclipsePlugin(); - ManifestAccess _manifest_2 = _eclipsePlugin_3.getManifest(); - boolean _tripleNotEquals_2 = (_manifest_2 != null); + ManifestAccess _manifest_1 = this.getProjectConfig().getEclipsePlugin().getManifest(); + boolean _tripleNotEquals_2 = (_manifest_1 != null); if (_tripleNotEquals_2) { - IXtextProjectConfig _projectConfig_4 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_4 = _projectConfig_4.getEclipsePlugin(); - ManifestAccess _manifest_3 = _eclipsePlugin_4.getManifest(); - Set _requiredBundles_1 = _manifest_3.getRequiredBundles(); + Set _requiredBundles_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); _requiredBundles_1.add("org.eclipse.xtext.xbase.lib"); - IXtextProjectConfig _projectConfig_5 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_5 = _projectConfig_5.getEclipsePlugin(); - ManifestAccess _manifest_4 = _eclipsePlugin_5.getManifest(); - Set _requiredBundles_2 = _manifest_4.getRequiredBundles(); + Set _requiredBundles_2 = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); _requiredBundles_2.add("org.eclipse.xtend.lib;resolution:=optional"); } } else { this.generateJavaProposalProviderStub(); } } - IXtextProjectConfig _projectConfig_6 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_6 = _projectConfig_6.getEclipsePlugin(); - ManifestAccess _manifest_5 = _eclipsePlugin_6.getManifest(); - boolean _tripleNotEquals_3 = (_manifest_5 != null); + ManifestAccess _manifest_2 = this.getProjectConfig().getEclipsePlugin().getManifest(); + boolean _tripleNotEquals_3 = (_manifest_2 != null); if (_tripleNotEquals_3) { - IXtextProjectConfig _projectConfig_7 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_7 = _projectConfig_7.getEclipsePlugin(); - ManifestAccess _manifest_6 = _eclipsePlugin_7.getManifest(); - Set _exportedPackages = _manifest_6.getExportedPackages(); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _proposalProviderClass_1 = this.getProposalProviderClass(_grammar_1); - String _packageName = _proposalProviderClass_1.getPackageName(); + Set _exportedPackages = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages(); + String _packageName = this.getProposalProviderClass(this.getGrammar()).getPackageName(); _exportedPackages.add(_packageName); } } public void generateXtendProposalProviderStub() { - Grammar _grammar = this.getGrammar(); - TypeReference _proposalProviderClass = this.getProposalProviderClass(_grammar); + TypeReference _proposalProviderClass = this.getProposalProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -196,13 +161,10 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - Grammar _grammar = ContentAssistFragment2.this.getGrammar(); - TypeReference _proposalProviderClass = ContentAssistFragment2.this.getProposalProviderClass(_grammar); - String _simpleName = _proposalProviderClass.getSimpleName(); + String _simpleName = ContentAssistFragment2.this.getProposalProviderClass(ContentAssistFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = ContentAssistFragment2.this.getGrammar(); - TypeReference _genProposalProviderClass = ContentAssistFragment2.this.getGenProposalProviderClass(_grammar_1); + TypeReference _genProposalProviderClass = ContentAssistFragment2.this.getGenProposalProviderClass(ContentAssistFragment2.this.getGrammar()); _builder.append(_genProposalProviderClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -210,16 +172,11 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_proposalProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src = _eclipsePlugin.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_proposalProviderClass, _client).writeTo(this.getProjectConfig().getEclipsePlugin().getSrc()); } protected void generateJavaProposalProviderStub() { - Grammar _grammar = this.getGrammar(); - TypeReference _proposalProviderClass = this.getProposalProviderClass(_grammar); + TypeReference _proposalProviderClass = this.getProposalProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -235,13 +192,10 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - Grammar _grammar = ContentAssistFragment2.this.getGrammar(); - TypeReference _proposalProviderClass = ContentAssistFragment2.this.getProposalProviderClass(_grammar); - String _simpleName = _proposalProviderClass.getSimpleName(); + String _simpleName = ContentAssistFragment2.this.getProposalProviderClass(ContentAssistFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = ContentAssistFragment2.this.getGrammar(); - TypeReference _genProposalProviderClass = ContentAssistFragment2.this.getGenProposalProviderClass(_grammar_1); + TypeReference _genProposalProviderClass = ContentAssistFragment2.this.getGenProposalProviderClass(ContentAssistFragment2.this.getGrammar()); _builder.append(_genProposalProviderClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -249,22 +203,14 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { _builder.newLine(); } }; - JavaFileAccess _createJavaFile = this.fileAccessFactory.createJavaFile(_proposalProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src = _eclipsePlugin.getSrc(); - _createJavaFile.writeTo(_src); + this.fileAccessFactory.createJavaFile(_proposalProviderClass, _client).writeTo(this.getProjectConfig().getEclipsePlugin().getSrc()); } protected GeneratedJavaFileAccess generateGenJavaProposalProvider() { GeneratedJavaFileAccess _xblockexpression = null; { - Grammar _grammar = this.getGrammar(); - final Set excludedFqnFeatureNames = this.getFQFeatureNamesToExclude(_grammar); + final Set excludedFqnFeatureNames = this.getFQFeatureNamesToExclude(this.getGrammar()); final HashSet processedNames = CollectionLiterals.newHashSet(); - Grammar _grammar_1 = this.getGrammar(); - List _containedAssignments = GrammarUtil.containedAssignments(_grammar_1); - ArrayList _newArrayList = CollectionLiterals.newArrayList(); final Function2, Assignment, ArrayList> _function = (ArrayList candidates, Assignment assignment) -> { ArrayList _xblockexpression_1 = null; { @@ -277,10 +223,7 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { } return _xblockexpression_1; }; - final ArrayList assignments = IterableExtensions.>fold(_containedAssignments, _newArrayList, _function); - Grammar _grammar_2 = this.getGrammar(); - EList _rules = _grammar_2.getRules(); - ArrayList _newArrayList_1 = CollectionLiterals.newArrayList(); + final ArrayList assignments = IterableExtensions.>fold(GrammarUtil.containedAssignments(this.getGrammar()), CollectionLiterals.newArrayList(), _function); final Function2, AbstractRule, ArrayList> _function_1 = (ArrayList candidates, AbstractRule rule) -> { ArrayList _xblockexpression_1 = null; { @@ -293,21 +236,18 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { } return _xblockexpression_1; }; - final ArrayList remainingRules = IterableExtensions.>fold(_rules, _newArrayList_1, _function_1); + final ArrayList remainingRules = IterableExtensions.>fold(this.getGrammar().getRules(), CollectionLiterals.newArrayList(), _function_1); TypeReference _xifexpression = null; boolean _isGenerateStub = this.isGenerateStub(); if (_isGenerateStub) { - Grammar _grammar_3 = this.getGrammar(); - _xifexpression = this.getGenProposalProviderClass(_grammar_3); + _xifexpression = this.getGenProposalProviderClass(this.getGrammar()); } else { - Grammar _grammar_4 = this.getGrammar(); - _xifexpression = this.getProposalProviderClass(_grammar_4); + _xifexpression = this.getProposalProviderClass(this.getGrammar()); } final TypeReference genClass = _xifexpression; GeneratedJavaFileAccess _createGeneratedJavaFile = this.fileAccessFactory.createGeneratedJavaFile(genClass); final Procedure1 _function_2 = (GeneratedJavaFileAccess it) -> { - Grammar _grammar_5 = this.getGrammar(); - final TypeReference superClass = this.getGenProposalProviderSuperClass(_grammar_5); + final TypeReference superClass = this.getGenProposalProviderSuperClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -405,24 +345,19 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { private StringConcatenationClient handleAssignment(final Assignment assignment) { StringConcatenationClient _xblockexpression = null; { - ParserRule _containingParserRule = GrammarUtil.containingParserRule(assignment); - List _containedAssignments = GrammarUtil.containedAssignments(_containingParserRule); final Function1 _function = (Assignment it) -> { String _feature = it.getFeature(); String _feature_1 = assignment.getFeature(); return Boolean.valueOf(Objects.equal(_feature, _feature_1)); }; - Iterable _filter = IterableExtensions.filter(_containedAssignments, _function); final Function1 _function_1 = (Assignment it) -> { return it.getTerminal(); }; - Iterable _map = IterableExtensions.map(_filter, _function_1); - final List terminals = IterableExtensions.toList(_map); + final List terminals = IterableExtensions.toList(IterableExtensions.map(IterableExtensions.filter(GrammarUtil.containedAssignments(GrammarUtil.containingParserRule(assignment)), _function), _function_1)); final Function1 _function_2 = (AbstractElement it) -> { return it.eClass(); }; - List _map_1 = ListExtensions.map(terminals, _function_2); - final Set terminalTypes = IterableExtensions.toSet(_map_1); + final Set terminalTypes = IterableExtensions.toSet(ListExtensions.map(terminals, _function_2)); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -476,31 +411,28 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { StringConcatenationClient _xblockexpression = null; { final HashSet processedTerminals = CollectionLiterals.newHashSet(); - ArrayList _newArrayList = CollectionLiterals.newArrayList(); final Function2, AbstractElement, ArrayList> _function = (ArrayList candidates, AbstractElement terminal) -> { ArrayList _xblockexpression_1 = null; { - EClass _eClass = terminal.eClass(); - boolean _contains = processedTerminals.contains(_eClass); + boolean _contains = processedTerminals.contains(terminal.eClass()); boolean _not = (!_contains); if (_not) { - EClass _eClass_1 = terminal.eClass(); - processedTerminals.add(_eClass_1); + EClass _eClass = terminal.eClass(); + processedTerminals.add(_eClass); candidates.add(terminal); } _xblockexpression_1 = candidates; } return _xblockexpression_1; }; - final ArrayList candidates = IterableExtensions.>fold(terminals, _newArrayList, _function); + final ArrayList candidates = IterableExtensions.>fold(terminals, CollectionLiterals.newArrayList(), _function); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { { for(final AbstractElement terminal : candidates) { _builder.append("if (assignment.getTerminal() instanceof "); - EClass _eClass = terminal.eClass(); - Class _instanceClass = _eClass.getInstanceClass(); + Class _instanceClass = terminal.eClass().getInstanceClass(); _builder.append(_instanceClass); _builder.append(") {"); _builder.newLineIfNotEmpty(); @@ -571,10 +503,8 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { { - EList _elements = alternatives.getElements(); - Iterable> _indexed = IterableExtensions.indexed(_elements); + Iterable> _indexed = IterableExtensions.indexed(alternatives.getElements()); for(final Pair pair : _indexed) { - AbstractElement _value = pair.getValue(); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -588,7 +518,7 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { _builder.append(")"); } }; - StringConcatenationClient _assignmentTerminal = ContentAssistFragment2.this.assignmentTerminal(_value, _client); + StringConcatenationClient _assignmentTerminal = ContentAssistFragment2.this.assignmentTerminal(pair.getValue(), _client); _builder.append(_assignmentTerminal); _builder.newLineIfNotEmpty(); } @@ -612,26 +542,21 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { } private String getFQFeatureName(final Assignment a) { - ParserRule _containingParserRule = GrammarUtil.containingParserRule(a); - String _name = _containingParserRule.getName(); - String _firstUpper = StringExtensions.toFirstUpper(_name); + String _firstUpper = StringExtensions.toFirstUpper(GrammarUtil.containingParserRule(a).getName()); String _plus = (_firstUpper + "_"); - String _feature = a.getFeature(); - String _firstUpper_1 = StringExtensions.toFirstUpper(_feature); + String _firstUpper_1 = StringExtensions.toFirstUpper(a.getFeature()); return (_plus + _firstUpper_1); } private Iterable computeFQFeatureNames(final Grammar g) { - List _containedAssignments = GrammarUtil.containedAssignments(g); final Function1 _function = (Assignment it) -> { return this.getFQFeatureName(it); }; - List _map = ListExtensions.map(_containedAssignments, _function); - EList _rules = g.getRules(); + List _map = ListExtensions.map(GrammarUtil.containedAssignments(g), _function); final Function1 _function_1 = (AbstractRule it) -> { return this.getFQFeatureName(it); }; - List _map_1 = ListExtensions.map(_rules, _function_1); + List _map_1 = ListExtensions.map(g.getRules(), _function_1); return Iterables.concat(_map, _map_1); } @@ -642,15 +567,11 @@ public class ContentAssistFragment2 extends AbstractInheritingFragment { if (_tripleNotEquals) { Sets.SetView _xblockexpression = null; { - Iterable _computeFQFeatureNames = this.computeFQFeatureNames(g); - final Set thisGrammarFqFeatureNames = IterableExtensions.toSet(_computeFQFeatureNames); - List _allUsedGrammars = GrammarUtil.allUsedGrammars(g); + final Set thisGrammarFqFeatureNames = IterableExtensions.toSet(this.computeFQFeatureNames(g)); final Function1> _function = (Grammar it) -> { return this.computeFQFeatureNames(it); }; - List> _map = ListExtensions.>map(_allUsedGrammars, _function); - Iterable _flatten = Iterables.concat(_map); - final Set superGrammarsFqFeatureNames = IterableExtensions.toSet(_flatten); + final Set superGrammarsFqFeatureNames = IterableExtensions.toSet(Iterables.concat(ListExtensions.>map(GrammarUtil.allUsedGrammars(g), _function))); _xblockexpression = Sets.intersection(thisGrammarFqFeatureNames, superGrammarsFqFeatureNames); } _xifexpression = _xblockexpression; diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/labeling/LabelProviderFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/labeling/LabelProviderFragment2.java index 6adbe1a03..7422f939a 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/labeling/LabelProviderFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/labeling/LabelProviderFragment2.java @@ -14,17 +14,11 @@ import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xtext.generator.AbstractStubGeneratingFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; -import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.XtendFileAccess; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.xbase.XbaseUsageDetector; /** @@ -106,22 +100,16 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { @Override public void generate() { if ((this.isGenerateStub() || this._xbaseUsageDetector.inheritsXbase(this.getGrammar()))) { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - ManifestAccess _manifest = _eclipsePlugin.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_1.getEclipsePlugin(); - ManifestAccess _manifest_1 = _eclipsePlugin_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); + Set _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); _requiredBundles.add("org.eclipse.xtext.ui"); } TypeReference _xifexpression = null; boolean _isGenerateStub = this.isGenerateStub(); if (_isGenerateStub) { - Grammar _grammar = this.getGrammar(); - _xifexpression = this.getEObjectLabelProviderClass(_grammar); + _xifexpression = this.getEObjectLabelProviderClass(this.getGrammar()); } else { _xifexpression = new TypeReference(LabelProviderFragment2.XBASE_LABEL_PROVIDER); } @@ -129,16 +117,14 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { TypeReference _xifexpression_1 = null; boolean _isGenerateStub_1 = this.isGenerateStub(); if (_isGenerateStub_1) { - Grammar _grammar_1 = this.getGrammar(); - _xifexpression_1 = this.getDescriptionLabelProviderClass(_grammar_1); + _xifexpression_1 = this.getDescriptionLabelProviderClass(this.getGrammar()); } else { _xifexpression_1 = new TypeReference(LabelProviderFragment2.XBASE_DESCRIPTION_LABEL_PROVIDER); } final TypeReference descriptionLabelProviderClass = _xifexpression_1; final TypeReference iLabelProviderClass = new TypeReference("org.eclipse.jface.viewers.ILabelProvider"); final TypeReference rsdLabelProviderClass = new TypeReference("org.eclipse.xtext.ui.resource.ResourceServiceDescriptionLabelProvider"); - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(iLabelProviderClass, labelProviderClass); + GuiceModuleAccess.BindingFactory _addTypeToType = new GuiceModuleAccess.BindingFactory().addTypeToType(iLabelProviderClass, labelProviderClass); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -152,10 +138,7 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); } }; - GuiceModuleAccess.BindingFactory _addConfiguredBinding = _addTypeToType.addConfiguredBinding("ResourceUIServiceLabelProvider", _client); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule(); - _addConfiguredBinding.contributeTo(_eclipsePluginGenModule); + _addTypeToType.addConfiguredBinding("ResourceUIServiceLabelProvider", _client).contributeTo(this.getLanguage().getEclipsePluginGenModule()); } if ((this.isGenerateStub() && (this.getProjectConfig().getEclipsePlugin().getSrc() != null))) { boolean _isGenerateXtendStub = this.isGenerateXtendStub(); @@ -170,8 +153,7 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { } protected void generateXtendEObjectLabelProvider() { - Grammar _grammar = this.getGrammar(); - TypeReference _eObjectLabelProviderClass = this.getEObjectLabelProviderClass(_grammar); + TypeReference _eObjectLabelProviderClass = this.getEObjectLabelProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -190,13 +172,10 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - Grammar _grammar = LabelProviderFragment2.this.getGrammar(); - TypeReference _eObjectLabelProviderClass = LabelProviderFragment2.this.getEObjectLabelProviderClass(_grammar); - String _simpleName = _eObjectLabelProviderClass.getSimpleName(); + String _simpleName = LabelProviderFragment2.this.getEObjectLabelProviderClass(LabelProviderFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = LabelProviderFragment2.this.getGrammar(); - TypeReference _eObjectLabelProviderSuperClass = LabelProviderFragment2.this.getEObjectLabelProviderSuperClass(_grammar_1); + TypeReference _eObjectLabelProviderSuperClass = LabelProviderFragment2.this.getEObjectLabelProviderSuperClass(LabelProviderFragment2.this.getGrammar()); _builder.append(_eObjectLabelProviderSuperClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -241,16 +220,11 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_eObjectLabelProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src = _eclipsePlugin.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_eObjectLabelProviderClass, _client).writeTo(this.getProjectConfig().getEclipsePlugin().getSrc()); } protected void generateXtendDescriptionLabelProvider() { - Grammar _grammar = this.getGrammar(); - TypeReference _descriptionLabelProviderClass = this.getDescriptionLabelProviderClass(_grammar); + TypeReference _descriptionLabelProviderClass = this.getDescriptionLabelProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -269,13 +243,10 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - Grammar _grammar = LabelProviderFragment2.this.getGrammar(); - TypeReference _descriptionLabelProviderClass = LabelProviderFragment2.this.getDescriptionLabelProviderClass(_grammar); - String _simpleName = _descriptionLabelProviderClass.getSimpleName(); + String _simpleName = LabelProviderFragment2.this.getDescriptionLabelProviderClass(LabelProviderFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = LabelProviderFragment2.this.getGrammar(); - TypeReference _descriptionLabelProviderSuperClass = LabelProviderFragment2.this.getDescriptionLabelProviderSuperClass(_grammar_1); + TypeReference _descriptionLabelProviderSuperClass = LabelProviderFragment2.this.getDescriptionLabelProviderSuperClass(LabelProviderFragment2.this.getGrammar()); _builder.append(_descriptionLabelProviderSuperClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -303,16 +274,11 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_descriptionLabelProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src = _eclipsePlugin.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_descriptionLabelProviderClass, _client).writeTo(this.getProjectConfig().getEclipsePlugin().getSrc()); } protected void generateJavaEObjectLabelProvider() { - Grammar _grammar = this.getGrammar(); - TypeReference _eObjectLabelProviderClass = this.getEObjectLabelProviderClass(_grammar); + TypeReference _eObjectLabelProviderClass = this.getEObjectLabelProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -331,13 +297,10 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - Grammar _grammar = LabelProviderFragment2.this.getGrammar(); - TypeReference _eObjectLabelProviderClass = LabelProviderFragment2.this.getEObjectLabelProviderClass(_grammar); - String _simpleName = _eObjectLabelProviderClass.getSimpleName(); + String _simpleName = LabelProviderFragment2.this.getEObjectLabelProviderClass(LabelProviderFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = LabelProviderFragment2.this.getGrammar(); - TypeReference _eObjectLabelProviderSuperClass = LabelProviderFragment2.this.getEObjectLabelProviderSuperClass(_grammar_1); + TypeReference _eObjectLabelProviderSuperClass = LabelProviderFragment2.this.getEObjectLabelProviderSuperClass(LabelProviderFragment2.this.getGrammar()); _builder.append(_eObjectLabelProviderSuperClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -348,9 +311,7 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("public "); - Grammar _grammar_2 = LabelProviderFragment2.this.getGrammar(); - TypeReference _eObjectLabelProviderClass_1 = LabelProviderFragment2.this.getEObjectLabelProviderClass(_grammar_2); - String _simpleName_1 = _eObjectLabelProviderClass_1.getSimpleName(); + String _simpleName_1 = LabelProviderFragment2.this.getEObjectLabelProviderClass(LabelProviderFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName_1, "\t"); _builder.append("("); TypeReference _typeReference = new TypeReference("org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider"); @@ -387,16 +348,11 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - JavaFileAccess _createJavaFile = this.fileAccessFactory.createJavaFile(_eObjectLabelProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src = _eclipsePlugin.getSrc(); - _createJavaFile.writeTo(_src); + this.fileAccessFactory.createJavaFile(_eObjectLabelProviderClass, _client).writeTo(this.getProjectConfig().getEclipsePlugin().getSrc()); } protected void generateJavaDescriptionLabelProvider() { - Grammar _grammar = this.getGrammar(); - TypeReference _descriptionLabelProviderClass = this.getDescriptionLabelProviderClass(_grammar); + TypeReference _descriptionLabelProviderClass = this.getDescriptionLabelProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -415,13 +371,10 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - Grammar _grammar = LabelProviderFragment2.this.getGrammar(); - TypeReference _descriptionLabelProviderClass = LabelProviderFragment2.this.getDescriptionLabelProviderClass(_grammar); - String _simpleName = _descriptionLabelProviderClass.getSimpleName(); + String _simpleName = LabelProviderFragment2.this.getDescriptionLabelProviderClass(LabelProviderFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = LabelProviderFragment2.this.getGrammar(); - TypeReference _descriptionLabelProviderSuperClass = LabelProviderFragment2.this.getDescriptionLabelProviderSuperClass(_grammar_1); + TypeReference _descriptionLabelProviderSuperClass = LabelProviderFragment2.this.getDescriptionLabelProviderSuperClass(LabelProviderFragment2.this.getGrammar()); _builder.append(_descriptionLabelProviderSuperClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -449,10 +402,6 @@ public class LabelProviderFragment2 extends AbstractStubGeneratingFragment { _builder.newLine(); } }; - JavaFileAccess _createJavaFile = this.fileAccessFactory.createJavaFile(_descriptionLabelProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src = _eclipsePlugin.getSrc(); - _createJavaFile.writeTo(_src); + this.fileAccessFactory.createJavaFile(_descriptionLabelProviderClass, _client).writeTo(this.getProjectConfig().getEclipsePlugin().getSrc()); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/outline/OutlineTreeProviderFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/outline/OutlineTreeProviderFragment2.java index dad2fe112..9cabd79c0 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/outline/OutlineTreeProviderFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/outline/OutlineTreeProviderFragment2.java @@ -14,17 +14,12 @@ import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xtext.generator.AbstractStubGeneratingFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; -import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.XtendFileAccess; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; /** * @author Christian Schneider - Initial contribution and API @@ -49,15 +44,10 @@ public class OutlineTreeProviderFragment2 extends AbstractStubGeneratingFragment @Override public void generate() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - ManifestAccess _manifest = _eclipsePlugin.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_1.getEclipsePlugin(); - ManifestAccess _manifest_1 = _eclipsePlugin_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); + Set _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); _requiredBundles.add("org.eclipse.xtext.ui"); } boolean _isGenerateStub = this.isGenerateStub(); @@ -65,9 +55,7 @@ public class OutlineTreeProviderFragment2 extends AbstractStubGeneratingFragment if (_not) { return; } - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_2 = _projectConfig_2.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src = _eclipsePlugin_2.getSrc(); + IXtextGeneratorFileSystemAccess _src = this.getProjectConfig().getEclipsePlugin().getSrc(); boolean _tripleNotEquals_1 = (_src != null); if (_tripleNotEquals_1) { boolean _isGenerateXtendStub = this.isGenerateXtendStub(); @@ -79,21 +67,15 @@ public class OutlineTreeProviderFragment2 extends AbstractStubGeneratingFragment } GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.editor.outline.IOutlineTreeProvider"); - Grammar _grammar = this.getGrammar(); - TypeReference _outlineTreeProviderClass = this.getOutlineTreeProviderClass(_grammar); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeReference, _outlineTreeProviderClass); + GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeReference, + this.getOutlineTreeProviderClass(this.getGrammar())); TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.ui.editor.outline.impl.IOutlineTreeStructureProvider"); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _outlineTreeProviderClass_1 = this.getOutlineTreeProviderClass(_grammar_1); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeReference_1, _outlineTreeProviderClass_1); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule(); - _addTypeToType_1.contributeTo(_eclipsePluginGenModule); + _addTypeToType.addTypeToType(_typeReference_1, + this.getOutlineTreeProviderClass(this.getGrammar())).contributeTo(this.getLanguage().getEclipsePluginGenModule()); } protected void generateJavaOutlineTreeProvider() { - Grammar _grammar = this.getGrammar(); - TypeReference _outlineTreeProviderClass = this.getOutlineTreeProviderClass(_grammar); + TypeReference _outlineTreeProviderClass = this.getOutlineTreeProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -112,9 +94,7 @@ public class OutlineTreeProviderFragment2 extends AbstractStubGeneratingFragment _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - Grammar _grammar = OutlineTreeProviderFragment2.this.getGrammar(); - TypeReference _outlineTreeProviderClass = OutlineTreeProviderFragment2.this.getOutlineTreeProviderClass(_grammar); - String _simpleName = _outlineTreeProviderClass.getSimpleName(); + String _simpleName = OutlineTreeProviderFragment2.this.getOutlineTreeProviderClass(OutlineTreeProviderFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider"); @@ -126,16 +106,11 @@ public class OutlineTreeProviderFragment2 extends AbstractStubGeneratingFragment _builder.newLine(); } }; - JavaFileAccess _createJavaFile = this.fileAccessFactory.createJavaFile(_outlineTreeProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src = _eclipsePlugin.getSrc(); - _createJavaFile.writeTo(_src); + this.fileAccessFactory.createJavaFile(_outlineTreeProviderClass, _client).writeTo(this.getProjectConfig().getEclipsePlugin().getSrc()); } protected void generateXtendOutlineTreeProvider() { - Grammar _grammar = this.getGrammar(); - TypeReference _outlineTreeProviderClass = this.getOutlineTreeProviderClass(_grammar); + TypeReference _outlineTreeProviderClass = this.getOutlineTreeProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -154,9 +129,7 @@ public class OutlineTreeProviderFragment2 extends AbstractStubGeneratingFragment _builder.append("*/"); _builder.newLine(); _builder.append("class "); - Grammar _grammar = OutlineTreeProviderFragment2.this.getGrammar(); - TypeReference _outlineTreeProviderClass = OutlineTreeProviderFragment2.this.getOutlineTreeProviderClass(_grammar); - String _simpleName = _outlineTreeProviderClass.getSimpleName(); + String _simpleName = OutlineTreeProviderFragment2.this.getOutlineTreeProviderClass(OutlineTreeProviderFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider"); @@ -168,10 +141,6 @@ public class OutlineTreeProviderFragment2 extends AbstractStubGeneratingFragment _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_outlineTreeProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src = _eclipsePlugin.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_outlineTreeProviderClass, _client).writeTo(this.getProjectConfig().getEclipsePlugin().getSrc()); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/outline/QuickOutlineFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/outline/QuickOutlineFragment2.java index ca1acc3d8..92035a38b 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/outline/QuickOutlineFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/outline/QuickOutlineFragment2.java @@ -11,15 +11,12 @@ import com.google.inject.Inject; import java.util.List; import java.util.Set; import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.Grammar; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; /** * Contributes the 'Quick Outline' entry to the language editor's context menu. @@ -34,26 +31,16 @@ public class QuickOutlineFragment2 extends AbstractXtextGeneratorFragment { @Override public void generate() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - ManifestAccess _manifest = _eclipsePlugin.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_1.getEclipsePlugin(); - ManifestAccess _manifest_1 = _eclipsePlugin_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); + Set _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); _requiredBundles.add("org.eclipse.xtext.ui"); } - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_2 = _projectConfig_2.getEclipsePlugin(); - PluginXmlAccess _pluginXml = _eclipsePlugin_2.getPluginXml(); + PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml(); boolean _tripleNotEquals_1 = (_pluginXml != null); if (_tripleNotEquals_1) { - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_3 = _projectConfig_3.getEclipsePlugin(); - PluginXmlAccess _pluginXml_1 = _eclipsePlugin_3.getPluginXml(); - List _entries = _pluginXml_1.getEntries(); + List _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); StringConcatenation _builder = new StringConcatenation(); _builder.append(""); _builder.newLine(); @@ -67,8 +54,7 @@ public class QuickOutlineFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("class=\""); - Grammar _grammar = this.getGrammar(); - TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(_grammar); + TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar()); _builder.append(_eclipsePluginExecutableExtensionFactory, "\t\t"); _builder.append(":org.eclipse.xtext.ui.editor.outline.quickoutline.ShowQuickOutlineActionHandler\""); _builder.newLineIfNotEmpty(); @@ -83,8 +69,7 @@ public class QuickOutlineFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); _builder.append("\t\t\t\t"); _builder.append("definitionId=\""); - Grammar _grammar_1 = this.getGrammar(); - String _name = _grammar_1.getName(); + String _name = this.getGrammar().getName(); _builder.append(_name, "\t\t\t\t"); _builder.append(".Editor.opened\">"); _builder.newLineIfNotEmpty(); @@ -143,8 +128,7 @@ public class QuickOutlineFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); _builder.append("\t\t\t\t"); _builder.append(""); _builder.newLineIfNotEmpty(); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/projectWizard/SimpleProjectWizardFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/projectWizard/SimpleProjectWizardFragment2.java index 10b281ab3..8aeea9a90 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/projectWizard/SimpleProjectWizardFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/projectWizard/SimpleProjectWizardFragment2.java @@ -15,25 +15,21 @@ import java.util.Set; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtend2.lib.StringConcatenationClient; -import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.model.XtendFileAccess; import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; /** * Contributes the registration of compare infrastructure. @@ -60,40 +56,29 @@ public class SimpleProjectWizardFragment2 extends AbstractXtextGeneratorFragment if ((!this.generate)) { return; } - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); + IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin(); ManifestAccess _manifest = null; if (_eclipsePlugin!=null) { _manifest=_eclipsePlugin.getManifest(); } boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_1.getEclipsePlugin(); - ManifestAccess _manifest_1 = _eclipsePlugin_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); + Set _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); Iterables.addAll(_requiredBundles, Collections.unmodifiableList(CollectionLiterals.newArrayList("org.eclipse.ui", "org.eclipse.core.runtime", "org.eclipse.core.resources", "org.eclipse.ui.ide"))); } GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.wizard.IProjectCreator"); String _projectCreatorClassName = this.getProjectCreatorClassName(); TypeReference _typeReference_1 = new TypeReference(_projectCreatorClassName); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeReference, _typeReference_1); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule(); - _addTypeToType.contributeTo(_eclipsePluginGenModule); - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_2 = _projectConfig_2.getEclipsePlugin(); + _bindingFactory.addTypeToType(_typeReference, _typeReference_1).contributeTo(this.getLanguage().getEclipsePluginGenModule()); + IBundleProjectConfig _eclipsePlugin_1 = this.getProjectConfig().getEclipsePlugin(); PluginXmlAccess _pluginXml = null; - if (_eclipsePlugin_2!=null) { - _pluginXml=_eclipsePlugin_2.getPluginXml(); + if (_eclipsePlugin_1!=null) { + _pluginXml=_eclipsePlugin_1.getPluginXml(); } boolean _tripleNotEquals_1 = (_pluginXml != null); if (_tripleNotEquals_1) { - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_3 = _projectConfig_3.getEclipsePlugin(); - PluginXmlAccess _pluginXml_1 = _eclipsePlugin_3.getPluginXml(); - List _entries = _pluginXml_1.getEntries(); + List _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); StringConcatenation _builder = new StringConcatenation(); _builder.append(" _exportedPackages = _manifest_1.getExportedPackages(); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _quickfixProviderClass_1 = this.getQuickfixProviderClass(_grammar_1); - String _packageName = _quickfixProviderClass_1.getPackageName(); + Set _exportedPackages = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages(); + String _packageName = this.getQuickfixProviderClass(this.getGrammar()).getPackageName(); _exportedPackages.add(_packageName); } - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_3 = _projectConfig_3.getEclipsePlugin(); - PluginXmlAccess _pluginXml = _eclipsePlugin_3.getPluginXml(); + PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml(); boolean _tripleNotEquals_2 = (_pluginXml != null); if (_tripleNotEquals_2) { this.addRegistrationToPluginXml(); } } else { - IXtextProjectConfig _projectConfig_4 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_4 = _projectConfig_4.getEclipsePlugin(); + IBundleProjectConfig _eclipsePlugin_1 = this.getProjectConfig().getEclipsePlugin(); IXtextGeneratorFileSystemAccess _srcGen = null; - if (_eclipsePlugin_4!=null) { - _srcGen=_eclipsePlugin_4.getSrcGen(); + if (_eclipsePlugin_1!=null) { + _srcGen=_eclipsePlugin_1.getSrcGen(); } boolean _tripleNotEquals_3 = (_srcGen != null); if (_tripleNotEquals_3) { this.generateGenQuickfixProvider(); } - IXtextProjectConfig _projectConfig_5 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_5 = _projectConfig_5.getEclipsePlugin(); - ManifestAccess _manifest_2 = _eclipsePlugin_5.getManifest(); - boolean _tripleNotEquals_4 = (_manifest_2 != null); + ManifestAccess _manifest_1 = this.getProjectConfig().getEclipsePlugin().getManifest(); + boolean _tripleNotEquals_4 = (_manifest_1 != null); if (_tripleNotEquals_4) { - IXtextProjectConfig _projectConfig_6 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_6 = _projectConfig_6.getEclipsePlugin(); - ManifestAccess _manifest_3 = _eclipsePlugin_6.getManifest(); - Set _exportedPackages_1 = _manifest_3.getExportedPackages(); - Grammar _grammar_2 = this.getGrammar(); - TypeReference _quickfixProviderClass_2 = this.getQuickfixProviderClass(_grammar_2); - String _packageName_1 = _quickfixProviderClass_2.getPackageName(); + Set _exportedPackages_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages(); + String _packageName_1 = this.getQuickfixProviderClass(this.getGrammar()).getPackageName(); _exportedPackages_1.add(_packageName_1); } } } public void generateGenQuickfixProvider() { - Grammar _grammar = this.getGrammar(); - final TypeReference genClass = this.getQuickfixProviderClass(_grammar); + final TypeReference genClass = this.getQuickfixProviderClass(this.getGrammar()); final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(genClass); StringConcatenationClient _client = new StringConcatenationClient() { @Override @@ -168,8 +141,7 @@ public class QuickfixProviderFragment2 extends AbstractInheritingFragment { String _simpleName = genClass.getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar = QuickfixProviderFragment2.this.getGrammar(); - TypeReference _quickfixProviderSuperClass = QuickfixProviderFragment2.this.getQuickfixProviderSuperClass(_grammar); + TypeReference _quickfixProviderSuperClass = QuickfixProviderFragment2.this.getQuickfixProviderSuperClass(QuickfixProviderFragment2.this.getGrammar()); _builder.append(_quickfixProviderSuperClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -178,15 +150,11 @@ public class QuickfixProviderFragment2 extends AbstractInheritingFragment { } }; file.setContent(_client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _srcGen = _eclipsePlugin.getSrcGen(); - file.writeTo(_srcGen); + file.writeTo(this.getProjectConfig().getEclipsePlugin().getSrcGen()); } protected void generateXtendQuickfixProvider() { - Grammar _grammar = this.getGrammar(); - TypeReference _quickfixProviderClass = this.getQuickfixProviderClass(_grammar); + TypeReference _quickfixProviderClass = this.getQuickfixProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -205,21 +173,16 @@ public class QuickfixProviderFragment2 extends AbstractInheritingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - Grammar _grammar = QuickfixProviderFragment2.this.getGrammar(); - TypeReference _quickfixProviderClass = QuickfixProviderFragment2.this.getQuickfixProviderClass(_grammar); - String _simpleName = _quickfixProviderClass.getSimpleName(); + String _simpleName = QuickfixProviderFragment2.this.getQuickfixProviderClass(QuickfixProviderFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = QuickfixProviderFragment2.this.getGrammar(); - TypeReference _quickfixProviderSuperClass = QuickfixProviderFragment2.this.getQuickfixProviderSuperClass(_grammar_1); + TypeReference _quickfixProviderSuperClass = QuickfixProviderFragment2.this.getQuickfixProviderSuperClass(QuickfixProviderFragment2.this.getGrammar()); _builder.append(_quickfixProviderSuperClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("//\t@Fix("); - Grammar _grammar_2 = QuickfixProviderFragment2.this.getGrammar(); - TypeReference _validatorClass = QuickfixProviderFragment2.this._validatorNaming.getValidatorClass(_grammar_2); - String _simpleName_1 = _validatorClass.getSimpleName(); + String _simpleName_1 = QuickfixProviderFragment2.this._validatorNaming.getValidatorClass(QuickfixProviderFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName_1); _builder.append(".INVALID_NAME)"); _builder.newLineIfNotEmpty(); @@ -243,16 +206,11 @@ public class QuickfixProviderFragment2 extends AbstractInheritingFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_quickfixProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src = _eclipsePlugin.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_quickfixProviderClass, _client).writeTo(this.getProjectConfig().getEclipsePlugin().getSrc()); } protected void generateJavaQuickfixProvider() { - Grammar _grammar = this.getGrammar(); - TypeReference _quickfixProviderClass = this.getQuickfixProviderClass(_grammar); + TypeReference _quickfixProviderClass = this.getQuickfixProviderClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -271,21 +229,16 @@ public class QuickfixProviderFragment2 extends AbstractInheritingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - Grammar _grammar = QuickfixProviderFragment2.this.getGrammar(); - TypeReference _quickfixProviderClass = QuickfixProviderFragment2.this.getQuickfixProviderClass(_grammar); - String _simpleName = _quickfixProviderClass.getSimpleName(); + String _simpleName = QuickfixProviderFragment2.this.getQuickfixProviderClass(QuickfixProviderFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = QuickfixProviderFragment2.this.getGrammar(); - TypeReference _quickfixProviderSuperClass = QuickfixProviderFragment2.this.getQuickfixProviderSuperClass(_grammar_1); + TypeReference _quickfixProviderSuperClass = QuickfixProviderFragment2.this.getQuickfixProviderSuperClass(QuickfixProviderFragment2.this.getGrammar()); _builder.append(_quickfixProviderSuperClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("//\t@Fix("); - Grammar _grammar_2 = QuickfixProviderFragment2.this.getGrammar(); - TypeReference _validatorClass = QuickfixProviderFragment2.this._validatorNaming.getValidatorClass(_grammar_2); - String _simpleName_1 = _validatorClass.getSimpleName(); + String _simpleName_1 = QuickfixProviderFragment2.this._validatorNaming.getValidatorClass(QuickfixProviderFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName_1); _builder.append(".INVALID_NAME)"); _builder.newLineIfNotEmpty(); @@ -312,34 +265,21 @@ public class QuickfixProviderFragment2 extends AbstractInheritingFragment { _builder.newLine(); } }; - JavaFileAccess _createJavaFile = this.fileAccessFactory.createJavaFile(_quickfixProviderClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - IXtextGeneratorFileSystemAccess _src = _eclipsePlugin.getSrc(); - _createJavaFile.writeTo(_src); + this.fileAccessFactory.createJavaFile(_quickfixProviderClass, _client).writeTo(this.getProjectConfig().getEclipsePlugin().getSrc()); } protected boolean addRegistrationToPluginXml() { boolean _xblockexpression = false; { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - String _name = _eclipsePlugin.getName(); + String _name = this.getProjectConfig().getEclipsePlugin().getName(); String _plus = (_name + "."); - Grammar _grammar = this.getGrammar(); - String _simpleName = GrammarUtil.getSimpleName(_grammar); - String _lowerCase = _simpleName.toLowerCase(); + String _lowerCase = GrammarUtil.getSimpleName(this.getGrammar()).toLowerCase(); final String markerTypePrefix = (_plus + _lowerCase); - Grammar _grammar_1 = this.getGrammar(); - final TypeReference executableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(_grammar_1); - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_1.getEclipsePlugin(); - PluginXmlAccess _pluginXml = _eclipsePlugin_1.getPluginXml(); - List _entries = _pluginXml.getEntries(); + final TypeReference executableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar()); + List _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); StringConcatenation _builder = new StringConcatenation(); _builder.append(""); _builder.newLineIfNotEmpty(); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/refactoring/RefactorElementNameFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/refactoring/RefactorElementNameFragment2.java index bfdf88483..47b3d89a7 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/refactoring/RefactorElementNameFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/refactoring/RefactorElementNameFragment2.java @@ -18,14 +18,12 @@ import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.util.BooleanGeneratorOption; import org.eclipse.xtext.xtext.generator.xbase.XbaseUsageDetector; @@ -63,30 +61,22 @@ public class RefactorElementNameFragment2 extends AbstractXtextGeneratorFragment @Override public void generate() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); + IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin(); ManifestAccess _manifest = null; if (_eclipsePlugin!=null) { _manifest=_eclipsePlugin.getManifest(); } boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_1.getEclipsePlugin(); - ManifestAccess _manifest_1 = _eclipsePlugin_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); + Set _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); _requiredBundles.add("org.eclipse.xtext.ui"); } - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameStrategy"); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultRenameStrategy"); - GuiceModuleAccess.BindingFactory _addTypeToType = _bindingFactory.addTypeToType(_typeRef, _typeRef_1); - TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IReferenceUpdater"); - TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultReferenceUpdater"); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeRef_2, _typeRef_3); - TypeReference _typeRef_4 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer"); - List _simpleNames = _typeRef_4.getSimpleNames(); - String _join = IterableExtensions.join(_simpleNames, "."); + GuiceModuleAccess.BindingFactory _addTypeToType = new GuiceModuleAccess.BindingFactory().addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameStrategy"), + TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultRenameStrategy")).addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IReferenceUpdater"), + TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultReferenceUpdater")); + String _join = IterableExtensions.join(TypeReference.typeRef("org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer").getSimpleNames(), "."); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -108,22 +98,20 @@ public class RefactorElementNameFragment2 extends AbstractXtextGeneratorFragment _builder.newLineIfNotEmpty(); } }; - final GuiceModuleAccess.BindingFactory bindings = _addTypeToType_1.addConfiguredBinding(_join, _client); - Grammar _grammar = this.getGrammar(); - boolean _isUseJdtRefactoring = this.isUseJdtRefactoring(_grammar); + final GuiceModuleAccess.BindingFactory bindings = _addTypeToType.addConfiguredBinding(_join, _client); + boolean _isUseJdtRefactoring = this.isUseJdtRefactoring(this.getGrammar()); if (_isUseJdtRefactoring) { - TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.ui.IRenameContextFactory"); - TypeReference _typeRef_6 = TypeReference.typeRef("org.eclipse.xtext.common.types.ui.refactoring.JdtRefactoringContextFactory"); - GuiceModuleAccess.BindingFactory _addTypeToType_2 = bindings.addTypeToType(_typeRef_5, _typeRef_6); - TypeReference _typeRef_7 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider"); - TypeReference _typeRef_8 = TypeReference.typeRef("org.eclipse.xtext.common.types.ui.refactoring.JvmRenameRefactoringProvider"); - GuiceModuleAccess.BindingFactory _addTypeToType_3 = _addTypeToType_2.addTypeToType(_typeRef_7, _typeRef_8); + GuiceModuleAccess.BindingFactory _addTypeToType_1 = bindings.addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.ui.IRenameContextFactory"), + TypeReference.typeRef("org.eclipse.xtext.common.types.ui.refactoring.JdtRefactoringContextFactory")).addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider"), + TypeReference.typeRef("org.eclipse.xtext.common.types.ui.refactoring.JvmRenameRefactoringProvider")); TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.refactoring.ui", "IRenameSupport.Factory"); TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.common.types.ui.refactoring", "JdtRenameSupport.Factory"); - GuiceModuleAccess.BindingFactory _addTypeToType_4 = _addTypeToType_3.addTypeToType(_typeReference, _typeReference_1); + GuiceModuleAccess.BindingFactory _addTypeToType_2 = _addTypeToType_1.addTypeToType(_typeReference, _typeReference_1); TypeReference _typeReference_2 = new TypeReference("org.eclipse.xtext.ui.refactoring", "IRenameStrategy.Provider"); TypeReference _typeReference_3 = new TypeReference("org.eclipse.xtext.common.types.ui.refactoring.participant", "JvmMemberRenameStrategy.Provider"); - GuiceModuleAccess.BindingFactory _addTypeToType_5 = _addTypeToType_4.addTypeToType(_typeReference_2, _typeReference_3); + GuiceModuleAccess.BindingFactory _addTypeToType_3 = _addTypeToType_2.addTypeToType(_typeReference_2, _typeReference_3); StringConcatenationClient _client_1 = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -140,31 +128,25 @@ public class RefactorElementNameFragment2 extends AbstractXtextGeneratorFragment _builder.newLineIfNotEmpty(); } }; - _addTypeToType_5.addConfiguredBinding( + _addTypeToType_3.addConfiguredBinding( "JvmMemberRenameStrategy.Provider.Delegate", _client_1); } else { - TypeReference _typeRef_9 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider"); - TypeReference _typeRef_10 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultRenameRefactoringProvider"); - GuiceModuleAccess.BindingFactory _addTypeToType_6 = bindings.addTypeToType(_typeRef_9, _typeRef_10); + GuiceModuleAccess.BindingFactory _addTypeToType_4 = bindings.addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider"), + TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultRenameRefactoringProvider")); TypeReference _typeReference_4 = new TypeReference("org.eclipse.xtext.ui.refactoring.ui", "IRenameSupport.Factory"); TypeReference _typeReference_5 = new TypeReference("org.eclipse.xtext.ui.refactoring.ui", "DefaultRenameSupport.Factory"); - _addTypeToType_6.addTypeToType(_typeReference_4, _typeReference_5); + _addTypeToType_4.addTypeToType(_typeReference_4, _typeReference_5); } - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule(); - bindings.contributeTo(_eclipsePluginGenModule); - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_2 = _projectConfig_2.getEclipsePlugin(); + bindings.contributeTo(this.getLanguage().getEclipsePluginGenModule()); + IBundleProjectConfig _eclipsePlugin_1 = this.getProjectConfig().getEclipsePlugin(); PluginXmlAccess _pluginXml = null; - if (_eclipsePlugin_2!=null) { - _pluginXml=_eclipsePlugin_2.getPluginXml(); + if (_eclipsePlugin_1!=null) { + _pluginXml=_eclipsePlugin_1.getPluginXml(); } boolean _tripleNotEquals_1 = (_pluginXml != null); if (_tripleNotEquals_1) { - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_3 = _projectConfig_3.getEclipsePlugin(); - PluginXmlAccess _pluginXml_1 = _eclipsePlugin_3.getPluginXml(); - List _entries = _pluginXml_1.getEntries(); + List _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); StringConcatenation _builder = new StringConcatenation(); _builder.append(""); _builder.newLine(); @@ -175,8 +157,7 @@ public class RefactorElementNameFragment2 extends AbstractXtextGeneratorFragment _builder.newLine(); _builder.append("\t\t"); _builder.append("class=\""); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(_grammar_1); + TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar()); _builder.append(_eclipsePluginExecutableExtensionFactory, "\t\t"); _builder.append(":org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler\""); _builder.newLineIfNotEmpty(); @@ -191,8 +172,7 @@ public class RefactorElementNameFragment2 extends AbstractXtextGeneratorFragment _builder.newLine(); _builder.append("\t\t\t\t"); _builder.append("definitionId=\""); - Grammar _grammar_2 = this.getGrammar(); - String _name = _grammar_2.getName(); + String _name = this.getGrammar().getName(); _builder.append(_name, "\t\t\t\t"); _builder.append(".Editor.opened\">"); _builder.newLineIfNotEmpty(); @@ -229,8 +209,7 @@ public class RefactorElementNameFragment2 extends AbstractXtextGeneratorFragment _builder.newLine(); _builder.append("\t\t\t\t\t"); _builder.append("definitionId=\""); - Grammar _grammar_3 = this.getGrammar(); - String _name_1 = _grammar_3.getName(); + String _name_1 = this.getGrammar().getName(); _builder.append(_name_1, "\t\t\t\t\t"); _builder.append(".Editor.opened\">"); _builder.newLineIfNotEmpty(); @@ -255,22 +234,19 @@ public class RefactorElementNameFragment2 extends AbstractXtextGeneratorFragment _builder.newLine(); _builder.append("\t\t"); _builder.append("category=\""); - Grammar _grammar_4 = this.getGrammar(); - String _name_2 = _grammar_4.getName(); + String _name_2 = this.getGrammar().getName(); _builder.append(_name_2, "\t\t"); _builder.append("\""); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("class=\""); - Grammar _grammar_5 = this.getGrammar(); - TypeReference _eclipsePluginExecutableExtensionFactory_1 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(_grammar_5); + TypeReference _eclipsePluginExecutableExtensionFactory_1 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar()); _builder.append(_eclipsePluginExecutableExtensionFactory_1, "\t\t"); _builder.append(":org.eclipse.xtext.ui.refactoring.ui.RefactoringPreferencePage\""); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("id=\""); - Grammar _grammar_6 = this.getGrammar(); - String _name_3 = _grammar_6.getName(); + String _name_3 = this.getGrammar().getName(); _builder.append(_name_3, "\t\t"); _builder.append(".refactoring\""); _builder.newLineIfNotEmpty(); @@ -279,11 +255,9 @@ public class RefactorElementNameFragment2 extends AbstractXtextGeneratorFragment _builder.newLine(); _builder.append("\t\t"); _builder.append(""); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/templates/CodetemplatesGeneratorFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/templates/CodetemplatesGeneratorFragment2.java index 544000f52..17e0a65c6 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/templates/CodetemplatesGeneratorFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/ui/templates/CodetemplatesGeneratorFragment2.java @@ -21,7 +21,6 @@ import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.ObjectExtensions; import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess; @@ -30,7 +29,6 @@ import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.parser.antlr.ContentAssistGrammarNaming; /** @@ -63,8 +61,7 @@ public class CodetemplatesGeneratorFragment2 extends AbstractXtextGeneratorFragm @Override public void generate() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); + IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin(); ManifestAccess _manifest = null; if (_eclipsePlugin!=null) { _manifest=_eclipsePlugin.getManifest(); @@ -97,34 +94,23 @@ public class CodetemplatesGeneratorFragment2 extends AbstractXtextGeneratorFragm _builder.append(".getLanguageRegistry()"); } }; - GuiceModuleAccess.BindingFactory _addTypeToProviderInstance_1 = _addTypeToProviderInstance.addTypeToProviderInstance(_typeRef_1, _client_1); - TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar"); - TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar"); - GuiceModuleAccess.BindingFactory _addTypeToTypeEagerSingleton = _addTypeToProviderInstance_1.addTypeToTypeEagerSingleton(_typeRef_2, _typeRef_3); - TypeReference _typeRef_4 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.templates.XtextTemplatePreferencePage"); - TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.preferences.AdvancedTemplatesPreferencePage"); - GuiceModuleAccess.BindingFactory _addTypeToType = _addTypeToTypeEagerSingleton.addTypeToType(_typeRef_4, _typeRef_5); - TypeReference _typeRef_6 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser"); - Grammar _grammar = this.getGrammar(); - TypeReference _partialContentAssistParserClass = this.getPartialContentAssistParserClass(_grammar); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeRef_6, _partialContentAssistParserClass); - TypeReference _typeRef_7 = TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.partialEditing.IPartialEditingContentAssistContextFactory"); - TypeReference _typeRef_8 = TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.partialEditing.PartialEditingContentAssistContextFactory"); - GuiceModuleAccess.BindingFactory _addTypeToType_2 = _addTypeToType_1.addTypeToType(_typeRef_7, _typeRef_8); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule(); - _addTypeToType_2.contributeTo(_eclipsePluginGenModule); - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IBundleProjectConfig _genericIde = _projectConfig_1.getGenericIde(); + _addTypeToProviderInstance.addTypeToProviderInstance(_typeRef_1, _client_1).addTypeToTypeEagerSingleton( + TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar"), + TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar")).addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ui.editor.templates.XtextTemplatePreferencePage"), + TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.preferences.AdvancedTemplatesPreferencePage")).addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser"), + this.getPartialContentAssistParserClass(this.getGrammar())).addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.partialEditing.IPartialEditingContentAssistContextFactory"), + TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.partialEditing.PartialEditingContentAssistContextFactory")).contributeTo(this.getLanguage().getEclipsePluginGenModule()); + IBundleProjectConfig _genericIde = this.getProjectConfig().getGenericIde(); IXtextGeneratorFileSystemAccess _srcGen = null; if (_genericIde!=null) { _srcGen=_genericIde.getSrcGen(); } boolean _tripleNotEquals = (_srcGen != null); if (_tripleNotEquals) { - Grammar _grammar_1 = this.getGrammar(); - TypeReference _partialContentAssistParserClass_1 = this.getPartialContentAssistParserClass(_grammar_1); - GeneratedJavaFileAccess _createGeneratedJavaFile = this.fileAccessFactory.createGeneratedJavaFile(_partialContentAssistParserClass_1); + GeneratedJavaFileAccess _createGeneratedJavaFile = this.fileAccessFactory.createGeneratedJavaFile(this.getPartialContentAssistParserClass(this.getGrammar())); final Procedure1 _function = (GeneratedJavaFileAccess it) -> { it.setContent(this.getGenPartialContentAssistParser()); it.writeTo(this.getProjectConfig().getGenericIde().getSrcGen()); @@ -138,13 +124,10 @@ public class CodetemplatesGeneratorFragment2 extends AbstractXtextGeneratorFragm @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); - Grammar _grammar = CodetemplatesGeneratorFragment2.this.getGrammar(); - TypeReference _partialContentAssistParserClass = CodetemplatesGeneratorFragment2.this.getPartialContentAssistParserClass(_grammar); - String _simpleName = _partialContentAssistParserClass.getSimpleName(); + String _simpleName = CodetemplatesGeneratorFragment2.this.getPartialContentAssistParserClass(CodetemplatesGeneratorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = CodetemplatesGeneratorFragment2.this.getGrammar(); - TypeReference _parserClass = CodetemplatesGeneratorFragment2.this.caNaming.getParserClass(_grammar_1); + TypeReference _parserClass = CodetemplatesGeneratorFragment2.this.caNaming.getParserClass(CodetemplatesGeneratorFragment2.this.getGrammar()); _builder.append(_parserClass); _builder.append(" implements "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser"); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/GenModelUtil2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/GenModelUtil2.java index 05071310c..0b5571020 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/GenModelUtil2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/GenModelUtil2.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.xtext.generator.util; import com.google.common.base.Objects; -import java.util.Map; import org.eclipse.emf.codegen.ecore.genmodel.GenClass; import org.eclipse.emf.codegen.ecore.genmodel.GenClassifier; import org.eclipse.emf.codegen.ecore.genmodel.GenDataType; @@ -45,8 +44,7 @@ public class GenModelUtil2 { EList _genClassifiers = genPackage.getGenClassifiers(); for (final GenClassifier genCls : _genClassifiers) { String _name = cls.getName(); - EClassifier _ecoreClassifier = genCls.getEcoreClassifier(); - String _name_1 = _ecoreClassifier.getName(); + String _name_1 = genCls.getEcoreClassifier().getName(); boolean _equals = Objects.equal(_name, _name_1); if (_equals) { return genCls; @@ -57,8 +55,7 @@ public class GenModelUtil2 { String _name_2 = cls.getName(); _builder.append(_name_2); _builder.append("\' found in GenModel "); - Resource _eResource = genPackage.eResource(); - URI _uRI = _eResource.getURI(); + URI _uRI = genPackage.eResource().getURI(); _builder.append(_uRI); throw new RuntimeException(_builder.toString()); } @@ -79,8 +76,7 @@ public class GenModelUtil2 { EList _genFeatures = genCls.getGenFeatures(); for (final GenFeature genFeat : _genFeatures) { String _name = feature.getName(); - EStructuralFeature _ecoreFeature = genFeat.getEcoreFeature(); - String _name_1 = _ecoreFeature.getName(); + String _name_1 = genFeat.getEcoreFeature().getName(); boolean _equals = Objects.equal(_name, _name_1); if (_equals) { return genFeat; @@ -93,8 +89,7 @@ public class GenModelUtil2 { _builder.append("\' found in GenClass \'"); _builder.append(genCls); _builder.append("\' from GenModel"); - Resource _eResource = genCls.eResource(); - URI _uRI = _eResource.getURI(); + URI _uRI = genCls.eResource().getURI(); _builder.append(_uRI); throw new RuntimeException(_builder.toString()); } @@ -118,8 +113,7 @@ public class GenModelUtil2 { if ((model instanceof GenModel)) { final GenPackage genPkg = ((GenModel)model).findGenPackage(pkg); if ((genPkg != null)) { - EPackage _ecorePackage = genPkg.getEcorePackage(); - _ecorePackage.getEClassifiers(); + genPkg.getEcorePackage().getEClassifiers(); return genPkg; } } @@ -140,8 +134,7 @@ public class GenModelUtil2 { } public static Resource getGenModelResource(final String locationInfo, final String nsURI, final ResourceSet resourceSet) { - Map _ePackageNsURIToGenModelLocationMap = EcorePlugin.getEPackageNsURIToGenModelLocationMap(false); - final URI genModelURI = _ePackageNsURIToGenModelLocationMap.get(nsURI); + final URI genModelURI = EcorePlugin.getEPackageNsURIToGenModelLocationMap(false).get(nsURI); if ((genModelURI == null)) { boolean _equals = Objects.equal(EcorePackage.eNS_URI, nsURI); if (_equals) { @@ -214,20 +207,16 @@ public class GenModelUtil2 { } public static String getIntLiteral(final EClass clazz, final EStructuralFeature feature, final ResourceSet resourceSet) { - GenClass _genClass = GenModelUtil2.getGenClass(clazz, resourceSet); - GenFeature _genFeature = GenModelUtil2.getGenFeature(feature, resourceSet); - return _genClass.getFeatureID(_genFeature); + return GenModelUtil2.getGenClass(clazz, resourceSet).getFeatureID(GenModelUtil2.getGenFeature(feature, resourceSet)); } public static String getIntLiteral(final EClassifier classifier, final ResourceSet resourceSet) { - GenClassifier _genClassifier = GenModelUtil2.getGenClassifier(classifier, resourceSet); - return _genClassifier.getClassifierID(); + return GenModelUtil2.getGenClassifier(classifier, resourceSet).getClassifierID(); } public static String getTypeLiteral(final EClassifier classifier, final ResourceSet resourceSet) { final GenClassifier genClassifier = GenModelUtil2.getGenClassifier(classifier, resourceSet); - GenPackage _genPackage = genClassifier.getGenPackage(); - boolean _isLiteralsInterface = _genPackage.isLiteralsInterface(); + boolean _isLiteralsInterface = genClassifier.getGenPackage().isLiteralsInterface(); if (_isLiteralsInterface) { String _classifierID = genClassifier.getClassifierID(); return ("Literals." + _classifierID); @@ -243,11 +232,9 @@ public class GenModelUtil2 { } public static String getFeatureLiteral(final GenFeature genFeature, final ResourceSet resourceSet) { - GenPackage _genPackage = genFeature.getGenPackage(); - boolean _isLiteralsInterface = _genPackage.isLiteralsInterface(); + boolean _isLiteralsInterface = genFeature.getGenPackage().isLiteralsInterface(); if (_isLiteralsInterface) { - GenClass _genClass = genFeature.getGenClass(); - String _featureID = _genClass.getFeatureID(genFeature); + String _featureID = genFeature.getGenClass().getFeatureID(genFeature); return ("Literals." + _featureID); } else { String _featureAccessorName = genFeature.getFeatureAccessorName(); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/GrammarUtil2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/GrammarUtil2.java index bc7e57bb7..ce26f99c5 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/GrammarUtil2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/GrammarUtil2.java @@ -35,11 +35,10 @@ public class GrammarUtil2 extends GrammarUtil { } public static Grammar getNonTerminalsSuperGrammar(final Grammar grammar) { - EList _usedGrammars = grammar.getUsedGrammars(); final Function1 _function = (Grammar it) -> { String _name = it.getName(); return Boolean.valueOf((!Objects.equal(_name, GrammarUtil2.TERMINALS))); }; - return IterableExtensions.findFirst(_usedGrammars, _function); + return IterableExtensions.findFirst(grammar.getUsedGrammars(), _function); } } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.java index b22152fed..f9953dbc2 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/util/SyntheticTerminalDetector.java @@ -32,8 +32,7 @@ public class SyntheticTerminalDetector { if ((_alternatives instanceof Keyword)) { AbstractElement _alternatives_1 = rule.getAlternatives(); String value = ((Keyword) _alternatives_1).getValue(); - TerminalRule _originalElement = AntlrGrammarGenUtil.getOriginalElement(rule); - String _name = _originalElement.getName(); + String _name = AntlrGrammarGenUtil.getOriginalElement(rule).getName(); String _plus = ("synthetic:" + _name); return Objects.equal(_plus, value); } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/validation/ValidatorFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/validation/ValidatorFragment2.java index caf681707..efaf56188 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/validation/ValidatorFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/validation/ValidatorFragment2.java @@ -13,11 +13,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EPackage; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtend2.lib.StringConcatenationClient; -import org.eclipse.xtext.AbstractMetamodelDeclaration; import org.eclipse.xtext.GeneratedMetamodel; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; @@ -29,20 +27,13 @@ import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.StringExtensions; import org.eclipse.xtext.xtext.generator.AbstractInheritingFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; -import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.XtendFileAccess; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.util.GrammarUtil2; import org.eclipse.xtext.xtext.generator.validation.ValidatorNaming; @@ -92,15 +83,7 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { @Override public void generate() { - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - Grammar _grammar = this.getGrammar(); - TypeReference _validatorClass = this._validatorNaming.getValidatorClass(_grammar); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _validatorClass_1 = this._validatorNaming.getValidatorClass(_grammar_1); - GuiceModuleAccess.BindingFactory _addTypeToTypeEagerSingleton = _bindingFactory.addTypeToTypeEagerSingleton(_validatorClass, _validatorClass_1); - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language.getRuntimeGenModule(); - _addTypeToTypeEagerSingleton.contributeTo(_runtimeGenModule); + new GuiceModuleAccess.BindingFactory().addTypeToTypeEagerSingleton(this._validatorNaming.getValidatorClass(this.getGrammar()), this._validatorNaming.getValidatorClass(this.getGrammar())).contributeTo(this.getLanguage().getRuntimeGenModule()); boolean _isGenerateStub = this.isGenerateStub(); if (_isGenerateStub) { boolean _isGenerateXtendStub = this.isGenerateXtendStub(); @@ -111,23 +94,14 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { } } this.generateGenValidator(); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - ManifestAccess _manifest = _runtime.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_1.getRuntime(); - ManifestAccess _manifest_1 = _runtime_1.getManifest(); - Set _exportedPackages = _manifest_1.getExportedPackages(); - Grammar _grammar_2 = this.getGrammar(); - TypeReference _validatorClass_2 = this._validatorNaming.getValidatorClass(_grammar_2); - String _packageName = _validatorClass_2.getPackageName(); + Set _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages(); + String _packageName = this._validatorNaming.getValidatorClass(this.getGrammar()).getPackageName(); _exportedPackages.add(_packageName); } - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig_2.getEclipsePlugin(); - PluginXmlAccess _pluginXml = _eclipsePlugin.getPluginXml(); + PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml(); boolean _tripleNotEquals_1 = (_pluginXml != null); if (_tripleNotEquals_1) { this.contributeEclipsePluginExtensions(); @@ -135,8 +109,7 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { } protected void generateXtendValidatorStub() { - Grammar _grammar = this.getGrammar(); - TypeReference _validatorClass = this._validatorNaming.getValidatorClass(_grammar); + TypeReference _validatorClass = this._validatorNaming.getValidatorClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -155,13 +128,10 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - Grammar _grammar = ValidatorFragment2.this.getGrammar(); - TypeReference _validatorClass = ValidatorFragment2.this._validatorNaming.getValidatorClass(_grammar); - String _simpleName = _validatorClass.getSimpleName(); + String _simpleName = ValidatorFragment2.this._validatorNaming.getValidatorClass(ValidatorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = ValidatorFragment2.this.getGrammar(); - TypeReference _abstractValidatorClass = ValidatorFragment2.this._validatorNaming.getAbstractValidatorClass(_grammar_1); + TypeReference _abstractValidatorClass = ValidatorFragment2.this._validatorNaming.getAbstractValidatorClass(ValidatorFragment2.this.getGrammar()); _builder.append(_abstractValidatorClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -180,8 +150,7 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { _builder.append("//\t\t\twarning(\'Name should start with a capital\', "); _builder.newLine(); _builder.append("//\t\t\t\t\t"); - Grammar _grammar_2 = ValidatorFragment2.this.getGrammar(); - String _simpleName_1 = GrammarUtil.getSimpleName(_grammar_2); + String _simpleName_1 = GrammarUtil.getSimpleName(ValidatorFragment2.this.getGrammar()); _builder.append(_simpleName_1); _builder.append("Package.Literals.GREETING__NAME,"); _builder.newLineIfNotEmpty(); @@ -197,16 +166,11 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_validatorClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_validatorClass, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } protected void generateJavaValidatorStub() { - Grammar _grammar = this.getGrammar(); - TypeReference _validatorClass = this._validatorNaming.getValidatorClass(_grammar); + TypeReference _validatorClass = this._validatorNaming.getValidatorClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -225,13 +189,10 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { _builder.append("*/"); _builder.newLine(); _builder.append("public class "); - Grammar _grammar = ValidatorFragment2.this.getGrammar(); - TypeReference _validatorClass = ValidatorFragment2.this._validatorNaming.getValidatorClass(_grammar); - String _simpleName = _validatorClass.getSimpleName(); + String _simpleName = ValidatorFragment2.this._validatorNaming.getValidatorClass(ValidatorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar_1 = ValidatorFragment2.this.getGrammar(); - TypeReference _abstractValidatorClass = ValidatorFragment2.this._validatorNaming.getAbstractValidatorClass(_grammar_1); + TypeReference _abstractValidatorClass = ValidatorFragment2.this._validatorNaming.getAbstractValidatorClass(ValidatorFragment2.this.getGrammar()); _builder.append(_abstractValidatorClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -250,8 +211,7 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { _builder.append("//\t\t\twarning(\"Name should start with a capital\","); _builder.newLine(); _builder.append("//\t\t\t\t\t"); - Grammar _grammar_2 = ValidatorFragment2.this.getGrammar(); - String _simpleName_1 = GrammarUtil.getSimpleName(_grammar_2); + String _simpleName_1 = GrammarUtil.getSimpleName(ValidatorFragment2.this.getGrammar()); _builder.append(_simpleName_1); _builder.append("Package.Literals.GREETING__NAME,"); _builder.newLineIfNotEmpty(); @@ -267,22 +227,16 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { _builder.newLine(); } }; - JavaFileAccess _createJavaFile = this.fileAccessFactory.createJavaFile(_validatorClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createJavaFile.writeTo(_src); + this.fileAccessFactory.createJavaFile(_validatorClass, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } protected void generateGenValidator() { TypeReference _xifexpression = null; boolean _isGenerateStub = this.isGenerateStub(); if (_isGenerateStub) { - Grammar _grammar = this.getGrammar(); - _xifexpression = this._validatorNaming.getAbstractValidatorClass(_grammar); + _xifexpression = this._validatorNaming.getAbstractValidatorClass(this.getGrammar()); } else { - Grammar _grammar_1 = this.getGrammar(); - _xifexpression = this._validatorNaming.getValidatorClass(_grammar_1); + _xifexpression = this._validatorNaming.getValidatorClass(this.getGrammar()); } final TypeReference genClass = _xifexpression; final GeneratedJavaFileAccess javaFile = this.fileAccessFactory.createGeneratedJavaFile(genClass); @@ -324,8 +278,7 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { String _simpleName = genClass.getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); - Grammar _grammar = ValidatorFragment2.this.getGrammar(); - TypeReference _genValidatorSuperClass = ValidatorFragment2.this.getGenValidatorSuperClass(_grammar); + TypeReference _genValidatorSuperClass = ValidatorFragment2.this.getGenValidatorSuperClass(ValidatorFragment2.this.getGrammar()); _builder.append(_genValidatorSuperClass); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -392,46 +345,34 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { } }; javaFile.setContent(_client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _srcGen = _runtime.getSrcGen(); - javaFile.writeTo(_srcGen); + javaFile.writeTo(this.getProjectConfig().getRuntime().getSrcGen()); } protected Iterable getGeneratedPackagesToValidate() { - Grammar _grammar = this.getGrammar(); - EList _metamodelDeclarations = _grammar.getMetamodelDeclarations(); - Iterable _filter = Iterables.filter(_metamodelDeclarations, GeneratedMetamodel.class); final Function1 _function = (GeneratedMetamodel it) -> { return it.getEPackage(); }; - return IterableExtensions.map(_filter, _function); + return IterableExtensions.map(Iterables.filter(this.getGrammar().getMetamodelDeclarations(), GeneratedMetamodel.class), _function); } protected Collection getRegistryPackagesToValidate() { final Collection packages = GrammarUtil.allEPackagesToValidate(this.getGrammar()); - List _allMetamodelDeclarations = GrammarUtil.allMetamodelDeclarations(this.getGrammar()); - Iterable _filter = Iterables.filter(_allMetamodelDeclarations, GeneratedMetamodel.class); final Function1 _function = (GeneratedMetamodel it) -> { return it.getEPackage(); }; - Iterable _map = IterableExtensions.map(_filter, _function); - List _list = IterableExtensions.toList(_map); - packages.removeAll(_list); + packages.removeAll(IterableExtensions.toList(IterableExtensions.map(Iterables.filter(GrammarUtil.allMetamodelDeclarations(this.getGrammar()), GeneratedMetamodel.class), _function))); return packages; } protected String getGeneratedEPackageName(final EPackage pack) { StringConcatenation _builder = new StringConcatenation(); - Grammar _grammar = this.getGrammar(); - String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(_grammar); + String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar()); _builder.append(_runtimeBasePackage); _builder.append("."); String _name = pack.getName(); _builder.append(_name); _builder.append("."); - String _name_1 = pack.getName(); - String _firstUpper = StringExtensions.toFirstUpper(_name_1); + String _firstUpper = StringExtensions.toFirstUpper(pack.getName()); _builder.append(_firstUpper); _builder.append("Package"); return _builder.toString(); @@ -441,14 +382,10 @@ public class ValidatorFragment2 extends AbstractInheritingFragment { boolean _xblockexpression = false; { final String simpleName = GrammarUtil.getSimpleName(this.getGrammar()); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - PluginXmlAccess _pluginXml = _eclipsePlugin.getPluginXml(); - List _entries = _pluginXml.getEntries(); + List _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); StringConcatenation _builder = new StringConcatenation(); _builder.append(""); _builder.newLineIfNotEmpty(); diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/web/WebIntegrationFragment.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/web/WebIntegrationFragment.java index 3131a71d9..88006eda9 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/web/WebIntegrationFragment.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/web/WebIntegrationFragment.java @@ -18,7 +18,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.function.Consumer; -import java.util.regex.Matcher; import java.util.regex.Pattern; import org.eclipse.emf.mwe2.runtime.Mandatory; import org.eclipse.xtend.lib.annotations.AccessorType; @@ -38,16 +37,11 @@ import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xbase.lib.StringExtensions; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; import org.eclipse.xtext.xtext.generator.CodeConfig; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.Issues; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.TextFileAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.XtendFileAccess; -import org.eclipse.xtext.xtext.generator.model.project.IWebProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.util.BooleanGeneratorOption; import org.eclipse.xtext.xtext.generator.util.GeneratorOption; import org.eclipse.xtext.xtext.generator.util.GrammarUtil2; @@ -143,9 +137,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { */ @Mandatory public void setFramework(final String frameworkName) { - String _upperCase = frameworkName.toUpperCase(); - WebIntegrationFragment.Framework _valueOf = WebIntegrationFragment.Framework.valueOf(_upperCase); - this.framework.set(_valueOf); + this.framework.set(WebIntegrationFragment.Framework.valueOf(frameworkName.toUpperCase())); } /** @@ -275,11 +267,11 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { @Override public void generate() { if (((this.highlightingModuleName != null) && this.highlightingModuleName.endsWith(".js"))) { - this.highlightingModuleName = this.highlightingModuleName.substring(0, (this.highlightingModuleName.length() - 3)); + int _length = this.highlightingModuleName.length(); + int _minus = (_length - 3); + this.highlightingModuleName = this.highlightingModuleName.substring(0, _minus); } - IXtextGeneratorLanguage _language = this.getLanguage(); - List _fileExtensions = _language.getFileExtensions(); - final String langId = IterableExtensions.head(_fileExtensions); + final String langId = IterableExtensions.head(this.getLanguage().getFileExtensions()); String _elvis = null; if (this.highlightingModuleName != null) { _elvis = this.highlightingModuleName; @@ -333,27 +325,23 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { }.apply(); protected void generateJsHighlighting(final String langId) { - Grammar _grammar = this.getGrammar(); - final Set allKeywords = GrammarUtil.getAllKeywords(_grammar); + final Set allKeywords = GrammarUtil.getAllKeywords(this.getGrammar()); final ArrayList wordKeywords = CollectionLiterals.newArrayList(); final ArrayList nonWordKeywords = CollectionLiterals.newArrayList(); final Pattern keywordsFilterPattern = Pattern.compile(this.keywordsFilter); final Pattern wordKeywordPattern = Pattern.compile("\\w(.*\\w)?"); final Function1 _function = (String it) -> { - Matcher _matcher = keywordsFilterPattern.matcher(it); - return Boolean.valueOf(_matcher.matches()); + return Boolean.valueOf(keywordsFilterPattern.matcher(it).matches()); }; - Iterable _filter = IterableExtensions.filter(allKeywords, _function); final Consumer _function_1 = (String it) -> { - Matcher _matcher = wordKeywordPattern.matcher(it); - boolean _matches = _matcher.matches(); + boolean _matches = wordKeywordPattern.matcher(it).matches(); if (_matches) { wordKeywords.add(it); } else { nonWordKeywords.add(it); } }; - _filter.forEach(_function_1); + IterableExtensions.filter(allKeywords, _function).forEach(_function_1); Collections.sort(wordKeywords); Collections.sort(nonWordKeywords); final TextFileAccess jsFile = this.fileAccessFactory.createTextFile(); @@ -689,10 +677,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { break; } } - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IWebProjectConfig _web = _projectConfig.getWeb(); - IXtextGeneratorFileSystemAccess _assets = _web.getAssets(); - jsFile.writeTo(_assets); + jsFile.writeTo(this.getProjectConfig().getWeb().getAssets()); } protected CharSequence generateKeywords(final List wordKeywords, final List nonWordKeywords) { @@ -775,10 +760,8 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { } protected Collection createOrionPatterns(final String langId, final Set keywords) { - Grammar _grammar = this.getGrammar(); - final boolean inheritsTerminals = GrammarUtil2.inherits(_grammar, GrammarUtil2.TERMINALS); - Grammar _grammar_1 = this.getGrammar(); - final boolean inheritsXbase = this._xbaseUsageDetector.inheritsXbase(_grammar_1); + final boolean inheritsTerminals = GrammarUtil2.inherits(this.getGrammar(), GrammarUtil2.TERMINALS); + final boolean inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getGrammar()); final ArrayList patterns = new ArrayList(); if ((this.enabledPatterns.contains("comment_singleLine") || ((inheritsTerminals || inheritsXbase) && (!this.suppressedPatterns.contains("comment_singleLine"))))) { patterns.add("{include: \"orion.c-like#comment_singleLine\"}"); @@ -824,10 +807,8 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { } protected Multimap createCodeMirrorPatterns(final String langId, final Set keywords) { - Grammar _grammar = this.getGrammar(); - final boolean inheritsTerminals = GrammarUtil2.inherits(_grammar, GrammarUtil2.TERMINALS); - Grammar _grammar_1 = this.getGrammar(); - final boolean inheritsXbase = this._xbaseUsageDetector.inheritsXbase(_grammar_1); + final boolean inheritsTerminals = GrammarUtil2.inherits(this.getGrammar(), GrammarUtil2.TERMINALS); + final boolean inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getGrammar()); final LinkedHashMultimap patterns = LinkedHashMultimap.create(); final boolean hasSingleLineComment = (this.enabledPatterns.contains("comment_singleLine") || ((inheritsTerminals || inheritsXbase) && (!this.suppressedPatterns.contains("comment_singleLine")))); if (hasSingleLineComment) { @@ -928,10 +909,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { } protected void generateIndexDoc(final String hlModName) { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IWebProjectConfig _web = _projectConfig.getWeb(); - IXtextGeneratorFileSystemAccess _assets = _web.getAssets(); - boolean _isFile = _assets.isFile("index.html"); + boolean _isFile = this.getProjectConfig().getWeb().getAssets().isFile("index.html"); if (_isFile) { return; } @@ -1306,8 +1284,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("

Example "); - Grammar _grammar = WebIntegrationFragment.this.getGrammar(); - String _simpleName = GrammarUtil.getSimpleName(_grammar); + String _simpleName = GrammarUtil.getSimpleName(WebIntegrationFragment.this.getGrammar()); _builder.append(_simpleName, "\t\t"); _builder.append(" Web Editor

"); _builder.newLineIfNotEmpty(); @@ -1319,9 +1296,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("
_fileExtensions = _language.getFileExtensions(); - String _head = IterableExtensions.head(_fileExtensions); + String _head = IterableExtensions.head(WebIntegrationFragment.this.getLanguage().getFileExtensions()); _builder.append(_head, "\t\t"); _builder.append("\">
"); _builder.newLineIfNotEmpty(); @@ -1338,17 +1313,11 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { } }; indexFile.setContent(_client); - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IWebProjectConfig _web_1 = _projectConfig_1.getWeb(); - IXtextGeneratorFileSystemAccess _assets_1 = _web_1.getAssets(); - indexFile.writeTo(_assets_1); + indexFile.writeTo(this.getProjectConfig().getWeb().getAssets()); } protected void generateStyleSheet() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IWebProjectConfig _web = _projectConfig.getWeb(); - IXtextGeneratorFileSystemAccess _assets = _web.getAssets(); - boolean _isFile = _assets.isFile("style.css"); + boolean _isFile = this.getProjectConfig().getWeb().getAssets().isFile("style.css"); if (_isFile) { return; } @@ -1545,15 +1514,11 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { } }; styleFile.setContent(_client); - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IWebProjectConfig _web_1 = _projectConfig_1.getWeb(); - IXtextGeneratorFileSystemAccess _assets_1 = _web_1.getAssets(); - styleFile.writeTo(_assets_1); + styleFile.writeTo(this.getProjectConfig().getWeb().getAssets()); } protected void generateServerLauncher() { - Grammar _grammar = this.getGrammar(); - TypeReference _serverLauncherClass = this.getServerLauncherClass(_grammar); + TypeReference _serverLauncherClass = this.getServerLauncherClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -1569,9 +1534,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - Grammar _grammar = WebIntegrationFragment.this.getGrammar(); - TypeReference _serverLauncherClass = WebIntegrationFragment.this.getServerLauncherClass(_grammar); - String _simpleName = _serverLauncherClass.getSimpleName(); + String _simpleName = WebIntegrationFragment.this.getServerLauncherClass(WebIntegrationFragment.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -1595,14 +1558,8 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { _builder.newLineIfNotEmpty(); _builder.append("\t\t\t"); _builder.append("resourceBase = \'"); - IXtextProjectConfig _projectConfig = WebIntegrationFragment.this.getProjectConfig(); - IWebProjectConfig _web = _projectConfig.getWeb(); - IXtextGeneratorFileSystemAccess _assets = _web.getAssets(); - String _path = _assets.getPath(); - IXtextProjectConfig _projectConfig_1 = WebIntegrationFragment.this.getProjectConfig(); - IWebProjectConfig _web_1 = _projectConfig_1.getWeb(); - IXtextGeneratorFileSystemAccess _root = _web_1.getRoot(); - String _path_1 = _root.getPath(); + String _path = WebIntegrationFragment.this.getProjectConfig().getWeb().getAssets().getPath(); + String _path_1 = WebIntegrationFragment.this.getProjectConfig().getWeb().getRoot().getPath(); String _plus = (_path_1 + "/"); String _replace = _path.replace(_plus, ""); _builder.append(_replace, "\t\t\t"); @@ -1648,10 +1605,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { TypeReference _typeRef_7 = TypeReference.typeRef("org.eclipse.jetty.webapp.WebInfConfiguration"); _builder.append(_typeRef_7, "\t\t\t"); _builder.append(".CONTAINER_JAR_PATTERN, \'.*/"); - IXtextProjectConfig _projectConfig_2 = WebIntegrationFragment.this.getProjectConfig(); - IWebProjectConfig _web_2 = _projectConfig_2.getWeb(); - String _name = _web_2.getName(); - String _replace_1 = _name.replace(".", "\\\\."); + String _replace_1 = WebIntegrationFragment.this.getProjectConfig().getWeb().getName().replace(".", "\\\\."); _builder.append(_replace_1, "\t\t\t"); _builder.append("/.*,.*\\\\.jar\')"); _builder.newLineIfNotEmpty(); @@ -1666,9 +1620,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { TypeReference _typeRef_8 = TypeReference.typeRef("org.eclipse.jetty.util.log.Slf4jLog"); _builder.append(_typeRef_8, "\t\t"); _builder.append("("); - Grammar _grammar_1 = WebIntegrationFragment.this.getGrammar(); - TypeReference _serverLauncherClass_1 = WebIntegrationFragment.this.getServerLauncherClass(_grammar_1); - String _simpleName_1 = _serverLauncherClass_1.getSimpleName(); + String _simpleName_1 = WebIntegrationFragment.this.getServerLauncherClass(WebIntegrationFragment.this.getGrammar()).getSimpleName(); _builder.append(_simpleName_1, "\t\t"); _builder.append(".name)"); _builder.newLineIfNotEmpty(); @@ -1730,16 +1682,11 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_serverLauncherClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IWebProjectConfig _web = _projectConfig.getWeb(); - IXtextGeneratorFileSystemAccess _src = _web.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_serverLauncherClass, _client).writeTo(this.getProjectConfig().getWeb().getSrc()); } protected void generateServlet() { - Grammar _grammar = this.getGrammar(); - TypeReference _servletClass = this.getServletClass(_grammar); + TypeReference _servletClass = this.getServletClass(this.getGrammar()); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { @@ -1761,9 +1708,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { } } _builder.append("class "); - Grammar _grammar = WebIntegrationFragment.this.getGrammar(); - TypeReference _servletClass = WebIntegrationFragment.this.getServletClass(_grammar); - String _simpleName = _servletClass.getSimpleName(); + String _simpleName = WebIntegrationFragment.this.getServletClass(WebIntegrationFragment.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.web.servlet.XtextServlet"); @@ -1786,8 +1731,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("val injector = new "); - Grammar _grammar_1 = WebIntegrationFragment.this.getGrammar(); - TypeReference _webSetup = WebIntegrationFragment.this._xtextGeneratorNaming.getWebSetup(_grammar_1); + TypeReference _webSetup = WebIntegrationFragment.this._xtextGeneratorNaming.getWebSetup(WebIntegrationFragment.this.getGrammar()); _builder.append(_webSetup, "\t\t"); _builder.append("().createInjectorAndDoEMFRegistration()"); _builder.newLineIfNotEmpty(); @@ -1828,18 +1772,11 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_servletClass, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IWebProjectConfig _web = _projectConfig.getWeb(); - IXtextGeneratorFileSystemAccess _src = _web.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_servletClass, _client).writeTo(this.getProjectConfig().getWeb().getSrc()); } protected void generateWebXml() { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IWebProjectConfig _web = _projectConfig.getWeb(); - IXtextGeneratorFileSystemAccess _assets = _web.getAssets(); - boolean _isFile = _assets.isFile("WEB-INF/web.xml"); + boolean _isFile = this.getProjectConfig().getWeb().getAssets().isFile("WEB-INF/web.xml"); if (_isFile) { return; } @@ -1899,8 +1836,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { _builder.append("\t"); _builder.append("\t"); _builder.append(""); - Grammar _grammar = WebIntegrationFragment.this.getGrammar(); - TypeReference _servletClass = WebIntegrationFragment.this.getServletClass(_grammar); + TypeReference _servletClass = WebIntegrationFragment.this.getServletClass(WebIntegrationFragment.this.getGrammar()); _builder.append(_servletClass, "\t\t"); _builder.append(""); _builder.newLineIfNotEmpty(); @@ -2026,10 +1962,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment { } }; xmlFile.setContent(_client); - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IWebProjectConfig _web_1 = _projectConfig_1.getWeb(); - IXtextGeneratorFileSystemAccess _assets_1 = _web_1.getAssets(); - xmlFile.writeTo(_assets_1); + xmlFile.writeTo(this.getProjectConfig().getWeb().getAssets()); } @Pure diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/xbase/XbaseGeneratorFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/xbase/XbaseGeneratorFragment2.java index 26b9c38d6..5c870f636 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/xbase/XbaseGeneratorFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/xbase/XbaseGeneratorFragment2.java @@ -11,18 +11,12 @@ import com.google.inject.Inject; import java.util.Collections; import java.util.List; import java.util.Set; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.xtend.lib.annotations.AccessorType; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtend2.lib.StringConcatenationClient; import org.eclipse.xtext.AbstractRule; -import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; -import org.eclipse.xtext.TypeRef; import org.eclipse.xtext.naming.IQualifiedNameProvider; import org.eclipse.xtext.resource.ILocationInFileProvider; import org.eclipse.xtext.scoping.IGlobalScopeProvider; @@ -31,18 +25,12 @@ import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage; import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming; import org.eclipse.xtext.xtext.generator.model.FileAccessFactory; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; -import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess; import org.eclipse.xtext.xtext.generator.model.ManifestAccess; import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import org.eclipse.xtext.xtext.generator.model.XtendFileAccess; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.util.GenModelUtil2; import org.eclipse.xtext.xtext.generator.xbase.XbaseUsageDetector; @@ -75,11 +63,9 @@ public class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment { private XbaseUsageDetector _xbaseUsageDetector; protected TypeReference getJvmModelInferrer() { - Grammar _grammar = this.getGrammar(); - String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(_grammar); + String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar()); String _plus = (_runtimeBasePackage + ".jvmmodel."); - Grammar _grammar_1 = this.getGrammar(); - String _simpleName = GrammarUtil.getSimpleName(_grammar_1); + String _simpleName = GrammarUtil.getSimpleName(this.getGrammar()); String _plus_1 = (_plus + _simpleName); String _plus_2 = (_plus_1 + "JvmModelInferrer"); return new TypeReference(_plus_2); @@ -87,17 +73,14 @@ public class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment { @Override public void generate() { - Grammar _grammar = this.getGrammar(); - boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(_grammar); + boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getGrammar()); boolean _not = (!_inheritsXbase); if (_not) { return; } this.contributeRuntimeGuiceBindings(); this.contributeEclipsePluginGuiceBindings(); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - PluginXmlAccess _pluginXml = _eclipsePlugin.getPluginXml(); + PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml(); boolean _tripleNotEquals = (_pluginXml != null); if (_tripleNotEquals) { this.contributeEclipsePluginExtensions(); @@ -105,95 +88,55 @@ public class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment { if (this.generateXtendInferrer) { this.doGenerateXtendInferrer(); } - IXtextProjectConfig _projectConfig_1 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig_1.getRuntime(); - ManifestAccess _manifest = _runtime.getManifest(); + ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest(); boolean _tripleNotEquals_1 = (_manifest != null); if (_tripleNotEquals_1) { - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_1 = _projectConfig_2.getRuntime(); - ManifestAccess _manifest_1 = _runtime_1.getManifest(); - Set _requiredBundles = _manifest_1.getRequiredBundles(); - _requiredBundles.addAll( + this.getProjectConfig().getRuntime().getManifest().getRequiredBundles().addAll( Collections.unmodifiableList(CollectionLiterals.newArrayList("org.eclipse.xtext.xbase", "org.eclipse.xtext.xbase.lib"))); if (((this.generateXtendInferrer || this.useInferredJvmModel) && (!this.skipExportedPackage))) { - IXtextProjectConfig _projectConfig_3 = this.getProjectConfig(); - IRuntimeProjectConfig _runtime_2 = _projectConfig_3.getRuntime(); - ManifestAccess _manifest_2 = _runtime_2.getManifest(); - Set _exportedPackages = _manifest_2.getExportedPackages(); - TypeReference _jvmModelInferrer = this.getJvmModelInferrer(); - String _packageName = _jvmModelInferrer.getPackageName(); + Set _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages(); + String _packageName = this.getJvmModelInferrer().getPackageName(); _exportedPackages.add(_packageName); } } - IXtextProjectConfig _projectConfig_4 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_1 = _projectConfig_4.getEclipsePlugin(); - ManifestAccess _manifest_3 = _eclipsePlugin_1.getManifest(); - boolean _tripleNotEquals_2 = (_manifest_3 != null); + ManifestAccess _manifest_1 = this.getProjectConfig().getEclipsePlugin().getManifest(); + boolean _tripleNotEquals_2 = (_manifest_1 != null); if (_tripleNotEquals_2) { - IXtextProjectConfig _projectConfig_5 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_2 = _projectConfig_5.getEclipsePlugin(); - ManifestAccess _manifest_4 = _eclipsePlugin_2.getManifest(); - Set _requiredBundles_1 = _manifest_4.getRequiredBundles(); - _requiredBundles_1.addAll( + this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles().addAll( Collections.unmodifiableList(CollectionLiterals.newArrayList("org.eclipse.xtext.xbase.ui", "org.eclipse.jdt.debug.ui"))); } - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _ideGenModule = _language.getIdeGenModule(); + GuiceModuleAccess _ideGenModule = this.getLanguage().getIdeGenModule(); _ideGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.ide.DefaultXbaseIdeModule")); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - GuiceModuleAccess _webGenModule = _language_1.getWebGenModule(); + GuiceModuleAccess _webGenModule = this.getLanguage().getWebGenModule(); _webGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.web.DefaultXbaseWebModule")); } protected void contributeRuntimeGuiceBindings() { - GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory(); - TypeReference _typeRef = TypeReference.typeRef(IQualifiedNameProvider.class); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.xbase.scoping.XbaseQualifiedNameProvider"); - final GuiceModuleAccess.BindingFactory bindingFactory = _bindingFactory.addTypeToType(_typeRef, _typeRef_1); + final GuiceModuleAccess.BindingFactory bindingFactory = new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IQualifiedNameProvider.class), + TypeReference.typeRef("org.eclipse.xtext.xbase.scoping.XbaseQualifiedNameProvider")); if (this.useInferredJvmModel) { - TypeReference _typeRef_2 = TypeReference.typeRef(ILocationInFileProvider.class); - TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.xbase.jvmmodel.JvmLocationInFileProvider"); - GuiceModuleAccess.BindingFactory _addTypeToType = bindingFactory.addTypeToType(_typeRef_2, _typeRef_3); - TypeReference _typeRef_4 = TypeReference.typeRef(IGlobalScopeProvider.class); - TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider"); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeRef_4, _typeRef_5); - TypeReference _typeRef_6 = TypeReference.typeRef("org.eclipse.xtext.xbase.validation.FeatureNameValidator"); - TypeReference _typeRef_7 = TypeReference.typeRef("org.eclipse.xtext.xbase.validation.LogicalContainerAwareFeatureNameValidator"); - GuiceModuleAccess.BindingFactory _addTypeToType_2 = _addTypeToType_1.addTypeToType(_typeRef_6, _typeRef_7); - TypeReference _typeRef_8 = TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.DefaultBatchTypeResolver"); - TypeReference _typeRef_9 = TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareBatchTypeResolver"); - GuiceModuleAccess.BindingFactory _addTypeToType_3 = _addTypeToType_2.addTypeToType(_typeRef_8, _typeRef_9); - TypeReference _typeRef_10 = TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.DefaultReentrantTypeResolver"); - TypeReference _typeRef_11 = TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareReentrantTypeResolver"); - GuiceModuleAccess.BindingFactory _addTypeToType_4 = _addTypeToType_3.addTypeToType(_typeRef_10, _typeRef_11); - TypeReference _typeRef_12 = TypeReference.typeRef(IResourceValidator.class); - TypeReference _typeRef_13 = TypeReference.typeRef("org.eclipse.xtext.xbase.annotations.validation.DerivedStateAwareResourceValidator"); - _addTypeToType_4.addTypeToType(_typeRef_12, _typeRef_13); + bindingFactory.addTypeToType(TypeReference.typeRef(ILocationInFileProvider.class), + TypeReference.typeRef("org.eclipse.xtext.xbase.jvmmodel.JvmLocationInFileProvider")).addTypeToType(TypeReference.typeRef(IGlobalScopeProvider.class), + TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.validation.FeatureNameValidator"), + TypeReference.typeRef("org.eclipse.xtext.xbase.validation.LogicalContainerAwareFeatureNameValidator")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.DefaultBatchTypeResolver"), + TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareBatchTypeResolver")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.DefaultReentrantTypeResolver"), + TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareReentrantTypeResolver")).addTypeToType(TypeReference.typeRef(IResourceValidator.class), + TypeReference.typeRef("org.eclipse.xtext.xbase.annotations.validation.DerivedStateAwareResourceValidator")); if (this.generateXtendInferrer) { - TypeReference _typeRef_14 = TypeReference.typeRef("org.eclipse.xtext.xbase.jvmmodel.IJvmModelInferrer"); - TypeReference _jvmModelInferrer = this.getJvmModelInferrer(); - bindingFactory.addTypeToType(_typeRef_14, _jvmModelInferrer); + bindingFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.jvmmodel.IJvmModelInferrer"), this.getJvmModelInferrer()); } } else { - TypeReference _typeRef_15 = TypeReference.typeRef(ILocationInFileProvider.class); - TypeReference _typeRef_16 = TypeReference.typeRef("org.eclipse.xtext.xbase.resource.XbaseLocationInFileProvider"); - bindingFactory.addTypeToType(_typeRef_15, _typeRef_16); + bindingFactory.addTypeToType(TypeReference.typeRef(ILocationInFileProvider.class), + TypeReference.typeRef("org.eclipse.xtext.xbase.resource.XbaseLocationInFileProvider")); } - IXtextGeneratorLanguage _language = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule = _language.getRuntimeGenModule(); - bindingFactory.contributeTo(_runtimeGenModule); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - Grammar _grammar = _language_1.getGrammar(); - boolean _inheritsXbaseWithAnnotations = this._xbaseUsageDetector.inheritsXbaseWithAnnotations(_grammar); + bindingFactory.contributeTo(this.getLanguage().getRuntimeGenModule()); + boolean _inheritsXbaseWithAnnotations = this._xbaseUsageDetector.inheritsXbaseWithAnnotations(this.getLanguage().getGrammar()); if (_inheritsXbaseWithAnnotations) { - IXtextGeneratorLanguage _language_2 = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule_1 = _language_2.getRuntimeGenModule(); - _runtimeGenModule_1.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.annotations.DefaultXbaseWithAnnotationsRuntimeModule")); + GuiceModuleAccess _runtimeGenModule = this.getLanguage().getRuntimeGenModule(); + _runtimeGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.annotations.DefaultXbaseWithAnnotationsRuntimeModule")); } else { - IXtextGeneratorLanguage _language_3 = this.getLanguage(); - GuiceModuleAccess _runtimeGenModule_2 = _language_3.getRuntimeGenModule(); - _runtimeGenModule_2.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.DefaultXbaseRuntimeModule")); + GuiceModuleAccess _runtimeGenModule_1 = this.getLanguage().getRuntimeGenModule(); + _runtimeGenModule_1.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.DefaultXbaseRuntimeModule")); } } @@ -234,93 +177,49 @@ public class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment { } }; final StringConcatenationClient statement = _client; - TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.editor.findrefs.FindReferencesHandler"); - TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.findrefs.JvmModelFindReferenceHandler"); - GuiceModuleAccess.BindingFactory _addTypeToType = bindingFactory.addTypeToType(_typeRef, _typeRef_1); - TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.findrefs.ReferenceQueryExecutor"); - TypeReference _typeRef_3 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.findrefs.JvmModelReferenceQueryExecutor"); - GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeRef_2, _typeRef_3); - TypeReference _typeRef_4 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator"); - TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.refactoring.JvmModelDependentElementsCalculator"); - GuiceModuleAccess.BindingFactory _addTypeToType_2 = _addTypeToType_1.addTypeToType(_typeRef_4, _typeRef_5); - TypeReference _typeRef_6 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider"); - TypeReference _typeRef_7 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.refactoring.jdt.CombinedJvmJdtRenameRefactoringProvider"); - GuiceModuleAccess.BindingFactory _addTypeToType_3 = _addTypeToType_2.addTypeToType(_typeRef_6, _typeRef_7); - TypeReference _typeRef_8 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IReferenceUpdater"); - TypeReference _typeRef_9 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.refactoring.XbaseReferenceUpdater"); - GuiceModuleAccess.BindingFactory _addTypeToType_4 = _addTypeToType_3.addTypeToType(_typeRef_8, _typeRef_9); - TypeReference _typeRef_10 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.ui.IRenameContextFactory"); - TypeReference _typeRef_11 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.refactoring.jdt.CombinedJvmJdtRenameContextFactory"); - GuiceModuleAccess.BindingFactory _addfinalTypeToType = _addTypeToType_4.addfinalTypeToType(_typeRef_10, _typeRef_11); - TypeReference _typeRef_12 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameStrategy"); - TypeReference _typeRef_13 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.refactoring.DefaultJvmModelRenameStrategy"); - GuiceModuleAccess.BindingFactory _addTypeToType_5 = _addfinalTypeToType.addTypeToType(_typeRef_12, _typeRef_13); + GuiceModuleAccess.BindingFactory _addTypeToType = bindingFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.findrefs.FindReferencesHandler"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.findrefs.JvmModelFindReferenceHandler")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.findrefs.ReferenceQueryExecutor"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.findrefs.JvmModelReferenceQueryExecutor")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.refactoring.JvmModelDependentElementsCalculator")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.refactoring.jdt.CombinedJvmJdtRenameRefactoringProvider")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IReferenceUpdater"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.refactoring.XbaseReferenceUpdater")).addfinalTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.ui.IRenameContextFactory"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.refactoring.jdt.CombinedJvmJdtRenameContextFactory")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameStrategy"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.refactoring.DefaultJvmModelRenameStrategy")); TypeReference _typeReference = new TypeReference("org.eclipse.xtext.common.types.ui.refactoring.participant", "JdtRenameParticipant.ContextFactory"); TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.xbase.ui.jvmmodel.refactoring", "JvmModelJdtRenameParticipantContext.ContextFactory"); - GuiceModuleAccess.BindingFactory _addTypeToType_6 = _addTypeToType_5.addTypeToType(_typeReference, _typeReference_1); - TypeReference _typeRef_14 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.outline.impl.OutlineNodeElementOpener"); - TypeReference _typeRef_15 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.outline.JvmOutlineNodeElementOpener"); - GuiceModuleAccess.BindingFactory _addTypeToType_7 = _addTypeToType_6.addTypeToType(_typeRef_14, _typeRef_15); - TypeReference _typeRef_16 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.GlobalURIEditorOpener"); - TypeReference _typeRef_17 = TypeReference.typeRef("org.eclipse.xtext.common.types.ui.navigation.GlobalDerivedMemberAwareURIEditorOpener"); - GuiceModuleAccess.BindingFactory _addTypeToType_8 = _addTypeToType_7.addTypeToType(_typeRef_16, _typeRef_17); - TypeReference _typeRef_18 = TypeReference.typeRef("org.eclipse.xtext.common.types.ui.query.IJavaSearchParticipation"); + GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeReference, _typeReference_1).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.outline.impl.OutlineNodeElementOpener"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.jvmmodel.outline.JvmOutlineNodeElementOpener")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.GlobalURIEditorOpener"), + TypeReference.typeRef("org.eclipse.xtext.common.types.ui.navigation.GlobalDerivedMemberAwareURIEditorOpener")); + TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.common.types.ui.query.IJavaSearchParticipation"); TypeReference _typeReference_2 = new TypeReference("org.eclipse.xtext.common.types.ui.query", "IJavaSearchParticipation.No"); - GuiceModuleAccess.BindingFactory _addTypeToType_9 = _addTypeToType_8.addTypeToType(_typeRef_18, _typeReference_2); - _addTypeToType_9.addConfiguredBinding("LanguageSpecificURIEditorOpener", statement); + _addTypeToType_1.addTypeToType(_typeRef, _typeReference_2).addConfiguredBinding("LanguageSpecificURIEditorOpener", statement); } else { - TypeReference _typeRef_19 = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameStrategy"); - TypeReference _typeRef_20 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.refactoring.XbaseRenameStrategy"); - bindingFactory.addTypeToType(_typeRef_19, _typeRef_20); + bindingFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameStrategy"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.refactoring.XbaseRenameStrategy")); } - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - boolean _usesXImportSection = this._xbaseUsageDetector.usesXImportSection(_grammar); + boolean _usesXImportSection = this._xbaseUsageDetector.usesXImportSection(this.getLanguage().getGrammar()); if (_usesXImportSection) { - TypeReference _typeRef_21 = TypeReference.typeRef("org.eclipse.xtext.xbase.imports.IUnresolvedTypeResolver"); - TypeReference _typeRef_22 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.imports.InteractiveUnresolvedTypeResolver"); - GuiceModuleAccess.BindingFactory _addTypeToType_10 = bindingFactory.addTypeToType(_typeRef_21, _typeRef_22); - TypeReference _typeRef_23 = TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.ui.ITypesProposalProvider"); - TypeReference _typeRef_24 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.contentassist.ImportingTypesProposalProvider"); - GuiceModuleAccess.BindingFactory _addTypeToType_11 = _addTypeToType_10.addTypeToType(_typeRef_23, _typeRef_24); - TypeReference _typeRef_25 = TypeReference.typeRef("org.eclipse.xtext.ui.editor.templates.XtextTemplateContextType"); - TypeReference _typeRef_26 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.templates.XbaseTemplateContextType"); - _addTypeToType_11.addTypeToType(_typeRef_25, _typeRef_26); + bindingFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.imports.IUnresolvedTypeResolver"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.imports.InteractiveUnresolvedTypeResolver")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.ui.ITypesProposalProvider"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.contentassist.ImportingTypesProposalProvider")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.templates.XtextTemplateContextType"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.templates.XbaseTemplateContextType")); } else { - TypeReference _typeRef_27 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.quickfix.JavaTypeQuickfixes"); - TypeReference _typeRef_28 = TypeReference.typeRef("org.eclipse.xtext.xbase.ui.quickfix.JavaTypeQuickfixesNoImportSection"); - bindingFactory.addTypeToType(_typeRef_27, _typeRef_28); + bindingFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.ui.quickfix.JavaTypeQuickfixes"), + TypeReference.typeRef("org.eclipse.xtext.xbase.ui.quickfix.JavaTypeQuickfixesNoImportSection")); } - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule = _language_1.getEclipsePluginGenModule(); - bindingFactory.contributeTo(_eclipsePluginGenModule); - IXtextGeneratorLanguage _language_2 = this.getLanguage(); - Grammar _grammar_1 = _language_2.getGrammar(); - boolean _inheritsXbaseWithAnnotations = this._xbaseUsageDetector.inheritsXbaseWithAnnotations(_grammar_1); + bindingFactory.contributeTo(this.getLanguage().getEclipsePluginGenModule()); + boolean _inheritsXbaseWithAnnotations = this._xbaseUsageDetector.inheritsXbaseWithAnnotations(this.getLanguage().getGrammar()); if (_inheritsXbaseWithAnnotations) { - IXtextGeneratorLanguage _language_3 = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule_1 = _language_3.getEclipsePluginGenModule(); - _eclipsePluginGenModule_1.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.annotations.ui.DefaultXbaseWithAnnotationsUiModule")); + GuiceModuleAccess _eclipsePluginGenModule = this.getLanguage().getEclipsePluginGenModule(); + _eclipsePluginGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.annotations.ui.DefaultXbaseWithAnnotationsUiModule")); } else { - IXtextGeneratorLanguage _language_4 = this.getLanguage(); - GuiceModuleAccess _eclipsePluginGenModule_2 = _language_4.getEclipsePluginGenModule(); - _eclipsePluginGenModule_2.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.ui.DefaultXbaseUiModule")); + GuiceModuleAccess _eclipsePluginGenModule_1 = this.getLanguage().getEclipsePluginGenModule(); + _eclipsePluginGenModule_1.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.ui.DefaultXbaseUiModule")); } } protected void doGenerateXtendInferrer() { - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - EList _rules = _grammar.getRules(); - AbstractRule _head = IterableExtensions.head(_rules); - TypeRef _type = _head.getType(); - EClassifier _classifier = _type.getClassifier(); - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - Grammar _grammar_1 = _language_1.getGrammar(); - Resource _eResource = _grammar_1.eResource(); - ResourceSet _resourceSet = _eResource.getResourceSet(); - String _javaTypeName = GenModelUtil2.getJavaTypeName(_classifier, _resourceSet); - final TypeReference firstRuleType = TypeReference.typeRef(_javaTypeName); + final TypeReference firstRuleType = TypeReference.typeRef(GenModelUtil2.getJavaTypeName(IterableExtensions.head(this.getLanguage().getGrammar().getRules()).getType().getClassifier(), this.getLanguage().getGrammar().eResource().getResourceSet())); TypeReference _jvmModelInferrer = this.getJvmModelInferrer(); StringConcatenationClient _client = new StringConcatenationClient() { @Override @@ -343,8 +242,7 @@ public class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment { _builder.append("*/"); _builder.newLine(); _builder.append("class "); - TypeReference _jvmModelInferrer = XbaseGeneratorFragment2.this.getJvmModelInferrer(); - String _simpleName = _jvmModelInferrer.getSimpleName(); + String _simpleName = XbaseGeneratorFragment2.this.getJvmModelInferrer().getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.xbase.jvmmodel.AbstractModelInferrer"); @@ -485,24 +383,15 @@ public class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); } }; - XtendFileAccess _createXtendFile = this.fileAccessFactory.createXtendFile(_jvmModelInferrer, _client); - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IRuntimeProjectConfig _runtime = _projectConfig.getRuntime(); - IXtextGeneratorFileSystemAccess _src = _runtime.getSrc(); - _createXtendFile.writeTo(_src); + this.fileAccessFactory.createXtendFile(_jvmModelInferrer, _client).writeTo(this.getProjectConfig().getRuntime().getSrc()); } protected boolean contributeEclipsePluginExtensions() { boolean _xblockexpression = false; { - IXtextGeneratorLanguage _language = this.getLanguage(); - Grammar _grammar = _language.getGrammar(); - final String name = _grammar.getName(); + final String name = this.getLanguage().getGrammar().getName(); if (this.jdtTypeHierarchy) { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - PluginXmlAccess _pluginXml = _eclipsePlugin.getPluginXml(); - List _entries = _pluginXml.getEntries(); + List _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); StringConcatenation _builder = new StringConcatenation(); _builder.append(""); _builder.newLine(); @@ -513,8 +402,7 @@ public class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("class=\""); - Grammar _grammar_1 = this.getGrammar(); - TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(_grammar_1); + TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar()); _builder.append(_eclipsePluginExecutableExtensionFactory, "\t\t"); _builder.append(":org.eclipse.xtext.xbase.ui.hierarchy.OpenTypeHierarchyHandler\""); _builder.newLineIfNotEmpty(); @@ -546,8 +434,7 @@ public class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment { _builder.newLine(); _builder.append("\t\t"); _builder.append("class=\""); - Grammar _grammar_2 = this.getGrammar(); - TypeReference _eclipsePluginExecutableExtensionFactory_1 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(_grammar_2); + TypeReference _eclipsePluginExecutableExtensionFactory_1 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar()); _builder.append(_eclipsePluginExecutableExtensionFactory_1, "\t\t"); _builder.append(":org.eclipse.xtext.xbase.ui.hierarchy.QuickTypeHierarchyHandler\""); _builder.newLineIfNotEmpty(); @@ -575,9 +462,7 @@ public class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment { _builder.append(""); _builder.newLine(); { - IXtextGeneratorLanguage _language_1 = this.getLanguage(); - Grammar _grammar_3 = _language_1.getGrammar(); - boolean _usesXImportSection = this._xbaseUsageDetector.usesXImportSection(_grammar_3); + boolean _usesXImportSection = this._xbaseUsageDetector.usesXImportSection(this.getLanguage().getGrammar()); if (_usesXImportSection) { _builder.append("\t"); _builder.append(""); _builder.newLine(); { - IXtextGeneratorLanguage _language_2 = this.getLanguage(); - Grammar _grammar_5 = _language_2.getGrammar(); - boolean _usesXImportSection_1 = this._xbaseUsageDetector.usesXImportSection(_grammar_5); + boolean _usesXImportSection_1 = this._xbaseUsageDetector.usesXImportSection(this.getLanguage().getGrammar()); if (_usesXImportSection_1) { _builder.append("\t"); _builder.append(" _entries_1 = _pluginXml_1.getEntries(); + List _entries_1 = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(""); _builder_1.newLine(); @@ -767,8 +646,7 @@ public class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment { _builder_1.newLine(); _builder_1.append("\t\t"); _builder_1.append("class=\""); - Grammar _grammar_6 = this.getGrammar(); - TypeReference _eclipsePluginExecutableExtensionFactory_3 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(_grammar_6); + TypeReference _eclipsePluginExecutableExtensionFactory_3 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar()); _builder_1.append(_eclipsePluginExecutableExtensionFactory_3, "\t\t"); _builder_1.append(":org.eclipse.xtext.xbase.ui.hierarchy.OpenCallHierachyHandler\""); _builder_1.newLineIfNotEmpty(); @@ -835,17 +713,13 @@ public class XbaseGeneratorFragment2 extends AbstractXtextGeneratorFragment { _builder_1.newLine(); _entries_1.add(_builder_1.toString()); } - IXtextProjectConfig _projectConfig_2 = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin_2 = _projectConfig_2.getEclipsePlugin(); - PluginXmlAccess _pluginXml_2 = _eclipsePlugin_2.getPluginXml(); - List _entries_2 = _pluginXml_2.getEntries(); + List _entries_2 = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries(); StringConcatenation _builder_2 = new StringConcatenation(); _builder_2.append(""); _builder_2.newLine(); _builder_2.append("\t"); _builder_2.append(" usedRules = CollectionLiterals.newHashSet(); - UsedRulesFinder _usedRulesFinder = new UsedRulesFinder(usedRules); - _usedRulesFinder.compute(grammar); + new UsedRulesFinder(usedRules).compute(grammar); final Function1 _function = (AbstractRule it) -> { return Boolean.valueOf((Objects.equal(it.getName(), "XImportSection") && Objects.equal(GrammarUtil.getGrammar(it).getName(), "org.eclipse.xtext.xbase.Xtype"))); }; diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/xbase/XtypeGeneratorFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/xbase/XtypeGeneratorFragment2.java index 9e6a2f7c2..fe8fdcdaa 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/xbase/XtypeGeneratorFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/xbase/XtypeGeneratorFragment2.java @@ -11,9 +11,6 @@ import com.google.inject.Inject; import java.util.Set; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment; -import org.eclipse.xtext.xtext.generator.model.ManifestAccess; -import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig; -import org.eclipse.xtext.xtext.generator.model.project.IXtextProjectConfig; import org.eclipse.xtext.xtext.generator.xbase.XbaseUsageDetector; @SuppressWarnings("all") @@ -25,10 +22,7 @@ public class XtypeGeneratorFragment2 extends AbstractXtextGeneratorFragment { @Override public void generate() { if ((this._xbaseUsageDetector.inheritsXtype(this.getLanguage().getGrammar()) && (this.getProjectConfig().getEclipsePlugin().getManifest() != null))) { - IXtextProjectConfig _projectConfig = this.getProjectConfig(); - IBundleProjectConfig _eclipsePlugin = _projectConfig.getEclipsePlugin(); - ManifestAccess _manifest = _eclipsePlugin.getManifest(); - Set _requiredBundles = _manifest.getRequiredBundles(); + Set _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(); _requiredBundles.add("org.eclipse.xtext.xbase.ui"); } } diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/GradleBuildFile.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/GradleBuildFile.java index 9eee62635..5ff1f06fe 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/GradleBuildFile.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/GradleBuildFile.java @@ -17,7 +17,6 @@ import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xtext.wizard.ExternalDependency; import org.eclipse.xtext.xtext.wizard.Outlet; import org.eclipse.xtext.xtext.wizard.ProjectDescriptor; -import org.eclipse.xtext.xtext.wizard.Scope; import org.eclipse.xtext.xtext.wizard.TextFile; @SuppressWarnings("all") @@ -38,15 +37,13 @@ public class GradleBuildFile extends TextFile { _builder.append(this.pluginsSection); _builder.newLineIfNotEmpty(); { - Iterable _allDependencies = this.getAllDependencies(); - boolean _isEmpty = IterableExtensions.isEmpty(_allDependencies); + boolean _isEmpty = IterableExtensions.isEmpty(this.getAllDependencies()); boolean _not = (!_isEmpty); if (_not) { _builder.append("dependencies {"); _builder.newLine(); { - ProjectDescriptor _project = this.getProject(); - Set _upstreamProjects = _project.getUpstreamProjects(); + Set _upstreamProjects = this.getProject().getUpstreamProjects(); for(final ProjectDescriptor p : _upstreamProjects) { _builder.append("\t"); _builder.append("compile project(\':"); @@ -60,8 +57,7 @@ public class GradleBuildFile extends TextFile { Iterable _mavenDependencies = this.getMavenDependencies(); for(final ExternalDependency.MavenCoordinates dep : _mavenDependencies) { _builder.append("\t"); - Scope _scope = dep.getScope(); - String _gradleNotation = _scope.getGradleNotation(); + String _gradleNotation = dep.getScope().getGradleNotation(); _builder.append(_gradleNotation, "\t"); _builder.append(" \""); String _groupId = dep.getGroupId(); @@ -83,8 +79,7 @@ public class GradleBuildFile extends TextFile { _builder.append(this.additionalContent); _builder.newLineIfNotEmpty(); { - ProjectDescriptor _project_1 = this.getProject(); - boolean _isEclipsePluginProject = _project_1.isEclipsePluginProject(); + boolean _isEclipsePluginProject = this.getProject().isEclipsePluginProject(); if (_isEclipsePluginProject) { _builder.append("//this is an eclipse plugin project"); _builder.newLine(); @@ -98,22 +93,18 @@ public class GradleBuildFile extends TextFile { } private Iterable getMavenDependencies() { - ProjectDescriptor _project = this.getProject(); - Set _externalDependencies = _project.getExternalDependencies(); final Function1 _function = (ExternalDependency it) -> { return it.getMaven(); }; - Iterable _map = IterableExtensions.map(_externalDependencies, _function); final Function1 _function_1 = (ExternalDependency.MavenCoordinates it) -> { String _artifactId = it.getArtifactId(); return Boolean.valueOf((_artifactId != null)); }; - return IterableExtensions.filter(_map, _function_1); + return IterableExtensions.filter(IterableExtensions.map(this.getProject().getExternalDependencies(), _function), _function_1); } private Iterable getAllDependencies() { - ProjectDescriptor _project = this.getProject(); - Set _upstreamProjects = _project.getUpstreamProjects(); + Set _upstreamProjects = this.getProject().getUpstreamProjects(); Iterable _mavenDependencies = this.getMavenDependencies(); return Iterables.concat(_upstreamProjects, _mavenDependencies); } diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/IdeProjectDescriptor.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/IdeProjectDescriptor.java index bc0a2a3b4..f698af50e 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/IdeProjectDescriptor.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/IdeProjectDescriptor.java @@ -36,8 +36,7 @@ public class IdeProjectDescriptor extends ProjectDescriptor { @Override public Set getUpstreamProjects() { - WizardConfiguration _config = this.getConfig(); - RuntimeProjectDescriptor _runtimeProject = _config.getRuntimeProject(); + RuntimeProjectDescriptor _runtimeProject = this.getConfig().getRuntimeProject(); return Collections.unmodifiableSet(CollectionLiterals.newHashSet(_runtimeProject)); } diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/IntellijProjectDescriptor.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/IntellijProjectDescriptor.java index 2ebcab28e..f72fbd31a 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/IntellijProjectDescriptor.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/IntellijProjectDescriptor.java @@ -10,7 +10,6 @@ package org.eclipse.xtext.xtext.wizard; import java.util.Set; import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.util.XtextVersion; import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.ObjectExtensions; import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; @@ -70,9 +69,7 @@ public class IntellijProjectDescriptor extends ProjectDescriptor { _builder_1.append("pluginRepositories {"); _builder_1.newLine(); { - WizardConfiguration _config = this.getConfig(); - XtextVersion _xtextVersion = _config.getXtextVersion(); - boolean _isSnapshot = _xtextVersion.isSnapshot(); + boolean _isSnapshot = this.getConfig().getXtextVersion().isSnapshot(); if (_isSnapshot) { _builder_1.append("\t\t"); _builder_1.append("url \"https://hudson.eclipse.org/xtext/job/xtext-intellij/lastSuccessfulBuild/artifact/git-repo/intellij/build/ideaRepository/updatePlugins.xml\""); diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/LanguageDescriptor.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/LanguageDescriptor.java index aa246b96d..cf49d60ff 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/LanguageDescriptor.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/LanguageDescriptor.java @@ -25,10 +25,7 @@ public class LanguageDescriptor { public static LanguageDescriptor.FileExtensions fromString(final String fileExtensions) { LanguageDescriptor.FileExtensions _xblockexpression = null; { - Splitter _on = Splitter.on(","); - Splitter _trimResults = _on.trimResults(); - Splitter _omitEmptyStrings = _trimResults.omitEmptyStrings(); - final Iterable splitFileExtensions = _omitEmptyStrings.split(fileExtensions); + final Iterable splitFileExtensions = Splitter.on(",").trimResults().omitEmptyStrings().split(fileExtensions); _xblockexpression = new LanguageDescriptor.FileExtensions(splitFileExtensions); } return _xblockexpression; @@ -72,14 +69,12 @@ public class LanguageDescriptor { } public String getBasePackagePath() { - String _basePackage = this.getBasePackage(); - return _basePackage.replaceAll("\\.", "/"); + return this.getBasePackage().replaceAll("\\.", "/"); } public String getSimpleName() { final String[] segments = this.name.split("\\."); - String _last = IterableExtensions.last(((Iterable)Conversions.doWrapArray(segments))); - return StringExtensions.toFirstUpper(_last); + return StringExtensions.toFirstUpper(IterableExtensions.last(((Iterable)Conversions.doWrapArray(segments)))); } public String getNsURI() { diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/P2RepositoryProject.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/P2RepositoryProject.java index 25d2a413c..eb78e7653 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/P2RepositoryProject.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/P2RepositoryProject.java @@ -18,12 +18,10 @@ import org.eclipse.xtext.xbase.lib.ObjectExtensions; import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; import org.eclipse.xtext.xtext.wizard.AbstractFile; import org.eclipse.xtext.xtext.wizard.GradleBuildFile; -import org.eclipse.xtext.xtext.wizard.LanguageDescriptor; import org.eclipse.xtext.xtext.wizard.Outlet; import org.eclipse.xtext.xtext.wizard.PlainTextFile; import org.eclipse.xtext.xtext.wizard.PomFile; import org.eclipse.xtext.xtext.wizard.ProjectDescriptor; -import org.eclipse.xtext.xtext.wizard.SdkFeatureProject; import org.eclipse.xtext.xtext.wizard.WizardConfiguration; /** @@ -84,9 +82,7 @@ public class P2RepositoryProject extends ProjectDescriptor { _builder.newLine(); _builder.append("\t"); _builder.append(""); _builder.newLineIfNotEmpty(); @@ -98,9 +94,7 @@ public class P2RepositoryProject extends ProjectDescriptor { _builder.newLine(); _builder.append("\t"); _builder.append(""); _builder.newLineIfNotEmpty(); @@ -112,17 +106,13 @@ public class P2RepositoryProject extends ProjectDescriptor { _builder.newLine(); _builder.append("\t"); _builder.append(""); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append(""); _builder.newLineIfNotEmpty(); diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ParentProjectDescriptor.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ParentProjectDescriptor.java index f53c77300..1d02e4d53 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ParentProjectDescriptor.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ParentProjectDescriptor.java @@ -11,14 +11,12 @@ import com.google.common.base.Charsets; import com.google.common.base.Objects; import com.google.common.collect.Iterables; import com.google.common.io.Resources; -import java.net.URL; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Collections; import java.util.Set; import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.util.JavaVersion; import org.eclipse.xtext.util.XtextVersion; import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Exceptions; @@ -29,15 +27,12 @@ import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; import org.eclipse.xtext.xtext.wizard.AbstractFile; import org.eclipse.xtext.xtext.wizard.BinaryFile; import org.eclipse.xtext.xtext.wizard.GradleBuildFile; -import org.eclipse.xtext.xtext.wizard.IntellijProjectDescriptor; import org.eclipse.xtext.xtext.wizard.Outlet; -import org.eclipse.xtext.xtext.wizard.P2RepositoryProject; import org.eclipse.xtext.xtext.wizard.PlainTextFile; import org.eclipse.xtext.xtext.wizard.PomFile; import org.eclipse.xtext.xtext.wizard.ProjectDescriptor; import org.eclipse.xtext.xtext.wizard.ProjectLayout; import org.eclipse.xtext.xtext.wizard.SourceLayout; -import org.eclipse.xtext.xtext.wizard.TargetPlatformProject; import org.eclipse.xtext.xtext.wizard.WizardConfiguration; @FinalFieldsConstructor @@ -66,8 +61,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { @Override public String getLocation() { - WizardConfiguration _config = this.getConfig(); - String _rootLocation = _config.getRootLocation(); + String _rootLocation = this.getConfig().getRootLocation(); String _plus = (_rootLocation + "/"); String _name = this.getName(); return (_plus + _name); @@ -93,8 +87,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { final ArrayList files = CollectionLiterals.newArrayList(); Iterable _files = super.getFiles(); Iterables.addAll(files, _files); - WizardConfiguration _config = this.getConfig(); - boolean _needsGradleBuild = _config.needsGradleBuild(); + boolean _needsGradleBuild = this.getConfig().needsGradleBuild(); if (_needsGradleBuild) { PlainTextFile _file = this.file(Outlet.ROOT, "settings.gradle", this.settingsGradle()); files.add(_file); @@ -102,8 +95,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { files.add(_file_1); PlainTextFile _file_2 = this.file(Outlet.ROOT, "gradle/maven-deployment.gradle", this.mavenDeploymentGradle()); files.add(_file_2); - WizardConfiguration _config_1 = this.getConfig(); - boolean _isNeedsGradleWrapper = _config_1.isNeedsGradleWrapper(); + boolean _isNeedsGradleWrapper = this.getConfig().isNeedsGradleWrapper(); if (_isNeedsGradleWrapper) { PlainTextFile _file_3 = this.file(Outlet.ROOT, "gradlew", this.loadResource("gradlew/gradlew"), true); files.add(_file_3); @@ -119,17 +111,12 @@ public class ParentProjectDescriptor extends ProjectDescriptor { } public String getJavaVersion() { - WizardConfiguration _config = this.getConfig(); - JavaVersion _javaVersion = _config.getJavaVersion(); - return _javaVersion.getQualifier(); + return this.getConfig().getJavaVersion().getQualifier(); } private CharSequence loadResource(final String resourcePath) { try { - Class _class = this.getClass(); - ClassLoader _classLoader = _class.getClassLoader(); - URL _resource = _classLoader.getResource(resourcePath); - return Resources.toString(_resource, Charsets.ISO_8859_1); + return Resources.toString(this.getClass().getClassLoader().getResource(resourcePath), Charsets.ISO_8859_1); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -156,22 +143,16 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.newLine(); _builder.append("\t\t"); _builder.append("classpath \'org.xtext:xtext-gradle-plugin:"); - WizardConfiguration _config = this.getConfig(); - XtextVersion _xtextVersion = _config.getXtextVersion(); - String _xtextGradlePluginVersion = _xtextVersion.getXtextGradlePluginVersion(); + String _xtextGradlePluginVersion = this.getConfig().getXtextVersion().getXtextGradlePluginVersion(); _builder.append(_xtextGradlePluginVersion, "\t\t"); _builder.append("\'"); _builder.newLineIfNotEmpty(); { - WizardConfiguration _config_1 = this.getConfig(); - IntellijProjectDescriptor _intellijProject = _config_1.getIntellijProject(); - boolean _isEnabled = _intellijProject.isEnabled(); + boolean _isEnabled = this.getConfig().getIntellijProject().isEnabled(); if (_isEnabled) { _builder.append("\t\t"); _builder.append("classpath \'org.xtext:xtext-idea-gradle-plugin:"); - WizardConfiguration _config_2 = this.getConfig(); - XtextVersion _xtextVersion_1 = _config_2.getXtextVersion(); - String _xtextGradlePluginVersion_1 = _xtextVersion_1.getXtextGradlePluginVersion(); + String _xtextGradlePluginVersion_1 = this.getConfig().getXtextVersion().getXtextGradlePluginVersion(); _builder.append(_xtextGradlePluginVersion_1, "\t\t"); _builder.append("\'"); _builder.newLineIfNotEmpty(); @@ -187,9 +168,8 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.newLine(); _builder.append("\t"); _builder.append("ext.xtextVersion = \'"); - WizardConfiguration _config_3 = this.getConfig(); - XtextVersion _xtextVersion_2 = _config_3.getXtextVersion(); - _builder.append(_xtextVersion_2, "\t"); + XtextVersion _xtextVersion = this.getConfig().getXtextVersion(); + _builder.append(_xtextVersion, "\t"); _builder.append("\'"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -199,9 +179,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.append("jcenter()"); _builder.newLine(); { - WizardConfiguration _config_4 = this.getConfig(); - XtextVersion _xtextVersion_3 = _config_4.getXtextVersion(); - boolean _isSnapshot = _xtextVersion_3.isSnapshot(); + boolean _isSnapshot = this.getConfig().getXtextVersion().isSnapshot(); if (_isSnapshot) { _builder.append("\t\t"); _builder.append("maven {"); @@ -242,8 +220,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.newLine(); _builder.append("\t"); _builder.append("group = \'"); - WizardConfiguration _config_5 = this.getConfig(); - String _baseName = _config_5.getBaseName(); + String _baseName = this.getConfig().getBaseName(); _builder.append(_baseName, "\t"); _builder.append("\'"); _builder.newLineIfNotEmpty(); @@ -285,16 +262,13 @@ public class ParentProjectDescriptor extends ProjectDescriptor { public CharSequence settingsGradle() { StringConcatenation _builder = new StringConcatenation(); { - WizardConfiguration _config = this.getConfig(); - Set _enabledProjects = _config.getEnabledProjects(); final Function1 _function = (ProjectDescriptor it) -> { return Boolean.valueOf(((!Objects.equal(it, this)) && it.isPartOfGradleBuild())); }; - Iterable _filter = IterableExtensions.filter(_enabledProjects, _function); + Iterable _filter = IterableExtensions.filter(this.getConfig().getEnabledProjects(), _function); for(final ProjectDescriptor p : _filter) { { - WizardConfiguration _config_1 = this.getConfig(); - ProjectLayout _projectLayout = _config_1.getProjectLayout(); + ProjectLayout _projectLayout = this.getConfig().getProjectLayout(); boolean _equals = Objects.equal(_projectLayout, ProjectLayout.FLAT); if (_equals) { _builder.append("includeFlat"); @@ -315,8 +289,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { public CharSequence sourceLayoutGradle() { StringConcatenation _builder = new StringConcatenation(); { - WizardConfiguration _config = this.getConfig(); - SourceLayout _sourceLayout = _config.getSourceLayout(); + SourceLayout _sourceLayout = this.getConfig().getSourceLayout(); boolean _equals = Objects.equal(_sourceLayout, SourceLayout.PLAIN); if (_equals) { _builder.append("if (name.endsWith(\".tests\")) {"); @@ -585,8 +558,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config = this.getConfig(); - boolean _needsTychoBuild = _config.needsTychoBuild(); + boolean _needsTychoBuild = this.getConfig().needsTychoBuild(); if (_needsTychoBuild) { _builder.append("\t"); _builder.append("0.25.0"); @@ -595,15 +567,13 @@ public class ParentProjectDescriptor extends ProjectDescriptor { } _builder.append("\t"); _builder.append(""); - WizardConfiguration _config_1 = this.getConfig(); - XtextVersion _xtextVersion = _config_1.getXtextVersion(); + XtextVersion _xtextVersion = this.getConfig().getXtextVersion(); _builder.append(_xtextVersion, "\t"); _builder.append(""); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append(""); - WizardConfiguration _config_2 = this.getConfig(); - Charset _encoding = _config_2.getEncoding(); + Charset _encoding = this.getConfig().getEncoding(); _builder.append(_encoding, "\t"); _builder.append(""); _builder.newLineIfNotEmpty(); @@ -624,18 +594,15 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config_3 = this.getConfig(); - Set _enabledProjects = _config_3.getEnabledProjects(); final Function1 _function_1 = (ProjectDescriptor it_1) -> { return Boolean.valueOf(((!Objects.equal(it_1, this)) && it_1.isPartOfMavenBuild())); }; - Iterable _filter = IterableExtensions.filter(_enabledProjects, _function_1); + Iterable _filter = IterableExtensions.filter(this.getConfig().getEnabledProjects(), _function_1); for(final ProjectDescriptor p : _filter) { _builder.append("\t"); _builder.append(""); { - WizardConfiguration _config_4 = this.getConfig(); - ProjectLayout _projectLayout = _config_4.getProjectLayout(); + ProjectLayout _projectLayout = this.getConfig().getProjectLayout(); boolean _equals = Objects.equal(_projectLayout, ProjectLayout.FLAT); if (_equals) { _builder.append("../"); @@ -652,8 +619,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config_5 = this.getConfig(); - boolean _needsTychoBuild_1 = _config_5.needsTychoBuild(); + boolean _needsTychoBuild_1 = this.getConfig().needsTychoBuild(); if (_needsTychoBuild_1) { _builder.append("\t"); _builder.append(""); @@ -683,9 +649,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config_6 = this.getConfig(); - P2RepositoryProject _p2Project = _config_6.getP2Project(); - boolean _isEnabled = _p2Project.isEnabled(); + boolean _isEnabled = this.getConfig().getP2Project().isEnabled(); if (_isEnabled) { _builder.append("\t"); _builder.append("\t"); @@ -919,17 +883,14 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.append("\t"); _builder.append("\t\t\t\t\t"); _builder.append(""); - WizardConfiguration _config_7 = this.getConfig(); - String _baseName = _config_7.getBaseName(); + String _baseName = this.getConfig().getBaseName(); _builder.append(_baseName, "\t\t\t\t\t\t"); _builder.append(""); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("\t\t\t\t\t"); _builder.append(""); - WizardConfiguration _config_8 = this.getConfig(); - TargetPlatformProject _targetPlatformProject = _config_8.getTargetPlatformProject(); - String _name_1 = _targetPlatformProject.getName(); + String _name_1 = this.getConfig().getTargetPlatformProject().getName(); _builder.append(_name_1, "\t\t\t\t\t\t"); _builder.append(""); _builder.newLineIfNotEmpty(); @@ -1111,11 +1072,10 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.append(""); _builder.newLine(); { - Set _set = IterableExtensions.toSet(Collections.unmodifiableList(CollectionLiterals.newArrayList(Outlet.MAIN_XTEND_GEN, Outlet.TEST_XTEND_GEN))); final Function1 _function_2 = (Outlet it_1) -> { return this.sourceFolder(it_1); }; - Iterable _map = IterableExtensions.map(_set, _function_2); + Iterable _map = IterableExtensions.map(IterableExtensions.toSet(Collections.unmodifiableList(CollectionLiterals.newArrayList(Outlet.MAIN_XTEND_GEN, Outlet.TEST_XTEND_GEN))), _function_2); for(final String dir : _map) { _builder.append("\t\t\t\t\t\t\t"); _builder.append("${basedir}/"); @@ -1294,8 +1254,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config_9 = this.getConfig(); - boolean _needsTychoBuild_2 = _config_9.needsTychoBuild(); + boolean _needsTychoBuild_2 = this.getConfig().needsTychoBuild(); if (_needsTychoBuild_2) { _builder.append("\t\t\t\t\t\t\t"); _builder.append(""); @@ -1472,8 +1431,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config_10 = this.getConfig(); - boolean _needsTychoBuild_3 = _config_10.needsTychoBuild(); + boolean _needsTychoBuild_3 = this.getConfig().needsTychoBuild(); if (_needsTychoBuild_3) { _builder.append("\t\t\t"); _builder.append(""); @@ -1567,9 +1525,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config_11 = this.getConfig(); - XtextVersion _xtextVersion_1 = _config_11.getXtextVersion(); - boolean _isSnapshot = _xtextVersion_1.isSnapshot(); + boolean _isSnapshot = this.getConfig().getXtextVersion().isSnapshot(); if (_isSnapshot) { _builder.append("\t"); _builder.append(""); @@ -1633,9 +1589,7 @@ public class ParentProjectDescriptor extends ProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config_12 = this.getConfig(); - XtextVersion _xtextVersion_2 = _config_12.getXtextVersion(); - boolean _isSnapshot_1 = _xtextVersion_2.isSnapshot(); + boolean _isSnapshot_1 = this.getConfig().getXtextVersion().isSnapshot(); if (_isSnapshot_1) { _builder.append("\t"); _builder.append(""); diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/PomFile.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/PomFile.java index 6d9ce6abd..2f841f804 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/PomFile.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/PomFile.java @@ -21,7 +21,6 @@ import org.eclipse.xtext.xtext.wizard.ProjectDescriptor; import org.eclipse.xtext.xtext.wizard.ProjectLayout; import org.eclipse.xtext.xtext.wizard.Scope; import org.eclipse.xtext.xtext.wizard.TextFile; -import org.eclipse.xtext.xtext.wizard.WizardConfiguration; @SuppressWarnings("all") public class PomFile extends TextFile { @@ -51,9 +50,7 @@ public class PomFile extends TextFile { _builder.newLine(); { ProjectDescriptor _project = this.getProject(); - ProjectDescriptor _project_1 = this.getProject(); - WizardConfiguration _config = _project_1.getConfig(); - ParentProjectDescriptor _parentProject = _config.getParentProject(); + ParentProjectDescriptor _parentProject = this.getProject().getConfig().getParentProject(); boolean _notEquals = (!Objects.equal(_project, _parentProject)); if (_notEquals) { _builder.append("\t"); @@ -62,19 +59,14 @@ public class PomFile extends TextFile { _builder.append("\t"); _builder.append("\t"); _builder.append(""); - ProjectDescriptor _project_2 = this.getProject(); - WizardConfiguration _config_1 = _project_2.getConfig(); - String _baseName = _config_1.getBaseName(); + String _baseName = this.getProject().getConfig().getBaseName(); _builder.append(_baseName, "\t\t"); _builder.append(""); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("\t"); _builder.append(""); - ProjectDescriptor _project_3 = this.getProject(); - WizardConfiguration _config_2 = _project_3.getConfig(); - ParentProjectDescriptor _parentProject_1 = _config_2.getParentProject(); - String _name = _parentProject_1.getName(); + String _name = this.getProject().getConfig().getParentProject().getName(); _builder.append(_name, "\t\t"); _builder.append(""); _builder.newLineIfNotEmpty(); @@ -83,18 +75,13 @@ public class PomFile extends TextFile { _builder.append("1.0.0-SNAPSHOT"); _builder.newLine(); { - ProjectDescriptor _project_4 = this.getProject(); - WizardConfiguration _config_3 = _project_4.getConfig(); - ProjectLayout _projectLayout = _config_3.getProjectLayout(); + ProjectLayout _projectLayout = this.getProject().getConfig().getProjectLayout(); boolean _equals = Objects.equal(_projectLayout, ProjectLayout.FLAT); if (_equals) { _builder.append("\t"); _builder.append("\t"); _builder.append("../"); - ProjectDescriptor _project_5 = this.getProject(); - WizardConfiguration _config_4 = _project_5.getConfig(); - ParentProjectDescriptor _parentProject_2 = _config_4.getParentProject(); - String _name_1 = _parentProject_2.getName(); + String _name_1 = this.getProject().getConfig().getParentProject().getName(); _builder.append(_name_1, "\t\t"); _builder.append("/pom.xml"); _builder.newLineIfNotEmpty(); @@ -106,9 +93,7 @@ public class PomFile extends TextFile { } else { _builder.append("\t"); _builder.append(""); - ProjectDescriptor _project_6 = this.getProject(); - WizardConfiguration _config_5 = _project_6.getConfig(); - String _baseName_1 = _config_5.getBaseName(); + String _baseName_1 = this.getProject().getConfig().getBaseName(); _builder.append(_baseName_1, "\t"); _builder.append(""); _builder.newLineIfNotEmpty(); @@ -119,8 +104,7 @@ public class PomFile extends TextFile { } _builder.append("\t"); _builder.append(""); - ProjectDescriptor _project_7 = this.getProject(); - String _name_2 = _project_7.getName(); + String _name_2 = this.getProject().getName(); _builder.append(_name_2, "\t"); _builder.append(""); _builder.newLineIfNotEmpty(); @@ -135,16 +119,14 @@ public class PomFile extends TextFile { _builder.newLineIfNotEmpty(); _builder.newLine(); { - ProjectDescriptor _project_8 = this.getProject(); - boolean _isEclipsePluginProject = _project_8.isEclipsePluginProject(); + boolean _isEclipsePluginProject = this.getProject().isEclipsePluginProject(); boolean _not = (!_isEclipsePluginProject); if (_not) { _builder.append("\t"); _builder.append(""); _builder.newLine(); { - ProjectDescriptor _project_9 = this.getProject(); - Set _upstreamProjects = _project_9.getUpstreamProjects(); + Set _upstreamProjects = this.getProject().getUpstreamProjects(); for(final ProjectDescriptor p : _upstreamProjects) { _builder.append("\t"); _builder.append("\t"); @@ -175,17 +157,14 @@ public class PomFile extends TextFile { } } { - ProjectDescriptor _project_10 = this.getProject(); - Set _externalDependencies = _project_10.getExternalDependencies(); final Function1 _function = (ExternalDependency it) -> { return it.getMaven(); }; - Iterable _map = IterableExtensions.map(_externalDependencies, _function); final Function1 _function_1 = (ExternalDependency.MavenCoordinates it) -> { String _artifactId = it.getArtifactId(); return Boolean.valueOf((_artifactId != null)); }; - Iterable _filter = IterableExtensions.filter(_map, _function_1); + Iterable _filter = IterableExtensions.filter(IterableExtensions.map(this.getProject().getExternalDependencies(), _function), _function_1); for(final ExternalDependency.MavenCoordinates dep : _filter) { _builder.append("\t"); _builder.append("\t"); @@ -223,8 +202,7 @@ public class PomFile extends TextFile { _builder.append("\t"); _builder.append("\t"); _builder.append(""); - Scope _scope_1 = dep.getScope(); - String _mavenNotation = _scope_1.getMavenNotation(); + String _mavenNotation = dep.getScope().getMavenNotation(); _builder.append(_mavenNotation, "\t\t\t"); _builder.append(""); _builder.newLineIfNotEmpty(); diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ProjectDescriptor.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ProjectDescriptor.java index 8c466ea9d..f758b026c 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ProjectDescriptor.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ProjectDescriptor.java @@ -18,7 +18,6 @@ import java.util.Set; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.util.JavaVersion; import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; @@ -27,15 +26,12 @@ import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xtext.wizard.AbstractFile; import org.eclipse.xtext.xtext.wizard.BinaryFile; import org.eclipse.xtext.xtext.wizard.EPackageInfo; -import org.eclipse.xtext.xtext.wizard.Ecore2XtextConfiguration; import org.eclipse.xtext.xtext.wizard.ExternalDependency; import org.eclipse.xtext.xtext.wizard.GradleBuildFile; import org.eclipse.xtext.xtext.wizard.Outlet; -import org.eclipse.xtext.xtext.wizard.ParentProjectDescriptor; import org.eclipse.xtext.xtext.wizard.PlainTextFile; import org.eclipse.xtext.xtext.wizard.PomFile; import org.eclipse.xtext.xtext.wizard.ProjectLayout; -import org.eclipse.xtext.xtext.wizard.SourceLayout; import org.eclipse.xtext.xtext.wizard.TextFile; import org.eclipse.xtext.xtext.wizard.WizardConfiguration; @@ -65,8 +61,7 @@ public abstract class ProjectDescriptor { String _name = this.getName(); _xifexpression = (_plus + _name); } else { - ParentProjectDescriptor _parentProject = this.config.getParentProject(); - String _location = _parentProject.getLocation(); + String _location = this.config.getParentProject().getLocation(); String _plus_1 = (_location + "/"); String _name_1 = this.getName(); _xifexpression = (_plus_1 + _name_1); @@ -82,8 +77,7 @@ public abstract class ProjectDescriptor { final Function1 _function = (Outlet it) -> { return this.sourceFolder(it); }; - List _map = ListExtensions.map(Collections.unmodifiableList(CollectionLiterals.newArrayList(Outlet.MAIN_JAVA, Outlet.MAIN_RESOURCES, Outlet.MAIN_SRC_GEN, Outlet.MAIN_XTEND_GEN)), _function); - return IterableExtensions.toSet(_map); + return IterableExtensions.toSet(ListExtensions.map(Collections.unmodifiableList(CollectionLiterals.newArrayList(Outlet.MAIN_JAVA, Outlet.MAIN_RESOURCES, Outlet.MAIN_SRC_GEN, Outlet.MAIN_XTEND_GEN)), _function)); } public Iterable getFiles() { @@ -123,9 +117,10 @@ public abstract class ProjectDescriptor { public CharSequence buildProperties() { StringConcatenation _builder = new StringConcatenation(); - String _buildPropertiesEntry = this.buildPropertiesEntry("source..", IterableExtensions.map(this.getSourceFolders(), ((Function1) (String it) -> { + final Function1 _function = (String it) -> { return (it + "/"); - }))); + }; + String _buildPropertiesEntry = this.buildPropertiesEntry("source..", IterableExtensions.map(this.getSourceFolders(), _function)); _builder.append(_buildPropertiesEntry); _builder.newLineIfNotEmpty(); String _buildPropertiesEntry_1 = this.buildPropertiesEntry("bin.includes", this.getBinIncludes()); @@ -167,8 +162,7 @@ public abstract class ProjectDescriptor { return ""; } final String assignment = (key + " = "); - int _length = assignment.length(); - final String indent = Strings.repeat(" ", _length); + final String indent = Strings.repeat(" ", assignment.length()); String _join = IterableExtensions.join(value, (",\\\n" + indent)); _xblockexpression = (assignment + _join); } @@ -220,8 +214,7 @@ public abstract class ProjectDescriptor { } public String getBree() { - JavaVersion _javaVersion = this.config.getJavaVersion(); - return _javaVersion.getBree(); + return this.config.getJavaVersion().getBree(); } private String manifestEntry(final String key, final Iterable value) { @@ -241,22 +234,18 @@ public abstract class ProjectDescriptor { LinkedHashSet _xblockexpression = null; { final LinkedHashSet bundles = CollectionLiterals.newLinkedHashSet(); - Set _upstreamProjects = this.getUpstreamProjects(); final Function1 _function = (ProjectDescriptor it) -> { return it.getName(); }; - Iterable _map = IterableExtensions.map(_upstreamProjects, _function); + Iterable _map = IterableExtensions.map(this.getUpstreamProjects(), _function); Iterables.addAll(bundles, _map); - Set _externalDependencies = this.getExternalDependencies(); final Function1 _function_1 = (ExternalDependency it) -> { return it.getP2(); }; - Iterable _map_1 = IterableExtensions.map(_externalDependencies, _function_1); final Function1 _function_2 = (ExternalDependency.P2Coordinates it) -> { String _bundleId = it.getBundleId(); return Boolean.valueOf((_bundleId != null)); }; - Iterable _filter = IterableExtensions.filter(_map_1, _function_2); final Function1 _function_3 = (ExternalDependency.P2Coordinates it) -> { String _bundleId = it.getBundleId(); String _xifexpression = null; @@ -271,31 +260,25 @@ public abstract class ProjectDescriptor { } return (_bundleId + _xifexpression); }; - Iterable _map_2 = IterableExtensions.map(_filter, _function_3); - Iterables.addAll(bundles, _map_2); + Iterable _map_1 = IterableExtensions.map(IterableExtensions.filter(IterableExtensions.map(this.getExternalDependencies(), _function_1), _function_2), _function_3); + Iterables.addAll(bundles, _map_1); _xblockexpression = bundles; } return _xblockexpression; } public Set getImportedPackages() { - Set _externalDependencies = this.getExternalDependencies(); final Function1> _function = (ExternalDependency it) -> { - ExternalDependency.P2Coordinates _p2 = it.getP2(); - return _p2.getPackages(); + return it.getP2().getPackages(); }; - Iterable> _map = IterableExtensions.>map(_externalDependencies, _function); - Iterable _flatten = Iterables.concat(_map); - return IterableExtensions.toSet(_flatten); + return IterableExtensions.toSet(Iterables.concat(IterableExtensions.>map(this.getExternalDependencies(), _function))); } public Set getExternalDependencies() { final LinkedHashSet deps = CollectionLiterals.newLinkedHashSet(); - Ecore2XtextConfiguration _ecore2Xtext = this.config.getEcore2Xtext(); - Set _ePackageInfos = _ecore2Xtext.getEPackageInfos(); + Set _ePackageInfos = this.config.getEcore2Xtext().getEPackageInfos(); for (final EPackageInfo ePackage : _ePackageInfos) { - String _bundleID = ePackage.getBundleID(); - ExternalDependency _createBundleDependency = ExternalDependency.createBundleDependency(_bundleID); + ExternalDependency _createBundleDependency = ExternalDependency.createBundleDependency(ePackage.getBundleID()); deps.add(_createBundleDependency); } return deps; @@ -314,8 +297,7 @@ public abstract class ProjectDescriptor { } public String sourceFolder(final Outlet outlet) { - SourceLayout _sourceLayout = this.config.getSourceLayout(); - return _sourceLayout.getPathFor(outlet); + return this.config.getSourceLayout().getPathFor(outlet); } protected PlainTextFile file(final Outlet outlet, final String relativePath, final CharSequence content) { diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/RuntimeProjectDescriptor.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/RuntimeProjectDescriptor.java index 116a28b0f..0548b52a1 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/RuntimeProjectDescriptor.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/RuntimeProjectDescriptor.java @@ -14,11 +14,9 @@ import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; -import org.eclipse.emf.common.util.URI; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.util.XtextVersion; import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; @@ -29,11 +27,9 @@ import org.eclipse.xtext.xbase.lib.StringExtensions; import org.eclipse.xtext.xtext.wizard.AbstractFile; import org.eclipse.xtext.xtext.wizard.BuildSystem; import org.eclipse.xtext.xtext.wizard.EPackageInfo; -import org.eclipse.xtext.xtext.wizard.Ecore2XtextConfiguration; import org.eclipse.xtext.xtext.wizard.ExternalDependency; import org.eclipse.xtext.xtext.wizard.GradleBuildFile; import org.eclipse.xtext.xtext.wizard.IdeProjectDescriptor; -import org.eclipse.xtext.xtext.wizard.IntellijProjectDescriptor; import org.eclipse.xtext.xtext.wizard.LanguageDescriptor; import org.eclipse.xtext.xtext.wizard.Outlet; import org.eclipse.xtext.xtext.wizard.PlainTextFile; @@ -172,15 +168,11 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { "com.ibm.icu"); boolean _isFromExistingEcoreModels = this.isFromExistingEcoreModels(); if (_isFromExistingEcoreModels) { - WizardConfiguration _config = this.getConfig(); - Ecore2XtextConfiguration _ecore2Xtext = _config.getEcore2Xtext(); - Set _ePackageInfos = _ecore2Xtext.getEPackageInfos(); final Function1 _function = (EPackageInfo it) -> { - URI _genmodelURI = it.getGenmodelURI(); - String _fileExtension = _genmodelURI.fileExtension(); + String _fileExtension = it.getGenmodelURI().fileExtension(); return Boolean.valueOf(Objects.equal(_fileExtension, "xcore")); }; - boolean _exists = IterableExtensions.exists(_ePackageInfos, _function); + boolean _exists = IterableExtensions.exists(this.getConfig().getEcore2Xtext().getEPackageInfos(), _function); if (_exists) { result.add("org.eclipse.emf.ecore.xcore"); } @@ -211,23 +203,18 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { Iterables.addAll(files, _files); PlainTextFile _grammarFile = this.getGrammarFile(); files.add(_grammarFile); - String _workflowFilePath = this.getWorkflowFilePath(); - CharSequence _workflow = this.workflow(); - PlainTextFile _file = this.file(Outlet.MAIN_JAVA, _workflowFilePath, _workflow); + PlainTextFile _file = this.file(Outlet.MAIN_JAVA, this.getWorkflowFilePath(), this.workflow()); files.add(_file); PlainTextFile _workflowLaunchConfigFile = this.getWorkflowLaunchConfigFile(); files.add(_workflowLaunchConfigFile); - WizardConfiguration _config = this.getConfig(); - RuntimeProjectDescriptor _runtimeProject = _config.getRuntimeProject(); - boolean _isEclipsePluginProject = _runtimeProject.isEclipsePluginProject(); + boolean _isEclipsePluginProject = this.getConfig().getRuntimeProject().isEclipsePluginProject(); if (_isEclipsePluginProject) { PlainTextFile _launchConfigFile = this.getLaunchConfigFile(); files.add(_launchConfigFile); } boolean _isPlainMavenBuild = this.isPlainMavenBuild(); if (_isPlainMavenBuild) { - CharSequence _jarDescriptor = this.jarDescriptor(); - PlainTextFile _file_1 = this.file(Outlet.ROOT, "jar-with-ecore-model.xml", _jarDescriptor); + PlainTextFile _file_1 = this.file(Outlet.ROOT, "jar-with-ecore-model.xml", this.jarDescriptor()); files.add(_file_1); } return files; @@ -238,21 +225,15 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { } public PlainTextFile getGrammarFile() { - String _grammarFilePath = this.getGrammarFilePath(); - CharSequence _grammar = this.grammar(); - return this.file(Outlet.MAIN_JAVA, _grammarFilePath, _grammar); + return this.file(Outlet.MAIN_JAVA, this.getGrammarFilePath(), this.grammar()); } public String getGrammarFilePath() { StringConcatenation _builder = new StringConcatenation(); - WizardConfiguration _config = this.getConfig(); - LanguageDescriptor _language = _config.getLanguage(); - String _basePackagePath = _language.getBasePackagePath(); + String _basePackagePath = this.getConfig().getLanguage().getBasePackagePath(); _builder.append(_basePackagePath); _builder.append("/"); - WizardConfiguration _config_1 = this.getConfig(); - LanguageDescriptor _language_1 = _config_1.getLanguage(); - String _simpleName = _language_1.getSimpleName(); + String _simpleName = this.getConfig().getLanguage().getSimpleName(); _builder.append(_simpleName); _builder.append(".xtext"); return _builder.toString(); @@ -262,8 +243,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { CharSequence _xifexpression = null; boolean _isFromExistingEcoreModels = this.isFromExistingEcoreModels(); if (_isFromExistingEcoreModels) { - WizardConfiguration _config = this.getConfig(); - _xifexpression = this.grammarCreator.grammar(_config); + _xifexpression = this.grammarCreator.grammar(this.getConfig()); } else { _xifexpression = this.defaultGrammar(); } @@ -273,23 +253,16 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { private CharSequence defaultGrammar() { StringConcatenation _builder = new StringConcatenation(); _builder.append("grammar "); - WizardConfiguration _config = this.getConfig(); - LanguageDescriptor _language = _config.getLanguage(); - String _name = _language.getName(); + String _name = this.getConfig().getLanguage().getName(); _builder.append(_name); _builder.append(" with org.eclipse.xtext.common.Terminals"); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("generate "); - WizardConfiguration _config_1 = this.getConfig(); - LanguageDescriptor _language_1 = _config_1.getLanguage(); - String _simpleName = _language_1.getSimpleName(); - String _firstLower = StringExtensions.toFirstLower(_simpleName); + String _firstLower = StringExtensions.toFirstLower(this.getConfig().getLanguage().getSimpleName()); _builder.append(_firstLower); _builder.append(" \""); - WizardConfiguration _config_2 = this.getConfig(); - LanguageDescriptor _language_2 = _config_2.getLanguage(); - String _nsURI = _language_2.getNsURI(); + String _nsURI = this.getConfig().getLanguage().getNsURI(); _builder.append(_nsURI); _builder.append("\""); _builder.newLineIfNotEmpty(); @@ -311,14 +284,10 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { public String getWorkflowFilePath() { StringConcatenation _builder = new StringConcatenation(); - WizardConfiguration _config = this.getConfig(); - LanguageDescriptor _language = _config.getLanguage(); - String _basePackagePath = _language.getBasePackagePath(); + String _basePackagePath = this.getConfig().getLanguage().getBasePackagePath(); _builder.append(_basePackagePath); _builder.append("/Generate"); - WizardConfiguration _config_1 = this.getConfig(); - LanguageDescriptor _language_1 = _config_1.getLanguage(); - String _simpleName = _language_1.getSimpleName(); + String _simpleName = this.getConfig().getLanguage().getSimpleName(); _builder.append(_simpleName); _builder.append(".mwe2"); return _builder.toString(); @@ -327,15 +296,10 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { public CharSequence workflow() { StringConcatenation _builder = new StringConcatenation(); _builder.append("module "); - WizardConfiguration _config = this.getConfig(); - LanguageDescriptor _language = _config.getLanguage(); - String _basePackagePath = _language.getBasePackagePath(); + String _basePackagePath = this.getConfig().getLanguage().getBasePackagePath(); String _plus = (_basePackagePath + "/Generate"); - WizardConfiguration _config_1 = this.getConfig(); - LanguageDescriptor _language_1 = _config_1.getLanguage(); - String _simpleName = _language_1.getSimpleName(); - String _plus_1 = (_plus + _simpleName); - String _replaceAll = _plus_1.replaceAll("/", "."); + String _simpleName = this.getConfig().getLanguage().getSimpleName(); + String _replaceAll = (_plus + _simpleName).replaceAll("/", "."); _builder.append(_replaceAll); _builder.newLineIfNotEmpty(); _builder.newLine(); @@ -401,9 +365,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { } } { - WizardConfiguration _config_2 = this.getConfig(); - UiProjectDescriptor _uiProject = _config_2.getUiProject(); - boolean _isEnabled_1 = _uiProject.isEnabled(); + boolean _isEnabled_1 = this.getConfig().getUiProject().isEnabled(); if (_isEnabled_1) { _builder.append("\t\t\t\t"); _builder.append("eclipsePlugin = {"); @@ -418,10 +380,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { } } { - WizardConfiguration _config_3 = this.getConfig(); - UiProjectDescriptor _uiProject_1 = _config_3.getUiProject(); - TestProjectDescriptor _testProject = _uiProject_1.getTestProject(); - boolean _isEnabled_2 = _testProject.isEnabled(); + boolean _isEnabled_2 = this.getConfig().getUiProject().getTestProject().isEnabled(); if (_isEnabled_2) { _builder.append("\t\t\t\t"); _builder.append("eclipsePluginTest = {"); @@ -436,9 +395,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { } } { - WizardConfiguration _config_4 = this.getConfig(); - IntellijProjectDescriptor _intellijProject = _config_4.getIntellijProject(); - boolean _isEnabled_3 = _intellijProject.isEnabled(); + boolean _isEnabled_3 = this.getConfig().getIntellijProject().isEnabled(); if (_isEnabled_3) { _builder.append("\t\t\t\t"); _builder.append("ideaPlugin = {"); @@ -453,9 +410,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { } } { - WizardConfiguration _config_5 = this.getConfig(); - WebProjectDescriptor _webProject = _config_5.getWebProject(); - boolean _isEnabled_4 = _webProject.isEnabled(); + boolean _isEnabled_4 = this.getConfig().getWebProject().isEnabled(); if (_isEnabled_4) { _builder.append("\t\t\t\t"); _builder.append("web = {"); @@ -470,8 +425,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { } } { - WizardConfiguration _config_6 = this.getConfig(); - SourceLayout _sourceLayout = _config_6.getSourceLayout(); + SourceLayout _sourceLayout = this.getConfig().getSourceLayout(); boolean _equals = Objects.equal(_sourceLayout, SourceLayout.MAVEN); if (_equals) { _builder.append("\t\t\t\t"); @@ -495,16 +449,13 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder.newLine(); _builder.append("\t\t\t\t"); _builder.append("encoding = \""); - WizardConfiguration _config_7 = this.getConfig(); - Charset _encoding = _config_7.getEncoding(); + Charset _encoding = this.getConfig().getEncoding(); _builder.append(_encoding, "\t\t\t\t"); _builder.append("\""); _builder.newLineIfNotEmpty(); _builder.append("\t\t\t\t"); _builder.append("lineDelimiter = \""); - WizardConfiguration _config_8 = this.getConfig(); - String _lineDelimiter = _config_8.getLineDelimiter(); - String _convertToJavaString = Strings.convertToJavaString(_lineDelimiter); + String _convertToJavaString = Strings.convertToJavaString(this.getConfig().getLineDelimiter()); _builder.append(_convertToJavaString, "\t\t\t\t"); _builder.append("\""); _builder.newLineIfNotEmpty(); @@ -522,37 +473,25 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder.newLine(); _builder.append("\t\t\t"); _builder.append("name = \""); - WizardConfiguration _config_9 = this.getConfig(); - LanguageDescriptor _language_2 = _config_9.getLanguage(); - String _name_1 = _language_2.getName(); + String _name_1 = this.getConfig().getLanguage().getName(); _builder.append(_name_1, "\t\t\t"); _builder.append("\""); _builder.newLineIfNotEmpty(); _builder.append("\t\t\t"); _builder.append("fileExtensions = \""); - WizardConfiguration _config_10 = this.getConfig(); - LanguageDescriptor _language_3 = _config_10.getLanguage(); - LanguageDescriptor.FileExtensions _fileExtensions = _language_3.getFileExtensions(); + LanguageDescriptor.FileExtensions _fileExtensions = this.getConfig().getLanguage().getFileExtensions(); _builder.append(_fileExtensions, "\t\t\t"); _builder.append("\""); _builder.newLineIfNotEmpty(); { - WizardConfiguration _config_11 = this.getConfig(); - Ecore2XtextConfiguration _ecore2Xtext = _config_11.getEcore2Xtext(); - Set _ePackageInfos = _ecore2Xtext.getEPackageInfos(); - boolean _isEmpty = _ePackageInfos.isEmpty(); + boolean _isEmpty = this.getConfig().getEcore2Xtext().getEPackageInfos().isEmpty(); boolean _not = (!_isEmpty); if (_not) { { - WizardConfiguration _config_12 = this.getConfig(); - Ecore2XtextConfiguration _ecore2Xtext_1 = _config_12.getEcore2Xtext(); - Set _ePackageInfos_1 = _ecore2Xtext_1.getEPackageInfos(); final Function1 _function = (EPackageInfo it) -> { - URI _genmodelURI = it.getGenmodelURI(); - return _genmodelURI.toString(); + return it.getGenmodelURI().toString(); }; - Iterable _map = IterableExtensions.map(_ePackageInfos_1, _function); - Set _set = IterableExtensions.toSet(_map); + Set _set = IterableExtensions.toSet(IterableExtensions.map(this.getConfig().getEcore2Xtext().getEPackageInfos(), _function)); for(final String genmodelURI : _set) { _builder.append("\t\t\t"); _builder.append("referencedResource = \""); @@ -615,10 +554,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { } private boolean isFromExistingEcoreModels() { - WizardConfiguration _config = this.getConfig(); - Ecore2XtextConfiguration _ecore2Xtext = _config.getEcore2Xtext(); - Set _ePackageInfos = _ecore2Xtext.getEPackageInfos(); - boolean _isEmpty = _ePackageInfos.isEmpty(); + boolean _isEmpty = this.getConfig().getEcore2Xtext().getEPackageInfos().isEmpty(); return (!_isEmpty); } @@ -645,9 +581,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder.newLine(); _builder.append("\t"); _builder.append("mwe2 \"org.eclipse.emf:org.eclipse.emf.mwe2.launch:"); - WizardConfiguration _config = this.getConfig(); - XtextVersion _xtextVersion = _config.getXtextVersion(); - String _mweVersion = _xtextVersion.getMweVersion(); + String _mweVersion = this.getConfig().getXtextVersion().getMweVersion(); _builder.append(_mweVersion, "\t"); _builder.append("\""); _builder.newLineIfNotEmpty(); @@ -887,8 +821,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config = this.getConfig(); - boolean _needsTychoBuild = _config.needsTychoBuild(); + boolean _needsTychoBuild = this.getConfig().needsTychoBuild(); if (_needsTychoBuild) { _builder.append("\t\t\t"); _builder.append(""); @@ -908,9 +841,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder.append("\t\t\t"); _builder.append("\t\t"); _builder.append(""); - WizardConfiguration _config_1 = this.getConfig(); - XtextVersion _xtextVersion = _config_1.getXtextVersion(); - String _mweVersion = _xtextVersion.getMweVersion(); + String _mweVersion = this.getConfig().getXtextVersion().getMweVersion(); _builder.append(_mweVersion, "\t\t\t\t\t"); _builder.append(""); _builder.newLineIfNotEmpty(); @@ -1015,12 +946,9 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config_2 = this.getConfig(); - IdeProjectDescriptor _ideProject = _config_2.getIdeProject(); - WizardConfiguration _config_3 = this.getConfig(); - UiProjectDescriptor _uiProject = _config_3.getUiProject(); - WizardConfiguration _config_4 = this.getConfig(); - WebProjectDescriptor _webProject = _config_4.getWebProject(); + IdeProjectDescriptor _ideProject = this.getConfig().getIdeProject(); + UiProjectDescriptor _uiProject = this.getConfig().getUiProject(); + WebProjectDescriptor _webProject = this.getConfig().getWebProject(); for(final ProjectDescriptor p : Collections.unmodifiableList(CollectionLiterals.newArrayList(this, _ideProject, _uiProject, _webProject))) { { boolean _isEnabled = p.isEnabled(); @@ -1056,8 +984,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { { if ((p instanceof TestedProjectDescriptor)) { { - TestProjectDescriptor _testProject = ((TestedProjectDescriptor)p).getTestProject(); - boolean _isEnabled_1 = _testProject.isEnabled(); + boolean _isEnabled_1 = ((TestedProjectDescriptor)p).getTestProject().isEnabled(); if (_isEnabled_1) { _builder.append("\t\t\t\t\t"); _builder.append(""); @@ -1066,13 +993,11 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder.append("\t"); _builder.append("${basedir}/../"); String _xifexpression_1 = null; - TestProjectDescriptor _testProject_1 = ((TestedProjectDescriptor)p).getTestProject(); - boolean _isInlined = _testProject_1.isInlined(); + boolean _isInlined = ((TestedProjectDescriptor)p).getTestProject().isInlined(); if (_isInlined) { _xifexpression_1 = ((TestedProjectDescriptor)p).getName(); } else { - TestProjectDescriptor _testProject_2 = ((TestedProjectDescriptor)p).getTestProject(); - _xifexpression_1 = _testProject_2.getName(); + _xifexpression_1 = ((TestedProjectDescriptor)p).getTestProject().getName(); } _builder.append(_xifexpression_1, "\t\t\t\t\t\t"); _builder.append("/"); @@ -1626,20 +1551,13 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { private PlainTextFile getWorkflowLaunchConfigFile() { StringConcatenation _builder = new StringConcatenation(); _builder.append(".launch/Generate "); - WizardConfiguration _config = this.getConfig(); - LanguageDescriptor _language = _config.getLanguage(); - String _simpleName = _language.getSimpleName(); + String _simpleName = this.getConfig().getLanguage().getSimpleName(); _builder.append(_simpleName); _builder.append(" ("); - WizardConfiguration _config_1 = this.getConfig(); - LanguageDescriptor _language_1 = _config_1.getLanguage(); - LanguageDescriptor.FileExtensions _fileExtensions = _language_1.getFileExtensions(); - String _head = IterableExtensions.head(_fileExtensions); + String _head = IterableExtensions.head(this.getConfig().getLanguage().getFileExtensions()); _builder.append(_head); _builder.append(") Language Infrastructure.launch"); - String _string = _builder.toString(); - CharSequence _workflowLaunchConfig = this.workflowLaunchConfig(); - return this.file(Outlet.ROOT, _string, _workflowLaunchConfig); + return this.file(Outlet.ROOT, _builder.toString(), this.workflowLaunchConfig()); } /** @@ -1649,26 +1567,16 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { CharSequence _xblockexpression = null; { ArrayList projectsToRefresh = CollectionLiterals.newArrayList(); - WizardConfiguration _config = this.getConfig(); - Set _enabledProjects = _config.getEnabledProjects(); + Set _enabledProjects = this.getConfig().getEnabledProjects(); Iterables.addAll(projectsToRefresh, _enabledProjects); - WizardConfiguration _config_1 = this.getConfig(); - RuntimeProjectDescriptor _runtimeProject = _config_1.getRuntimeProject(); - boolean _isEnabled = _runtimeProject.testProject.isEnabled(); + boolean _isEnabled = this.getConfig().getRuntimeProject().testProject.isEnabled(); if (_isEnabled) { - WizardConfiguration _config_2 = this.getConfig(); - RuntimeProjectDescriptor _runtimeProject_1 = _config_2.getRuntimeProject(); - projectsToRefresh.add(_runtimeProject_1.testProject); + projectsToRefresh.add(this.getConfig().getRuntimeProject().testProject); } - WizardConfiguration _config_3 = this.getConfig(); - UiProjectDescriptor _uiProject = _config_3.getUiProject(); - TestProjectDescriptor _testProject = _uiProject.getTestProject(); - boolean _isEnabled_1 = _testProject.isEnabled(); + boolean _isEnabled_1 = this.getConfig().getUiProject().getTestProject().isEnabled(); if (_isEnabled_1) { - WizardConfiguration _config_4 = this.getConfig(); - UiProjectDescriptor _uiProject_1 = _config_4.getUiProject(); - TestProjectDescriptor _testProject_1 = _uiProject_1.getTestProject(); - projectsToRefresh.add(_testProject_1); + TestProjectDescriptor _testProject = this.getConfig().getUiProject().getTestProject(); + projectsToRefresh.add(_testProject); } StringConcatenation _builder = new StringConcatenation(); _builder.append("${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> "); @@ -1686,18 +1594,14 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder_1.append(""); _builder_1.newLine(); { - WizardConfiguration _config_5 = this.getConfig(); - RuntimeProjectDescriptor _runtimeProject_2 = _config_5.getRuntimeProject(); - boolean _isEclipsePluginProject = _runtimeProject_2.isEclipsePluginProject(); + boolean _isEclipsePluginProject = this.getConfig().getRuntimeProject().isEclipsePluginProject(); if (_isEclipsePluginProject) { _builder_1.append(""); _builder_1.newLine(); _builder_1.append(""); _builder_1.newLine(); _builder_1.append(""); _builder_1.newLineIfNotEmpty(); @@ -1724,22 +1628,15 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder_1.append(""); _builder_1.newLine(); _builder_1.append(""); _builder_1.newLineIfNotEmpty(); _builder_1.append(""); _builder_1.newLineIfNotEmpty(); @@ -1748,8 +1645,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder_1.append(""); _builder_1.newLine(); } else { - WizardConfiguration _config_10 = this.getConfig(); - BuildSystem _preferredBuildSystem = _config_10.getPreferredBuildSystem(); + BuildSystem _preferredBuildSystem = this.getConfig().getPreferredBuildSystem(); boolean _equals = Objects.equal(_preferredBuildSystem, BuildSystem.MAVEN); if (_equals) { _builder_1.append(""); @@ -1785,17 +1681,14 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder_1.append(""); _builder_1.newLine(); _builder_1.append(""); _builder_1.newLineIfNotEmpty(); _builder_1.append(""); _builder_1.newLine(); } else { - WizardConfiguration _config_12 = this.getConfig(); - BuildSystem _preferredBuildSystem_1 = _config_12.getPreferredBuildSystem(); + BuildSystem _preferredBuildSystem_1 = this.getConfig().getPreferredBuildSystem(); boolean _equals_1 = Objects.equal(_preferredBuildSystem_1, BuildSystem.GRADLE); if (_equals_1) { _builder_1.append(""); @@ -1823,9 +1716,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder_1.append(""); _builder_1.newLine(); _builder_1.append(""); _builder_1.newLineIfNotEmpty(); @@ -1844,8 +1735,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { * @since 2.11 */ private PlainTextFile getLaunchConfigFile() { - CharSequence _launchConfig = this.launchConfig(); - return this.file(Outlet.ROOT, ".launch/Launch Runtime Eclipse.launch", _launchConfig); + return this.file(Outlet.ROOT, ".launch/Launch Runtime Eclipse.launch", this.launchConfig()); } /** @@ -1866,9 +1756,7 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor { _builder.append(""); _builder.newLine(); _builder.append(""); _builder.newLineIfNotEmpty(); diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/RuntimeTestProjectDescriptor.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/RuntimeTestProjectDescriptor.java index ee8591692..5e269e2b2 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/RuntimeTestProjectDescriptor.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/RuntimeTestProjectDescriptor.java @@ -20,7 +20,6 @@ import org.eclipse.xtext.xtext.wizard.ExternalDependency; import org.eclipse.xtext.xtext.wizard.Scope; import org.eclipse.xtext.xtext.wizard.TestProjectDescriptor; import org.eclipse.xtext.xtext.wizard.TestedProjectDescriptor; -import org.eclipse.xtext.xtext.wizard.WizardConfiguration; @FinalFieldsConstructor @SuppressWarnings("all") @@ -53,15 +52,13 @@ public class RuntimeTestProjectDescriptor extends TestProjectDescriptor { @Override public boolean isPartOfGradleBuild() { - WizardConfiguration _config = this.getConfig(); - BuildSystem _preferredBuildSystem = _config.getPreferredBuildSystem(); + BuildSystem _preferredBuildSystem = this.getConfig().getPreferredBuildSystem(); return Objects.equal(_preferredBuildSystem, BuildSystem.GRADLE); } @Override public boolean isPartOfMavenBuild() { - WizardConfiguration _config = this.getConfig(); - BuildSystem _preferredBuildSystem = _config.getPreferredBuildSystem(); + BuildSystem _preferredBuildSystem = this.getConfig().getPreferredBuildSystem(); return Objects.equal(_preferredBuildSystem, BuildSystem.MAVEN); } diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/SdkFeatureProject.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/SdkFeatureProject.java index 2f087f6fd..3941d9b30 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/SdkFeatureProject.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/SdkFeatureProject.java @@ -18,13 +18,10 @@ import org.eclipse.xtext.xbase.lib.ObjectExtensions; import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; import org.eclipse.xtext.xtext.wizard.AbstractFile; import org.eclipse.xtext.xtext.wizard.GradleBuildFile; -import org.eclipse.xtext.xtext.wizard.IdeProjectDescriptor; -import org.eclipse.xtext.xtext.wizard.LanguageDescriptor; import org.eclipse.xtext.xtext.wizard.Outlet; import org.eclipse.xtext.xtext.wizard.PlainTextFile; import org.eclipse.xtext.xtext.wizard.PomFile; import org.eclipse.xtext.xtext.wizard.ProjectDescriptor; -import org.eclipse.xtext.xtext.wizard.UiProjectDescriptor; import org.eclipse.xtext.xtext.wizard.WizardConfiguration; /** @@ -107,9 +104,7 @@ public class SdkFeatureProject extends ProjectDescriptor { _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("label=\""); - WizardConfiguration _config = this.getConfig(); - LanguageDescriptor _language = _config.getLanguage(); - String _simpleName = _language.getSimpleName(); + String _simpleName = this.getConfig().getLanguage().getSimpleName(); _builder.append(_simpleName, "\t"); _builder.append(" Feature \""); _builder.newLineIfNotEmpty(); @@ -121,9 +116,7 @@ public class SdkFeatureProject extends ProjectDescriptor { _builder.append(_includedPlugin, "\t"); _builder.newLineIfNotEmpty(); { - WizardConfiguration _config_1 = this.getConfig(); - IdeProjectDescriptor _ideProject = _config_1.getIdeProject(); - boolean _isEnabled = _ideProject.isEnabled(); + boolean _isEnabled = this.getConfig().getIdeProject().isEnabled(); if (_isEnabled) { _builder.append("\t"); CharSequence _includedPlugin_1 = this.includedPlugin(this.getConfig().getIdeProject().getNameQualifier()); @@ -132,9 +125,7 @@ public class SdkFeatureProject extends ProjectDescriptor { } } { - WizardConfiguration _config_2 = this.getConfig(); - UiProjectDescriptor _uiProject = _config_2.getUiProject(); - boolean _isEnabled_1 = _uiProject.isEnabled(); + boolean _isEnabled_1 = this.getConfig().getUiProject().isEnabled(); if (_isEnabled_1) { _builder.append("\t"); CharSequence _includedPlugin_2 = this.includedPlugin(this.getConfig().getUiProject().getNameQualifier()); @@ -153,8 +144,7 @@ public class SdkFeatureProject extends ProjectDescriptor { _builder.newLine(); _builder.append("\t\t"); _builder.append("id=\""); - WizardConfiguration _config = this.getConfig(); - String _baseName = _config.getBaseName(); + String _baseName = this.getConfig().getBaseName(); String _plus = (_baseName + qualifier); _builder.append(_plus, "\t\t"); _builder.append("\""); diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TargetPlatformProject.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TargetPlatformProject.java index 99ab8f9c4..7db05b1e7 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TargetPlatformProject.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TargetPlatformProject.java @@ -50,8 +50,7 @@ public class TargetPlatformProject extends ProjectDescriptor { @Override public boolean isEnabled() { - WizardConfiguration _config = this.getConfig(); - return _config.needsTychoBuild(); + return this.getConfig().needsTychoBuild(); } @Override @@ -128,24 +127,19 @@ public class TargetPlatformProject extends ProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config = this.getConfig(); - XtextVersion _xtextVersion = _config.getXtextVersion(); - boolean _isSnapshot = _xtextVersion.isSnapshot(); + boolean _isSnapshot = this.getConfig().getXtextVersion().isSnapshot(); if (_isSnapshot) { _builder.append(""); _builder.newLine(); } else { - WizardConfiguration _config_1 = this.getConfig(); - XtextVersion _xtextVersion_1 = _config_1.getXtextVersion(); - boolean _isStable = _xtextVersion_1.isStable(); + boolean _isStable = this.getConfig().getXtextVersion().isStable(); if (_isStable) { _builder.append(""); _builder.newLine(); } else { _builder.append(""); _builder.newLineIfNotEmpty(); } diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TestProjectDescriptor.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TestProjectDescriptor.java index 4f204b6b5..a39d0b247 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TestProjectDescriptor.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TestProjectDescriptor.java @@ -11,7 +11,6 @@ import com.google.common.base.Objects; import com.google.common.collect.Iterables; import java.util.Collections; import java.util.LinkedHashSet; -import java.util.List; import java.util.Set; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend2.lib.StringConcatenation; @@ -45,8 +44,7 @@ public abstract class TestProjectDescriptor extends ProjectDescriptor { final Function1 _function = (Outlet it) -> { return this.sourceFolder(it); }; - List _map = ListExtensions.map(Collections.unmodifiableList(CollectionLiterals.newArrayList(Outlet.TEST_JAVA, Outlet.TEST_RESOURCES, Outlet.TEST_SRC_GEN, Outlet.TEST_XTEND_GEN)), _function); - return IterableExtensions.toSet(_map); + return IterableExtensions.toSet(ListExtensions.map(Collections.unmodifiableList(CollectionLiterals.newArrayList(Outlet.TEST_JAVA, Outlet.TEST_RESOURCES, Outlet.TEST_SRC_GEN, Outlet.TEST_XTEND_GEN)), _function)); } public boolean isInlined() { diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TestedProjectDescriptor.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TestedProjectDescriptor.java index 17054a7fb..fa0c23c19 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TestedProjectDescriptor.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/TestedProjectDescriptor.java @@ -34,11 +34,9 @@ public abstract class TestedProjectDescriptor extends ProjectDescriptor { final LinkedHashSet deps = CollectionLiterals.newLinkedHashSet(); Set _externalDependencies = super.getExternalDependencies(); Iterables.addAll(deps, _externalDependencies); - TestProjectDescriptor _testProject = this.getTestProject(); - boolean _isInlined = _testProject.isInlined(); + boolean _isInlined = this.getTestProject().isInlined(); if (_isInlined) { - TestProjectDescriptor _testProject_1 = this.getTestProject(); - Set _externalDependencies_1 = _testProject_1.getExternalDependencies(); + Set _externalDependencies_1 = this.getTestProject().getExternalDependencies(); Iterables.addAll(deps, _externalDependencies_1); } _xblockexpression = deps; @@ -53,11 +51,9 @@ public abstract class TestedProjectDescriptor extends ProjectDescriptor { final LinkedHashSet sourceFolders = CollectionLiterals.newLinkedHashSet(); Set _sourceFolders = super.getSourceFolders(); Iterables.addAll(sourceFolders, _sourceFolders); - TestProjectDescriptor _testProject = this.getTestProject(); - boolean _isInlined = _testProject.isInlined(); + boolean _isInlined = this.getTestProject().isInlined(); if (_isInlined) { - TestProjectDescriptor _testProject_1 = this.getTestProject(); - Set _sourceFolders_1 = _testProject_1.getSourceFolders(); + Set _sourceFolders_1 = this.getTestProject().getSourceFolders(); Iterables.addAll(sourceFolders, _sourceFolders_1); } _xblockexpression = sourceFolders; @@ -72,11 +68,8 @@ public abstract class TestedProjectDescriptor extends ProjectDescriptor { final ArrayList files = CollectionLiterals.newArrayList(); Iterable _files = super.getFiles(); Iterables.addAll(files, _files); - TestProjectDescriptor _testProject = this.getTestProject(); - boolean _isInlined = _testProject.isInlined(); + boolean _isInlined = this.getTestProject().isInlined(); if (_isInlined) { - TestProjectDescriptor _testProject_1 = this.getTestProject(); - Iterable _files_1 = _testProject_1.getFiles(); final Function1 _function = (AbstractFile fileFromTestProject) -> { final Function1 _function_1 = (AbstractFile it) -> { String _relativePath = it.getRelativePath(); @@ -86,7 +79,7 @@ public abstract class TestedProjectDescriptor extends ProjectDescriptor { boolean _exists = IterableExtensions.exists(files, _function_1); return Boolean.valueOf((!_exists)); }; - Iterable _filter = IterableExtensions.filter(_files_1, _function); + Iterable _filter = IterableExtensions.filter(this.getTestProject().getFiles(), _function); Iterables.addAll(files, _filter); } _xblockexpression = files; diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/UiProjectDescriptor.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/UiProjectDescriptor.java index 50a01b30d..55d996fb3 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/UiProjectDescriptor.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/UiProjectDescriptor.java @@ -44,15 +44,12 @@ public class UiProjectDescriptor extends TestedProjectDescriptor { @Override public Set getUpstreamProjects() { - WizardConfiguration _config = this.getConfig(); - RuntimeProjectDescriptor _runtimeProject = _config.getRuntimeProject(); - WizardConfiguration _config_1 = this.getConfig(); - IdeProjectDescriptor _ideProject = _config_1.getIdeProject(); + RuntimeProjectDescriptor _runtimeProject = this.getConfig().getRuntimeProject(); + IdeProjectDescriptor _ideProject = this.getConfig().getIdeProject(); final Function1 _function = (ProjectDescriptor it) -> { return Boolean.valueOf(it.isEnabled()); }; - Iterable _filter = IterableExtensions.filter(Collections.unmodifiableList(CollectionLiterals.newArrayList(_runtimeProject, _ideProject)), _function); - return IterableExtensions.toSet(_filter); + return IterableExtensions.toSet(IterableExtensions.filter(Collections.unmodifiableList(CollectionLiterals.newArrayList(_runtimeProject, _ideProject)), _function)); } @Override @@ -108,14 +105,10 @@ public class UiProjectDescriptor extends TestedProjectDescriptor { }; ExternalDependency _doubleArrow_1 = ObjectExtensions.operator_doubleArrow(_externalDependency_1, _function_1); deps.add(_doubleArrow_1); - WizardConfiguration _config = this.getConfig(); - IdeProjectDescriptor _ideProject = _config.getIdeProject(); - boolean _isEnabled = _ideProject.isEnabled(); + boolean _isEnabled = this.getConfig().getIdeProject().isEnabled(); boolean _not = (!_isEnabled); if (_not) { - WizardConfiguration _config_1 = this.getConfig(); - IdeProjectDescriptor _ideProject_1 = _config_1.getIdeProject(); - Set _externalDependencies_1 = _ideProject_1.getExternalDependencies(); + Set _externalDependencies_1 = this.getConfig().getIdeProject().getExternalDependencies(); Iterables.addAll(deps, _externalDependencies_1); } _xblockexpression = deps; diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/WebProjectDescriptor.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/WebProjectDescriptor.java index 28ffd5605..69cd12d9b 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/WebProjectDescriptor.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/WebProjectDescriptor.java @@ -19,7 +19,6 @@ import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; import org.eclipse.xtext.xtext.wizard.BuildSystem; import org.eclipse.xtext.xtext.wizard.ExternalDependency; import org.eclipse.xtext.xtext.wizard.GradleBuildFile; -import org.eclipse.xtext.xtext.wizard.LanguageDescriptor; import org.eclipse.xtext.xtext.wizard.Outlet; import org.eclipse.xtext.xtext.wizard.PomFile; import org.eclipse.xtext.xtext.wizard.ProjectDescriptor; @@ -57,15 +56,13 @@ public class WebProjectDescriptor extends ProjectDescriptor { @Override public boolean isPartOfGradleBuild() { - WizardConfiguration _config = this.getConfig(); - BuildSystem _preferredBuildSystem = _config.getPreferredBuildSystem(); + BuildSystem _preferredBuildSystem = this.getConfig().getPreferredBuildSystem(); return Objects.equal(_preferredBuildSystem, BuildSystem.GRADLE); } @Override public boolean isPartOfMavenBuild() { - WizardConfiguration _config = this.getConfig(); - BuildSystem _preferredBuildSystem = _config.getPreferredBuildSystem(); + BuildSystem _preferredBuildSystem = this.getConfig().getPreferredBuildSystem(); return Objects.equal(_preferredBuildSystem, BuildSystem.MAVEN); } @@ -127,9 +124,7 @@ public class WebProjectDescriptor extends ProjectDescriptor { _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append("main = \'"); - WizardConfiguration _config = this.getConfig(); - LanguageDescriptor _language = _config.getLanguage(); - String _basePackage = _language.getBasePackage(); + String _basePackage = this.getConfig().getLanguage().getBasePackage(); _builder_1.append(_basePackage, "\t"); _builder_1.append(".web.ServerLauncher\'"); _builder_1.newLineIfNotEmpty(); @@ -158,8 +153,7 @@ public class WebProjectDescriptor extends ProjectDescriptor { _builder.append(""); _builder.newLine(); { - WizardConfiguration _config = this.getConfig(); - SourceLayout _sourceLayout = _config.getSourceLayout(); + SourceLayout _sourceLayout = this.getConfig().getSourceLayout(); boolean _equals = Objects.equal(_sourceLayout, SourceLayout.PLAIN); if (_equals) { _builder.append("\t"); diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/WizardConfiguration.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/WizardConfiguration.java index 8cacbbc03..0eecc75ee 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/WizardConfiguration.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/WizardConfiguration.java @@ -91,15 +91,13 @@ public class WizardConfiguration { return Boolean.valueOf(it.isEnabled()); }; final Iterable productionProjects = IterableExtensions.filter(Collections.unmodifiableList(CollectionLiterals.newArrayList(this.parentProject, this.runtimeProject, this.ideProject, this.uiProject, this.intellijProject, this.webProject, this.targetPlatformProject, this.sdkProject, this.p2Project)), _function); - Iterable _filter = Iterables.filter(productionProjects, TestedProjectDescriptor.class); final Function1 _function_1 = (TestedProjectDescriptor it) -> { return it.getTestProject(); }; - Iterable _map = IterableExtensions.map(_filter, _function_1); final Function1 _function_2 = (TestProjectDescriptor it) -> { return Boolean.valueOf((it.isEnabled() && it.isSeparate())); }; - final Iterable testProjects = IterableExtensions.filter(_map, _function_2); + final Iterable testProjects = IterableExtensions.filter(IterableExtensions.map(Iterables.filter(productionProjects, TestedProjectDescriptor.class), _function_1), _function_2); Iterable _plus = Iterables.concat(productionProjects, testProjects); _xblockexpression = ImmutableSet.copyOf(_plus); } diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/cli/CliProjectsCreator.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/cli/CliProjectsCreator.java index f221fc54b..502513a0a 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/cli/CliProjectsCreator.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/cli/CliProjectsCreator.java @@ -10,9 +10,6 @@ package org.eclipse.xtext.xtext.wizard.cli; import com.google.common.io.Files; import com.google.common.io.Resources; import java.io.File; -import java.net.URL; -import java.nio.charset.Charset; -import java.util.Set; import java.util.function.Consumer; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtext.util.Strings; @@ -20,10 +17,8 @@ import org.eclipse.xtext.xbase.lib.Exceptions; import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xtext.wizard.AbstractFile; import org.eclipse.xtext.xtext.wizard.BinaryFile; -import org.eclipse.xtext.xtext.wizard.Outlet; import org.eclipse.xtext.xtext.wizard.ProjectDescriptor; import org.eclipse.xtext.xtext.wizard.ProjectsCreator; -import org.eclipse.xtext.xtext.wizard.SourceLayout; import org.eclipse.xtext.xtext.wizard.TextFile; import org.eclipse.xtext.xtext.wizard.WizardConfiguration; @@ -34,46 +29,34 @@ public class CliProjectsCreator implements ProjectsCreator { @Override public void createProjects(final WizardConfiguration config) { - Set _enabledProjects = config.getEnabledProjects(); final Consumer _function = (ProjectDescriptor it) -> { this.createProject(it); }; - _enabledProjects.forEach(_function); + config.getEnabledProjects().forEach(_function); } public void createProject(final ProjectDescriptor project) { String _location = project.getLocation(); final File projectRoot = new File(_location); projectRoot.mkdirs(); - Iterable _files = project.getFiles(); final Consumer _function = (AbstractFile it) -> { try { - WizardConfiguration _config = project.getConfig(); - SourceLayout _sourceLayout = _config.getSourceLayout(); - Outlet _outlet = it.getOutlet(); - String _pathFor = _sourceLayout.getPathFor(_outlet); + String _pathFor = project.getConfig().getSourceLayout().getPathFor(it.getOutlet()); String _plus = (_pathFor + "/"); String _relativePath = it.getRelativePath(); final String projectRelativePath = (_plus + _relativePath); final File file = new File(projectRoot, projectRelativePath); - File _parentFile = file.getParentFile(); - _parentFile.mkdirs(); + file.getParentFile().mkdirs(); boolean _matched = false; if (it instanceof TextFile) { _matched=true; - String _content = ((TextFile)it).getContent(); - String _newLine = Strings.newLine(); - final String normalizedContent = _content.replace(_newLine, this.lineDelimiter); - WizardConfiguration _config_1 = project.getConfig(); - Charset _encoding = _config_1.getEncoding(); - Files.write(normalizedContent, file, _encoding); + final String normalizedContent = ((TextFile)it).getContent().replace(Strings.newLine(), this.lineDelimiter); + Files.write(normalizedContent, file, project.getConfig().getEncoding()); } if (!_matched) { if (it instanceof BinaryFile) { _matched=true; - URL _content = ((BinaryFile)it).getContent(); - byte[] _byteArray = Resources.toByteArray(_content); - Files.write(_byteArray, file); + Files.write(Resources.toByteArray(((BinaryFile)it).getContent()), file); } } boolean _isExecutable = it.isExecutable(); @@ -84,13 +67,11 @@ public class CliProjectsCreator implements ProjectsCreator { throw Exceptions.sneakyThrow(_e); } }; - _files.forEach(_function); - Set _sourceFolders = project.getSourceFolders(); + project.getFiles().forEach(_function); final Consumer _function_1 = (String it) -> { - File _file = new File(projectRoot, it); - _file.mkdirs(); + new File(projectRoot, it).mkdirs(); }; - _sourceFolders.forEach(_function_1); + project.getSourceFolders().forEach(_function_1); } @Pure diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ecore2xtext/Ecore2XtextExtensions.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ecore2xtext/Ecore2XtextExtensions.java index f8817ed78..5a73e18f1 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ecore2xtext/Ecore2XtextExtensions.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ecore2xtext/Ecore2XtextExtensions.java @@ -36,17 +36,13 @@ public class Ecore2XtextExtensions { EClass _rootElementClass = it.getRootElementClass(); boolean _tripleEquals = (_rootElementClass == null); if (_tripleEquals) { - Set _ePackageInfos = it.getEPackageInfos(); final Function1> _function = (EPackageInfo it_1) -> { return Ecore2XtextExtensions.allReferencedClassifiers(it_1.getEPackage(), false); }; - Iterable> _map = IterableExtensions.>map(_ePackageInfos, _function); - Iterable _flatten = Iterables.concat(_map); - Set _set = IterableExtensions.toSet(_flatten); final Function1 _function_1 = (EClassifier it_1) -> { return Boolean.valueOf(Ecore2XtextExtensions.needsConcreteRule(it_1)); }; - _xifexpression = IterableExtensions.filter(_set, _function_1); + _xifexpression = IterableExtensions.filter(IterableExtensions.toSet(Iterables.concat(IterableExtensions.>map(it.getEPackageInfos(), _function))), _function_1); } else { Set _xblockexpression = null; { @@ -55,8 +51,7 @@ public class Ecore2XtextExtensions { final Function1 _function_2 = (EClassifier cl) -> { return Boolean.valueOf(Ecore2XtextExtensions.needsConcreteRule(cl)); }; - Iterable _filter = IterableExtensions.filter(c, _function_2); - _xblockexpression = IterableExtensions.toSet(_filter); + _xblockexpression = IterableExtensions.toSet(IterableExtensions.filter(c, _function_2)); } _xifexpression = _xblockexpression; } @@ -68,97 +63,68 @@ public class Ecore2XtextExtensions { EClass _rootElementClass = it.getRootElementClass(); boolean _tripleEquals = (_rootElementClass == null); if (_tripleEquals) { - Set _ePackageInfos = it.getEPackageInfos(); final Function1> _function = (EPackageInfo it_1) -> { return Ecore2XtextExtensions.allReferencedClassifiers(it_1.getEPackage(), false); }; - Iterable> _map = IterableExtensions.>map(_ePackageInfos, _function); - Iterable _flatten = Iterables.concat(_map); - Set _set = IterableExtensions.toSet(_flatten); final Function1 _function_1 = (EClassifier c) -> { return Boolean.valueOf(Ecore2XtextExtensions.needsDispatcherRule(c)); }; - Iterable _filter = IterableExtensions.filter(_set, _function_1); - Iterable _filter_1 = Iterables.filter(_filter, EClass.class); - _xifexpression = IterableExtensions.toSet(_filter_1); + _xifexpression = IterableExtensions.toSet(Iterables.filter(IterableExtensions.filter(IterableExtensions.toSet(Iterables.concat(IterableExtensions.>map(it.getEPackageInfos(), _function))), _function_1), EClass.class)); } else { - Iterable _allConcreteRuleClassifiers = Ecore2XtextExtensions.allConcreteRuleClassifiers(it); - Iterable _filter_2 = Iterables.filter(_allConcreteRuleClassifiers, EClass.class); final Function1> _function_2 = (EClass c) -> { - EList _eAllReferences = c.getEAllReferences(); final Function1 _function_3 = (EReference r) -> { return Boolean.valueOf(Ecore2XtextExtensions.needsAssignment(r)); }; - Iterable _filter_3 = IterableExtensions.filter(_eAllReferences, _function_3); final Function1 _function_4 = (EReference it_1) -> { return it_1.getEType(); }; - return IterableExtensions.map(_filter_3, _function_4); + return IterableExtensions.map(IterableExtensions.filter(c.getEAllReferences(), _function_3), _function_4); }; - Iterable> _map_1 = IterableExtensions.>map(_filter_2, _function_2); - Iterable _flatten_1 = Iterables.concat(_map_1); - Iterable _filter_3 = Iterables.filter(_flatten_1, EClass.class); - _xifexpression = IterableExtensions.toSet(_filter_3); + _xifexpression = IterableExtensions.toSet(Iterables.filter(Iterables.concat(IterableExtensions.>map(Iterables.filter(Ecore2XtextExtensions.allConcreteRuleClassifiers(it), EClass.class), _function_2)), EClass.class)); } return _xifexpression; } public static Collection allReferencedEPackages(final Ecore2XtextConfiguration prjInfo) { - Set _ePackageInfos = prjInfo.getEPackageInfos(); final Function1> _function = (EPackageInfo it) -> { return Ecore2XtextExtensions.allReferencedEPackages(it.getEPackage(), true); }; - Iterable> _map = IterableExtensions.>map(_ePackageInfos, _function); - Iterable _flatten = Iterables.concat(_map); - return IterableExtensions.toSet(_flatten); + return IterableExtensions.toSet(Iterables.concat(IterableExtensions.>map(prjInfo.getEPackageInfos(), _function))); } public static Set allReferencedEPackages(final EPackage ePack, final boolean includeCrossRefs) { - Set _allReferencedClassifiers = Ecore2XtextExtensions.allReferencedClassifiers(ePack, includeCrossRefs); final Function1 _function = (EClassifier it) -> { return it.getEPackage(); }; - Iterable _map = IterableExtensions.map(_allReferencedClassifiers, _function); - Iterable _filterNull = IterableExtensions.filterNull(_map); - return IterableExtensions.toSet(_filterNull); + return IterableExtensions.toSet(IterableExtensions.filterNull(IterableExtensions.map(Ecore2XtextExtensions.allReferencedClassifiers(ePack, includeCrossRefs), _function))); } public static Set allReferencedClassifiers(final EPackage ePack, final boolean includeCrossRefs) { - EList _eClassifiers = ePack.getEClassifiers(); - Iterable _filter = Iterables.filter(_eClassifiers, EClass.class); final Function1> _function = (EClass it) -> { - EList _eAllStructuralFeatures = it.getEAllStructuralFeatures(); final Function1 _function_1 = (EStructuralFeature f) -> { return Boolean.valueOf((Ecore2XtextExtensions.needsAssignment(f) && (includeCrossRefs || Ecore2XtextExtensions.isContainment(f)))); }; - return IterableExtensions.filter(_eAllStructuralFeatures, _function_1); + return IterableExtensions.filter(it.getEAllStructuralFeatures(), _function_1); }; - final Iterable> strFeatures = IterableExtensions.>map(_filter, _function); - Iterable _flatten = Iterables.concat(strFeatures); + final Iterable> strFeatures = IterableExtensions.>map(Iterables.filter(ePack.getEClassifiers(), EClass.class), _function); final Function1 _function_1 = (EStructuralFeature it) -> { return it.getEType(); }; - Iterable _map = IterableExtensions.map(_flatten, _function_1); - final Set refTypes = IterableExtensions.toSet(_map); - EList _eClassifiers_1 = ePack.getEClassifiers(); - Iterable _plus = Iterables.concat(_eClassifiers_1, refTypes); - final Set retVal = IterableExtensions.toSet(_plus); - EClassifier _eString = UniqueNameUtil.eString(); - retVal.add(_eString); + final Set refTypes = IterableExtensions.toSet(IterableExtensions.map(Iterables.concat(strFeatures), _function_1)); + EList _eClassifiers = ePack.getEClassifiers(); + final Set retVal = IterableExtensions.toSet(Iterables.concat(_eClassifiers, refTypes)); + retVal.add(UniqueNameUtil.eString()); return retVal; } private static void allAssignedClassifiers(final EClass eClazz, final Collection acceptor) { - EList _eAllStructuralFeatures = eClazz.getEAllStructuralFeatures(); final Function1 _function = (EStructuralFeature f) -> { return Boolean.valueOf(Ecore2XtextExtensions.needsAssignment(f)); }; - Iterable _filter = IterableExtensions.filter(_eAllStructuralFeatures, _function); final Function1 _function_1 = (EStructuralFeature it) -> { return it.getEType(); }; - Iterable _map = IterableExtensions.map(_filter, _function_1); - final List classifiers = IterableExtensions.toList(_map); + final List classifiers = IterableExtensions.toList(IterableExtensions.map(IterableExtensions.filter(eClazz.getEAllStructuralFeatures(), _function), _function_1)); Iterable _subClasses = Ecore2XtextExtensions.subClasses(eClazz); Iterables.addAll(classifiers, _subClasses); classifiers.removeAll(acceptor); @@ -167,11 +133,10 @@ public class Ecore2XtextExtensions { return; } else { Iterables.addAll(acceptor, classifiers); - Iterable _filter_1 = Iterables.filter(classifiers, EClass.class); final Consumer _function_2 = (EClass c) -> { Ecore2XtextExtensions.allAssignedClassifiers(c, acceptor); }; - _filter_1.forEach(_function_2); + Iterables.filter(classifiers, EClass.class).forEach(_function_2); } } @@ -186,8 +151,7 @@ public class Ecore2XtextExtensions { if (_tripleEquals) { _xifexpression = Ecore2XtextExtensions.quoteIfNeccesary(it.getName()); } else { - EPackage _ePackage_1 = it.getEPackage(); - String _uniqueName_1 = UniqueNameUtil.uniqueName(_ePackage_1); + String _uniqueName_1 = UniqueNameUtil.uniqueName(it.getEPackage()); String _plus = (_uniqueName_1 + "::"); String _quoteIfNeccesary = Ecore2XtextExtensions.quoteIfNeccesary(it.getName()); _xifexpression = (_plus + _quoteIfNeccesary); @@ -196,25 +160,19 @@ public class Ecore2XtextExtensions { } public static Iterable prefixFeatures(final EClass it) { - EList _eAllStructuralFeatures = it.getEAllStructuralFeatures(); final Function1 _function = (EStructuralFeature f) -> { return Boolean.valueOf((Ecore2XtextExtensions.needsAssignment(f) && Ecore2XtextExtensions.isPrefixBooleanFeature(f))); }; - return IterableExtensions.filter(_eAllStructuralFeatures, _function); + return IterableExtensions.filter(it.getEAllStructuralFeatures(), _function); } public static Iterable inlinedFeatures(final EClass it) { - EList _eAllStructuralFeatures = it.getEAllStructuralFeatures(); final Function1 _function = (EStructuralFeature f) -> { return Boolean.valueOf(Ecore2XtextExtensions.needsAssignment(f)); }; - Iterable _filter = IterableExtensions.filter(_eAllStructuralFeatures, _function); - final List features = IterableExtensions.toList(_filter); - EAttribute _idAttribute = Ecore2XtextExtensions.idAttribute(it); - features.remove(_idAttribute); - Iterable _prefixFeatures = Ecore2XtextExtensions.prefixFeatures(it); - List _list = IterableExtensions.toList(_prefixFeatures); - features.removeAll(_list); + final List features = IterableExtensions.toList(IterableExtensions.filter(it.getEAllStructuralFeatures(), _function)); + features.remove(Ecore2XtextExtensions.idAttribute(it)); + features.removeAll(IterableExtensions.toList(Ecore2XtextExtensions.prefixFeatures(it))); return features; } @@ -227,8 +185,7 @@ public class Ecore2XtextExtensions { final Function1 _function = (EStructuralFeature f) -> { return Boolean.valueOf(f.isRequired()); }; - Iterable _filter = IterableExtensions.filter(features, _function); - _xblockexpression = IterableExtensions.isEmpty(_filter); + _xblockexpression = IterableExtensions.isEmpty(IterableExtensions.filter(features, _function)); } return _xblockexpression; } @@ -241,8 +198,7 @@ public class Ecore2XtextExtensions { String _plus = ("\'" + _name); _xifexpression = (_plus + "\'"); } else { - EClassifier _eType = it.getEType(); - _xifexpression = UniqueNameUtil.uniqueName(_eType); + _xifexpression = UniqueNameUtil.uniqueName(it.getEType()); } return _xifexpression; } @@ -371,7 +327,7 @@ public class Ecore2XtextExtensions { } public static boolean isXtextKeyword(final String str) { - ArrayList _newArrayList = CollectionLiterals.newArrayList( + return CollectionLiterals.newArrayList( "returns", "generate", "terminal", @@ -383,8 +339,7 @@ public class Ecore2XtextExtensions { "as", "current", "fragment", - "EOF"); - return _newArrayList.contains(str); + "EOF").contains(str); } public static EAttribute idAttribute(final EClass it) { @@ -395,11 +350,10 @@ public class Ecore2XtextExtensions { if ((idAttr != null)) { _xifexpression = idAttr; } else { - EList _eAllAttributes = it.getEAllAttributes(); final Function1 _function = (EAttribute a) -> { return Boolean.valueOf((((Ecore2XtextExtensions.needsAssignment(a) && Objects.equal(a.getName(), "name")) && Objects.equal(a.getEType().getName(), "EString")) && (!a.isMany()))); }; - _xifexpression = IterableExtensions.findFirst(_eAllAttributes, _function); + _xifexpression = IterableExtensions.findFirst(it.getEAllAttributes(), _function); } _xblockexpression = _xifexpression; } @@ -407,11 +361,10 @@ public class Ecore2XtextExtensions { } private static EAttribute idAttributeInternal(final EClass it) { - EList _eAllAttributes = it.getEAllAttributes(); final Function1 _function = (EAttribute a) -> { return Boolean.valueOf((Ecore2XtextExtensions.needsAssignment(a) && a.isID())); }; - return IterableExtensions.findFirst(_eAllAttributes, _function); + return IterableExtensions.findFirst(it.getEAllAttributes(), _function); } public static boolean isBoolean(final EClassifier it) { @@ -462,12 +415,10 @@ public class Ecore2XtextExtensions { boolean _matched = false; if (eClassifier instanceof EClass) { _matched=true; - Iterable _subClasses = Ecore2XtextExtensions.subClasses(((EClass)eClassifier)); final Function1 _function = (EClass c) -> { return Boolean.valueOf(Ecore2XtextExtensions.needsConcreteRule(c)); }; - Iterable _filter = IterableExtensions.filter(_subClasses, _function); - boolean _isEmpty = IterableExtensions.isEmpty(_filter); + boolean _isEmpty = IterableExtensions.isEmpty(IterableExtensions.filter(Ecore2XtextExtensions.subClasses(((EClass)eClassifier)), _function)); _switchResult = (!_isEmpty); } if (!_matched) { @@ -502,39 +453,30 @@ public class Ecore2XtextExtensions { if (_tripleEquals) { _xifexpression = CollectionLiterals.emptyList(); } else { - EPackage _ePackage_1 = it.getEPackage(); - EList _eClassifiers = _ePackage_1.getEClassifiers(); - Iterable _filter = Iterables.filter(_eClassifiers, EClass.class); final Function1 _function = (EClass c) -> { - EList _eAllSuperTypes = c.getEAllSuperTypes(); - return Boolean.valueOf(_eAllSuperTypes.contains(it)); + return Boolean.valueOf(c.getEAllSuperTypes().contains(it)); }; - _xifexpression = IterableExtensions.filter(_filter, _function); + _xifexpression = IterableExtensions.filter(Iterables.filter(it.getEPackage().getEClassifiers(), EClass.class), _function); } return _xifexpression; } public static Iterable allAttributes(final EClass it) { - Iterable _inlinedFeatures = Ecore2XtextExtensions.inlinedFeatures(it); - return Iterables.filter(_inlinedFeatures, EAttribute.class); + return Iterables.filter(Ecore2XtextExtensions.inlinedFeatures(it), EAttribute.class); } public static Iterable allCrossReferences(final EClass it) { - Iterable _inlinedFeatures = Ecore2XtextExtensions.inlinedFeatures(it); - Iterable _filter = Iterables.filter(_inlinedFeatures, EReference.class); final Function1 _function = (EReference f) -> { boolean _isContainment = f.isContainment(); return Boolean.valueOf((!_isContainment)); }; - return IterableExtensions.filter(_filter, _function); + return IterableExtensions.filter(Iterables.filter(Ecore2XtextExtensions.inlinedFeatures(it), EReference.class), _function); } public static Iterable allContainmentReferences(final EClass it) { - Iterable _inlinedFeatures = Ecore2XtextExtensions.inlinedFeatures(it); - Iterable _filter = Iterables.filter(_inlinedFeatures, EReference.class); final Function1 _function = (EReference f) -> { return Boolean.valueOf(f.isContainment()); }; - return IterableExtensions.filter(_filter, _function); + return IterableExtensions.filter(Iterables.filter(Ecore2XtextExtensions.inlinedFeatures(it), EReference.class), _function); } } diff --git a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ecore2xtext/Ecore2XtextGrammarCreator.java b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ecore2xtext/Ecore2XtextGrammarCreator.java index 34c6e1e05..520d4749d 100644 --- a/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ecore2xtext/Ecore2XtextGrammarCreator.java +++ b/org.eclipse.xtext.xtext.wizard/xtend-gen/org/eclipse/xtext/xtext/wizard/ecore2xtext/Ecore2XtextGrammarCreator.java @@ -12,7 +12,6 @@ import com.google.common.collect.Iterables; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; @@ -27,9 +26,7 @@ import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.ListExtensions; -import org.eclipse.xtext.xtext.wizard.EPackageInfo; import org.eclipse.xtext.xtext.wizard.Ecore2XtextConfiguration; -import org.eclipse.xtext.xtext.wizard.LanguageDescriptor; import org.eclipse.xtext.xtext.wizard.WizardConfiguration; import org.eclipse.xtext.xtext.wizard.ecore2xtext.Ecore2XtextExtensions; import org.eclipse.xtext.xtext.wizard.ecore2xtext.UniqueNameUtil; @@ -40,14 +37,12 @@ public class Ecore2XtextGrammarCreator { CharSequence _xblockexpression = null; { final Ecore2XtextConfiguration it = config.getEcore2Xtext(); - EPackageInfo _defaultEPackageInfo = it.getDefaultEPackageInfo(); - UniqueNameUtil.clearUniqueNames(_defaultEPackageInfo); + UniqueNameUtil.clearUniqueNames(it.getDefaultEPackageInfo()); StringConcatenation _builder = new StringConcatenation(); _builder.append("// automatically generated by Xtext"); _builder.newLine(); _builder.append("grammar "); - LanguageDescriptor _language = config.getLanguage(); - String _name = _language.getName(); + String _name = config.getLanguage().getName(); _builder.append(_name); _builder.append(" with org.eclipse.xtext.common.Terminals"); _builder.newLineIfNotEmpty(); @@ -70,14 +65,11 @@ public class Ecore2XtextGrammarCreator { } } _builder.newLine(); - EClass _rootElementClass = it.getRootElementClass(); - CharSequence _rules = this.rules(_rootElementClass); + CharSequence _rules = this.rules(it.getRootElementClass()); _builder.append(_rules); _builder.newLineIfNotEmpty(); { - Collection _allDispatcherRuleClasses = Ecore2XtextExtensions.allDispatcherRuleClasses(it); - EClass _rootElementClass_1 = it.getRootElementClass(); - List _but = this.but(_allDispatcherRuleClasses, _rootElementClass_1); + List _but = this.but(Ecore2XtextExtensions.allDispatcherRuleClasses(it), it.getRootElementClass()); for(final EClass it_2 : _but) { _builder.newLine(); CharSequence _subClassDispatcherRule = this.subClassDispatcherRule(it_2); @@ -86,9 +78,7 @@ public class Ecore2XtextGrammarCreator { } } { - Iterable _allConcreteRuleClassifiers = Ecore2XtextExtensions.allConcreteRuleClassifiers(it); - EClass _rootElementClass_2 = it.getRootElementClass(); - List _but_1 = this.but(_allConcreteRuleClassifiers, _rootElementClass_2); + List _but_1 = this.but(Ecore2XtextExtensions.allConcreteRuleClassifiers(it), it.getRootElementClass()); for(final EClassifier it_3 : _but_1) { _builder.newLine(); CharSequence _rule = this.rule(it_3); @@ -138,13 +128,11 @@ public class Ecore2XtextGrammarCreator { final Function1 _function = (EClass c) -> { return Boolean.valueOf(Ecore2XtextExtensions.needsConcreteRule(c)); }; - Iterable _filter = IterableExtensions.filter(list, _function); - list = _filter; + list = IterableExtensions.filter(list, _function); final Function1 _function_1 = (EClass it) -> { return Ecore2XtextExtensions.concreteRuleName(it); }; - Iterable _map = IterableExtensions.map(list, _function_1); - _xblockexpression = IterableExtensions.join(_map, " | "); + _xblockexpression = IterableExtensions.join(IterableExtensions.map(list, _function_1), " | "); } return _xblockexpression; } @@ -192,8 +180,7 @@ public class Ecore2XtextGrammarCreator { } } } - String _name = it.getName(); - String _quoteIfNeccesary = Ecore2XtextExtensions.quoteIfNeccesary(_name); + String _quoteIfNeccesary = Ecore2XtextExtensions.quoteIfNeccesary(it.getName()); _builder.append(_quoteIfNeccesary); CharSequence _assignmentOperator = this.assignmentOperator(it); _builder.append(_assignmentOperator); @@ -203,8 +190,7 @@ public class Ecore2XtextGrammarCreator { boolean _isMany_1 = it.isMany(); if (_isMany_1) { _builder.append(" ( \",\" "); - String _name_1 = it.getName(); - String _quoteIfNeccesary_1 = Ecore2XtextExtensions.quoteIfNeccesary(_name_1); + String _quoteIfNeccesary_1 = Ecore2XtextExtensions.quoteIfNeccesary(it.getName()); _builder.append(_quoteIfNeccesary_1); CharSequence _assignmentOperator_1 = this.assignmentOperator(it); _builder.append(_assignmentOperator_1); @@ -245,13 +231,11 @@ public class Ecore2XtextGrammarCreator { CharSequence _xifexpression = null; boolean _isContainment = ((EReference)it).isContainment(); if (_isContainment) { - EClass _eReferenceType = ((EReference)it).getEReferenceType(); - _xifexpression = UniqueNameUtil.uniqueName(_eReferenceType); + _xifexpression = UniqueNameUtil.uniqueName(((EReference)it).getEReferenceType()); } else { StringConcatenation _builder = new StringConcatenation(); _builder.append("["); - EClass _eReferenceType_1 = ((EReference)it).getEReferenceType(); - String _fqn = Ecore2XtextExtensions.fqn(_eReferenceType_1); + String _fqn = Ecore2XtextExtensions.fqn(((EReference)it).getEReferenceType()); _builder.append(_fqn); _builder.append("|EString]"); _xifexpression = _builder; @@ -334,8 +318,7 @@ public class Ecore2XtextGrammarCreator { CharSequence _idAssignment = this.idAssignment(((EClass)it)); _builder.append(_idAssignment, "\t"); { - Iterable _inlinedFeatures = Ecore2XtextExtensions.inlinedFeatures(((EClass)it)); - boolean _isEmpty = IterableExtensions.isEmpty(_inlinedFeatures); + boolean _isEmpty = IterableExtensions.isEmpty(Ecore2XtextExtensions.inlinedFeatures(((EClass)it))); boolean _not = (!_isEmpty); if (_not) { _builder.newLineIfNotEmpty(); @@ -385,8 +368,7 @@ public class Ecore2XtextGrammarCreator { _matched=true; StringConcatenation _builder = new StringConcatenation(); _builder.append("enum "); - String _name = ((EEnum)it).getName(); - String _quoteIfNeccesary = Ecore2XtextExtensions.quoteIfNeccesary(_name); + String _quoteIfNeccesary = Ecore2XtextExtensions.quoteIfNeccesary(((EEnum)it).getName()); _builder.append(_quoteIfNeccesary); _builder.append(" returns "); String _fqn = Ecore2XtextExtensions.fqn(it); @@ -394,16 +376,14 @@ public class Ecore2XtextGrammarCreator { _builder.append(":"); _builder.newLineIfNotEmpty(); _builder.append("\t\t\t\t"); - EList _eLiterals = ((EEnum)it).getELiterals(); final Function1 _function = (EEnumLiteral it_1) -> { + String _name = it_1.getName(); + String _plus = (_name + " = \'"); String _name_1 = it_1.getName(); - String _plus = (_name_1 + " = \'"); - String _name_2 = it_1.getName(); - String _plus_1 = (_plus + _name_2); + String _plus_1 = (_plus + _name_1); return (_plus_1 + "\'"); }; - List _map = ListExtensions.map(_eLiterals, _function); - String _join = IterableExtensions.join(_map, " | "); + String _join = IterableExtensions.join(ListExtensions.map(((EEnum)it).getELiterals(), _function), " | "); _builder.append(_join, "\t\t\t\t"); _builder.append(";"); _switchResult = _builder; diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/BuildContext.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/BuildContext.java index a148a255c..d04472850 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/BuildContext.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/BuildContext.java @@ -52,8 +52,7 @@ public class BuildContext { final Function1 _function = (URI it) -> { return Boolean.valueOf(this.canHandle(it)); }; - Iterable _filter = IterableExtensions.filter(uri, _function); - return this.loader.executeClustered(_filter, operation); + return this.loader.executeClustered(IterableExtensions.filter(uri, _function), operation); } protected boolean canHandle(final URI uri) { diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/BuildRequest.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/BuildRequest.java index 98a667e64..d9fb3eb26 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/BuildRequest.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/BuildRequest.java @@ -49,21 +49,17 @@ public class BuildRequest { if (_severity != null) { switch (_severity) { case ERROR: - String _string = issue.toString(); - BuildRequest.DefaultValidationCallback.LOG.error(_string); + BuildRequest.DefaultValidationCallback.LOG.error(issue.toString()); errorFree = false; break; case WARNING: - String _string_1 = issue.toString(); - BuildRequest.DefaultValidationCallback.LOG.warn(_string_1); + BuildRequest.DefaultValidationCallback.LOG.warn(issue.toString()); break; case INFO: - String _string_2 = issue.toString(); - BuildRequest.DefaultValidationCallback.LOG.info(_string_2); + BuildRequest.DefaultValidationCallback.LOG.info(issue.toString()); break; case IGNORE: - String _string_3 = issue.toString(); - BuildRequest.DefaultValidationCallback.LOG.debug(_string_3); + BuildRequest.DefaultValidationCallback.LOG.debug(issue.toString()); break; default: break; @@ -81,7 +77,8 @@ public class BuildRequest { public URI getBaseDir() { if ((this.baseDir == null)) { final String userDir = System.getProperty("user.dir"); - this.baseDir = UriUtil.createFolderURI(new File(userDir)); + File _file = new File(userDir); + this.baseDir = UriUtil.createFolderURI(_file); } return this.baseDir; } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/ClusteringStorageAwareResourceLoader.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/ClusteringStorageAwareResourceLoader.java index 0b40e08a4..c0cac01ad 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/ClusteringStorageAwareResourceLoader.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/ClusteringStorageAwareResourceLoader.java @@ -11,15 +11,12 @@ import com.google.common.collect.Iterables; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; import org.eclipse.xtext.build.BuildContext; import org.eclipse.xtext.resource.IResourceServiceProvider; import org.eclipse.xtext.resource.IResourceServiceProviderExtension; -import org.eclipse.xtext.resource.XtextResourceSet; -import org.eclipse.xtext.resource.clustering.IResourceClusteringPolicy; import org.eclipse.xtext.resource.persistence.SourceLevelURIsAdapter; import org.eclipse.xtext.resource.persistence.StorageAwareResource; import org.eclipse.xtext.xbase.lib.CollectionLiterals; @@ -47,10 +44,7 @@ public class ClusteringStorageAwareResourceLoader { while (iter.hasNext()) { { final URI uri = iter.next(); - IResourceClusteringPolicy _clusteringPolicy = this.context.getClusteringPolicy(); - XtextResourceSet _resourceSet = this.context.getResourceSet(); - int _size = loadedURIs.size(); - boolean _continueProcessing = _clusteringPolicy.continueProcessing(_resourceSet, uri, _size); + boolean _continueProcessing = this.context.getClusteringPolicy().continueProcessing(this.context.getResourceSet(), uri, loadedURIs.size()); boolean _not = (!_continueProcessing); if (_not) { final Function1 _function = (Resource it) -> { @@ -66,19 +60,16 @@ public class ClusteringStorageAwareResourceLoader { boolean _isSource = this.isSource(uri); if (_isSource) { sourceLevelURIs.add(uri); - XtextResourceSet _resourceSet_1 = this.context.getResourceSet(); - final Resource existingResource = _resourceSet_1.getResource(uri, false); + final Resource existingResource = this.context.getResourceSet().getResource(uri, false); if ((existingResource instanceof StorageAwareResource)) { boolean _isLoadedFromStorage = ((StorageAwareResource)existingResource).isLoadedFromStorage(); if (_isLoadedFromStorage) { ((StorageAwareResource)existingResource).unload(); } } - XtextResourceSet _resourceSet_2 = this.context.getResourceSet(); - SourceLevelURIsAdapter.setSourceLevelUris(_resourceSet_2, sourceLevelURIs); + SourceLevelURIsAdapter.setSourceLevelUris(this.context.getResourceSet(), sourceLevelURIs); } - XtextResourceSet _resourceSet_3 = this.context.getResourceSet(); - Resource _resource = _resourceSet_3.getResource(uri, true); + Resource _resource = this.context.getResourceSet().getResource(uri, true); resources.add(_resource); } } @@ -99,17 +90,12 @@ public class ClusteringStorageAwareResourceLoader { } protected void clearResourceSet() { - XtextResourceSet _resourceSet = this.context.getResourceSet(); - final boolean wasDeliver = _resourceSet.eDeliver(); + final boolean wasDeliver = this.context.getResourceSet().eDeliver(); try { - XtextResourceSet _resourceSet_1 = this.context.getResourceSet(); - _resourceSet_1.eSetDeliver(false); - XtextResourceSet _resourceSet_2 = this.context.getResourceSet(); - EList _resources = _resourceSet_2.getResources(); - _resources.clear(); + this.context.getResourceSet().eSetDeliver(false); + this.context.getResourceSet().getResources().clear(); } finally { - XtextResourceSet _resourceSet_3 = this.context.getResourceSet(); - _resourceSet_3.eSetDeliver(wasDeliver); + this.context.getResourceSet().eSetDeliver(wasDeliver); } } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/IncrementalBuilder.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/IncrementalBuilder.java index 19ce2365e..1052c0977 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/IncrementalBuilder.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/IncrementalBuilder.java @@ -14,14 +14,11 @@ import com.google.inject.Provider; import java.io.InputStream; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.function.Consumer; import org.apache.log4j.Logger; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.URIConverter; import org.eclipse.xtend.lib.annotations.AccessorType; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtend.lib.annotations.Data; @@ -67,7 +64,6 @@ import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.ObjectExtensions; import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure2; import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; @@ -160,11 +156,8 @@ public class IncrementalBuilder { private OperationCanceledManager _operationCanceledManager; public IncrementalBuilder.Result launch() { - IndexState _state = this.request.getState(); - final Source2GeneratedMapping newSource2GeneratedMapping = _state.getFileMappings(); - List _deletedFiles = this.request.getDeletedFiles(); + final Source2GeneratedMapping newSource2GeneratedMapping = this.request.getState().getFileMappings(); final Consumer _function = (URI source) -> { - Set _deleteSource = newSource2GeneratedMapping.deleteSource(source); final Consumer _function_1 = (URI generated) -> { try { boolean _isInfoEnabled = IncrementalBuilder.InternalStatefulIncrementalBuilder.LOG.isInfoEnabled(); @@ -172,9 +165,7 @@ public class IncrementalBuilder { IncrementalBuilder.InternalStatefulIncrementalBuilder.LOG.info(("Deleting " + generated)); } final IResourceServiceProvider serviceProvider = this.context.getResourceServiceProvider(source); - IContextualOutputConfigurationProvider2 _get = serviceProvider.get(IContextualOutputConfigurationProvider2.class); - XtextResourceSet _resourceSet = this.request.getResourceSet(); - final Set configs = _get.getOutputConfigurations(_resourceSet); + final Set configs = serviceProvider.get(IContextualOutputConfigurationProvider2.class).getOutputConfigurations(this.request.getResourceSet()); final String configName = newSource2GeneratedMapping.getOutputConfigName(generated); final Function1 _function_2 = (OutputConfiguration it) -> { String _name = it.getName(); @@ -182,117 +173,88 @@ public class IncrementalBuilder { }; final OutputConfiguration config = IterableExtensions.findFirst(configs, _function_2); if (((config != null) && config.isCleanUpDerivedResources())) { - XtextResourceSet _resourceSet_1 = this.context.getResourceSet(); - URIConverter _uRIConverter = _resourceSet_1.getURIConverter(); - Map _emptyMap = CollectionLiterals.emptyMap(); - _uRIConverter.delete(generated, _emptyMap); - Procedure1 _afterDeleteFile = this.request.getAfterDeleteFile(); - _afterDeleteFile.apply(generated); + this.context.getResourceSet().getURIConverter().delete(generated, CollectionLiterals.emptyMap()); + this.request.getAfterDeleteFile().apply(generated); } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }; - _deleteSource.forEach(_function_1); + newSource2GeneratedMapping.deleteSource(source).forEach(_function_1); }; - _deletedFiles.forEach(_function); + this.request.getDeletedFiles().forEach(_function); final Indexer.IndexResult result = this.indexer.computeAndIndexAffected(this.request, this.context); - CancelIndicator _cancelIndicator = this.request.getCancelIndicator(); - this._operationCanceledManager.checkCanceled(_cancelIndicator); + this._operationCanceledManager.checkCanceled(this.request.getCancelIndicator()); final ArrayList resolvedDeltas = CollectionLiterals.newArrayList(); - List _resourceDeltas = result.getResourceDeltas(); final Function1 _function_1 = (IResourceDescription.Delta it) -> { IResourceDescription _new = it.getNew(); return Boolean.valueOf((_new == null)); }; - Iterable _filter = IterableExtensions.filter(_resourceDeltas, _function_1); + Iterable _filter = IterableExtensions.filter(result.getResourceDeltas(), _function_1); Iterables.addAll(resolvedDeltas, _filter); - List _resourceDeltas_1 = result.getResourceDeltas(); final Function1 _function_2 = (IResourceDescription.Delta it) -> { IResourceDescription _new = it.getNew(); return Boolean.valueOf((_new != null)); }; - Iterable _filter_1 = IterableExtensions.filter(_resourceDeltas_1, _function_2); final Function1 _function_3 = (IResourceDescription.Delta it) -> { return it.getUri(); }; - Iterable _map = IterableExtensions.map(_filter_1, _function_3); final Function1 _function_4 = (Resource resource) -> { - CancelIndicator _cancelIndicator_1 = this.request.getCancelIndicator(); - this._operationCanceledManager.checkCanceled(_cancelIndicator_1); + this._operationCanceledManager.checkCanceled(this.request.getCancelIndicator()); resource.getContents(); EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl); - CancelIndicator _cancelIndicator_2 = this.request.getCancelIndicator(); - this._operationCanceledManager.checkCanceled(_cancelIndicator_2); - URI _uRI = resource.getURI(); - final IResourceServiceProvider serviceProvider = this.context.getResourceServiceProvider(_uRI); + this._operationCanceledManager.checkCanceled(this.request.getCancelIndicator()); + final IResourceServiceProvider serviceProvider = this.context.getResourceServiceProvider(resource.getURI()); final IResourceDescription.Manager manager = serviceProvider.getResourceDescriptionManager(); final IResourceDescription description = manager.getResourceDescription(resource); final SerializableResourceDescription copiedDescription = SerializableResourceDescription.createCopy(description); - ResourceDescriptionsData _newIndex = result.getNewIndex(); - URI _uRI_1 = resource.getURI(); - _newIndex.addDescription(_uRI_1, copiedDescription); - CancelIndicator _cancelIndicator_3 = this.request.getCancelIndicator(); - this._operationCanceledManager.checkCanceled(_cancelIndicator_3); + result.getNewIndex().addDescription(resource.getURI(), copiedDescription); + this._operationCanceledManager.checkCanceled(this.request.getCancelIndicator()); if ((((!this.request.isIndexOnly()) && this.validate(resource)) && serviceProvider.get(IShouldGenerate.class).shouldGenerate(resource, CancelIndicator.NullImpl))) { - CancelIndicator _cancelIndicator_4 = this.request.getCancelIndicator(); - this._operationCanceledManager.checkCanceled(_cancelIndicator_4); + this._operationCanceledManager.checkCanceled(this.request.getCancelIndicator()); this.generate(resource, this.request, newSource2GeneratedMapping); } - IndexState _oldState = this.context.getOldState(); - ResourceDescriptionsData _resourceDescriptions = _oldState.getResourceDescriptions(); - URI _uRI_2 = resource.getURI(); - final IResourceDescription old = _resourceDescriptions.getResourceDescription(_uRI_2); + final IResourceDescription old = this.context.getOldState().getResourceDescriptions().getResourceDescription(resource.getURI()); return manager.createDelta(old, copiedDescription); }; - Iterable _executeClustered = this.context.executeClustered(_map, _function_4); + Iterable _executeClustered = this.context.executeClustered(IterableExtensions.map(IterableExtensions.filter(result.getResourceDeltas(), _function_2), _function_3), _function_4); Iterables.addAll(resolvedDeltas, _executeClustered); - IndexState _state_1 = this.request.getState(); - return new IncrementalBuilder.Result(_state_1, resolvedDeltas); + IndexState _state = this.request.getState(); + return new IncrementalBuilder.Result(_state, resolvedDeltas); } protected boolean validate(final Resource resource) { - IResourceServiceProvider _resourceServiceProvider = this.context.getResourceServiceProvider(resource.getURI()); - final IResourceValidator resourceValidator = _resourceServiceProvider.getResourceValidator(); + final IResourceValidator resourceValidator = this.context.getResourceServiceProvider(resource.getURI()).getResourceValidator(); if ((resourceValidator == null)) { return true; } - URI _uRI = resource.getURI(); - String _lastSegment = _uRI.lastSegment(); + String _lastSegment = resource.getURI().lastSegment(); String _plus = ("Starting validation for input: \'" + _lastSegment); String _plus_1 = (_plus + "\'"); IncrementalBuilder.InternalStatefulIncrementalBuilder.LOG.info(_plus_1); final List validationResult = resourceValidator.validate(resource, CheckMode.ALL, null); - BuildRequest.IPostValidationCallback _afterValidate = this.request.getAfterValidate(); - URI _uRI_1 = resource.getURI(); - return _afterValidate.afterValidate(_uRI_1, validationResult); + return this.request.getAfterValidate().afterValidate(resource.getURI(), validationResult); } protected void generate(final Resource resource, final BuildRequest request, final Source2GeneratedMapping newMappings) { - URI _uRI = resource.getURI(); - final IResourceServiceProvider serviceProvider = this.context.getResourceServiceProvider(_uRI); + final IResourceServiceProvider serviceProvider = this.context.getResourceServiceProvider(resource.getURI()); final GeneratorDelegate generator = serviceProvider.get(GeneratorDelegate.class); if ((generator == null)) { return; } - URI _uRI_1 = resource.getURI(); - final Set previous = newMappings.deleteSource(_uRI_1); + final Set previous = newMappings.deleteSource(resource.getURI()); URIBasedFileSystemAccess _createFileSystemAccess = this.createFileSystemAccess(serviceProvider, resource); final Procedure1 _function = (URIBasedFileSystemAccess it) -> { final URIBasedFileSystemAccess.BeforeWrite _function_1 = (URI uri, String outputCfgName, InputStream contents) -> { - URI _uRI_2 = resource.getURI(); - newMappings.addSource2Generated(_uRI_2, uri, outputCfgName); + newMappings.addSource2Generated(resource.getURI(), uri, outputCfgName); previous.remove(uri); - Procedure2 _afterGenerateFile = request.getAfterGenerateFile(); - URI _uRI_3 = resource.getURI(); - _afterGenerateFile.apply(_uRI_3, uri); + request.getAfterGenerateFile().apply(resource.getURI(), uri); return contents; }; it.setBeforeWrite(_function_1); final URIBasedFileSystemAccess.BeforeDelete _function_2 = (URI uri) -> { newMappings.deleteGenerated(uri); - Procedure1 _afterDeleteFile = request.getAfterDeleteFile(); - _afterDeleteFile.apply(uri); + request.getAfterDeleteFile().apply(uri); return true; }; it.setBeforeDelete(_function_2); @@ -307,8 +269,7 @@ public class IncrementalBuilder { boolean _tripleNotEquals = (_resourceStorageFacade != null); if (_tripleNotEquals) { _matched=true; - IResourceStorageFacade _resourceStorageFacade_1 = ((StorageAwareResource)resource).getResourceStorageFacade(); - _resourceStorageFacade_1.saveResource(((StorageAwareResource)resource), fileSystemAccess); + ((StorageAwareResource)resource).getResourceStorageFacade().saveResource(((StorageAwareResource)resource), fileSystemAccess); } } } @@ -318,12 +279,8 @@ public class IncrementalBuilder { final Consumer _function_1 = (URI it) -> { try { IncrementalBuilder.InternalStatefulIncrementalBuilder.LOG.info(("Deleting stale generated file " + it)); - XtextResourceSet _resourceSet = this.context.getResourceSet(); - URIConverter _uRIConverter = _resourceSet.getURIConverter(); - Map _emptyMap = CollectionLiterals.emptyMap(); - _uRIConverter.delete(it, _emptyMap); - Procedure1 _afterDeleteFile = request.getAfterDeleteFile(); - _afterDeleteFile.apply(it); + this.context.getResourceSet().getURIConverter().delete(it, CollectionLiterals.emptyMap()); + request.getAfterDeleteFile().apply(it); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -337,22 +294,21 @@ public class IncrementalBuilder { final IProjectConfigProvider projectConfigProvider = serviceProvider.get(IProjectConfigProvider.class); IProjectConfig _projectConfig = null; if (projectConfigProvider!=null) { - ResourceSet _resourceSet = resource.getResourceSet(); - _projectConfig=projectConfigProvider.getProjectConfig(_resourceSet); + _projectConfig=projectConfigProvider.getProjectConfig(resource.getResourceSet()); } final IProjectConfig projectConfig = _projectConfig; ISourceFolder _findSourceFolderContaining = null; if (projectConfig!=null) { - URI _uRI = resource.getURI(); - _findSourceFolderContaining=projectConfig.findSourceFolderContaining(_uRI); + _findSourceFolderContaining=projectConfig.findSourceFolderContaining(resource.getURI()); } final ISourceFolder sourceFolder = _findSourceFolderContaining; URIBasedFileSystemAccess _uRIBasedFileSystemAccess = new URIBasedFileSystemAccess(); final Procedure1 _function = (URIBasedFileSystemAccess it) -> { final IContextualOutputConfigurationProvider outputConfigProvider = serviceProvider.get(IContextualOutputConfigurationProvider.class); - it.setOutputConfigurations(IterableExtensions.toMap(outputConfigProvider.getOutputConfigurations(resource), ((Function1) (OutputConfiguration it_1) -> { + final Function1 _function_1 = (OutputConfiguration it_1) -> { return it_1.getName(); - }))); + }; + it.setOutputConfigurations(IterableExtensions.toMap(outputConfigProvider.getOutputConfigurations(resource), _function_1)); it.setPostProcessor(serviceProvider.get(IFilePostProcessor.class)); final IEncodingProvider newEncodingProvider = serviceProvider.get(IEncodingProvider.class); if ((newEncodingProvider != null)) { @@ -400,12 +356,8 @@ public class IncrementalBuilder { public IncrementalBuilder.Result build(final BuildRequest request, final Function1 languages, final IResourceClusteringPolicy clusteringPolicy) { try { final XtextResourceSet resourceSet = request.getResourceSet(); - IndexState _state = request.getState(); - ResourceDescriptionsData _resourceDescriptions = _state.getResourceDescriptions(); - ResourceDescriptionsData _copy = _resourceDescriptions.copy(); - IndexState _state_1 = request.getState(); - Source2GeneratedMapping _fileMappings = _state_1.getFileMappings(); - Source2GeneratedMapping _copy_1 = _fileMappings.copy(); + ResourceDescriptionsData _copy = request.getState().getResourceDescriptions().copy(); + Source2GeneratedMapping _copy_1 = request.getState().getFileMappings().copy(); final IndexState oldState = new IndexState(_copy, _copy_1); CancelIndicator _cancelIndicator = request.getCancelIndicator(); final BuildContext context = new BuildContext(languages, resourceSet, oldState, clusteringPolicy, _cancelIndicator); diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/Indexer.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/Indexer.java index 4227dd35e..8a6b696cf 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/Indexer.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/Indexer.java @@ -12,7 +12,6 @@ import com.google.common.collect.Maps; import com.google.inject.Inject; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -20,7 +19,6 @@ import java.util.Set; import java.util.function.Consumer; import org.apache.log4j.Logger; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.resource.Resource; @@ -31,7 +29,6 @@ import org.eclipse.xtend.lib.annotations.Data; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.build.BuildContext; import org.eclipse.xtext.build.BuildRequest; -import org.eclipse.xtext.build.IndexState; import org.eclipse.xtext.naming.QualifiedName; import org.eclipse.xtext.resource.CompilerPhases; import org.eclipse.xtext.resource.EObjectDescription; @@ -40,13 +37,11 @@ import org.eclipse.xtext.resource.IReferenceDescription; import org.eclipse.xtext.resource.IResourceDescription; import org.eclipse.xtext.resource.IResourceDescriptions; import org.eclipse.xtext.resource.IResourceServiceProvider; -import org.eclipse.xtext.resource.XtextResourceSet; import org.eclipse.xtext.resource.impl.AbstractResourceDescription; import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionDelta; import org.eclipse.xtext.resource.impl.ResourceDescriptionsData; import org.eclipse.xtext.resource.persistence.SerializableEObjectDescriptionProvider; import org.eclipse.xtext.service.OperationCanceledManager; -import org.eclipse.xtext.util.CancelIndicator; import org.eclipse.xtext.util.internal.Log; import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Extension; @@ -136,41 +131,32 @@ public class Indexer { private ImmutableList exported; public ResolvedResourceDescription(final IResourceDescription original) { - URI _uRI = original.getURI(); - this.URI = _uRI; - Iterable _exportedObjects = original.getExportedObjects(); + this.URI = original.getURI(); final Function1 _function = (IEObjectDescription from) -> { if ((from instanceof SerializableEObjectDescriptionProvider)) { return ((SerializableEObjectDescriptionProvider)from).toSerializableEObjectDescription(); } - EObject _eObjectOrProxy = from.getEObjectOrProxy(); - boolean _eIsProxy = _eObjectOrProxy.eIsProxy(); + boolean _eIsProxy = from.getEObjectOrProxy().eIsProxy(); if (_eIsProxy) { return from; } - EClass _eClass = from.getEClass(); - EObject _create = EcoreUtil.create(_eClass); + EObject _create = EcoreUtil.create(from.getEClass()); InternalEObject result = ((InternalEObject) _create); - URI _eObjectURI = from.getEObjectURI(); - result.eSetProxyURI(_eObjectURI); + result.eSetProxyURI(from.getEObjectURI()); Map userData = null; String[] _userDataKeys = from.getUserDataKeys(); for (final String key : _userDataKeys) { { if ((userData == null)) { - HashMap _newHashMapWithExpectedSize = Maps.newHashMapWithExpectedSize(2); - userData = _newHashMapWithExpectedSize; + userData = Maps.newHashMapWithExpectedSize(2); } - String _userData = from.getUserData(key); - userData.put(key, _userData); + userData.put(key, from.getUserData(key)); } } - QualifiedName _name = from.getName(); - return EObjectDescription.create(_name, result, userData); + return EObjectDescription.create(from.getName(), result, userData); }; - Iterable _map = IterableExtensions.map(_exportedObjects, _function); - ImmutableList _copyOf = ImmutableList.copyOf(_map); - this.exported = _copyOf; + this.exported = ImmutableList.copyOf( + IterableExtensions.map(original.getExportedObjects(), _function)); } @Override @@ -214,81 +200,63 @@ public class Indexer { private OperationCanceledManager _operationCanceledManager; public Indexer.IndexResult computeAndIndexAffected(final BuildRequest request, @Extension final BuildContext context) { - IndexState _oldState = context.getOldState(); - final ResourceDescriptionsData previousIndex = _oldState.getResourceDescriptions(); - IndexState _state = request.getState(); - final ResourceDescriptionsData newIndex = _state.getResourceDescriptions(); + final ResourceDescriptionsData previousIndex = context.getOldState().getResourceDescriptions(); + final ResourceDescriptionsData newIndex = request.getState().getResourceDescriptions(); final List deltas = CollectionLiterals.newArrayList(); boolean _isInfoEnabled = Indexer.LOG.isInfoEnabled(); if (_isInfoEnabled) { - List _deletedFiles = request.getDeletedFiles(); - Set _set = IterableExtensions.toSet(_deletedFiles); + Set _set = IterableExtensions.toSet(request.getDeletedFiles()); String _plus = ("Creating Deltas for changes. Deleted : " + _set); String _plus_1 = (_plus + ", Changed : "); - List _dirtyFiles = request.getDirtyFiles(); - Set _set_1 = IterableExtensions.toSet(_dirtyFiles); + Set _set_1 = IterableExtensions.toSet(request.getDirtyFiles()); String _plus_2 = (_plus_1 + _set_1); String _plus_3 = (_plus_2 + "."); Indexer.LOG.info(_plus_3); } - List _deltasForDeletedResources = this.getDeltasForDeletedResources(request, previousIndex, context); - deltas.addAll(_deltasForDeletedResources); - List _dirtyFiles_1 = request.getDirtyFiles(); - List _deltasForChangedResources = this.getDeltasForChangedResources(_dirtyFiles_1, previousIndex, context); - deltas.addAll(_deltasForChangedResources); + deltas.addAll(this.getDeltasForDeletedResources(request, previousIndex, context)); + deltas.addAll(this.getDeltasForChangedResources(request.getDirtyFiles(), previousIndex, context)); for (final IResourceDescription.Delta delta : deltas) { newIndex.register(delta); } final HashSet allDeltas = new HashSet(deltas); - List _externalDeltas = request.getExternalDeltas(); - boolean _isEmpty = _externalDeltas.isEmpty(); + boolean _isEmpty = request.getExternalDeltas().isEmpty(); boolean _not = (!_isEmpty); if (_not) { - List _externalDeltas_1 = request.getExternalDeltas(); - allDeltas.addAll(_externalDeltas_1); + allDeltas.addAll(request.getExternalDeltas()); } - Iterable _allResourceDescriptions = previousIndex.getAllResourceDescriptions(); final Function1 _function = (IResourceDescription it) -> { return it.getURI(); }; - Iterable _map = IterableExtensions.map(_allResourceDescriptions, _function); - final Set remainingURIs = IterableExtensions.toSet(_map); + final Set remainingURIs = IterableExtensions.toSet(IterableExtensions.map(previousIndex.getAllResourceDescriptions(), _function)); final Function1 _function_1 = (IResourceDescription.Delta it) -> { return it.getUri(); }; - List _map_1 = ListExtensions.map(deltas, _function_1); - remainingURIs.removeAll(_map_1); + remainingURIs.removeAll(ListExtensions.map(deltas, _function_1)); final Function1 _function_2 = (URI it) -> { - IResourceServiceProvider _resourceServiceProvider = context.getResourceServiceProvider(it); - final IResourceDescription.Manager manager = _resourceServiceProvider.getResourceDescriptionManager(); + final IResourceDescription.Manager manager = context.getResourceServiceProvider(it).getResourceDescriptionManager(); final IResourceDescription resourceDescription = previousIndex.getResourceDescription(it); final boolean isAffected = this.isAffected(resourceDescription, manager, allDeltas, allDeltas, newIndex); return Boolean.valueOf(isAffected); }; - Iterable _filter = IterableExtensions.filter(remainingURIs, _function_2); - final List allAffected = IterableExtensions.toList(_filter); + final List allAffected = IterableExtensions.toList(IterableExtensions.filter(remainingURIs, _function_2)); if ((Indexer.LOG.isInfoEnabled() && (!allAffected.isEmpty()))) { Set _set_2 = IterableExtensions.toSet(allAffected); String _plus_4 = ("Creating Deltas for affected resources : " + _set_2); String _plus_5 = (_plus_4 + "."); Indexer.LOG.info(_plus_5); } - List _deltasForChangedResources_1 = this.getDeltasForChangedResources(allAffected, previousIndex, context); - deltas.addAll(_deltasForChangedResources_1); + deltas.addAll(this.getDeltasForChangedResources(allAffected, previousIndex, context)); return new Indexer.IndexResult(deltas, newIndex); } protected List getDeltasForDeletedResources(final BuildRequest request, final ResourceDescriptionsData oldIndex, @Extension final BuildContext context) { final ArrayList deltas = CollectionLiterals.newArrayList(); - List _deletedFiles = request.getDeletedFiles(); final Function1 _function = (URI it) -> { IResourceServiceProvider _resourceServiceProvider = context.getResourceServiceProvider(it); return Boolean.valueOf((_resourceServiceProvider != null)); }; - Iterable _filter = IterableExtensions.filter(_deletedFiles, _function); final Consumer _function_1 = (URI it) -> { - CancelIndicator _cancelIndicator = context.getCancelIndicator(); - this._operationCanceledManager.checkCanceled(_cancelIndicator); + this._operationCanceledManager.checkCanceled(context.getCancelIndicator()); IResourceDescription _resourceDescription = null; if (oldIndex!=null) { _resourceDescription=oldIndex.getResourceDescription(it); @@ -299,28 +267,24 @@ public class Indexer { deltas.add(delta); } }; - _filter.forEach(_function_1); + IterableExtensions.filter(request.getDeletedFiles(), _function).forEach(_function_1); return deltas; } protected List getDeltasForChangedResources(final Iterable affectedUris, final ResourceDescriptionsData oldIndex, @Extension final BuildContext context) { try { - XtextResourceSet _resourceSet = context.getResourceSet(); - this.compilerPhases.setIndexing(_resourceSet, true); + this.compilerPhases.setIndexing(context.getResourceSet(), true); final Function1 _function = (Resource it) -> { return this.addToIndex(it, true, oldIndex, context); }; - Iterable _executeClustered = context.executeClustered(affectedUris, _function); - return IterableExtensions.toList(_executeClustered); + return IterableExtensions.toList(context.executeClustered(affectedUris, _function)); } finally { - XtextResourceSet _resourceSet_1 = context.getResourceSet(); - this.compilerPhases.setIndexing(_resourceSet_1, false); + this.compilerPhases.setIndexing(context.getResourceSet(), false); } } protected IResourceDescription.Delta addToIndex(final Resource resource, final boolean isPreIndexing, final ResourceDescriptionsData oldIndex, final BuildContext context) { - CancelIndicator _cancelIndicator = context.getCancelIndicator(); - this._operationCanceledManager.checkCanceled(_cancelIndicator); + this._operationCanceledManager.checkCanceled(context.getCancelIndicator()); final URI uri = resource.getURI(); final IResourceServiceProvider serviceProvider = context.getResourceServiceProvider(uri); final IResourceDescription.Manager manager = serviceProvider.getResourceDescriptionManager(); diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/Source2GeneratedMapping.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/Source2GeneratedMapping.java index cca316859..62b6ecd7e 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/Source2GeneratedMapping.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/build/Source2GeneratedMapping.java @@ -77,11 +77,10 @@ public class Source2GeneratedMapping implements Externalizable { } public void deleteGenerated(final URI generated) { - Collection _removeAll = this.generated2source.removeAll(generated); final Consumer _function = (URI it) -> { this.source2generated.remove(it, generated); }; - _removeAll.forEach(_function); + this.generated2source.removeAll(generated).forEach(_function); this.generated2OutputConfigName.remove(generated); } @@ -90,18 +89,15 @@ public class Source2GeneratedMapping implements Externalizable { } public List getGenerated(final URI source) { - Collection _get = this.source2generated.get(source); - return Lists.newArrayList(_get); + return Lists.newArrayList(this.source2generated.get(source)); } public List getSource(final URI generated) { - Collection _get = this.generated2source.get(generated); - return Lists.newArrayList(_get); + return Lists.newArrayList(this.generated2source.get(generated)); } public List getAllGenerated() { - Set _keySet = this.generated2source.keySet(); - return Lists.newArrayList(_keySet); + return Lists.newArrayList(this.generated2source.keySet()); } @Override @@ -110,14 +106,12 @@ public class Source2GeneratedMapping implements Externalizable { ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, numEntries, true); for (final Integer i : _doubleDotLessThan) { { - String _readUTF = in.readUTF(); - final URI source = URI.createURI(_readUTF); + final URI source = URI.createURI(in.readUTF()); final int numGenerated = in.readInt(); ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, numGenerated, true); for (final Integer j : _doubleDotLessThan_1) { { - String _readUTF_1 = in.readUTF(); - final URI generated = URI.createURI(_readUTF_1); + final URI generated = URI.createURI(in.readUTF()); final String outputConfig = in.readUTF(); this.addSource2Generated(source, generated, outputConfig); } @@ -128,23 +122,15 @@ public class Source2GeneratedMapping implements Externalizable { @Override public void writeExternal(final ObjectOutput out) throws IOException { - Map> _asMap = this.source2generated.asMap(); - final Set>> entries = _asMap.entrySet(); - int _size = entries.size(); - out.writeInt(_size); + final Set>> entries = this.source2generated.asMap().entrySet(); + out.writeInt(entries.size()); final Consumer>> _function = (Map.Entry> it) -> { try { - URI _key = it.getKey(); - String _string = _key.toString(); - out.writeUTF(_string); - Collection _value = it.getValue(); - int _size_1 = _value.size(); - out.writeInt(_size_1); - Collection _value_1 = it.getValue(); + out.writeUTF(it.getKey().toString()); + out.writeInt(it.getValue().size()); final Consumer _function_1 = (URI it_1) -> { try { - String _string_1 = it_1.toString(); - out.writeUTF(_string_1); + out.writeUTF(it_1.toString()); String _elvis = null; String _get = this.generated2OutputConfigName.get(it_1); if (_get != null) { @@ -157,7 +143,7 @@ public class Source2GeneratedMapping implements Externalizable { throw Exceptions.sneakyThrow(_e); } }; - _value_1.forEach(_function_1); + it.getValue().forEach(_function_1); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/findReferences/ReferenceAcceptor.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/findReferences/ReferenceAcceptor.java index 3d4ab19a0..88d34f015 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/findReferences/ReferenceAcceptor.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/findReferences/ReferenceAcceptor.java @@ -50,11 +50,9 @@ public class ReferenceAcceptor implements IReferenceFinder.Acceptor { protected void computeExportedObjectsMap(final EObject source) { final Resource resource = source.eResource(); - URI _uRI = resource.getURI(); - final IResourceServiceProvider resourceServiceProvider = this.resourceServiceProviderRegistry.getResourceServiceProvider(_uRI); + final IResourceServiceProvider resourceServiceProvider = this.resourceServiceProviderRegistry.getResourceServiceProvider(resource.getURI()); if ((resourceServiceProvider != null)) { - IResourceDescription.Manager _resourceDescriptionManager = resourceServiceProvider.getResourceDescriptionManager(); - final IResourceDescription resourceDescription = _resourceDescriptionManager.getResourceDescription(resource); + final IResourceDescription resourceDescription = resourceServiceProvider.getResourceDescriptionManager().getResourceDescription(resource); this.exportedContainersInCurrentResource = CollectionLiterals.newHashMap(); Iterable _exportedObjects = resourceDescription.getExportedObjects(); for (final IEObjectDescription description : _exportedObjects) { @@ -64,8 +62,7 @@ public class ReferenceAcceptor implements IReferenceFinder.Acceptor { if (_eIsProxy) { instance = resource.getEObject(description.getEObjectURI().fragment()); } - URI _eObjectURI = description.getEObjectURI(); - this.exportedContainersInCurrentResource.put(instance, _eObjectURI); + this.exportedContainersInCurrentResource.put(instance, description.getEObjectURI()); } } } else { diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/IShouldGenerate.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/IShouldGenerate.java index 4eeddf267..63aadc5ed 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/IShouldGenerate.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/IShouldGenerate.java @@ -12,7 +12,6 @@ import com.google.common.base.Objects; import com.google.inject.ImplementedBy; import com.google.inject.Inject; import java.util.List; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtext.diagnostics.Severity; import org.eclipse.xtext.util.CancelIndicator; @@ -38,8 +37,7 @@ public interface IShouldGenerate { @Override public boolean shouldGenerate(final Resource resource, final CancelIndicator cancelIndicator) { - EList _errors = resource.getErrors(); - boolean _isEmpty = _errors.isEmpty(); + boolean _isEmpty = resource.getErrors().isEmpty(); boolean _not = (!_isEmpty); if (_not) { return false; diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/URIBasedFileSystemAccess.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/URIBasedFileSystemAccess.java index 4b20a8a73..08bcdb8db 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/URIBasedFileSystemAccess.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/URIBasedFileSystemAccess.java @@ -16,7 +16,6 @@ import java.io.FileNotFoundException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; -import java.util.Map; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.URIConverter; import org.eclipse.xtend.lib.annotations.Accessors; @@ -93,8 +92,7 @@ public class URIBasedFileSystemAccess extends AbstractFileSystemAccess2 { @Override public URI getURI(final String path, final String outputConfiguration) { - Map _pathes = this.getPathes(); - final String outlet = _pathes.get(outputConfiguration); + final String outlet = this.getPathes().get(outputConfiguration); if ((outlet == null)) { throw new IllegalArgumentException((("A slot with name \'" + outputConfiguration) + "\' has not been configured.")); } @@ -121,8 +119,7 @@ public class URIBasedFileSystemAccess extends AbstractFileSystemAccess2 { final String encoding = this.getEncoding(uri); final CharSequence postProcessed = this.postProcess(fileName, outputCfgName, contents, encoding); this.generateTrace(fileName, outputCfgName, postProcessed); - String _string = postProcessed.toString(); - byte[] _bytes = _string.getBytes(encoding); + byte[] _bytes = postProcessed.toString().getBytes(encoding); final ByteArrayInputStream inStream = new ByteArrayInputStream(_bytes); this.generateFile(fileName, outputCfgName, inStream); } catch (Throwable _e) { diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/AbsoluteURI.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/AbsoluteURI.java index 561d8768f..63a0f0163 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/AbsoluteURI.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/AbsoluteURI.java @@ -36,14 +36,13 @@ public class AbsoluteURI extends AbstractURIWrapper { public SourceRelativeURI deresolve(final URI sourceFolderURI) { try { - URI _uRI = this.getURI(); - URI _deresolve = _uRI.deresolve(sourceFolderURI); + URI _deresolve = this.getURI().deresolve(sourceFolderURI); return new SourceRelativeURI(_deresolve); } catch (final Throwable _t) { if (_t instanceof IllegalArgumentException) { final IllegalArgumentException e = (IllegalArgumentException)_t; - URI _uRI_1 = this.getURI(); - String _plus = ("Base URI was " + _uRI_1); + URI _uRI = this.getURI(); + String _plus = ("Base URI was " + _uRI); throw new IllegalArgumentException(_plus, e); } else { throw Exceptions.sneakyThrow(_t); @@ -56,8 +55,7 @@ public class AbsoluteURI extends AbstractURIWrapper { } public SourceRelativeURI deresolve(final IProjectConfig projectConfig) { - URI _uRI = this.getURI(); - final ISourceFolder sourceFolder = projectConfig.findSourceFolderContaining(_uRI); + final ISourceFolder sourceFolder = projectConfig.findSourceFolderContaining(this.getURI()); SourceRelativeURI _deresolve = null; if (sourceFolder!=null) { _deresolve=this.deresolve(sourceFolder); diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/AbstractTraceRegionToString.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/AbstractTraceRegionToString.java index 56e67cbda..92621ec6a 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/AbstractTraceRegionToString.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/AbstractTraceRegionToString.java @@ -10,9 +10,6 @@ package org.eclipse.xtext.generator.trace; import com.google.common.base.Function; import com.google.common.base.Strings; import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableListMultimap; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Multimaps; import com.google.common.io.CharStreams; @@ -24,13 +21,11 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; -import org.eclipse.emf.common.util.URI; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtext.generator.trace.AbstractTraceRegion; import org.eclipse.xtext.generator.trace.ILocationData; import org.eclipse.xtext.generator.trace.SourceRelativeURI; import org.eclipse.xtext.util.ITextRegion; -import org.eclipse.xtext.util.ITextRegionWithLineInformation; import org.eclipse.xtext.util.TextRegion; import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Conversions; @@ -207,8 +202,7 @@ public abstract class AbstractTraceRegionToString { } protected String getRemoteTitle(final SourceRelativeURI uri) { - URI _uRI = uri.getURI(); - return _uRI.toString(); + return uri.getURI().toString(); } protected boolean shouldInclude(final AbstractTraceRegion region) { @@ -216,8 +210,7 @@ public abstract class AbstractTraceRegionToString { if ((frame == null)) { return true; } else { - ITextRegionWithLineInformation _myRegion = region.getMyRegion(); - return frame.contains(_myRegion); + return frame.contains(region.getMyRegion()); } } @@ -268,14 +261,11 @@ public abstract class AbstractTraceRegionToString { final AbstractTraceRegionToString.RegionHandle regHandle = new AbstractTraceRegionToString.RegionHandle(_plusPlus, reg); result.add(regHandle); childResult = regHandle.children; - ITextRegionWithLineInformation _myRegion = reg.getMyRegion(); - this.add(lFile, _myRegion, regHandle, null); - List _associatedLocations = reg.getAssociatedLocations(); + this.add(lFile, reg.getMyRegion(), regHandle, null); final Function1 _function = (ILocationData it) -> { return Boolean.valueOf(this.shouldInclude(reg, it)); }; - Iterable _filter = IterableExtensions.filter(_associatedLocations, _function); - final List locs = IterableExtensions.toList(_filter); + final List locs = IterableExtensions.toList(IterableExtensions.filter(reg.getAssociatedLocations(), _function)); for (int j = 0; (j < locs.size()); j++) { { final ILocationData loc = locs.get(j); @@ -336,30 +326,24 @@ public abstract class AbstractTraceRegionToString { final Function1 _function = (AbstractTraceRegionToString.Insert it) -> { return Boolean.valueOf(it.open); }; - Iterable _filter = IterableExtensions.filter(inserts, _function); final Function1 _function_1 = (AbstractTraceRegionToString.Insert it) -> { return Integer.valueOf(this.sortKey(it)); }; - List _sortBy = IterableExtensions.sortBy(_filter, _function_1); final Function1 _function_2 = (AbstractTraceRegionToString.Insert it) -> { return this.render(it, width); }; - List _map = ListExtensions.map(_sortBy, _function_2); - final String opens = IterableExtensions.join(_map, ","); + final String opens = IterableExtensions.join(ListExtensions.map(IterableExtensions.sortBy(IterableExtensions.filter(inserts, _function), _function_1), _function_2), ","); final Function1 _function_3 = (AbstractTraceRegionToString.Insert it) -> { return Boolean.valueOf((!it.open)); }; - Iterable _filter_1 = IterableExtensions.filter(inserts, _function_3); final Function1 _function_4 = (AbstractTraceRegionToString.Insert it) -> { int _sortKey = this.sortKey(it); return Integer.valueOf((-_sortKey)); }; - List _sortBy_1 = IterableExtensions.sortBy(_filter_1, _function_4); final Function1 _function_5 = (AbstractTraceRegionToString.Insert it) -> { return this.render(it, width); }; - List _map_1 = ListExtensions.map(_sortBy_1, _function_5); - final String closes = IterableExtensions.join(_map_1, ","); + final String closes = IterableExtensions.join(ListExtensions.map(IterableExtensions.sortBy(IterableExtensions.filter(inserts, _function_3), _function_4), _function_5), ","); String _xifexpression = null; boolean _isEmpty = opens.isEmpty(); if (_isEmpty) { @@ -410,21 +394,16 @@ public abstract class AbstractTraceRegionToString { final Function _function_1 = (AbstractTraceRegionToString.Insert it) -> { return Integer.valueOf(it.offset); }; - ImmutableListMultimap _index = Multimaps.index(inframe, _function_1); - ImmutableMap> _asMap = _index.asMap(); - ImmutableSet>> _entrySet = _asMap.entrySet(); - List>> _list = IterableExtensions.>>toList(_entrySet); final Function1>, Integer> _function_2 = (Map.Entry> it) -> { return it.getKey(); }; - final List>> offsets = IterableExtensions.>, Integer>sortBy(_list, _function_2); + final List>> offsets = IterableExtensions.>, Integer>sortBy(IterableExtensions.>>toList(Multimaps.index(inframe, _function_1).asMap().entrySet()), _function_2); int last = frame.getOffset(); final StringBuilder result = new StringBuilder(); for (final Map.Entry> e : offsets) { { final Integer offset = e.getKey(); - Collection _value = e.getValue(); - final String insert = this.render(_value, width); + final String insert = this.render(e.getValue(), width); final String prefix = text.substring(last, (offset).intValue()); result.append(prefix); result.append(insert); @@ -435,8 +414,7 @@ public abstract class AbstractTraceRegionToString { int _length_1 = frame.getLength(); final int end = (_offset + _length_1); if ((last < end)) { - String _substring = text.substring(last, end); - result.append(_substring); + result.append(text.substring(last, end)); } String _string = result.toString(); StringReader _stringReader = new StringReader(_string); @@ -491,8 +469,7 @@ public abstract class AbstractTraceRegionToString { _xifexpression = ""; } final String prefix = _xifexpression; - Class _class = loc.location.getClass(); - final String name = _class.getSimpleName(); + final String name = loc.location.getClass().getSimpleName(); String _xifexpression_1 = null; SourceRelativeURI _srcRelativePath = loc.location.getSrcRelativePath(); boolean _tripleNotEquals = (_srcRelativePath != null); @@ -513,8 +490,7 @@ public abstract class AbstractTraceRegionToString { } protected void render(final AbstractTraceRegionToString.RegionHandle region, final int idW, final int offsetW, final int lengthW, final int indent, final List result) { - String _string = Integer.toString(region.id, this.radix); - final String id = Strings.padStart(_string, idW, '0'); + final String id = Strings.padStart(Integer.toString(region.id, this.radix), idW, '0'); String _xifexpression = null; boolean _isUseForDebugging = region.region.isUseForDebugging(); if (_isUseForDebugging) { @@ -523,20 +499,14 @@ public abstract class AbstractTraceRegionToString { _xifexpression = " "; } final String debug = _xifexpression; - int _myOffset = region.region.getMyOffset(); - String _string_1 = Integer.toString(_myOffset); - final String offset = Strings.padStart(_string_1, offsetW, '0'); - int _myLength = region.region.getMyLength(); - String _string_2 = Integer.toString(_myLength); - final String length = Strings.padStart(_string_2, lengthW, '0'); + final String offset = Strings.padStart(Integer.toString(region.region.getMyOffset()), offsetW, '0'); + final String length = Strings.padStart(Integer.toString(region.region.getMyLength()), lengthW, '0'); final String space = Strings.repeat(" ", indent); - Class _class = region.region.getClass(); - final String name = _class.getSimpleName(); + final String name = region.region.getClass().getSimpleName(); final Function1 _function = (AbstractTraceRegionToString.LocationHandle it) -> { return this.render(it); }; - List _map = ListExtensions.map(region.locations, _function); - final String locations = IterableExtensions.join(_map, ", "); + final String locations = IterableExtensions.join(ListExtensions.map(region.locations, _function), ", "); final String loc = (((((debug + " ") + offset) + "-") + length) + space); final String header = (((((id + ": ") + loc) + name) + " -> ") + locations); boolean _isEmpty = region.children.isEmpty(); @@ -558,10 +528,8 @@ public abstract class AbstractTraceRegionToString { final AbstractTraceRegionToString.File localFile = new AbstractTraceRegionToString.File(null); final LinkedHashMap remoteFiles = CollectionLiterals.newLinkedHashMap(); final List roothandles = CollectionLiterals.newArrayList(); - AbstractTraceRegion _trace = this.getTrace(); - final int maxid = this.collect(_trace, 1, localFile, remoteFiles, roothandles); - String _string = Integer.toString(maxid, this.radix); - final int idwidth = _string.length(); + final int maxid = this.collect(this.getTrace(), 1, localFile, remoteFiles, roothandles); + final int idwidth = Integer.toString(maxid, this.radix).length(); List _render = this.render(localFile, idwidth); Iterables.addAll(localFile.lines, _render); Collection _values = remoteFiles.values(); @@ -572,41 +540,30 @@ public abstract class AbstractTraceRegionToString { final Function1 _function = (String it) -> { return Integer.valueOf(it.length()); }; - List _map = ListExtensions.map(localFile.lines, _function); - Integer _max = IterableExtensions.max(_map); - String _localTitle = this.getLocalTitle(); - int _length = _localTitle.length(); + Integer _max = IterableExtensions.max(ListExtensions.map(localFile.lines, _function)); + int _length = this.getLocalTitle().length(); int _plus = (_length + 2); final int localWidth = Math.max((_max).intValue(), _plus); - Collection _values_1 = remoteFiles.values(); final Function1 _function_1 = (AbstractTraceRegionToString.File it) -> { final Function1 _function_2 = (String it_1) -> { return Integer.valueOf(it_1.length()); }; - List _map_1 = ListExtensions.map(it.lines, _function_2); - Integer _max_1 = IterableExtensions.max(_map_1); - String _remoteTitle = this.getRemoteTitle(it.uri); - int _length_1 = _remoteTitle.length(); + Integer _max_1 = IterableExtensions.max(ListExtensions.map(it.lines, _function_2)); + int _length_1 = this.getRemoteTitle(it.uri).length(); int _plus_1 = (_length_1 + 2); return Integer.valueOf(Math.max((_max_1).intValue(), _plus_1)); }; - Iterable _map_1 = IterableExtensions.map(_values_1, _function_1); - final Integer remoteWidth = IterableExtensions.max(_map_1); - String _title = this.title(null, localWidth); - localFile.lines.add(0, _title); - Collection _values_2 = remoteFiles.values(); - for (final AbstractTraceRegionToString.File file_1 : _values_2) { - String _title_1 = this.title(file_1.uri, (remoteWidth).intValue()); - file_1.lines.add(0, _title_1); + final Integer remoteWidth = IterableExtensions.max(IterableExtensions.map(remoteFiles.values(), _function_1)); + localFile.lines.add(0, this.title(null, localWidth)); + Collection _values_1 = remoteFiles.values(); + for (final AbstractTraceRegionToString.File file_1 : _values_1) { + file_1.lines.add(0, this.title(file_1.uri, (remoteWidth).intValue())); } final List left = localFile.lines; - Collection _values_3 = remoteFiles.values(); final Function1> _function_2 = (AbstractTraceRegionToString.File it) -> { return it.lines; }; - Iterable> _map_2 = IterableExtensions.>map(_values_3, _function_2); - Iterable _flatten = Iterables.concat(_map_2); - final List right = IterableExtensions.toList(_flatten); + final List right = IterableExtensions.toList(Iterables.concat(IterableExtensions.>map(remoteFiles.values(), _function_2))); final ArrayList result = CollectionLiterals.newArrayList(); if (this.showLegend) { result.add( @@ -648,28 +605,20 @@ public abstract class AbstractTraceRegionToString { }; return this.collect(it, _function_4); }; - List> _map_3 = ListExtensions.>map(roothandles, _function_3); - final Iterable allhandles = Iterables.concat(_map_3); + final Iterable allhandles = Iterables.concat(ListExtensions.>map(roothandles, _function_3)); final Function1 _function_4 = (AbstractTraceRegionToString.RegionHandle it) -> { return Integer.valueOf(it.region.getMyOffset()); }; - Iterable _map_4 = IterableExtensions.map(allhandles, _function_4); - Integer _max_1 = IterableExtensions.max(_map_4); - String _valueOf = String.valueOf(_max_1); - final int offsetWidth = _valueOf.length(); + final int offsetWidth = String.valueOf(IterableExtensions.max(IterableExtensions.map(allhandles, _function_4))).length(); final Function1 _function_5 = (AbstractTraceRegionToString.RegionHandle it) -> { return Integer.valueOf(it.region.getMyLength()); }; - Iterable _map_5 = IterableExtensions.map(allhandles, _function_5); - Integer _max_2 = IterableExtensions.max(_map_5); - String _valueOf_1 = String.valueOf(_max_2); - final int lengthWidth = _valueOf_1.length(); + final int lengthWidth = String.valueOf(IterableExtensions.max(IterableExtensions.map(allhandles, _function_5))).length(); for (final AbstractTraceRegionToString.RegionHandle handle : roothandles) { this.render(handle, idwidth, offsetWidth, lengthWidth, 1, result); } } - String _newLine = org.eclipse.xtext.util.Strings.newLine(); - return IterableExtensions.join(result, _newLine); + return IterableExtensions.join(result, org.eclipse.xtext.util.Strings.newLine()); } @Override diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/SourceRelativeURI.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/SourceRelativeURI.java index 50fb4c8f5..aa29b98ee 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/SourceRelativeURI.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/SourceRelativeURI.java @@ -24,8 +24,7 @@ public class SourceRelativeURI extends AbstractURIWrapper { String _string = uri.toString(); throw new IllegalArgumentException(_string); } - String _path = uri.path(); - String _substring = _path.substring(1); + String _substring = uri.path().substring(1); return new SourceRelativeURI(_substring); } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/parser/antlr/AbstractAntlrParserBasedTokenSourceProvider.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/parser/antlr/AbstractAntlrParserBasedTokenSourceProvider.java index dfff94c5e..e8859d3fd 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/parser/antlr/AbstractAntlrParserBasedTokenSourceProvider.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/parser/antlr/AbstractAntlrParserBasedTokenSourceProvider.java @@ -32,8 +32,7 @@ public class AbstractAntlrParserBasedTokenSourceProvider extends AbstractTokenSo return ((AbstractAntlrParser)this.parser).createLexer(stream); } StringConcatenation _builder = new StringConcatenation(); - Class _class = this.parser.getClass(); - String _name = _class.getName(); + String _name = this.parser.getClass().getName(); _builder.append(_name); _builder.append(" should be a subclass of "); String _name_1 = AbstractAntlrParser.class.getName(); diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/parser/antlr/AbstractTokenSourceProvider.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/parser/antlr/AbstractTokenSourceProvider.java index 3684197d1..7f79fb3a0 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/parser/antlr/AbstractTokenSourceProvider.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/parser/antlr/AbstractTokenSourceProvider.java @@ -36,13 +36,11 @@ public abstract class AbstractTokenSourceProvider implements TokenSourceProvider @Override public TokenSource createTokenSource(final CharSequence text) { - StringReader _reader = this.getReader(text); - return this.createTokenSource(_reader); + return this.createTokenSource(this.getReader(text)); } @Override public TokenSource createTokenSource(final Reader reader) { - CharStream _charStream = this.getCharStream(reader); - return this.createTokenSource(_charStream); + return this.createTokenSource(this.getCharStream(reader)); } } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/OutdatedStateManager.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/OutdatedStateManager.java index f9a63e9de..e4fd42f60 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/OutdatedStateManager.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/OutdatedStateManager.java @@ -82,8 +82,7 @@ public class OutdatedStateManager { }; _xifexpression = _function; } else { - ResourceSet _resourceSet = param.getResourceSet(); - _xifexpression = this.newCancelIndicator(_resourceSet); + _xifexpression = this.newCancelIndicator(param.getResourceSet()); } ((CancelableUnitOfWork)work).setCancelIndicator(_xifexpression); } else { diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/ResourceServiceProviderServiceLoader.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/ResourceServiceProviderServiceLoader.java index d4434f446..d3591929d 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/ResourceServiceProviderServiceLoader.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/ResourceServiceProviderServiceLoader.java @@ -11,7 +11,6 @@ import com.google.common.base.Objects; import com.google.inject.Injector; import com.google.inject.Provider; import com.google.inject.Singleton; -import java.util.Map; import java.util.ServiceLoader; import java.util.Set; import org.eclipse.xtext.ISetup; @@ -39,18 +38,15 @@ public class ResourceServiceProviderServiceLoader implements ProvidergetInstance(FileExtensionProvider.class); Set _fileExtensions = extensionProvider.getFileExtensions(); for (final String ext : _fileExtensions) { - Map _extensionToFactoryMap = registry.getExtensionToFactoryMap(); - boolean _containsKey = _extensionToFactoryMap.containsKey(ext); + boolean _containsKey = registry.getExtensionToFactoryMap().containsKey(ext); if (_containsKey) { String _primaryFileExtension = extensionProvider.getPrimaryFileExtension(); boolean _equals = Objects.equal(_primaryFileExtension, ext); if (_equals) { - Map _extensionToFactoryMap_1 = registry.getExtensionToFactoryMap(); - _extensionToFactoryMap_1.put(ext, resourceServiceProvider); + registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider); } } else { - Map _extensionToFactoryMap_2 = registry.getExtensionToFactoryMap(); - _extensionToFactoryMap_2.put(ext, resourceServiceProvider); + registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider); } } } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/containers/ProjectDescriptionBasedContainerManager.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/containers/ProjectDescriptionBasedContainerManager.java index cf9f16a6c..01c09ba58 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/containers/ProjectDescriptionBasedContainerManager.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/containers/ProjectDescriptionBasedContainerManager.java @@ -31,8 +31,7 @@ import org.eclipse.xtext.xbase.lib.CollectionLiterals; public class ProjectDescriptionBasedContainerManager implements IContainer.Manager { public boolean shouldUseProjectDescriptionBasedContainers(final IResourceDescriptions resourceDescriptions) { if ((resourceDescriptions instanceof ChunkedResourceDescriptions)) { - ResourceSet _resourceSet = ((ChunkedResourceDescriptions)resourceDescriptions).getResourceSet(); - ProjectDescription _findInEmfObject = ProjectDescription.findInEmfObject(_resourceSet); + ProjectDescription _findInEmfObject = ProjectDescription.findInEmfObject(((ChunkedResourceDescriptions)resourceDescriptions).getResourceSet()); boolean _tripleNotEquals = (_findInEmfObject != null); if (_tripleNotEquals) { return true; @@ -46,12 +45,11 @@ public class ProjectDescriptionBasedContainerManager implements IContainer.Manag if ((resourceDescriptions instanceof ChunkedResourceDescriptions)) { final ResourceSet resourceSet = ((ChunkedResourceDescriptions)resourceDescriptions).getResourceSet(); final ProjectDescription projectDescription = ProjectDescription.findInEmfObject(resourceSet); - String _name = projectDescription.getName(); - final ResourceDescriptionsData container = ((ChunkedResourceDescriptions)resourceDescriptions).getContainer(_name); + final ResourceDescriptionsData container = ((ChunkedResourceDescriptions)resourceDescriptions).getContainer(projectDescription.getName()); return new ResourceDescriptionsBasedContainer(container); } - String _name_1 = ChunkedResourceDescriptions.class.getName(); - String _plus = ("expected " + _name_1); + String _name = ChunkedResourceDescriptions.class.getName(); + String _plus = ("expected " + _name); throw new IllegalArgumentException(_plus); } @@ -62,8 +60,7 @@ public class ProjectDescriptionBasedContainerManager implements IContainer.Manag final ProjectDescription projectDescription = ProjectDescription.findInEmfObject(resourceSet); final ArrayList allContainers = CollectionLiterals.newArrayList(); ResourceDescriptionsData _elvis = null; - String _name = projectDescription.getName(); - ResourceDescriptionsData _container = ((ChunkedResourceDescriptions)resourceDescriptions).getContainer(_name); + ResourceDescriptionsData _container = ((ChunkedResourceDescriptions)resourceDescriptions).getContainer(projectDescription.getName()); if (_container != null) { _elvis = _container; } else { @@ -93,8 +90,8 @@ public class ProjectDescriptionBasedContainerManager implements IContainer.Manag } return allContainers; } - String _name_1 = ChunkedResourceDescriptions.class.getName(); - String _plus = ("expected " + _name_1); + String _name = ChunkedResourceDescriptions.class.getName(); + String _plus = ("expected " + _name); throw new IllegalArgumentException(_plus); } } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/impl/ChunkedResourceDescriptions.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/impl/ChunkedResourceDescriptions.java index a2e400a1a..5fb3b70f1 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/impl/ChunkedResourceDescriptions.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/impl/ChunkedResourceDescriptions.java @@ -19,7 +19,6 @@ import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Consumer; import org.eclipse.emf.common.notify.Adapter; @@ -102,16 +101,14 @@ public class ChunkedResourceDescriptions extends AbstractCompoundSelectable impl protected void setResourceSet(final ResourceSet resourceSet) { if ((this.resourceSet != null)) { - Class _class = this.getClass(); - String _name = _class.getName(); + String _name = this.getClass().getName(); String _plus = ("This " + _name); String _plus_1 = (_plus + " is already associated with a different resource set."); throw new IllegalStateException(_plus_1); } final ChunkedResourceDescriptions index = ChunkedResourceDescriptions.findInEmfObject(resourceSet); if ((index != null)) { - Class _class_1 = this.getClass(); - String _name_1 = _class_1.getName(); + String _name_1 = this.getClass().getName(); String _plus_2 = ("There is already a different " + _name_1); String _plus_3 = (_plus_2 + " installed in the given resource set."); throw new IllegalStateException(_plus_3); @@ -135,12 +132,10 @@ public class ChunkedResourceDescriptions extends AbstractCompoundSelectable impl @Override public Iterable getAllResourceDescriptions() { - Collection _values = this.chunk2resourceDescriptions.values(); final Function1> _function = (ResourceDescriptionsData it) -> { return it.getAllResourceDescriptions(); }; - Iterable> _map = IterableExtensions.>map(_values, _function); - return Iterables.concat(_map); + return Iterables.concat(IterableExtensions.>map(this.chunk2resourceDescriptions.values(), _function)); } @Override @@ -197,16 +192,10 @@ public class ChunkedResourceDescriptions extends AbstractCompoundSelectable impl @Override public void writeExternal(final ObjectOutput out) throws IOException { final HashMap copy = new HashMap(this.chunk2resourceDescriptions); - Set> _entrySet = copy.entrySet(); - int _size = _entrySet.size(); - out.writeInt(_size); - Set> _entrySet_1 = copy.entrySet(); + out.writeInt(copy.entrySet().size()); final Consumer> _function = (Map.Entry it) -> { try { - String _key = it.getKey(); - out.writeUTF(_key); - ResourceDescriptionsData _value = it.getValue(); - Iterable _allResourceDescriptions = _value.getAllResourceDescriptions(); + out.writeUTF(it.getKey()); final Function1 _function_1 = (IResourceDescription it_1) -> { Object _xifexpression = null; if ((it_1 instanceof Serializable)) { @@ -216,9 +205,8 @@ public class ChunkedResourceDescriptions extends AbstractCompoundSelectable impl } return ((Object)_xifexpression); }; - final Iterable descriptions = IterableExtensions.map(_allResourceDescriptions, _function_1); - int _size_1 = IterableExtensions.size(descriptions); - out.writeInt(_size_1); + final Iterable descriptions = IterableExtensions.map(it.getValue().getAllResourceDescriptions(), _function_1); + out.writeInt(IterableExtensions.size(descriptions)); final Consumer _function_2 = (Object it_1) -> { try { out.writeObject(it_1); @@ -231,7 +219,7 @@ public class ChunkedResourceDescriptions extends AbstractCompoundSelectable impl throw Exceptions.sneakyThrow(_e); } }; - _entrySet_1.forEach(_function); + copy.entrySet().forEach(_function); } public static ChunkedResourceDescriptions findInEmfObject(final Notifier emfObject) { diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/PortableURIs.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/PortableURIs.java index 1d4eb09d8..464a45a9d 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/PortableURIs.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/PortableURIs.java @@ -8,7 +8,6 @@ package org.eclipse.xtext.resource.persistence; import com.google.common.base.Objects; -import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.base.Splitter; import com.google.inject.Inject; @@ -19,7 +18,6 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.EcoreFactory; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.emf.ecore.InternalEObject; @@ -169,15 +167,12 @@ public class PortableURIs { final PortableURIs.PortableFragmentDescription desc = this.fromFragmentString(portableFragment); final EReference mock = EcoreFactory.eINSTANCE.createEReference(); mock.setEType(desc.descriptionEClass); - Predicate _alwaysTrue = Predicates.alwaysTrue(); - final IScope scope = this.globalScopeProvider.getScope(resource, mock, _alwaysTrue); - Iterable _elements = scope.getElements(desc.descriptionQualifiedName); - final IEObjectDescription description = IterableExtensions.head(_elements); + final IScope scope = this.globalScopeProvider.getScope(resource, mock, Predicates.alwaysTrue()); + final IEObjectDescription description = IterableExtensions.head(scope.getElements(desc.descriptionQualifiedName)); if ((description == null)) { return null; } - EObject _eObjectOrProxy = description.getEObjectOrProxy(); - final EObject container = EcoreUtil.resolve(_eObjectOrProxy, resource); + final EObject container = EcoreUtil.resolve(description.getEObjectOrProxy(), resource); return this.getEObject(container, desc.descriptionRelativeFragment); } @@ -192,13 +187,10 @@ public class PortableURIs { * @return a portable URI or null */ public URI toPortableURI(final StorageAwareResource sourceResource, final URI targetURI) { - ResourceSet _resourceSet = sourceResource.getResourceSet(); - URI _trimFragment = targetURI.trimFragment(); - Resource _resource = _resourceSet.getResource(_trimFragment, false); + Resource _resource = sourceResource.getResourceSet().getResource(targetURI.trimFragment(), false); EObject _eObject = null; if (_resource!=null) { - String _fragment = targetURI.fragment(); - _eObject=_resource.getEObject(_fragment); + _eObject=_resource.getEObject(targetURI.fragment()); } final EObject to = _eObject; boolean _or = false; @@ -206,11 +198,11 @@ public class PortableURIs { _or = true; } else { Resource _eResource = to.eResource(); - ResourceSet _resourceSet_1 = null; + ResourceSet _resourceSet = null; if (_eResource!=null) { - _resourceSet_1=_eResource.getResourceSet(); + _resourceSet=_eResource.getResourceSet(); } - boolean _tripleNotEquals = (_resourceSet_1 != null); + boolean _tripleNotEquals = (_resourceSet != null); _or = _tripleNotEquals; } if (_or) { @@ -234,13 +226,11 @@ public class PortableURIs { */ public URI toPortableURI(final StorageAwareResource sourceResource, final EObject targetObject) { if (((targetObject == null) || targetObject.eIsProxy())) { - URI _uRI = sourceResource.getURI(); - return _uRI.appendFragment(StorageAwareResource.UNRESOLVABLE_FRAGMENT); + return sourceResource.getURI().appendFragment(StorageAwareResource.UNRESOLVABLE_FRAGMENT); } final String portableFragment = this.getPortableURIFragment(targetObject); if ((portableFragment != null)) { - URI _uRI_1 = sourceResource.getURI(); - return _uRI_1.appendFragment(portableFragment); + return sourceResource.getURI().appendFragment(portableFragment); } return null; } @@ -249,26 +239,20 @@ public class PortableURIs { * @return a portable URI fragment, or null if the give EObject isn't itself or is not contained in an exported EObjectDescription */ protected String getPortableURIFragment(final EObject obj) { - Resource _eResource = obj.eResource(); - final IResourceDescriptions descriptions = this.resourceDescriptionsProvider.getResourceDescriptions(_eResource); - Resource _eResource_1 = obj.eResource(); - URI _uRI = _eResource_1.getURI(); - final IResourceDescription desc = descriptions.getResourceDescription(_uRI); + final IResourceDescriptions descriptions = this.resourceDescriptionsProvider.getResourceDescriptions(obj.eResource()); + final IResourceDescription desc = descriptions.getResourceDescription(obj.eResource().getURI()); if ((desc == null)) { return null; } - Iterable _exportedObjects = desc.getExportedObjects(); final Function1 _function = (IEObjectDescription it) -> { boolean _xblockexpression = false; { - EObject _eObjectOrProxy = it.getEObjectOrProxy(); - Resource _eResource_2 = obj.eResource(); - final EObject possibleContainer = EcoreUtil.resolve(_eObjectOrProxy, _eResource_2); + final EObject possibleContainer = EcoreUtil.resolve(it.getEObjectOrProxy(), obj.eResource()); _xblockexpression = (Objects.equal(obj, possibleContainer) || EcoreUtil.isAncestor(obj, possibleContainer)); } return Boolean.valueOf(_xblockexpression); }; - final IEObjectDescription containerDesc = IterableExtensions.findFirst(_exportedObjects, _function); + final IEObjectDescription containerDesc = IterableExtensions.findFirst(desc.getExportedObjects(), _function); if ((containerDesc != null)) { final PortableURIs.PortableFragmentDescription fragmentDescription = this.createPortableFragmentDescription(containerDesc, obj); return this.toFragmentString(fragmentDescription); @@ -277,8 +261,7 @@ public class PortableURIs { } protected PortableURIs.PortableFragmentDescription createPortableFragmentDescription(final IEObjectDescription desc, final EObject target) { - EObject _eObjectOrProxy = desc.getEObjectOrProxy(); - final EObject possibleContainer = EcoreUtil.resolve(_eObjectOrProxy, target); + final EObject possibleContainer = EcoreUtil.resolve(desc.getEObjectOrProxy(), target); final String fragmentToTarget = this.getFragment(target, possibleContainer); EClass _eClass = desc.getEClass(); QualifiedName _qualifiedName = desc.getQualifiedName(); @@ -286,12 +269,9 @@ public class PortableURIs { } protected String toFragmentString(final PortableURIs.PortableFragmentDescription desc) { - URI _uRI = EcoreUtil.getURI(desc.descriptionEClass); - String _string = _uRI.toString(); - final String eclassUriAsString = URI.encodeFragment(_string, false); + final String eclassUriAsString = URI.encodeFragment(EcoreUtil.getURI(desc.descriptionEClass).toString(), false); final List segments = desc.descriptionQualifiedName.getSegments(); - String _join = IterableExtensions.join(segments, ":"); - String _encodeFragment = URI.encodeFragment(_join, false); + String _encodeFragment = URI.encodeFragment(IterableExtensions.join(segments, ":"), false); String uriFragment = ((((PortableURIs.PORTABLE_SCHEME + "#") + eclassUriAsString) + "#") + _encodeFragment); if ((desc.descriptionRelativeFragment != null)) { String _uriFragment = uriFragment; @@ -303,37 +283,24 @@ public class PortableURIs { } protected PortableURIs.PortableFragmentDescription fromFragmentString(final String fragmentString) { - Splitter _on = Splitter.on("#"); - Iterable _split = _on.split(fragmentString); - final Iterator segments = _split.iterator(); + final Iterator segments = Splitter.on("#").split(fragmentString).iterator(); segments.next(); - String _next = segments.next(); - String _decode = URI.decode(_next); - final URI eClassURI = URI.createURI(_decode); - URI _trimFragment = eClassURI.trimFragment(); - String _string = _trimFragment.toString(); - final EPackage ePackage = this.packageRegistry.getEPackage(_string); + final URI eClassURI = URI.createURI(URI.decode(segments.next())); + final EPackage ePackage = this.packageRegistry.getEPackage(eClassURI.trimFragment().toString()); Resource _eResource = null; if (ePackage!=null) { _eResource=ePackage.eResource(); } EObject _eObject = null; if (_eResource!=null) { - String _fragment = eClassURI.fragment(); - _eObject=_eResource.getEObject(_fragment); + _eObject=_eResource.getEObject(eClassURI.fragment()); } final EClass eClass = ((EClass) _eObject); - Splitter _on_1 = Splitter.on(":"); - String _next_1 = segments.next(); - String _decode_1 = URI.decode(_next_1); - Iterable _split_1 = _on_1.split(_decode_1); - List _list = IterableExtensions.toList(_split_1); - final QualifiedName qname = QualifiedName.create(_list); + final QualifiedName qname = QualifiedName.create(IterableExtensions.toList(Splitter.on(":").split(URI.decode(segments.next())))); String _xifexpression = null; boolean _hasNext = segments.hasNext(); if (_hasNext) { - String _next_2 = segments.next(); - _xifexpression = URI.decode(_next_2); + _xifexpression = URI.decode(segments.next()); } final String fragment = _xifexpression; EClass _elvis = null; @@ -362,8 +329,7 @@ public class PortableURIs { } InternalEObject lastChild = ((InternalEObject) toChild); InternalEObject lastContainer = lastChild.eInternalContainer(); - EStructuralFeature _eContainingFeature = lastChild.eContainingFeature(); - String result = lastContainer.eURIFragmentSegment(_eContainingFeature, lastChild); + String result = lastContainer.eURIFragmentSegment(lastChild.eContainingFeature(), lastChild); while (((lastContainer != null) && (!Objects.equal(fromContainer, lastContainer)))) { { lastChild = lastContainer; @@ -371,8 +337,7 @@ public class PortableURIs { if ((lastContainer == null)) { throw new IllegalStateException(("No more containers for element " + lastChild)); } - EStructuralFeature _eContainingFeature_1 = lastChild.eContainingFeature(); - String _eURIFragmentSegment = lastContainer.eURIFragmentSegment(_eContainingFeature_1, lastChild); + String _eURIFragmentSegment = lastContainer.eURIFragmentSegment(lastChild.eContainingFeature(), lastChild); String _plus = (_eURIFragmentSegment + "/"); String _plus_1 = (_plus + result); result = _plus_1; @@ -393,8 +358,7 @@ public class PortableURIs { if ((toFragment == null)) { return from; } - Splitter _on = Splitter.on("/"); - final Iterable splitted = _on.split(toFragment); + final Iterable splitted = Splitter.on("/").split(toFragment); final Function2 _function = (EObject $0, String $1) -> { return ((InternalEObject) $0).eObjectForURIFragmentSegment($1); }; diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageFacade.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageFacade.java index b8ab30d73..d19fd6c82 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageFacade.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageFacade.java @@ -7,7 +7,6 @@ */ package org.eclipse.xtext.resource.persistence; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.inject.Inject; import com.google.inject.Provider; @@ -16,14 +15,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.Map; -import java.util.Set; import org.apache.log4j.Logger; -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.ResourceSet; -import org.eclipse.emf.ecore.resource.URIConverter; import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl; import org.eclipse.xtend.lib.annotations.Accessors; import org.eclipse.xtext.generator.AbstractFileSystemAccess2; @@ -74,14 +67,11 @@ public class ResourceStorageFacade implements IResourceStorageFacade { */ @Override public boolean shouldLoadFromStorage(final StorageAwareResource resource) { - ResourceSet _resourceSet = resource.getResourceSet(); - final SourceLevelURIsAdapter adapter = SourceLevelURIsAdapter.findInstalledAdapter(_resourceSet); + final SourceLevelURIsAdapter adapter = SourceLevelURIsAdapter.findInstalledAdapter(resource.getResourceSet()); if ((adapter == null)) { return false; } else { - ImmutableSet _sourceLevelURIs = adapter.getSourceLevelURIs(); - URI _uRI = resource.getURI(); - boolean _contains = _sourceLevelURIs.contains(_uRI); + boolean _contains = adapter.getSourceLevelURIs().contains(resource.getURI()); if (_contains) { return false; } @@ -99,10 +89,7 @@ public class ResourceStorageFacade implements IResourceStorageFacade { @Override public ResourceStorageLoadable getOrCreateResourceStorageLoadable(final StorageAwareResource resource) { try { - ResourceSet _resourceSet = resource.getResourceSet(); - EList _eAdapters = _resourceSet.eAdapters(); - Iterable _filter = Iterables.filter(_eAdapters, ResourceStorageProviderAdapter.class); - final ResourceStorageProviderAdapter stateProvider = IterableExtensions.head(_filter); + final ResourceStorageProviderAdapter stateProvider = IterableExtensions.head(Iterables.filter(resource.getResourceSet().eAdapters(), ResourceStorageProviderAdapter.class)); if ((stateProvider != null)) { final ResourceStorageLoadable inputStream = stateProvider.getResourceStorageLoadable(resource); if ((inputStream != null)) { @@ -110,18 +97,9 @@ public class ResourceStorageFacade implements IResourceStorageFacade { } } InputStream _xifexpression = null; - ResourceSet _resourceSet_1 = resource.getResourceSet(); - URIConverter _uRIConverter = _resourceSet_1.getURIConverter(); - URI _uRI = resource.getURI(); - URI _binaryStorageURI = this.getBinaryStorageURI(_uRI); - Map _emptyMap = CollectionLiterals.emptyMap(); - boolean _exists = _uRIConverter.exists(_binaryStorageURI, _emptyMap); + boolean _exists = resource.getResourceSet().getURIConverter().exists(this.getBinaryStorageURI(resource.getURI()), CollectionLiterals.emptyMap()); if (_exists) { - ResourceSet _resourceSet_2 = resource.getResourceSet(); - URIConverter _uRIConverter_1 = _resourceSet_2.getURIConverter(); - URI _uRI_1 = resource.getURI(); - URI _binaryStorageURI_1 = this.getBinaryStorageURI(_uRI_1); - _xifexpression = _uRIConverter_1.createInputStream(_binaryStorageURI_1); + _xifexpression = resource.getResourceSet().getURIConverter().createInputStream(this.getBinaryStorageURI(resource.getURI())); } else { InputStream _xblockexpression = null; { @@ -178,24 +156,15 @@ public class ResourceStorageFacade implements IResourceStorageFacade { * @return whether a stored resource state exists for the given resource */ protected boolean doesStorageExist(final StorageAwareResource resource) { - ResourceSet _resourceSet = resource.getResourceSet(); - EList _eAdapters = _resourceSet.eAdapters(); - Iterable _filter = Iterables.filter(_eAdapters, ResourceStorageProviderAdapter.class); - final ResourceStorageProviderAdapter stateProvider = IterableExtensions.head(_filter); + final ResourceStorageProviderAdapter stateProvider = IterableExtensions.head(Iterables.filter(resource.getResourceSet().eAdapters(), ResourceStorageProviderAdapter.class)); if (((stateProvider != null) && (stateProvider.getResourceStorageLoadable(resource) != null))) { return true; } - ResourceSet _resourceSet_1 = resource.getResourceSet(); - URIConverter _uRIConverter = _resourceSet_1.getURIConverter(); - URI _uRI = resource.getURI(); - URI _binaryStorageURI = this.getBinaryStorageURI(_uRI); - Map _emptyMap = CollectionLiterals.emptyMap(); - boolean _exists = _uRIConverter.exists(_binaryStorageURI, _emptyMap); + boolean _exists = resource.getResourceSet().getURIConverter().exists(this.getBinaryStorageURI(resource.getURI()), CollectionLiterals.emptyMap()); if (_exists) { return true; } - URI _uRI_1 = resource.getURI(); - boolean _isArchive = _uRI_1.isArchive(); + boolean _isArchive = resource.getURI().isArchive(); if (_isArchive) { return false; } @@ -208,36 +177,27 @@ public class ResourceStorageFacade implements IResourceStorageFacade { protected AbstractFileSystemAccess2 getFileSystemAccess(final StorageAwareResource resource) { final AbstractFileSystemAccess2 fsa = this.fileSystemAccessProvider.get(); fsa.setContext(resource); - Set _outputConfigurations = this.outputConfigurationProvider.getOutputConfigurations(resource); final Function1 _function = (OutputConfiguration it) -> { return it.getName(); }; - Map _map = IterableExtensions.toMap(_outputConfigurations, _function); - fsa.setOutputConfigurations(_map); + fsa.setOutputConfigurations(IterableExtensions.toMap(this.outputConfigurationProvider.getOutputConfigurations(resource), _function)); return fsa; } protected String computeOutputPath(final StorageAwareResource resource) { final URI srcContainerURI = this.getSourceContainerURI(resource); - URI _uRI = resource.getURI(); - final URI uri = this.getBinaryStorageURI(_uRI); - URI _deresolve = uri.deresolve(srcContainerURI, false, false, true); - final String outputRelativePath = _deresolve.path(); + final URI uri = this.getBinaryStorageURI(resource.getURI()); + final String outputRelativePath = uri.deresolve(srcContainerURI, false, false, true).path(); return outputRelativePath; } protected URI getSourceContainerURI(final StorageAwareResource resource) { - URI _uRI = resource.getURI(); - URI _trimSegments = _uRI.trimSegments(1); - return _trimSegments.appendSegment(""); + return resource.getURI().trimSegments(1).appendSegment(""); } @Override public boolean hasStorageFor(final URI uri) { - ExtensibleURIConverterImpl _extensibleURIConverterImpl = new ExtensibleURIConverterImpl(); - URI _binaryStorageURI = this.getBinaryStorageURI(uri); - Map _emptyMap = CollectionLiterals.emptyMap(); - return _extensibleURIConverterImpl.exists(_binaryStorageURI, _emptyMap); + return new ExtensibleURIConverterImpl().exists(this.getBinaryStorageURI(uri), CollectionLiterals.emptyMap()); } protected URI getBinaryStorageURI(final URI sourceURI) { diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageLoadable.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageLoadable.java index 8746650f9..67f6b8bb7 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageLoadable.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageLoadable.java @@ -16,12 +16,9 @@ import java.io.ObjectInputStream; import java.util.Map; import java.util.zip.ZipInputStream; import org.apache.log4j.Logger; -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.InternalEObject; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.URIConverter; import org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl; import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; import org.eclipse.xtext.nodemodel.impl.SerializableNodeModel; @@ -106,8 +103,7 @@ public class ResourceStorageLoadable { final ObjectInputStream objectIn = new ObjectInputStream(inputStream); Object _readObject = objectIn.readObject(); final SerializableResourceDescription description = ((SerializableResourceDescription) _readObject); - URI _uRI = resource.getURI(); - description.updateResourceURI(_uRI); + description.updateResourceURI(resource.getURI()); resource.setResourceDescription(description); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); @@ -116,31 +112,22 @@ public class ResourceStorageLoadable { protected void readNodeModel(final StorageAwareResource resource, final InputStream inputStream) throws IOException { final SerializableNodeModel serializableNodeModel = new SerializableNodeModel(resource); - ResourceSet _resourceSet = resource.getResourceSet(); - URIConverter _uRIConverter = _resourceSet.getURIConverter(); - URI _uRI = resource.getURI(); - ResourceSet _resourceSet_1 = resource.getResourceSet(); - Map _loadOptions = _resourceSet_1.getLoadOptions(); - boolean _exists = _uRIConverter.exists(_uRI, _loadOptions); + boolean _exists = resource.getResourceSet().getURIConverter().exists(resource.getURI(), resource.getResourceSet().getLoadOptions()); boolean _not = (!_exists); if (_not) { - URI _uRI_1 = resource.getURI(); - String _plus = ("Skipping loading node model for synthetic resource " + _uRI_1); + URI _uRI = resource.getURI(); + String _plus = ("Skipping loading node model for synthetic resource " + _uRI); ResourceStorageLoadable.LOG.info(_plus); return; } - ResourceSet _resourceSet_2 = resource.getResourceSet(); - URIConverter _uRIConverter_1 = _resourceSet_2.getURIConverter(); - URI _uRI_2 = resource.getURI(); - final InputStream stream = _uRIConverter_1.createInputStream(_uRI_2); + final InputStream stream = resource.getResourceSet().getURIConverter().createInputStream(resource.getURI()); String _encoding = resource.getEncoding(); final InputStreamReader in = new InputStreamReader(stream, _encoding); final String completeContent = CharStreams.toString(in); final DeserializationConversionContext deserializationContext = new DeserializationConversionContext(resource, completeContent); final DataInputStream dataIn = new DataInputStream(inputStream); serializableNodeModel.readObjectData(dataIn, deserializationContext); - EList _contents = resource.getContents(); - EObject _head = IterableExtensions.head(_contents); + EObject _head = IterableExtensions.head(resource.getContents()); boolean _hasErrors = deserializationContext.hasErrors(); ParseResult _parseResult = new ParseResult(_head, serializableNodeModel.root, _hasErrors); resource.setParseResult(_parseResult); diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageWritable.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageWritable.java index cbb8e55ce..df167603f 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageWritable.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageWritable.java @@ -24,8 +24,6 @@ import org.eclipse.xtext.nodemodel.impl.SerializableNodeModel; import org.eclipse.xtext.nodemodel.serialization.SerializationConversionContext; import org.eclipse.xtext.resource.IReferenceDescription; import org.eclipse.xtext.resource.IResourceDescription; -import org.eclipse.xtext.resource.IResourceServiceProvider; -import org.eclipse.xtext.resource.persistence.PortableURIs; import org.eclipse.xtext.resource.persistence.SerializableReferenceDescription; import org.eclipse.xtext.resource.persistence.SerializableResourceDescription; import org.eclipse.xtext.resource.persistence.StorageAwareResource; @@ -97,17 +95,14 @@ public class ResourceStorageWritable { public void writeURI(final URI uri, final String fragment) throws IOException { final URI fullURI = uri.appendFragment(fragment); URI _elvis = null; - PortableURIs _portableURIs = storageAwareResource.getPortableURIs(); - URI _portableURI = _portableURIs.toPortableURI(storageAwareResource, fullURI); + URI _portableURI = storageAwareResource.getPortableURIs().toPortableURI(storageAwareResource, fullURI); if (_portableURI != null) { _elvis = _portableURI; } else { _elvis = fullURI; } final URI uriToWrite = _elvis; - URI _trimFragment = uriToWrite.trimFragment(); - String _fragment = uriToWrite.fragment(); - super.writeURI(_trimFragment, _fragment); + super.writeURI(uriToWrite.trimFragment(), uriToWrite.fragment()); } @Override @@ -132,9 +127,7 @@ public class ResourceStorageWritable { } protected void writeResourceDescription(final StorageAwareResource resource, final OutputStream outputStream) throws IOException { - IResourceServiceProvider _resourceServiceProvider = resource.getResourceServiceProvider(); - IResourceDescription.Manager _resourceDescriptionManager = _resourceServiceProvider.getResourceDescriptionManager(); - final IResourceDescription description = _resourceDescriptionManager.getResourceDescription(resource); + final IResourceDescription description = resource.getResourceServiceProvider().getResourceDescriptionManager().getResourceDescription(resource); final SerializableResourceDescription serializableDescription = SerializableResourceDescription.createCopy(description); this.convertExternalURIsToPortableURIs(serializableDescription, resource); final ObjectOutputStream out = new ObjectOutputStream(outputStream); @@ -148,20 +141,17 @@ public class ResourceStorageWritable { protected void convertExternalURIsToPortableURIs(final SerializableResourceDescription description, final StorageAwareResource resource) { Iterable _referenceDescriptions = description.getReferenceDescriptions(); for (final IReferenceDescription ref : _referenceDescriptions) { - URI _targetEObjectUri = ref.getTargetEObjectUri(); - URI _trimFragment = _targetEObjectUri.trimFragment(); + URI _trimFragment = ref.getTargetEObjectUri().trimFragment(); URI _uRI = resource.getURI(); boolean _notEquals = (!Objects.equal(_trimFragment, _uRI)); if (_notEquals) { URI _elvis = null; - PortableURIs _portableURIs = resource.getPortableURIs(); - URI _targetEObjectUri_1 = ref.getTargetEObjectUri(); - URI _portableURI = _portableURIs.toPortableURI(resource, _targetEObjectUri_1); + URI _portableURI = resource.getPortableURIs().toPortableURI(resource, ref.getTargetEObjectUri()); if (_portableURI != null) { _elvis = _portableURI; } else { - URI _targetEObjectUri_2 = ref.getTargetEObjectUri(); - _elvis = _targetEObjectUri_2; + URI _targetEObjectUri = ref.getTargetEObjectUri(); + _elvis = _targetEObjectUri; } ((SerializableReferenceDescription) ref).setTargetEObjectUri(_elvis); } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableEObjectDescription.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableEObjectDescription.java index a31ec60ca..9acc1ce8c 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableEObjectDescription.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableEObjectDescription.java @@ -83,8 +83,7 @@ public class SerializableEObjectDescription implements IEObjectDescription, Exte @Override public void writeExternal(final ObjectOutput out) throws IOException { SerializationExtensions.writeURI(out, this.eObjectURI); - URI _uRI = EcoreUtil.getURI(this.eClass); - SerializationExtensions.writeURI(out, _uRI); + SerializationExtensions.writeURI(out, EcoreUtil.getURI(this.eClass)); SerializationExtensions.writeQualifiedName(out, this.qualifiedName); out.writeObject(this.userData); } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableResourceDescription.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableResourceDescription.java index f81009f26..3644e80b7 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableResourceDescription.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializableResourceDescription.java @@ -15,8 +15,6 @@ import java.util.ArrayList; 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.xtend.lib.annotations.Accessors; import org.eclipse.xtext.naming.QualifiedName; import org.eclipse.xtext.resource.IEObjectDescription; @@ -47,25 +45,16 @@ public class SerializableResourceDescription extends AbstractResourceDescription public static SerializableResourceDescription createCopy(final IResourceDescription desc) { SerializableResourceDescription _serializableResourceDescription = new SerializableResourceDescription(); final Procedure1 _function = (SerializableResourceDescription it) -> { - URI _uRI = desc.getURI(); - it.setURI(_uRI); - Iterable _exportedObjects = desc.getExportedObjects(); + it.setURI(desc.getURI()); final Function1 _function_1 = (IEObjectDescription it_1) -> { return SerializableResourceDescription.createCopy(it_1); }; - Iterable _map = IterableExtensions.map(_exportedObjects, _function_1); - List _list = IterableExtensions.toList(_map); - it.descriptions = _list; - Iterable _referenceDescriptions = desc.getReferenceDescriptions(); + it.descriptions = IterableExtensions.toList(IterableExtensions.map(desc.getExportedObjects(), _function_1)); final Function1 _function_2 = (IReferenceDescription it_1) -> { return SerializableResourceDescription.createCopy(it_1); }; - Iterable _map_1 = IterableExtensions.map(_referenceDescriptions, _function_2); - List _list_1 = IterableExtensions.toList(_map_1); - it.references = _list_1; - Iterable _importedNames = desc.getImportedNames(); - ArrayList _newArrayList = CollectionLiterals.newArrayList(((QualifiedName[])Conversions.unwrapArray(_importedNames, QualifiedName.class))); - it.importedNames = _newArrayList; + it.references = IterableExtensions.toList(IterableExtensions.map(desc.getReferenceDescriptions(), _function_2)); + it.importedNames = CollectionLiterals.newArrayList(((QualifiedName[])Conversions.unwrapArray(desc.getImportedNames(), QualifiedName.class))); }; return ObjectExtensions.operator_doubleArrow(_serializableResourceDescription, _function); } @@ -76,20 +65,15 @@ public class SerializableResourceDescription extends AbstractResourceDescription } SerializableEObjectDescription _serializableEObjectDescription = new SerializableEObjectDescription(); final Procedure1 _function = (SerializableEObjectDescription it) -> { - EClass _eClass = desc.getEClass(); - it.setEClass(_eClass); - URI _eObjectURI = desc.getEObjectURI(); - it.setEObjectURI(_eObjectURI); - QualifiedName _qualifiedName = desc.getQualifiedName(); - it.qualifiedName = _qualifiedName; - String[] _userDataKeys = desc.getUserDataKeys(); - int _size = ((List)Conversions.doWrapArray(_userDataKeys)).size(); + it.setEClass(desc.getEClass()); + it.setEObjectURI(desc.getEObjectURI()); + it.qualifiedName = desc.getQualifiedName(); + int _size = ((List)Conversions.doWrapArray(desc.getUserDataKeys())).size(); HashMap _hashMap = new HashMap(_size); it.userData = _hashMap; - String[] _userDataKeys_1 = desc.getUserDataKeys(); - for (final String key : _userDataKeys_1) { - String _userData = desc.getUserData(key); - it.userData.put(key, _userData); + String[] _userDataKeys = desc.getUserDataKeys(); + for (final String key : _userDataKeys) { + it.userData.put(key, desc.getUserData(key)); } }; return ObjectExtensions.operator_doubleArrow(_serializableEObjectDescription, _function); @@ -98,16 +82,11 @@ public class SerializableResourceDescription extends AbstractResourceDescription private static SerializableReferenceDescription createCopy(final IReferenceDescription desc) { SerializableReferenceDescription _serializableReferenceDescription = new SerializableReferenceDescription(); final Procedure1 _function = (SerializableReferenceDescription it) -> { - URI _sourceEObjectUri = desc.getSourceEObjectUri(); - it.setSourceEObjectUri(_sourceEObjectUri); - URI _targetEObjectUri = desc.getTargetEObjectUri(); - it.setTargetEObjectUri(_targetEObjectUri); - EReference _eReference = desc.getEReference(); - it.setEReference(_eReference); - int _indexInList = desc.getIndexInList(); - it.setIndexInList(_indexInList); - URI _containerEObjectURI = desc.getContainerEObjectURI(); - it.setContainerEObjectURI(_containerEObjectURI); + it.setSourceEObjectUri(desc.getSourceEObjectUri()); + it.setTargetEObjectUri(desc.getTargetEObjectUri()); + it.setEReference(desc.getEReference()); + it.setIndexInList(desc.getIndexInList()); + it.setContainerEObjectURI(desc.getContainerEObjectURI()); }; return ObjectExtensions.operator_doubleArrow(_serializableReferenceDescription, _function); } @@ -147,49 +126,42 @@ public class SerializableResourceDescription extends AbstractResourceDescription @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { - URI _readURI = SerializationExtensions.readURI(in); - this.setURI(_readURI); + this.setURI(SerializationExtensions.readURI(in)); final int descriptionsSize = in.readInt(); ArrayList _arrayList = new ArrayList(descriptionsSize); this.descriptions = _arrayList; ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, descriptionsSize, true); for (final Integer i : _doubleDotLessThan) { - SerializableEObjectDescription _readCastedObject = SerializationExtensions.readCastedObject(in); - this.descriptions.add(_readCastedObject); + this.descriptions.add(SerializationExtensions.readCastedObject(in)); } final int referencesSize = in.readInt(); ArrayList _arrayList_1 = new ArrayList(referencesSize); this.references = _arrayList_1; ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, referencesSize, true); for (final Integer i_1 : _doubleDotLessThan_1) { - SerializableReferenceDescription _readCastedObject_1 = SerializationExtensions.readCastedObject(in); - this.references.add(_readCastedObject_1); + this.references.add(SerializationExtensions.readCastedObject(in)); } final int importedNamesSize = in.readInt(); ArrayList _arrayList_2 = new ArrayList(importedNamesSize); this.importedNames = _arrayList_2; ExclusiveRange _doubleDotLessThan_2 = new ExclusiveRange(0, importedNamesSize, true); for (final Integer i_2 : _doubleDotLessThan_2) { - QualifiedName _readQualifiedName = SerializationExtensions.readQualifiedName(in); - this.importedNames.add(_readQualifiedName); + this.importedNames.add(SerializationExtensions.readQualifiedName(in)); } } @Override public void writeExternal(final ObjectOutput out) throws IOException { SerializationExtensions.writeURI(out, this.uRI); - int _size = this.descriptions.size(); - out.writeInt(_size); + out.writeInt(this.descriptions.size()); for (final SerializableEObjectDescription desc : this.descriptions) { out.writeObject(desc); } - int _size_1 = this.references.size(); - out.writeInt(_size_1); + out.writeInt(this.references.size()); for (final SerializableReferenceDescription ref : this.references) { out.writeObject(ref); } - int _size_2 = this.importedNames.size(); - out.writeInt(_size_2); + out.writeInt(this.importedNames.size()); for (final QualifiedName name : this.importedNames) { SerializationExtensions.writeQualifiedName(out, name); } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializationExtensions.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializationExtensions.java index b9e12e41e..8622a87fb 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializationExtensions.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SerializationExtensions.java @@ -29,17 +29,14 @@ import org.eclipse.xtext.xbase.lib.Exceptions; class SerializationExtensions { public static T readEcoreElement(final ObjectInput in) throws IOException { final URI uri = SerializationExtensions.readURI(in); - URI _trimFragment = uri.trimFragment(); - String _string = _trimFragment.toString(); - final EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(_string); + final EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(uri.trimFragment().toString()); Resource _eResource = null; if (ePackage!=null) { _eResource=ePackage.eResource(); } EObject _eObject = null; if (_eResource!=null) { - String _fragment = uri.fragment(); - _eObject=_eResource.getEObject(_fragment); + _eObject=_eResource.getEObject(uri.fragment()); } return ((T) _eObject); } @@ -71,8 +68,7 @@ class SerializationExtensions { if ((uri == null)) { out.writeUTF("NULL"); } else { - String _string = uri.toString(); - out.writeUTF(_string); + out.writeUTF(uri.toString()); } } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SourceLevelURIsAdapter.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SourceLevelURIsAdapter.java index 554d0644a..73fa1bd00 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SourceLevelURIsAdapter.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SourceLevelURIsAdapter.java @@ -63,9 +63,7 @@ public class SourceLevelURIsAdapter extends AdapterImpl { } public static SourceLevelURIsAdapter findInstalledAdapter(final ResourceSet resourceSet) { - EList _eAdapters = resourceSet.eAdapters(); - Iterable _filter = Iterables.filter(_eAdapters, SourceLevelURIsAdapter.class); - return IterableExtensions.head(_filter); + return IterableExtensions.head(Iterables.filter(resourceSet.eAdapters(), SourceLevelURIsAdapter.class)); } @Pure diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/service/OperationCanceledManager.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/service/OperationCanceledManager.java index 71185196e..9d95b5bbf 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/service/OperationCanceledManager.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/service/OperationCanceledManager.java @@ -30,8 +30,7 @@ public class OperationCanceledManager { } if (!_matched) { if (t instanceof RuntimeException) { - Class _class = ((RuntimeException)t).getClass(); - String _name = _class.getName(); + String _name = ((RuntimeException)t).getClass().getName(); boolean _equals = Objects.equal(_name, "com.intellij.openapi.progress.ProcessCanceledException"); if (_equals) { _matched=true; @@ -91,8 +90,7 @@ public class OperationCanceledManager { } public void throwOperationCanceledException() { - RuntimeException _platformSpecificOperationCanceledException = this.getPlatformSpecificOperationCanceledException(); - throw this.asWrappingOperationCanceledException(_platformSpecificOperationCanceledException); + throw this.asWrappingOperationCanceledException(this.getPlatformSpecificOperationCanceledException()); } protected RuntimeException getPlatformSpecificOperationCanceledException() { diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskFinder.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskFinder.java index 54da9e210..d96152a8a 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskFinder.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskFinder.java @@ -80,20 +80,16 @@ public class DefaultTaskFinder implements ITaskFinder { } protected List findTasks(final ICompositeNode it, final TaskTags taskTags) { - Iterable _leafNodes = it.getLeafNodes(); final Function1> _function = (ILeafNode it_1) -> { return this.findTasks(it_1, taskTags); }; - Iterable> _map = IterableExtensions.>map(_leafNodes, _function); - Iterable _flatten = Iterables.concat(_map); - return IterableExtensions.toList(_flatten); + return IterableExtensions.toList(Iterables.concat(IterableExtensions.>map(it.getLeafNodes(), _function))); } protected List findTasks(final ILeafNode node, final TaskTags taskTags) { boolean _canContainTaskTags = this.canContainTaskTags(node); if (_canContainTaskTags) { - String _text = node.getText(); - final List tasks = this.parser.parseTasks(_text, taskTags); + final List tasks = this.parser.parseTasks(node.getText(), taskTags); final Consumer _function = (Task it) -> { int _offset = it.getOffset(); int _offset_1 = node.getOffset(); diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskParser.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskParser.java index 28f371f11..638a67698 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskParser.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskParser.java @@ -40,12 +40,10 @@ public class DefaultTaskParser implements ITaskParser { return Collections.unmodifiableList(CollectionLiterals.newArrayList()); } final Function _function = (TaskTag it) -> { - String _name = it.getName(); - return _name.toLowerCase(); + return it.getName().toLowerCase(); }; final ImmutableMap taskTagsByName = Maps.uniqueIndex(taskTags, _function); - Pattern _pattern = this.toPattern(taskTags); - final Matcher matcher = _pattern.matcher(source); + final Matcher matcher = this.toPattern(taskTags).matcher(source); final ArrayList tasks = CollectionLiterals.newArrayList(); int prevLine = 1; int prevOffset = 0; @@ -55,8 +53,7 @@ public class DefaultTaskParser implements ITaskParser { task.setTag(taskTagsByName.get(matcher.group(2).toLowerCase())); task.setDescription(matcher.group(3)); task.setOffset(matcher.start(2)); - int _offset = task.getOffset(); - int _countLineBreaks = Strings.countLineBreaks(source, prevOffset, _offset); + int _countLineBreaks = Strings.countLineBreaks(source, prevOffset, task.getOffset()); int _plus = (_countLineBreaks + prevLine); task.setLineNumber(_plus); prevLine = task.getLineNumber(); @@ -81,11 +78,9 @@ public class DefaultTaskParser implements ITaskParser { StringConcatenation _builder = new StringConcatenation(); _builder.append("^.*(("); final Function1 _function = (TaskTag it) -> { - String _name = it.getName(); - return Pattern.quote(_name); + return Pattern.quote(it.getName()); }; - Iterable _map = IterableExtensions.map(taskTags, _function); - String _join = IterableExtensions.join(_map, "|"); + String _join = IterableExtensions.join(IterableExtensions.map(taskTags, _function), "|"); _builder.append(_join); _builder.append(")(.*)?)$"); _xblockexpression = Pattern.compile(_builder.toString(), flags); diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/PreferenceTaskTagProvider.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/PreferenceTaskTagProvider.java index 1b3c4c184..a230f67cc 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/PreferenceTaskTagProvider.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/PreferenceTaskTagProvider.java @@ -46,13 +46,9 @@ public class PreferenceTaskTagProvider implements ITaskTagProvider { public final static List KEYS = Collections.unmodifiableList(CollectionLiterals.newArrayList(PreferenceTaskTagProvider.TAGS_KEY, PreferenceTaskTagProvider.PRIORITIES_KEY, PreferenceTaskTagProvider.CASE_SENSITIVE_KEY)); public static List parseTags(final String names, final String priorities) { - Splitter _on = Splitter.on(","); - Splitter _omitEmptyStrings = _on.omitEmptyStrings(); - final Splitter splitter = _omitEmptyStrings.trimResults(); - Iterable _split = splitter.split(names); - final List tags = IterableExtensions.toList(_split); - Iterable _split_1 = splitter.split(priorities); - final List prios = IterableExtensions.toList(_split_1); + final Splitter splitter = Splitter.on(",").omitEmptyStrings().trimResults(); + final List tags = IterableExtensions.toList(splitter.split(names)); + final List prios = IterableExtensions.toList(splitter.split(priorities)); final ArrayList elements = CollectionLiterals.newArrayList(); int _size = tags.size(); ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true); @@ -66,8 +62,7 @@ public class PreferenceTaskTagProvider implements ITaskTagProvider { if (_greaterEqualsThan) { Priority _xtrycatchfinallyexpression = null; try { - String _get = prios.get((i).intValue()); - _xtrycatchfinallyexpression = Priority.valueOf(_get); + _xtrycatchfinallyexpression = Priority.valueOf(prios.get((i).intValue())); } catch (final Throwable _t) { if (_t instanceof IllegalArgumentException) { final IllegalArgumentException e = (IllegalArgumentException)_t; @@ -89,21 +84,17 @@ public class PreferenceTaskTagProvider implements ITaskTagProvider { } public static String serializeTags(final List tags) { - Joiner _on = Joiner.on(","); final Function1 _function = (TaskTag it) -> { return it.getName(); }; - List _map = ListExtensions.map(tags, _function); - return _on.join(_map); + return Joiner.on(",").join(ListExtensions.map(tags, _function)); } public static String serializePriorities(final List tags) { - Joiner _on = Joiner.on(","); final Function1 _function = (TaskTag it) -> { return it.getPriority(); }; - List _map = ListExtensions.map(tags, _function); - return _on.join(_map); + return Joiner.on(",").join(ListExtensions.map(tags, _function)); } private IPreferenceValuesProvider preferenceValuesProvider; diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/Task.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/Task.java index fab1121bc..97b557284 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/Task.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/Task.java @@ -32,8 +32,7 @@ public class Task { } public int getTotalLength() { - String _fullText = this.getFullText(); - return _fullText.length(); + return this.getFullText().length(); } public int getTagLength() { diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/FileProjectConfig.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/FileProjectConfig.java index c87e2d7f8..125a6e2f6 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/FileProjectConfig.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/FileProjectConfig.java @@ -59,8 +59,7 @@ public class FileProjectConfig implements IProjectConfig { @Override public FileSourceFolder findSourceFolderContaining(final URI member) { final Function1 _function = (FileSourceFolder source) -> { - URI _path = source.getPath(); - return Boolean.valueOf(UriUtil.isPrefixOf(_path, member)); + return Boolean.valueOf(UriUtil.isPrefixOf(source.getPath(), member)); }; return IterableExtensions.findFirst(this.sourceFolders, _function); } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/FileSourceFolder.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/FileSourceFolder.java index 0b6c3ab9f..26ef77ed9 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/FileSourceFolder.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/FileSourceFolder.java @@ -28,9 +28,7 @@ public class FileSourceFolder implements ISourceFolder { @Override public URI getPath() { - URI _createFileURI = URI.createFileURI(this.name); - URI _path = this.parent.getPath(); - final URI result = _createFileURI.resolve(_path); + final URI result = URI.createFileURI(this.name).resolve(this.parent.getPath()); boolean _hasTrailingPathSeparator = result.hasTrailingPathSeparator(); if (_hasTrailingPathSeparator) { return result; @@ -51,8 +49,7 @@ public class FileSourceFolder implements ISourceFolder { @Override public int hashCode() { - URI _path = this.getPath(); - return _path.hashCode(); + return this.getPath().hashCode(); } @Override diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/ProjectConfigAdapter.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/ProjectConfigAdapter.java index ba4b279c1..294102fa9 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/ProjectConfigAdapter.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/ProjectConfigAdapter.java @@ -45,8 +45,7 @@ public class ProjectConfigAdapter { } public static void install(final ResourceSet resourceSet, final IProjectConfig config) { - ProjectConfigAdapter _projectConfigAdapter = new ProjectConfigAdapter(config); - _projectConfigAdapter.attachToEmfObject(resourceSet); + new ProjectConfigAdapter(config).attachToEmfObject(resourceSet); } public static ProjectConfigAdapter findInEmfObject(final Notifier emfObject) { diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/SingleProjectWorkspaceConfig.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/SingleProjectWorkspaceConfig.java index 995cc10b0..0c59ac2e7 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/SingleProjectWorkspaceConfig.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/workspace/SingleProjectWorkspaceConfig.java @@ -36,8 +36,7 @@ public class SingleProjectWorkspaceConfig implements IWorkspaceConfig { @Override public IProjectConfig findProjectContaining(final URI member) { - URI _path = this.projectConfig.getPath(); - boolean _isPrefixOf = UriUtil.isPrefixOf(_path, member); + boolean _isPrefixOf = UriUtil.isPrefixOf(this.projectConfig.getPath(), member); if (_isPrefixOf) { return this.projectConfig; } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/xtext/FlattenedGrammarAccess.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/xtext/FlattenedGrammarAccess.java index fd354c8ee..cb65b32d8 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/xtext/FlattenedGrammarAccess.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/xtext/FlattenedGrammarAccess.java @@ -104,17 +104,14 @@ public class FlattenedGrammarAccess { boolean _isDiscardTerminalRules = filter.isDiscardTerminalRules(); boolean _not = (!_isDiscardTerminalRules); if (_not) { - List _allTerminalRules = GrammarUtil.allTerminalRules(flattenedGrammar); - usedRules.addAll(_allTerminalRules); + usedRules.addAll(GrammarUtil.allTerminalRules(flattenedGrammar)); } UsedRulesFinder finder = new UsedRulesFinder(usedRules); finder.compute(flattenedGrammar); - EList _rules_1 = flattenedGrammar.getRules(); - _rules_1.retainAll(usedRules); + flattenedGrammar.getRules().retainAll(usedRules); } this.flattenedGrammar = flattenedGrammar; - OriginalGrammar _originalGrammar = new OriginalGrammar(grammar); - _originalGrammar.attachToEmfObject(flattenedGrammar); + new OriginalGrammar(grammar).attachToEmfObject(flattenedGrammar); } private void setHiddenTokens(final Grammar copy, final Grammar orig, final Map origToCopy) { @@ -124,45 +121,37 @@ public class FlattenedGrammarAccess { boolean _isDefinesHiddenTokens = orig.isDefinesHiddenTokens(); boolean _not = (!_isDefinesHiddenTokens); if (_not) { - EList _usedGrammars = orig.getUsedGrammars(); - Grammar _head = IterableExtensions.head(_usedGrammars); - this.setHiddenTokens(copy, _head, origToCopy); + this.setHiddenTokens(copy, IterableExtensions.head(orig.getUsedGrammars()), origToCopy); } else { copy.setDefinesHiddenTokens(true); EList _hiddenTokens = copy.getHiddenTokens(); - EList _hiddenTokens_1 = orig.getHiddenTokens(); final Function1 _function = (AbstractRule hidden) -> { RuleWithParameterValues _ruleWithParameterValues = new RuleWithParameterValues(hidden); return origToCopy.get(_ruleWithParameterValues); }; - List _map = ListExtensions.map(_hiddenTokens_1, _function); + List _map = ListExtensions.map(orig.getHiddenTokens(), _function); Iterables.addAll(_hiddenTokens, _map); } } } private void markAsFragment(final Multimap calledFrom) { - Set _keySet = calledFrom.keySet(); final Function1 _function = (TerminalRule it) -> { boolean _isFragment = it.isFragment(); return Boolean.valueOf((!_isFragment)); }; - Iterable _filter = IterableExtensions.filter(_keySet, _function); final Function1 _function_1 = (TerminalRule it) -> { return Boolean.valueOf(this.allAreTerminalRules(calledFrom.get(it))); }; - Iterable _filter_1 = IterableExtensions.filter(_filter, _function_1); final Function1 _function_2 = (TerminalRule it) -> { EObject _eContainer = it.eContainer(); - EList _hiddenTokens = ((Grammar) _eContainer).getHiddenTokens(); - boolean _contains = _hiddenTokens.contains(it); + boolean _contains = ((Grammar) _eContainer).getHiddenTokens().contains(it); return Boolean.valueOf((!_contains)); }; - Iterable _filter_2 = IterableExtensions.filter(_filter_1, _function_2); final Consumer _function_3 = (TerminalRule it) -> { it.setFragment(true); }; - _filter_2.forEach(_function_3); + IterableExtensions.filter(IterableExtensions.filter(IterableExtensions.filter(calledFrom.keySet(), _function), _function_1), _function_2).forEach(_function_3); } private Multimap copyRuleBodies(final List copies, final Map origToCopy) { @@ -203,22 +192,17 @@ public class FlattenedGrammarAccess { } Set getParameterConfig(final RuleCall origRuleCall, final RuleCall copyRuleCall) { - EList _arguments = origRuleCall.getArguments(); - boolean _isEmpty = _arguments.isEmpty(); + boolean _isEmpty = origRuleCall.getArguments().isEmpty(); if (_isEmpty) { return Collections.emptySet(); } - EList _arguments_1 = origRuleCall.getArguments(); final Function1 _function = (NamedArgument it) -> { - Condition _value = it.getValue(); - return Boolean.valueOf(this.evaluate(_value)); + return Boolean.valueOf(this.evaluate(it.getValue())); }; - Iterable _filter = IterableExtensions.filter(_arguments_1, _function); final Function1 _function_1 = (NamedArgument it) -> { return it.getParameter(); }; - Iterable _map = IterableExtensions.map(_filter, _function_1); - Set result = IterableExtensions.toSet(_map); + Set result = IterableExtensions.toSet(IterableExtensions.map(IterableExtensions.filter(origRuleCall.getArguments(), _function), _function_1)); return result; } @@ -278,12 +262,10 @@ public class FlattenedGrammarAccess { EClass _eClass_1 = result.eClass(); boolean _notEquals = (!Objects.equal(_eClass, _eClass_1)); if (_notEquals) { - EClass _eClass_2 = result.eClass(); - String _name = _eClass_2.getName(); + String _name = result.eClass().getName(); String _plus = ("copy is: \'" + _name); String _plus_1 = (_plus + "\' but original was: \'"); - EClass _eClass_3 = ((AbstractElement)eObject).eClass(); - String _name_1 = _eClass_3.getName(); + String _name_1 = ((AbstractElement)eObject).eClass().getName(); String _plus_2 = (_plus_1 + _name_1); String _plus_3 = (_plus_2 + "\'"); throw new IllegalStateException(_plus_3); @@ -339,13 +321,11 @@ public class FlattenedGrammarAccess { } boolean evaluate(final Condition condition) { - ConditionEvaluator _conditionEvaluator = new ConditionEvaluator(paramValues); - boolean result = _conditionEvaluator.evaluate(condition); + boolean result = new ConditionEvaluator(paramValues).evaluate(condition); return result; } }; - AbstractElement _alternatives = orig.getAlternatives(); - EObject _copy = copier.copy(_alternatives); + EObject _copy = copier.copy(orig.getAlternatives()); AbstractElement copiedBody = ((AbstractElement) _copy); copier.copyReferences(); copy.setAlternatives(copiedBody); @@ -401,8 +381,6 @@ public class FlattenedGrammarAccess { this.attachTo(copy, rule, origToCopy); result.add(copy); } else { - ImmutableSet _copyOf = ImmutableSet.copyOf(params); - Set> _powerSet = Sets.powerSet(_copyOf); final Procedure2, Integer> _function = (Set parameterConfig, Integer i) -> { RuleWithParameterValues parameterValues = new RuleWithParameterValues(rule, parameterConfig); ParserRule copy_1 = this.copy(((ParserRule)rule)); @@ -416,7 +394,7 @@ public class FlattenedGrammarAccess { parameterValues.attachToEmfObject(copy_1); result.add(copy_1); }; - IterableExtensions.>forEach(_powerSet, _function); + IterableExtensions.>forEach(Sets.powerSet(ImmutableSet.copyOf(params)), _function); } } if (!_matched) { @@ -462,8 +440,7 @@ public class FlattenedGrammarAccess { } private T copy(final T t) { - EClass _eClass = t.eClass(); - EObject _create = EcoreUtil.create(_eClass); + EObject _create = EcoreUtil.create(t.eClass()); T result = ((T) _create); return result; } diff --git a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/xtext/RuleWithParameterValues.java b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/xtext/RuleWithParameterValues.java index 8d1b8ff42..a1f189ab8 100644 --- a/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/xtext/RuleWithParameterValues.java +++ b/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/xtext/RuleWithParameterValues.java @@ -63,8 +63,7 @@ public class RuleWithParameterValues { } public static AbstractRule getOriginalRule(final AbstractRule copy) { - RuleWithParameterValues _findInEmfObject = RuleWithParameterValues.findInEmfObject(copy); - return _findInEmfObject.getOriginal(); + return RuleWithParameterValues.findInEmfObject(copy).getOriginal(); } public static AbstractRule tryGetOriginalRule(final AbstractRule copy) { @@ -77,8 +76,7 @@ public class RuleWithParameterValues { } public static Set getParamValues(final AbstractRule copy) { - RuleWithParameterValues _findInEmfObject = RuleWithParameterValues.findInEmfObject(copy); - return _findInEmfObject.getParamValues(); + return RuleWithParameterValues.findInEmfObject(copy).getParamValues(); } public static int getParamConfig(final AbstractRule copy) {