blob: 2ca0173be03de5cf26f0eceef255b8806c45301c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/* *******************************************************************
* Copyright (c) 2008 Contributors.
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html
*
* ******************************************************************/
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;
}
}
|