Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Fix type reference in exception message (#5753)
Browse files Browse the repository at this point in the history
fixes #5744

Signed-off-by: Henning Treu <henning.treu@telekom.de>
  • Loading branch information
htreu authored and sjsf committed Jun 20, 2018
1 parent bdc3d00 commit 4f5afee
Showing 1 changed file with 9 additions and 4 deletions.
Expand Up @@ -35,6 +35,7 @@ import org.eclipse.xtext.xbase.XMemberFeatureCall
import org.eclipse.xtext.xbase.interpreter.IEvaluationContext
import org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter
import org.eclipse.xtext.xbase.jvmmodel.IJvmModelAssociations
import org.eclipse.xtext.xbase.typesystem.IBatchTypeResolver

/**
* The script interpreter handles ESH specific script components, which are not known
Expand All @@ -52,6 +53,9 @@ public class ScriptInterpreter extends XbaseInterpreter {

@Inject
StateAndCommandProvider stateAndCommandProvider

@Inject
private IBatchTypeResolver typeResolver;

@Inject
extension IJvmModelAssociations
Expand All @@ -61,7 +65,7 @@ public class ScriptInterpreter extends XbaseInterpreter {

// Check if the JvmField is inferred
val sourceElement = jvmField.sourceElements.head
if (sourceElement != null) {
if (sourceElement !== null) {
val value = context.getValue(QualifiedName.create(jvmField.simpleName))
value ?: {

Expand All @@ -77,11 +81,12 @@ public class ScriptInterpreter extends XbaseInterpreter {

override protected invokeFeature(JvmIdentifiableElement feature, XAbstractFeatureCall featureCall,
Object receiverObj, IEvaluationContext context, CancelIndicator indicator) {
if (feature != null && feature.eIsProxy) {
if (feature !== null && feature.eIsProxy) {
if (featureCall instanceof XMemberFeatureCall) {
val expression = featureCall.memberCallTarget;
val type = typeResolver.resolveTypes(expression)?.getActualType(expression)?.identifier;
throw new ScriptExecutionException(new ScriptError(
"'" + featureCall.getConcreteSyntaxFeatureName() + "' is not a member of '" +
receiverObj?.getClass()?.getName() + "'", featureCall));
"'" + featureCall.getConcreteSyntaxFeatureName() + "' is not a member of '" + type + "'", featureCall));
} else if (featureCall instanceof XFeatureCall) {
throw new ScriptExecutionException(new ScriptError(
"The name '" + featureCall.getConcreteSyntaxFeatureName() +
Expand Down

0 comments on commit 4f5afee

Please sign in to comment.