alert.setHeaderText(String.format(
//this line//"Title:%s%nSinger:%s%nDate:%s%nAlbum:%s%nSongs:%s%nResult: %s",
msg.getTitle(), msg.getSinger(),
msg.getDate(), msg.getAlbum(),
msg.getResult()));
我试图修复此检查样式错误。请帮忙!!!
答案 0 :(得分:1)
为了解决这个checkstyle错误,您可以将此行拆分为两行,如下所示
alert.setHeaderText(String.format(
"Title:%s%nSinger:%s%n" +
"Date:%s%nAlbum:%s%nSongs:%s%nResult: %s",
msg.getTitle(), msg.getSinger(),
msg.getDate(), msg.getAlbum(),
msg.getResult()));
你应该考虑缩进级别的公正和整体减少,例如......
alert.setHeaderText(String.format(
"Title:%s%nSinger:%s%n" +
"Date:%s%nAlbum:%s%nSongs:%s%nResult: %s",
msg.getTitle(), msg.getSinger(),
msg.getDate(), msg.getAlbum(),
msg.getResult()));