newbie: "reference to object is ambiguous" error  
Author Message
LaCo





PostPosted: 2004-5-13 20:34:00 Top

java-programmer, newbie: "reference to object is ambiguous" error Hi!
I have this error compilling my application that I have created with
netbeans:

JFrameSample.java:164: reference to Object is ambiguous, both class
org.omg.CORBA.Object in org.omg.CORBA and class java.lang.Object
in java.lang match
new Object [][] {
^
1 error

How can I fix it? I need both: org.omg.CORBA and java.lang.*
any ideas?

Thanks!
LaCo
 
IkRhcmlvIChkcmlua2luZyBjb++sgGVlIGluIHRoZSBv76yDY2XigKYpIg





PostPosted: 2004-5-13 20:50:00 Top

java-programmer >> newbie: "reference to object is ambiguous" error LaCo wrote:

> JFrameSample.java:164: reference to Object is ambiguous, both class
> org.omg.CORBA.Object in org.omg.CORBA and class java.lang.Object
> in java.lang match
> new Object [][] {
> ^
> 1 error
>
> How can I fix it? I need both: org.omg.CORBA and java.lang.*
> any ideas?

Rewrite your:
new Object [][]
as:
new java.lang.Object [][]

- Dario
 
Gordon Beaton





PostPosted: 2004-5-13 21:00:00 Top

java-programmer >> newbie: "reference to object is ambiguous" error On Thu, 13 May 2004 14:34:13 +0200, LaCo wrote:
> How can I fix it? I need both: org.omg.CORBA and java.lang.*
> any ideas?

Use the full name: org.omg.CORBA.Object or java.lang.Object

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
 
 
Christophe Vanfleteren





PostPosted: 2004-5-13 21:00:00 Top

java-programmer >> newbie: "reference to object is ambiguous" error LaCo wrote:

> Hi!
> I have this error compilling my application that I have created with
> netbeans:
>
> JFrameSample.java:164: reference to Object is ambiguous, both class
> org.omg.CORBA.Object in org.omg.CORBA and class java.lang.Object
> in java.lang match
> new Object [][] {
> ^
> 1 error
>
> How can I fix it? I need both: org.omg.CORBA and java.lang.*
> any ideas?
>

You'll need to fully qualify one of the classes, and only import the other
(int this case you don't need to import java.lang.Object, since the
compiler does that for you).

...
//"normal" object
Object[] bla = Object[10];

//CORBA object:
org.omg.CORBA.Object bli = new org.omg.CORBA.Object(...);
...

--
Kind regards,
Christophe Vanfleteren
 
 
Sudsy





PostPosted: 2004-5-13 22:15:00 Top

java-programmer >> newbie: "reference to object is ambiguous" error LaCo wrote:
> Hi!
> I have this error compilling my application that I have created with
> netbeans:
>
> JFrameSample.java:164: reference to Object is ambiguous, both class
> org.omg.CORBA.Object in org.omg.CORBA and class java.lang.Object
> in java.lang match
> new Object [][] {
> ^
> 1 error
>
> How can I fix it? I need both: org.omg.CORBA and java.lang.*
> any ideas?

This is one of those situations which perfectly illustrate why it's
not a good idea to use wild-card imports. You probably have something
like this:

import org.omg.CORBA.*;

What you SHOULD be doing (IMHO) is only importing the classes you're
actually going to use. IDEs like Eclipse will handle all of this for
you, BTW.
If you truly need both org.omg.CORBA.Object and java.lang.Object
(note that you don't have to import the java.lang classes) then all
the other responders have provided the answer: use the fully-qualified
class name.

 
 
Roedy Green





PostPosted: 2004-5-14 4:01:00 Top

java-programmer >> newbie: "reference to object is ambiguous" error On Thu, 13 May 2004 14:34:13 +0200, "LaCo" <email***@***.com> wrote
or quoted :

>JFrameSample.java:164: reference to Object is ambiguous, both class
> org.omg.CORBA.Object in org.omg.CORBA and class java.lang.Object
> in java.lang match
> new Object [][] {
> ^

see http://mindprod.com/jgloss/errormessages.html#AMBIGUOUS

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.