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 139147 - JavadocEnv.getRawCommentFor is out of sync sometimes
Summary: JavadocEnv.getRawCommentFor is out of sync sometimes
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Parsing & Indexing (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Tomas Zezula
URL: http://statistics.netbeans.org/except...
Keywords:
: 134122 138897 139232 139607 158726 161134 161272 (view as bug list)
Depends on: 159352 159389 178095 178096
Blocks:
  Show dependency tree
 
Reported: 2008-07-07 15:56 UTC by Jan Pokorsky
Modified: 2010-02-16 21:53 UTC (History)
20 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 47124


Attachments
stacktrace (5.91 KB, text/plain)
2008-07-08 15:26 UTC, Jiri Prox
Details
stacktrace (5.91 KB, text/plain)
2008-07-09 12:24 UTC, pribyl
Details
messages.log file (91.23 KB, text/plain)
2008-11-21 11:02 UTC, matusdekanek
Details
Dump file 1/15 (5.62 KB, text/plain)
2009-04-24 05:42 UTC, theshadow27
Details
Dump file 15/15 (5.64 KB, text/plain)
2009-04-24 05:45 UTC, theshadow27
Details
build 200910160201 messages.log (344.00 KB, text/plain)
2009-10-18 18:34 UTC, _ gtzabari
Details
build 200910160201 dump file (49.40 KB, text/plain)
2009-10-18 18:35 UTC, _ gtzabari
Details
dump file (2.89 KB, text/plain)
2010-01-14 03:47 UTC, Peter Pis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Pokorsky 2008-07-07 15:56:06 UTC
Under some circumstances com.sun.javadoc.Doc differs from document snapshot of javac. It appears to be caused by
JavadocEnv.getRawCommentFor that computes javadoc content inside new JavaSource.runUserActionTask. This task may use
javac with another document snapshot.

My usecase is code running as a java source factory and calling e.g. Doc.getRawCommentText(). User modifies document
before JavadocEnv.getRawCommentFor is invoked and as a consequence I get new javadoc. It seems that js factories do not
share the same javac with JavaSource.runUserActionTask as in case of recursively invoked JavaSource.runUserActionTask.
Comment 1 Jan Pokorsky 2008-07-08 14:16:44 UTC
*** Issue 139232 has been marked as a duplicate of this issue. ***
Comment 2 Jan Pokorsky 2008-07-08 14:18:49 UTC
*** Issue 139232 has been marked as a duplicate of this issue. ***
Comment 3 Jan Pokorsky 2008-07-08 14:20:43 UTC
*** Issue 134122 has been marked as a duplicate of this issue. ***
Comment 4 Jan Pokorsky 2008-07-08 14:21:42 UTC
*** Issue 138897 has been marked as a duplicate of this issue. ***
Comment 5 Jiri Prox 2008-07-08 15:25:45 UTC
Build: NetBeans IDE Dev (Build 20080708124741)
VM: Java HotSpot(TM) Client VM, 11.0-b13, Java(TM) SE Runtime Environment, 1.6.0_10-rc-b26
OS: Linux, 2.6.22-15-generic, i386

User Comments: 
ISE when staritng to write annotation for whole class.


package javaa2;

/**
 *
 * 
 * @author jp159440
 */
@
public class NewClass {

}
Comment 6 Jiri Prox 2008-07-08 15:26:00 UTC
Created attachment 64095 [details]
stacktrace
Comment 7 Dusan Balek 2008-07-09 10:20:17 UTC
java.source part fixed.

changeset 2a47df2f7f6c in main/nb-javac
details: http://hg.netbeans.org/main/nb-javac?cmd=changeset;node=2a47df2f7f6c
changeset a5f6f5fd0090 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=a5f6f5fd0090
Comment 8 pribyl 2008-07-09 12:24:38 UTC
Build: NetBeans IDE Dev (Build 200807080009)
VM: Java HotSpot(TM) Client VM, 11.0-b13, Java(TM) SE Runtime Environment, 1.6.0_10-rc-b26
OS: Linux, 2.6.24-19-generic, i386

User Comments: 
I created new (Persistence) entity class from database.
When I opened the .java file, created from the db table (books.java), this Exception was thrown.

(It happens regullary, even with NB restarted and clean userdir)

TestSpec I followed:  http://wiki.netbeans.org/TS_61_FormSimpleJTableDataBinding#section-TS_61_FormSimpleJTableDataBinding-TestSuiteJTableBindingUsingWizards  
Comment 9 pribyl 2008-07-09 12:24:48 UTC
Created attachment 64163 [details]
stacktrace
Comment 10 Jan Pokorsky 2008-07-09 12:33:49 UTC
I have fixed the javadoc part as http://hg.netbeans.org/main/rev/a30cfd14baa6.
Comment 11 Quality Engineering 2008-07-09 15:41:55 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #309 build
Changeset: http://hg.netbeans.org/main/rev/a5f6f5fd0090
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #139147: JavadocEnv.getRawCommentFor is out of sync sometimes - partial fix.
Comment 12 Jan Pokorsky 2008-07-11 13:38:35 UTC
*** Issue 139607 has been marked as a duplicate of this issue. ***
Comment 13 jddestouches 2008-10-05 14:44:23 UTC
Reopening - reproduced in NetBeans IDE 6.5 Beta (Build 200808111757)
Comment 14 Jan Pokorsky 2008-10-06 10:32:05 UTC
jddestouches: I cannot reproduce on test cases mentioned above. Please provide more details what you did reproduce.
Comment 15 matusdekanek 2008-11-21 11:01:12 UTC
confirming problem: still exists in NB 6.5:

Product Version: NetBeans IDE Dev (Build 200811181401)
Java: 1.6.0_10; Java HotSpot(TM) Client VM 11.0-b15
System: Linux version 2.6.24-21-generic running on i386; UTF-8; en_US (nb)

I edited svn versioned file with more syntax/semantic errors. 
I will submit messages.log file
Comment 16 matusdekanek 2008-11-21 11:02:32 UTC
Created attachment 74000 [details]
messages.log file
Comment 17 Exceptions Reporter 2009-01-21 02:04:04 UTC
Reopening - reproduced in NetBeans IDE 6.5 (Build 200811100001)
http://statistics.netbeans.org/exceptions/detail.do?id=47124
Comment 18 Jan Pokorsky 2009-02-04 16:39:03 UTC
I would say last duplicates are slightly different issue. It does not relate to lazy loading of javadoc of elements
comming from other files but the result is same. It is that Doc instance and javadoc token sequence are out of sync. I
guess it is caused by syntactically corrupted source but I cannot find the case to reproduce the issue.

Thus I have added more debugging info and I would like to ask everyone who will encounter the issue again to attach
var/log/*.jddump files here or to send them by email to me if possible. What file to send is mentioned in details of the
exception notification and in your var/log/messages.log.

http://hg.netbeans.org/main/rev/04fdafb04e06
Comment 19 Quality Engineering 2009-02-06 07:50:30 UTC
Integrated into 'main-golden', will be available in build *200902060201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/04fdafb04e06
User: Jan Pokorsky <jpokorsky@netbeans.org>
Log: #139147: added debugging info to identify cases when Doc and javadoc token sequence are out of sync
Comment 20 Torbjorn Norbye 2009-02-27 18:44:09 UTC
I'm getting this. I can send you my dump file (offline).

It seems to happen when I just edited in an EMPTY javadoc - e.g. I typed  /** <caret> */ (or I may have deleted
something to get to this state). 
Comment 21 Torbjorn Norbye 2009-02-27 18:46:04 UTC
Yep, I just reproduced it.

I had this:

/** Foo */

I backspaced over Foo to get to

/** ^ */

and it threw warnings.
Comment 22 Torbjorn Norbye 2009-02-27 18:46:24 UTC
By the way I'm seeing this with a 7.0 daily build fresh as of a day or two ago.
Comment 23 Tomas Zezula 2009-02-27 18:53:47 UTC
In 7.0 it can be caused by out dated snapshot.
Comment 24 Jan Pokorsky 2009-02-27 19:44:33 UTC
tor: your dump file is not necessary. Your test case is reproducible. Unfortunately it is a false alarm. I did not
realize that token sequence with white spaces results to trimmed string. I will tweak the check. Anyway thank you for
the report.
Comment 25 Jan Pokorsky 2009-03-02 13:34:37 UTC
tor: fixed as issue #159389
Comment 26 Jan Pokorsky 2009-03-30 16:30:59 UTC
*** Issue 161272 has been marked as a duplicate of this issue. ***
Comment 27 Marian Mirilovic 2009-03-30 21:31:00 UTC
Honza, 
there is couple additional comments in exceptions database ... see
http://statistics.netbeans.org/exceptions/detail.do?id=47124
Comment 28 Jan Pokorsky 2009-03-31 10:52:08 UTC
Yes, there is but I need a log from build 200903060201 or newer. There should be available dump files with details what
is wrong.
Comment 29 Jiri Prox 2009-04-07 15:30:37 UTC
The requested info was not provided and there is no new occurrence of this issue in build after nov 2008, so I guess it
is fixed now
Comment 30 Jan Pokorsky 2009-04-08 15:23:25 UTC
*** Issue 161134 has been marked as a duplicate of this issue. ***
Comment 31 Jan Pokorsky 2009-04-08 15:28:33 UTC
Reopening. We have a reproducible test case now
Comment 32 Jan Pokorsky 2009-04-08 15:39:42 UTC
Dusane, it looks that JavadocEnter creates wrong ClassDocImpl instance. The debugger shows that it passes docCommnet
text as null for TestClass in JavadocEnter.visitClassDef(). Use following class to reproduce it:

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author a
 */
@Deprecated
public class TestClass {

}

The file content snapshot and TokenHierarchy seem to be OK. See
http://www.netbeans.org/nonav/issues/showattachment.cgi/78840/TestClass_4.jddump
Comment 33 Dusan Balek 2009-04-09 09:00:26 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/91a2c2a3a2f9
changeset 0407d629b1af in main/nb-javac
details: http://hg.netbeans.org/main/nb-javac?cmd=changeset;node=0407d629b1af
Comment 34 Quality Engineering 2009-04-10 07:35:53 UTC
Integrated into 'main-golden', will be available in build *200904100201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/91a2c2a3a2f9
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #139147: JavadocEnv.getRawCommentFor is out of sync sometimes - fixed.
Comment 35 Jindrich Sedek 2009-04-15 13:18:45 UTC
I'm still able to reproduce this issue in latest build
NetBeans IDE Dev (Build 200904141401)
use this code in Java file - :
--------------------
/**
* and open the template in the editor.
*/

package javaapplication1;
/**
*
* @author jindra
*/
public class Main {
}
--------------------------
Comment 36 Dusan Balek 2009-04-15 15:09:22 UTC
Second attempt pushed to jet-main.

changeset 9be8ec15ad39 in main/nb-javac
details: http://hg.netbeans.org/main/nb-javac?cmd=changeset;node=9be8ec15ad39
Comment 37 theshadow27 2009-04-24 05:39:51 UTC
Got again in 2009 04 22 0201

To reproduce:
1) Have a method which is fairly simple 
2) Go to where the editor would insert javadoc if /** [enter] were typed
3) Type /** (space) (space) **/ [enter]
illegal state exception 



In context:

        /** **/ 
        public long till(){
            return Math.max(when - System.currentTimeMillis(), 0);
        }
Comment 38 theshadow27 2009-04-24 05:42:08 UTC
Created attachment 80813 [details]
Dump file 1/15
Comment 39 theshadow27 2009-04-24 05:44:17 UTC
Changed to P1 as this does not go away, keeps throwing and throwing. Produced 16 dump files, will upload a few...
Comment 40 theshadow27 2009-04-24 05:45:45 UTC
Created attachment 80815 [details]
Dump file 15/15
Comment 41 Dusan Balek 2009-04-24 08:50:23 UTC
Honzo, empty javadoc is returned correctly in this case (additional stars are skipped).
Comment 42 Jan Pokorsky 2009-04-24 10:03:14 UTC
I will have a look at it.
Comment 43 Jan Pokorsky 2009-04-24 11:19:28 UTC
fixed http://hg.netbeans.org/jet-main/rev/cd41abea3de9

As a workaround do not use multiple trailing asterisks in javadocs. /**  */ works properly.
Comment 44 Quality Engineering 2009-04-25 07:25:49 UTC
Integrated into 'main-golden', will be available in build *200904250201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/cd41abea3de9
User: Jan Pokorsky <jpokorsky@netbeans.org>
Log: #139147: javadoc parser considers white spaces + trailing asterisks as empty javadoc /** **/
Comment 45 _ gtzabari 2009-07-20 21:26:14 UTC
I just ran across this bug in Netbeans 6.7 final. Please see
http://statistics.netbeans.org/analytics/exception.do?id=230573 for more information. Please note I do not recall what I
did to trigger this issue.
Comment 46 David Strupl 2009-07-21 14:22:03 UTC
None of the reports are coming from the post 6.7 builds --> making it P2 instead of P1 and waiting for furhter reports.
Comment 47 Jan Jancura 2009-08-18 14:19:17 UTC
not reproducible in current trunk, looks like its fixed.
Comment 48 _ gtzabari 2009-10-18 18:33:43 UTC
Reproduced in dev build 200910160201
Comment 49 _ gtzabari 2009-10-18 18:34:43 UTC
Created attachment 89662 [details]
build 200910160201 messages.log
Comment 50 _ gtzabari 2009-10-18 18:35:32 UTC
Created attachment 89663 [details]
build 200910160201 dump file
Comment 51 _ gtzabari 2009-10-18 18:40:14 UTC
The following code triggered this issue:

	/**
	 * Reloads the device state.
	 * 
	 * @param <A> the attachment type
	 * @param completionHandler invoked when the operation completes
	 * @param attachment user-object passed to the completion handler
	 */
	public void final CompletionHandler<Void, A> completionHandler, final A attachment)

Granted, the method signature is invalid but it should not cause Netbeans to fail.
Comment 52 Vitezslav Stejskal 2009-10-19 10:25:41 UTC
Honzo, Dusane, could you guys please have a look? Thanks
Comment 53 Jan Pokorsky 2009-10-19 11:08:32 UTC
gtzabari: Thanks a lot for the reproducible test case. We will investigate what's wrong.
Comment 54 Jiri Prox 2009-10-19 11:52:43 UTC
reproducible
Comment 55 Jan Pokorsky 2009-11-10 08:55:05 UTC
gtzabari's test case has been fixed as issue #174864.

There are further reports from tmhealy, bburette and others but without requested .jddump files it is impossible to fix them. Closing as INCOMPLETE for now.
Comment 56 Dusan Balek 2009-12-07 05:18:46 UTC
*** Bug 158726 has been marked as a duplicate of this bug. ***
Comment 57 Peter Pis 2010-01-14 03:44:19 UTC
type before the invalid code fragment:

/** [enter]
public void final CompletionHandler<Void, A> completionHandler, final A
attachment)

java.lang.IllegalStateException: Please attach dump file file:/Users/noel/.netbeans/dev/var/log/T_5.jddump to bug.
	at org.netbeans.modules.java.editor.javadoc.JavadocCompletionUtils.dumpOutOfSyncError(JavadocCompletionUtils.java:511)
	at org.netbeans.modules.java.editor.javadoc.JavadocCompletionUtils.findJavadoc(JavadocCompletionUtils.java:192)
	at org.netbeans.modules.java.editor.javadoc.JavadocImports.findReferencedElement(JavadocImports.java:287)
	at org.netbeans.modules.java.editor.semantic.MarkOccurrencesHighlighter.processImpl(MarkOccurrencesHighlighter.java:372)
	at org.netbeans.modules.java.editor.semantic.MarkOccurrencesHighlighter.run(MarkOccurrencesHighlighter.java:153)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:654)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
	at java.util.concurrent.FutureTask.run(FutureTask.java:123)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
Comment 58 Peter Pis 2010-01-14 03:47:24 UTC
Created attachment 93278 [details]
dump file
Comment 59 Vitezslav Stejskal 2010-02-15 10:34:42 UTC
(In reply to comment #58)
> Created an attachment (id=93278) [details]
> dump file

It looks like when a method declaration contains an error the tree does not contain method's javadoc. This causes the tree-vs-tokensequence consistency check to generate a false alarm. It is consistently reproducible with the java class from the above attachment in recent 6.9dev builds.

I'm trading this issue with tzezula for issue #180581.
Comment 60 Tomas Zezula 2010-02-16 03:01:45 UTC
Next case fixed.
fixed in jet-main: 0c62c91780b1
Comment 61 Quality Engineering 2010-02-16 21:53:38 UTC
Integrated into 'main-golden', will be available in build *201002170200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/0c62c91780b1
User: Tomas Zezula <tzezula@netbeans.org>
Log: #139147:JavadocEnv.getRawCommentFor is out of sync sometimes