aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2017-03-22 22:02:12 +0100
committerRoel Spilker <r.spilker@gmail.com>2017-03-22 22:24:12 +0100
commit1db7052464d8956d7ebe303b15729a7c0be557bf (patch)
treeab6dbc838fa0b082b4a068feee93620bf5bc4b6c /src/core/lombok
parent6b3aa5ffd3d4e4d7a26ea41cd77b2b031722e365 (diff)
downloadlombok-1db7052464d8956d7ebe303b15729a7c0be557bf.tar.gz
lombok-1db7052464d8956d7ebe303b15729a7c0be557bf.tar.bz2
lombok-1db7052464d8956d7ebe303b15729a7c0be557bf.zip
[jdk9] Workaround for a weird casting issue that shows up for singularizer support.
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilSingularizer.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilSingularizer.java
index 25669721..0589ac34 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilSingularizer.java
@@ -165,6 +165,9 @@ abstract class JavacJavaUtilSingularizer extends JavacSingularizer {
JCExpression pluralnameDotPut = maker.Select(maker.Ident(data.getPluralName()), builderType.toName("put"));
JCExpression arg1 = maker.Apply(jceBlank, chainDots(builderType, "this", data.getPluralName() + "$key", "get"), List.<JCExpression>of(maker.Ident(ivar)));
JCExpression arg2 = maker.Apply(jceBlank, chainDots(builderType, "this", data.getPluralName() + "$value", "get"), List.<JCExpression>of(maker.Ident(ivar)));
+ // [jdk9] We add an unneccessary (V) cast here. Not doing so gives an error in javac (build 9-ea+156-jigsaw-nightly-h6072-20170212):
+ // error: method put in interface Map<K#2,V#2> cannot be applied to given types;
+ arg2 = maker.TypeCast(createTypeArgs(2, false, builderType, data.getTypeArgs(), source).get(1), arg2);
JCStatement putStatement = maker.Exec(maker.Apply(jceBlank, pluralnameDotPut, List.of(arg1, arg2)));
JCStatement forInit = maker.VarDef(maker.Modifiers(0), ivar, maker.TypeIdent(CTC_INT), maker.Literal(CTC_INT, 0));
JCExpression checkExpr = maker.Binary(CTC_LESS_THAN, maker.Ident(ivar), getSize(maker, builderType, keyVarName, nullGuard, true));