This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB 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: java/1413: gdb loses java type information


The following reply was made to PR java/1413; it has been noted by GNATS.

From: David Carlton <carlton@kealia.com>
To: Jim Blandy <jimb@redhat.com>
Cc: GNATS Filer <gdb-gnats@sources.redhat.com>
Subject: Re: java/1413: gdb loses java type information
Date: Thu, 09 Oct 2003 12:36:21 -0700

  
 >  Are there cases where treating every object according to its dynamic
 >  type would change the semantics of an expression, aside from making
 >  more expressions permissible (while still never accepting non-typesafe
 >  expressions)?
 
 Yes.  At least in C++; Java has overloading too, right?
 
 class A {
 public:
   void member(A *x);
 };
 
 class B : public A {
 public:
   void member(B *x);
 };
 
 void foo(A *y)
 {
   B b;
 
   y->member(&b);
 }
 
 Here, A::member should be called.  But if y is really a B *, and we go
 by the dynamic type, then B::member would be called instead.
 
 I've forgotten how Java's overloading rules work, but I would be
 surprised if you couldn't construct similar examples in Java.


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