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 187452 - Incorrect running of Java code
Summary: Incorrect running of Java code
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 6.x
Hardware: PC Windows 7 x64
: P2 normal with 1 vote (vote)
Assignee: Jan Lahoda
URL: http://forums.netbeans.org/topic28295...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-10 20:01 UTC by 00jt
Modified: 2010-10-14 08:22 UTC (History)
0 users

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 00jt 2010-06-10 20:01:35 UTC
When i have a class "x" in some method, and another inner class (outside of the method) with the same name. Then any other class "Y" that extends "x" inside the same method as "x" will incorrectly use the other class (outside of the method).

See link to forum. 
http://forums.netbeans.org/topic28295.html
Comment 1 Jan Lahoda 2010-06-13 18:36:26 UTC
Seems like a bug in JDK1.7 javac, which got pulled to NB. I tried to find out the cause, but did not succeed so far. Seems that the buggy changed occurred before the code was converted to mercurial.

There is a quite simple workaround: go to Project Properties/Compile tab (for J2SE Project) and disable Compile on Save. After that the javac from your JDK will be used to compile the project and as long as that javac does not have this bug, the problem should go away.
Comment 2 00jt 2010-07-06 16:04:59 UTC
(In reply to comment #1)
> Seems like a bug in JDK1.7 javac, which got pulled to NB. I tried to find out
> the cause, but did not succeed so far. Seems that the buggy changed occurred
> before the code was converted to mercurial.
> 
> There is a quite simple workaround: go to Project Properties/Compile tab (for
> J2SE Project) and disable Compile on Save. After that the javac from your JDK
> will be used to compile the project and as long as that javac does not have
> this bug, the problem should go away.

So, is this bug going to be fixed for JDK1.7?  Have you had any luck finding the cause?
Comment 3 Jan Lahoda 2010-07-13 14:48:33 UTC
I took a deeper look. I am almost sure that this was caused by a fix for bug 5060485:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5060485

I will contact the javac maintainers to see what they think.
Comment 4 00jt 2010-07-13 18:11:57 UTC
(In reply to comment #3)

Sounds good, I have recently downloaded JDK1.7 (build 99) and the bug didn't occur. Perhaps Netbeans has an earlier build of JDK1.7?
Comment 5 Jan Lahoda 2010-08-26 11:27:35 UTC
I do not think this was fixed in JDK7 build 99 - but should be fixed by:
http://hg.openjdk.java.net/jdk7/tl/langtools/rev/a75770c0d7f6

I suppose we will take a javac with this fix for 6.10.
Comment 6 Jan Lahoda 2010-10-14 08:22:57 UTC
The JDK7 support has been merged into NB trunk:
http://hg.netbeans.org/jet-main/rev/c8b57ee089c0

It includes javac with the fix.