AspectJ
   HOME

TheInfoList



OR:

AspectJ is an
aspect-oriented programming In computing, aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. It does so by adding behavior to existing code (an advice) ''without'' modifying th ...
(AOP) extension created at PARC for the
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
programming language. It is available in
Eclipse Foundation The Eclipse Foundation AISBL is an independent, Europe-based not-for-profit corporation that acts as a steward of the Eclipse open source software development community, with legal jurisdiction in the European Union. It is an organization suppo ...
open-source projects, both stand-alone and integrated into
Eclipse An eclipse is an astronomical event that occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three c ...
. AspectJ has become a widely used de facto standard for AOP by emphasizing simplicity and usability for end users. It uses Java-like syntax, and included IDE integrations for displaying crosscutting structure since its initial public release in 2001.


Simple language description

All valid Java programs are also valid AspectJ programs, but AspectJ lets programmers define special constructs called '' aspects''. Aspects can contain several entities unavailable to standard classes. These are: ; Extension methods: Allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class: : aspect VisitAspect ; Pointcuts: Allow a programmer to specify join points (well-defined moments in the execution of a program, like method call, object instantiation, or variable access). All pointcuts are expressions ( quantifications) that determine whether a given join point matches. For example, this point-cut matches the execution of any instance method in an object of type Point whose name begins with set: : pointcut set() : execution(* set*(..) ) && this(Point); ; Advices: Allow a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed ''before'', ''after'', or ''around'' the specified join point. Here, the advice refreshes the display every time something on Point is set, using the pointcut declared above: : after () : set() AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). See th
AspectJ Programming Guide
for a more detailed description of the language.


AspectJ compatibility and implementations

AspectJ can be implemented in many ways, including source-weaving or bytecode-weaving, and directly in the virtual machine (VM). In all cases, the AspectJ program becomes a valid Java program that runs in a Java VM. Classes affected by aspects are binary-compatible with unaffected classes (to remain compatible with classes compiled with the unaffected originals). Supporting multiple implementations allows the language to grow as technology changes, and being Java-compatible ensures platform availability. Key to its success has been engineering and language decisions that make the language usable and programs deployable. The original Xerox AspectJ implementation used source weaving, which required access to source code. When Xerox contributed the code to Eclipse, AspectJ was reimplemented using the Eclipse Java compiler and a bytecode weaver based on BCEL, so developers could write aspects for code in binary (.class) form. At this time the AspectJ language was restricted to support a per-class model essential for incremental compilation and load-time weaving. This made IDE integrations as responsive as their Java counterparts, and it let developers deploy aspects without altering the build process. This led to increased adoption, as AspectJ became usable for impatient Java programmers and enterprise-level deployments. Since then, the Eclipse team has increased performance and correctness, upgraded the AspectJ language to support
Java 5 The Java language has undergone several changes since JDK 1.0 as well as numerous additions of classes and packages to the standard library. Since J2SE 1.4, the evolution of the Java language has been governed by the Java Community P ...
language features like
generics Generic or generics may refer to: In business * Generic term, a common name used for a range or class of similar things not protected by trademark * Generic brand, a brand for a product that does not have an associated brand or trademark, other ...
and
annotations An annotation is extra information associated with a particular point in a document or other piece of information. It can be a note that includes a comment or explanation. Annotations are sometimes presented in the margin of book pages. For anno ...
, and integrated annotation-style pure-java aspects from AspectWerkz. The Eclipse project supports both command-line and
Ant Ants are eusocial insects of the family Formicidae and, along with the related wasps and bees, belong to the order Hymenoptera. Ants evolved from vespoid wasp ancestors in the Cretaceous period. More than 13,800 of an estimated total of ...
interfaces. A related Eclipse project has steadily improved the Eclipse IDE support for AspectJ (called ''AspectJ Development Tools ( AJDT)'') and other providers of crosscutting structure. IDE support for
emacs Emacs , originally named EMACS (an acronym for "Editor MACroS"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, ...
,
NetBeans NetBeans is an integrated development environment (IDE) for Java. NetBeans allows applications to be developed from a set of modular software components called ''modules''. NetBeans runs on Windows, macOS, Linux and Solaris. In addition to Java ...
, and
JBuilder JBuilder is a discontinued integrated development environment (IDE) for the programming language Java from Embarcadero Technologies. Originally developed by Borland, JBuilder was spun off with CodeGear which was eventually purchased by Embarcader ...
foundered when Xerox put them into open source, but support for Oracle's JDeveloper did appear. IDE support has been key to Java programmers using AspectJ and understanding crosscutting concerns. BEA has offered limited VM support for aspect-oriented extensions, but for extensions supported in all Java VM's would require agreement through Sun's Java Community Process (see also the java.lang.instrument package available since Java SE 5 — which is a common ground for JVM load-time instrumentation). Academic interest in the semantics and implementation of aspect-oriented languages has surrounded AspectJ since its release. The leading research implementation of AspectJ is th
AspectBench Compiler
or ''abc''; it supports extensions for changing the syntax and semantics of the language and forms the basis for many AOP experiments that the AspectJ team can no longer support, given its broad user base. Many programmers discover AspectJ as an enabling technology for other projects, most notably
Spring AOP The Spring Framework is an application framework and inversion of control container for the Java platform. The framework's core features can be used by any Java application, but there are extensions for building web applications on top of the Java ...
. A sister Spring project,
Spring Roo Spring Roo is an open-source software tool that uses convention-over-configuration principles to provide rapid application development of Java-based enterprise software. The resulting applications use common Java technologies such as Spring Fr ...
, automatically maintains AspectJ inter-type declarations as its principal code generation output.


History and contributors

Gregor Kiczales Gregor Kiczales is an American computer scientist. He is currently a full time professor of computer science at the University of British Columbia in Vancouver, British Columbia, Canada. He is best known for developing the concept of aspect-ori ...
started and led the
Xerox PARC PARC (Palo Alto Research Center; formerly Xerox PARC) is a research and development company in Palo Alto, California. Founded in 1969 by Jacob E. "Jack" Goldman, chief scientist of Xerox Corporation, the company was originally a division of Xero ...
team that eventually developed AspectJ. He coined the term ''crosscutting''. Fourth on the team,
Chris Maeda AspectJ is an aspect-oriented programming (AOP) extension created at PARC (company), PARC for the Java (programming language), Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated i ...
coined the term ''aspect-oriented programming.''
Jim Hugunin Jim Hugunin is a software programmer who created the Python programming language extension Numeric (ancestor to NumPy), and later created Python implementations for the Java Platform (Jython) and for Microsoft .NET platform (IronPython); he ha ...
and Erik Hilsdale (
Xerox PARC PARC (Palo Alto Research Center; formerly Xerox PARC) is a research and development company in Palo Alto, California. Founded in 1969 by Jacob E. "Jack" Goldman, chief scientist of Xerox Corporation, the company was originally a division of Xero ...
team members 12 and 13) were the original compiler and weaver engineers,
Mik Kersten Mik Kersten is a Polish- Canadian computer specialist who created and leads the open-source Eclipse Mylyn project. Kersten invented the Task-Focused Interface technology underlying Mylyn while working on his PhD at the University of British Col ...
implemented the IDE integration and started th
Eclipse AJDT
project with Adrian Colyer (current lead of th
AspectJ project
and Andrew Clement (current compiler engineer). The AspectBench Compiler was developed and is maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the
Sable Research Group The sable (''Martes zibellina'') is a species In biology, a species is the basic unit of Taxonomy (biology), classification and a taxonomic rank of an organism, as well as a unit of biodiversity. A species is often defined as the largest ...
at
McGill University McGill University (french: link=no, Université McGill) is an English-language public research university located in Montreal, Quebec, Canada. Founded in 1821 by royal charter granted by King George IV,Frost, Stanley Brice. ''McGill Univer ...
, and the Institute for Basic Research in Computer Science (BRICS).


AspectWerkz

AspectWerkz is a dynamic, lightweight and high-performance AOP/AOSD framework for
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
. It has been merged with the AspectJ project, which supports AspectWerkz functionality since AspectJ 5. Jonas Boner and Alex Vasseur engineered the AspectWerkz project, and later contributed to the AspectJ project when it merged in the AspectWerkz annotation style and load-time weaving support. Unlike AspectJ prior to version 5, AspectWerkz did not add any new language constructs to Java, but instead supported declaration of aspects within Java annotations. It utilizes bytecode modification to weave classes at project build-time, class load time, as well as runtime. It uses standardized . Aspects can be defined using either Java annotations (introduced with Java 5), Java 1.3/1.4 custom doclet or a simple XML definition file. AspectWerkz provides an API to use the very same aspects for proxies, hence providing a transparent experience, allowing a smooth transition for users familiar with proxies. AspectWerkz is
free software Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, n ...
. The
LGPL The GNU Lesser General Public License (LGPL) is a free-software license published by the Free Software Foundation (FSF). The license allows developers and companies to use and integrate a software component released under the LGPL into their own ...
-style license allows the use of AspectWerkz 2.0 in both commercial and open source projects.


See also

*
Aspect-oriented programming In computing, aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. It does so by adding behavior to existing code (an advice) ''without'' modifying th ...
*
Spring AOP The Spring Framework is an application framework and inversion of control container for the Java platform. The framework's core features can be used by any Java application, but there are extensions for building web applications on top of the Java ...
(part of the
Spring Framework The Spring Framework is an application framework and inversion of control container for the Java platform. The framework's core features can be used by any Java application, but there are extensions for building web applications on top of the ...
) *
Aspect-oriented software development In computing, aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. It does so by adding behavior to existing code (an advice) ''without'' modifying ...


References

* * * *


External links


AJDT
* Aspect bench : https://web.archive.org/web/20170816093700/http://www.sable.mcgill.ca/abc/
AspectJ Home Page

AspectWerkz Project homepage

Improve modularity with aspect-oriented programming

Spring AOP and AspectJ Introduction


* Xerox has for AOP/AspectJ, but published AspectJ source code under th

which grants some patent rights. {{DEFAULTSORT:Aspectj Programming languages Aspect-oriented programming Aspect-oriented software development Cross-platform software Eclipse (software) Eclipse software Eclipse technology Java programming language family Software distribution Software using the Eclipse license Programming languages created in 2001 2001 software Cross-platform free software High-level programming languages