ดังนั้นปัญหาจะสามารถรวมการยับยั้งการเตือนแบบหลายรายการเพื่อให้แต่ละรายการไม่จำเป็นต้องใช้@SuppressWarningsคำอธิบายประกอบของตัวเอง
ตัวอย่างเช่น:
public class Example
    public Example() {
        GO go = new GO();  // unused
        ....
        List<String> list = ( List<String> ) go.getList(); // unchecked
    }
    ...
    // getters/setters/other methods
}
ตอนนี้แทนที่จะมีสอง@SuppressWarningsฉันต้องการที่จะมีหนึ่งที่ระดับชั้นสำหรับคำเตือนทั้งสองดังนั้นเช่นนี้
@SuppressWarnings( "unused", "unchecked" )
public class Example
    public Example() {
        GO go = new GO();  // unused - suppressed
        ....
        List<String> list = ( List<String> ) go.getList(); // unchecked - suppressed
    }
    ...
    // getters/setters/other methods
}
แต่นั่นไม่ใช่ไวยากรณ์ที่ถูกต้องมีวิธีทำเช่นนี้หรือไม่
                  @SuppressWarnings ("ไม่ได้ใช้", "ไม่ได้ตรวจสอบ") ไม่ทำงานโปรดแก้ไขเป็น @SuppressWarnings ({"ไม่ได้ใช้", "ไม่ได้ตรวจสอบ"})
                
                
                  
                    —
                    Raj