This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: fix parser bug with types
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 25 Oct 2005 16:16:30 -0600
- Subject: [gcjx] Patch: FYI: fix parser bug with types
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
This fixes a small parser bug with generic types. We were looking for
'[]' even when closing multiple generic types at once. This is a test
case:
class gen<T> { }
class gen2<T> { }
class base {
public gen<?>[] m() { return null; }
}
public class overr2 extends base {
public gen<gen2<String>>[] m() { return null; }
}
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* source/parse.cc (counted_type): Don't look for [] if multiple
<> were closed at once.
Index: source/parse.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/source/Attic/parse.cc,v
retrieving revision 1.1.2.8
diff -u -r1.1.2.8 parse.cc
--- source/parse.cc 21 Oct 2005 22:23:48 -0000 1.1.2.8
+++ source/parse.cc 25 Oct 2005 22:21:55 -0000
@@ -1372,8 +1372,12 @@
ref_forwarding_type
parse::counted_type (int <_depth)
{
+ int saved_depth = lt_depth;
ref_forwarding_type result (type_name (lt_depth));
- return brackets_opt (result);
+ // Don't look for [] if we just closed more than one <>.
+ if (saved_depth == lt_depth)
+ result = brackets_opt (result);
+ return result;
}
// type: