StrongRelaxAJ: integrating adaptability of RelaxAJ and expressiveness of StrongAspectJ Tomoyuki Aotani Manabu Touyama and Hidehiko Masuhara University.

Slides:



Advertisements
Similar presentations
1 Mooly Sagiv and Greta Yorsh School of Computer Science Tel-Aviv University Modern Compiler Design.
Advertisements

Winter Compiler Construction T7 – semantic analysis part II type-checking Mooly Sagiv and Roman Manevich School of Computer Science Tel-Aviv.
WEAVING CODE EXTENSIONS INTO JAVASCRIPT Benjamin Lerner, Herman Venter, and Dan Grossman University of Washington, Microsoft Research.
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Modularization.
Generic programming in Java
1 Continuation Join Points Yusuke Endoh, Hidehiko Masuhara, Akinori Yonezawa (University of Tokyo)
Catriel Beeri Pls/Winter 2004/5 last 55 Two comments on let polymorphism I. What is the (time, space) complexity of type reconstruction? In practice –
Overview of AspectJ Aspect Oriented Software Development Seminar Technion presented by Oren Mishali.
University of British Columbia Software Practices Lab Fluid AOP Join Point Models Terry Hon Gregor Kiczales.
Java Generics.
Generic types for ArrayList Old Java (1.4 and older): ArrayList strings = new ArrayList(); strings.enqueue(“hello”); String word = (String) strings.get(0);
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Regression Test Selection for AspectJ Software Guoqing Xu and Atanas.
More on AspectJ. aspect MoveTracking { private static boolean _flag = false; public static boolean testAndClear() { boolean result = _flag; _flag = false;
1.2 – Open Sentences and Graphs
CS 1110 Final Exam: Review Session 2 Part 1 : Inheriting classes 1. Inheritance Facts 2. Constructors in Subclasses BREAK : 10 sec. Part 2 : Working with.
A Formal Model of Modularity in Aspect-Oriented Programming Jonathan Aldrich : Objects and Aspects Carnegie Mellon University.
Type-Directed, Whitespace-Delimited Parsing for Embedded DSLs Cyrus Omar School of Computer Science Carnegie Mellon University [GlobalDSL13] Benjamin ChungAlex.
Background Data validation, a critical issue for the E.S.S.
XFindBugs: eXtended FindBugs for AspectJ Haihao Shen, Sai Zhang, Jianjun Zhao, Jianhong Fang, Shiyuan Yao Software Theory and Practice Group (STAP) Shanghai.
Xactium xDSLs Run Models Not Code Tony Clark
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
1 Specialization Tools and Techniques for Systematic Optimization of System Software McNamee, Walpole, Pu, Cowan, Krasic, Goel, Wagle, Consel, Muller,
1 A Theoretical Framework for Association Mining based on the Boolean Retrieval Model on the Boolean Retrieval Model Peter Bollmann-Sdorra.
Muga Nishizawa and Shigeru Chiba (Tokyo Institute of Technology, Japan) 1 A Small Extension to Java for Class Refinement ACM SAC'08, March 18, 2008.
Generics1 Parametrized classes and methods. Generics2 What are generics Generics are classes or interfaces that can be instantiated with a variety of.
Generics1 Parametrized classes and methods. Generics2 What are generics Generics are classes or interfaces that can be instantiated with a variety of.
1 Biggest issue!!! You can’t do questions on this topic correctly unless you draw variables, draw objects when they are created, and draw frames for method.
Generics1 Parametrized classes and methods. Generics2 What are generics Generics are classes or interfaces that can be instantiated with a variety of.
A Bipartite Graph Model of Information Flow IFIP WG 2.3, May 2014 Gary T. Leavens (with John L. Singleton) University of Central Florida Orlando Florida.
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan Pointcut-based Architectural Interface.
A Meta-Level Specification and Profile for AspectJ in UML Joerg Evermann School of Information Management Victoria University of Wellington.
Java Graphics Stuart Hansen 11/6/03. What’s Wrong with OpenGL Graphics – not GUI –No real support of text boxes, buttons, etc. Procedural - not OOP –No.
A Distributed Aspect-Oriented System for J2EE Applications Muga Nishizawa and Shigeru Chiba (Tokyo Institute of Technology, Japan) Background - As benefits.
CCC: An Aspect-Oriented Intermediate Language on.Net Platform Yingfei Xiong and Feng Wan University of Electronic Science and Technology of China, China.
Features of AOP languages AOP languages have the following main elements: –a join point model (JPM) wrt base PL –a specification language for expressing.
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
Region Pointcut for AspectJ Shumpei Akai Shigeru Chiba Muga Nishizawa.
Inter-Type Declarations in AspectJ Awais Rashid Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
AspectJ – AOP for Java Tom Janofsky. Instructor at Penn State Abington Consultant with Chariot Solutions JUG Member.
Applying Translucid Contracts for Modular Reasoning about Aspect and Object Oriented Events Mehdi Bagherzadeh Gary T. Leavens Robert Dyer Foundations of.
Featherweight Generic Ownership Alex Potanin, James Noble Victoria University of Wellington Dave Clarke CWI, Netherlands Robert Biddle Carlton University.
CMSC 330: Organization of Programming Languages Java Generics.
Eclipse Debug Views Update Policy. 2 Agenda  Background  Requirements  How does it work now?  How to make it more flexible?
Extending the Field Access Pointcuts of AspectJ to Arrays ICS 2006 – Taipei, December 2006 Kung Chen and Chin-Hung Chien* National Chengchi University.
Polymorphism & Methods COMP206 Geoff Holmes & Bernhard Pfahringer (these slides: lots of input from Mark Hall) poly + morphos (greek) “many forms”
Semantic Analysis II. Messages Please check lecturer notices in the Moodle Appeals  Legitimate: “I don’t have the bug you mentioned…”  Illegitimate:
Comparison of Different AOP Approaches Presented by: Xiaojing Wang.
Semantic Analysis II Type Checking EECS 483 – Lecture 12 University of Michigan Wednesday, October 18, 2006.
How to Compile Aspects with Real-Time Java Pengcheng Wu Northeastern University Mar. 14, 2005 FOAL Workshop with AOSD’05.
IMPLEMENTING ARRAYLIST COMP 103. RECAP  Comparator and Comparable  Brief look at Exceptions TODAY  Abstract Classes - but note that the details are.
Arrays.
AspectScope: An Outline Viewer for AspectJ Programs Michihiro Horie, Shigeru Chiba Tokyo Institute of Technology, Japan.
SCoPE: an AspectJ Compiler for Supporting User-Defined Analysis-Based Pointcuts Tomoyuki Aotani Hidehiko Masuhara
Inheritance ndex.html ndex.htmland “Java.
Types and Programming Languages Lecture 10 Simon Gay Department of Computing Science University of Glasgow 2006/07.
AOP with AspectJ Awais Rashid, Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
1 An AOP Implementation Framework for Extending Join Point Models Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Hidehiko Masuhara(University.
1 Aspectual Caml an Aspect-Oriented Functional Language Hideaki Tatsuzawa Hidehiko Masuhara Akinori Yonezawa University of Tokyo.
Compound Types for Java Object Oriented Systems and Languages © 2001 Marcus Handte.
Towards a Semantic Model for Java Wildcards Sophia Drossopoulou Mariangiola Dezani-Ciancaglini Imperial College London Università di Torino Italy Nicholas.
Features of AOP languages AOP languages have the following main elements: –a join point model (JPM) wrt base PL –a specification language for expressing.
Language-Based Security: Overview of Types Deepak Garg Foundations of Security and Privacy October 27, 2009.
Sections Inheritance and Abstract Classes
Modular Software Development for Dealing with Uncertainty
Component Based Software Engineering
Aspect-Oriented Generation of the API Documentation for AspectJ
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Towards Effective Adaptive User Interfaces Design
Verifying Self-adaptive Applications Suffering Uncertainty
Presentation transcript:

StrongRelaxAJ: integrating adaptability of RelaxAJ and expressiveness of StrongAspectJ Tomoyuki Aotani Manabu Touyama and Hidehiko Masuhara University of Tokyo, Japan

Background: improving type-safety and expressiveness of around advice Safe & flexible generic Safe & generic flexible

void showPreview(Frame mainWin){ JDialog popup= new JDialog(mainWin); JButton close=new JButton("close"); popup.getContentPane().add(close); popup.setVisible(true); } Background – AspectJ is less flexible: changing a JDialog to a JWindow JWindow popup= new JWindow(mainWin); JWindow around(Frame f): call(JDialog.new(Frame))&&args(f){ new JWindow(f); } JDialogJWindow Component WindowRPC

Background – AspectJ is less flexible: JDialog cannot be replaced due to types JWindow around(Frame f): call(JDialog.new(Frame))&&args(f){ new JWindow(f); } JDialogJWindow Component WindowRPC Must be a subtype of JDialog in AspectJ forall Rs. Ra <= Rs must be hold – Rs: return type of a join point shadow – Ra: return type of around advice new JDialog(mainWin); apply

Background – RelaxAJ [Masuhara’10] : accepting any type if safely used forall Rs. Ra <= Rs is NOT required – Rs: return type of a join point shadow – Ra: return type of around advice Instead, Ra must be a subtype of all the usage types of the returned value – receiver’s type of a method call – field’s type of a field set

Background – RelaxAJ [Masuhara’10] : accepting any type if safely used void showPreview(Frame mainWin){ JDialog popup= new JDialog(mainWin); JButton close=new JButton("close"); popup.getContentPane().add(close); popup.setVisible(true); } JWindow around(Frame f) : call(JDialog.new(Frame))&&args(f) { return new JWindow(mainWin); } RelaxAJ compiler JDialogJWindow Component WindowRPC OK! collect usage types of returned value check relation

Problems of RelaxAJ Lack of expressiveness Lack of expressiveness: return type of around advice must be a single class Strange typing Strange typing: signature of proceed is the same to the one of around advice – Same to AspectJ

Problems of RelaxAJ Lack of expressiveness Lack of expressiveness: return type of around advice must be a single class Strange typing Strange typing: signature of proceed is the same to the one of around advice – Same to AspectJ

void showPreview(Frame mainWin){ JDialog popup= new JDialog(mainWin); JButton close=new JButton("close"); popup.getContentPane().add(close); popup.setVisible(true); } Extended example: replacing a JDialog with a JWindow conditionally JWindow popup= new JWindow(mainWin); if DECORATE is false JWindow around(Frame f): call(JDialog.new(Frame))&&args(f){ if(DECORATE) return proceed(f); else return new JWindow(f); }

void showPreview(Frame mainWin){ JDialog popup= new JDialog(mainWin); JButton close=new JButton("close"); popup.getContentPane().add(close); popup.setVisible(true); } Extended example: replacing a JDialog with a JWindow conditionally JWindow popup= new JWindow(mainWin); if DECORATE is false JWindow around(Frame f): call(JDialog.new(Frame))&&args(f){ if(DECORATE) return proceed(f); else return new JWindow(f); } returns JDialog  not JWindow JDialogJWindow Component WindowRPC not subtype

Problem 1: no suitable return type for the advice void showPreview(Frame mainWin){ JDialog popup= new JDialog(mainWin); JButton close=new JButton("close"); popup.getContentPane().add(close); popup.setVisible(true); } JDialogJWindow Component WindowRPC T around(Frame f): call(JDialog.new(Frame))&&args(f){ if(DECORATE) return proceed(f); else return new JWindow(f); } Return type T should be: T <: RPC T <: Window JWindow <: T JDialog <: T

Problems of RelaxAJ Lack of expressiveness Lack of expressiveness: return type of around advice must be a single class Strange typing Strange typing: signature of proceed is the same to the one of around advice – Same to AspectJ

Extended example: making a JDialog modal void showPreview(Frame mainWin){ JDialog popup= new JDialog(mainWin); JButton close=new JButton("close"); popup.getContentPane().add(clase); popup.setVisible(true); } JDialog d= new JDialog(mainWin); d.setModal(true); JWindow popup= new JWindow(mainWin); JWindow around(Frame f): call(JDialog.new(Frame))&&args(f){ proceed(f).setModal(true); return new JWindow(f); } JDialogJWindow Component WindowRPC

Problem 2: return types of around advice and its proceed are the same void showPreview(Frame mainWin){ JDialog popup= new JDialog(mainWin); JButton close=new JButton("close"); popup.getContentPane().add(clase); popup.setVisible(true); } JDialog d= new JDialog(mainWin); d.setModal(true); JWindow popup= new JWindow(mainWin); JWindow around(Frame f): call(JDialog.new(Frame))&&args(f){ proceed(f).setModal(true); return new JWindow(f); } JDialogJWindow Component WindowRPC Sig. of proceed: Frame -> JWindow But it never returns JWindow!

Our solution: StrongRelaxAJ Extending RelaxAJ with – Bounded type variables: representing “some type that can be used as type A and B” – Explicit signature of proceed: specifying the return type of proceed These features are found in StrongAspectJ – StrongRelaxAJ may= StrongAspectJ + RelaxAJ Ra around() : pointcut() : Rp proceed() {.... } Advice in StrongRelaxAJ:

Type variables: representing “some type that can be used as type A and B” void showPreview(Frame mainWin){ JDialog popup= new JDialog(mainWin); JButton close=new JButton("close"); popup.getContentPane().add(close); popup.setVisible(true); } JWindow popup= new JWindow(mainWin); if DECORATE is false JDialogJWindow Component WindowRPC

Explicit signature of proceed: specifying the return type of proceed void showPreview(Frame mainWin){ JDialog popup= new JDialog(mainWin); JButton close=new JButton("close"); popup.getContentPane().add(clase); popup.setVisible(true); } JDialog d= new JDialog(mainWin); d.setModal(true); JWindow popup= new JWindow(mainWin); JWindow around(Frame f): call(JDialog.new(Frame))&&args(f) : JDialog proceed(Frame) { proceed(f).setModal(true); return new JWindow(f); } JDialogJWindow Component WindowRPC Sig. of proceed: Frame -> JDialog OK!

Relationship between the return types of advice and proceed languagerelationship AspectJ Ra == Rp <: Rs StrongAspectJ Ra <: Rs <: Rp RelaxAJ Ra == Rp & forall i. Ra <: Ui StrongRelaxAJ Rs <: Rp & forall i. Ra <: Ui o=(Rs)e; ((U1)o).m1(); ((U2)o).m2(); Ra around(): match(Rs e) : Rp proceed(){ …} Rs: ret. type of shadow Ra: ret. type of advice Ui: usage type of advice return

Experiments: # of application chances in applications totalusage type > 1% jEdit JHotDraw (DrawApp) jython antlr freemind Counted the number of variables that is used as more than 2 types in Shimple (SSA) by using Soot [Vallée-Rai’99] A few, but not none!

Conclusions and future work StrongRelaxAJ: an extension to RelaxAJ with – Bounded type variables – Explicit signature of proceed A few chances to apply StrongRelaxAJ aspects according to the result of preliminaly experiments Future work includes – Completing type-checking rule – Discussing type-safety formally – Mining useful examples from real applications

Type-checking the return types of proceed and advice o=(Rs)e; ((U1)o).m1(); ((U2)o).m2(); Ra1 around(): match(Rs e) : Rp1 proceed(){ …} Ra2 around(): match(Rs e) : Rp2 proceed(){ …} Ra2 <= Rp1 Rs <= Rp1 Ra1 <= U1 Ra1 <= U2 Ra1 <= Rp2 Rs <= Rp2 Ra2 <= U1 Ra2 <= U2 Independent of order (precedence)

Background: around advice is useful changing Window to JWindow void showPreview(Frame mainWin){ Window popup= new Window(mainWin);... } JWindow popup= new JWindow(mainWin); JWindow Component WindowRPC JWindow around(Frame f): call(Window.new(Frame))&&args(f){ new JWindow(mainWin); }