Skip to content

Commit

Permalink
another round
Browse files Browse the repository at this point in the history
  • Loading branch information
cdietrich committed Jul 31, 2024
1 parent f3ba2ec commit 1c59f9c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2013, 2024 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
Expand Down Expand Up @@ -34,6 +34,7 @@ class CompilerBug419688Test extends AbstractXtendCompilerTest {
super();
}
@Override
public D m() {
return super.m();
}
Expand All @@ -60,6 +61,7 @@ class CompilerBug419688Test extends AbstractXtendCompilerTest {
super();
}
@Override
public Iterable<D> m() {
return super.m();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2014, 2024 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
Expand Down Expand Up @@ -60,13 +60,11 @@ class CompilerBug440196Test extends AbstractXtendCompilerTest {
@SuppressWarnings("all")
public class C {
public Boolean m() {
final Function0<Boolean> _function = new Function0<Boolean>() {
public Boolean apply() {
if ((Boolean.TRUE).booleanValue()) {
return true;
}
return null;
final Function0<Boolean> _function = () -> {
if ((Boolean.TRUE).booleanValue()) {
return true;
}
return null;
};
return _function.apply();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,14 @@ class CompilerBugProtectedVisibilityTest extends AbstractXtendCompilerTest {
}
}
'''.assertCompilesTo('''
@SuppressWarnings("all")
public class B {
private C c = new C();
import testdata.ClazzWithProtectedMember;
protected Object doX(final Runnable r) {
final Runnable _function = () -> {
this.c.protectedMethod();
};
return this.doX(_function);
@SuppressWarnings("all")
public class Sample extends ClazzWithProtectedMember {
public static class ParamClass {
public String doSomething(final Sample c) {
return c.member = "Hello";
}
}
}
''')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2013 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2013, 2024 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
Expand Down Expand Up @@ -58,6 +58,9 @@ public void test_01() {
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public D m() {");
_builder_1.newLine();
_builder_1.append(" ");
Expand Down Expand Up @@ -113,6 +116,9 @@ public void test_02() {
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public Iterable<D> m() {");
_builder_1.newLine();
_builder_1.append(" ");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2014 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2014, 2024 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
Expand Down Expand Up @@ -116,25 +116,19 @@ public void test_02() {
_builder_1.append("public Boolean m() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("final Function0<Boolean> _function = new Function0<Boolean>() {");
_builder_1.append("final Function0<Boolean> _function = () -> {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public Boolean apply() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("if ((Boolean.TRUE).booleanValue()) {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("return true;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("return null;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("}");
_builder_1.append("return null;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("};");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,28 +512,24 @@ public void testExtrasIssue229_02() {
_builder.append("}");
_builder.newLine();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("@SuppressWarnings(\"all\")");
_builder_1.append("import testdata.ClazzWithProtectedMember;");
_builder_1.newLine();
_builder_1.append("public class B {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("private C c = new C();");
_builder_1.append("@SuppressWarnings(\"all\")");
_builder_1.newLine();
_builder_1.append("public class Sample extends ClazzWithProtectedMember {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("protected Object doX(final Runnable r) {");
_builder_1.append("public static class ParamClass {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("final Runnable _function = () -> {");
_builder_1.append("public String doSomething(final Sample c) {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("this.c.protectedMethod();");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("};");
_builder_1.append("return c.member = \"Hello\";");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("return this.doX(_function);");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("}");
Expand Down

0 comments on commit 1c59f9c

Please sign in to comment.