From 46c37550c0c34e059f632097b2d1be0cd063d8bf Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Thu, 8 Jun 2017 17:44:53 +0300 Subject: [PATCH] type migration: add a test for IDEA-173791 --- .../testData/intentions/threadLocal/afterCycle.java | 8 ++++++++ .../testData/intentions/threadLocal/beforeCycle.java | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 java/typeMigration/testData/intentions/threadLocal/afterCycle.java create mode 100644 java/typeMigration/testData/intentions/threadLocal/beforeCycle.java diff --git a/java/typeMigration/testData/intentions/threadLocal/afterCycle.java b/java/typeMigration/testData/intentions/threadLocal/afterCycle.java new file mode 100644 index 000000000000..b2d5d06814ba --- /dev/null +++ b/java/typeMigration/testData/intentions/threadLocal/afterCycle.java @@ -0,0 +1,8 @@ +// "Convert to ThreadLocal" "true" +import java.util.Arrays; + +class Foo { + private final ThreadLocal lookahead = ThreadLocal.withInitial(() -> new char[0]); + + { lookahead.set(Arrays.copyOf(lookahead.get(), 42));} +} \ No newline at end of file diff --git a/java/typeMigration/testData/intentions/threadLocal/beforeCycle.java b/java/typeMigration/testData/intentions/threadLocal/beforeCycle.java new file mode 100644 index 000000000000..257fdfd4e425 --- /dev/null +++ b/java/typeMigration/testData/intentions/threadLocal/beforeCycle.java @@ -0,0 +1,8 @@ +// "Convert to ThreadLocal" "true" +import java.util.Arrays; + +class Foo { + private char[] lookahead = new char[0]; + + { lookahead = Arrays.copyOf(lookahead, 42);} +} \ No newline at end of file