This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 99229 - Javadoc '@' tags incorrectly highlighted
Summary: Javadoc '@' tags incorrectly highlighted
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: issues@editor
: 99332 99765 99778 100222 100487 101029 (view as bug list)
Depends on: 93644
  Show dependency tree
Reported: 2007-03-28 12:05 UTC by Max Sauer
Modified: 2007-11-05 13:45 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

propoesed screenshot (18.81 KB, image/png)
2007-03-28 12:06 UTC, Max Sauer
Snapshots of the TokenHierarchy (22.35 KB, text/plain)
2007-04-03 01:35 UTC, Vitezslav Stejskal
Java source used for testing (208 bytes, text/plain)
2007-04-03 01:36 UTC, Vitezslav Stejskal
This occasionally happens when editing javadoc (2.91 KB, text/plain)
2007-04-03 06:05 UTC, Vitezslav Stejskal

Note You need to log in before you can comment on or make changes to this bug.
Description Max Sauer 2007-03-28 12:05:47 UTC
When typing javadoc commnents for a method, the '@' tags become sometimes
improperly highlighted, the number of characters emphasized by blue changes
along with the code I type in the line above the tag. See attached screenshot.
This issue is random, but happens to me often.

Typical steps to reproduce:
1) Have a java class, define a non-void method, w/o javadoc
2) Invoke Javadoc hint, to supply javadoc skeleton
=> javadoc with '@return' is created
3) On the line above '@return', type some text
4) '@return' becomes highlighted with grey color, along with the typed comment

NetBeans IDE Dev (Build 070328)
1.6.0_01; Java HotSpot(TM) Server VM 1.6.0_01-b04
Linux version 2.6.12-1.1390_FC4smp running on i386
en_US (nb); UTF-8
Comment 1 Max Sauer 2007-03-28 12:06:29 UTC
Created attachment 40081 [details]
propoesed screenshot
Comment 2 Vitezslav Stejskal 2007-03-28 23:46:53 UTC
Reproducible. I am not sure what is wrong, it's probably related to the latest
changes in lexer (incremental lexing of embedded tokens), but the problem clould
be in the coloring layer itself. I'll investigate it.
Comment 3 Vitezslav Stejskal 2007-04-03 01:20:47 UTC
I've done some investigation and it looks like the problem is either in the
lexer infrastructure or in JavadocLexer. Here is what I've done:

1. First, I changed the SyntaxHighlighting to *always* fire changes for the
whole document ignoring the text change ranges reported by lexer. This had no

2. Then I dumped the whole TokenSequence after each change, which revealed that
some of the javadoc tokens are not parsed correctly. It might be a problem in
the lexer infrastructure, because when the document is fully relexed it all
works fine. It's only when the incremental lexing is done for javadoc text that
some of the tokens are not lexed properly and (that's the most suspicios thing)
some of the characters are listed in more than just one token.

I'm attaching the TokenSequence dumps and the java source file I used for
testing. The dump file contains four snapshots of tokens in the hierarchy. The
first one was taken right after opening the file and then the three others after
typing ' dd' right at the beginning of the second javadoc comment in the java
source file (typed right after '/**').

Milo could you please try reproducing the problem and possibly explain what is
going on? Thanks a lot.
Comment 4 Vitezslav Stejskal 2007-04-03 01:35:16 UTC
Created attachment 40287 [details]
Snapshots of the TokenHierarchy
Comment 5 Vitezslav Stejskal 2007-04-03 01:36:40 UTC
Created attachment 40288 [details]
Java source used for testing
Comment 6 Vitezslav Stejskal 2007-04-03 01:59:24 UTC
The token sequence dumping can be turned on in trunk by:

Comment 7 Vitezslav Stejskal 2007-04-03 06:05:04 UTC
Created attachment 40291 [details]
This occasionally happens when editing javadoc
Comment 8 Vitezslav Stejskal 2007-04-03 09:52:35 UTC
*** Issue 99765 has been marked as a duplicate of this issue. ***
Comment 9 Jan Lahoda 2007-04-03 10:33:15 UTC
*** Issue 99778 has been marked as a duplicate of this issue. ***
Comment 10 Jiri Prox 2007-04-10 16:22:48 UTC
*** Issue 100487 has been marked as a duplicate of this issue. ***
Comment 11 Miloslav Metelka 2007-04-10 17:21:23 UTC
*** Issue 100487 has been marked as a duplicate of this issue. ***
Comment 12 Miloslav Metelka 2007-04-10 17:39:38 UTC
The problem should now be fixed. I wasn't able to reproduce a problematic
javadoc case but if you still find any incorrect embedded highlighting please
reopen the issue.

Checking in token/;
/cvs/lexer/src/org/netbeans/lib/lexer/token/,v  <--
new revision: 1.7; previous revision: 1.6
Checking in;
/cvs/lexer/src/org/netbeans/lib/lexer/,v  <--
new revision: 1.11; previous revision: 1.10
Checking in;
/cvs/lexer/src/org/netbeans/lib/lexer/,v  <--
new revision: 1.11; previous revision: 1.10
Checking in;
/cvs/lexer/src/org/netbeans/lib/lexer/,v  <--
new revision: 1.7; previous revision: 1.6
Checking in inc/;
/cvs/lexer/src/org/netbeans/lib/lexer/inc/,v  <--
new revision: 1.8; previous revision: 1.7
Comment 13 Miloslav Metelka 2007-04-10 17:48:23 UTC
*** Issue 99332 has been marked as a duplicate of this issue. ***
Comment 14 Vitezslav Stejskal 2007-04-11 01:26:38 UTC
I checked the javadoc and it's looking good now. Thanks Mila.
Comment 15 Marek Fukala 2007-04-11 08:56:45 UTC
*** Issue 100222 has been marked as a duplicate of this issue. ***
Comment 16 Max Sauer 2007-04-12 09:08:27 UTC
I'm not able to reproduce anymore. Marking as VERIFIED.
NetBeans IDE Dev (Build 200704111800)
1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105
SunOS version 5.10 running on sparc
en (nb); ISO646-US
Comment 17 Jan Lahoda 2007-04-17 16:29:12 UTC
*** Issue 101029 has been marked as a duplicate of this issue. ***