Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

An external spec cannot refine methods its class inherits

已關閉
#379 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

已經有一個關聯 PR 被合併了。

  • #387 來自 @CatarinaGamboa —— 已合併

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
java

研究方向

Start by reading the external-refinement method lookup that emits “Could not find method” for pack() and setUndecorated(boolean); the issue does not name its source files or tests. Reproduce the example against the reported main revision, then trace how lookup handles methods inherited from java.awt.Window and java.awt.Frame. Done when an external spec can name those inherited methods and the protocol example is verified as intended.

由索引模型根據 Issue 內容生成。

描述

bug
@StateSet({"displayable", "notDisplayable"})
@ExternalRefinementsFor("javax.swing.JFrame")
public interface JFrameRefinementsExpert {
    @StateRefinement(to = "notDisplayable(this)") void JFrame(String title);
    @StateRefinement(to = "displayable(this)") void pack();
    @StateRefinement(from = "notDisplayable(this)") void setUndecorated(boolean undecorated);
}

public class Repro {
    void show() {
        JFrame f = new JFrame("x");
        f.pack();
        f.setUndecorated(true);   // throws IllegalComponentStateException: The frame is displayable.
    }
}

On main 321a7321:

Warning: Could not find method 'void pack()' for 'javax.swing.JFrame'
Warning: Could not find method 'void setUndecorated(boolean)' for 'javax.swing.JFrame'
Correct! Passed Verification.

pack is declared in java.awt.Window and setUndecorated in java.awt.Frame; a spec can only name methods its own class declares. A protocol that spans a hierarchy (here: displayable, from Window, guarding a Frame method) then has to be split into one interface per declaring class, sharing states by simple name (which also depends on registration order, see the related issue). Expected: an external spec can name inherited methods, applying to calls on receivers of that class.

主要語言
Java
星號
67
分支
36
平均合併
2 天 2 小時
30 天內合併 PR
34

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

liquid-java/liquidjava 的其他 Issue

查看 liquid-java/liquidjava 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。