author | rfield |
Tue, 15 Apr 2014 15:52:52 -0700 | |
changeset 23969 | 023c35e5c2b8 |
permissions | -rw-r--r-- |
23969
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
1 |
/* |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
4 |
* |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
8 |
* |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
13 |
* accompanied this code). |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
14 |
* |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
18 |
* |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
21 |
* questions. |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
22 |
*/ |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
23 |
|
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
24 |
/* |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
25 |
* @test |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
26 |
* @bug 8037935 |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
27 |
* @summary Javac: final local String var referenced in binary/unary op in lambda produces code that does not verify |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
28 |
* @run main LambdaWithBinOpConstRefToConstString |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
29 |
*/ |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
30 |
|
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
31 |
interface MyFI { |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
32 |
void accept(); |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
33 |
} |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
34 |
|
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
35 |
public class LambdaWithBinOpConstRefToConstString { |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
36 |
public static void main(String[] args) { |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
37 |
final String CONSTANT_STRING_VALUE = "mwmwm"; |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
38 |
|
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
39 |
MyFI consumeStrings = () -> { |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
40 |
System.out.println(" local constant: " + CONSTANT_STRING_VALUE); |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
41 |
}; |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
42 |
} |
023c35e5c2b8
8037935: Javac -- final local String var referenced in binary/unary op in lambda produces code that does not verify
rfield
parents:
diff
changeset
|
43 |
} |