This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Scala Eclipse Plugin initialisation Was: Scala Eclipse Plugin Conflicts with AJDT

4 replies
Jan Lohre
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Hi,

ScalaCompilationUnitManager.getScalaCompilationUnit appears to create compilation units on the fly if it can't find them in the cache.
Which gets me to the question why ScalaCompilationUnitManager.initCompilationUnits(ResourcesPlugin.getWorkspace) is necessary in the activators start method.
I would say we should remove it from there.


Kind regards,
Jan

2009/2/1 Jan Lohre <jan.lohre@googlemail.com>
Hi,

in eclipse/osgi a bundle is not allowed to do much work on startup. After 5 sec the framework aborts the loading of a bundle and ignores it after that.

I have seen the same case without AJDT, my way of getting the scala plugin back to work was closing all scala related projects and restart. Then opening a verys small scala project. If all of these steps are required? No idea but it worked.

After browsing trac sources I found a good candidate for causing the problem:

ScalaCompilationUnitManager.initCompilationUnits(ResourcesPlugin.getWorkspace)

in the start method in scala.tools.eclipse.ScalaUIPlugin, which appears to be the activator.

This is a severe problem effectivly limiting workspace sizes, but I wonder why the plugin developers never stumbled over this, as the plugin for sure has a larger codebase than I have.

I guess we should open a ticket.

Kind regards,
Jan

2009/2/1 Gordon Leland Hempton <ghempton@gmail.com>
I am trying to incorporate scala and the eclipse plugin into an existing project, however the project already has a dependency on aspectj's AJDT plugin and the Scala plugin and AJDT appear not to play nicely together. After installing the scala plugin, there are no errors, however none of the aspects are recognized by AJDT. The problem persists even if the Scala builder is not selected and even after I remove the Scala plugin. The only solution is to create a new workspace after the scala plugin has been removed. I have attempted this multiple times and am almost positive this is caused by the Scala eclipse plugin.

Inside the workspace log file there is the following:
!ENTRY org.eclipse.osgi 2 0 2009-02-01 01:31:00.762!MESSAGE While loading class "lampion.presentation.Presentations$", thread "Thread[worker-oakland,6,main]" timed out waiting (5000ms) for thread "Thread[main,6,main]" to finish starting bundle "reference:file:plugins\ch.epfl.lamp.sdt.core_2.7.3.final.jar [515]". To avoid deadlock, thread "Thread[worker-oakland,6,main]" is proceeding but "lampion.presentation.Presentations$" may not be fully initialized. !STACK 0org.osgi.framework.BundleException: State change in progress for bundle "reference:file:plugins\ch.epfl.lamp.sdt.core_2.7.3.final.jar" by thread "main". at org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(AbstractBundle.java:1144) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:263) at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400) at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:427) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:193) at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:368) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:444) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:397) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:385) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at lampion.presentation.Presentations$ProjectImpl$Job.run(Presentations.scala:335)Caused by: org.eclipse.osgi.framework.internal.core.AbstractBundle$BundleStatusException ... 14 moreRoot exception:org.eclipse.osgi.framework.internal.core.AbstractBundle$BundleStatusException at org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(AbstractBundle.java:1144) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:263) at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400) at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:427) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:193) at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:368) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:444) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:397) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:385) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at lampion.presentation.Presentations$ProjectImpl$Job.run(Presentations.scala:335)
I am using the version from the update site, 2.7.3final. Anyone have any ideas or suggestions?
Thanks,Gordon


milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.
Re: Scala Eclipse Plugin initialisation Was: Scala Eclipse Plu

On Tue, Feb 3, 2009 at 8:25 PM, Jan Lohre wrote:
> ScalaCompilationUnitManager.getScalaCompilationUnit appears to create
> compilation units on the fly if it can't find them in the cache.
> Which gets me to the question why
> ScalaCompilationUnitManager.initCompilationUnits(ResourcesPlugin.getWorkspace)
> is necessary in the activators start method.
> I would say we should remove it from there.

If you try taking it out you'll find that Scala files stop appearing
as such in the Package Explorer ;-)

But you're right: it's a time consuming, ugly hack, and it is
responsible for the error you're seeing in the log. You'll be glad to
know that it's going as a side effect of the switch to an Equinox
Aspects based approach to JDT integration that's about to land on
trunk.

Cheers,

Miles

Jan Lohre
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala Eclipse Plugin initialisation Was: Scala Eclipse Plu
Do they?

I wouldn't understand this from the code perspective (which actually does not mean much as I only had quite a short look at it yet)
But the attached screenshot tells a different story IMHO. But I'll decide trusting you if I still overlooked or misinterpreted something. Anyway if it's gonna disapear anytime soon its not worth removing it now.

Having said this, when will the refactoring land on trunk and what parts are currently not worth looking at as I could imagine at least some radical changes coming with the refactoring.

Kind regards,
Jan

2009/2/3 Miles Sabin <miles@milessabin.com>
On Tue, Feb 3, 2009 at 8:25 PM, Jan Lohre <jan.lohre@googlemail.com> wrote:
> ScalaCompilationUnitManager.getScalaCompilationUnit appears to create
> compilation units on the fly if it can't find them in the cache.
> Which gets me to the question why
> ScalaCompilationUnitManager.initCompilationUnits(ResourcesPlugin.getWorkspace)
> is necessary in the activators start method.
> I would say we should remove it from there.

If you try taking it out you'll find that Scala files stop appearing
as such in the Package Explorer ;-)

But you're right: it's a time consuming, ugly hack, and it is
responsible for the error you're seeing in the log. You'll be glad to
know that it's going as a side effect of the switch to an Equinox
Aspects based approach to JDT integration that's about to land on
trunk.

Cheers,


Miles

--
Miles Sabin
tel:    +44 (0)1273 720 779
mobile: +44 (0)7813 944 528
skype:  milessabin

milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.
Re: Scala Eclipse Plugin initialisation Was: Scala Eclipse Plu

On Tue, Feb 3, 2009 at 11:03 PM, Jan Lohre wrote:
> Do they?

Yes they do.

Try again with a workspace containing more and larger projects.

Cheers,

Miles

Jan Lohre
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala Eclipse Plugin initialisation Was: Scala Eclipse Plu
As I said I will trust your experience (and I have seen it with the scala and scala-plugin projects now)

What about the other question I had?

>Having said this, when will the refactoring land on trunk and what parts are currently not worth looking at as I could imagine at least some radical changes coming with >the refactoring.

Kind regards,
Jan

2009/2/4 Miles Sabin <miles@milessabin.com>
On Tue, Feb 3, 2009 at 11:03 PM, Jan Lohre <jan.lohre@googlemail.com> wrote:
> Do they?

Yes they do.

Try again with a workspace containing more and larger projects.

Cheers,


Miles

--
Miles Sabin
tel:    +44 (0)1273 720 779
mobile: +44 (0)7813 944 528
skype:  milessabin

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland