Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

AspectJ

< >

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

#401on PLDB 23Years Old 671Repos
Homepage · REPL · Wikipedia

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 Example Token
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

- Build the next great programming language · Add · Issues · About · Search · Keywords · Livestreams · Labs · Resources · Acknowledgements

Built with Scroll v154.3.0