本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.TypeIds.T_ConfiguredAnnotationNonNullByDefault方法的典型用法代码示例。如果您正苦于以下问题:Java TypeIds.T_ConfiguredAnnotationNonNullByDefault方法的具体用法?Java TypeIds.T_ConfiguredAnnotationNonNullByDefault怎么用?Java TypeIds.T_ConfiguredAnnotationNonNullByDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.TypeIds
的用法示例。
在下文中一共展示了TypeIds.T_ConfiguredAnnotationNonNullByDefault方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: excludeDueToAnnotation
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
/**
* Returns true if a private member should not be warned as unused if
* annotated with a non-standard annotation.
* https://bugs.eclipse.org/365437
* https://bugs.eclipse.org/376590
*/
private boolean excludeDueToAnnotation(Annotation[] annotations, int problemId) {
int annotationsLen = 0;
if (annotations != null) {
annotationsLen = annotations.length;
} else {
return false;
}
if (annotationsLen == 0) return false;
for (int i = 0; i < annotationsLen; i++) {
TypeBinding resolvedType = annotations[i].resolvedType;
if (resolvedType != null) {
switch (resolvedType.id) {
case TypeIds.T_JavaLangSuppressWarnings:
case TypeIds.T_JavaLangDeprecated:
case TypeIds.T_JavaLangSafeVarargs:
case TypeIds.T_ConfiguredAnnotationNonNull:
case TypeIds.T_ConfiguredAnnotationNullable:
case TypeIds.T_ConfiguredAnnotationNonNullByDefault:
break;
case TypeIds.T_JavaxInjectInject:
case TypeIds.T_ComGoogleInjectInject:
if (problemId != IProblem.UnusedPrivateField)
return true; // @Inject on method/ctor does constitute a relevant use, just on fields it doesn't
break;
default:
// non-standard annotation found, don't warn
return true;
}
}
}
return false;
}
示例2: excludeDueToAnnotation
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
/**
* Returns true if a private member should not be warned as unused if
* annotated with a non-standard annotation.
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
*/
private boolean excludeDueToAnnotation(Annotation[] annotations) {
int annotationsLen = 0;
if (annotations != null) {
annotationsLen = annotations.length;
} else {
return false;
}
if (annotationsLen == 0) return false;
for (int i = 0; i < annotationsLen; i++) {
TypeBinding resolvedType = annotations[i].resolvedType;
if (resolvedType != null) {
switch (resolvedType.id) {
case TypeIds.T_JavaLangSuppressWarnings:
case TypeIds.T_JavaLangDeprecated:
case TypeIds.T_JavaLangSafeVarargs:
case TypeIds.T_ConfiguredAnnotationNonNull:
case TypeIds.T_ConfiguredAnnotationNullable:
case TypeIds.T_ConfiguredAnnotationNonNullByDefault:
break;
default:
// non-standard annotation found, don't warn
return true;
}
}
}
return false;
}