[ 
https://issues.apache.org/jira/browse/JENA-1389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16153371#comment-16153371
 ] 

Andy Seaborne commented on JENA-1389:
-------------------------------------

[~kinow]

Clearer, but still a bit muddy :-) 

"a matching signature and return type is declared in a superclass." 
Signature the same (signature does not include the result type).
Matching return type includes erasure.

The byte codes {{invoke*}} put a result on the stack regardless so does that 
mean void is compatible with every type?  There is no assignment to use the 
result and the stack must be pop'ed because there is always a return, even for 
void. 

Long dicusssion:
https://stackoverflow.com/questions/3589946/retrofitting-void-methods-to-return-its-argument-to-facilitate-fluency-breaking

To try and pin this down,
http://docs.oracle.com/javase/specs/jls/se8/html/jls-13.html#jls-13.1
{quote}
A reference to a method must be resolved at compile time to a symbolic 
reference to the erasure (§4.6) of the qualifying type of the invocation, plus 
the erasure of the signature (§8.4.2) of the method. The signature of a method 
must include all of the following as determined by §15.12.3:

* The simple name of the method
* The number of parameters to the method
* A symbolic reference to the type of each parameter

A reference to a method must also include either a symbolic reference to the 
erasure of the return type of the denoted method or an indication that the 
denoted method is declared void and does not return a value.
{quote}

The method reference changes.

This is binary incompatible.


> Return `this` rather than `void` from Dataset
> ---------------------------------------------
>
>                 Key: JENA-1389
>                 URL: https://issues.apache.org/jira/browse/JENA-1389
>             Project: Apache Jena
>          Issue Type: Improvement
>          Components: ARQ
>    Affects Versions: Jena 3.4.0
>            Reporter: Adam Jacobs
>            Priority: Trivial
>              Labels: easytask
>
> Allow method chaining from the org.apache.jena.query.Dataset interface by 
> returning `this` rather than `void` from the following methods.
> # setDefaultModel
> # addNamedModel
> # removeNamedModel
> # replaceNamedModel
> Allowing method chaining would align with the behavior of the add and remove 
> methods in org.apache.jena.rdf.model.Model.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to