private TextEdit change(final Position startPos, final Position endPos, final String newText) { TextEdit _textEdit = new TextEdit(); final Procedure1<TextEdit> _function = (TextEdit it) -> { if ((startPos != null)) { Range _range = new Range(); final Procedure1<Range> _function_1 = (Range it_1) -> { it_1.setStart(startPos); it_1.setEnd(endPos); }; Range _doubleArrow = ObjectExtensions.<Range>operator_doubleArrow(_range, _function_1); it.setRange(_doubleArrow); } it.setNewText(newText); }; return ObjectExtensions.<TextEdit>operator_doubleArrow(_textEdit, _function); }
@Test public void testRangeFormattingService() { final Procedure1<RangeFormattingConfiguration> _function = (RangeFormattingConfiguration it) -> { StringConcatenation _builder = new StringConcatenation(); _builder.append("type Foo{int bar} type Bar{Foo foo}"); it.setModel(_builder.toString()); Range _range = new Range(); final Procedure1<Range> _function_1 = (Range it_1) -> { Position _position = new Position(0, 0); it_1.setStart(_position); Position _position_1 = new Position(0, 17); it_1.setEnd(_position_1); }; Range _doubleArrow = ObjectExtensions.<Range>operator_doubleArrow(_range, _function_1); it.setRange(_doubleArrow); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type Foo{"); _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append("int bar"); _builder_1.newLine(); _builder_1.append("} type Bar{Foo foo}"); it.setExpectedText(_builder_1.toString()); }; this.testRangeFormatting(_function); }
protected List<Class<?>> getExtensionClasses() { return Lists.<Class<?>> newArrayList( ArrayExtensions.class, BigDecimalExtensions.class, BigIntegerExtensions.class, BooleanExtensions.class, ByteExtensions.class, CharacterExtensions.class, CollectionExtensions.class, ComparableExtensions.class, DoubleExtensions.class, FloatExtensions.class, FunctionExtensions.class, IntegerExtensions.class, IterableExtensions.class, IteratorExtensions.class, ListExtensions.class, LongExtensions.class, MapExtensions.class, ObjectExtensions.class, ProcedureExtensions.class, ShortExtensions.class, StringExtensions.class); }
public GeneratorConfig install(final ResourceSet resourceSet, final GeneratorConfig config) { GeneratorConfigProvider.GeneratorConfigAdapter _elvis = null; GeneratorConfigProvider.GeneratorConfigAdapter _findInEmfObject = GeneratorConfigProvider.GeneratorConfigAdapter.findInEmfObject(resourceSet); if (_findInEmfObject != null) { _elvis = _findInEmfObject; } else { GeneratorConfigProvider.GeneratorConfigAdapter _generatorConfigAdapter = new GeneratorConfigProvider.GeneratorConfigAdapter(); final Procedure1<GeneratorConfigProvider.GeneratorConfigAdapter> _function = (GeneratorConfigProvider.GeneratorConfigAdapter it) -> { it.attachToEmfObject(resourceSet); }; GeneratorConfigProvider.GeneratorConfigAdapter _doubleArrow = ObjectExtensions.<GeneratorConfigProvider.GeneratorConfigAdapter>operator_doubleArrow(_generatorConfigAdapter, _function); _elvis = _doubleArrow; } final GeneratorConfigProvider.GeneratorConfigAdapter adapter = _elvis; return adapter.language2GeneratorConfig.put(this.languageId, config); }
protected BuildRequest newBuildRequest(final List<URI> changedFiles, final List<URI> deletedFiles, final List<IResourceDescription.Delta> externalDeltas, final CancelIndicator cancelIndicator) { BuildRequest _buildRequest = new BuildRequest(); final Procedure1<BuildRequest> _function = (BuildRequest it) -> { it.setBaseDir(this.baseDir); 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())); it.setDirtyFiles(changedFiles); it.setDeletedFiles(deletedFiles); it.setExternalDeltas(externalDeltas); final BuildRequest.IPostValidationCallback _function_1 = (URI uri, Iterable<Issue> issues) -> { this.issueAcceptor.apply(uri, issues); return true; }; it.setAfterValidate(_function_1); it.setCancelIndicator(cancelIndicator); }; return ObjectExtensions.<BuildRequest>operator_doubleArrow(_buildRequest, _function); }
/** * Uses curly braces and comma as delimiters. Doesn't use them for single valued iterables. */ public <T extends Object> void forEachWithShortcut(final ITreeAppendable appendable, final Iterable<T> elements, final Procedure1<? super T> procedure) { int _size = IterableExtensions.size(elements); boolean _equals = (_size == 1); if (_equals) { T _head = IterableExtensions.<T>head(elements); ObjectExtensions.<T>operator_doubleArrow(_head, procedure); } else { appendable.append("{"); final Procedure1<LoopParams> _function = (LoopParams it) -> { it.setPrefix(" "); it.setSeparator(", "); it.setSuffix(" "); }; this.<T>forEach(appendable, elements, _function, procedure); appendable.append("}"); } }
protected JvmTypeReference toTypeReference(final JvmType type, final int arrayDimensions) { if ((type == null)) { return null; } JvmParameterizedTypeReference _createJvmParameterizedTypeReference = TypesFactory.eINSTANCE.createJvmParameterizedTypeReference(); final Procedure1<JvmParameterizedTypeReference> _function = (JvmParameterizedTypeReference it) -> { it.setType(type); }; JvmTypeReference resultTypeRef = ObjectExtensions.<JvmParameterizedTypeReference>operator_doubleArrow(_createJvmParameterizedTypeReference, _function); ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, arrayDimensions, true); for (final Integer i : _doubleDotLessThan) { { final JvmGenericArrayTypeReference arrayRef = TypesFactory.eINSTANCE.createJvmGenericArrayTypeReference(); arrayRef.setComponentType(resultTypeRef); resultTypeRef = arrayRef; } } return resultTypeRef; }
@Test public void testDuplicateCases_typeLiteral_2() { try { StringConcatenation _builder = new StringConcatenation(); _builder.append("switch x : String {"); _builder.newLine(); _builder.append("\t"); _builder.append("case String: 1"); _builder.newLine(); _builder.append("\t"); _builder.append("case typeof(String): 1"); _builder.newLine(); _builder.append("}"); _builder.newLine(); XExpression _expression = this.expression(_builder); final Procedure1<XExpression> _function = (XExpression it) -> { this._validationTestHelper.assertError(it, XbasePackage.Literals.XTYPE_LITERAL, IssueCodes.DUPLICATE_CASE); this._validationTestHelper.assertError(it, XbasePackage.Literals.XFEATURE_CALL, IssueCodes.DUPLICATE_CASE); }; ObjectExtensions.<XExpression>operator_doubleArrow(_expression, _function); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
@Test public void testFunctionType4() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Function3.class)); final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> { it.setReturnType(this.typeRef(Object.class)); it.addTypeArgument(this.typeRef(Object.class)); it.addParameterType(this.typeRef(String.class)); it.addTypeArgument(this.typeRef(String.class)); ParameterizedTypeReference _typeRef = this.typeRef(List.class); final Procedure1<ParameterizedTypeReference> _function_1 = (ParameterizedTypeReference it_1) -> { WildcardTypeReference _newWildcardTypeReference = it_1.getOwner().newWildcardTypeReference(); final Procedure1<WildcardTypeReference> _function_2 = (WildcardTypeReference it_2) -> { it_2.setLowerBound(this.typeRef(CharSequence.class)); }; WildcardTypeReference _doubleArrow = ObjectExtensions.<WildcardTypeReference>operator_doubleArrow(_newWildcardTypeReference, _function_2); it_1.addTypeArgument(_doubleArrow); }; final ParameterizedTypeReference listOfCharSequence = ObjectExtensions.<ParameterizedTypeReference>operator_doubleArrow(_typeRef, _function_1); it.addParameterType(listOfCharSequence); it.addTypeArgument(listOfCharSequence); final ArrayTypeReference arrayOfObject = it.getOwner().newArrayTypeReference(this.typeRef(Object.class)); it.addParameterType(arrayOfObject); it.addTypeArgument(arrayOfObject); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "(java.lang.String, java.util.List<? super java.lang.CharSequence>, java.lang.Object[])=>java.lang.Object"), "org.eclipse.xtext.xbase.lib.Functions$Function3<java.lang.Object, java.lang.String, java.util.List<? super java.lang.CharSequence>, java.lang.Object[]>"); }
@Test public void testFunctionType7() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Procedure3.class)); final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> { it.addParameterType(this.typeRef(String.class)); it.addTypeArgument(this.typeRef(String.class)); ParameterizedTypeReference _typeRef = this.typeRef(List.class); final Procedure1<ParameterizedTypeReference> _function_1 = (ParameterizedTypeReference it_1) -> { WildcardTypeReference _newWildcardTypeReference = it_1.getOwner().newWildcardTypeReference(); final Procedure1<WildcardTypeReference> _function_2 = (WildcardTypeReference it_2) -> { it_2.setLowerBound(this.typeRef(CharSequence.class)); }; WildcardTypeReference _doubleArrow = ObjectExtensions.<WildcardTypeReference>operator_doubleArrow(_newWildcardTypeReference, _function_2); it_1.addTypeArgument(_doubleArrow); }; final ParameterizedTypeReference listOfCharSequence = ObjectExtensions.<ParameterizedTypeReference>operator_doubleArrow(_typeRef, _function_1); it.addParameterType(listOfCharSequence); it.addTypeArgument(listOfCharSequence); final ArrayTypeReference arrayOfObject = it.getOwner().newArrayTypeReference(this.typeRef(Object.class)); it.addParameterType(arrayOfObject); it.addTypeArgument(arrayOfObject); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "(java.lang.String, java.util.List<? super java.lang.CharSequence>, java.lang.Object[])=>void"), "org.eclipse.xtext.xbase.lib.Procedures$Procedure3<java.lang.String, java.util.List<? super java.lang.CharSequence>, java.lang.Object[]>"); }
protected TextEdit toTextEdit(final Document document, final String formattedText, final int startOffset, final int length) { TextEdit _textEdit = new TextEdit(); final Procedure1<TextEdit> _function = (TextEdit it) -> { it.setNewText(formattedText); Range _range = new Range(); final Procedure1<Range> _function_1 = (Range it_1) -> { it_1.setStart(document.getPosition(startOffset)); it_1.setEnd(document.getPosition((startOffset + length))); }; Range _doubleArrow = ObjectExtensions.<Range>operator_doubleArrow(_range, _function_1); it.setRange(_doubleArrow); }; return ObjectExtensions.<TextEdit>operator_doubleArrow(_textEdit, _function); }
@Override public TaskTags getTaskTags(final Resource resource) { TaskTags _xblockexpression = null; { final IPreferenceValues prefs = this.preferenceValuesProvider.getPreferenceValues(resource); final String names = prefs.getPreference(PreferenceTaskTagProvider.TAGS_KEY); final String priorities = prefs.getPreference(PreferenceTaskTagProvider.PRIORITIES_KEY); TaskTags _taskTags = new TaskTags(); final Procedure1<TaskTags> _function = (TaskTags it) -> { it.setCaseSensitive((Boolean.valueOf(prefs.getPreference(PreferenceTaskTagProvider.CASE_SENSITIVE_KEY))).booleanValue()); List<TaskTag> _taskTags_1 = it.getTaskTags(); List<TaskTag> _parseTags = PreferenceTaskTagProvider.parseTags(names, priorities); Iterables.<TaskTag>addAll(_taskTags_1, _parseTags); }; _xblockexpression = ObjectExtensions.<TaskTags>operator_doubleArrow(_taskTags, _function); } return _xblockexpression; }
public static void setSourceLevelUris(final ResourceSet resourceSet, final Collection<URI> uris) { SourceLevelURIsAdapter _elvis = null; SourceLevelURIsAdapter _findInstalledAdapter = SourceLevelURIsAdapter.findInstalledAdapter(resourceSet); if (_findInstalledAdapter != null) { _elvis = _findInstalledAdapter; } else { SourceLevelURIsAdapter _sourceLevelURIsAdapter = new SourceLevelURIsAdapter(); final Procedure1<SourceLevelURIsAdapter> _function = (SourceLevelURIsAdapter it) -> { EList<Adapter> _eAdapters = resourceSet.eAdapters(); _eAdapters.add(it); }; SourceLevelURIsAdapter _doubleArrow = ObjectExtensions.<SourceLevelURIsAdapter>operator_doubleArrow(_sourceLevelURIsAdapter, _function); _elvis = _doubleArrow; } final SourceLevelURIsAdapter adapter = _elvis; adapter.sourceLevelURIs = ImmutableSet.<URI>copyOf(uris); }
private static SerializableEObjectDescription createCopy(final IEObjectDescription desc) { if ((desc instanceof SerializableEObjectDescriptionProvider)) { return ((SerializableEObjectDescriptionProvider)desc).toSerializableEObjectDescription(); } SerializableEObjectDescription _serializableEObjectDescription = new SerializableEObjectDescription(); final Procedure1<SerializableEObjectDescription> _function = (SerializableEObjectDescription it) -> { it.setEClass(desc.getEClass()); it.setEObjectURI(desc.getEObjectURI()); it.qualifiedName = desc.getQualifiedName(); int _size = ((List<String>)Conversions.doWrapArray(desc.getUserDataKeys())).size(); HashMap<String, String> _hashMap = new HashMap<String, String>(_size); it.userData = _hashMap; String[] _userDataKeys = desc.getUserDataKeys(); for (final String key : _userDataKeys) { it.userData.put(key, desc.getUserData(key)); } }; return ObjectExtensions.<SerializableEObjectDescription>operator_doubleArrow(_serializableEObjectDescription, _function); }
@Override public void setContext(final Notifier ctx) { IResourceDescriptions _localDescriptions = this.getLocalDescriptions(); final Procedure1<ResourceSetBasedResourceDescriptions> _function = (ResourceSetBasedResourceDescriptions it) -> { it.setContext(ctx); it.setData(null); }; ObjectExtensions.<ResourceSetBasedResourceDescriptions>operator_doubleArrow(((ResourceSetBasedResourceDescriptions) _localDescriptions), _function); final ResourceSet resourceSet = EcoreUtil2.getResourceSet(ctx); this.setGlobalDescriptions(ChunkedResourceDescriptions.findInEmfObject(resourceSet)); IProjectConfig _projectConfig = null; if (this.projectConfigProvider!=null) { _projectConfig=this.projectConfigProvider.getProjectConfig(resourceSet); } IWorkspaceConfig _workspaceConfig = null; if (_projectConfig!=null) { _workspaceConfig=_projectConfig.getWorkspaceConfig(); } this.workspaceConfig = _workspaceConfig; }
@Test public void testOffSet_empty() { Document _document = new Document(1, ""); final Procedure1<Document> _function = (Document it) -> { Assert.assertEquals(0, it.getOffSet(this.position(0, 0))); try { it.getOffSet(this.position(0, 12)); Assert.fail(); } catch (final Throwable _t) { if (_t instanceof IndexOutOfBoundsException) { } else { throw Exceptions.sneakyThrow(_t); } } }; ObjectExtensions.<Document>operator_doubleArrow(_document, _function); }
@Test public void testUpdate_01() { StringConcatenation _builder = new StringConcatenation(); _builder.append("hello world"); _builder.newLine(); _builder.append("foo"); _builder.newLine(); _builder.append("bar"); _builder.newLine(); String _normalize = this.normalize(_builder); Document _document = new Document(1, _normalize); final Procedure1<Document> _function = (Document it) -> { StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("hello world"); _builder_1.newLine(); _builder_1.append("bar"); _builder_1.newLine(); TextEdit _change = this.change(this.position(1, 0), this.position(2, 0), ""); Assert.assertEquals(this.normalize(_builder_1), it.applyChanges( Collections.<TextEdit>unmodifiableList(CollectionLiterals.<TextEdit>newArrayList(_change))).getContents()); }; ObjectExtensions.<Document>operator_doubleArrow(_document, _function); }
@Test public void testUpdate_02() { StringConcatenation _builder = new StringConcatenation(); _builder.append("hello world"); _builder.newLine(); _builder.append("foo"); _builder.newLine(); _builder.append("bar"); _builder.newLine(); String _normalize = this.normalize(_builder); Document _document = new Document(1, _normalize); final Procedure1<Document> _function = (Document it) -> { StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("hello world"); _builder_1.newLine(); _builder_1.append("future"); _builder_1.newLine(); _builder_1.append("bar"); _builder_1.newLine(); TextEdit _change = this.change(this.position(1, 1), this.position(1, 3), "uture"); Assert.assertEquals(this.normalize(_builder_1), it.applyChanges( Collections.<TextEdit>unmodifiableList(CollectionLiterals.<TextEdit>newArrayList(_change))).getContents()); }; ObjectExtensions.<Document>operator_doubleArrow(_document, _function); }
@Test public void testUpdate_nonIncrementalChange() { StringConcatenation _builder = new StringConcatenation(); _builder.append("hello world"); _builder.newLine(); _builder.append("foo"); _builder.newLine(); _builder.append("bar"); String _normalize = this.normalize(_builder); Document _document = new Document(1, _normalize); final Procedure1<Document> _function = (Document it) -> { TextEdit _change = this.change(null, null, " foo "); Assert.assertEquals(" foo ", it.applyChanges( Collections.<TextEdit>unmodifiableList(CollectionLiterals.<TextEdit>newArrayList(_change))).getContents()); }; ObjectExtensions.<Document>operator_doubleArrow(_document, _function); }
@Override public CompletableFuture<TestLangLSPExtension.TextOfLineResult> getTextOfLine(final TestLangLSPExtension.TextOfLineParam param) { final Function<ILanguageServerAccess.Context, TestLangLSPExtension.TextOfLineResult> _function = (ILanguageServerAccess.Context ctx) -> { Position _position = new Position(param.line, 0); final int start = ctx.getDocument().getOffSet(_position); Position _position_1 = new Position((param.line + 1), 0); int _offSet = ctx.getDocument().getOffSet(_position_1); int _length = System.lineSeparator().length(); final int end = (_offSet - _length); TestLangLSPExtension.TextOfLineResult _textOfLineResult = new TestLangLSPExtension.TextOfLineResult(); final Procedure1<TestLangLSPExtension.TextOfLineResult> _function_1 = (TestLangLSPExtension.TextOfLineResult it) -> { it.text = ctx.getDocument().getContents().substring(start, end); }; return ObjectExtensions.<TestLangLSPExtension.TextOfLineResult>operator_doubleArrow(_textOfLineResult, _function_1); }; return this.access.<TestLangLSPExtension.TextOfLineResult>doRead(param.uri, _function); }
@Before public void setupConfig() { WizardConfiguration _wizardConfiguration = new WizardConfiguration(); final Procedure1<WizardConfiguration> _function = (WizardConfiguration it) -> { it.setBaseName("org.example.mydsl"); it.setRootLocation(""); LanguageDescriptor _language = it.getLanguage(); final Procedure1<LanguageDescriptor> _function_1 = (LanguageDescriptor it_1) -> { it_1.setName("org.example.mydsl.MyDsl"); it_1.setFileExtensions(LanguageDescriptor.FileExtensions.fromString("mydsl")); }; ObjectExtensions.<LanguageDescriptor>operator_doubleArrow(_language, _function_1); }; WizardConfiguration _doubleArrow = ObjectExtensions.<WizardConfiguration>operator_doubleArrow(_wizardConfiguration, _function); this.config = _doubleArrow; }
public void initialize() { if ((this.injector == null)) { XtextGenerator.LOG.info("Initializing Xtext generator"); new StandaloneSetup().addRegisterGeneratedEPackage("org.eclipse.xtext.common.types.TypesPackage"); this.initializeEncoding(); this.injector = this.createInjector(); this.injector.injectMembers(this); CodeConfig _instance = this.injector.<CodeConfig>getInstance(CodeConfig.class); final Procedure1<CodeConfig> _function = (CodeConfig it) -> { it.initialize(this.injector); }; ObjectExtensions.<CodeConfig>operator_doubleArrow(_instance, _function); this.projectConfig.initialize(this.injector); this.cleaner.initialize(this.injector); this.standaloneSetup.initialize(this.injector); for (final XtextGeneratorLanguage language : this.languageConfigs) { { final Injector languageInjector = this.createLanguageInjector(this.injector, language); language.initialize(languageInjector); } } } }
protected void testRangeFormatting(final Procedure1<? super RangeFormattingConfiguration> configurator) { try { @Extension final RangeFormattingConfiguration configuration = new RangeFormattingConfiguration(); configuration.setFilePath(("MyModel." + this.fileExtension)); configurator.apply(configuration); final FileInfo fileInfo = this.initializeContext(configuration); DocumentRangeFormattingParams _documentRangeFormattingParams = new DocumentRangeFormattingParams(); final Procedure1<DocumentRangeFormattingParams> _function = (DocumentRangeFormattingParams it) -> { String _uri = fileInfo.getUri(); TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(_uri); it.setTextDocument(_textDocumentIdentifier); it.setRange(configuration.getRange()); }; DocumentRangeFormattingParams _doubleArrow = ObjectExtensions.<DocumentRangeFormattingParams>operator_doubleArrow(_documentRangeFormattingParams, _function); final CompletableFuture<List<? extends TextEdit>> changes = this.languageServer.rangeFormatting(_doubleArrow); String _contents = fileInfo.getContents(); final Document result = new Document(1, _contents).applyChanges(ListExtensions.<TextEdit>reverse(CollectionLiterals.<TextEdit>newArrayList(((TextEdit[])Conversions.unwrapArray(changes.get(), TextEdit.class))))); this.assertEquals(configuration.getExpectedText(), result.getContents()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
@Test public void testMavenProjectNames() { StandardProjectConfig _standardProjectConfig = new StandardProjectConfig(); final Procedure1<StandardProjectConfig> _function = (StandardProjectConfig it) -> { it.setBaseName("com.acme"); it.setMavenLayout(true); BundleProjectConfig _runtimeTest = it.getRuntimeTest(); _runtimeTest.setEnabled(true); BundleProjectConfig _eclipsePlugin = it.getEclipsePlugin(); _eclipsePlugin.setEnabled(true); BundleProjectConfig _eclipsePluginTest = it.getEclipsePluginTest(); _eclipsePluginTest.setEnabled(true); }; final StandardProjectConfig cfg = ObjectExtensions.<StandardProjectConfig>operator_doubleArrow(_standardProjectConfig, _function); cfg.initialize(this.injector); Assert.assertEquals("com.acme", cfg.getRuntimeTest().getName()); Assert.assertEquals("com.acme.ui", cfg.getEclipsePluginTest().getName()); }
@Test public void testPlainProjectNames() { StandardProjectConfig _standardProjectConfig = new StandardProjectConfig(); final Procedure1<StandardProjectConfig> _function = (StandardProjectConfig it) -> { it.setBaseName("com.acme"); BundleProjectConfig _runtimeTest = it.getRuntimeTest(); _runtimeTest.setEnabled(true); BundleProjectConfig _eclipsePlugin = it.getEclipsePlugin(); _eclipsePlugin.setEnabled(true); BundleProjectConfig _eclipsePluginTest = it.getEclipsePluginTest(); _eclipsePluginTest.setEnabled(true); }; final StandardProjectConfig cfg = ObjectExtensions.<StandardProjectConfig>operator_doubleArrow(_standardProjectConfig, _function); cfg.initialize(this.injector); Assert.assertEquals("com.acme.tests", cfg.getRuntimeTest().getName()); Assert.assertEquals("com.acme.ui.tests", cfg.getEclipsePluginTest().getName()); }
@Test public void testResponseError() { ResponseMessage _responseMessage = new ResponseMessage(); final Procedure1<ResponseMessage> _function = (ResponseMessage it) -> { it.setJsonrpc("2.0"); it.setId("12"); ResponseError _responseError = new ResponseError(); final Procedure1<ResponseError> _function_1 = (ResponseError it_1) -> { it_1.setCode(ResponseErrorCode.InvalidRequest); it_1.setMessage("Could not parse request."); }; ResponseError _doubleArrow = ObjectExtensions.<ResponseError>operator_doubleArrow(_responseError, _function_1); it.setError(_doubleArrow); }; final ResponseMessage message = ObjectExtensions.<ResponseMessage>operator_doubleArrow(_responseMessage, _function); StringConcatenation _builder = new StringConcatenation(); _builder.append("{"); _builder.newLine(); _builder.append(" "); _builder.append("\"jsonrpc\": \"2.0\","); _builder.newLine(); _builder.append(" "); _builder.append("\"id\": \"12\","); _builder.newLine(); _builder.append(" "); _builder.append("\"error\": {"); _builder.newLine(); _builder.append(" "); _builder.append("\"code\": -32600,"); _builder.newLine(); _builder.append(" "); _builder.append("\"message\": \"Could not parse request.\""); _builder.newLine(); _builder.append(" "); _builder.append("}"); _builder.newLine(); _builder.append("}"); _builder.newLine(); this.assertSerialize(message, _builder); }
@Override public Resource createResource(final URI uri) { JavaResource _get = this.resourceProvider.get(); final Procedure1<JavaResource> _function = (JavaResource it) -> { it.setURI(uri); }; return ObjectExtensions.<JavaResource>operator_doubleArrow(_get, _function); }
private CodeConfig createCodeConfig() { CodeConfig _codeConfig = new CodeConfig(); final Procedure1<CodeConfig> _function = (CodeConfig it) -> { it.setLineDelimiter(this.naming.getLineDelimiter()); it.setFileHeader(this.naming.fileHeader()); }; return ObjectExtensions.<CodeConfig>operator_doubleArrow(_codeConfig, _function); }
private IXtextGeneratorLanguage createLanguage(final Injector generatorInjector) { XtextGeneratorLanguage _xtextGeneratorLanguage = new XtextGeneratorLanguage(); final Procedure1<XtextGeneratorLanguage> _function = (XtextGeneratorLanguage it) -> { it.setGrammarUri(this.languageConfig.getGrammar().eResource().getURI().toString()); it.setResourceSet(this.languageConfig.getGrammar().eResource().getResourceSet()); it.setFileExtensions(IterableExtensions.join(this.languageConfig.getFileExtensions(this.languageConfig.getGrammar()), ",")); generatorInjector.injectMembers(it); it.initialize(this.languageConfig.getGrammar()); }; return ObjectExtensions.<XtextGeneratorLanguage>operator_doubleArrow(_xtextGeneratorLanguage, _function); }
@Override protected ResourceSetImpl createEmptyResourceSet() { ResourceSetImpl _resourceSetImpl = new ResourceSetImpl(); final Procedure1<ResourceSetImpl> _function = (ResourceSetImpl it) -> { it.setURIResourceMap(CollectionLiterals.<URI, Resource>newHashMap()); }; return ObjectExtensions.<ResourceSetImpl>operator_doubleArrow(_resourceSetImpl, _function); }
@Test public void testListUpperBound() { ParameterizedTypeReference _typeRef = this.typeRef(List.class); final Procedure1<ParameterizedTypeReference> _function = (ParameterizedTypeReference it) -> { WildcardTypeReference _newWildcardTypeReference = it.getOwner().newWildcardTypeReference(); final Procedure1<WildcardTypeReference> _function_1 = (WildcardTypeReference it_1) -> { it_1.addUpperBound(this.typeRef(CharSequence.class)); }; WildcardTypeReference _doubleArrow = ObjectExtensions.<WildcardTypeReference>operator_doubleArrow(_newWildcardTypeReference, _function_1); it.addTypeArgument(_doubleArrow); }; this.assertInXtendAndJava(ObjectExtensions.<ParameterizedTypeReference>operator_doubleArrow(_typeRef, _function), "java.util.List<? extends java.lang.CharSequence>"); }
@Test public void testListUpperBounds() { ParameterizedTypeReference _typeRef = this.typeRef(List.class); final Procedure1<ParameterizedTypeReference> _function = (ParameterizedTypeReference it) -> { WildcardTypeReference _newWildcardTypeReference = it.getOwner().newWildcardTypeReference(); final Procedure1<WildcardTypeReference> _function_1 = (WildcardTypeReference it_1) -> { it_1.addUpperBound(this.typeRef(CharSequence.class)); it_1.addUpperBound(this.typeRef(Serializable.class)); }; WildcardTypeReference _doubleArrow = ObjectExtensions.<WildcardTypeReference>operator_doubleArrow(_newWildcardTypeReference, _function_1); it.addTypeArgument(_doubleArrow); }; this.assertInXtendAndJava(ObjectExtensions.<ParameterizedTypeReference>operator_doubleArrow(_typeRef, _function), "java.util.List<? extends java.lang.CharSequence & java.io.Serializable>"); }
@Test public void testListUpperBoundsIncludingObject() { ParameterizedTypeReference _typeRef = this.typeRef(List.class); final Procedure1<ParameterizedTypeReference> _function = (ParameterizedTypeReference it) -> { WildcardTypeReference _newWildcardTypeReference = it.getOwner().newWildcardTypeReference(); final Procedure1<WildcardTypeReference> _function_1 = (WildcardTypeReference it_1) -> { it_1.addUpperBound(this.typeRef(CharSequence.class)); it_1.addUpperBound(this.typeRef(Object.class)); it_1.addUpperBound(this.typeRef(Serializable.class)); }; WildcardTypeReference _doubleArrow = ObjectExtensions.<WildcardTypeReference>operator_doubleArrow(_newWildcardTypeReference, _function_1); it.addTypeArgument(_doubleArrow); }; this.assertInXtendAndJava(ObjectExtensions.<ParameterizedTypeReference>operator_doubleArrow(_typeRef, _function), "java.util.List<? extends java.lang.CharSequence & java.io.Serializable>"); }
@Test public void testListLowerBound() { ParameterizedTypeReference _typeRef = this.typeRef(List.class); final Procedure1<ParameterizedTypeReference> _function = (ParameterizedTypeReference it) -> { WildcardTypeReference _newWildcardTypeReference = it.getOwner().newWildcardTypeReference(); final Procedure1<WildcardTypeReference> _function_1 = (WildcardTypeReference it_1) -> { it_1.setLowerBound(this.typeRef(CharSequence.class)); }; WildcardTypeReference _doubleArrow = ObjectExtensions.<WildcardTypeReference>operator_doubleArrow(_newWildcardTypeReference, _function_1); it.addTypeArgument(_doubleArrow); }; this.assertInXtendAndJava(ObjectExtensions.<ParameterizedTypeReference>operator_doubleArrow(_typeRef, _function), "java.util.List<? super java.lang.CharSequence>"); }
@Test public void testListLowerAndUpperBound() { ParameterizedTypeReference _typeRef = this.typeRef(List.class); final Procedure1<ParameterizedTypeReference> _function = (ParameterizedTypeReference it) -> { WildcardTypeReference _newWildcardTypeReference = it.getOwner().newWildcardTypeReference(); final Procedure1<WildcardTypeReference> _function_1 = (WildcardTypeReference it_1) -> { it_1.setLowerBound(this.typeRef(CharSequence.class)); it_1.addUpperBound(this.typeRef(Serializable.class)); }; WildcardTypeReference _doubleArrow = ObjectExtensions.<WildcardTypeReference>operator_doubleArrow(_newWildcardTypeReference, _function_1); it.addTypeArgument(_doubleArrow); }; this.assertInXtendAndJava(ObjectExtensions.<ParameterizedTypeReference>operator_doubleArrow(_typeRef, _function), "java.util.List<? super java.lang.CharSequence>"); }
@Test public void testFunctionType1() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Function0.class)); final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> { it.setReturnType(this.typeRef(String.class)); it.addTypeArgument(this.typeRef(String.class)); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "()=>java.lang.String"), "org.eclipse.xtext.xbase.lib.Functions$Function0<java.lang.String>"); }
@Test public void testFunctionType2() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Function1.class)); final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> { it.addParameterType(this.typeRef(String.class)); it.addTypeArgument(this.typeRef(Void.class)); it.addTypeArgument(this.typeRef(String.class)); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "(java.lang.String)=>void"), "org.eclipse.xtext.xbase.lib.Functions$Function1<java.lang.Void, java.lang.String>"); }
@Test public void testVarNameConflictingWithParam() { EAttribute _createEAttribute = EcoreFactory.eINSTANCE.createEAttribute(); final Procedure1<EAttribute> _function = (EAttribute it) -> { it.setName("xxx"); }; EAttribute _doubleArrow = ObjectExtensions.<EAttribute>operator_doubleArrow(_createEAttribute, _function); Assert.assertEquals("_xxx", this.fragment.toVarName(_doubleArrow), "xxx"); }
@Test public void testFunctionType6() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Procedure1.class)); final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> { it.addParameterType(this.typeRef(String.class)); it.addTypeArgument(this.typeRef(String.class)); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "(java.lang.String)=>void"), "org.eclipse.xtext.xbase.lib.Procedures$Procedure1<java.lang.String>"); }
@Test public void testFunctionType9() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Readable.class)); final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> { it.addParameterType(this.typeRef(CharBuffer.class)); it.setReturnType(this.typeRef(Integer.TYPE)); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "(java.nio.CharBuffer)=>int"), "java.lang.Readable"); }