15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.io.PrintWriter;
25 import java.io.StringWriter;
26 import java.util.ArrayList;
27 import java.util.List;
28 import java.util.regex.Matcher;
29 import java.util.regex.Pattern;
30
31 /*
32 * @test
33 * @bug 8038414
34 * @summary Constant pool's strings are not escaped properly
35 * @modules jdk.compiler
36 */
37 public class T8038414 {
38 private static final String NEW_LINE = System.getProperty("line.separator");
39 private static final String TEST_CLASSES = System.getProperty("test.classes", ".");
40 private static final String GOLDEN_STRING = escapeString(Test.test);
41
42 private static String escapeString(String s) {
43 StringBuilder sb = new StringBuilder();
44 for (int i = 0; i < s.length(); i++) {
45 char c = s.charAt(i);
46 switch (c) {
47 case '\t':
48 sb.append('\\').append('t');
49 break;
50 case '\n':
51 sb.append('\\').append('n');
52 break;
53 case '\r':
54 sb.append('\\').append('r');
55 break;
|
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.io.PrintWriter;
25 import java.io.StringWriter;
26 import java.util.ArrayList;
27 import java.util.List;
28 import java.util.regex.Matcher;
29 import java.util.regex.Pattern;
30
31 /*
32 * @test
33 * @bug 8038414
34 * @summary Constant pool's strings are not escaped properly
35 * @modules jdk.jdeps
36 */
37 public class T8038414 {
38 private static final String NEW_LINE = System.getProperty("line.separator");
39 private static final String TEST_CLASSES = System.getProperty("test.classes", ".");
40 private static final String GOLDEN_STRING = escapeString(Test.test);
41
42 private static String escapeString(String s) {
43 StringBuilder sb = new StringBuilder();
44 for (int i = 0; i < s.length(); i++) {
45 char c = s.charAt(i);
46 switch (c) {
47 case '\t':
48 sb.append('\\').append('t');
49 break;
50 case '\n':
51 sb.append('\\').append('n');
52 break;
53 case '\r':
54 sb.append('\\').append('r');
55 break;
|