validate field names in JetScope

(field name must start with dollar sign)
This commit is contained in:
Stepan Koltsov
2011-11-30 02:48:20 +04:00
parent d984f6c4b8
commit 72777733cd
@@ -299,11 +299,19 @@ public class WritableScopeImpl extends WritableScopeWithImports {
@Override
public void addPropertyDescriptorByFieldName(@NotNull String fieldName, @NotNull PropertyDescriptor propertyDescriptor) {
if (!fieldName.startsWith("$")) {
throw new IllegalStateException();
}
getPropertyDescriptorsByFieldNames().put(fieldName, propertyDescriptor);
}
@Override
public PropertyDescriptor getPropertyByFieldReference(@NotNull String fieldName) {
if (!fieldName.startsWith("$")) {
throw new IllegalStateException();
}
PropertyDescriptor descriptor = getPropertyDescriptorsByFieldNames().get(fieldName);
if (descriptor != null) return descriptor;
return super.getPropertyByFieldReference(fieldName);