Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To generate Java classes for different sets of template arguments, the Parser, in
declarations()
, makes a first pass without argument values during which it fills aninfoList
(inDeclarationsList
) with the infos targeting instances of the template, then makes additional passes for each element ininfoList
, fillingtemplateMap
with template arguments founds in each info.To pick these infos, it calls
infoMap.get(name)
which may return infos with several cpp names.For instance for
ptr<X>
it could return an info with the following cppNames:["ArrayRef<ptr<X> >", "ptr<X>"]
.Then when filling
templateMap
, onlycppNames[0]
is checked, and itsType.arguments
are used to fill thetemplateMap
values. In the example above, we will end up trying to instantiateptr<ptr<X> >
.I came across this problem when trying to understand a concurrent modification exception thrown by the parser when the infoList was modified when using its iterator.
This PR proposes to replace the
infoIterator
with a string iterator containing cpp names founds in info, but only those that match the name of the declaration being parsed (in normalized form).Checked on existing presets, nothing changed in parsing results.
Only the first matching cppName in each info is considered. I think returning all matching names would be better, but this would require modifications in existing presets.