{"comment":{"url":"https://api.github.com/repos/usethesource/rascal/comments/16826855","html_url":"https://github.com/usethesource/rascal/commit/c3dc9801cf0579402693b6fd9755c9874c94cf9e#commitcomment-16826855","id":16826855,"user":{"login":"ben-manes","id":378614,"avatar_url":"https://avatars.githubusercontent.com/u/378614?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-manes","html_url":"https://github.com/ben-manes","followers_url":"https://api.github.com/users/ben-manes/followers","following_url":"https://api.github.com/users/ben-manes/following{/other_user}","gists_url":"https://api.github.com/users/ben-manes/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-manes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-manes/subscriptions","organizations_url":"https://api.github.com/users/ben-manes/orgs","repos_url":"https://api.github.com/users/ben-manes/repos","events_url":"https://api.github.com/users/ben-manes/events{/privacy}","received_events_url":"https://api.github.com/users/ben-manes/received_events","type":"User","site_admin":false},"position":76,"line":111,"path":"src/org/rascalmpl/value/impl/primitive/SourceLocationValues.java","commit_id":"c3dc9801cf0579402693b6fd9755c9874c94cf9e","created_at":"2016-03-24T02:02:07Z","updated_at":"2016-03-24T02:02:07Z","body":"You may wish to convert over to using a `LoadingCache`. Then you would write this as,\r\n\r\n```java\r\nlocationCache = Caffeine.newBuilder()\r\n    //... settings\r\n    .build(uri -> newSourceLocation(uri.getScheme(), uri.getAuthority(), \r\n                  uri.getPath(), uri.getQuery(), uri.getFragment());\r\n// later on,\r\nreturn locationCache.get(uri);\r\n```\r\n\r\nAs of v2 the cache loader was improved to automatically wrap checked exceptions with `CompletionException`. This wasn't done in v1 simply because I punted on that improvement due to how much complexity there was to wrangle."}}