Buggy code:
public class Indexer extends SpelNodeImpl { private String cachedReadName ; private Class < ? > cachedReadTargetType ; private PropertyAccessor cachedReadAccessor ; private String cachedWriteName ; private Class < ? > cachedWriteTargetType ; private PropertyAccessor cachedWriteAccessor ; public Indexer ( int pos , SpelNodeImpl expr ) { } @ Override public TypedValue getValueInternal ( ExpressionState state ) throws EvaluationException { TypedValue context = state . getActiveContextObject ( ) ; Object targetObject = context . getValue ( ) ; TypeDescriptor targetObjectTypeDescriptor = context . getTypeDescriptor ( ) ; TypedValue indexValue = null ; Object index = null ; if ( ( targetObject instanceof Map ) && ( ( children [ 0 ] ) instanceof PropertyOrFieldReference ) ) { PropertyOrFieldReference reference = ( ( PropertyOrFieldReference ) ( children [ 0 ] ) ) ; index = reference . getName ( ) ; indexValue = new TypedValue ( index ) ; } else { try { state . pushActiveContextObject ( state . getRootContextObject ( ) ) ; indexValue = children [ 0 ] . getValueInternal ( state ) ; index = indexValue . getValue ( ) ; } finally { state . popActiveContextObject ( ) ; } } if ( targetObject instanceof Map ) { Object key = index ; if ( ( targetObjectTypeDescriptor . getMapKeyTypeDescriptor ( ) ) != null ) { key = state . convertValue ( key , targetObjectTypeDescriptor . getMapKeyTypeDescriptor ( ) ) ; } Object value = ( ( Map < ? , ? > ) ( targetObject ) ) . get ( key ) ; <START_BUG> return new TypedValue ( value , targetObjectTypeDescriptor . mapValueTypeDescriptor ( value ) ) ; <END_BUG> } if ( targetObject == null ) { throw new SpelEvaluationException ( getStartPosition ( ) , SpelMessage . CANNOT_INDEX_INTO_NULL_VALUE ) ; } if ( ( ( targetObject instanceof Collection ) || ( targetObject . getClass ( ) . isArray ( ) ) ) || ( targetObject instanceof String ) ) { int idx = ( ( Integer ) ( state . convertValue ( index , TypeDescriptor . valueOf ( Integer . class ) ) ) ) ; if ( targetObject . getClass ( ) . isArray ( ) ) { Object arrayElement = accessArrayElement ( targetObject , idx ) ; return new TypedValue ( arrayElement , targetObjectTypeDescriptor . elementTypeDescriptor ( arrayElement ) ) ; } else if ( targetObject instanceof Collection ) { Collection c = ( ( Collection ) ( targetObject ) ) ; if ( idx >= ( c . size ( ) ) ) { if ( ! ( growCollection ( state , targetObjectTypeDescriptor , idx , c ) ) ) { throw new SpelEvaluationException ( getStartPosition ( ) , SpelMessage . COLLECTION_INDEX_OUT_OF_BOUNDS , c . size ( ) , idx ) ; } } int pos = 0 ; for ( Object o : c ) { if ( pos == idx ) { return new TypedValue ( o , targetObjectTypeDescriptor . elementTypeDescriptor ( o ) ) ; } pos ++ ; } } else if ( targetObject instanceof String ) { String ctxString = ( ( String ) ( targetObject ) ) ; if ( idx >= ( ctxString . length ( ) ) ) { throw new SpelEvaluationException ( getStartPosition ( ) , SpelMessage . STRING_INDEX_OUT_OF_BOUNDS , ctxString . length ( ) , idx ) ; } return new TypedValue ( String . valueOf ( ctxString . charAt ( idx ) ) ) ; } } if ( ( indexValue . getTypeDescriptor ( ) . getType ( ) ) == ( String . class ) ) { Class < ? > targetObjectRuntimeClass = getObjectClass ( targetObject ) ; String name = ( ( String ) ( indexValue . getValue ( ) ) ) ; EvaluationContext eContext = state . getEvaluationContext ( ) ; try { if ( ( ( ( ( cachedReadName ) != null ) && ( cachedReadName . equals ( name ) ) ) && ( ( cachedReadTargetType ) != null ) ) && ( cachedReadTargetType . equals ( targetObjectRuntimeClass ) ) ) { return cachedReadAccessor . read ( eContext , targetObject , name ) ; } List < PropertyAccessor > accessorsToTry = AstUtils . getPropertyAccessorsToTry ( targetObjectRuntimeClass , state ) ; if ( accessorsToTry != null ) { for ( PropertyAccessor accessor : accessorsToTry ) { if ( accessor . canRead ( eContext , targetObject , name ) ) { if ( accessor instanceof ReflectivePropertyAccessor ) { accessor = ( ( ReflectivePropertyAccessor ) ( accessor ) ) . createOptimalAccessor ( eContext , targetObject , name ) ; } this . cachedReadAccessor = accessor ; this . cachedReadName = name ; this . cachedReadTargetType = targetObjectRuntimeClass ; return accessor . read ( eContext , targetObject , name ) ; } } } } catch ( AccessException e ) { throw new SpelEvaluationException ( getStartPosition ( ) , e , SpelMessage . INDEXING_NOT_SUPPORTED_FOR_TYPE , targetObjectTypeDescriptor . toString ( ) ) ; } } throw new SpelEvaluationException ( getStartPosition ( ) , SpelMessage . INDEXING_NOT_SUPPORTED_FOR_TYPE , targetObjectTypeDescriptor . toString ( ) ) ; } @ Override public boolean isWritable ( ExpressionState expressionState ) throws SpelEvaluationException { } @ SuppressWarnings ( "unchecked" ) @ Override public void setValue ( ExpressionState state , Object newValue ) throws EvaluationException { } @ SuppressWarnings ( "unchecked" ) private boolean growCollection ( ExpressionState state , TypeDescriptor targetType , int index , Collection collection ) { } @ Override public String toStringAST ( ) { } private void setArrayElement ( ExpressionState state , Object ctx , int idx , Object newValue , Class clazz ) throws EvaluationException { } private Object accessArrayElement ( Object ctx , int idx ) throws SpelEvaluationException { } private void checkAccess ( int arrayLength , int index ) throws SpelEvaluationException { } }

Fix:
return new TypedValue ( value , targetObjectTypeDescriptor . getMapValueTypeDescriptor ( value ) ) ;