diff options
author | Roel Spilker <r.spilker@gmail.com> | 2017-03-22 22:02:12 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2017-03-22 22:24:12 +0100 |
commit | 1db7052464d8956d7ebe303b15729a7c0be557bf (patch) | |
tree | ab6dbc838fa0b082b4a068feee93620bf5bc4b6c /src | |
parent | 6b3aa5ffd3d4e4d7a26ea41cd77b2b031722e365 (diff) | |
download | lombok-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')
-rw-r--r-- | src/core/lombok/javac/handlers/singulars/JavacJavaUtilSingularizer.java | 3 |
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)); |