Skip to content

Commit 3772c04

Browse files
authored
Add missing generics to generated code (#15)
1 parent 7c46783 commit 3772c04

5 files changed

Lines changed: 66 additions & 66 deletions

File tree

processor/src/main/resources/org/mapstruct/tools/gem/processor/Gem.ftl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public class ${gemInfo.gemName} implements Gem {
151151
*
152152
* @return the {@link ${gemInfo.builderName}} for this gem, representing {@link ${gemInfo.gemName}}
153153
*/
154-
${gemInfo.builderName} set${gemValueInfo.name?capitalize}(GemValue<${gemValueInfo.valueType.name}> methodName );
154+
${gemInfo.builderName}<T> set${gemValueInfo.name?capitalize}(GemValue<${gemValueInfo.valueType.name}> methodName );
155155

156156
</#list>
157157
/**
@@ -161,7 +161,7 @@ public class ${gemInfo.gemName} implements Gem {
161161
*
162162
* @return the {@link ${gemInfo.builderName}} for this gem, representing {@link ${gemInfo.gemName}}
163163
*/
164-
${gemInfo.builderName} setMirror( AnnotationMirror mirror );
164+
${gemInfo.builderName}<T> setMirror( AnnotationMirror mirror );
165165

166166
/**
167167
* The build method can be overriden in a custom custom implementation, which allows
@@ -180,13 +180,13 @@ public class ${gemInfo.gemName} implements Gem {
180180
private AnnotationMirror mirror;
181181

182182
<#list gemInfo.gemValueInfos as gemValueInfo>
183-
public ${gemInfo.builderName} set${gemValueInfo.name?capitalize}(GemValue<${gemValueInfo.valueType.name}> ${gemValueInfo.name} ) {
183+
public ${gemInfo.builderName}<${gemInfo.gemName}> set${gemValueInfo.name?capitalize}(GemValue<${gemValueInfo.valueType.name}> ${gemValueInfo.name} ) {
184184
this.${gemValueInfo.name} = ${gemValueInfo.name};
185185
return this;
186186
}
187187

188188
</#list>
189-
public ${gemInfo.builderName} setMirror( AnnotationMirror mirror ) {
189+
public ${gemInfo.builderName}<${gemInfo.gemName}> setMirror( AnnotationMirror mirror ) {
190190
this.mirror = mirror;
191191
return this;
192192
}

processor/src/test/resources/fixtures/org/mapstruct/tools/gem/processor/BuilderGem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public interface Builder_<T> {
7878
*
7979
* @return the {@link Builder_} for this gem, representing {@link BuilderGem}
8080
*/
81-
Builder_ setMirror( AnnotationMirror mirror );
81+
Builder_<T> setMirror( AnnotationMirror mirror );
8282

8383
/**
8484
* The build method can be overriden in a custom custom implementation, which allows
@@ -93,7 +93,7 @@ private static class BuilderImpl implements Builder_<BuilderGem> {
9393

9494
private AnnotationMirror mirror;
9595

96-
public Builder_ setMirror( AnnotationMirror mirror ) {
96+
public Builder_<BuilderGem> setMirror( AnnotationMirror mirror ) {
9797
this.mirror = mirror;
9898
return this;
9999
}

processor/src/test/resources/fixtures/org/mapstruct/tools/gem/processor/SomeAnnotationGem.java

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -420,154 +420,154 @@ public interface Builder<T> {
420420
*
421421
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
422422
*/
423-
Builder setMyclasswithdefault(GemValue<TypeMirror> methodName );
423+
Builder<T> setMyclasswithdefault(GemValue<TypeMirror> methodName );
424424

425425
/**
426426
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myBooleanWithDefault}
427427
*
428428
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
429429
*/
430-
Builder setMybooleanwithdefault(GemValue<Boolean> methodName );
430+
Builder<T> setMybooleanwithdefault(GemValue<Boolean> methodName );
431431

432432
/**
433433
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myCharWithDefault}
434434
*
435435
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
436436
*/
437-
Builder setMycharwithdefault(GemValue<Character> methodName );
437+
Builder<T> setMycharwithdefault(GemValue<Character> methodName );
438438

439439
/**
440440
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myByteWithDefault}
441441
*
442442
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
443443
*/
444-
Builder setMybytewithdefault(GemValue<Byte> methodName );
444+
Builder<T> setMybytewithdefault(GemValue<Byte> methodName );
445445

446446
/**
447447
* Sets the {@link GemValue} for {@link SomeAnnotationGem#mShortWithDefault}
448448
*
449449
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
450450
*/
451-
Builder setMshortwithdefault(GemValue<Short> methodName );
451+
Builder<T> setMshortwithdefault(GemValue<Short> methodName );
452452

453453
/**
454454
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myIntWithDefault}
455455
*
456456
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
457457
*/
458-
Builder setMyintwithdefault(GemValue<Integer> methodName );
458+
Builder<T> setMyintwithdefault(GemValue<Integer> methodName );
459459

460460
/**
461461
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myLongWithDefault}
462462
*
463463
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
464464
*/
465-
Builder setMylongwithdefault(GemValue<Integer> methodName );
465+
Builder<T> setMylongwithdefault(GemValue<Integer> methodName );
466466

467467
/**
468468
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myFloatWithDefault}
469469
*
470470
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
471471
*/
472-
Builder setMyfloatwithdefault(GemValue<Float> methodName );
472+
Builder<T> setMyfloatwithdefault(GemValue<Float> methodName );
473473

474474
/**
475475
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myDoubleWithDefault}
476476
*
477477
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
478478
*/
479-
Builder setMydoublewithdefault(GemValue<Double> methodName );
479+
Builder<T> setMydoublewithdefault(GemValue<Double> methodName );
480480

481481
/**
482482
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myStringWithDefault}
483483
*
484484
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
485485
*/
486-
Builder setMystringwithdefault(GemValue<String> methodName );
486+
Builder<T> setMystringwithdefault(GemValue<String> methodName );
487487

488488
/**
489489
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myEnumWithDefault}
490490
*
491491
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
492492
*/
493-
Builder setMyenumwithdefault(GemValue<String> methodName );
493+
Builder<T> setMyenumwithdefault(GemValue<String> methodName );
494494

495495
/**
496496
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myClass}
497497
*
498498
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
499499
*/
500-
Builder setMyclass(GemValue<TypeMirror> methodName );
500+
Builder<T> setMyclass(GemValue<TypeMirror> methodName );
501501

502502
/**
503503
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myBoolean}
504504
*
505505
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
506506
*/
507-
Builder setMyboolean(GemValue<Boolean> methodName );
507+
Builder<T> setMyboolean(GemValue<Boolean> methodName );
508508

509509
/**
510510
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myChar}
511511
*
512512
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
513513
*/
514-
Builder setMychar(GemValue<Character> methodName );
514+
Builder<T> setMychar(GemValue<Character> methodName );
515515

516516
/**
517517
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myByte}
518518
*
519519
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
520520
*/
521-
Builder setMybyte(GemValue<Byte> methodName );
521+
Builder<T> setMybyte(GemValue<Byte> methodName );
522522

523523
/**
524524
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myShort}
525525
*
526526
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
527527
*/
528-
Builder setMyshort(GemValue<Short> methodName );
528+
Builder<T> setMyshort(GemValue<Short> methodName );
529529

530530
/**
531531
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myInt}
532532
*
533533
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
534534
*/
535-
Builder setMyint(GemValue<Integer> methodName );
535+
Builder<T> setMyint(GemValue<Integer> methodName );
536536

537537
/**
538538
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myLong}
539539
*
540540
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
541541
*/
542-
Builder setMylong(GemValue<Integer> methodName );
542+
Builder<T> setMylong(GemValue<Integer> methodName );
543543

544544
/**
545545
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myFloat}
546546
*
547547
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
548548
*/
549-
Builder setMyfloat(GemValue<Float> methodName );
549+
Builder<T> setMyfloat(GemValue<Float> methodName );
550550

551551
/**
552552
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myDouble}
553553
*
554554
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
555555
*/
556-
Builder setMydouble(GemValue<Double> methodName );
556+
Builder<T> setMydouble(GemValue<Double> methodName );
557557

558558
/**
559559
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myString}
560560
*
561561
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
562562
*/
563-
Builder setMystring(GemValue<String> methodName );
563+
Builder<T> setMystring(GemValue<String> methodName );
564564

565565
/**
566566
* Sets the {@link GemValue} for {@link SomeAnnotationGem#myEnum}
567567
*
568568
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
569569
*/
570-
Builder setMyenum(GemValue<String> methodName );
570+
Builder<T> setMyenum(GemValue<String> methodName );
571571

572572
/**
573573
* Sets the annotation mirror
@@ -576,7 +576,7 @@ public interface Builder<T> {
576576
*
577577
* @return the {@link Builder} for this gem, representing {@link SomeAnnotationGem}
578578
*/
579-
Builder setMirror( AnnotationMirror mirror );
579+
Builder<T> setMirror( AnnotationMirror mirror );
580580

581581
/**
582582
* The build method can be overriden in a custom custom implementation, which allows
@@ -613,117 +613,117 @@ private static class BuilderImpl implements Builder<SomeAnnotationGem> {
613613
private GemValue<String> myEnum;
614614
private AnnotationMirror mirror;
615615

616-
public Builder setMyclasswithdefault(GemValue<TypeMirror> myClassWithDefault ) {
616+
public Builder<SomeAnnotationGem> setMyclasswithdefault(GemValue<TypeMirror> myClassWithDefault ) {
617617
this.myClassWithDefault = myClassWithDefault;
618618
return this;
619619
}
620620

621-
public Builder setMybooleanwithdefault(GemValue<Boolean> myBooleanWithDefault ) {
621+
public Builder<SomeAnnotationGem> setMybooleanwithdefault(GemValue<Boolean> myBooleanWithDefault ) {
622622
this.myBooleanWithDefault = myBooleanWithDefault;
623623
return this;
624624
}
625625

626-
public Builder setMycharwithdefault(GemValue<Character> myCharWithDefault ) {
626+
public Builder<SomeAnnotationGem> setMycharwithdefault(GemValue<Character> myCharWithDefault ) {
627627
this.myCharWithDefault = myCharWithDefault;
628628
return this;
629629
}
630630

631-
public Builder setMybytewithdefault(GemValue<Byte> myByteWithDefault ) {
631+
public Builder<SomeAnnotationGem> setMybytewithdefault(GemValue<Byte> myByteWithDefault ) {
632632
this.myByteWithDefault = myByteWithDefault;
633633
return this;
634634
}
635635

636-
public Builder setMshortwithdefault(GemValue<Short> mShortWithDefault ) {
636+
public Builder<SomeAnnotationGem> setMshortwithdefault(GemValue<Short> mShortWithDefault ) {
637637
this.mShortWithDefault = mShortWithDefault;
638638
return this;
639639
}
640640

641-
public Builder setMyintwithdefault(GemValue<Integer> myIntWithDefault ) {
641+
public Builder<SomeAnnotationGem> setMyintwithdefault(GemValue<Integer> myIntWithDefault ) {
642642
this.myIntWithDefault = myIntWithDefault;
643643
return this;
644644
}
645645

646-
public Builder setMylongwithdefault(GemValue<Integer> myLongWithDefault ) {
646+
public Builder<SomeAnnotationGem> setMylongwithdefault(GemValue<Integer> myLongWithDefault ) {
647647
this.myLongWithDefault = myLongWithDefault;
648648
return this;
649649
}
650650

651-
public Builder setMyfloatwithdefault(GemValue<Float> myFloatWithDefault ) {
651+
public Builder<SomeAnnotationGem> setMyfloatwithdefault(GemValue<Float> myFloatWithDefault ) {
652652
this.myFloatWithDefault = myFloatWithDefault;
653653
return this;
654654
}
655655

656-
public Builder setMydoublewithdefault(GemValue<Double> myDoubleWithDefault ) {
656+
public Builder<SomeAnnotationGem> setMydoublewithdefault(GemValue<Double> myDoubleWithDefault ) {
657657
this.myDoubleWithDefault = myDoubleWithDefault;
658658
return this;
659659
}
660660

661-
public Builder setMystringwithdefault(GemValue<String> myStringWithDefault ) {
661+
public Builder<SomeAnnotationGem> setMystringwithdefault(GemValue<String> myStringWithDefault ) {
662662
this.myStringWithDefault = myStringWithDefault;
663663
return this;
664664
}
665665

666-
public Builder setMyenumwithdefault(GemValue<String> myEnumWithDefault ) {
666+
public Builder<SomeAnnotationGem> setMyenumwithdefault(GemValue<String> myEnumWithDefault ) {
667667
this.myEnumWithDefault = myEnumWithDefault;
668668
return this;
669669
}
670670

671-
public Builder setMyclass(GemValue<TypeMirror> myClass ) {
671+
public Builder<SomeAnnotationGem> setMyclass(GemValue<TypeMirror> myClass ) {
672672
this.myClass = myClass;
673673
return this;
674674
}
675675

676-
public Builder setMyboolean(GemValue<Boolean> myBoolean ) {
676+
public Builder<SomeAnnotationGem> setMyboolean(GemValue<Boolean> myBoolean ) {
677677
this.myBoolean = myBoolean;
678678
return this;
679679
}
680680

681-
public Builder setMychar(GemValue<Character> myChar ) {
681+
public Builder<SomeAnnotationGem> setMychar(GemValue<Character> myChar ) {
682682
this.myChar = myChar;
683683
return this;
684684
}
685685

686-
public Builder setMybyte(GemValue<Byte> myByte ) {
686+
public Builder<SomeAnnotationGem> setMybyte(GemValue<Byte> myByte ) {
687687
this.myByte = myByte;
688688
return this;
689689
}
690690

691-
public Builder setMyshort(GemValue<Short> myShort ) {
691+
public Builder<SomeAnnotationGem> setMyshort(GemValue<Short> myShort ) {
692692
this.myShort = myShort;
693693
return this;
694694
}
695695

696-
public Builder setMyint(GemValue<Integer> myInt ) {
696+
public Builder<SomeAnnotationGem> setMyint(GemValue<Integer> myInt ) {
697697
this.myInt = myInt;
698698
return this;
699699
}
700700

701-
public Builder setMylong(GemValue<Integer> myLong ) {
701+
public Builder<SomeAnnotationGem> setMylong(GemValue<Integer> myLong ) {
702702
this.myLong = myLong;
703703
return this;
704704
}
705705

706-
public Builder setMyfloat(GemValue<Float> myFloat ) {
706+
public Builder<SomeAnnotationGem> setMyfloat(GemValue<Float> myFloat ) {
707707
this.myFloat = myFloat;
708708
return this;
709709
}
710710

711-
public Builder setMydouble(GemValue<Double> myDouble ) {
711+
public Builder<SomeAnnotationGem> setMydouble(GemValue<Double> myDouble ) {
712712
this.myDouble = myDouble;
713713
return this;
714714
}
715715

716-
public Builder setMystring(GemValue<String> myString ) {
716+
public Builder<SomeAnnotationGem> setMystring(GemValue<String> myString ) {
717717
this.myString = myString;
718718
return this;
719719
}
720720

721-
public Builder setMyenum(GemValue<String> myEnum ) {
721+
public Builder<SomeAnnotationGem> setMyenum(GemValue<String> myEnum ) {
722722
this.myEnum = myEnum;
723723
return this;
724724
}
725725

726-
public Builder setMirror( AnnotationMirror mirror ) {
726+
public Builder<SomeAnnotationGem> setMirror( AnnotationMirror mirror ) {
727727
this.mirror = mirror;
728728
return this;
729729
}

0 commit comments

Comments
 (0)