diff --git a/src/main/java/org/bytedeco/javacpp/tools/InfoMap.java b/src/main/java/org/bytedeco/javacpp/tools/InfoMap.java index a380b167..8f4fef77 100644 --- a/src/main/java/org/bytedeco/javacpp/tools/InfoMap.java +++ b/src/main/java/org/bytedeco/javacpp/tools/InfoMap.java @@ -110,18 +110,23 @@ public class InfoMap extends HashMap> { .put(new Info("std::vector").annotations("@StdVector")) .put(new Info("abstract").javaNames("_abstract")) + .put(new Info("assert").javaNames("_assert")) .put(new Info("boolean").javaNames("_boolean")) .put(new Info("byte").javaNames("_byte")) .put(new Info("extends").javaNames("_extends")) + .put(new Info("final").javaNames("_final")) .put(new Info("finally").javaNames("_finally")) .put(new Info("implements").javaNames("_implements")) .put(new Info("import").javaNames("_import")) .put(new Info("instanceof").javaNames("_instanceof")) + .put(new Info("interface").javaNames("_interface")) .put(new Info("native").javaNames("_native")) .put(new Info("null").javaNames("_null")) .put(new Info("package").javaNames("_package")) + .put(new Info("strictfp").javaNames("_strictfp")) .put(new Info("super").javaNames("_super")) .put(new Info("synchronized").javaNames("_synchronized")) + .put(new Info("throws").javaNames("_throws")) .put(new Info("transient").javaNames("_transient")) .put(new Info("operator ->").javaNames("access")) diff --git a/src/main/java/org/bytedeco/javacpp/tools/Parser.java b/src/main/java/org/bytedeco/javacpp/tools/Parser.java index 8338a008..a86cf3dd 100644 --- a/src/main/java/org/bytedeco/javacpp/tools/Parser.java +++ b/src/main/java/org/bytedeco/javacpp/tools/Parser.java @@ -89,15 +89,6 @@ public Parser(Logger logger, Properties properties, String encoding, String line this.lineSeparator = p.lineSeparator; } - /** Reserved keywords than cannot be used for Java identifier, but could be for C++ identifiers. */ - static final HashSet JAVA_KEYWORDS = new HashSet<>(); - static { - JAVA_KEYWORDS.addAll(Arrays.asList(new String[] { - "abstract", "assert", "boolean", "byte", "extends", "final", "finally", "implements", "import", - "instanceof", "interface", "native", "package", "strictfp", "super", "synchronized", "throws", "transient" - })); - } - final Logger logger; final Properties properties; final String encoding; @@ -1671,8 +1662,6 @@ Declarator declarator(Context context, String defaultName, int infoNumber, boole dcl.javaName = info.javaNames[0]; } - if (JAVA_KEYWORDS.contains(dcl.javaName)) dcl.javaName += '_'; - if (info != null && info.annotations != null) { for (String s : info.annotations) { if (!type.annotations.contains(s)) { @@ -1835,8 +1824,8 @@ Declarator declarator(Context context, String defaultName, int infoNumber, boole } } - // annotate with @Name if the Java name doesn't match with the C++ name, and if we are not parsing a function parameter - if (dcl.cppName != null && defaultName == null) { + // annotate with @Name if the Java name doesn't match with the C++ name + if (dcl.cppName != null) { String localName = dcl.cppName; if (context.namespace != null && localName.startsWith(context.namespace + "::")) { localName = dcl.cppName.substring(context.namespace.length() + 2);