bug#60765: CC Mode 5.35.2 (Java//l); Java incorrect type recognition

Po Lu via CC-Mode-help <[email protected]> Tue, 17 Jan 2023 13:14:51 +0800
Newsgroups gmane.emacs.cc-mode.general
Message-ID <[email protected]>
Alan Mackenzie <[email protected]> writes:

>> Insert the following text into a Java mode buffer:
>
>> class Foo
>> {
>>   public void
>>   viewLayout (int left, int top, int right, int bottom)
>>   {
>>     int rectWidth, rectHeight;
>
>>     synchronized (this)
>>       {
>> 	rect.left = left;
>> 	rect.top = top;
>> 	rect.right = right;
>> 	rect.bottom = bottom;
>>       }
>
>
>>     EmacsNative.sendConfigureNotify (this.handle,
>> 				     System.currentTimeMillis (),
>> 				     left, top, rectWidth,
>> 				     rectHeight);
>>   }
>> }
>
>> go to the line immediately above EmacsNative.sendConfigureNotify.  Then,
>> type:
>
>>   TAB r e c t W i d t h;
>
>> `rectHeight' and `viewLayout' will appear in c-found-types.  Thanks.
>
> Yes.  With the "unsafe-maybe" mechanism added to CC Mode late last year,
> this was a fairly simple bug to fix.  I've taken the liberty of
> committing the fix to the emacs-29 branch with:
>
> commit c1d32d9a20dc94d403725c288d168451b916c034 (HEAD -> emacs-29, origin/emacs-29, origin/HEAD)
> Author: Alan Mackenzie <[email protected]>
> Date:   Mon Jan 16 17:44:44 2023 +0000
>
>     CC Mode: Prevent ids in temporary "declarators" getting into c-found-types
>
> , though I haven't yet closed the bug.  I'd be grateful if you could
> update your emacs-29 branch with this fix, run your real Java code in
> it, and confirm that the bug is indeed fixed.  Thanks!
>

Thanks, this seems to work here.