diff options
author | Tom Tromey <tromey@redhat.com> | 2005-12-02 19:35:53 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2005-12-02 19:35:53 +0000 |
commit | 3629d53e1b090f55fd8aac11017728da51d3d30b (patch) | |
tree | 56a58bfc0a1965c20c9ba70469fd3967ace2ff2e | |
parent | 14559d7fe36adb7e0257bb8d1be1f7495f426e17 (diff) |
* unify.cc (unifier::unify): Pass bounds of wildcard types to
recursive invocations.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcjx-branch@107915 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcjx/ChangeLog | 5 | ||||
-rw-r--r-- | gcjx/TODO | 10 | ||||
-rw-r--r-- | gcjx/unify.cc | 35 |
3 files changed, 38 insertions, 12 deletions
diff --git a/gcjx/ChangeLog b/gcjx/ChangeLog index 54e8c8152e1..6ba9c9f8737 100644 --- a/gcjx/ChangeLog +++ b/gcjx/ChangeLog @@ -1,5 +1,10 @@ 2005-12-02 Tom Tromey <tromey@redhat.com> + * unify.cc (unifier::unify): Pass bounds of wildcard types to + recursive invocations. + +2005-12-02 Tom Tromey <tromey@redhat.com> + * model/memberref.cc (resolve_as_enum_constant): New methods. (resolve): Use it. * model/memberref.hh diff --git a/gcjx/TODO b/gcjx/TODO index cdbe365e91c..8749f660537 100644 --- a/gcjx/TODO +++ b/gcjx/TODO @@ -1,3 +1,13 @@ +look at the ums.java test case +in this we do type unification between +umsSet<T> and umsHashset<T> -- but we should only +compare when the erasures are the same. ie, the +unification code needs to move up the type hierarchy... + +we fake support for the various -g options +we should really support them +this requires (small) changes in the .class back end + we resolve classes too eagerly there is a BSF example from fitzsim where we resolve the members of a class read from .class diff --git a/gcjx/unify.cc b/gcjx/unify.cc index e0956bcd905..73d943bd99c 100644 --- a/gcjx/unify.cc +++ b/gcjx/unify.cc @@ -418,22 +418,33 @@ class unifier model_class *inner_a = *i_a; model_wildcard *inner_a_w = dynamic_cast<model_wildcard *> (inner_a); + model_class *actual_bound = NULL; + if (inner_a_w) + { + actual_bound = inner_a_w->get_bound (); + // FIXME: not clear this is correct. + if (actual_bound == NULL) + actual_bound = global->get_compiler ()->java_lang_Object (); + } + model_class *formal_bound = NULL; + if (inner_f_w) + { + formal_bound = inner_f_w->get_bound (); + // FIXME: not clear this is correct. + if (formal_bound == NULL) + formal_bound = global->get_compiler ()->java_lang_Object (); + } + if (! inner_f->wildcard_p ()) { if (constraint == GREATER_THAN) { if (inner_a->wildcard_p ()) { - model_class *bound = inner_a_w->get_bound (); if (inner_a_w->super_p ()) - unify (LESS_THAN, bound, inner_f); + unify (LESS_THAN, actual_bound, inner_f); else - { - // FIXME: is replacing the bound here ok? - if (! bound) - bound = global->get_compiler ()->java_lang_Object (); - unify (GREATER_THAN, bound, inner_f); - } + unify (GREATER_THAN, actual_bound, inner_f); } else unify (EQUAL, inner_a, inner_f); @@ -446,10 +457,10 @@ class unifier if (inner_a->wildcard_p ()) { if (inner_a_w->super_p ()) - unify (GREATER_THAN, inner_a, inner_f); + unify (GREATER_THAN, actual_bound, formal_bound); } else - unify (GREATER_THAN, inner_a, inner_f); + unify (GREATER_THAN, inner_a, formal_bound); } else if (inner_f_w->has_bound_p ()) { @@ -457,10 +468,10 @@ class unifier if (inner_a->wildcard_p ()) { if (! inner_a_w->super_p () && inner_a_w->has_bound_p ()) - unify (LESS_THAN, inner_a, inner_f); + unify (LESS_THAN, actual_bound, formal_bound); } else - unify (LESS_THAN, inner_a, inner_f); + unify (LESS_THAN, inner_a, formal_bound); } ++i_a; |