Top 1,000 Features Creators Events Podcasts Extensions Blog Explorer CSV Download


< >

AspectJ is an open source programming language created in 2001 by Eric Bodden.

#370on PLDB 23Years Old 671Repos

Try now: Riju

AspectJ is an aspect-oriented programming (AOP) extension created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become a widely used de facto standard for AOP by emphasizing simplicity and usability for end users. Read more on Wikipedia...

Example from Riju:
public class Main { public static void main(String[] args) { System.out.println("Hello, world!"); } }
Example from hello-world:
System.out.println("Hello World");
Example from Linguist:
package com.blogspot.miguelinlas3.aspectj.cache; import java.util.Map; import java.util.WeakHashMap; import org.aspectj.lang.JoinPoint; import com.blogspot.miguelinlas3.aspectj.cache.marker.Cacheable; /** * This simple aspect simulates the behaviour of a very simple cache * * @author migue * */ public aspect CacheAspect { public pointcut cache(Cacheable cacheable): execution(@Cacheable * * (..)) && @annotation(cacheable); Object around(Cacheable cacheable): cache(cacheable){ String evaluatedKey = this.evaluateKey(cacheable.scriptKey(), thisJoinPoint); if(cache.containsKey(evaluatedKey)){ System.out.println("Cache hit for key " + evaluatedKey); return this.cache.get(evaluatedKey); } System.out.println("Cache miss for key " + evaluatedKey); Object value = proceed(cacheable); cache.put(evaluatedKey, value); return value; } protected String evaluateKey(String key, JoinPoint joinPoint) { // TODO add some smart staff to allow simple scripting in @Cacheable annotation return key; } protected Map<String, Object> cache = new WeakHashMap<String, Object>(); }
Example from Wikipedia:
pointcut set() : execution(* set*(..) ) && this(Point);

Language features

Feature Supported Token Example
Binary Literals โœ“
// 0[bB][01][01_]*[lL]?
Integers โœ“
// 0|[1-9][0-9_]*[lL]?
Floats โœ“
// ([0-9][0-9_]*\.([0-9][0-9_]*)?|\.[0-9][0-9_]*)([eE][+\-]?[0-9][0-9_]*)?[fFdD]?|[0-9][eE][+\-]?[0-9][0-9_]*[fFdD]?|[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFdD]|0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)[pP][+\-]?[0-9][0-9_]*[fFdD]?
Hexadecimals โœ“
// 0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?
Octals โœ“
// 0[0-7_]+[lL]?
Strings โœ“ "
"Hello world"
MultiLine Comments โœ“ /* */
/* A comment
Print() Debugging โœ“ System.out.println
Comments โœ“
// A comment
Line Comments โœ“ //
// A comment
Semantic Indentation X

View source

- Build the next great programming language ยท About ยท Resources ยท Acknowledgements ยท Part of the World Wide Scroll