Skip to content

Commit

Permalink
Add BUILD file to dagger/functional/generictypes/subpackage.
Browse files Browse the repository at this point in the history
This refactor was done in preparation for migrating these sources to kotlin, which will require a BUILD file in the subpackage.

(Note: I had to move `Generic.java` and `Generic2.java` into the subpackage to avoid a cyclic dependency between sources in the two BUILD files.

RELNOTES=N/A
PiperOrigin-RevId: 500412259
  • Loading branch information
bcorso authored and Dagger Team committed Jan 7, 2023
1 parent 9a5a498 commit e9116f0
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 10 deletions.
5 changes: 4 additions & 1 deletion javatests/dagger/functional/generictypes/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ package(default_visibility = ["//:src"])

GenJavaTests(
name = "generictypes",
srcs = glob(["**/*.java"]),
srcs = glob(["*.java"]),
gen_library_deps = [
"//javatests/dagger/functional/generictypes/subpackage",
],
javacopts = DOCLINT_HTML_AND_SYNTAX,
test_only_deps = [
"//third_party/java/guava/collect",
Expand Down
2 changes: 2 additions & 0 deletions javatests/dagger/functional/generictypes/ComplexGenerics.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package dagger.functional.generictypes;

import dagger.Lazy;
import dagger.functional.generictypes.subpackage.Generic;
import dagger.functional.generictypes.subpackage.Generic2;
import javax.inject.Inject;
import javax.inject.Provider;

Expand Down
1 change: 1 addition & 0 deletions javatests/dagger/functional/generictypes/GenericTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.junit.Assert.assertEquals;

import dagger.functional.generictypes.subpackage.Exposed;
import dagger.functional.generictypes.subpackage.Generic;
import dagger.functional.generictypes.subpackage.PublicSubclass;
import java.util.ArrayList;
import java.util.LinkedList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package dagger.functional.generictypes;

import dagger.functional.generictypes.subpackage.Generic;
import javax.inject.Inject;

class ReferencesGeneric {
Expand Down
30 changes: 30 additions & 0 deletions javatests/dagger/functional/generictypes/subpackage/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2023 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.

# Description:
# Functional tests for Dagger generic types

load("//:build_defs.bzl", "DOCLINT_HTML_AND_SYNTAX")
load("//:test_defs.bzl", "GenJavaLibrary")

package(default_visibility = ["//:src"])

GenJavaLibrary(
name = "subpackage",
srcs = glob(["*.java"]),
javacopts = DOCLINT_HTML_AND_SYNTAX,
deps = [
"//:dagger_with_compiler",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
package dagger.functional.generictypes.subpackage;

import dagger.Lazy;
import dagger.functional.generictypes.Generic;
import dagger.functional.generictypes.Generic2;
import javax.inject.Inject;
import javax.inject.Provider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
* limitations under the License.
*/

package dagger.functional.generictypes;
package dagger.functional.generictypes.subpackage;

import javax.inject.Inject;

public class Generic<T> {
final T t;
public final T t;

@Inject public Generic(T t) {
@Inject
Generic(T t) {
this.t = t;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package dagger.functional.generictypes;
package dagger.functional.generictypes.subpackage;

import javax.inject.Inject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package dagger.functional.generictypes.subpackage;

import dagger.functional.generictypes.Generic;
import javax.inject.Inject;

public class PublicSubclass extends Generic<PackagePrivate> {
@Inject public PublicSubclass(PackagePrivate pp) {
@Inject
PublicSubclass(PackagePrivate pp) {
super(pp);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package dagger.functional.generictypes.subpackage;

import dagger.functional.generictypes.Generic;
import javax.inject.Inject;

public class PublicSubclass2 extends Generic<PackagePrivateContainer.PublicEnclosed> {
Expand Down

0 comments on commit e9116f0

Please sign in to comment.