Bug 63304 - Support type patterns for AspectJ
Summary: Support type patterns for AspectJ
Status: REOPENED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-20 15:55 EDT by Ron Bodkin CLA
Modified: 2013-04-19 15:04 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2004-05-20 15:55:17 EDT
Allow defining type names that can be used anywhere a type pattern can be used 
in AspectJ (e.g., in ). This will allow reuse and composition of patterns, 
which is going to be especially important when resolving 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=44365 and adding support for JSR-
175 annotations to AspectJ.

It would be *very* beneficial if these type names could be used for inter-type 
declarations and declare forms like declare soft, instead of requiring these 
to be restricted to a single type.

Example syntax (proposed by Jim):
  declare typename: PublicFinalType: public final *;

It would be conceptually nice if these type names could be used throughout a 
code base wherever a type is allowed (basically providing a typedef facility 
for Java), although that would represent a significant non-AOP extension to 
Java.
Comment 1 Ben Youngdahl CLA 2004-09-24 14:20:35 EDT
Why limit such an addition to just type patterns?  How about method,
constructor, and field patterns as well?  Looking at the AspectJ 1.1 quick
reference I'm not seeing a mechanism to use OR-operators ( || ) for these
patterns, but, why not?

For example, if I need to define call() and execution() pointcuts across the
same set of methods, its bad from a maintenance standpoint to have to copy the
signatures multiple times.  For example:

pointcut fooCalls() : call(... method signature 1 ...) || call ( ... method
signature 2 ... ) || etc.;
pointcut fooExecutions() : call(... method signature 1 ...) || call ( .. method
signature 2 ... ) || etc.;

Why not support a way to define a set of method signatures, attach a name to it,
and then do:
pointcut fooCalls() : call(fooMethods);
pointcut fooExecutions() : execution(fooMethods);

Thanks for your consideration of this opinion.
Comment 2 Adrian Colyer CLA 2005-08-26 11:05:47 EDT
We're not going to get to this in AJ 1.5.0. Marking as "LATER" for consideration
in 1.5.1 and future release planning.

Something like this *should* make it into AJ sooner rather than later though I hope.
Comment 3 Eclipse Webmaster CLA 2009-08-30 02:51:15 EDT
LATER/REMIND bugs are being automatically reopened as P5 because the LATER and REMIND resolutions are deprecated.
Comment 4 Matthew Adams CLA 2013-04-19 14:11:12 EDT
Any change in status for this?  I'd still like to be able to prevent inheritance within certain packages or types, especially as I use traits more & more:

public abstract aspect AbstractExtend {

	public static class Nothing {}

	/**
	 * Type expression provided by subaspects to identify types that are not
	 * allowed to use inheritance.
	 */
	public abstract type restrictedTypes;

	public type requiredInheritance: Enum+ && Annotation+;
	
	declare parents:
		(restrictedTypes && !requiredInheritance)
		extends Nothing;
}
Comment 5 Andrew Clement CLA 2013-04-19 15:04:30 EDT
no change I'm afraid, I'm heads down in JDT Core Java 8 right now.