Implement quickfixes for Android Lint api issues

#KT-16624 Fixed
#KT-16625 Fixed
#KT-14947 Fixed
This commit is contained in:
Vyacheslav Gerasimov
2017-03-03 16:12:54 +03:00
parent a907ec92b5
commit 1376c8f8cf
178 changed files with 1307 additions and 221 deletions
@@ -24,10 +24,10 @@ import org.jetbrains.kotlin.allopen.AbstractBytecodeListingTestForAllOpen
import org.jetbrains.kotlin.android.*
import org.jetbrains.kotlin.android.configure.AbstractConfigureProjectTest
import org.jetbrains.kotlin.android.folding.AbstractAndroidResourceFoldingTest
import org.jetbrains.kotlin.android.intentions.AbstractAndroidIntentionTest
import org.jetbrains.kotlin.android.intentions.AbstractAndroidResourceIntentionTest
import org.jetbrains.kotlin.android.quickfix.AbstractAndroidLintQuickfixTest
import org.jetbrains.kotlin.android.intention.AbstractAndroidResourceIntentionTest
import org.jetbrains.kotlin.android.lint.AbstractKotlinLintTest
import org.jetbrains.kotlin.android.quickfixes.AbstractAndroidQuickFixMultiFileTest
import org.jetbrains.kotlin.android.quickfix.AbstractAndroidQuickFixMultiFileTest
import org.jetbrains.kotlin.annotation.AbstractAnnotationProcessorBoxTest
import org.jetbrains.kotlin.annotation.processing.test.sourceRetention.AbstractBytecodeListingTestForSourceRetention
import org.jetbrains.kotlin.annotation.processing.test.wrappers.AbstractAnnotationProcessingTest
@@ -1209,7 +1209,7 @@ fun main(args: Array<String>) {
}
testClass<AbstractAndroidResourceIntentionTest> {
model("android/resourceIntentions", extension = "test", singleClass = true)
model("android/resourceIntention", extension = "test", singleClass = true)
}
testClass<AbstractAndroidQuickFixMultiFileTest> {
@@ -1220,8 +1220,8 @@ fun main(args: Array<String>) {
model("android/lint", excludeParentDirs = true)
}
testClass<AbstractAndroidIntentionTest> {
model("android/intentions", pattern = "^([\\w\\-_]+)\\.kt$")
testClass<AbstractAndroidLintQuickfixTest> {
model("android/lintQuickfix", pattern = "^([\\w\\-_]+)\\.kt$")
}
testClass<AbstractAndroidResourceFoldingTest> {
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.kotlin.android.intentions
package org.jetbrains.kotlin.android.intention
import com.intellij.openapi.util.Key
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.kotlin.android.intentions
package org.jetbrains.kotlin.android.intention
import com.android.resources.ResourceType
import com.intellij.CommonBundle
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.kotlin.android.intentions
package org.jetbrains.kotlin.android.intention
import com.android.SdkConstants
import com.google.gson.JsonObject
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.kotlin.android.intentions;
package org.jetbrains.kotlin.android.intention;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
@@ -28,131 +28,131 @@ import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("idea/testData/android/resourceIntentions")
@TestMetadata("idea/testData/android/resourceIntention")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class AndroidResourceIntentionTestGenerated extends AbstractAndroidResourceIntentionTest {
public void testAllFilesPresentInResourceIntentions() throws Exception {
KotlinTestUtils.assertAllTestsPresentInSingleGeneratedClass(this.getClass(), new File("idea/testData/android/resourceIntentions"), Pattern.compile("^(.+)\\.test$"), TargetBackend.ANY);
public void testAllFilesPresentInResourceIntention() throws Exception {
KotlinTestUtils.assertAllTestsPresentInSingleGeneratedClass(this.getClass(), new File("idea/testData/android/resourceIntention"), Pattern.compile("^(.+)\\.test$"), TargetBackend.ANY);
}
@TestMetadata("createColorValueResource/alreadyExists/alreadyExists.test")
public void testCreateColorValueResource_alreadyExists_AlreadyExists() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createColorValueResource/alreadyExists/alreadyExists.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createColorValueResource/alreadyExists/alreadyExists.test");
doTest(fileName);
}
@TestMetadata("createColorValueResource/simpleFunction/simpleFunction.test")
public void testCreateColorValueResource_simpleFunction_SimpleFunction() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createColorValueResource/simpleFunction/simpleFunction.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createColorValueResource/simpleFunction/simpleFunction.test");
doTest(fileName);
}
@TestMetadata("createLayoutResourceFile/alreadyExists/alreadyExists.test")
public void testCreateLayoutResourceFile_alreadyExists_AlreadyExists() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createLayoutResourceFile/alreadyExists/alreadyExists.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createLayoutResourceFile/alreadyExists/alreadyExists.test");
doTest(fileName);
}
@TestMetadata("createLayoutResourceFile/simpleFunction/simpleFunction.test")
public void testCreateLayoutResourceFile_simpleFunction_SimpleFunction() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createLayoutResourceFile/simpleFunction/simpleFunction.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createLayoutResourceFile/simpleFunction/simpleFunction.test");
doTest(fileName);
}
@TestMetadata("createStringValueResource/alreadyExists/alreadyExists.test")
public void testCreateStringValueResource_alreadyExists_AlreadyExists() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createStringValueResource/alreadyExists/alreadyExists.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createStringValueResource/alreadyExists/alreadyExists.test");
doTest(fileName);
}
@TestMetadata("createStringValueResource/simpleFunction/simpleFunction.test")
public void testCreateStringValueResource_simpleFunction_SimpleFunction() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createStringValueResource/simpleFunction/simpleFunction.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createStringValueResource/simpleFunction/simpleFunction.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/activityExtension/activityExtension.test")
public void testKotlinAndroidAddStringResource_activityExtension_ActivityExtension() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/activityExtension/activityExtension.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/activityExtension/activityExtension.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/activityMethod/activityMethod.test")
public void testKotlinAndroidAddStringResource_activityMethod_ActivityMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/activityMethod/activityMethod.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/activityMethod/activityMethod.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/classInActivity/classInActivity.test")
public void testKotlinAndroidAddStringResource_classInActivity_ClassInActivity() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/classInActivity/classInActivity.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/classInActivity/classInActivity.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/extensionLambda/extensionLambda.test")
public void testKotlinAndroidAddStringResource_extensionLambda_ExtensionLambda() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/extensionLambda/extensionLambda.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/extensionLambda/extensionLambda.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/function/function.test")
public void testKotlinAndroidAddStringResource_function_Function() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/function/function.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/function/function.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/genericContextExtensionFunction/genericContextExtensionFunction.test")
public void testKotlinAndroidAddStringResource_genericContextExtensionFunction_GenericContextExtensionFunction() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/genericContextExtensionFunction/genericContextExtensionFunction.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/genericContextExtensionFunction/genericContextExtensionFunction.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/innerClassInActivity/innerClassInActivity.test")
public void testKotlinAndroidAddStringResource_innerClassInActivity_InnerClassInActivity() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/innerClassInActivity/innerClassInActivity.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/innerClassInActivity/innerClassInActivity.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/innerViewInActivity/innerViewInActivity.test")
public void testKotlinAndroidAddStringResource_innerViewInActivity_InnerViewInActivity() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/innerViewInActivity/innerViewInActivity.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/innerViewInActivity/innerViewInActivity.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/objectInActivity/objectInActivity.test")
public void testKotlinAndroidAddStringResource_objectInActivity_ObjectInActivity() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/objectInActivity/objectInActivity.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/objectInActivity/objectInActivity.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/objectInActivityMethod/objectInActivityMethod.test")
public void testKotlinAndroidAddStringResource_objectInActivityMethod_ObjectInActivityMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/objectInActivityMethod/objectInActivityMethod.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/objectInActivityMethod/objectInActivityMethod.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/objectInFunction/objectInFunction.test")
public void testKotlinAndroidAddStringResource_objectInFunction_ObjectInFunction() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/objectInFunction/objectInFunction.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/objectInFunction/objectInFunction.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/stringTemplate/stringTemplate.test")
public void testKotlinAndroidAddStringResource_stringTemplate_StringTemplate() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/stringTemplate/stringTemplate.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/stringTemplate/stringTemplate.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/viewExtensionActivityMethod/viewExtensionActivityMethod.test")
public void testKotlinAndroidAddStringResource_viewExtensionActivityMethod_ViewExtensionActivityMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/viewExtensionActivityMethod/viewExtensionActivityMethod.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/viewExtensionActivityMethod/viewExtensionActivityMethod.test");
doTest(fileName);
}
@TestMetadata("kotlinAndroidAddStringResource/viewMethod/viewMethod.test")
public void testKotlinAndroidAddStringResource_viewMethod_ViewMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/viewMethod/viewMethod.test");
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/viewMethod/viewMethod.test");
doTest(fileName);
}
}
@@ -1,101 +0,0 @@
/*
* Copyright 2010-2017 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.android.intentions;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("idea/testData/android/intentions")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class AndroidIntentionTestGenerated extends AbstractAndroidIntentionTest {
public void testAllFilesPresentInIntentions() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/intentions"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("idea/testData/android/intentions/suppressLint")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SuppressLint extends AbstractAndroidIntentionTest {
@TestMetadata("activityMethod.kt")
public void testActivityMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/activityMethod.kt");
doTest(fileName);
}
@TestMetadata("addToExistingAnnotation.kt")
public void testAddToExistingAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/addToExistingAnnotation.kt");
doTest(fileName);
}
public void testAllFilesPresentInSuppressLint() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/intentions/suppressLint"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("constructorParameter.kt")
public void testConstructorParameter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/constructorParameter.kt");
doTest(fileName);
}
@TestMetadata("destructuringDeclaration.kt")
public void testDestructuringDeclaration() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/destructuringDeclaration.kt");
doTest(fileName);
}
@TestMetadata("lambdaArgument.kt")
public void testLambdaArgument() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/lambdaArgument.kt");
doTest(fileName);
}
@TestMetadata("lambdaArgumentProperty.kt")
public void testLambdaArgumentProperty() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/lambdaArgumentProperty.kt");
doTest(fileName);
}
@TestMetadata("methodParameter.kt")
public void testMethodParameter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/methodParameter.kt");
doTest(fileName);
}
@TestMetadata("propertyWithLambda.kt")
public void testPropertyWithLambda() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/propertyWithLambda.kt");
doTest(fileName);
}
@TestMetadata("simpleProperty.kt")
public void testSimpleProperty() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/simpleProperty.kt");
doTest(fileName);
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 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,40 +14,52 @@
* limitations under the License.
*/
package org.jetbrains.kotlin.android.intentions
package org.jetbrains.kotlin.android.quickfix
import com.android.SdkConstants
import com.intellij.codeInspection.InspectionProfileEntry
import com.intellij.openapi.util.io.FileUtil
import com.intellij.util.PathUtil
import org.jetbrains.android.inspections.klint.AndroidLintInspectionBase
import org.jetbrains.kotlin.android.KotlinAndroidTestCase
import org.jetbrains.kotlin.idea.test.DirectiveBasedActionUtils
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.jetbrains.kotlin.test.KotlinTestUtils
import java.io.File
abstract class AbstractAndroidIntentionTest : KotlinAndroidTestCase() {
abstract class AbstractAndroidLintQuickfixTest : KotlinAndroidTestCase() {
override fun setUp() {
AndroidLintInspectionBase.invalidateInspectionShortName2IssueMap()
super.setUp()
}
fun doTest(path: String) {
val fileText = FileUtil.loadFile(File(path), true)
val intentionText = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// INTENTION_TEXT: ") ?: error("Empty intention text")
val mainInspectionClassName = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// INSPECTION_CLASS: ") ?: error("Empty inspection class name")
val dependency = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// DEPENDENCY: ")
val intentionAvailable = !InTextDirectivesUtils.isDirectiveDefined(fileText, "// INTENTION_NOT_AVAILABLE")
val inspectionClass = Class.forName(mainInspectionClassName).newInstance() as AndroidLintInspectionBase
myFixture.enableInspections(inspectionClass)
val inspection = Class.forName(mainInspectionClassName).newInstance() as InspectionProfileEntry
myFixture.enableInspections(inspection)
val sourceFile = myFixture.copyFileToProject(path, "src/${PathUtil.getFileName(path)}")
myFixture.configureFromExistingVirtualFile(sourceFile)
DirectiveBasedActionUtils.checkForUnexpectedErrors(myFixture.file as KtFile)
if (dependency != null) {
val (dependencyFile, dependencyTargetPath) = dependency.split(" -> ").map(String::trim)
myFixture.copyFileToProject("${PathUtil.getParentPath(path)}/$dependencyFile", "src/$dependencyTargetPath")
}
val intention = myFixture.getAvailableIntention(intentionText) ?: error("Failed to find intention")
myFixture.launchAction(intention)
myFixture.checkResultByFile(path + ".expected")
if (intentionAvailable) {
val intention = myFixture.getAvailableIntention(intentionText) ?: error("Failed to find intention")
myFixture.launchAction(intention)
myFixture.checkResultByFile(path + ".expected")
}
else {
assertNull("Intention should not be availabale", myFixture.availableIntentions.find { it.text == intentionText })
}
}
override fun createManifest() {
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.kotlin.android.quickfixes;
package org.jetbrains.kotlin.android.quickfix;
import com.intellij.facet.FacetManager;
import com.intellij.facet.ModifiableFacetModel;
@@ -0,0 +1,272 @@
/*
* Copyright 2010-2017 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.android.quickfix;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("idea/testData/android/lintQuickfix")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class AndroidLintQuickfixTestGenerated extends AbstractAndroidLintQuickfixTest {
public void testAllFilesPresentInLintQuickfix() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/lintQuickfix"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("idea/testData/android/lintQuickfix/requiresApi")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class RequiresApi extends AbstractAndroidLintQuickfixTest {
public void testAllFilesPresentInRequiresApi() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/lintQuickfix/requiresApi"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("annotation.kt")
public void testAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/annotation.kt");
doTest(fileName);
}
@TestMetadata("companion.kt")
public void testCompanion() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/companion.kt");
doTest(fileName);
}
@TestMetadata("defaultParameter.kt")
public void testDefaultParameter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt");
doTest(fileName);
}
@TestMetadata("extend.kt")
public void testExtend() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/extend.kt");
doTest(fileName);
}
@TestMetadata("functionLiteral.kt")
public void testFunctionLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt");
doTest(fileName);
}
@TestMetadata("method.kt")
public void testMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/method.kt");
doTest(fileName);
}
@TestMetadata("property.kt")
public void testProperty() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/property.kt");
doTest(fileName);
}
@TestMetadata("when.kt")
public void testWhen() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/when.kt");
doTest(fileName);
}
}
@TestMetadata("idea/testData/android/lintQuickfix/suppressLint")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SuppressLint extends AbstractAndroidLintQuickfixTest {
@TestMetadata("activityMethod.kt")
public void testActivityMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt");
doTest(fileName);
}
@TestMetadata("addToExistingAnnotation.kt")
public void testAddToExistingAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt");
doTest(fileName);
}
public void testAllFilesPresentInSuppressLint() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/lintQuickfix/suppressLint"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("constructorParameter.kt")
public void testConstructorParameter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt");
doTest(fileName);
}
@TestMetadata("destructuringDeclaration.kt")
public void testDestructuringDeclaration() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt");
doTest(fileName);
}
@TestMetadata("lambdaArgument.kt")
public void testLambdaArgument() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt");
doTest(fileName);
}
@TestMetadata("lambdaArgumentProperty.kt")
public void testLambdaArgumentProperty() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt");
doTest(fileName);
}
@TestMetadata("methodParameter.kt")
public void testMethodParameter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt");
doTest(fileName);
}
@TestMetadata("propertyWithLambda.kt")
public void testPropertyWithLambda() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt");
doTest(fileName);
}
@TestMetadata("simpleProperty.kt")
public void testSimpleProperty() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt");
doTest(fileName);
}
}
@TestMetadata("idea/testData/android/lintQuickfix/targetApi")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TargetApi extends AbstractAndroidLintQuickfixTest {
public void testAllFilesPresentInTargetApi() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/lintQuickfix/targetApi"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("annotation.kt")
public void testAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/annotation.kt");
doTest(fileName);
}
@TestMetadata("companion.kt")
public void testCompanion() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/companion.kt");
doTest(fileName);
}
@TestMetadata("defaultParameter.kt")
public void testDefaultParameter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt");
doTest(fileName);
}
@TestMetadata("extend.kt")
public void testExtend() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/extend.kt");
doTest(fileName);
}
@TestMetadata("functionLiteral.kt")
public void testFunctionLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt");
doTest(fileName);
}
@TestMetadata("method.kt")
public void testMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/method.kt");
doTest(fileName);
}
@TestMetadata("property.kt")
public void testProperty() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/property.kt");
doTest(fileName);
}
@TestMetadata("when.kt")
public void testWhen() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/when.kt");
doTest(fileName);
}
}
@TestMetadata("idea/testData/android/lintQuickfix/targetVersionCheck")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TargetVersionCheck extends AbstractAndroidLintQuickfixTest {
public void testAllFilesPresentInTargetVersionCheck() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/lintQuickfix/targetVersionCheck"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("annotation.kt")
public void testAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/annotation.kt");
doTest(fileName);
}
@TestMetadata("defaultParameter.kt")
public void testDefaultParameter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/defaultParameter.kt");
doTest(fileName);
}
@TestMetadata("expressionBody.kt")
public void testExpressionBody() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt");
doTest(fileName);
}
@TestMetadata("functionLiteral.kt")
public void testFunctionLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt");
doTest(fileName);
}
@TestMetadata("if.kt")
public void testIf() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/if.kt");
doTest(fileName);
}
@TestMetadata("ifWithBlock.kt")
public void testIfWithBlock() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt");
doTest(fileName);
}
@TestMetadata("method.kt")
public void testMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/method.kt");
doTest(fileName);
}
@TestMetadata("when.kt")
public void testWhen() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/when.kt");
doTest(fileName);
}
}
}
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.kotlin.android.quickfixes;
package org.jetbrains.kotlin.android.quickfix;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
+1 -1
View File
@@ -19,7 +19,7 @@
<editorNotificationProvider implementation="org.jetbrains.kotlin.android.actions.KotlinNewActivityNotification"/>
<intentionAction>
<className>org.jetbrains.kotlin.android.intentions.KotlinAndroidAddStringResource</className>
<className>org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource</className>
<category>Kotlin Android</category>
</intentionAction>
@@ -0,0 +1,49 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* 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 android.support.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.CLASS;
/**
* Denotes that the annotated element should only be called on the given API level
* or higher.
* <p>
* This is similar in purpose to the older {@code @TargetApi} annotation, but more
* clearly expresses that this is a requirement on the caller, rather than being
* used to "suppress" warnings within the method that exceed the {@code minSdkVersion}.
*/
@Retention(CLASS)
@Target({TYPE,METHOD,CONSTRUCTOR,FIELD})
public @interface RequiresApi {
/**
* The API level to require. Alias for {@link #api} which allows you to leave out the
* {@code api=} part.
*/
@IntRange(from=1)
int value() default 1;
/** The API level to require */
@IntRange(from=1)
int api() default 1;
}
@@ -0,0 +1,12 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
import kotlin.reflect.KClass
annotation class SomeAnnotationWithClass(val cls: KClass<*>)
@SomeAnnotationWithClass(<caret>VectorDrawable::class)
class VectorDrawableProvider {
}
@@ -0,0 +1,15 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
import android.os.Build
import android.support.annotation.RequiresApi
import kotlin.reflect.KClass
annotation class SomeAnnotationWithClass(val cls: KClass<*>)
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
@SomeAnnotationWithClass(VectorDrawable::class)
class VectorDrawableProvider {
}
@@ -0,0 +1,11 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
companion object {
val VECTOR_DRAWABLE = <caret>VectorDrawable()
}
}
@@ -0,0 +1,14 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
import android.os.Build
import android.support.annotation.RequiresApi
class VectorDrawableProvider {
companion object {
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
val VECTOR_DRAWABLE = VectorDrawable()
}
}
@@ -0,0 +1,10 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
fun withDefaultParameter(vector: VectorDrawable = <caret>VectorDrawable()) {
}
@@ -0,0 +1,13 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
import android.os.Build
import android.support.annotation.RequiresApi
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
fun withDefaultParameter(vector: VectorDrawable = VectorDrawable()) {
}
@@ -0,0 +1,9 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
class MyVectorDrawable : <caret>VectorDrawable() {
}
@@ -0,0 +1,12 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
import android.os.Build
import android.support.annotation.RequiresApi
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
class MyVectorDrawable : VectorDrawable() {
}
@@ -0,0 +1,13 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
with(this) {
return <caret>VectorDrawable()
}
}
}
@@ -0,0 +1,16 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
import android.os.Build
import android.support.annotation.RequiresApi
class VectorDrawableProvider {
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
fun getVectorDrawable(): VectorDrawable {
with(this) {
return VectorDrawable()
}
}
}
@@ -0,0 +1,11 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
return <caret>VectorDrawable()
}
}
@@ -0,0 +1,14 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
import android.os.Build
import android.support.annotation.RequiresApi
class VectorDrawableProvider {
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
fun getVectorDrawable(): VectorDrawable {
return VectorDrawable()
}
}
@@ -0,0 +1,9 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
val VECTOR_DRAWABLE = <caret>VectorDrawable()
}
@@ -0,0 +1,12 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
import android.os.Build
import android.support.annotation.RequiresApi
class VectorDrawableProvider {
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
val VECTOR_DRAWABLE = VectorDrawable()
}
+15
View File
@@ -0,0 +1,15 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
return when (flag) {
true -> <caret>VectorDrawable()
else -> VectorDrawable()
}
}
}
@@ -0,0 +1,18 @@
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
import android.graphics.drawable.VectorDrawable
import android.os.Build
import android.support.annotation.RequiresApi
class VectorDrawableProvider {
val flag = false
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
fun getVectorDrawable(): VectorDrawable {
return when (flag) {
true -> VectorDrawable()
else -> VectorDrawable()
}
}
}
@@ -0,0 +1,11 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import kotlin.reflect.KClass
annotation class SomeAnnotationWithClass(val cls: KClass<*>)
@SomeAnnotationWithClass(<caret>VectorDrawable::class)
class VectorDrawableProvider {
}
@@ -0,0 +1,14 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.annotation.TargetApi
import android.graphics.drawable.VectorDrawable
import android.os.Build
import kotlin.reflect.KClass
annotation class SomeAnnotationWithClass(val cls: KClass<*>)
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@SomeAnnotationWithClass(VectorDrawable::class)
class VectorDrawableProvider {
}
@@ -0,0 +1,10 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
companion object {
val VECTOR_DRAWABLE = <caret>VectorDrawable()
}
}
@@ -0,0 +1,13 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.annotation.TargetApi
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
companion object {
val VECTOR_DRAWABLE = VectorDrawable()
}
}
@@ -0,0 +1,9 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
fun withDefaultParameter(vector: VectorDrawable = <caret>VectorDrawable()) {
}
@@ -0,0 +1,12 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.annotation.TargetApi
import android.graphics.drawable.VectorDrawable
import android.os.Build
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
fun withDefaultParameter(vector: VectorDrawable = VectorDrawable()) {
}
@@ -0,0 +1,8 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class MyVectorDrawable : <caret>VectorDrawable() {
}
@@ -0,0 +1,11 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.annotation.TargetApi
import android.graphics.drawable.VectorDrawable
import android.os.Build
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
class MyVectorDrawable : VectorDrawable() {
}
@@ -0,0 +1,12 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
with(this) {
return <caret>VectorDrawable()
}
}
}
@@ -0,0 +1,15 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.annotation.TargetApi
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
fun getVectorDrawable(): VectorDrawable {
with(this) {
return VectorDrawable()
}
}
}
+10
View File
@@ -0,0 +1,10 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
return <caret>VectorDrawable()
}
}
@@ -0,0 +1,13 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.annotation.TargetApi
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
fun getVectorDrawable(): VectorDrawable {
return VectorDrawable()
}
}
@@ -0,0 +1,8 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
val VECTOR_DRAWABLE = <caret>VectorDrawable()
}
@@ -0,0 +1,11 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.annotation.TargetApi
import android.graphics.drawable.VectorDrawable
import android.os.Build
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
class VectorDrawableProvider {
val VECTOR_DRAWABLE = VectorDrawable()
}
+14
View File
@@ -0,0 +1,14 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
return when (flag) {
true -> <caret>VectorDrawable()
else -> VectorDrawable()
}
}
}
@@ -0,0 +1,17 @@
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.annotation.TargetApi
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
val flag = false
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
fun getVectorDrawable(): VectorDrawable {
return when (flag) {
true -> VectorDrawable()
else -> VectorDrawable()
}
}
}
@@ -0,0 +1,12 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INTENTION_NOT_AVAILABLE
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import kotlin.reflect.KClass
annotation class SomeAnnotationWithClass(val cls: KClass<*>)
@SomeAnnotationWithClass(<caret>VectorDrawable::class)
class VectorDrawableProvider {
}
@@ -0,0 +1,10 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INTENTION_NOT_AVAILABLE
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
fun withDefaultParameter(vector: VectorDrawable = <caret>VectorDrawable()) {
}
@@ -0,0 +1,8 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable = <caret>VectorDrawable()
}
@@ -0,0 +1,11 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
VectorDrawable()
}
}
@@ -0,0 +1,12 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
with(this) {
return <caret>VectorDrawable()
}
}
}
@@ -0,0 +1,15 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
with(this) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return VectorDrawable()
}
}
}
}
@@ -0,0 +1,12 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
if (flag)
return <caret>VectorDrawable()
}
}
@@ -0,0 +1,15 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
if (flag)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return VectorDrawable()
}
}
}
@@ -0,0 +1,13 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
if (flag) {
return <caret>VectorDrawable()
}
}
}
@@ -0,0 +1,16 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
if (flag) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return VectorDrawable()
}
}
}
}
@@ -0,0 +1,10 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
return <caret>VectorDrawable()
}
}
@@ -0,0 +1,13 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return VectorDrawable()
}
}
}
@@ -0,0 +1,14 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
return when (flag) {
true -> <caret>VectorDrawable()
else -> VectorDrawable()
}
}
}
@@ -0,0 +1,17 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
return when (flag) {
true -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
VectorDrawable()
}
else -> VectorDrawable()
}
}
}

Some files were not shown because too many files have changed in this diff Show More