niagara編譯錯誤:using type arguments to access generic types requires the use of "-source 1.5"

在寫niagara module的過程中用到了HashMap<String, String>,這是一個需要JDK1.5的特性,而niagara默認的java編譯器是jikes版本只到1.3(後來在niagara安裝目錄/lib下的devkit.properties文件中找到,怎麼想起來看這個文件呢,其實如果注意編譯時eclipse控制檯的輸出能發現這樣一句"Loading [d:\program files\niagara-3.7.106\lib\devkit.properties])。

在niagara-community Answers裏搜索結果,找到一個靠譜的回答"compiling generics"(回答者是tridium的custom support),大意就是要在build.xml文件的module或者package元素中加上edition="j2se"屬性(哎,也怪自己當時看<modules and component>這章的時候沒注意)。其實你去看devkit.properties這個文件,對應j2se還是-source 1.3,需要用edition="j2se-5.0"。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章