Question: I'm trying to create jsp page which will create a svg graphic file. Based on various examples of jsp pages and svgs i come with this:

```
<?xml version="1.0" encoding="UTF-8"?> 

<%@ page language="java" contentType="image/svg+xml; charset=UTF-8;"    pageEncoding="UTF-8"%>

<%
response.addHeader(
        "Content-Disposition","attachment; filename=blob3" );
%>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="140" width="140" viewBox="0 0 14 14">
  <circle cx="7" cy="7" r="6" fill="blue" />
</svg>

```

but it is not working. it allows me to download blob3.svg file, but it is empty file.

Can anyone could give me hint, what i'm doing wrong?

Answer: 
These answers are all to the wrong question. The difference is subtle, but this is not the same issue as the one in the [linked ticket](https://issues.scala-lang.org/browse/SI-2991). That one does require unreasonable gymnastics to call the non-varargs method. For this one, the following is enough.

```
thenReturn[String]("something")

```

Or, if you didn't want to do that for some reason, you don't need the type alias and the cast. You can use a structural type ascription directly.

```
(this: { def thenReturn[T](s: T): OngoingStubbing[T] }).thenReturn("something")

```

The issue here is type inference at the intersection of overloading and polymorphism - one method is more specific, but scalac doesn't figure out which. The issue in SI-2991 is genuine ambiguity due to an interaction between overloading and tuple conversion - neither is more specific.
Assuming others will find this question when having the `overloaded method value thenReturn with alternatives` error, I want to share my solution as well.

Instead of

`when(field.getValue(isA(classOf[Record]))).thenReturn(value)`

I use

`doReturn(value).when(field).getValue(isA(classOf[Record]))`

which resolves the disambiguity in my case.