Verify database after opened
Room now keeps an identity hash on the database and checks it when database
is open to ensure that the schema matches the current one. If not, developer
probably forgot to update the version number so it crashes.
Bug: 35804916
Test: IdentityDetectionTest.java
Change-Id: I441cbb3e78d88874406806af6c36917d1bf0142c
diff --git a/app-toolkit/dependencies.gradle b/app-toolkit/dependencies.gradle
index 3b114a9..2bfed3c 100644
--- a/app-toolkit/dependencies.gradle
+++ b/app-toolkit/dependencies.gradle
@@ -36,12 +36,18 @@
// https://github.com/xerial/sqlite-jdbc/issues/97
ffVersions.xerial = "3.16.1"
ffVersions.antlr = "4.5.3"
+ffVersions.commons_codec = "1.10"
ffLibs.kotlin = [
stdlib : "org.jetbrains.kotlin:kotlin-stdlib:$ffVersions.kotlin",
gradle_plugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$ffVersions.kotlin"
]
ffLibs.auto_common = "com.google.auto:auto-common:$ffVersions.auto_common"
+ffLibs.apache = [
+ commons : [
+ codec : "commons-codec:commons-codec:$ffVersions.commons_codec"
+ ]
+]
def getSupportLib(String name, String version, String artifactName = null) {
def sourceProject = findProject(name)
diff --git a/lifecycle/compiler/src/main/resources/NOTICE.txt b/lifecycle/compiler/src/main/resources/NOTICE.txt
index 7cd74cc..02ade00 100644
--- a/lifecycle/compiler/src/main/resources/NOTICE.txt
+++ b/lifecycle/compiler/src/main/resources/NOTICE.txt
@@ -901,57 +901,46 @@
+
+
<!DOCTYPE html>
-<html lang="en" class="">
- <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#">
- <meta charset='utf-8'>
-
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
- <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-c07e6f4b02b556d1d85052fb3853caf84c80e6b23dcdb1ae1b00f051da1115a2.css" media="all" rel="stylesheet" />
- <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-85f6307e0a74c78ba00f8c5bf9c7fb17a418d361627638f51f989be45f709416.css" media="all" rel="stylesheet" />
-
-
- <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/site-73b3dae8eb441c98982c7306f0e59decca409e87188e07bc1a961b8cea511aab.css" media="all" rel="stylesheet" />
-
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta http-equiv="Content-Language" content="en">
- <meta name="viewport" content="width=device-width">
-
- <title>javapoet/LICENSE.txt at master · square/javapoet · GitHub</title>
- <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">
- <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
- <link rel="apple-touch-icon" href="/apple-touch-icon.png">
- <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">
- <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">
- <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">
- <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png">
- <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">
- <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">
- <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png">
- <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">
- <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">
- <meta property="fb:app_id" content="1401488693436528">
- <meta content="https://avatars0.githubusercontent.com/u/82592?v=3&s=400" name="twitter:image:src" /><meta content="@github" name="twitter:site" /><meta content="summary" name="twitter:card" /><meta content="square/javapoet" name="twitter:title" /><meta content="javapoet - A Java API for generating .java source files." name="twitter:description" />
- <meta content="https://avatars0.githubusercontent.com/u/82592?v=3&s=400" property="og:image" /><meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="square/javapoet" property="og:title" /><meta content="https://github.com/square/javapoet" property="og:url" /><meta content="javapoet - A Java API for generating .java source files." property="og:description" />
- <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
- <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
- <link rel="assets" href="https://assets-cdn.github.com/">
-
- <meta name="pjax-timeout" content="1000">
-
- <meta name="request-id" content="F616:4D80:3D52FD2:640C534:588819F9" data-pjax-transient>
+ <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-19e26a1cefb5f1e92203a9468134dbf46b5a5308aeeeee09c96b32fec8c8b044.css" media="all" rel="stylesheet" />
+ <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-a97f6b98170262f1be5dd5b84d3fb788f1bb65b269c11417026fe763d5eeb63b.css" media="all" rel="stylesheet" />
+
+
+ <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/site-1da8b9f73abeb68e6a54d0f514085224fe9e7325fd664eacacb38bebe10b9eab.css" media="all" rel="stylesheet" />
+
- <meta name="msapplication-TileImage" content="/windows-tile.png">
- <meta name="msapplication-TileColor" content="#ffffff">
- <meta name="selected-link" value="repo_source" data-pjax-transient>
+ <meta name="viewport" content="width=device-width">
+
+ <title>javapoet/LICENSE.txt at master · square/javapoet · GitHub</title>
+ <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">
+ <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
+ <meta property="fb:app_id" content="1401488693436528">
- <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
+
+ <meta content="https://avatars0.githubusercontent.com/u/82592?v=3&s=400" property="og:image" /><meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="square/javapoet" property="og:title" /><meta content="https://github.com/square/javapoet" property="og:url" /><meta content="javapoet - A Java API for generating .java source files." property="og:description" />
+
+ <link rel="assets" href="https://assets-cdn.github.com/">
+
+ <meta name="pjax-timeout" content="1000">
+
+ <meta name="request-id" content="D75A:1A96:10DDEF3:1BB2B17:58BD2CC8" data-pjax-transient>
+
+
+ <meta name="selected-link" value="repo_source" data-pjax-transient>
+
+ <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
<meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA">
<meta name="google-analytics" content="UA-3769691-2">
-<meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="F616:4D80:3D52FD2:640C534:588819F9" name="octolytics-dimension-request_id" />
+<meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="https://collector.githubapp.com/github-external/browser_event" name="octolytics-event-url" /><meta content="D75A:1A96:10DDEF3:1BB2B17:58BD2CC8" name="octolytics-dimension-request_id" />
<meta content="/<user-name>/<repo-name>/blob/show" data-pjax-transient="true" name="analytics-location" />
@@ -960,22 +949,19 @@
- <meta name="hostname" content="github.com">
- <meta name="user-login" content="">
+ <meta name="hostname" content="github.com">
+ <meta name="user-login" content="">
- <meta name="expected-hostname" content="github.com">
- <meta name="js-proxy-site-detection-payload" content="YmQzYzA4OTVmOTU4OGNkNDVlZmQwODdjYTU0MDk0YjUzOTJiYTg0NWJhNzRjZmMzN2E0NWY3MmI1M2E2MWMwM3x7InJlbW90ZV9hZGRyZXNzIjoiNzMuMjMxLjEzMS44IiwicmVxdWVzdF9pZCI6IkY2MTY6NEQ4MDozRDUyRkQyOjY0MEM1MzQ6NTg4ODE5RjkiLCJ0aW1lc3RhbXAiOjE0ODUzMTQ1NTMsImhvc3QiOiJnaXRodWIuY29tIn0=">
+ <meta name="expected-hostname" content="github.com">
+ <meta name="js-proxy-site-detection-payload" content="NGRjZDFjODc4ZmY4MzA4ZDAyN2ZmZWNiZWZjZjljNDc5NDU4ZGQ0MDMyYzUzOTc2MzQwYjYyNTU3OTc3OWU1ZHx7InJlbW90ZV9hZGRyZXNzIjoiNzMuMjMxLjEzMS44IiwicmVxdWVzdF9pZCI6IkQ3NUE6MUE5NjoxMERERUYzOjFCQjJCMTc6NThCRDJDQzgiLCJ0aW1lc3RhbXAiOjE0ODg3OTI3NzYsImhvc3QiOiJnaXRodWIuY29tIn0=">
- <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#000000">
- <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">
+ <meta name="html-safe-nonce" content="02a3372ab8b20fc5463cb4cd59c8b23a4e7920d3">
- <meta name="html-safe-nonce" content="60b5f53f2584bab59a420ca40699efced4b0a6ce">
+ <meta http-equiv="x-pjax-version" content="11ea01c62849452917c88fc6d788a343">
+
- <meta http-equiv="x-pjax-version" content="5a52992acda5541f43c6302475c81d61">
-
-
<meta name="description" content="javapoet - A Java API for generating .java source files.">
<meta name="go-import" content="github.com/square/javapoet git https://github.com/square/javapoet.git">
@@ -983,13 +969,28 @@
<link href="https://github.com/square/javapoet/commits/master.atom" rel="alternate" title="Recent Commits to javapoet:master" type="application/atom+xml">
- <link rel="canonical" href="https://github.com/square/javapoet/blob/master/LICENSE.txt" data-pjax-transient>
+ <link rel="canonical" href="https://github.com/square/javapoet/blob/master/LICENSE.txt" data-pjax-transient>
+
+
+ <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
+
+ <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
+
+ <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#000000">
+ <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">
+
+<meta name="theme-color" content="#1e2327">
+
+
+
</head>
+ <body class="logged-out env-production vis-public page-blob">
+
- <body class="logged-out env-production vis-public page-blob">
- <div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div>
+ <div class="position-relative js-header-wrapper ">
<a href="#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a>
+ <div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div>
@@ -997,7 +998,7 @@
- <header class="site-header js-details-container Details alt-body-font" role="banner">
+ <header class="site-header js-details-container Details" role="banner">
<div class="container-responsive">
<a class="header-logo-invertocat" href="https://github.com/" aria-label="Homepage" data-ga-click="(Logged out) Header, go to homepage, icon:logo-wordmark">
<svg aria-hidden="true" class="octicon octicon-mark-github" height="32" version="1.1" viewBox="0 0 16 16" width="32"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
@@ -1008,28 +1009,17 @@
</button>
<div class="site-header-menu">
- <nav class="site-header-nav site-header-nav-main">
- <a href="/personal" class="js-selected-navigation-item nav-item nav-item-personal" data-ga-click="Header, click, Nav menu - item:personal" data-selected-links="/personal /personal">
- Personal
-</a> <a href="/open-source" class="js-selected-navigation-item nav-item nav-item-opensource" data-ga-click="Header, click, Nav menu - item:opensource" data-selected-links="/open-source /open-source">
- Open source
-</a> <a href="/business" class="js-selected-navigation-item nav-item nav-item-business" data-ga-click="Header, click, Nav menu - item:business" data-selected-links="/business /business/partners /business/features /business/customers /business">
- Business
-</a> <a href="/explore" class="js-selected-navigation-item nav-item nav-item-explore" data-ga-click="Header, click, Nav menu - item:explore" data-selected-links="/explore /trending /trending/developers /integrations /integrations/feature/code /integrations/feature/collaborate /integrations/feature/ship /showcases /explore">
- Explore
+ <nav class="site-header-nav">
+ <a href="/features" class="js-selected-navigation-item nav-item" data-ga-click="Header, click, Nav menu - item:features" data-selected-links="/features /features">
+ Features
+</a> <a href="/explore" class="js-selected-navigation-item nav-item" data-ga-click="Header, click, Nav menu - item:explore" data-selected-links="/explore /trending /trending/developers /integrations /integrations/feature/code /integrations/feature/collaborate /integrations/feature/ship /showcases /explore">
+ Explore
+</a> <a href="/pricing" class="js-selected-navigation-item nav-item" data-ga-click="Header, click, Nav menu - item:pricing" data-selected-links="/pricing /pricing">
+ Pricing
</a> </nav>
<div class="site-header-actions">
- <a class="btn btn-primary site-header-actions-btn" href="/join?source=header-repo" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up">Sign up</a>
- <a class="btn site-header-actions-btn mr-1" href="/login?return_to=%2Fsquare%2Fjavapoet%2Fblob%2Fmaster%2FLICENSE.txt" data-ga-click="(Logged out) Header, clicked Sign in, text:sign-in">Sign in</a>
- </div>
-
- <nav class="site-header-nav site-header-nav-secondary mr-md-3">
- <a class="nav-item" href="/pricing">Pricing</a>
- <a class="nav-item" href="/blog">Blog</a>
- <a class="nav-item" href="https://help.github.com">Support</a>
- <a class="nav-item header-search-link" href="https://github.com/search">Search GitHub</a>
- <div class="header-search scoped-search site-scoped-search js-site-search" role="search">
+ <div class="header-search scoped-search site-scoped-search js-site-search" role="search">
<!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/square/javapoet/search" class="js-site-search-form" data-scoped-search-url="/square/javapoet/search" data-unscoped-search-url="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
<label class="form-control header-search-wrapper js-chromeless-input-container">
<div class="header-search-scope">This repository</div>
@@ -1045,23 +1035,32 @@
</label>
</form></div>
- </nav>
+
+ <a class="text-bold site-header-link" href="/login?return_to=%2Fsquare%2Fjavapoet%2Fblob%2Fmaster%2FLICENSE.txt" data-ga-click="(Logged out) Header, clicked Sign in, text:sign-in">Sign in</a>
+ <span class="text-gray">or</span>
+ <a class="text-bold site-header-link" href="/join?source=header-repo" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up">Sign up</a>
+ </div>
</div>
</div>
</header>
+ </div>
- <div id="start-of-content" class="accessibility-aid"></div>
+ <div id="start-of-content" class="accessibility-aid"></div>
- <div id="js-flash-container">
+ <div id="js-flash-container">
</div>
- <div role="main">
- <div itemscope itemtype="http://schema.org/SoftwareSourceCode">
+
+ <div role="main">
+ <div itemscope itemtype="http://schema.org/SoftwareSourceCode">
<div id="js-repo-pjax-container" data-pjax-container>
+
+
+
<div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav">
<div class="container repohead-details-container">
@@ -1077,8 +1076,8 @@
Watch
</a>
<a class="social-count" href="/square/javapoet/watchers"
- aria-label="200 users are watching this repository">
- 200
+ aria-label="212 users are watching this repository">
+ 212
</a>
</li>
@@ -1092,8 +1091,8 @@
</a>
<a class="social-count js-social-count" href="/square/javapoet/stargazers"
- aria-label="2916 users starred this repository">
- 2,916
+ aria-label="3081 users starred this repository">
+ 3,081
</a>
</li>
@@ -1107,8 +1106,8 @@
</a>
<a href="/square/javapoet/network" class="social-count"
- aria-label="421 users forked this repository">
- 421
+ aria-label="446 users forked this repository">
+ 446
</a>
</li>
</ul>
@@ -1141,7 +1140,7 @@
<a href="/square/javapoet/issues" class="js-selected-navigation-item reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /square/javapoet/issues" itemprop="url">
<svg aria-hidden="true" class="octicon octicon-issue-opened" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"/></svg>
<span itemprop="name">Issues</span>
- <span class="counter">38</span>
+ <span class="counter">36</span>
<meta itemprop="position" content="2">
</a> </span>
@@ -1179,7 +1178,7 @@
-<a href="/square/javapoet/blob/b66d3d543982755f1d2397066ac9ccbc5ba8c327/LICENSE.txt" class="d-none js-permalink-shortcut" data-hotkey="y">Permalink</a>
+<a href="/square/javapoet/blob/0d6bdebf124a0c0e2a52ef520231b64e98c77a64/LICENSE.txt" class="d-none js-permalink-shortcut" data-hotkey="y">Permalink</a>
<!-- blob contrib key: blob_contributors:v21:d6361a7a2d71a3d3eba2cb0a1f0c07a2 -->
@@ -2552,9 +2551,9 @@
</div>
</div>
- </div>
+ </div>
- <div class="container site-footer-container">
+ <div class="container site-footer-container">
<div class="site-footer" role="contentinfo">
<ul class="site-footer-links float-right">
<li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact GitHub</a></li>
@@ -2570,7 +2569,7 @@
<svg aria-hidden="true" class="octicon octicon-mark-github" height="24" version="1.1" viewBox="0 0 16 16" width="24"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
</a>
<ul class="site-footer-links">
- <li>© 2017 <span title="0.04921s from github-fe-bd32a9f.cp1-iad.github.net">GitHub</span>, Inc.</li>
+ <li>© 2017 <span title="0.05888s from github-fe-fdcdb84.cp1-iad.github.net">GitHub</span>, Inc.</li>
<li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li>
<li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li>
<li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li>
@@ -2582,30 +2581,30 @@
+
+
+ <div id="ajax-error-message" class="ajax-error-message flash flash-error">
+ <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>
+ <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error">
+ <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>
+ </button>
+ You can't perform that action at this time.
+ </div>
+
+
+ <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/compat-8e19569aacd39e737a14c8515582825f3c90d1794c0e5539f9b525b8eb8b5a8e.js"></script>
+ <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/frameworks-506169cb2fe76254b921e8c944dd406e5cab2d719e657eace8ada98486231472.js"></script>
+ <script async="async" crossorigin="anonymous" src="https://assets-cdn.github.com/assets/github-2682871eafdca76aa810dac6b2433150e4f9a5810fd29306c5149b29ef81cc31.js"></script>
-
- <div id="ajax-error-message" class="ajax-error-message flash flash-error">
- <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>
- <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error">
- <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>
- </button>
- You can't perform that action at this time.
- </div>
-
-
- <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/compat-8e19569aacd39e737a14c8515582825f3c90d1794c0e5539f9b525b8eb8b5a8e.js"></script>
- <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/frameworks-d23e32e482112ba5e3ea9bd8dc7e555680116a74e002746ac91f41a4e5875a9b.js"></script>
- <script async="async" crossorigin="anonymous" src="https://assets-cdn.github.com/assets/github-2789a710829edc0c146edb49db485fdf15e3005c2e255ed209595bfe0e4c43a5.js"></script>
-
-
-
-
- <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner d-none">
- <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>
- <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span>
- <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span>
- </div>
- <div class="facebox" id="facebox" style="display:none;">
+
+
+
+ <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner d-none">
+ <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>
+ <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span>
+ <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span>
+ </div>
+ <div class="facebox" id="facebox" style="display:none;">
<div class="facebox-popup">
<div class="facebox-content" role="dialog" aria-labelledby="facebox-header" aria-describedby="facebox-description">
</div>
@@ -2615,6 +2614,7 @@
</div>
</div>
+
</body>
</html>
diff --git a/room/compiler/build.gradle b/room/compiler/build.gradle
index 5e4d1f1..a3cab58 100644
--- a/room/compiler/build.gradle
+++ b/room/compiler/build.gradle
@@ -35,6 +35,7 @@
compile libs.javapoet
compile libs.antlr
compile libs.xerial
+ compile libs.apache.commons.codec
testCompile libs.google_compile_testing
testCompile libs.junit
testCompile libs.ij_annotations
diff --git a/room/compiler/src/main/kotlin/com/android/support/room/vo/Database.kt b/room/compiler/src/main/kotlin/com/android/support/room/vo/Database.kt
index cbff03e..dda4a3d 100644
--- a/room/compiler/src/main/kotlin/com/android/support/room/vo/Database.kt
+++ b/room/compiler/src/main/kotlin/com/android/support/room/vo/Database.kt
@@ -17,6 +17,7 @@
package com.android.support.room.vo
import com.squareup.javapoet.ClassName
+import org.apache.commons.codec.digest.DigestUtils
import javax.lang.model.element.TypeElement
import javax.lang.model.type.TypeMirror
@@ -33,7 +34,25 @@
"${typeName.simpleNames().joinToString("_")}_Impl"
}
- val implTypeName by lazy {
+ val implTypeName : ClassName by lazy {
ClassName.get(typeName.packageName(), implClassName)
}
+
+ /**
+ * Create a has that identifies this database definition so that at runtime we can check to
+ * ensure developer didn't forget to update the version.
+ */
+ val identityHash : String by lazy {
+ val entityDescriptions = entities
+ .sortedBy { it.tableName }
+ .map { it.createTableQuery }
+ val indexDescriptions = entities
+ .flatMap { entity ->
+ entity.indices.map { index ->
+ index.createQuery(entity.tableName)
+ }
+ }
+ val input = (entityDescriptions + indexDescriptions).joinToString("¯\\_(ツ)_/¯")
+ DigestUtils.md5Hex(input)
+ }
}
diff --git a/room/compiler/src/main/kotlin/com/android/support/room/writer/SQLiteOpenHelperWriter.kt b/room/compiler/src/main/kotlin/com/android/support/room/writer/SQLiteOpenHelperWriter.kt
index a1c6bc4..2ae4bf7 100644
--- a/room/compiler/src/main/kotlin/com/android/support/room/writer/SQLiteOpenHelperWriter.kt
+++ b/room/compiler/src/main/kotlin/com/android/support/room/writer/SQLiteOpenHelperWriter.kt
@@ -17,11 +17,14 @@
package com.android.support.room.writer
import android.support.annotation.VisibleForTesting
+import com.android.support.room.ext.AndroidTypeNames
import com.android.support.room.ext.L
import com.android.support.room.ext.N
+import com.android.support.room.ext.RoomTypeNames
import com.android.support.room.ext.S
import com.android.support.room.ext.SupportDbTypeNames
import com.android.support.room.ext.T
+import com.android.support.room.ext.typeName
import com.android.support.room.solver.CodeGenScope
import com.android.support.room.vo.Database
import com.android.support.room.vo.Entity
@@ -35,6 +38,13 @@
* Create an open helper using SupportSQLiteOpenHelperFactory
*/
class SQLiteOpenHelperWriter(val database : Database) {
+ companion object {
+ // must match the runtime property Room#MASTER_TABLE_NAME
+ val MASTER_TABLE_NAME = "room_master_table"
+ val MASTER_TABLE_ID_COLUMN = "id"
+ val MASTER_TABLE_IDENTITY_HASH_COLUMN = "identity_hash"
+ val MASTER_TABLE_ID = 42
+ }
fun write(outVar : String, configuration : ParameterSpec, scope: CodeGenScope) {
scope.builder().apply {
val sqliteConfigVar = scope.getTmpVar("_sqliteConfig")
@@ -74,11 +84,35 @@
return MethodSpec.methodBuilder("onOpen").apply {
addModifiers(PUBLIC)
addParameter(SupportDbTypeNames.DB, "_db")
+ addStatement("String identityHash = \"\"")
+ addStatement("$T cursor = _db.rawQuery($S, $T.EMPTY_STRING_ARRAY)",
+ AndroidTypeNames.CURSOR, readIdentityHashQuery(),
+ RoomTypeNames.STRING_UTIL)
+ beginControlFlow("try").apply {
+ beginControlFlow("if (cursor.moveToFirst())").apply {
+ addStatement("identityHash = cursor.getString(0)")
+ }
+ endControlFlow()
+ }
+ nextControlFlow("finally").apply {
+ addStatement("cursor.close()")
+ }
+ endControlFlow()
+ beginControlFlow("if(!$S.equals(identityHash))", database.identityHash).apply {
+ addStatement("throw new $T($S)", IllegalStateException::class.typeName(),
+ "Room cannot verify the data integrity. Looks like you've changed schema" +
+ " but forgot to update the version number. You can simply fix" +
+ " this by increasing the version number.")
+ }
+ endControlFlow()
+ addStatement("mDatabase = _db")
addStatement("internalInitInvalidationTracker(_db)")
}.build()
}
private fun MethodSpec.Builder.writeCreateStatements() {
+ addStatement("_db.execSQL($S)", createMasterTableQuery())
+ addStatement("_db.execSQL($S)", setIdentityHashQuery())
// this is already called in transaction so no need for a transaction
database.entities.forEach {
addStatement("_db.execSQL($S)", createQuery(it))
@@ -90,6 +124,26 @@
}
}
+ private fun setIdentityHashQuery(): String {
+ return "INSERT OR REPLACE INTO $MASTER_TABLE_NAME VALUES($MASTER_TABLE_ID," +
+ "\"${database.identityHash}\")"
+ }
+
+ private fun readIdentityHashQuery() : String {
+ return "SELECT $MASTER_TABLE_IDENTITY_HASH_COLUMN FROM $MASTER_TABLE_NAME WHERE" +
+ " $MASTER_TABLE_ID_COLUMN = $MASTER_TABLE_ID LIMIT 1"
+ }
+
+ private fun createMasterTableQuery() : String {
+ return "CREATE TABLE IF NOT EXISTS `$MASTER_TABLE_NAME`(" +
+ "$MASTER_TABLE_ID_COLUMN INTEGER PRIMARY KEY," +
+ "$MASTER_TABLE_IDENTITY_HASH_COLUMN TEXT)"
+ }
+
+ private fun dropMasterTableQuery() : String {
+ return "DROP TABLE IF EXISTS `$MASTER_TABLE_NAME`"
+ }
+
private fun createOnCreate() : MethodSpec {
return MethodSpec.methodBuilder("onCreate").apply {
addModifiers(PUBLIC)
diff --git a/room/compiler/src/main/resources/NOTICE.txt b/room/compiler/src/main/resources/NOTICE.txt
index 2575e9b..3c07ba3 100644
--- a/room/compiler/src/main/resources/NOTICE.txt
+++ b/room/compiler/src/main/resources/NOTICE.txt
@@ -267,6 +267,32 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+=====
+
+MIT License for codepointat.js from https://git.io/codepointat
+MIT License for fromcodepoint.js from https://git.io/vDW1m
+
+Copyright Mathias Bynens <https://mathiasbynens.be/>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
@@ -1171,57 +1197,46 @@
+
+
<!DOCTYPE html>
-<html lang="en" class="">
- <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#">
- <meta charset='utf-8'>
-
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
- <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-c07e6f4b02b556d1d85052fb3853caf84c80e6b23dcdb1ae1b00f051da1115a2.css" media="all" rel="stylesheet" />
- <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-85f6307e0a74c78ba00f8c5bf9c7fb17a418d361627638f51f989be45f709416.css" media="all" rel="stylesheet" />
-
-
- <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/site-73b3dae8eb441c98982c7306f0e59decca409e87188e07bc1a961b8cea511aab.css" media="all" rel="stylesheet" />
-
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta http-equiv="Content-Language" content="en">
- <meta name="viewport" content="width=device-width">
-
- <title>javapoet/LICENSE.txt at master · square/javapoet · GitHub</title>
- <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">
- <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
- <link rel="apple-touch-icon" href="/apple-touch-icon.png">
- <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">
- <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">
- <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">
- <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png">
- <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">
- <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">
- <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png">
- <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">
- <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">
- <meta property="fb:app_id" content="1401488693436528">
- <meta content="https://avatars0.githubusercontent.com/u/82592?v=3&s=400" name="twitter:image:src" /><meta content="@github" name="twitter:site" /><meta content="summary" name="twitter:card" /><meta content="square/javapoet" name="twitter:title" /><meta content="javapoet - A Java API for generating .java source files." name="twitter:description" />
- <meta content="https://avatars0.githubusercontent.com/u/82592?v=3&s=400" property="og:image" /><meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="square/javapoet" property="og:title" /><meta content="https://github.com/square/javapoet" property="og:url" /><meta content="javapoet - A Java API for generating .java source files." property="og:description" />
- <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
- <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
- <link rel="assets" href="https://assets-cdn.github.com/">
-
- <meta name="pjax-timeout" content="1000">
-
- <meta name="request-id" content="F589:4D7F:4003D62:681CE2A:588819F0" data-pjax-transient>
+ <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-19e26a1cefb5f1e92203a9468134dbf46b5a5308aeeeee09c96b32fec8c8b044.css" media="all" rel="stylesheet" />
+ <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-a97f6b98170262f1be5dd5b84d3fb788f1bb65b269c11417026fe763d5eeb63b.css" media="all" rel="stylesheet" />
+
+
+ <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/site-1da8b9f73abeb68e6a54d0f514085224fe9e7325fd664eacacb38bebe10b9eab.css" media="all" rel="stylesheet" />
+
- <meta name="msapplication-TileImage" content="/windows-tile.png">
- <meta name="msapplication-TileColor" content="#ffffff">
- <meta name="selected-link" value="repo_source" data-pjax-transient>
+ <meta name="viewport" content="width=device-width">
+
+ <title>javapoet/LICENSE.txt at master · square/javapoet · GitHub</title>
+ <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">
+ <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
+ <meta property="fb:app_id" content="1401488693436528">
- <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
+
+ <meta content="https://avatars0.githubusercontent.com/u/82592?v=3&s=400" property="og:image" /><meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="square/javapoet" property="og:title" /><meta content="https://github.com/square/javapoet" property="og:url" /><meta content="javapoet - A Java API for generating .java source files." property="og:description" />
+
+ <link rel="assets" href="https://assets-cdn.github.com/">
+
+ <meta name="pjax-timeout" content="1000">
+
+ <meta name="request-id" content="D6C7:1A98:299347D:4428E57:58BD2CBF" data-pjax-transient>
+
+
+ <meta name="selected-link" value="repo_source" data-pjax-transient>
+
+ <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
<meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA">
<meta name="google-analytics" content="UA-3769691-2">
-<meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="F589:4D7F:4003D62:681CE2A:588819F0" name="octolytics-dimension-request_id" />
+<meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="https://collector.githubapp.com/github-external/browser_event" name="octolytics-event-url" /><meta content="D6C7:1A98:299347D:4428E57:58BD2CBF" name="octolytics-dimension-request_id" />
<meta content="/<user-name>/<repo-name>/blob/show" data-pjax-transient="true" name="analytics-location" />
@@ -1230,22 +1245,19 @@
- <meta name="hostname" content="github.com">
- <meta name="user-login" content="">
+ <meta name="hostname" content="github.com">
+ <meta name="user-login" content="">
- <meta name="expected-hostname" content="github.com">
- <meta name="js-proxy-site-detection-payload" content="MzgwODcxZTYwMTg2MjUyOGMwYjFkNzEzZWQxOTMzODJhZTQyNmY0ZjcwOTBhYTk4NTkyZDQ0Yzg1NDQyM2FlOXx7InJlbW90ZV9hZGRyZXNzIjoiNzMuMjMxLjEzMS44IiwicmVxdWVzdF9pZCI6IkY1ODk6NEQ3Rjo0MDAzRDYyOjY4MUNFMkE6NTg4ODE5RjAiLCJ0aW1lc3RhbXAiOjE0ODUzMTQ1NDUsImhvc3QiOiJnaXRodWIuY29tIn0=">
+ <meta name="expected-hostname" content="github.com">
+ <meta name="js-proxy-site-detection-payload" content="ZDNmMzgxMGJiZDc4ODliMzdlNzI4OTYzZDY1ZDQ0OWEzOWI0MjU4ODRlYTM0MjQwZjI0YTkyMDI1ZmY2YThlZnx7InJlbW90ZV9hZGRyZXNzIjoiNzMuMjMxLjEzMS44IiwicmVxdWVzdF9pZCI6IkQ2Qzc6MUE5ODoyOTkzNDdEOjQ0MjhFNTc6NThCRDJDQkYiLCJ0aW1lc3RhbXAiOjE0ODg3OTI3NjgsImhvc3QiOiJnaXRodWIuY29tIn0=">
- <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#000000">
- <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">
+ <meta name="html-safe-nonce" content="183c8e3f1a3735499d60ecdf53b57bdd88276258">
- <meta name="html-safe-nonce" content="15b8293c9d294a2dbe72cb0a081192e3c4764a4a">
+ <meta http-equiv="x-pjax-version" content="11ea01c62849452917c88fc6d788a343">
+
- <meta http-equiv="x-pjax-version" content="5a52992acda5541f43c6302475c81d61">
-
-
<meta name="description" content="javapoet - A Java API for generating .java source files.">
<meta name="go-import" content="github.com/square/javapoet git https://github.com/square/javapoet.git">
@@ -1253,13 +1265,28 @@
<link href="https://github.com/square/javapoet/commits/master.atom" rel="alternate" title="Recent Commits to javapoet:master" type="application/atom+xml">
- <link rel="canonical" href="https://github.com/square/javapoet/blob/master/LICENSE.txt" data-pjax-transient>
+ <link rel="canonical" href="https://github.com/square/javapoet/blob/master/LICENSE.txt" data-pjax-transient>
+
+
+ <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
+
+ <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
+
+ <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#000000">
+ <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">
+
+<meta name="theme-color" content="#1e2327">
+
+
+
</head>
+ <body class="logged-out env-production vis-public page-blob">
+
- <body class="logged-out env-production vis-public page-blob">
- <div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div>
+ <div class="position-relative js-header-wrapper ">
<a href="#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a>
+ <div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div>
@@ -1267,7 +1294,7 @@
- <header class="site-header js-details-container Details alt-body-font" role="banner">
+ <header class="site-header js-details-container Details" role="banner">
<div class="container-responsive">
<a class="header-logo-invertocat" href="https://github.com/" aria-label="Homepage" data-ga-click="(Logged out) Header, go to homepage, icon:logo-wordmark">
<svg aria-hidden="true" class="octicon octicon-mark-github" height="32" version="1.1" viewBox="0 0 16 16" width="32"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
@@ -1278,28 +1305,17 @@
</button>
<div class="site-header-menu">
- <nav class="site-header-nav site-header-nav-main">
- <a href="/personal" class="js-selected-navigation-item nav-item nav-item-personal" data-ga-click="Header, click, Nav menu - item:personal" data-selected-links="/personal /personal">
- Personal
-</a> <a href="/open-source" class="js-selected-navigation-item nav-item nav-item-opensource" data-ga-click="Header, click, Nav menu - item:opensource" data-selected-links="/open-source /open-source">
- Open source
-</a> <a href="/business" class="js-selected-navigation-item nav-item nav-item-business" data-ga-click="Header, click, Nav menu - item:business" data-selected-links="/business /business/partners /business/features /business/customers /business">
- Business
-</a> <a href="/explore" class="js-selected-navigation-item nav-item nav-item-explore" data-ga-click="Header, click, Nav menu - item:explore" data-selected-links="/explore /trending /trending/developers /integrations /integrations/feature/code /integrations/feature/collaborate /integrations/feature/ship /showcases /explore">
- Explore
+ <nav class="site-header-nav">
+ <a href="/features" class="js-selected-navigation-item nav-item" data-ga-click="Header, click, Nav menu - item:features" data-selected-links="/features /features">
+ Features
+</a> <a href="/explore" class="js-selected-navigation-item nav-item" data-ga-click="Header, click, Nav menu - item:explore" data-selected-links="/explore /trending /trending/developers /integrations /integrations/feature/code /integrations/feature/collaborate /integrations/feature/ship /showcases /explore">
+ Explore
+</a> <a href="/pricing" class="js-selected-navigation-item nav-item" data-ga-click="Header, click, Nav menu - item:pricing" data-selected-links="/pricing /pricing">
+ Pricing
</a> </nav>
<div class="site-header-actions">
- <a class="btn btn-primary site-header-actions-btn" href="/join?source=header-repo" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up">Sign up</a>
- <a class="btn site-header-actions-btn mr-1" href="/login?return_to=%2Fsquare%2Fjavapoet%2Fblob%2Fmaster%2FLICENSE.txt" data-ga-click="(Logged out) Header, clicked Sign in, text:sign-in">Sign in</a>
- </div>
-
- <nav class="site-header-nav site-header-nav-secondary mr-md-3">
- <a class="nav-item" href="/pricing">Pricing</a>
- <a class="nav-item" href="/blog">Blog</a>
- <a class="nav-item" href="https://help.github.com">Support</a>
- <a class="nav-item header-search-link" href="https://github.com/search">Search GitHub</a>
- <div class="header-search scoped-search site-scoped-search js-site-search" role="search">
+ <div class="header-search scoped-search site-scoped-search js-site-search" role="search">
<!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/square/javapoet/search" class="js-site-search-form" data-scoped-search-url="/square/javapoet/search" data-unscoped-search-url="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
<label class="form-control header-search-wrapper js-chromeless-input-container">
<div class="header-search-scope">This repository</div>
@@ -1315,23 +1331,32 @@
</label>
</form></div>
- </nav>
+
+ <a class="text-bold site-header-link" href="/login?return_to=%2Fsquare%2Fjavapoet%2Fblob%2Fmaster%2FLICENSE.txt" data-ga-click="(Logged out) Header, clicked Sign in, text:sign-in">Sign in</a>
+ <span class="text-gray">or</span>
+ <a class="text-bold site-header-link" href="/join?source=header-repo" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up">Sign up</a>
+ </div>
</div>
</div>
</header>
+ </div>
- <div id="start-of-content" class="accessibility-aid"></div>
+ <div id="start-of-content" class="accessibility-aid"></div>
- <div id="js-flash-container">
+ <div id="js-flash-container">
</div>
- <div role="main">
- <div itemscope itemtype="http://schema.org/SoftwareSourceCode">
+
+ <div role="main">
+ <div itemscope itemtype="http://schema.org/SoftwareSourceCode">
<div id="js-repo-pjax-container" data-pjax-container>
+
+
+
<div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav">
<div class="container repohead-details-container">
@@ -1347,8 +1372,8 @@
Watch
</a>
<a class="social-count" href="/square/javapoet/watchers"
- aria-label="200 users are watching this repository">
- 200
+ aria-label="212 users are watching this repository">
+ 212
</a>
</li>
@@ -1362,8 +1387,8 @@
</a>
<a class="social-count js-social-count" href="/square/javapoet/stargazers"
- aria-label="2916 users starred this repository">
- 2,916
+ aria-label="3081 users starred this repository">
+ 3,081
</a>
</li>
@@ -1377,8 +1402,8 @@
</a>
<a href="/square/javapoet/network" class="social-count"
- aria-label="421 users forked this repository">
- 421
+ aria-label="446 users forked this repository">
+ 446
</a>
</li>
</ul>
@@ -1411,7 +1436,7 @@
<a href="/square/javapoet/issues" class="js-selected-navigation-item reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /square/javapoet/issues" itemprop="url">
<svg aria-hidden="true" class="octicon octicon-issue-opened" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"/></svg>
<span itemprop="name">Issues</span>
- <span class="counter">38</span>
+ <span class="counter">36</span>
<meta itemprop="position" content="2">
</a> </span>
@@ -1449,7 +1474,7 @@
-<a href="/square/javapoet/blob/b66d3d543982755f1d2397066ac9ccbc5ba8c327/LICENSE.txt" class="d-none js-permalink-shortcut" data-hotkey="y">Permalink</a>
+<a href="/square/javapoet/blob/0d6bdebf124a0c0e2a52ef520231b64e98c77a64/LICENSE.txt" class="d-none js-permalink-shortcut" data-hotkey="y">Permalink</a>
<!-- blob contrib key: blob_contributors:v21:d6361a7a2d71a3d3eba2cb0a1f0c07a2 -->
@@ -2822,9 +2847,9 @@
</div>
</div>
- </div>
+ </div>
- <div class="container site-footer-container">
+ <div class="container site-footer-container">
<div class="site-footer" role="contentinfo">
<ul class="site-footer-links float-right">
<li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact GitHub</a></li>
@@ -2840,7 +2865,7 @@
<svg aria-hidden="true" class="octicon octicon-mark-github" height="24" version="1.1" viewBox="0 0 16 16" width="24"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
</a>
<ul class="site-footer-links">
- <li>© 2017 <span title="0.06770s from github-fe126-cp1-prd.iad.github.net">GitHub</span>, Inc.</li>
+ <li>© 2017 <span title="0.17132s from github-fe133-cp1-prd.iad.github.net">GitHub</span>, Inc.</li>
<li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li>
<li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li>
<li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li>
@@ -2852,30 +2877,30 @@
+
+
+ <div id="ajax-error-message" class="ajax-error-message flash flash-error">
+ <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>
+ <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error">
+ <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>
+ </button>
+ You can't perform that action at this time.
+ </div>
+
+
+ <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/compat-8e19569aacd39e737a14c8515582825f3c90d1794c0e5539f9b525b8eb8b5a8e.js"></script>
+ <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/frameworks-506169cb2fe76254b921e8c944dd406e5cab2d719e657eace8ada98486231472.js"></script>
+ <script async="async" crossorigin="anonymous" src="https://assets-cdn.github.com/assets/github-2682871eafdca76aa810dac6b2433150e4f9a5810fd29306c5149b29ef81cc31.js"></script>
-
- <div id="ajax-error-message" class="ajax-error-message flash flash-error">
- <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>
- <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error">
- <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>
- </button>
- You can't perform that action at this time.
- </div>
-
-
- <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/compat-8e19569aacd39e737a14c8515582825f3c90d1794c0e5539f9b525b8eb8b5a8e.js"></script>
- <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/frameworks-d23e32e482112ba5e3ea9bd8dc7e555680116a74e002746ac91f41a4e5875a9b.js"></script>
- <script async="async" crossorigin="anonymous" src="https://assets-cdn.github.com/assets/github-2789a710829edc0c146edb49db485fdf15e3005c2e255ed209595bfe0e4c43a5.js"></script>
-
-
-
-
- <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner d-none">
- <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>
- <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span>
- <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span>
- </div>
- <div class="facebox" id="facebox" style="display:none;">
+
+
+
+ <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner d-none">
+ <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>
+ <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span>
+ <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span>
+ </div>
+ <div class="facebox" id="facebox" style="display:none;">
<div class="facebox-popup">
<div class="facebox-content" role="dialog" aria-labelledby="facebox-header" aria-describedby="facebox-description">
</div>
@@ -2885,9 +2910,239 @@
</div>
</div>
+
</body>
</html>
+
+-----------------------------------------------------------------------------
+* commons-codec.jar (commons-codec:commons-codec:1.10)
+
+ ****** NOTICE:
+Apache Commons Codec
+Copyright 2002-2016 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java
+contains test data from http://aspell.net/test/orig/batch0.tab.
+Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org)
+
+===============================================================================
+
+The content of package org.apache.commons.codec.language.bm has been translated
+from the original php source code available at http://stevemorse.org/phoneticinfo.htm
+with permission from the original authors.
+Original source copyright:
+Copyright (c) 2008 Alexander Beider & Stephen P. Morse.
+
+ ****** LICENSE:
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
+
+
diff --git a/room/compiler/src/test/data/databasewriter/output/ComplexDatabase.java b/room/compiler/src/test/data/databasewriter/output/ComplexDatabase.java
index 43adb9d..5db1335 100644
--- a/room/compiler/src/test/data/databasewriter/output/ComplexDatabase.java
+++ b/room/compiler/src/test/data/databasewriter/output/ComplexDatabase.java
@@ -1,11 +1,14 @@
package foo.bar;
+import android.database.Cursor;
import com.android.support.db.SupportSQLiteDatabase;
import com.android.support.db.SupportSQLiteOpenHelper;
import com.android.support.db.SupportSQLiteOpenHelper.Callback;
import com.android.support.db.SupportSQLiteOpenHelper.Configuration;
import com.android.support.room.DatabaseConfiguration;
import com.android.support.room.InvalidationTracker;
+import com.android.support.room.util.StringUtil;
+import java.lang.IllegalStateException;
import java.lang.Override;
public class ComplexDatabase_Impl extends ComplexDatabase {
@@ -14,14 +17,16 @@
protected SupportSQLiteOpenHelper createOpenHelper(DatabaseConfiguration configuration) {
final SupportSQLiteOpenHelper.Callback _openCallback = new SupportSQLiteOpenHelper.Callback() {
public void onCreate(SupportSQLiteDatabase _db) {
- _db.execSQL("CREATE TABLE IF NOT EXISTS `User` (`uid` INTEGER, `name` TEXT,"
- + " `lastName` TEXT, `ageColumn` INTEGER, PRIMARY KEY(`uid`))");
+ _db.execSQL("CREATE TABLE IF NOT EXISTS `room_master_table`(id INTEGER PRIMARY KEY,identity_hash TEXT)");
+ _db.execSQL("INSERT OR REPLACE INTO room_master_table VALUES(42,\"d4b1d59e1344d0db40fe2cd3fe64d02f\")");
+ _db.execSQL("CREATE TABLE IF NOT EXISTS `User` (`uid` INTEGER, `name` TEXT, `lastName` TEXT, `ageColumn` INTEGER, PRIMARY KEY(`uid`))");
}
public void onUpgrade(SupportSQLiteDatabase _db, int _oldVersion, int _newVersion) {
_db.execSQL("DROP TABLE IF EXISTS `User`");
- _db.execSQL("CREATE TABLE IF NOT EXISTS `User` (`uid` INTEGER, `name` TEXT,"
- + " `lastName` TEXT, `ageColumn` INTEGER, PRIMARY KEY(`uid`))");
+ _db.execSQL("CREATE TABLE IF NOT EXISTS `room_master_table`(id INTEGER PRIMARY KEY,identity_hash TEXT)");
+ _db.execSQL("INSERT OR REPLACE INTO room_master_table VALUES(42,\"d4b1d59e1344d0db40fe2cd3fe64d02f\")");
+ _db.execSQL("CREATE TABLE IF NOT EXISTS `User` (`uid` INTEGER, `name` TEXT, `lastName` TEXT, `ageColumn` INTEGER, PRIMARY KEY(`uid`))");
}
public void onDowngrade(SupportSQLiteDatabase _db, int _oldVersion, int _newVersion) {
@@ -29,6 +34,19 @@
}
public void onOpen(SupportSQLiteDatabase _db) {
+ String identityHash = "";
+ Cursor cursor = _db.rawQuery("SELECT identity_hash FROM room_master_table WHERE id = 42 LIMIT 1", StringUtil.EMPTY_STRING_ARRAY);
+ try {
+ if (cursor.moveToFirst()) {
+ identityHash = cursor.getString(0);
+ }
+ } finally {
+ cursor.close();
+ }
+ if(!"d4b1d59e1344d0db40fe2cd3fe64d02f".equals(identityHash)) {
+ throw new IllegalStateException("Room cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number. You can simply fix this by increasing the version number.");
+ }
+ mDatabase = _db;
internalInitInvalidationTracker(_db);
}
};
@@ -59,4 +77,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/room/integration-tests/testapp/src/androidTest/java/com/android/support/room/integration/testapp/test/IdentityDetectionTest.java b/room/integration-tests/testapp/src/androidTest/java/com/android/support/room/integration/testapp/test/IdentityDetectionTest.java
new file mode 100644
index 0000000..93bbfed
--- /dev/null
+++ b/room/integration-tests/testapp/src/androidTest/java/com/android/support/room/integration/testapp/test/IdentityDetectionTest.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * 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 com.android.support.room.integration.testapp.test;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+import android.util.Log;
+
+import com.android.support.db.SupportSQLiteDatabase;
+import com.android.support.room.Room;
+import com.android.support.room.integration.testapp.TestDatabase;
+import com.android.support.room.integration.testapp.vo.User;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class IdentityDetectionTest {
+ static final String TAG = "IdentityDetectionTest";
+ static final String DB_FILE_NAME = "identity_test_db";
+ TestDatabase mTestDatabase;
+ @Before
+ public void createTestDatabase() {
+ deleteDbFile();
+ }
+
+ @Test
+ public void reOpenWithoutIssues() {
+ openDb();
+ mTestDatabase.getUserDao().insert(TestUtil.createUser(3));
+ closeDb();
+ openDb();
+ User[] users = mTestDatabase.getUserDao().loadByIds(3);
+ assertThat(users.length, is(1));
+ }
+
+ @Test
+ public void reOpenChangedHash() {
+ openDb();
+ mTestDatabase.getUserDao().insert(TestUtil.createUser(3));
+ // change the hash
+ SupportSQLiteDatabase db = mTestDatabase.getOpenHelper().getWritableDatabase();
+ db.execSQL("UPDATE " + Room.MASTER_TABLE_NAME + " SET `identity_hash` = ?"
+ + " WHERE id = 42", new String[]{"bad hash"});
+ closeDb();
+ Throwable[] exceptions = new Throwable[1];
+ try {
+ openDb();
+ mTestDatabase.getUserDao().loadByIds(3);
+ } catch (Throwable t) {
+ exceptions[0] = t;
+ mTestDatabase = null;
+ }
+ assertThat(exceptions[0], instanceOf(IllegalStateException.class));
+ }
+
+ private void closeDb() {
+ mTestDatabase.getOpenHelper().close();
+ }
+
+ private void openDb() {
+ mTestDatabase = Room.databaseBuilder(InstrumentationRegistry.getTargetContext(),
+ TestDatabase.class, DB_FILE_NAME).build();
+ }
+
+ @After
+ public void clear() {
+ try {
+ if (mTestDatabase != null) {
+ closeDb();
+ }
+ deleteDbFile();
+ } finally {
+ Log.e(TAG, "could not close test database");
+ }
+ }
+
+ private void deleteDbFile() {
+ File testDb = InstrumentationRegistry.getTargetContext().getDatabasePath(DB_FILE_NAME);
+ testDb.delete();
+ }
+}
diff --git a/room/runtime/src/main/java/com/android/support/room/InvalidationTracker.java b/room/runtime/src/main/java/com/android/support/room/InvalidationTracker.java
index 88ce984..8c84be8 100644
--- a/room/runtime/src/main/java/com/android/support/room/InvalidationTracker.java
+++ b/room/runtime/src/main/java/com/android/support/room/InvalidationTracker.java
@@ -275,40 +275,49 @@
if (!ensureInitialization()) {
return;
}
- // This method runs in a while loop because while changes are synced to db, another
- // runnable may be skipped. If we cause it to skip, we need to do its work.
- while (true) {
- // there is a potential race condition where another mSyncTriggers runnable
- // can start running right after we get the tables list to sync.
- final int[] tablesToSync = mObservedTableTracker.getTablesToSync();
- if (tablesToSync == null) {
- return;
- }
- final int limit = tablesToSync.length;
- final SupportSQLiteDatabase writableDatabase = mDatabase.getOpenHelper()
- .getWritableDatabase();
- try {
- writableDatabase.beginTransaction();
- for (int tableId = 0; tableId < limit; tableId++) {
- switch (tablesToSync[tableId]) {
- case ObservedTableTracker.ADD:
- startTrackingTable(writableDatabase, tableId);
- break;
- case ObservedTableTracker.REMOVE:
- stopTrackingTable(writableDatabase, tableId);
- break;
- }
+ try {
+ // This method runs in a while loop because while changes are synced to db, another
+ // runnable may be skipped. If we cause it to skip, we need to do its work.
+ while (true) {
+ // there is a potential race condition where another mSyncTriggers runnable
+ // can start running right after we get the tables list to sync.
+ final int[] tablesToSync = mObservedTableTracker.getTablesToSync();
+ if (tablesToSync == null) {
+ return;
}
- writableDatabase.setTransactionSuccessful();
- } finally {
- writableDatabase.endTransaction();
+ final int limit = tablesToSync.length;
+ final SupportSQLiteDatabase writableDatabase = mDatabase.getOpenHelper()
+ .getWritableDatabase();
+ try {
+ writableDatabase.beginTransaction();
+ for (int tableId = 0; tableId < limit; tableId++) {
+ switch (tablesToSync[tableId]) {
+ case ObservedTableTracker.ADD:
+ startTrackingTable(writableDatabase, tableId);
+ break;
+ case ObservedTableTracker.REMOVE:
+ stopTrackingTable(writableDatabase, tableId);
+ break;
+ }
+ }
+ writableDatabase.setTransactionSuccessful();
+ } finally {
+ writableDatabase.endTransaction();
+ }
+ mObservedTableTracker.onSyncCompleted();
}
- mObservedTableTracker.onSyncCompleted();
+ } catch (IllegalStateException exception) {
+ // may happen if db is closed. just log.
+ Log.e(Room.LOG_TAG, "Cannot run invalidation tracker.", exception);
}
}
};
private boolean ensureInitialization() {
+ SupportSQLiteDatabase connection = mDatabase.getDatabase();
+ if (connection == null || !connection.isOpen()) {
+ return false;
+ }
if (!mInitialized) {
// trigger initialization
mDatabase.getOpenHelper().getWritableDatabase();
@@ -324,31 +333,36 @@
Runnable mRefreshRunnable = new Runnable() {
@Override
public void run() {
+ if (!ensureInitialization()) {
+ return;
+ }
if (mDatabase.inTransaction()
|| !mPendingRefresh.compareAndSet(true, false)) {
// no pending refresh
return;
}
- if (!ensureInitialization()) {
- return;
- }
- mCleanupStatement.executeUpdateDelete();
boolean hasUpdatedTable = false;
- mQueryArgs[0] = Long.toString(mMaxVersion);
- Cursor cursor = mDatabase.query(SELECT_UPDATED_TABLES_SQL, mQueryArgs);
- //noinspection TryFinallyCanBeTryWithResources
try {
- while (cursor.moveToNext()) {
- final long version = cursor.getLong(0);
- final int tableId = cursor.getInt(1);
+ mCleanupStatement.executeUpdateDelete();
+ mQueryArgs[0] = Long.toString(mMaxVersion);
+ Cursor cursor = mDatabase.query(SELECT_UPDATED_TABLES_SQL, mQueryArgs);
+ //noinspection TryFinallyCanBeTryWithResources
+ try {
+ while (cursor.moveToNext()) {
+ final long version = cursor.getLong(0);
+ final int tableId = cursor.getInt(1);
- mTableVersions[tableId] = version;
- hasUpdatedTable = true;
- // result is ordered so we can safely do this assignment
- mMaxVersion = version;
+ mTableVersions[tableId] = version;
+ hasUpdatedTable = true;
+ // result is ordered so we can safely do this assignment
+ mMaxVersion = version;
+ }
+ } finally {
+ cursor.close();
}
- } finally {
- cursor.close();
+ } catch (IllegalStateException exception) {
+ // may happen if db is closed. just log.
+ Log.e(Room.LOG_TAG, "Cannot run invalidation tracker.", exception);
}
if (hasUpdatedTable) {
synchronized (mObserverMap) {
diff --git a/room/runtime/src/main/java/com/android/support/room/Room.java b/room/runtime/src/main/java/com/android/support/room/Room.java
index 00afe83..922a4a5 100644
--- a/room/runtime/src/main/java/com/android/support/room/Room.java
+++ b/room/runtime/src/main/java/com/android/support/room/Room.java
@@ -25,6 +25,10 @@
@SuppressWarnings("unused")
public class Room {
static final String LOG_TAG = "ROOM";
+ /**
+ * The master table where room keeps its metadata information.
+ */
+ public static final String MASTER_TABLE_NAME = "room_master_table";
private static final String CURSOR_CONV_SUFFIX = "_CursorConverter";
/**
diff --git a/room/runtime/src/main/java/com/android/support/room/RoomDatabase.java b/room/runtime/src/main/java/com/android/support/room/RoomDatabase.java
index 7568417..e31406d 100644
--- a/room/runtime/src/main/java/com/android/support/room/RoomDatabase.java
+++ b/room/runtime/src/main/java/com/android/support/room/RoomDatabase.java
@@ -40,7 +40,8 @@
@SuppressWarnings({"unused", "WeakerAccess"})
public abstract class RoomDatabase {
private static final String DB_IMPL_SUFFIX = "_Impl";
- private volatile SupportSQLiteDatabase mDatabase;
+ // set by the generated open helper.
+ protected volatile SupportSQLiteDatabase mDatabase;
private SupportSQLiteOpenHelper mOpenHelper;
private final InvalidationTracker mInvalidationTracker;
@@ -93,6 +94,18 @@
*/
protected abstract InvalidationTracker createInvalidationTracker();
+ /**
+ * Returns the database connection. Note that, if the database is not opened yet, this method
+ * will return {code null}. You can use the {@link #getOpenHelper()} method to open the
+ * database.
+ *
+ * @return The database connection or {@code null} if it is not opened yet.
+ */
+ @Nullable
+ public SupportSQLiteDatabase getDatabase() {
+ return mDatabase;
+ }
+
// Below, there are wrapper methods for SupportSQLiteDatabase. This helps us track which
// methods we are using and also helps unit tests to mock this class without mocking
// all sqlite database methods.