SideEffectAnnotation methodSideEffectAnnotation(Element element,boolean issueErrorIfMoreThanOnePresent){
  if (element != null) {
    List<SideEffectAnnotation> sideEffectAnnotationPresent=new ArrayList<>();
    for (    SideEffectAnnotation sea : SideEffectAnnotation.values()) {
      if (getDeclAnnotationNoAliases(element,sea.getAnnotationClass()) != null) {
        sideEffectAnnotationPresent.add(sea);
      }
    }
    int count=sideEffectAnnotationPresent.size();
    if (count == 0) {
      return defaults.applyUncheckedCodeDefaults(element) ? SideEffectAnnotation.MAYRELEASELOCKS : SideEffectAnnotation.RELEASESNOLOCKS;
    }
    if (count > 1 && issueErrorIfMoreThanOnePresent) {
    }
    SideEffectAnnotation weakest=sideEffectAnnotationPresent.get(0);
    for (    SideEffectAnnotation sea : sideEffectAnnotationPresent) {
      if (sea.isWeakerThan(weakest)) {
        weakest=sea;
      }
    }
    return weakest;
  }
  return SideEffectAnnotation.weakest();
}

SideEffectAnnotation methodSideEffectAnnotation ( Element element , boolean issueErrorIfMoreThanOnePresent ) { if ( element != null ) { List < SideEffectAnnotation > sideEffectAnnotationPresent = new ArrayList < > ( ) ; for ( SideEffectAnnotation sea : SideEffectAnnotation . values ( ) ) { if ( getDeclAnnotationNoAliases ( element , sea . getAnnotationClass ( ) ) != null ) { sideEffectAnnotationPresent . add ( sea ) ; } } int count = sideEffectAnnotationPresent . size ( ) ; if ( count == 0 ) { return defaults . applyUncheckedCodeDefaults ( element ) ? SideEffectAnnotation . MAYRELEASELOCKS : SideEffectAnnotation . RELEASESNOLOCKS ; } if ( count > 1 && issueErrorIfMoreThanOnePresent ) { } SideEffectAnnotation weakest = sideEffectAnnotationPresent . get ( 0 ) ; for ( SideEffectAnnotation sea : sideEffectAnnotationPresent ) { if ( sea . isWeakerThan ( weakest ) ) { weakest = sea ; } } return weakest ; } return SideEffectAnnotation . weakest ( ) ; }
indicates which side effect annotation is present on the given method . if more than one annotation is present , this method issues an error ( if issueerrorifmorethanonepresent is true ) and returns the annotation providing the weakest guarantee . only call with issueerrorifmorethanonepresent = = true when visiting a method definition . this prevents multiple errors being issued for the same method ( as would occur if issueerrorifmorethanonepresent were set to true when visiting method invocations ) . if no annotation is present , return releasesnolocks as the default , and mayreleaselocks as the default for unchecked code .
