Bug in multi-line string declaration

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Feb 18 22:42:03 UTC 2015


On 18/02/15 21:03, Jonathan Gibbons wrote:
> There's two parts to this.    There's whatever is going on in kulla, 
> but the reference to the unary operator '+++' is a javac quirk that 
> (coincidentally) was should have been fixed by Maurizio's work on his 
> refactoring of the operator code in javac.
Yeah - that's fixed as part of the latest operator work; unary '+' was 
turned into '+++' back in the early JDK 8 days because javac was 
resolving operators using overload resolution and there were like 12 
different versions of '+' most of which didn't apply if you were really 
after an unary operator. Since in vanilla javac this kind of error is 
never possible (i.e. the parser will reject such code), using '+++' was 
an hacky way to squeeze more performances out of javac (avoiding all the 
useless overloads).

Now that a more general solution is in place, the hack is no longer 
needed - but as Jon says, the problem here as probably very little to do 
with '+' vs. '+++' and more with parser possibly not constructing the 
right AST.

Maurizio
>
> -- Jon
>
> On 02/18/2015 08:46 AM, andrei.eremeev wrote:
>> Hi REPL team,
>>
>> Multi-line string declaration fails with error : bad operand type 
>> java.lang.String for unary operator '+++'.
>>
>> -> String s = "aaa" +
>> >> "aaa";
>> |  Error:
>> |  bad operand type java.lang.String for unary operator '+++'
>> |  String s = "aaa" +
>> |  "aaa";
>> |                   ^
>>
>> Andrei Eremeev
>



More information about the kulla-dev mailing list