author | ysuenaga |
Wed, 30 Mar 2016 21:05:13 +0900 | |
changeset 37218 | c7241bc368bf |
parent 28336 | 9a6ae3c3efb5 |
permissions | -rw-r--r-- |
28336
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
1 |
/* |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
4 |
* |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
8 |
* |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
13 |
* accompanied this code). |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
14 |
* |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
18 |
* |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
21 |
* questions. |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
22 |
*/ |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
23 |
|
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
24 |
/* |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
25 |
* @test |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
26 |
* @bug 8066871 |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
27 |
* @summary java.lang.VerifyError: Bad local variable type - local final String |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
28 |
* @author Srikanth Sankaran |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
29 |
* |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
30 |
* @compile -g:none ConditionalWithFinalStrings.java |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
31 |
* @run main ConditionalWithFinalStrings |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
32 |
*/ |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
33 |
|
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
34 |
public class ConditionalWithFinalStrings { |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
35 |
|
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
36 |
interface I { |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
37 |
String foo(); |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
38 |
} |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
39 |
|
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
40 |
static class Tmp { |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
41 |
private String value; |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
42 |
public void setValue(String tmpStr) { |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
43 |
this.value = tmpStr; |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
44 |
if (!this.value.equals("YES")) |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
45 |
throw new AssertionError(); |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
46 |
} |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
47 |
} |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
48 |
|
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
49 |
void goo(I i) { |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
50 |
if (!i.foo().equals("YES")) |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
51 |
throw new AssertionError(); |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
52 |
} |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
53 |
|
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
54 |
public void test() { |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
55 |
final String y = "YES"; |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
56 |
final String n = "NO"; |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
57 |
Tmp tmp = new Tmp(); |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
58 |
tmp.setValue(true ? y : n); |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
59 |
goo (() -> y); |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
60 |
|
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
61 |
} |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
62 |
public static void main(String[] args) { |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
63 |
new ConditionalWithFinalStrings().test(); |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
64 |
if (!id("Hello!").equals("Hello!")) |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
65 |
throw new AssertionError(); |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
66 |
|
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
67 |
} |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
68 |
static <Z> Z id(Z z) { return z; } |
9a6ae3c3efb5
8066871: java.lang.VerifyError: Bad local variable type - local final String
mcimadamore
parents:
diff
changeset
|
69 |
} |