ambiguous

Android O Preview findViewById compile error

一世执手 提交于 2019-12-08 16:31:55
问题 I tried to test the Android O Developer Preview second phase. After the project was created, I just clicked build and run but I didn't have any success. Android default generated code below: Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); compile error occurred. Error:(18, 37) error: reference to findViewById is ambiguous both method findViewById(int) in Activity and method <T>findViewById(int) in AppCompatActivity match where T is a type-variable: T extends View declared in method <T

call of overloaded <brace-enclosed initializer list> is ambiguous, how to deal with that?

旧时模样 提交于 2019-12-08 14:37:54
问题 I really don't understand this, I thought that compiler first executes what is in braces and then gives the result to the most appropriate function. Here it looks like it gives the function an initializer list to deal with it... #include <string> #include <vector> using namespace std; void func(vector<string> v) { } void func(vector<wstring> v) { } int main() { func({"apple", "banana"}); } error: <stdin>: In function 'int main()': <stdin>:11:27: error: call of overloaded 'func(<brace-enclosed

error: call of overloaded distance is ambiguous

不想你离开。 提交于 2019-12-08 12:37:28
问题 I have a bit of code (which I didn't write, but am trying to compile) -- iostream_combo.cc--, and doing so gives me the following error: ./moses/moses/comboreduct/combo/iostream_combo.cc: In function ‘std::__cxx11::string opencog::combo::l2ph(const string&, const std::vector<std::__cxx11::basic_string<char> >&)’: ./moses/moses/comboreduct/combo/iostream_combo.cc:543:64: error: call of overloaded ‘distance(std::vector<std::__cxx11::basic_string<char> >::const_iterator, __gnu_cxx::__normal

The method is ambiguous for the type Error

前提是你 提交于 2019-12-07 03:13:08
问题 I am trying to understand how Overloading in JAVA works and trying to get grasp of various overloading rules that are applied in case of widening, autoboxing and varargs in JAVA. I am not able to understand what is happening in the following scenario: package package1; public class JustAClass { public static void add(int a, long b) { System.out.println("all primitives"); } //public static void add(Integer a, long b) { // System.out.println("Wraper int, primitive long"); //} public static void

The method is ambiguous for the type Error

好久不见. 提交于 2019-12-05 06:43:48
I am trying to understand how Overloading in JAVA works and trying to get grasp of various overloading rules that are applied in case of widening, autoboxing and varargs in JAVA. I am not able to understand what is happening in the following scenario: package package1; public class JustAClass { public static void add(int a, long b) { System.out.println("all primitives"); } //public static void add(Integer a, long b) { // System.out.println("Wraper int, primitive long"); //} public static void add(int a, Long b) { System.out.println("Primitive int, Wrapper long"); } public static void add

In Java, why is the call foo() not ambigious given 2 varags methods foo(int… ints) and foo(Object… objects)?

故事扮演 提交于 2019-12-05 01:29:21
If I declare just the 2 varargs methods as follows: public void foo(String... strings) { System.out.println("Foo with Strings"); } and public void foo(int... ints) { System.out.println("Foo with ints"); } and then have the code: foo(); this is a compiler error due to the ambiguity as expected. However if I have just the following 2 versions of foo: public void foo(Object... objects) { System.out.println("Foo with Objects"); } and public void foo(int... ints) { System.out.println("Foo with ints"); } then the code foo(); calls the ints version of the method. Can anyone explain why the second

ICollection / ICollection<T> ambiguity problem

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 00:50:37
问题 Just want to make simple extension for syntactic sygar : public static bool IsNotEmpty(this ICollection obj) { return ((obj != null) && (obj.Count > 0)); } public static bool IsNotEmpty<T>(this ICollection<T> obj) { return ((obj != null) && (obj.Count > 0)); } It works perfectly when I work with some collections, but when working with others I get The call is ambiguous between the following methods or properties: 'PowerOn.ExtensionsBasic.IsNotEmpty(System.Collections.IList)' and 'PowerOn

Specflow test step inheritance causes “Ambiguous step definitions”

天涯浪子 提交于 2019-12-05 00:37:35
I want to have the following test step class structure: [Binding] public class BaseStep { [Given(@"there is a customer")] public void GivenThereIsACustomer(Table table) { HandleCustomer(table); } protected virtual void HandleCustomer(Table table) { } } [Binding] public class FeatureOneStep : BaseStep { protected override void HandleCustomer(Table table) { // feature one action } [Given(@"feature one specific step")] public void GivenFeatureOneSpecificAction(Table table) { // do something } } [Binding] public class FeatureTwoStep : BaseStep { protected override void HandleCustomer(Table table)

Static method access to non-static constructor?

坚强是说给别人听的谎言 提交于 2019-12-04 11:56:04
问题 I had an exam yesterday on Java. There is something which seem really ambiguous to me. Rules are simple: Static method cannot cannot call non-static methods. Constructors are kind of a method with no return type. public class Main { public static void main(String[] args) { Main p = new Main(); k(); } protected Main() { System.out.print("1234"); } protected void k() { } } Main p = new Main() line prints 1234 k() line raises error So why did this happen? Doesn't it conflict with the rules of

Ambiguous use of 'subscript' with NSArray & JSON

大城市里の小女人 提交于 2019-12-04 05:01:41
问题 I have looked through the similar topics in stackoverflow but none of those solutions seem to work for me. I have an app that fetch video through youtube API . The following code is giving the error. var arrayOfVideos = [Video]() // I am getting the error for the following line and it says "Ambiguous use of 'subscript'. for video in JSON["items"] as! NSArray { let videoObj = Video() videoObj.videoId = video.valueForKeyPath("snippet.resourceId.videoId") as! String videoObj.videoTitle = video