Skip to content

Commit 2202008

Browse files
committed
Update dependencies
Add override api field
1 parent 4761ebf commit 2202008

File tree

6 files changed

+23
-21
lines changed

6 files changed

+23
-21
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.20'
2+
ext.kotlin_version = '1.5.30'
33
repositories {
44
google()
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.1.3'
8+
classpath 'com.android.tools.build:gradle:7.0.2'
99
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1010
}
1111
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Sat Mar 02 12:40:29 MSK 2019
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip

lint-rules-android/build.gradle

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ apply plugin: 'java-library'
22
apply plugin: "kotlin"
33

44
buildscript {
5-
ext.kotlin_version = '1.3.20'
5+
ext.kotlin_version = '1.5.30'
6+
ext.lint_api_version = '30.0.2'
67

78
repositories {
89
mavenCentral()
@@ -14,10 +15,15 @@ buildscript {
1415
}
1516

1617
dependencies {
17-
compileOnly "com.android.tools.lint:lint-api:26.3.1"
18+
compileOnly "com.android.tools.lint:lint-api:$lint_api_version"
1819
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
19-
testImplementation "com.android.tools.lint:lint:26.3.1"
20-
testImplementation "com.android.tools.lint:lint-tests:26.3.1"
20+
21+
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
22+
testImplementation "com.android.tools.lint:lint:$lint_api_version"
23+
testImplementation "com.android.tools.lint:lint-tests:$lint_api_version"
24+
25+
testCompile 'junit:junit:4.12'
26+
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
2127
}
2228

2329
jar {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.i90g.checkexceptlint" />
2+
package="com.thirdegg.checking_exceptions_lint" />

lint-rules-android/src/main/java/com/thirdegg/lintrules/android/CheckedExceptionsDetector.kt renamed to lint-rules-android/src/main/java/com/thirdegg/lintrules/android/CheckingExceptionsDetector.kt

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,15 @@ class CheckedExceptionsDetector : Detector(), Detector.UastScanner {
7373

7474
override fun createUastHandler(context: JavaContext) = object : UElementHandler() {
7575

76-
init {
77-
// println(context.uastFile?.asRecursiveLogString())
78-
}
79-
8076
override fun visitCallExpression(node: UCallExpression) {
8177

82-
val call = node
83-
val method = call.resolve() ?: return
84-
val uMethod = context.uastContext.getMethod(method)
78+
val method = node.resolve() ?: return
79+
val uMethod = UastFacade.convertElement(method, null, UMethod::class.java) as UMethod
8580

8681
var throwsExceptions = HashMap<String, HashSet<String>>()
8782

8883
// Find @Throws in annotation expression
89-
for (annotation in uMethod.annotations) {
84+
for (annotation in uMethod.uAnnotations) {
9085
if (annotation.qualifiedName != "kotlin.jvm.Throws") continue
9186
for (throwsException in findNamedExpressionsInAnnotation(annotation)) {
9287
throwsExceptions[throwsException.canonicalText] = findClassParents(throwsException)
@@ -119,9 +114,9 @@ class CheckedExceptionsDetector : Detector(), Detector.UastScanner {
119114

120115

121116
// Remove catched
122-
for (element in call.withContainingElements) {
117+
for (element in node.withContainingElements) {
123118
if (element !is UMethod) continue
124-
for (child in element.annotations) {
119+
for (child in element.uAnnotations) {
125120
for (classInAnnotation in findNamedExpressionsInAnnotation(child)) {
126121
throwsExceptions = throwsExceptions.filterTo(HashMap()) {
127122
!it.value.contains(classInAnnotation.canonicalText)
@@ -131,7 +126,7 @@ class CheckedExceptionsDetector : Detector(), Detector.UastScanner {
131126
break
132127
}
133128

134-
for (element in call.withContainingElements) {
129+
for (element in node.withContainingElements) {
135130
if (element !is UTryExpression) continue
136131
for (catchCause in element.catchClauses) {
137132
catchCause.types.forEach { catch ->
@@ -145,7 +140,7 @@ class CheckedExceptionsDetector : Detector(), Detector.UastScanner {
145140

146141
for (exceptions in throwsExceptions) {
147142
context.report(
148-
ISSUE_PATTERN, call, context.getNameLocation(call),
143+
ISSUE_PATTERN, node, context.getNameLocation(node),
149144
"Unhandled exception: ${exceptions.key}"
150145
)
151146
}

lint-rules-android/src/main/java/com/thirdegg/lintrules/android/LintRulesRegistry.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ class LintRulesRegistry: IssueRegistry() {
77

88
override val issues: List<Issue> = listOf(ISSUE_PATTERN)
99

10+
override val api: Int = CURRENT_API
11+
1012
}

0 commit comments

Comments
 (0)