From 065936319d79b06238ad13ebf375601740ce4aca Mon Sep 17 00:00:00 2001 From: Sebastian Zarnekow Date: Fri, 13 Nov 2015 10:19:41 +0100 Subject: [PATCH] [xtext][fragments] Fixed NPE in TokenUtil --- .../org/eclipse/xtext/parsetree/reconstr/impl/TokenUtil.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/parsetree/reconstr/impl/TokenUtil.java b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/parsetree/reconstr/impl/TokenUtil.java index 8f78b7a98..027fba9f7 100644 --- a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/parsetree/reconstr/impl/TokenUtil.java +++ b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/parsetree/reconstr/impl/TokenUtil.java @@ -9,7 +9,6 @@ package org.eclipse.xtext.parsetree.reconstr.impl; import java.util.List; -import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.AbstractRule; import org.eclipse.xtext.Action; @@ -53,9 +52,7 @@ public class TokenUtil { if (node.getParent().hasDirectSemanticElement()) return node.getParent().getSemanticElement(); EObject parentGrammarElement = node.getParent().getGrammarElement(); - boolean isParser = parentGrammarElement instanceof ParserRule - || (parentGrammarElement instanceof RuleCall && - ((RuleCall) parentGrammarElement).getRule().getType().getClassifier() instanceof EClass); + boolean isParser = GrammarUtil.isEObjectRule(parentGrammarElement) || GrammarUtil.isEObjectRuleCall(parentGrammarElement); for (INode sibling : node.getParent().getChildren()) if (sibling.hasDirectSemanticElement() && (isParser || sibling.getGrammarElement() instanceof Action)) return sibling.getSemanticElement();