public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: bryce@albatross.co.nz
To: java-gnats@sourceware.cygnus.com
Subject: java/1348: Overloaded method resolution should not cross contexts
Date: Wed, 20 Dec 2000 12:25:00 -0000	[thread overview]
Message-ID: <20000817022320.5598.qmail@sourceware.cygnus.com> (raw)

>Number:         1348
>Category:       java
>Synopsis:       Overloaded method resolution should not cross contexts
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apbianco
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:19:16 PST 2000
>Closed-Date:    
>Last-Modified:  
>Originator:     Bryce McKinlay
>Release:        current
>Organization:
>Environment:

>Description:
gcj goes to some lengths to try and resolve calls to 
overloaded methods where methods in an outer context share
the same name (see find_most_specific_methods_list etc). 
However this is unneccessary (and wrong), as demonstrated 
by the following example.

class Overload
{
  void p(String s) {}

  class A
  {
    void p(int i) {}
    
    void a()
    {
      p("One");
    }
  }
}

Here gcj will patch the call through to p(String) in the
outer context. But both jikes and javac reject this code
because overload resolution should stop at the first context
in which an appropriatly named method is discovered.
Jikes's error message is particularly intelligent here:

$ jikes Overload.java 

Found 1 semantic error compiling "Overload.java":

    11.       p("One");
              <------>
*** Error: The method "void p(java.lang.String s);" contained in the enclosing type "Overload" is a perfect match for this method call. However, it is not visible in this nested class because a method with the same name in an intervening class is hiding it.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:

Formerly PR gcj/322

>Unformatted:


             reply	other threads:[~2000-12-20 12:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-20 12:25 bryce [this message]
2003-05-12  3:16 Dara Hazeghi
2003-05-14 10:44 giovannibajo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000817022320.5598.qmail@sourceware.cygnus.com \
    --to=bryce@albatross.co.nz \
    --cc=java-gnats@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).