From 33a3a3d3d91c7e3d22ad2a25c5b7e250acbbf5a3 Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Tue, 17 Sep 2024 10:55:16 +0200 Subject: [PATCH] [java] Less raw types GitOrigin-RevId: 0bb21ea1ab22c45d79e74e8c839c6b8495a9036a --- .../uiDesigner/compiler/AsmCodeGenerator.java | 19 ++++------ .../lw/CompiledClassPropertiesProvider.java | 11 +++--- .../intellij/uiDesigner/lw/LwComponent.java | 35 ++++++++----------- .../uiDesigner/lw/PropertiesProvider.java | 2 +- .../MoveInstanceMethodDialog.java | 4 +-- .../MoveInstanceMethodDialogBase.java | 10 +++--- .../rename/inplace/JavaResolveSnapshot.java | 13 +++---- .../psi/impl/compiled/ClsMemberImpl.java | 2 +- .../compiled/ClsRepositoryPsiElement.java | 12 +++---- .../intellij/rt/debugger/MethodInvoker.java | 8 ++--- .../uiDesigner/PsiPropertiesProvider.java | 8 ++--- .../make/FormSourceCodeGenerator.java | 7 ++-- 12 files changed, 57 insertions(+), 74 deletions(-) diff --git a/java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java b/java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java index dc7ea2ebdde9..36a157bf9ec0 100644 --- a/java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java +++ b/java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java @@ -134,19 +134,15 @@ public final class AsmCodeGenerator { fis.close(); } - FileOutputStream fos = new FileOutputStream(classFile); - try { + try (FileOutputStream fos = new FileOutputStream(classFile)) { fos.write(patchedData); } - finally { - fos.close(); - } } catch (IOException e) { - myErrors.add(new FormErrorInfo(null, "Cannot read or write class file " + classFile.getPath() + ": " + e.toString())); + myErrors.add(new FormErrorInfo(null, "Cannot read or write class file " + classFile.getPath() + ": " + e)); } catch(IllegalStateException e) { - myErrors.add(new FormErrorInfo(null, "Unexpected data in form file when patching class " + classFile.getPath() + ": " + e.toString())); + myErrors.add(new FormErrorInfo(null, "Unexpected data in form file when patching class " + classFile.getPath() + ": " + e)); } } @@ -313,7 +309,7 @@ public final class AsmCodeGenerator { final String rootBinding = myRootContainer.getComponent(0).getBinding(); if (rootBinding != null && myFieldDescMap.containsKey(rootBinding)) { - buildGetRootComponenMethod(); + buildGetRootComponentMethod(); } if (myGetFontMethod != null) { @@ -328,7 +324,7 @@ public final class AsmCodeGenerator { super.visitEnd(); } - private void buildGetRootComponenMethod() { + private void buildGetRootComponentMethod() { final Type componentType = Type.getType(JComponent.class); final Method method = new Method(GET_ROOT_COMPONENT_METHOD_NAME, componentType, new Type[0]); GeneratorAdapter generator = new GeneratorAdapter(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, method, null, null, cv); @@ -623,11 +619,10 @@ public final class AsmCodeGenerator { final InstrumentationClassFinder.PseudoClass componentClass, final GeneratorAdapter generator, final int componentLocal) throws CodeGenerationException { - for (Object o : lwComponent.getDelegeeClientProperties().entrySet()) { - Map.Entry e = (Map.Entry)o; + for (Map.Entry e : lwComponent.getDelegeeClientProperties().entrySet()) { generator.loadLocal(componentLocal); - generator.push((String)e.getKey()); + generator.push(e.getKey()); Object value = e.getValue(); if (value instanceof StringDescriptor) { diff --git a/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/CompiledClassPropertiesProvider.java b/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/CompiledClassPropertiesProvider.java index 4404be33d3bc..1de020144655 100644 --- a/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/CompiledClassPropertiesProvider.java +++ b/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/CompiledClassPropertiesProvider.java @@ -10,11 +10,10 @@ import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.util.HashMap; -import java.util.Map; public final class CompiledClassPropertiesProvider implements PropertiesProvider { private final ClassLoader myLoader; - private final HashMap> myCache; + private final HashMap> myCache; public CompiledClassPropertiesProvider(final ClassLoader loader) { if (loader == null) { @@ -25,16 +24,16 @@ public final class CompiledClassPropertiesProvider implements PropertiesProvider } @Override - public HashMap getLwProperties(final String className) { + public HashMap getLwProperties(final String className) { if (myCache.containsKey(className)) { - return (HashMap)myCache.get(className); + return myCache.get(className); } if (Utils.validateJComponentClass(myLoader, className, false) != null) { return null; } - final Class aClass; + final Class aClass; try { aClass = Class.forName(className, false, myLoader); } @@ -55,7 +54,7 @@ public final class CompiledClassPropertiesProvider implements PropertiesProvider for (final PropertyDescriptor descriptor : descriptors) { final Method readMethod = descriptor.getReadMethod(); final Method writeMethod = descriptor.getWriteMethod(); - final Class propertyType = descriptor.getPropertyType(); + final Class propertyType = descriptor.getPropertyType(); if (writeMethod == null || readMethod == null || propertyType == null) { continue; } diff --git a/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/LwComponent.java b/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/LwComponent.java index 96ce0395e709..ef462168b5bb 100644 --- a/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/LwComponent.java +++ b/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/LwComponent.java @@ -21,7 +21,6 @@ import org.jdom.Element; import java.awt.*; import java.util.HashMap; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -31,7 +30,7 @@ public abstract class LwComponent implements IComponent{ */ private String myId; /** - * may be null + * could be null */ private String myBinding; /** @@ -55,13 +54,13 @@ public abstract class LwComponent implements IComponent{ */ private final Rectangle myBounds; - private final HashMap myIntrospectedProperty2Value; + private final HashMap myIntrospectedProperty2Value; /** - * if class is unknown (cannot be loaded), properties tag is stored as is + * if class is unknown (cannot be loaded), property tag is stored as is */ private Element myErrorComponentProperties; - protected final HashMap myClientProperties; - protected final HashMap myDelegeeClientProperties; + protected final HashMap myClientProperties; + protected final HashMap myDelegeeClientProperties; private boolean myCustomCreate = false; private boolean myDefaultBinding = false; @@ -71,10 +70,10 @@ public abstract class LwComponent implements IComponent{ } myBounds = new Rectangle(); myConstraints = new GridConstraints(); - myIntrospectedProperty2Value = new LinkedHashMap(); + myIntrospectedProperty2Value = new LinkedHashMap<>(); myClassName = className; - myClientProperties = new LinkedHashMap(); - myDelegeeClientProperties = new LinkedHashMap(); + myClientProperties = new LinkedHashMap<>(); + myDelegeeClientProperties = new LinkedHashMap<>(); } @Override @@ -121,8 +120,7 @@ public abstract class LwComponent implements IComponent{ } /** - * @return component's constraints in XY layout. This method rever - * returns {@code null}. + * @return component's constraints in XY layout. */ public final Rectangle getBounds(){ return (Rectangle)myBounds.clone(); @@ -190,12 +188,7 @@ public abstract class LwComponent implements IComponent{ } public final LwIntrospectedProperty[] getAssignedIntrospectedProperties() { - final LwIntrospectedProperty[] properties = new LwIntrospectedProperty[myIntrospectedProperty2Value.size()]; - final Iterator iterator = myIntrospectedProperty2Value.keySet().iterator(); - for (int i=0; iterator.hasNext(); i++) { - properties[i] = (LwIntrospectedProperty)iterator.next(); - } - return properties; + return myIntrospectedProperty2Value.keySet().toArray(new LwIntrospectedProperty[0]); } /** @@ -224,7 +217,7 @@ public abstract class LwComponent implements IComponent{ propertiesElement = new Element(UIFormXmlConstants.ELEMENT_PROPERTIES, element.getNamespace()); } - final HashMap name2property = provider.getLwProperties(getComponentClassName()); + final HashMap name2property = provider.getLwProperties(getComponentClassName()); if (name2property == null) { myErrorComponentProperties = propertiesElement.clone(); return; @@ -233,7 +226,7 @@ public abstract class LwComponent implements IComponent{ final List propertyElements = propertiesElement.getChildren(); for (Element t : propertyElements) { final String name = t.getName(); - final LwIntrospectedProperty property = (LwIntrospectedProperty)name2property.get(name); + final LwIntrospectedProperty property = name2property.get(name); if (property == null){ continue; } @@ -268,7 +261,7 @@ public abstract class LwComponent implements IComponent{ lwProp = new LwIntroPrimitiveTypeProperty(propName, Double.class); } else { - Class propClass; + Class propClass; try { propClass = Class.forName(className); } @@ -329,7 +322,7 @@ public abstract class LwComponent implements IComponent{ myClientProperties.put(key, value); } - public HashMap getDelegeeClientProperties() { + public HashMap getDelegeeClientProperties() { return myDelegeeClientProperties; } } \ No newline at end of file diff --git a/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/PropertiesProvider.java b/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/PropertiesProvider.java index 897680b5dd5b..f64251e6b594 100644 --- a/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/PropertiesProvider.java +++ b/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/PropertiesProvider.java @@ -25,5 +25,5 @@ public interface PropertiesProvider { * @return key - property name (String), value - LwProperty. If class cannot be inspected for some reason, * returns null */ - HashMap getLwProperties(String className); + HashMap getLwProperties(String className); } diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialog.java b/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialog.java index dba9ddc9fe49..090c6fc37376 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialog.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialog.java @@ -103,7 +103,7 @@ public class MoveInstanceMethodDialog extends MoveInstanceMethodDialogBase { private JPanel createParametersPanel () { myThisClassesMap = MoveInstanceMembersUtil.getThisClassesToMembers(myMethod); myOldClassParameterNameFields = new HashMap<>(); - if (myThisClassesMap.size() == 0) return null; + if (myThisClassesMap.isEmpty()) return null; JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, true)); for (PsiClass aClass : myThisClassesMap.keySet()) { final String text = JavaRefactoringBundle.message("move.method.this.parameter.label", ObjectUtils.notNull(aClass.getName(), "")); @@ -147,7 +147,7 @@ public class MoveInstanceMethodDialog extends MoveInstanceMethodDialogBase { } @Override - protected void updateOnChanged(JList list) { + protected void updateOnChanged(JList list) { super.updateOnChanged(list); final PsiVariable selectedValue = (PsiVariable)list.getSelectedValue(); if (selectedValue != null) { diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialogBase.java b/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialogBase.java index 758c66115988..62048803af39 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialogBase.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialogBase.java @@ -37,7 +37,7 @@ public abstract class MoveInstanceMethodDialogBase extends MoveDialogBase { return myList; } - protected JList myList; + protected JList myList; protected JavaVisibilityPanel myVisibilityPanel; protected final @NlsContexts.DialogTitle String myRefactoringName; @@ -73,8 +73,8 @@ public abstract class MoveInstanceMethodDialogBase extends MoveDialogBase { return hBox; } - protected JList createTargetVariableChooser() { - final JList list = new JBList(new MyListModel()); + protected JList createTargetVariableChooser() { + final JList list = new JBList<>(new MyListModel()); list.setCellRenderer(new MyListCellRenderer()); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectedIndex(0); @@ -88,7 +88,7 @@ public abstract class MoveInstanceMethodDialogBase extends MoveDialogBase { return list; } - protected void updateOnChanged(JList list) { + protected void updateOnChanged(JList list) { getOKAction().setEnabled(!list.getSelectionModel().isSelectionEmpty()); } @@ -120,7 +120,7 @@ public abstract class MoveInstanceMethodDialogBase extends MoveDialogBase { return true; } - private class MyListModel extends AbstractListModel { + private class MyListModel extends AbstractListModel { @Override public int getSize() { return myVariables.length; diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/rename/inplace/JavaResolveSnapshot.java b/java/java-impl-refactorings/src/com/intellij/refactoring/rename/inplace/JavaResolveSnapshot.java index 40b90170aa27..8a423d596238 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/rename/inplace/JavaResolveSnapshot.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/rename/inplace/JavaResolveSnapshot.java @@ -1,7 +1,6 @@ // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.refactoring.rename.inplace; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.project.Project; import com.intellij.psi.*; @@ -13,9 +12,7 @@ import java.util.HashMap; import java.util.Map; class JavaResolveSnapshot extends ResolveSnapshotProvider.ResolveSnapshot { - private static final Logger LOG = Logger.getInstance(JavaResolveSnapshot.class); - - private final Map myReferencesMap = new HashMap<>(); + private final Map, SmartPsiElementPointer> myReferencesMap = new HashMap<>(); private final Project myProject; private final Document myDocument; @@ -23,15 +20,15 @@ class JavaResolveSnapshot extends ResolveSnapshotProvider.ResolveSnapshot { myProject = scope.getProject(); myDocument = PsiDocumentManager.getInstance(myProject).getDocument(scope.getContainingFile()); final SmartPointerManager pointerManager = SmartPointerManager.getInstance(myProject); - final Map pointers = new HashMap<>(); + final Map> pointers = new HashMap<>(); scope.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitReferenceExpression(@NotNull PsiReferenceExpression refExpr) { if (!refExpr.isQualified()) { JavaResolveResult resolveResult = refExpr.advancedResolve(false); final PsiElement resolved = resolveResult.getElement(); if ((resolved instanceof PsiField || resolved instanceof PsiClass) && resolveResult.isStaticsScopeCorrect()) { - SmartPsiElementPointer key = pointerManager.createSmartPsiElementPointer(refExpr); - SmartPsiElementPointer value = pointers.get(resolved); + SmartPsiElementPointer key = pointerManager.createSmartPsiElementPointer(refExpr); + SmartPsiElementPointer value = pointers.get(resolved); if (value == null) { value = pointerManager.createSmartPsiElementPointer(resolved); pointers.put(resolved, value); @@ -47,7 +44,7 @@ class JavaResolveSnapshot extends ResolveSnapshotProvider.ResolveSnapshot { @Override public void apply(String hidingLocalName) { PsiDocumentManager.getInstance(myProject).commitDocument(myDocument); - for (Map.Entry entry : myReferencesMap.entrySet()) { + for (Map.Entry, SmartPsiElementPointer> entry : myReferencesMap.entrySet()) { qualify(entry.getKey().getElement(), entry.getValue().getElement(), hidingLocalName); } } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsMemberImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsMemberImpl.java index c2951aba141e..bb8471bb5cbe 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsMemberImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsMemberImpl.java @@ -12,7 +12,7 @@ import com.intellij.psi.javadoc.PsiDocComment; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; -public abstract class ClsMemberImpl extends ClsRepositoryPsiElement implements PsiDocCommentOwner, PsiNameIdentifierOwner { +public abstract class ClsMemberImpl> extends ClsRepositoryPsiElement implements PsiDocCommentOwner, PsiNameIdentifierOwner { private final NotNullLazyValue myDocComment; private final NotNullLazyValue myNameIdentifier; diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsRepositoryPsiElement.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsRepositoryPsiElement.java index 822cfe87c0de..ec545b4e59a0 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsRepositoryPsiElement.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsRepositoryPsiElement.java @@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull; import java.util.List; -public abstract class ClsRepositoryPsiElement extends ClsElementImpl implements StubBasedPsiElement { +public abstract class ClsRepositoryPsiElement> extends ClsElementImpl implements StubBasedPsiElement { private final T myStub; protected ClsRepositoryPsiElement(final T stub) { @@ -50,7 +50,7 @@ public abstract class ClsRepositoryPsiElement extends Cls @Override public PsiFile getContainingFile() { - StubElement p = myStub; + StubElement p = myStub; while (!(p instanceof PsiFileStub)) { p = p.getParentStub(); } @@ -70,8 +70,8 @@ public abstract class ClsRepositoryPsiElement extends Cls @Override public PsiElement @NotNull [] getChildren() { - @SuppressWarnings("unchecked") List stubs = getStub().getChildrenStubs(); - if (stubs.size() == 0) return EMPTY_ARRAY; + List> stubs = getStub().getChildrenStubs(); + if (stubs.isEmpty()) return EMPTY_ARRAY; PsiElement[] children = new PsiElement[stubs.size()]; for (int i = 0; i < stubs.size(); i++) { children[i] = stubs.get(i).getPsi(); @@ -81,13 +81,13 @@ public abstract class ClsRepositoryPsiElement extends Cls @Override public PsiElement getFirstChild() { - @SuppressWarnings("unchecked") List children = getStub().getChildrenStubs(); + List> children = getStub().getChildrenStubs(); return children.isEmpty() ? null : children.get(0).getPsi(); } @Override public PsiElement getLastChild() { - @SuppressWarnings("unchecked") List children = getStub().getChildrenStubs(); + List> children = getStub().getChildrenStubs(); return children.isEmpty() ? null : children.get(children.size() - 1).getPsi(); } diff --git a/java/java-runtime/src/com/intellij/rt/debugger/MethodInvoker.java b/java/java-runtime/src/com/intellij/rt/debugger/MethodInvoker.java index d69b7bded66a..b7d7e9b267e5 100644 --- a/java/java-runtime/src/com/intellij/rt/debugger/MethodInvoker.java +++ b/java/java-runtime/src/com/intellij/rt/debugger/MethodInvoker.java @@ -10,7 +10,7 @@ public final class MethodInvoker { // TODO: may leak objects here static ThreadLocal returnValue = new ThreadLocal<>(); - public static Object invoke(Class cls, Object obj, String name, Class[] parameterTypes, Object[] args) + public static Object invoke(Class cls, Object obj, String name, Class[] parameterTypes, Object[] args) throws Throwable { ArrayList methods = new ArrayList<>(); // TODO: better collect methods lazily @@ -40,17 +40,17 @@ public final class MethodInvoker { } //TODO: avoid recursion - private static void addMatchingMethods(List methods, Class cls, String name, Class[] parameterTypes) { + private static void addMatchingMethods(List methods, Class cls, String name, Class[] parameterTypes) { try { methods.add(cls.getDeclaredMethod(name, parameterTypes)); } catch (NoSuchMethodException ignored) { } - Class superclass = cls.getSuperclass(); + Class superclass = cls.getSuperclass(); if (superclass != null) { addMatchingMethods(methods, superclass, name, parameterTypes); } - for (Class anInterface : cls.getInterfaces()) { + for (Class anInterface : cls.getInterfaces()) { addMatchingMethods(methods, anInterface, name, parameterTypes); } } diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/PsiPropertiesProvider.java b/plugins/ui-designer/src/com/intellij/uiDesigner/PsiPropertiesProvider.java index 197091836a14..0479a6d90de0 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/PsiPropertiesProvider.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/PsiPropertiesProvider.java @@ -20,7 +20,7 @@ import java.util.HashMap; public final class PsiPropertiesProvider implements PropertiesProvider { private final Module myModule; - private final HashMap myCache; + private final HashMap> myCache; public PsiPropertiesProvider(final @NotNull Module module) { myModule = module; @@ -28,7 +28,7 @@ public final class PsiPropertiesProvider implements PropertiesProvider { } @Override - public @Nullable HashMap getLwProperties(final String className) { + public @Nullable HashMap getLwProperties(final String className) { if (myCache.containsKey(className)) { return myCache.get(className); } @@ -40,11 +40,11 @@ public final class PsiPropertiesProvider implements PropertiesProvider { return null; } - final HashMap result = new HashMap(); + final HashMap result = new HashMap<>(); final PsiMethod[] methods = aClass.getAllMethods(); for (final PsiMethod method : methods) { - // it's a setter candidate.. try to find getter + // it's a setter candidate. try to find getter if (!PropertyUtilBase.isSimplePropertySetter(method)) { continue; diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/make/FormSourceCodeGenerator.java b/plugins/ui-designer/src/com/intellij/uiDesigner/make/FormSourceCodeGenerator.java index 96c02183e343..e7a531a02639 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/make/FormSourceCodeGenerator.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/make/FormSourceCodeGenerator.java @@ -977,11 +977,10 @@ public final class FormSourceCodeGenerator { } private void generateClientProperties(final LwComponent component, final String variable) throws CodeGenerationException { - HashMap props = component.getDelegeeClientProperties(); - for (final Object o : props.entrySet()) { - Map.Entry e = (Map.Entry)o; + HashMap props = component.getDelegeeClientProperties(); + for (final Map.Entry e : props.entrySet()) { startMethodCall(variable, "putClientProperty"); - push((String) e.getKey()); + push(e.getKey()); Object value = e.getValue(); if (value instanceof StringDescriptor) {