diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index a5aec3c..9f9f27d 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index d138cfb..fe810c0 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -9,11 +9,12 @@
+
-
-
-
+
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 99202cc..963d406 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,5 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apt/.gitignore b/app-databinding/.gitignore
similarity index 100%
rename from apt/.gitignore
rename to app-databinding/.gitignore
diff --git a/app-databinding/build.gradle b/app-databinding/build.gradle
new file mode 100644
index 0000000..92c7ca0
--- /dev/null
+++ b/app-databinding/build.gradle
@@ -0,0 +1,40 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 28
+ defaultConfig {
+ applicationId "com.zhangyue.we.x2c.demo2"
+ minSdkVersion 15
+ targetSdkVersion 28
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ javaCompileOptions {
+ annotationProcessorOptions.includeCompileClasspath = true
+ }
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ dataBinding {
+ enabled true
+ }
+
+}
+
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation 'com.android.support:appcompat-v7:27.1.1'
+ implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
+ implementation 'com.jakewharton:butterknife:8.8.1'
+ annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
+
+ annotationProcessor project(':x2c-apt')
+ implementation project(':x2c-lib')
+ if (android.dataBinding.enabled) {
+ implementation project(':x2c-binding')
+ }
+}
diff --git a/lib/proguard-rules.pro b/app-databinding/proguard-rules.pro
similarity index 100%
rename from lib/proguard-rules.pro
rename to app-databinding/proguard-rules.pro
diff --git a/app-databinding/src/main/AndroidManifest.xml b/app-databinding/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..8bb18af
--- /dev/null
+++ b/app-databinding/src/main/AndroidManifest.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/zhangyue/we/x2c/demo/act/ActivityDataBinding.java b/app-databinding/src/main/java/com/zhangyue/demo/databinding/ActivityDataBinding.java
similarity index 82%
rename from app/src/main/java/com/zhangyue/we/x2c/demo/act/ActivityDataBinding.java
rename to app-databinding/src/main/java/com/zhangyue/demo/databinding/ActivityDataBinding.java
index 7f80046..644d008 100644
--- a/app/src/main/java/com/zhangyue/we/x2c/demo/act/ActivityDataBinding.java
+++ b/app-databinding/src/main/java/com/zhangyue/demo/databinding/ActivityDataBinding.java
@@ -1,14 +1,11 @@
-package com.zhangyue.we.x2c.demo.act;
+package com.zhangyue.demo.databinding;
import android.app.Activity;
-import android.databinding.DataBindingUtil;
import android.databinding.DataBindingX2C;
import android.os.Bundle;
-import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import com.zhangyue.we.x2c.ano.Xml;
-import com.zhangyue.we.x2c.demo.Bean;
import com.zhangyue.we.x2c.demo.R;
import com.zhangyue.we.x2c.demo.databinding.ActivityDatabindingBinding;
diff --git a/app/src/main/java/com/zhangyue/we/x2c/demo/Bean.java b/app-databinding/src/main/java/com/zhangyue/demo/databinding/Bean.java
similarity index 78%
rename from app/src/main/java/com/zhangyue/we/x2c/demo/Bean.java
rename to app-databinding/src/main/java/com/zhangyue/demo/databinding/Bean.java
index fa4d882..49673cb 100644
--- a/app/src/main/java/com/zhangyue/we/x2c/demo/Bean.java
+++ b/app-databinding/src/main/java/com/zhangyue/demo/databinding/Bean.java
@@ -1,4 +1,4 @@
-package com.zhangyue.we.x2c.demo;
+package com.zhangyue.demo.databinding;
/**
* @author:chengwei 2018/8/31
diff --git a/app-databinding/src/main/res/drawable/head.jpg b/app-databinding/src/main/res/drawable/head.jpg
new file mode 100644
index 0000000..650f05c
Binary files /dev/null and b/app-databinding/src/main/res/drawable/head.jpg differ
diff --git a/app-databinding/src/main/res/drawable/ic_launcher_background.xml b/app-databinding/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..d5fccc5
--- /dev/null
+++ b/app-databinding/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app-databinding/src/main/res/drawable/ic_launcher_foreground.xml b/app-databinding/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..c7bd21d
--- /dev/null
+++ b/app-databinding/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app-databinding/src/main/res/layout/activity_databinding.xml b/app-databinding/src/main/res/layout/activity_databinding.xml
new file mode 100644
index 0000000..af161f4
--- /dev/null
+++ b/app-databinding/src/main/res/layout/activity_databinding.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app-databinding/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app-databinding/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/app-databinding/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app-databinding/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app-databinding/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/app-databinding/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app-databinding/src/main/res/mipmap-hdpi/a.jpg b/app-databinding/src/main/res/mipmap-hdpi/a.jpg
new file mode 100644
index 0000000..5f864e4
Binary files /dev/null and b/app-databinding/src/main/res/mipmap-hdpi/a.jpg differ
diff --git a/app-databinding/src/main/res/mipmap-hdpi/ic_launcher.png b/app-databinding/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..a2f5908
Binary files /dev/null and b/app-databinding/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app-databinding/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app-databinding/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..1b52399
Binary files /dev/null and b/app-databinding/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app-databinding/src/main/res/mipmap-mdpi/ic_launcher.png b/app-databinding/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..ff10afd
Binary files /dev/null and b/app-databinding/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app-databinding/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app-databinding/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..115a4c7
Binary files /dev/null and b/app-databinding/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app-databinding/src/main/res/mipmap-xhdpi/ic_launcher.png b/app-databinding/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..dcd3cd8
Binary files /dev/null and b/app-databinding/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app-databinding/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app-databinding/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..459ca60
Binary files /dev/null and b/app-databinding/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app-databinding/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app-databinding/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..8ca12fe
Binary files /dev/null and b/app-databinding/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app-databinding/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app-databinding/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..8e19b41
Binary files /dev/null and b/app-databinding/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app-databinding/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app-databinding/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..b824ebd
Binary files /dev/null and b/app-databinding/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app-databinding/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app-databinding/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..4c19a13
Binary files /dev/null and b/app-databinding/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app-databinding/src/main/res/values/strings.xml b/app-databinding/src/main/res/values/strings.xml
new file mode 100644
index 0000000..a8b4614
--- /dev/null
+++ b/app-databinding/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ app-databinding
+
diff --git a/app-databinding/src/main/res/values/styles.xml b/app-databinding/src/main/res/values/styles.xml
new file mode 100644
index 0000000..61236bf
--- /dev/null
+++ b/app-databinding/src/main/res/values/styles.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
diff --git a/app-module/build.gradle b/app-module/build.gradle
index 9814ddd..1808b48 100644
--- a/app-module/build.gradle
+++ b/app-module/build.gradle
@@ -25,8 +25,8 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- annotationProcessor project(':apt')
- implementation project(':lib')
+ annotationProcessor project(':x2c-apt')
+ implementation project(':x2c-lib')
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
diff --git a/app/build.gradle b/app/build.gradle
index 0af6098..441e045 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -19,9 +19,6 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
- dataBinding {
- enabled true
- }
}
@@ -31,10 +28,8 @@ dependencies {
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
+
implementation project(':app-module')
- annotationProcessor project(':apt')
- implementation project(':lib')
- if (android.dataBinding.enabled) {
- implementation project(':sup-databinding')
- }
+ annotationProcessor project(':x2c-apt')
+ implementation project(':x2c-lib')
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ead8033..a68154b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -19,7 +19,6 @@
-
\ No newline at end of file
diff --git a/app/src/main/java/com/zhangyue/we/x2c/demo/MyFragment.java b/app/src/main/java/com/zhangyue/we/x2c/demo/MyFragment.java
index bd0d42a..ab3654c 100644
--- a/app/src/main/java/com/zhangyue/we/x2c/demo/MyFragment.java
+++ b/app/src/main/java/com/zhangyue/we/x2c/demo/MyFragment.java
@@ -11,7 +11,7 @@
import com.zhangyue.we.x2c.ano.Xml;
/**
- * @author:chengwei 2018/8/28
+ * @author:chengwei 2018/8/28
* @description
*/
@Xml(layouts = "fragmetn_layout")
diff --git a/app/src/main/java/com/zhangyue/we/x2c/demo/act/ActivityX2C.java b/app/src/main/java/com/zhangyue/we/x2c/demo/act/ActivityX2C.java
index 3f55aff..30996d1 100644
--- a/app/src/main/java/com/zhangyue/we/x2c/demo/act/ActivityX2C.java
+++ b/app/src/main/java/com/zhangyue/we/x2c/demo/act/ActivityX2C.java
@@ -9,7 +9,7 @@
import com.zhangyue.we.x2c.demo.R;
/**
- * @author:chengwei 2018/8/24
+ * @author:chengwei 2018/8/24
* @description
*/
@Xml(layouts = "activity_main")
diff --git a/app/src/main/java/com/zhangyue/we/x2c/demo/act/ActivityXML.java b/app/src/main/java/com/zhangyue/we/x2c/demo/act/ActivityXML.java
index eddbe01..478cccd 100644
--- a/app/src/main/java/com/zhangyue/we/x2c/demo/act/ActivityXML.java
+++ b/app/src/main/java/com/zhangyue/we/x2c/demo/act/ActivityXML.java
@@ -7,7 +7,7 @@
import com.zhangyue.we.x2c.demo.R;
/**
- * @author:chengwei 2018/8/24
+ * @author:chengwei 2018/8/24
* @description
*/
public class ActivityXML extends Activity {
diff --git a/app/src/main/java/com/zhangyue/we/x2c/demo/act/MainActivity.java b/app/src/main/java/com/zhangyue/we/x2c/demo/act/MainActivity.java
index 168a5bb..40bb459 100644
--- a/app/src/main/java/com/zhangyue/we/x2c/demo/act/MainActivity.java
+++ b/app/src/main/java/com/zhangyue/we/x2c/demo/act/MainActivity.java
@@ -39,8 +39,5 @@ void toSub() {
startActivity(new Intent(this, ActivitySubModule.class));
}
- @OnClick(R.id.binding)
- void toDataBinding() {
- startActivity(new Intent(this,ActivityDataBinding.class));
- }
+
}
diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..c7bd21d
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity.xml b/app/src/main/res/layout/activity.xml
index e01d345..97778ff 100644
--- a/app/src/main/res/layout/activity.xml
+++ b/app/src/main/res/layout/activity.xml
@@ -25,9 +25,5 @@
android:layout_marginTop="10dp"
android:text="subModule" />
-
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 627e91d..6d5ebcb 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -33,6 +33,7 @@
app:layout_constraintTop_toTopOf="@id/xml" />
+ app:layout_constraintTop_toBottomOf="@id/custom" />
> members;
-
- private AnnotationSpec(Builder builder) {
- this.type = builder.type;
- this.members = Util.immutableMultimap(builder.members);
- }
-
- void emit(CodeWriter codeWriter, boolean inline) throws IOException {
- String whitespace = inline ? "" : "\n";
- String memberSeparator = inline ? ", " : ",\n";
- if (members.isEmpty()) {
- // @Singleton
- codeWriter.emit("@$T", type);
- } else if (members.size() == 1 && members.containsKey("value")) {
- // @Named("foo")
- codeWriter.emit("@$T(", type);
- emitAnnotationValues(codeWriter, whitespace, memberSeparator, members.get("value"));
- codeWriter.emit(")");
- } else {
- // Inline:
- // @Column(name = "updated_at", nullable = false)
- //
- // Not inline:
- // @Column(
- // name = "updated_at",
- // nullable = false
- // )
- codeWriter.emit("@$T(" + whitespace, type);
- codeWriter.indent(2);
- for (Iterator>> i
- = members.entrySet().iterator(); i.hasNext(); ) {
- Map.Entry> entry = i.next();
- codeWriter.emit("$L = ", entry.getKey());
- emitAnnotationValues(codeWriter, whitespace, memberSeparator, entry.getValue());
- if (i.hasNext()) codeWriter.emit(memberSeparator);
- }
- codeWriter.unindent(2);
- codeWriter.emit(whitespace + ")");
- }
- }
-
- private void emitAnnotationValues(CodeWriter codeWriter, String whitespace,
- String memberSeparator, List values) throws IOException {
- if (values.size() == 1) {
- codeWriter.indent(2);
- codeWriter.emit(values.get(0));
- codeWriter.unindent(2);
- return;
- }
-
- codeWriter.emit("{" + whitespace);
- codeWriter.indent(2);
- boolean first = true;
- for (CodeBlock codeBlock : values) {
- if (!first) codeWriter.emit(memberSeparator);
- codeWriter.emit(codeBlock);
- first = false;
- }
- codeWriter.unindent(2);
- codeWriter.emit(whitespace + "}");
- }
-
- public static AnnotationSpec get(Annotation annotation) {
- return get(annotation, false);
- }
-
- public static AnnotationSpec get(Annotation annotation, boolean includeDefaultValues) {
- Builder builder = builder(annotation.annotationType());
- try {
- Method[] methods = annotation.annotationType().getDeclaredMethods();
- Arrays.sort(methods, new Comparator() {
- @Override
- public int compare(Method m1, Method m2) {
- return m1.getName().compareTo(m2.getName());
- }
- });
- for (Method method : methods) {
- Object value = method.invoke(annotation);
- if (!includeDefaultValues) {
- if (Objects.deepEquals(value, method.getDefaultValue())) {
- continue;
- }
- }
- if (value.getClass().isArray()) {
- for (int i = 0; i < Array.getLength(value); i++) {
- builder.addMemberForValue(method.getName(), Array.get(value, i));
- }
- continue;
- }
- if (value instanceof Annotation) {
- builder.addMember(method.getName(), "$L", get((Annotation) value));
- continue;
- }
- builder.addMemberForValue(method.getName(), value);
- }
- } catch (Exception e) {
- throw new RuntimeException("Reflecting " + annotation + " failed!", e);
- }
- return builder.build();
- }
-
- public static AnnotationSpec get(AnnotationMirror annotation) {
- TypeElement element = (TypeElement) annotation.getAnnotationType().asElement();
- Builder builder = AnnotationSpec.builder(ClassName.get(element));
- Visitor visitor = new Visitor(builder);
- for (ExecutableElement executableElement : annotation.getElementValues().keySet()) {
- String name = executableElement.getSimpleName().toString();
- AnnotationValue value = annotation.getElementValues().get(executableElement);
- value.accept(visitor, name);
- }
- return builder.build();
- }
-
- public static Builder builder(ClassName type) {
- checkNotNull(type, "type == null");
- return new Builder(type);
- }
-
- public static Builder builder(Class> type) {
- return builder(ClassName.get(type));
- }
-
- public Builder toBuilder() {
- Builder builder = new Builder(type);
- for (Map.Entry> entry : members.entrySet()) {
- builder.members.put(entry.getKey(), new ArrayList<>(entry.getValue()));
- }
- return builder;
- }
-
- @Override public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null) return false;
- if (getClass() != o.getClass()) return false;
- return toString().equals(o.toString());
- }
-
- @Override public int hashCode() {
- return toString().hashCode();
- }
-
- @Override public String toString() {
- StringWriter out = new StringWriter();
- try {
- CodeWriter codeWriter = new CodeWriter(out);
- codeWriter.emit("$L", this);
- return out.toString();
- } catch (IOException e) {
- throw new AssertionError();
- }
- }
-
- public static final class Builder {
- private final TypeName type;
- private final Map> members = new LinkedHashMap<>();
-
- private Builder(TypeName type) {
- this.type = type;
- }
-
- public Builder addMember(String name, String format, Object... args) {
- return addMember(name, CodeBlock.of(format, args));
- }
-
- public Builder addMember(String name, CodeBlock codeBlock) {
- List values = members.get(name);
- if (values == null) {
- values = new ArrayList<>();
- members.put(name, values);
- }
- values.add(codeBlock);
- return this;
- }
-
- /**
- * Delegates to {@link #addMember(String, String, Object...)}, with parameter {@code format}
- * depending on the given {@code value} object. Falls back to {@code "$L"} literal format if
- * the class of the given {@code value} object is not supported.
- */
- Builder addMemberForValue(String memberName, Object value) {
- checkNotNull(memberName, "memberName == null");
- checkNotNull(value, "value == null, constant non-null value expected for %s", memberName);
- if (value instanceof Class>) {
- return addMember(memberName, "$T.class", value);
- }
- if (value instanceof Enum) {
- return addMember(memberName, "$T.$L", value.getClass(), ((Enum>) value).name());
- }
- if (value instanceof String) {
- return addMember(memberName, "$S", value);
- }
- if (value instanceof Float) {
- return addMember(memberName, "$Lf", value);
- }
- if (value instanceof Character) {
- return addMember(memberName, "'$L'", characterLiteralWithoutSingleQuotes((char) value));
- }
- return addMember(memberName, "$L", value);
- }
-
- public AnnotationSpec build() {
- return new AnnotationSpec(this);
- }
- }
-
- /**
- * Annotation value visitor adding members to the given builder instance.
- */
- private static class Visitor extends SimpleAnnotationValueVisitor7 {
- final Builder builder;
-
- Visitor(Builder builder) {
- super(builder);
- this.builder = builder;
- }
-
- @Override protected Builder defaultAction(Object o, String name) {
- return builder.addMemberForValue(name, o);
- }
-
- @Override public Builder visitAnnotation(AnnotationMirror a, String name) {
- return builder.addMember(name, "$L", get(a));
- }
-
- @Override public Builder visitEnumConstant(VariableElement c, String name) {
- return builder.addMember(name, "$T.$L", c.asType(), c.getSimpleName());
- }
-
- @Override public Builder visitType(TypeMirror t, String name) {
- return builder.addMember(name, "$T.class", t);
- }
-
- @Override public Builder visitArray(List extends AnnotationValue> values, String name) {
- for (AnnotationValue value : values) {
- value.accept(this, name);
- }
- return builder;
- }
- }
-}
diff --git a/apt/src/main/java/com/squareup/javapoet/ArrayTypeName.java b/apt/src/main/java/com/squareup/javapoet/ArrayTypeName.java
deleted file mode 100644
index 0f82aad..0000000
--- a/apt/src/main/java/com/squareup/javapoet/ArrayTypeName.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2015 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 com.squareup.javapoet;
-
-import java.io.IOException;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.lang.model.element.TypeParameterElement;
-import javax.lang.model.type.ArrayType;
-
-import static com.squareup.javapoet.Util.checkNotNull;
-
-public final class ArrayTypeName extends TypeName {
- public final TypeName componentType;
-
- private ArrayTypeName(TypeName componentType) {
- this(componentType, new ArrayList());
- }
-
- private ArrayTypeName(TypeName componentType, List annotations) {
- super(annotations);
- this.componentType = checkNotNull(componentType, "rawType == null");
- }
-
- @Override public ArrayTypeName annotated(List annotations) {
- return new ArrayTypeName(componentType, concatAnnotations(annotations));
- }
-
- @Override public TypeName withoutAnnotations() {
- return new ArrayTypeName(componentType);
- }
-
- @Override
- CodeWriter emit(CodeWriter out) throws IOException {
- return out.emit("$T[]", componentType);
- }
-
- /** Returns an array type whose elements are all instances of {@code componentType}. */
- public static ArrayTypeName of(TypeName componentType) {
- return new ArrayTypeName(componentType);
- }
-
- /** Returns an array type whose elements are all instances of {@code componentType}. */
- public static ArrayTypeName of(Type componentType) {
- return of(TypeName.get(componentType));
- }
-
- /** Returns an array type equivalent to {@code mirror}. */
- public static ArrayTypeName get(ArrayType mirror) {
- return get(mirror, new LinkedHashMap());
- }
-
- static ArrayTypeName get(
- ArrayType mirror, Map typeVariables) {
- return new ArrayTypeName(get(mirror.getComponentType(), typeVariables));
- }
-
- /** Returns an array type equivalent to {@code type}. */
- public static ArrayTypeName get(GenericArrayType type) {
- return get(type, new LinkedHashMap());
- }
-
- static ArrayTypeName get(GenericArrayType type, Map map) {
- return ArrayTypeName.of(get(type.getGenericComponentType(), map));
- }
-}
diff --git a/apt/src/main/java/com/squareup/javapoet/ClassName.java b/apt/src/main/java/com/squareup/javapoet/ClassName.java
deleted file mode 100644
index 94d50be..0000000
--- a/apt/src/main/java/com/squareup/javapoet/ClassName.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (C) 2014 Google, 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 com.squareup.javapoet;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ElementKind;
-import javax.lang.model.element.PackageElement;
-import javax.lang.model.element.TypeElement;
-
-import static com.squareup.javapoet.Util.checkArgument;
-import static com.squareup.javapoet.Util.checkNotNull;
-import static javax.lang.model.element.NestingKind.MEMBER;
-import static javax.lang.model.element.NestingKind.TOP_LEVEL;
-
-/** A fully-qualified class name for top-level and member classes. */
-public final class ClassName extends TypeName implements Comparable {
- public static final ClassName OBJECT = ClassName.get(Object.class);
-
- /** From top to bottom. This will be ["java.util", "Map", "Entry"] for {@link Map.Entry}. */
- final List names;
- final String canonicalName;
-
- private ClassName(List names) {
- this(names, new ArrayList());
- }
-
- private ClassName(List names, List annotations) {
- super(annotations);
- for (int i = 1; i < names.size(); i++) {
- checkArgument(SourceVersion.isName(names.get(i)), "part '%s' is keyword", names.get(i));
- }
- this.names = Util.immutableList(names);
- this.canonicalName = names.get(0).isEmpty()
- ? Util.join(".", names.subList(1, names.size()))
- : Util.join(".", names);
- }
-
- @Override public ClassName annotated(List annotations) {
- return new ClassName(names, concatAnnotations(annotations));
- }
-
- @Override public TypeName withoutAnnotations() {
- return new ClassName(names);
- }
-
- /** Returns the package name, like {@code "java.util"} for {@code Map.Entry}. */
- public String packageName() {
- return names.get(0);
- }
-
- /**
- * Returns the enclosing class, like {@link Map} for {@code Map.Entry}. Returns null if this class
- * is not nested in another class.
- */
- public ClassName enclosingClassName() {
- if (names.size() == 2) return null;
- return new ClassName(names.subList(0, names.size() - 1));
- }
-
- /**
- * Returns the top class in this nesting group. Equivalent to chained calls to {@link
- * #enclosingClassName()} until the result's enclosing class is null.
- */
- public ClassName topLevelClassName() {
- return new ClassName(names.subList(0, 2));
- }
-
- /**
- * Returns a new {@link ClassName} instance for the specified {@code name} as nested inside this
- * class.
- */
- public ClassName nestedClass(String name) {
- checkNotNull(name, "name == null");
- List result = new ArrayList<>(names.size() + 1);
- result.addAll(names);
- result.add(name);
- return new ClassName(result);
- }
-
- public List simpleNames() {
- return names.subList(1, names.size());
- }
-
- /**
- * Returns a class that shares the same enclosing package or class. If this class is enclosed by
- * another class, this is equivalent to {@code enclosingClassName().nestedClass(name)}. Otherwise
- * it is equivalent to {@code get(packageName(), name)}.
- */
- public ClassName peerClass(String name) {
- List result = new ArrayList<>(names);
- result.set(result.size() - 1, name);
- return new ClassName(result);
- }
-
- /** Returns the simple name of this class, like {@code "Entry"} for {@link Map.Entry}. */
- public String simpleName() {
- return names.get(names.size() - 1);
- }
-
- public static ClassName get(Class> clazz) {
- checkNotNull(clazz, "clazz == null");
- checkArgument(!clazz.isPrimitive(), "primitive types cannot be represented as a ClassName");
- checkArgument(!void.class.equals(clazz), "'void' type cannot be represented as a ClassName");
- checkArgument(!clazz.isArray(), "array types cannot be represented as a ClassName");
- List names = new ArrayList<>();
- while (true) {
- names.add(clazz.getSimpleName());
- Class> enclosing = clazz.getEnclosingClass();
- if (enclosing == null) break;
- clazz = enclosing;
- }
- // Avoid unreliable Class.getPackage(). https://github.com/square/javapoet/issues/295
- int lastDot = clazz.getName().lastIndexOf('.');
- if (lastDot != -1) names.add(clazz.getName().substring(0, lastDot));
- Collections.reverse(names);
- return new ClassName(names);
- }
-
- /**
- * Returns a new {@link ClassName} instance for the given fully-qualified class name string. This
- * method assumes that the input is ASCII and follows typical Java style (lowercase package
- * names, UpperCamelCase class names) and may produce incorrect results or throw
- * {@link IllegalArgumentException} otherwise. For that reason, {@link #get(Class)} and
- * {@link #get(Class)} should be preferred as they can correctly create {@link ClassName}
- * instances without such restrictions.
- */
- public static ClassName bestGuess(String classNameString) {
- List names = new ArrayList<>();
-
- // Add the package name, like "java.util.concurrent", or "" for no package.
- int p = 0;
- while (p < classNameString.length() && Character.isLowerCase(classNameString.codePointAt(p))) {
- p = classNameString.indexOf('.', p) + 1;
- checkArgument(p != 0, "couldn't make a guess for %s", classNameString);
- }
- names.add(p != 0 ? classNameString.substring(0, p - 1) : "");
-
- // Add the class names, like "Map" and "Entry".
- for (String part : classNameString.substring(p).split("\\.", -1)) {
- checkArgument(!part.isEmpty() && Character.isUpperCase(part.codePointAt(0)),
- "couldn't make a guess for %s", classNameString);
- names.add(part);
- }
-
- checkArgument(names.size() >= 2, "couldn't make a guess for %s", classNameString);
- return new ClassName(names);
- }
-
- /**
- * Returns a class name created from the given parts. For example, calling this with package name
- * {@code "java.util"} and simple names {@code "Map"}, {@code "Entry"} yields {@link Map.Entry}.
- */
- public static ClassName get(String packageName, String simpleName, String... simpleNames) {
- List result = new ArrayList<>();
- result.add(packageName);
- result.add(simpleName);
- Collections.addAll(result, simpleNames);
- return new ClassName(result);
- }
-
- /** Returns the class name for {@code element}. */
- public static ClassName get(TypeElement element) {
- checkNotNull(element, "element == null");
- List names = new ArrayList<>();
- for (Element e = element; isClassOrInterface(e); e = e.getEnclosingElement()) {
- checkArgument(element.getNestingKind() == TOP_LEVEL || element.getNestingKind() == MEMBER,
- "unexpected type testing");
- names.add(e.getSimpleName().toString());
- }
- names.add(getPackage(element).getQualifiedName().toString());
- Collections.reverse(names);
- return new ClassName(names);
- }
-
- private static boolean isClassOrInterface(Element e) {
- return e.getKind().isClass() || e.getKind().isInterface();
- }
-
- private static PackageElement getPackage(Element type) {
- while (type.getKind() != ElementKind.PACKAGE) {
- type = type.getEnclosingElement();
- }
- return (PackageElement) type;
- }
-
- @Override public int compareTo(ClassName o) {
- return canonicalName.compareTo(o.canonicalName);
- }
-
- @Override
- CodeWriter emit(CodeWriter out) throws IOException {
- return out.emitAndIndent(out.lookupName(this));
- }
-}
diff --git a/apt/src/main/java/com/squareup/javapoet/CodeBlock.java b/apt/src/main/java/com/squareup/javapoet/CodeBlock.java
deleted file mode 100644
index 92788b1..0000000
--- a/apt/src/main/java/com/squareup/javapoet/CodeBlock.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright (C) 2015 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 com.squareup.javapoet;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.lang.model.element.Element;
-import javax.lang.model.type.TypeMirror;
-
-import static com.squareup.javapoet.Util.checkArgument;
-
-/**
- * A fragment of a .java file, potentially containing declarations, statements, and documentation.
- * Code blocks are not necessarily well-formed Java code, and are not validated. This class assumes
- * javac will check correctness later!
- *
- *
Code blocks support placeholders like {@link java.text.Format}. Where {@link String#format}
- * uses percent {@code %} to reference target values, this class uses dollar sign {@code $} and has
- * its own set of permitted placeholders:
- *
- *
- *
{@code $L} emits a literal value with no escaping. Arguments for literals may be
- * strings, primitives, {@linkplain TypeSpec type declarations}, {@linkplain AnnotationSpec
- * annotations} and even other code blocks.
- *
{@code $N} emits a name, using name collision avoidance where necessary. Arguments
- * for names may be strings (actually any {@linkplain CharSequence character sequence}),
- * {@linkplain ParameterSpec parameters}, {@linkplain FieldSpec fields}, {@linkplain
- * MethodSpec methods}, and {@linkplain TypeSpec types}.
- *
{@code $S} escapes the value as a string, wraps it with double quotes, and emits
- * that. For example, {@code 6" sandwich} is emitted {@code "6\" sandwich"}.
- *
{@code $T} emits a type reference. Types will be imported if possible. Arguments
- * for types may be {@linkplain Class classes}, {@linkplain TypeMirror
-,* type mirrors}, and {@linkplain Element elements}.
- *
{@code $$} emits a dollar sign.
- *
{@code $>} increases the indentation level.
- *
{@code $<} decreases the indentation level.
- *
{@code $[} begins a statement. For multiline statements, every line after the first line
- * is double-indented.
- *
{@code $]} ends a statement.
- *
- */
-public final class CodeBlock {
- /** A heterogeneous list containing string literals and value placeholders. */
- final List formatParts;
- final List