SORU
25 EKİM 2012, PERŞEMBE


Birleştirme birden fazla @SuppressWarnings açıklamalar - Eclipse Indigo

Sorun, her öğe @SuppressWarnings kendi açıklama ihtiyacı yok ki multple uyarı baskılar birleştirmek için güçlü olmak.

Örneğin:

public class Example
    public Example() {
        GO go = new GO();  // unused
        ....
        List<String> list = ( List<String> ) go.getList(); // unchecked
    }
    ...
    // getters/setters/other methods
}

Şimdi iki @SuppressWarnings olması yerine bu şekilde bu iki uyarı için sınıf düzeyinde, yani: bir tane istiyorum

@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
}

Ama bu geçerli bir sözdizimi değildir, orada bunu yapmak için bir yol var mı?

CEVAP
25 EKİM 2012, PERŞEMBE


Aşağıdakileri kullanın: @SuppressWarnings({"unused", "unchecked"})

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • disneychannel

    disneychanne

    19 ŞUBAT 2006
  • natescamp

    natescamp

    30 NİSAN 2009
  • Rachel Talbott

    Rachel Talbo

    26 Ocak 2011