Java 类jdk.nashorn.internal.runtime.RewriteException 实例源码

项目:OpenJSharp    文件:ClassEmitter.java   
/**
 * Add a new method to the class, representing a rest-of version of the function node
 *
 * @param functionNode the function node to generate a method for
 * @return method emitter to use for weaving this method
 */
MethodEmitter restOfMethod(final FunctionNode functionNode) {
    methodCount++;
    methodNames.add(functionNode.getName());
    final MethodVisitor mv = cw.visitMethod(
        ACC_PUBLIC | ACC_STATIC,
        functionNode.getName(),
        Type.getMethodDescriptor(functionNode.getReturnType().getTypeClass(), RewriteException.class),
        null,
        null);

    return new MethodEmitter(this, mv, functionNode);
}
项目:openjdk-jdk10    文件:ClassEmitter.java   
/**
 * Add a new method to the class, representing a rest-of version of the
 * function node.
 *
 * @param functionNode the function node to generate a method for
 *
 * @return method emitter to use for weaving this method
 */
MethodEmitter restOfMethod(final FunctionNode functionNode) {
    methodCount++;
    methodNames.add(functionNode.getName());
    final MethodVisitor mv = cw.visitMethod(
        ACC_PUBLIC | ACC_STATIC,
        functionNode.getName(),
        Type.getMethodDescriptor(functionNode.getReturnType().getTypeClass(), RewriteException.class),
        null,
        null);

    return new MethodEmitter(this, mv, functionNode);
}
项目:openjdk-jdk10    文件:ExceptionsNotSerializable.java   
@Test
public void rewriteExceptionNotSerializable() throws ScriptException {
    // NOTE: we must create a RewriteException in a context of a Nashorn engine, as it uses Global.newIntance()
    // internally.
    final ScriptEngine e = new NashornScriptEngineFactory().getScriptEngine();
    e.put("f", new Runnable() {
        @Override
        public void run() {
            tryToSerialize(RewriteException.create(null, new Object[0], new String[0]));
        }
    });
    e.eval("f()");
}
项目:openjdk9    文件:ClassEmitter.java   
/**
 * Add a new method to the class, representing a rest-of version of the
 * function node.
 *
 * @param functionNode the function node to generate a method for
 *
 * @return method emitter to use for weaving this method
 */
MethodEmitter restOfMethod(final FunctionNode functionNode) {
    methodCount++;
    methodNames.add(functionNode.getName());
    final MethodVisitor mv = cw.visitMethod(
        ACC_PUBLIC | ACC_STATIC,
        functionNode.getName(),
        Type.getMethodDescriptor(functionNode.getReturnType().getTypeClass(), RewriteException.class),
        null,
        null);

    return new MethodEmitter(this, mv, functionNode);
}
项目:openjdk9    文件:ExceptionsNotSerializable.java   
@Test
public void rewriteExceptionNotSerializable() throws ScriptException {
    // NOTE: we must create a RewriteException in a context of a Nashorn engine, as it uses Global.newIntance()
    // internally.
    final ScriptEngine e = new NashornScriptEngineFactory().getScriptEngine();
    e.put("f", new Runnable() {
        @Override
        public void run() {
            tryToSerialize(RewriteException.create(null, new Object[0], new String[0]));
        }
    });
    e.eval("f()");
}
项目:kaziranga    文件:ClassEmitter.java   
/**
 * Add a new method to the class, representing a rest-of version of the
 * function node.
 *
 * @param functionNode the function node to generate a method for
 *
 * @return method emitter to use for weaving this method
 */
MethodEmitter restOfMethod(final FunctionNode functionNode) {
    methodCount++;
    methodNames.add(functionNode.getName());
    final MethodVisitor mv = cw.visitMethod(
        ACC_PUBLIC | ACC_STATIC,
        functionNode.getName(),
        Type.getMethodDescriptor(functionNode.getReturnType().getTypeClass(), RewriteException.class),
        null,
        null);

    return new MethodEmitter(this, mv, functionNode);
}
项目:kaziranga    文件:ExceptionsNotSerializable.java   
@Test
public void rewriteExceptionNotSerializable() throws ScriptException {
    // NOTE: we must create a RewriteException in a context of a Nashorn engine, as it uses Global.newIntance()
    // internally.
    final ScriptEngine e = new NashornScriptEngineFactory().getScriptEngine();
    e.put("f", new Runnable() {
        @Override
        public void run() {
            tryToSerialize(RewriteException.create(null, new Object[0], new String[0]));
        }
    });
    e.eval("f()");
}
项目:lookaside_java-1.8.0-openjdk    文件:ClassEmitter.java   
/**
 * Add a new method to the class, representing a rest-of version of the
 * function node.
 *
 * @param functionNode the function node to generate a method for
 *
 * @return method emitter to use for weaving this method
 */
MethodEmitter restOfMethod(final FunctionNode functionNode) {
    methodCount++;
    methodNames.add(functionNode.getName());
    final MethodVisitor mv = cw.visitMethod(
        ACC_PUBLIC | ACC_STATIC,
        functionNode.getName(),
        Type.getMethodDescriptor(functionNode.getReturnType().getTypeClass(), RewriteException.class),
        null,
        null);

    return new MethodEmitter(this, mv, functionNode);
}
项目:lookaside_java-1.8.0-openjdk    文件:ExceptionsNotSerializable.java   
@Test
public void rewriteExceptionNotSerializable() throws ScriptException {
    // NOTE: we must create a RewriteException in a context of a Nashorn engine, as it uses Global.newIntance()
    // internally.
    final ScriptEngine e = new NashornScriptEngineFactory().getScriptEngine();
    e.put("f", new Runnable() {
        @Override
        public void run() {
            tryToSerialize(RewriteException.create(null, new Object[0], new String[0]));
        }
    });
    e.eval("f()");
}
项目:jdk8u_nashorn    文件:ClassEmitter.java   
/**
 * Add a new method to the class, representing a rest-of version of the
 * function node.
 *
 * @param functionNode the function node to generate a method for
 *
 * @return method emitter to use for weaving this method
 */
MethodEmitter restOfMethod(final FunctionNode functionNode) {
    methodCount++;
    methodNames.add(functionNode.getName());
    final MethodVisitor mv = cw.visitMethod(
        ACC_PUBLIC | ACC_STATIC,
        functionNode.getName(),
        Type.getMethodDescriptor(functionNode.getReturnType().getTypeClass(), RewriteException.class),
        null,
        null);

    return new MethodEmitter(this, mv, functionNode);
}
项目:jdk8u_nashorn    文件:ExceptionsNotSerializable.java   
@Test
public void rewriteExceptionNotSerializable() throws ScriptException {
    // NOTE: we must create a RewriteException in a context of a Nashorn engine, as it uses Global.newIntance()
    // internally.
    final ScriptEngine e = new NashornScriptEngineFactory().getScriptEngine();
    e.put("f", new Runnable() {
        @Override
        public void run() {
            tryToSerialize(RewriteException.create(null, new Object[0], new String[0]));
        }
    });
    e.eval("f()");
}
项目:infobip-open-jdk-8    文件:ClassEmitter.java   
/**
 * Add a new method to the class, representing a rest-of version of the function node
 *
 * @param functionNode the function node to generate a method for
 * @return method emitter to use for weaving this method
 */
MethodEmitter restOfMethod(final FunctionNode functionNode) {
    methodCount++;
    methodNames.add(functionNode.getName());
    final MethodVisitor mv = cw.visitMethod(
        ACC_PUBLIC | ACC_STATIC,
        functionNode.getName(),
        Type.getMethodDescriptor(functionNode.getReturnType().getTypeClass(), RewriteException.class),
        null,
        null);

    return new MethodEmitter(this, mv, functionNode);
}
项目:OpenJSharp    文件:RecompilationEvent.java   
/**
 * Constructor
 *
 * @param level            logging level
 * @param rewriteException rewriteException wrapped by this RuntimEvent
 * @param returnValue      rewriteException return value - as we don't want to make
 *     {@code RewriteException.getReturnValueNonDestructive()} public, we pass it as
 *     an extra parameter, rather than querying the getter from another package.
 */
public RecompilationEvent(final Level level, final RewriteException rewriteException, final Object returnValue) {
    super(level, rewriteException);
    assert Context.getContext().getLogger(RecompilableScriptFunctionData.class).isEnabled() :
        "Unit test/instrumentation purpose only: RecompilationEvent instances should not be created without '--log=recompile', or we will leak memory in the general case";
    this.returnValue = returnValue;
}
项目:openjdk-jdk10    文件:RecompilationEvent.java   
/**
 * Constructor
 *
 * @param level            logging level
 * @param rewriteException rewriteException wrapped by this RuntimEvent
 * @param returnValue      rewriteException return value - as we don't want to make
 *     {@code RewriteException.getReturnValueNonDestructive()} public, we pass it as
 *     an extra parameter, rather than querying the getter from another package.
 */
public RecompilationEvent(final Level level, final RewriteException rewriteException, final Object returnValue) {
    super(level, rewriteException);
    assert Context.getContext().getLogger(RecompilableScriptFunctionData.class).isEnabled() :
        "Unit test/instrumentation purpose only: RecompilationEvent instances should not be created without '--log=recompile', or we will leak memory in the general case";
    this.returnValue = returnValue;
}
项目:openjdk9    文件:RecompilationEvent.java   
/**
 * Constructor
 *
 * @param level            logging level
 * @param rewriteException rewriteException wrapped by this RuntimEvent
 * @param returnValue      rewriteException return value - as we don't want to make
 *     {@code RewriteException.getReturnValueNonDestructive()} public, we pass it as
 *     an extra parameter, rather than querying the getter from another package.
 */
public RecompilationEvent(final Level level, final RewriteException rewriteException, final Object returnValue) {
    super(level, rewriteException);
    assert Context.getContext().getLogger(RecompilableScriptFunctionData.class).isEnabled() :
        "Unit test/instrumentation purpose only: RecompilationEvent instances should not be created without '--log=recompile', or we will leak memory in the general case";
    this.returnValue = returnValue;
}
项目:kaziranga    文件:RecompilationEvent.java   
/**
 * Constructor
 *
 * @param level            logging level
 * @param rewriteException rewriteException wrapped by this RuntimEvent
 * @param returnValue      rewriteException return value - as we don't want to make
 *     {@code RewriteException.getReturnValueNonDestructive()} public, we pass it as
 *     an extra parameter, rather than querying the getter from another package.
 */
public RecompilationEvent(final Level level, final RewriteException rewriteException, final Object returnValue) {
    super(level, rewriteException);
    assert Context.getContext().getLogger(RecompilableScriptFunctionData.class).isEnabled() :
        "Unit test/instrumentation purpose only: RecompilationEvent instances should not be created without '--log=recompile', or we will leak memory in the general case";
    this.returnValue = returnValue;
}
项目:lookaside_java-1.8.0-openjdk    文件:RecompilationEvent.java   
/**
 * Constructor
 *
 * @param level            logging level
 * @param rewriteException rewriteException wrapped by this RuntimEvent
 * @param returnValue      rewriteException return value - as we don't want to make
 *     {@code RewriteException.getReturnValueNonDestructive()} public, we pass it as
 *     an extra parameter, rather than querying the getter from another package.
 */
public RecompilationEvent(final Level level, final RewriteException rewriteException, final Object returnValue) {
    super(level, rewriteException);
    assert Context.getContext().getLogger(RecompilableScriptFunctionData.class).isEnabled() :
        "Unit test/instrumentation purpose only: RecompilationEvent instances should not be created without '--log=recompile', or we will leak memory in the general case";
    this.returnValue = returnValue;
}
项目:jdk8u_nashorn    文件:RecompilationEvent.java   
/**
 * Constructor
 *
 * @param level            logging level
 * @param rewriteException rewriteException wrapped by this RuntimEvent
 * @param returnValue      rewriteException return value - as we don't want to make
 *     {@code RewriteException.getReturnValueNonDestructive()} public, we pass it as
 *     an extra parameter, rather than querying the getter from another package.
 */
public RecompilationEvent(final Level level, final RewriteException rewriteException, final Object returnValue) {
    super(level, rewriteException);
    assert Context.getContext().getLogger(RecompilableScriptFunctionData.class).isEnabled() :
        "Unit test/instrumentation purpose only: RecompilationEvent instances should not be created without '--log=recompile', or we will leak memory in the general case";
    this.returnValue = returnValue;
}
项目:infobip-open-jdk-8    文件:RecompilationEvent.java   
/**
 * Constructor
 *
 * @param level            logging level
 * @param rewriteException rewriteException wrapped by this RuntimEvent
 * @param returnValue      rewriteException return value - as we don't want to make
 *     {@code RewriteException.getReturnValueNonDestructive()} public, we pass it as
 *     an extra parameter, rather than querying the getter from another package.
 */
public RecompilationEvent(final Level level, final RewriteException rewriteException, final Object returnValue) {
    super(level, rewriteException);
    assert Context.getContext().getLogger(RecompilableScriptFunctionData.class).isEnabled() :
        "Unit test/instrumentation purpose only: RecompilationEvent instances should not be created without '--log=recompile', or we will leak memory in the general case";
    this.returnValue = returnValue;
}