diff --git a/compiler/ast/src/main/kotlin/motif/ast/compiler/CompilerType.kt b/compiler/ast/src/main/kotlin/motif/ast/compiler/CompilerType.kt index 51eb8955..fb5b7730 100644 --- a/compiler/ast/src/main/kotlin/motif/ast/compiler/CompilerType.kt +++ b/compiler/ast/src/main/kotlin/motif/ast/compiler/CompilerType.kt @@ -81,9 +81,12 @@ class CompilerType( return type } - val superType = MoreTypes.nonObjectSuperclass(env.typeUtils, env.elementUtils, type).orNull() ?: return null - - return getMatchingSuperType(baseType, superType) + return env.typeUtils.directSupertypes(type) + .asSequence() + .mapNotNull { superType -> + getMatchingSuperType(baseType, superType as DeclaredType) + } + .firstOrNull() } override fun equals(other: Any?): Boolean { diff --git a/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/A.java b/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/A.java new file mode 100644 index 00000000..7eed9705 --- /dev/null +++ b/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/A.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.E042_binds_invalid_wildcard_extends; + +public class A implements B {} diff --git a/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/B.java b/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/B.java new file mode 100644 index 00000000..58dba634 --- /dev/null +++ b/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/B.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.E042_binds_invalid_wildcard_extends; + +interface B {} diff --git a/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/Scope.java b/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/Scope.java new file mode 100644 index 00000000..462c9c14 --- /dev/null +++ b/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/Scope.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.E042_binds_invalid_wildcard_extends; + +@motif.Scope +public interface Scope { + + B b(); + + @motif.Objects + abstract class Objects { + abstract A a(); + + abstract B b(A a); + } + + @motif.Dependencies + interface Dependencies {} +} diff --git a/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/Test.java b/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/Test.java new file mode 100644 index 00000000..ab157362 --- /dev/null +++ b/tests/src/main/java/testcases/E042_binds_invalid_wildcard_extends/Test.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.E042_binds_invalid_wildcard_extends; + +import motif.models.errors.MotifError; +import motif.models.errors.NotAssignableBindsMethod; + +import static com.google.common.truth.Truth.assertThat; + +public class Test { + + public static MotifError error; + + public static void run() { + assertThat(error).isInstanceOf(NotAssignableBindsMethod.class); + } +} diff --git a/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/A.java b/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/A.java new file mode 100644 index 00000000..db977149 --- /dev/null +++ b/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/A.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.E043_binds_invalid_wildcard_super; + +public class A implements B {} diff --git a/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/B.java b/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/B.java new file mode 100644 index 00000000..6f8b0361 --- /dev/null +++ b/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/B.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.E043_binds_invalid_wildcard_super; + +interface B {} diff --git a/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/Scope.java b/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/Scope.java new file mode 100644 index 00000000..d5de7549 --- /dev/null +++ b/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/Scope.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.E043_binds_invalid_wildcard_super; + +@motif.Scope +public interface Scope { + + B b(); + + @motif.Objects + abstract class Objects { + abstract A a(); + + abstract B b(A a); + } + + @motif.Dependencies + interface Dependencies {} +} diff --git a/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/Test.java b/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/Test.java new file mode 100644 index 00000000..7df737b6 --- /dev/null +++ b/tests/src/main/java/testcases/E043_binds_invalid_wildcard_super/Test.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.E043_binds_invalid_wildcard_super; + +import motif.models.errors.MotifError; +import motif.models.errors.NotAssignableBindsMethod; + +import static com.google.common.truth.Truth.assertThat; + +public class Test { + + public static MotifError error; + + public static void run() { + assertThat(error).isInstanceOf(NotAssignableBindsMethod.class); + } +} diff --git a/tests/src/main/java/testcases/T051_binds_interface/A.java b/tests/src/main/java/testcases/T051_binds_interface/A.java new file mode 100644 index 00000000..d33d750f --- /dev/null +++ b/tests/src/main/java/testcases/T051_binds_interface/A.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T051_binds_interface; + +public class A implements B {} diff --git a/tests/src/main/java/testcases/T051_binds_interface/B.java b/tests/src/main/java/testcases/T051_binds_interface/B.java new file mode 100644 index 00000000..5dcd3b2e --- /dev/null +++ b/tests/src/main/java/testcases/T051_binds_interface/B.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T051_binds_interface; + +interface B {} diff --git a/tests/src/main/java/testcases/T051_binds_interface/Scope.java b/tests/src/main/java/testcases/T051_binds_interface/Scope.java new file mode 100644 index 00000000..18ece7b6 --- /dev/null +++ b/tests/src/main/java/testcases/T051_binds_interface/Scope.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T051_binds_interface; + +@motif.Scope +public interface Scope { + + B b(); + + @motif.Objects + abstract class Objects { + abstract A a(); + + abstract B b(A a); + } + + @motif.Dependencies + interface Dependencies {} +} diff --git a/tests/src/main/java/testcases/T051_binds_interface/Test.java b/tests/src/main/java/testcases/T051_binds_interface/Test.java new file mode 100644 index 00000000..cdc57f67 --- /dev/null +++ b/tests/src/main/java/testcases/T051_binds_interface/Test.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T051_binds_interface; + +import static com.google.common.truth.Truth.assertThat; + +public class Test { + + public static void run() { + Scope scope = new ScopeImpl(); + assertThat(scope.b()).isInstanceOf(A.class); + } +} diff --git a/tests/src/main/java/testcases/T052_binds_interface_generic/A.java b/tests/src/main/java/testcases/T052_binds_interface_generic/A.java new file mode 100644 index 00000000..2bb84274 --- /dev/null +++ b/tests/src/main/java/testcases/T052_binds_interface_generic/A.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T052_binds_interface_generic; + +public class A implements B {} diff --git a/tests/src/main/java/testcases/T052_binds_interface_generic/B.java b/tests/src/main/java/testcases/T052_binds_interface_generic/B.java new file mode 100644 index 00000000..84409483 --- /dev/null +++ b/tests/src/main/java/testcases/T052_binds_interface_generic/B.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T052_binds_interface_generic; + +interface B {} diff --git a/tests/src/main/java/testcases/T052_binds_interface_generic/Scope.java b/tests/src/main/java/testcases/T052_binds_interface_generic/Scope.java new file mode 100644 index 00000000..3958d021 --- /dev/null +++ b/tests/src/main/java/testcases/T052_binds_interface_generic/Scope.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T052_binds_interface_generic; + +@motif.Scope +public interface Scope { + + B b(); + + @motif.Objects + abstract class Objects { + abstract A a(); + + abstract B b(A a); + } + + @motif.Dependencies + interface Dependencies {} +} diff --git a/tests/src/main/java/testcases/T052_binds_interface_generic/Test.java b/tests/src/main/java/testcases/T052_binds_interface_generic/Test.java new file mode 100644 index 00000000..55d95791 --- /dev/null +++ b/tests/src/main/java/testcases/T052_binds_interface_generic/Test.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T052_binds_interface_generic; + +import static com.google.common.truth.Truth.assertThat; + +public class Test { + + public static void run() { + Scope scope = new ScopeImpl(); + assertThat(scope.b()).isInstanceOf(A.class); + } +} diff --git a/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/A.java b/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/A.java new file mode 100644 index 00000000..48ef2078 --- /dev/null +++ b/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/A.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T053_binds_bounded_type_parameters; + +public class A implements B {} diff --git a/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/B.java b/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/B.java new file mode 100644 index 00000000..487d0ced --- /dev/null +++ b/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/B.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T053_binds_bounded_type_parameters; + +interface B {} diff --git a/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/Scope.java b/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/Scope.java new file mode 100644 index 00000000..2547233f --- /dev/null +++ b/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/Scope.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T053_binds_bounded_type_parameters; + +@motif.Scope +public interface Scope { + + B b(); + + @motif.Objects + abstract class Objects { + abstract A a(); + + abstract B b(A a); + } + + @motif.Dependencies + interface Dependencies {} +} diff --git a/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/Test.java b/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/Test.java new file mode 100644 index 00000000..44da991d --- /dev/null +++ b/tests/src/main/java/testcases/T053_binds_bounded_type_parameters/Test.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T053_binds_bounded_type_parameters; + +import static com.google.common.truth.Truth.assertThat; + +public class Test { + + public static void run() { + Scope scope = new ScopeImpl(); + assertThat(scope.b()).isInstanceOf(A.class); + } +} diff --git a/tests/src/main/java/testcases/T054_binds_wildcards/A.java b/tests/src/main/java/testcases/T054_binds_wildcards/A.java new file mode 100644 index 00000000..26e7d7cb --- /dev/null +++ b/tests/src/main/java/testcases/T054_binds_wildcards/A.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T054_binds_wildcards; + +public class A implements B {} diff --git a/tests/src/main/java/testcases/T054_binds_wildcards/B.java b/tests/src/main/java/testcases/T054_binds_wildcards/B.java new file mode 100644 index 00000000..b91ae828 --- /dev/null +++ b/tests/src/main/java/testcases/T054_binds_wildcards/B.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T054_binds_wildcards; + +interface B {} diff --git a/tests/src/main/java/testcases/T054_binds_wildcards/Scope.java b/tests/src/main/java/testcases/T054_binds_wildcards/Scope.java new file mode 100644 index 00000000..4ebf184d --- /dev/null +++ b/tests/src/main/java/testcases/T054_binds_wildcards/Scope.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T054_binds_wildcards; + +@motif.Scope +public interface Scope { + + B b1(); + + B b2(); + + @motif.Objects + abstract class Objects { + abstract A a(); + + abstract B b1(A a); + + abstract B b2(A a); + } + + @motif.Dependencies + interface Dependencies {} +} diff --git a/tests/src/main/java/testcases/T054_binds_wildcards/Test.java b/tests/src/main/java/testcases/T054_binds_wildcards/Test.java new file mode 100644 index 00000000..755b51b8 --- /dev/null +++ b/tests/src/main/java/testcases/T054_binds_wildcards/Test.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2018 Uber Technologies, 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 testcases.T054_binds_wildcards; + +import static com.google.common.truth.Truth.assertThat; + +public class Test { + + public static void run() { + Scope scope = new ScopeImpl(); + assertThat(scope.b1()).isInstanceOf(A.class); + assertThat(scope.b2()).isInstanceOf(A.class); + } +}