因此本研究將提供一個擴充於 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.