久久久久久久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注解成員可以使用哪些類型?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  今天我想在 這個(gè)文檔之后創(chuàng)建我的第一個(gè)注釋接口 我得到了這個(gè)編譯器錯(cuò)誤

                  <塊引用>

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

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

                  這是我通過反復(fù)試驗(yàn)發(fā)現(xiàn)的:

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

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

                  解決方案

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

                  • 原始
                  • 字符串
                  • 一個(gè)枚舉
                  • 另一個(gè)注解
                  • 上述任何一項(xiàng)的數(shù)組

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

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

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

                  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.

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

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

                  相關(guān)文檔推薦

                  quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯(cuò)誤)
                  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 操作數(shù)的三元表達(dá)式的類型是什么?)
                  Read a text file and store every single character occurrence(讀取文本文件并存儲(chǔ)出現(xiàn)的每個(gè)字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉(zhuǎn)換 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>
                            主站蜘蛛池模板: 成人天堂 | 免费欧美 | 中文av电影| 国产超碰人人爽人人做人人爱 | 国产精品伦理一区 | 天天干天天草 | 欧美午夜一区 | 国产精品亚洲成在人线 | 免费观看日韩精品 | 久草免费视 | 久久99精品久久久久久 | 国产伦精品一区二区三区视频金莲 | 国产传媒毛片精品视频第一次 | 成人精品一区二区三区四区 | 中文字幕日韩欧美一区二区三区 | 日韩性生活网 | 精品久久久久久国产 | 免费av直接看 | 超碰97人人人人人蜜桃 | 日韩一区中文字幕 | 国产农村妇女毛片精品久久麻豆 | 久久亚洲天堂 | 91久久久www播放日本观看 | 日韩欧美国产一区二区三区 | 一区二区三区高清 | 亚洲国产成人av好男人在线观看 | 国产精品精品视频一区二区三区 | 欧美性成人 | 日韩一区二区三区视频在线观看 | 日韩欧美在 | 亚洲3p| 久久伊人精品 | 免费久久视频 | 亚洲高清视频在线 | 性做久久久久久免费观看欧美 | 亚洲精品久久久久久一区二区 | 在线观看国产视频 | 欧美四虎 | 黄色永久免费 | 九九导航 | 久久久久久久久久一区 |