Loading src/main/java/com/nextcloud/android/sso/api/NextcloudAPI.java +15 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import java.io.Reader; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.lang.reflect.Constructor; import java.lang.reflect.Type; import io.reactivex.Observable; Loading @@ -45,6 +46,18 @@ public class NextcloudAPI { private static final String TAG = NextcloudAPI.class.getCanonicalName(); private static final Void NOTHING = getVoidInstance(); private static Void getVoidInstance() { Constructor<Void> constructor = (Constructor<Void>) Void.class.getDeclaredConstructors()[0]; constructor.setAccessible(true); try { return constructor.newInstance(); } catch (Exception e) { throw new IllegalStateException("Should never happen, but did: unable to instantiate Void"); } } private NetworkRequest networkRequest; private Gson gson; Loading Loading @@ -125,6 +138,8 @@ public class NextcloudAPI { Log.d(TAG, result.toString()); } */ } else { result = (T) NOTHING; } } return result; Loading Loading
src/main/java/com/nextcloud/android/sso/api/NextcloudAPI.java +15 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import java.io.Reader; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.lang.reflect.Constructor; import java.lang.reflect.Type; import io.reactivex.Observable; Loading @@ -45,6 +46,18 @@ public class NextcloudAPI { private static final String TAG = NextcloudAPI.class.getCanonicalName(); private static final Void NOTHING = getVoidInstance(); private static Void getVoidInstance() { Constructor<Void> constructor = (Constructor<Void>) Void.class.getDeclaredConstructors()[0]; constructor.setAccessible(true); try { return constructor.newInstance(); } catch (Exception e) { throw new IllegalStateException("Should never happen, but did: unable to instantiate Void"); } } private NetworkRequest networkRequest; private Gson gson; Loading Loading @@ -125,6 +138,8 @@ public class NextcloudAPI { Log.d(TAG, result.toString()); } */ } else { result = (T) NOTHING; } } return result; Loading