protected static Method resolveJavaMethod(BshClassManager bcm,Class clas,String name,Class[] types,boolean staticOnly) throws UtilEvalError {
  if (clas == null)   throw new InterpreterError("null class");
  Method method=null;
  if (bcm == null)   Interpreter.debug("resolveJavaMethod UNOPTIMIZED lookup");
 else   method=bcm.getResolvedMethod(clas,name,types,staticOnly);
  if (method == null) {
    boolean publicOnly=!Capabilities.haveAccessibility();
    try {
      method=findOverloadedMethod(clas,name,types,publicOnly);
    }
 catch (    SecurityException e) {
      throw new UtilTargetError("Security Exception while searching methods of: " + clas,e);
    }
    checkFoundStaticMethod(method,staticOnly,clas);
    if (method != null && !publicOnly) {
      try {
        ReflectManager.RMSetAccessible(method);
      }
 catch (      UtilEvalError e) {
      }
    }
    if (method != null && bcm != null)     bcm.cacheResolvedMethod(clas,types,method);
  }
  return method;
}

protected static Method resolveJavaMethod ( BshClassManager bcm , Class clas , String name , Class [ ] types , boolean staticOnly ) throws UtilEvalError { if ( clas == null ) throw new InterpreterError ( "null class" ) ; Method method = null ; if ( bcm == null ) Interpreter . debug ( "resolveJavaMethod UNOPTIMIZED lookup" ) ; else method = bcm . getResolvedMethod ( clas , name , types , staticOnly ) ; if ( method == null ) { boolean publicOnly = ! Capabilities . haveAccessibility ( ) ; try { method = findOverloadedMethod ( clas , name , types , publicOnly ) ; } catch ( SecurityException e ) { throw new UtilTargetError ( "Security Exception while searching methods of: " + clas , e ) ; } checkFoundStaticMethod ( method , staticOnly , clas ) ; if ( method != null && ! publicOnly ) { try { ReflectManager . RMSetAccessible ( method ) ; } catch ( UtilEvalError e ) { } } if ( method != null && bcm != null ) bcm . cacheResolvedMethod ( clas , types , method ) ; } return method ; }
the full blown resolver method . all other method invocation methods delegate to this . the method may be static or dynamic unless staticonly is set ( in which case object may be null ) . if staticonly is set then only static methods will be located . < p / > this method performs caching ( caches discovered methods through the class manager and utilizes cached methods . ) < p / > this method determines whether to attempt to use non - public methods based on capabilities . haveaccessibility ( ) and will set the accessibilty flag on the method as necessary . < p / > if , when directed to find a static method , this method locates a more specific matching instance method it will throw a descriptive exception analogous to the error that the java compiler would produce . note : as of 2 . 0 . x this is a problem because there is no way to work around this with a cast . < p / >
