Skip to content

Commit d36430d

Browse files
committed
Merge pull request google#10 from cgruber/upstreamchanges
Merge in upstream changes from square/dagger
2 parents 803309b + ad1f5c4 commit d36430d

File tree

60 files changed

+1779
-307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1779
-307
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
Change Log
22
==========
33

4-
Version 1.1.0 *(TBD)*
4+
Version 1.1.0 *(2013-08-05)*
55
----------------------------
66

7-
* Allow multiple contributions to Set binding via `Provides.Type.SET_VALUES`
7+
* Module loading now requires code generation via the 'dagger-compiler' artifact.
8+
* Allow multiple contributions to Set binding via `Provides.Type.SET_VALUES`.
9+
* Request classloading from the classloader of the requesting object, not the current thread's
10+
context classloader.
11+
* Cache class loading at the root injector to reduce costs of loading adapters.
12+
* Fix: Primitive array types are no longer incorrectly changed to their boxed type.
13+
* Update JavaWriter to 2.1.1.
814

915

1016
Version 1.0.1 *(2013-06-03)*

compiler/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>com.google.dagger</groupId>
2323
<artifactId>dagger-parent</artifactId>
24-
<version>1.0.2-SNAPSHOT</version>
24+
<version>1.1.1-SNAPSHOT</version>
2525
</parent>
2626

2727
<artifactId>dagger-compiler</artifactId>
@@ -78,6 +78,7 @@
7878
<goals><goal>testCompile</goal></goals>
7979
<configuration>
8080
<annotationProcessors>
81+
<annotationProcessor>dagger.internal.codegen.ValidationProcessor</annotationProcessor>
8182
<annotationProcessor>dagger.internal.codegen.InjectAdapterProcessor</annotationProcessor>
8283
<annotationProcessor>dagger.internal.codegen.ModuleAdapterProcessor</annotationProcessor>
8384
<annotationProcessor>dagger.internal.codegen.GraphAnalysisProcessor</annotationProcessor>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.buildResult=failure
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright (C) 2013 Google, Inc.
4+
Copyright (C) 2013 Square, Inc.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
<project
19+
xmlns="http://maven.apache.org/POM/4.0.0"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
22+
<modelVersion>4.0.0</modelVersion>
23+
<groupId>com.example.dagger.tests</groupId>
24+
<artifactId>final-field-inject</artifactId>
25+
<version>HEAD-SNAPSHOT</version>
26+
<dependencies>
27+
<dependency>
28+
<groupId>@dagger.groupId@</groupId>
29+
<artifactId>dagger</artifactId>
30+
<version>@dagger.version@</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>@dagger.groupId@</groupId>
34+
<artifactId>dagger-compiler</artifactId>
35+
<version>@dagger.version@</version>
36+
<optional>true</optional>
37+
</dependency>
38+
</dependencies>
39+
<build>
40+
<plugins>
41+
<plugin>
42+
<artifactId>maven-compiler-plugin</artifactId>
43+
<version>3.1</version>
44+
<configuration>
45+
<source>1.5</source>
46+
<target>1.5</target>
47+
</configuration>
48+
</plugin>
49+
</plugins>
50+
</build>
51+
</project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (C) 2013 Google, Inc.
3+
* Copyright (C) 2013 Square, Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package test;
18+
19+
import javax.inject.Inject;
20+
21+
class TestApp {
22+
@Inject final Object nope;
23+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import dagger.testing.it.BuildLogValidator;
2+
import java.io.File;
3+
4+
File buildLog = new File(basedir, "build.log");
5+
new BuildLogValidator().assertHasText(buildLog, new String[]{
6+
"Can't inject a final field: test.TestApp.nope"});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.buildResult=failure
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright (C) 2013 Google, Inc.
4+
Copyright (C) 2013 Square, Inc.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
<project
19+
xmlns="http://maven.apache.org/POM/4.0.0"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
22+
<modelVersion>4.0.0</modelVersion>
23+
<groupId>com.example.dagger.tests</groupId>
24+
<artifactId>multiple-qualifiers</artifactId>
25+
<version>HEAD-SNAPSHOT</version>
26+
<dependencies>
27+
<dependency>
28+
<groupId>@dagger.groupId@</groupId>
29+
<artifactId>dagger</artifactId>
30+
<version>@dagger.version@</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>@dagger.groupId@</groupId>
34+
<artifactId>dagger-compiler</artifactId>
35+
<version>@dagger.version@</version>
36+
<optional>true</optional>
37+
</dependency>
38+
</dependencies>
39+
<build>
40+
<plugins>
41+
<plugin>
42+
<artifactId>maven-compiler-plugin</artifactId>
43+
<version>3.1</version>
44+
<configuration>
45+
<source>1.5</source>
46+
<target>1.5</target>
47+
</configuration>
48+
</plugin>
49+
</plugins>
50+
</build>
51+
</project>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (C) 2013 Google, Inc.
3+
* Copyright (C) 2013 Square, Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package test;
18+
19+
import dagger.Module;
20+
import dagger.Provides;
21+
import java.lang.annotation.Retention;
22+
import javax.inject.Inject;
23+
import javax.inject.Singleton;
24+
import javax.inject.Qualifier;
25+
26+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
27+
28+
class TestApp {
29+
static class TestClass1 {
30+
@Inject
31+
@MyQualifier1
32+
@MyQualifier2
33+
String field;
34+
}
35+
36+
static class TestClass2 {
37+
String string;
38+
39+
public TestClass2(@MyQualifier1 @MyQualifier2 String constructorParam) {
40+
this.string = string;
41+
}
42+
}
43+
44+
@Module(injects = TestClass1.class)
45+
static class TestModule {
46+
@MyQualifier1
47+
@MyQualifier2
48+
@Provides
49+
String providesString() {
50+
return "string";
51+
}
52+
}
53+
54+
@Qualifier
55+
@Retention(value = RUNTIME)
56+
@interface MyQualifier1 {}
57+
58+
@Qualifier
59+
@Retention(value = RUNTIME)
60+
@interface MyQualifier2 {}
61+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import dagger.testing.it.BuildLogValidator;
2+
import java.io.File;
3+
4+
File buildLog = new File(basedir, "build.log");
5+
new BuildLogValidator().assertHasText(buildLog, new String[]{
6+
"Only one qualifier annotation is allowed per element: test.TestApp.TestClass1.field"});
7+
new BuildLogValidator().assertHasText(buildLog, new String[]{
8+
"Only one qualifier annotation is allowed per element: constructorParam"});
9+
new BuildLogValidator().assertHasText(buildLog, new String[]{
10+
"Only one qualifier annotation is allowed per element: test.TestApp.TestModule.providesString()"});

0 commit comments

Comments
 (0)