博碩士論文 110522089 詳細資訊




以作者查詢圖書館館藏 以作者查詢臺灣博碩士 以作者查詢全國書目 勘誤回報 、線上人數:5 、訪客IP:3.137.183.14
姓名 郭威(Wei Kuo)  查詢紙本館藏   畢業系所 資訊工程學系
論文名稱 基於抽象語法樹的深度複製及彈性別名之所有權系統解決 Java 表示暴露問題
(AST-Based Deep Copy and Flexible Alias Ownership System Resolves Java Representation Exposure Problem)
相關論文
★ 條件判斷式事件驅動程式設計之C語言擴充★ 基于小波变换的指纹活度检测,具有聚集 LPQ 和 LBP 特征
★ 應用自動化測試於異質環境機器學習管道之 MLOps 系統★ 設計具有可視化思維工具和程式作為單一步的 輔助學習程式之棋盤式遊戲
★ TOCTOU 漏洞的靜態分析與實作★ 用於繪製風力發電控制邏輯之特定領域語言
★ 在Java程式語言中以雙向結構表達數學公式間關聯之設計與實作★ 支援模組化規則製作之程式碼轉換工具
★ 基於替代語意的 pandas DataFrame 靜態型別檢查器★ 自動化時間複雜度分析的設計與實作–從軟體層面評估嵌入式系統的功率消耗
★ 以震波層析成像為應用之特定領域語言實作與分析★ 用特徵選擇減少疲勞偵測腦電圖通道數
★ 一個應用紙本運算與數位化於程式設計學習使程序性思維可視化的機制★ 基於抽象語法樹的陣列形狀錯誤偵測
★ 從合作學習角色分工獲得函式程式設計思維學習遞迴程式的機制★ 基於 Python 型別提示檢查不可變性
檔案 [Endnote RIS 格式]    [Bibtex 格式]    [相關文章]   [文章引用]   [完整記錄]   [館藏目錄]   至系統瀏覽論文 (2028-7-19以後開放)
摘要(中) 在物件導向語言的設計模式中,封裝性佔了不少重要的部分,但於 Java 語言中使用封裝性時,卻可能會發生表示暴露 (Representation Exposure) 問題,而該問題歸咎於 Java 語言本身沒有足夠提供所有權 (Ownership) 及不變性 (Immutability) 的特性,使得外部的參考可以非預期地修改物件內部資料,進而導致封裝性遭破壞。

因此本研究將提供一個擴充於 Java 上的所有權系統— SlimeJava,基於抽象語法樹建立的所有權系統,來實現深度複製及彈性別名,並透過標註 (Annotation) 來進行源對源 (Source-to-source) 轉換,協助程式設計者避免表示暴露問題發生。在提案與實作中,我們討論了該如何透過使用標註,實現所有權系統並為何能夠避免表示暴露問題發生,並在最後透過評估證明其可行性。
摘要(英) In the design patterns of object-oriented languages, encapsulation plays a significant role. However, when using encapsulation in the Java language, a problem known as "Representation Exposure" may arise. This problem can be attributed to Java′s lack of sufficient features for ownership and immutability, which allows external references to unexpectedly modify internal object data and thereby compromising encapsulation.

To address this issue, this research proposes an extension for Java called "SlimeJava", which introduces an ownership system based on abstract syntax trees. SlimeJava implements deep copy and flexible alias, which utilizing annotations for source-to-source transformations to assist programmers in avoiding representation exposure. In the proposal and implementation, we discuss how to realize the ownership system through annotations and why it helps prevent representation exposure. Finally, the feasibility of the approach is demonstrated through evaluation.
關鍵字(中) ★ Java
★ 表示暴露
★ 不變性
★ 所有權
★ 封裝性
★ 設計模式
關鍵字(英) ★ Java
★ Representation Exposure
★ Immutability
★ Ownership
★ Encapsulation
★ Design Pattern
論文目次 摘要 xiii
Abstract xv
目錄 xvii
一、 緒論 1
1.1 表示暴露問題與別名 (Alias) 機制 1
1.1.1 別名產生方式 2
1.1.2 別名型態 2
1.1.3 其他程式語言之表示暴露問題 3
1.1.4 別名之重要性 4
1.2 確保別名機制的封裝性 4
1.2.1 不變性問題 4
1.2.2 所有權問題 5
1.3 既有研究之解決方法 5
1.4 論文架構 6
二、 動機 9
2.1 備忘錄模式範例 10
2.1.1 推文機制實作流程 10
2.1.2 主程式表示暴露問題 12
2.2 設計所有權系統來解決表示暴露問題的好處 14
2.3 設計所有權系統來解決表示暴露問題的難處 15
三、 提案與實作 17
3.1 SlimeOwned 18
3.2 SlimeBorrow 20
3.3 SlimeCopy 21
3.4 小結提案功能 22
3.5 實作內容 22
3.5.1 剖析 Java 程式碼 23
3.5.2 建立符號表檢查語法 26
3.5.3 生成深度複製並交由 Java 編譯器處理 26
3.5.4 生成深度複製無法支援之案例 28
3.6 改寫動機範例分析 28
3.6.1 建立 SlimeOwned 內部成員28
3.6.2 防止傳入型別名表示暴露問題 29
3.6.3 透過 SlimeCopy 建立備忘錄並存放於看守者 29
3.6.4 後續操作之變化 30
四、 評估 33
4.1 設計模式各項操作 33
4.2 與既有研究之操作比較 37
4.3 量化評估效能 39
4.3.1 測試準備 39
4.3.2 測試結果 40
五、 相關研究 43
5.1 所有權類型 (Ownership Types) 43
5.2 所有權域 (Ownership Domains) 44
六、 總結 47
七、 未來展望 49
參考文獻 51
附錄 A 程式碼 57
A.1 Memento 模式 57
A.1.1 Originator 介面 57
A.1.2 Tweet 類別 58
A.1.3 Memento 類別 60
A.1.4 CareTaker 類別 61
A.1.5 Java 主程式 62
A.1.6 Rust 主程式 62
參考文獻 [1] J. Noble, J. Vitek, and J. Potter, “Flexible alias protection,” in ECOOP’98— Object-Oriented Programming: 12th European Conference Brussels, Belgium, July 20–24, 1998 Proceedings 12, Springer, 1998, pp. 158–185.
[2] D. G. Clarke, J. M. Potter, and J. Noble, “Ownership types for flexible alias protection,” in Proceedings of the 13th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, 1998, pp. 48–64.
[3] D. L. Detlefs, K. R. M. Leino, and G. Nelson, Wrestling with rep exposure. Digital, Systems Research Center, 1998, vol. 156.
[4] D. G. Clarke, J. Noble, and J. Potter, “Overcoming representation exposure,” in Proceedings of the Workshop on Object-Oriented Technology, 1999, pp. 149–151.
[5] J. Hogg, D. Lea, A. Wills, D. deChampeaux, and R. Holt, “The geneva convention on the treatment of object aliasing,” ACM SIGPLAN OOPS Messenger, vol. 3, no. 2, pp. 11–16, 1992.
[6] D. G. Clarke, Object Ownership & Containment. University of New South Wales, 2002.
[7] P. E. Proposals. “Pep 591 –adding a final qualifier to typing.” (2022), [Online]. Available: https://peps.python.org/pep-0591 (visited on 06/06/2023).
[8] C. Reference. “C++ keyword: Const.” (2012), [Online]. Available: https://en.cppreference.com/w/cpp/keyword/const (visited on 06/06/2023).
[9] T. R. P. Language. “Variables and mutability.” (2019), [Online]. Available: https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html (visited on 05/15/2023).
[10] T. R. P. Language. “References and borrowing.” (2019), [Online]. Available: https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html (visited on 05/15/2023).
[11] D. Rayside, L. Mendel, R. Seater, and D. Jackson, “An analysis and visualization for revealing object sharing,” in Proceedings of the 2005 OOPSLA workshop on Eclipse technology eXchange, 2005, pp. 11–15.
[12] E. Gamma, R. Helm, R. Johnson, R. E. Johnson, and J. Vlissides, Design patterns: elements of reusable object-oriented software. Pearson Deutschland GmbH, 1995.
[13] T. Wrigstad, “Ownership-based alias managemant,” Ph.D. dissertation, KTH, 2006.
[14] C. Haack and E. Poll, “Type-based object immutability with flexible initialization.,” in ECOOP, Springer, vol. 5653, 2009, pp. 520–545.
[15] A. Banerjee and D. A. Naumann, “State based ownership, reentrance, and encapsulation,” in ECOOP 2005-Object-Oriented Programming: 19th European Conference, Glasgow, UK, July 25-29, 2005. Proceedings 19, Springer, 2005, pp. 387–411.
[16] Y. Zibin, A. Potanin, P. Li, M. Ali, and M. D. Ernst, “Ownership and immutability in generic java,” ACM Sigplan Notices, vol. 45, no. 10, pp. 598–617, 2010.
[17] final vs Immutability in Java. “Linked lists–advanced operations.” (2018), [Online]. Available: https://www.geeksforgeeks.org/final-vs-immutability-java (visited on 06/06/2023).
[18] Oracle. “Creating immutable lists, sets, and maps.” (2018), [Online]. Available: https://docs.oracle.com/javase/9/core/creating-immutable-lists-sets-and-maps.htm (visited on 05/07/2023).
[19] Rishabhsingh054. “Primitive data type vs. object data type in java with examples.”(2020), [Online]. Available: https://www.geeksforgeeks.org/primitive-data-type-vs-object-data-type-in-java-with-examples (visited on 05/11/2023).
[20] Javapoint. “Shallow copy java.” (2021), [Online]. Available: https://www.javatpoint.com/shallow-copy-java (visited on 05/11/2023).
[21] J. Noble, D. Clarke, and J. Potter, “Object ownership for dynamic alias protection,”in Proceedings Technology of Object-Oriented Languages and Systems. TOOLS 32, IEEE, 1999, pp. 176–187.
[22] C. Boyapati, “Safejava: A unified type system for safe programming,” Ph.D. dissertation, Massachusetts Institute of Technology, 2003.
[23] C. Boyapati, R. Lee, and M. Rinard, “Ownership types for safe programming: Preventing data races and deadlocks,” in Proceedings of the 17th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, 2002, pp. 211–230.
[24] C. Boyapati and M. Rinard, “A parameterized type system for race-free java programs,” in Proceedings of the 16th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, 2001, pp. 56–69.
[25] J. Aldrich and C. Chambers, “Ownership domains: Separating aliasing policy from mechanism,” in ECOOP 2004–Object-Oriented Programming: 18th European Conference, Oslo, Norway, June 14-18, 2004. Proceedings 18, Springer, 2004, pp. 1–25.
[26] J. Schäfer and A. Poetzsch-Heffter, “A parameterized type system for simple loose ownership domains.,” J. Object Technol., vol. 6, no. 5, pp. 71–100, 2007.
[27] D. Clarke, J. Östlund, I. Sergey, and T. Wrigstad, “Ownership types: A survey,”Aliasing in Object-Oriented Programming. Types, Analysis and Verification, pp. 15–58, 2013.
[28] T. Zhao, J. Palsberg, and J. Vitek, “Lightweight confinement for featherweight java,” ACM SIGPLAN Notices, vol. 38, no. 11, pp. 135–148, 2003.
[29] S. S. Huang, D. Zook, and Y. Smaragdakis, “Cj: Enhancing java with safe type conditions,” in Proceedings of the 6th international conference on Aspect-oriented software development, 2007, pp. 185–198.
[30] A. Potanin, J. Noble, D. Clarke, and R. Biddle, “Generic ownership for generic java,” ACM SIGPLAN Notices, vol. 41, no. 10, pp. 311–324, 2006.
[31] C. S. Gordon, M. J. Parkinson, J. Parsons, A. Bromfield, and J. Duffy, “Uniqueness and reference immutability for safe parallelism,” ACM SIGPLAN Notices, vol. 47, no. 10, pp. 21–40, 2012.
[32] Oracle. “Java annotation.” (2014), [Online]. Available: https://docs.oracle.com/javase/8/docs/technotes/guides/language/annotations.html (visited on 06/06/2023).
[33] M. EECS. “Abstraction functions & rep invariants.” (2015), [Online]. Available: https://web.mit.edu/6.005/www/fa15/classes/13-abstraction-functions-rep-invariants (visited on 05/07/2023).
[34] Javapoint. “Reference data types in java.” (2021), [Online]. Available: https://www.javatpoint.com/reference-data-types-in-java (visited on 05/15/2023).
[35] T. R. P. Language. “What is ownership?” (2019), [Online]. Available: https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html (visited on 05/15/2023).
[36] T. R. P. Language. “Vectors.” (2019), [Online]. Available: https://doc.rust.lang.org/book/ch08-01-vectors.html (visited on 05/15/2023).
[37] A. Potanin, M. Damitio, and J. Noble, “Are your incoming aliases really necessary? counting the cost of object ownership,” in 2013 35th International Conference on Software Engineering (ICSE), IEEE, 2013, pp. 742–751.
[38] S. Dashora. “Dangling references in rust –should you be worried?” (2022), [Online]. Available: https://progressivecoder.com/dangling-references-in-rust (visited on 05/24/2023).
[39] M. B. Marat Akhin. “Kotlin language specification.” (2021), [Online]. Available: https://kotlinlang.org/spec/introduction.html (visited on 06/06/2023).
[40] Jetbrain. “What is intellij idea?” (2003), [Online]. Available: https://www.jetbrains.com/idea/features (visited on 06/06/2023).
[41] Gradle. “What is gradle?” (2020), [Online]. Available: https://docs.gradle.org/current/userguide/what_is_gradle.html (visited on 06/06/2023).
[42] A. Bansal. “Java vs. kotlin.” (2021), [Online]. Available: https://www.baeldung.com/kotlin/java-vs-kotlin (visited on 06/06/2023).
[43] JavaParser. “Javaparser repository.” (2015), [Online]. Available: https://github.com/javaparser/javaparser (visited on 06/06/2023).
[44] I. d. N. Oren Ben-Kiki Clark Evans. “Yaml.” (2001), [Online]. Available: https://yaml.org/spec (visited on 06/06/2023).
[45] J. C. Mitchell, Foundations for programming languages. MIT press Cambridge, 1996, vol. 1.
[46] Pankaj. “Java singleton design pattern best practices with examples.” (2022), [Online]. Available: https://www.digitalocean.com/community/tutorials/java-singleton-design-pattern-best-practices-examples#singleton-pattern-principles (visited on 06/06/2023).
[47] Javapoint. “Java swing tutorial.” (2014), [Online]. Available: https://www.javatpoint.com/java-swing (visited on 06/06/2023).
[48] Orcale. “Threadpoolexecutor.” (2014), [Online]. Available: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadPoolExecutor.html (visited on 06/06/2023).
[49] Orcale. “Driver.” (2014), [Online]. Available: https://docs.oracle.com/javase/8/docs/api/java/sql/Driver.html (visited on 06/06/2023).
[50] J. Noble, “Iterators and encapsulation,” in Proceedings 33rd International Conference on Technology of Object-Oriented Languages and Systems TOOLS 33, IEEE, 2000, pp. 431–442.
[51] T. R. P. Language. “Option library.” (2014), [Online]. Available: https://doc.rust-lang.org/core/option/enum.Option.html (visited on 06/06/2023).
[52] Oracle. “Java optional.” (2014), [Online]. Available: https://www.oracle.com/technical-resources/articles/java/java8-optional.html (visited on 06/06/2023).
[53] Daniel. “Java 8 optional best practices and wrong usage.” (2016), [Online]. Available: http://dolszewski.com/java/java-8-optional-use-cases (visited on 06/06/2023).
[54] D. Clarke and S. Drossopoulou, “Ownership, encapsulation and the disjointness of type and effect,” in Proceedings of the 17th ACM SIGPLAN conference on Objectoriented programming, systems, languages, and applications, 2002, pp. 292–310.
[55] L. Cardelli and X. Leroy, “Abstract types and the dot notation,” in IFIP TC2 working conference on programming concepts and methods, North-Holland, 1990, pp. 479–504.
[56] M. Abi-Antoun and J. Aldrich, “Static extraction and conformance analysis of hierarchical runtime architectural structure using annotations,” in Proceedings of the 24th ACM SIGPLAN conference on Object oriented programming systems languages and applications, 2009, pp. 321–340.
[57] Andrew. “Linter.” (2017), [Online]. Available: https://github.com/mcandre/linters#what-is-a-linter (visited on 05/29/2023).
[58] S. Banerjee, L. Clapp, and M. Sridharan, “Nullaway: Practical type-based null safety for java,” in Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, 2019, pp. 740–750.
[59] D. Brotherston, W. Dietl, and O. Lhoták, “Granullar: Gradual nullable types for java,” in Proceedings of the 26th International Conference on Compiler Construction, 2017, pp. 87–97.
指導教授 莊永裕(Yung-Yu Zhuang) 審核日期 2023-7-20
推文 facebook   plurk   twitter   funp   google   live   udn   HD   myshare   reddit   netvibes   friend   youpush   delicious   baidu   
網路書籤 Google bookmarks   del.icio.us   hemidemi   myshare   

若有論文相關問題,請聯絡國立中央大學圖書館推廣服務組 TEL:(03)422-7151轉57407,或E-mail聯絡  - 隱私權政策聲明