Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358967 - [Xtend2] Function with no expression validates but causes NPE in generator
Summary: [Xtend2] Function with no expression validates but causes NPE in generator
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-26 15:20 EDT by Jason Barkanic CLA
Modified: 2017-09-19 17:51 EDT (History)
2 users (show)

See Also:
sebastian.zarnekow: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Barkanic CLA 2011-09-26 15:20:02 EDT
Build Identifier: Build id: I20110613-1736

Defining a function in Xtend2 without an expression does not cause a validation error, but does cause a NPE in the generator.

Reproducible: Always

Steps to Reproduce:
class Test {

  def void foo(EObject o)

}
Comment 1 Jason Barkanic CLA 2011-09-26 15:22:24 EDT
java.lang.NullPointerException
	at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler._toJavaStatement(AbstractXbaseCompiler.java:137)
	at sun.reflect.GeneratedMethodAccessor1775.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:111)
	at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.compile(AbstractXbaseCompiler.java:92)
	at org.eclipse.xtext.xtend2.compiler.Xtend2Compiler.compile(Xtend2Compiler.java:320)
	at org.eclipse.xtext.xtend2.compiler.Xtend2Compiler.compile(Xtend2Compiler.java:161)
	at org.eclipse.xtext.xtend2.compiler.Xtend2Compiler.compile(Xtend2Compiler.java:114)
	at org.eclipse.xtext.xtend2.ui.builder.Xtend2BuilderParticipant.compile(Xtend2BuilderParticipant.java:146)
	at org.eclipse.xtext.xtend2.ui.builder.Xtend2BuilderParticipant.processDelta(Xtend2BuilderParticipant.java:115)
	at org.eclipse.xtext.xtend2.ui.builder.Xtend2BuilderParticipant.build(Xtend2BuilderParticipant.java:75)
	at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
	at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:160)
	at org.eclipse.xtext.builder.impl.XtextBuilder.incrementalBuild(XtextBuilder.java:141)
	at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:91)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 2 Holger Schill CLA 2011-10-12 09:39:10 EDT
With the current head there is no Nullpointer anymore.


  def void foo()

leads to :


  public void foo() {
    throw new UnsupportedOperationException("foo is not implemented");
  }


Please reopen if I missed something.
Comment 3 Sebastian Zarnekow CLA 2011-10-12 09:41:57 EDT
Marked as resolved since this one was fixed for 2.1
Comment 4 Karsten Thoms CLA 2017-09-19 17:40:50 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 5 Karsten Thoms CLA 2017-09-19 17:51:57 EDT
Closing all bugs that were set to RESOLVED before Neon.0