Implement inherited abstract methods doesn't work
Create a new Scala class using the wizard, and select to implement a Scala interface, for example:
The generated class will be invalid code:
This can be fixed once we have a better structure builder.
package test
/** Test Base */
trait Base {
def foo(x: Int): Int
def bar(f: Int => Int, xs: List[Int]): List[(Int, Int)]
def baz[T <: Ordered[T]](other: T): Boolean
}
The generated class will be invalid code:
package test
import test.Base.T
import scala.collection.immutable.List
class Derived extends Base {
def foo(x: Int): Int = { 0 }
def bar(f: Function1, xs: List): List = { null }
def baz(other: T): Object = { null }
}
This can be fixed once we have a better structure builder.
Leave a comment
Updating tickets (#1000238, #1000326, #1000331, #1000264, #1000298, #1000314, #1000315, #1000325, #1000329, #1000333, #1000277, #1000209, #1000210, #1000288, #1000299, #1000300, #1000301, #1000305, #1000309, #1000310, #1000327, #1000270, #1000292, #1000293, #1000294, #1000295, #1000297, #1000303, #1000304, #1000312, #1000320)
on 2012-01-27 06:41 *
By skyluc
Type set to Defect
Version changed from 2.0.0-beta1 to 2.0.0-final-29
Eclipse version changed from Helios to All
Assigned to changed from login to -none-
Component changed from None to Editor
Milestone changed from Helium to Backlog
Permission type changed from None to Public
Status changed from New to Accepted
I'm re-opening this as it still doesn't work. There are now two issues:
1) An exception is produced in the wizard after clicking Finish
2) The created class doesn't compile
1) An exception is produced in the wizard after clicking Finish
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1029)
at org.eclipse.jdt.internal.ui.wizards.NewElementWizard.performFinish(NewElementWizard.java:134)
at scala.tools.eclipse.wizards.AbstractNewElementWizard.performFinish(AbstractNewElementWizard.scala:29)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:827)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:432)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4128)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1270)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3974)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3613)
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.actions.NewWizardShortcutAction.run(NewWizardShortcutAction.java:135)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4128)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1270)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3974)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3613)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
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:344)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
Caused by: java.lang.NullPointerException
at scala.tools.eclipse.wizards.AbstractNewElementWizardPage.createType(AbstractNewElementWizardPage.scala:372)
at scala.tools.eclipse.wizards.AbstractNewElementWizard.finishPage(AbstractNewElementWizard.scala:48)
at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:118)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4873)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Root exception:
java.lang.NullPointerException
at scala.tools.eclipse.wizards.AbstractNewElementWizardPage.createType(AbstractNewElementWizardPage.scala:372)
at scala.tools.eclipse.wizards.AbstractNewElementWizard.finishPage(AbstractNewElementWizard.scala:48)
at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:118)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4873)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
2) The created class doesn't compile
import scala.collection.immutable.List
class BaseImpl2 extends Base {
def foo(x: Int): Int = { 0 }
def bar(f: Function1, xs: List): List = { null }
def baz[T >: Nothing <: Any](other: Unknown -> TT;): Boolean = { false } // Look at the signature of the function parameter!!
}
on 2012-07-30 02:05 *
By Mirco Dotta
Version changed from 2.0.0-final-29 to 2.1.0-M2-29
Milestone changed from Backlog to Helium
on 2014-02-05 05:40 *
By Iulian Dragos
Version changed from 2.1.0-M2-29 to 3.0.2-210
Milestone changed from Lithium to Lithium SR1
The checkmars were removed from the wizard, so technically this should be a new feature.