Merge remote-tracking branch 'remotes/origin/pdolgov/moveReturnToComputation'

This commit is contained in:
Pavel Dolgov
2016-09-07 17:21:40 +03:00
118 changed files with 2453 additions and 0 deletions
@@ -0,0 +1,19 @@
// "Move 'return' closer to computation of the value of 's'" "true"
import java.io.*;
class T {
private static String getString() throws IOException {
String s;
try (BufferedReader reader = open()) {
while (true) {
s = reader.readLine();
if (s == null || s.startsWith("$")) {
return s;
}
}
}
}
private static BufferedReader open() throws FileNotFoundException {
return null;
}
}
@@ -0,0 +1,21 @@
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f() {
String r = "";
do {
if (!hasNext()) return r;
String s = next();
if (s != null) {
return s;
}
} while (true);
}
boolean hasNext() {
return true;
}
String next() {
return null;
}
}
@@ -0,0 +1,17 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a[]) {
int n = 0;
for (int i=0; i<a.length; i++) {
if (n < a[i]) n = a[i];
if (n > 100) {
return n; // at the end 1
}
if (n < 0) {
return 0; // at the end 2
/* inline */
}
}
return n;
}
}
@@ -0,0 +1,11 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n = -1;
for(int i=0;; i++) {
if (i % 127 == 0 && i % 129 == 0) {
return i + 1;
}
}
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 'raw'" "true"
import java.util.*;
class T {
List<String> f(boolean b) {
List raw = null;
if (b) {
return g();
}
return raw;
}
List<String> g() {
return Collections.singletonList("");
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 's'" "true"
class T {
String f(String a) {
String s = a;
if (s == null) {
return ""; /* return comment */ // end of line
}
else if (s.startsWith("@")) {
return s.substring(1); // return comment
}
else if (s.startsWith("#")) {
return "#"; /* return comment */ /* inline */
}
return s; // return comment
}
}
@@ -0,0 +1,12 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
if (b) {
return 1;
}
else {
throw new RuntimeException();
}
}
}
@@ -0,0 +1,8 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
if (b) return 1;
else return 2;
}
}
@@ -0,0 +1,9 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
if (b) System.out.println("yes");
else return 2;
return n;
}
}
@@ -0,0 +1,9 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
if (b) return 1;
else System.out.println("no");
return n;
}
}
@@ -0,0 +1,12 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
if (b) {
throw new RuntimeException();
}
else {
return 2;
}
}
}
@@ -0,0 +1,26 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b, boolean c) {
int n = -1;
if (b) {
try {
return g();
}
catch (RuntimeException e) {
d(e);
}
}
else {
return 2;
}
return n;
}
int g() {
return 1;
}
void d(Exception e) {
e.printStackTrace()
}
}
@@ -0,0 +1,12 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n;
myLabel:
{
n = 1;
if (b) return n;
return 2;
}
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a) {
int n = -1;
myLabel:
for (int i = 0; i < a.length; i++) {
if (a[0] == 0) {
return i;
}
}
return n;
}
}
@@ -0,0 +1,12 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a) {
int n = -1;
myLabel:
for (int i = 0; i < a.length; i++) {
n = i;
if (a[0] == 0) return n;
}
return n;
}
}
@@ -0,0 +1,15 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[][] a) {
int n = -1;
myLabel:
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[i].length; j++) {
if (a[i][j] == 0) {
return j;
}
}
}
return n;
}
}
@@ -0,0 +1,17 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[][] a) {
int n = -1;
myLabel:
for (int i = 0; i < a.length; i++) {
if (a[i].length == 0) {
return -i - 1;
}
for(int j = 0; j < a[i].length; j++) {
n = j;
if (a[i][j] == 0) return n;
}
}
return n;
}
}
@@ -0,0 +1,9 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
myLabel:
if (b) return 1;
else return n;
}
}
@@ -0,0 +1,9 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n;
{
return 1;
}
}
}
@@ -0,0 +1,11 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n;
{
n = 1;
System.out.println();
return n;
}
}
}
@@ -0,0 +1,12 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
if (a) {
if (b) {
return 1;
}
}
return n;
}
}
@@ -0,0 +1,11 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
if (a) {
if (b) return 1;
else return 2;
}
return n;
}
}
@@ -0,0 +1,11 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
if (a) {
if (b) return 1;
}
else return 2;
return n;
}
}
@@ -0,0 +1,15 @@
// "Move 'return' closer to computation of the value of 's'" "true"
import java.io.*;
class T {
private static String getString() throws IOException {
String s;
try (BufferedReader r = open()) {
return r.readLine();
}
}
private static BufferedReader open() throws FileNotFoundException {
return null;
}
}
@@ -0,0 +1,25 @@
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String a) {
String r = "";
int i = 0;
do {
int j = a.indexOf(",", i);
String s = j > i ? a.substring(i, j) : a.substring(i);
if (s.startsWith("@")) {
return s;
}
i = j + 1;
}
while (i >= 0);
return r;
}
boolean hasNext() {
return true;
}
String next() {
return null;
}
}
@@ -0,0 +1,12 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a, int b) {
int n = -1;
for (int i = 0; i < a.length; i++) {
if (a[i] == b) {
return i;
}
}
return n;
}
}
@@ -0,0 +1,12 @@
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String[] a) {
String r = "";
for (String s : a) {
if (s != null && s.contains("@")) {
return s + ":" + s.length();
}
}
return r;
}
}
@@ -0,0 +1,8 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
if (b) return 1;
return n;
}
}
@@ -0,0 +1,11 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = g();
if (b) return 1;
return n;
}
int g() {
return 0;
}
}
@@ -0,0 +1,8 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b, int d) {
int n = d;
if (b) return 1;
return n;
}
}
@@ -0,0 +1,21 @@
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f() {
String r = "";
while (hasNext()) {
String s = next();
if (s != null) {
return s;
}
}
return r;
}
boolean hasNext() {
return true;
}
String next() {
return null;
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
return 2;
case 2:
return 4;
}
return n;
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
return 2;
case 2:
return 4;
}
return n;
}
}
@@ -0,0 +1,14 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
return 2;
case 2:
return 4;
default:
return 0;
}
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
return 2;
case 2:
return 4;
default:
return 0;
case 0:
}
return n;
}
}
@@ -0,0 +1,14 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
return 2;
default:
return 0;
case 2:
return 4;
}
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
try {
n = 1;
if (b) {
throw new RuntimeException();
}
return n;
}
catch (RuntimeException e) {
return 2;
}
}
}
@@ -0,0 +1,24 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
int f(boolean b, boolean c) {
int n = -1;
try {
n = 1;
if (b) throw new IOException();
n = 2;
if (c) throw new RuntimeException();
return n;
}
catch (IOException e) {
throw new RuntimeException(e);
}
catch (RuntimeException e) {
return 3;
}
finally {
System.out.println();
}
}
}
@@ -0,0 +1,24 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
int f(boolean b, boolean c) {
int n = -1;
try {
n = 1;
if (b) throw new IOException();
n = 2;
if (c) throw new RuntimeException();
return n;
}
catch (IOException e) {
throw new RuntimeException(e);
}
catch (RuntimeException e) {
return 3;
}
finally {
System.out.println();
}
}
}
@@ -0,0 +1,24 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
int f(boolean b, boolean c) {
int n = -1;
try {
n = 1;
if (b) throw new IOException();
n = 2;
if (c) throw new RuntimeException();
return n;
}
catch (IOException e) {
throw new RuntimeException(e);
}
catch (RuntimeException e) {
return 3;
}
finally {
return 4;
}
}
}
@@ -0,0 +1,24 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
int f(boolean b, boolean c, boolean d) {
int n = -1;
try {
n = 1;
if (b) throw new IOException();
n = 2;
if (c) throw new RuntimeException();
return n;
}
catch (IOException e) {
throw new RuntimeException(e);
}
catch (RuntimeException e) {
return 3;
}
finally {
if(d) return 4;
}
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
try {
n = 1;
if (b) {
throw new RuntimeException();
}
return n;
}
catch (RuntimeException e) {
throw new RuntimeException(e);
}
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
try {
n = 1;
if (b) {
throw new RuntimeException();
}
return n;
}
catch (RuntimeException e) {
return 2;
}
}
}
@@ -0,0 +1,23 @@
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String p) {
String r = null;
try {
while (true) {
String n = next();
if (n != null) {
String t = n.toLowerCase();
if (t.equals(p)) {
return n;
}
}
}
} finally {
System.out.println();
}
}
String next() {
return "";
}
}
@@ -0,0 +1,24 @@
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String p) {
String r = null;
try {
while (true) {
String n = next();
if (n != null) return r;
if ("@".eqals(n)) {
String t = n.toLowerCase();
if (t.equals(p)) {
return n;
}
}
}
} finally {
System.out.println();
}
}
String next() {
return "";
}
}
@@ -0,0 +1,14 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
while (true) {
n = g();
if(n != 0) return n;
}
}
int g() {
return 1;
}
}
@@ -0,0 +1,15 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
while (n <= 0) {
n = g();
if (n != 0) return n;
}
return n;
}
int g() {
return 1;
}
}
@@ -0,0 +1,20 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
int t = a;
while (t != null) {
if (t == 1) {
return 10;
}
else if (t == 2) {
return 20;
}
else {
t = t + 1;
continue;
}
}
return n;
}
}
@@ -0,0 +1,15 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
while (true) {
n = g();
if(n == 0) continue;
else return n;
}
}
int g() {
return 1;
}
}
@@ -0,0 +1,15 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
while (true) {
n = g();
if(n == 0) continue;
return n;
}
}
int g() {
return 1;
}
}
@@ -0,0 +1,14 @@
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
long f() {
long r;
long s = System.currentTimeMillis();
long t = s;
while (true) {
t = System.currentTimeMillis();
if (t - s > 100) {
return t;
}
}
}
}
@@ -0,0 +1,8 @@
// "Move 'return' closer to computation of the value of 'n'" "false"
class T {
int f(int a) {
int n = a;
assert n != 0;
r<caret>eturn n;
}
}
@@ -0,0 +1,15 @@
// "Move 'return' closer to computation of the value of 'n'" "false"
class T {
int x;
int y;
int f(int a) {
int n = -1;
if (a != 0) {
n = a;
n = 31 * x + n;
n = 31 * y + n;
}
re<caret>turn n;
}
}
@@ -0,0 +1,20 @@
// "Move 'return' closer to computation of the value of 's'" "true"
import java.io.*;
class T {
private static String getString() throws IOException {
String s;
try (BufferedReader reader = open()) {
while (true) {
s = reader.readLine();
if (s == null || s.startsWith("$")) {
break;
}
}
}
r<caret>eturn s;
}
private static BufferedReader open() throws FileNotFoundException {
return null;
}
}
@@ -0,0 +1,23 @@
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f() {
String r = "";
do {
if (!hasNext()) break;
String s = next();
if (s != null) {
r = s;
break;
}
} while (true);
<caret>return r;
}
boolean hasNext() {
return true;
}
String next() {
return null;
}
}
@@ -0,0 +1,17 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a[]) {
int n = 0;
for (int i=0; i<a.length; i++) {
if (n < a[i]) n = a[i];
if (n > 100) {
break; // at the end 1
}
if (n < 0) {
n = 0; // at the end 2
break; /* inline */
}
}
ret<caret>urn n;
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n = -1;
for(int i=0;; i++) {
if (i % 127 == 0 && i % 129 == 0) {
n = i + 1;
break;
}
}
r<caret>eturn n;
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 'raw'" "true"
import java.util.*;
class T {
List<String> f(boolean b) {
List raw = null;
if (b) {
raw = g();
}
re<caret>turn raw;
}
List<String> g() {
return Collections.singletonList("");
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 'raw'" "false"
import java.util.*;
class T {
List<Object> f(boolean b) {
List raw = null;
if (b) {
raw = g();
}
re<caret>turn raw;
}
List<String> g() {
return Collections.singletonList("");
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'result'" "false"
class T {
int size;
int width;
int height;
public int hashCode() {
int result = size;
result = 31 * result + width;
result = 31 * result + height;
ret<caret>urn result;
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 's'" "true"
class T {
String f(String a) {
String s = a;
if (s == null) {
s = ""; // end of line
}
else if (s.startsWith("@")) {
s = s.substring(1);
}
else if (s.startsWith("#")) {
s = "#"; /* inline */
}
ret<caret>urn s; // return comment
}
}
@@ -0,0 +1,9 @@
// "Move 'return' closer to computation of the value of 'n'" "false"
class T {
int f(boolean b) {
int n = 0;
if (b) System.out.println("yes");
else System.out.println("no");
ret<caret>urn n;
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
if (b) {
n = 1;
}
else {
throw new RuntimeException();
}
r<caret>eturn n;
}
}
@@ -0,0 +1,9 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
if (b) n = 1;
else n = 2;
r<caret>eturn n;
}
}
@@ -0,0 +1,9 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
if (b) System.out.println("yes");
else n = 2;
r<caret>eturn n;
}
}
@@ -0,0 +1,9 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
if (b) n = 1;
else System.out.println("no");
ret<caret>urn n;
}
}
@@ -0,0 +1,10 @@
// "Move 'return' closer to computation of the value of 'n'" "false"
class T {
int f(boolean b) {
int n = -1;
if (b) {
throw new RuntimeException();
}
r<caret>eturn n;
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
if (b) {
throw new RuntimeException();
}
else {
n = 2;
}
r<caret>eturn n;
}
}
@@ -0,0 +1,26 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b, boolean c) {
int n = -1;
if (b) {
try {
n = g();
}
catch (RuntimeException e) {
d(e);
}
}
else {
n = 2;
}
r<caret>eturn n;
}
int g() {
return 1;
}
void d(Exception e) {
e.printStackTrace()
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n;
myLabel:
{
n = 1;
if (b) break myLabel;
n = 2;
}
ret<caret>urn n;
}
}
@@ -0,0 +1,14 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a) {
int n = -1;
myLabel:
for (int i = 0; i < a.length; i++) {
if (a[0] == 0) {
n = i;
break myLabel;
}
}
re<caret>turn n;
}
}
@@ -0,0 +1,12 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a) {
int n = -1;
myLabel:
for (int i = 0; i < a.length; i++) {
n = i;
if (a[0] == 0) break myLabel;
}
re<caret>turn n;
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[][] a) {
int n = -1;
myLabel:
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[i].length; j++) {
if (a[i][j] == 0) {
n = j;
break myLabel;
}
}
}
re<caret>turn n;
}
}
@@ -0,0 +1,18 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[][] a) {
int n = -1;
myLabel:
for (int i = 0; i < a.length; i++) {
if (a[i].length == 0) {
n = -i - 1;
break myLabel;
}
for(int j = 0; j < a[i].length; j++) {
n = j;
if (a[i][j] == 0) break myLabel;
}
}
re<caret>turn n;
}
}
@@ -0,0 +1,10 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
myLabel:
if (b) n = 1;
else break myLabel;
ret<caret>urn n;
}
}
@@ -0,0 +1,10 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n;
{
n = 1;
}
ret<caret>urn n;
}
}
@@ -0,0 +1,11 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f() {
int n;
{
n = 1;
System.out.println();
}
re<caret>turn n;
}
}
@@ -0,0 +1,12 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
if (a) {
if (b) {
n = 1;
}
}
ret<caret>urn n;
}
}
@@ -0,0 +1,11 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
if (a) {
if (b) n = 1;
else n = 2;
}
r<caret>eturn n;
}
}
@@ -0,0 +1,11 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean a, boolean b) {
int n = -1;
if (a) {
if (b) n = 1;
}
else n = 2;
re<caret>turn n;
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 's'" "true"
import java.io.*;
class T {
private static String getString() throws IOException {
String s;
try (BufferedReader r = open()) {
s = r.readLine();
}
re<caret>turn s;
}
private static BufferedReader open() throws FileNotFoundException {
return null;
}
}
@@ -0,0 +1,10 @@
// "Move 'return' closer to computation of the value of 'r'" "false"
class T {
int[] f(boolean b) {
int[] r = new int[]{-1};
if (b) {
r[0] = 1;
}
re<caret>turn r;
}
}
@@ -0,0 +1,26 @@
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String a) {
String r = "";
int i = 0;
do {
int j = a.indexOf(",", i);
String s = j > i ? a.substring(i, j) : a.substring(i);
if (s.startsWith("@")) {
r = s;
break;
}
i = j + 1;
}
while (i >= 0);
retu<caret>rn r;
}
boolean hasNext() {
return true;
}
String next() {
return null;
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int[] a, int b) {
int n = -1;
for (int i = 0; i < a.length; i++) {
if (a[i] == b) {
n = i;
break;
}
}
r<caret>eturn n;
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f(String[] a) {
String r = "";
for (String s : a) {
if (s != null && s.contains("@")) {
r = s + ":" + s.length();
break;
}
}
r<caret>eturn r;
}
}
@@ -0,0 +1,8 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = 0;
if (b) n = 1;
re<caret>turn n;
}
}
@@ -0,0 +1,11 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = g();
if (b) n = 1;
re<caret>turn n;
}
int g() {
return 0;
}
}
@@ -0,0 +1,8 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b, int d) {
int n = d;
if (b) n = 1;
re<caret>turn n;
}
}
@@ -0,0 +1,22 @@
// "Move 'return' closer to computation of the value of 'r'" "true"
class T {
String f() {
String r = "";
while (hasNext()) {
String s = next();
if (s != null) {
r = s;
break;
}
}
re<caret>turn r;
}
boolean hasNext() {
return true;
}
String next() {
return null;
}
}
@@ -0,0 +1,15 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
n = 2;
break;
case 2:
n = 4;
break;
}
r<caret>eturn n;
}
}
@@ -0,0 +1,14 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
n = 2;
break;
case 2:
n = 4;
}
ret<caret>urn n;
}
}
@@ -0,0 +1,17 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
n = 2;
break;
case 2:
n = 4;
break;
default:
n = 0;
}
ret<caret>urn n;
}
}
@@ -0,0 +1,19 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
n = 2;
break;
case 2:
n = 4;
break;
default:
n = 0;
break;
case 0:
}
re<caret>turn n;
}
}
@@ -0,0 +1,17 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int a) {
int n = -1;
switch (a) {
case 1:
n = 2;
break;
default:
n = 0;
break;
case 2:
n = 4;
}
ret<caret>urn n;
}
}
@@ -0,0 +1,16 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(boolean b) {
int n = -1;
try {
n = 1;
if (b) {
throw new RuntimeException();
}
}
catch (RuntimeException e) {
n = 2;
}
re<caret>turn n;
}
}
@@ -0,0 +1,24 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
int f(boolean b, boolean c) {
int n = -1;
try {
n = 1;
if (b) throw new IOException();
n = 2;
if (c) throw new RuntimeException();
}
catch (IOException e) {
throw new RuntimeException(e);
}
catch (RuntimeException e) {
return 3;
}
finally {
System.out.println();
}
re<caret>turn n;
}
}
@@ -0,0 +1,24 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
int f(boolean b, boolean c) {
int n = -1;
try {
n = 1;
if (b) throw new IOException();
n = 2;
if (c) throw new RuntimeException();
}
catch (IOException e) {
throw new RuntimeException(e);
}
catch (RuntimeException e) {
n = 3;
}
finally {
System.out.println();
}
re<caret>turn n;
}
}
@@ -0,0 +1,24 @@
// "Move 'return' closer to computation of the value of 'n'" "false"
import java.io.*;
class T {
int f(boolean b, boolean c) {
int n = -1;
try {
n = 1;
if (b) throw new IOException();
n = 2;
if (c) throw new RuntimeException();
}
catch (IOException e) {
throw new RuntimeException(e);
}
catch (RuntimeException e) {
n = 3;
}
finally {
n = 4;
}
re<caret>turn n;
}
}
@@ -0,0 +1,24 @@
// "Move 'return' closer to computation of the value of 'n'" "false"
import java.io.*;
class T {
int f(boolean b, boolean c) {
int n = -1;
try {
n = 1;
if (b) throw new IOException();
n = 2;
if (c) throw new RuntimeException();
}
catch (IOException e) {
throw new RuntimeException(e);
}
catch (RuntimeException e) {
n = 3;
}
finally {
System.out.println(n);
}
re<caret>turn n;
}
}
@@ -0,0 +1,24 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
import java.io.*;
class T {
int f(boolean b, boolean c) {
int n = -1;
try {
n = 1;
if (b) throw new IOException();
n = 2;
if (c) throw new RuntimeException();
}
catch (IOException e) {
throw new RuntimeException(e);
}
catch (RuntimeException e) {
n = 3;
}
finally {
return 4;
}
re<caret>turn n;
}
}

Some files were not shown because too many files have changed in this diff Show More