change new operator type: anonymous classes processed (IDEA-102236)

This commit is contained in:
anna
2013-03-01 18:11:40 +01:00
parent ac96df7cc6
commit e6fb83143a
8 changed files with 94 additions and 10 deletions
@@ -1,9 +1,9 @@
// "Change 'new Runnable() {...}' to 'new StringBuffer()'" "true"
class X {
public StringBuffer buf = new StringBuffer(){
public void run(){
System.out.println("smth");
}
};
public StringBuffer buf = new StringBuffer() {
public void run(){
System.out.println("smth");
}
};
}
@@ -0,0 +1,16 @@
// "Change 'new Foo<short[]>() {...}' to 'new Boo.Foo<String>()'" "true"
class Boo {
abstract class Foo<T>{}
private Foo<String> foo()
{
return new Foo<String>() {
@Override
public int hashCode() {
return super.hashCode();
}
};
}
}
@@ -0,0 +1,12 @@
// "Change 'new Foo<short[]>() {...}' to 'new Boo.Foo<String>()'" "true"
class Boo {
abstract class Foo<T>{}
private Foo<String> foo()
{
return new Foo<String>() {
};
}
}
@@ -0,0 +1,13 @@
// "Change 'new FooImpl<short[]>() {...}' to 'new Boo.FooImpl<String>()'" "true"
class Boo {
abstract class Foo<T>{}
abstract class FooImpl<K> extends Foo<K>{}
private Foo<String> foo()
{
return new FooImpl<String>() {
};
}
}
@@ -0,0 +1,16 @@
// "Change 'new Foo<short[]>() {...}' to 'new Boo.Foo<String>()'" "true"
class Boo {
abstract class Foo<T>{}
private Foo<String> foo()
{
return new F<caret>oo<short[]>() {
@Override
public int hashCode() {
return super.hashCode();
}
};
}
}
@@ -0,0 +1,11 @@
// "Change 'new Foo<short[]>() {...}' to 'new Boo.Foo<String>()'" "true"
class Boo {
abstract class Foo<T>{}
private Foo<String> foo()
{
return new F<caret>oo<short[]>() {};
}
}
@@ -0,0 +1,12 @@
// "Change 'new FooImpl<short[]>() {...}' to 'new Boo.FooImpl<String>()'" "true"
class Boo {
abstract class Foo<T>{}
abstract class FooImpl<K> extends Foo<K>{}
private Foo<String> foo()
{
return new F<caret>ooImpl<short[]>() {};
}
}