@@ -380,23 +380,25 @@ public JBlock assignDivide (@Nonnull final IJAssignmentTarget aLhs, @Nonnull fin
380380 }
381381
382382 /**
383- * Creates an invocation statement and adds it to this block.
383+ * Creates an invocation statement and adds it to this block.<br>
384+ * Note: since 3.1.0 this method no longer returns the invocation, to avoid
385+ * chaining, as this would not work (see #62)
384386 *
385387 * @param aExpr
386388 * {@link IJExpression} evaluating to the class or object upon which
387389 * the named method will be invoked
388390 * @param sMethod
389391 * Name of method to invoke
390- * @return Newly generated {@link JInvocation}
391392 */
392- @ Nonnull
393- public JInvocation invoke (@ Nonnull final IJExpression aExpr , @ Nonnull final String sMethod )
393+ public void invoke (@ Nonnull final IJExpression aExpr , @ Nonnull final String sMethod )
394394 {
395- return invoke ((JCodeModel ) null , aExpr , sMethod );
395+ invoke ((JCodeModel ) null , aExpr , sMethod );
396396 }
397397
398398 /**
399- * Creates an invocation statement and adds it to this block.
399+ * Creates an invocation statement and adds it to this block.<br>
400+ * Note: since 3.1.0 this method no longer returns the invocation, to avoid
401+ * chaining, as this would not work (see #62)
400402 *
401403 * @param aCM
402404 * CodeModel to use. May be <code>null</code>.
@@ -405,123 +407,117 @@ public JInvocation invoke (@Nonnull final IJExpression aExpr, @Nonnull final Str
405407 * the named method will be invoked
406408 * @param sMethod
407409 * Name of method to invoke
408- * @return Newly generated {@link JInvocation}
409- * @since 3.0.5
410+ * @since 3.1.0
410411 */
411- @ Nonnull
412- public JInvocation invoke (@ Nullable final JCodeModel aCM ,
413- @ Nonnull final IJExpression aExpr ,
414- @ Nonnull final String sMethod )
412+ public void invoke (@ Nullable final JCodeModel aCM , @ Nonnull final IJExpression aExpr , @ Nonnull final String sMethod )
415413 {
416- return internalInsert (new JInvocation (aCM , aExpr , sMethod ));
414+ internalInsert (new JInvocation (aCM , aExpr , sMethod ));
417415 }
418416
419417 /**
420- * Creates an invocation statement and adds it to this block.
418+ * Creates an invocation statement and adds it to this block.<br>
419+ * Note: since 3.1.0 this method no longer returns the invocation, to avoid
420+ * chaining, as this would not work (see #62)
421421 *
422422 * @param sMethod
423423 * Name of method to invoke on this
424- * @return Newly generated {@link JInvocation}
425424 */
426- @ Nonnull
427- public JInvocation invokeThis (@ Nonnull final String sMethod )
425+ public void invokeThis (@ Nonnull final String sMethod )
428426 {
429- return invoke (JExpr ._this (), sMethod );
427+ invoke (JExpr ._this (), sMethod );
430428 }
431429
432430 /**
433431 * Explicitly call the super class constructor in this block. This method may
434- * only be called as the first call inside a constructor block!
432+ * only be called as the first call inside a constructor block!<br>
433+ * Note: since 3.1.0 this method no longer returns the invocation, to avoid
434+ * chaining, as this would not work (see #62)
435435 *
436- * @return Newly generated super {@link JInvocation}
437436 * @since 3.0.1
438437 */
439- @ Nonnull
440- public JInvocation invokeSuper ()
438+ public void invokeSuper ()
441439 {
442- return internalInsert (JInvocation ._super ());
440+ internalInsert (JInvocation ._super ());
443441 }
444442
445443 /**
446- * Creates an invocation statement and adds it to this block.
444+ * Creates an invocation statement and adds it to this block.<br>
445+ * Note: since 3.1.0 this method no longer returns the invocation, to avoid
446+ * chaining, as this would not work (see #62)
447447 *
448448 * @param aExpr
449449 * {@link IJExpression} evaluating to the class or object upon which
450450 * the method will be invoked
451451 * @param aMethod
452452 * {@link JMethod} to invoke
453- * @return Newly generated {@link JInvocation}
454453 */
455- @ Nonnull
456- public JInvocation invoke (@ Nonnull final IJExpression aExpr , @ Nonnull final JMethod aMethod )
454+ public void invoke (@ Nullable final IJExpression aExpr , @ Nonnull final JMethod aMethod )
457455 {
458- return internalInsert (new JInvocation (aMethod .owner (), aExpr , aMethod ));
456+ internalInsert (new JInvocation (aMethod .owner (), aExpr , aMethod ));
459457 }
460458
461459 /**
462- * Creates an invocation statement and adds it to this block.
460+ * Creates an invocation statement and adds it to this block.<br>
461+ * Note: since 3.1.0 this method no longer returns the invocation, to avoid
462+ * chaining, as this would not work (see #62)
463463 *
464464 * @param aMethod
465465 * {@link JMethod} to invoke on this
466- * @return Newly generated {@link JInvocation}
467466 */
468- @ Nonnull
469- public JInvocation invokeThis (@ Nonnull final JMethod aMethod )
467+ public void invokeThis (@ Nonnull final JMethod aMethod )
470468 {
471- return invoke (JExpr ._this (), aMethod );
469+ invoke (JExpr ._this (), aMethod );
472470 }
473471
474472 /**
475- * Creates a static invocation statement.
473+ * Creates a static invocation statement.<br>
474+ * Note: since 3.1.0 this method no longer returns the invocation, to avoid
475+ * chaining, as this would not work (see #62)
476476 *
477477 * @param aType
478478 * Type upon which the method should be invoked
479479 * @param sMethod
480480 * Name of method to invoke
481- * @return Newly generated {@link JInvocation}
482481 */
483- @ Nonnull
484- public JInvocation staticInvoke (@ Nonnull final AbstractJClass aType , @ Nonnull final String sMethod )
482+ public void staticInvoke (@ Nonnull final AbstractJClass aType , @ Nonnull final String sMethod )
485483 {
486- return internalInsert (new JInvocation (aType .owner (), aType , sMethod ));
484+ internalInsert (new JInvocation (aType .owner (), aType , sMethod ));
487485 }
488486
489487 /**
490- * Creates an invocation statement and adds it to this block.
488+ * Creates an invocation statement and adds it to this block.<br>
489+ * Note: since 3.1.0 this method no longer returns the invocation, to avoid
490+ * chaining, as this would not work (see #62)
491491 *
492492 * @param sMethod
493493 * Name of method to invoke
494- * @return Newly generated {@link JInvocation}
495494 */
496- @ Nonnull
497- public JInvocation invoke (@ Nonnull final String sMethod )
495+ public void invoke (@ Nonnull final String sMethod )
498496 {
499- return internalInsert (new JInvocation ((JCodeModel ) null , (IJExpression ) null , sMethod ));
497+ internalInsert (new JInvocation ((JCodeModel ) null , (IJExpression ) null , sMethod ));
500498 }
501499
502500 /**
503- * Creates an invocation statement and adds it to this block.
501+ * Creates an invocation statement and adds it to this block.<br>
502+ * Note: since 3.1.0 this method no longer returns the invocation, to avoid
503+ * chaining, as this would not work (see #62)
504504 *
505505 * @param aMethod
506506 * JMethod to invoke
507- * @return Newly generated {@link JInvocation}
508507 */
509- @ Nonnull
510- public JInvocation invoke (@ Nonnull final JMethod aMethod )
508+ public void invoke (@ Nonnull final JMethod aMethod )
511509 {
512- return internalInsert (new JInvocation (aMethod .owner (), (IJExpression ) null , aMethod ));
510+ internalInsert (new JInvocation (aMethod .owner (), (IJExpression ) null , aMethod ));
513511 }
514512
515- @ Nonnull
516- public JInvocation _new (@ Nonnull final AbstractJClass aClass )
513+ public void _new (@ Nonnull final AbstractJClass aClass )
517514 {
518- return internalInsert (new JInvocation (aClass ));
515+ internalInsert (new JInvocation (aClass ));
519516 }
520517
521- @ Nonnull
522- public JInvocation _new (@ Nonnull final AbstractJType aType )
518+ public void _new (@ Nonnull final AbstractJType aType )
523519 {
524- return internalInsert (new JInvocation (aType ));
520+ internalInsert (new JInvocation (aType ));
525521 }
526522
527523 /**
0 commit comments