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 160383 - Bogus "Incorrect Package" message
Summary: Bogus "Incorrect Package" message
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: Macintosh Mac OS X
: P4 blocker (vote)
Assignee: Max Sauer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-16 16:42 UTC by hcayless
Modified: 2017-05-07 22:52 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 hcayless 2009-03-16 16:42:23 UTC
I'm using Netbeans 6.5 to edit a maven project.  The last package in the "Source Packages" folder is named
"info.papyri.util".  Any class I open in this package starts with the line:

package info.papyri.info

but the package name gets a red underline and a marginal icon indicating an error.  The mouseover message is "Incorrect
Package".  The project builds just fine under maven, and there is no indication of errors in the Projects window.  The
marginal icon gives me two refactoring options: "Move class to correct folder" or "Remove package declaration".  If I
choose the former, the file is moved to a new package: "info.papyri.util.info.papyri.util", which obviously breaks
everything.

The project is under version control (svn).

I've tried reinstalling netbeans, clearing all of my local netbeans config (deleting ~/.netbeans), and renaming the
package (which seems to work, but is undesirable).

Netbeans seems to have decided that the info.papyri.util is the default package.  If I use the refactoring tool to try
to move it back, it moves the class there instead of into info.papyri.util.
Comment 1 Jiri Prox 2009-03-16 16:58:08 UTC
The red underline is caused by hint which is setup to be displayed like error, you can customize it in options dialog. 
The wrong correction of package statement is a real problem -> reassigning to java/hint
Comment 2 hcayless 2009-03-16 17:39:35 UTC
Update: I think this is being triggered by the maven plugin (or some interaction with it).  There was an xml file in
that package, and when I moved it to main/resources, the incorrect package message was resolved.
Comment 3 Max Sauer 2009-04-22 12:46:44 UTC
Could you please provide the project with incorrect structure or at least describe what xml file caused the error and what was its location inside of the 
project? To me it seems as bad project structure combined with classes residing in a bad folder => P4. Thanks.
Comment 4 Peter Pis 2009-09-03 07:54:07 UTC
Without requested information for long time - INVALID. We can't do anything in this case. Reporter, please add requested
information and reopen issue. Thanks in advance.
Comment 5 netbiolab12 2015-04-27 14:24:04 UTC
Noticed same behaviour, to reproduce download Vuze source code from sourceforge link http://sourceforge.net/projects/azureus/files/vuze/Vuze_5600/Vuze_5600_source.zip/download then try to import project as "New project from existing sources".
Then add the com/ and org/ folders as src folders by dragging and dropping them inside the window (if you select them with import button a warning that you cannot have the same src folder as the project folder is shown).

From now on it will show bogus package errors.
Notice the structure of the project is ok, it is an eclipse project folder but should be fine for Netbeans.

To solve I trashed the Vuze folder and re unzipped to a fresh new directory then created a bogus src folder inside itand moved the org/ and com/ folders inside it and Netbeans works correctly with no bogus warnings.
Comment 6 Martin Balin 2016-07-07 07:16:27 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 7 ljb 2017-05-07 22:52:16 UTC
I'm just getting started with 8.2, and I am seeing this 'incorrect package' error.

I have downloaded Java source code from Interactive Brokers for their demo app to use their API to get data from their server farm. (No account is needed to get the source code and run it, but you can't connect to the servers without an account.)

The app seems to work fine. I've been exploring and modifying the code for a week or two, hoping to be able to "fix" it. (It is pretty lame as is, but then what do you expect from a demo?)

Any way, as I was exploring the use of the debugger to help understand the source code I noticed that sometimes when I tried to jump to the source code for a component in the GUI I would get an error message saying the source code could not be found.

I knew this had to be a bug of some sort since the debugger could run the app just as easily as the main part of NB. And besides, the source file in question was on the tab next to the 'Snapshot of ""' tab.

I searched this and other forums looking for "file not found" sort of errors in the debugger, but got no hits.

Then the other day I noticed a "package error" at the top of a file. One of the suggestions to fix it was move the class to the right place. I tried this and it worked.

It changed the package ref from "apidemo" to "apidemo/apidemo". In the existing apidemo folder a new folder, named apidemo, was added and the unfind-able file was moved (not copied) from "apidemo" to "apidemo/apidemo". 

The demo still works, both in the main NB program and in the debugger. But now the debugger can find that particular source file. But only that one. The other source files that go with GUI components are sill not find-able.

I did the "fix by moving" thing to one other of these not find-able files. It was also moved from "apidemo" to "apidemo/apidemo". And the debugger can now find it.

***

I realize that to get help I will probably have to provided more details.

Ask and you shall receive.

***

I'm new to Netbeans, and have only a little experience with Java. Java-scrip-like code is fairly common for doing custom technical indicators however and I've been doing this for many years. I worked as a programmer for about 20 years doing business system maintenance and development in various versions of Pick/Universe. 

I also spent some time self learning to use MFC until they decided to drop it a while back. Like with the Pick stuff, I'm a bit tired of working with dinosaur code.

Regards,
LB