@SuppressWarnings("unchecked") private <T>T allowStaticAccessToMember(T member,boolean staticOnly){
  if (member == null)   return null;
  if (!staticOnly)   return member;
  boolean isStatic;
  if (member instanceof Variable) {
    Variable v=(Variable)member;
    isStatic=Modifier.isStatic(v.getModifiers());
  }
 else   if (member instanceof List) {
    List<MethodNode> list=(List<MethodNode>)member;
    if (list.size() == 1) {
      return (T)Collections.singletonList(allowStaticAccessToMember(list.get(0),staticOnly));
    }
    return (T)Collections.emptyList();
  }
 else {
    MethodNode mn=(MethodNode)member;
    isStatic=mn.isStatic();
  }
  if (staticOnly && !isStatic)   return null;
  return member;
}

@ SuppressWarnings ( "unchecked" ) private < T > T allowStaticAccessToMember ( T member , boolean staticOnly ) { if ( member == null ) return null ; if ( ! staticOnly ) return member ; boolean isStatic ; if ( member instanceof Variable ) { Variable v = ( Variable ) member ; isStatic = Modifier . isStatic ( v . getModifiers ( ) ) ; } else if ( member instanceof List ) { List < MethodNode > list = ( List < MethodNode > ) member ; if ( list . size ( ) == 1 ) { return ( T ) Collections . singletonList ( allowStaticAccessToMember ( list . get ( 0 ) , staticOnly ) ) ; } return ( T ) Collections . emptyList ( ) ; } else { MethodNode mn = ( MethodNode ) member ; isStatic = mn . isStatic ( ) ; } if ( staticOnly && ! isStatic ) return null ; return member ; }
this method is used to filter search results in which null means " no match " , to filter out illegal access to instance members from a static context . return null if the given member is not static , but we want to access in a static way ( staticonly = true ) . if we want to access in a non - static way we always return the member , since then access to static members and non - static members is allowed .
