Skip to content

Commit

Permalink
one more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cdietrich committed Jul 31, 2024
1 parent 536106a commit c950473
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2015, 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 @@ -35,10 +35,12 @@ class CompilerBug457350Test extends AbstractXtendCompilerTest {
public void test() {
final Runnable _function = new Runnable() {
final Runnable _self = this;
@Override
public void run() {
new Runnable() {
@Override
public void run() {
_self.run();
Runnable.super.run();
this.run();
}
};
Expand Down Expand Up @@ -70,21 +72,21 @@ class CompilerBug457350Test extends AbstractXtendCompilerTest {
@SuppressWarnings("all")
public class Test {
public void test() {
final Procedure1<Object> _function = new Procedure1<Object>() {
public void apply(final Object it) {
final Runnable _function = new Runnable() {
final Runnable _self = this;
public void run() {
new Runnable() {
public void run() {
_self.run();
this.run();
}
};
}
};
final Runnable r1 = _function;
}
final Procedure1<Object> _function = (Object it) -> {
final Runnable _function_1 = new Runnable() {
final Runnable _self = this;
@Override
public void run() {
new Runnable() {
@Override
public void run() {
Runnable.super.run();
this.run();
}
};
}
};
final Runnable r1 = _function_1;
};
_function.apply(null);
}
Expand Down Expand Up @@ -112,8 +114,10 @@ class CompilerBug457350Test extends AbstractXtendCompilerTest {
public void test() {
new Runnable() {
final Runnable _this = this;
@Override
public void run() {
final Runnable _function = new Runnable() {
@Override
public void run() {
this.run();
_this.run();
Expand Down Expand Up @@ -153,8 +157,10 @@ class CompilerBug457350Test extends AbstractXtendCompilerTest {
}
new __Test_1() {
@Override
public void run() {
final Runnable _function = new Runnable() {
@Override
public void run() {
this.run();
_this__Test_1.run();
Expand Down Expand Up @@ -192,21 +198,21 @@ class CompilerBug457350Test extends AbstractXtendCompilerTest {
@SuppressWarnings("all")
public class Test {
public void test() {
final Function1<Object, Runnable> _function = new Function1<Object, Runnable>() {
public Runnable apply(final Object it) {
return new Runnable() {
final Runnable _this = this;
public void run() {
final Runnable _function = new Runnable() {
public void run() {
this.run();
_this.run();
}
};
final Runnable r1 = _function;
}
};
}
final Function1<Object, Runnable> _function = (Object it) -> {
return new Runnable() {
final Runnable _this = this;
@Override
public void run() {
final Runnable _function = new Runnable() {
@Override
public void run() {
this.run();
_this.run();
}
};
final Runnable r1 = _function;
}
};
};
_function.apply(null);
}
Expand Down Expand Up @@ -234,14 +240,13 @@ class CompilerBug457350Test extends AbstractXtendCompilerTest {
@SuppressWarnings("all")
public class Test extends SuperFoo {
public void test() {
final Runnable _function = new Runnable() {
public void run() {
new Runnable() {
public void run() {
Test.super.bar();
}
};
}
final Runnable _function = () -> {
new Runnable() {
@Override
public void run() {
Test.super.bar();
}
};
};
final Runnable r1 = _function;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2015, 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 @@ -68,16 +68,22 @@ public void testBug457350_01() {
_builder_1.append("final Runnable _self = this;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("new Runnable() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("_self.run();");
_builder_1.append("Runnable.super.run();");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("this.run();");
Expand Down Expand Up @@ -154,49 +160,49 @@ public void testBug457350_02() {
_builder_1.append("public void test() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("final Procedure1<Object> _function = new Procedure1<Object>() {");
_builder_1.append("final Procedure1<Object> _function = (Object it) -> {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void apply(final Object it) {");
_builder_1.append("final Runnable _function_1 = new Runnable() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("final Runnable _function = new Runnable() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("final Runnable _self = this;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("new Runnable() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("_self.run();");
_builder_1.append(" ");
_builder_1.append("Runnable.super.run();");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("this.run();");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("};");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("};");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("final Runnable r1 = _function;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("}");
_builder_1.append("final Runnable r1 = _function_1;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("};");
Expand Down Expand Up @@ -264,12 +270,18 @@ public void testBug457350_03() {
_builder_1.append("final Runnable _this = this;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("final Runnable _function = new Runnable() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append(" ");
Expand Down Expand Up @@ -367,12 +379,18 @@ public void testBug457350_04() {
_builder_1.append("new __Test_1() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("final Runnable _function = new Runnable() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append(" ");
Expand Down Expand Up @@ -463,49 +481,49 @@ public void testBug457350_05() {
_builder_1.append("public void test() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("final Function1<Object, Runnable> _function = new Function1<Object, Runnable>() {");
_builder_1.append("final Function1<Object, Runnable> _function = (Object it) -> {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public Runnable apply(final Object it) {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("return new Runnable() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("final Runnable _this = this;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("final Runnable _function = new Runnable() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("this.run();");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("_this.run();");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("};");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("final Runnable r1 = _function;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("}");
_builder_1.append("final Runnable r1 = _function;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("};");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("}");
_builder_1.append("};");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("};");
Expand Down Expand Up @@ -571,28 +589,25 @@ public void testBug457350_06() {
_builder_1.append("public void test() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("final Runnable _function = new Runnable() {");
_builder_1.append("final Runnable _function = () -> {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.append("new Runnable() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("new Runnable() {");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append(" ");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("Test.super.bar();");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("}");
_builder_1.append("Test.super.bar();");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("};");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("}");
_builder_1.append("};");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("};");
Expand Down

0 comments on commit c950473

Please sign in to comment.