@@ -23,7 +23,8 @@ abstract private class GeneratedType extends RefType {
2323 private string stubKeyword ( ) {
2424 this instanceof Interface and result = "interface"
2525 or
26- this instanceof Class and ( if this instanceof EnumType then result = "enum" else result = "class" )
26+ this instanceof Class and
27+ ( if this instanceof EnumType then result = "enum" else result = "class" )
2728 }
2829
2930 private string stubAbstractModifier ( ) {
@@ -50,6 +51,7 @@ abstract private class GeneratedType extends RefType {
5051 result = this .getASupertype ( ) and
5152 not result instanceof TypeObject and
5253 not this instanceof EnumType and
54+ // generic types have their source declaation (the corresponding raw type) as a supertype of themselves
5355 result .getSourceDeclaration ( ) != this
5456 }
5557
@@ -330,20 +332,20 @@ private string stubMember(Member m) {
330332 then result = ""
331333 else (
332334 result =
333- " " + stubModifiers ( m ) + stubGenericMethodParams ( m ) + stubTypeName ( m .( Method ) .getReturnType ( ) ) +
334- " " + m .getName ( ) + "(" + stubParameters ( m ) + ")" + stubImplementation ( m ) + "\n"
335+ " " + stubModifiers ( m ) + stubGenericMethodParams ( m ) +
336+ stubTypeName ( m .( Method ) .getReturnType ( ) ) + " " + m .getName ( ) + "(" + stubParameters ( m ) + ")"
337+ + stubImplementation ( m ) + "\n"
335338 or
336339 m instanceof Constructor and
337340 result =
338341 " " + stubModifiers ( m ) + m .getName ( ) + "(" + stubParameters ( m ) + ")" +
339342 stubImplementation ( m ) + "\n"
340343 or
341- m instanceof Field and
342344 result =
343- " " + stubModifiers ( m ) + stubTypeName ( m .getType ( ) ) + " " + m .getName ( ) + " = " +
344- stubDefaultValue ( m .getType ( ) ) + ";\n"
345+ " " + stubModifiers ( m ) + stubTypeName ( m .( Field ) . getType ( ) ) + " " + m .getName ( ) + " = " +
346+ stubDefaultValue ( m .( Field ) . getType ( ) ) + ";\n"
345347 or
346- result = indent ( m .( NestedType ) .( GeneratedType ) .getStub ( ) ) )
348+ result = indent ( m .( NestedType ) .( GeneratedType ) .getStub ( ) )
347349 )
348350}
349351
@@ -357,6 +359,7 @@ private string stubFakeConstructor(RefType t) {
357359 then result = ""
358360 else
359361 exists ( string mod |
362+ // this won't conflict with any existing private constructors, since we don't generate stubs for any private members.
360363 if t instanceof EnumType then mod = " private " else mod = " protected "
361364 |
362365 if hasNoArgConstructor ( t ) then result = "" else result = mod + t .getName ( ) + "() {}\n"
0 commit comments