diff options
Diffstat (limited to 'plugins/typeMigration/testData/intentions/threadLocal')
18 files changed, 175 insertions, 0 deletions
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after1.java b/plugins/typeMigration/testData/intentions/threadLocal/after1.java new file mode 100644 index 000000000000..b5df8fd35214 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/after1.java @@ -0,0 +1,12 @@ +// "Convert to ThreadLocal" "true" +class Test { + final ThreadLocal<Integer> field = new ThreadLocal<Integer>() { + @Override + protected Integer initialValue() { + return 0; + } + }; + void foo() { + field.set(field.get() + 1); + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after2.java b/plugins/typeMigration/testData/intentions/threadLocal/after2.java new file mode 100644 index 000000000000..3a546c5b0c9a --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/after2.java @@ -0,0 +1,12 @@ +// "Convert to ThreadLocal" "true" +class Test { + final ThreadLocal<String> field = new ThreadLocal<String>() { + @Override + protected String initialValue() { + return ""; + } + }; + void foo() { + System.out.println(field.get()); + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after3.java b/plugins/typeMigration/testData/intentions/threadLocal/after3.java new file mode 100644 index 000000000000..9fc0f825ac4b --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/after3.java @@ -0,0 +1,12 @@ +// "Convert to ThreadLocal" "true" +class Test { + final ThreadLocal<Integer> field = new ThreadLocal<Integer>() { + @Override + protected Integer initialValue() { + return new Integer(0); + } + }; + void foo() { + if (field.get() == null) return; + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after4.java b/plugins/typeMigration/testData/intentions/threadLocal/after4.java new file mode 100644 index 000000000000..8410a1c33c0e --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/after4.java @@ -0,0 +1,12 @@ +// "Convert to ThreadLocal" "true" +class Test { + final ThreadLocal<String> field = new ThreadLocal<String>() { + @Override + protected String initialValue() { + return ""; + } + }; + void foo() { + if (field.get().indexOf("a") == -1) return; + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after5.java b/plugins/typeMigration/testData/intentions/threadLocal/after5.java new file mode 100644 index 000000000000..435e1b6a50e6 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/after5.java @@ -0,0 +1,12 @@ +// "Convert to ThreadLocal" "true" +class Test { + final ThreadLocal<Integer> field = new ThreadLocal<Integer>() { + @Override + protected Integer initialValue() { + return new Integer(0); + } + }; + void foo(Test t) { + if (t.field.get() == null) return; + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after6.java b/plugins/typeMigration/testData/intentions/threadLocal/after6.java new file mode 100644 index 000000000000..1879a46be16d --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/after6.java @@ -0,0 +1,12 @@ +// "Convert to ThreadLocal" "true" +class Test { + static final ThreadLocal<Integer> field; + static { + field = new ThreadLocal<Integer>() { + @Override + protected Integer initialValue() { + return new Integer(0); + } + }; + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after7.java b/plugins/typeMigration/testData/intentions/threadLocal/after7.java new file mode 100644 index 000000000000..5398ff5e2991 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/after7.java @@ -0,0 +1,15 @@ +// "Convert to ThreadLocal" "true" +class X { + private final ThreadLocal<byte[]> bytes = new ThreadLocal<byte[]>() { + @Override + protected byte[] initialValue() { + return new byte[10]; + } + }; + + byte foo(byte b) { + bytes.get()[0] = 1; + foo(bytes.get()[1]) + return bytes.get()[2]; + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after8.java b/plugins/typeMigration/testData/intentions/threadLocal/after8.java new file mode 100644 index 000000000000..d158894b6130 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/after8.java @@ -0,0 +1,9 @@ +// "Convert to ThreadLocal" "true" +class X { + final ThreadLocal<Integer> i = new ThreadLocal<Integer>() { + @Override + protected Integer initialValue() { + return 0; + } + }; +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/afterTA1.java b/plugins/typeMigration/testData/intentions/threadLocal/afterTA1.java new file mode 100644 index 000000000000..0e3687e146b6 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/afterTA1.java @@ -0,0 +1,14 @@ +// "Convert to ThreadLocal" "true" +import java.lang.annotation.*; + +@Target(value = ElementType.TYPE_USE) +public @interface TA { int value(); } + +class Test { + final ThreadLocal<@TA(42) Integer> field = new ThreadLocal<Integer>() { + @Override + protected Integer initialValue() { + return 0; + } + }; +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before1.java b/plugins/typeMigration/testData/intentions/threadLocal/before1.java new file mode 100644 index 000000000000..e35925390137 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/before1.java @@ -0,0 +1,7 @@ +// "Convert to ThreadLocal" "true" +class Test { + int <caret>field=0; + void foo() { + field++; + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before2.java b/plugins/typeMigration/testData/intentions/threadLocal/before2.java new file mode 100644 index 000000000000..47c6471739d7 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/before2.java @@ -0,0 +1,7 @@ +// "Convert to ThreadLocal" "true" +class Test { + String <caret>field=""; + void foo() { + System.out.println(field); + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before3.java b/plugins/typeMigration/testData/intentions/threadLocal/before3.java new file mode 100644 index 000000000000..19d296cffa36 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/before3.java @@ -0,0 +1,7 @@ +// "Convert to ThreadLocal" "true" +class Test { + Integer <caret>field=new Integer(0); + void foo() { + if (field == null) return; + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before4.java b/plugins/typeMigration/testData/intentions/threadLocal/before4.java new file mode 100644 index 000000000000..66d2efa6230a --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/before4.java @@ -0,0 +1,7 @@ +// "Convert to ThreadLocal" "true" +class Test { + String <caret>field=""; + void foo() { + if (field.indexOf("a") == -1) return; + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before5.java b/plugins/typeMigration/testData/intentions/threadLocal/before5.java new file mode 100644 index 000000000000..c459443241e4 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/before5.java @@ -0,0 +1,7 @@ +// "Convert to ThreadLocal" "true" +class Test { + Integer <caret>field=new Integer(0); + void foo(Test t) { + if (t.field == null) return; + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before6.java b/plugins/typeMigration/testData/intentions/threadLocal/before6.java new file mode 100644 index 000000000000..74427e6e4f06 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/before6.java @@ -0,0 +1,7 @@ +// "Convert to ThreadLocal" "true" +class Test { + static final Integer <caret>field; + static { + field = new Integer(0); + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before7.java b/plugins/typeMigration/testData/intentions/threadLocal/before7.java new file mode 100644 index 000000000000..dfff0417b272 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/before7.java @@ -0,0 +1,10 @@ +// "Convert to ThreadLocal" "true" +class X { + private final byte[] <caret>bytes = new byte[10]; + + byte foo(byte b) { + bytes[0] = 1; + foo(bytes[1]) + return bytes[2]; + } +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before8.java b/plugins/typeMigration/testData/intentions/threadLocal/before8.java new file mode 100644 index 000000000000..af321e0da56c --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/before8.java @@ -0,0 +1,4 @@ +// "Convert to ThreadLocal" "true" +class X { + volatile int <caret>i = 0; +}
\ No newline at end of file diff --git a/plugins/typeMigration/testData/intentions/threadLocal/beforeTA1.java b/plugins/typeMigration/testData/intentions/threadLocal/beforeTA1.java new file mode 100644 index 000000000000..ac3409c2e759 --- /dev/null +++ b/plugins/typeMigration/testData/intentions/threadLocal/beforeTA1.java @@ -0,0 +1,9 @@ +// "Convert to ThreadLocal" "true" +import java.lang.annotation.*; + +@Target(value = ElementType.TYPE_USE) +public @interface TA { int value(); } + +class Test { + @TA(42) int <caret>field = 0; +}
\ No newline at end of file |