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

org.aspectj.weaver.Utils Maven / Gradle / Ivy

Go to download

The AspectJ matcher can be used for matching pointcuts independently of any AspectJ compilation or weaving steps. Most notably, this can be used by frameworks such as Spring AOP which utilise the @AspectJ pointcut syntax but implement aspect weaving in a way independent of AspectJ, e.g. using dynamic proxies.

There is a newer version: 1.9.22.1
Show newest version
/* *******************************************************************
 * Copyright (c) 2008 Contributors.
 * 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
 *
 * ******************************************************************/
package org.aspectj.weaver;

/**
 *
 * @author Andy Clement
 */
public class Utils {

	/**
	 * Check if the annotations contain a SuppressAjWarnings annotation and if that annotation specifies that the given lint message
	 * (identified by its key) should be ignored.
	 *
	 */
	public static boolean isSuppressing(AnnotationAJ[] anns, String lintkey) {
		if (anns == null) {
			return false;
		}
		// Go through the annotation types on the advice
		for (AnnotationAJ ann : anns) {
			if (UnresolvedType.SUPPRESS_AJ_WARNINGS.getSignature().equals(ann.getTypeSignature())) {
				// Two possibilities:
				// 1. there are no values specified (i.e. @SuppressAjWarnings)
				// 2. there are values specified (i.e. @SuppressAjWarnings("A") or @SuppressAjWarnings({"A","B"})
				String value = ann.getStringFormOfValue("value");
				// Slightly lazy, just doing a string indexof
				if (value == null || value.contains(lintkey)) {
					return true;
				}
			}
		}
		return false;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy