- 
    Bug 
- 
    Resolution: Duplicate
- 
     P4 P4
- 
    None
- 
    8u192
- 
        x86_64
- 
        generic
                    ADDITIONAL SYSTEM INFORMATION :
Linux 64 bit
Linux 4.15.0-39-generic #42-Ubuntu SMP Tue Oct 23 15:48:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)
A DESCRIPTION OF THE PROBLEM :
The following code snippet reports compilation error:
package my;
import java.util.Comparator;
public class CheckJavaCompileError {
private static final Comparator<String> MY_COMPARATOR = Comparator.comparing(lambdaVar -> lambdaVar);
public CheckJavaCompileError() {
return;
}
}
Error:(9, 9) java: variable lambdaVar might not have been initialized
REGRESSION : Last worked in version 8u192
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Put code snippet into a file and compile it
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Code successfully compiled
ACTUAL -
Compilation reports error:
Error:(9, 9) java: variable lambdaVar might not have been initialized
---------- BEGIN SOURCE ----------
package my;
import java.util.Comparator;
public class CheckJavaCompileError {
private static final Comparator<String> MY_COMPARATOR = Comparator.comparing(lambdaVar -> lambdaVar);
public CheckJavaCompileError() {
return;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Avoid using return statement in constructor
FREQUENCY : always
            
Linux 64 bit
Linux 4.15.0-39-generic #42-Ubuntu SMP Tue Oct 23 15:48:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)
A DESCRIPTION OF THE PROBLEM :
The following code snippet reports compilation error:
package my;
import java.util.Comparator;
public class CheckJavaCompileError {
private static final Comparator<String> MY_COMPARATOR = Comparator.comparing(lambdaVar -> lambdaVar);
public CheckJavaCompileError() {
return;
}
}
Error:(9, 9) java: variable lambdaVar might not have been initialized
REGRESSION : Last worked in version 8u192
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Put code snippet into a file and compile it
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Code successfully compiled
ACTUAL -
Compilation reports error:
Error:(9, 9) java: variable lambdaVar might not have been initialized
---------- BEGIN SOURCE ----------
package my;
import java.util.Comparator;
public class CheckJavaCompileError {
private static final Comparator<String> MY_COMPARATOR = Comparator.comparing(lambdaVar -> lambdaVar);
public CheckJavaCompileError() {
return;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Avoid using return statement in constructor
FREQUENCY : always
- duplicates
- 
                    JDK-8077667 'variable may not have been initialized' error for parameter in lambda function -           
- Closed
 
-