forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run superficial validation before running InjectValidator.
This ensures that we defer if a generated type has not been generated before trying to do validation on it. Fixes #3075 RELNOTES=Fixes #3075: ensures that we defer if a generated type has not been generated before trying to do validation on it PiperOrigin-RevId: 413542073
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
javatests/dagger/functional/kotlin/DependsOnGeneratedCodeClasses.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2021 The Dagger Authors. | ||
* | ||
* 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 dagger.functional.kotlin | ||
|
||
import com.google.auto.factory.AutoFactory | ||
import dagger.Component | ||
import javax.inject.Inject | ||
|
||
// TODO(bcorso): Merge this into the test once we support kt_jvm_test | ||
/** Defines kotlin classes for the associated test. */ | ||
object DependsOnGeneratedCodeClasses { | ||
@Component | ||
abstract class TestComponent { | ||
abstract fun bar(): Bar | ||
} | ||
|
||
class Bar @Inject constructor( | ||
) | ||
|
||
@AutoFactory class SomeClass | ||
} |
34 changes: 34 additions & 0 deletions
34
javatests/dagger/functional/kotlin/DependsOnGeneratedCodeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2021 The Dagger Authors. | ||
* | ||
* 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 dagger.functional.kotlin; | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.JUnit4; | ||
|
||
/** | ||
* @see <a href="https://github.com/google/dagger/issues/3075">Issue #3075</a> | ||
*/ | ||
@RunWith(JUnit4.class) | ||
public class DependsOnGeneratedCodeTest { | ||
@Test | ||
public void testComponentDependsOnGeneratedCode() { | ||
assertThat(DaggerDependsOnGeneratedCodeClasses_TestComponent.create().bar()).isNotNull(); | ||
} | ||
} |