Skip to content

Commit f9af374

Browse files
author
Thomas Kiley
authored
Merge pull request #1512 from thk123/bugfix/TG-1058/crash-inner-class-generic-class
[TG-1058] Fixes parsing errors relating inner classes on generic classes
2 parents bd2e9c2 + f892f4a commit f9af374

File tree

11 files changed

+1697
-148
lines changed

11 files changed

+1697
-148
lines changed

src/java_bytecode/java_types.cpp

+254-145
Large diffs are not rendered by default.

src/java_bytecode/java_types.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class java_generic_parametert:public reference_typet
9090
{
9191
public:
9292
typedef symbol_typet type_variablet;
93-
typedef std::vector<type_variablet> type_variablest;
9493

9594
java_generic_parametert(
9695
const irep_idt &_type_var_name,
@@ -108,6 +107,8 @@ class java_generic_parametert:public reference_typet
108107
return type_variables().front();
109108
}
110109

110+
private:
111+
typedef std::vector<type_variablet> type_variablest;
111112
const type_variablest &type_variables() const
112113
{
113114
return (const type_variablest &)(find(ID_type_variables).get_sub());

src/java_bytecode/java_utils.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ size_t find_closing_delimiter(
214214

215215
while(c_pos<=end_pos)
216216
{
217-
if(src[c_pos]=='<')
217+
if(src[c_pos] == open_char)
218218
depth++;
219-
else if(src[c_pos]=='>')
219+
else if(src[c_pos] == close_char)
220220
{
221221
if(depth==0)
222222
return c_pos;
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
public class GenericClass<T>
2+
{
3+
class InnerClass
4+
{
5+
}
6+
7+
class GenericInnerClass<V>
8+
{
9+
V field;
10+
11+
class DoublyNestedInnerClass
12+
{
13+
14+
}
15+
16+
class DoublyNestedInnerGenericClass<U>
17+
{
18+
T field;
19+
}
20+
}
21+
22+
class SameGenericParamInnerClass<T>
23+
{
24+
T field;
25+
}
26+
27+
InnerClass field;
28+
GenericInnerClass<Foo> field2;
29+
GenericInnerClass<T> field3;
30+
31+
GenericInnerClass<Foo>.DoublyNestedInnerClass field4;
32+
GenericInnerClass<T>.DoublyNestedInnerClass field5;
33+
34+
GenericInnerClass<Foo>.DoublyNestedInnerGenericClass<Foo> field6;
35+
GenericInnerClass<T>.DoublyNestedInnerGenericClass<T> field7;
36+
37+
void method(InnerClass input)
38+
{
39+
40+
}
41+
42+
void method2(InnerClass input, InnerClass input2)
43+
{
44+
45+
}
46+
47+
48+
void method3(GenericInnerClass<Foo> input)
49+
{
50+
51+
}
52+
53+
void method4(GenericInnerClass<T> input)
54+
{
55+
56+
}
57+
58+
void method5(GenericInnerClass<Foo>.DoublyNestedInnerClass input)
59+
{
60+
61+
}
62+
63+
void method6(GenericInnerClass<T>.DoublyNestedInnerClass input)
64+
{
65+
66+
}
67+
68+
void method7(GenericInnerClass<Foo>.DoublyNestedInnerGenericClass<Foo> input)
69+
{
70+
71+
}
72+
73+
void method8(GenericInnerClass<T>.DoublyNestedInnerGenericClass<T> input)
74+
{
75+
76+
}
77+
78+
InnerClass ret_method1()
79+
{
80+
return null;
81+
}
82+
83+
GenericInnerClass<Foo> ret_method2()
84+
{
85+
return null;
86+
}
87+
88+
GenericInnerClass<T> ret_method3()
89+
{
90+
return null;
91+
}
92+
93+
GenericInnerClass<Foo>.DoublyNestedInnerClass ret_method4()
94+
{
95+
return null;
96+
}
97+
GenericInnerClass<T>.DoublyNestedInnerClass ret_method5()
98+
{
99+
return null;
100+
}
101+
GenericInnerClass<Foo>.DoublyNestedInnerGenericClass<Foo> ret_method6()
102+
{
103+
return null;
104+
}
105+
GenericInnerClass<T>.DoublyNestedInnerGenericClass<T> ret_method7()
106+
{
107+
return null;
108+
}
109+
}

0 commit comments

Comments
 (0)