Skip to content

Commit

Permalink
* Prevent Generator from creating duplicate using statements (pull
Browse files Browse the repository at this point in the history
  • Loading branch information
floybix authored and saudet committed Jan 7, 2017
1 parent 20a335c commit fe0a74c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/java/org/bytedeco/javacpp/tools/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -2066,8 +2066,18 @@ void callback(Class<?> cls, Method callbackMethod, String callbackName, boolean
if (functionList == null) {
virtualFunctions.put(cls, functionList = new LinkedHashSet<String>());
}
member += "using " + valueTypeName + "::" + methodInfo.memberName[0] + ";\n "
+ "virtual " + returnConvention[0] + (returnConvention.length > 1 ? returnConvention[1] : "")
String usingLine = "using " + valueTypeName + "::" + methodInfo.memberName[0] + ";";
boolean needUsing = true;
for (String s : memberList) {
if (s.split("\n", 2)[0].equals(member + usingLine)) {
needUsing = false;
break;
}
}
if (needUsing) {
member += usingLine + "\n ";
}
member += "virtual " + returnConvention[0] + (returnConvention.length > 1 ? returnConvention[1] : "")
+ methodInfo.memberName[0] + parameterDeclaration + ";\n "
+ returnConvention[0] + "super_" + methodInfo.memberName[0] + nonconstParamDeclaration + " { ";
if (methodInfo.method.getAnnotation(Virtual.class).value()) {
Expand Down

0 comments on commit fe0a74c

Please sign in to comment.