Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 8e919ede authored by Tobias Kaminsky's avatar Tobias Kaminsky Committed by GitHub
Browse files

Merge pull request #232 from desperateCoder/231-void-return-type

#231 fix void return type
parents 815ec85a e19aae1c
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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;

@@ -125,6 +138,8 @@ public class NextcloudAPI {
                    Log.d(TAG, result.toString());
                }
                */
            } else {
                result = (T) NOTHING;
            }
        }
        return result;