Frequently Asked Questions about AJDT


Last updated on May 17, 2003.

The beginnings of an FAQ for AJDT...

1 Overview
1. What is AJDT?
2. Who develops AJDT?
3. Where can I get the latest version?
4. How does AJDT relate to the AspectJ project?
2 Community
1. Are there any newsgroups for AJDT users?
2. What do I do if I think I've found a bug in AJDT?
3. How can I request a new feature in AJDT?
4. Is there an AJDT mailing list?
3 Using AJDT
1. Why aren't AspectJ keywords highlighted in the editor?
2. Why are keywords like "aspect" underlined as problems?
3. Why doesn't the outline view update as I type in the editor?
4. How can I debug AspectJ programs in Eclipse?
5. Why is automatic building suppressed in AJDT?
6. How does the visualiser work?
7. What happened to the JoinPoint probe?
4 Contributing
1. How can I contribute to the AJDT project?
2. How can I package my sample code for contribution to the examples plugin?
3. Where will I find the source for AJDT?
4. How do I setup an AJDT development environment in Eclipse?
5 Plans
1. What new AJDT features are being worked on at the moment?

1 Overview

1. What is AJDT?

The AspectJ Development Tools project (AJDT) is a set of plugins for Eclipse that provide support for aspect-oriented software development using AspectJ within the Eclipse IDE.

2. Who develops AJDT?

AJDT is an open-source project hosted on eclipse.org, current contributors are listed on the website. Anyone can get involved, see "How can I contribute?"

3. Where can I get the latest version?

The latest releases are available from the AJDT download page.

4. How does AJDT relate to the AspectJ project?

AJDT provides Eclipse IDE integration for AspectJ, and includes the Ajde libraries from the AspectJ project as part of its packaging. Development of the AspectJ compiler and AJDE takes place under the AspectJ project.

2 Community

1. Are there any newsgroups for AJDT users?

AJDT is supported through the eclipse.technology.ajdt newsgroup. A web interface is also available.

2. What do I do if I think I've found a bug in AJTD?

First check the bug database to see if you've hit a known problem. There's also a view built into AJDT (Window->Show View->Other...->AspectJ->AJDT Event Trace) that displays a lot of diagnostic information about the execution of the plugin (for example, it will show you the exact classpaths being used for compilation). If it appears to be a genuinely new bug, please submit a bug report on AJDT using bugzilla following the bug reporting guidelines.

3. How can I request a new feature in AJDT?

Informal requests can be posted to the newsgroup or mailing list. Formal requests can be made by raising an AJDT enhancement request on Bugzilla.

4. Is there an AJDT mailing list?

AJDT has a developers mailing list, ajdt-dev@dev.eclipse.org, with archives and subscription information available online. Questions regarding the use of AspectJ the language are best directed to the AspectJ users mailing list.

3 Using AJDT

1. Why aren't AspectJ keywords highlighted in the editor?

The most common cause of this problem is opening Java files (files with the .java extension) using the JDT's Java Editor. AJDT provides an extension to the Java Editor, the AspectJ Editor, that recognizes AspectJ language structure and provides an outline view that displays crosscutting structure information. To configure Eclipse so that Java files are opened with the AspectJ editor, select "preferences" from the Window menu. Expand the workbench preferences and click on "File Associations." Select file type "*.java," then select the AspectJ Editor and click the "Default" button.

2. Why are keywords like "aspect" underlined as problems (red squiggle underline)?

AJDT doesn't yet provide an eager parser for AspectJ. The early problem indication support is therefore expecting to see a regular Java program, and so treats AspectJ keywords as errors. The squiggles can be turned off by opening preferences from the Window menu: Expand the Java preferences and click on "Editor." In the "Problem Indication" tab, uncheck the option "Show problems before compiling."

3. Why doesn't the outline view update as I type in the editor?

AJDT doesn't yet provide an eager parser for AspectJ, so the understanding of the editor buffer contents needed to update the outline view is only after a compilation. The process of compiling creates a structure model (including the crosscutting information) that the outline view then renders.

4. How can I debug AspectJ programs in Eclipse?

The class files generated by AspectJ have the property that a single class file may have been generated from multiple source files (for example, the source file for a domain class and the source file for an aspect that advises it). This complicates the line number table present in the class file, since we need to record not only which line number is associated with a set of bytecodes, but which file as well. Fortunately there's a JSR, JSR 45, which specifies how to do this in a standard way so that debuggers can interpret the information correctly. With a compiler that generates JSR 45 compliant meta-information in class files, a JSR 45 compliant JVM, and a JSR 45 compliant debugger, you will be able to seamlessly step across source files, set breakpoints etc..

JSR 45 didn't quite make it into the list of approved JSRs for JDK 1.4, but Sun's JDK provides an implementation of it anyway! Eclipse has JSR 45 support as a plan item for the 2.2 release. AspectJ 1.0.6 generates JSR 45 compliant class files, but the new 1.1 compiler doesn't (yet). When both Eclipse and AspectJ 1.1 support JSR 45 then full debug capability will be available.

In the meantime, you can work with AspectJ programs in the debugger with the following limitations:

  • You can only set breakpoints in Java classes (not aspects)
  • You can step into and through most aspect code (around advice is still problematic) - use "step into" instead of "step over" on an adviced line of source in order to step into the aspect code.
  • If you use "step over" to step past a line of code, this will also step over any advice applied to that line in one step.

5. Why is automatic building suppressed in AJDT?

The AJDT support for incremental compilation mode is not complete. In particular the outline view is only updated for the file currently being edited, to refresh the structure model select "Project-rebuild all." Incremental support in AspectJ itself is also one of the newest and therefore least tested features on real world projects. AJDT therefore turns off incremental compilation by default, and builds are done on demand using the AJDT build button. You can turn automatic building back on by selecting preferences from the Window menu, and in the AspectJ page deselect "Suppress automatic building for AspectJ projects." These automatic builds will be *full* builds unless you also select the incremental compilation option on the properties page of the project in question.

6. How does the visualiser work?

The visualiser consists of two views, the Aspect Visualiser and the Aspect Menu, both of which need to be open: Select "Window" , "Show View" , "Other... AspectJ" from the taskbar, then select "Aspect Visualiser" and "Aspect Menu " and click OK.

To visualise an AspectJ project, click on the AspectJ Project in the Package Explorer (for the Visualiser to work you must have at least one aspect active in the project i.e. included in the current build list). The aspects defined in that project should appear in the Menu. The Visualiser shows all the classes in your project with bar length proportional to number of lines of code. Dark bars represent classes not affected by an aspect. Coloured lines on the white bars represent lines of code affected by the Aspect in the Menu which has the corresponding colour. It is also possible to click on individual classes or packages in the package explorer to see their individual representations.

The Visualiser starts in class mode by default. Click on the package button to choose package mode. Here each bar represents a package in your project and length is proportional to total number of lines. Package view was designed as an overview, particularly for large projects. Click on the class button to return to class mode.

In either package or class mode, clicking on the limit button restricts the view to affected bars only. Clicking again leaves limit mode.

Subselect mode can be used to view selected bars by themselves. Click on the title buttons of the required bars. Then click on the subselect button to view the selected bars. Click on the subselect button again to leave subselect mode. You may need to click on the project again in the package explorer.

To open the source file of a represented class, go into class mode and double click on the corresponding bar. To open a source file at a line affected by an aspect, go into class mode and double click on the corresponding coloured line.

7. What happened to the JoinPoint probe?

The JoinPoint probe was an experimental function that made a brief appearance in AJDT 0.5.2 and 0.6.0beta. We have temporarily removed it from AJDT whilst we work out the correct user-interaction model and port the Swing UI to SWT.

4 Contributing

1. How can I contribute to the AJDT project?

Your contributions to the AJDT project are strongly welcomed! You can create a patch that fixes a bug or provides an enhancement and submit it to the AJDT developers either as an attachment to a bug in Bugzilla, or as an attachment to a post to the newsgroup or developer mailing list. You can also contribute sample code showing interesting uses of AspectJ, by adding entries to the example plugin. All contributions must be made available under the terms of the Eclipse website see the Eclipse contribution and participation FAQ. Sorry, but for legal reasons we are unable to accept patches emailed directly to developers, and will normally ask you to resubmit these either via Bugzilla or the mailing list.

AJDT development is run as a meritocracy, developers who have a track record of submitting good patches can become committers on the project.

2. How can I package my sample code for contribution to the examples plugin?

The org.eclipse.ajdt.examples plugin contains various sample projects which are made available under the Examples category of the New wizard, from where they can be imported into your workspace as AspectJ projects. It is easy to add new samples to this plugin, as follows:

  • Create a jar file containing your source code, and at least one build configuration file. Place this in the archive folder of the examples plugin.
  • Add an entry to the plugin.xml file for your sample project, by copying one of the existing entries.
  • Change the src attribute of the import element to refer to your jar file, and change the title, description, pagetitle, and pagedescription property names as appropriate, and add corresponding entries to the plugin.properties file.
  • Change the build attribute to refer to your default build configuration file. Your project may contain more configurations but the one specified here will be the one used to initially build the project.
  • Optionally, you can specify an open attribute to the projectsetup element, which refers to a file, such as a README file, which is opened after the project has been imported to the workspace.

3. Where will I find the source for AJDT?

AJDT source is held in the Eclipse CVS repository under /home/technology, see the root of the AJDT source tree online. AJDT is organized in subdirectories of org.eclipse.ajdt as follows:

  org.eclipse.ajdt
	|
	|--> plugins
		|--> org.eclipse.ajdt		(source of the AJDT UI plugin)
		|--> org.aspectj.ajde		(the AJDE plugin provided by the AspectJ project)
		|--> org.eclipse.aspectj	(the "feature" plugin that provides the AspectJ feature)
	|--> features
		|-->org.eclipse.aspectj		(the AspectJ feature)
	|--> update				(files used to create the AspectJ update site)
	|--> binaries				(archives of selected binaries made available for download)
	

4. How do I setup an AJDT development environment in Eclipse?

Start with a clean workspace under Eclipse 2.0.2 or 2.1:

  • Prepare your workspace for self-hosting: from the File menu select "Import...", choose "External plugins and fragments" and click "Next". Click "Next" again, the press then "Select All" button and click "Finish." If you are not in it already, switch to the Java Perspective. To reduce the clutter in the Package Explorer, click the downward pointing arrow icon on the Package Explorer toolbar, then choose "Filters..." Check "Hide binary plug-in projects" and press OK.
  • Create a CVS repository connection to dev.eclipse.org: connection type pserver, your username and password (or anonymous), repository path /home/technology, for example
    :pserver:anonymous@dev.eclipse.org:/home/technology
      (Detailed instructions...)
    • From the Window menu, select "Open Perspective..." , then "CVS Repository Exploring"
    • From the context menu in the CVS Repositories view, select New... Repository Location
    • Host = dev.eclipse.org, Repository path = /home/technology
    • Your userid and password, or "anonymous"
    • Connection type = pserver
    • Click "Finish"

  • Use the CVS Repositories view to navigate to org.eclipse.ajdt/plugins/org.aspectj.ajde. From the context (right mouse button) menu select "Check out as project."
  • Repeat this step for org.eclipse.ajdt/plugins/org.eclipse.ajdt and org.eclipse.ajdt/plugins/org.eclipse.apectj.
  • Navigate to org.eclipse.ajdt/features/org.eclipse.aspectj and from the context menu select "Check out as...," and then enter a project name of "org.eclipse.aspectj.feature" (of course, you can call the project whatever you like, that's just what I call it).
  • Navigate to org.eclipse.ajdt/update and "check out as..." project "org.eclipse.aspectj.updatesite." Note that you won't see this project in the Package Explorer - it doesn't contain any Java source. Use the Navigator to see the contents of this project.
Eclipse will build the projects as you import them (the order specified above allows dependencies to be met), so you're ready to run the plugins inside Eclipse straight away:
  • Switch back to the Java Perspective if you're not already in it...
  • From the run menu select "Run..."
  • Select "Run-time workbench" and click new
  • Give your launch configuration a name, and click "Run"
  • Subsequent runs can simpy use the launch configuration you just created
Now you're ready to start enhancing the plugins by adding to or extending the code in your projects - just use run (or debug) to test your changes. When you have a cool patch or bug fix to submit to the project, go the the "Team" item in the project context menu and select "Create Patch..."

Each of the projects you just created also contains an Ant build file, "build.xml." The default target builds a packaged version of the project in question. Use the build.xml file in the "update" project to invoke a master build that builds an entire update site structure in its "dist" directory.

  • Copy the contents of the dist directory to a clean directory, outside of your workspace. For example, "ajupdate."
  • From the help menu of the Eclipse in which you wish to install the AspectJ feature, choose "Software Updates..." and then "Update Manager."
  • Expand the "My Computer" branch and navigate to the "ajupdate" directory, and then "AspectJ."
  • Select "Eclipse AspectJ Development Tools" and then click on the "Install" button.

5 Plans

1. What new AJDT features are being worked on at the moment?

See the task list on our project home page.