From ae277a0ad7ea3f38701c9ea8fb0a24e11653a2d3 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 28 Jul 2015 18:52:16 +0300 Subject: [PATCH] Delete RemovableSlice and MutableSlicedMap.remove --- .../util/slicedMap/MutableSlicedMap.java | 2 -- .../kotlin/util/slicedMap/RemovableSlice.java | 21 ----------------- .../kotlin/util/slicedMap/SlicedMapImpl.java | 18 --------------- .../kotlin/util/slicedMap/Slices.java | 22 +++++------------- .../util/slicedMap/TrackingSlicedMap.java | 23 +++---------------- 5 files changed, 9 insertions(+), 77 deletions(-) delete mode 100644 compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/RemovableSlice.java diff --git a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/MutableSlicedMap.java b/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/MutableSlicedMap.java index 1f16928afd7..25abf102aeb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/MutableSlicedMap.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/MutableSlicedMap.java @@ -24,8 +24,6 @@ public interface MutableSlicedMap extends SlicedMap { void put(WritableSlice slice, K key, V value); - V remove(RemovableSlice slice, K key); - void clear(); @NotNull diff --git a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/RemovableSlice.java b/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/RemovableSlice.java deleted file mode 100644 index f15fc4853ab..00000000000 --- a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/RemovableSlice.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2010-2015 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 org.jetbrains.kotlin.util.slicedMap; - -public interface RemovableSlice extends WritableSlice { - -} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/SlicedMapImpl.java b/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/SlicedMapImpl.java index ac65c901ee3..4c86d9e2cfb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/SlicedMapImpl.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/SlicedMapImpl.java @@ -99,24 +99,6 @@ public class SlicedMapImpl implements MutableSlicedMap { return (Collection) collectiveSliceKeys.get(slice); } - @Override - public V remove(RemovableSlice slice, K key) { - UserDataHolderImpl holder = map.get(key); - - if (holder == null) return null; - - Key sliceKey = slice.getKey(); - V value = holder.getUserData(sliceKey); - - holder.putUserData(sliceKey, null); - - if (holder.isUserDataEmpty()) { - map.remove(key); - } - - return value; - } - @Override public void forEach(@NotNull Function3 f) { for (Map.Entry entry : map.entrySet()) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/Slices.java b/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/Slices.java index 68223383031..edc68fcccda 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/Slices.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/Slices.java @@ -86,17 +86,17 @@ public class Slices { return this; } - public RemovableSlice build() { - BasicRemovableSlice result = doBuild(); + public WritableSlice build() { + BasicWritableSlice result = doBuild(); if (debugName != null) { result.setDebugName(debugName); } return result; } - private BasicRemovableSlice doBuild() { + private BasicWritableSlice doBuild() { if (furtherLookupSlices != null) { - return new BasicRemovableSlice(rewritePolicy) { + return new BasicWritableSlice(rewritePolicy) { @Override public V computeValue(SlicedMap map, K key, V value, boolean valueNotFound) { if (valueNotFound) { @@ -112,21 +112,11 @@ public class Slices { } }; } - return new BasicRemovableSlice(rewritePolicy); + return new BasicWritableSlice(rewritePolicy); } } - public static class BasicRemovableSlice extends BasicWritableSlice implements RemovableSlice { - protected BasicRemovableSlice(RewritePolicy rewritePolicy) { - super(rewritePolicy); - } - - protected BasicRemovableSlice(RewritePolicy rewritePolicy, boolean isCollective) { - super(rewritePolicy, isCollective); - } - } - - public static class SetSlice extends BasicRemovableSlice { + public static class SetSlice extends BasicWritableSlice { protected SetSlice(RewritePolicy rewritePolicy) { this(rewritePolicy, false); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/TrackingSlicedMap.java b/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/TrackingSlicedMap.java index d1ab22f97a9..a23418ad04d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/TrackingSlicedMap.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/TrackingSlicedMap.java @@ -16,11 +16,9 @@ package org.jetbrains.kotlin.util.slicedMap; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import kotlin.jvm.functions.Function3; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.TestOnly; import org.jetbrains.kotlin.utils.Printer; import java.util.Collection; @@ -70,23 +68,6 @@ public class TrackingSlicedMap extends SlicedMapImpl { super.put(wrapSlice(slice), key, new TrackableValue(value, trackWithStackTraces)); } - @Override - public V remove(RemovableSlice slice, K key) { - return super.remove(wrapSlice(slice), key).value; - } - - @Override - public void clear() { - super.clear(); - } - - @Override - @NotNull - @TestOnly - public ImmutableMap getSliceContents(@NotNull ReadOnlySlice slice) { - return super.getSliceContents(slice); - } - private static class TrackableValue { private final static StackTraceElement[] EMPTY_STACK_TRACE = new StackTraceElement[0]; @@ -136,7 +117,9 @@ public class TrackingSlicedMap extends SlicedMapImpl { } } - private class SliceWithStackTrace extends AbstractWritableSlice> implements RemovableSlice> { + private class SliceWithStackTrace + extends AbstractWritableSlice> + implements WritableSlice> { private final ReadOnlySlice delegate;