org.eclipse.jdt.internal.compiler.ast.Annotation.nullTagBitsFromAnnotationValue()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中org.eclipse.jdt.internal.compiler.ast.Annotation.nullTagBitsFromAnnotationValue()方法的一些代码示例,展示了Annotation.nullTagBitsFromAnnotationValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.nullTagBitsFromAnnotationValue()方法的具体详情如下:
包路径:org.eclipse.jdt.internal.compiler.ast.Annotation
类名称:Annotation
方法名:nullTagBitsFromAnnotationValue

Annotation.nullTagBitsFromAnnotationValue介绍

[英]Convert the value() attribute of @NonNullByDefault into a bitvector a la Binding#NullnessDefaultMASK. This method understands value encodings from source and binary types. pre: null annotation analysis is enabled
[中]将@NonNullByDefault的value()属性转换为位向量a la Binding#nullnessdaultmask。此方法理解源类型和二进制类型的值编码。前置:已启用空批注分析

代码示例

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

/** given an application of @NonNullByDefault convert the annotation argument (if any) into a bitvector a la {@link Binding#NullnessDefaultMASK} */
// pre: null annotation analysis is enabled
int getNonNullByDefaultValue(IBinaryAnnotation annotation) {
  char[] annotationTypeName = annotation.getTypeName();
  char[][] typeName = CharOperation.splitOn('/', annotationTypeName, 1, annotationTypeName.length-1); // cut of leading 'L' and trailing ';'
  IBinaryElementValuePair[] elementValuePairs = annotation.getElementValuePairs();
  if (elementValuePairs == null || elementValuePairs.length == 0 ) {
    // no argument: apply default default
    ReferenceBinding annotationType = this.environment.getType(typeName);
    if (annotationType == null) return 0;
    if (annotationType.isUnresolvedType())
      annotationType = ((UnresolvedReferenceBinding) annotationType).resolve(this.environment, false);
    MethodBinding[] annotationMethods = annotationType.methods();
    if (annotationMethods != null && annotationMethods.length == 1) {
      Object value = annotationMethods[0].getDefaultValue();
      return Annotation.nullTagBitsFromAnnotationValue(value);
    }
  } else if (elementValuePairs.length > 0) {
    // evaluate the contained EnumConstantSignatures:
    int nullness = 0;
    for (int i = 0; i < elementValuePairs.length; i++)
      nullness |= Annotation.nullTagBitsFromAnnotationValue(elementValuePairs[i].getValue());
    return nullness;
  } else {
    // empty argument: cancel all defaults from enclosing scopes
    return NULL_UNSPECIFIED_BY_DEFAULT;
  }
  return 0;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/** given an application of @NonNullByDefault convert the annotation argument (if any) into a bitvector a la {@link Binding#NullnessDefaultMASK} */
// pre: null annotation analysis is enabled
int getNonNullByDefaultValue(IBinaryAnnotation annotation) {
  char[] annotationTypeName = annotation.getTypeName();
  char[][] typeName = CharOperation.splitOn('/', annotationTypeName, 1, annotationTypeName.length-1); // cut of leading 'L' and trailing ';'
  IBinaryElementValuePair[] elementValuePairs = annotation.getElementValuePairs();
  if (elementValuePairs == null || elementValuePairs.length == 0 ) {
    // no argument: apply default default
    ReferenceBinding annotationType = this.environment.getType(typeName);
    if (annotationType == null) return 0;
    if (annotationType.isUnresolvedType())
      annotationType = ((UnresolvedReferenceBinding) annotationType).resolve(this.environment, false);
    MethodBinding[] annotationMethods = annotationType.methods();
    if (annotationMethods != null && annotationMethods.length == 1) {
      Object value = annotationMethods[0].getDefaultValue();
      return Annotation.nullTagBitsFromAnnotationValue(value);
    }
  } else if (elementValuePairs.length > 0) {
    // evaluate the contained EnumConstantSignatures:
    int nullness = 0;
    for (int i = 0; i < elementValuePairs.length; i++)
      nullness |= Annotation.nullTagBitsFromAnnotationValue(elementValuePairs[i].getValue());
    return nullness;
  } else {
    // empty argument: cancel all defaults from enclosing scopes
    return NULL_UNSPECIFIED_BY_DEFAULT;
  }
  return 0;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

/** given an application of @NonNullByDefault convert the annotation argument (if any) into a bitvector a la {@link Binding#NullnessDefaultMASK} */
// pre: null annotation analysis is enabled
int getNonNullByDefaultValue(IBinaryAnnotation annotation) {
  char[] annotationTypeName = annotation.getTypeName();
  char[][] typeName = CharOperation.splitOn('/', annotationTypeName, 1, annotationTypeName.length-1); // cut of leading 'L' and trailing ';'
  IBinaryElementValuePair[] elementValuePairs = annotation.getElementValuePairs();
  if (elementValuePairs == null || elementValuePairs.length == 0 ) {
    // no argument: apply default default
    ReferenceBinding annotationType = this.environment.getType(typeName);
    if (annotationType == null) return 0;
    if (annotationType.isUnresolvedType())
      annotationType = ((UnresolvedReferenceBinding) annotationType).resolve(this.environment, false);
    MethodBinding[] annotationMethods = annotationType.methods();
    if (annotationMethods != null && annotationMethods.length == 1) {
      Object value = annotationMethods[0].getDefaultValue();
      return Annotation.nullTagBitsFromAnnotationValue(value);
    }
  } else if (elementValuePairs.length > 0) {
    // evaluate the contained EnumConstantSignatures:
    int nullness = 0;
    for (int i = 0; i < elementValuePairs.length; i++)
      nullness |= Annotation.nullTagBitsFromAnnotationValue(elementValuePairs[i].getValue());
    return nullness;
  } else {
    // empty argument: cancel all defaults from enclosing scopes
    return NULL_UNSPECIFIED_BY_DEFAULT;
  }
  return 0;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

tagBits |= nullTagBitsFromAnnotationValue(value);
} else {

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

tagBits |= nullTagBitsFromAnnotationValue(value);
} else {

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

tagBits |= nullTagBitsFromAnnotationValue(value);
} else {

相关文章