[gcjx] Patch: FYI: fix parser bug with types
Tom Tromey
tromey@redhat.com
Tue Oct 25 22:22:00 GMT 2005
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:
More information about the Java-patches
mailing list