
patterntesting.java.StackTraceAspect.aj Maven / Gradle / Ivy
Go to download
PatternTesting is a testing framework that allows to automatically verify
that Architecture/Design recommendations are implemented correctly in the
code. It uses AOP and AspectJ to perform this feat.
The newest version!
/**
* $Id: StackTraceAspect.aj,v 1.1 2008/09/16 20:18:15 oboehm Exp $
*
* Copyright (c) 2008 by Oliver Boehm
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express orimplied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* (c)reated 14.09.2008 by oliver ([email protected])
*/
package patterntesting.java;
import patterntesting.java.annotation.*;
/**
* @author oliver
* @since 14.09.2008
* @version $Revision: 1.1 $
*/
public aspect StackTraceAspect {
/**
* Invalid system logging.
*/
pointcut invalidStackTraceLogging() :
call (public void Throwable+.printStackTrace())
&& !within(@SuppressStackTraceWarning *)
&& !withincode(@SuppressStackTraceWarning *..*.new(..))
&& !withincode(@SuppressStackTraceWarning * *..*.*(..));
/**
* Declare logging to stdout and stderr being compilation errors.
*/
declare warning: invalidStackTraceLogging() :
"No logging should be done using Throwable.printStackTrace().";
}
/**
* $Log: StackTraceAspect.aj,v $
* Revision 1.1 2008/09/16 20:18:15 oboehm
* concrete StackTraceAspect and SystemAspect added
* (can be disabled via annotations)
*
* $Source: /cvsroot/patterntesting/PatternTesting05/src/main/aspect/patterntesting/java/StackTraceAspect.aj,v $
*/
© 2015 - 2025 Weber Informatics LLC | Privacy Policy