Summary: | Eclipse won't compile classes with wrong package name | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Maarten Coene <maarten_coene> |
Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> |
Status: | VERIFIED DUPLICATE | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | amj87.iitr, jarthana, Olivier_Thomann, srikanth_sankaran |
Version: | 3.7 | ||
Target Milestone: | 3.7 M3 | ||
Hardware: | PC | ||
OS: | Windows Vista | ||
Whiteboard: |
Description
Maarten Coene
2010-10-21 15:30:29 EDT
Although javac does allow the user to compile with an incorrect package declaration, eclipse can't do that because it has to do in-time compilation of the code and also resolve the dependencies that other files may have with the file being currently compiled. An incorrect package declaration would mean that suddenly code resolution for all the other places that were using the fully qualified name for a type, etc will fail. Also, i dont understand your motivation behind declaring a different package than the one in which the class is being created. Why not just change the package name itself? You will anyway have to change the package at some point later. I intend to close this as WONTFIX. I agree with you that you should not declare yourself a package that is inconsistent with the location on disk of the java file. However, we are using a lot of external libraries and we don't own the source code of these libraries. I wanted to patch one of these libraries to fix a bug, so I opened the sources in my favorite IDE: Eclipse. Unfortunately, I was not able to patch the library quickly because of this problem: the library sources were having inconsistent package declarations. Moving all source files to their correct directory was just too much work so I used IntelliJ IDEA to patch the library (IDEA also has some issues with this, but at least it could compile the code). It just would have been nice if I could have done this with Eclipse as well. Srikanth, what is your take on this? (In reply to comment #3) > Srikanth, what is your take on this? See also bug 119440, bug 16209, bug 48407, bug 151316, bug 85394 et al. As the lengthy discussion in bug 16209 shows this issue has been debated in great detail the conclusion being it would break other parts of the IDE and it would not be cost effective to rework things to a full solution. *** This bug has been marked as a duplicate of bug 16209 *** Verified for 3.7M3 |