Skip to content

Commit 9ea9c85

Browse files
committed
Add erroneous statements producing lint errors
1 parent c1b16f9 commit 9ea9c85

4 files changed

Lines changed: 58 additions & 1 deletion

File tree

lintchecks/src/main/java/eltos/lintchecks/DialogMethodCallLintDetector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
public class DialogMethodCallLintDetector extends Detector implements Detector.UastScanner {
4444

4545
private static String BUILD_CALL_MESSAGE = "%1$s does not implement a `build` method. " +
46-
"A **%2$s will be created** instead!\n" +
46+
"A **%2$s** will be created instead!\n" +
4747
"Implement the method in %1$s or call `%2$s.build()` instead.";
4848
public static final Issue BUILD_CALL = Issue.create("BuildNotImplemented",
4949
"Calling not implemented build",

testApp/src/main/java/eltos/simpledialogfragments/KotlinActivity.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ class KotlinActivity : AppCompatActivity(), OnDialogResultListener {
3636
.show(this)
3737
}
3838

39+
@Suppress("Unused")
40+
fun lintTest(){
41+
// The following produces a lint error
42+
//TestLintDialog.build().show(this)
43+
}
44+
3945

4046
fun showProgressTask(view: View?) {
4147
val task = MyProgressTask()

testApp/src/main/java/eltos/simpledialogfragments/MainActivity.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,21 @@ protected void onDestroy() {
143143
super.onDestroy();
144144
}
145145

146+
@SuppressWarnings("unused")
147+
public void lintTest(){
148+
// The following produces a lint error
149+
//TestLintDialog.build().show(this);
150+
}
151+
152+
153+
154+
155+
156+
157+
158+
159+
160+
146161
// == A l e r t s ==
147162

148163
public void showInfo(View view){
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2021 Philipp Niedermayer (github.com/eltos)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package eltos.simpledialogfragments;
18+
19+
import android.os.Bundle;
20+
import android.view.View;
21+
22+
import eltos.simpledialogfragment.CustomViewDialog;
23+
24+
public class TestLintDialog extends CustomViewDialog<TestLintDialog> {
25+
26+
//public static String TAG = "my-tag";
27+
28+
//public static TestLintDialog build(){
29+
// return new TestLintDialog();
30+
//}
31+
32+
@Override
33+
protected View onCreateContentView(Bundle savedInstanceState) {
34+
return null;
35+
}
36+
}

0 commit comments

Comments
 (0)