久久久久久久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>
                            主站蜘蛛池模板: 亚洲视频一区在线观看 | 成人国产精品久久久 | 日韩成人免费在线视频 | 日韩成人在线电影 | 国产精品欧美一区二区 | 国产69精品久久99不卡免费版 | 999精品在线观看 | 精品欧美乱码久久久久久1区2区 | 成年人在线观看 | 亚洲黄色网址视频 | 国产三级一区二区三区 | 久久国产高清 | 国产精品久久影院 | 欧美日韩精品久久久免费观看 | 国产美女自拍视频 | 九九色综合 | www日本在线 | 亚洲成人av在线播放 | 九九av | 四虎影视1304t | 日韩免费一区 | 欧美精品久久久久久久久久 | 波多野结衣精品在线 | 成人在线网 | 高清亚洲 | 日本视频中文字幕 | 国产免费人成xvideos视频 | 偷拍亚洲色图 | 亚洲美女在线一区 | 国产精品大全 | 精品国产欧美一区二区三区成人 | www.夜夜草| 久久亚洲一区二区 | 国产精品久久久亚洲 | 国产午夜精品一区二区三区四区 | 国产在线视频一区二区董小宛性色 | 欧美三区视频 | 综合精品在线 | 国产一区二区三区在线 | av一级| 日本免费黄色一级片 |