diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-05-01 05:45:10 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-05-01 05:45:10 +0200 |
commit | 2335f251665d43b4c8cebe00b980f07ef33bdb17 (patch) | |
tree | 7ae9ddf76e3a140081d002e0ef985ee72e6f33e1 /src/core/lombok/javac/handlers/HandleSuperBuilder.java | |
parent | bf0499263b05e11fdd43886df3dc5663c8fee5f4 (diff) | |
download | lombok-2335f251665d43b4c8cebe00b980f07ef33bdb17.tar.gz lombok-2335f251665d43b4c8cebe00b980f07ef33bdb17.tar.bz2 lombok-2335f251665d43b4c8cebe00b980f07ef33bdb17.zip |
[fixes #2104] superbuilder + non-list-singulars wouldn’t work due to hardcoded call to emptyList.
Diffstat (limited to 'src/core/lombok/javac/handlers/HandleSuperBuilder.java')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleSuperBuilder.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/lombok/javac/handlers/HandleSuperBuilder.java b/src/core/lombok/javac/handlers/HandleSuperBuilder.java index 798ff7b4..290ef89f 100644 --- a/src/core/lombok/javac/handlers/HandleSuperBuilder.java +++ b/src/core/lombok/javac/handlers/HandleSuperBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2018 The Project Lombok Authors. + * Copyright (C) 2013-2019 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -725,8 +725,9 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> { arg = tgt[0]; } else { JCExpression eqNull = maker.Binary(CTC_EQUAL, tgt[0], maker.Literal(CTC_BOT, null)); - JCExpression emptyList = maker.Apply(List.<JCExpression>nil(), chainDots(type, "java", "util", "Collections", "emptyList"), List.<JCExpression>nil()); - arg = maker.Conditional(eqNull, emptyList, tgt[1]); + String emptyMaker = bfd.singularData.getSingularizer().getEmptyMaker(bfd.singularData.getTargetFqn()); + JCExpression emptyCollection = maker.Apply(List.<JCExpression>nil(), chainDots(type, emptyMaker.split("\\.")), List.<JCExpression>nil()); + arg = maker.Conditional(eqNull, emptyCollection, tgt[1]); } JCMethodInvocation apply = maker.Apply(List.<JCExpression>nil(), maker.Select(maker.Ident(type.toName(BUILDER_VARIABLE_NAME)), bfd.name), List.of(arg)); JCExpressionStatement exec = maker.Exec(apply); |