久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='apHtj'><tr id='apHtj'><dt id='apHtj'><q id='apHtj'><span id='apHtj'><b id='apHtj'><form id='apHtj'><ins id='apHtj'></ins><ul id='apHtj'></ul><sub id='apHtj'></sub></form><legend id='apHtj'></legend><bdo id='apHtj'><pre id='apHtj'><center id='apHtj'></center></pre></bdo></b><th id='apHtj'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='apHtj'><tfoot id='apHtj'></tfoot><dl id='apHtj'><fieldset id='apHtj'></fieldset></dl></div>

      1. <tfoot id='apHtj'></tfoot>

        <small id='apHtj'></small><noframes id='apHtj'>

      2. <legend id='apHtj'><style id='apHtj'><dir id='apHtj'><q id='apHtj'></q></dir></style></legend>
          <bdo id='apHtj'></bdo><ul id='apHtj'></ul>

        Java注解成員可以使用哪些類型?

        Which types can be used for Java annotation members?(Java注解成員可以使用哪些類型?)
        <legend id='mUtPs'><style id='mUtPs'><dir id='mUtPs'><q id='mUtPs'></q></dir></style></legend>
        • <i id='mUtPs'><tr id='mUtPs'><dt id='mUtPs'><q id='mUtPs'><span id='mUtPs'><b id='mUtPs'><form id='mUtPs'><ins id='mUtPs'></ins><ul id='mUtPs'></ul><sub id='mUtPs'></sub></form><legend id='mUtPs'></legend><bdo id='mUtPs'><pre id='mUtPs'><center id='mUtPs'></center></pre></bdo></b><th id='mUtPs'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='mUtPs'><tfoot id='mUtPs'></tfoot><dl id='mUtPs'><fieldset id='mUtPs'></fieldset></dl></div>

              <tbody id='mUtPs'></tbody>

                • <bdo id='mUtPs'></bdo><ul id='mUtPs'></ul>
                  <tfoot id='mUtPs'></tfoot>

                  <small id='mUtPs'></small><noframes id='mUtPs'>

                  本文介紹了Java注解成員可以使用哪些類型?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  今天我想在 這個文檔之后創建我的第一個注釋接口 我得到了這個編譯器錯誤

                  <塊引用>

                  注解成員的類型無效":公共@interface MyAnnotation {對象我的參數;^^^^^^}

                  顯然 Object 不能用作注解成員的類型.不幸的是,我找不到任何關于一般可以使用哪些類型的信息.

                  這是我通過反復試驗發現的:

                  • 字符串 → 有效
                  • int → 有效
                  • 整數 → 無效(令人驚訝)
                  • String[] → 有效(令人驚訝)
                  • 對象 → 無效

                  也許有人可以闡明哪些類型實際上是允許的以及為什么.

                  解決方案

                  由JLS 的第 9.6.1 節.注釋成員類型必須是以下之一:

                  • 原始
                  • 字符串
                  • 一個枚舉
                  • 另一個注解
                  • 上述任何一項的數組

                  它看起來確實有限制,但毫無疑問是有原因的.

                  還要注意多維數組(例如 String[][])被上述規則隱式禁止.

                  如 this answer 中所述,不允許使用 Class 數組.

                  Today I wanted to create my first annotation interface following this documentation and I got this compiler error

                  Invalid type for annotation member":
                  public @interface MyAnnotation {
                      Object myParameter;
                      ^^^^^^
                  }
                  

                  Obviously Object cannot be used as type of an annotation member. Unfortunately I could not find any information on which types can be used in general.

                  This I found out using trial-and-error:

                  • String → Valid
                  • int → Valid
                  • Integer → Invalid (Surprisingly)
                  • String[] → Valid (Surprisingly)
                  • Object → Invalid

                  Perhaps someone can shed some light on which types are actually allowed and why.

                  解決方案

                  It's specified by section 9.6.1 of the JLS. The annotation member types must be one of:

                  • primitive
                  • String
                  • an Enum
                  • another Annotation
                  • Class
                  • an array of any of the above

                  It does seem restrictive, but no doubt there are reasons for it.

                  Also note that multidimensional arrays (e.g. String[][]) are implicitly forbidden by the above rule.

                  Arrays of Class are not allowed as described in this answer.

                  這篇關于Java注解成員可以使用哪些類型?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯誤)
                  Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語句 - 是“或/“和可能的?)
                  Java Replace Character At Specific Position Of String?(Java替換字符串特定位置的字符?)
                  What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作數的三元表達式的類型是什么?)
                  Read a text file and store every single character occurrence(讀取文本文件并存儲出現的每個字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉換 char 原語?)

                  1. <small id='6O00y'></small><noframes id='6O00y'>

                      • <bdo id='6O00y'></bdo><ul id='6O00y'></ul>

                          <i id='6O00y'><tr id='6O00y'><dt id='6O00y'><q id='6O00y'><span id='6O00y'><b id='6O00y'><form id='6O00y'><ins id='6O00y'></ins><ul id='6O00y'></ul><sub id='6O00y'></sub></form><legend id='6O00y'></legend><bdo id='6O00y'><pre id='6O00y'><center id='6O00y'></center></pre></bdo></b><th id='6O00y'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6O00y'><tfoot id='6O00y'></tfoot><dl id='6O00y'><fieldset id='6O00y'></fieldset></dl></div>
                            <tbody id='6O00y'></tbody>

                            <legend id='6O00y'><style id='6O00y'><dir id='6O00y'><q id='6O00y'></q></dir></style></legend>

                          • <tfoot id='6O00y'></tfoot>
                            主站蜘蛛池模板: 欧美精品一区二区免费 | 91精品国产91久久久久久不卞 | 欧美日日 | 国产色片| 久久久久久免费毛片精品 | 91视频国产精品 | 亚洲精品视频播放 | 久草青青草 | 日韩精品在线观看视频 | 99re66在线观看精品热 | 亚洲国产精品久久人人爱 | 欧美日韩精品区 | 欧美三区| 国产精品免费在线 | 国产精久久久 | 久久精品亚洲精品国产欧美 | 高清免费在线 | 日韩不卡一二区 | 亚洲伊人久久综合 | 91久久精品国产91久久性色tv | 91在线网站 | 日韩在线视频一区二区三区 | 婷婷五月色综合 | 羞羞的视频在线 | 丝袜 亚洲 另类 欧美 综合 | 祝你幸福电影在线观看 | 91久久久久| 久久久久国产一区二区三区四区 | 色综合一区二区 | 国产在线一区二区 | 天天天天操 | 国产精品久久久久免费 | 国产精选一区 | 高清欧美性猛交xxxx黑人猛交 | 在线一区二区三区 | 久久久久亚洲精品 | 精品欧美 | 成人av一区 | 日韩视频一区二区 | 韩日有码 | 国产男女精品 |