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

Commit e19aae1c authored by desperateCoder's avatar desperateCoder
Browse files

#231 fix void return type

parent e16cdea6
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@ import java.io.Reader;
import java.lang.annotation.Documented;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.annotation.Target;
import java.lang.reflect.Constructor;
import java.lang.reflect.Type;
import java.lang.reflect.Type;


import io.reactivex.Observable;
import io.reactivex.Observable;
@@ -45,6 +46,18 @@ public class NextcloudAPI {


    private static final String TAG = NextcloudAPI.class.getCanonicalName();
    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 NetworkRequest networkRequest;
    private Gson gson;
    private Gson gson;


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