mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 23:39:39 +07:00
testdata for assignment to final vars inside lambda
This commit is contained in:
@@ -149,4 +149,30 @@ class FinalAssignmentInInitializer {
|
||||
Runnable r = () -> <error descr="Cannot assign a value to final variable 'x'">x</error> = "";
|
||||
x = "";
|
||||
}
|
||||
}
|
||||
|
||||
class AssignmentToFinalInsideLambda {
|
||||
boolean isTrue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
Runnable r = () -> {
|
||||
final int i;
|
||||
if (isTrue()) {
|
||||
i = 1;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
};
|
||||
|
||||
void a() {
|
||||
Runnable r = () -> {
|
||||
final int i;
|
||||
if (isTrue()) {
|
||||
i = 1;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user