Skip to content

Commit

Permalink
Instantiate templates with Info.define
Browse files Browse the repository at this point in the history
  • Loading branch information
HGuillemet committed Dec 31, 2023
1 parent 514aeb9 commit 95ff339
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/org/bytedeco/javacpp/tools/DeclarationList.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public boolean add(Declaration decl, String fullName) {
boolean add = true;
if (templateMap != null && templateMap.empty() && !decl.custom && (decl.type != null || decl.declarator != null)) {
// method templates cannot be declared in Java, but make sure to make their
// info available on request (when Info.javaNames is set) to be able to create instances
// info available on request (when Info.javaNames or Info.define is set) to be able to create instances
if (infoIterator == null) {
Type type = templateMap.type = decl.type;
Declarator dcl = templateMap.declarator = decl.declarator;
Expand All @@ -75,12 +75,12 @@ public boolean add(Declaration decl, String fullName) {
continue;
}
List<Info> infoList = infoMap.get(name);
boolean hasJavaName = false;
boolean hasJavaNameOrDefine = false;
for (Info info : infoList) {
hasJavaName |= info.javaNames != null && info.javaNames.length > 0;
hasJavaNameOrDefine |= info.javaNames != null && info.javaNames.length > 0 || info.define;
}
if (!decl.function || hasJavaName) {
infoIterator = infoList.size() > 0 ? infoList.listIterator() : null;
if (!decl.function || hasJavaNameOrDefine) {
infoIterator = infoList.size() > 0 ? new ArrayList<>(infoList).listIterator() : null;
break;
}
}
Expand Down

0 comments on commit 95ff339

Please sign in to comment.