Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » name may not be null xtext 2.12
name may not be null xtext 2.12 [message #1764675] Thu, 01 June 2017 11:05 Go to next message
anil chalil is currently offline anil chalilFriend
Messages: 38
Registered: October 2010
Member
Hi,

I upgraded my dsl from 2.11 2.12. With 2.11 it was ok but now it throws below:

Caused by: java.lang.IllegalStateException: name may not be null
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.getFavoriteVariableName(AbstractXbaseCompiler.java:568)
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.declareFreshLocalVariable(AbstractXbaseCompiler.java:627)
at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler._toJavaStatement(FeatureCallCompiler.java:176)
at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler.doInternalToJavaStatement(FeatureCallCompiler.java:111)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:385)
at henkan.dsl.jvmmodel.HenkanCompiler.doInternalToJavaStatement(HenkanCompiler.java:55)
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:473)
at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler.prepareExpression(FeatureCallCompiler.java:534)
at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler._toJavaStatement(FeatureCallCompiler.java:151)
at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler.doInternalToJavaStatement(FeatureCallCompiler.java:111)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:385)
at henkan.dsl.jvmmodel.HenkanCompiler.doInternalToJavaStatement(HenkanCompiler.java:55)
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:473)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler._toJavaStatement(XbaseCompiler.java:1060)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:363)
at henkan.dsl.jvmmodel.HenkanCompiler.doInternalToJavaStatement(HenkanCompiler.java:55)
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:473)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler._toJavaStatement(XbaseCompiler.java:394)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:349)
at henkan.dsl.jvmmodel.HenkanCompiler.doInternalToJavaStatement(HenkanCompiler.java:55)
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:473)
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.compile(AbstractXbaseCompiler.java:294)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler.toAnonymousClass(XbaseCompiler.java:1660)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler._toJavaStatement(XbaseCompiler.java:1600)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:353)
at henkan.dsl.jvmmodel.HenkanCompiler.doInternalToJavaStatement(HenkanCompiler.java:55)
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:473)
at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler.prepareExpression(FeatureCallCompiler.java:534)
at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler._toJavaStatement(FeatureCallCompiler.java:154)
at org.eclipse.xtext.xbase.compiler.FeatureCallCompiler.doInternalToJavaStatement(FeatureCallCompiler.java:111)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:385)
at henkan.dsl.jvmmodel.HenkanCompiler.doInternalToJavaStatement(HenkanCompiler.java:55)
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:473)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler._toJavaStatement(XbaseCompiler.java:394)
at org.eclipse.xtext.xbase.compiler.XbaseCompiler.doInternalToJavaStatement(XbaseCompiler.java:349)
at henkan.dsl.jvmmodel.HenkanCompiler.doInternalToJavaStatement(HenkanCompiler.java:55)
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.internalToJavaStatement(AbstractXbaseCompiler.java:473)
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.compile(AbstractXbaseCompiler.java:294)
at org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler.compile(AbstractXbaseCompiler.java:274)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.compile(JvmModelGenerator.java:1057)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.generateExecutableBody(JvmModelGenerator.java:1034)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator._generateMember(JvmModelGenerator.java:798)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.generateMember(JvmModelGenerator.java:1660)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.lambda$generateMembersInBody$2(JvmModelGenerator.java:292)
at org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_doubleArrow(ObjectExtensions.java:139)
at org.eclipse.xtext.xbase.compiler.LoopExtensions.forEach(LoopExtensions.java:35)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.generateMembersInBody(JvmModelGenerator.java:295)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator._generateBody(JvmModelGenerator.java:269)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.generateBody(JvmModelGenerator.java:1632)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.generateType(JvmModelGenerator.java:226)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator._internalDoGenerate(JvmModelGenerator.java:213)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.internalDoGenerate(JvmModelGenerator.java:1615)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.doGenerate(JvmModelGenerator.java:196)
at org.eclipse.xtext.generator.GeneratorDelegate.doGenerate(GeneratorDelegate.java:45)
at org.eclipse.xtext.generator.GeneratorDelegate.generate(GeneratorDelegate.java:34)
at org.eclipse.xtext.build.IncrementalBuilder$InternalStatefulIncrementalBuilder.generate(IncrementalBuilder.java:309)
at org.eclipse.xtext.build.IncrementalBuilder$InternalStatefulIncrementalBuilder.lambda$launch$6(IncrementalBuilder.java:246)
at org.eclipse.xtext.build.ClusteringStorageAwareResourceLoader.lambda$executeClustered$1(ClusteringStorageAwareResourceLoader.java:77)
at org.eclipse.xtext.xbase.lib.internal.FunctionDelegate.apply(FunctionDelegate.java:42)
at com.google.common.collect.Lists$TransformingRandomAccessList$1.transform(Lists.java:617)
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
at java.util.AbstractCollection.toArray(AbstractCollection.java:141)
at java.util.ArrayList.addAll(ArrayList.java:577)
at com.google.common.collect.Iterables.addAll(Iterables.java:352)
at org.eclipse.xtext.build.ClusteringStorageAwareResourceLoader.executeClustered(ClusteringStorageAwareResourceLoader.java:80)
at org.eclipse.xtext.build.BuildContext.executeClustered(BuildContext.java:55)
at org.eclipse.xtext.build.IncrementalBuilder$InternalStatefulIncrementalBuilder.launch(IncrementalBuilder.java:251)
at org.eclipse.xtext.build.IncrementalBuilder.build(IncrementalBuilder.java:399)
at org.eclipse.xtext.build.IncrementalBuilder.build(IncrementalBuilder.java:384)
at org.eclipse.xtext.ide.server.ProjectManager.doBuild(ProjectManager.java:115)
at org.eclipse.xtext.ide.server.BuildManager.internalBuild(BuildManager.java:171)
at org.eclipse.xtext.ide.server.BuildManager.doBuild(BuildManager.java:125)
at org.eclipse.xtext.ide.server.WorkspaceManager.doBuild(WorkspaceManager.java:153)
at org.eclipse.xtext.ide.server.WorkspaceManager.didOpen(WorkspaceManager.java:202)
at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$didOpen$4(LanguageServerImpl.java:263)
at org.eclipse.xtext.ide.server.concurrent.RequestManager.runWrite(RequestManager.java:71)
at org.eclipse.xtext.ide.server.LanguageServerImpl.didOpen(LanguageServerImpl.java:266)
... 17 more


Below is the xtext expression that throws this line

rows.forEach[row|
if(row.age>10)
emit("anil" + 1 named col1,row.age named name)
]

any idea why?
Re: name may not be null xtext 2.12 [message #1764676 is a reply to message #1764675] Thu, 01 June 2017 11:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
could you nail down this to a complete reproducible example e.g. in domain model example or xtend?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: name may not be null xtext 2.12 [message #1764677 is a reply to message #1764676] Thu, 01 June 2017 11:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
String name = nameProvider.getSimpleName(((XAbstractFeatureCall) ex).getFeature());
if (name == null) {
throw new IllegalStateException("name may not be null");
}

what is the feature at this please?
is the feature null or a proxy
or is the name null


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: name may not be null xtext 2.12 [message #1764678 is a reply to message #1764677] Thu, 01 June 2017 11:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
another question:

did you customize around

isVariableDeclarationRequired? if yes please have a look at the changed code there


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: name may not be null xtext 2.12 [message #1764679 is a reply to message #1764677] Thu, 01 June 2017 11:18 Go to previous messageGo to next message
anil chalil is currently offline anil chalilFriend
Messages: 38
Registered: October 2010
Member
Hi Christian

The feature is (i evaluated that expression from debug window ((XAbstractFeatureCall) ex).getFeature()) and it is JvmVoid.

In the mean time it is the same project that i uploaded for https://github.com/eclipse/xtext-extras/issues/144. I just added an TypeListener to set Live flag to true as a workaround for above issue. Do you want me to upload it again with latest changes?
Re: name may not be null xtext 2.12 [message #1764681 is a reply to message #1764679] Thu, 01 June 2017 11:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
can you share a complete test model for this issue.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: name may not be null xtext 2.12 [message #1764683 is a reply to message #1764681] Thu, 01 June 2017 11:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
(the following unit test seems ok for me with the code you originally shared)
=> would be interesting to see what you changed

import com.google.inject.Inject
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
import org.eclipse.xtext.xbase.testing.CompilationTestHelper
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(XtextRunner)
@InjectWith(HDslInjectorProvider)
class HDslParsingTest {
	
	
	@Inject extension CompilationTestHelper
	helper;
	
	@Test
	def void xxxxx() {
		assertCompilesTo('''
		source source1 with id="1";
					
					flatmap operator deneme source source1 [
						rows.forEach[row|
						if(row.age>10)
						emit("anil" + 1 named col1,row.age named name)
						]
					    val first=rows.next
					    emit("anil" named col1)
					]
					
					flatmap operator deneme2 source deneme [
					    val first = rows.next
					    emit("anil2" named col1)
					]
					
					sink mysink with id="2" source deneme2;
		''', '''
		MULTIPLE FILES WERE GENERATED
		
		File 1 : /myProject/./src-gen/deneme2Function.java
		
		import henkan.dsl.lib.HenkanRow;
		import java.util.Iterator;
		import org.apache.flink.util.Collector;
		
		@SuppressWarnings("all")
		public class deneme2Function {
		  public void main(final Iterator<denemeRow> rows, final Collector<HenkanRow> collector) {
		    final denemeRow first = rows.next();
		    deneme2Row _row = new deneme2Row();
		    _row.col1 = "anil2";
		    collector.out(_row);
		    
		  }
		}
		
		File 2 : /myProject/./src-gen/deneme2Row.java
		
		import henkan.dsl.lib.HenkanRow;
		
		@SuppressWarnings("all")
		public class deneme2Row implements HenkanRow {
		  public String col1;
		}
		
		File 3 : /myProject/./src-gen/denemeFunction.java
		
		import henkan.dsl.lib.HenkanRow;
		import java.util.Iterator;
		import org.apache.flink.util.Collector;
		import org.eclipse.xtext.xbase.lib.IteratorExtensions;
		import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
		
		@SuppressWarnings("all")
		public class denemeFunction {
		  public void main(final Iterator<source1Row> rows, final Collector<HenkanRow> collector) {
		    final Procedure1<source1Row> _function = new Procedure1<source1Row>() {
		      @Override
		      public void apply(final source1Row row) {
		        if (((row.age).intValue() > 10)) {
		          denemeRow _row = new denemeRow();
		          _row.col1 = ("anil" + Integer.valueOf(1));
		          _row.name = row.age;
		          collector.out(_row);
		          
		        }
		      }
		    };
		    IteratorExtensions.<source1Row>forEach(rows, _function);
		    final source1Row first = rows.next();
		    denemeRow _row = new denemeRow();
		    _row.col1 = "anil";
		    collector.out(_row);
		    
		  }
		}
		
		File 4 : /myProject/./src-gen/denemeRow.java
		
		import henkan.dsl.lib.HenkanRow;
		
		@SuppressWarnings("all")
		public class denemeRow implements HenkanRow {
		  public String col1;
		}
		
		File 5 : /myProject/./src-gen/source1Row.java
		
		import henkan.dsl.lib.HenkanRow;
		
		@SuppressWarnings("all")
		public class source1Row implements HenkanRow {
		  public String surname;
		  
		  public String name;
		  
		  public Integer age;
		}
		
		''')
	}
}



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: name may not be null xtext 2.12 [message #1764688 is a reply to message #1764683] Thu, 01 June 2017 11:59 Go to previous messageGo to next message
anil chalil is currently offline anil chalilFriend
Messages: 38
Registered: October 2010
Member
I added the unit test you provided(with little modifications) and it seems to be ok. Weird thing when i launch my project with RunWebSocketServer it throws the exception i mentioned. I attached the latest version of my project
Re: name may not be null xtext 2.12 [message #1764695 is a reply to message #1764688] Thu, 01 June 2017 12:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
can you please file another ticket?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: name may not be null xtext 2.12 [message #1764696 is a reply to message #1764695] Thu, 01 June 2017 13:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
ps it is a proxy

JvmVoid: (eProxyURI: file:///Users/dietrich/Downloads/henkan.dsl.parent/vscode-hdsl-ext/exampleproject/example.hl#|4)

and i get errors on incomplete classpath


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: name may not be null xtext 2.12 [message #1764700 is a reply to message #1764696] Thu, 01 June 2017 13:34 Go to previous messageGo to next message
anil chalil is currently offline anil chalilFriend
Messages: 38
Registered: October 2010
Member
Hi Christian,

Where should i file ticket? under xtext-extras ?

What kind of errors did you get related to classpath? Can you share ?
Re: name may not be null xtext 2.12 [message #1764709 is a reply to message #1764700] Thu, 01 June 2017 14:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
yes

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: name may not be null xtext 2.12 [message #1764710 is a reply to message #1764709] Thu, 01 June 2017 14:19 Go to previous messageGo to next message
anil chalil is currently offline anil chalilFriend
Messages: 38
Registered: October 2010
Member
Here is the issue https://github.com/eclipse/xtext-extras/issues/145
Re: name may not be null xtext 2.12 [message #1764749 is a reply to message #1764710] Fri, 02 June 2017 05:35 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
does the workaround mentioned in the issue work for you?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:Terminal does not match a lowercase string
Next Topic:Interfaces and classes / types are proposed where only interfaces should be proposed
Goto Forum:
  


Current Time: Sun Nov 10 18:34:01 GMT 2024

Powered by FUDForum. Page generated in 0.04799 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top