1

通常,我会从 Netbeans 获得一些黄色提示。可以看出,该类无法编译,但 Netbeans 没有提示,通常我希望在行号上看到黄色的小提示:

行号上的黄色提示

我将 throws 选项配置为:

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)
4

2 回答 2

1

这不是答案,而是附加信息。问题自然而然地解决了。也许是因为我退出了 Netbeans。也许是因为我重新启动了。也许是小精灵:

在此处输入图像描述

需要明确的是,保存时编译仍然被禁用,它与 Netbeans 的版本相同。

于 2013-03-30T10:59:21.350 回答
0

从互联网网页复制示例后,我遇到了同样的问题。重新启动 Netbeans 后,我确实再次得到了提示。

于 2015-07-05T14:37:40.707 回答