facebook

JSP file name conflicts with imported class name

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #220730 Reply

    john
    Member

    This is a minor issue with the MyEclipse JSP Editor in
    Version: 3.8.2
    Build id: 200409171200-3.8.2.
    (I’m fairly certain that’s the GA release.)

    [File/class names changed to protect the innocent.]

    I have a file named JohnDoe.jsp, which imports a class called org.example.fake.JohnDoe. The JSP editor complains about the import, saying ‘The import org.example.fake.blah.JohnDoe conflicts with a type defined in the same file (in file: “org.example.fake.blah.JohnDoe”)’.

    I’m pretty sure this import should be allowed by the JSP spec. (I know it’s supported by both Tomcat and Weblogic, as both servers name the generated jsp servlets something a little funny. I think Weblogic does “_JohnDoe.class” and Tomcat does “JohnDoe_jsp.class.”)

    When I copy the contents of JohnDoe.jsp into Temp.jsp, the Editor likes the import just fine.

    -john.

    #220746 Reply

    Riyad Kalla
    Member

    John,
    We use the Jasper2 JSP compiler that is from the Tomcat project to validate/compile JSP pages, so the errors should be on par. Besides that, having two files name exactly the same thing will confuse the snot out of the source lookup mechanism in the debugger, so maybe its a good idea not to do that 😉

    #220758 Reply

    Paul Kaiser
    Member

    Aren’t the JSP-derived classes in a different namespace?

    #220763 Reply

    john
    Member

    Riyad,
    I don’t know what you use to compile JSP pages, but I just tested this scenario with both Tomcat 4.1.31 and Tomcat 5.0.30, and in both versions a JSP can import and use a class whose unqualifed name is the same as the name of the JSP file (minus the .jsp extension).

    The output from my test page (SameName.jsp) looks something like this:

    I am a org.apache.jsp.SameName_jsp, specifically org.apache.jsp.SameName_jsp@1ea0105.
    I used a somepackage.SameName, specifically somepackage.SameName@1e91a4d.

    For what it’s worth, I agree that naming JSP pages and classes the same thing is not a great idea, but that’s really beside the point.

    Thanks.
    -john.

    #221177 Reply

    john
    Member

    I see that my bug is a natural consequence of the cause of this issue (marked FIXED in 3.8.3, although my bug still exists):

    ID: 968, Jasper Validation and JSP Editor Reconciliation Validation are Different

    Even though MyEclipse compiles with Jasper (hence SameName.jsp does not show a red X decorator on its icon), the editor realtime-compiles with code that’s part of IBM’s Webtools contribution, which applies different rules and does not handle this name conflict.

    In addition to the error marker at the import line, all method invocations (unless the methods happen to match signatures of methods defined in the JSP) are also marked as errors. Of course Ctrl-Click also doesn’t navigate, since the editor is not resolving the class correctly.

    Is there any plan to address this? Thanks.
    -john.

    #221181 Reply

    Riyad Kalla
    Member

    John,
    We are spread pretty thin right now working on 3.9 (already! No down time around here), could you do us a huge favor and create a small Web Project that exhibits this problem, export it to a ZIP and email it to support@genuitec.com ATTN Riyad? I’ll test it and file the bug with the project attached so we have a real-world test case to run with when we fix the bug.

    #221215 Reply

    john
    Member

    Sent. Thanks.

    #221240 Reply

    Riyad Kalla
    Member

    Got it and filed it, thanks for your help John.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: JSP file name conflicts with imported class name

You must be logged in to post in the forum log in