All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aspectj.ajdt.internal.compiler.DefaultCompilerAdapter Maven / Gradle / Ivy

Go to download

AspectJ tools most notably contains the AspectJ compiler (AJC). AJC applies aspects to Java classes during compilation, fully replacing Javac for plain Java classes and also compiling native AspectJ or annotation-based @AspectJ syntax. Furthermore, AJC can weave aspects into existing class files in a post-compile binary weaving step. This library is a superset of AspectJ weaver and hence also of AspectJ runtime.

There is a newer version: 1.9.22.1
Show newest version
// AspectJ Extension
/*******************************************************************************
 * Copyright (c) 2004 IBM Corporation and others.
 * All rights reserved.
 * This program and the accompanying materials are made available
 * under the terms of the Eclipse Public License v 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.aspectj.ajdt.internal.compiler;

import org.aspectj.org.eclipse.jdt.internal.compiler.Compiler;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit;

/**
 * This DefaultCompilerAdapter preserves the original behaviour of the 
 * JDT compiler.
 */
public class DefaultCompilerAdapter implements ICompilerAdapter {
	private Compiler compiler;
	
	public DefaultCompilerAdapter(Compiler compiler) {
		this.compiler = compiler;
	}
	
	/* (non-Javadoc)
	 * @see org.aspectj.org.eclipse.jdt.internal.compiler.ICompilerAdapter#beforeCompiling(org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit[])
	 */
	@Override
	public void beforeCompiling(ICompilationUnit[] sourceUnits) {}

	/* (non-Javadoc)
	 * @see org.aspectj.org.eclipse.jdt.internal.compiler.ICompilerAdapter#afterCompiling()
	 */
	@Override
	public void afterCompiling(CompilationUnitDeclaration[] units) {}
	
	/* (non-Javadoc)
	 * @see org.aspectj.org.eclipse.jdt.internal.compiler.ICompilerAdapter#beforeProcessing(org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration)
	 */
	@Override
	public void beforeProcessing(CompilationUnitDeclaration unit) {}
	
	/* (non-Javadoc)
	 * @see org.aspectj.org.eclipse.jdt.internal.compiler.ICompilerAdapter#afterProcessing(org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration)
	 */
	@Override
	public void afterProcessing(CompilationUnitDeclaration unit, int unitIndex) {
		unit.cleanUp();
		compiler.requestor.acceptResult(unit.compilationResult.tagAsAccepted());
		compiler.unitsToProcess[unitIndex] = null;
	}
	
	@Override
	public void beforeAnalysing(CompilationUnitDeclaration unit) {
		// no-op
	}
	
	/* (non-Javadoc)
	 * @see org.aspectj.org.eclipse.jdt.internal.compiler.ICompilerAdapter#beforeResolving(org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration, org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit, boolean, boolean, boolean)
	 */
	public void beforeResolving(CompilationUnitDeclaration unit,
			ICompilationUnit sourceUnit, boolean verifyMethods,
			boolean analyzeCode, boolean generateCode){
		// no-op
	}
	
	/* (non-Javadoc)
	 * @see org.aspectj.org.eclipse.jdt.internal.compiler.ICompilerAdapter#afterResolving(org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration, org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit, boolean, boolean, boolean)
	 */
	public void afterResolving(CompilationUnitDeclaration unit,
			ICompilationUnit sourceUnit, boolean verifyMethods,
			boolean analyzeCode, boolean generateCode) {
		if (compiler.unitsToProcess != null) compiler.unitsToProcess[0] = null; // release reference to processed unit declaration
		compiler.requestor.acceptResult(unit.compilationResult.tagAsAccepted());
	}

	@Override
	public void beforeResolving(CompilationUnitDeclaration unit) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void afterResolving(CompilationUnitDeclaration unit) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void afterAnalysing(CompilationUnitDeclaration unit) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void beforeGenerating(CompilationUnitDeclaration unit) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void afterGenerating(CompilationUnitDeclaration unit) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void afterDietParsing(CompilationUnitDeclaration[] units) {
		// TODO Auto-generated method stub
		
	}
}
// End AspectJ Extension




© 2015 - 2024 Weber Informatics LLC | Privacy Policy