升级到 Intellij 2018.1,现在我在 SQL 代码中引用的 public static final String 常量出现错误

Upgraded to Intellij 2018.1 and now I'm getting an error for public static final String constants that are referenced in SQL code

我的所有 类 具有 public static final String NAME = "value" 且在 SQL 查询中使用的所有 类 现在都出现编译器错误“或预期的 DELIMITER,得到 'lastname'”。

您还可以找到下面的代码,以防它有助于复制它。

public class PeopleSQL
{
    public static final String ID_COL = "id";
    public static final String FIRSTNAME_COL = "firstname";
    public static final String LASTNAME_COL = "lastname";

    public static void getListOfPeople(Connection connection) throws RanaSQLException
    {
        PreparedStatement statement = null;
        ResultSet result = null;

        try
        {
            statement = connection.prepareStatement("SELECT " + ID_COL + ", " + LASTNAME_COL + " FROM people");
            result = statement.executeQuery();

        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try
            {
                result.close();
                statement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}


class People
{

}

是的,我已经提交了错误报告。

这是新 Intellij 2018.1 版的错误,错误报告已发布:https://youtrack.jetbrains.com/issue/IDEA-188988

下面是临时解决方法的屏幕截图。您基本上需要禁用一个设置。