Rename package jet -> kotlin in util, util-runtime

org.jetbrains.jet.config -> org.jetbrains.kotlin.config
org.jetbrains.jet.utils -> org.jetbrains.kotlin.utils

Also move coreLib.kt to package 'org.jetbrains.kotlin.utils'
This commit is contained in:
Alexander Udalov
2015-01-08 21:20:12 +03:00
parent 8ca803775f
commit f37e2f173d
222 changed files with 322 additions and 389 deletions
@@ -1,44 +0,0 @@
/*
* Copyright 2010-2013 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.jet.utils;
import java.util.BitSet;
public class BitSetUtils {
private BitSetUtils() {
}
public static int toInt(BitSet bitSet) {
int intValue = 0;
for (int bit = 0; bit < bitSet.length(); bit++) {
if (bitSet.get(bit)) {
intValue |= (1 << bit);
}
}
return intValue;
}
public static BitSet toBitSet(int value) {
BitSet bitSet = new BitSet();
int bit = 0;
while (value > 0) {
bitSet.set(bit++, value % 2 == 1);
value >>= 1;
}
return bitSet;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.config;
package org.jetbrains.kotlin.config;
public class IncrementalCompilation {
public static final boolean ENABLED = "true".equals(System.getProperty("kotlin.incremental.compilation"));
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.config
package org.jetbrains.kotlin.config
import java.util.HashMap
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
* 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.
@@ -14,12 +14,14 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils
package org.jetbrains.kotlin.utils
import kotlin.properties.ReadOnlyProperty
public class CachedValueProperty<TValue : Any, TTimestamp : Any>(private val calculator: () -> TValue,
private val timestampCalculator: () -> TTimestamp) : ReadOnlyProperty<Any?, TValue> {
public class CachedValueProperty<TValue : Any, TTimestamp : Any>(
private val calculator: () -> TValue,
private val timestampCalculator: () -> TTimestamp
) : ReadOnlyProperty<Any?, TValue> {
private var value: TValue? = null
private var timestamp: TTimestamp? = null
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils;
package org.jetbrains.kotlin.utils;
import com.intellij.util.containers.hash.EqualityPolicy;
import com.intellij.util.containers.hash.LinkedHashMap;
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
* 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.
@@ -14,6 +14,6 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils
package org.jetbrains.kotlin.utils
public class KotlinFrontEndException(message: String, cause: Throwable) : RuntimeException(message, cause)
public class KotlinFrontEndException(message: String, cause: Throwable) : RuntimeException(message, cause)
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils;
package org.jetbrains.kotlin.utils;
import org.jetbrains.annotations.NotNull;
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils;
package org.jetbrains.kotlin.utils;
import org.jetbrains.annotations.NotNull;
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils;
package org.jetbrains.kotlin.utils;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils
package org.jetbrains.kotlin.utils
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.util.io.FileUtil
@@ -237,4 +237,4 @@ public object LibraryUtils {
return value
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils;
package org.jetbrains.kotlin.utils;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils;
package org.jetbrains.kotlin.utils;
import com.intellij.openapi.diagnostic.Logger;
import org.apache.log4j.Level;
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils;
package org.jetbrains.kotlin.utils;
import com.intellij.openapi.diagnostic.Logger;
import org.jetbrains.annotations.NotNull;
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils;
package org.jetbrains.kotlin.utils;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils;
package org.jetbrains.kotlin.utils;
import org.jetbrains.annotations.NotNull;
@@ -26,11 +26,12 @@ public class ThrowingList<E> extends AbstractList<E> {
private ThrowingList() {}
@NotNull
@SuppressWarnings("unchecked")
public static <E> ThrowingList<E> instance() {
//noinspection unchecked
return (ThrowingList<E>) INSTANCE;
}
@NotNull
@Override
public E get(int index) {
throw new UnsupportedOperationException(getClass().getName());
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils.addToStdlib
package org.jetbrains.kotlin.utils.addToStdlib
import java.util.HashMap
import java.util.Collections
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils.concurrent.block
package org.jetbrains.kotlin.utils.concurrent.block
public class LockedClearableLazyValue<T: Any>(val lock: Any, val init: () -> T) {
private volatile var value: T? = null
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* 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.
@@ -14,11 +14,10 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils.fileUtils
package org.jetbrains.kotlin.utils.fileUtils
import java.io.File
// TODO: move to stdlib as:
// public fun File?.readTextOrEmpty(encoding: String = Charset.defaultCharset().name()): String = this?.readText(encoding) ?: ""
public fun File?.readTextOrEmpty() : String = this?.readText() ?: ""
public fun File?.readTextOrEmpty(): String = this?.readText() ?: ""
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils.intellij
package org.jetbrains.kotlin.utils.intellij
import com.intellij.openapi.util.Pair
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.jet.utils.strings
package org.jetbrains.kotlin.utils.strings
import com.intellij.openapi.util.text.StringUtil