File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reference to double ambigous

 
shanaya dutt
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my proogram im using
Arc2D.Double() creating an arc
and later
v = Double.parseDouble(line.trim());
for extracting the double values from a line.
the compiler gives the error

"Reference to Double is ambiguous,both classes java.awt.geom.arc2D and java.lang.Double match"

how do i correct this error?
 
Steve Luke
Bartender
Pie
Posts: 4181
21
IntelliJ IDE Java Python
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You apparently did a static import of Arc2D, creating an ambiguous reference between Arc2D.Double (since statically imported, now just Double) and the Double wrapper class. To fix it either don't import the static content of Arc2D or refer to the Double you are interested in using the fully qualified name java.lang.Double wherever you need to use it.
 
Rob Spoor
Sheriff
Pie
Posts: 20380
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The import of Arc2D.Double doesn't need to be static; you can also import nested classes as follows:

Instead of using this import for Arc2D.Double and typing java.lang.Double fully, I would do it the other way around:
- change the import to java.awt.geom.Arc2D;
- use Double for java.lang.Double
- use Arc2D.Double for java.awt.geom.Arc2D.Double

Everybody who sees "Double" expects that to be java.lang.Double, and with the above naming you don't break that expectation.

Also, I'm a lazy git, and Arc2D.Double is shorter than java.lang.Double
 
shanaya dutt
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic