I've solved it by myself. As someone mentioned in the comment, VSCode(Cursor) uses ecj while IntelliJ uses javac. This problem happens just in ecj (I changed a compiler to ecj in IntelliJ and the same compile error happened). Thank you for your comments!