Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » ClassCastException during serialization
icon5.gif  ClassCastException during serialization [message #1717759] Wed, 16 December 2015 14:40 Go to next message
Jonathan Koscielny is currently offline Jonathan KoscielnyFriend
Messages: 14
Registered: August 2013
Junior Member
Dear community,

Xtext shows some very unexpected behaviour since I use Xbase to integrate my dsl with Java. I use Xbase only to import Java types and to resolve the references to Java types and Java Class representations of my dsl code. My problem is the following:

My dsl needs complex internal reference resolving, which means I have implemented my own ScopeProvide to resolve the references. This works very fine - as long as I do not serialize the model of any dsl file after manually loading and transforming it. The model transformation is triggered by the generator of a second dsl. the generation process is similar, but much more complex, to the following outline:

class Dsl2Generator implements IGenerator {

	@Inject
	private ISerializer serializer;

	override doGenerate(Resource r, IFileSystemAccess fsa) {

		// Do some configuration stuf

		// Manually loading resources from dsl1
		Map<String, Delta> m = new LinkedHashMap<String, Delta>();
		IResourceDescriptions descriptions = resourceDescriptionsProvider
				.getResourceDescriptions(r);
		Iterable<IResourceDescription> list = descriptions
				.getAllResourceDescriptions();
		for (IResourceDescription rd : list) {
			URI u = rd.getURI();
			if (u.fileExtension().equals("deltaj")) {
				Resource deltajResource = r.getResourceSet().getResource(u, true);
				Iterable<Delta> deltas = Iterables.<Delta> filter(IteratorExtensions.<EObject> toIterable(deltajResource.getAllContents()), Delta.class);
				for (Delta d : deltas) {
					m.put(d.getDName(), d);
				}
			}
		}

		// Performing some model transformation on the Delta elements
		Map<String, OutputmodelWrapper> outputModels = doModelTransformation();

		// Writing transformed models to file system
		// ...
		for (OutputmodelWrapper omw : outputModels) {
			String outputString = serializer.serialize(omw.getModel());
			// ...
		}
	}
}


But the serialization throws a following ClassCastException (see end of the post). My implemented ScopeProvider is in the stack trace of the exception (at org.deltaj.scoping.DeltaJScopeProvider.getScope(DeltaJScopeProvider.java:223)). Thus, I have taken a closer look to it and figured out that the exception has been thrown while the serializer asked the scope provider to provide a scope for a JvmTypeReference. My ScopeProvider only calculates the scope for references within elements of my language, all other references are resolved by calling super.getScope(context, reference).

My ScopeProvider is implemented with the following hierarchy:

Quote:

class DeltaJScopeProvider extends AbstractDeltaJScopeProvider { ... }

class AbstractDeltaJScopeProvider extends AbstractDeclarativeScopeProvider {

/** Name of the scope provider. */
public static val NAMED_DELEGATE = 'org.deltaj.scoping.scoping.DeltaJScopeProvider.delegate'

/** The delegate scope provider */
@Inject
@Named(NAMED_DELEGATE)
var IScopeProvider myDelegate

/** Sets the delegate */
override setDelegate(IScopeProvider delegate) {
myDelegate = delegate
}

/** Returns the delegate */
override getDelegate() {
myDelegate
}
}


To avoid the ClassCastException, I tried to return an Iscope.NULLSCOPE for any JvmTypeReference. Without a scope, the serialization succeeds, but I got the usual unresolved reference errors in the editor. I have absolutely no idea how to solve this problem!

Best,
Jonathan



java.lang.ClassCastException: org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider cannot be cast to org.eclipse.xtext.common.types.access.impl.ClasspathTypeProvider
	at org.eclipse.xtext.common.types.xtext.ClasspathBasedTypeScopeProvider.createTypeScope(ClasspathBasedTypeScopeProvider.java:35)
	at org.eclipse.xtext.common.types.xtext.ClasspathBasedTypeScopeProvider.createTypeScope(ClasspathBasedTypeScopeProvider.java:1)
	at org.eclipse.xtext.common.types.xtext.AbstractTypeScopeProvider.getScope(AbstractTypeScopeProvider.java:55)
	at org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider.getScope(TypesAwareDefaultGlobalScopeProvider.java:38)
	at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider.getGlobalScope(AbstractGlobalScopeDelegatingScopeProvider.java:46)
	at org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider.getGlobalScope(XImportSectionNamespaceScopeProvider.java:88)
	at org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider.getScope(XImportSectionNamespaceScopeProvider.java:82)
	at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegateGetScope(AbstractDeclarativeScopeProvider.java:72)
	at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.getScope(AbstractDeclarativeScopeProvider.java:104)
	at org.deltaj.scoping.DeltaJScopeProvider.getScope(DeltaJScopeProvider.java:223)
	at org.eclipse.xtext.xbase.scoping.batch.TypeScopes.createTypeScope(TypeScopes.java:59)
	at org.eclipse.xtext.xbase.scoping.batch.XbaseBatchScopeProvider.getScope(XbaseBatchScopeProvider.java:105)
	at org.eclipse.xtext.xbase.serializer.SerializerScopeProvider.getScope(SerializerScopeProvider.java:89)
	at org.eclipse.xtext.serializer.tokens.CrossReferenceSerializer.serializeCrossRef(CrossReferenceSerializer.java:86)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.getToken(SequenceFeeder.java:454)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:220)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:408)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.eclipse.xtext.xbase.serializer.AbstractXtypeSemanticSequencer.sequence_JvmParameterizedTypeReference(AbstractXtypeSemanticSequencer.java:128)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:739)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:408)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_MemberDeclaration1(DeltaJSemanticSequencer.java:2198)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:537)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:408)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_ClassBodyMemberDeclaration(DeltaJSemanticSequencer.java:1275)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:320)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:401)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_ClassBody(DeltaJSemanticSequencer.java:1284)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:317)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:408)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_ClassDeclaration(DeltaJSemanticSequencer.java:1321)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:329)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:408)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_ClassOrInterfaceDeclaration(DeltaJSemanticSequencer.java:1330)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:332)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:401)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_JavaCompilationUnit(DeltaJSemanticSequencer.java:2129)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:522)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:86)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:109)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:124)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:52)
	at org.deltaj.impl.ToString.valueOf(ToString.java:39)
	at org.deltaj.deltaJ.impl.JavaCompilationUnitImpl.toString(JavaCompilationUnitImpl.java:283)
	at org.deltaj.generator.util.GeneratedClassDeclaration.toString(GeneratedClassDeclaration.java:1446)
	at org.deltaj.spl.generator.DeltaJProductGenerator.generateProduct(DeltaJProductGenerator.java:61)
	at org.deltaj.spl.generator.SPLGenerator.lambda$2(SPLGenerator.java:69)
	at org.deltaj.spl.generator.SPLGenerator$$Lambda$15/2078233245.accept(Unknown Source)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at org.deltaj.spl.generator.SPLGenerator.lambda$0(SPLGenerator.java:71)
	at org.deltaj.spl.generator.SPLGenerator$$Lambda$13/340235387.accept(Unknown Source)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at org.deltaj.spl.generator.SPLGenerator.doGenerate(SPLGenerator.java:75)
	at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:524)
	at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:513)
	at org.eclipse.xtext.builder.BuilderParticipant.doGenerate(BuilderParticipant.java:498)
	at org.eclipse.xtext.builder.BuilderParticipant.doBuild(BuilderParticipant.java:263)
	at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:221)
	at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant$DeferredBuilderParticipant.build(RegistryBuilderParticipant.java:161)
	at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:69)
	at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:252)
	at org.eclipse.xtext.builder.impl.XtextBuilder.incrementalBuild(XtextBuilder.java:228)
	at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:123)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
java.lang.ClassCastException: org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider cannot be cast to org.eclipse.xtext.common.types.access.impl.ClasspathTypeProvider
	at org.eclipse.xtext.common.types.xtext.ClasspathBasedTypeScopeProvider.createTypeScope(ClasspathBasedTypeScopeProvider.java:35)
	at org.eclipse.xtext.common.types.xtext.ClasspathBasedTypeScopeProvider.createTypeScope(ClasspathBasedTypeScopeProvider.java:1)
	at org.eclipse.xtext.common.types.xtext.AbstractTypeScopeProvider.getScope(AbstractTypeScopeProvider.java:55)
	at org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider.getScope(TypesAwareDefaultGlobalScopeProvider.java:38)
	at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider.getGlobalScope(AbstractGlobalScopeDelegatingScopeProvider.java:46)
	at org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider.getGlobalScope(XImportSectionNamespaceScopeProvider.java:88)
	at org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider.getScope(XImportSectionNamespaceScopeProvider.java:82)
	at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegateGetScope(AbstractDeclarativeScopeProvider.java:72)
	at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.getScope(AbstractDeclarativeScopeProvider.java:104)
	at org.deltaj.scoping.DeltaJScopeProvider.getScope(DeltaJScopeProvider.java:233)
	at org.eclipse.xtext.xbase.scoping.batch.TypeScopes.createTypeScope(TypeScopes.java:59)
	at org.eclipse.xtext.xbase.scoping.batch.XbaseBatchScopeProvider.getScope(XbaseBatchScopeProvider.java:105)
	at org.eclipse.xtext.xbase.serializer.SerializerScopeProvider.getScope(SerializerScopeProvider.java:89)
	at org.eclipse.xtext.serializer.tokens.CrossReferenceSerializer.serializeCrossRef(CrossReferenceSerializer.java:86)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.getToken(SequenceFeeder.java:454)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:220)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:408)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.eclipse.xtext.xbase.serializer.AbstractXtypeSemanticSequencer.sequence_JvmParameterizedTypeReference(AbstractXtypeSemanticSequencer.java:128)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:739)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:408)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_MemberDeclaration1(DeltaJSemanticSequencer.java:2198)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:537)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:408)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_ClassBodyMemberDeclaration(DeltaJSemanticSequencer.java:1275)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:320)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:401)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_ClassBody(DeltaJSemanticSequencer.java:1284)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:317)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:408)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_ClassDeclaration(DeltaJSemanticSequencer.java:1321)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:329)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:408)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_ClassOrInterfaceDeclaration(DeltaJSemanticSequencer.java:1330)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:332)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:401)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:454)
	at org.deltaj.serializer.DeltaJSemanticSequencer.sequence_JavaCompilationUnit(DeltaJSemanticSequencer.java:2129)
	at org.deltaj.serializer.DeltaJSemanticSequencer.createSequence(DeltaJSemanticSequencer.java:522)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:86)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:109)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:124)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:52)
	at org.deltaj.impl.ToString.valueOf(ToString.java:39)
	at org.deltaj.deltaJ.impl.JavaCompilationUnitImpl.toString(JavaCompilationUnitImpl.java:283)
	at org.deltaj.generator.util.GeneratedClassDeclaration.toString(GeneratedClassDeclaration.java:1446)
	at org.deltaj.spl.generator.DeltaJProductGenerator.generateProduct(DeltaJProductGenerator.java:61)
	at org.deltaj.spl.generator.SPLGenerator.lambda$2(SPLGenerator.java:69)
	at org.deltaj.spl.generator.SPLGenerator$$Lambda$15/2078233245.accept(Unknown Source)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at org.deltaj.spl.generator.SPLGenerator.lambda$0(SPLGenerator.java:71)
	at org.deltaj.spl.generator.SPLGenerator$$Lambda$13/340235387.accept(Unknown Source)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at org.deltaj.spl.generator.SPLGenerator.doGenerate(SPLGenerator.java:75)
	at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:524)
	at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:513)
	at org.eclipse.xtext.builder.BuilderParticipant.doGenerate(BuilderParticipant.java:498)
	at org.eclipse.xtext.builder.BuilderParticipant.doBuild(BuilderParticipant.java:263)
	at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:221)
	at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant$DeferredBuilderParticipant.build(RegistryBuilderParticipant.java:161)
	at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:69)
	at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:252)
	at org.eclipse.xtext.builder.impl.XtextBuilder.incrementalBuild(XtextBuilder.java:228)
	at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:123)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Re: ClassCastException during serialization [message #1718281 is a reply to message #1717759] Tue, 22 December 2015 06:07 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
In Eclipse you should never end up using a ClasspathBasedTypeScopeProvider. Instead a JdtBasedSimpleTypeScopeProvider should be used.
Did you change any bindings in the UIModule that would bind the wrong scopeprovider here or do you even call a standalonesetup or crate another injector?
Re: ClassCastException during serialization [message #1718358 is a reply to message #1718281] Tue, 22 December 2015 21:11 Go to previous message
Jonathan Koscielny is currently offline Jonathan KoscielnyFriend
Messages: 14
Registered: August 2013
Junior Member
Hi Sven,

thanks for your answer. let me have a look at my code to answer your questions.

Sven Efftinge wrote on Tue, 22 December 2015 01:07

Did you change any bindings in the UIModule that would bind the wrong scopeprovider here

No, I only bind some highlighting and outline implementations in the UIModules of both languages.

Quote:
or do you even call a standalonesetup or crate another injector?

Maybe, I'm not sure. I use some EObject.toString() overriding like discribed in Jevopi's Developer Blog [1].

I use three different ScopeProviders in my language. They are bound like this:

	public void configureIScopeProviderDelegate(Binder binder) {
		binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeltaJScopeProvider.NAMED_DELEGATE))
				.to(DeltaJXImportSectionNamespaceScopeProvider.class);
	}

	public void configureIScopeProviderDelegate2(Binder binder) {
		binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
				.to(DeltaJScopeProvider.class);
	}
	
	public void configureClasspathBasedTypeScopeProvider(Binder binder) {
		binder.bind(ClasspathBasedTypeScopeProvider.class).to(DeltaJClasspathBasedTypeScopeProvider.class);
	}


I hacked a little bit within the ClasspathBasedTypeScopeProvider trying to overcome the exception - it didn't worked very well, but the model is serializable again.



[1] http://jevopisdeveloperblog.blogspot.de/2011/03/implement-tostring-with-xtexts.html
Previous Topic:Can XBase operate properly while generating a large number of classes?
Next Topic:Modifying Xtext Document renders Eclipse non-responsive
Goto Forum:
  


Current Time: Wed Aug 10 20:22:39 GMT 2022

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

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

Back to the top