本文整理了Java中bsh.Interpreter.debug()
方法的一些代码示例,展示了Interpreter.debug()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Interpreter.debug()
方法的具体详情如下:
包路径:bsh.Interpreter
类名称:Interpreter
方法名:debug
[英]Print a debug message on debug stream associated with this interpreter only if debugging is turned on.
[中]仅当调试已打开时,才在与此解释器关联的调试流上打印调试消息。
代码示例来源:origin: jitlogic/zorka
private static void logInvokeMethod(String msg, Method method, Object[] args) {
if (Interpreter.DEBUG) {
Interpreter.debug(msg + method + " with args:");
for (int i = 0; i < args.length; i++) {
final Object arg = args[i];
Interpreter.debug("args[" + i + "] = " + arg + " type = " + (arg == null ? "<unkown>" : arg.getClass()));
}
}
}
代码示例来源:origin: beanshell/beanshell
static void logInvokeMethod(String msg, Invocable method, Object[] args) {
if (Interpreter.DEBUG.get()) {
Interpreter.debug(msg, method, " with args:");
for (int i = 0; i < args.length; i++) {
final Object arg = args[i];
Interpreter.debug("args[", i, "] = ", arg, " type = ", (arg == null ? "<unknown>" : arg.getClass()));
}
}
}
代码示例来源:origin: beanshell/beanshell
@Override
public void addListener( Listener l ) {
listeners.addElement( new WeakReference( l, refQueue) );
// clean up old listeners
Reference deadref;
while ( (deadref = refQueue.poll()) != null ) {
if ( !listeners.removeElement( deadref ) )
Interpreter.debug(
"tried to remove non-existent weak ref: ", deadref);
}
}
代码示例来源:origin: jitlogic/zorka
@Override
public void addListener( Listener l ) {
listeners.addElement( new WeakReference( l, refQueue) );
// clean up old listeners
Reference deadref;
while ( (deadref = refQueue.poll()) != null ) {
boolean ok = listeners.removeElement( deadref );
if ( ok ) {
//System.err.println("cleaned up weak ref: "+deadref);
} else {
if ( Interpreter.DEBUG ) Interpreter.debug(
"tried to remove non-existent weak ref: "+deadref);
}
}
}
代码示例来源:origin: beanshell/beanshell
void loadRCFiles() {
try {
// Default is c:\windows under win98, $HOME under Unix
String rcfile =
System.getProperty("user.home") + File.separator + ".bshrc";
source( rcfile, globalNameSpace );
} catch ( Exception e ) {
// squeltch security exception, filenotfoundexception
Interpreter.debug("Could not find rc file: ", e);
}
}
代码示例来源:origin: beanshell/beanshell
public Object eval(
Class type, CallStack callstack, Interpreter interpreter )
throws EvalError
{
Interpreter.debug("array base type = ", type);
baseType = type;
if ( null == cached )
cached = eval( callstack, interpreter );
return cached;
}
代码示例来源:origin: jitlogic/zorka
/**
Evaluate the string in this interpreter's global namespace.
*/
public Object eval( String statements ) throws EvalError {
if ( Interpreter.DEBUG ) debug("eval(String): "+statements);
return eval(statements, globalNameSpace);
}
代码示例来源:origin: beanshell/beanshell
/**
Evaluate the string in this interpreter's global namespace.
*/
public Object eval( String statements ) throws EvalError {
Interpreter.debug("eval(String): ", statements);
return eval(statements, globalNameSpace);
}
代码示例来源:origin: jitlogic/zorka
void loadRCFiles() {
try {
String rcfile =
// Default is c:\windows under win98, $HOME under Unix
System.getProperty("user.home") + File.separator + ".bshrc";
source( rcfile, globalNameSpace );
} catch ( Exception e ) {
// squeltch security exception, filenotfoundexception
if ( Interpreter.DEBUG ) debug("Could not find rc file: "+e);
}
}
代码示例来源:origin: jitlogic/zorka
public Object evalArrayDimensions( BSHArrayDimensions node,
Class type )
throws EvalError
{
if ( Interpreter.DEBUG ) Interpreter.debug("array base type = "+type);
node.baseType = type;
return node.accept(this);
}
代码示例来源:origin: beanshell/beanshell
public void paintComponent( Graphics g ) {
// copy buffered image
if ( imageBuffer != null )
g.drawImage(imageBuffer, 0,0, this);
// Delegate call to scripted paint() method
if ( ths != null ) {
try {
ths.invokeMethod( "paint", new Object[] { g } );
} catch(EvalError e) {
Interpreter.debug(
"BshCanvas: method invocation error:", e);
}
}
}
代码示例来源:origin: jitlogic/zorka
/**
Read text from fileName and eval it.
*/
public Object source( String filename, NameSpace nameSpace )
throws FileNotFoundException, IOException, EvalError
{
File file = pathToFile( filename );
if ( Interpreter.DEBUG ) debug("Sourcing file: "+file);
Reader sourceIn = new BufferedReader( new FileReader(file) );
try {
return eval( sourceIn, nameSpace, filename );
} finally {
sourceIn.close();
}
}
代码示例来源:origin: jitlogic/zorka
public static Object getIndex(Object array, int index) throws ReflectError, UtilTargetError {
if (Interpreter.DEBUG) {
Interpreter.debug("getIndex: " + array + ", index=" + index);
}
try {
Object val = Array.get(array, index);
return Primitive.wrap(val, array.getClass().getComponentType());
} catch (ArrayIndexOutOfBoundsException e1) {
throw new UtilTargetError(e1);
} catch (Exception e) {
throw new ReflectError("Array access:" + e);
}
}
代码示例来源:origin: jitlogic/zorka
/**
* Invoke a method known to be static.
* No object instance is needed and there is no possibility of the
* method being a bsh scripted method.
*/
public static Object invokeStaticMethod(BshClassManager bcm, Class clas, String methodName, Object[] args) throws ReflectError, UtilEvalError, InvocationTargetException {
Interpreter.debug("invoke static Method");
Method method = resolveExpectedJavaMethod(bcm, clas, null, methodName, args, true);
return invokeMethod(method, null, args);
}
代码示例来源:origin: jitlogic/zorka
public static void setObjectProperty(Object obj, String propName, Object value) throws ReflectError, UtilEvalError {
String accessorName = accessorName("set", propName);
Object[] args = new Object[]{value};
Interpreter.debug("property access: ");
try {
Method method = resolveExpectedJavaMethod(null/*bcm*/, obj.getClass(), obj, accessorName, args, false);
invokeMethod(method, obj, args);
} catch (InvocationTargetException e) {
throw new UtilEvalError("Property accessor threw exception: " + e.getTargetException());
}
}
代码示例来源:origin: beanshell/beanshell
/**
Read text from fileName and eval it.
*/
public Object source( String filename, NameSpace nameSpace )
throws FileNotFoundException, IOException, EvalError
{
File file = pathToFile( filename );
Interpreter.debug("Sourcing file: ", file);
Reader sourceIn = new BufferedReader( new FileReader(file) );
try {
return eval( sourceIn, nameSpace, filename );
} finally {
sourceIn.close();
}
}
代码示例来源:origin: jitlogic/zorka
public Object lhsUnaryOperation( LHS lhs, boolean strictJava )
throws UtilEvalError
{
if ( Interpreter.DEBUG ) Interpreter.debug("lhsUnaryOperation");
Object prevalue, postvalue;
prevalue = lhs.getValue();
postvalue = unaryOperation(prevalue, kind);
Object retVal;
if ( postfix )
retVal = prevalue;
else
retVal = postvalue;
lhs.assign( postvalue, strictJava );
return retVal;
}
代码示例来源:origin: beanshell/beanshell
private Object lhsUnaryOperation( LHS lhs, boolean strictJava )
throws UtilEvalError
{
Interpreter.debug("lhsUnaryOperation");
Object prevalue, postvalue;
prevalue = lhs.getValue();
postvalue = unaryOperation(prevalue, kind);
Object retVal;
if ( postfix )
retVal = prevalue;
else
retVal = postvalue;
lhs.assign( postvalue, strictJava );
return retVal;
}
代码示例来源:origin: beanshell/beanshell
/**
Invoke a method known to be static.
No object instance is needed and there is no possibility of the
method being a bsh scripted method.
*/
public static Object invokeStaticMethod(
BshClassManager bcm, Class<?> clas, String methodName,
Object [] args, SimpleNode callerInfo )
throws ReflectError, UtilEvalError,
InvocationTargetException {
Interpreter.debug("invoke static Method");
NameSpace ns = getThisNS(clas);
if (null != ns)
ns.setNode(callerInfo);
Invocable method = resolveExpectedJavaMethod(
bcm, clas, null, methodName, args, true );
return method.invoke(null, args);
}
代码示例来源:origin: jitlogic/zorka
final public boolean Line() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 0:
jj_consume_token(0);
Interpreter.debug("End of File!");
{if (true) return true;}
break;
default:
if (jj_2_1(1)) {
BlockStatement();
{if (true) return false;}
} else {
jj_consume_token(-1);
throw new ParseException();
}
}
throw new Error("Missing return statement in function");
}
内容来源于网络,如有侵权,请联系作者删除!