java - 智能 : What causes a dark green inspection highlight?

标签 java intellij-idea ide

在搜索论坛和 stackoverflow 之后,我看不出这个检查亮点试图提醒我什么:

除了标准上下文操作外,选择/悬停在突出显示的文本上不会返回任何内容。

最初这些变量是在构造函数之前声明和实例化的。 (ACTIONS TAKEN TO REPRODUCE) 当我使用上下文操作“将初始化移动到构造函数”时,构造函数中的初始化突出显示为深绿色。见附件 img。

有人知道这里发生了什么吗?

例子:

public class HoaQueueEditorDialog extends ListDialogBase implements Mutable {

    private static final String SAVE = "Save";
    private static final String CANCEL = "Cancel";
    private static final String CHAR_DELIMITER = ",";
    private static final String[] COL_NAMES = {"Workflow Step Name"};
    private static final Color NORM_BACKGROUND = TRexUIManager.getColor(TRexUIManager.CONTENT_BACKGROUND);
    private static final Color NORM_FOREGROUND = Color.black;
    private static final int[] COL_WIDTHS = {325};
    private static final ArrayList<AppOptionsUtil.WorkflowStepInfo> SUPPORTED_STEPS_LIST = AppOptionsUtil.getDisplayHoaInfoWfStepsSupportedList();

    // UI Elements
    private TButton saveButton;
    private TButton cancelButton;
    private JPanel parentPanel;
    private JPanel buttonPanelRight;
    private JPanel buttonPanelLeft;

    // Stores the data necessary to build a table row and it's corresponding checkbox object.
    protected HashMap<AppOptionsUtil.WorkflowStepInfo, TCheckBox> checkBoxMap;

    private TTable wfQueuesTable;
    private DefaultTableModel tableModel;

    private TChangeListener changeListener = null;

    private boolean escKeyPressedInsideYesNoCancel = false;

    private String originalAppOptionValues = null;
    private String returnAppOptionValues = null;

    public HoaQueueEditorDialog() {
        try {
            this.tableModel = new DefaultTableModel(new Object[][]{{}}, COL_NAMES);
            this.wfQueuesTable = new TTable();
            wfQueuesTable.setModel(tableModel);
            wfQueuesTable.setBackground(NORM_BACKGROUND);
            wfQueuesTable.setRowHeight(42);
            wfQueuesTable.getSelectionModel().addListSelectionListener(new DocumentTableSelectionListener());

            init();
            initMVC();
            this.setResizable(true);
        } catch (Exception ex) {
            TRexToolkit.showErrorMessage("Error initializing Document Print Screen.", "Error", ex);
        }
        buttonPanelLeft = new JPanel(new FlowLayout(LEFT));
        buttonPanelRight = new JPanel(new FlowLayout(RIGHT));
        parentPanel = new JPanel();
    }

最佳答案

IntelliJ IDEA 正在突出显示它在您调用 Move initialization to constructor 意图时所做的更改。由于更改距离光标很远,否则您可能看不到它们。按 Escape 将删除突出显示。

关于java - 智能 : What causes a dark green inspection highlight?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62440556/

相关文章:

java - AWS S3 : Uploading large file fails with ResetException: Failed to reset the request input stream

java - 即使父类(super class)实现了相同的接口(interface),在子类中实现接口(interface)有什么好处吗?

ide - SAS 语言的最佳非 SAS IDE 是什么?

java - 在数百个已编译的 jar 中查找方法或符号调用

java - 插入排序: count swaps and comparisons

java - 将方法添加到 Java 中的生成类中

maven - Gradle本地依赖性测试

java - 线程 "main"java.lang.Error : Unresolved compilation problem (Edx Course example) 中出现异常

java - 如何为字节码检测设置 Intellij/jar list ?

css - Eclipse CSS 自动完成/内容辅助不工作