From 961da2a081517628ac605693c55ef844e91de29d Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 17 Feb 2005 15:11:14 +0000 Subject: [PATCH] Utility method adding for quizing whether you can find a SuppressAjWarnings annotation amongst some bunch of annotations and whether it suppresses a particular lint warning. --- .../src/org/aspectj/weaver/bcel/Utility.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/org/aspectj/weaver/bcel/Utility.java index 9a70029d5..ee47c67a6 100644 --- a/weaver/src/org/aspectj/weaver/bcel/Utility.java +++ b/weaver/src/org/aspectj/weaver/bcel/Utility.java @@ -19,11 +19,17 @@ import java.io.DataOutputStream; import java.io.IOException; import java.lang.reflect.Modifier; import java.util.Hashtable; +import java.util.List; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.ClassParser; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.classfile.annotation.Annotation; +import org.aspectj.apache.bcel.classfile.annotation.ArrayElementValue; +import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePair; +import org.aspectj.apache.bcel.classfile.annotation.ElementValue; +import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValue; import org.aspectj.apache.bcel.generic.ArrayType; import org.aspectj.apache.bcel.generic.BIPUSH; import org.aspectj.apache.bcel.generic.BasicType; @@ -602,4 +608,39 @@ public class Utility { public static boolean isConstantPushInstruction(Instruction i) { return (i instanceof ConstantPushInstruction) || (i instanceof LDC); } + + /** + * 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(Annotation[] anns,String lintkey) { + boolean suppressed = false; + // Go through the annotation types on the advice + for (int i = 0;!suppressed && i