Lines Matching refs:code

24  * A collection of static methods for creating a <code>CtMethod</code>.
32 * Compiles the given source code and creates a method.
33 * The source code must include not only the method body
48 * Compiles the given source code and creates a method.
49 * The source code must include not only the method body
54 * <p>If the source code includes <code>$proceed()</code>, then
60 * that is called on by <code>$proceed()</code>.
62 * that is called by <code>$proceed()</code>.
93 * It must be a block surrounded by <code>{}</code>.
94 * If it is <code>null</code>, the created method
110 * Creates a method. <code>modifiers</code> can contain
111 * <code>Modifier.STATIC</code>.
119 * It must be a block surrounded by <code>{}</code>.
120 * If it is <code>null</code>, the created method
156 * It can be <code>null</code>.
178 * It can be <code>null</code>.
231 Bytecode code = new Bytecode(cp, 2, 1);
235 code.addAload(0);
236 code.addGetfield(Bytecode.THIS, fieldName, fieldType);
239 code.addGetstatic(Bytecode.THIS, fieldName, fieldType);
241 code.addReturn(field.getType());
247 minfo.setCodeAttribute(code.toCodeAttribute());
257 * by <code>setModifiers()</code> in <code>CtBehavior</code>.
272 Bytecode code = new Bytecode(cp, 3, 3);
276 code.addAload(0);
277 code.addLoad(1, field.getType());
278 code.addPutfield(Bytecode.THIS, fieldName, fieldType);
281 code.addLoad(1, field.getType());
282 code.addPutstatic(Bytecode.THIS, fieldName, fieldType);
285 code.addReturn(null);
291 minfo.setCodeAttribute(code.toCodeAttribute());
298 * by <code>delegate</code> with all the parameters passed to the
310 * <code>setName()</code>.
342 Bytecode code = new Bytecode(cp, 0, 0);
348 s = code.addLoadParameters(params, 0);
349 code.addInvokestatic(deleClass, methodName, desc);
352 code.addLoad(0, deleClass);
353 s = code.addLoadParameters(params, 1);
354 code.addInvokespecial(deleClass, methodName, desc);
357 code.addReturn(delegate.getReturnType());
358 code.setMaxLocals(++s);
359 code.setMaxStack(s < 2 ? 2 : s); // for a 2-word return value
360 minfo.setCodeAttribute(code.toCodeAttribute());
366 * in the form of an array of <code>Object</code>.
369 * specified by <code>body</code>. However, it is wrapped in
370 * parameter-conversion code.
372 * <p>The method specified by <code>body</code> must have this singature:
374 * <ul><code>Object method(Object[] params, &lt;type&gt; cvalue)
375 * </code></ul>
377 * <p>The type of the <code>cvalue</code> depends on
378 * <code>constParam</code>.
379 * If <code>constParam</code> is <code>null</code>, the signature
382 * <ul><code>Object method(Object[] params)</code></ul>
384 * <p>The method body copied from <code>body</code> is wrapped in
385 * parameter-conversion code, which converts parameters specified by
386 * <code>parameterTypes</code> into an array of <code>Object</code>.
387 * The returned value is also converted from the <code>Object</code>
388 * type to the type specified by <code>returnType</code>. Thus,
398 * <p>The variables <code>p0</code>, <code>p2</code>, ... represent
400 * The value of <code>cvalue</code> is specified by
401 * <code>constParam</code>.
405 * <code>java.lang.Integer</code>. If the type of the returned value
406 * is <code>void</code>, the returned value is discarded.
420 * <p>where the class <code>Sample</code> is as follows:
429 * <p>This program produces a class <code>intVector</code>:
441 * <p>Note that the type of the parameter to <code>add()</code> depends
442 * only on the value of <code>argTypes</code> passed to
443 * <code>CtNewMethod.wrapped()</code>. Thus, it is easy to
445 * <code>StringVector</code> class, which is a vector containing
446 * only <code>String</code> objects, and other vector classes.
455 * (maybe <code>null</code>).