diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-29 16:31:53 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-29 16:31:53 +0000 |
commit | 18d8c04953780b83f4783cfbfb9ce35a4343e72c (patch) | |
tree | 6f42da3be8a72fabc602b81ed7dd9cfe5515daca | |
parent | da13fdfe7a26705b6c36bd21c315d8facf78fc8e (diff) | |
download | gcc-18d8c04953780b83f4783cfbfb9ce35a4343e72c.tar.gz |
gcc/java
PR java/26390:
* parse.y (find_most_specific_methods_list): Added 'class'
argument.
(lookup_method_invoke): Updated.
libjava
PR java/26390:
* testsuite/libjava.lang/pr26390.out: New file.
* testsuite/libjava.lang/pr26390.java: New file.
* sources.am, Makefile.in: Rebuilt.
* scripts/makemake.tcl: Compile gnu/java/awt/peer/swing.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112499 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/java/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/java/parse.y | 23 | ||||
-rw-r--r-- | libjava/ChangeLog | 8 | ||||
-rw-r--r-- | libjava/Makefile.in | 29 | ||||
-rwxr-xr-x | libjava/scripts/makemake.tcl | 3 | ||||
-rw-r--r-- | libjava/sources.am | 22 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/pr26390.java | 45 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/pr26390.out | 0 |
8 files changed, 128 insertions, 9 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 5f840751fb4..826d60808f0 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,10 @@ +2006-03-28 Tom Tromey <tromey@redhat.com> + + PR java/26390: + * parse.y (find_most_specific_methods_list): Added 'class' + argument. + (lookup_method_invoke): Updated. + 2006-03-15 Tom Tromey <tromey@redhat.com> * jcf-write.c (generate_bytecode_insns): Use qualifying type for diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 48a56d8f1d8..6b0bf767ca3 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -134,7 +134,7 @@ static tree resolve_no_layout (tree, tree); static int invocation_mode (tree, int); static tree find_applicable_accessible_methods_list (int, tree, tree, tree); static void search_applicable_methods_list (int, tree, tree, tree, tree *, tree *); -static tree find_most_specific_methods_list (tree); +static tree find_most_specific_methods_list (tree, tree); static int argument_types_convertible (tree, tree); static tree patch_invoke (tree, tree, tree); static int maybe_use_access_method (int, tree *, tree *); @@ -11249,7 +11249,7 @@ lookup_method_invoke (int lc, tree cl, tree class, tree name, tree arg_list) /* Find all candidates and then refine the list, searching for the most specific method. */ list = find_applicable_accessible_methods_list (lc, class, name, atl); - list = find_most_specific_methods_list (list); + list = find_most_specific_methods_list (list, class); if (list && !TREE_CHAIN (list)) return TREE_VALUE (list); @@ -11441,7 +11441,7 @@ search_applicable_methods_list (int lc, tree method, tree name, tree arglist, /* 15.11.2.2 Choose the Most Specific Method */ static tree -find_most_specific_methods_list (tree list) +find_most_specific_methods_list (tree list, tree class) { int max = 0; int abstract, candidates; @@ -11464,8 +11464,23 @@ find_most_specific_methods_list (tree list) /* Compare arguments and location where methods where declared */ if (argument_types_convertible (method_v, current_v)) { + /* We have a rather odd special case here. The front + end doesn't properly implement inheritance, so we + work around it here. The idea is, if we are + comparing a method declared in a class to one + declared in an interface, and the invocation's + qualifying class is a class (and not an interface), + then we consider the method's class to be the + qualifying class of the invocation. This lets us + fake the result of ordinary inheritance. */ + tree context_v = DECL_CONTEXT (current_v); + if (TYPE_INTERFACE_P (DECL_CONTEXT (method_v)) + && ! TYPE_INTERFACE_P (context_v) + && ! TYPE_INTERFACE_P (class)) + context_v = class; + if (valid_method_invocation_conversion_p - (DECL_CONTEXT (method_v), DECL_CONTEXT (current_v))) + (DECL_CONTEXT (method_v), context_v)) { int v = (DECL_SPECIFIC_COUNT (current_v) += 1); max = (v > max ? v : max); diff --git a/libjava/ChangeLog b/libjava/ChangeLog index fe5de168643..2c8ea41ce5c 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,13 @@ 2006-03-29 Tom Tromey <tromey@redhat.com> + PR java/26390: + * testsuite/libjava.lang/pr26390.out: New file. + * testsuite/libjava.lang/pr26390.java: New file. + * sources.am, Makefile.in: Rebuilt. + * scripts/makemake.tcl: Compile gnu/java/awt/peer/swing. + +2006-03-29 Tom Tromey <tromey@redhat.com> + * posix.cc (_Jv_platform_nanotime): Look for CLOCK_MONOTONIC and CLOCK_HIGHRES. diff --git a/libjava/Makefile.in b/libjava/Makefile.in index d784fcc740f..b32f73eb489 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -234,9 +234,10 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \ javax/swing/text/html/parser.lo javax/swing/text/rtf.lo \ javax/swing/tree.lo javax/swing/undo.lo javax/transaction.lo \ javax/transaction/xa.lo org/ietf/jgss.lo -am__DEPENDENCIES_3 = gnu-CORBA.lo gnu-java-beans.lo gnu-javax-rmi.lo \ - gnu-javax-sound-midi.lo gnu-xml.lo javax-imageio.lo \ - javax-rmi.lo javax-xml.lo org-omg.lo org-w3c.lo org-xml.lo +am__DEPENDENCIES_3 = gnu-CORBA.lo gnu-java-awt-peer-swing.lo \ + gnu-java-beans.lo gnu-javax-rmi.lo gnu-javax-sound-midi.lo \ + gnu-xml.lo javax-imageio.lo javax-rmi.lo javax-xml.lo \ + org-omg.lo org-w3c.lo org-xml.lo am__DEPENDENCIES_4 = $(patsubst classpath/resource/%,%,$(addsuffix \ .lo,$(property_files))) am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc \ @@ -1372,6 +1373,22 @@ classpath/gnu/java/awt/peer/qt/QtToolkit.java \ classpath/gnu/java/awt/peer/qt/QtVolatileImage.java \ classpath/gnu/java/awt/peer/qt/QtWindowPeer.java +gnu_java_awt_peer_swing_source_files = \ +classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingCanvasPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingComponent.java \ +classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingFramePeer.java \ +classpath/gnu/java/awt/peer/swing/SwingLabelPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingMenuItemPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingMenuPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingPanelPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingToolkit.java \ +classpath/gnu/java/awt/peer/swing/SwingWindowPeer.java + gnu_java_beans_source_files = \ classpath/gnu/java/beans/BeanInfoEmbryo.java \ classpath/gnu/java/beans/DefaultExceptionListener.java \ @@ -6618,6 +6635,7 @@ ordinary_header_files = \ bc_objects = \ gnu-CORBA.lo \ + gnu-java-awt-peer-swing.lo \ gnu-java-beans.lo \ gnu-javax-rmi.lo \ gnu-javax-sound-midi.lo \ @@ -8662,6 +8680,11 @@ gnu-java-awt-peer-qt.lo: $(gnu_java_awt_peer_qt_source_files) $(LTGCJCOMPILE) -fjni -findirect-dispatch -c -o gnu-java-awt-peer-qt.lo @gnu-java-awt-peer-qt.list @rm -f gnu-java-awt-peer-qt.list +gnu-java-awt-peer-swing.lo: $(gnu_java_awt_peer_swing_source_files) + @find classpath/lib/gnu/java/awt/peer/swing -name '*.class' > gnu-java-awt-peer-swing.list + $(LTGCJCOMPILE) -fjni -findirect-dispatch -c -o gnu-java-awt-peer-swing.lo @gnu-java-awt-peer-swing.list + @rm -f gnu-java-awt-peer-swing.list + gnu-java-beans.lo: $(gnu_java_beans_source_files) @find classpath/lib/gnu/java/beans -name '*.class' > gnu-java-beans.list $(LTGCJCOMPILE) -fjni -findirect-dispatch -c -o gnu-java-beans.lo @gnu-java-beans.list diff --git a/libjava/scripts/makemake.tcl b/libjava/scripts/makemake.tcl index e4d4dd677cc..d50b65a8a16 100755 --- a/libjava/scripts/makemake.tcl +++ b/libjava/scripts/makemake.tcl @@ -37,8 +37,7 @@ set package_map(.) package set package_map(gnu/test) ignore set package_map(gnu/javax/swing/plaf/gtk) ignore -# This package doesn't really work yet, and seems to trigger bug #26390 -set package_map(gnu/java/awt/peer/swing) ignore +set package_map(gnu/java/awt/peer/swing) bc set package_map(gnu/xml) bc set package_map(javax/imageio) bc diff --git a/libjava/sources.am b/libjava/sources.am index e9014b6f01d..4748a1b5110 100644 --- a/libjava/sources.am +++ b/libjava/sources.am @@ -825,6 +825,27 @@ gnu-java-awt-peer-qt.lo: $(gnu_java_awt_peer_qt_source_files) $(LTGCJCOMPILE) -fjni -findirect-dispatch -c -o gnu-java-awt-peer-qt.lo @gnu-java-awt-peer-qt.list @rm -f gnu-java-awt-peer-qt.list +gnu_java_awt_peer_swing_source_files = \ +classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingCanvasPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingComponent.java \ +classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingFramePeer.java \ +classpath/gnu/java/awt/peer/swing/SwingLabelPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingMenuItemPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingMenuPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingPanelPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java \ +classpath/gnu/java/awt/peer/swing/SwingToolkit.java \ +classpath/gnu/java/awt/peer/swing/SwingWindowPeer.java + +gnu-java-awt-peer-swing.lo: $(gnu_java_awt_peer_swing_source_files) + @find classpath/lib/gnu/java/awt/peer/swing -name '*.class' > gnu-java-awt-peer-swing.list + $(LTGCJCOMPILE) -fjni -findirect-dispatch -c -o gnu-java-awt-peer-swing.lo @gnu-java-awt-peer-swing.list + @rm -f gnu-java-awt-peer-swing.list + gnu_java_beans_source_files = \ classpath/gnu/java/beans/BeanInfoEmbryo.java \ classpath/gnu/java/beans/DefaultExceptionListener.java \ @@ -8186,6 +8207,7 @@ ordinary_header_files = \ bc_objects = \ gnu-CORBA.lo \ + gnu-java-awt-peer-swing.lo \ gnu-java-beans.lo \ gnu-javax-rmi.lo \ gnu-javax-sound-midi.lo \ diff --git a/libjava/testsuite/libjava.lang/pr26390.java b/libjava/testsuite/libjava.lang/pr26390.java new file mode 100644 index 00000000000..09cca7ef903 --- /dev/null +++ b/libjava/testsuite/libjava.lang/pr26390.java @@ -0,0 +1,45 @@ +public class pr26390 +{ + public interface ComponentPeer { + public void setBounds(); + } + + public interface ContainerPeer extends ComponentPeer { + } + + public interface WindowPeer extends ContainerPeer { + } + + public interface FramePeer extends WindowPeer { + } + + public static class SwingComponentPeer implements ComponentPeer { + public void setBounds() { + } + } + + public static class SwingContainerPeer + extends SwingComponentPeer implements ContainerPeer + { + } + + public static class SwingWindowPeer + extends SwingContainerPeer implements WindowPeer + { + } + + public static class SwingFramePeer + extends SwingWindowPeer implements FramePeer + { + public void setBounds() { + super.setBounds(); + } + } + + public static void main(String[] args) + { + SwingFramePeer s = new SwingFramePeer(); + s.setBounds(); + } +} + diff --git a/libjava/testsuite/libjava.lang/pr26390.out b/libjava/testsuite/libjava.lang/pr26390.out new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/libjava/testsuite/libjava.lang/pr26390.out |