Skip to content

Commit

Permalink
Ensure constructor cppName is class name
Browse files Browse the repository at this point in the history
  • Loading branch information
HGuillemet committed Jan 20, 2024
1 parent 314f760 commit 8d66b2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public boolean add(Declaration decl, String fullName) {
if (infoIterator == null) {
Type type = templateMap.type = decl.type;
Declarator dcl = templateMap.declarator = decl.declarator;
for (String name : new String[] {fullName, dcl != null ? (dcl.type.constructor ? Parser.constructorName(dcl.cppName) : dcl.cppName) : type.cppName}) {
for (String name : new String[] {fullName, dcl != null ? dcl.cppName : type.cppName}) {
if (name == null) {
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/bytedeco/javacpp/tools/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static String upcastMethodName(String javaName) {
* NS::CN::CN(int)
* Declarator.cppName contains the calling name, and this method returns the declaration name.
* Keys in info map should use the declaration name, because the calling name cannot specify
* arguments in case of constructor templates, and to avoid confusion between classes and constructores info.
* arguments in case of constructor templates, and to avoid confusion between classes and constructors info.
*/
static String constructorName(String cppName) {
String constructorName = Templates.strip(cppName);
Expand Down Expand Up @@ -1161,6 +1161,7 @@ else if (cppNameSplit.size() > 1 && groupNameSplit.size() == 1)
if (cppName.equals(groupName)) {
type.constructor = !type.destructor && !type.operator
&& type.indirections == 0 && !type.reference && tokens.get().match('(', ':');
if (type.constructor) type.cppName = context.cppName; // Fix potential qualification errors
}
type.javaName = context.shorten(type.javaName);
}
Expand Down

0 comments on commit 8d66b2e

Please sign in to comment.