Skip to content

Commit

Permalink
#135 fix generated compile errors for nested and generic dataype params
Browse files Browse the repository at this point in the history
  • Loading branch information
bergmanngabor committed Apr 12, 2024
1 parent 4293f96 commit a170ddf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ class PatternMatchClassInferrer {
if (!isMutable()) throw new java.lang.UnsupportedOperationException();
«FOR variable : pattern.parameters»
«val type = variable.calculateType»
if ("«variable.name»".equals(parameterName) «IF typeReference.is(type, Object)»&& newValue instanceof «type»«ENDIF») {
this.«variable.fieldName» = («type») newValue;
if ("«variable.name»".equals(parameterName) «IF typeReference.is(type, Object)»&& newValue instanceof «type.type»«ENDIF») {
this.«variable.fieldName» = («type.type») newValue;
return true;
}
«ENDFOR»
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class PatternMatcherClassInferrer {
parameters += variable.toParameter("parameters", typeRef(Object).addArrayTypeDimension)
visibility = JvmVisibility::PROTECTED
body = '''
return rawStreamAllValues(«variable.positionConstant», parameters).map(«typeOfVariable».class::cast);
return rawStreamAllValues(«variable.positionConstant», parameters).map(«typeOfVariable.type».class::cast);
'''
]
type.members += pattern.toMethod("getAllValuesOf" + variable.name, typeRef(Set, typeOfVariable)) [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class PatternQuerySpecificationClassInferrer {
annotations += annotationRef(Override)
parameters += pattern.toParameter("parameters", typeRef(Object).addArrayTypeDimension)
varArgs = true
body = '''return «matchClass».newMatch(«FOR p : pattern.parameters SEPARATOR ', '»(«p.calculateType.qualifiedName») parameters[«pattern.parameters.indexOf(p)»]«ENDFOR»);'''
body = '''return «matchClass».newMatch(«FOR p : pattern.parameters SEPARATOR ', '»(«p.calculateType.type») parameters[«pattern.parameters.indexOf(p)»]«ENDFOR»);'''
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void resolveClassInternal() throws ClassNotFoundException {
@Override
public String getPrettyPrintableName() {
getWrapperInstanceClass();
return cachedWrapperInstanceClass == null ? wrappedKey == null ? "<null>" : wrappedKey : cachedWrapperInstanceClass.getName();
return cachedWrapperInstanceClass == null ? wrappedKey == null ? "<null>" : wrappedKey : cachedWrapperInstanceClass.getCanonicalName();
}

@Override
Expand Down

0 comments on commit a170ddf

Please sign in to comment.