1 Mar 2006 04:46
Re: weirdness in typechecking call on overloaded java method
Jason Kinzer <jmkinzer <at> gmail.com>
2006-03-01 03:46:02 GMT
2006-03-01 03:46:02 GMT
Lex,
It was indeed an older version of the compiler.
Thanks for the reply & also thanks to Martin Sandin for passing on
Sean's workaround (simply assign a dummy result to obtain the correct
overload) and Martin Odersky for mentioning that the bug had already
been fixed locally. I greatly appreciate the responses.
Jason
On 27 Feb 2006 11:10:30 +0100, Lex Spoon <lex <at> cc.gatech.edu> wrote:
"Jason Kinzer" <jmkinzer <at> gmail.com> writes:
> I've stumbled upon a typing issue I'm at a loss to explain. Following is a
> minimal test case:
>
> ---------------------------------------------
> // ScalaMenuTest.scala
> object ScalaMenuTest {
> def main(args: Array[String]): Unit = {
> val v = new javax.swing.JMenu()
> v.add (new javax.swing.JMenuItem())
> //v.add(new java.awt.PopupMenu());
> }
> }
>
> //==> compiling with scalac2 results in
> //
> // found : javax.swing.JMenuItem
> // required: java.awt.PopupMenu
> // v.add(new javax.swing.JMenuItem())
> // ^
> //one error found
> ---------------------------------------------
There have been problems like this, but your example compiles for
me using version 2.0.5843 and 2.0.5774 . Can you check your
version (scalac -version), and upgrade if it is older than these?
Otherwise, maybe it is environmental. I am using a 1.5 Sun SDK.
-Lex
Question #1: How in the hell does the Application trait work, and how would
I create one like it (say, for a servlet)? I can't figure out how to
replicate that behavior in a different trait, such that the body of the
class defined would be called when something in the trait is called (the way
main() in the trait somehow executes the body of the "<<thing>> with
Application" does).
Ted Neward
Author, Presenter, Consultant
Java, .NET, XML services
RSS Feed