This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix PR23230 - wrong code generated in inner class


Robin Green wrote:
> This one-liner fixes PR java/23230 by saying "if the inner class has a matching
> method, don't call a matching method in an outer class." In other words, always
> use the innermost scope.
> 
> Tested against libjava/testsuite and jacks - no new failures (or passes). I'll
> submit a new test case to jacks.

Just to be sure, you did a *clean* build of libjava and then a testsuite
run with Jacks included, right? Stuff like this can very easily
introduce miscompilations (and was the reason I withdrew my own
patch for PR19870 Part 2, by the way).

Jacks is most likely not the place for such a testcase - AFAICT, they
only check for compilation success, error or warning. A better place
would be the libjava testsuite's "libjava.lang" sub-testsuite. A simple
testcase that reproduces the problem for me is:
------------------------------- 8< -------------------------------
class Snafu
{
  public void whoami( )
  {
    System.out.println( this.getClass( ).getName( ));
  }
}

public class PR23230 extends Snafu
{
  class Foo extends Snafu
  {
    Foo( )
    {
      whoami( );
    }
  }

  void bar( )
  {
    new Foo( );
  }

  public static void main( String[] args)
  {
    new PR23230( ).bar( );
  }
}
------------------------------- 8< -------------------------------

This currently prints "PR23230$Foo" when compiled with Jikes or
javac, but only prints "PR23230" when compiled with "gcj -C".

Thanks,
Ranjit.

-- 
Ranjit Mathew       Email: rmathew AT gmail DOT com

Bangalore, INDIA.     Web: http://ranjitmathew.hostingzero.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]