diff options
| author | Zoltan Ujhelyi | 2017-09-12 13:46:31 +0000 |
|---|---|---|
| committer | Zoltan Ujhelyi | 2017-09-15 13:39:36 +0000 |
| commit | 59b79a88de697b854f8163a2766be52e52a09cde (patch) | |
| tree | c7d17b1efed9db9d09c58410508fb1f1de6c4964 | |
| parent | 8c4cc3dcb5d262d0995e5f6bdbef3651c717b188 (diff) | |
| download | org.eclipse.viatra-59b79a88de697b854f8163a2766be52e52a09cde.tar.gz org.eclipse.viatra-59b79a88de697b854f8163a2766be52e52a09cde.tar.xz org.eclipse.viatra-59b79a88de697b854f8163a2766be52e52a09cde.zip | |
[469149] Do not try to index non-enumerable types
Change-Id: Idf1216c7ef9ca1d93939af1926179ad1f17061ab
Signed-off-by: Zoltan Ujhelyi <ujhelyiz@incquerylabs.com>
3 files changed, 9 insertions, 8 deletions
diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/matcher/integration/AbstractLocalSearchResultProvider.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/matcher/integration/AbstractLocalSearchResultProvider.java index 00745f444..6607d680a 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/matcher/integration/AbstractLocalSearchResultProvider.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/matcher/integration/AbstractLocalSearchResultProvider.java @@ -321,7 +321,9 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP @Override public Void call() throws Exception { for(IInputKey key : keys){ - qrc.ensureIndexed(key, IndexingService.INSTANCES); + if (key.isEnumerable()) { + qrc.ensureIndexed(key, IndexingService.INSTANCES); + } } return null; } diff --git a/query/plugins/org.eclipse.viatra.query.runtime.matchers/src/org/eclipse/viatra/query/runtime/matchers/context/IQueryRuntimeContext.java b/query/plugins/org.eclipse.viatra.query.runtime.matchers/src/org/eclipse/viatra/query/runtime/matchers/context/IQueryRuntimeContext.java index 36bf219bc..6d1653376 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.matchers/src/org/eclipse/viatra/query/runtime/matchers/context/IQueryRuntimeContext.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.matchers/src/org/eclipse/viatra/query/runtime/matchers/context/IQueryRuntimeContext.java @@ -50,7 +50,7 @@ public interface IQueryRuntimeContext { /** * Returns true if index is available for the given key providing the given service. - * + * @throws IllegalArgumentException if key is not enumerable or an unknown type, see {@link IQueryMetaContext#isEnumerable(IInputKey)}. * @since 1.4 */ public boolean isIndexed(IInputKey key, IndexingService service); @@ -58,6 +58,7 @@ public interface IQueryRuntimeContext { /** * @return true iff the given input key is already indexed, and contents are available without costly model traversal. * @deprecated use {@link #isIndexed(IInputKey, IndexingService)} instead + * @throws IllegalArgumentException if key is not enumerable or an unknown type, see {@link IQueryMetaContext#isEnumerable(IInputKey)}. */ @Deprecated public boolean isIndexed(IInputKey key); @@ -72,7 +73,7 @@ public interface IQueryRuntimeContext { * and service will be guaranteed to return the requested or a highing indexing level as soon as {@link #isCoalescing()} first returns false. * * <p><b>Precondition:</b> the given key is enumerable, see {@link IQueryMetaContext#isEnumerable(IInputKey)}. - * @throws IllegalArgumentException if key is not enumerable, see {@link IQueryMetaContext#isEnumerable(IInputKey)}. + * @throws IllegalArgumentException if key is not enumerable or an unknown type, see {@link IQueryMetaContext#isEnumerable(IInputKey)}. * @since 1.4 */ public void ensureIndexed(IInputKey key, IndexingService service); @@ -86,7 +87,7 @@ public interface IQueryRuntimeContext { * will be guaranteed to return true as soon as {@link #isCoalescing()} first returns false. * * <p><b>Precondition:</b> the given key is enumerable, see {@link IQueryMetaContext#isEnumerable(IInputKey)}. - * @throws IllegalArgumentException if key is not enumerable, see {@link IQueryMetaContext#isEnumerable(IInputKey)}. + * @throws IllegalArgumentException if key is not enumerable or an unknown type, see {@link IQueryMetaContext#isEnumerable(IInputKey)}. * * @deprecated use ensureIndexed(IInputKey, IndexingServices) instead */ diff --git a/query/plugins/org.eclipse.viatra.query.runtime/src/org/eclipse/viatra/query/runtime/emf/EMFQueryRuntimeContext.java b/query/plugins/org.eclipse.viatra.query.runtime/src/org/eclipse/viatra/query/runtime/emf/EMFQueryRuntimeContext.java index e3d85e5dd..53b82d483 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime/src/org/eclipse/viatra/query/runtime/emf/EMFQueryRuntimeContext.java +++ b/query/plugins/org.eclipse.viatra.query.runtime/src/org/eclipse/viatra/query/runtime/emf/EMFQueryRuntimeContext.java @@ -154,10 +154,8 @@ public class EMFQueryRuntimeContext extends AbstractQueryRuntimeContext { * @since 1.4 */ protected EnumSet<IndexingService> getCurrentIndexingServiceFor(IInputKey key){ - ensureValidKey(key); - if (!key.isEnumerable()) { - return EnumSet.noneOf(IndexingService.class); - } else if (key instanceof EClassTransitiveInstancesKey) { + ensureEnumerableKey(key); + if (key instanceof EClassTransitiveInstancesKey) { EClass eClass = ((EClassTransitiveInstancesKey) key).getEmfKey(); EnumSet<IndexingService> is = indexedClasses.get(eClass); return is == null ? EnumSet.noneOf(IndexingService.class) : is; |
