Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated Xtend generated classes #3003

Merged
merged 1 commit into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
*/
package org.eclipse.xtend.core.tests.formatting;

import java.util.function.Consumer;
import org.eclipse.xtend.core.tests.RuntimeInjectorProvider;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.preferences.MapBasedPreferenceValues;
import org.eclipse.xtext.testing.InjectWith;
import org.eclipse.xtext.testing.XtextRunner;
import org.eclipse.xtext.testing.formatter.AbstractFormatterTest;
import org.eclipse.xtext.xbase.formatting2.XbaseFormatterPreferenceKeys;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -42,7 +42,7 @@ public void formatSingleMember() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down Expand Up @@ -78,7 +78,7 @@ public void formatMultiMember() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down Expand Up @@ -106,7 +106,7 @@ public void formatTypeParam() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down Expand Up @@ -166,7 +166,7 @@ public void formatNested() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
*/
package org.eclipse.xtend.core.tests.formatting;

import java.util.function.Consumer;
import org.eclipse.xtend.core.tests.RuntimeInjectorProvider;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.preferences.MapBasedPreferenceValues;
import org.eclipse.xtext.testing.InjectWith;
import org.eclipse.xtext.testing.XtextRunner;
import org.eclipse.xtext.testing.formatter.AbstractFormatterTest;
import org.eclipse.xtext.xbase.formatting2.XbaseFormatterPreferenceKeys;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -155,7 +155,7 @@ public void formatBraces_01() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand All @@ -173,7 +173,7 @@ public void formatBraces_02() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package org.eclipse.xtend.core.tests.formatting;

import java.util.function.Consumer;
import org.eclipse.xtend.core.formatting2.XtendFormatterPreferenceKeys;
import org.eclipse.xtend.core.tests.RuntimeInjectorProvider;
import org.eclipse.xtend2.lib.StringConcatenation;
Expand Down Expand Up @@ -61,7 +62,7 @@ public void formatClassSingleAnnotationSL() {
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations, Boolean.valueOf(false));
it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
};
Expand All @@ -80,7 +81,7 @@ public void formatClassSingleAnnotationML1() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations, Boolean.valueOf(false));
it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
};
Expand Down Expand Up @@ -117,7 +118,7 @@ public void formatClassSingleAnnotationML2() {
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations, Boolean.valueOf(true));
it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
};
Expand Down Expand Up @@ -586,18 +587,26 @@ public void formatAnnotationStringConcatenation() {
}

private void assertFormattedMember(final String expectation, final CharSequence toBeFormatted) {
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XtendFormatterPreferenceKeys.keepOneLineMethods, Boolean.valueOf(false));
};
this.assertFormattedTo(this.toMember(toBeFormatted), this.toMember(expectation), _function);
}

private void assertFormattedMember(final Procedure1<? super MapBasedPreferenceValues> cfg, final String expectation, final CharSequence toBeFormatted) {
this.assertFormattedTo(this.toMember(toBeFormatted), this.toMember(expectation), ((Procedure1<MapBasedPreferenceValues>)cfg));
this.assertFormattedTo(this.toMember(toBeFormatted), this.toMember(expectation), new Consumer<MapBasedPreferenceValues>() {
public void accept(MapBasedPreferenceValues t) {
cfg.apply(t);
}
});
}

private void assertFormattedMember(final Procedure1<? super MapBasedPreferenceValues> cfg, final String expectation) {
this.assertUnformattedEqualsFormatted(this.toMember(expectation), ((Procedure1<MapBasedPreferenceValues>)cfg));
this.assertUnformattedEqualsFormatted(this.toMember(expectation), new Consumer<MapBasedPreferenceValues>() {
public void accept(MapBasedPreferenceValues t) {
cfg.apply(t);
}
});
}

private CharSequence toMember(final CharSequence expression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package org.eclipse.xtend.core.tests.formatting;

import java.util.function.Consumer;
import org.eclipse.xtend.core.tests.RuntimeInjectorProvider;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.formatting2.FormatterPreferenceKeys;
Expand All @@ -16,7 +17,6 @@
import org.eclipse.xtext.testing.XtextRunner;
import org.eclipse.xtext.testing.formatter.AbstractFormatterTest;
import org.eclipse.xtext.xbase.formatting2.XbaseFormatterPreferenceKeys;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -37,7 +37,7 @@ public void formatConstructor01() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand All @@ -61,7 +61,7 @@ public void formatConstructor02() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down Expand Up @@ -384,7 +384,7 @@ public void formatMethod01() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand All @@ -411,7 +411,7 @@ public void formatMethod02() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down Expand Up @@ -477,7 +477,7 @@ public void formatMethod3() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Integer>put(FormatterPreferenceKeys.maxLineWidth, Integer.valueOf(80));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
*/
package org.eclipse.xtend.core.tests.formatting;

import java.util.function.Consumer;
import org.eclipse.xtend.core.tests.RuntimeInjectorProvider;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.preferences.MapBasedPreferenceValues;
import org.eclipse.xtext.testing.InjectWith;
import org.eclipse.xtext.testing.XtextRunner;
import org.eclipse.xtext.testing.formatter.AbstractFormatterTest;
import org.eclipse.xtext.xbase.formatting2.XbaseFormatterPreferenceKeys;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand Down Expand Up @@ -111,7 +111,7 @@ public void formatBraces_02() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package org.eclipse.xtend.core.tests.formatting;

import java.util.function.Consumer;
import org.eclipse.xtend.core.formatting2.XtendFormatterPreferenceKeys;
import org.eclipse.xtend.core.tests.RuntimeInjectorProvider;
import org.eclipse.xtend2.lib.StringConcatenation;
Expand All @@ -17,7 +18,6 @@
import org.eclipse.xtext.testing.XtextRunner;
import org.eclipse.xtext.testing.formatter.AbstractFormatterTest;
import org.eclipse.xtext.xbase.formatting2.XbaseFormatterPreferenceKeys;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -35,7 +35,7 @@ public void formatClass11() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand All @@ -53,7 +53,7 @@ public void formatClass12() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand All @@ -72,7 +72,7 @@ public void formatClass112() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand All @@ -93,7 +93,7 @@ public void formatClass122() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down Expand Up @@ -162,7 +162,7 @@ public void formatClass3() {
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XtendFormatterPreferenceKeys.keepOneLineMethods, Boolean.valueOf(false));
};
this.assertFormattedTo(_builder, _builder_1, _function);
Expand Down Expand Up @@ -195,7 +195,7 @@ public void formatClass31() {
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XtendFormatterPreferenceKeys.keepOneLineMethods, Boolean.valueOf(false));
};
this.assertFormattedTo(_builder, _builder_1, _function);
Expand Down Expand Up @@ -274,7 +274,7 @@ public void formatClass4() {
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XtendFormatterPreferenceKeys.keepOneLineMethods, Boolean.valueOf(false));
};
this.assertFormattedTo(_builder, _builder_1, _function);
Expand Down Expand Up @@ -441,7 +441,7 @@ public void formatPreferencesExample() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Integer>put(FormatterPreferenceKeys.maxLineWidth, Integer.valueOf(80));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down Expand Up @@ -496,7 +496,7 @@ public void formatPreferencesExample_02() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Integer>put(FormatterPreferenceKeys.maxLineWidth, Integer.valueOf(80));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package org.eclipse.xtend.core.tests.formatting;

import java.util.function.Consumer;
import org.eclipse.xtend.core.formatting2.XtendFormatterPreferenceKeys;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.formatting2.FormatterPreferenceKeys;
Expand Down Expand Up @@ -375,7 +376,7 @@ public void testBug398625() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Integer>put(FormatterPreferenceKeys.maxLineWidth, Integer.valueOf(80));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down Expand Up @@ -404,7 +405,7 @@ public void testBug398625_2() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Integer>put(FormatterPreferenceKeys.maxLineWidth, Integer.valueOf(80));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down Expand Up @@ -459,7 +460,7 @@ public void testBug398625_3() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Integer>put(FormatterPreferenceKeys.maxLineWidth, Integer.valueOf(80));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand Down Expand Up @@ -639,7 +640,7 @@ public void testBug_xtext_xtend_194() {
_builder.newLine();
_builder.append("}");
_builder.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Integer>put(FormatterPreferenceKeys.maxLineWidth, Integer.valueOf(80));
};
this.assertUnformattedEqualsFormatted(_builder, _function);
Expand All @@ -661,7 +662,7 @@ public void testBug455582() {
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
final Consumer<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XtendFormatterPreferenceKeys.keepOneLineMethods, Boolean.valueOf(false));
};
this.assertFormattedTo(_builder, _builder_1, _function);
Expand Down
Loading
Loading