aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2014-01-17 21:50:10 +0100
committerRoel Spilker <r.spilker@gmail.com>2014-01-17 21:50:10 +0100
commit493cf8231390af5500174091a3d1c0b27f0b0aee (patch)
tree72258484f9894d8f2573fb7d51dfd773cace45d6 /src/core/lombok
parent477a5341c1ca8f3037a921dd1c05addc74e5a5a3 (diff)
downloadlombok-493cf8231390af5500174091a3d1c0b27f0b0aee.tar.gz
lombok-493cf8231390af5500174091a3d1c0b27f0b0aee.tar.bz2
lombok-493cf8231390af5500174091a3d1c0b27f0b0aee.zip
[configuration] More strict naming rules for keyNames:
- may contain letters, digits, minus signs, underscores and periods - must start with a letter, minus sign or underscore - may not end with a period or minus sign the rules about the periods are for possible future wildcard/globbing enhancements
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/core/configuration/ConfigurationKey.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/lombok/core/configuration/ConfigurationKey.java b/src/core/lombok/core/configuration/ConfigurationKey.java
index f6711cca..694a0054 100644
--- a/src/core/lombok/core/configuration/ConfigurationKey.java
+++ b/src/core/lombok/core/configuration/ConfigurationKey.java
@@ -26,6 +26,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
+import java.util.regex.Pattern;
/**
* Describes a configuration key and its type.
@@ -36,6 +37,8 @@ import java.util.TreeMap;
* </pre>
*/
public abstract class ConfigurationKey<T> {
+ private static final Pattern VALID_NAMES = Pattern.compile("[\\-_a-zA-Z][\\-\\.\\w]*(?<![\\.\\-])");
+
private static final TreeMap<String, ConfigurationDataType> registeredKeys = new TreeMap<String, ConfigurationDataType>(String.CASE_INSENSITIVE_ORDER);
private static Map<String, ConfigurationDataType> copy;
@@ -86,7 +89,7 @@ public abstract class ConfigurationKey<T> {
private static String checkName(String keyName) {
if (keyName == null) throw new NullPointerException("keyName");
- if (keyName.contains("=")) throw new IllegalArgumentException("Invalid character '=' in keyName: " + keyName);
+ if (!VALID_NAMES.matcher(keyName).matches()) throw new IllegalArgumentException("Invalid keyName: " + keyName);
return keyName;
}