Kotlin 1.1.4 is unusable in Eclipse

Since nobody here answered my simple question about how to install an older version of Kotlin so I could figure out the problems I encountered with 1.1.4 (see my unanswered post “How to downgrade to a previous release”), I forged ahead trying to figure things out as best I could. So I whittled down one problem to this single source file -

class ClassA {
	var code1 = ""
}

class ClassB {

	private val alist = ArrayList<ClassA>()

	fun go() {
		for (a1 in alist) {
			print(a1.code1)
		}
	}
}

This code compiles successfully with kotlinc (info: kotlinc-jvm 1.1.4-2 (JRE 1.8.0_121-b13)) from the command line with Kotlin installed by using Brew on MacOS.

However, compilation of the same code fails in MacOS Eclipse Oxygen with the Kotlin plugin. The compiler error is ‘code1’ inside the for loop underlined in red with the message “unresolved reference: code1”. Interestingly, up until now my experience using Kotlin with Eclipse was not great but was tolerable. That’s ended. Should I bother to file a bug report? Or should I just give up on Kotlin with Eclipse (which unless something changes this calendar year, means we’ll likely give up completely on Kotlin).

I’ve just tried in my Neon.3 Release (4.6.3) with Kotlin 0.8.2.v20170314-0957 plugin and it complies but I have to say that plugin is very unpleasant to work with especially when java-kotlin mixed project is involved.
For Kotlin project I started to use IntelliJ IDEA (community) as I need also do some Scala stuff as both are much much much better supported in IDEA

Note: While it compiles, it can’t be run in my Eclipse. That just sucks.

Thanks for the response anthavio.

So I decided to try Eclipse Neon.3 Java standard edition. I downloaded the MacOS 64 bit version and started it up. I installed no other software. My first step was to attempt to install the Kotlin plugin. I tried using the Eclipse Marketplace. The installation failed with this message:

An error occurred while collecting items to be installed
session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
No repository found containing: osgi.bundle,org.eclipse.pde.build,3.9.200.v20160204-0642
No repository found containing: osgi.bundle,org.eclipse.pde.core,3.11.1.v20161115-1951
No repository found containing: osgi.bundle,org.eclipse.pde.launching,3.6.401.v20161115-0549

I then tried to install the Kotlin plugin via the Eclipse update site mechanism, and got the same error.

So on a hunch because the missing software had “.pde.” in its name (pde stands for Plugin Development Environment), I downloaded the much bigger Eclipse Neon.3 for Committers distribution, started it, installed the Kotlin plugin and compiled my test program (see my first post above) SUCCESSFULLY!

This episode is very discouraging, from several points of view. Most disconcerting is the fact that the compiler works on Neon while it only works for almost everything (my test project is dozens of classes and thousands of lines) on Oxygen (the latest release of Eclipse), but fails for some very simple constructs. Another discouraging thing is the lack of anybody here who responds to my pleas for simple help. While feature discussions like ternary operators attract hundreds of viewers and very informative responses, my posts asking for help get a few dozen views and crickets. Am I not posting at the right place to get some help on the use of Kotlin? Is there paid support from JetBrains available?

It appears that “support” for Eclipse is just JetBrains marketing fluff to attract some of the millions of users of Eclipse. If JetBrains was honest, they would take the Eclipse logo and claim of support off of the front page of the kotlinlang.org web site.

To add a +1 to the statistics of observed sub-par behaviour of eclipse + kotlin, heres a +1 … so that makes 3 ? :slight_smile:slight_smile: I’ve had a love-hate relationship with eclipse for over a decade – at one point it was the worse of the best, then the best then the only then on-par with a very few - now its hard to judge.
But its a tough ‘market’ I was a contractor for a Java IDE Company the early 2000s’ that closed its doors literally overnight leaving 50+ employees wondering why the doors were locked and if there were getting paid that week.
IDE’s are very complex products, when a ‘free’ one that is as good as eclipse is (or was) is shows up donated by a major company its impossible to complete even if your vastly better. On the other side there’s not a vast incentive to do better once you have no competition, as an open source productor insufficient revenue to fund it even if you wanted to, and even if it helps your commercial businesses – So that all said I’m all out of fingers to point or places to point them.
Usually the answer to that is “You get what you pay for” – so I have tried IntelliJ many times over the years, I currently have pro subscription – but its not all milk and honey in that yard either. IntelliJ is an excellent product and in many many ways surpases eclipse, but for me atleast, not in every way - in particular – years later - I still can figure out how to use it in any serious way. Likely only my own fault – but it seems harder to change and learn a new IDE then it is to learn a new OS or programming language. I dont have nearly the problem switching between Windows, Unix, Linux, Mac, Solaris, iOs - or Java, C++, C# , Python etc as I do figuring out what works and what doesn’t and even if something will ever work enough to put the in effort in IDEs – The best of them are still huge learning curves with hidden treasures and traps with success and golden unicorns that drop gold and diamonds only just one mental shift and a few magic spells away from grasp. So I’m out of fingers on that front too –

But I havent lost hope – Seeing how much better Gradle Buildship has gotten since it came out is encouraging. Its well past the point where it works more often than not, is more useful than not, and on par with or better than many.
For me, Eclipse support for Kotlin is “Good Enough” – “Just Barely” – that It is not stopping me from deciding to switch to kotlin for both new programs and patches to legacy Java monsters I have to maintain - Of all the things that don’t work well in eclipse that I have to use, kotlin is not by far the worse. I do get code-completion sometimes and if lucky even “Open Declaration” and “View Type Hierarchy” occasionally. When it doesn’t, or when 16G isn’t enough to keep eclipse from crashing evey hour – there’s always plan B,C,D – If I relied on only one tool for a projects’s success I would fail every time. Standalone, Gradle, and Maven support have been rock solid for quite a while, and while I do like a good interactive IDE supported debug session there are too many environments where I could never do that anyway so one learns to get by the old fashioned way. For what one looses in productivity by using primitive tools you get back in speed and lack of frustration and often end up learning things you wouldn’t otherwise – sour grapes perhaps, I would rather have a pile of all sweet grapes – - but some are better than no grapes.

As for if this is the right place to ask questions, if you know a better place I’d love to know too – I don’t think this is an inappropriate place to ask.

However I think its unrealistic to expect answers or even ‘help’ – One is hopeful, but expectation is a different story.
I don’t think due to lack of interest or empathy – but rather because there isn’t any to be had (yet?). It is obvious much more effort has been put into IntelliJ then Eclipse, but I don’t fault JB for that - Given that IntelliJ still isnt isnt perfect wrt Kotlin support, its a tough call deciding where to spend a finite budget - a product that has a direct revenue return or one that does not – then balance that with attempting to get mind-share and community – then balance that against skill set – There’s not a huge line of expert eclipse plugin software engineers that are also kotlin internals experts and are not already the same people you need on intellij work. Im very impressed with the state of affairs right now.
I would very much like to see it better – as I am sure everyone would. But how to get there, whom to expect to do it, who’s going to pay for it and why that vs something else, those are more challenging issues.

Yes I would file a bug, the more the better (if they are accurate and helpful). Yes it takes a lot of work to file bugs, and no I don’t expect a fix anytime soon – but that’s the best way I know to express public interest – maybe enough people do and it might become interesting enough that people will work on improving or making a new plugin that works better.
If not Eclipse, at least that people are interested and willing to put effort in to supporting and helping – 90+ % of the work to fix a hard bug is a well defined reproducible test. If its broken in Eclipse its likely broken elsewhere as well (or in other areas of eclipse) – so there is a crossover benefit.

1 Like