diff --git a/CONTRIBUTORS b/CONTRIBUTORS index c178ec908..0d9a926e4 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -5,4 +5,5 @@ The complete list of contributors can be identified through Git history. - Google Inc. +- Microsoft Corp. diff --git a/README.md b/README.md index 79aca3edb..31e32f978 100644 --- a/README.md +++ b/README.md @@ -507,6 +507,14 @@ For more informations, take a look at https://github.com/leetal/ios-cmake. - `ENABLE_BITCODE`: enable/disable the bitcode generation. +## Android Parcelable records + +Djinni supports generating records that implements `android.os.parcelable`. + +In order to do that, there are two steps needed: +- deriving the records that should be parcelable with the keyword parcelable: `deriving(parcelable)` +- run Djinni with the following flag `--java-implement-android-os-parcelable true` + ## Community Links * Join the discussion with other developers at the [Mobile C++ Slack Community](https://mobilecpp.herokuapp.com/) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index fa5b3a406..6f8f3b6e5 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -10,6 +10,12 @@ android { versionCode 1 versionName "1.0" } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + buildTypes { release { minifyEnabled false diff --git a/example/generated-src/cpp/sort_order.hpp b/example/generated-src/cpp/sort_order.hpp index 63461037f..e9980960a 100644 --- a/example/generated-src/cpp/sort_order.hpp +++ b/example/generated-src/cpp/sort_order.hpp @@ -4,6 +4,7 @@ #pragma once #include +#include namespace textsort { @@ -13,6 +14,16 @@ enum class sort_order : int { RANDOM, }; +static inline ::std::ostream& operator<<(::std::ostream& os, sort_order v) { + os << "sort_order::"; + switch (v) { + case sort_order::ASCENDING: return os << "ASCENDING"; + case sort_order::DESCENDING: return os << "DESCENDING"; + case sort_order::RANDOM: return os << "RANDOM"; + default: return os << "(v) << ">"; + } +} + } // namespace textsort namespace std { diff --git a/example/generated-src/java/com/dropbox/textsort/SortItems.java b/example/generated-src/java/com/dropbox/textsort/SortItems.java index beeef710c..03dbb82b4 100644 --- a/example/generated-src/java/com/dropbox/textsort/SortItems.java +++ b/example/generated-src/java/com/dropbox/textsort/SortItems.java @@ -7,18 +7,24 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -/*package*/ abstract class SortItems { +/*package*/ interface SortItems { /** For the iOS / Android demo */ - public abstract void sort(@Nonnull SortOrder order, @Nonnull ItemList items); + public void sort(@Nonnull SortOrder order, @Nonnull ItemList items); @CheckForNull - public static native SortItems createWithListener(@CheckForNull TextboxListener listener); + public static SortItems createWithListener(@CheckForNull TextboxListener listener) + { + return CppProxy.createWithListener(listener); + } /** For the localhost / command-line demo */ @Nonnull - public static native ItemList runSort(@Nonnull ItemList items); + public static ItemList runSort(@Nonnull ItemList items) + { + return CppProxy.runSort(items); + } - private static final class CppProxy extends SortItems + static final class CppProxy implements SortItems { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -30,14 +36,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } @@ -48,5 +54,11 @@ public void sort(SortOrder order, ItemList items) native_sort(this.nativeRef, order, items); } private native void native_sort(long _nativeRef, SortOrder order, ItemList items); + + @CheckForNull + public static native SortItems createWithListener(@CheckForNull TextboxListener listener); + + @Nonnull + public static native ItemList runSort(@Nonnull ItemList items); } } diff --git a/example/generated-src/java/com/dropbox/textsort/TextboxListener.java b/example/generated-src/java/com/dropbox/textsort/TextboxListener.java index d67afe271..244821361 100644 --- a/example/generated-src/java/com/dropbox/textsort/TextboxListener.java +++ b/example/generated-src/java/com/dropbox/textsort/TextboxListener.java @@ -6,6 +6,6 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -/*package*/ abstract class TextboxListener { - public abstract void update(@Nonnull ItemList items); +/*package*/ interface TextboxListener { + public void update(@Nonnull ItemList items); } diff --git a/example/generated-src/jni/NativeSortItems.cpp b/example/generated-src/jni/NativeSortItems.cpp index 03162cc5e..1c685395a 100644 --- a/example/generated-src/jni/NativeSortItems.cpp +++ b/example/generated-src/jni/NativeSortItems.cpp @@ -31,7 +31,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_textsort_SortItems_00024CppProxy_native } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_textsort_SortItems_createWithListener(JNIEnv* jniEnv, jobject /*this*/, jobject j_listener) +CJNIEXPORT jobject JNICALL Java_com_dropbox_textsort_SortItems_00024CppProxy_createWithListener(JNIEnv* jniEnv, jobject /*this*/, jobject j_listener) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -40,7 +40,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_textsort_SortItems_createWithListene } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_textsort_SortItems_runSort(JNIEnv* jniEnv, jobject /*this*/, jobject j_items) +CJNIEXPORT jobject JNICALL Java_com_dropbox_textsort_SortItems_00024CppProxy_runSort(JNIEnv* jniEnv, jobject /*this*/, jobject j_items) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); diff --git a/example/generated-src/objc/TextSort-Bridging-Header.h b/example/generated-src/objc/TextSort-Bridging-Header.h index bad025562..840e576f0 100644 --- a/example/generated-src/objc/TextSort-Bridging-Header.h +++ b/example/generated-src/objc/TextSort-Bridging-Header.h @@ -1,6 +1,17 @@ // AUTOGENERATED FILE - DO NOT MODIFY! // This file generated by Djinni +// TextSort_Bridging_Header.h +// TextSort_Bridging_Header + +#import + +//! Project version number for TextSortBridgingHeader. +FOUNDATION_EXPORT double TextSortBridgingHeaderVersionNumber; + +//! Project version string for TextSortBridgingHeader. +FOUNDATION_EXPORT const unsigned char TextSortBridgingHeaderVersionString[]; + #import "TXSItemList.h" #import "TXSSortOrder.h" #import "TXSSortItems.h" diff --git a/example/handwritten-src/java/com/dropbox/textsort/TextboxListenerImpl.java b/example/handwritten-src/java/com/dropbox/textsort/TextboxListenerImpl.java index 38c34a08f..dc4cb8562 100644 --- a/example/handwritten-src/java/com/dropbox/textsort/TextboxListenerImpl.java +++ b/example/handwritten-src/java/com/dropbox/textsort/TextboxListenerImpl.java @@ -4,7 +4,7 @@ import java.util.ArrayList; -public class TextboxListenerImpl extends TextboxListener { +public class TextboxListenerImpl implements TextboxListener { private EditText mTextArea; diff --git a/example/run_djinni.sh b/example/run_djinni.sh index a136b6ad3..8430fc1fa 100755 --- a/example/run_djinni.sh +++ b/example/run_djinni.sh @@ -54,6 +54,7 @@ fi --java-out "$temp_out/java" \ --java-package $java_package \ --java-class-access-modifier "package" \ + --java-generate-interfaces true \ --java-nullable-annotation "javax.annotation.CheckForNull" \ --java-nonnull-annotation "javax.annotation.Nonnull" \ --ident-java-field mFooBar \ diff --git a/intellij-plugin/.gitignore b/intellij-plugin/.gitignore new file mode 100644 index 000000000..9fab65093 --- /dev/null +++ b/intellij-plugin/.gitignore @@ -0,0 +1,3 @@ +out/ +*~ +resources/META-INF \ No newline at end of file diff --git a/intellij-plugin/META-INF/plugin.xml b/intellij-plugin/META-INF/plugin.xml index c4ad46c21..ad98ca222 100644 --- a/intellij-plugin/META-INF/plugin.xml +++ b/intellij-plugin/META-INF/plugin.xml @@ -13,10 +13,10 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + com.dropbox.djinni.ideaplugin Djinni IDL file support - 0.8 + 0.8.1 Dropbox Djinni Github Project + diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/parser/DjinniParser.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/parser/DjinniParser.java index 9548f73ec..f1dff1adc 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/parser/DjinniParser.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/parser/DjinniParser.java @@ -122,7 +122,7 @@ protected boolean parse_root_(IElementType t, PsiBuilder b, int l) { public static boolean basicType(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "basicType")) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); + Marker m = enter_section_(b, l, _NONE_, BASIC_TYPE, ""); r = consumeToken(b, "bool"); if (!r) r = consumeToken(b, "i8"); if (!r) r = consumeToken(b, "i16"); @@ -133,24 +133,25 @@ public static boolean basicType(PsiBuilder b, int l) { if (!r) r = consumeToken(b, "string"); if (!r) r = consumeToken(b, "binary"); if (!r) r = consumeToken(b, "date"); - exit_section_(b, l, m, BASIC_TYPE, r, false, null); + exit_section_(b, l, m, r, false, null); return r; } /* ********************************************************** */ - // 'const' constNamedValue COLON typeReference EQ constValue SEMICOLON + // const constNamedValue COLON typeReference EQ constValue SEMICOLON public static boolean constMember(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "constMember")) return false; + if (!nextTokenIs(b, CONST)) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); - r = consumeToken(b, "const"); + Marker m = enter_section_(b); + r = consumeToken(b, CONST); r = r && constNamedValue(b, l + 1); r = r && consumeToken(b, COLON); r = r && typeReference(b, l + 1); r = r && consumeToken(b, EQ); r = r && constValue(b, l + 1); r = r && consumeToken(b, SEMICOLON); - exit_section_(b, l, m, CONST_MEMBER, r, false, null); + exit_section_(b, m, CONST_MEMBER, r); return r; } @@ -253,24 +254,25 @@ public static boolean constReference(PsiBuilder b, int l) { public static boolean constValue(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "constValue")) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); + Marker m = enter_section_(b, l, _NONE_, CONST_VALUE, ""); r = consumeToken(b, STRING_LITERAL); if (!r) r = consumeToken(b, NUMBER_LITERAL); if (!r) r = constReference(b, l + 1); if (!r) r = constRecord(b, l + 1); - exit_section_(b, l, m, CONST_VALUE, r, false, null); + exit_section_(b, l, m, r, false, null); return r; } /* ********************************************************** */ - // 'eq' | 'ord' + // eq_keyword | ord public static boolean derivingParam(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "derivingParam")) return false; + if (!nextTokenIs(b, "", EQ_KEYWORD, ORD)) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); - r = consumeToken(b, "eq"); - if (!r) r = consumeToken(b, "ord"); - exit_section_(b, l, m, DERIVING_PARAM, r, false, null); + Marker m = enter_section_(b, l, _NONE_, DERIVING_PARAM, ""); + r = consumeToken(b, EQ_KEYWORD); + if (!r) r = consumeToken(b, ORD); + exit_section_(b, l, m, r, false, null); return r; } @@ -278,11 +280,12 @@ public static boolean derivingParam(PsiBuilder b, int l) { // (derivingParam ',' derivingParamList) | derivingParam public static boolean derivingParamList(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "derivingParamList")) return false; + if (!nextTokenIs(b, "", EQ_KEYWORD, ORD)) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); + Marker m = enter_section_(b, l, _NONE_, DERIVING_PARAM_LIST, ""); r = derivingParamList_0(b, l + 1); if (!r) r = derivingParam(b, l + 1); - exit_section_(b, l, m, DERIVING_PARAM_LIST, r, false, null); + exit_section_(b, l, m, r, false, null); return r; } @@ -315,6 +318,7 @@ static boolean djinniFile(PsiBuilder b, int l) { // enumTypeVariant LEFT_BLOCK_BRACE enumMember* RIGHT_BLOCK_BRACE static boolean enumDescription(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "enumDescription")) return false; + if (!nextTokenIs(b, ENUM)) return false; boolean r; Marker m = enter_section_(b); r = enumTypeVariant(b, l + 1); @@ -351,13 +355,14 @@ public static boolean enumMember(PsiBuilder b, int l) { } /* ********************************************************** */ - // 'enum' + // enum public static boolean enumTypeVariant(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "enumTypeVariant")) return false; + if (!nextTokenIs(b, ENUM)) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); - r = consumeToken(b, "enum"); - exit_section_(b, l, m, ENUM_TYPE_VARIANT, r, false, null); + Marker m = enter_section_(b); + r = consumeToken(b, ENUM); + exit_section_(b, m, ENUM_TYPE_VARIANT, r); return r; } @@ -374,15 +379,13 @@ public static boolean enumValue(PsiBuilder b, int l) { } /* ********************************************************** */ - // AT'extern' string_literal + // AT extern string_literal public static boolean externStatement(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "externStatement")) return false; if (!nextTokenIs(b, AT)) return false; boolean r; Marker m = enter_section_(b); - r = consumeToken(b, AT); - r = r && consumeToken(b, "extern"); - r = r && consumeToken(b, STRING_LITERAL); + r = consumeTokens(b, 0, AT, EXTERN, STRING_LITERAL); exit_section_(b, m, EXTERN_STATEMENT, r); return r; } @@ -439,10 +442,10 @@ private static boolean generator_2(PsiBuilder b, int l) { public static boolean genericBasicType(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "genericBasicType")) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); + Marker m = enter_section_(b, l, _NONE_, GENERIC_BASIC_TYPE, ""); r = genericBasicTypeSingleParameter(b, l + 1); if (!r) r = genericBasicTypeDualParameter(b, l + 1); - exit_section_(b, l, m, GENERIC_BASIC_TYPE, r, false, null); + exit_section_(b, l, m, r, false, null); return r; } @@ -467,13 +470,13 @@ public static boolean genericBasicTypeDualParameter(PsiBuilder b, int l) { public static boolean genericBasicTypeSingleParameter(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "genericBasicTypeSingleParameter")) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); + Marker m = enter_section_(b, l, _NONE_, GENERIC_BASIC_TYPE_SINGLE_PARAMETER, ""); r = genericBasicTypeSingleParameter_0(b, l + 1); r = r && genericBasicTypeSingleParameter_1(b, l + 1); r = r && consumeToken(b, LEFT_GENERICS_BRACE); r = r && typeReference(b, l + 1); r = r && consumeToken(b, RIGHT_GENERICS_BRACE); - exit_section_(b, l, m, GENERIC_BASIC_TYPE_SINGLE_PARAMETER, r, false, null); + exit_section_(b, l, m, r, false, null); return r; } @@ -493,22 +496,20 @@ private static boolean genericBasicTypeSingleParameter_0(PsiBuilder b, int l) { private static boolean genericBasicTypeSingleParameter_1(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "genericBasicTypeSingleParameter_1")) return false; boolean r; - Marker m = enter_section_(b, l, _NOT_, null); + Marker m = enter_section_(b, l, _NOT_); r = !consumeToken(b, SPACE); - exit_section_(b, l, m, null, r, false, null); + exit_section_(b, l, m, r, false, null); return r; } /* ********************************************************** */ - // AT'import' string_literal + // AT import string_literal public static boolean importStatement(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "importStatement")) return false; if (!nextTokenIs(b, AT)) return false; boolean r; Marker m = enter_section_(b); - r = consumeToken(b, AT); - r = r && consumeToken(b, "import"); - r = r && consumeToken(b, STRING_LITERAL); + r = consumeTokens(b, 0, AT, IMPORT, STRING_LITERAL); exit_section_(b, m, IMPORT_STATEMENT, r); return r; } @@ -517,6 +518,7 @@ public static boolean importStatement(PsiBuilder b, int l) { // interfaceTypeVariant LEFT_BLOCK_BRACE interfaceMember* RIGHT_BLOCK_BRACE static boolean interfaceDescription(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "interfaceDescription")) return false; + if (!nextTokenIs(b, INTERFACE)) return false; boolean r; Marker m = enter_section_(b); r = interfaceTypeVariant(b, l + 1); @@ -582,33 +584,34 @@ private static boolean interfaceFunctionParamList_0(PsiBuilder b, int l) { public static boolean interfaceMember(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "interfaceMember")) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); + Marker m = enter_section_(b, l, _NONE_, INTERFACE_MEMBER, ""); r = constMember(b, l + 1); if (!r) r = interfaceMemberFunction(b, l + 1); - exit_section_(b, l, m, INTERFACE_MEMBER, r, false, null); + exit_section_(b, l, m, r, false, null); return r; } /* ********************************************************** */ - // ['static'] identifier LEFT_PARAM_BRACE interfaceFunctionParamList? RIGHT_PARAM_BRACE [COLON typeReference] SEMICOLON + // [static] identifier LEFT_PARAM_BRACE interfaceFunctionParamList? RIGHT_PARAM_BRACE [COLON typeReference] SEMICOLON public static boolean interfaceMemberFunction(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "interfaceMemberFunction")) return false; + if (!nextTokenIs(b, "", IDENTIFIER, STATIC)) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); + Marker m = enter_section_(b, l, _NONE_, INTERFACE_MEMBER_FUNCTION, ""); r = interfaceMemberFunction_0(b, l + 1); r = r && consumeTokens(b, 0, IDENTIFIER, LEFT_PARAM_BRACE); r = r && interfaceMemberFunction_3(b, l + 1); r = r && consumeToken(b, RIGHT_PARAM_BRACE); r = r && interfaceMemberFunction_5(b, l + 1); r = r && consumeToken(b, SEMICOLON); - exit_section_(b, l, m, INTERFACE_MEMBER_FUNCTION, r, false, null); + exit_section_(b, l, m, r, false, null); return r; } - // ['static'] + // [static] private static boolean interfaceMemberFunction_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "interfaceMemberFunction_0")) return false; - consumeToken(b, "static"); + consumeToken(b, STATIC); return true; } @@ -638,14 +641,15 @@ private static boolean interfaceMemberFunction_5_0(PsiBuilder b, int l) { } /* ********************************************************** */ - // 'interface' generator* + // interface generator* public static boolean interfaceTypeVariant(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "interfaceTypeVariant")) return false; + if (!nextTokenIs(b, INTERFACE)) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); - r = consumeToken(b, "interface"); + Marker m = enter_section_(b); + r = consumeToken(b, INTERFACE); r = r && interfaceTypeVariant_1(b, l + 1); - exit_section_(b, l, m, INTERFACE_TYPE_VARIANT, r, false, null); + exit_section_(b, m, INTERFACE_TYPE_VARIANT, r); return r; } @@ -680,10 +684,10 @@ static boolean item_(PsiBuilder b, int l) { public static boolean predefinedType(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "predefinedType")) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); + Marker m = enter_section_(b, l, _NONE_, PREDEFINED_TYPE, ""); r = basicType(b, l + 1); if (!r) r = genericBasicType(b, l + 1); - exit_section_(b, l, m, PREDEFINED_TYPE, r, false, null); + exit_section_(b, l, m, r, false, null); return r; } @@ -691,6 +695,7 @@ public static boolean predefinedType(PsiBuilder b, int l) { // recordTypeVariant LEFT_BLOCK_BRACE recordMember* RIGHT_BLOCK_BRACE ['deriving' LEFT_PARAM_BRACE derivingParamList RIGHT_PARAM_BRACE] static boolean recordDescription(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "recordDescription")) return false; + if (!nextTokenIs(b, RECORD)) return false; boolean r; Marker m = enter_section_(b); r = recordTypeVariant(b, l + 1); @@ -738,11 +743,12 @@ private static boolean recordDescription_4_0(PsiBuilder b, int l) { // constMember | recordMemberVariable public static boolean recordMember(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "recordMember")) return false; + if (!nextTokenIs(b, "", CONST, IDENTIFIER)) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); + Marker m = enter_section_(b, l, _NONE_, RECORD_MEMBER, ""); r = constMember(b, l + 1); if (!r) r = recordMemberVariable(b, l + 1); - exit_section_(b, l, m, RECORD_MEMBER, r, false, null); + exit_section_(b, l, m, r, false, null); return r; } @@ -761,14 +767,15 @@ public static boolean recordMemberVariable(PsiBuilder b, int l) { } /* ********************************************************** */ - // 'record' generator* + // record generator* public static boolean recordTypeVariant(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "recordTypeVariant")) return false; + if (!nextTokenIs(b, RECORD)) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); - r = consumeToken(b, "record"); + Marker m = enter_section_(b); + r = consumeToken(b, RECORD); r = r && recordTypeVariant_1(b, l + 1); - exit_section_(b, l, m, RECORD_TYPE_VARIANT, r, false, null); + exit_section_(b, m, RECORD_TYPE_VARIANT, r); return r; } @@ -815,10 +822,10 @@ static boolean typeDescription(PsiBuilder b, int l) { public static boolean typeReference(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "typeReference")) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); + Marker m = enter_section_(b, l, _NONE_, TYPE_REFERENCE, ""); r = predefinedType(b, l + 1); if (!r) r = consumeToken(b, IDENTIFIER); - exit_section_(b, l, m, TYPE_REFERENCE, r, false, null); + exit_section_(b, l, m, r, false, null); return r; } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniConstMember.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniConstMember.java index 663eaf616..40f77cb42 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniConstMember.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniConstMember.java @@ -25,4 +25,7 @@ public interface DjinniConstMember extends PsiElement { @NotNull PsiElement getSemicolon(); + @NotNull + PsiElement getConst(); + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniDerivingParam.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniDerivingParam.java index 7dfa5ba4f..6eb0c7764 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniDerivingParam.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniDerivingParam.java @@ -7,4 +7,10 @@ public interface DjinniDerivingParam extends PsiElement { + @Nullable + PsiElement getEqKeyword(); + + @Nullable + PsiElement getOrd(); + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniEnumTypeVariant.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniEnumTypeVariant.java index 980c49282..58efc4b40 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniEnumTypeVariant.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniEnumTypeVariant.java @@ -7,4 +7,7 @@ public interface DjinniEnumTypeVariant extends PsiElement { + @NotNull + PsiElement getEnum(); + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniExternStatement.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniExternStatement.java index efb1e9de9..9bb55ff9b 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniExternStatement.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniExternStatement.java @@ -12,6 +12,9 @@ public interface DjinniExternStatement extends PsiNamedElement { @NotNull PsiElement getAt(); + @NotNull + PsiElement getExtern(); + @NotNull PsiElement getStringLiteral(); diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniImportStatement.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniImportStatement.java index 61b1b20a3..27d4e574c 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniImportStatement.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniImportStatement.java @@ -12,6 +12,9 @@ public interface DjinniImportStatement extends PsiNamedElement { @NotNull PsiElement getAt(); + @NotNull + PsiElement getImport(); + @NotNull PsiElement getStringLiteral(); diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniInterfaceMemberFunction.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniInterfaceMemberFunction.java index 7890e0079..4b1e78d81 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniInterfaceMemberFunction.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniInterfaceMemberFunction.java @@ -28,4 +28,7 @@ public interface DjinniInterfaceMemberFunction extends PsiElement { @NotNull PsiElement getIdentifier(); + @Nullable + PsiElement getStatic(); + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniInterfaceTypeVariant.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniInterfaceTypeVariant.java index 54525dc9a..df3db250e 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniInterfaceTypeVariant.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniInterfaceTypeVariant.java @@ -10,4 +10,7 @@ public interface DjinniInterfaceTypeVariant extends PsiElement { @NotNull List getGeneratorList(); + @NotNull + PsiElement getInterface(); + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniRecordTypeVariant.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniRecordTypeVariant.java index 08f265bcb..542459d1f 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniRecordTypeVariant.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniRecordTypeVariant.java @@ -10,4 +10,7 @@ public interface DjinniRecordTypeVariant extends PsiElement { @NotNull List getGeneratorList(); + @NotNull + PsiElement getRecord(); + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniTypes.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniTypes.java index 6033bac0e..b53ee005e 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniTypes.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/DjinniTypes.java @@ -40,8 +40,14 @@ public interface DjinniTypes { IElementType AT = new DjinniTokenType("@"); IElementType COLON = new DjinniTokenType(":"); IElementType COMMENT = new DjinniTokenType("comment"); + IElementType CONST = new DjinniTokenType("const"); + IElementType ENUM = new DjinniTokenType("enum"); IElementType EQ = new DjinniTokenType("="); + IElementType EQ_KEYWORD = new DjinniTokenType("eq"); + IElementType EXTERN = new DjinniTokenType("extern"); IElementType IDENTIFIER = new DjinniTokenType("identifier"); + IElementType IMPORT = new DjinniTokenType("import"); + IElementType INTERFACE = new DjinniTokenType("interface"); IElementType LEFT_BLOCK_BRACE = new DjinniTokenType("{"); IElementType LEFT_GENERICS_BRACE = new DjinniTokenType("<"); IElementType LEFT_PARAM_BRACE = new DjinniTokenType("("); @@ -50,13 +56,16 @@ public interface DjinniTypes { IElementType MAP = new DjinniTokenType("map"); IElementType NUMBER_LITERAL = new DjinniTokenType("number_literal"); IElementType OPTIONAL = new DjinniTokenType("optional"); + IElementType ORD = new DjinniTokenType("ord"); IElementType PLUS = new DjinniTokenType("+"); + IElementType RECORD = new DjinniTokenType("record"); IElementType RIGHT_BLOCK_BRACE = new DjinniTokenType("}"); IElementType RIGHT_GENERICS_BRACE = new DjinniTokenType(">"); IElementType RIGHT_PARAM_BRACE = new DjinniTokenType(")"); IElementType SEMICOLON = new DjinniTokenType(";"); IElementType SET = new DjinniTokenType("set"); IElementType SPACE = new DjinniTokenType("space"); + IElementType STATIC = new DjinniTokenType("static"); IElementType STRING_LITERAL = new DjinniTokenType("string_literal"); IElementType TEXT = new DjinniTokenType("text"); diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniBasicTypeImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniBasicTypeImpl.java index cf4e13019..74876c564 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniBasicTypeImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniBasicTypeImpl.java @@ -17,8 +17,12 @@ public DjinniBasicTypeImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitBasicType(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitBasicType(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstMemberImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstMemberImpl.java index 98e9d2c72..e8b0665e4 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstMemberImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstMemberImpl.java @@ -17,8 +17,12 @@ public DjinniConstMemberImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitConstMember(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitConstMember(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } @@ -58,4 +62,10 @@ public PsiElement getSemicolon() { return findNotNullChildByType(SEMICOLON); } + @Override + @NotNull + public PsiElement getConst() { + return findNotNullChildByType(CONST); + } + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstNamedValueImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstNamedValueImpl.java index c05193ac8..3d7d28668 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstNamedValueImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstNamedValueImpl.java @@ -16,8 +16,12 @@ public DjinniConstNamedValueImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitConstNamedValue(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitConstNamedValue(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstRecordMemberElementImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstRecordMemberElementImpl.java index 73c3fb7e2..2a45c5c9a 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstRecordMemberElementImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstRecordMemberElementImpl.java @@ -17,8 +17,12 @@ public DjinniConstRecordMemberElementImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitConstRecordMemberElement(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitConstRecordMemberElement(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstReferenceImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstReferenceImpl.java index 7f99755c7..14f59e8b2 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstReferenceImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstReferenceImpl.java @@ -16,8 +16,12 @@ public DjinniConstReferenceImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitConstReference(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitConstReference(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstValueImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstValueImpl.java index 3599659dd..1c0c459ca 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstValueImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniConstValueImpl.java @@ -17,8 +17,12 @@ public DjinniConstValueImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitConstValue(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitConstValue(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniDerivingParamImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniDerivingParamImpl.java index e213df8b4..3b73a65dd 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniDerivingParamImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniDerivingParamImpl.java @@ -17,9 +17,25 @@ public DjinniDerivingParamImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitDerivingParam(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitDerivingParam(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } + @Override + @Nullable + public PsiElement getEqKeyword() { + return findChildByType(EQ_KEYWORD); + } + + @Override + @Nullable + public PsiElement getOrd() { + return findChildByType(ORD); + } + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniDerivingParamListImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniDerivingParamListImpl.java index 692ab03f6..d79820ada 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniDerivingParamListImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniDerivingParamListImpl.java @@ -17,8 +17,12 @@ public DjinniDerivingParamListImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitDerivingParamList(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitDerivingParamList(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumMemberImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumMemberImpl.java index 62cc2f1f5..005d2840f 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumMemberImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumMemberImpl.java @@ -17,8 +17,12 @@ public DjinniEnumMemberImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitEnumMember(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitEnumMember(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumTypeVariantImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumTypeVariantImpl.java index df57f9b32..26ecea3da 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumTypeVariantImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumTypeVariantImpl.java @@ -17,9 +17,19 @@ public DjinniEnumTypeVariantImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitEnumTypeVariant(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitEnumTypeVariant(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } + @Override + @NotNull + public PsiElement getEnum() { + return findNotNullChildByType(ENUM); + } + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumValueImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumValueImpl.java index c44e4144e..ef802862c 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumValueImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniEnumValueImpl.java @@ -16,8 +16,12 @@ public DjinniEnumValueImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitEnumValue(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitEnumValue(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniExternStatementImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniExternStatementImpl.java index 77ea3c743..e724ea1e3 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniExternStatementImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniExternStatementImpl.java @@ -17,8 +17,12 @@ public DjinniExternStatementImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitExternStatement(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitExternStatement(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } @@ -28,6 +32,12 @@ public PsiElement getAt() { return findNotNullChildByType(AT); } + @Override + @NotNull + public PsiElement getExtern() { + return findNotNullChildByType(EXTERN); + } + @Override @NotNull public PsiElement getStringLiteral() { diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGeneratorImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGeneratorImpl.java index d7b7a2e58..1c0f857bb 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGeneratorImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGeneratorImpl.java @@ -17,8 +17,12 @@ public DjinniGeneratorImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitGenerator(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitGenerator(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeDualParameterImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeDualParameterImpl.java index 8e73882b7..e037042d4 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeDualParameterImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeDualParameterImpl.java @@ -17,8 +17,12 @@ public DjinniGenericBasicTypeDualParameterImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitGenericBasicTypeDualParameter(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitGenericBasicTypeDualParameter(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeImpl.java index a1a67ad39..6d9039363 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeImpl.java @@ -17,8 +17,12 @@ public DjinniGenericBasicTypeImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitGenericBasicType(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitGenericBasicType(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeSingleParameterImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeSingleParameterImpl.java index c53ed0853..a231f7bfb 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeSingleParameterImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniGenericBasicTypeSingleParameterImpl.java @@ -17,8 +17,12 @@ public DjinniGenericBasicTypeSingleParameterImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitGenericBasicTypeSingleParameter(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitGenericBasicTypeSingleParameter(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniImportStatementImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniImportStatementImpl.java index 92fef9354..2de2ddc61 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniImportStatementImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniImportStatementImpl.java @@ -17,8 +17,12 @@ public DjinniImportStatementImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitImportStatement(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitImportStatement(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } @@ -28,6 +32,12 @@ public PsiElement getAt() { return findNotNullChildByType(AT); } + @Override + @NotNull + public PsiElement getImport() { + return findNotNullChildByType(IMPORT); + } + @Override @NotNull public PsiElement getStringLiteral() { diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceFunctionParamImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceFunctionParamImpl.java index 4cf6c6259..cfccbf6e3 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceFunctionParamImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceFunctionParamImpl.java @@ -17,8 +17,12 @@ public DjinniInterfaceFunctionParamImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitInterfaceFunctionParam(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitInterfaceFunctionParam(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceFunctionParamListImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceFunctionParamListImpl.java index e9a7d2682..bd2f2eedf 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceFunctionParamListImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceFunctionParamListImpl.java @@ -17,8 +17,12 @@ public DjinniInterfaceFunctionParamListImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitInterfaceFunctionParamList(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitInterfaceFunctionParamList(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceMemberFunctionImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceMemberFunctionImpl.java index 7a70bcf32..e94fbad48 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceMemberFunctionImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceMemberFunctionImpl.java @@ -17,8 +17,12 @@ public DjinniInterfaceMemberFunctionImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitInterfaceMemberFunction(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitInterfaceMemberFunction(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } @@ -64,4 +68,10 @@ public PsiElement getIdentifier() { return findNotNullChildByType(IDENTIFIER); } + @Override + @Nullable + public PsiElement getStatic() { + return findChildByType(STATIC); + } + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceMemberImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceMemberImpl.java index fd7075bc0..249f1ab5e 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceMemberImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceMemberImpl.java @@ -17,8 +17,12 @@ public DjinniInterfaceMemberImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitInterfaceMember(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitInterfaceMember(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceTypeVariantImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceTypeVariantImpl.java index 08a846dc3..b47b10eb2 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceTypeVariantImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniInterfaceTypeVariantImpl.java @@ -17,8 +17,12 @@ public DjinniInterfaceTypeVariantImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitInterfaceTypeVariant(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitInterfaceTypeVariant(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } @@ -28,4 +32,10 @@ public List getGeneratorList() { return PsiTreeUtil.getChildrenOfTypeAsList(this, DjinniGenerator.class); } + @Override + @NotNull + public PsiElement getInterface() { + return findNotNullChildByType(INTERFACE); + } + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniPredefinedTypeImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniPredefinedTypeImpl.java index a914750ac..a222bb540 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniPredefinedTypeImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniPredefinedTypeImpl.java @@ -17,8 +17,12 @@ public DjinniPredefinedTypeImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitPredefinedType(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitPredefinedType(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordMemberImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordMemberImpl.java index c20b1d96a..cc0004ab1 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordMemberImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordMemberImpl.java @@ -17,8 +17,12 @@ public DjinniRecordMemberImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitRecordMember(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitRecordMember(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordMemberVariableImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordMemberVariableImpl.java index 79a3c9265..35fb03a27 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordMemberVariableImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordMemberVariableImpl.java @@ -17,8 +17,12 @@ public DjinniRecordMemberVariableImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitRecordMemberVariable(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitRecordMemberVariable(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordTypeVariantImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordTypeVariantImpl.java index 6e6e351d5..5edee5456 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordTypeVariantImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniRecordTypeVariantImpl.java @@ -17,8 +17,12 @@ public DjinniRecordTypeVariantImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitRecordTypeVariant(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitRecordTypeVariant(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } @@ -28,4 +32,10 @@ public List getGeneratorList() { return PsiTreeUtil.getChildrenOfTypeAsList(this, DjinniGenerator.class); } + @Override + @NotNull + public PsiElement getRecord() { + return findNotNullChildByType(RECORD); + } + } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniTypeDefinitionImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniTypeDefinitionImpl.java index c46f7a051..4e8a1d663 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniTypeDefinitionImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniTypeDefinitionImpl.java @@ -18,8 +18,12 @@ public DjinniTypeDefinitionImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitTypeDefinition(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitTypeDefinition(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniTypeReferenceImpl.java b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniTypeReferenceImpl.java index b224415bb..765cd6678 100644 --- a/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniTypeReferenceImpl.java +++ b/intellij-plugin/gen/com/dropbox/djinni/ideaplugin/psi/impl/DjinniTypeReferenceImpl.java @@ -16,8 +16,12 @@ public DjinniTypeReferenceImpl(ASTNode node) { super(node); } + public void accept(@NotNull DjinniVisitor visitor) { + visitor.visitTypeReference(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof DjinniVisitor) ((DjinniVisitor)visitor).visitTypeReference(this); + if (visitor instanceof DjinniVisitor) accept((DjinniVisitor)visitor); else super.accept(visitor); } diff --git a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/Djinni.bnf b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/Djinni.bnf index 5a67d5cb3..1a0a17f45 100644 --- a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/Djinni.bnf +++ b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/Djinni.bnf @@ -46,6 +46,15 @@ space="regexp:\s+" comment="regexp:#.*" + enum="enum" + record="record" + eq_keyword="eq" + ord="ord" + interface="interface" + static="static" + const="const" + extern="extern" + import="import" string_literal="regexp:('([^'\\]|\\.)*'|\"([^\"\\]|\\\"|\\\'|\\)*\")" number_literal="regexp:-?(\d+(\.\d*)?)|(\.\d+)" identifier="regexp:\p{Alpha}\w*" @@ -72,7 +81,7 @@ generator ::= (PLUS 'c') | (PLUS 'j') | (PLUS 'o') private enumDescription ::= enumTypeVariant LEFT_BLOCK_BRACE enumMember* RIGHT_BLOCK_BRACE -enumTypeVariant ::= 'enum' +enumTypeVariant ::= enum enumMember ::= enumValue SEMICOLON @@ -86,11 +95,11 @@ enumValue ::= identifier { private recordDescription ::= recordTypeVariant LEFT_BLOCK_BRACE recordMember* RIGHT_BLOCK_BRACE ['deriving' LEFT_PARAM_BRACE derivingParamList RIGHT_PARAM_BRACE] -recordTypeVariant ::= 'record' generator* +recordTypeVariant ::= record generator* derivingParamList ::= (derivingParam ',' derivingParamList) | derivingParam -derivingParam ::= 'eq' | 'ord' +derivingParam ::= eq_keyword | ord recordMember ::= constMember | recordMemberVariable @@ -100,11 +109,11 @@ recordMemberVariable ::= identifier COLON typeReference SEMICOLON private interfaceDescription ::= interfaceTypeVariant LEFT_BLOCK_BRACE interfaceMember* RIGHT_BLOCK_BRACE -interfaceTypeVariant ::= 'interface' generator* +interfaceTypeVariant ::= interface generator* interfaceMember ::= constMember | interfaceMemberFunction -interfaceMemberFunction ::= ['static'] identifier LEFT_PARAM_BRACE interfaceFunctionParamList? RIGHT_PARAM_BRACE [COLON typeReference] SEMICOLON +interfaceMemberFunction ::= [static] identifier LEFT_PARAM_BRACE interfaceFunctionParamList? RIGHT_PARAM_BRACE [COLON typeReference] SEMICOLON interfaceFunctionParamList ::= (interfaceFunctionParam ',' interfaceFunctionParamList) | interfaceFunctionParam @@ -134,7 +143,7 @@ genericBasicTypeDualParameter ::= map LEFT_GENERICS_BRACE typeReference LIST_SEP // // const definitions // -constMember ::= 'const' constNamedValue COLON typeReference EQ constValue SEMICOLON +constMember ::= const constNamedValue COLON typeReference EQ constValue SEMICOLON constNamedValue ::= identifier { mixin="com.dropbox.djinni.ideaplugin.psi.impl.DjinniReferenceImpl" @@ -159,7 +168,7 @@ constRecordMemberElement ::= identifier EQ constValue // // import // -importStatement ::= AT'import' string_literal { +importStatement ::= AT import string_literal { mixin="com.dropbox.djinni.ideaplugin.psi.impl.DjinniImportStatementBaseImpl" implements="com.intellij.psi.PsiNamedElement" methods=[getName setName getRangeOfPath getPath] @@ -168,7 +177,7 @@ importStatement ::= AT'import' string_literal { // // extern // -externStatement ::= AT'extern' string_literal { +externStatement ::= AT extern string_literal { mixin="com.dropbox.djinni.ideaplugin.psi.impl.DjinniImportStatementBaseImpl" implements="com.intellij.psi.PsiNamedElement" methods=[getName setName getRangeOfPath getPath] diff --git a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniBraceMatcher.java b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniBraceMatcher.java new file mode 100644 index 000000000..37783b9c7 --- /dev/null +++ b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniBraceMatcher.java @@ -0,0 +1,34 @@ +package com.dropbox.djinni.ideaplugin; + +import com.dropbox.djinni.ideaplugin.psi.DjinniTypes; +import com.intellij.lang.BracePair; +import com.intellij.lang.PairedBraceMatcher; +import com.intellij.psi.PsiFile; +import com.intellij.psi.tree.IElementType; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class DjinniBraceMatcher implements PairedBraceMatcher { + public static @NotNull + BracePair[] PAIRS = new BracePair[]{ + new BracePair(DjinniTypes.LEFT_BLOCK_BRACE, DjinniTypes.RIGHT_BLOCK_BRACE, false), + new BracePair(DjinniTypes.LEFT_GENERICS_BRACE, DjinniTypes.RIGHT_GENERICS_BRACE, false), + new BracePair(DjinniTypes.LEFT_PARAM_BRACE, DjinniTypes.RIGHT_PARAM_BRACE, false), + }; + + @NotNull + @Override + public BracePair[] getPairs() { + return PAIRS; + } + + @Override + public boolean isPairedBracesAllowedBeforeType(@NotNull IElementType lbraceType, @Nullable IElementType contextType) { + return true; + } + + @Override + public int getCodeConstructStart(PsiFile file, int openingBraceOffset) { + return openingBraceOffset; + } +} diff --git a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniColorSettingsPage.java b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniColorSettingsPage.java index 8960a5557..ec9c24021 100644 --- a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniColorSettingsPage.java +++ b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniColorSettingsPage.java @@ -33,6 +33,7 @@ public class DjinniColorSettingsPage implements ColorSettingsPage { private static final AttributesDescriptor[] DESCRIPTORS = new AttributesDescriptor[] { new AttributesDescriptor("Comment", DjinniSyntaxHighlighter.COMMENT), new AttributesDescriptor("Identifier", DjinniSyntaxHighlighter.IDENTIFIER), + new AttributesDescriptor("Keywords", DjinniSyntaxHighlighter.KEYWORDS), new AttributesDescriptor("String literal", DjinniSyntaxHighlighter.STRING_LITERAL), new AttributesDescriptor("Number literal", DjinniSyntaxHighlighter.NUMBER_LITERAL), }; diff --git a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniSyntaxHighlighter.java b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniSyntaxHighlighter.java index 0c17922ed..f54e7ceac 100644 --- a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniSyntaxHighlighter.java +++ b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniSyntaxHighlighter.java @@ -23,6 +23,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighterBase; import com.intellij.psi.TokenType; import com.intellij.psi.tree.IElementType; +import com.intellij.psi.tree.TokenSet; import org.jetbrains.annotations.NotNull; import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey; @@ -31,14 +32,25 @@ * Created by jaetzold on 7/23/15. */ public class DjinniSyntaxHighlighter extends SyntaxHighlighterBase { + public static TokenSet KEYWORD_TOKENS = TokenSet.create(DjinniTypes.EQ_KEYWORD, + DjinniTypes.ENUM, + DjinniTypes.INTERFACE, + DjinniTypes.CONST, + DjinniTypes.EXTERN, + DjinniTypes.IMPORT, + DjinniTypes.ORD, + DjinniTypes.RECORD, + DjinniTypes.STATIC); public static final TextAttributesKey STRING_LITERAL = createTextAttributesKey("DJINNI_STRING_LITERAL", DefaultLanguageHighlighterColors.STRING); + public static final TextAttributesKey KEYWORDS = createTextAttributesKey("DJINNI_KEYWORDS", DefaultLanguageHighlighterColors.KEYWORD); public static final TextAttributesKey NUMBER_LITERAL = createTextAttributesKey("DJINNI_NUMBER_LITERAL", DefaultLanguageHighlighterColors.NUMBER); public static final TextAttributesKey IDENTIFIER = createTextAttributesKey("DJINNI_IDENTIFIER", DefaultLanguageHighlighterColors.IDENTIFIER); public static final TextAttributesKey COMMENT = createTextAttributesKey("DJINNI_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT); public static final TextAttributesKey BAD_CHARACTER = createTextAttributesKey("DJINNI_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER); private static final TextAttributesKey[] STRING_LITERAL_KEYS = new TextAttributesKey[]{STRING_LITERAL}; + private static final TextAttributesKey[] KEYWORD_KEYS = new TextAttributesKey[]{KEYWORDS}; private static final TextAttributesKey[] NUMBER_LITERAL_KEYS = new TextAttributesKey[]{NUMBER_LITERAL}; private static final TextAttributesKey[] IDENTIFIER_KEYS = new TextAttributesKey[]{IDENTIFIER}; private static final TextAttributesKey[] COMMENT_KEYS = new TextAttributesKey[]{COMMENT}; @@ -64,6 +76,8 @@ public TextAttributesKey[] getTokenHighlights(IElementType tokenType) { return COMMENT_KEYS; } else if (tokenType.equals(TokenType.BAD_CHARACTER)) { return BAD_CHAR_KEYS; + } else if (KEYWORD_TOKENS.contains(tokenType)) { + return KEYWORD_KEYS; } else { return EMPTY_KEYS; } diff --git a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniUtil.java b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniUtil.java index 8d644917c..e77235c55 100644 --- a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniUtil.java +++ b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/DjinniUtil.java @@ -17,11 +17,9 @@ import com.dropbox.djinni.ideaplugin.psi.*; import com.dropbox.djinni.ideaplugin.psi.impl.DjinniPsiImplUtil; -import com.intellij.lang.Language; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; -import com.intellij.psi.impl.PsiManagerImpl; import com.intellij.psi.search.FileTypeIndex; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.util.PsiTreeUtil; @@ -30,8 +28,6 @@ import org.jetbrains.annotations.Nullable; import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; /** * Created by jaetzold on 7/27/15. @@ -123,7 +119,7 @@ public static List findAllTypeDefinitions(Project project, } @NotNull - public static List findAllExternalTypes(Project project, PsiElement visibilityContext) { + public static List findAllExternalTypes(Project project, @Nullable PsiElement visibilityContext) { List result = new ArrayList(); List allExternalFiles = findAllExternalFiles(project, visibilityContext); @@ -273,7 +269,7 @@ public static List findAllConstNamedValues(Project projec } @NotNull - public static List findAllDjinniFiles(Project project, PsiElement visibilityContext) { + public static List findAllDjinniFiles(Project project, @Nullable PsiElement visibilityContext) { List result = new ArrayList(); if (visibilityContext == null) { @@ -315,7 +311,7 @@ public static List findAllDjinniFiles(Project project, PsiElement vi } @NotNull - public static List findAllExternalFiles(Project project, @NotNull PsiElement visibilityContext) { + public static List findAllExternalFiles(Project project, @Nullable PsiElement visibilityContext) { List result = new ArrayList(); List visibleDjinniFiles = findAllDjinniFiles(project, visibilityContext); diff --git a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/_DjinniLexer.flex b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/_DjinniLexer.flex index e9a4f3d22..9c9bfb846 100644 --- a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/_DjinniLexer.flex +++ b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/_DjinniLexer.flex @@ -63,6 +63,12 @@ TEXT=[a-zA-Z_0-9]+ "set" { return SET; } "optional" { return OPTIONAL; } "map" { return MAP; } + "enum" { return ENUM; } + "record" { return RECORD; } + "eq" { return EQ_KEYWORD; } + "ord" { return ORD; } + "interface" { return INTERFACE; } + "static" { return STATIC; } {SPACE} { return SPACE; } {COMMENT} { return COMMENT; } diff --git a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/_DjinniLexer.java b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/_DjinniLexer.java index 520e22ad9..ed85de50d 100644 --- a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/_DjinniLexer.java +++ b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/_DjinniLexer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -/* The following code was generated by JFlex 1.4.3 on 8/12/15 1:36 PM */ +/* The following code was generated by JFlex 1.7.0 tweaked for IntelliJ platform */ package com.dropbox.djinni.ideaplugin; import com.intellij.lexer.*; @@ -23,12 +23,15 @@ /** - * This class is a scanner generated by - * JFlex 1.4.3 - * on 8/12/15 1:36 PM from the specification file - * /Users/jaetzold/src/idea/plugins/djinni/src/com/dropbox/djinni/ideaplugin/_DjinniLexer.flex + * This class is a scanner generated by + * JFlex 1.7.0 + * from the specification file _DjinniLexer.flex */ public class _DjinniLexer implements FlexLexer { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + /** initial size of the lookahead buffer */ private static final int ZZ_BUFFERSIZE = 16384; @@ -41,82 +44,133 @@ public class _DjinniLexer implements FlexLexer { * at the beginning of a line * l is of the form l = 2*k, k a non negative integer */ - private static final int ZZ_LEXSTATE[] = { + private static final int ZZ_LEXSTATE[] = { 0, 0 }; - /** - * Translates characters to character classes - */ - private static final String ZZ_CMAP_PACKED = - "\11\0\1\1\1\2\1\3\1\1\1\1\22\0\1\1\1\0\1\7"+ - "\1\4\3\0\1\5\1\27\1\30\1\0\1\22\1\21\1\10\1\12"+ - "\1\0\12\11\1\17\1\20\1\25\1\16\1\26\1\0\1\31\32\15"+ - "\1\0\1\6\2\0\1\14\1\0\1\42\3\15\1\36\3\15\1\33"+ - "\2\15\1\32\1\43\1\41\1\37\1\40\2\15\1\34\1\35\6\15"+ - "\1\23\1\0\1\24\54\0\1\13\12\0\1\13\4\0\1\13\5\0"+ - "\27\13\1\0\37\13\1\0\u013f\13\31\0\162\13\4\0\14\13\16\0"+ - "\5\13\11\0\1\13\213\0\1\13\13\0\1\13\1\0\3\13\1\0"+ - "\1\13\1\0\24\13\1\0\54\13\1\0\46\13\1\0\5\13\4\0"+ - "\202\13\10\0\105\13\1\0\46\13\2\0\2\13\6\0\20\13\41\0"+ - "\46\13\2\0\1\13\7\0\47\13\110\0\33\13\5\0\3\13\56\0"+ - "\32\13\5\0\13\13\43\0\2\13\1\0\143\13\1\0\1\13\17\0"+ - "\2\13\7\0\2\13\12\0\3\13\2\0\1\13\20\0\1\13\1\0"+ - "\36\13\35\0\3\13\60\0\46\13\13\0\1\13\u0152\0\66\13\3\0"+ - "\1\13\22\0\1\13\7\0\12\13\43\0\10\13\2\0\2\13\2\0"+ - "\26\13\1\0\7\13\1\0\1\13\3\0\4\13\3\0\1\13\36\0"+ - "\2\13\1\0\3\13\16\0\2\13\23\0\6\13\4\0\2\13\2\0"+ - "\26\13\1\0\7\13\1\0\2\13\1\0\2\13\1\0\2\13\37\0"+ - "\4\13\1\0\1\13\23\0\3\13\20\0\11\13\1\0\3\13\1\0"+ - "\26\13\1\0\7\13\1\0\2\13\1\0\5\13\3\0\1\13\22\0"+ - "\1\13\17\0\2\13\43\0\10\13\2\0\2\13\2\0\26\13\1\0"+ - "\7\13\1\0\2\13\1\0\5\13\3\0\1\13\36\0\2\13\1\0"+ - "\3\13\17\0\1\13\21\0\1\13\1\0\6\13\3\0\3\13\1\0"+ - "\4\13\3\0\2\13\1\0\1\13\1\0\2\13\3\0\2\13\3\0"+ - "\3\13\3\0\10\13\1\0\3\13\113\0\10\13\1\0\3\13\1\0"+ - "\27\13\1\0\12\13\1\0\5\13\46\0\2\13\43\0\10\13\1\0"+ - "\3\13\1\0\27\13\1\0\12\13\1\0\5\13\3\0\1\13\40\0"+ - "\1\13\1\0\2\13\43\0\10\13\1\0\3\13\1\0\27\13\1\0"+ - "\20\13\46\0\2\13\43\0\22\13\3\0\30\13\1\0\11\13\1\0"+ - "\1\13\2\0\7\13\72\0\60\13\1\0\2\13\14\0\7\13\72\0"+ - "\2\13\1\0\1\13\2\0\2\13\1\0\1\13\2\0\1\13\6\0"+ - "\4\13\1\0\7\13\1\0\3\13\1\0\1\13\1\0\1\13\2\0"+ - "\2\13\1\0\4\13\1\0\2\13\11\0\1\13\2\0\5\13\1\0"+ - "\1\13\25\0\2\13\42\0\1\13\77\0\10\13\1\0\42\13\35\0"+ - "\4\13\164\0\42\13\1\0\5\13\1\0\2\13\45\0\6\13\112\0"+ - "\46\13\12\0\51\13\7\0\132\13\5\0\104\13\5\0\122\13\6\0"+ - "\7\13\1\0\77\13\1\0\1\13\1\0\4\13\2\0\7\13\1\0"+ - "\1\13\1\0\4\13\2\0\47\13\1\0\1\13\1\0\4\13\2\0"+ - "\37\13\1\0\1\13\1\0\4\13\2\0\7\13\1\0\1\13\1\0"+ - "\4\13\2\0\7\13\1\0\7\13\1\0\27\13\1\0\37\13\1\0"+ - "\1\13\1\0\4\13\2\0\7\13\1\0\47\13\1\0\23\13\105\0"+ - "\125\13\14\0\u026c\13\2\0\10\13\12\0\32\13\5\0\113\13\25\0"+ - "\15\13\1\0\4\13\16\0\22\13\16\0\22\13\16\0\15\13\1\0"+ - "\3\13\17\0\64\13\43\0\1\13\4\0\1\13\103\0\130\13\10\0"+ - "\51\13\127\0\35\13\63\0\36\13\2\0\5\13\u038b\0\154\13\224\0"+ - "\234\13\4\0\132\13\6\0\26\13\2\0\6\13\2\0\46\13\2\0"+ - "\6\13\2\0\10\13\1\0\1\13\1\0\1\13\1\0\1\13\1\0"+ - "\37\13\2\0\65\13\1\0\7\13\1\0\1\13\3\0\3\13\1\0"+ - "\7\13\3\0\4\13\2\0\6\13\4\0\15\13\5\0\3\13\1\0"+ - "\7\13\164\0\1\13\15\0\1\13\202\0\1\13\4\0\1\13\2\0"+ - "\12\13\1\0\1\13\3\0\5\13\6\0\1\13\1\0\1\13\1\0"+ - "\1\13\1\0\4\13\1\0\3\13\1\0\7\13\3\0\3\13\5\0"+ - "\5\13\u0ebb\0\2\13\52\0\5\13\5\0\2\13\4\0\126\13\6\0"+ - "\3\13\1\0\132\13\1\0\4\13\5\0\50\13\4\0\136\13\21\0"+ - "\30\13\70\0\20\13\u0200\0\u19b6\13\112\0\u51a6\13\132\0\u048d\13\u0773\0"+ - "\u2ba4\13\u215c\0\u012e\13\2\0\73\13\225\0\7\13\14\0\5\13\5\0"+ - "\1\13\1\0\12\13\1\0\15\13\1\0\5\13\1\0\1\13\1\0"+ - "\2\13\1\0\2\13\1\0\154\13\41\0\u016b\13\22\0\100\13\2\0"+ - "\66\13\50\0\14\13\164\0\5\13\1\0\207\13\44\0\32\13\6\0"+ - "\32\13\13\0\131\13\3\0\6\13\2\0\6\13\2\0\6\13\2\0"+ - "\3\13\43\0"; - - /** + /** * Translates characters to character classes + * Chosen bits are [11, 6, 4] + * Total runtime size is 14112 bytes */ - private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + public static int ZZ_CMAP(int ch) { + return ZZ_CMAP_A[(ZZ_CMAP_Y[(ZZ_CMAP_Z[ch>>10]<<6)|((ch>>4)&0x3f)]<<4)|(ch&0xf)]; + } - /** + /* The ZZ_CMAP_Z table has 1088 entries */ + static final char ZZ_CMAP_Z[] = zzUnpackCMap( + "\1\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7\1\10\2\11\1\12\1\13\6\14\1\15\23\14\1\16"+ + "\1\14\1\17\1\20\12\14\1\21\10\11\1\22\1\23\1\24\1\25\1\26\1\27\1\30\1\31\1"+ + "\32\1\33\1\34\1\35\2\11\1\14\1\36\3\11\1\37\10\11\1\40\1\41\5\14\1\42\1\43"+ + "\11\11\1\44\2\11\1\45\5\11\1\46\4\11\1\47\1\50\4\11\51\14\1\51\3\14\1\52\1"+ + "\53\4\14\1\54\12\11\1\55\u0381\11"); + + /* The ZZ_CMAP_Y table has 2944 entries */ + static final char ZZ_CMAP_Y[] = zzUnpackCMap( + "\1\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\1\1\11\1\12\1\13\1\14\1\13\1\14\34"+ + "\13\1\15\1\16\1\17\10\1\1\20\1\21\1\13\1\22\4\13\1\23\10\13\1\24\12\13\1\25"+ + "\1\13\1\26\1\25\1\13\1\27\4\1\1\13\1\30\1\31\2\1\2\13\1\30\1\1\1\32\1\25\5"+ + "\13\1\33\1\34\1\35\1\1\1\36\1\13\1\1\1\37\5\13\1\40\1\41\1\42\1\13\1\30\1"+ + "\43\1\13\1\44\1\45\1\1\1\13\1\46\4\1\1\13\1\47\4\1\1\50\2\13\1\51\1\1\1\52"+ + "\1\16\1\25\1\53\1\54\1\55\1\56\1\57\1\60\2\16\1\61\1\54\1\55\1\62\1\1\1\63"+ + "\1\1\1\64\1\65\1\22\1\55\1\66\1\1\1\67\1\16\1\70\1\71\1\54\1\55\1\66\1\1\1"+ + "\60\1\16\1\41\1\72\1\73\1\74\1\75\1\1\1\67\2\1\1\76\1\36\1\55\1\51\1\1\1\77"+ + "\1\16\1\1\1\100\1\36\1\55\1\101\1\1\1\57\1\16\1\102\1\76\1\36\1\13\1\103\1"+ + "\57\1\104\1\16\1\42\1\105\1\106\1\13\1\107\1\110\3\1\1\25\2\13\1\111\1\110"+ + "\3\1\1\112\1\113\1\114\1\115\1\116\1\117\2\1\1\67\3\1\1\120\1\13\1\121\1\1"+ + "\1\122\7\1\2\13\1\30\1\123\1\1\1\124\1\125\1\126\1\127\1\1\2\13\1\130\2\13"+ + "\1\131\24\13\1\132\1\133\2\13\1\132\2\13\1\134\1\135\1\14\3\13\1\135\3\13"+ + "\1\30\2\1\1\13\1\1\5\13\1\136\1\25\45\13\1\137\1\13\1\25\1\30\4\13\1\30\1"+ + "\140\1\141\1\16\1\13\1\16\1\13\1\16\1\141\1\67\3\13\1\142\1\1\1\143\4\1\5"+ + "\13\1\27\1\144\1\13\1\145\4\13\1\40\1\13\1\146\3\1\1\13\1\147\1\150\2\13\1"+ + "\151\1\13\1\75\3\1\1\13\1\110\3\13\1\150\4\1\1\152\5\1\1\105\2\13\1\142\1"+ + "\153\3\1\1\154\1\13\1\155\1\42\2\13\1\40\1\1\2\13\1\142\1\1\1\37\1\42\1\13"+ + "\1\147\1\46\5\1\1\156\1\157\14\13\4\1\21\13\1\136\2\13\1\136\1\160\1\13\1"+ + "\147\3\13\1\161\1\162\1\163\1\121\1\162\2\1\1\164\4\1\1\165\1\1\1\121\6\1"+ + "\1\166\1\167\1\170\1\171\1\172\3\1\1\173\147\1\2\13\1\146\2\13\1\146\10\13"+ + "\1\174\1\175\2\13\1\130\3\13\1\176\1\1\1\13\1\110\4\177\4\1\1\123\35\1\1\200"+ + "\2\1\1\201\1\25\4\13\1\202\1\25\4\13\1\131\1\105\1\13\1\147\1\25\4\13\1\146"+ + "\1\1\1\13\1\30\3\1\1\13\40\1\133\13\1\40\4\1\135\13\1\40\2\1\10\13\1\121\4"+ + "\1\2\13\1\147\20\13\1\121\1\13\1\203\1\1\2\13\1\146\1\123\1\13\1\147\4\13"+ + "\1\40\2\1\1\204\1\205\5\13\1\206\1\13\1\146\1\27\3\1\1\204\1\207\1\13\1\31"+ + "\1\1\3\13\1\142\1\205\2\13\1\142\3\1\1\210\1\42\1\13\1\40\1\13\1\110\1\1\1"+ + "\13\1\121\1\50\2\13\1\31\1\123\1\1\1\211\1\212\2\13\1\46\1\1\1\213\1\1\1\13"+ + "\1\214\3\13\1\215\1\216\1\217\1\30\1\64\1\220\1\221\1\177\2\13\1\131\1\40"+ + "\7\13\1\31\1\1\72\13\1\142\1\13\1\222\2\13\1\151\20\1\26\13\1\147\6\13\1\75"+ + "\2\1\1\110\1\223\1\55\1\224\1\225\6\13\1\16\1\1\1\154\25\13\1\147\1\1\4\13"+ + "\1\205\2\13\1\27\2\1\1\151\7\1\1\211\7\13\1\121\2\1\1\25\1\30\1\25\1\30\1"+ + "\226\4\13\1\146\1\227\1\230\2\1\1\231\1\13\1\14\1\232\2\147\2\1\7\13\1\30"+ + "\30\1\1\13\1\121\3\13\1\67\2\1\2\13\1\1\1\13\1\233\2\13\1\40\1\13\1\147\2"+ + "\13\1\234\3\1\11\13\1\147\1\1\2\13\1\234\1\13\1\151\2\13\1\27\3\13\1\142\11"+ + "\1\23\13\1\110\1\13\1\40\1\27\11\1\1\235\2\13\1\236\1\13\1\40\1\13\1\110\1"+ + "\13\1\146\4\1\1\13\1\237\1\13\1\40\1\13\1\75\4\1\3\13\1\240\4\1\1\67\1\241"+ + "\1\13\1\142\2\1\1\13\1\121\1\13\1\121\2\1\1\120\1\13\1\150\1\1\3\13\1\40\1"+ + "\13\1\40\1\13\1\31\1\13\1\16\6\1\4\13\1\46\3\1\3\13\1\31\3\13\1\31\60\1\1"+ + "\154\2\13\1\27\4\1\1\154\2\13\2\1\1\13\1\46\1\1\1\154\1\13\1\110\2\1\2\13"+ + "\1\242\1\154\2\13\1\31\1\243\1\244\2\1\1\13\1\22\1\151\5\1\1\245\1\246\1\46"+ + "\2\13\1\146\2\1\1\71\1\54\1\55\1\66\1\1\1\247\1\16\11\1\3\13\1\150\1\250\3"+ + "\1\3\13\1\1\1\251\13\1\2\13\1\146\2\1\1\252\2\1\3\13\1\1\1\253\3\1\2\13\1"+ + "\30\5\1\1\13\1\75\30\1\4\13\1\1\1\123\34\1\3\13\1\46\20\1\1\55\1\13\1\146"+ + "\1\1\1\67\2\1\1\205\1\13\67\1\71\13\1\75\16\1\14\13\1\142\53\1\2\13\1\146"+ + "\75\1\44\13\1\110\33\1\43\13\1\46\1\13\1\146\7\1\1\13\1\147\1\1\3\13\1\1\1"+ + "\142\1\1\1\154\1\254\1\13\67\1\4\13\1\150\1\67\3\1\1\154\4\1\1\67\1\1\76\13"+ + "\1\121\1\1\57\13\1\31\20\1\1\16\77\1\6\13\1\30\1\121\1\46\1\75\66\1\5\13\1"+ + "\211\3\13\1\141\1\255\1\256\1\257\3\13\1\260\1\261\1\13\1\262\1\263\1\36\24"+ + "\13\1\264\1\13\1\36\1\131\1\13\1\131\1\13\1\211\1\13\1\211\1\146\1\13\1\146"+ + "\1\13\1\55\1\13\1\55\1\13\1\213\3\1\14\13\1\150\3\1\4\13\1\142\113\1\1\257"+ + "\1\13\1\265\1\266\1\267\1\270\1\271\1\272\1\273\1\151\1\274\1\151\24\1\55"+ + "\13\1\110\2\1\103\13\1\150\15\13\1\147\150\13\1\16\25\1\41\13\1\147\36\1"); + + /* The ZZ_CMAP_A table has 3024 entries */ + static final char ZZ_CMAP_A[] = zzUnpackCMap( + "\11\0\1\2\1\1\1\3\2\1\22\0\1\2\1\0\1\10\1\4\3\0\1\6\1\30\1\31\1\0\1\23\1\22"+ + "\1\11\1\13\1\0\12\12\1\20\1\21\1\26\1\17\1\27\1\0\1\32\32\16\1\0\1\7\2\0\1"+ + "\15\1\0\1\43\1\16\1\47\1\50\1\37\1\52\2\16\1\34\2\16\1\33\1\44\1\42\1\40\1"+ + "\41\1\51\1\46\1\35\1\36\1\45\5\16\1\24\1\0\1\25\7\0\1\5\24\0\1\14\12\0\1\14"+ + "\4\0\1\14\5\0\27\14\1\0\12\14\4\0\14\14\16\0\5\14\7\0\1\14\1\0\1\14\1\0\5"+ + "\14\1\0\2\14\2\0\4\14\1\0\1\14\6\0\1\14\1\0\3\14\1\0\1\14\1\0\4\14\1\0\23"+ + "\14\1\0\13\14\10\0\6\14\1\0\26\14\2\0\1\14\6\0\10\14\10\0\13\14\5\0\3\14\33"+ + "\0\6\14\1\0\1\14\17\0\2\14\7\0\2\14\12\0\3\14\2\0\2\14\1\0\16\14\15\0\11\14"+ + "\13\0\1\14\30\0\6\14\4\0\2\14\4\0\1\14\5\0\6\14\4\0\1\14\11\0\1\14\3\0\1\14"+ + "\7\0\11\14\7\0\5\14\1\0\10\14\6\0\26\14\3\0\1\14\2\0\1\14\7\0\11\14\4\0\10"+ + "\14\2\0\2\14\2\0\26\14\1\0\7\14\1\0\1\14\3\0\4\14\3\0\1\14\20\0\1\14\15\0"+ + "\2\14\1\0\1\14\5\0\6\14\4\0\2\14\1\0\2\14\1\0\2\14\1\0\2\14\17\0\4\14\1\0"+ + "\1\14\3\0\3\14\20\0\11\14\1\0\2\14\1\0\2\14\1\0\5\14\3\0\1\14\2\0\1\14\30"+ + "\0\1\14\13\0\10\14\2\0\1\14\3\0\1\14\1\0\6\14\3\0\3\14\1\0\4\14\3\0\2\14\1"+ + "\0\1\14\1\0\2\14\3\0\2\14\3\0\3\14\3\0\14\14\13\0\10\14\1\0\2\14\10\0\3\14"+ + "\5\0\1\14\4\0\10\14\1\0\6\14\1\0\5\14\3\0\1\14\3\0\2\14\15\0\13\14\2\0\1\14"+ + "\6\0\3\14\10\0\1\14\5\0\22\14\3\0\10\14\1\0\11\14\1\0\1\14\2\0\7\14\11\0\1"+ + "\14\1\0\2\14\15\0\2\14\1\0\1\14\2\0\2\14\1\0\1\14\2\0\1\14\6\0\4\14\1\0\7"+ + "\14\1\0\3\14\1\0\1\14\1\0\1\14\2\0\2\14\1\0\4\14\1\0\2\14\11\0\1\14\2\0\5"+ + "\14\1\0\1\14\25\0\14\14\1\0\24\14\13\0\5\14\22\0\7\14\4\0\4\14\3\0\1\14\3"+ + "\0\2\14\7\0\3\14\4\0\15\14\14\0\1\14\1\0\6\14\1\0\1\14\5\0\1\14\2\0\13\14"+ + "\1\0\15\14\1\0\4\14\2\0\7\14\1\0\1\14\1\0\4\14\2\0\1\14\1\0\4\14\2\0\7\14"+ + "\1\0\1\14\1\0\4\14\2\0\16\14\2\0\6\14\2\0\15\14\2\0\1\14\1\0\10\14\7\0\15"+ + "\14\1\0\6\14\23\0\1\14\4\0\1\14\3\0\5\14\2\0\22\14\1\0\1\14\5\0\17\14\1\0"+ + "\16\14\2\0\5\14\13\0\14\14\13\0\1\14\15\0\7\14\7\0\16\14\15\0\2\14\11\0\4"+ + "\14\1\0\4\14\3\0\2\14\11\0\10\14\1\0\1\14\1\0\1\14\1\0\1\14\1\0\6\14\1\0\7"+ + "\14\1\0\1\14\3\0\3\14\1\0\7\14\3\0\4\14\2\0\6\14\14\0\2\5\7\0\1\14\15\0\1"+ + "\14\2\0\1\14\4\0\1\14\2\0\12\14\1\0\1\14\3\0\5\14\6\0\1\14\1\0\1\14\1\0\1"+ + "\14\1\0\4\14\1\0\13\14\2\0\4\14\5\0\5\14\4\0\1\14\4\0\2\14\13\0\5\14\6\0\4"+ + "\14\3\0\2\14\14\0\10\14\7\0\10\14\1\0\7\14\6\0\2\14\12\0\5\14\5\0\2\14\3\0"+ + "\7\14\6\0\3\14\12\0\2\14\13\0\11\14\2\0\27\14\2\0\7\14\1\0\3\14\1\0\4\14\1"+ + "\0\4\14\2\0\6\14\3\0\1\14\1\0\1\14\2\0\5\14\1\0\12\14\12\0\5\14\1\0\3\14\1"+ + "\0\10\14\4\0\7\14\3\0\1\14\3\0\2\14\1\0\1\14\3\0\2\14\2\0\5\14\2\0\1\14\1"+ + "\0\1\14\30\0\3\14\3\0\6\14\2\0\6\14\2\0\6\14\11\0\7\14\4\0\5\14\3\0\5\14\5"+ + "\0\1\14\1\0\10\14\1\0\5\14\1\0\1\14\1\0\2\14\1\0\2\14\1\0\12\14\6\0\12\14"+ + "\2\0\6\14\2\0\6\14\2\0\6\14\2\0\3\14\3\0\14\14\1\0\16\14\1\0\2\14\1\0\2\14"+ + "\1\0\10\14\6\0\4\14\4\0\16\14\2\0\1\14\1\0\14\14\1\0\2\14\3\0\1\14\2\0\4\14"+ + "\1\0\2\14\12\0\10\14\6\0\6\14\1\0\3\14\1\0\12\14\3\0\1\14\12\0\4\14\25\0\1"+ + "\14\1\0\1\14\3\0\7\14\1\0\1\14\1\0\4\14\1\0\17\14\1\0\2\14\14\0\3\14\7\0\4"+ + "\14\11\0\2\14\1\0\1\14\20\0\4\14\10\0\1\14\13\0\10\14\5\0\3\14\2\0\1\14\2"+ + "\0\2\14\2\0\4\14\1\0\14\14\1\0\1\14\1\0\7\14\1\0\21\14\1\0\4\14\2\0\10\14"+ + "\1\0\7\14\1\0\14\14\1\0\4\14\1\0\5\14\1\0\1\14\3\0\14\14\2\0\10\14\1\0\2\14"+ + "\1\0\1\14\2\0\1\14\1\0\12\14\1\0\4\14\1\0\1\14\1\0\1\14\6\0\1\14\4\0\1\14"+ + "\1\0\1\14\1\0\1\14\1\0\3\14\1\0\2\14\1\0\1\14\2\0\1\14\1\0\1\14\1\0\1\14\1"+ + "\0\1\14\1\0\1\14\1\0\2\14\1\0\1\14\2\0\4\14\1\0\7\14\1\0\4\14\1\0\4\14\1\0"+ + "\1\14\1\0\12\14\1\0\5\14\1\0\3\14\1\0\5\14\1\0\5\14"); + + /** * Translates DFA states to action switch labels. */ private static final int [] ZZ_ACTION = zzUnpackAction(); @@ -124,12 +178,13 @@ public class _DjinniLexer implements FlexLexer { private static final String ZZ_ACTION_PACKED_0 = "\1\0\1\1\1\2\1\3\1\4\3\1\1\5\1\1"+ "\1\6\1\7\1\10\1\11\1\12\1\13\1\14\1\15"+ - "\1\16\1\17\1\20\1\21\1\22\1\23\4\6\1\0"+ - "\1\24\3\0\2\5\4\6\1\24\1\6\1\25\1\6"+ - "\1\26\1\27\4\6\1\30"; + "\1\16\1\17\1\20\1\21\1\22\1\23\7\6\1\0"+ + "\1\24\3\0\2\5\5\6\1\25\4\6\1\24\3\6"+ + "\1\26\2\6\1\27\1\30\1\6\1\31\2\6\1\32"+ + "\7\6\1\33\1\6\1\34\3\6\1\35\1\36"; private static int [] zzUnpackAction() { - int [] result = new int[50]; + int [] result = new int[77]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -148,22 +203,25 @@ private static int zzUnpackAction(String packed, int offset, int [] result) { } - /** + /** * Translates a state to a row index in the transition table */ private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); private static final String ZZ_ROWMAP_PACKED_0 = - "\0\0\0\44\0\110\0\154\0\220\0\264\0\330\0\374"+ - "\0\u0120\0\u0144\0\u0168\0\u018c\0\44\0\44\0\44\0\44"+ - "\0\44\0\44\0\44\0\44\0\44\0\44\0\44\0\44"+ - "\0\u01b0\0\u01d4\0\u01f8\0\u021c\0\264\0\44\0\u0240\0\330"+ - "\0\u0264\0\u0288\0\u0144\0\u02ac\0\u02d0\0\u02f4\0\u0318\0\330"+ - "\0\u033c\0\u0168\0\u0360\0\u0168\0\u0168\0\u0384\0\u03a8\0\u03cc"+ - "\0\u03f0\0\u0168"; + "\0\0\0\53\0\126\0\201\0\254\0\327\0\u0102\0\u012d"+ + "\0\u0158\0\u0183\0\u01ae\0\u01d9\0\53\0\53\0\53\0\53"+ + "\0\53\0\53\0\53\0\53\0\53\0\53\0\53\0\53"+ + "\0\u0204\0\u022f\0\u025a\0\u0285\0\u02b0\0\u02db\0\u0306\0\327"+ + "\0\53\0\u0331\0\u0102\0\u035c\0\u0387\0\u0183\0\u03b2\0\u03dd"+ + "\0\u0408\0\u0433\0\u045e\0\u01ae\0\u0489\0\u04b4\0\u04df\0\u050a"+ + "\0\u0102\0\u0535\0\u0560\0\u058b\0\u01ae\0\u05b6\0\u05e1\0\u01ae"+ + "\0\u01ae\0\u060c\0\u01ae\0\u0637\0\u0662\0\u01ae\0\u068d\0\u06b8"+ + "\0\u06e3\0\u070e\0\u0739\0\u0764\0\u078f\0\u01ae\0\u07ba\0\u01ae"+ + "\0\u07e5\0\u0810\0\u083b\0\u01ae\0\u01ae"; private static int [] zzUnpackRowMap() { - int [] result = new int[50]; + int [] result = new int[77]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -180,40 +238,63 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) { return j; } - /** + /** * The transition table of the DFA */ private static final int [] ZZ_TRANS = zzUnpackTrans(); private static final String ZZ_TRANS_PACKED_0 = - "\1\2\2\3\1\4\1\5\1\6\1\2\1\7\1\10"+ - "\1\11\1\12\1\13\1\14\1\13\1\15\1\16\1\17"+ - "\1\20\1\21\1\22\1\23\1\24\1\25\1\26\1\27"+ - "\1\30\1\31\1\13\1\32\2\13\1\33\3\13\1\34"+ - "\45\0\2\3\1\4\41\0\3\4\40\0\2\5\1\0"+ - "\41\5\5\35\1\36\1\37\35\35\6\40\1\41\1\36"+ - "\34\40\11\0\1\42\43\0\1\11\1\43\1\0\2\14"+ - "\14\0\12\14\11\0\1\43\43\0\1\13\2\0\2\13"+ - "\14\0\12\13\11\0\1\14\2\0\2\14\14\0\12\14"+ - "\11\0\1\13\2\0\2\13\14\0\1\13\1\44\10\13"+ - "\11\0\1\13\2\0\2\13\14\0\4\13\1\45\5\13"+ - "\11\0\1\13\2\0\2\13\14\0\6\13\1\46\3\13"+ - "\11\0\1\13\2\0\2\13\14\0\10\13\1\47\1\13"+ - "\2\35\1\0\41\35\6\40\1\41\1\50\34\40\11\0"+ - "\1\42\1\43\42\0\1\13\2\0\2\13\14\0\2\13"+ - "\1\51\7\13\11\0\1\13\2\0\2\13\14\0\3\13"+ - "\1\52\6\13\11\0\1\13\2\0\2\13\14\0\3\13"+ - "\1\53\6\13\11\0\1\13\2\0\2\13\14\0\6\13"+ - "\1\54\3\13\11\0\1\13\2\0\2\13\14\0\3\13"+ - "\1\55\6\13\11\0\1\13\2\0\2\13\14\0\1\13"+ - "\1\56\10\13\11\0\1\13\2\0\2\13\14\0\5\13"+ - "\1\57\4\13\11\0\1\13\2\0\2\13\14\0\7\13"+ - "\1\60\2\13\11\0\1\13\2\0\2\13\14\0\10\13"+ - "\1\61\1\13\11\0\1\13\2\0\2\13\14\0\1\62"+ - "\11\13"; + "\1\2\2\3\1\4\1\5\1\2\1\6\1\2\1\7"+ + "\1\10\1\11\1\12\1\13\1\14\1\13\1\15\1\16"+ + "\1\17\1\20\1\21\1\22\1\23\1\24\1\25\1\26"+ + "\1\27\1\30\1\31\1\32\1\33\1\13\1\34\1\35"+ + "\3\13\1\36\1\13\1\37\4\13\54\0\2\3\1\4"+ + "\50\0\3\4\47\0\1\5\1\0\1\5\1\0\1\5"+ + "\1\0\45\5\6\40\1\41\1\42\43\40\7\43\1\44"+ + "\1\41\42\43\12\0\1\45\52\0\1\11\1\46\1\0"+ + "\2\14\14\0\20\14\12\0\1\46\52\0\1\13\2\0"+ + "\2\13\14\0\20\13\12\0\1\14\2\0\2\14\14\0"+ + "\20\14\12\0\1\13\2\0\2\13\14\0\1\13\1\47"+ + "\16\13\12\0\1\13\2\0\2\13\14\0\7\13\1\50"+ + "\10\13\12\0\1\13\2\0\2\13\14\0\3\13\1\51"+ + "\1\52\13\13\12\0\1\13\2\0\2\13\14\0\7\13"+ + "\1\53\6\13\1\54\1\13\12\0\1\13\2\0\2\13"+ + "\14\0\6\13\1\55\4\13\1\56\4\13\12\0\1\13"+ + "\2\0\2\13\14\0\10\13\1\57\7\13\12\0\1\13"+ + "\2\0\2\13\14\0\4\13\1\60\13\13\1\40\1\0"+ + "\1\40\1\0\1\40\1\0\45\40\7\43\1\44\1\61"+ + "\42\43\12\0\1\45\1\46\51\0\1\13\2\0\2\13"+ + "\14\0\2\13\1\62\15\13\12\0\1\13\2\0\2\13"+ + "\14\0\3\13\1\63\14\13\12\0\1\13\2\0\2\13"+ + "\14\0\10\13\1\64\7\13\12\0\1\13\2\0\2\13"+ + "\14\0\3\13\1\65\14\13\12\0\1\13\2\0\2\13"+ + "\14\0\12\13\1\66\5\13\12\0\1\13\2\0\2\13"+ + "\14\0\3\13\1\67\14\13\12\0\1\13\2\0\2\13"+ + "\14\0\15\13\1\70\2\13\12\0\1\13\2\0\2\13"+ + "\14\0\6\13\1\71\11\13\12\0\1\13\2\0\2\13"+ + "\14\0\14\13\1\72\3\13\12\0\1\13\2\0\2\13"+ + "\14\0\3\13\1\73\14\13\12\0\1\13\2\0\2\13"+ + "\14\0\4\13\1\74\13\13\12\0\1\13\2\0\2\13"+ + "\14\0\3\13\1\75\14\13\12\0\1\13\2\0\2\13"+ + "\14\0\11\13\1\76\6\13\12\0\1\13\2\0\2\13"+ + "\14\0\1\13\1\77\16\13\12\0\1\13\2\0\2\13"+ + "\14\0\5\13\1\100\12\13\12\0\1\13\2\0\2\13"+ + "\14\0\13\13\1\101\4\13\12\0\1\13\2\0\2\13"+ + "\14\0\1\13\1\102\16\13\12\0\1\13\2\0\2\13"+ + "\14\0\5\13\1\103\12\13\12\0\1\13\2\0\2\13"+ + "\14\0\13\13\1\104\4\13\12\0\1\13\2\0\2\13"+ + "\14\0\17\13\1\105\12\0\1\13\2\0\2\13\14\0"+ + "\14\13\1\106\3\13\12\0\1\13\2\0\2\13\14\0"+ + "\7\13\1\107\10\13\12\0\1\13\2\0\2\13\14\0"+ + "\15\13\1\110\2\13\12\0\1\13\2\0\2\13\14\0"+ + "\10\13\1\111\7\13\12\0\1\13\2\0\2\13\14\0"+ + "\10\13\1\112\7\13\12\0\1\13\2\0\2\13\14\0"+ + "\14\13\1\113\3\13\12\0\1\13\2\0\2\13\14\0"+ + "\1\114\17\13\12\0\1\13\2\0\2\13\14\0\4\13"+ + "\1\115\13\13"; private static int [] zzUnpackTrans() { - int [] result = new int[1044]; + int [] result = new int[2150]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -237,12 +318,9 @@ private static int zzUnpackTrans(String packed, int offset, int [] result) { private static final int ZZ_UNKNOWN_ERROR = 0; private static final int ZZ_NO_MATCH = 1; private static final int ZZ_PUSHBACK_2BIG = 2; - private static final char[] EMPTY_BUFFER = new char[0]; - private static final int YYEOF = -1; - private static java.io.Reader zzReader = null; // Fake /* error messages for the codes above */ - private static final String ZZ_ERROR_MSG[] = { + private static final String[] ZZ_ERROR_MSG = { "Unknown internal scanner error", "Error: could not match input", "Error: pushback value was too large" @@ -254,11 +332,11 @@ private static int zzUnpackTrans(String packed, int offset, int [] result) { private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); private static final String ZZ_ATTRIBUTE_PACKED_0 = - "\1\0\1\11\12\1\14\11\4\1\1\0\1\11\3\0"+ - "\21\1"; + "\1\0\1\11\12\1\14\11\7\1\1\0\1\11\3\0"+ + "\51\1"; private static int [] zzUnpackAttribute() { - int [] result = new int[50]; + int [] result = new int[77]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -276,6 +354,9 @@ private static int zzUnpackAttribute(String packed, int offset, int [] result) { return j; } + /** the input device */ + private java.io.Reader zzReader; + /** the current state of the DFA */ private int zzState; @@ -286,15 +367,9 @@ private static int zzUnpackAttribute(String packed, int offset, int [] result) { the source of the yytext() string */ private CharSequence zzBuffer = ""; - /** this buffer may contains the current text array to be matched when it is cheap to acquire it */ - private char[] zzBufferArray; - /** the textposition at the last accepting state */ private int zzMarkedPos; - /** the textposition at the last state to be included in yytext */ - private int zzPushbackPos; - /** the current text position in the buffer */ private int zzCurrentPos; @@ -313,6 +388,9 @@ the source of the yytext() string */ /** zzAtEOF == true <=> the scanner is at the EOF */ private boolean zzAtEOF; + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + /* user code: */ public _DjinniLexer() { this((java.io.Reader)null); @@ -329,17 +407,21 @@ public _DjinniLexer(java.io.Reader in) { } - /** + /** * Unpacks the compressed character translation table. * * @param packed the packed character translation table * @return the unpacked character translation table */ private static char [] zzUnpackCMap(String packed) { - char [] map = new char[0x10000]; + int size = 0; + for (int i = 0, length = packed.length(); i < length; i += 2) { + size += packed.charAt(i); + } + char[] map = new char[size]; int i = 0; /* index in packed string */ int j = 0; /* index in unpacked array */ - while (i < 1204) { + while (i < packed.length()) { int count = packed.charAt(i++); char value = packed.charAt(i++); do map[j++] = value; while (--count > 0); @@ -347,19 +429,17 @@ public _DjinniLexer(java.io.Reader in) { return map; } - public final int getTokenStart(){ + public final int getTokenStart() { return zzStartRead; } - public final int getTokenEnd(){ + public final int getTokenEnd() { return getTokenStart() + yylength(); } - public void reset(CharSequence buffer, int start, int end,int initialState){ + public void reset(CharSequence buffer, int start, int end, int initialState) { zzBuffer = buffer; - zzBufferArray = com.intellij.util.text.CharArrayUtil.fromSequenceWithoutCopying(buffer); zzCurrentPos = zzMarkedPos = zzStartRead = start; - zzPushbackPos = 0; zzAtEOF = false; zzAtBOL = true; zzEndRead = end; @@ -416,7 +496,7 @@ public final CharSequence yytext() { * @return the character at position pos */ public final char yycharat(int pos) { - return zzBufferArray != null ? zzBufferArray[zzStartRead+pos]:zzBuffer.charAt(zzStartRead+pos); + return zzBuffer.charAt(zzStartRead+pos); } @@ -429,7 +509,7 @@ public final int yylength() { /** - * Reports an error that occurred while scanning. + * Reports an error that occured while scanning. * * In a wellformed scanner (no or only correct usage of * yypushback(int) and a match-all fallback rule) this method @@ -487,8 +567,6 @@ public IElementType advance() throws java.io.IOException { int zzMarkedPosL; int zzEndReadL = zzEndRead; CharSequence zzBufferL = zzBuffer; - char[] zzBufferArrayL = zzBufferArray; - char [] zzCMapL = ZZ_CMAP; int [] zzTransL = ZZ_TRANS; int [] zzRowMapL = ZZ_ROWMAP; @@ -503,12 +581,20 @@ public IElementType advance() throws java.io.IOException { zzState = ZZ_LEXSTATE[zzLexicalState]; + // set up zzAction for empty match case: + int zzAttributes = zzAttrL[zzState]; + if ( (zzAttributes & 1) == 1 ) { + zzAction = zzState; + } + zzForAction: { while (true) { - if (zzCurrentPosL < zzEndReadL) - zzInput = (zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++)); + if (zzCurrentPosL < zzEndReadL) { + zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/); + zzCurrentPosL += Character.charCount(zzInput); + } else if (zzAtEOF) { zzInput = YYEOF; break zzForAction; @@ -528,14 +614,15 @@ else if (zzAtEOF) { break zzForAction; } else { - zzInput = (zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++)); + zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/); + zzCurrentPosL += Character.charCount(zzInput); } } - int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; + int zzNext = zzTransL[ zzRowMapL[zzState] + ZZ_CMAP(zzInput) ]; if (zzNext == -1) break zzForAction; zzState = zzNext; - int zzAttributes = zzAttrL[zzState]; + zzAttributes = zzAttrL[zzState]; if ( (zzAttributes & 1) == 1 ) { zzAction = zzState; zzMarkedPosL = zzCurrentPosL; @@ -548,109 +635,163 @@ else if (zzAtEOF) { // store back cached position zzMarkedPos = zzMarkedPosL; - switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { - case 17: - { return LEFT_PARAM_BRACE; - } - case 25: break; - case 14: - { return RIGHT_BLOCK_BRACE; - } - case 26: break; - case 4: - { return COMMENT; - } - case 27: break; - case 22: - { return MAP; - } - case 28: break; - case 6: - { return IDENTIFIER; - } - case 29: break; - case 24: - { return OPTIONAL; - } - case 30: break; - case 1: - { return com.intellij.psi.TokenType.BAD_CHARACTER; - } - case 31: break; - case 12: - { return PLUS; - } - case 32: break; - case 11: - { return LIST_SEPARATOR; - } - case 33: break; - case 9: - { return COLON; - } - case 34: break; - case 20: - { return STRING_LITERAL; - } - case 35: break; - case 13: - { return LEFT_BLOCK_BRACE; - } - case 36: break; - case 19: - { return AT; - } - case 37: break; - case 21: - { return SET; - } - case 38: break; - case 23: - { return LIST; - } - case 39: break; - case 10: - { return SEMICOLON; - } - case 40: break; - case 18: - { return RIGHT_PARAM_BRACE; - } - case 41: break; - case 15: - { return LEFT_GENERICS_BRACE; - } - case 42: break; - case 16: - { return RIGHT_GENERICS_BRACE; - } - case 43: break; - case 8: - { return EQ; - } - case 44: break; - case 3: - { return SPACE; - } - case 45: break; - case 7: - { return TEXT; - } - case 46: break; - case 5: - { return NUMBER_LITERAL; - } - case 47: break; - case 2: - { return com.intellij.psi.TokenType.WHITE_SPACE; - } - case 48: break; - default: - if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { - zzAtEOF = true; - return null; - } - else { + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + return null; + } + else { + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 1: + { return com.intellij.psi.TokenType.BAD_CHARACTER; + } + // fall through + case 31: break; + case 2: + { return com.intellij.psi.TokenType.WHITE_SPACE; + } + // fall through + case 32: break; + case 3: + { return SPACE; + } + // fall through + case 33: break; + case 4: + { return COMMENT; + } + // fall through + case 34: break; + case 5: + { return NUMBER_LITERAL; + } + // fall through + case 35: break; + case 6: + { return IDENTIFIER; + } + // fall through + case 36: break; + case 7: + { return TEXT; + } + // fall through + case 37: break; + case 8: + { return EQ; + } + // fall through + case 38: break; + case 9: + { return COLON; + } + // fall through + case 39: break; + case 10: + { return SEMICOLON; + } + // fall through + case 40: break; + case 11: + { return LIST_SEPARATOR; + } + // fall through + case 41: break; + case 12: + { return PLUS; + } + // fall through + case 42: break; + case 13: + { return LEFT_BLOCK_BRACE; + } + // fall through + case 43: break; + case 14: + { return RIGHT_BLOCK_BRACE; + } + // fall through + case 44: break; + case 15: + { return LEFT_GENERICS_BRACE; + } + // fall through + case 45: break; + case 16: + { return RIGHT_GENERICS_BRACE; + } + // fall through + case 46: break; + case 17: + { return LEFT_PARAM_BRACE; + } + // fall through + case 47: break; + case 18: + { return RIGHT_PARAM_BRACE; + } + // fall through + case 48: break; + case 19: + { return AT; + } + // fall through + case 49: break; + case 20: + { return STRING_LITERAL; + } + // fall through + case 50: break; + case 21: + { return EQ_KEYWORD; + } + // fall through + case 51: break; + case 22: + { return SET; + } + // fall through + case 52: break; + case 23: + { return ORD; + } + // fall through + case 53: break; + case 24: + { return MAP; + } + // fall through + case 54: break; + case 25: + { return LIST; + } + // fall through + case 55: break; + case 26: + { return ENUM; + } + // fall through + case 56: break; + case 27: + { return STATIC; + } + // fall through + case 57: break; + case 28: + { return RECORD; + } + // fall through + case 58: break; + case 29: + { return OPTIONAL; + } + // fall through + case 59: break; + case 30: + { return INTERFACE; + } + // fall through + case 60: break; + default: zzScanError(ZZ_NO_MATCH); } } diff --git a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/psi/DjinniTokenType.java b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/psi/DjinniTokenType.java index 582a90788..0cb39bec3 100644 --- a/intellij-plugin/src/com/dropbox/djinni/ideaplugin/psi/DjinniTokenType.java +++ b/intellij-plugin/src/com/dropbox/djinni/ideaplugin/psi/DjinniTokenType.java @@ -20,6 +20,9 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import java.util.Arrays; +import java.util.List; + /** * Created by jaetzold on 7/20/15. */ diff --git a/src/build.sbt b/src/build.sbt index f08c84058..655ed5562 100644 --- a/src/build.sbt +++ b/src/build.sbt @@ -1,6 +1,6 @@ import com.typesafe.sbt.SbtStartScript -scalaVersion := "2.11.0" +scalaVersion := "2.11.12" libraryDependencies ++= Seq( "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1", diff --git a/src/project/build.properties b/src/project/build.properties index be6c454fb..133a8f197 100644 --- a/src/project/build.properties +++ b/src/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.5 +sbt.version=0.13.17 diff --git a/src/run b/src/run index df98763bc..caea5c3b0 100755 --- a/src/run +++ b/src/run @@ -12,7 +12,7 @@ while [ -h "$loc" ]; do loc="`dirname "$loc"`/$link" # Relative link fi done -base_dir=$(cd "`dirname "$loc"`" && pwd) +base_dir=$(cd "`dirname "$loc"`" > /dev/null && pwd) "$base_dir/build" diff --git a/src/run-assume-built b/src/run-assume-built index 9502973b4..6d2a50bcb 100755 --- a/src/run-assume-built +++ b/src/run-assume-built @@ -12,6 +12,6 @@ while [ -h "$loc" ]; do loc="`dirname "$loc"`/$link" # Relative link fi done -base_dir=$(cd "`dirname "$loc"`" && pwd) +base_dir=$(cd "`dirname "$loc"`" > /dev/null && pwd) exec "$base_dir/target/start" "$@" diff --git a/src/source/BaseObjcGenerator.scala b/src/source/BaseObjcGenerator.scala index 3e19473d9..ea23bb658 100644 --- a/src/source/BaseObjcGenerator.scala +++ b/src/source/BaseObjcGenerator.scala @@ -57,7 +57,7 @@ abstract class BaseObjcGenerator(spec: Spec) extends Generator(spec) { case d: Double => w.w(boxedPrimitive(ty) + d.toString) case b: Boolean => w.w(boxedPrimitive(ty) + (if (b) "YES" else "NO")) case s: String => w.w("@" + s) - case e: EnumValue => w.w(idObjc.enum(e.ty + "_" + e.name)) + case e: EnumValue => w.w(marshal.typename(ty) + idObjc.enum(e.name)) case v: ConstRef => w.w(selfName + idObjc.const (v.name)) case z: Map[_, _] => { // Value is record val recordMdef = ty.resolved.base.asInstanceOf[MDef] diff --git a/src/source/CppGenerator.scala b/src/source/CppGenerator.scala index 28d309b1a..00af80b81 100644 --- a/src/source/CppGenerator.scala +++ b/src/source/CppGenerator.scala @@ -62,6 +62,9 @@ class CppGenerator(spec: Spec) extends Generator(spec) { if (spec.cppEnumHashWorkaround) { refs.hpp.add("#include ") // needed for std::hash } + if (!e.flags) { + refs.hpp.add("#include ") // needed for printing to stream + } val flagsType = "unsigned" val enumType = "int" @@ -91,6 +94,18 @@ class CppGenerator(spec: Spec) extends Generator(spec) { w.w(s"constexpr $self operator~($self x) noexcept").braced { w.wl(s"return static_cast<$self>(~static_cast<$flagsType>(x));") } + } else { + w.wl + w.w(s"static inline ::std::ostream& operator<<(::std::ostream& os, $self v)").braced { + w.wl("os << \"" ++ self ++ "::\";") + w.w("switch (v)").braced { + for (o <- normalEnumOptions(e)) { + val name = idCpp.enum(o.ident.name) + w.wl("case " ++ self ++ "::" ++ name ++ ": return os << \"" ++ name ++ "\";") + } + w.wl("default: return os << \"(v) << \">\";") + } + } } }, w => { @@ -112,11 +127,35 @@ class CppGenerator(spec: Spec) extends Generator(spec) { }) } + def shouldConstexpr(c: Const) = { + // Make sure we don't constexpr optionals as some might not support it + val canConstexpr = c.ty.resolved.base match { + case p: MPrimitive if c.ty.resolved.base != MOptional => true + case _ => false + } + canConstexpr + } + def generateHppConstants(w: IndentWriter, consts: Seq[Const]) = { for (c <- consts) { + // set value in header if can constexpr (only primitives) + var constexpr = shouldConstexpr(c) + var constValue = ";" + if (constexpr) { + constValue = c.value match { + case l: Long => " = " + l.toString + ";" + case d: Double if marshal.fieldType(c.ty) == "float" => " = " + d.toString + "f;" + case d: Double => " = " + d.toString + ";" + case b: Boolean => if (b) " = true;" else " = false;" + case _ => ";" + } + } + val constFieldType = if (constexpr) s"constexpr ${marshal.fieldType(c.ty)}" else s"${marshal.fieldType(c.ty)} const" + + // Write code to the header file w.wl writeDoc(w, c.doc) - w.wl(s"static ${marshal.fieldType(c.ty)} const ${idCpp.const(c.ident)};") + w.wl(s"static ${constFieldType} ${idCpp.const(c.ident)}${constValue}") } } @@ -127,7 +166,7 @@ class CppGenerator(spec: Spec) extends Generator(spec) { case d: Double => w.w(d.toString) case b: Boolean => w.w(if (b) "true" else "false") case s: String => w.w("{" + s + "}") - case e: EnumValue => w.w(marshal.typename(ty) + "::" + idCpp.enum(e.ty.name + "_" + e.name)) + case e: EnumValue => w.w(marshal.typename(ty) + "::" + idCpp.enum(e.name)) case v: ConstRef => w.w(selfName + "::" + idCpp.const(v)) case z: Map[_, _] => { // Value is record val recordMdef = ty.resolved.base.asInstanceOf[MDef] @@ -150,8 +189,12 @@ class CppGenerator(spec: Spec) extends Generator(spec) { val skipFirst = SkipFirst() for (c <- consts) { skipFirst{ w.wl } - w.w(s"${marshal.fieldType(c.ty)} const $selfName::${idCpp.const(c.ident)} = ") - writeCppConst(w, c.ty, c.value) + if (shouldConstexpr(c)){ + w.w(s"${marshal.fieldType(c.ty)} constexpr $selfName::${idCpp.const(c.ident)}") + } else { + w.w(s"${marshal.fieldType(c.ty)} const $selfName::${idCpp.const(c.ident)} = ") + writeCppConst(w, c.ty, c.value) + } w.wl(";") } } @@ -161,6 +204,9 @@ class CppGenerator(spec: Spec) extends Generator(spec) { r.fields.foreach(f => refs.find(f.ty, false)) r.consts.foreach(c => refs.find(c.ty, false)) refs.hpp.add("#include ") // Add for std::move + if (r.derivingTypes.contains(DerivingType.Show)) { + refs.hpp.add("#include ") // Add for overloading operator<< + } val self = marshal.typename(ident, r) val (cppName, cppFinal) = if (r.ext.cpp) (ident.name + "_base", "") else (ident.name, " final") @@ -203,6 +249,10 @@ class CppGenerator(spec: Spec) extends Generator(spec) { w.wl(s"friend bool operator<=(const $actualSelf& lhs, const $actualSelf& rhs);") w.wl(s"friend bool operator>=(const $actualSelf& lhs, const $actualSelf& rhs);") } + if (r.derivingTypes.contains(DerivingType.Show)) { + w.wl + w.wl(s"friend ::std::ostream& operator<<(::std::ostream& os, const $actualSelf& self);") + } // Constructor. if(r.fields.nonEmpty) { @@ -228,11 +278,16 @@ class CppGenerator(spec: Spec) extends Generator(spec) { w.wl(s"$actualSelf& operator=($actualSelf&&) = default;") } } + + if (r.derivingTypes.contains(DerivingType.Show)) { + w.wl + w.wl(s"::std::ostream& operator<<(::std::ostream& os, const $actualSelf& self);") + } } writeHppFile(cppName, origin, refs.hpp, refs.hppFwds, writeCppPrototype) - if (r.consts.nonEmpty || r.derivingTypes.contains(DerivingType.Eq) || r.derivingTypes.contains(DerivingType.Ord)) { + if (r.consts.nonEmpty || r.derivingTypes.contains(DerivingType.Eq) || r.derivingTypes.contains(DerivingType.Ord) || r.derivingTypes.contains(DerivingType.Show)) { writeCppFile(cppName, origin, refs.cpp, w => { generateCppConstants(w, r.consts, actualSelf) @@ -279,6 +334,46 @@ class CppGenerator(spec: Spec) extends Generator(spec) { w.wl("return !(lhs < rhs);") } } + if (r.derivingTypes.contains(DerivingType.Show)) { + def generateCollectionFormatterIfNeeded(parameters: Array[String], collection: String, open: String, close: String) { + // overload operator<< for collections that are actually used + if (refs.hpp.contains(s"#include <$collection>")) { + def chain(a: String, b: String): String = { + a ++ ", " ++ b + } + + val parameterDecl = parameters.map(p => "typename " ++ p).reduceLeft(chain) + w.wl(s"template<$parameterDecl>") + + val parameterDef = parameters.reduceLeft(chain) + val collectionDecl = s"::std::$collection<$parameterDef>" + w.w(s"::std::ostream& operator<<(::std::ostream& os, const $collectionDecl& c)").braced { + w.wl("auto first = true;") + w.wl("os << \"" ++ open ++ "\";") + w.w("for (auto&& element : c)").braced { + w.wl("if (first) first = false; else os << \",\" << ::std::endl;") + parameters.length match { + case 1 => w.wl("os << element;") + case 2 => w.wl("os << element.first << \": \" << element.second;") + } + } + w.wl("return os << \"" ++ close ++ "\";") + } + } + } + generateCollectionFormatterIfNeeded(Array("T"), "vector", "[", "]") + generateCollectionFormatterIfNeeded(Array("T"), "unordered_set", "{", "}") + generateCollectionFormatterIfNeeded(Array("K","V"), "unordered_map", "[", "]") + + w.wl + w.w(s"::std::ostream& operator<<(::std::ostream& os, const $actualSelf& self)").braced { + w.wl("os << \"" ++ self ++ "{\";") + for(f <- r.fields) { + w.wl("os << \" " ++ idCpp.field(f.ident) ++ ":\" << self." ++ idCpp.field(f.ident) ++ ";") + } + w.wl("return os << \"}\";") + } + } }) } @@ -309,7 +404,7 @@ class CppGenerator(spec: Spec) extends Generator(spec) { // Methods for (m <- i.methods) { w.wl - writeDoc(w, m.doc) + writeMethodDoc(w, m, idCpp.local) val ret = marshal.returnType(m.ret, methodNamesInScope) val params = m.params.map(p => marshal.paramType(p.ty, methodNamesInScope) + " " + idCpp.local(p.ident)) if (m.static) { diff --git a/src/source/JNIGenerator.scala b/src/source/JNIGenerator.scala index 0720a151b..971657dcf 100644 --- a/src/source/JNIGenerator.scala +++ b/src/source/JNIGenerator.scala @@ -330,7 +330,7 @@ class JNIGenerator(spec: Spec) extends Generator(spec) { val methodNameMunged = name.replaceAllLiterally("_", "_1") val zero = ret.fold("")(s => "0 /* value doesn't matter */") if (static) { - w.wl(s"CJNIEXPORT $jniRetType JNICALL ${prefix}_$methodNameMunged(JNIEnv* jniEnv, jobject /*this*/${preComma(paramList)})").braced { + w.wl(s"CJNIEXPORT $jniRetType JNICALL ${prefix}_00024CppProxy_$methodNameMunged(JNIEnv* jniEnv, jobject /*this*/${preComma(paramList)})").braced { w.w("try").bracedEnd(s" JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, $zero)") { w.wl(s"DJINNI_FUNCTION_PROLOGUE0(jniEnv);") f diff --git a/src/source/JavaGenerator.scala b/src/source/JavaGenerator.scala index 1c0c23804..aff100151 100644 --- a/src/source/JavaGenerator.scala +++ b/src/source/JavaGenerator.scala @@ -64,7 +64,7 @@ class JavaGenerator(spec: Spec) extends Generator(spec) { }) } - def generateJavaConstants(w: IndentWriter, consts: Seq[Const]) = { + def generateJavaConstants(w: IndentWriter, consts: Seq[Const], forJavaInterface: Boolean) = { def writeJavaConst(w: IndentWriter, ty: TypeRef, v: Any): Unit = v match { case l: Long if marshal.fieldType(ty).equalsIgnoreCase("long") => w.w(l.toString + "l") @@ -97,7 +97,11 @@ class JavaGenerator(spec: Spec) extends Generator(spec) { writeDoc(w, c.doc) javaAnnotationHeader.foreach(w.wl) marshal.nullityAnnotation(c.ty).foreach(w.wl) - w.w(s"public static final ${marshal.fieldType(c.ty)} ${idJava.const(c.ident)} = ") + + // If the constants are part of a Java interface, omit the "public," "static," + // and "final" specifiers. + val publicStaticFinalString = if (forJavaInterface) "" else "public static final " + w.w(s"${publicStaticFinalString}${marshal.fieldType(c.ty)} ${idJava.const(c.ident)} = ") writeJavaConst(w, c.ty, c.value) w.wl(";") w.wl @@ -140,37 +144,53 @@ class JavaGenerator(spec: Spec) extends Generator(spec) { writeDoc(w, doc) javaAnnotationHeader.foreach(w.wl) - w.w(s"${javaClassAccessModifierString}abstract class $javaClass$typeParamList").braced { + + // Generate an interface or an abstract class depending on whether the use + // of Java interfaces was requested. + val classPrefix = if (spec.javaGenerateInterfaces) "interface" else "abstract class" + val methodPrefix = if (spec.javaGenerateInterfaces) "" else "abstract " + val extendsKeyword = if (spec.javaGenerateInterfaces) "implements" else "extends" + val innerClassAccessibility = if (spec.javaGenerateInterfaces) "" else "private " + w.w(s"${javaClassAccessModifierString}$classPrefix $javaClass$typeParamList").braced { val skipFirst = SkipFirst() - generateJavaConstants(w, i.consts) + generateJavaConstants(w, i.consts, spec.javaGenerateInterfaces) val throwException = spec.javaCppException.fold("")(" throws " + _) for (m <- i.methods if !m.static) { skipFirst { w.wl } - writeDoc(w, m.doc) + writeMethodDoc(w, m, idJava.local) val ret = marshal.returnType(m.ret) val params = m.params.map(p => { val nullityAnnotation = marshal.nullityAnnotation(p.ty).map(_ + " ").getOrElse("") nullityAnnotation + marshal.paramType(p.ty) + " " + idJava.local(p.ident) }) marshal.nullityAnnotation(m.ret).foreach(w.wl) - w.wl("public abstract " + ret + " " + idJava.method(m.ident) + params.mkString("(", ", ", ")") + throwException + ";") + w.wl(s"public $methodPrefix" + ret + " " + idJava.method(m.ident) + params.mkString("(", ", ", ")") + throwException + ";") } + + // Implement the interface's static methods as calls to CppProxy's corresponding methods. for (m <- i.methods if m.static) { skipFirst { w.wl } - writeDoc(w, m.doc) + writeMethodDoc(w, m, idJava.local) val ret = marshal.returnType(m.ret) + val returnPrefix = if (ret == "void") "" else "return " val params = m.params.map(p => { val nullityAnnotation = marshal.nullityAnnotation(p.ty).map(_ + " ").getOrElse("") nullityAnnotation + marshal.paramType(p.ty) + " " + idJava.local(p.ident) }) + + val meth = idJava.method(m.ident) marshal.nullityAnnotation(m.ret).foreach(w.wl) - w.wl("public static native "+ ret + " " + idJava.method(m.ident) + params.mkString("(", ", ", ")") + ";") + w.wl("public static "+ ret + " " + idJava.method(m.ident) + params.mkString("(", ", ", ")")).braced { + writeAlignedCall(w, s"${returnPrefix}CppProxy.${meth}(", m.params, ");", p => idJava.local(p.ident)) + w.wl + } } + if (i.ext.cpp) { w.wl javaAnnotationHeader.foreach(w.wl) - w.wl(s"private static final class CppProxy$typeParamList extends $javaClass$typeParamList").braced { + w.wl(s"${innerClassAccessibility}static final class CppProxy$typeParamList $extendsKeyword $javaClass$typeParamList").braced { w.wl("private final long nativeRef;") w.wl("private final AtomicBoolean destroyed = new AtomicBoolean(false);") w.wl @@ -180,15 +200,17 @@ class JavaGenerator(spec: Spec) extends Generator(spec) { } w.wl w.wl("private native void nativeDestroy(long nativeRef);") - w.wl("public void destroy()").braced { + w.wl("public void _djinni_private_destroy()").braced { w.wl("boolean destroyed = this.destroyed.getAndSet(true);") w.wl("if (!destroyed) nativeDestroy(this.nativeRef);") } w.wl("protected void finalize() throws java.lang.Throwable").braced { - w.wl("destroy();") + w.wl("_djinni_private_destroy();") w.wl("super.finalize();") } - for (m <- i.methods if !m.static) { // Static methods not in CppProxy + + // Implement the interface's non-static methods. + for (m <- i.methods if !m.static) { val ret = marshal.returnType(m.ret) val returnStmt = m.ret.fold("")(_ => "return ") val params = m.params.map(p => marshal.paramType(p.ty) + " " + idJava.local(p.ident)).mkString(", ") @@ -202,6 +224,18 @@ class JavaGenerator(spec: Spec) extends Generator(spec) { } w.wl(s"private native $ret native_$meth(long _nativeRef${preComma(params)});") } + + // Declare a native method for each of the interface's static methods. + for (m <- i.methods if m.static) { + skipFirst { w.wl } + val ret = marshal.returnType(m.ret) + val params = m.params.map(p => { + val nullityAnnotation = marshal.nullityAnnotation(p.ty).map(_ + " ").getOrElse("") + nullityAnnotation + marshal.paramType(p.ty) + " " + idJava.local(p.ident) + }) + marshal.nullityAnnotation(m.ret).foreach(w.wl) + w.wl("public static native "+ ret + " " + idJava.method(m.ident) + params.mkString("(", ", ", ")") + ";") + } } } } @@ -228,7 +262,7 @@ class JavaGenerator(spec: Spec) extends Generator(spec) { val implementsSection = if (interfaces.isEmpty) "" else " implements " + interfaces.mkString(", ") w.w(s"${javaClassAccessModifierString}${javaFinal}class ${self + javaTypeParams(params)}$implementsSection").braced { w.wl - generateJavaConstants(w, r.consts) + generateJavaConstants(w, r.consts, false) // Field definitions. for (f <- r.fields) { w.wl diff --git a/src/source/Main.scala b/src/source/Main.scala index 84d97f017..9b4237202 100644 --- a/src/source/Main.scala +++ b/src/source/Main.scala @@ -42,6 +42,7 @@ object Main { var javaClassAccessModifier: JavaAccessModifier.Value = JavaAccessModifier.Public var javaCppException: Option[String] = None var javaAnnotation: Option[String] = None + var javaGenerateInterfaces: Boolean = false var javaNullableAnnotation: Option[String] = None var javaNonnullAnnotation: Option[String] = None var javaImplementAndroidOsParcelable : Boolean = false @@ -69,7 +70,7 @@ object Main { var objcTypePrefix: String = "" var objcIncludePrefix: String = "" var objcExtendedRecordIncludePrefix: String = "" - var objcSwiftBridgingHeader: Option[String] = None + var objcSwiftBridgingHeaderName: Option[String] = None var objcppIncludePrefix: String = "" var objcppIncludeCppPrefix: String = "" var objcppIncludeObjcPrefixOptional: Option[String] = None @@ -82,7 +83,7 @@ object Main { var yamlOutFolder: Option[File] = None var yamlOutFile: Option[String] = None var yamlPrefix: String = "" - + val argParser = new scopt.OptionParser[Unit]("djinni") { def identStyle(optionName: String, update: IdentConverter => Unit) = { @@ -111,6 +112,8 @@ object Main { .text("The type for translated C++ exceptions in Java (default: java.lang.RuntimeException that is not checked)") opt[String]("java-annotation").valueName("").foreach(x => javaAnnotation = Some(x)) .text("Java annotation (@Foo) to place on all generated Java classes") + opt[Boolean]("java-generate-interfaces").valueName("").foreach(x => javaGenerateInterfaces = x) + .text("Whether Java interfaces should be used instead of abstract classes where possible (default: false).") opt[String]("java-nullable-annotation").valueName("").foreach(x => javaNullableAnnotation = Some(x)) .text("Java annotation (@Nullable) to place on all fields and return values that are optional") opt[String]("java-nonnull-annotation").valueName("").foreach(x => javaNonnullAnnotation = Some(x)) @@ -168,7 +171,7 @@ object Main { .text("The prefix for Objective-C data types (usually two or three letters)") opt[String]("objc-include-prefix").valueName("").foreach(objcIncludePrefix = _) .text("The prefix for #import of header files from Objective-C files.") - opt[String]("objc-swift-bridging-header").valueName("").foreach(x => objcSwiftBridgingHeader = Some(x)) + opt[String]("objc-swift-bridging-header").valueName("").foreach(x => objcSwiftBridgingHeaderName = Some(x)) .text("The name of Objective-C Bridging Header used in XCode's Swift projects.") note("") opt[File]("objcpp-out").valueName("").foreach(x => objcppOutFolder = Some(x)) @@ -288,8 +291,8 @@ object Main { } else { None } - val objcSwiftBridgingHeaderWriter = if (objcSwiftBridgingHeader.isDefined && objcOutFolder.isDefined) { - val objcSwiftBridgingHeaderFile = new File(objcOutFolder.get.getPath, objcSwiftBridgingHeader.get + ".h") + val objcSwiftBridgingHeaderWriter = if (objcSwiftBridgingHeaderName.isDefined && objcOutFolder.isDefined) { + val objcSwiftBridgingHeaderFile = new File(objcOutFolder.get.getPath, objcSwiftBridgingHeaderName.get + ".h") if (objcSwiftBridgingHeaderFile.getParentFile != null) createFolder("output file list", objcSwiftBridgingHeaderFile.getParentFile) Some(new BufferedWriter(new FileWriter(objcSwiftBridgingHeaderFile))) @@ -304,6 +307,7 @@ object Main { javaIdentStyle, javaCppException, javaAnnotation, + javaGenerateInterfaces, javaNullableAnnotation, javaNonnullAnnotation, javaImplementAndroidOsParcelable, @@ -346,6 +350,7 @@ object Main { objcppNamespace, objcBaseLibIncludePrefix, objcSwiftBridgingHeaderWriter, + objcSwiftBridgingHeaderName, outFileListWriter, skipGeneration, yamlOutFolder, diff --git a/src/source/ObjcGenerator.scala b/src/source/ObjcGenerator.scala index c62f60b9a..420c6cd1d 100644 --- a/src/source/ObjcGenerator.scala +++ b/src/source/ObjcGenerator.scala @@ -107,7 +107,7 @@ class ObjcGenerator(spec: Spec) extends BaseObjcGenerator(spec) { if (i.ext.objc) w.wl(s"@protocol $self") else w.wl(s"@interface $self : NSObject") for (m <- i.methods) { w.wl - writeDoc(w, m.doc) + writeMethodDoc(w, m, idObjc.local) writeObjcFuncDecl(m, w) w.wl(";") } diff --git a/src/source/SwiftBridgingHeaderGenerator.scala b/src/source/SwiftBridgingHeaderGenerator.scala index 441ea987b..f5d9d0761 100644 --- a/src/source/SwiftBridgingHeaderGenerator.scala +++ b/src/source/SwiftBridgingHeaderGenerator.scala @@ -38,8 +38,24 @@ class SwiftBridgingHeaderGenerator(spec: Spec) extends Generator(spec) { } object SwiftBridgingHeaderGenerator { - def writeAutogenerationWarning(writer: Writer) { + + val bridgingHeaderName = (s: String) => s.split('-').mkString("_") + val bridgingHeaderVariables = (s: String) => s.split('-').mkString("") + + def writeAutogenerationWarning(name: String, writer: Writer) { + val bridgingHeaderVarName = bridgingHeaderName(name) writer.write("// AUTOGENERATED FILE - DO NOT MODIFY!\n") writer.write("// This file generated by Djinni\n\n") + writer.write("// " + bridgingHeaderVarName + ".h\n") + writer.write("// " + bridgingHeaderVarName + "\n\n") + } + + def writeBridgingVars(name: String, writer: Writer) { + val bridgingHeaderVarName = bridgingHeaderVariables(name) + writer.write("#import \n\n") + writer.write("//! Project version number for " + bridgingHeaderVarName +".\n") + writer.write("FOUNDATION_EXPORT double " + bridgingHeaderVarName + "VersionNumber;\n\n") + writer.write("//! Project version string for " + bridgingHeaderVarName +".\n") + writer.write("FOUNDATION_EXPORT const unsigned char " + bridgingHeaderVarName + "VersionString[];\n\n") } } \ No newline at end of file diff --git a/src/source/ast.scala b/src/source/ast.scala index fb171240b..c073d8c4b 100644 --- a/src/source/ast.scala +++ b/src/source/ast.scala @@ -75,7 +75,7 @@ case class Record(ext: Ext, fields: Seq[Field], consts: Seq[Const], derivingType object Record { object DerivingType extends Enumeration { type DerivingType = Value - val Eq, Ord, AndroidParcelable = Value + val Eq, Ord, Show, AndroidParcelable = Value } } diff --git a/src/source/generator.scala b/src/source/generator.scala index e5f687722..0151d89a7 100644 --- a/src/source/generator.scala +++ b/src/source/generator.scala @@ -24,6 +24,7 @@ import djinni.syntax.Error import djinni.writer.IndentWriter import scala.language.implicitConversions import scala.collection.mutable +import scala.util.matching.Regex package object generatorTools { @@ -34,6 +35,7 @@ package object generatorTools { javaIdentStyle: JavaIdentStyle, javaCppException: Option[String], javaAnnotation: Option[String], + javaGenerateInterfaces: Boolean, javaNullableAnnotation: Option[String], javaNonnullAnnotation: Option[String], javaImplementAndroidOsParcelable: Boolean, @@ -76,6 +78,7 @@ package object generatorTools { objcppNamespace: String, objcBaseLibIncludePrefix: String, objcSwiftBridgingHeaderWriter: Option[Writer], + objcSwiftBridgingHeaderName: Option[String], outFileListWriter: Option[Writer], skipGeneration: Boolean, yamlOutFolder: Option[File], @@ -216,7 +219,8 @@ package object generatorTools { new ObjcppGenerator(spec).generate(idl) } if (spec.objcSwiftBridgingHeaderWriter.isDefined) { - SwiftBridgingHeaderGenerator.writeAutogenerationWarning(spec.objcSwiftBridgingHeaderWriter.get) + SwiftBridgingHeaderGenerator.writeAutogenerationWarning(spec.objcSwiftBridgingHeaderName.get, spec.objcSwiftBridgingHeaderWriter.get) + SwiftBridgingHeaderGenerator.writeBridgingVars(spec.objcSwiftBridgingHeaderName.get, spec.objcSwiftBridgingHeaderWriter.get) new SwiftBridgingHeaderGenerator(spec).generate(idl) } if (spec.yamlOutFolder.isDefined) { @@ -237,9 +241,12 @@ package object generatorTools { case class DeclRef(decl: String, namespace: Option[String]) extends SymbolReference } +object Generator { + val writtenFiles = mutable.HashMap[String,String]() +} + abstract class Generator(spec: Spec) { - protected val writtenFiles = mutable.HashMap[String,String]() protected def createFile(folder: File, fileName: String, makeWriter: OutputStreamWriter => IndentWriter, f: IndentWriter => Unit): Unit = { if (spec.outFileListWriter.isDefined) { @@ -251,7 +258,7 @@ abstract class Generator(spec: Spec) val file = new File(folder, fileName) val cp = file.getCanonicalPath - writtenFiles.put(cp.toLowerCase, cp) match { + Generator.writtenFiles.put(cp.toLowerCase, cp) match { case Some(existing) => if (existing == cp) { throw GenerateException("Refusing to write \"" + file.getPath + "\"; we already wrote a file to that path.") @@ -416,6 +423,15 @@ abstract class Generator(spec: Spec) // -------------------------------------------------------------------------- + def writeMethodDoc(w: IndentWriter, method: Interface.Method, ident: IdentConverter) { + val paramReplacements = method.params.map(p => (s"\\b${Regex.quote(p.ident.name)}\\b", s"${ident(p.ident.name)}")) + val newDoc = Doc(method.doc.lines.map(l => { + paramReplacements.foldLeft(l)((line, rep) => + line.replaceAll(rep._1, rep._2)) + })) + writeDoc(w, newDoc) + } + def writeDoc(w: IndentWriter, doc: Doc) { doc.lines.length match { case 0 => diff --git a/src/source/parser.scala b/src/source/parser.scala index 9e79e9960..09b87653e 100644 --- a/src/source/parser.scala +++ b/src/source/parser.scala @@ -123,6 +123,7 @@ private object IdlParser extends RegexParsers { _.map(ident => ident.name match { case "eq" => Record.DerivingType.Eq case "ord" => Record.DerivingType.Ord + case "show" => Record.DerivingType.Show case "parcelable" => Record.DerivingType.AndroidParcelable case _ => return err( s"""Unrecognized deriving type "${ident.name}"""") }).toSet diff --git a/src/source/resolver.scala b/src/source/resolver.scala index aac986b1e..71bd71ec4 100644 --- a/src/source/resolver.scala +++ b/src/source/resolver.scala @@ -240,8 +240,7 @@ private def resolveRecord(scope: Scope, r: Record) { throw new Error(f.ident.loc, "Interface reference cannot live in a record").toException case DRecord => val record = df.body.asInstanceOf[Record] - if (!r.derivingTypes.subsetOf(record.derivingTypes)) - throw new Error(f.ident.loc, s"Some deriving required is not implemented in record ${f.ident.name}").toException + checkRecordRef(r, f, record) case DEnum => } case e: MExtern => e.defType match { @@ -249,8 +248,7 @@ private def resolveRecord(scope: Scope, r: Record) { throw new Error(f.ident.loc, "Interface reference cannot live in a record").toException case DRecord => val record = e.body.asInstanceOf[Record] - if (!r.derivingTypes.subsetOf(record.derivingTypes)) - throw new Error(f.ident.loc, s"Some deriving required is not implemented in record ${f.ident.name}").toException + checkRecordRef(r, f, record) case DEnum => } case _ => throw new AssertionError("Type cannot be resolved") @@ -263,6 +261,16 @@ private def resolveRecord(scope: Scope, r: Record) { } } +private def checkRecordRef(container: Record, field: Field, reference: Record) { + // Find missing directives so we can provide a useful error message + val missingTypes = container.derivingTypes -- reference.derivingTypes + if (!missingTypes.isEmpty) { + def describeType(t: DerivingType) = { "'" ++ t.toString.map(_.toLower) ++ "'" } + val names = missingTypes.tail.foldLeft(describeType(missingTypes.head))((s, t) => s ++ ", " ++ describeType(t)) + throw new Error(field.ident.loc, s"Record '${field.ty.expr.ident.name}' not deriving required operation(s): ${names}").toException + } +} + private def resolveInterface(scope: Scope, i: Interface) { // Const and static methods are only allowed on +c (only) interfaces if (i.ext.java || i.ext.objc) { diff --git a/support-lib/jni/djinni_support.cpp b/support-lib/jni/djinni_support.cpp index deb3cc3f8..142b9e220 100644 --- a/support-lib/jni/djinni_support.cpp +++ b/support-lib/jni/djinni_support.cpp @@ -585,7 +585,7 @@ void jniSetPendingFromCurrent(JNIEnv * env, const char * ctx) noexcept { jniDefaultSetPendingFromCurrent(env, ctx); } -void jniDefaultSetPendingFromCurrent(JNIEnv * env, const char * /*ctx*/) noexcept { +void jniDefaultSetPendingFromCurrentImpl(JNIEnv * env) { assert(env); try { throw; @@ -595,9 +595,17 @@ void jniDefaultSetPendingFromCurrent(JNIEnv * env, const char * /*ctx*/) noexcep } catch (const std::exception & e) { env->ThrowNew(env->FindClass("java/lang/RuntimeException"), e.what()); } +} - // noexcept will call terminate() for anything not caught above (i.e. - // exceptions which aren't std::exception subclasses). +void jniDefaultSetPendingFromCurrent(JNIEnv * env, const char * /*ctx*/) noexcept { + + /* It is necessary to go through a layer of indirection here because this + function is marked noexcept, but the implementation may still throw. + Any exceptions which are not caught (i.e. exceptions which aren't + std::exception subclasses) will result in a call to terminate() since this + function is marked noexcept */ + + jniDefaultSetPendingFromCurrentImpl(env); } template class ProxyCache; diff --git a/test-suite/djinni/all.djinni b/test-suite/djinni/all.djinni index e520a6760..8431f1423 100644 --- a/test-suite/djinni/all.djinni +++ b/test-suite/djinni/all.djinni @@ -1,6 +1,7 @@ @import "common.djinni" @import "enum_flags.djinni" +@import "constant_enum.djinni" @import "vendor/third-party/date.djinni" @import "third-party/duration.djinni" diff --git a/test-suite/djinni/constant_enum.djinni b/test-suite/djinni/constant_enum.djinni new file mode 100644 index 000000000..a7c57cb3c --- /dev/null +++ b/test-suite/djinni/constant_enum.djinni @@ -0,0 +1,15 @@ +# enum for use in constants +constant_enum = enum { + some_value; + some_other_value; +} + +# Record containing enum constant +constant_with_enum = record { + const const_enum: constant_enum = constant_enum::some_value; +} + +# Interface containing enum constant +constant_interface_with_enum = interface +c { + const const_enum: constant_enum = constant_enum::some_value; +} diff --git a/test-suite/djinni/varnames.djinni b/test-suite/djinni/varnames.djinni index 5b3e5e567..169ff33f7 100644 --- a/test-suite/djinni/varnames.djinni +++ b/test-suite/djinni/varnames.djinni @@ -6,6 +6,9 @@ _varname_record_ = record { } _varname_interface_ = interface +c { + # We should also rewrite parameter names in docstrings. + # _r_arg_ should be rewritten. + # _i_arg_ should not. _rmethod_(_r_arg_: _varname_record_): _varname_record_; _imethod_(_i_arg_: _varname_interface_): _varname_interface_; } diff --git a/test-suite/generated-src/cpp/_varname_interface_.hpp b/test-suite/generated-src/cpp/_varname_interface_.hpp index dddbfffad..5b66e949e 100644 --- a/test-suite/generated-src/cpp/_varname_interface_.hpp +++ b/test-suite/generated-src/cpp/_varname_interface_.hpp @@ -13,6 +13,11 @@ class VarnameInterface { public: virtual ~VarnameInterface() {} + /** + * We should also rewrite parameter names in docstrings. + * _r_arg_ should be rewritten. + * _i_arg_ should not. + */ virtual VarnameRecord _rmethod_(const VarnameRecord & _r_arg_) = 0; virtual std::shared_ptr _imethod_(const std::shared_ptr & _i_arg_) = 0; diff --git a/test-suite/generated-src/cpp/constant_enum.hpp b/test-suite/generated-src/cpp/constant_enum.hpp new file mode 100644 index 000000000..580415248 --- /dev/null +++ b/test-suite/generated-src/cpp/constant_enum.hpp @@ -0,0 +1,26 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#pragma once + +#include + +namespace testsuite { + +enum class constant_enum : int { + SOME_VALUE, + SOME_OTHER_VALUE, +}; + +} // namespace testsuite + +namespace std { + +template <> +struct hash<::testsuite::constant_enum> { + size_t operator()(::testsuite::constant_enum type) const { + return std::hash()(static_cast(type)); + } +}; + +} // namespace std diff --git a/test-suite/generated-src/cpp/constant_interface_with_enum.cpp b/test-suite/generated-src/cpp/constant_interface_with_enum.cpp new file mode 100644 index 000000000..e3bb9b739 --- /dev/null +++ b/test-suite/generated-src/cpp/constant_interface_with_enum.cpp @@ -0,0 +1,11 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#include "constant_interface_with_enum.hpp" // my header +#include "constant_enum.hpp" + +namespace testsuite { + +constant_enum const ConstantInterfaceWithEnum::CONST_ENUM = constant_enum::SOME_VALUE; + +} // namespace testsuite diff --git a/test-suite/generated-src/cpp/constant_interface_with_enum.hpp b/test-suite/generated-src/cpp/constant_interface_with_enum.hpp new file mode 100644 index 000000000..5bfde8c2a --- /dev/null +++ b/test-suite/generated-src/cpp/constant_interface_with_enum.hpp @@ -0,0 +1,18 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#pragma once + +namespace testsuite { + +enum class constant_enum; + +/** Interface containing enum constant */ +class ConstantInterfaceWithEnum { +public: + virtual ~ConstantInterfaceWithEnum() {} + + static constant_enum const CONST_ENUM; +}; + +} // namespace testsuite diff --git a/test-suite/generated-src/cpp/constant_with_enum.cpp b/test-suite/generated-src/cpp/constant_with_enum.cpp new file mode 100644 index 000000000..1b5d9b0c7 --- /dev/null +++ b/test-suite/generated-src/cpp/constant_with_enum.cpp @@ -0,0 +1,10 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#include "constant_with_enum.hpp" // my header + +namespace testsuite { + +constant_enum const ConstantWithEnum::CONST_ENUM = constant_enum::SOME_VALUE; + +} // namespace testsuite diff --git a/test-suite/generated-src/cpp/constant_with_enum.hpp b/test-suite/generated-src/cpp/constant_with_enum.hpp new file mode 100644 index 000000000..15091b69e --- /dev/null +++ b/test-suite/generated-src/cpp/constant_with_enum.hpp @@ -0,0 +1,17 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#pragma once + +#include "constant_enum.hpp" +#include + +namespace testsuite { + +/** Record containing enum constant */ +struct ConstantWithEnum final { + + static constant_enum const CONST_ENUM; +}; + +} // namespace testsuite diff --git a/test-suite/generated-src/cpp/constants.cpp b/test-suite/generated-src/cpp/constants.cpp index db05286d6..d21ba16c2 100644 --- a/test-suite/generated-src/cpp/constants.cpp +++ b/test-suite/generated-src/cpp/constants.cpp @@ -5,19 +5,19 @@ namespace testsuite { -bool const Constants::BOOL_CONSTANT = true; +bool constexpr Constants::BOOL_CONSTANT; -int8_t const Constants::I8_CONSTANT = 1; +int8_t constexpr Constants::I8_CONSTANT; -int16_t const Constants::I16_CONSTANT = 2; +int16_t constexpr Constants::I16_CONSTANT; -int32_t const Constants::I32_CONSTANT = 3; +int32_t constexpr Constants::I32_CONSTANT; -int64_t const Constants::I64_CONSTANT = 4; +int64_t constexpr Constants::I64_CONSTANT; -float const Constants::F32_CONSTANT = 5.0f; +float constexpr Constants::F32_CONSTANT; -double const Constants::F64_CONSTANT = 5.0; +double constexpr Constants::F64_CONSTANT; std::experimental::optional const Constants::OPT_BOOL_CONSTANT = true; @@ -41,6 +41,6 @@ ConstantRecord const Constants::OBJECT_CONSTANT = ConstantRecord( Constants::I32_CONSTANT /* some_integer */ , Constants::STRING_CONSTANT /* some_string */ ); -bool const Constants::DUMMY = false; +bool constexpr Constants::DUMMY; } // namespace testsuite diff --git a/test-suite/generated-src/cpp/constants.hpp b/test-suite/generated-src/cpp/constants.hpp index 32b1a0283..eac9e97f6 100644 --- a/test-suite/generated-src/cpp/constants.hpp +++ b/test-suite/generated-src/cpp/constants.hpp @@ -15,24 +15,24 @@ namespace testsuite { struct Constants final { /** bool_constant has documentation. */ - static bool const BOOL_CONSTANT; + static constexpr bool BOOL_CONSTANT = true; - static int8_t const I8_CONSTANT; + static constexpr int8_t I8_CONSTANT = 1; - static int16_t const I16_CONSTANT; + static constexpr int16_t I16_CONSTANT = 2; - static int32_t const I32_CONSTANT; + static constexpr int32_t I32_CONSTANT = 3; - static int64_t const I64_CONSTANT; + static constexpr int64_t I64_CONSTANT = 4; - static float const F32_CONSTANT; + static constexpr float F32_CONSTANT = 5.0f; /** * f64_constant has long documentation. * (Second line of multi-line documentation. * Indented third line of multi-line documentation.) */ - static double const F64_CONSTANT; + static constexpr double F64_CONSTANT = 5.0; static std::experimental::optional const OPT_BOOL_CONSTANT; @@ -65,7 +65,7 @@ struct Constants final { * No support for optional constant records * No support for constant binary, list, set, map */ - static bool const DUMMY; + static constexpr bool DUMMY = false; }; } // namespace testsuite diff --git a/test-suite/generated-src/cpp/constants_interface.cpp b/test-suite/generated-src/cpp/constants_interface.cpp index b24932e9f..3633110f7 100644 --- a/test-suite/generated-src/cpp/constants_interface.cpp +++ b/test-suite/generated-src/cpp/constants_interface.cpp @@ -6,19 +6,19 @@ namespace testsuite { -bool const ConstantsInterface::BOOL_CONSTANT = true; +bool constexpr ConstantsInterface::BOOL_CONSTANT; -int8_t const ConstantsInterface::I8_CONSTANT = 1; +int8_t constexpr ConstantsInterface::I8_CONSTANT; -int16_t const ConstantsInterface::I16_CONSTANT = 2; +int16_t constexpr ConstantsInterface::I16_CONSTANT; -int32_t const ConstantsInterface::I32_CONSTANT = 3; +int32_t constexpr ConstantsInterface::I32_CONSTANT; -int64_t const ConstantsInterface::I64_CONSTANT = 4; +int64_t constexpr ConstantsInterface::I64_CONSTANT; -float const ConstantsInterface::F32_CONSTANT = 5.0f; +float constexpr ConstantsInterface::F32_CONSTANT; -double const ConstantsInterface::F64_CONSTANT = 5.0; +double constexpr ConstantsInterface::F64_CONSTANT; std::experimental::optional const ConstantsInterface::OPT_BOOL_CONSTANT = true; diff --git a/test-suite/generated-src/cpp/constants_interface.hpp b/test-suite/generated-src/cpp/constants_interface.hpp index 54a7d6c8c..c73189728 100644 --- a/test-suite/generated-src/cpp/constants_interface.hpp +++ b/test-suite/generated-src/cpp/constants_interface.hpp @@ -16,25 +16,25 @@ class ConstantsInterface { public: virtual ~ConstantsInterface() {} - static bool const BOOL_CONSTANT; + static constexpr bool BOOL_CONSTANT = true; - static int8_t const I8_CONSTANT; + static constexpr int8_t I8_CONSTANT = 1; - static int16_t const I16_CONSTANT; + static constexpr int16_t I16_CONSTANT = 2; /** i32_constant has documentation. */ - static int32_t const I32_CONSTANT; + static constexpr int32_t I32_CONSTANT = 3; /** * i64_constant has long documentation. * (Second line of multi-line documentation. * Indented third line of multi-line documentation.) */ - static int64_t const I64_CONSTANT; + static constexpr int64_t I64_CONSTANT = 4; - static float const F32_CONSTANT; + static constexpr float F32_CONSTANT = 5.0f; - static double const F64_CONSTANT; + static constexpr double F64_CONSTANT = 5.0; static std::experimental::optional const OPT_BOOL_CONSTANT; diff --git a/test-suite/generated-src/inFileList.txt b/test-suite/generated-src/inFileList.txt index 3b2f259db..62909ef88 100644 --- a/test-suite/generated-src/inFileList.txt +++ b/test-suite/generated-src/inFileList.txt @@ -18,6 +18,7 @@ djinni/extended_record.djinni djinni/varnames.djinni djinni/relative_paths.djinni djinni/enum_flags.djinni +djinni/constant_enum.djinni djinni/vendor/third-party/date.djinni djinni/vendor/third-party/date.yaml djinni/vendor/third-party/duration.djinni diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ClientInterface.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ClientInterface.java index 2b7f85efb..b77eed268 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/ClientInterface.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ClientInterface.java @@ -7,19 +7,19 @@ import javax.annotation.Nonnull; /** Client interface */ -public abstract class ClientInterface { +public interface ClientInterface { /** Returns record of given string */ @Nonnull - public abstract ClientReturnedRecord getRecord(long recordId, @Nonnull String utf8string, @CheckForNull String misc); + public ClientReturnedRecord getRecord(long recordId, @Nonnull String utf8string, @CheckForNull String misc); - public abstract double identifierCheck(@Nonnull byte[] data, int r, long jret); + public double identifierCheck(@Nonnull byte[] data, int r, long jret); @Nonnull - public abstract String returnStr(); + public String returnStr(); @Nonnull - public abstract String methTakingInterface(@CheckForNull ClientInterface i); + public String methTakingInterface(@CheckForNull ClientInterface i); @Nonnull - public abstract String methTakingOptionalInterface(@CheckForNull ClientInterface i); + public String methTakingOptionalInterface(@CheckForNull ClientInterface i); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/Conflict.java b/test-suite/generated-src/java/com/dropbox/djinni/test/Conflict.java index fbd6ce640..4a5d1944b 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/Conflict.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/Conflict.java @@ -11,9 +11,9 @@ * Test for conflict of method name with an interface name. * See the comments about scopeSymbols in CppMarshal.scala for more info. */ -public abstract class Conflict { +public interface Conflict { - private static final class CppProxy extends Conflict + static final class CppProxy implements Conflict { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -25,14 +25,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ConflictUser.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ConflictUser.java index 7169b30ff..865a2dff2 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/ConflictUser.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ConflictUser.java @@ -8,13 +8,13 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class ConflictUser { +public interface ConflictUser { @CheckForNull - public abstract Conflict Conflict(); + public Conflict Conflict(); - public abstract boolean conflictArg(@Nonnull HashSet cs); + public boolean conflictArg(@Nonnull HashSet cs); - private static final class CppProxy extends ConflictUser + static final class CppProxy implements ConflictUser { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -26,14 +26,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantEnum.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantEnum.java new file mode 100644 index 000000000..89782b089 --- /dev/null +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantEnum.java @@ -0,0 +1,14 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +package com.dropbox.djinni.test; + +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; + +/** enum for use in constants */ +public enum ConstantEnum { + SOME_VALUE, + SOME_OTHER_VALUE, + ; +} diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantInterfaceWithEnum.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantInterfaceWithEnum.java new file mode 100644 index 000000000..42d6787e1 --- /dev/null +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantInterfaceWithEnum.java @@ -0,0 +1,39 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +package com.dropbox.djinni.test; + +import java.util.concurrent.atomic.AtomicBoolean; +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; + +/** Interface containing enum constant */ +public interface ConstantInterfaceWithEnum { + @Nonnull + ConstantEnum CONST_ENUM = ConstantEnum.SOME_VALUE; + + + static final class CppProxy implements ConstantInterfaceWithEnum + { + private final long nativeRef; + private final AtomicBoolean destroyed = new AtomicBoolean(false); + + private CppProxy(long nativeRef) + { + if (nativeRef == 0) throw new RuntimeException("nativeRef is zero"); + this.nativeRef = nativeRef; + } + + private native void nativeDestroy(long nativeRef); + public void _djinni_private_destroy() + { + boolean destroyed = this.destroyed.getAndSet(true); + if (!destroyed) nativeDestroy(this.nativeRef); + } + protected void finalize() throws java.lang.Throwable + { + _djinni_private_destroy(); + super.finalize(); + } + } +} diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantWithEnum.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantWithEnum.java new file mode 100644 index 000000000..002023763 --- /dev/null +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantWithEnum.java @@ -0,0 +1,26 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +package com.dropbox.djinni.test; + +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; + +/** Record containing enum constant */ +public class ConstantWithEnum { + + @Nonnull + public static final ConstantEnum CONST_ENUM = ConstantEnum.SOME_VALUE; + + + public ConstantWithEnum( + ) { + } + + @Override + public String toString() { + return "ConstantWithEnum{" + + "}"; + } + +} diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantsInterface.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantsInterface.java index 2c38a374f..03a043aae 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantsInterface.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ConstantsInterface.java @@ -8,42 +8,42 @@ import javax.annotation.Nonnull; /** Interface containing constants */ -public abstract class ConstantsInterface { - public static final boolean BOOL_CONSTANT = true; +public interface ConstantsInterface { + boolean BOOL_CONSTANT = true; - public static final byte I8_CONSTANT = 1; + byte I8_CONSTANT = 1; - public static final short I16_CONSTANT = 2; + short I16_CONSTANT = 2; /** i32_constant has documentation. */ - public static final int I32_CONSTANT = 3; + int I32_CONSTANT = 3; /** * i64_constant has long documentation. * (Second line of multi-line documentation. * Indented third line of multi-line documentation.) */ - public static final long I64_CONSTANT = 4l; + long I64_CONSTANT = 4l; - public static final float F32_CONSTANT = 5.0f; + float F32_CONSTANT = 5.0f; - public static final double F64_CONSTANT = 5.0; + double F64_CONSTANT = 5.0; @CheckForNull - public static final Boolean OPT_BOOL_CONSTANT = true; + Boolean OPT_BOOL_CONSTANT = true; @CheckForNull - public static final Byte OPT_I8_CONSTANT = 1; + Byte OPT_I8_CONSTANT = 1; /** opt_i16_constant has documentation. */ @CheckForNull - public static final Short OPT_I16_CONSTANT = 2; + Short OPT_I16_CONSTANT = 2; @CheckForNull - public static final Integer OPT_I32_CONSTANT = 3; + Integer OPT_I32_CONSTANT = 3; @CheckForNull - public static final Long OPT_I64_CONSTANT = 4l; + Long OPT_I64_CONSTANT = 4l; /** * opt_f32_constant has long documentation. @@ -51,19 +51,19 @@ public abstract class ConstantsInterface { * Indented third line of multi-line documentation.) */ @CheckForNull - public static final Float OPT_F32_CONSTANT = 5.0f; + Float OPT_F32_CONSTANT = 5.0f; @CheckForNull - public static final Double OPT_F64_CONSTANT = 5.0; + Double OPT_F64_CONSTANT = 5.0; @Nonnull - public static final String STRING_CONSTANT = "string-constant"; + String STRING_CONSTANT = "string-constant"; @CheckForNull - public static final String OPT_STRING_CONSTANT = "string-constant"; + String OPT_STRING_CONSTANT = "string-constant"; @Nonnull - public static final ConstantRecord OBJECT_CONSTANT = new ConstantRecord( + ConstantRecord OBJECT_CONSTANT = new ConstantRecord( I32_CONSTANT /* mSomeInteger */ , STRING_CONSTANT /* mSomeString */ ); @@ -72,9 +72,9 @@ public abstract class ConstantsInterface { * No support for optional constant records * No support for constant binary, list, set, map */ - public abstract void dummy(); + public void dummy(); - private static final class CppProxy extends ConstantsInterface + static final class CppProxy implements ConstantsInterface { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -86,14 +86,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/CppException.java b/test-suite/generated-src/java/com/dropbox/djinni/test/CppException.java index 362dbb0f5..b8a4e7f2e 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/CppException.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/CppException.java @@ -7,13 +7,16 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class CppException { - public abstract int throwAnException(); +public interface CppException { + public int throwAnException(); @CheckForNull - public static native CppException get(); + public static CppException get() + { + return CppProxy.get(); + } - private static final class CppProxy extends CppException + static final class CppProxy implements CppException { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -25,14 +28,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } @@ -43,5 +46,8 @@ public int throwAnException() return native_throwAnException(this.nativeRef); } private native int native_throwAnException(long _nativeRef); + + @CheckForNull + public static native CppException get(); } } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/EnumUsageInterface.java b/test-suite/generated-src/java/com/dropbox/djinni/test/EnumUsageInterface.java index dcb1322db..de33ea331 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/EnumUsageInterface.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/EnumUsageInterface.java @@ -10,23 +10,23 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class EnumUsageInterface { +public interface EnumUsageInterface { @Nonnull - public abstract Color e(@Nonnull Color e); + public Color e(@Nonnull Color e); @CheckForNull - public abstract Color o(@CheckForNull Color o); + public Color o(@CheckForNull Color o); @Nonnull - public abstract ArrayList l(@Nonnull ArrayList l); + public ArrayList l(@Nonnull ArrayList l); @Nonnull - public abstract HashSet s(@Nonnull HashSet s); + public HashSet s(@Nonnull HashSet s); @Nonnull - public abstract HashMap m(@Nonnull HashMap m); + public HashMap m(@Nonnull HashMap m); - private static final class CppProxy extends EnumUsageInterface + static final class CppProxy implements EnumUsageInterface { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -38,14 +38,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ExternInterface1.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ExternInterface1.java index 01c0dbf94..5af1efcc9 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/ExternInterface1.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ExternInterface1.java @@ -5,10 +5,10 @@ import java.util.concurrent.atomic.AtomicBoolean; -public abstract class ExternInterface1 { - public abstract com.dropbox.djinni.test.ClientReturnedRecord foo(com.dropbox.djinni.test.ClientInterface i); +public interface ExternInterface1 { + public com.dropbox.djinni.test.ClientReturnedRecord foo(com.dropbox.djinni.test.ClientInterface i); - private static final class CppProxy extends ExternInterface1 + static final class CppProxy implements ExternInterface1 { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -20,14 +20,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ExternInterface2.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ExternInterface2.java index 522f6a14c..393c444ef 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/ExternInterface2.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ExternInterface2.java @@ -3,6 +3,6 @@ package com.dropbox.djinni.test; -public abstract class ExternInterface2 { - public abstract ExternRecordWithDerivings foo(com.dropbox.djinni.test.TestHelpers i); +public interface ExternInterface2 { + public ExternRecordWithDerivings foo(com.dropbox.djinni.test.TestHelpers i); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/FirstListener.java b/test-suite/generated-src/java/com/dropbox/djinni/test/FirstListener.java index 1faa7faa0..3d1036c5d 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/FirstListener.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/FirstListener.java @@ -7,6 +7,6 @@ import javax.annotation.Nonnull; /** Used for ObjC multiple inheritance tests */ -public abstract class FirstListener { - public abstract void first(); +public interface FirstListener { + public void first(); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/FlagRoundtrip.java b/test-suite/generated-src/java/com/dropbox/djinni/test/FlagRoundtrip.java index 0f9ebbe37..d3348d82a 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/FlagRoundtrip.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/FlagRoundtrip.java @@ -8,20 +8,32 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class FlagRoundtrip { +public interface FlagRoundtrip { @Nonnull - public static native EnumSet roundtripAccess(@Nonnull EnumSet flag); + public static EnumSet roundtripAccess(@Nonnull EnumSet flag) + { + return CppProxy.roundtripAccess(flag); + } @Nonnull - public static native EnumSet roundtripEmpty(@Nonnull EnumSet flag); + public static EnumSet roundtripEmpty(@Nonnull EnumSet flag) + { + return CppProxy.roundtripEmpty(flag); + } @CheckForNull - public static native EnumSet roundtripAccessBoxed(@CheckForNull EnumSet flag); + public static EnumSet roundtripAccessBoxed(@CheckForNull EnumSet flag) + { + return CppProxy.roundtripAccessBoxed(flag); + } @CheckForNull - public static native EnumSet roundtripEmptyBoxed(@CheckForNull EnumSet flag); + public static EnumSet roundtripEmptyBoxed(@CheckForNull EnumSet flag) + { + return CppProxy.roundtripEmptyBoxed(flag); + } - private static final class CppProxy extends FlagRoundtrip + static final class CppProxy implements FlagRoundtrip { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -33,15 +45,27 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } + + @Nonnull + public static native EnumSet roundtripAccess(@Nonnull EnumSet flag); + + @Nonnull + public static native EnumSet roundtripEmpty(@Nonnull EnumSet flag); + + @CheckForNull + public static native EnumSet roundtripAccessBoxed(@CheckForNull EnumSet flag); + + @CheckForNull + public static native EnumSet roundtripEmptyBoxed(@CheckForNull EnumSet flag); } } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/InterfaceUsingExtendedRecord.java b/test-suite/generated-src/java/com/dropbox/djinni/test/InterfaceUsingExtendedRecord.java index 682ae0cd5..f58159795 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/InterfaceUsingExtendedRecord.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/InterfaceUsingExtendedRecord.java @@ -7,16 +7,16 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class InterfaceUsingExtendedRecord { +public interface InterfaceUsingExtendedRecord { @Nonnull - public static final RecordUsingExtendedRecord CR = new RecordUsingExtendedRecord( + RecordUsingExtendedRecord CR = new RecordUsingExtendedRecord( new ExtendedRecord( false /* mFoo */ ) /* mEr */ ); @Nonnull - public abstract ExtendedRecord meth(@Nonnull ExtendedRecord er); + public ExtendedRecord meth(@Nonnull ExtendedRecord er); - private static final class CppProxy extends InterfaceUsingExtendedRecord + static final class CppProxy implements InterfaceUsingExtendedRecord { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -28,14 +28,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/JavaOnlyListener.java b/test-suite/generated-src/java/com/dropbox/djinni/test/JavaOnlyListener.java index 8b9a64633..6ba2f11d3 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/JavaOnlyListener.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/JavaOnlyListener.java @@ -6,5 +6,5 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class JavaOnlyListener { +public interface JavaOnlyListener { } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ListenerCaller.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ListenerCaller.java index 934a11b8c..c5f9ca617 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/ListenerCaller.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ListenerCaller.java @@ -13,15 +13,19 @@ * languages, due to the details of multiple inheritance and object * comparison. */ -public abstract class ListenerCaller { - public abstract void callFirst(); +public interface ListenerCaller { + public void callFirst(); - public abstract void callSecond(); + public void callSecond(); @CheckForNull - public static native ListenerCaller init(@CheckForNull FirstListener firstL, @CheckForNull SecondListener secondL); + public static ListenerCaller init(@CheckForNull FirstListener firstL, @CheckForNull SecondListener secondL) + { + return CppProxy.init(firstL, + secondL); + } - private static final class CppProxy extends ListenerCaller + static final class CppProxy implements ListenerCaller { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -33,14 +37,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } @@ -59,5 +63,8 @@ public void callSecond() native_callSecond(this.nativeRef); } private native void native_callSecond(long _nativeRef); + + @CheckForNull + public static native ListenerCaller init(@CheckForNull FirstListener firstL, @CheckForNull SecondListener secondL); } } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ObjcOnlyListener.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ObjcOnlyListener.java index d83e887d5..98fde0ea1 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/ObjcOnlyListener.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ObjcOnlyListener.java @@ -6,5 +6,5 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class ObjcOnlyListener { +public interface ObjcOnlyListener { } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ReturnOne.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ReturnOne.java index a973cd87e..4ed856264 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/ReturnOne.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ReturnOne.java @@ -8,13 +8,16 @@ import javax.annotation.Nonnull; /** Used for C++ multiple inheritance tests */ -public abstract class ReturnOne { - public abstract byte returnOne(); +public interface ReturnOne { + public byte returnOne(); @CheckForNull - public static native ReturnOne getInstance(); + public static ReturnOne getInstance() + { + return CppProxy.getInstance(); + } - private static final class CppProxy extends ReturnOne + static final class CppProxy implements ReturnOne { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -26,14 +29,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } @@ -44,5 +47,8 @@ public byte returnOne() return native_returnOne(this.nativeRef); } private native byte native_returnOne(long _nativeRef); + + @CheckForNull + public static native ReturnOne getInstance(); } } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ReturnTwo.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ReturnTwo.java index 5e3ed043c..580e6a73f 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/ReturnTwo.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ReturnTwo.java @@ -8,13 +8,16 @@ import javax.annotation.Nonnull; /** Used for C++ multiple inheritance tests */ -public abstract class ReturnTwo { - public abstract byte returnTwo(); +public interface ReturnTwo { + public byte returnTwo(); @CheckForNull - public static native ReturnTwo getInstance(); + public static ReturnTwo getInstance() + { + return CppProxy.getInstance(); + } - private static final class CppProxy extends ReturnTwo + static final class CppProxy implements ReturnTwo { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -26,14 +29,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } @@ -44,5 +47,8 @@ public byte returnTwo() return native_returnTwo(this.nativeRef); } private native byte native_returnTwo(long _nativeRef); + + @CheckForNull + public static native ReturnTwo getInstance(); } } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/ReverseClientInterface.java b/test-suite/generated-src/java/com/dropbox/djinni/test/ReverseClientInterface.java index 9dea77f2a..4187bf6f0 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/ReverseClientInterface.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/ReverseClientInterface.java @@ -7,20 +7,23 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class ReverseClientInterface { +public interface ReverseClientInterface { @Nonnull - public abstract String returnStr(); + public String returnStr(); @Nonnull - public abstract String methTakingInterface(@CheckForNull ReverseClientInterface i); + public String methTakingInterface(@CheckForNull ReverseClientInterface i); @Nonnull - public abstract String methTakingOptionalInterface(@CheckForNull ReverseClientInterface i); + public String methTakingOptionalInterface(@CheckForNull ReverseClientInterface i); @CheckForNull - public static native ReverseClientInterface create(); + public static ReverseClientInterface create() + { + return CppProxy.create(); + } - private static final class CppProxy extends ReverseClientInterface + static final class CppProxy implements ReverseClientInterface { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -32,14 +35,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } @@ -66,5 +69,8 @@ public String methTakingOptionalInterface(ReverseClientInterface i) return native_methTakingOptionalInterface(this.nativeRef, i); } private native String native_methTakingOptionalInterface(long _nativeRef, ReverseClientInterface i); + + @CheckForNull + public static native ReverseClientInterface create(); } } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/SecondListener.java b/test-suite/generated-src/java/com/dropbox/djinni/test/SecondListener.java index e25c73493..9bcd6dd3a 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/SecondListener.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/SecondListener.java @@ -7,6 +7,6 @@ import javax.annotation.Nonnull; /** Used for ObjC multiple inheritance tests */ -public abstract class SecondListener { - public abstract void second(); +public interface SecondListener { + public void second(); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/TestDuration.java b/test-suite/generated-src/java/com/dropbox/djinni/test/TestDuration.java index 4331dde0d..d8f64a782 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/TestDuration.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/TestDuration.java @@ -7,67 +7,127 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class TestDuration { +public interface TestDuration { @Nonnull - public static native String hoursString(@Nonnull java.time.Duration dt); + public static String hoursString(@Nonnull java.time.Duration dt) + { + return CppProxy.hoursString(dt); + } @Nonnull - public static native String minutesString(@Nonnull java.time.Duration dt); + public static String minutesString(@Nonnull java.time.Duration dt) + { + return CppProxy.minutesString(dt); + } @Nonnull - public static native String secondsString(@Nonnull java.time.Duration dt); + public static String secondsString(@Nonnull java.time.Duration dt) + { + return CppProxy.secondsString(dt); + } @Nonnull - public static native String millisString(@Nonnull java.time.Duration dt); + public static String millisString(@Nonnull java.time.Duration dt) + { + return CppProxy.millisString(dt); + } @Nonnull - public static native String microsString(@Nonnull java.time.Duration dt); + public static String microsString(@Nonnull java.time.Duration dt) + { + return CppProxy.microsString(dt); + } @Nonnull - public static native String nanosString(@Nonnull java.time.Duration dt); + public static String nanosString(@Nonnull java.time.Duration dt) + { + return CppProxy.nanosString(dt); + } @Nonnull - public static native java.time.Duration hours(int count); + public static java.time.Duration hours(int count) + { + return CppProxy.hours(count); + } @Nonnull - public static native java.time.Duration minutes(int count); + public static java.time.Duration minutes(int count) + { + return CppProxy.minutes(count); + } @Nonnull - public static native java.time.Duration seconds(int count); + public static java.time.Duration seconds(int count) + { + return CppProxy.seconds(count); + } @Nonnull - public static native java.time.Duration millis(int count); + public static java.time.Duration millis(int count) + { + return CppProxy.millis(count); + } @Nonnull - public static native java.time.Duration micros(int count); + public static java.time.Duration micros(int count) + { + return CppProxy.micros(count); + } @Nonnull - public static native java.time.Duration nanos(int count); + public static java.time.Duration nanos(int count) + { + return CppProxy.nanos(count); + } @Nonnull - public static native java.time.Duration hoursf(double count); + public static java.time.Duration hoursf(double count) + { + return CppProxy.hoursf(count); + } @Nonnull - public static native java.time.Duration minutesf(double count); + public static java.time.Duration minutesf(double count) + { + return CppProxy.minutesf(count); + } @Nonnull - public static native java.time.Duration secondsf(double count); + public static java.time.Duration secondsf(double count) + { + return CppProxy.secondsf(count); + } @Nonnull - public static native java.time.Duration millisf(double count); + public static java.time.Duration millisf(double count) + { + return CppProxy.millisf(count); + } @Nonnull - public static native java.time.Duration microsf(double count); + public static java.time.Duration microsf(double count) + { + return CppProxy.microsf(count); + } @Nonnull - public static native java.time.Duration nanosf(double count); + public static java.time.Duration nanosf(double count) + { + return CppProxy.nanosf(count); + } @CheckForNull - public static native java.time.Duration box(long count); + public static java.time.Duration box(long count) + { + return CppProxy.box(count); + } - public static native long unbox(@CheckForNull java.time.Duration dt); + public static long unbox(@CheckForNull java.time.Duration dt) + { + return CppProxy.unbox(dt); + } - private static final class CppProxy extends TestDuration + static final class CppProxy implements TestDuration { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -79,15 +139,74 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } + + @Nonnull + public static native String hoursString(@Nonnull java.time.Duration dt); + + @Nonnull + public static native String minutesString(@Nonnull java.time.Duration dt); + + @Nonnull + public static native String secondsString(@Nonnull java.time.Duration dt); + + @Nonnull + public static native String millisString(@Nonnull java.time.Duration dt); + + @Nonnull + public static native String microsString(@Nonnull java.time.Duration dt); + + @Nonnull + public static native String nanosString(@Nonnull java.time.Duration dt); + + @Nonnull + public static native java.time.Duration hours(int count); + + @Nonnull + public static native java.time.Duration minutes(int count); + + @Nonnull + public static native java.time.Duration seconds(int count); + + @Nonnull + public static native java.time.Duration millis(int count); + + @Nonnull + public static native java.time.Duration micros(int count); + + @Nonnull + public static native java.time.Duration nanos(int count); + + @Nonnull + public static native java.time.Duration hoursf(double count); + + @Nonnull + public static native java.time.Duration minutesf(double count); + + @Nonnull + public static native java.time.Duration secondsf(double count); + + @Nonnull + public static native java.time.Duration millisf(double count); + + @Nonnull + public static native java.time.Duration microsf(double count); + + @Nonnull + public static native java.time.Duration nanosf(double count); + + @CheckForNull + public static native java.time.Duration box(long count); + + public static native long unbox(@CheckForNull java.time.Duration dt); } } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/TestHelpers.java b/test-suite/generated-src/java/com/dropbox/djinni/test/TestHelpers.java index 052461154..72d03cf62 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/TestHelpers.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/TestHelpers.java @@ -13,76 +13,152 @@ * (Second line of multi-line documentation. * Indented third line of multi-line documentation.) */ -public abstract class TestHelpers { +public interface TestHelpers { /** Method with documentation */ @Nonnull - public static native SetRecord getSetRecord(); + public static SetRecord getSetRecord() + { + return CppProxy.getSetRecord(); + } /** * Method with long documentation * (Second line of multi-line documentation. * Indented third line of multi-line documentation.) */ - public static native boolean checkSetRecord(@Nonnull SetRecord rec); + public static boolean checkSetRecord(@Nonnull SetRecord rec) + { + return CppProxy.checkSetRecord(rec); + } @Nonnull - public static native PrimitiveList getPrimitiveList(); + public static PrimitiveList getPrimitiveList() + { + return CppProxy.getPrimitiveList(); + } - public static native boolean checkPrimitiveList(@Nonnull PrimitiveList pl); + public static boolean checkPrimitiveList(@Nonnull PrimitiveList pl) + { + return CppProxy.checkPrimitiveList(pl); + } @Nonnull - public static native NestedCollection getNestedCollection(); + public static NestedCollection getNestedCollection() + { + return CppProxy.getNestedCollection(); + } - public static native boolean checkNestedCollection(@Nonnull NestedCollection nc); + public static boolean checkNestedCollection(@Nonnull NestedCollection nc) + { + return CppProxy.checkNestedCollection(nc); + } @Nonnull - public static native HashMap getMap(); + public static HashMap getMap() + { + return CppProxy.getMap(); + } - public static native boolean checkMap(@Nonnull HashMap m); + public static boolean checkMap(@Nonnull HashMap m) + { + return CppProxy.checkMap(m); + } @Nonnull - public static native HashMap getEmptyMap(); + public static HashMap getEmptyMap() + { + return CppProxy.getEmptyMap(); + } - public static native boolean checkEmptyMap(@Nonnull HashMap m); + public static boolean checkEmptyMap(@Nonnull HashMap m) + { + return CppProxy.checkEmptyMap(m); + } @Nonnull - public static native MapListRecord getMapListRecord(); + public static MapListRecord getMapListRecord() + { + return CppProxy.getMapListRecord(); + } - public static native boolean checkMapListRecord(@Nonnull MapListRecord m); + public static boolean checkMapListRecord(@Nonnull MapListRecord m) + { + return CppProxy.checkMapListRecord(m); + } - public static native void checkClientInterfaceAscii(@CheckForNull ClientInterface i); + public static void checkClientInterfaceAscii(@CheckForNull ClientInterface i) + { + CppProxy.checkClientInterfaceAscii(i); + } - public static native void checkClientInterfaceNonascii(@CheckForNull ClientInterface i); + public static void checkClientInterfaceNonascii(@CheckForNull ClientInterface i) + { + CppProxy.checkClientInterfaceNonascii(i); + } - public static native void checkClientInterfaceArgs(@CheckForNull ClientInterface i); + public static void checkClientInterfaceArgs(@CheckForNull ClientInterface i) + { + CppProxy.checkClientInterfaceArgs(i); + } - public static native void checkEnumMap(@Nonnull HashMap m); + public static void checkEnumMap(@Nonnull HashMap m) + { + CppProxy.checkEnumMap(m); + } - public static native void checkEnum(@Nonnull Color c); + public static void checkEnum(@Nonnull Color c) + { + CppProxy.checkEnum(c); + } @CheckForNull - public static native UserToken tokenId(@CheckForNull UserToken t); + public static UserToken tokenId(@CheckForNull UserToken t) + { + return CppProxy.tokenId(t); + } @CheckForNull - public static native UserToken createCppToken(); + public static UserToken createCppToken() + { + return CppProxy.createCppToken(); + } - public static native void checkCppToken(@CheckForNull UserToken t); + public static void checkCppToken(@CheckForNull UserToken t) + { + CppProxy.checkCppToken(t); + } - public static native long cppTokenId(@CheckForNull UserToken t); + public static long cppTokenId(@CheckForNull UserToken t) + { + return CppProxy.cppTokenId(t); + } - public static native void checkTokenType(@CheckForNull UserToken t, @Nonnull String type); + public static void checkTokenType(@CheckForNull UserToken t, @Nonnull String type) + { + CppProxy.checkTokenType(t, + type); + } @CheckForNull - public static native Integer returnNone(); + public static Integer returnNone() + { + return CppProxy.returnNone(); + } /** Ensures that we generate integer translation code */ @Nonnull - public static native AssortedPrimitives assortedPrimitivesId(@Nonnull AssortedPrimitives i); + public static AssortedPrimitives assortedPrimitivesId(@Nonnull AssortedPrimitives i) + { + return CppProxy.assortedPrimitivesId(i); + } @Nonnull - public static native byte[] idBinary(@Nonnull byte[] b); + public static byte[] idBinary(@Nonnull byte[] b) + { + return CppProxy.idBinary(b); + } - private static final class CppProxy extends TestHelpers + static final class CppProxy implements TestHelpers { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -94,15 +170,76 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } + + @Nonnull + public static native SetRecord getSetRecord(); + + public static native boolean checkSetRecord(@Nonnull SetRecord rec); + + @Nonnull + public static native PrimitiveList getPrimitiveList(); + + public static native boolean checkPrimitiveList(@Nonnull PrimitiveList pl); + + @Nonnull + public static native NestedCollection getNestedCollection(); + + public static native boolean checkNestedCollection(@Nonnull NestedCollection nc); + + @Nonnull + public static native HashMap getMap(); + + public static native boolean checkMap(@Nonnull HashMap m); + + @Nonnull + public static native HashMap getEmptyMap(); + + public static native boolean checkEmptyMap(@Nonnull HashMap m); + + @Nonnull + public static native MapListRecord getMapListRecord(); + + public static native boolean checkMapListRecord(@Nonnull MapListRecord m); + + public static native void checkClientInterfaceAscii(@CheckForNull ClientInterface i); + + public static native void checkClientInterfaceNonascii(@CheckForNull ClientInterface i); + + public static native void checkClientInterfaceArgs(@CheckForNull ClientInterface i); + + public static native void checkEnumMap(@Nonnull HashMap m); + + public static native void checkEnum(@Nonnull Color c); + + @CheckForNull + public static native UserToken tokenId(@CheckForNull UserToken t); + + @CheckForNull + public static native UserToken createCppToken(); + + public static native void checkCppToken(@CheckForNull UserToken t); + + public static native long cppTokenId(@CheckForNull UserToken t); + + public static native void checkTokenType(@CheckForNull UserToken t, @Nonnull String type); + + @CheckForNull + public static native Integer returnNone(); + + @Nonnull + public static native AssortedPrimitives assortedPrimitivesId(@Nonnull AssortedPrimitives i); + + @Nonnull + public static native byte[] idBinary(@Nonnull byte[] b); } } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/UserToken.java b/test-suite/generated-src/java/com/dropbox/djinni/test/UserToken.java index 659e8b58f..0afa70d48 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/UserToken.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/UserToken.java @@ -7,11 +7,11 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class UserToken { +public interface UserToken { @Nonnull - public abstract String whoami(); + public String whoami(); - private static final class CppProxy extends UserToken + static final class CppProxy implements UserToken { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -23,14 +23,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/UsesSingleLanguageListeners.java b/test-suite/generated-src/java/com/dropbox/djinni/test/UsesSingleLanguageListeners.java index 719afba3c..ca910b957 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/UsesSingleLanguageListeners.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/UsesSingleLanguageListeners.java @@ -11,18 +11,18 @@ * Generating and compiling this makes sure other languages don't break * on references to interfaces they don't need. */ -public abstract class UsesSingleLanguageListeners { - public abstract void callForObjC(@CheckForNull ObjcOnlyListener l); +public interface UsesSingleLanguageListeners { + public void callForObjC(@CheckForNull ObjcOnlyListener l); @CheckForNull - public abstract ObjcOnlyListener returnForObjC(); + public ObjcOnlyListener returnForObjC(); - public abstract void callForJava(@CheckForNull JavaOnlyListener l); + public void callForJava(@CheckForNull JavaOnlyListener l); @CheckForNull - public abstract JavaOnlyListener returnForJava(); + public JavaOnlyListener returnForJava(); - private static final class CppProxy extends UsesSingleLanguageListeners + static final class CppProxy implements UsesSingleLanguageListeners { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -34,14 +34,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/VarnameInterface.java b/test-suite/generated-src/java/com/dropbox/djinni/test/VarnameInterface.java index 57b016f5d..d371ff006 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/VarnameInterface.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/VarnameInterface.java @@ -7,14 +7,19 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class VarnameInterface { +public interface VarnameInterface { + /** + * We should also rewrite parameter names in docstrings. + * RArg should be rewritten. + * _i_arg_ should not. + */ @Nonnull - public abstract VarnameRecord Rmethod(@Nonnull VarnameRecord RArg); + public VarnameRecord Rmethod(@Nonnull VarnameRecord RArg); @CheckForNull - public abstract VarnameInterface Imethod(@CheckForNull VarnameInterface IArg); + public VarnameInterface Imethod(@CheckForNull VarnameInterface IArg); - private static final class CppProxy extends VarnameInterface + static final class CppProxy implements VarnameInterface { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -26,14 +31,14 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } diff --git a/test-suite/generated-src/java/com/dropbox/djinni/test/WcharTestHelpers.java b/test-suite/generated-src/java/com/dropbox/djinni/test/WcharTestHelpers.java index eecbbd107..39dcf60e4 100644 --- a/test-suite/generated-src/java/com/dropbox/djinni/test/WcharTestHelpers.java +++ b/test-suite/generated-src/java/com/dropbox/djinni/test/WcharTestHelpers.java @@ -7,18 +7,30 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -public abstract class WcharTestHelpers { +public interface WcharTestHelpers { @Nonnull - public static native WcharTestRec getRecord(); + public static WcharTestRec getRecord() + { + return CppProxy.getRecord(); + } @Nonnull - public static native String getString(); + public static String getString() + { + return CppProxy.getString(); + } - public static native boolean checkString(@Nonnull String str); + public static boolean checkString(@Nonnull String str) + { + return CppProxy.checkString(str); + } - public static native boolean checkRecord(@Nonnull WcharTestRec rec); + public static boolean checkRecord(@Nonnull WcharTestRec rec) + { + return CppProxy.checkRecord(rec); + } - private static final class CppProxy extends WcharTestHelpers + static final class CppProxy implements WcharTestHelpers { private final long nativeRef; private final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -30,15 +42,25 @@ private CppProxy(long nativeRef) } private native void nativeDestroy(long nativeRef); - public void destroy() + public void _djinni_private_destroy() { boolean destroyed = this.destroyed.getAndSet(true); if (!destroyed) nativeDestroy(this.nativeRef); } protected void finalize() throws java.lang.Throwable { - destroy(); + _djinni_private_destroy(); super.finalize(); } + + @Nonnull + public static native WcharTestRec getRecord(); + + @Nonnull + public static native String getString(); + + public static native boolean checkString(@Nonnull String str); + + public static native boolean checkRecord(@Nonnull WcharTestRec rec); } } diff --git a/test-suite/generated-src/jni/NativeConstantEnum.hpp b/test-suite/generated-src/jni/NativeConstantEnum.hpp new file mode 100644 index 000000000..7f255274a --- /dev/null +++ b/test-suite/generated-src/jni/NativeConstantEnum.hpp @@ -0,0 +1,26 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#pragma once + +#include "constant_enum.hpp" +#include "djinni_support.hpp" + +namespace djinni_generated { + +class NativeConstantEnum final : ::djinni::JniEnum { +public: + using CppType = ::testsuite::constant_enum; + using JniType = jobject; + + using Boxed = NativeConstantEnum; + + static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast(::djinni::JniClass::get().ordinal(jniEnv, j)); } + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass::get().create(jniEnv, static_cast(c)); } + +private: + NativeConstantEnum() : JniEnum("com/dropbox/djinni/test/ConstantEnum") {} + friend ::djinni::JniClass; +}; + +} // namespace djinni_generated diff --git a/test-suite/generated-src/jni/NativeConstantInterfaceWithEnum.cpp b/test-suite/generated-src/jni/NativeConstantInterfaceWithEnum.cpp new file mode 100644 index 000000000..9ba160838 --- /dev/null +++ b/test-suite/generated-src/jni/NativeConstantInterfaceWithEnum.cpp @@ -0,0 +1,22 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#include "NativeConstantInterfaceWithEnum.hpp" // my header +#include "NativeConstantEnum.hpp" + +namespace djinni_generated { + +NativeConstantInterfaceWithEnum::NativeConstantInterfaceWithEnum() : ::djinni::JniInterface<::testsuite::ConstantInterfaceWithEnum, NativeConstantInterfaceWithEnum>("com/dropbox/djinni/test/ConstantInterfaceWithEnum$CppProxy") {} + +NativeConstantInterfaceWithEnum::~NativeConstantInterfaceWithEnum() = default; + + +CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ConstantInterfaceWithEnum_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + delete reinterpret_cast<::djinni::CppProxyHandle<::testsuite::ConstantInterfaceWithEnum>*>(nativeRef); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) +} + +} // namespace djinni_generated diff --git a/test-suite/generated-src/jni/NativeConstantInterfaceWithEnum.hpp b/test-suite/generated-src/jni/NativeConstantInterfaceWithEnum.hpp new file mode 100644 index 000000000..bc3a01882 --- /dev/null +++ b/test-suite/generated-src/jni/NativeConstantInterfaceWithEnum.hpp @@ -0,0 +1,32 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#pragma once + +#include "constant_interface_with_enum.hpp" +#include "djinni_support.hpp" + +namespace djinni_generated { + +class NativeConstantInterfaceWithEnum final : ::djinni::JniInterface<::testsuite::ConstantInterfaceWithEnum, NativeConstantInterfaceWithEnum> { +public: + using CppType = std::shared_ptr<::testsuite::ConstantInterfaceWithEnum>; + using CppOptType = std::shared_ptr<::testsuite::ConstantInterfaceWithEnum>; + using JniType = jobject; + + using Boxed = NativeConstantInterfaceWithEnum; + + ~NativeConstantInterfaceWithEnum(); + + static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass::get()._fromJava(jniEnv, j); } + static ::djinni::LocalRef fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass::get()._toJava(jniEnv, c)}; } + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); } + +private: + NativeConstantInterfaceWithEnum(); + friend ::djinni::JniClass; + friend ::djinni::JniInterface<::testsuite::ConstantInterfaceWithEnum, NativeConstantInterfaceWithEnum>; + +}; + +} // namespace djinni_generated diff --git a/test-suite/generated-src/jni/NativeConstantWithEnum.cpp b/test-suite/generated-src/jni/NativeConstantWithEnum.cpp new file mode 100644 index 000000000..9b8b6f72f --- /dev/null +++ b/test-suite/generated-src/jni/NativeConstantWithEnum.cpp @@ -0,0 +1,27 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#include "NativeConstantWithEnum.hpp" // my header + +namespace djinni_generated { + +NativeConstantWithEnum::NativeConstantWithEnum() = default; + +NativeConstantWithEnum::~NativeConstantWithEnum() = default; + +auto NativeConstantWithEnum::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef { + (void)c; // Suppress warnings in release builds for empty records + const auto& data = ::djinni::JniClass::get(); + auto r = ::djinni::LocalRef{jniEnv->NewObject(data.clazz.get(), data.jconstructor)}; + ::djinni::jniExceptionCheck(jniEnv); + return r; +} + +auto NativeConstantWithEnum::toCpp(JNIEnv* jniEnv, JniType j) -> CppType { + ::djinni::JniLocalScope jscope(jniEnv, 1); + assert(j != nullptr); + (void)j; // Suppress warnings in release builds for empty records + return {}; +} + +} // namespace djinni_generated diff --git a/test-suite/generated-src/jni/NativeConstantWithEnum.hpp b/test-suite/generated-src/jni/NativeConstantWithEnum.hpp new file mode 100644 index 000000000..5e3d15b8a --- /dev/null +++ b/test-suite/generated-src/jni/NativeConstantWithEnum.hpp @@ -0,0 +1,31 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#pragma once + +#include "constant_with_enum.hpp" +#include "djinni_support.hpp" + +namespace djinni_generated { + +class NativeConstantWithEnum final { +public: + using CppType = ::testsuite::ConstantWithEnum; + using JniType = jobject; + + using Boxed = NativeConstantWithEnum; + + ~NativeConstantWithEnum(); + + static CppType toCpp(JNIEnv* jniEnv, JniType j); + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c); + +private: + NativeConstantWithEnum(); + friend ::djinni::JniClass; + + const ::djinni::GlobalRef clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/ConstantWithEnum") }; + const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "", "()V") }; +}; + +} // namespace djinni_generated diff --git a/test-suite/generated-src/jni/NativeCppException.cpp b/test-suite/generated-src/jni/NativeCppException.cpp index dc7cfe0a1..06da84963 100644 --- a/test-suite/generated-src/jni/NativeCppException.cpp +++ b/test-suite/generated-src/jni/NativeCppException.cpp @@ -29,7 +29,7 @@ CJNIEXPORT jint JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_ } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_CppException_get(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_get(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); diff --git a/test-suite/generated-src/jni/NativeFlagRoundtrip.cpp b/test-suite/generated-src/jni/NativeFlagRoundtrip.cpp index 225ba6d1b..502bd5af2 100644 --- a/test-suite/generated-src/jni/NativeFlagRoundtrip.cpp +++ b/test-suite/generated-src/jni/NativeFlagRoundtrip.cpp @@ -21,7 +21,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_00024CppProxy } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_roundtripAccess(JNIEnv* jniEnv, jobject /*this*/, jobject j_flag) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_00024CppProxy_roundtripAccess(JNIEnv* jniEnv, jobject /*this*/, jobject j_flag) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -30,7 +30,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_roundtripA } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_roundtripEmpty(JNIEnv* jniEnv, jobject /*this*/, jobject j_flag) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_00024CppProxy_roundtripEmpty(JNIEnv* jniEnv, jobject /*this*/, jobject j_flag) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -39,7 +39,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_roundtripE } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_roundtripAccessBoxed(JNIEnv* jniEnv, jobject /*this*/, jobject j_flag) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_00024CppProxy_roundtripAccessBoxed(JNIEnv* jniEnv, jobject /*this*/, jobject j_flag) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -48,7 +48,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_roundtripA } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_roundtripEmptyBoxed(JNIEnv* jniEnv, jobject /*this*/, jobject j_flag) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_FlagRoundtrip_00024CppProxy_roundtripEmptyBoxed(JNIEnv* jniEnv, jobject /*this*/, jobject j_flag) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); diff --git a/test-suite/generated-src/jni/NativeListenerCaller.cpp b/test-suite/generated-src/jni/NativeListenerCaller.cpp index ea5b2de3e..dc2a1eee6 100644 --- a/test-suite/generated-src/jni/NativeListenerCaller.cpp +++ b/test-suite/generated-src/jni/NativeListenerCaller.cpp @@ -20,7 +20,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ListenerCaller_00024CppProx } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ListenerCaller_init(JNIEnv* jniEnv, jobject /*this*/, jobject j_firstL, jobject j_secondL) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ListenerCaller_00024CppProxy_init(JNIEnv* jniEnv, jobject /*this*/, jobject j_firstL, jobject j_secondL) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); diff --git a/test-suite/generated-src/jni/NativeReturnOne.cpp b/test-suite/generated-src/jni/NativeReturnOne.cpp index 8b2690b53..76ac84e24 100644 --- a/test-suite/generated-src/jni/NativeReturnOne.cpp +++ b/test-suite/generated-src/jni/NativeReturnOne.cpp @@ -19,7 +19,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ReturnOne_00024CppProxy_nat } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ReturnOne_getInstance(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ReturnOne_00024CppProxy_getInstance(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); diff --git a/test-suite/generated-src/jni/NativeReturnTwo.cpp b/test-suite/generated-src/jni/NativeReturnTwo.cpp index 0697e2983..dffef3c97 100644 --- a/test-suite/generated-src/jni/NativeReturnTwo.cpp +++ b/test-suite/generated-src/jni/NativeReturnTwo.cpp @@ -19,7 +19,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ReturnTwo_00024CppProxy_nat } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ReturnTwo_getInstance(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ReturnTwo_00024CppProxy_getInstance(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); diff --git a/test-suite/generated-src/jni/NativeReverseClientInterface.cpp b/test-suite/generated-src/jni/NativeReverseClientInterface.cpp index 013ab8e14..b46930d69 100644 --- a/test-suite/generated-src/jni/NativeReverseClientInterface.cpp +++ b/test-suite/generated-src/jni/NativeReverseClientInterface.cpp @@ -49,7 +49,7 @@ CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_ReverseClientInterface_0 } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ReverseClientInterface_create(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ReverseClientInterface_00024CppProxy_create(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); diff --git a/test-suite/generated-src/jni/NativeTestDuration.cpp b/test-suite/generated-src/jni/NativeTestDuration.cpp index 2712f7901..21ab32b7a 100644 --- a/test-suite/generated-src/jni/NativeTestDuration.cpp +++ b/test-suite/generated-src/jni/NativeTestDuration.cpp @@ -20,7 +20,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_ } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_hoursString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_h>::JniType j_dt) +CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_hoursString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_h>::JniType j_dt) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -29,7 +29,7 @@ CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_hoursString } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_minutesString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_min>::JniType j_dt) +CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_minutesString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_min>::JniType j_dt) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -38,7 +38,7 @@ CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_minutesStri } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_secondsString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_s>::JniType j_dt) +CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_secondsString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_s>::JniType j_dt) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -47,7 +47,7 @@ CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_secondsStri } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_millisString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_ms>::JniType j_dt) +CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_millisString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_ms>::JniType j_dt) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -56,7 +56,7 @@ CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_millisStrin } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_microsString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_us>::JniType j_dt) +CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_microsString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_us>::JniType j_dt) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -65,7 +65,7 @@ CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_microsStrin } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_nanosString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_ns>::JniType j_dt) +CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_nanosString(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I32, ::djinni::Duration_ns>::JniType j_dt) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -74,7 +74,7 @@ CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_TestDuration_nanosString } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_h>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_hours(JNIEnv* jniEnv, jobject /*this*/, jint j_count) +CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_h>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_hours(JNIEnv* jniEnv, jobject /*this*/, jint j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -83,7 +83,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_h>::JniType JNIC } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_min>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_minutes(JNIEnv* jniEnv, jobject /*this*/, jint j_count) +CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_min>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_minutes(JNIEnv* jniEnv, jobject /*this*/, jint j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -92,7 +92,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_min>::JniType JN } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_s>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_seconds(JNIEnv* jniEnv, jobject /*this*/, jint j_count) +CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_s>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_seconds(JNIEnv* jniEnv, jobject /*this*/, jint j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -101,7 +101,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_s>::JniType JNIC } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_ms>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_millis(JNIEnv* jniEnv, jobject /*this*/, jint j_count) +CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_ms>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_millis(JNIEnv* jniEnv, jobject /*this*/, jint j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -110,7 +110,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_ms>::JniType JNI } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_us>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_micros(JNIEnv* jniEnv, jobject /*this*/, jint j_count) +CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_us>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_micros(JNIEnv* jniEnv, jobject /*this*/, jint j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -119,7 +119,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_us>::JniType JNI } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_ns>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_nanos(JNIEnv* jniEnv, jobject /*this*/, jint j_count) +CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_ns>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_nanos(JNIEnv* jniEnv, jobject /*this*/, jint j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -128,7 +128,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::I32, ::djinni::Duration_ns>::JniType JNI } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_h>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_hoursf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) +CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_h>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_hoursf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -137,7 +137,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_h>::JniType JNIC } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_min>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_minutesf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) +CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_min>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_minutesf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -146,7 +146,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_min>::JniType JN } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_s>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_secondsf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) +CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_s>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_secondsf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -155,7 +155,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_s>::JniType JNIC } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_ms>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_millisf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) +CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_ms>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_millisf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -164,7 +164,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_ms>::JniType JNI } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_us>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_microsf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) +CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_us>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_microsf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -173,7 +173,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_us>::JniType JNI } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_ns>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_nanosf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) +CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_ns>::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_nanosf(JNIEnv* jniEnv, jobject /*this*/, jdouble j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -182,7 +182,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::F64, ::djinni::Duration_ns>::JniType JNI } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT ::djinni::Duration<::djinni::I64, ::djinni::Duration_s>::Boxed::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_box(JNIEnv* jniEnv, jobject /*this*/, jlong j_count) +CJNIEXPORT ::djinni::Duration<::djinni::I64, ::djinni::Duration_s>::Boxed::JniType JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_box(JNIEnv* jniEnv, jobject /*this*/, jlong j_count) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -191,7 +191,7 @@ CJNIEXPORT ::djinni::Duration<::djinni::I64, ::djinni::Duration_s>::Boxed::JniTy } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jlong JNICALL Java_com_dropbox_djinni_test_TestDuration_unbox(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I64, ::djinni::Duration_s>::Boxed::JniType j_dt) +CJNIEXPORT jlong JNICALL Java_com_dropbox_djinni_test_TestDuration_00024CppProxy_unbox(JNIEnv* jniEnv, jobject /*this*/, ::djinni::Duration<::djinni::I64, ::djinni::Duration_s>::Boxed::JniType j_dt) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); diff --git a/test-suite/generated-src/jni/NativeTestHelpers.cpp b/test-suite/generated-src/jni/NativeTestHelpers.cpp index f49395ce9..359b07da5 100644 --- a/test-suite/generated-src/jni/NativeTestHelpers.cpp +++ b/test-suite/generated-src/jni/NativeTestHelpers.cpp @@ -27,7 +27,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_n } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getSetRecord(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_getSetRecord(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -36,7 +36,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getSetRecord } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkSetRecord(JNIEnv* jniEnv, jobject /*this*/, jobject j_rec) +CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkSetRecord(JNIEnv* jniEnv, jobject /*this*/, jobject j_rec) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -45,7 +45,7 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkSetRec } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getPrimitiveList(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_getPrimitiveList(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -54,7 +54,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getPrimitive } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkPrimitiveList(JNIEnv* jniEnv, jobject /*this*/, jobject j_pl) +CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkPrimitiveList(JNIEnv* jniEnv, jobject /*this*/, jobject j_pl) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -63,7 +63,7 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkPrimit } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getNestedCollection(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_getNestedCollection(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -72,7 +72,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getNestedCol } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkNestedCollection(JNIEnv* jniEnv, jobject /*this*/, jobject j_nc) +CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkNestedCollection(JNIEnv* jniEnv, jobject /*this*/, jobject j_nc) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -81,7 +81,7 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkNested } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getMap(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_getMap(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -90,7 +90,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getMap(JNIEn } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkMap(JNIEnv* jniEnv, jobject /*this*/, jobject j_m) +CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkMap(JNIEnv* jniEnv, jobject /*this*/, jobject j_m) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -99,7 +99,7 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkMap(JN } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getEmptyMap(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_getEmptyMap(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -108,7 +108,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getEmptyMap( } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkEmptyMap(JNIEnv* jniEnv, jobject /*this*/, jobject j_m) +CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkEmptyMap(JNIEnv* jniEnv, jobject /*this*/, jobject j_m) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -117,7 +117,7 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkEmptyM } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getMapListRecord(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_getMapListRecord(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -126,7 +126,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_getMapListRe } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkMapListRecord(JNIEnv* jniEnv, jobject /*this*/, jobject j_m) +CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkMapListRecord(JNIEnv* jniEnv, jobject /*this*/, jobject j_m) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -135,7 +135,7 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkMapLis } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkClientInterfaceAscii(JNIEnv* jniEnv, jobject /*this*/, jobject j_i) +CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkClientInterfaceAscii(JNIEnv* jniEnv, jobject /*this*/, jobject j_i) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -143,7 +143,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkClientInte } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkClientInterfaceNonascii(JNIEnv* jniEnv, jobject /*this*/, jobject j_i) +CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkClientInterfaceNonascii(JNIEnv* jniEnv, jobject /*this*/, jobject j_i) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -151,7 +151,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkClientInte } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkClientInterfaceArgs(JNIEnv* jniEnv, jobject /*this*/, jobject j_i) +CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkClientInterfaceArgs(JNIEnv* jniEnv, jobject /*this*/, jobject j_i) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -159,7 +159,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkClientInte } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkEnumMap(JNIEnv* jniEnv, jobject /*this*/, jobject j_m) +CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkEnumMap(JNIEnv* jniEnv, jobject /*this*/, jobject j_m) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -167,7 +167,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkEnumMap(JN } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkEnum(JNIEnv* jniEnv, jobject /*this*/, jobject j_c) +CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkEnum(JNIEnv* jniEnv, jobject /*this*/, jobject j_c) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -175,7 +175,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkEnum(JNIEn } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_tokenId(JNIEnv* jniEnv, jobject /*this*/, jobject j_t) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_tokenId(JNIEnv* jniEnv, jobject /*this*/, jobject j_t) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -184,7 +184,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_tokenId(JNIE } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_createCppToken(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_createCppToken(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -193,7 +193,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_createCppTok } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkCppToken(JNIEnv* jniEnv, jobject /*this*/, jobject j_t) +CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkCppToken(JNIEnv* jniEnv, jobject /*this*/, jobject j_t) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -201,7 +201,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkCppToken(J } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT jlong JNICALL Java_com_dropbox_djinni_test_TestHelpers_cppTokenId(JNIEnv* jniEnv, jobject /*this*/, jobject j_t) +CJNIEXPORT jlong JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_cppTokenId(JNIEnv* jniEnv, jobject /*this*/, jobject j_t) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -210,7 +210,7 @@ CJNIEXPORT jlong JNICALL Java_com_dropbox_djinni_test_TestHelpers_cppTokenId(JNI } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkTokenType(JNIEnv* jniEnv, jobject /*this*/, jobject j_t, jstring j_type) +CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_checkTokenType(JNIEnv* jniEnv, jobject /*this*/, jobject j_t, jstring j_type) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -219,7 +219,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_TestHelpers_checkTokenType( } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_returnNone(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_returnNone(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -228,7 +228,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_returnNone(J } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_assortedPrimitivesId(JNIEnv* jniEnv, jobject /*this*/, jobject j_i) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_assortedPrimitivesId(JNIEnv* jniEnv, jobject /*this*/, jobject j_i) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -237,7 +237,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_assortedPrim } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jbyteArray JNICALL Java_com_dropbox_djinni_test_TestHelpers_idBinary(JNIEnv* jniEnv, jobject /*this*/, jbyteArray j_b) +CJNIEXPORT jbyteArray JNICALL Java_com_dropbox_djinni_test_TestHelpers_00024CppProxy_idBinary(JNIEnv* jniEnv, jobject /*this*/, jbyteArray j_b) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); diff --git a/test-suite/generated-src/jni/NativeWcharTestHelpers.cpp b/test-suite/generated-src/jni/NativeWcharTestHelpers.cpp index 19dd54fae..8ea8c9c94 100644 --- a/test-suite/generated-src/jni/NativeWcharTestHelpers.cpp +++ b/test-suite/generated-src/jni/NativeWcharTestHelpers.cpp @@ -20,7 +20,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_00024CppPr } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } -CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_getRecord(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_00024CppProxy_getRecord(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -29,7 +29,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_getReco } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_getString(JNIEnv* jniEnv, jobject /*this*/) +CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_00024CppProxy_getString(JNIEnv* jniEnv, jobject /*this*/) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -38,7 +38,7 @@ CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_getStri } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_checkString(JNIEnv* jniEnv, jobject /*this*/, jstring j_str) +CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_00024CppProxy_checkString(JNIEnv* jniEnv, jobject /*this*/, jstring j_str) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); @@ -47,7 +47,7 @@ CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_checkS } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } -CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_checkRecord(JNIEnv* jniEnv, jobject /*this*/, jobject j_rec) +CJNIEXPORT jboolean JNICALL Java_com_dropbox_djinni_test_WcharTestHelpers_00024CppProxy_checkRecord(JNIEnv* jniEnv, jobject /*this*/, jobject j_rec) { try { DJINNI_FUNCTION_PROLOGUE0(jniEnv); diff --git a/test-suite/generated-src/objc/DBConstantEnum+Private.h b/test-suite/generated-src/objc/DBConstantEnum+Private.h new file mode 100644 index 000000000..2c1fb7067 --- /dev/null +++ b/test-suite/generated-src/objc/DBConstantEnum+Private.h @@ -0,0 +1,6 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#include "constant_enum.hpp" +#import "DJIMarshal+Private.h" + diff --git a/test-suite/generated-src/objc/DBConstantEnum.h b/test-suite/generated-src/objc/DBConstantEnum.h new file mode 100644 index 000000000..6b318dc25 --- /dev/null +++ b/test-suite/generated-src/objc/DBConstantEnum.h @@ -0,0 +1,11 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#import + +/** enum for use in constants */ +typedef NS_ENUM(NSInteger, DBConstantEnum) +{ + DBConstantEnumSomeValue, + DBConstantEnumSomeOtherValue, +}; diff --git a/test-suite/generated-src/objc/DBConstantInterfaceWithEnum+Private.h b/test-suite/generated-src/objc/DBConstantInterfaceWithEnum+Private.h new file mode 100644 index 000000000..f8d192311 --- /dev/null +++ b/test-suite/generated-src/objc/DBConstantInterfaceWithEnum+Private.h @@ -0,0 +1,31 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#include "constant_interface_with_enum.hpp" +#include + +static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); + +@class DBConstantInterfaceWithEnum; + +namespace djinni_generated { + +class ConstantInterfaceWithEnum +{ +public: + using CppType = std::shared_ptr<::testsuite::ConstantInterfaceWithEnum>; + using CppOptType = std::shared_ptr<::testsuite::ConstantInterfaceWithEnum>; + using ObjcType = DBConstantInterfaceWithEnum*; + + using Boxed = ConstantInterfaceWithEnum; + + static CppType toCpp(ObjcType objc); + static ObjcType fromCppOpt(const CppOptType& cpp); + static ObjcType fromCpp(const CppType& cpp) { return fromCppOpt(cpp); } + +private: + class ObjcProxy; +}; + +} // namespace djinni_generated + diff --git a/test-suite/generated-src/objc/DBConstantInterfaceWithEnum+Private.mm b/test-suite/generated-src/objc/DBConstantInterfaceWithEnum+Private.mm new file mode 100644 index 000000000..ae5719e2c --- /dev/null +++ b/test-suite/generated-src/objc/DBConstantInterfaceWithEnum+Private.mm @@ -0,0 +1,60 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#import "DBConstantInterfaceWithEnum+Private.h" +#import "DBConstantInterfaceWithEnum.h" +#import "DBConstantEnum+Private.h" +#import "DJICppWrapperCache+Private.h" +#import "DJIError.h" +#include +#include +#include + +static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); + +@interface DBConstantInterfaceWithEnum () + +- (id)initWithCpp:(const std::shared_ptr<::testsuite::ConstantInterfaceWithEnum>&)cppRef; + +@end + +@implementation DBConstantInterfaceWithEnum { + ::djinni::CppProxyCache::Handle> _cppRefHandle; +} + +- (id)initWithCpp:(const std::shared_ptr<::testsuite::ConstantInterfaceWithEnum>&)cppRef +{ + if (self = [super init]) { + _cppRefHandle.assign(cppRef); + } + return self; +} + ++ (DBConstantEnum)constEnum +{ + static DBConstantEnum const s_constEnum = DBConstantEnumSomeValue; + return s_constEnum; +} + + +namespace djinni_generated { + +auto ConstantInterfaceWithEnum::toCpp(ObjcType objc) -> CppType +{ + if (!objc) { + return nullptr; + } + return objc->_cppRefHandle.get(); +} + +auto ConstantInterfaceWithEnum::fromCppOpt(const CppOptType& cpp) -> ObjcType +{ + if (!cpp) { + return nil; + } + return ::djinni::get_cpp_proxy(cpp); +} + +} // namespace djinni_generated + +@end diff --git a/test-suite/generated-src/objc/DBConstantInterfaceWithEnum.h b/test-suite/generated-src/objc/DBConstantInterfaceWithEnum.h new file mode 100644 index 000000000..4bce1df46 --- /dev/null +++ b/test-suite/generated-src/objc/DBConstantInterfaceWithEnum.h @@ -0,0 +1,12 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#import "DBConstantEnum.h" +#import + + +/** Interface containing enum constant */ +@interface DBConstantInterfaceWithEnum : NSObject + ++ (DBConstantEnum)constEnum; +@end diff --git a/test-suite/generated-src/objc/DBConstantInterfaceWithEnum.mm b/test-suite/generated-src/objc/DBConstantInterfaceWithEnum.mm new file mode 100644 index 000000000..8d9fc579c --- /dev/null +++ b/test-suite/generated-src/objc/DBConstantInterfaceWithEnum.mm @@ -0,0 +1,5 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#import "DBConstantInterfaceWithEnum.h" + diff --git a/test-suite/generated-src/objc/DBConstantWithEnum+Private.h b/test-suite/generated-src/objc/DBConstantWithEnum+Private.h new file mode 100644 index 000000000..162c927aa --- /dev/null +++ b/test-suite/generated-src/objc/DBConstantWithEnum+Private.h @@ -0,0 +1,24 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#import "DBConstantWithEnum.h" +#include "constant_with_enum.hpp" + +static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); + +@class DBConstantWithEnum; + +namespace djinni_generated { + +struct ConstantWithEnum +{ + using CppType = ::testsuite::ConstantWithEnum; + using ObjcType = DBConstantWithEnum*; + + using Boxed = ConstantWithEnum; + + static CppType toCpp(ObjcType objc); + static ObjcType fromCpp(const CppType& cpp); +}; + +} // namespace djinni_generated diff --git a/test-suite/generated-src/objc/DBConstantWithEnum+Private.mm b/test-suite/generated-src/objc/DBConstantWithEnum+Private.mm new file mode 100644 index 000000000..506e37723 --- /dev/null +++ b/test-suite/generated-src/objc/DBConstantWithEnum+Private.mm @@ -0,0 +1,23 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#import "DBConstantWithEnum+Private.h" +#import "DBConstantEnum+Private.h" +#include + +namespace djinni_generated { + +auto ConstantWithEnum::toCpp(ObjcType obj) -> CppType +{ + assert(obj); + (void)obj; // Suppress warnings in relase builds for empty records + return {}; +} + +auto ConstantWithEnum::fromCpp(const CppType& cpp) -> ObjcType +{ + (void)cpp; // Suppress warnings in relase builds for empty records + return [[DBConstantWithEnum alloc] init]; +} + +} // namespace djinni_generated diff --git a/test-suite/generated-src/objc/DBConstantWithEnum.h b/test-suite/generated-src/objc/DBConstantWithEnum.h new file mode 100644 index 000000000..56f464ec3 --- /dev/null +++ b/test-suite/generated-src/objc/DBConstantWithEnum.h @@ -0,0 +1,14 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#import "DBConstantEnum.h" +#import + +/** Record containing enum constant */ +@interface DBConstantWithEnum : NSObject +- (nonnull instancetype)init; ++ (nonnull instancetype)constantWithEnum; + ++ (DBConstantEnum)constEnum; +@end + diff --git a/test-suite/generated-src/objc/DBConstantWithEnum.mm b/test-suite/generated-src/objc/DBConstantWithEnum.mm new file mode 100644 index 000000000..ce60fd23c --- /dev/null +++ b/test-suite/generated-src/objc/DBConstantWithEnum.mm @@ -0,0 +1,32 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from constant_enum.djinni + +#import "DBConstantWithEnum.h" + + +@implementation DBConstantWithEnum + +- (nonnull instancetype)init +{ + if (self = [super init]) { + } + return self; +} + ++ (nonnull instancetype)constantWithEnum +{ + return [[self alloc] init]; +} + ++ (DBConstantEnum)constEnum +{ + static DBConstantEnum const s_constEnum = DBConstantEnumSomeValue; + return s_constEnum; +} + +- (NSString *)description +{ + return [NSString stringWithFormat:@"<%@ %p>", self.class, (void *)self]; +} + +@end diff --git a/test-suite/generated-src/objc/DBVarnameInterface.h b/test-suite/generated-src/objc/DBVarnameInterface.h index ec27c0279..c3f0a83ce 100644 --- a/test-suite/generated-src/objc/DBVarnameInterface.h +++ b/test-suite/generated-src/objc/DBVarnameInterface.h @@ -8,6 +8,11 @@ @interface DBVarnameInterface : NSObject +/** + * We should also rewrite parameter names in docstrings. + * RArg should be rewritten. + * _i_arg_ should not. + */ - (nonnull DBVarnameRecord *)Rmethod:(nonnull DBVarnameRecord *)RArg; - (nullable DBVarnameInterface *)Imethod:(nullable DBVarnameInterface *)IArg; diff --git a/test-suite/generated-src/outFileList.txt b/test-suite/generated-src/outFileList.txt index a99741bc7..cebf65b09 100644 --- a/test-suite/generated-src/outFileList.txt +++ b/test-suite/generated-src/outFileList.txt @@ -4,6 +4,11 @@ djinni-output-temp/cpp/record_with_duration_and_derivings.cpp djinni-output-temp/cpp/date_record.hpp djinni-output-temp/cpp/date_record.cpp djinni-output-temp/cpp/map_date_record.hpp +djinni-output-temp/cpp/constant_enum.hpp +djinni-output-temp/cpp/constant_with_enum.hpp +djinni-output-temp/cpp/constant_with_enum.cpp +djinni-output-temp/cpp/constant_interface_with_enum.hpp +djinni-output-temp/cpp/constant_interface_with_enum.cpp djinni-output-temp/cpp/access_flags.hpp djinni-output-temp/cpp/empty_flags.hpp djinni-output-temp/cpp/flag_roundtrip.hpp @@ -56,6 +61,9 @@ djinni-output-temp/java/TestDuration.java djinni-output-temp/java/RecordWithDurationAndDerivings.java djinni-output-temp/java/DateRecord.java djinni-output-temp/java/MapDateRecord.java +djinni-output-temp/java/ConstantEnum.java +djinni-output-temp/java/ConstantWithEnum.java +djinni-output-temp/java/ConstantInterfaceWithEnum.java djinni-output-temp/java/AccessFlags.java djinni-output-temp/java/EmptyFlags.java djinni-output-temp/java/FlagRoundtrip.java @@ -104,6 +112,11 @@ djinni-output-temp/jni/NativeDateRecord.hpp djinni-output-temp/jni/NativeDateRecord.cpp djinni-output-temp/jni/NativeMapDateRecord.hpp djinni-output-temp/jni/NativeMapDateRecord.cpp +djinni-output-temp/jni/NativeConstantEnum.hpp +djinni-output-temp/jni/NativeConstantWithEnum.hpp +djinni-output-temp/jni/NativeConstantWithEnum.cpp +djinni-output-temp/jni/NativeConstantInterfaceWithEnum.hpp +djinni-output-temp/jni/NativeConstantInterfaceWithEnum.cpp djinni-output-temp/jni/NativeAccessFlags.hpp djinni-output-temp/jni/NativeEmptyFlags.hpp djinni-output-temp/jni/NativeFlagRoundtrip.hpp @@ -188,6 +201,11 @@ djinni-output-temp/objc/DBDateRecord.h djinni-output-temp/objc/DBDateRecord.mm djinni-output-temp/objc/DBMapDateRecord.h djinni-output-temp/objc/DBMapDateRecord.mm +djinni-output-temp/objc/DBConstantEnum.h +djinni-output-temp/objc/DBConstantWithEnum.h +djinni-output-temp/objc/DBConstantWithEnum.mm +djinni-output-temp/objc/DBConstantInterfaceWithEnum.h +djinni-output-temp/objc/DBConstantInterfaceWithEnum.mm djinni-output-temp/objc/DBAccessFlags.h djinni-output-temp/objc/DBEmptyFlags.h djinni-output-temp/objc/DBFlagRoundtrip.h @@ -255,6 +273,11 @@ djinni-output-temp/objc/DBDateRecord+Private.h djinni-output-temp/objc/DBDateRecord+Private.mm djinni-output-temp/objc/DBMapDateRecord+Private.h djinni-output-temp/objc/DBMapDateRecord+Private.mm +djinni-output-temp/objc/DBConstantEnum+Private.h +djinni-output-temp/objc/DBConstantWithEnum+Private.h +djinni-output-temp/objc/DBConstantWithEnum+Private.mm +djinni-output-temp/objc/DBConstantInterfaceWithEnum+Private.h +djinni-output-temp/objc/DBConstantInterfaceWithEnum+Private.mm djinni-output-temp/objc/DBAccessFlags+Private.h djinni-output-temp/objc/DBEmptyFlags+Private.h djinni-output-temp/objc/DBFlagRoundtrip+Private.h diff --git a/test-suite/handwritten-src/java/com/dropbox/djinni/test/ClientInterfaceImpl.java b/test-suite/handwritten-src/java/com/dropbox/djinni/test/ClientInterfaceImpl.java index 0049334e9..822125f43 100644 --- a/test-suite/handwritten-src/java/com/dropbox/djinni/test/ClientInterfaceImpl.java +++ b/test-suite/handwritten-src/java/com/dropbox/djinni/test/ClientInterfaceImpl.java @@ -2,7 +2,7 @@ import javax.annotation.CheckForNull; -public class ClientInterfaceImpl extends ClientInterface { +public class ClientInterfaceImpl implements ClientInterface { @Override public ClientReturnedRecord getRecord(long id, String utf8string, String misc) { if (!utf8string.equals("Non-ASCII /\0 非 ASCII 字符") && !utf8string.equals("Hello World!")) { diff --git a/test-suite/handwritten-src/java/com/dropbox/djinni/test/TokenTest.java b/test-suite/handwritten-src/java/com/dropbox/djinni/test/TokenTest.java index 0a89e4470..c625ca868 100644 --- a/test-suite/handwritten-src/java/com/dropbox/djinni/test/TokenTest.java +++ b/test-suite/handwritten-src/java/com/dropbox/djinni/test/TokenTest.java @@ -4,7 +4,7 @@ public class TokenTest extends TestCase { - private class JavaToken extends UserToken { + private class JavaToken implements UserToken { public String whoami() { return "Java"; } } diff --git a/test-suite/java/build.xml b/test-suite/java/build.xml index eea2ce5e4..4e67b15e0 100644 --- a/test-suite/java/build.xml +++ b/test-suite/java/build.xml @@ -35,7 +35,7 @@ - + diff --git a/test-suite/objc/DjinniObjcTest.xcodeproj/project.pbxproj b/test-suite/objc/DjinniObjcTest.xcodeproj/project.pbxproj index 36b34b027..2e7cac57c 100644 --- a/test-suite/objc/DjinniObjcTest.xcodeproj/project.pbxproj +++ b/test-suite/objc/DjinniObjcTest.xcodeproj/project.pbxproj @@ -438,6 +438,9 @@ CFFD58B01B041BD9001E10B6 /* DBConstantsInterface+Private.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "DBConstantsInterface+Private.mm"; sourceTree = ""; }; CFFD58B51B041BFD001E10B6 /* constants_interface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = constants_interface.cpp; sourceTree = ""; }; CFFD58B61B041BFD001E10B6 /* constants_interface.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = constants_interface.hpp; sourceTree = ""; }; + FAB1E3382024112400B8E3CC /* constant_enum.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = constant_enum.hpp; sourceTree = ""; }; + FAB1E3392024115900B8E3CC /* DBConstantEnum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBConstantEnum.h; sourceTree = ""; }; + FAB1E33A2024115900B8E3CC /* DBConstantEnum+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DBConstantEnum+Private.h"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -593,6 +596,8 @@ B5F06A711D4973BD005BE736 /* DBConflictUser.h */, B5F06A721D4973BD005BE736 /* DBConflictUser+Private.h */, B5F06A731D4973BD005BE736 /* DBConflictUser+Private.mm */, + FAB1E3392024115900B8E3CC /* DBConstantEnum.h */, + FAB1E33A2024115900B8E3CC /* DBConstantEnum+Private.h */, B5D8FC321C23E2F40045ADCF /* DBConstantRecord.h */, B5D8FC331C23E2F40045ADCF /* DBConstantRecord.mm */, B5D8FC341C23E2F40045ADCF /* DBConstantRecord+Private.h */, @@ -748,31 +753,18 @@ A242495D1AF192FC003BF8F0 /* generated-cpp */ = { isa = PBXGroup; children = ( - B58B16B21D5AD55B00EF92B5 /* record_using_extended_record.cpp */, - B58B16B31D5AD55B00EF92B5 /* interface_using_extended_record.cpp */, - B58B16A61D5AC9AD00EF92B5 /* record_using_extended_record.hpp */, - B58B16A71D5AC9AD00EF92B5 /* interface_using_extended_record.hpp */, - B51911471D555EDC00772DFE /* _varname_record_.hpp */, B51911481D555EDC00772DFE /* _varname_interface_.hpp */, - B51911191D542AEC00772DFE /* wchar_test_helpers.hpp */, - B5153F871D54282C00012654 /* wchar_test_rec.hpp */, - B5F06A9B1D4987C7005BE736 /* enum_usage_interface.hpp */, - B5F06A9C1D4987C7005BE736 /* enum_usage_record.hpp */, - B5F06A651D497396005BE736 /* conflict_user.hpp */, - B5F06A661D497396005BE736 /* Conflict.hpp */, - B5F06A681D497396005BE736 /* extended_record_base.cpp */, - B5F06A691D497396005BE736 /* extended_record_base.hpp */, - B5F06A6A1D497396005BE736 /* java_only_listener.hpp */, - B5F06A6B1D497396005BE736 /* objc_only_listener.hpp */, - B5F06A6C1D497396005BE736 /* uses_single_language_listeners.hpp */, + B51911471D555EDC00772DFE /* _varname_record_.hpp */, CFBBB8ED1B6E3A72002EF52F /* access_flags.hpp */, - B5D8FC381C23E30D0045ADCF /* constant_record.hpp */, - B5E9C93C1C1F9DCA0073C123 /* reverse_client_interface.hpp */, B52DA56C1B103FBE005CE75F /* assorted_primitives.cpp */, B52DA56D1B103FBE005CE75F /* assorted_primitives.hpp */, A24249601AF192FC003BF8F0 /* client_interface.hpp */, A24249611AF192FC003BF8F0 /* client_returned_record.hpp */, A24249621AF192FC003BF8F0 /* color.hpp */, + B5F06A651D497396005BE736 /* conflict_user.hpp */, + B5F06A661D497396005BE736 /* Conflict.hpp */, + FAB1E3382024112400B8E3CC /* constant_enum.hpp */, + B5D8FC381C23E30D0045ADCF /* constant_record.hpp */, CFFD58B51B041BFD001E10B6 /* constants_interface.cpp */, CFFD58B61B041BFD001E10B6 /* constants_interface.hpp */, A24249631AF192FC003BF8F0 /* constants.cpp */, @@ -782,18 +774,28 @@ A24249661AF192FC003BF8F0 /* date_record.hpp */, CFBBB8E71B6E3747002EF52F /* empty_flags.hpp */, CFAED8771B54292600E3B8A3 /* empty_record.hpp */, + B5F06A9B1D4987C7005BE736 /* enum_usage_interface.hpp */, + B5F06A9C1D4987C7005BE736 /* enum_usage_record.hpp */, + B5F06A681D497396005BE736 /* extended_record_base.cpp */, + B5F06A691D497396005BE736 /* extended_record_base.hpp */, CFC5D9E01B1513D800BF2DF8 /* extern_interface_1.hpp */, CFC5D9E11B1513D800BF2DF8 /* extern_interface_2.hpp */, CFC5D9CE1B15105100BF2DF8 /* extern_record_with_derivings.cpp */, CFC5D9CF1B15105100BF2DF8 /* extern_record_with_derivings.hpp */, 6551683A1C404B58003682A4 /* first_listener.hpp */, CFBBB8F41B6EF0A0002EF52F /* flag_roundtrip.hpp */, + B58B16B31D5AD55B00EF92B5 /* interface_using_extended_record.cpp */, + B58B16A71D5AC9AD00EF92B5 /* interface_using_extended_record.hpp */, + B5F06A6A1D497396005BE736 /* java_only_listener.hpp */, 650CA04E1C2AB460007ADDDB /* listener_caller.hpp */, A24249671AF192FC003BF8F0 /* map_date_record.hpp */, A24249681AF192FC003BF8F0 /* map_list_record.hpp */, A24249691AF192FC003BF8F0 /* map_record.hpp */, A242496A1AF192FC003BF8F0 /* nested_collection.hpp */, + B5F06A6B1D497396005BE736 /* objc_only_listener.hpp */, A242496B1AF192FC003BF8F0 /* primitive_list.hpp */, + B58B16B21D5AD55B00EF92B5 /* record_using_extended_record.cpp */, + B58B16A61D5AC9AD00EF92B5 /* record_using_extended_record.hpp */, A242496C1AF192FC003BF8F0 /* record_with_derivings.cpp */, A242496D1AF192FC003BF8F0 /* record_with_derivings.hpp */, CFC5DA0C1B15330000BF2DF8 /* record_with_duration_and_derivings.cpp */, @@ -803,11 +805,15 @@ A242496F1AF192FC003BF8F0 /* record_with_nested_derivings.hpp */, 655168441C40508A003682A4 /* return_one.hpp */, 655168451C40508A003682A4 /* return_two.hpp */, + B5E9C93C1C1F9DCA0073C123 /* reverse_client_interface.hpp */, 6551683B1C404B58003682A4 /* second_listener.hpp */, A24249701AF192FC003BF8F0 /* set_record.hpp */, CFC5DA031B15319600BF2DF8 /* test_duration.hpp */, A24249711AF192FC003BF8F0 /* test_helpers.hpp */, A24249721AF192FC003BF8F0 /* user_token.hpp */, + B5F06A6C1D497396005BE736 /* uses_single_language_listeners.hpp */, + B51911191D542AEC00772DFE /* wchar_test_helpers.hpp */, + B5153F871D54282C00012654 /* wchar_test_rec.hpp */, ); name = "generated-cpp"; path = "../generated-src/cpp"; diff --git a/test-suite/run_djinni.sh b/test-suite/run_djinni.sh index 022db0be2..4e25a5010 100755 --- a/test-suite/run_djinni.sh +++ b/test-suite/run_djinni.sh @@ -66,6 +66,7 @@ fi "$base_dir/../src/run-assume-built" \ --java-out "$temp_out_relative/java" \ --java-package $java_package \ + --java-generate-interfaces true \ --java-nullable-annotation "javax.annotation.CheckForNull" \ --java-nonnull-annotation "javax.annotation.Nonnull" \ --java-use-final-for-record false \ @@ -95,6 +96,7 @@ fi "$base_dir/../src/run-assume-built" \ --java-out "$temp_out_relative/java" \ --java-package $java_package \ + --java-generate-interfaces true \ --java-nullable-annotation "javax.annotation.CheckForNull" \ --java-nonnull-annotation "javax.annotation.Nonnull" \ --java-use-final-for-record false \ @@ -133,6 +135,7 @@ cp "$base_dir/djinni/yaml-test.djinni" "$temp_out/yaml" "$base_dir/../src/run-assume-built" \ --java-out "$temp_out_relative/java" \ --java-package $java_package \ + --java-generate-interfaces true \ --ident-java-field mFooBar \ \ --cpp-out "$temp_out_relative/cpp" \