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 169998 - Misleading, transient error annotations re: super calls
Summary: Misleading, transient error annotations re: super calls
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords:
: 164716 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-08-06 15:36 UTC by devon_c_miller
Modified: 2009-08-17 17:20 UTC (History)
1 user (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 devon_c_miller 2009-08-06 15:36:36 UTC
Given the code below, there is exactly one error: the method at line D has not been defined.

However, if you change the first constructor in a way that the parser is re-run,
the second constructor displays a second warning at line B or line C:

    "Call to super must be first statement in constructor"

How the file is changed seems to determine whether the error is reported at B or C.

If I delete the semicolon at line A, then add it back, line C is flagged.

If I put the cursor after A and type <CR>serr<TAB>, line B is flagged.

Making another change will cause the error to disappear. Even switching to anoter application and back will cause the
error to disappear.

import javax.swing.Icon;
import javax.swing.JButton;
public class A extends JButton {
    public A(Icon icon) {
        super(icon); // A
    }
    public A(String text) { // B
        super(text); // C
        someMethod(text); // D
    }
}
Comment 1 Max Sauer 2009-08-07 12:32:18 UTC
Reproducible. Thanks for your report.
Comment 2 Max Sauer 2009-08-10 10:14:34 UTC
Dusane, could you please have a look on this? Mentioned inappropriate 'Call to super must be first statement in constructor' is provided by 
CompilationInfo.getDiagnostics(), phase is 'resolved'. Thanks.
Comment 3 Dusan Balek 2009-08-11 09:02:06 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/b74592f0bce5

changeset 710fd67c9280 in main/nb-javac
details: http://hg.netbeans.org/main/nb-javac?cmd=changeset;node=710fd67c9280
Comment 4 Quality Engineering 2009-08-12 06:28:53 UTC
Integrated into 'main-golden', will be available in build *200908120201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b74592f0bce5
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #169998: Misleading, transient error annotations re: super calls - fixed.
Comment 5 Dusan Balek 2009-08-17 17:20:46 UTC
*** Issue 164716 has been marked as a duplicate of this issue. ***