public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* java/1299: full hiearchy of interfaces not checked?
@ 2000-12-20 12:24 osk
0 siblings, 0 replies; only message in thread
From: osk @ 2000-12-20 12:24 UTC (permalink / raw)
To: java-gnats
>Number: 1299
>Category: java
>Synopsis: full hiearchy of interfaces not checked?
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 20 12:18:50 PST 2000
>Closed-Date:
>Last-Modified: Mon Jul 3 04:40:01 PDT 2000
>Originator: Oskar Liljeblad
>Release: unknown-1.0
>Organization:
>Environment:
Debian GNU/Linux
egcs 2.96 2000-06-26
libgcj 2000-07-02
>Description:
Run the script below to generate the java code, then compile it.
$ sh the_script
$ gcj -C bava/awt/*.java
bava/awt/Dialog.java: In class `bava.awt.Dialog':
bava/awt/Dialog.java: In method `bava.awt.Dialog()':
bava/awt/Dialog.java:4: Can't find method `setLayout(Lbava/awt/BorderLayout;)' in type `bava.awt.Dialog'.
setLayout(new BorderLayout());
If BorderLayout only extends LayoutManager and not LayoutManager2, everything
is fine. So it seems that the class hierarchy of interfaces are not checked
in arguments.
Oskar Liljeblad (osk@hem.passagen.se)
----------------------------------------------------------------------
mkdir bava bava/awt
cd bava/awt
echo >BorderLayout.java "package bava.awt;"
echo >>BorderLayout.java "public class BorderLayout implements LayoutManager2 { }"
echo >LayoutManager2.java "package bava.awt;"
echo >>LayoutManager2.java "public interface LayoutManager2 extends LayoutManager { }"
echo >LayoutManager.java "package bava.awt;"
echo >>LayoutManager.java "public interface LayoutManager { }"
cat >Dialog.java <<__END__
package bava.awt;
public class Dialog {
public Dialog() {
setLayout(new BorderLayout());
}
public void setLayout(LayoutManager layout_manager) { }
}
__END__
----------------------------------------------------------------------
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
Formerly PR gcj/278
From: Bryce McKinlay <bryce@albatross.co.nz>
To: osk@hem.passagen.se
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/278: full hiearchy of interfaces not checked?
Date: Mon, 03 Jul 2000 22:47:35 +1200
This is a multi-part message in MIME format.
--------------9BAB4FC556DE4E9507B0F7D1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
osk@hem.passagen.se wrote:
> If BorderLayout only extends LayoutManager and not LayoutManager2, everything
> is fine. So it seems that the class hierarchy of interfaces are not checked
> in arguments.
This seems to be a case of gcj behaving differently depending on whethere the classes referenced exist as
.class files or .java files. When the LayoutManager interfaces exist as class files, interface_of_p will
return false (when it should return true), but if they exist as java files it works okay.
Here is a proposed patch.
regards
[ bryce ]
--------------9BAB4FC556DE4E9507B0F7D1
Content-Type: text/plain; charset=us-ascii;
name="gcj-PR278.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="gcj-PR278.patch"
2000-07-03 Bryce McKinlay <bryce@albatross.co.nz>
* class.c (interface_of_p): Call load_class on arguments if they're
not loaded.
Index: class.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/class.c,v
retrieving revision 1.70
diff -u -r1.70 class.c
--- class.c 2000/06/27 04:30:18 1.70
+++ class.c 2000/07/03 10:40:51
@@ -432,6 +432,11 @@
int n, i;
tree basetype_vec;
+ if (! CLASS_LOADED_P (type1))
+ load_class (type1, 1);
+ if (! CLASS_LOADED_P (type2))
+ load_class (type2, 1);
+
if (!(basetype_vec = TYPE_BINFO_BASETYPES (type2)))
return 0;
n = TREE_VEC_LENGTH (basetype_vec);
--------------9BAB4FC556DE4E9507B0F7D1--
From: Bryce McKinlay <bryce@albatross.co.nz>
To: Oskar Liljeblad <osk@hem.passagen.se>, java-gnats@sourceware.cygnus.com
Cc:
Subject: Re: gcj/278: full hiearchy of interfaces not checked?
Date: Mon, 03 Jul 2000 23:38:47 +1200
This is a multi-part message in MIME format.
--------------7D4C2CD1C698A6C846153641
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Oskar Liljeblad wrote:
> I applied your patch, recompiled and installed. Now Dialog.java compiles
> but LayoutManager2.java doesn't. I get this error:
>
> $ gcj -C bava/awt/*.java
> ./bava/awt/LayoutManager2.java:2: Interface `bava.awt.LayoutManager2' already defined in bava/awt/LayoutManager2.java:2.
> public interface LayoutManager2 extends LayoutManager { }
> ^
> 1 error
>
> Oskar Liljeblad (osk@hem.passagen.se)
Doh.
Try this one. I'm not really sure if the patch is correct - I get the feeling I'm just fixing the symptom here and not the
real problem... ;-(
regards
[ bryce ]
--------------7D4C2CD1C698A6C846153641
Content-Type: text/plain; charset=us-ascii;
name="gcj-PR278-2.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="gcj-PR278-2.patch"
2000-07-03 Bryce McKinlay <bryce@albatross.co.nz>
* class.c (interface_of_p): Call load_class on arguments if they're
not loaded and not being compiled from source.
Index: class.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/class.c,v
retrieving revision 1.70
diff -u -r1.70 class.c
--- class.c 2000/06/27 04:30:18 1.70
+++ class.c 2000/07/03 11:34:46
@@ -432,6 +432,11 @@
int n, i;
tree basetype_vec;
+ if (!CLASS_LOADED_P (type1) && !CLASS_FROM_SOURCE_P (type1))
+ load_class (type1, 1);
+ if (!CLASS_LOADED_P (type2) && !CLASS_FROM_SOURCE_P (type2))
+ load_class (type2, 1);
+
if (!(basetype_vec = TYPE_BINFO_BASETYPES (type2)))
return 0;
n = TREE_VEC_LENGTH (basetype_vec);
--------------7D4C2CD1C698A6C846153641--
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-12-20 12:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-20 12:24 java/1299: full hiearchy of interfaces not checked? osk
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).