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

Bug 367857

Summary: [xbase] CCE in validator
Product: [Modeling] TMF Reporter: Sebastian Zarnekow <sebastian.zarnekow>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sven.efftinge
Version: 2.3.0Flags: sebastian.zarnekow: juno+
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sebastian Zarnekow CLA 2012-01-04 10:12:49 EST
java.lang.ClassCastException: org.eclipse.xtext.common.types.impl.JvmOperationImpl cannot be cast to org.eclipse.xtext.common.types.JvmConstructor
	at org.eclipse.xtext.xbase.impl.XConstructorCallImpl.getConstructor(XConstructorCallImpl.java:150)
	at org.eclipse.xtext.xbase.validation.XbaseJavaValidator.checkInstantiationOfAbstractClass(XbaseJavaValidator.java:640)
	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)
Comment 1 Sebastian Zarnekow CLA 2012-01-04 10:22:24 EST
1) Input files in two open editors:


class XtendClass {
	new() {
		new Entity()
	}
}

===

entity Entity {}   

2) Edit the dmodel file with the entity and add an operation:

entity Entity {
  op name () : String {
    ""
  }
}

3) Hit save

The validator kicks in an revalidates the xtend class after it unloaded the referenced dmodel. Proxy resolution will lead to the CCE because of the index based URI fragments.
Comment 2 Sebastian Zarnekow CLA 2012-01-04 10:27:48 EST
Happens with two Xtend classes, too. Start with:

class OtherClass {
	def getName() {
		""
	}
}

class XtendClass {
	new() {
		new OtherClass()
	}
}

And add a constructor to OtherClass:

class OtherClass {
	def getName() {
		""
	}
	new () {
		
	}
}
Comment 3 Sven Efftinge CLA 2013-09-16 12:55:31 EDT
works now
Comment 4 Eclipse Webmaster CLA 2017-10-31 11:24:26 EDT
Requested via bug 522520.

-M.