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 253009 - Erroneous Error flags
Summary: Erroneous Error flags
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Other
: P2 normal with 2 votes (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-15 16:07 UTC by bolsover
Modified: 2015-09-01 10:45 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Illustration of error flags. (83.76 KB, image/jpeg)
2015-06-15 16:07 UTC, bolsover
Details
test project and library files (2.48 MB, application/octet-stream)
2015-06-15 16:11 UTC, bolsover
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bolsover 2015-06-15 16:07:37 UTC
Created attachment 154234 [details]
Illustration of error flags.

Just recently however, came across a problem with some of my classes showing many error flags on previously error free code:
Attempts to compile would fail with may warnings ‘cannot find symbol fireButtonEvent(int, String)…

 

I quickly realised that the problem had arisen because I had included source stub files (declarations and method signatures without proprietary implementation code) in the Nebeans library along with the usual class file .jar and Javadoc references.

What is curious is that if I remove the source stub files from the library, the error flags remain but the code will compile. 
If I close the IDE after removing the source stub files from the library definition, clear the cache and restart, the error flags disappear.

On further investigation I found that all the error flags were due to a single source stub file..

In the screen-shot above, all the nnnWizardPages are all extended from a superclass AbstractWizardPage. When I look at AbstractWizardPage (with the src-stubs installed),  I see the following, unremarkable  code:

[code]
package com.jidesoft.wizard;

public abstract class AbstractWizardPage extends AbstractDialogPage {

     public static final int LEFTPANE_NONE = 0;

… remainder of class definition
[/code]

Now the fireButtonEvent(int, String) method is declared in the class AbstractDialogPage and the Netbeans error is ‘cannot find symbol fireButtonEvent(int, String)…’ .
In the code above, there is NO import for the class AbstractDialogPage. 

If I navigate to the source code for AbstractDialogPage  having first removed the offending src-stub files, I see the following code:

[code]
package com.jidesoft.wizard;

import com.jidesoft.dialog.AbstractDialogPage;
import com.jidesoft.dialog.PageListener;
import java.awt.Image;
import java.util.List;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.border.Border;

public abstract class AbstractWizardPage extends AbstractDialogPage {

    public static final int LEFTPANE_NONE = 0;
… remainder of class definition
[/code]
    
So, now I have a much more complete view of the source code from the Netbeans decompiler and importantly, there is an import for AbstractDialogPage and I have no errors.

I raised the issue with Jidesoft.. Their response was: “ If an IDE depends on the import statements in the source code to implement the error highlighting, something is wrong about the IDE. I didn't check eclipse but IDEA has no problem with the stub source without imports.”

Now I’m not really qualified to judge the situation but my observation and question is simple:

It seems that when available, Netbeans uses the source code in preference to the compiled .class to implement error highlighting in this case.
Comment 1 bolsover 2015-06-15 16:11:26 UTC
Created attachment 154235 [details]
test project and library files

1 Extract ErrorFlags.zip to a convenient location; the .zip contains two folders: ErrorFlagTests and errorlibs. 
2 Open the Netbeans project ErrrorFlagTests (folder ErrorFlagTests)
3 Define a new Ant Library ‘errorlib’ and add jide-common.jar and jide-dialogs.jar (from errorlibs folder) to the library Classpath. Add src-oss.zip ONLY to the library sources.
4 Make sure the Library ‘errorlib’ is referenced by the Netbeans project ErrorFlagTests.
5 In Netbeans, navigate to and open the file com.bolsover.errortest.MyErrorpage.java
6 Compile the project. The build should proceed normally with no warnings.
7 Edit the library ‘errorlib’, adding src-dialogs-stub.zip to the library sources.
8 Compile the project.  The build should proceed normally but this time you should see an error flag against line 29 of com.bolsover.errortest.MyErrorpage.java
Comment 2 bolsover 2015-06-15 16:15:47 UTC
Error can be reproduced and has been validated on following system

Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b14
System: Windows 8 version 6.2 running on amd64; Cp1252; en_GB (nb)

Mark Wilmoth, NetCat contributor has also confirmed as follows:

"Reproducible in:


Product Version: NetBeans IDE 8.0.2 (Build 201411181905) 
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02 
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b15 
System: Windows 7 version 6.1 running on amd64; UTF8; en_US (nb)       


Product Version: NetBeans IDE Dev (Build 201506130001) 
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02 
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b15 
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb) 

I have to remove src-dialogs-stub.zip and delete the cache to get the error to go away. 


Mark"
Comment 3 Jiri Prox 2015-06-16 14:58:59 UTC
reproducible

It seems that is is caused by the invalid code src-dialogs-stub.zip.
I've tried to add missing imports to class AbstractWizardPage and the error does away
Comment 4 bolsover 2015-06-16 15:11:37 UTC
I found that also.

I'm inclined to agree with the assertion from Jidesoft:

“ If an IDE depends on the import statements in the source code to implement the error highlighting, something is wrong about the IDE. I didn't check eclipse but IDEA has no problem with the stub source without imports.”
Comment 5 Dusan Balek 2015-08-31 11:26:11 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/2b7e4f576a4d
Comment 6 Quality Engineering 2015-09-01 01:25:17 UTC
Integrated into 'main-silver', will be available in build *201509010002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2b7e4f576a4d
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #253009 - Erroneous Error flags - fixed.
Comment 7 bolsover 2015-09-01 10:45:37 UTC
Confirmed..

Problem appears to the resolved in Product Version: NetBeans IDE Dev (Build 201509010002)

Keep up the good work.

David