Skip navigation

DSpace JSPUI

DSpace preserves and enables easy and open access to all types of digital content including text, images, moving images, mpegs and data sets

Learn More
DSpace logo
English
中文
  • Browse
    • Communities
      & Collections
    • Publication Year
    • Author
    • Title
    • Subject
    • Advisor
  • Search TDR
  • Rights Q&A
    • My Page
    • Receive email
      updates
    • Edit Profile
  1. NTU Theses and Dissertations Repository
  2. 電機資訊學院
  3. 資訊工程學系
Please use this identifier to cite or link to this item: http://tdr.lib.ntu.edu.tw/jspui/handle/123456789/29213
Title: 一個精確的Java語言型別檢查機制
A Precise Parameterized Pype Phecking Mechanism for Java
Authors: Shang-Ru Guan
關尚儒
Advisor: 陳俊良(Chuen-Liang Chen)
Keyword: 爪哇,泛型,參數化多型,反射,爪哇編譯器,一般化方法,
Java,generics,parametric polymorphism,reflection,Javac,generalization,
Publication Year : 2007
Degree: 碩士
Abstract: Java語言是個典型的物件導向程式語言。Java語言從出現時所帶來的可攜性、動態載入等等特性就受到強烈的注目。在其使用者與日俱增的同時,其語言特性也在以不影響其相容性、可攜性的原則之下快速的成長。Java語言在1.5(5.0)版開始正式在SDK中加入了泛型語法。其目的在於讓程式員在使用或是自定義容器類別時達到程式碼覆用以及編譯時期型別檢察等優點。
然而,Java語言在兼顧相容性和程式執行負擔的考量下使用了”一般化方法(Generalization)”來實現其泛型語法。此方法相較於C++語言使用的”特別化方法(Specialization)”,在執行時期無法達到真正的參數化多型。一個泛型類別的Java程式碼會產生一個泛型類別檔,而執行時期此類別之執行時期結構將會是唯一一份的存在,並不會因為其型別參數被給予引數的不同而產生多份結構。如此將會帶來許多限制以及危險性。
針對此現象,有相關研究提出了相當徹底的解決辦法,就是將Java的泛型語法實現方式想辦法改變為特別化方法,以避免掉所有一般化方法產生的問題。然而此解法必須修改Java虛擬機器才能實現,犧牲了相容性,也違背了泛型爪哇(Generic Java)的基本原則。這篇論文針對Java泛型語法所帶來的型別安全之缺陷,在不違背一般化方法實現以及泛型爪哇的原則之下,提出一個兼顧相容性的解法。藉由編譯器以及類別檔的修改。將執行時期泛型類別所產生的物件保有自己的型別引數(或稱之為泛型類別的Actual Type)資訊。藉此資訊可以提供Java反射機制的補完以及型別安全性的檢查
Java language is a typical object-oriented computer language. Programmers have gotten convenience in container declaration and usage since generics was supported by JDK5.0. As a result of using generalization to implement the generics support of new Java compiler. There could be difference between the source code and the real semantic in its class file. Java core reflection is also incomplete. The primal reason is that Java Virtual Machine doesn’t support parameterized type. In this thesis we bring up a light weight solution for parameterized type checking at runtime. It can also support runtime parameterized type reflection. This solution can work without modifying Java Virtual Machine.
URI: http://tdr.lib.ntu.edu.tw/jspui/handle/123456789/29213
Fulltext Rights: 有償授權
Appears in Collections:資訊工程學系

Files in This Item:
File SizeFormat 
ntu-96-1.pdf
  Restricted Access
5.2 MBAdobe PDF
Show full item record


Items in DSpace are protected by copyright, with all rights reserved, unless otherwise indicated.

社群連結
聯絡資訊
10617臺北市大安區羅斯福路四段1號
No.1 Sec.4, Roosevelt Rd., Taipei, Taiwan, R.O.C. 106
Tel: (02)33662353
Email: ntuetds@ntu.edu.tw
意見箱
相關連結
館藏目錄
國內圖書館整合查詢 MetaCat
臺大學術典藏 NTU Scholars
臺大圖書館數位典藏館
本站聲明
© NTU Library All Rights Reserved