jdk.nashorn.internal.runtime.RewriteException Java Examples
The following examples show how to use
jdk.nashorn.internal.runtime.RewriteException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClassEmitter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example #2
Source File: ExceptionsNotSerializable.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
@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()"); }
Example #3
Source File: ClassEmitter.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example #4
Source File: ExceptionsNotSerializable.java From hottub with GNU General Public License v2.0 | 5 votes |
@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()"); }
Example #5
Source File: ClassEmitter.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example #6
Source File: ExceptionsNotSerializable.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@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()"); }
Example #7
Source File: ClassEmitter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example #8
Source File: ExceptionsNotSerializable.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@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()"); }
Example #9
Source File: ExceptionsNotSerializable.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@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()"); }
Example #10
Source File: ClassEmitter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example #11
Source File: ExceptionsNotSerializable.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@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()"); }
Example #12
Source File: ClassEmitter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example #13
Source File: ExceptionsNotSerializable.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@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()"); }
Example #14
Source File: ClassEmitter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example #15
Source File: RecompilationEvent.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 3 votes |
/** * 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; }
Example #16
Source File: RecompilationEvent.java From TencentKona-8 with GNU General Public License v2.0 | 3 votes |
/** * 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; }
Example #17
Source File: RecompilationEvent.java From openjdk-jdk9 with GNU General Public License v2.0 | 3 votes |
/** * 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; }
Example #18
Source File: RecompilationEvent.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
/** * 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; }
Example #19
Source File: RecompilationEvent.java From hottub with GNU General Public License v2.0 | 3 votes |
/** * 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; }
Example #20
Source File: RecompilationEvent.java From jdk8u60 with GNU General Public License v2.0 | 3 votes |
/** * 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; }
Example #21
Source File: RecompilationEvent.java From jdk8u_nashorn with GNU General Public License v2.0 | 3 votes |
/** * 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; }