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.
If you change the package name but leave the file in the old package directory the compiler will not mark it as an error. It will compile the file to the location of the package name which confuses the IDE and forces files that use it to error. It also forces the fix imports to always want to import the file from the incorrect location. This was found when the refactor wizard did not correctly change the name of the package.
Well don't change the package name to the wrong value then. Many things will not work if you do so. If you can reproduce a problem with the refactoring wizard, please file it with details (component: refactoring).
This problem was found when refactoring I DIDN'T CHANGE THE PACKAGE TO THE WRONG NAME NETBEANS DID. If a file is in a wrong package the IDE should tell you this. It seems to me that other IDEs and if you want to compete with other IDEs and "keep people out of the dark" then you netbeans should strive to be BETTER not worse. Thank you for your poor non caring response.
Please stop shouting. As I said before, if the IDE failed to update the package declaration correctly during a refactoring (e.g. move class to another package), that is clearly a bug which should be filed in the refactoring component, with whatever details to reproduce the problem you can supply (since I presume NetBeans QA has tried this operation many times and it worked correctly, so any failure is likely to rely on something specific about your environment). Leaving open in Java component (nothing to do with Ant) in case it is possible to mark a JavaNode with some kind of error badge in case its package declaration conflicts with its actual location beneath a source root. I believe JavaNode used to do this, or at least produced a tooltip or something, but I am not sure of details.
Sorry to bother you with something that could improve the program.. I really didn't mean to take any of your time.
I think this is a valid issue when rephrased - there should indeed be some warning on the Java node as it is parsed - I just did not consider that possibility before, since the request was phrased in terms of the build process, where it is impractical to make any change (for reasons of performance among others). As far as the build stage with Ant goes, there is little to be done because javac will accept files from any structure (with no warnings about inappropriate package statements) even though in such cases it will fail to correctly handle transitive compilation dependencies (which I seem to recall was the gist of another recent issue of yours - a bad package structure could result in such a problem). Cf. e.g. http://ant.apache.org/faq.html#always-recompiles Ideally javac would have some kind of flag which let you request a warning or error message in case a package declaration did not match one of a supplied list of source roots, but it doesn't. All of this is independent of any bugs that may exist in the refactoring functionality; the IDE always *tries* to set the correct package statement when making a new class or moving it.
I found what caused the initial error and am issuing it in the Refactoring error.. If you create a new file in the Source Packages and click/drag a class into it, it will bring up the "Refactor Code for Move Class" dialog box under clicking next it says "A package correspondig to the entered name cannot be found.". Clicking on cancel leaves the file in the moved directory without the package name being changed. At least a simple error indicator on the package line if the file is not in the correct directory would be nice. Thanks
I cannot reproduce this error in 6.5.