(Class<?> cls, Map<String, ?> options, Object proxy)
| 2077 | * looking them up later. |
| 2078 | */ |
| 2079 | private static Map<String, Object> cacheOptions(Class<?> cls, Map<String, ?> options, Object proxy) { |
| 2080 | Map<String, Object> libOptions = new HashMap<>(options); |
| 2081 | libOptions.put(_OPTION_ENCLOSING_LIBRARY, cls); |
| 2082 | typeOptions.put(cls, libOptions); |
| 2083 | if (proxy != null) { |
| 2084 | libraries.put(cls, new WeakReference<>(proxy)); |
| 2085 | } |
| 2086 | |
| 2087 | // If it's a direct mapping, AND implements a Library interface, |
| 2088 | // cache the library interface as well, so that any nested |
| 2089 | // classes get the appropriate associated options |
| 2090 | if (!cls.isInterface() |
| 2091 | && Library.class.isAssignableFrom(cls)) { |
| 2092 | Class<?> ifaces[] = cls.getInterfaces(); |
| 2093 | for (Class<?> ifc : ifaces) { |
| 2094 | if (Library.class.isAssignableFrom(ifc)) { |
| 2095 | cacheOptions(ifc, libOptions, proxy); |
| 2096 | break; |
| 2097 | } |
| 2098 | } |
| 2099 | } |
| 2100 | return libOptions; |
| 2101 | } |
| 2102 | |
| 2103 | private static native long registerMethod(Class<?> cls, |
| 2104 | String name, |
no test coverage detected