RFR 8172443: Change use of tree.pos to line:col in rawDiagnostics

Vicente Romero vicente.romero at oracle.com
Thu Oct 5 14:27:39 UTC 2017

On 10/05/2017 10:12 AM, Maurizio Cimadamore wrote:
> On 05/10/17 15:05, Vicente Romero wrote:
>> On 10/05/2017 09:51 AM, Maurizio Cimadamore wrote:
>>> On 05/10/17 14:49, Vicente Romero wrote:
>>>> Hi,
>>>> +100 to this effort, that will save us a lot of time. Regarding the 
>>>> patch, sometimes new lines need to be added to a test, sometimes in 
>>>> the jtreg header, sometimes somewhere else. How bad would be to use 
>>>> the column number only instead of line:col?
>>> I understand the concern. I think the goal of this patch is to fix 
>>> the #1 offender. As you say there could be other offenders. But 
>>> getting rid of them all is hard - if you just use 'col' you 
>>> basically lose uniqueness, which makes looking at the golden file 
>>> more obscure, I think.
>> well it's true that uniqueness could be a problem for errors reported 
>> at statements that spans more than one line, but I'm not sure if it 
>> is worthy to still keep a source of brittleness because of that. I 
>> mean what could be the probability of introducing a change that will 
>> swap two identical column positions in the diagnostics and still 
>> produce the same diagnostics such that we won't detect it. In the 
>> worst case we can add the line if we see that the particular 
>> statement we are generating the diagnostics for spans more than one 
>> line and use only the column for all other cases
> I suggest with stick with the proposed approach and then see how bad 
> it is in the real world?

I think that the proposed approach will be better than the current 
situation, that's for sure, but I think that this is the right moment to 
consider if the proposed approach can be still better. If you want to go 
for it with the current version, I'm OK with that but you know how long 
it takes for stuff like this to be revisited.

> Maurizio


>> Vicente
>>> Maurizio
>>>> Thanks,
>>>> Vicente
>>>> On 10/05/2017 09:29 AM, Maurizio Cimadamore wrote:
>>>>> Hi,
>>>>> this is a fix to our raw diagnostic machinery that will allow for 
>>>>> more robust compiler negative tests. Currently, when a functional 
>>>>> expression is found in a diagnostic, it can sometimes be 
>>>>> represented using the absoluted cursor position of the expression 
>>>>> in the source file. This makes the golden files for such tests 
>>>>> extremely unreliable, as simply adding/removing chars from lines 
>>>>> before the functional expression would result in golden file 
>>>>> mismatches. This is extremely annoying when e.g. the jtreg header 
>>>>> of a test must be change for some reason (e.g. to add an extra bug 
>>>>> id).
>>>>> The solution is to use a more robust encoding with line:col - so 
>>>>> that there's less dependencies on what happens on previous lines.
>>>>> http://cr.openjdk.java.net/~mcimadamore/8172443/
>>>>> Cheers
>>>>> Maurizio

More information about the compiler-dev mailing list