Community
Participate
Working Groups
There is an issue with the latest update (2020-12) in eclipse as shown below in the code snippet: public class TernaryFail { final static boolean debug = false; final static String s1 = "Test string one"; final static String s2 = "Test string two"; static public void testMethod() { // This works with no compile error String test = ""; if (debug) test = s1; else test = s2; System.out.println(test); // This works with no compile error test = (debug ? s1 : s2); System.out.println(test); // This fails compile with "debug cannot be resolved to a variable" but used to work in eclipse 2020-09 and prior test = new String(debug ? s1 : s2); System.out.println(test); } } I starting seeing this issue today after updating eclipse to 2020-12 on both the Mac (Big Sur) and Windows 10.
Forgot to mention that we are using 1.8 compatibility.
*** This bug has been marked as a duplicate of bug 569498 ***