通常,我从Netbeans那里得到一点黄色提示。可以看出,该类无法编译,但Netbeans没有提示,通常我希望在行号上看到一点黄色提示:
我将throws选项配置为:
我也没有看到有关声明对象的提示。就像提示被禁用一样。如何重新启用提示?
修改
code as follows:
package net.bounceme.dur.nntp.swing;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JScrollPane;
import net.bounceme.dur.nntp.gnu.Page;
import net.bounceme.dur.nntp.gnu.Usenet;
public class MyPanel extends JScrollPane {
private static final Logger LOG = Logger.getLogger(MyPanel.class.getName());
private JList jList;
private DefaultListModel defaultListModel;
private Usenet u = Usenet.INSTANCE;
private Page page;
public MyPanel() {
page = u.getPage(new Page().getPmd()); //uncaught exception
jList = new JList(defaultListModel); // null, need to initialize
initComponents();
}
private void initComponents() {
}
}
显示此类无法编译的堆栈跟踪:
init:
Deleting: /home/thufir/NetBeansProjects/gnumail-providers/build/built-jar.properties
deps-jar:
Updating property file: /home/thufir/NetBeansProjects/gnumail-providers/build/built-jar.properties
Compiling 1 source file to /home/thufir/NetBeansProjects/gnumail-providers/build/classes
/home/thufir/NetBeansProjects/gnumail-providers/src/net/bounceme/dur/nntp/swing/MyPanel.java:19: error: unreported exception Exception; must be caught or declared to be thrown
page = u.getPage(new Page().getPmd()); //uncaught exception
Note: /home/thufir/NetBeansProjects/gnumail-providers/src/net/bounceme/dur/nntp/swing/MyPanel.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
/home/thufir/NetBeansProjects/gnumail-providers/nbproject/build-impl.xml:624: The following error occurred while executing this line:
/home/thufir/NetBeansProjects/gnumail-providers/nbproject/build-impl.xml:243: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
答案 0 :(得分:1)
这不是答案,而是附加信息。问题自发地解决了。也许是因为我退出了Netbeans。也许是因为我重新启动了。也许是小鬼:
为了清楚起见,仍然禁用了compile-on-save,它与Netbeans的版本相同。
答案 1 :(得分:0)
从互联网网页复制示例后,我遇到了同样的问题。重新启动Netbeans之后,我确实再次得到了提示。