Reputation:
How can I fix that:
Command:
$ ceylon format source/com/example/helloworld/*
Exception:
Exception in thread "main" java.lang.NoSuchMethodError: ceylon.language.runtime_.getMaxArraySize()Lceylon/language/Integer;
at ceylon.collection.Hashtable.<init>(Hashtable.ceylon:35)
at ceylon.collection.Hashtable.<init>(Hashtable.ceylon)
at ceylon.collection.HashMap.$default$hashtable(HashMap.ceylon:31)
at ceylon.formatter.options.Spaces$cache_.<init>(IndentMode.ceylon:62)
at ceylon.formatter.options.Spaces$cache_.<init>(IndentMode.ceylon)
at ceylon.formatter.options.Spaces.<init>(IndentMode.ceylon:59)
at ceylon.formatter.options.FormattingOptions.$default$indentMode(FormattingOptions_generated.ceylon:355)
at ceylon.formatter.options.FormattingOptions.<init>(FormattingOptions_generated.ceylon)
at ceylon.formatter.options.loadProfile_.loadProfile(profiles.ceylon:79)
at ceylon.formatter.options.loadProfile_.loadProfile(profiles.ceylon)
at ceylon.formatter.options.commandLineOptions_.commandLineOptions(formattingOptions.ceylon:125)
at ceylon.formatter.options.commandLineOptions_.commandLineOptions(formattingOptions.ceylon)
at ceylon.formatter.run_.run(run.ceylon:285)
...
I think I have to re-install the formatter. But which version?
For no reason the following command works:
ceylon run ceylon.formatter source/com/example/helloworld/*.ceylon
Where is the difference and how can I fix it.
Upvotes: 1
Views: 46
Reputation: 462
Try ceylon plugin uninstall format
and see if that fixes things.
A second option would be to say ceylon plugin install ceylon.formatter/1.2.0
The reason why ceylon format
doesn't work but ceylon run
does is because your installed ceylon format
will look for the hard-coded version 1.1
which isn't compatible anymore while ceylon run
will look for any version that's compatible with the current Ceylon version you're using. (So it will find both 1.1.0 and 1.2.0 but it will discard 1.1.0 because it isn't compatible and therefore choose 1.2.0 automatically)
Upvotes: 3
Reputation: 2742
ceylon.language.runtime
used to be implemented in hand-written Java code. In this code, getMaxArraySize()
accidentally returned ceylon.language.Integer
when it should have returned long
. This worked, but wasn’t quite correct.
Then, with native support in Ceylon 1.2, runtime
(along with some other objects) were rewritten as native Ceylon code. Since this is converted to Java by the Ceylon compiler, the method now gets the correct return type, long
. Newly compiled modules will now call this method, but code that was compiled against an old ceylon.language
will still try to call a method returning ceylon.language.Integer
, which leads to your NoSuchMethodError
.
What’s happening here, it seems, is that ceylon format
runs ceylon.formatter/1.1.0
, which was compiled against ceylon.language/1.1.0
, and now can’t run with ceylon.language/1.2.0
. ceylon run ceylon.formatter
probably runs ceylon.formatter/1.2.0
for some reason, which works.
I’m not sure what you need to do to fix this. I changed the way the ceylon format
plugin works recently, so you probably need to delete the old ceylon format
script (a ceylon-format
or ceylon-format.bat
file somewhere in .ceylon/bin
, I believe). Hopefully the new one is already there, ready to take over.
Upvotes: 3