profile
viewpoint
Jake Wharton JakeWharton Google, Inc. Pittsburgh, PA, USA http://jakewharton.com

JakeWharton/butterknife 25081

Bind Android views and callbacks to fields and methods.

google/gson 17350

A Java serialization/deserialization library to convert Java Objects into JSON and back

JakeWharton/ActionBarSherlock 7224

[DEPRECATED] Action bar implementation which uses the native action bar on Android 4.0+ and a custom implementation on pre-4.0 through a single API and theme.

JakeWharton/DiskLruCache 5277

Java implementation of a Disk-based LRU cache which specifically targets Android compatibility.

cashapp/sqldelight 3043

SQLDelight - Generates typesafe Kotlin APIs from SQL

JakeWharton/Android-DirectionalViewPager 1047

[DEPRECATED] Implementation of the compatibility library ViewPager class that supports paging both vertically and horizontally.

JakeWharton/diffuse 810

Diffuse is a tool for diffing APKs, AABs, AARs, and JARs

JakeWharton/dagger-reflect 590

A reflection-based implementation of the Dagger dependency injection library for fast IDE builds.

JakeWharton/AutoValueAnnotations 230

A standalone packaging of the annotations from Google's AutoValue library.

JakeWharton/adjacent-fragment-pager-sample 221

Demonstrates how to manage two fragments where portrait displays them in a ViewPager and landscape displays them side-by-side.

issue closedsquare/retrofit

ETag cache not working

I'm trying to get cache working - including the use of ETags, but so far I've had no success.

This is my OkHttpClient Builder: val cache = Cache( directory = app.cacheDir, maxSize = 10L * 1024L * 1024L ) return OkHttpClient.Builder() .cache(cache) .addNetworkInterceptor(rxOAuthManager.provideAuthInterceptor()) .addInterceptor(httpLoggingInterceptor) .addInterceptor( ConnectivityInterceptor( app, connectivityChecker ) )

And here's a sample response from my server: 2020-02-24 17:17:23.937 15661-16048/de.tafmobile.android.payu.local D/OkHttp: <-- 200 http://192.168.120.67:8000/restapi/product/v1/catalog (6ms) 2020-02-24 17:17:23.937 15661-16048/de.tafmobile.android.payu.local D/OkHttp: Date: Mon, 24 Feb 2020 16:05:01 GMT 2020-02-24 17:17:23.937 15661-16048/de.tafmobile.android.payu.local D/OkHttp: X-Content-Type-Options: nosniff 2020-02-24 17:17:23.937 15661-16048/de.tafmobile.android.payu.local D/OkHttp: X-XSS-Protection: 1; mode=block 2020-02-24 17:17:23.937 15661-16048/de.tafmobile.android.payu.local D/OkHttp: X-Frame-Options: DENY 2020-02-24 17:17:23.937 15661-16048/de.tafmobile.android.payu.local D/OkHttp: ETag: "0eff0ea3a1471aaa7e8fd2b895db52eb7" 2020-02-24 17:17:23.937 15661-16048/de.tafmobile.android.payu.local D/OkHttp: Cache-Control: max-age=24898, must-revalidate, private

I can get ETag working if I manually save the ETag and send it through a @Header parameter in the request, but I reckon Retrofit usually manages ETag and some other caching automatically, right?

Thanks in advance!

closed time in 34 minutes

victorlsn

issue commentsquare/retrofit

ETag cache not working

Retrofit knows nothing about OkHttp's cache and does not manage it in any way. We only use OkHttp to model requests and responses. The mechanisms of its internals like caching are completely opaque to Retrofit and it isn't in a position to control them.

If you think there's a bug in OkHttp's behavior you should isolate it into a test case with MockWebServer where you can script both the client and server behavior to ensure everyone is seeing the same behavior and is clear on what the expectations are and then create an issue on OkHttp. If this is just a general usage question about OkHttp's behavior with regard to ETags then I would recommend posting on StackOverflow with the 'okhttp' tag.

victorlsn

comment created time in 34 minutes

issue commentsquare/moshi

How to skip data containers

You can write a Moshi adapter which handles enveloping which will work anywhere in the JSON tree.

meruiden

comment created time in 2 hours

issue commentgoogle/desugar_jdk_libs

When will Android support Java 11?

Which ones are you wanting? I can prioritize anything that is needed.

The list of supported Java 11 desugarings is here: https://r8.googlesource.com/r8/+/refs/heads/master/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java#1474

and here: https://r8.googlesource.com/r8/+/refs/heads/master/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java#1643

You can also find those from Java 9 and 10 in that same file. Sadly I'm blocked on adding ones from 12, 13, and 14 until a new JDK is added to the R8 project. Hopefully I can convince them to add 14 so I can work on all 3.

Unfortunately, for now, the only way to use these methods is by writing a pure Java library against JDK 11 and then pulling that into an Android project. D8/R8 can handle Java 11 bytecode just fine. You cannot write an Android project and link against them because they are not in the android.jar. Despite my best efforts, only a paltry few APIs from Java 9 made it into R. At least they're instantly available down to API 1 thanks to D8/R8.

LifeIsStrange

comment created time in 18 hours

issue commentgoogle/desugar_jdk_libs

When will Android support Java 11?

This repository is for APIs implementations which has nothing to do with ART or the Dalvik file format so it's not the appropriate place to ask. You're free to file your own issue about Java 11 on the Android tracker.

LifeIsStrange

comment created time in a day

issue commentsquare/retrofit

First-party RxJava 3 adapter

This library is built entirely on volunteer time so there are no ETAs.

JakeWharton

comment created time in 2 days

pull request commentsquare/okhttp

Handle Android 11 restrictions

This PR is for 11

yschimke

comment created time in 2 days

pull request commentsquare/okhttp

Handle Android 11 restrictions

Just remember that API 29 is non-final so while it's probably safe to rely on these new APIs at this point (internal API freeze has happened), it's technically not stable yet and could change. It would be safer to ship reflection and switch to direct linking in a few months.

yschimke

comment created time in 2 days

push eventJakeWharton/SdkSearch

Jake Wharton

commit sha f18c7cc8792f24e0d3406309761893e572b57a81

Add Bugsnag callout

view details

push time in 3 days

push eventJakeWharton/SdkSearch

Jake Wharton

commit sha bef34a65eca495fea07c01d68d3c36f48e9bd2de

Add Bugsnag callout

view details

push time in 3 days

push eventJakeWharton/SdkSearch

Jake Wharton

commit sha 0d39df5e8c4e07a909da97f07e817add704edfff

Fix README image path

view details

push time in 3 days

Pull request review commentsquare/okhttp

[WIP] Handle Android 11 restrictions

+/*+ * Copyright (C) 2016 Square, Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *      http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package okhttp3.internal.platform;++import android.annotation.SuppressLint;+import java.lang.reflect.InvocationTargetException;+import java.lang.reflect.Method;+import java.util.List;+import javax.annotation.Nullable;+import javax.net.ssl.SSLParameters;+import javax.net.ssl.SSLSocket;+import okhttp3.Protocol;++/** Android 11+. */+class Android11Platform extends BaseAndroidPlatform {+  private final Method setUseSessionTickets;+  private final Method isSupportedSocket;++  Android11Platform(Class<?> sslParametersClass,+      Method setUseSessionTickets,+      Method isSupportedSocket) {+    super(sslParametersClass);+    this.setUseSessionTickets = setUseSessionTickets;+    this.isSupportedSocket = isSupportedSocket;+  }++  @SuppressLint("NewApi")+  @Override public void configureTlsExtensions(+      SSLSocket sslSocket, String hostname, List<Protocol> protocols) {+    try {+      if (!isSupported(sslSocket)) {+        return; // No TLS extensions if the socket class is custom.+      }++      setUseSessionTickets.invoke(null, sslSocket, true);++      SSLParameters sslParameters = sslSocket.getSSLParameters();++      // Enable ALPN.+      String[] protocolsArray = Platform.alpnProtocolNames(protocols).toArray(new String[0]);+      sslParameters.setApplicationProtocols(protocolsArray);++      sslSocket.setSSLParameters(sslParameters);+    } catch (IllegalAccessException | InvocationTargetException e) {+      throw new AssertionError(e);+    }+  }++  private boolean isSupported(SSLSocket sslSocket)+      throws InvocationTargetException, IllegalAccessException {+    return (boolean) isSupportedSocket.invoke(null, sslSocket);+  }++  @SuppressLint("NewApi")+  @Override public @Nullable String getSelectedProtocol(SSLSocket socket) {+    try {+      if (!isSupported(socket)) {+        return null; // No TLS extensions if the socket class is custom.+      }++      String alpnResult = socket.getApplicationProtocol();++      if (alpnResult == null || alpnResult.isEmpty()) {+        return null;+      }++      return alpnResult;+    } catch (IllegalAccessException | InvocationTargetException e) {+      throw new AssertionError(e);+    }+  }++  public static @Nullable Platform buildIfSupported() {+    // Attempt to find Android 5+ APIs.
    // Attempt to find Android 11+ APIs.
yschimke

comment created time in 3 days

issue commentsquare/okhttp

ExceptionInitializerError with new Android 11 version (DP1)

I only cross referenced the offending usage from 3.x to the list of public replacements. Didn't look at 4.x.

arocha55

comment created time in 3 days

issue commentsquare/okhttp

ExceptionInitializerError with new Android 11 version (DP1)

In addition to setHostname and getAlpnSelectedProtocol, setAlpnProtocols is used which is on the list.

The replacements are:

Lcom/android/org/conscrypt/AbstractConscryptSocket;->getAlpnSelectedProtocol()[B   # Use javax.net.ssl.SSLSocket#getApplicationProtocol().
Lcom/android/org/conscrypt/ConscryptFileDescriptorSocket;->setHostname(Ljava/lang/String;)V   # Use javax.net.ssl.SSLParameters#setServerNames.
Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([Ljava/lang/String;)V   # Use javax.net.ssl.SSLParameters#setApplicationProtocols(java.lang.String[]).

The ALPN ones are a direct replacement, the setHostname one is a bit more complicated.

arocha55

comment created time in 3 days

push eventJakeWharton/docker-mbsync

Jake Wharton

commit sha 4a1235d0f88b7d6e0b740296ee787356527201e0

Add curl to be able to ping healthcheck

view details

push time in 3 days

IssuesEvent

issue commentJakeWharton/docker-mbsync

Writes files as root

Not good enough. Cron still needs to run as root. We should maybe do a PUID env var like the linuxserver containers and switch sync.sh to run as that.

JakeWharton

comment created time in 3 days

IssuesEvent

issue commentJakeWharton/docker-gphotos-sync

Writes files as root

Not good enough. Cron still needs to run as root. We should maybe do a PUID env var like the linuxserver containers and switch sync.sh to run as that.

JakeWharton

comment created time in 3 days

push eventJakeWharton/docker-gphotos-sync

Jake Wharton

commit sha 64b645e090e0c5518343624fef5c048eedfedb80

Revert "Info on running as non-root" This reverts commit 57796489bbb75422aa83608d5dda72d09b7bf7c5.

view details

push time in 3 days

push eventJakeWharton/docker-mbsync

Jake Wharton

commit sha eeb7d4af8d2ad6ff7bbbc309ba04c79b16da19ac

Revert "Info on running as non-root" This reverts commit 95a9c1f07a4353ba1fdcc3610c8409aca509730b.

view details

push time in 3 days

issue closedJakeWharton/docker-mbsync

Writes files as root

Needs to be as user

closed time in 3 days

JakeWharton

issue commentJakeWharton/docker-mbsync

Writes files as root

95a9c1f07a4353ba1fdcc3610c8409aca509730b

JakeWharton

comment created time in 3 days

issue closedJakeWharton/docker-gphotos-sync

Writes files as root

Need to write as user

closed time in 3 days

JakeWharton

issue commentJakeWharton/docker-gphotos-sync

Writes files as root

57796489bbb75422aa83608d5dda72d09b7bf7c5

JakeWharton

comment created time in 3 days

push eventJakeWharton/docker-gphotos-sync

Jake Wharton

commit sha 57796489bbb75422aa83608d5dda72d09b7bf7c5

Info on running as non-root

view details

push time in 3 days

push eventJakeWharton/docker-mbsync

Jake Wharton

commit sha 942d8210ab7623715a2fc7f071ae6ba726763da8

Remove TZ env var

view details

Jake Wharton

commit sha 95a9c1f07a4353ba1fdcc3610c8409aca509730b

Info on running as non-root

view details

push time in 3 days

issue openedJakeWharton/docker-mbsync

Writes files as root

Needs to be as user

created time in 3 days

issue openedJakeWharton/docker-gphotos-sync

Writes files as root

Need to write as user

created time in 3 days

push eventJakeWharton/docker-mbsync

Jake Wharton

commit sha a5a3556dc78ad4f4492364b58cfe65f62359d37c

Add config info

view details

push time in 3 days

push eventJakeWharton/docker-mbsync

Jake Wharton

commit sha 19dd173303226f603a9f583e0e2a3c09ee84b6b4

Operate on all defined channels

view details

push time in 3 days

push eventJakeWharton/docker-mbsync

Jake Wharton

commit sha 1dfa2b50bf524f855739ead2cc8ff373b81d7b9d

Fix compose example

view details

push time in 3 days

pull request commentoznu/docker-cloudflare-ddns

fixing dns ip addr retrieval for century link issue

So it would seem that the fallback mechanism needs fixed. Otherwise what's the point of having it?

clevernyyyy

comment created time in 3 days

pull request commentoznu/docker-cloudflare-ddns

fixing dns ip addr retrieval for century link issue

What is the behavior? Why doesn't the fallback work?

clevernyyyy

comment created time in 3 days

push eventJakeWharton/docker-gphotos-sync

Jake Wharton

commit sha 5df4ed654cb16c8becbc5228953b178780a84661

Dummy change

view details

push time in 4 days

push eventJakeWharton/docker-mbsync

Jake Wharton

commit sha 280f8359af268efbeae63c43ec019eb91425e222

Initial commit

view details

push time in 4 days

create barnchJakeWharton/docker-mbsync

branch : master

created branch time in 4 days

created repositoryJakeWharton/docker-mbsync

created time in 4 days

pull request commentsquare/retrofit

FIX: #3281 Don't call private Lookup constructor

Thanks I'll take a peek tomorrow

On Thu, Feb 20, 2020, at 9:11 PM, Thomas May wrote:

@cogman https://github.com/cogman requested your review on: #3310 https://github.com/square/retrofit/pull/3310 FIX: #3281 https://github.com/square/retrofit/issues/3281 Don't call private Lookup constructor.

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/square/retrofit/pull/3310?email_source=notifications&email_token=AAAQIEKHRRWOMSKH6Y442QTRD4Z4PA5CNFSM4KY2XOU2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOWZKMCIY#event-3059007779, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQIENPWKKJGTQ2UHBW5ULRD4Z4PANCNFSM4KY2XOUQ.

cogman

comment created time in 4 days

pull request commentsquare/retrofit

Use computeIfAbsent method to simplify this method

Hopefully the Animal Sniffer check will fail the Travis CI build because of this...

cogman

comment created time in 4 days

PR closed square/retrofit

Reviewers
Use computeIfAbsent method to simplify this method

This is a minor change. This relies on the internal locking mechanisms of the concurrent hash map instead of doing manual synchronization work.

Not that it matters, but it ends up being somewhat faster (this is not likely a hot path). There is only a single key lookup instead of 2 in the worst case and it relies on CHMs internal locking scheme only (instead of having an extra one outside).

+1 -11

1 comment

1 changed file

cogman

pr closed time in 4 days

pull request commentsquare/retrofit

Use computeIfAbsent method to simplify this method

Unfortunately this is only available on Android API 24 and newer whereas we support API 21+.

So it'll be a while before we can actually use this, despite being much nicer.

cogman

comment created time in 4 days

push eventAndroidStudyGroup/conferences

brianPlummer

commit sha f1a3af921a6c4995105002b34f0c701ddd234e40

update droidcon lisbon cfp dates

view details

Jake Wharton

commit sha a9b94cc727027d086160c605d8fbea351807c1bf

Merge pull request #604 from friendlyrobotnyc/droidcon_lisbon_2020 update droidcon lisbon 2020 cfp dates

view details

push time in 4 days

PR merged AndroidStudyGroup/conferences

update droidcon lisbon 2020 cfp dates

feb 19th - jun 30 https://sessionize.com/droidcon-lisbon2020/

+5 -1

0 comment

1 changed file

brianPlummer

pr closed time in 4 days

issue commentsquare/okhttp

ExceptionInitializerError with new Android 11 version (DP1)

Thank you for the very detailed report!

arocha55

comment created time in 4 days

pull request commentsquare/retrofit

[RFC] Easier creation of new calls

Can you explain your use case more?

christophehenry

comment created time in 4 days

push eventAndroidStudyGroup/conferences

Jossi Wolf

commit sha 0751fc9da9f4942c38844aa55531606119685ae7

Display CfP closing date

view details

Jake Wharton

commit sha 6cf1d7ff55c2308f9fb88ef678140b0fcb4ddd63

Merge pull request #599 from jossiwolf/jw/display-cfp-closing-date Display CfP closing date

view details

push time in 4 days

PR merged AndroidStudyGroup/conferences

Display CfP closing date

I often could really use having a better overview and figured this data could just be displayed since it's there anyways.

What do you think?

image

+1 -1

2 comments

1 changed file

jossiwolf

pr closed time in 4 days

pull request commentAndroidStudyGroup/conferences

Display CfP closing date

I like it!

jossiwolf

comment created time in 4 days

pull request commentAndroidStudyGroup/conferences

Fix Travis build

Thanks. Been meaning to migrate to GitHub Actions too, but working is better than perfect.

cortinico

comment created time in 4 days

push eventAndroidStudyGroup/conferences

Nicola Corti

commit sha 72287550cf58aa1bcd9d8c7873a0a4c74f0ae77a

Fix Travis Build

view details

Nicola Corti

commit sha dd05d3c88ed3e4a9c0d91772407f54213575ef56

Fix missing md extensions

view details

Jake Wharton

commit sha 3eb5f26569c721aff5c5c76a59951955adb07629

Merge pull request #602 from cortinico/fix-travis Fix Travis build

view details

push time in 4 days

PR merged AndroidStudyGroup/conferences

Reviewers
Fix Travis build

Looks like the travis build is broken since a while, I'm fixing it: https://travis-ci.com/cortinico/conferences/builds/149831885

Moreover I've removed therubyracer from the Gemfile as it's not actually used + I've updated the Gemfile.lock.

+76 -84

0 comment

6 changed files

cortinico

pr closed time in 4 days

issue commentsquare/moshi

Multi-byte whitespace Unicode character is not skipped

"FEFF" is not whitespace, it's a BOM. You'll need to detect this and skip it yourself before handing the stream to Moshi.

A simple way to do this is by calling require(2) on a BufferedSource and then doing a rangeEquals against FEFF in a ByteString.

If you want a more comprehensive implementation, you can check out the implementation added to OkHttp which correlates a BOM to a Charset: https://github.com/square/okhttp/blob/3f946d0b13534bcd1662e58624b0fc5816d1cc14/okhttp/src/main/java/okhttp3/internal/Util.kt#L255-L265

reline

comment created time in 4 days

issue closedsquare/moshi

Multi-byte whitespace Unicode character is not skipped

I have a file from a third-party that begins with the zero width no-break space unicode character (UxFEFF) at the beginning of the file, and Moshi fails on the first char reporting an unexpected string. Is this and other multi-byte whitespace unicode characters planned to be supported? I wrote a test case that fails.

public final class JsonUtf8ReaderTest {
    .....
  @Test public void multiByteWhitespaceChar() throws Exception {
    Buffer buffer = new Buffer().writeUtf8("\uFEFF[]");

    JsonReader reader = JsonReader.of(buffer);
    reader.setLenient(true);
    reader.beginArray();
    reader.endArray();
    assertThat(buffer.size()).isEqualTo(0);
  }

closed time in 4 days

reline

issue commentsquare/retrofit

Parse Kotlin metadata manually to honor nullability and avoid kotlin-metadata-jvm dep

That is the expected behavior for that return type.

AidanLaing

comment created time in 5 days

issue openedpinterest/ktlint

False positive: unnecessary semicolon

val keyFactory = run {
  val random = Random(1);
  { random.nextInt() }
}

This is a minimal reproducing sample which is contrived, not the actual code.

The problem is that without the semicolon Kotlin thinks that I'm calling the Random constructor with a trailing lambda and fails to compile. Thus, the semicolon is necessary to separate the statement from the lambda (which is an implicit return value).

created time in 5 days

issue closedsquare/retrofit

WATCH THE STREAM WITH MY HOT PUSSY 💋💋💋

WATCH THE STREAM WITH MY HOT PUSSY 💋💋💋 👇👇👇

https://tinyurl.com/t46ja28

closed time in 5 days

kate5586

push eventJakeWharton/jakewharton.com

Jake Wharton

commit sha ab23b8382aed709cbc2cf010bfc6acad69781b16

Is

view details

push time in 5 days

push eventJakeWharton/jakewharton.com

Jake Wharton

commit sha f9eace8f23d1fec7a80b6aa02ddde4df481f60e5

Knowledge

view details

push time in 5 days

push eventJakeWharton/jakewharton.com

Jake Wharton

commit sha 67e2873022e40a334bb24fe754f9a11304c0daf4

Of

view details

push time in 5 days

push eventJakeWharton/jakewharton.com

Jake Wharton

commit sha 9b3edd42bbdabf80c26b51275b126b8aca4e27c9

Download

view details

push time in 5 days

push eventJakeWharton/jakewharton.com

Jake Wharton

commit sha 336fafa86ee6b1fa2434af71378b313f9ffa987b

L

view details

push time in 5 days

push eventJakeWharton/jakewharton.com

Jake Wharton

commit sha 01f05fcb71e881c1e0b62ce04887940e75e9a9e7

Your

view details

push time in 5 days

issue closedcashapp/sqldelight

Support last insert rowid and rows modified count

Probably want to have inserts return data class InsertResult(val lastInsertRowId: Long, val rowsModified: Long) and updates and deletes should return data class UpdateResult(val rowsModified: Long) or ..DeleteResult(..).

This will require changing the platform drivers

closed time in 5 days

angusholder

issue commentcashapp/sqldelight

Support last insert rowid and rows modified count

You can already query for these yourself:

SELECT last_insert_rowid();
SELECT changes();

We do not want to run these queries automatically because they are often not needed.

angusholder

comment created time in 5 days

issue commentsquare/okhttp

Does okhttp support "get" methods with "body"?

Yes. What's your use case?

sjrlyy

comment created time in 6 days

issue closedsquare/okhttp

Does okhttp support "get" methods with "body"?

Does okhttp support "get" methods with "body"?

closed time in 6 days

sjrlyy

issue commentsquare/okhttp

Does okhttp support "get" methods with "body"?

No. The spec forbids this.

sjrlyy

comment created time in 6 days

pull request commentcashapp/sqldelight

Improve docs relating to Android & Android Studio

Its dependencies are listed in its pom.xml. You should be able to publish a snapshot to your local Maven repo (~/.m2) by running the :sqldelight-gradle-plugin:publishToMavenLocal task.

angusholder

comment created time in 6 days

issue commentperkeep/gphotos-cdp

Allow optional path for -dev flag?

Any feedback? I'm happy to do this work, I just need the decision to be made.

JakeWharton

comment created time in 6 days

pull request commentJakeWharton/RxBinding

Upgrade to RxJava 3

Please rebase on master with RxJava 3 final and we can get this merged.

BraisGabin

comment created time in 6 days

pull request commentsquare/okhttp

Fixed flaky RealWebSocketTest.serverCloseThenClientClose().

No good deed goes unpunished! Fix one, find another.

dave-r12

comment created time in 6 days

issue commentcashapp/sqldelight

Streaming blobs?

Looks like sqlite's C API supports this (https://www.sqlite.org/c3ref/blob_open.html) but obviously not through the managed APIs that we use.

ursusursus

comment created time in 6 days

issue commentcashapp/sqldelight

Streaming blobs?

Some databases support this (Postgres), but I don't think that it's available through a common interface like JDBC.

ursusursus

comment created time in 6 days

push eventJakeWharton/diffuse

Jake Wharton

commit sha de07ab7f34c0bbaf9dbda8f650d7c689ba7a8894

Picnic 0.3 and JUnit 4.13 final

view details

Jake Wharton

commit sha 183e6c555be326cd6a495204a4f270b49484c3d1

Restore tests to passing state

view details

push time in 6 days

issue commentoetiker/znapzend

Is it safe for a dataset to have overlapping src and dst snapshot policies

Actually since a destination plan is required I suppose no matter what I'm facing overlap unless I migrate to something else for synchronizing "home" to "tank/backup/home".

JakeWharton

comment created time in 7 days

issue openedoetiker/znapzend

Is it safe for a dataset to have overlapping src and dst snapshot policies

I have two pools: "home" and "tank". Currently "home" has a snapshot policy and is replicated into "tank/backup/home" with a matching snapshot policy. Now I want to recursively replicate "tank/backup" which has a few filesystems (including "tank/backup/home") to a remote.

Is it safe to apply a source snapshot policy recursively to all of "tank/backup" which overlaps with that destination policy of "tank/backup/home"?

Or should I remove the destination policy of "home" --> "tank/backup/home" so that only the latest is synchronized and then let the recursive source snapshot policy of "tank/backup" --> remote do snapshotting?

created time in 7 days

pull request commentsquare/okhttp

Fix errorprone PreferJavaTimeOverload

Android users cannot use java.time APIs until they are on AGP 4.0 which is only about to enter beta. I would wait a year before deprecating the split overloads.

monkey-mas

comment created time in 7 days

issue commentgoogle/truth

Kotlin: Support `assertThat(foo) { isNotNull() isNotEqualTo(bar) ... }`

That would mean Truth would have to be on your non-test classpath which seems like a larger problem. In a test context, though, you can invoke assertions on any object at any time and that seems like it's working as intended.

cpovirk

comment created time in 7 days

issue closedsquare/AssistedInject

how do you configure assistedinject to use with bazel

is bazel supported? If so how do you configure, which class to use as processor_class with bazel?

closed time in 7 days

vipsy

issue commentsquare/AssistedInject

how do you configure assistedinject to use with bazel

We don't explicitly support Bazel but the library is an annotation processor that will work with any build system.

The core annotation processor class is com.squareup.inject.assisted.processor.AssistedInjectProcessor.

The Dagger 2-specific annotation processor class is com.squareup.inject.assisted.dagger2.processor.AssistedInjectDagger2Processor.

The inflation injection annotation processor class is com.squareup.inject.inflation.processor.InflationInjectProcessor.

Each of those is bundled in its own library so you'll need to make sure the corresponding artifact is on javac's processorpath along with any dependencies it requires.

Hope that helps. You may also want to try on StackOverflow as you can tag that question with 'bazel' and get help from people who actually use Bazel unlike me who is mostly just guessing and Googling.

vipsy

comment created time in 7 days

issue commentgoogle/truth

Kotlin: Support `assertThat(foo) { isNotNull() isNotEqualTo(bar) ... }`

In general, extension methods are considered the most idiomatic in Kotlin due to their discoverability. You never need to know where a function lives, because the IDE will suggest all applicable ones on the target type.

This is also a boon when you already have one function imported. If you import the core assertThat there will be available overloads for a lot of common types. But if you're looking for specific assertions using an extension will still prompt both versions whereas with top-level functions you'll need to manually add an import to get the more specific version.


Historically I believe I've named my extensions using just assert instead of assertThat.

user.name.assert {
  isNotEmpty()
  isEqualTo("Jake")
}

I don't find the English argument as a super strong influencer because it basically mandates you have a named local. Once you replace it with a method call (especially one with arguments) the sentence immediately breaks apart.

val box = Box(2, 2, 2, Red)
val scene = buildScene {
  putShape(Point(10, 10, 10), box)
}
assertThat(scene.viewport(Point(0, 0, 0), Point(1, 1, 1))) {
  containsShape(box)
}

Now you have to start inserting words to try and contort it back to English: "Assert that scene [with a] viewport [from] point 0,0,0 [facing] point 1,1,1 contains shape box". This is because we don't try to maintain English readability in the regular API that we're interacting with. And while it may make sense to pull out a local for a single assertion, if I want to check multiple viewports in this test function I would need to start getting creating with names.

Is that measurably more readable than

scene.viewport(Point(0, 0, 0), Point(1, 1, 1)).assert {
  containsShape(box)
}

due to trying to maintain English API order? I actually have no opinion on the English-ness of the API, but the import argument above I think is my primary one.

cpovirk

comment created time in 7 days

push eventJakeWharton/shimo

Jared Burrows

commit sha 991435c4df011f62305792dae0f9a5555bb54401

loose coupling

view details

Jake Wharton

commit sha e4e0100127a4ea226e5e0ce450cf456db4642189

Merge pull request #1 from jaredsburrows/pr/jaredsburrows/fix Loose coupling

view details

push time in 7 days

PR merged JakeWharton/shimo

Loose coupling

@JakeWharton

+1 -1

0 comment

1 changed file

jaredsburrows

pr closed time in 7 days

Pull request review commentsquare/okio

Add Buffer extensions to read and write NSData

+/*+ * Copyright (C) 2020 Square, Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *      http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package okio++import kotlinx.cinterop.ByteVarOf+import kotlinx.cinterop.CPointer+import kotlinx.cinterop.plus+import kotlinx.cinterop.addressOf+import kotlinx.cinterop.usePinned+import platform.Foundation.NSData+import platform.Foundation.NSMutableData+import platform.Foundation.create+import platform.darwin.NSInteger+import platform.posix.memcpy++fun Buffer.write(+  source: NSData,+  offset: Int = 0,+  byteCount: Int = source.length.toInt()+): Buffer = apply {+  var offset = offset+  checkOffsetAndCount(source.length.toLong(), offset.toLong(), byteCount.toLong())++  val limit = offset + byteCount+  while (offset < limit) {+    val tail = writableSegment(1)++    val toCopy = minOf(limit - offset, Segment.SIZE - tail.limit)+    tail.data.usePinned { pinned ->+      memcpy(+        __dst = pinned.addressOf(tail.limit),+        __src = (source.bytes as CPointer<ByteVarOf<*>>) + offset,+        __n = toCopy.toULong()+      )+    }++    offset += toCopy+    tail.limit += toCopy+  }++  size += byteCount.toLong()+}++fun Buffer.readNSData(byteCount: NSInteger = size): NSData {+  require(byteCount >= 0 && byteCount <= Int.MAX_VALUE) { "byteCount: $byteCount" }+  if (size < byteCount) throw EOFException()++  val length = byteCount.toULong()+  val result = NSMutableData.create(length = length)+    ?: throw IOException("Failed to create NSMutableData of length $length")

That sounds like OOM conditions to me.

Egorand

comment created time in 7 days

issue closedJakeWharton/ThreeTenABP

Contribution: Gson.toJson with @Expose annotations error

I have a class with a LocalDate attribute. I needed to store objects of that class in SharedPreferences, for which I used Gson.toJson to serialize the object to a String. I also needed to select manually which attributes to store and which not, and so I use the Gson @Expose annotations. But even though I marked the date with the @Expose, I wasn't being stored, since the internal attributes of the LocalDate didn't have the @Expose. To fix that issue, I had to create custom JsonSerializers and JsonDeserializers. Now it's working smoothly, but I was wondering if I could contribute to your project by adding this serializers directly to the library. Have a nice day!

closed time in 7 days

OscarCaro

issue commentJakeWharton/ThreeTenABP

Contribution: Gson.toJson with @Expose annotations error

So three things here:

  1. Gson is effectively deprecated and replaced by Moshi which is built by the same people but with a lot of the faults of Gson corrected.

  2. You should never serialize types that you do not control using their implementations. Always write a custom adapter to use their public API. The fact that Gson didn't work because of the lack of @Expose annotations is a happy accident because the implementation of these types is not stable and may change at any time.

  3. I do not want to publish adapters for Gson or Moshi or any serialization library as part of this library. For Gson and Moshi please see this thread: https://github.com/JakeWharton/ThreeTenABP/issues/67. These adapters can be published as a standalone library (targeting ThreeTenBp, not ThreeTenABP) and used together.

If you decide to publish these as a new standalone library, though, feel free to link it here.

OscarCaro

comment created time in 7 days

issue closedsquare/retrofit

Wanna see my hot pics?💋💋💋

Hi!😻😻😻 Wanna see my hot pics?💋💋💋 Go to this site and find me here. ❤️❤️❤️ My nick is sexygirl662 👇👇👇

https://tinyurl.com/ulpu2gz

closed time in 7 days

helen119

issue closedsquare/okhttp

Wanna see my hot pics?💋💋💋

Hi!😻😻😻 Wanna see my hot pics?💋💋💋 Go to this site and find me here. ❤️❤️❤️ My nick is sexygirl662 👇👇👇

https://tinyurl.com/ulpu2gz

closed time in 7 days

helen119

issue closedsquare/retrofit

retrofit does not recognize my access provider.

What kind of issue is this?

  • [ ] I get this error HTTP FAILED: java.net.UnknownHostException: Unable to resolve host "moov": No address associated with hostname. Moov is my 3G access provider. When I use Wifi network there is no problem.

closed time in 7 days

nimondo

issue commentsquare/retrofit

retrofit does not recognize my access provider.

This exception comes from deep within the networking stack. You are trying to connect to a URL whose host is just moov (e.g., http://moov/api/path). This is likely not what you want and instead you want a proper domain. This might be coming from your specified base URL or a @Url annotation parameter value.

nimondo

comment created time in 7 days

push eventAndroidStudyGroup/conferences

Adit Lal

commit sha 533ad162eb673d87b924afe09a55c219e6ccfcdf

Adds Droidcon india 2020 Added CFP, venue and dates

view details

Jake Wharton

commit sha 9bbe542199b4ca8bf3f39ee813ca23b428b40f34

Merge pull request #601 from aldefy/patch-1 Droidcon india 2020

view details

push time in 7 days

PR merged AndroidStudyGroup/conferences

Reviewers
Droidcon india 2020

Added CFP, venue and dates for Droidcon India 2020

+13 -0

1 comment

1 changed file

aldefy

pr closed time in 7 days

Pull request review commentsquare/okio

Add Buffer extensions to read and write NSData

+/*+ * Copyright (C) 2020 Square, Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *      http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package okio++import kotlinx.cinterop.ByteVarOf+import kotlinx.cinterop.CPointer+import kotlinx.cinterop.plus+import kotlinx.cinterop.addressOf+import kotlinx.cinterop.usePinned+import platform.Foundation.NSData+import platform.Foundation.NSMutableData+import platform.Foundation.create+import platform.darwin.NSInteger+import platform.posix.memcpy++fun Buffer.write(+  source: NSData,+  offset: Int = 0,+  byteCount: Int = source.length.toInt()+): Buffer = apply {+  var offset = offset+  checkOffsetAndCount(source.length.toLong(), offset.toLong(), byteCount.toLong())++  val limit = offset + byteCount+  while (offset < limit) {+    val tail = writableSegment(1)++    val toCopy = minOf(limit - offset, Segment.SIZE - tail.limit)+    tail.data.usePinned { pinned ->+      memcpy(+        __dst = pinned.addressOf(tail.limit),+        __src = (source.bytes as CPointer<ByteVarOf<*>>) + offset,+        __n = toCopy.toULong()+      )+    }++    offset += toCopy+    tail.limit += toCopy+  }++  size += byteCount.toLong()+}++fun Buffer.readNSData(byteCount: NSInteger = size): NSData {+  require(byteCount >= 0 && byteCount <= Int.MAX_VALUE) { "byteCount: $byteCount" }+  if (size < byteCount) throw EOFException()++  val length = byteCount.toULong()+  val result = NSMutableData.create(length = length)+    ?: throw IOException("Failed to create NSMutableData of length $length")

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-out-of-memory-error/index.html

Egorand

comment created time in 8 days

issue commentJakeWharton/docker-gphotos-sync

Do something about hangs

Maybe we monitor the output for changes and if it hangs for more than some period we kill the process?

JakeWharton

comment created time in 8 days

Pull request review commentsquare/okio

Add Buffer extensions to read and write NSData

+/*+ * Copyright (C) 2020 Square, Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *      http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package okio++import kotlinx.cinterop.ByteVarOf+import kotlinx.cinterop.CPointer+import kotlinx.cinterop.plus+import kotlinx.cinterop.addressOf+import kotlinx.cinterop.usePinned+import platform.Foundation.NSData+import platform.Foundation.NSMutableData+import platform.Foundation.create+import platform.darwin.NSInteger+import platform.posix.memcpy++fun Buffer.write(+  source: NSData,+  offset: Int = 0,+  byteCount: Int = source.length.toInt()+): Buffer = apply {+  var offset = offset+  checkOffsetAndCount(source.length.toLong(), offset.toLong(), byteCount.toLong())++  val limit = offset + byteCount+  while (offset < limit) {+    val tail = writableSegment(1)++    val toCopy = minOf(limit - offset, Segment.SIZE - tail.limit)+    tail.data.usePinned { pinned ->+      memcpy(+        __dst = pinned.addressOf(tail.limit),+        __src = (source.bytes as CPointer<ByteVarOf<*>>) + offset,+        __n = toCopy.toULong()+      )+    }++    offset += toCopy+    tail.limit += toCopy+  }++  size += byteCount.toLong()+}++fun Buffer.readNSData(byteCount: NSInteger = size): NSData {+  require(byteCount >= 0 && byteCount <= Int.MAX_VALUE) { "byteCount: $byteCount" }+  if (size < byteCount) throw EOFException()++  val length = byteCount.toULong()+  val result = NSMutableData.create(length = length)+    ?: throw IOException("Failed to create NSMutableData of length $length")

Should this be an OOM? When would this fail?

Egorand

comment created time in 8 days

Pull request review commentsquare/okio

Add Buffer extensions to read and write NSData

+/*+ * Copyright (C) 2020 Square, Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *      http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package okio++import kotlinx.cinterop.ByteVarOf+import kotlinx.cinterop.CPointer+import kotlinx.cinterop.plus+import kotlinx.cinterop.addressOf+import kotlinx.cinterop.usePinned+import platform.Foundation.NSData+import platform.Foundation.NSMutableData+import platform.Foundation.create+import platform.darwin.NSInteger+import platform.posix.memcpy++fun Buffer.write(

What does this look like from Obj-C or Swift?

Egorand

comment created time in 8 days

push eventAndroidStudyGroup/conferences

Nicola Corti

commit sha a7f1466ca0fc4ffba825aeaf460826934d91c5ff

Extend DevFest Pisa CFP deadline

view details

Jake Wharton

commit sha 4196450117efd75a7ea31408afd1e2c1a769c4de

Merge pull request #600 from cortinico/cortinico/extend-dfpisa Extend DevFest Pisa CFP deadline

view details

push time in 8 days

PR merged AndroidStudyGroup/conferences

Extend DevFest Pisa CFP deadline

We've moved our deadline to Feb the 17th: https://sessionize.com/devfest-pisa-2020

+1 -1

0 comment

1 changed file

cortinico

pr closed time in 8 days

pull request commentsquare/okio

Add NSData.toByteString()

You could use that argument against Linux because it runs on Windows or Windows because it runs on Linux.

Egorand

comment created time in 8 days

more