Java lambda表达式和switch语句会导致eclipse崩溃正常吗?

时间:2014-11-28 11:56:09

标签: java eclipse

我无法弄清楚是什么导致了eclipse中的stackoverflow问题。其实我确实知道,但我不知道为什么。我尝试过以下方法:

  1. 重启我的电脑 - 呃
  2. Eclipse.exe -clean
  3. 重新安装了一个新的日食
  4. 每次都测试完全相同的代码,每次完全相同的代码出现崩溃时。代码是lambda表达式。在按下周期键之前,这一切都很好。#34;。#34;用于在switch语句中完成代码。
  5. 我的代码是:

    albumList.getSelectionModel().selectedItemProperty()
            .addListener((ObservableValue obs, AbstractAlbum oldAlbum, AbstractAlbum selectedAlbum) -> {
         switch (type){
             test. // It doesn't matter what variable I use, valid or not, after the dot, eclipse crashes       
         }
    });
    

    我的代码无法解决问题。我在这里遵循了这个教程:http://code.makery.ch/java/javafx-8-tutorial-intro/,它也有一个lambda表达式。我试图在这段代码中添加一个开关,然后又崩溃了:

    lastNameColumn.setCellValueFactory(cellData -> {
        switch (type){
            test. // again it crashed after a dot
        }
    });
    

    有人可以确认他们是否可以复制此内容?我正在使用一个全新的Eclipse:Luna for java developer 64x - 最新的软件包。这是日食的日志:

    !ENTRY org.eclipse.ui 4 0 2014-11-28 22:19:08.889
    !MESSAGE Unhandled event loop exception
    !STACK 0
    org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.StackOverflowError)
        at org.eclipse.swt.SWT.error(SWT.java:4441)
        at org.eclipse.swt.SWT.error(SWT.java:4356)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:139)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    Caused by: java.lang.StackOverflowError
        at org.eclipse.jdt.internal.codeassist.UnresolvedReferenceNameFinder.visit(UnresolvedReferenceNameFinder.java:292)
        at org.eclipse.jdt.internal.compiler.ast.Block.traverse(Block.java:138)
        at org.eclipse.jdt.internal.compiler.ast.Initializer.traverse(Initializer.java:130)
        at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1427)
        at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.traverse(QualifiedAllocationExpression.java:603)
        at org.eclipse.jdt.internal.compiler.ast.LambdaExpression.traverse(LambdaExpression.java:645)
        at org.eclipse.jdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:1015)
        at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:347)
        at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1434)
        at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.traverse(QualifiedAllocationExpression.java:603)
        at org.eclipse.jdt.internal.compiler.ast.LambdaExpression.traverse(LambdaExpression.java:645)
        at org.eclipse.jdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:1015)
        at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:347)
        at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1434)
        at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.traverse(QualifiedAllocationExpression.java:603)
        at org.eclipse.jdt.internal.compiler.ast.LambdaExpression.traverse(LambdaExpression.java:645)
        at org.eclipse.jdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:1015)
        at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:347)
        at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1434)
        at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.traverse(QualifiedAllocationExpression.java:603)
    

1 个答案:

答案 0 :(得分:0)

也许时间治愈所有伤口? : - )

我使用Eclipse Neon 3并且所有内容辅助Java 8都可以正常工作....