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 11994 - Misplaced import statements in generated Java classes
Summary: Misplaced import statements in generated Java classes
Status: CLOSED DUPLICATE of bug 5620
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: PC Windows 3.1/NT
: P2 blocker (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-05-07 16:43 UTC by brazil
Modified: 2007-11-05 13:44 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description brazil 2001-05-07 16:43:46 UTC
In very rary cases import statements in generated Java classes occur at the 
bottom of the Java file as the last statement. I only saw this effect once after   
generating Java for a dbschema. I was not able to determinstically reproduce 
this effect.
Comment 1 Svata Dedic 2001-05-09 11:50:43 UTC
Changed milestone to 3.2.1 - the behaviour needs to be yet investigated since 
we could not reproduce it at all. We suspect race conditions between parser 
and the code generation process or incorrect initialization of data in the 
code generator when inserting import statements/class elements.
Comment 2 Svata Dedic 2001-06-27 16:39:05 UTC
Closing as WORKSFORME until a reliable reproduction is found.
Comment 3 Svata Dedic 2001-06-27 16:39:19 UTC
Closing as WORKSFORME until a reliable reproduction is found.
Comment 4 Svata Dedic 2001-06-27 16:40:01 UTC
Mistake in resolution state
Comment 5 Svata Dedic 2001-06-27 17:24:07 UTC
NOW closing as worksforme :-)
Comment 6 Jan Lahoda 2001-09-04 09:34:22 UTC
I have seen something like this, only import statement is added on
very beginning of the file.
1. Slow down the parser to parse the source for example after 1 minute
(Project/Settings/Java sources/Automatic Parsing delay for 3.2
and Tools/Options/Java sources/Automatic Parsing delay for dev)
2. Go to source, write somewhere "StringTokenizer tokenizer;"
(providing that java.util.StringTokenizer is not imported in this
file)
3. Reformat code
4. Before automatic parsing can occur, go to "StringTokenizer" and
invoke FastImport (Shift-Alt-I) and accept import for
java.util.StringTokenizer
5. The import statement will be added to very beginning of file.

This is probably caused by incorrect positions after reformat code
(there are more bugs about this). In this case, I think that source
hiearchy should be invalided after code reformat, which probably will
force parsing before adding import statement (and everything will work
OK, I hope).

My build is 0108310100, my computer is Sun/Solaris.
Comment 7 Svata Dedic 2001-09-04 10:00:50 UTC
No, actually the parsed information cannot be purged from memory; the
current behaviour is, that as long as there's a live element from the
source, the whole parse information is accessible and nonblocking for
read operations.
I think it is particularly bad if the reformat code operation
obliterates valuable data held by other modules.

Comment 8 Jan Lahoda 2001-09-04 10:17:24 UTC
So, when I think about it, I agree with you. Editor is not doing much
good job in these cases. I will suppose that root of the problems from
original report is the same as in my case and will move this bug to
editor.
Comment 9 Jan Lahoda 2001-09-04 15:10:31 UTC

*** This issue has been marked as a duplicate of 5620 ***
Comment 10 Quality Engineering 2003-06-30 18:05:37 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.
Comment 11 Quality Engineering 2003-06-30 18:11:41 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.