This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gjx] Patch: FYI: emit undeclared exceptions
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 11 Sep 2005 19:38:47 -0600
- Subject: [gjx] Patch: FYI: emit undeclared exceptions
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
We have to emit undeclared exceptions for a method to the bytecode,
and we should emit exceptions in their declaration order. We weren't
doing this properly.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* bytecode/attribute.cc (exceptions_attribute): Updated.
(emit): Likewise.
* bytecode/attribute.hh (exceptions_attribute::excs): Changed
type.
(exceptions_attribute): Updated.
* bytecode/classwriter.cc (write): Use get_throws, not
get_throws_as_set.
Index: TODO
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/Attic/TODO,v
retrieving revision 1.1.2.35
diff -u -r1.1.2.35 TODO
--- TODO 12 Sep 2005 01:33:27 -0000 1.1.2.35
+++ TODO 12 Sep 2005 01:42:56 -0000
@@ -1,6 +1,3 @@
-we should emit unchecked declared exceptions for a method
-currently we don't
-
error message if 'enum' is used as an identifier could be better
use a using declaration to resolve overrides in
Index: bytecode/attribute.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/bytecode/Attic/attribute.cc,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 attribute.cc
--- bytecode/attribute.cc 20 Apr 2005 16:05:01 -0000 1.1.2.5
+++ bytecode/attribute.cc 12 Sep 2005 01:42:56 -0000
@@ -104,12 +104,12 @@
exceptions_attribute::exceptions_attribute (outgoing_constant_pool *p,
- const std::set<model_type *> &e)
+ const std::list<ref_forwarding_type> &e)
: bytecode_attribute (p, "Exceptions"),
excs (e)
{
assert (! excs.empty ());
- for (std::set<model_type *>::const_iterator i = excs.begin ();
+ for (std::list<ref_forwarding_type>::const_iterator i = excs.begin ();
i != excs.end ();
++i)
pool->add (*i);
@@ -120,7 +120,7 @@
{
bytecode_attribute::emit (writer);
writer.put2 (excs.size ());
- for (std::set<model_type *>::const_iterator i = excs.begin ();
+ for (std::list<ref_forwarding_type>::const_iterator i = excs.begin ();
i != excs.end ();
++i)
writer.put2 (pool->add (*i));
Index: bytecode/attribute.hh
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/bytecode/Attic/attribute.hh,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 attribute.hh
--- bytecode/attribute.hh 20 Apr 2005 16:05:01 -0000 1.1.2.3
+++ bytecode/attribute.hh 12 Sep 2005 01:42:56 -0000
@@ -106,12 +106,12 @@
class exceptions_attribute : public bytecode_attribute
{
// The exceptions.
- std::set<model_type *> excs;
+ std::list<ref_forwarding_type> excs;
public:
exceptions_attribute (outgoing_constant_pool *,
- const std::set<model_type *> &);
+ const std::list<ref_forwarding_type> &);
void emit (bytecode_stream &);
Index: bytecode/classwriter.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/bytecode/Attic/classwriter.cc,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 classwriter.cc
--- bytecode/classwriter.cc 20 Apr 2005 16:05:01 -0000 1.1.2.5
+++ bytecode/classwriter.cc 12 Sep 2005 01:42:59 -0000
@@ -276,7 +276,7 @@
if ((*i)->deprecated_p ())
attrs->push_back (new simple_name_attribute (pool, "Deprecated"));
- std::set<model_type *> excs = (*i)->get_throws_as_set ();
+ std::list<ref_forwarding_type> excs = (*i)->get_throws ();
if (! excs.empty ())
attrs->push_back (new exceptions_attribute (pool, excs));