diff --git a/platform/lang-api/src/com/intellij/psi/ForceableComparable.java b/platform/lang-api/src/com/intellij/psi/ForceableComparable.java new file mode 100644 index 000000000000..643b1c6debef --- /dev/null +++ b/platform/lang-api/src/com/intellij/psi/ForceableComparable.java @@ -0,0 +1,23 @@ +/* + * Copyright 2000-2011 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.psi; + +/** + * @author peter + */ +public interface ForceableComparable { + void force(); +} diff --git a/platform/lang-api/src/com/intellij/psi/WeighingComparable.java b/platform/lang-api/src/com/intellij/psi/WeighingComparable.java index 4fc1aac16d35..69b03fc2bb59 100644 --- a/platform/lang-api/src/com/intellij/psi/WeighingComparable.java +++ b/platform/lang-api/src/com/intellij/psi/WeighingComparable.java @@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable; /** * @author peter */ -public class WeighingComparable implements Comparable> { +public class WeighingComparable implements Comparable>, ForceableComparable { private static final Comparable NULL = new Comparable() { public int compareTo(final Object o) { throw new UnsupportedOperationException("Method compareTo is not yet implemented in " + getClass().getName()); @@ -45,8 +45,8 @@ public class WeighingComparable implements Comparable> implements Comparable { +public class NegatingComparable> implements Comparable, ForceableComparable { private final Comparable myWeigh; public NegatingComparable(Comparable weigh) { myWeigh = weigh; } + @Override + public void force() { + if (myWeigh instanceof ForceableComparable) { + ((ForceableComparable)myWeigh).force(); + } + } + @Override public int compareTo(T o) { final Comparable w1 = myWeigh; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/CachingComparingClassifier.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/CachingComparingClassifier.java index 56800dda1ae7..e83ce85c0855 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/CachingComparingClassifier.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/CachingComparingClassifier.java @@ -15,7 +15,7 @@ */ package com.intellij.codeInsight.lookup; -import com.intellij.psi.WeighingComparable; +import com.intellij.psi.ForceableComparable; import gnu.trove.THashMap; import gnu.trove.TObjectHashingStrategy; import org.jetbrains.annotations.NotNull; @@ -47,8 +47,8 @@ public class CachingComparingClassifier extends ComparingClassifier