[wip] Random fixes to various tests that are failing, especially against Java7.

This commit is contained in:
Reinier Zwitserloot committed 2018-09-04 01:54:29 +02:00
1 parent 92bc41ae6d
commit af55bd0a32
7 files changed
+67 -24

No files matched your search

@@ -516,7 +516,8 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
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());
List<JCExpression> tas = cloneTypes(maker, bfd.singularData.getTypeArgs(), ast, type.getContext());
JCExpression emptyList = maker.Apply(tas, chainDots(type, "java", "util", "Collections", "emptyList"), List.<JCExpression>nil());
arg = maker.Conditional(eqNull, emptyList, tgt[1]);
}
+30 -9
View File
@@ -1,13 +1,34 @@
/*
* Copyright (C) 2018 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package lombok.core;
public class ClassLiteral {
private final String className;
public ClassLiteral(String className) {
this.className = className;
}
public String getClassName() {
return className;
}
private final String className;
public ClassLiteral(String className) {
this.className = className;
}
public String getClassName() {
return className;
}
}
+30 -9
View File
@@ -1,13 +1,34 @@
/*
* Copyright (C) 2018 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package lombok.core;
public class FieldSelect {
private final String finalPart;
public FieldSelect(String finalPart) {
this.finalPart = finalPart;
}
public String getFinalPart() {
return finalPart;
}
private final String finalPart;
public FieldSelect(String finalPart) {
this.finalPart = finalPart;
}
public String getFinalPart() {
return finalPart;
}
}
+2 -2
View File
@@ -186,11 +186,11 @@ public class Eclipse {
default: return null;
}
} else if (e instanceof ClassLiteralAccess) {
return new ClassLiteral(Eclipse.toQualifiedName(((ClassLiteralAccess)e).type.getTypeName()));
return new ClassLiteral(Eclipse.toQualifiedName(((ClassLiteralAccess) e).type.getTypeName()));
} else if (e instanceof SingleNameReference) {
return new FieldSelect(new String(((SingleNameReference)e).token));
} else if (e instanceof QualifiedNameReference) {
String qName = Eclipse.toQualifiedName(((QualifiedNameReference)e).tokens);
String qName = Eclipse.toQualifiedName(((QualifiedNameReference) e).tokens);
int idx = qName.lastIndexOf('.');
return new FieldSelect(idx == -1 ? qName : qName.substring(idx+1));
} else if (e instanceof UnaryExpression) {
@@ -58,6 +58,6 @@ class BuilderSingularToBuilderWithNull {
}
@java.lang.SuppressWarnings("all")
public BuilderSingularToBuilderWithNullBuilder toBuilder() {
return new BuilderSingularToBuilderWithNullBuilder().elems(this.elems == null ? java.util.Collections.emptyList() : this.elems);
return new BuilderSingularToBuilderWithNullBuilder().elems(this.elems == null ? java.util.Collections.<String>emptyList() : this.elems);
}
}
@@ -86,7 +86,7 @@ class BuilderWithToBuilder<T> {
}
@java.lang.SuppressWarnings("all")
public BuilderWithToBuilderBuilder<T> toBuilder() {
return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(this.bars == null ? java.util.Collections.emptyList() : this.bars);
return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(this.bars == null ? java.util.Collections.<T>emptyList() : this.bars);
}
}
class ConstructorWithToBuilder<T> {
@@ -52,6 +52,6 @@ import lombok.Singular;
return new BuilderSingularToBuilderWithNullBuilder();
}
public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder toBuilder() {
return new BuilderSingularToBuilderWithNullBuilder().elems(((this.elems == null) ? java.util.Collections.emptyList() : this.elems));
return new BuilderSingularToBuilderWithNullBuilder().elems(((this.elems == null) ? java.util.Collections.<String>emptyList() : this.elems));
}
}