Extending AJDT Charles Zhang University of Toronto.

Slides:



Advertisements
Similar presentations
Chapter 17 Failures and exceptions. This chapter discusses n Failure. n The meaning of system failure. n Causes of failure. n Handling failure. n Exception.
Advertisements

AspectWerkz 2 - and the road to AspectJ 5 Jonas Bonér Senior Software Engineer BEA Systems.
1..28 comparison of the leading aop tools report on February developerWorks articles Mik Kersten University of British Columbia.
AJDT and AspectJ Release Review | © 2007 by SpringSource, made available under the EPL v1.0 1 Release Review: AJDT and AspectJ
More on Classes Inheritance and Polymorphism
Bringing Procedural Knowledge to XLIFF Prof. Dr. Klemens Waldhör TAUS Labs & FOM University of Applied Science FEISGILTT 16 October 2012 Seattle, USA.
OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
Java Review Interface, Casting, Generics, Iterator.
Winter Compiler Construction T7 – semantic analysis part II type-checking Mooly Sagiv and Roman Manevich School of Computer Science Tel-Aviv.
Module 8 “Polymorphism and Inheritance”. Outline Understanding Inheritance Inheritance Diagrams Constructors in Derived Classes Type Compatibility Polymorphism.
Lecture 28: Abstract Classes & Inheritance Announcements & Review Lab 8 Due Thursday Image and color effects with 2D arrays Read: –Chapter 9 Cahoon & Davidson.
Inheritance. Class Relationships Composition: A class contains objects of other class(es) (actually, references to such objects) –A “has a” relationship.
Remote Method Invocation
ETX Workshop OOPSLA 2003 Prism pattern recognition for aspect mining Prism is Research in Software Modularization Charles Zhang and Hans-Arno Jacobsen.
University of British Columbia Software Practices Lab 2005 CASCON A Fluid AOP Editor Terry Hon Gregor Kiczales.
Preferences in Eclipse 3.0 Present by Kun-Tse Wu.
AspectJ2EE/Clasa Israel Institute of Technology The Computer Science department Itay Maman.
Aspect-Oriented Software Development (AOSD) Tutorial #3 AspectJ - continued.
Using Ant to build J2EE Applications Kumar
Io package as Java’s basic I/O system continue’d.
XFindBugs: eXtended FindBugs for AspectJ Haihao Shen, Sai Zhang, Jianjun Zhao, Jianhong Fang, Shiyuan Yao Software Theory and Practice Group (STAP) Shanghai.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Debugging Support.
IAdaptable Interface and Its Usage Te-Hsin Shih 03/26/2013.
Spring core v3.x Prepared by: Nhan Le. History v3.0 Spring Expression Language Java based bean metadata v3.1 Cache Abstraction Bean Definition Profile.
Aspect Oriented Programming Scott Nykl CSSE 411 Senior Seminar.
Extensible Plug-ins for Aspect-Oriented Programming Macneil Shonle*Ankit Shah.
Tool support for crosscutting concerns of API documentation Michihiro Horie, Shigeru Chiba Tokyo Institute of Technology, Japan.
Features of Object Oriented Programming Lec.4. ABSTRACTION AND ENCAPSULATION Computer programs can be very complex, perhaps the most complicated artifact.
Generalized Containers CSIS 3701: Advanced Object Oriented Programming.
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.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Using Aspects to Support the Software Process: XP over Eclipse Oren Mishali and Shmuel Katz Technion, Israel Institute of Technology.
© 2008 by Roy Ganor; made available under the EPL v1.0 | 19 th March 2008 Roy Ganor, Team Leader Zend Technologies, Ltd. March 19th 2008 EXTENDING THE.
These materials where developed by Martin Schray. Please feel free to use and modify them for non-commercial purposes. If you find them useful or would.
Introducing ABC: Programming Languages and AOP Oege de Moor Programming Tools Group University of Oxford joint work with Ganesh Sittampalam, Sascha Kuzins,
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
Génie logiciel Software Engineering Summary C. Petitpierre.
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.
Chapter 5 Objects and Classes Inheritance. Solution Assignments 3 & 4 Review in class…..
U n i v e r s i t y o f H a i l 1 ICS 202  2011 spring  Data Structures and Algorithms 
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
Aspect Oriented Programming Adlux Consultancy Services Pvt Ltd
Comparison of Different AOP Approaches Presented by: Xiaojing Wang.
(c) University of Washington06-1 CSC 143 Java Inheritance Tidbits.
1 Chapter 8 Class Inheritance and Interfaces F Superclasses and Subclasses  Keywords: super F Overriding methods  The Object Class  Modifiers: protected,
SourceAnatomy1 Java Source Anatomy Barb Ericson Georgia Institute of Technology July 2008.
University of British Columbia Software Practices Lab Uniform Support for Modeling Crosscutting Structure Maria Tkatchenko Gregor Kiczales Work supported.
AOP with AspectJ Awais Rashid, Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
Notices Assn 2 is due tomorrow, 7pm. Moodle quiz next week – written in the lab as before. Everything up to and including today’s lecture: Big Topics are.
CS/ENGRD 2110 SPRING 2016 Lecture 6: Consequence of type, casting; function equals 1.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Objects and Classes. F OO Programming Concepts F Creating Objects and Object Reference Variables –Differences between primitive data type and object type.
Software Development Java Classes and Methods
Remote Method Invocation
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Aspect-Oriented Programming
Class Inheritance (Cont.)
Methods (toString, equals)
COMPUTER 2430 Object Oriented Programming and Data Structures I
Inheritance.
Eclipse Plug-in Development
Announcements & Review
Recitation 7 October 7, 2011.
Defining Classes and Methods
Prism A Prism for research in software modularity through
Aspect Oriented Programming
ARV: Aspect Refactoring Verifier
Presentation transcript:

Extending AJDT Charles Zhang University of Toronto

Building an extension of AJDT Tap into the AspectJ compilation: Passive/Proactive Obtain the syntactic information ASTs of aspect, advice, pointcut declarations Obtain the structural information Relations between advices and matched Java program elements Produce consistent presentations Icons and markers

Example: Shadow comparison AST information about aspects: Kinds, names Joinpoint information: Type name, source location, advice kind Consistent L&F

Visiting ASTs of AspectJ Extend the AspectJ AST visitor: class MyVisitor extends AsmHierarchyBuilder{ public boolean visit(TypeDeclaration t, CompilationUnitScope s) { …} public boolean visit(MethodDeclaration m,ClassScope s) {…} } Visit passively: for compilation issued by Eclipse. Register the ASTWalker: org.aspectj.ajdt.internal.core.builder.AjBuildManager.setAsmHierarchyBuilder(MyVisitor ); Monitor the build process: extend org.aspectj.ajde.BuildListener register the build listener: Ajde.getDefault().getBuildManager().addListener(); Be aware of the racing condition: your stuff might be initialized before AJDT Visit proactively: programmatically invoke the AspectJ compiler outside of Eclipse: Get the classpath right: org.aspectj.ajde.NullIdeManager.init(String path); Register the ASTWalker the same way Invoke the compiler: In Java. Ajde.getDefault().getBuildManager().build(File buildlist) Through ant.

AST Walking: Getting pointcuts and advices Analyzing aspects: public boolean visit(TypeDeclaration td, CompilationUnitScope scope) { super.visit(typeDeclaration, scope); if(td instanceof AspectDeclaration){ SourceTypeBinding source = td.binding; String filename = new String(source.getFileName()); String aspectname_= ((AspectDeclaration)typeDeclaration).typeX.getName(); } return true; } Analyzing advices and pointcuts : public boolean visit(MethodDeclaration md,..) { if (md instanceof AdviceDeclaration || ) { String name = ((AdviceDeclaration)md).pointcutDesignator.getPointcut().toString(); } if (md instanceof PointcutDeclaration) { String name = ((PointcutDeclaration)md).pointcutDesignator.getPointcut().toString(); }

Structural model walking: Getting matched joinpoints Extend org.aspectj.asm.HierarchyWalker public void preProcess(IProgramElement node) { if(node.getKind().equals(IProgramElement.Kind.ADVICE)){ String key = node.getBytecodeName(); } if (node.getKind().equals( IProgramElement.Kind.DECLARE_WARNING)) { node.getBytecodeName(),node; } Trigger the walk of the structures: AsmManager.getDefault().getHierarchy().getRoot().walk(new MyWalker()); Obtain matched joinpoints: RelationshipMap mapper = (RelationshipMap)AsmManager.getDefault().getRelationshipMap(); List relations = mapper.get(node); Object o = relations.get(i).getTargets().get(j); IProgramElement element = hierarchy.findElementForHandle(o.toString());

Create AJDT Look and Feel Extend ILabelProvider class MyLabelProvider implements ILabelProvider { public Image getImage(Object element) { if(handle.value_.toString().indexOf("around")>0) return AspectJImages.instance().AROUND_ADVICE.getImageDescriptor().creat eImage(); if(handle.value_.toString().indexOf("before")>0) return AspectJImages.instance().BEFORE_ADVICE.getImageDescriptor().create Image(); if(handle.value_.toString().indexOf("after")>0) return AspectJImages.instance().AFTER_ADVICE.getImageDescriptor().createI mage(); }

More information The wiki is the most up to date resource on how to interact with AJDT and the compiler: nd_AspectJ nd_AspectJ (Tiny URL: ) AspectJ and AJDT FAQs: