private void checkOrMarkPrivateAccess(Expression source,MethodNode mn){
  if (mn == null) {
    return;
  }
  ClassNode declaringClass=mn.getDeclaringClass();
  ClassNode enclosingClassNode=typeCheckingContext.getEnclosingClassNode();
  if (declaringClass != enclosingClassNode || typeCheckingContext.getEnclosingClosure() != null) {
    int mods=mn.getModifiers();
    boolean sameModule=declaringClass.getModule() == enclosingClassNode.getModule();
    String packageName=declaringClass.getPackageName();
    if (packageName == null) {
      packageName="";
    }
    if ((Modifier.isPrivate(mods) && sameModule)) {
      addPrivateFieldOrMethodAccess(source,declaringClass,StaticTypesMarker.PV_METHODS_ACCESS,mn);
    }
 else     if (Modifier.isProtected(mods) && !packageName.equals(enclosingClassNode.getPackageName()) && !implementsInterfaceOrIsSubclassOf(enclosingClassNode,declaringClass)) {
      ClassNode cn=enclosingClassNode;
      while ((cn=cn.getOuterClass()) != null) {
        if (implementsInterfaceOrIsSubclassOf(cn,declaringClass)) {
          addPrivateFieldOrMethodAccess(source,cn,StaticTypesMarker.PV_METHODS_ACCESS,mn);
          break;
        }
      }
    }
  }
}

private void checkOrMarkPrivateAccess ( Expression source , MethodNode mn ) { if ( mn == null ) { return ; } ClassNode declaringClass = mn . getDeclaringClass ( ) ; ClassNode enclosingClassNode = typeCheckingContext . getEnclosingClassNode ( ) ; if ( declaringClass != enclosingClassNode || typeCheckingContext . getEnclosingClosure ( ) != null ) { int mods = mn . getModifiers ( ) ; boolean sameModule = declaringClass . getModule ( ) == enclosingClassNode . getModule ( ) ; String packageName = declaringClass . getPackageName ( ) ; if ( packageName == null ) { packageName = "" ; } if ( ( Modifier . isPrivate ( mods ) && sameModule ) ) { addPrivateFieldOrMethodAccess ( source , declaringClass , StaticTypesMarker . PV_METHODS_ACCESS , mn ) ; } else if ( Modifier . isProtected ( mods ) && ! packageName . equals ( enclosingClassNode . getPackageName ( ) ) && ! implementsInterfaceOrIsSubclassOf ( enclosingClassNode , declaringClass ) ) { ClassNode cn = enclosingClassNode ; while ( ( cn = cn . getOuterClass ( ) ) != null ) { if ( implementsInterfaceOrIsSubclassOf ( cn , declaringClass ) ) { addPrivateFieldOrMethodAccess ( source , cn , StaticTypesMarker . PV_METHODS_ACCESS , mn ) ; break ; } } } } }
given a method node , checks if we are calling a private method from an inner class .
