透過您的圖書館登入
IP:3.146.37.32
  • 學位論文

Java語言靜態泛型成員之機制

A Mechanism of Static Generic Type Members for the Java Programming Language

指導教授 : 陳俊良

摘要


經過多年的研究,一個將Java語言加入泛型機制的解法已經在Java 5.0上發佈了。為了兼顧新舊版本的相容性以及新舊程式碼的交互使用,Sun採用了擦拭法來達成泛型機制。擦拭法通常也被稱為一般化方法。然而,在擦拭法下帶來最大的問題為執行期間與泛型相關的型別資訊將會漏失。本論文中,將提出擦拭法帶來的另一個問題,這問題將導致無法使用泛型的靜態成員。最後,提出一個可行的解法並實現於Java 5.0編譯器之上。

並列摘要


Through the research for many years, a solution for the problem of extending Java with parametric polymorphism (genericity) has released in Java 5.0. In order to have the capability of backward compatibility and the capability of interoperability with legacy code, Sun adopts the method of type erasure to achieve Java with parametric polymorphism. The method is also called Generalization. Run-time type information will be lost because of type erasure and it’s the major problem of the solution. In the thesis, we show that Java 5.0 can’t declare static variable whose type is type parameter of class due to type erasure and propose a solution for this problem.

參考文獻


[1] Andrew Kennedy and Don Syme. Design and implementation of generics for the .Net Common Language Runtime.
Types to the JavaTM Programming Language.
[4] Brain Cabana, Suad Alagi, and Jeff Faulkner. Parametric Polymorphism for Java: Is There Any Hope in Sight?
ACM SIGPLAN Notices, volume 39, Dec 2004.
[5] B.Stoustrup. The C++ Programming Language. Addison-Wesley, 1987.

延伸閱讀