mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
moving tests
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
interface I {
|
||||
}
|
||||
|
||||
interface J extends I {
|
||||
}
|
||||
|
||||
class IImpl implements I {
|
||||
}
|
||||
|
||||
class JImpl implements J {
|
||||
}
|
||||
|
||||
class X {
|
||||
static void <caret>method(int i, I intf) {
|
||||
System.out.println("i = " + i + ", intf = " + intf);
|
||||
}
|
||||
|
||||
{
|
||||
J j = new JImpl();
|
||||
method(0, j);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
interface I {
|
||||
void method(int i);
|
||||
}
|
||||
|
||||
interface J extends I {
|
||||
}
|
||||
|
||||
class IImpl implements I {
|
||||
public void method(int i) {
|
||||
System.out.println("i = " + i + ", intf = " + this);
|
||||
}
|
||||
}
|
||||
|
||||
class JImpl implements J {
|
||||
public void method(int i) {
|
||||
System.out.println("i = " + i + ", intf = " + this);
|
||||
}
|
||||
}
|
||||
|
||||
class X {
|
||||
|
||||
{
|
||||
J j = new JImpl();
|
||||
j.method(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
interface I {
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
}
|
||||
|
||||
interface J extends I {
|
||||
}
|
||||
|
||||
class D extends C implements J {
|
||||
}
|
||||
|
||||
class X {
|
||||
static void <caret>m(I i) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
interface I {
|
||||
void m();
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
public void m() {
|
||||
}
|
||||
}
|
||||
|
||||
interface J extends I {
|
||||
}
|
||||
|
||||
class D extends C implements J {
|
||||
}
|
||||
|
||||
class X {
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
interface PsiAntElement {
|
||||
}
|
||||
|
||||
interface AntElement extends PsiAntElement {
|
||||
}
|
||||
|
||||
class AntElementImpl implements AntElement {
|
||||
}
|
||||
|
||||
interface AntNameIdentifier extends AntElement {
|
||||
}
|
||||
|
||||
class AntNameIdentifierImpl extends AntElementImpl implements AntNameIdentifier {
|
||||
}
|
||||
|
||||
interface AntStructuredElement extends AntElement {
|
||||
}
|
||||
|
||||
class AntStructuredElementImpl extends AntElementImpl implements AntStructuredElement {
|
||||
}
|
||||
|
||||
interface AntTask extends AntStructuredElement {
|
||||
}
|
||||
|
||||
class AntTaskImpl extends AntStructuredElementImpl implements AntTask {
|
||||
}
|
||||
|
||||
interface AntMacroDef extends AntTask {
|
||||
}
|
||||
|
||||
class AntMacroDefImpl extends AntTaskImpl implements AntMacroDef {
|
||||
}
|
||||
|
||||
class X {
|
||||
static void <caret>m(PsiAntElement i) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
interface PsiAntElement {
|
||||
void m();
|
||||
}
|
||||
|
||||
interface AntElement extends PsiAntElement {
|
||||
}
|
||||
|
||||
class AntElementImpl implements AntElement {
|
||||
public void m() {
|
||||
}
|
||||
}
|
||||
|
||||
interface AntNameIdentifier extends AntElement {
|
||||
}
|
||||
|
||||
class AntNameIdentifierImpl extends AntElementImpl implements AntNameIdentifier {
|
||||
}
|
||||
|
||||
interface AntStructuredElement extends AntElement {
|
||||
}
|
||||
|
||||
class AntStructuredElementImpl extends AntElementImpl implements AntStructuredElement {
|
||||
}
|
||||
|
||||
interface AntTask extends AntStructuredElement {
|
||||
}
|
||||
|
||||
class AntTaskImpl extends AntStructuredElementImpl implements AntTask {
|
||||
}
|
||||
|
||||
interface AntMacroDef extends AntTask {
|
||||
}
|
||||
|
||||
class AntMacroDefImpl extends AntTaskImpl implements AntMacroDef {
|
||||
}
|
||||
|
||||
class X {
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
interface I {
|
||||
}
|
||||
|
||||
interface J extends I {
|
||||
}
|
||||
|
||||
class IImpl implements I {
|
||||
}
|
||||
|
||||
class JImpl implements J {
|
||||
}
|
||||
|
||||
class X {
|
||||
private static void <caret>method(int i, I intf) {
|
||||
System.out.println("i = " + i + ", intf = " + intf);
|
||||
}
|
||||
|
||||
{
|
||||
J j = new JImpl();
|
||||
method(0, j);
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
interface I {
|
||||
void method(int i);
|
||||
}
|
||||
|
||||
interface J extends I {
|
||||
}
|
||||
|
||||
class IImpl implements I {
|
||||
public void method(int i) {
|
||||
System.out.println("i = " + i + ", intf = " + this);
|
||||
}
|
||||
}
|
||||
|
||||
class JImpl implements J {
|
||||
public void method(int i) {
|
||||
System.out.println("i = " + i + ", intf = " + this);
|
||||
}
|
||||
}
|
||||
|
||||
class X {
|
||||
|
||||
{
|
||||
J j = new JImpl();
|
||||
j.method(0);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
interface Intf<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
class Impl<V> implements Intf<V> {
|
||||
}
|
||||
|
||||
class X {
|
||||
static <U> X<U> <caret>method(Intf<U> p, U value) {
|
||||
U v = p.get();
|
||||
return new X<U>(v,value);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
interface Intf<T> {
|
||||
T get();
|
||||
|
||||
X<T> method(T value);
|
||||
}
|
||||
|
||||
class Impl<V> implements Intf<V> {
|
||||
public X<V> method(V value) {
|
||||
V v = get();
|
||||
return new X<V>(v,value);
|
||||
}
|
||||
}
|
||||
|
||||
class X {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
public class Y {
|
||||
public void foo() {
|
||||
}
|
||||
}
|
||||
public class X {
|
||||
static void <caret>method(Y y) {
|
||||
System.out.println(y);
|
||||
y.foo();
|
||||
}
|
||||
|
||||
{
|
||||
Y y = new Y();
|
||||
method(y);
|
||||
method(new Y());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
public class Y {
|
||||
public void foo() {
|
||||
}
|
||||
|
||||
void method() {
|
||||
System.out.println(this);
|
||||
foo();
|
||||
}
|
||||
}
|
||||
public class X {
|
||||
|
||||
{
|
||||
Y y = new Y();
|
||||
y.method();
|
||||
new Y().method();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C<T> {
|
||||
T get() { return null; }
|
||||
static <V> void <caret>method(C<V> c, V value, X<V> x) {
|
||||
V v = c.get();
|
||||
System.out.println(v + " " + value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class C<T> {
|
||||
T get() { return null; }
|
||||
|
||||
void method(T value, X<T> x) {
|
||||
T v = get();
|
||||
System.out.println(v + " " + value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
String s;
|
||||
boolean foo() {
|
||||
boolean bar = false;
|
||||
if (s == null) {
|
||||
ba<caret>r = true;
|
||||
}
|
||||
return bar;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
String s;
|
||||
boolean foo() {
|
||||
boolean b<caret>ar = false;
|
||||
if (s == null) {
|
||||
bar = true;
|
||||
}
|
||||
return bar;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class AugmentedAssignment {
|
||||
public static String x() {
|
||||
String te<caret>xt = "";
|
||||
text += "something";
|
||||
return text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class AugmentedAssignment {
|
||||
public static String x() {
|
||||
String te<caret>xt = "";
|
||||
text += "something";
|
||||
return text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class IDEADEV10376 {
|
||||
private static int f(int p) {
|
||||
int i = 0;
|
||||
i = 9;
|
||||
i = f(<caret>i);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class IDEADEV10376 {
|
||||
private static int f(int p) {
|
||||
int i = 0;
|
||||
i = f(9);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.*;
|
||||
|
||||
class IDEADEV12244 {
|
||||
{
|
||||
TreeMap<String, Set<Integer>> map = new TreeMap<String, Set<Integer>>();
|
||||
Set<Integer> set = Collections.emptySet();
|
||||
map.put("foo", <caret>set);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import java.util.*;
|
||||
|
||||
class IDEADEV12244 {
|
||||
{
|
||||
TreeMap<String, Set<Integer>> map = new TreeMap<String, Set<Integer>>();
|
||||
map.put("foo", Collections.<Integer>emptySet());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class Tester {
|
||||
void method(String x, String... y) {
|
||||
}
|
||||
|
||||
void method1(String x, String[] y) {
|
||||
}
|
||||
|
||||
void caller() {
|
||||
String[] thing = {"a", "b"};
|
||||
method("", <caret>thing);
|
||||
method1("", thing);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class Tester {
|
||||
void method(String x, String... y) {
|
||||
}
|
||||
|
||||
void method1(String x, String[] y) {
|
||||
}
|
||||
|
||||
void caller() {
|
||||
method("", "a", "b");
|
||||
method1("", new String[]{"a", "b"});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
public class IDEADEV950 {
|
||||
void foo () {
|
||||
int door_1 = 0;
|
||||
float doorP = door_1 ;
|
||||
//Cast should be inserted when inlining, otherwise semantics changes
|
||||
float d1 = (<caret>doorP / NOF_LOOPS);
|
||||
}
|
||||
|
||||
private static final int NOF_LOOPS = 2;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class IDEADEV950 {
|
||||
void foo () {
|
||||
int door_1 = 0;
|
||||
//Cast should be inserted when inlining, otherwise semantics changes
|
||||
float d1 = ((float) door_1 / NOF_LOOPS);
|
||||
}
|
||||
|
||||
private static final int NOF_LOOPS = 2;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import javax.swing.*;
|
||||
|
||||
class Test {
|
||||
public static JComponent getFoo() {
|
||||
JComponent c = new JPanel();
|
||||
return <caret>c;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import javax.swing.*;
|
||||
|
||||
class Test {
|
||||
public static JComponent getFoo() {
|
||||
return new JPanel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class Inference {
|
||||
public <T> T getX() {
|
||||
return null;
|
||||
}
|
||||
|
||||
void foo (String s) {}
|
||||
|
||||
{
|
||||
String v2 = new Inference().getX();
|
||||
foo(<caret>v2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Inference {
|
||||
public <T> T getX() {
|
||||
return null;
|
||||
}
|
||||
|
||||
void foo (String s) {}
|
||||
|
||||
{
|
||||
foo(new Inference().<String>getX());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class YoYo {
|
||||
void bar () {}
|
||||
void f () {
|
||||
YoYo yoYoYo = foo();
|
||||
<caret>yoYoYo.bar();
|
||||
}
|
||||
|
||||
private YoYoYo foo() {
|
||||
|
||||
}
|
||||
class YoYoYo extends YoYo {}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class YoYo {
|
||||
void bar () {}
|
||||
void f () {
|
||||
foo().bar();
|
||||
}
|
||||
|
||||
private YoYoYo foo() {
|
||||
|
||||
}
|
||||
class YoYoYo extends YoYo {}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class Outer {
|
||||
String getValue() { return "";}
|
||||
void doSomething (String x) { }
|
||||
void foo() {
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
final String <caret>value = getValue();
|
||||
doSomething(value);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Outer {
|
||||
String getValue() { return "";}
|
||||
void doSomething (String x) { }
|
||||
void foo() {
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
doSomething(getValue());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Example {
|
||||
private class X<T> {}
|
||||
private <T> X<T> foo() { return new X<T>(); }
|
||||
private <T> X<T> boo(X<T> x) {return x;}
|
||||
private void goo() {
|
||||
X<Integer> f = foo();
|
||||
X<Integer> x = boo(<caret>f);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Example {
|
||||
private class X<T> {}
|
||||
private <T> X<T> foo() { return new X<T>(); }
|
||||
private <T> X<T> boo(X<T> x) {return x;}
|
||||
private void goo() {
|
||||
X<Integer> x = boo(this.<Integer>foo());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Example {
|
||||
private static class X<T> {}
|
||||
private static <T> X<T> foo() { return new X<T>(); }
|
||||
private static <T> X<T> boo(X<T> x) {return x;}
|
||||
private static void goo() {
|
||||
X<Integer> f = foo();
|
||||
X<Integer> x = boo(<caret>f);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Example {
|
||||
private static class X<T> {}
|
||||
private static <T> X<T> foo() { return new X<T>(); }
|
||||
private static <T> X<T> boo(X<T> x) {return x;}
|
||||
private static void goo() {
|
||||
X<Integer> x = boo(Example.<Integer>foo());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
void foo(final MyObject obj) {
|
||||
final MyObject _obj = obj;
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(<caret>_obj);
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
void foo(final MyObject obj) {
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(obj);
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class A {
|
||||
void foo(final MyObject obj) {
|
||||
final MyObject _obj;
|
||||
_obj = obj;
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(<caret>_obj);
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
void foo(final MyObject obj) {
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(obj);
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
public class IDEA17606 {
|
||||
|
||||
public void foo() {
|
||||
final Preferences preferences = Preferences.getInstance();
|
||||
// try to inline 'preferences'
|
||||
final Bar bar = new Bar(<caret>preferences.getComponent());
|
||||
bar.toString();
|
||||
|
||||
ThreadUtils.run(new Runnable() {
|
||||
public void run() {
|
||||
final Foo foo = new Foo();
|
||||
foo.setSize(preferences.getDimension().getSize());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
class Preferences {
|
||||
public static Preferences getInstance() {
|
||||
return new Preferences();
|
||||
}
|
||||
|
||||
public JComponent getComponent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dimension getDimension() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
public Bar(JComponent component) {
|
||||
}
|
||||
}
|
||||
|
||||
class ThreadUtils {
|
||||
public static void run(Runnable runnable) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
public class IDEA17606 {
|
||||
|
||||
public void foo() {
|
||||
// try to inline 'preferences'
|
||||
final Bar bar = new Bar(Preferences.getInstance().getComponent());
|
||||
bar.toString();
|
||||
|
||||
ThreadUtils.run(new Runnable() {
|
||||
public void run() {
|
||||
final Foo foo = new Foo();
|
||||
foo.setSize(Preferences.getInstance().getDimension().getSize());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
class Preferences {
|
||||
public static Preferences getInstance() {
|
||||
return new Preferences();
|
||||
}
|
||||
|
||||
public JComponent getComponent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dimension getDimension() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
public Bar(JComponent component) {
|
||||
}
|
||||
}
|
||||
|
||||
class ThreadUtils {
|
||||
public static void run(Runnable runnable) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
public class IDEA17606 {
|
||||
|
||||
public void foo() {
|
||||
final Preferences preferences = Preferences.getInstance();
|
||||
// try to inline 'preferences'
|
||||
final Bar bar = new Bar(preferences.getComponent());
|
||||
bar.toString();
|
||||
|
||||
ThreadUtils.run(new Runnable() {
|
||||
public void run() {
|
||||
final Foo foo = new Foo();
|
||||
foo.setSize(<caret>preferences.getDimension().getSize());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
class Preferences {
|
||||
public static Preferences getInstance() {
|
||||
return new Preferences();
|
||||
}
|
||||
|
||||
public JComponent getComponent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dimension getDimension() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
public Bar(JComponent component) {
|
||||
}
|
||||
}
|
||||
|
||||
class ThreadUtils {
|
||||
public static void run(Runnable runnable) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
public class IDEA17606 {
|
||||
|
||||
public void foo() {
|
||||
// try to inline 'preferences'
|
||||
final Bar bar = new Bar(Preferences.getInstance().getComponent());
|
||||
bar.toString();
|
||||
|
||||
ThreadUtils.run(new Runnable() {
|
||||
public void run() {
|
||||
final Foo foo = new Foo();
|
||||
foo.setSize(Preferences.getInstance().getDimension().getSize());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
class Preferences {
|
||||
public static Preferences getInstance() {
|
||||
return new Preferences();
|
||||
}
|
||||
|
||||
public JComponent getComponent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dimension getDimension() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
public Bar(JComponent component) {
|
||||
}
|
||||
}
|
||||
|
||||
class ThreadUtils {
|
||||
public static void run(Runnable runnable) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
+12
@@ -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);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
public enum EEE {
|
||||
a(<caret>doTest());
|
||||
|
||||
EEE(String s) {
|
||||
}
|
||||
|
||||
private static String doTest() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public enum EEE {
|
||||
a("");
|
||||
|
||||
EEE(String s) {
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
public enum EEE {
|
||||
a(<caret>doTest());
|
||||
|
||||
EEE(String s) {
|
||||
}
|
||||
|
||||
private static String doTest() {
|
||||
System.out.println("q");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
public enum EEE {
|
||||
a(new Object() {
|
||||
String evaluate() {
|
||||
System.out.println("q");
|
||||
return "";
|
||||
}
|
||||
}.evaluate());
|
||||
|
||||
EEE(String s) {
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -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 "";
|
||||
}
|
||||
}
|
||||
+12
@@ -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());
|
||||
}
|
||||
}
|
||||
+14
@@ -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));
|
||||
}
|
||||
}
|
||||
+10
@@ -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());
|
||||
}
|
||||
}
|
||||
+7
@@ -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.
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user