mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 20:15:09 +00:00
* Added config key ‘lombok.addGeneratedAnnotation’.
* Added ‘format’ directive for tests. * Updates tests to salt in some more format and config keys.
This commit is contained in:
1 parent
26b2fb5cd6
commit
e5705f94cd
16 files changed
+109
-95
No files matched your search
@@ -35,6 +35,15 @@ public class ConfigurationKeys {
|
||||
|
||||
// ##### main package features #####
|
||||
|
||||
// ----- global -----
|
||||
|
||||
/**
|
||||
* lombok configuration: {@code lombok.addGeneratedAnnotation} = {@code true} | {@code false}.
|
||||
*
|
||||
* If unset or {@code true}, lombok generates {@code @javax.annotation.Generated("lombok")} on all fields, methods, and types that are generated.
|
||||
*/
|
||||
public static final ConfigurationKey<Boolean> ADD_GENERATED_ANNOTATIONS = new ConfigurationKey<Boolean>("lombok.addGeneratedAnnotation", "Generate @javax.annotation.Generated on all generated code (default: true).") {};
|
||||
|
||||
// ----- *ArgsConstructor -----
|
||||
|
||||
/**
|
||||
|
||||
@@ -1216,7 +1216,7 @@ public class EclipseHandlerUtil {
|
||||
*/
|
||||
public static EclipseNode injectFieldAndMarkGenerated(EclipseNode type, FieldDeclaration field) {
|
||||
field.annotations = addSuppressWarningsAll(field, field.annotations);
|
||||
field.annotations = addGenerated(field, field.annotations);
|
||||
field.annotations = addGenerated(type, field, field.annotations);
|
||||
return injectField(type, field);
|
||||
}
|
||||
|
||||
@@ -1262,7 +1262,7 @@ public class EclipseHandlerUtil {
|
||||
*/
|
||||
public static EclipseNode injectMethod(EclipseNode type, AbstractMethodDeclaration method) {
|
||||
method.annotations = addSuppressWarningsAll(method, method.annotations);
|
||||
method.annotations = addGenerated(method, method.annotations);
|
||||
method.annotations = addGenerated(type, method, method.annotations);
|
||||
TypeDeclaration parent = (TypeDeclaration) type.get();
|
||||
|
||||
if (parent.methods == null) {
|
||||
@@ -1305,7 +1305,7 @@ public class EclipseHandlerUtil {
|
||||
*/
|
||||
public static EclipseNode injectType(final EclipseNode typeNode, final TypeDeclaration type) {
|
||||
type.annotations = addSuppressWarningsAll(type, type.annotations);
|
||||
type.annotations = addGenerated(type, type.annotations);
|
||||
type.annotations = addGenerated(typeNode, type, type.annotations);
|
||||
TypeDeclaration parent = (TypeDeclaration) typeNode.get();
|
||||
|
||||
if (parent.memberTypes == null) {
|
||||
@@ -1328,7 +1328,8 @@ public class EclipseHandlerUtil {
|
||||
return addAnnotation(source, originalAnnotationArray, TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, new StringLiteral(ALL, 0, 0, 0));
|
||||
}
|
||||
|
||||
public static Annotation[] addGenerated(ASTNode source, Annotation[] originalAnnotationArray) {
|
||||
public static Annotation[] addGenerated(EclipseNode node, ASTNode source, Annotation[] originalAnnotationArray) {
|
||||
if (Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_GENERATED_ANNOTATIONS))) return originalAnnotationArray;
|
||||
return addAnnotation(source, originalAnnotationArray, JAVAX_ANNOTATION_GENERATED, new StringLiteral(LOMBOK, 0, 0, 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -956,6 +956,7 @@ public class JavacHandlerUtil {
|
||||
}
|
||||
|
||||
public static void addGenerated(JCModifiers mods, JavacNode node, int pos, JCTree source, Context context) {
|
||||
if (Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_GENERATED_ANNOTATIONS))) return;
|
||||
if (!LombokOptionsFactory.getDelombokOptions(context).getFormatPreferences().generateGenerated()) return;
|
||||
addAnnotation(mods, node, pos, source, context, "javax.annotation.Generated", node.getTreeMaker().Literal("lombok"));
|
||||
}
|
||||
|
||||
@@ -231,13 +231,13 @@ public class JavacSingularsRecipes {
|
||||
if (typeArgs != null) for (JCExpression orig : typeArgs) {
|
||||
if (!addExtends) {
|
||||
if (orig.getKind() == Kind.UNBOUNDED_WILDCARD || orig.getKind() == Kind.SUPER_WILDCARD) {
|
||||
arguments.append(chainDots(node, "java", "lang", "Object"));
|
||||
arguments.append(genJavaLangTypeRef(node, "Object"));
|
||||
} else if (orig.getKind() == Kind.EXTENDS_WILDCARD) {
|
||||
JCExpression inner;
|
||||
try {
|
||||
inner = (JCExpression) ((JCWildcard) orig).inner;
|
||||
} catch (Exception e) {
|
||||
inner = chainDots(node, "java", "lang", "Object");
|
||||
inner = genJavaLangTypeRef(node, "Object");
|
||||
}
|
||||
arguments.append(cloneType(maker, inner, source, context));
|
||||
} else {
|
||||
@@ -259,7 +259,7 @@ public class JavacSingularsRecipes {
|
||||
if (addExtends) {
|
||||
arguments.append(maker.Wildcard(maker.TypeBoundKind(BoundKind.UNBOUND), null));
|
||||
} else {
|
||||
arguments.append(chainDots(node, "java", "lang", "Object"));
|
||||
arguments.append(genJavaLangTypeRef(node, "Object"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,16 +280,16 @@ public class JavacSingularsRecipes {
|
||||
|
||||
protected JCExpression cloneParamType(int index, JavacTreeMaker maker, List<JCExpression> typeArgs, JavacNode builderType, JCTree source) {
|
||||
if (typeArgs == null || typeArgs.size() <= index) {
|
||||
return chainDots(builderType, "java", "lang", "Object");
|
||||
return genJavaLangTypeRef(builderType, "Object");
|
||||
} else {
|
||||
JCExpression originalType = typeArgs.get(index);
|
||||
if (originalType.getKind() == Kind.UNBOUNDED_WILDCARD || originalType.getKind() == Kind.SUPER_WILDCARD) {
|
||||
return chainDots(builderType, "java", "lang", "Object");
|
||||
return genJavaLangTypeRef(builderType, "Object");
|
||||
} else if (originalType.getKind() == Kind.EXTENDS_WILDCARD) {
|
||||
try {
|
||||
return cloneType(maker, (JCExpression) ((JCWildcard) originalType).inner, source, builderType.getContext());
|
||||
} catch (Exception e) {
|
||||
return chainDots(builderType, "java", "lang", "Object");
|
||||
return genJavaLangTypeRef(builderType, "Object");
|
||||
}
|
||||
} else {
|
||||
return cloneType(maker, originalType, source, builderType.getContext());
|
||||
|
||||
@@ -138,4 +138,8 @@ public final class FormatPreferences {
|
||||
public boolean generateConstructorProperties() {
|
||||
return generateConstructorProperties;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return rawMap.toString();
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
@@ -75,7 +76,7 @@ public abstract class AbstractRunTests {
|
||||
}
|
||||
});
|
||||
|
||||
transformCode(messages, writer, file, sourceDirectives.getSpecifiedEncoding());
|
||||
transformCode(messages, writer, file, sourceDirectives.getSpecifiedEncoding(), sourceDirectives.getFormatPreferences());
|
||||
|
||||
compare(file.getName(), expected, writer.toString(), messages, params.printErrors(), sourceDirectives.isSkipCompareContent() || expected.isSkipCompareContent());
|
||||
return true;
|
||||
@@ -97,7 +98,7 @@ public abstract class AbstractRunTests {
|
||||
return 8;
|
||||
}
|
||||
|
||||
protected abstract void transformCode(Collection<CompilerMessage> messages, StringWriter result, File file, String encoding) throws Throwable;
|
||||
protected abstract void transformCode(Collection<CompilerMessage> messages, StringWriter result, File file, String encoding, Map<String, String> formatPreferences) throws Throwable;
|
||||
|
||||
protected String readFile(File file) throws IOException {
|
||||
BufferedReader reader;
|
||||
|
||||
@@ -29,7 +29,9 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -45,6 +47,7 @@ public class LombokTestSource {
|
||||
private final File file;
|
||||
private final String content;
|
||||
private final LombokImmutableList<CompilerMessageMatcher> messages;
|
||||
private final Map<String, String> formatPreferences;
|
||||
private final boolean ignore;
|
||||
private final boolean skipCompareContent;
|
||||
private final int versionLowerLimit, versionUpperLimit;
|
||||
@@ -83,6 +86,10 @@ public class LombokTestSource {
|
||||
return configuration;
|
||||
}
|
||||
|
||||
public Map<String, String> getFormatPreferences() {
|
||||
return formatPreferences;
|
||||
}
|
||||
|
||||
private static final Pattern VERSION_STYLE_1 = Pattern.compile("^(\\d+)$");
|
||||
private static final Pattern VERSION_STYLE_2 = Pattern.compile("^\\:(\\d+)$");
|
||||
private static final Pattern VERSION_STYLE_3 = Pattern.compile("^(\\d+):$");
|
||||
@@ -129,6 +136,7 @@ public class LombokTestSource {
|
||||
boolean ignore = false;
|
||||
boolean skipCompareContent = false;
|
||||
String encoding = null;
|
||||
Map<String, String> formats = new HashMap<String, String>();
|
||||
|
||||
for (String directive : directives) {
|
||||
directive = directive.trim();
|
||||
@@ -165,6 +173,16 @@ public class LombokTestSource {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lc.startsWith("format:")) {
|
||||
String formatLine = directive.substring(7).trim();
|
||||
int idx = formatLine.indexOf('=');
|
||||
if (idx == -1) throw new IllegalArgumentException("To add a format directive, use: \"//FORMAT: javaLangAsFQN = skip\"");
|
||||
String key = formatLine.substring(0, idx).trim();
|
||||
String value = formatLine.substring(idx + 1).trim();
|
||||
formats.put(key.toLowerCase(), value);
|
||||
continue;
|
||||
}
|
||||
|
||||
Assert.fail("Directive line \"" + directive + "\" in '" + file.getAbsolutePath() + "' invalid: unrecognized directive.");
|
||||
throw new RuntimeException();
|
||||
}
|
||||
@@ -180,6 +198,7 @@ public class LombokTestSource {
|
||||
};
|
||||
|
||||
this.configuration = new BubblingConfigurationResolver(Collections.singleton(StringConfigurationSource.forString(conf, reporter, file.getAbsolutePath())));
|
||||
this.formatPreferences = Collections.unmodifiableMap(formats);
|
||||
}
|
||||
|
||||
public static LombokTestSource readDirectives(File file) throws IOException {
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.io.File;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.delombok.Delombok;
|
||||
import lombok.javac.CapturingDiagnosticListener;
|
||||
@@ -34,10 +35,11 @@ public class RunTestsViaDelombok extends AbstractRunTests {
|
||||
private Delombok delombok = new Delombok();
|
||||
|
||||
@Override
|
||||
public void transformCode(Collection<CompilerMessage> messages, StringWriter result, final File file, String encoding) throws Throwable {
|
||||
public void transformCode(Collection<CompilerMessage> messages, StringWriter result, final File file, String encoding, Map<String, String> formatPreferences) throws Throwable {
|
||||
delombok.setVerbose(false);
|
||||
delombok.setForceProcess(true);
|
||||
delombok.setCharset(encoding == null ? "UTF-8" : encoding);
|
||||
delombok.setFormatPreferences(formatPreferences);
|
||||
|
||||
delombok.setDiagnosticsListener(new CapturingDiagnosticListener(file, messages));
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformCode(Collection<CompilerMessage> messages, StringWriter result, File file, String encoding) throws Throwable {
|
||||
public void transformCode(Collection<CompilerMessage> messages, StringWriter result, File file, String encoding, Map<String, String> formatPreferences) throws Throwable {
|
||||
final AtomicReference<CompilationResult> compilationResult_ = new AtomicReference<CompilationResult>();
|
||||
final AtomicReference<CompilationUnitDeclaration> compilationUnit_ = new AtomicReference<CompilationUnitDeclaration>();
|
||||
ICompilerRequestor bitbucketRequestor = new ICompilerRequestor() {
|
||||
|
||||
@@ -6,32 +6,28 @@ class BuilderSingularMaps<K, V> {
|
||||
@SuppressWarnings("all")
|
||||
private Map rawMap;
|
||||
private Map<String, V> stringMap;
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
BuilderSingularMaps(final Map<K, V> women, final SortedMap<K, ? extends Number> men, final Map rawMap, final Map<String, V> stringMap) {
|
||||
@SuppressWarnings("all")
|
||||
BuilderSingularMaps(Map<K, V> women, SortedMap<K, ? extends Number> men, Map rawMap, Map<String, V> stringMap) {
|
||||
this.women = women;
|
||||
this.men = men;
|
||||
this.rawMap = rawMap;
|
||||
this.stringMap = stringMap;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
@SuppressWarnings("all")
|
||||
public static class BuilderSingularMapsBuilder<K, V> {
|
||||
private java.util.ArrayList<K> women$key;
|
||||
private java.util.ArrayList<V> women$value;
|
||||
private java.util.ArrayList<K> men$key;
|
||||
private java.util.ArrayList<Number> men$value;
|
||||
private java.util.ArrayList<java.lang.Object> rawMap$key;
|
||||
private java.util.ArrayList<java.lang.Object> rawMap$value;
|
||||
private java.util.ArrayList<Object> rawMap$key;
|
||||
private java.util.ArrayList<Object> rawMap$value;
|
||||
private java.util.ArrayList<String> stringMap$key;
|
||||
private java.util.ArrayList<V> stringMap$value;
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
@SuppressWarnings("all")
|
||||
BuilderSingularMapsBuilder() {
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public BuilderSingularMapsBuilder<K, V> woman(final K womanKey, final V womanValue) {
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsBuilder<K, V> woman(K womanKey, V womanValue) {
|
||||
if (this.women$key == null) {
|
||||
this.women$key = new java.util.ArrayList<K>();
|
||||
this.women$value = new java.util.ArrayList<V>();
|
||||
@@ -40,22 +36,20 @@ class BuilderSingularMaps<K, V> {
|
||||
this.women$value.add(womanValue);
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public BuilderSingularMapsBuilder<K, V> women(final java.util.Map<? extends K, ? extends V> women) {
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsBuilder<K, V> women(java.util.Map<? extends K, ? extends V> women) {
|
||||
if (this.women$key == null) {
|
||||
this.women$key = new java.util.ArrayList<K>();
|
||||
this.women$value = new java.util.ArrayList<V>();
|
||||
}
|
||||
for (final java.util.Map.Entry<? extends K, ? extends V> $lombokEntry : women.entrySet()) {
|
||||
for (java.util.Map.Entry<? extends K, ? extends V> $lombokEntry : women.entrySet()) {
|
||||
this.women$key.add($lombokEntry.getKey());
|
||||
this.women$value.add($lombokEntry.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public BuilderSingularMapsBuilder<K, V> man(final K manKey, final Number manValue) {
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsBuilder<K, V> man(K manKey, Number manValue) {
|
||||
if (this.men$key == null) {
|
||||
this.men$key = new java.util.ArrayList<K>();
|
||||
this.men$value = new java.util.ArrayList<Number>();
|
||||
@@ -64,46 +58,42 @@ class BuilderSingularMaps<K, V> {
|
||||
this.men$value.add(manValue);
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public BuilderSingularMapsBuilder<K, V> men(final java.util.Map<? extends K, ? extends Number> men) {
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsBuilder<K, V> men(java.util.Map<? extends K, ? extends Number> men) {
|
||||
if (this.men$key == null) {
|
||||
this.men$key = new java.util.ArrayList<K>();
|
||||
this.men$value = new java.util.ArrayList<Number>();
|
||||
}
|
||||
for (final java.util.Map.Entry<? extends K, ? extends Number> $lombokEntry : men.entrySet()) {
|
||||
for (java.util.Map.Entry<? extends K, ? extends Number> $lombokEntry : men.entrySet()) {
|
||||
this.men$key.add($lombokEntry.getKey());
|
||||
this.men$value.add($lombokEntry.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public BuilderSingularMapsBuilder<K, V> rawMap(final java.lang.Object rawMapKey, final java.lang.Object rawMapValue) {
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsBuilder<K, V> rawMap(Object rawMapKey, Object rawMapValue) {
|
||||
if (this.rawMap$key == null) {
|
||||
this.rawMap$key = new java.util.ArrayList<java.lang.Object>();
|
||||
this.rawMap$value = new java.util.ArrayList<java.lang.Object>();
|
||||
this.rawMap$key = new java.util.ArrayList<Object>();
|
||||
this.rawMap$value = new java.util.ArrayList<Object>();
|
||||
}
|
||||
this.rawMap$key.add(rawMapKey);
|
||||
this.rawMap$value.add(rawMapValue);
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public BuilderSingularMapsBuilder<K, V> rawMap(final java.util.Map<?, ?> rawMap) {
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsBuilder<K, V> rawMap(java.util.Map<?, ?> rawMap) {
|
||||
if (this.rawMap$key == null) {
|
||||
this.rawMap$key = new java.util.ArrayList<java.lang.Object>();
|
||||
this.rawMap$value = new java.util.ArrayList<java.lang.Object>();
|
||||
this.rawMap$key = new java.util.ArrayList<Object>();
|
||||
this.rawMap$value = new java.util.ArrayList<Object>();
|
||||
}
|
||||
for (final java.util.Map.Entry<?, ?> $lombokEntry : rawMap.entrySet()) {
|
||||
for (java.util.Map.Entry<?, ?> $lombokEntry : rawMap.entrySet()) {
|
||||
this.rawMap$key.add($lombokEntry.getKey());
|
||||
this.rawMap$value.add($lombokEntry.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public BuilderSingularMapsBuilder<K, V> stringMap(final String stringMapKey, final V stringMapValue) {
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsBuilder<K, V> stringMap(String stringMapKey, V stringMapValue) {
|
||||
if (this.stringMap$key == null) {
|
||||
this.stringMap$key = new java.util.ArrayList<String>();
|
||||
this.stringMap$value = new java.util.ArrayList<V>();
|
||||
@@ -112,21 +102,19 @@ class BuilderSingularMaps<K, V> {
|
||||
this.stringMap$value.add(stringMapValue);
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public BuilderSingularMapsBuilder<K, V> stringMap(final java.util.Map<? extends String, ? extends V> stringMap) {
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMapsBuilder<K, V> stringMap(java.util.Map<? extends String, ? extends V> stringMap) {
|
||||
if (this.stringMap$key == null) {
|
||||
this.stringMap$key = new java.util.ArrayList<String>();
|
||||
this.stringMap$value = new java.util.ArrayList<V>();
|
||||
}
|
||||
for (final java.util.Map.Entry<? extends String, ? extends V> $lombokEntry : stringMap.entrySet()) {
|
||||
for (java.util.Map.Entry<? extends String, ? extends V> $lombokEntry : stringMap.entrySet()) {
|
||||
this.stringMap$key.add($lombokEntry.getKey());
|
||||
this.stringMap$value.add($lombokEntry.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
@SuppressWarnings("all")
|
||||
public BuilderSingularMaps<K, V> build() {
|
||||
java.util.Map<K, V> women;
|
||||
switch (this.women$key == null ? 0 : this.women$key.size()) {
|
||||
@@ -137,14 +125,14 @@ class BuilderSingularMaps<K, V> {
|
||||
women = java.util.Collections.singletonMap(this.women$key.get(0), this.women$value.get(0));
|
||||
break;
|
||||
default:
|
||||
women = new java.util.LinkedHashMap<K, V>(this.women$key.size() < 1073741824 ? 1 + this.women$key.size() + (this.women$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
|
||||
women = new java.util.LinkedHashMap<K, V>(this.women$key.size() < 1073741824 ? 1 + this.women$key.size() + (this.women$key.size() - 3) / 3 : Integer.MAX_VALUE);
|
||||
for (int $i = 0; $i < this.women$key.size(); $i++) women.put(this.women$key.get($i), this.women$value.get($i));
|
||||
women = java.util.Collections.unmodifiableMap(women);
|
||||
}
|
||||
java.util.SortedMap<K, Number> men = new java.util.TreeMap<K, Number>();
|
||||
if (this.men$key != null) for (int $i = 0; $i < (this.men$key == null ? 0 : this.men$key.size()); $i++) men.put(this.men$key.get($i), this.men$value.get($i));
|
||||
men = java.util.Collections.unmodifiableSortedMap(men);
|
||||
java.util.Map<java.lang.Object, java.lang.Object> rawMap;
|
||||
java.util.Map<Object, Object> rawMap;
|
||||
switch (this.rawMap$key == null ? 0 : this.rawMap$key.size()) {
|
||||
case 0:
|
||||
rawMap = java.util.Collections.emptyMap();
|
||||
@@ -153,7 +141,7 @@ class BuilderSingularMaps<K, V> {
|
||||
rawMap = java.util.Collections.singletonMap(this.rawMap$key.get(0), this.rawMap$value.get(0));
|
||||
break;
|
||||
default:
|
||||
rawMap = new java.util.LinkedHashMap<java.lang.Object, java.lang.Object>(this.rawMap$key.size() < 1073741824 ? 1 + this.rawMap$key.size() + (this.rawMap$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
|
||||
rawMap = new java.util.LinkedHashMap<Object, Object>(this.rawMap$key.size() < 1073741824 ? 1 + this.rawMap$key.size() + (this.rawMap$key.size() - 3) / 3 : Integer.MAX_VALUE);
|
||||
for (int $i = 0; $i < this.rawMap$key.size(); $i++) rawMap.put(this.rawMap$key.get($i), this.rawMap$value.get($i));
|
||||
rawMap = java.util.Collections.unmodifiableMap(rawMap);
|
||||
}
|
||||
@@ -166,21 +154,19 @@ class BuilderSingularMaps<K, V> {
|
||||
stringMap = java.util.Collections.singletonMap(this.stringMap$key.get(0), this.stringMap$value.get(0));
|
||||
break;
|
||||
default:
|
||||
stringMap = new java.util.LinkedHashMap<String, V>(this.stringMap$key.size() < 1073741824 ? 1 + this.stringMap$key.size() + (this.stringMap$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
|
||||
stringMap = new java.util.LinkedHashMap<String, V>(this.stringMap$key.size() < 1073741824 ? 1 + this.stringMap$key.size() + (this.stringMap$key.size() - 3) / 3 : Integer.MAX_VALUE);
|
||||
for (int $i = 0; $i < this.stringMap$key.size(); $i++) stringMap.put(this.stringMap$key.get($i), this.stringMap$value.get($i));
|
||||
stringMap = java.util.Collections.unmodifiableMap(stringMap);
|
||||
}
|
||||
return new BuilderSingularMaps<K, V>(women, men, rawMap, stringMap);
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public java.lang.String toString() {
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
public String toString() {
|
||||
return "BuilderSingularMaps.BuilderSingularMapsBuilder(women$key=" + this.women$key + ", women$value=" + this.women$value + ", men$key=" + this.men$key + ", men$value=" + this.men$value + ", rawMap$key=" + this.rawMap$key + ", rawMap$value=" + this.rawMap$value + ", stringMap$key=" + this.stringMap$key + ", stringMap$value=" + this.stringMap$value + ")";
|
||||
}
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
@SuppressWarnings("all")
|
||||
public static <K, V> BuilderSingularMapsBuilder<K, V> builder() {
|
||||
return new BuilderSingularMapsBuilder<K, V>();
|
||||
}
|
||||
|
||||
@@ -6,13 +6,11 @@ class EqualsAndHashCodeWithSomeExistingMethods {
|
||||
return 42;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public EqualsAndHashCodeWithSomeExistingMethods() {
|
||||
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public java.lang.String toString() {
|
||||
return "EqualsAndHashCodeWithSomeExistingMethods(x=" + this.x + ")";
|
||||
}
|
||||
@@ -23,12 +21,10 @@ class EqualsAndHashCodeWithSomeExistingMethods2 {
|
||||
return false;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public EqualsAndHashCodeWithSomeExistingMethods2() {
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public boolean equals(final java.lang.Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof EqualsAndHashCodeWithSomeExistingMethods2)) return false;
|
||||
@@ -39,7 +35,6 @@ class EqualsAndHashCodeWithSomeExistingMethods2 {
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public int hashCode() {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
@@ -48,7 +43,6 @@ class EqualsAndHashCodeWithSomeExistingMethods2 {
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public java.lang.String toString() {
|
||||
return "EqualsAndHashCodeWithSomeExistingMethods2(x=" + this.x + ")";
|
||||
}
|
||||
@@ -62,12 +56,10 @@ class EqualsAndHashCodeWithAllExistingMethods {
|
||||
return false;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public EqualsAndHashCodeWithAllExistingMethods() {
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public java.lang.String toString() {
|
||||
return "EqualsAndHashCodeWithAllExistingMethods(x=" + this.x + ")";
|
||||
}
|
||||
@@ -75,13 +67,11 @@ class EqualsAndHashCodeWithAllExistingMethods {
|
||||
class EqualsAndHashCodeWithNoExistingMethods {
|
||||
int x;
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public EqualsAndHashCodeWithNoExistingMethods() {
|
||||
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public boolean equals(final java.lang.Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof EqualsAndHashCodeWithNoExistingMethods)) return false;
|
||||
@@ -91,13 +81,11 @@ class EqualsAndHashCodeWithNoExistingMethods {
|
||||
return true;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
protected boolean canEqual(final java.lang.Object other) {
|
||||
return other instanceof EqualsAndHashCodeWithNoExistingMethods;
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public int hashCode() {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
@@ -106,7 +94,6 @@ class EqualsAndHashCodeWithNoExistingMethods {
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@javax.annotation.Generated("lombok")
|
||||
public java.lang.String toString() {
|
||||
return "EqualsAndHashCodeWithNoExistingMethods(x=" + this.x + ")";
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ import static lombok.AccessLevel.NONE;
|
||||
public int hashCode() {
|
||||
return 42;
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() {
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
|
||||
return (("EqualsAndHashCodeWithSomeExistingMethods(x=" + this.x) + ")");
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") EqualsAndHashCodeWithSomeExistingMethods() {
|
||||
public @java.lang.SuppressWarnings("all") EqualsAndHashCodeWithSomeExistingMethods() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import static lombok.AccessLevel.NONE;
|
||||
protected boolean canEqual(Object other) {
|
||||
return false;
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") boolean equals(final java.lang.Object o) {
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
|
||||
if ((o == this))
|
||||
return true;
|
||||
if ((! (o instanceof EqualsAndHashCodeWithSomeExistingMethods2)))
|
||||
@@ -29,16 +29,16 @@ import static lombok.AccessLevel.NONE;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") int hashCode() {
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
result = ((result * PRIME) + this.x);
|
||||
return result;
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() {
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
|
||||
return (("EqualsAndHashCodeWithSomeExistingMethods2(x=" + this.x) + ")");
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") EqualsAndHashCodeWithSomeExistingMethods2() {
|
||||
public @java.lang.SuppressWarnings("all") EqualsAndHashCodeWithSomeExistingMethods2() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -50,16 +50,16 @@ import static lombok.AccessLevel.NONE;
|
||||
public boolean equals(Object other) {
|
||||
return false;
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() {
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
|
||||
return (("EqualsAndHashCodeWithAllExistingMethods(x=" + this.x) + ")");
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") EqualsAndHashCodeWithAllExistingMethods() {
|
||||
public @java.lang.SuppressWarnings("all") EqualsAndHashCodeWithAllExistingMethods() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@Data @Getter(AccessLevel.NONE) @Setter(lombok.AccessLevel.NONE) class EqualsAndHashCodeWithNoExistingMethods {
|
||||
int x;
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") boolean equals(final java.lang.Object o) {
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
|
||||
if ((o == this))
|
||||
return true;
|
||||
if ((! (o instanceof EqualsAndHashCodeWithNoExistingMethods)))
|
||||
@@ -71,19 +71,19 @@ import static lombok.AccessLevel.NONE;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
protected @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") boolean canEqual(final java.lang.Object other) {
|
||||
protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
|
||||
return (other instanceof EqualsAndHashCodeWithNoExistingMethods);
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") int hashCode() {
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
result = ((result * PRIME) + this.x);
|
||||
return result;
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() {
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
|
||||
return (("EqualsAndHashCodeWithNoExistingMethods(x=" + this.x) + ")");
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") EqualsAndHashCodeWithNoExistingMethods() {
|
||||
public @java.lang.SuppressWarnings("all") EqualsAndHashCodeWithNoExistingMethods() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
//FORMAT: javaLangAsFQN = skip
|
||||
//FORMAT: generated = skip
|
||||
//FORMAT: finalParams = skip
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//CONF: lombok.addGeneratedAnnotation = false
|
||||
import lombok.*;
|
||||
import static lombok.AccessLevel.NONE;
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
4 Not generating equals: One of equals or hashCode exists. You should either write both of these or none of these (in the latter case, lombok generates them).
|
||||
5 Not generating equals: One of equals or hashCode exists. You should either write both of these or none of these (in the latter case, lombok generates them).
|
||||
+1
-1
@@ -1 +1 @@
|
||||
4 Not generating equals: One of equals or hashCode exists. You should either write both of these or none of these (in the latter case, lombok generates them).
|
||||
5 Not generating equals: One of equals or hashCode exists. You should either write both of these or none of these (in the latter case, lombok generates them).
|
||||
Reference in new issue
Block a user