Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCP Product export doesn't work with Scala files #1919

Closed
scabug opened this issue Apr 24, 2009 · 23 comments
Closed

RCP Product export doesn't work with Scala files #1919

scabug opened this issue Apr 24, 2009 · 23 comments
Assignees

Comments

@scabug
Copy link

scabug commented Apr 24, 2009

Versions:
Scala Plugin: 2.7.4final
Eclipse: 3.5M5 I20090202-1535

Steps to reproduce:

  1. Create an RCP plugin.
  2. Add Scala nature to it.
  3. Create a Scala class in it and use it.
  4. Create a product definition for the RCP application.
  5. Export the product and run it.

Result:
The Scala source files are copied to the plugin bundle instead of the compiled .class files. Hence the exported product will abort with the following log message:

!ENTRY org.eclipse.osgi 4 0 2009-04-25 02:30:41.052
!MESSAGE Application error
!STACK 1
java.lang.Error: Unresolved compilation problem:
ExampleClass could not be resolved

More information:
http://wiki.eclipse.org/Scala_Bundle#Build_the_scala_bundle_jar explains the problem. Maybe you should file a bug to the Eclipse PDE bugzilla requesting the necessary changes to the PDE build process.

@scabug
Copy link
Author

scabug commented Apr 24, 2009

Imported From: https://issues.scala-lang.org/browse/SI-1919?orig=1
Reporter: thsoft
Attachments:

@scabug
Copy link
Author

scabug commented Sep 22, 2009

Andy Czerwonka (czerwonka) said:
If this issue were resolved we'd be able to mix scala and java plugins in our application. This would be fantastic, because I'd much rather write my model code in scala, but I can live with my RCP UI code in Java.

@scabug
Copy link
Author

scabug commented Sep 22, 2009

@milessabin said:
I'm puzzled. This should work ... can you send me an absolutely minimal project which illustrates the problem.

Nb. as of 2.7.4 that eclipse.org wiki page is wrong: you shouldn't have the Java builder in your .project, only the Scala builder (which will invoke the Java builder internally as necessary).

@scabug
Copy link
Author

scabug commented Sep 23, 2009

thsoft said:
The minimal project could be an RCP application from Hello RCP template. But when I now wanted to reproduce this, I couldn't, because the Scala plugin (2.7.6final with Eclipse 3.5.0 I20090611-1540) was so unusably unstable (the new Scala class wizard didn't work, and even though the Scala class could be compiled into a class file, when I wanted to call it in the RCP app, a java.lang.NoClassDefFoundError: scala/ScalaObject exception was thrown...

@scabug
Copy link
Author

scabug commented Sep 23, 2009

@milessabin said:
Could you follow the trouble-shooting instructions [http://www.scala-lang.org/node/94 here] and let me know how you get on. I suspect that heap configuration is the issue in comment #3.

@scabug
Copy link
Author

scabug commented Sep 23, 2009

thsoft said:
Sorry, I forgot to include scala.library to the plugin dependencies and to the run configuration. Now, I could reproduce the problem. The exact steps:

  • Create a plugin project with the following settings: create RCP application: yes, template: Hello RCP, add branding
  • Create a Scala class (e.g ScalaTest) with a method, instantiate it and call the method (e.g. in Activator.start())
  • Create a product definition using the existing product
  • Export the product (don't generate metadata repository)
    The problem: Now you can see that in the exported product, the plugin's jar contains only the source (.scala) of the Scala class, and not the compiled bytecode (.class). This occurs despite that the plugin's bin directory contains the correct class files.
    Hence the product won't start, and in the log, the following exception can be seen:

java.lang.Error: Unresolved compilation problem:
ScalaTest cannot be resolved to a type

@scabug
Copy link
Author

scabug commented Sep 23, 2009

Andy Czerwonka (czerwonka) said:
I'm having the same issue basically. Furthermore, I have wrapped JODA in a plugin and created a dependency from the Scala+Java plugin to the new JODA plugin. When I try a access the JODA api's from the Scala+Java plugin, I get errors plus I can't navigate to any of the JODA code.

It seems extremely unstable to me.

@scabug
Copy link
Author

scabug commented Sep 24, 2009

Andy Czerwonka (czerwonka) said:
Error in my activator trying to access Scala code

@scabug
Copy link
Author

scabug commented Sep 24, 2009

Andy Czerwonka (czerwonka) said:
simple Scala class that Java is trying to invoke

@scabug
Copy link
Author

scabug commented Sep 24, 2009

Andy Czerwonka (czerwonka) said:
Java and Scala in the same project

@scabug
Copy link
Author

scabug commented Sep 24, 2009

Andy Czerwonka (czerwonka) said:
I attached three screenshots that show a pedestrian case that is failing.

@scabug
Copy link
Author

scabug commented Sep 24, 2009

thsoft said:
I'm experiencing the same, but I think it is a separate issue, so it should belong to another ticket.

@scabug
Copy link
Author

scabug commented Sep 24, 2009

@milessabin said:
Are these error indicators only visible in the Java editor? Or do they also appear in the Eclipse Problems view?

@scabug
Copy link
Author

scabug commented Sep 24, 2009

thsoft said:
The strange is that they are only visible in the Java editor, but not in the Problems view or as resource decorations.

@scabug
Copy link
Author

scabug commented Sep 24, 2009

@milessabin said:
Right, so this is a known proble (largely fixed on trunk). The Java presentation compiler (which is responsible for the annotations you're seeing) isn't always aware of Scala constructs and hence give spurious reports. The Java build compiler, on the other hand, is quite happy so your build is successful and there are no problems listed in the Eclipse Problems view.

The workaround is to pay attention only to errors in Java source referencing Scala if there is a corresponding problem listed in the Problem view.

Aside from this, are you able to export your project?

@scabug
Copy link
Author

scabug commented Sep 24, 2009

thsoft said:
As I said in https://lampsvn.epfl.ch/trac/scala/ticket/1919#comment:5, the export completes successfully but the resulting plugin is incorrect because the source files of the Scala files are in the jar instead of the class files.

@scabug
Copy link
Author

scabug commented Sep 24, 2009

Andy Czerwonka (czerwonka) said:
Sounds like this issues is solved in the trunk so I won't bother logging a new issue. I will however abandon my Java+Scala project and reluctantly use Java exclusively. I do look forward to more progress on this development and will eagerly await a new release that is hopefully more ready.

Thanks for your efforts Miles - they are appreciated.

@scabug
Copy link
Author

scabug commented Oct 3, 2009

thsoft said:
Unfortunately in the more unstable 2.7.7RC1, the situation is even worse: when following the above steps creating an Eclipse plugin with Scala nature, when creating a Scala class, the following exception is thrown:

scala.tools.nsc.FatalError: object scala not found.
at scala.tools.nsc.symtab.Definitions$$definitions$$.getModuleOrClass(Definitions.scala:355)
at scala.tools.nsc.symtab.Definitions$$definitions$$.getModule(Definitions.scala:326)
at scala.tools.nsc.symtab.Definitions$$definitions$$.ScalaPackage(Definitions.scala:34)
at scala.tools.nsc.symtab.Definitions$$definitions$$.ScalaPackageClass(Definitions.scala:35)
at scala.tools.nsc.symtab.Definitions$$definitions$$.init(Definitions.scala:663)
at scala.tools.nsc.Global$$Run.(Global.scala:476)
at scala.tools.eclipse.BuildCompiler$$$$anon$$4.(BuildCompiler.scala:84)
at scala.tools.eclipse.BuildCompiler.build(BuildCompiler.scala:84)
at scala.tools.eclipse.ScalaPlugin$$ProjectImpl$$class.build(ScalaPlugin.scala:406)
at scala.tools.eclipse.Driver$$Project.build(Driver.scala:16)
at lampion.eclipse.Builder.build(Builder.scala:90)
at scala.tools.eclipse.Builder.build(Builder.scala:33)
at org.eclipse.core.internal.events.BuildManager$$2.run(BuildManager.java:627)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
at org.eclipse.core.internal.events.BuildManager$$1.run(BuildManager.java:253)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:218)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:360)
at org.eclipse.core.internal.resources.Project$$1.run(Project.java:522)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1782)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:502)
at org.eclipse.core.internal.resources.Project.build(Project.java:94)
at scala.tools.eclipse.wizards.NewResourceWizard$$class.performFinish(NewResourceWizard.scala:171)
at scala.tools.eclipse.wizards.NewClassWizard.performFinish(NewClassWizard.scala:9)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:752)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
at org.eclipse.jface.dialogs.Dialog$$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3542)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1247)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1270)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1255)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1076)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3440)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3099)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.ui.internal.handlers.WizardHandler$$New.executeHandler(WizardHandler.java:253)
at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:273)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:470)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:824)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:880)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:569)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$$3(WorkbenchKeyboard.java:510)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard$$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:125)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:965)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3541)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1247)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1270)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1255)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1284)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1280)
at org.eclipse.swt.widgets.Tree.sendKeyEvent(Tree.java:2330)
at org.eclipse.swt.widgets.Control.keyDown(Control.java:2019)
at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:529)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4654)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:202)
at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:1750)
at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:1821)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4712)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4284)
at org.eclipse.swt.widgets.Display.applicationProc(Display.java:4351)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:101)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3096)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)

The scala file is created, but after it, the bin directory does not contain the class files compiled from Scala code, and there are real problems (i.e. not just in the editor) when trying to access them from Java code.

@scabug
Copy link
Author

scabug commented Dec 1, 2009

@scabug
Copy link
Author

scabug commented Dec 1, 2009

@milessabin said:
That's an interesting looking article, but links to it belong in comments on this ticket. Please open a new enhancement ticket requesting enhanced Scala PDE support and reference that article there.

In the meantime, can anyone verify that the problem is indeed fixed on trunk?

@scabug
Copy link
Author

scabug commented Dec 1, 2009

@milessabin said:
That should have been "but links to it don't belong in comments on this ticket".

@scabug
Copy link
Author

scabug commented Dec 2, 2009

spiros said:
I've tested this issue with r19928 and unfortunately the bug is still valid. I followed the procedure outlined in comment: https://lampsvn.epfl.ch/trac/scala/ticket/1919#comment:5 and the jar file in the exported product contained the .scala file not the .class.

@scabug
Copy link
Author

scabug commented May 7, 2010

Richard Dallaway (d6y) said:
This ticket has been moved to the Scala IDE for Eclipse project at Assembla:

Information on how to follow the ticket can be found on the wiki:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants