aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/core/configuration/AllowHelper.java22
-rw-r--r--src/core/lombok/core/handlers/HandlerUtil.java7
2 files changed, 14 insertions, 15 deletions
diff --git a/src/core/lombok/core/configuration/AllowHelper.java b/src/core/lombok/core/configuration/AllowHelper.java
index 31d09381..3873b055 100644
--- a/src/core/lombok/core/configuration/AllowHelper.java
+++ b/src/core/lombok/core/configuration/AllowHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 The Project Lombok Authors.
+ * Copyright (C) 2016 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
@@ -21,17 +21,19 @@
*/
package lombok.core.configuration;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.Collection;
+import java.util.Collections;
-import static java.util.Arrays.asList;
+import lombok.ConfigurationKeys;
-public class AllowHelper {
- private final static Set<String> allowable = new HashSet<String>(asList(
- "var"
- ));
+public final class AllowHelper {
+ private final static Collection<? extends ConfigurationKey<?>> ALLOWABLE = Collections.singleton(ConfigurationKeys.VAR_FLAG_USAGE);
- public static boolean isAllowable(String feature) {
- return allowable.contains(feature);
+ private AllowHelper() {
+ // Prevent instantiation
+ }
+
+ public static boolean isAllowable(ConfigurationKey<?> key) {
+ return ALLOWABLE.contains(key);
}
}
diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java
index a321e67f..ef4ac7d6 100644
--- a/src/core/lombok/core/handlers/HandlerUtil.java
+++ b/src/core/lombok/core/handlers/HandlerUtil.java
@@ -96,13 +96,10 @@ public class HandlerUtil {
return Singulars.autoSingularize(plural);
}
public static void handleFlagUsage(LombokNode<?, ?, ?> node, ConfigurationKey<FlagUsageType> key, String featureName) {
- boolean allowable = AllowHelper.isAllowable(featureName);
-
FlagUsageType fut = node.getAst().readConfiguration(key);
- boolean allowed = !allowable || FlagUsageType.ALLOW == fut;
- if (!allowed) {
- node.addError("Use of " + featureName + " is disabled by default. Please use flag " + FlagUsageType.ALLOW + " to enable.");
+ if (fut == null && AllowHelper.isAllowable(key)) {
+ node.addError("Use of " + featureName + " is disabled by default. Please add '" + key.getKeyName() + " = " + FlagUsageType.ALLOW + "' to 'lombok.config' if you want to enable is.");
}
if (fut != null) {