String (Class<?> ifaceClass, String objVarName) { return ifaceClass.getSimpleName() + " unwrapped" + objVarName + " = " + "jbUnwrap(" + ifaceClass.getSimpleName() + ".class, " + objVarName + ");" + "\n\n\t\twhere\n\n" + "private static <T> T jbUnwrap(Class<? extends T> iface, T wrapper) {\n" + " T unwrapped = null;\n" + " try {\n" + " final Class<?> apiWrappers = wrapper.getClass().getClassLoader().loadClass(\"org.jetbrains.jps.javac.APIWrappers\");\n" + " final Method unwrapMethod = apiWrappers.getDeclaredMethod(\"unwrap\", Class.class, Object.class);\n" + " unwrapped = iface.cast(unwrapMethod.invoke(null, iface, wrapper));\n" + " }\n" + " catch (Throwable ignored) {}\n" + " return unwrapped != null? unwrapped : wrapper;\n" + "}"; }