mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
moving tests
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
class A {
|
||||
public void usage() {
|
||||
int array[150];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
method(array[i]);
|
||||
}
|
||||
}
|
||||
public void <caret>method(int i) {
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
public void usage() {
|
||||
int array[150];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
System.out.println(array[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
public class C {
|
||||
public void doSomething() {
|
||||
for (Iterator it = getSomeObjects().iterator(); it.hasNext();) {
|
||||
String text = (String)it.next();
|
||||
System.out.println("text = " + text);
|
||||
}
|
||||
}
|
||||
|
||||
private Collection <caret>getSomeObjects() {
|
||||
final String text = "hello";
|
||||
return getSomeObjects(text);
|
||||
}
|
||||
|
||||
private Collection getSomeObjects(String text) {
|
||||
final List list = new ArrayList();
|
||||
list.add(text);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
public class C {
|
||||
public void doSomething() {
|
||||
final String text1 = "hello";
|
||||
for (Iterator it = getSomeObjects(text1).iterator(); it.hasNext();) {
|
||||
String text = (String)it.next();
|
||||
System.out.println("text = " + text);
|
||||
}
|
||||
}
|
||||
|
||||
private Collection getSomeObjects(String text) {
|
||||
final List list = new ArrayList();
|
||||
list.add(text);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
public class Foo {
|
||||
String getComponent(Integer i) { return null; }
|
||||
Integer myI;
|
||||
|
||||
public void usage() {
|
||||
if (myI != null)
|
||||
method(myI);
|
||||
}
|
||||
|
||||
void me<caret>thod(Integer i) {
|
||||
System.out.println(getComponent(myI) + getComponent(i));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
public class Foo {
|
||||
String getComponent(Integer i) { return null; }
|
||||
Integer myI;
|
||||
|
||||
public void usage() {
|
||||
if (myI != null)
|
||||
System.out.println(getComponent(myI) + getComponent(myI));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
class InlineMethodTest {
|
||||
public static InlineMethodTest createInstance() {
|
||||
return new InlineMethodTest(0);
|
||||
}
|
||||
|
||||
protected <caret>InlineMethodTest(int y) {
|
||||
this("hello world", y);
|
||||
}
|
||||
|
||||
protected InlineMethodTest() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public InlineMethodTest(String text, int i) {
|
||||
}
|
||||
}
|
||||
|
||||
class Derived extends InlineMethodTest {
|
||||
public Derived(int i) {
|
||||
super(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
class InlineMethodTest {
|
||||
public static InlineMethodTest createInstance() {
|
||||
return new InlineMethodTest("hello world", 0);
|
||||
}
|
||||
|
||||
protected InlineMethodTest() {
|
||||
this("hello world", 0);
|
||||
}
|
||||
|
||||
public InlineMethodTest(String text, int i) {
|
||||
}
|
||||
}
|
||||
|
||||
class Derived extends InlineMethodTest {
|
||||
public Derived(int i) {
|
||||
super("hello world", i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class TestInlineMethod {
|
||||
public <caret>TestInlineMethod(String s1, int r1, String s2, int r2) {
|
||||
this(Integer.valueOf(s1, r1), Integer.valueOf(s2, r2));
|
||||
}
|
||||
|
||||
public TestInlineMethod(Integer i1, Integer i2) {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestInlineMethod test = new TestInlineMethod("10", 10, "A", 16);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class TestInlineMethod {
|
||||
|
||||
public TestInlineMethod(Integer i1, Integer i2) {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestInlineMethod test = new TestInlineMethod(Integer.valueOf("10", 10), Integer.valueOf("A", 16));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Test {
|
||||
public int i;
|
||||
|
||||
public int <caret>getI() {
|
||||
return i;
|
||||
}
|
||||
|
||||
public void usage() {
|
||||
int i = getI();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
public int i;
|
||||
|
||||
public void usage() {
|
||||
int i = this.i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
class Test {
|
||||
public static final int ID=0;
|
||||
|
||||
public <caret>Test() {
|
||||
this(ID);
|
||||
}
|
||||
|
||||
public Test(int id) {
|
||||
}
|
||||
}
|
||||
|
||||
class Rest {
|
||||
public static void test() {
|
||||
new Test();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class Test {
|
||||
public static final int ID=0;
|
||||
|
||||
public Test(int id) {
|
||||
}
|
||||
}
|
||||
|
||||
class Rest {
|
||||
public static void test() {
|
||||
new Test(Test.ID);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
public enum EEE {
|
||||
a(<caret>doTest());
|
||||
|
||||
EEE(String s) {
|
||||
}
|
||||
|
||||
private static String doTest() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
public enum EEE {
|
||||
a("");
|
||||
|
||||
EEE(String s) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
public enum EEE {
|
||||
a(<caret>doTest());
|
||||
|
||||
EEE(String s) {
|
||||
}
|
||||
|
||||
private static String doTest() {
|
||||
System.out.println("q");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
public enum EEE {
|
||||
a(new Object() {
|
||||
String evaluate() {
|
||||
System.out.println("q");
|
||||
return "";
|
||||
}
|
||||
}.evaluate());
|
||||
|
||||
EEE(String s) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
public enum EEE {
|
||||
a(<caret>doTest("q"));
|
||||
|
||||
EEE(String s) {
|
||||
}
|
||||
|
||||
private static String doTest(String s) {
|
||||
System.out.println(s);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
public enum EEE {
|
||||
a(new Object() {
|
||||
String evaluate() {
|
||||
System.out.println("q");
|
||||
return "";
|
||||
}
|
||||
}.evaluate());
|
||||
|
||||
EEE(String s) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
enum EnumWithConstructor {
|
||||
Test("1"), Rest("2", "b");
|
||||
|
||||
<caret>EnumWithConstructor(String s) {
|
||||
this(s, "");
|
||||
}
|
||||
|
||||
EnumWithConstructor(String s, String s2) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
enum EnumWithConstructor {
|
||||
Test("1", ""), Rest("2", "b");
|
||||
|
||||
EnumWithConstructor(String s, String s2) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class A{
|
||||
int field = foo();
|
||||
|
||||
int <caret>foo(){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
class A{
|
||||
int field = 1;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
void method(Object x) {
|
||||
String s = null;
|
||||
s = (String) x;
|
||||
toInline(s.length());
|
||||
}
|
||||
void toInli<caret>ne(final int i) {
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
void method(Object x) {
|
||||
String s = null;
|
||||
s = (String) x;
|
||||
System.out.println(s.length());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class Test {
|
||||
void method(Object x) {
|
||||
String s = null;
|
||||
s = (String) x;
|
||||
toInline(s.length());
|
||||
}
|
||||
void toIn<caret>line(final int i) {
|
||||
Runnable r = new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(i);
|
||||
}
|
||||
};
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class Test {
|
||||
void method(Object x) {
|
||||
String s = null;
|
||||
s = (String) x;
|
||||
final int i = s.length();
|
||||
Runnable r = new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(i);
|
||||
}
|
||||
};
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Test {
|
||||
public void foo() {
|
||||
String s = <caret>bar();
|
||||
}
|
||||
|
||||
private String bar() {
|
||||
String result = null;
|
||||
assert result != null;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
public void foo() {
|
||||
String result = null;
|
||||
assert result != null;
|
||||
String s = result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class Tester1 {
|
||||
void caller() {
|
||||
<caret>method();
|
||||
}
|
||||
void method() {
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
other();
|
||||
}
|
||||
};
|
||||
}
|
||||
void other() { }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Tester1 {
|
||||
void caller() {
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
other();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void other() { }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import java.util.*;
|
||||
|
||||
class Foo {
|
||||
public void foo(Bar bar) {
|
||||
for (Iterator it = bar.iterator(); it.hasNext();) {
|
||||
final String o = (String) it.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Bar<CN extends Bar> {
|
||||
private List<CN> cns;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public Iterator<CN> <caret>iterator() {
|
||||
return getCns().iterator();
|
||||
}
|
||||
|
||||
public List<CN> getCns() {
|
||||
if (cns == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return cns;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import java.util.*;
|
||||
|
||||
class Foo {
|
||||
public void foo(Bar bar) {
|
||||
for (Iterator it = bar.getCns().iterator(); it.hasNext();) {
|
||||
final String o = (String) it.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Bar<CN extends Bar> {
|
||||
private List<CN> cns;
|
||||
|
||||
public List<CN> getCns() {
|
||||
if (cns == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return cns;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class Base {
|
||||
protected int f;
|
||||
|
||||
|
||||
public int <caret>getF() {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
class DRV extends Base {
|
||||
void f() {
|
||||
int f1 = getF();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Base {
|
||||
protected int f;
|
||||
|
||||
|
||||
}
|
||||
|
||||
class DRV extends Base {
|
||||
void f() {
|
||||
int f1 = f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
public class Test {
|
||||
public int <caret>foo(int p1, int p2) {
|
||||
p2++;
|
||||
return someMethod(p1, p2);
|
||||
}
|
||||
|
||||
public void use1() {
|
||||
int r = foo(x, y);
|
||||
}
|
||||
|
||||
public void use2() {
|
||||
int r = foo(field1, field1);
|
||||
}
|
||||
|
||||
public void use3() {
|
||||
int r = foo(field2, field2);
|
||||
}
|
||||
|
||||
public void use4() {
|
||||
int r = foo(field3, field3);
|
||||
}
|
||||
|
||||
{
|
||||
field2++;
|
||||
}
|
||||
|
||||
private final int field1;
|
||||
private int field2;
|
||||
private int field3;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
public class Test {
|
||||
|
||||
public void use1() {
|
||||
int p2 = y;
|
||||
p2++;
|
||||
int r = someMethod(x, p2);
|
||||
}
|
||||
|
||||
public void use2() {
|
||||
int p2 = field1;
|
||||
p2++;
|
||||
int r = someMethod(field1, p2);
|
||||
}
|
||||
|
||||
public void use3() {
|
||||
int p2 = field2;
|
||||
p2++;
|
||||
int r = someMethod(field2, p2);
|
||||
}
|
||||
|
||||
public void use4() {
|
||||
int p2 = field3;
|
||||
p2++;
|
||||
int r = someMethod(field3, p2);
|
||||
}
|
||||
|
||||
{
|
||||
field2++;
|
||||
}
|
||||
|
||||
private final int field1;
|
||||
private int field2;
|
||||
private int field3;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
class Element {
|
||||
String id;
|
||||
|
||||
String <caret>getName() {
|
||||
return getID();
|
||||
}
|
||||
String getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String method(Element element) {
|
||||
return getName() + element.getName();
|
||||
}
|
||||
|
||||
public String staticMethod(Element element) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(element.getName());
|
||||
return buffer.toString();
|
||||
}
|
||||
static Element toXML(Element element){
|
||||
X el= new X("El")
|
||||
el.setAttribute("attr", element.getName());
|
||||
return el;
|
||||
}
|
||||
}
|
||||
|
||||
class Usage {
|
||||
public String staticMethod(Element element) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(element.getName());
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
class Element {
|
||||
String id;
|
||||
|
||||
String getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String method(Element element) {
|
||||
return getID() + element.getID();
|
||||
}
|
||||
|
||||
public String staticMethod(Element element) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(element.getID());
|
||||
return buffer.toString();
|
||||
}
|
||||
static Element toXML(Element element){
|
||||
X el= new X("El")
|
||||
el.setAttribute("attr", element.getID());
|
||||
return el;
|
||||
}
|
||||
}
|
||||
|
||||
class Usage {
|
||||
public String staticMethod(Element element) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(element.getID());
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
class Base {
|
||||
String id;
|
||||
public String getID() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
String <caret>getName() {
|
||||
return getID();
|
||||
}
|
||||
|
||||
static void usage(Derived element) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.add(element.getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class Base {
|
||||
String id;
|
||||
public String getID() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
|
||||
static void usage(Derived element) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.add(element.getID());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class A {
|
||||
{
|
||||
g();
|
||||
}
|
||||
int <caret>g() {
|
||||
try {
|
||||
return 0;
|
||||
} catch (Error e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
{
|
||||
int result;
|
||||
try {
|
||||
result = 0;
|
||||
} catch (Error e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
class A {
|
||||
|
||||
Integer f(int i) {
|
||||
return g(i);
|
||||
}
|
||||
|
||||
Integer <caret>g(int i) {
|
||||
if (i > 0) {
|
||||
return new Integer(i);
|
||||
}
|
||||
else {
|
||||
Integer result;
|
||||
result = new Integer(0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
class A {
|
||||
|
||||
Integer f(int i) {
|
||||
Integer result;
|
||||
if (i > 0) {
|
||||
result = new Integer(i);
|
||||
}
|
||||
else {
|
||||
Integer result;
|
||||
result = new Integer(0);
|
||||
result = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
public class Foo
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
Object value = null;
|
||||
log( "float", new Float( 5.5f ) );
|
||||
}
|
||||
|
||||
private static void <caret>log(String title, Object value) {
|
||||
System.out.println( title + ":" + value );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class Foo
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
Object value = null;
|
||||
System.out.println( "float" + ":" + new Float( 5.5f ));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class NestedCall {
|
||||
int foo(int p) { return p; }
|
||||
int <caret>bar(int p) { return foo(p); }
|
||||
|
||||
{
|
||||
bar(bar(0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class NestedCall {
|
||||
int foo(int p) { return p; }
|
||||
|
||||
{
|
||||
foo(foo(0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
public class ConstructedClass {
|
||||
public static ConstructedClass PEC_ONE = new ConstructedClass("param");
|
||||
|
||||
ConstructedClass(int field) {
|
||||
}
|
||||
|
||||
public <caret>ConstructedClass(String keyword) {
|
||||
this(keyword.length());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
public class ConstructedClass {
|
||||
public static ConstructedClass PEC_ONE = new ConstructedClass("param".length());
|
||||
|
||||
ConstructedClass(int field) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Super {
|
||||
public void message<caret>() {
|
||||
System.out.println(this);
|
||||
}
|
||||
}
|
||||
|
||||
class Sub extends Super {
|
||||
public void message() {
|
||||
super.message(); // <-- Inline this method call.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Super {
|
||||
}
|
||||
|
||||
class Sub extends Super {
|
||||
public void message() {
|
||||
System.out.println(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
public class SuperClass {
|
||||
public void <caret>doSomething() {
|
||||
UtilClass.doSomething(this);
|
||||
}
|
||||
}
|
||||
|
||||
public class SubClass extends SuperClass {
|
||||
public void doSomethingElse() {
|
||||
doSomething();
|
||||
}
|
||||
}
|
||||
|
||||
public class UtilClass {
|
||||
public static void doSomething(SuperClass superClass) {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
public class SuperClass {
|
||||
}
|
||||
|
||||
public class SubClass extends SuperClass {
|
||||
public void doSomethingElse() {
|
||||
UtilClass.doSomething(this);
|
||||
}
|
||||
}
|
||||
|
||||
public class UtilClass {
|
||||
public static void doSomething(SuperClass superClass) {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
private void f() {}
|
||||
}
|
||||
|
||||
class B {
|
||||
private A b;
|
||||
public void g() {
|
||||
b.<caret>f();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
}
|
||||
|
||||
class B {
|
||||
private A b;
|
||||
public void g() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class Test {
|
||||
<T> void foo(T t) {
|
||||
List<? extends T> l = new ArrayList<T>();
|
||||
}
|
||||
|
||||
void bar () {
|
||||
<caret>foo(new String());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class Test {
|
||||
|
||||
void bar () {
|
||||
List<? extends String> l = new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
public class Scr10884 {
|
||||
int foo() {
|
||||
return 1;
|
||||
}
|
||||
Y bar() {
|
||||
return new Y(<caret>foo()) {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class Y {
|
||||
Y(int x) {}
|
||||
int foo() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
public class Scr10884 {
|
||||
Y bar() {
|
||||
return new Y(1) {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class Y {
|
||||
Y(int x) {}
|
||||
int foo() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
public class Foo
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
log( "integer", new Integer( 5 ) );
|
||||
log( "float", new Float( 5.5f ) );
|
||||
}
|
||||
|
||||
private static void <caret>log(String title, Object value) {
|
||||
System.out.println( title + ":" + value );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class Foo
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println( "integer" + ":" + new Integer( 5 ));
|
||||
System.out.println( "float" + ":" + new Float( 5.5f ));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Test {
|
||||
private String s;
|
||||
String <caret>method() {
|
||||
s = "Hello";
|
||||
return s;
|
||||
}
|
||||
void test() {
|
||||
System.out.println(method());
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
private String s;
|
||||
|
||||
void test() {
|
||||
s = "Hello";
|
||||
System.out.println(s);
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class A{
|
||||
static int field = foo();
|
||||
|
||||
static int <caret>foo(){
|
||||
doSomething();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class A{
|
||||
static int field;
|
||||
|
||||
static {
|
||||
doSomething();
|
||||
field = 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class A {
|
||||
private String toInline(boolean b) {
|
||||
if (b) {
|
||||
return "b";
|
||||
}
|
||||
return "a";
|
||||
}
|
||||
|
||||
public String method(boolean b) {
|
||||
return <caret>toInline(b);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
|
||||
public String method(boolean b) {
|
||||
if (b) {
|
||||
return "b";
|
||||
}
|
||||
return "a";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class A {
|
||||
private String toInline(boolean b) {
|
||||
if (b) {
|
||||
return "b";
|
||||
}
|
||||
return "a";
|
||||
}
|
||||
|
||||
public String method(boolean b) {
|
||||
<caret>toInline(b);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
|
||||
public String method(boolean b) {
|
||||
if (b) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
private void b(){
|
||||
<caret>a();
|
||||
}
|
||||
|
||||
private void a(){
|
||||
System.out.println("asdasd");
|
||||
//test
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
private void b(){
|
||||
System.out.println("asdasd");
|
||||
//test
|
||||
}
|
||||
|
||||
}
|
||||
15
java/java-tests/testData/refactoring/inlineMethod/Try.java
Normal file
15
java/java-tests/testData/refactoring/inlineMethod/Try.java
Normal file
@@ -0,0 +1,15 @@
|
||||
public class Try {
|
||||
public int test() {
|
||||
int i = another();
|
||||
return i;
|
||||
}
|
||||
|
||||
public int another<caret>() {
|
||||
try {
|
||||
return Integer.parseInt("1");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
public class Try {
|
||||
public int test() {
|
||||
int result;
|
||||
try {
|
||||
result = Integer.parseInt("1");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw ex;
|
||||
}
|
||||
int i = result;
|
||||
return i;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
public class Try {
|
||||
public int test() {
|
||||
int i = another();
|
||||
return i;
|
||||
}
|
||||
|
||||
public synchronized int another<caret>() {
|
||||
try {
|
||||
return Integer.parseInt("1");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
public class Try {
|
||||
public int test() {
|
||||
int result;
|
||||
synchronized (this) {
|
||||
try {
|
||||
result = Integer.parseInt("1");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
int i = result;
|
||||
return i;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
public class Varargs {
|
||||
public static String join(String separator, String... texts) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String joinStrings(String separator, String... texts) {
|
||||
return join(separator, texts);
|
||||
}
|
||||
|
||||
public void foo() {
|
||||
String s = <caret>joinStrings("", "i", "d", "e", "a");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
public class Varargs {
|
||||
public static String join(String separator, String... texts) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public void foo() {
|
||||
String[] texts = new String[]{"i", "d", "e", "a"};
|
||||
String s = join("", texts);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class BugTest {
|
||||
void <caret>f(String... s) {
|
||||
for (String s1 : s) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
f(new String[] {""});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class BugTest {
|
||||
|
||||
{
|
||||
String[] s = new String[] {""};
|
||||
for (String s1 : s) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
void method() {
|
||||
otherMethod();
|
||||
System.out.println("Here");
|
||||
}
|
||||
void otherMethod<caret>() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
void method() {
|
||||
System.out.println("Here");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
private static void dude() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
<caret>dude();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user