removing unused code

This commit is contained in:
Eugene Zhuravlev
2015-03-03 10:37:40 +01:00
parent d5b59bf605
commit 6d1de21b40
8 changed files with 6 additions and 467 deletions
@@ -1,65 +0,0 @@
/*
* Copyright 2000-2012 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.jps.builders.java.dependencyView;
import gnu.trove.TIntIntProcedure;
import java.io.PrintStream;
/**
* @author: db
* Date: 04.11.11
*/
abstract class IntIntMaplet implements Streamable {
abstract boolean containsKey(final int key);
abstract int get(final int key);
abstract void put(final int key, final int value);
abstract void putAll(IntIntMaplet m);
abstract void remove(final int key);
abstract void close();
abstract void forEachEntry(TIntIntProcedure proc);
abstract void flush(boolean memoryCachesOnly);
public void toStream(final DependencyContext context, final PrintStream stream) {
final OrderProvider op = new OrderProvider(context);
forEachEntry(new TIntIntProcedure() {
@Override
public boolean execute(final int a, final int b) {
op.register(a);
return true;
}
});
final int[] keys = op.get();
for (final int a : keys) {
final int b = get(a);
stream.print(" ");
stream.print(context.getValue(a));
stream.print(" -> ");
stream.println(context.getValue(b));
}
}
}
@@ -1,71 +0,0 @@
/*
* Copyright 2000-2012 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.jps.builders.java.dependencyView;
import gnu.trove.TIntIntHashMap;
import gnu.trove.TIntIntProcedure;
/**
* @author: db
* Date: 05.11.11
*/
public class IntIntTransientMaplet extends IntIntMaplet {
private final TIntIntHashMap myMap = new TIntIntHashMap();
@Override
public boolean containsKey(final int key) {
return myMap.containsKey(key);
}
@Override
public int get(final int key) {
return myMap.get(key);
}
@Override
public void put(final int key, final int value) {
myMap.put(key, value);
}
@Override
public void putAll(final IntIntMaplet m) {
m.forEachEntry(new TIntIntProcedure() {
@Override
public boolean execute(int key, int value) {
myMap.put(key, value);
return true;
}
});
}
@Override
public void remove(final int key) {
myMap.remove(key);
}
@Override
public void close() {
myMap.clear();
}
public void flush(boolean memoryCachesOnly) {
}
@Override
public void forEachEntry(TIntIntProcedure proc) {
myMap.forEachEntry(proc);
}
}
@@ -1,66 +0,0 @@
/*
* Copyright 2000-2012 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.jps.builders.java.dependencyView;
import gnu.trove.TIntObjectProcedure;
import java.io.PrintStream;
/**
* @author: db
* Date: 04.11.11
*/
abstract class IntObjectMaplet<V> implements Streamable {
abstract boolean containsKey(final int key);
abstract V get(final int key);
abstract void put(final int key, final V value);
abstract void putAll(IntObjectMaplet<V> m);
abstract void remove(final int key);
abstract void close();
abstract void forEachEntry(TIntObjectProcedure<V> proc);
abstract void flush(boolean memoryCachesOnly);
public void toStream(final DependencyContext context, final PrintStream stream) {
final OrderProvider op = new OrderProvider(context);
forEachEntry(new TIntObjectProcedure<V>() {
@Override
public boolean execute(final int a, final V b) {
op.register(a);
return true;
}
});
final int[] keys = op.get();
for (final int a : keys) {
final V b = get(a);
stream.print(" ");
stream.print(context.getValue(a));
stream.print(" -> ");
stream.print(b.toString());
}
}
}
@@ -1,155 +0,0 @@
/*
* Copyright 2000-2014 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.jps.builders.java.dependencyView;
import com.intellij.util.Processor;
import com.intellij.util.containers.SLRUCache;
import com.intellij.util.io.DataExternalizer;
import com.intellij.util.io.IntInlineKeyDescriptor;
import com.intellij.util.io.PersistentHashMap;
import gnu.trove.TIntObjectProcedure;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
import java.io.File;
import java.io.IOException;
/**
* @author Eugene Zhuravlev
* Date: 9/10/12
*/
public class IntObjectPersistentMaplet<V> extends IntObjectMaplet<V>{
private static final Object NULL_OBJ = new Object();
private static final int CACHE_SIZE = 512;
private final PersistentHashMap<Integer, V> myMap;
private final SLRUCache<Integer, Object> myCache;
public IntObjectPersistentMaplet(final File file, final DataExternalizer<V> externalizer) {
try {
myMap = new PersistentHashMap<Integer, V>(file, new IntInlineKeyDescriptor(), externalizer);
myCache = new SLRUCache<Integer, Object>(CACHE_SIZE, CACHE_SIZE) {
@NotNull
@Override
public Object createValue(Integer key) {
try {
final V v1 = myMap.get(key);
return v1 == null? NULL_OBJ : v1;
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
};
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
@Override
public boolean containsKey(final int key) {
try {
return myMap.containsMapping(key);
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
@Override
public V get(final int key) {
final Object obj = myCache.get(key);
return obj == NULL_OBJ? null : (V)obj;
}
@Override
public void put(final int key, final V value) {
try {
myCache.remove(key);
myMap.put(key, value);
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
@Override
public void putAll(final IntObjectMaplet<V> m) {
m.forEachEntry(new TIntObjectProcedure<V>() {
@Override
public boolean execute(int key, V value) {
put(key, value);
return true;
}
});
}
@Override
public void remove(final int key) {
try {
myCache.remove(key);
myMap.remove(key);
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
@Override
public void close() {
try {
myCache.clear();
myMap.close();
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
@Override
public void flush(boolean memoryCachesOnly) {
if (memoryCachesOnly) {
if (myMap.isDirty()) {
myMap.dropMemoryCaches();
}
}
else {
myMap.force();
}
}
@Override
public void forEachEntry(final TIntObjectProcedure<V> proc) {
try {
myMap.processKeysWithExistingMapping(new Processor<Integer>() {
@Override
public boolean process(Integer key) {
try {
final V value = myMap.get(key);
return proc.execute(key, value);
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
});
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
}
@@ -1,71 +0,0 @@
/*
* Copyright 2000-2012 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.jps.builders.java.dependencyView;
import gnu.trove.TIntObjectHashMap;
import gnu.trove.TIntObjectProcedure;
/**
* @author Eugene Zhuravlev
* Date: 9/10/12
*/
public class IntObjectTransientMaplet<V> extends IntObjectMaplet<V>{
private final TIntObjectHashMap<V> myMap = new TIntObjectHashMap<V>();
@Override
boolean containsKey(int key) {
return myMap.containsKey(key);
}
@Override
V get(int key) {
return myMap.get(key);
}
@Override
void put(int key, V value) {
myMap.put(key, value);
}
@Override
void putAll(IntObjectMaplet<V> m) {
m.forEachEntry(new TIntObjectProcedure<V>() {
@Override
public boolean execute(int key, V value) {
myMap.put(key, value);
return true;
}
});
}
@Override
void remove(int key) {
myMap.remove(key);
}
@Override
void close() {
myMap.clear();
}
@Override
void forEachEntry(TIntObjectProcedure<V> proc) {
myMap.forEachEntry(proc);
}
@Override
void flush(boolean memoryCachesOnly) {
}
}
@@ -889,18 +889,6 @@ public class Mappings {
}
public interface DependentFilesFilter {
DependentFilesFilter ALL_FILES = new DependentFilesFilter() {
@Override
public boolean accept(File file) {
return true;
}
@Override
public boolean belongsToCurrentTargetChunk(File file) {
return true;
}
};
boolean accept(File file);
boolean belongsToCurrentTargetChunk(File file);
@@ -25,7 +25,6 @@ import org.jetbrains.org.objectweb.asm.Type;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
@@ -159,7 +158,6 @@ class TypeRepr {
public static class ClassType implements AbstractType {
public final int className;
public final AbstractType[] typeArgs;
@Override
public String getDescr(final DependencyContext context) {
@@ -173,23 +171,11 @@ class TypeRepr {
ClassType(final int className) {
this.className = className;
typeArgs = EMPTY_TYPE_ARRAY;
}
ClassType(final DependencyContext context, final DataInput in) {
ClassType(final DataInput in) {
try {
className = DataInputOutputUtil.readINT(in);
final int size = DataInputOutputUtil.readINT(in);
if (size == 0) {
typeArgs = EMPTY_TYPE_ARRAY;
}
else {
typeArgs = new AbstractType[size];
final DataExternalizer<AbstractType> externalizer = externalizer(context);
for (int i = 0; i < size; i++) {
typeArgs[i] = externalizer.read(in);
}
}
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
@@ -201,19 +187,16 @@ class TypeRepr {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final ClassType classType = (ClassType)o;
ClassType type = (ClassType)o;
if (className != classType.className) return false;
if (!Arrays.equals(typeArgs, classType.typeArgs)) return false;
if (className != type.className) return false;
return true;
}
@Override
public int hashCode() {
int result = className;
result = 31 * result + (typeArgs != null ? Arrays.hashCode(typeArgs) : 0);
return result;
return className;
}
@Override
@@ -221,10 +204,6 @@ class TypeRepr {
try {
out.writeByte(CLASS_TYPE);
DataInputOutputUtil.writeINT(out, className);
DataInputOutputUtil.writeINT(out, typeArgs.length);
for (AbstractType t : typeArgs) {
t.save(out);
}
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
@@ -299,7 +278,7 @@ class TypeRepr {
break loop;
case CLASS_TYPE:
elementType = context.getType(new ClassType(context, in));
elementType = context.getType(new ClassType(in));
break loop;
case ARRAY_TYPE:
@@ -42,7 +42,7 @@ import java.util.concurrent.ConcurrentMap;
* Date: 10/7/11
*/
public class BuildDataManager implements StorageOwner {
private static final int VERSION = 26;
private static final int VERSION = 27;
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.storage.BuildDataManager");
private static final String SRC_TO_FORM_STORAGE = "src-form";
private static final String OUT_TARGET_STORAGE = "out-target";