Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359100

Summary: Xpand is completely broken
Product: [Modeling] M2T Reporter: Sebastian Zarnekow <sebastian.zarnekow>
Component: XpandAssignee: Karsten Thoms <karsten.thoms>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: benedikt.niehues, dennis.huebner, karsten.thoms, sven.efftinge
Version: 1.1.0Flags: karsten.thoms: juno+
Target Milestone: M3   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Bug Depends on:    
Bug Blocks: 359115    
Attachments:
Description Flags
Patch for bug 359100
sven.efftinge: iplog+
UnitTest testing referenced projects build
sven.efftinge: iplog+
testProjects for the unit tests none

Description Sebastian Zarnekow CLA 2011-09-27 11:49:00 EDT
I just tried the new Xpand build and it seems to be completely broken. A great bunch of Xpand files in my workspace does no longer validate - I assume the ones that import extensions are affected, but I did not dig deeper into the problem.

FindBugs indicates a problem in some recently changed code:

ResourceID is incompatible with expected argument type String in 
 org.eclipse.xtend.shared.ui.core.internal.XtendXpandProject.loadXtendXpandResource(String, String, boolean, 
 Set)

and I get NPEs all over the place similar to this one:

eclipse.buildId=I20110613-1736
java.version=1.6.0_26
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=de_DE

Created Time: 2011-09-27 17:36:59.679

Error
Tue Sep 27 17:21:42 CEST 2011
java.lang.NullPointerException

java.lang.NullPointerException
	at org.eclipse.xtend.shared.ui.core.internal.XtendXpandProject.cacheXtendXpandResource(XtendXpandProject.java:385)
	at org.eclipse.xtend.shared.ui.core.internal.XtendXpandProject.loadXtendXpandResource(XtendXpandProject.java:372)
	at org.eclipse.xtend.shared.ui.core.internal.XtendXpandProject.loadXtendXpandResource(XtendXpandProject.java:307)
	at org.eclipse.xtend.shared.ui.core.internal.XtendXpandProject.findExtXptResource(XtendXpandProject.java:242)
	at org.eclipse.xtend.shared.ui.expression.XpandPluginExecutionContext$PluginResourceManager.loadResource(XpandPluginExecutionContext.java:71)
	at org.eclipse.internal.xtend.xtend.ast.ExtensionFile.getPublicExtensions(ExtensionFile.java:202)
	at org.eclipse.internal.xtend.xtend.ast.ExtensionFile.getPublicExtensions(ExtensionFile.java:185)
	at org.eclipse.xtend.ui.core.internal.XtendResourceImpl.getPublicExtensions(XtendResourceImpl.java:89)
	at org.eclipse.xtend.expression.ExecutionContextImpl.internalAllExtensions(ExecutionContextImpl.java:330)
	at org.eclipse.xtend.expression.ExecutionContextImpl.getAllExtensions(ExecutionContextImpl.java:305)
	at org.eclipse.xtend.shared.ui.expression.XpandPluginExecutionContext.getAllExtensions(XpandPluginExecutionContext.java:92)
	at org.eclipse.xtend.shared.ui.core.search.XtendXpandSearchEngine.findExtensionsByNameInResourceAndImports(XtendXpandSearchEngine.java:303)
	at org.eclipse.xtend.shared.ui.editor.navigation.AbstractHyperlinkDetector.findExtensionMatches(AbstractHyperlinkDetector.java:213)
	at org.eclipse.xpand.ui.editor.XpandHyperlinkDetector.computeMatchesAndHyperlinks(XpandHyperlinkDetector.java:105)
	at org.eclipse.xtend.shared.ui.editor.navigation.AbstractHyperlinkDetector.detectHyperlinks(AbstractHyperlinkDetector.java:74)
	at org.eclipse.xpand.ui.editor.XpandOpenAction.run(XpandOpenAction.java:68)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:279)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185)
	at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109)
	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:468)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1069)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4124)
	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.sendKeyEvent(Widget.java:1494)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1490)
	at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:463)
	at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:1051)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5560)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSResponder.interpretKeyEvents(NSResponder.java:68)
	at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:587)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5470)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
	at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2092)
	at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2255)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5532)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4986)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5135)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:128)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3607)
	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)
Comment 1 Dennis Huebner CLA 2011-09-27 13:11:36 EDT
I think it's a good example that shows the benefits of using static analyze tools. Therefore I opened a bug report #359115.
Comment 2 Benedikt Niehues CLA 2011-09-28 04:36:06 EDT
Created attachment 204151 [details]
Patch for bug 359100

this fixes the bug
Comment 3 Dennis Huebner CLA 2011-09-28 14:16:29 EDT
(In reply to comment #2)
> Created attachment 204151 [details]
> Patch for bug 359100
> 
> this fixes the bug

A lightweight unit test as a confirmation would be appropriate.
Comment 4 Benedikt Niehues CLA 2011-10-05 05:14:03 EDT
Created attachment 204574 [details]
UnitTest testing referenced projects build
Comment 5 Karsten Thoms CLA 2011-10-05 05:35:26 EDT
The unittest patch refers to a binary testProjects.zip. Could you attach that zip separately?
Comment 6 Benedikt Niehues CLA 2011-10-05 06:03:28 EDT
Created attachment 204579 [details]
testProjects for the unit tests

as they can not be integrated in the patch here it is separately. It has to be stored under org.eclipse.xtend.shared.ui.test/resources/
Comment 7 Karsten Thoms CLA 2011-10-05 13:07:46 EDT
The added unit test is failing:

junit.framework.AssertionFailedError: {resource=Template.xpt, attributes={message=Internal error:Imported extension resource org::eclipse::xtend::util::stdlib::io has errors., location=line: 3, charStart=63, issueType=Internal error, lineNumber=3, severity=1, charEnd=110}, type=org.eclipse.xtend.shared.ui.problem}
	at junit.framework.Assert.fail(Assert.java:47)
	at org.eclipse.xtend.shared.ui.test.PluginTestBase.assertNoErrorMarkers(PluginTestBase.java:43)
	at org.eclipse.xtend.shared.ui.test.xpand2.core.ReferencedProjectTest.testReferencedProjectWorkspace(ReferencedProjectTest.java:49)
	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 junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
	at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3935)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3612)
	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.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:54)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:41)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
	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)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Comment 8 Benedikt Niehues CLA 2011-10-06 02:15:13 EDT
The test is failing because of linked resources...
Similar to bug 338695 
To solve the problem there are three possibilities:
1. close the project org.eclipse.xtend.util.stdlib in your workspace
2. modify the template so that it won't use the stdlib::io extension 
3. fix the bug 338695
Comment 9 Karsten Thoms CLA 2011-10-07 02:37:38 EDT
Could reproduce the bug and saw it fixed after applying the patch.
Comment 10 Dennis Huebner CLA 2011-10-10 05:16:20 EDT
I can't find the corresponding test in https://hudson.eclipse.org/hudson/job/Xpand-nightly-HEAD/707/
We really need a test that is running in CI, especially for critical bugs.
Comment 11 Karsten Thoms CLA 2011-10-10 06:04:45 EDT
We need to activate the tests from 
  org.eclipse.xtend.shared.ui.test
Comment 12 Karsten Thoms CLA 2011-10-10 07:36:03 EDT
Tests are existent, but not executed in CI build. 

Add org.eclipse.xtend.shared.ui.test.AllTests
Comment 13 Dennis Huebner CLA 2011-10-10 16:25:14 EDT
(In reply to comment #12)
> Tests are existent, but not executed in CI build. 
> 
> Add org.eclipse.xtend.shared.ui.test.AllTests

Now I understand why I couldn't see any new test results after the patch was applied.
org.eclipse.xtend.shared.ui.test project was not included in the test feature and that's why the launch configuration was missing.
I've added tend.shared.ui.test bundle to the test feature and created /org.eclipse.xpand.build-feature/org.eclipse.xtend.shared.ui.test.launch file.

See:
https://hudson.eclipse.org/hudson/job/Xpand-nightly-HEAD/728/testReport/Tests%20for%20org.eclipse.xtend.shared.ui.test$org.eclipse.xtend.shared.ui.test.xpand2.core/ReferencedProjectTest/

By the way we can use eclipse launch configuration files with buckminster, so the old painful test suite approach is obsolete (see Xtext as reference).
Comment 14 Karsten Thoms CLA 2013-02-21 08:13:18 EST
Bug resolved before Xpand 1.2 release date => Closing