Merge remote-tracking branch 'origin/master' into idea14

Conflicts:
	update_dependencies.xml
This commit is contained in:
Nikolay Krasko
2014-06-27 14:44:05 +04:00
252 changed files with 1663 additions and 1096 deletions
@@ -270,7 +270,7 @@ package packageForDebugger
!FUNCTION!
"""
private val packageInternalName = PackageClassUtils.getPackageClassFqName(FqName("packageForDebugger")).asString().replace(".", "/")
private val packageInternalName = PackageClassUtils.getPackageClassInternalName(FqName("packageForDebugger"))
private fun createFileForDebugger(codeFragment: JetCodeFragment,
extractedFunction: JetNamedFunction
@@ -229,18 +229,28 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
}
private static String composeTooltipString(@NotNull DeclarationDescriptor declarationDescriptor, @NotNull AnnotationDescriptor descriptor) {
return "'" + getDescriptorString(declarationDescriptor) + "' is deprecated. " + getMessageFromAnnotationDescriptor(descriptor);
String fact = "'" + getDescriptorString(declarationDescriptor) + "' is deprecated.";
String message = getMessageFromAnnotationDescriptor(descriptor);
return message == null ? fact : fact + " " + message;
}
@Nullable
private static String getMessageFromAnnotationDescriptor(@NotNull AnnotationDescriptor descriptor) {
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(descriptor.getType());
assert classDescriptor != null : "ClassDescriptor for kotlin.deprecated mustn't be null";
ValueParameterDescriptor parameter =
DescriptorResolverUtils.getAnnotationParameterByName(DEFAULT_ANNOTATION_MEMBER_NAME, classDescriptor);
assert parameter != null : "kotlin.deprecated must have one parameter called value";
CompileTimeConstant<?> valueArgument = descriptor.getValueArgument(parameter);
assert valueArgument != null : "kotlin.deprecated must have value argument";
return (String) valueArgument.getValue();
if (classDescriptor != null) {
ValueParameterDescriptor parameter =
DescriptorResolverUtils.getAnnotationParameterByName(DEFAULT_ANNOTATION_MEMBER_NAME, classDescriptor);
if (parameter != null) {
CompileTimeConstant<?> valueArgument = descriptor.getValueArgument(parameter);
if (valueArgument != null) {
Object value = valueArgument.getValue();
if (value instanceof String) {
return String.valueOf(value);
}
}
}
}
return null;
}
private static String getDescriptorString(@NotNull DeclarationDescriptor descriptor) {
@@ -29,6 +29,7 @@ import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
import org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinder;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFqName;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFqNameSafe;
@@ -113,7 +114,7 @@ public final class DecompiledNavigationUtils {
}
if (containerDescriptor instanceof ClassDescriptor) {
if (containerDescriptor.getContainingDeclaration() instanceof ClassDescriptor
|| DescriptorUtils.isLocal(containerDescriptor.getContainingDeclaration(), containerDescriptor)) {
|| ExpressionTypingUtils.isLocal(containerDescriptor.getContainingDeclaration(), containerDescriptor)) {
return getContainerFqName(containerDescriptor.getContainingDeclaration());
}
return getFqNameSafe(containerDescriptor);
@@ -0,0 +1,11 @@
deprecated(<error>)</error>
fun foo() {}
deprecated(<error>false</error>)
fun boo() {}
fun far() = <warning descr="'fun foo()' is deprecated.">foo</warning>()
fun bar() = <warning descr="'fun boo()' is deprecated.">boo</warning>()
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
@@ -16,14 +16,17 @@
package org.jetbrains.jet.findUsages;
import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestSuite;
import java.io.File;
import java.util.regex.Pattern;
import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.test.InnerTestClasses;
import org.jetbrains.jet.test.TestMetadata;
import java.io.File;
import java.util.regex.Pattern;
import org.jetbrains.jet.findUsages.AbstractJetFindUsagesTest;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@@ -108,6 +108,11 @@ public class HighlightingTestGenerated extends AbstractHighlightingTest {
doTest("idea/testData/highlighter/deprecated/Inc.kt");
}
@TestMetadata("Invalid.kt")
public void testInvalid() throws Exception {
doTest("idea/testData/highlighter/deprecated/Invalid.kt");
}
@TestMetadata("Invoke.kt")
public void testInvoke() throws Exception {
doTest("idea/testData/highlighter/deprecated/Invoke.kt");