diff options
Diffstat (limited to 'lint/cli')
11 files changed, 93 insertions, 79 deletions
diff --git a/lint/cli/src/main/java/com/android/tools/lint/HtmlReporter.java b/lint/cli/src/main/java/com/android/tools/lint/HtmlReporter.java index 19f1028..83cd76d 100644 --- a/lint/cli/src/main/java/com/android/tools/lint/HtmlReporter.java +++ b/lint/cli/src/main/java/com/android/tools/lint/HtmlReporter.java @@ -58,7 +58,7 @@ import java.util.Set; */ @Beta public class HtmlReporter extends Reporter { - private static boolean USE_HOLO_STYLE = true; + private static final boolean USE_HOLO_STYLE = true; private static final String CSS = USE_HOLO_STYLE ? "hololike.css" : "default.css"; //$NON-NLS-1$ //$NON-NLS-2$ @@ -132,7 +132,7 @@ public class HtmlReporter extends Reporter { mWriter.write("<br/><br/>"); //$NON-NLS-1$ Issue previousIssue = null; - if (issues.size() > 0) { + if (!issues.isEmpty()) { List<List<Warning>> related = new ArrayList<List<Warning>>(); List<Warning> currentList = null; for (Warning warning : issues) { @@ -229,7 +229,7 @@ public class HtmlReporter extends Reporter { int otherLocations = 0; while (l != null) { String message = l.getMessage(); - if (message != null && message.length() > 0) { + if (message != null && !message.isEmpty()) { Position start = l.getStart(); int line = start != null ? start.getLine() : -1; String path = mClient.getDisplayPath(warning.project, l.getFile()); @@ -244,7 +244,7 @@ public class HtmlReporter extends Reporter { String name = l.getFile().getName(); if (!(endsWith(name, DOT_PNG) || endsWith(name, DOT_JPG))) { String s = mClient.readFile(l.getFile()); - if (s != null && s.length() > 0) { + if (s != null && !s.isEmpty()) { mWriter.write("<pre class=\"errorlines\">\n"); //$NON-NLS-1$ int offset = start != null ? start.getOffset() : -1; appendCodeBlock(s, line, offset); @@ -362,7 +362,7 @@ public class HtmlReporter extends Reporter { mWriter.write("Explanation: "); String description = issue.getDescription(); mWriter.write(description); - if (description.length() > 0 + if (!description.isEmpty() && Character.isLetter(description.charAt(description.length() - 1))) { mWriter.write('.'); } @@ -617,7 +617,7 @@ public class HtmlReporter extends Reporter { } location = location.getSecondary(); } - if (urls.size() > 0) { + if (!urls.isEmpty()) { // Sort in order Collections.sort(urls, new Comparator<String>() { @Override diff --git a/lint/cli/src/main/java/com/android/tools/lint/LintCliXmlParser.java b/lint/cli/src/main/java/com/android/tools/lint/LintCliXmlParser.java index c06178a..3e1408a 100644 --- a/lint/cli/src/main/java/com/android/tools/lint/LintCliXmlParser.java +++ b/lint/cli/src/main/java/com/android/tools/lint/LintCliXmlParser.java @@ -70,8 +70,9 @@ public class LintCliXmlParser extends PositionXmlParser implements IDomParser { return null; } + @NonNull @Override - public @NonNull Location getLocation(@NonNull XmlContext context, @NonNull Node node) { + public Location getLocation(@NonNull XmlContext context, @NonNull Node node) { OffsetPosition pos = (OffsetPosition) getPosition(node, -1, -1); if (pos != null) { return Location.create(context.file, pos, (OffsetPosition) pos.getEnd()); @@ -80,8 +81,9 @@ public class LintCliXmlParser extends PositionXmlParser implements IDomParser { return Location.create(context.file); } + @NonNull @Override - public @NonNull Location getLocation(@NonNull XmlContext context, @NonNull Node node, + public Location getLocation(@NonNull XmlContext context, @NonNull Node node, int start, int end) { OffsetPosition pos = (OffsetPosition) getPosition(node, start, end); if (pos != null) { @@ -91,13 +93,15 @@ public class LintCliXmlParser extends PositionXmlParser implements IDomParser { return Location.create(context.file); } + @NonNull @Override - public @NonNull Handle createLocationHandle(@NonNull XmlContext context, @NonNull Node node) { + public Handle createLocationHandle(@NonNull XmlContext context, @NonNull Node node) { return new LocationHandle(context.file, node); } + @NonNull @Override - protected @NonNull OffsetPosition createPosition(int line, int column, int offset) { + protected OffsetPosition createPosition(int line, int column, int offset) { return new OffsetPosition(line, column, offset); } @@ -119,7 +123,7 @@ public class LintCliXmlParser extends PositionXmlParser implements IDomParser { * Linked position: for a begin offset this will point to the end * offset, and for an end offset this will be null */ - private com.android.utils.PositionXmlParser.Position mEnd; + private PositionXmlParser.Position mEnd; /** * Creates a new {@link OffsetPosition} @@ -150,19 +154,19 @@ public class LintCliXmlParser extends PositionXmlParser implements IDomParser { } @Override - public com.android.utils.PositionXmlParser.Position getEnd() { + public PositionXmlParser.Position getEnd() { return mEnd; } @Override - public void setEnd(@NonNull com.android.utils.PositionXmlParser.Position end) { + public void setEnd(@NonNull PositionXmlParser.Position end) { mEnd = end; } @Override public String toString() { return "OffsetPosition [line=" + mLine + ", column=" + mColumn + ", offset=" - + mOffset + ", end=" + mEnd + "]"; + + mOffset + ", end=" + mEnd + ']'; } } @@ -172,8 +176,8 @@ public class LintCliXmlParser extends PositionXmlParser implements IDomParser { /* Handle for creating DOM positions cheaply and returning full fledged locations later */ private class LocationHandle implements Handle { - private File mFile; - private Node mNode; + private final File mFile; + private final Node mNode; private Object mClientData; public LocationHandle(File file, Node node) { @@ -181,8 +185,9 @@ public class LintCliXmlParser extends PositionXmlParser implements IDomParser { mNode = node; } + @NonNull @Override - public @NonNull Location resolve() { + public Location resolve() { OffsetPosition pos = (OffsetPosition) getPosition(mNode); if (pos != null) { return Location.create(mFile, pos, (OffsetPosition) pos.getEnd()); diff --git a/lint/cli/src/main/java/com/android/tools/lint/LombokParser.java b/lint/cli/src/main/java/com/android/tools/lint/LombokParser.java index bc841e2..26845a9 100644 --- a/lint/cli/src/main/java/com/android/tools/lint/LombokParser.java +++ b/lint/cli/src/main/java/com/android/tools/lint/LombokParser.java @@ -47,7 +47,7 @@ public class LombokParser implements IJavaParser { // Don't analyze files containing errors List<ParseProblem> problems = source.getProblems(); - if (problems != null && problems.size() > 0) { + if (problems != null && !problems.isEmpty()) { context.getDriver().setHasParserErrors(true); /* Silently ignore the errors. There are still some bugs in Lombok/Parboiled @@ -97,17 +97,19 @@ public class LombokParser implements IJavaParser { } } + @NonNull @Override - public @NonNull Location getLocation( + public Location getLocation( @NonNull JavaContext context, - @NonNull lombok.ast.Node node) { - lombok.ast.Position position = node.getPosition(); + @NonNull Node node) { + Position position = node.getPosition(); return Location.create(context.file, context.getContents(), position.getStart(), position.getEnd()); } + @NonNull @Override - public @NonNull Handle createLocationHandle(@NonNull JavaContext context, @NonNull Node node) { + public Handle createLocationHandle(@NonNull JavaContext context, @NonNull Node node) { return new LocationHandle(context.file, node); } @@ -116,9 +118,9 @@ public class LombokParser implements IJavaParser { } /* Handle for creating positions cheaply and returning full fledged locations later */ - private class LocationHandle implements Handle { - private File mFile; - private Node mNode; + private static class LocationHandle implements Handle { + private final File mFile; + private final Node mNode; private Object mClientData; public LocationHandle(File file, Node node) { @@ -126,8 +128,9 @@ public class LombokParser implements IJavaParser { mNode = node; } + @NonNull @Override - public @NonNull Location resolve() { + public Location resolve() { Position pos = mNode.getPosition(); return Location.create(mFile, null /*contents*/, pos.getStart(), pos.getEnd()); } diff --git a/lint/cli/src/main/java/com/android/tools/lint/Main.java b/lint/cli/src/main/java/com/android/tools/lint/Main.java index d2f9439..085a38c 100644 --- a/lint/cli/src/main/java/com/android/tools/lint/Main.java +++ b/lint/cli/src/main/java/com/android/tools/lint/Main.java @@ -109,9 +109,9 @@ public class Main extends LintClient { private static final int ERRNO_HELP = 4; private static final int ERRNO_INVALIDARGS = 5; - protected List<Warning> mWarnings = new ArrayList<Warning>(); - protected Set<String> mSuppress = new HashSet<String>(); - protected Set<String> mEnabled = new HashSet<String>(); + protected final List<Warning> mWarnings = new ArrayList<Warning>(); + protected final Set<String> mSuppress = new HashSet<String>(); + protected final Set<String> mEnabled = new HashSet<String>(); /** If non-null, only run the specified checks (possibly modified by enable/disables) */ protected Set<String> mCheck = null; protected boolean mHasErrors; @@ -120,7 +120,7 @@ public class Main extends LintClient { protected int mErrorCount; protected int mWarningCount; protected boolean mShowLines = true; - protected List<Reporter> mReporters = Lists.newArrayList(); + protected final List<Reporter> mReporters = Lists.newArrayList(); protected boolean mQuiet; protected boolean mWarnAll; protected boolean mNoWarnings; @@ -533,7 +533,7 @@ public class Main extends LintClient { } } - if (files.size() == 0) { + if (files.isEmpty()) { System.err.println("No files to analyze."); System.exit(ERRNO_INVALIDARGS); } else if (files.size() > 1 @@ -614,7 +614,7 @@ public class Main extends LintClient { * @param filename The filename given as a command-line argument. * @return A File matching filename, either absolute or relative to lint.workdir if defined. */ - private File getInArgumentPath(String filename) { + private static File getInArgumentPath(String filename) { File file = new File(filename); if (!file.isAbsolute()) { @@ -642,7 +642,7 @@ public class Main extends LintClient { * @param filename The filename given as a command-line argument. * @return A File matching filename, either absolute or relative to lint.workdir if defined. */ - private File getOutArgumentPath(String filename) { + private static File getOutArgumentPath(String filename) { File file = new File(filename); if (!file.isAbsolute()) { @@ -670,20 +670,20 @@ public class Main extends LintClient { * @return A new File corresponding to {@link #PROP_WORK_DIR} or null. */ @Nullable - private File getLintWorkDir() { + private static File getLintWorkDir() { // First check the Java properties (e.g. set using "java -jar ... -Dname=value") String path = System.getProperty(PROP_WORK_DIR); - if (path == null || path.length() == 0) { + if (path == null || path.isEmpty()) { // If not found, check environment variables. path = System.getenv(PROP_WORK_DIR); } - if (path != null && path.length() > 0) { + if (path != null && !path.isEmpty()) { return new File(path); } return null; } - private void printHelpTopicSuppress() { + private static void printHelpTopicSuppress() { System.out.println(wrap(getSuppressHelp())); } @@ -771,7 +771,7 @@ public class Main extends LintClient { properties.load(input); String revision = properties.getProperty("Pkg.Revision"); //$NON-NLS-1$ - if (revision != null && revision.length() > 0) { + if (revision != null && !revision.isEmpty()) { return revision; } } catch (IOException e) { @@ -784,7 +784,7 @@ public class Main extends LintClient { return null; } - private void displayValidIds(IssueRegistry registry, PrintStream out) { + private static void displayValidIds(IssueRegistry registry, PrintStream out) { List<Category> categories = registry.getCategories(); out.println("Valid issue categories:"); for (Category category : categories) { @@ -798,11 +798,11 @@ public class Main extends LintClient { } } - private void listIssue(PrintStream out, Issue issue) { + private static void listIssue(PrintStream out, Issue issue) { out.print(wrapArg("\"" + issue.getId() + "\": " + issue.getDescription())); } - private void showIssues(IssueRegistry registry) { + private static void showIssues(IssueRegistry registry) { List<Issue> issues = registry.getIssues(); List<Issue> sorted = new ArrayList<Issue>(issues); Collections.sort(sorted, new Comparator<Issue>() { @@ -840,7 +840,7 @@ public class Main extends LintClient { } } - private void describeIssue(Issue issue) { + private static void describeIssue(Issue issue) { System.out.println(issue.getId()); for (int i = 0; i < issue.getId().length(); i++) { System.out.print('-'); @@ -956,7 +956,7 @@ public class Main extends LintClient { argWidth = Math.max(argWidth, arg.length()); } argWidth += 2; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(20); for (int i = 0; i < argWidth; i++) { sb.append(' '); } @@ -966,7 +966,7 @@ public class Main extends LintClient { for (int i = 0; i < args.length; i += 2) { String arg = args[i]; String description = args[i + 1]; - if (arg.length() == 0) { + if (arg.isEmpty()) { out.println(description); } else { out.print(wrap(String.format(formatString, arg, description), @@ -1006,7 +1006,7 @@ public class Main extends LintClient { } /** File content cache */ - private Map<File, String> mFileContents = new HashMap<File, String>(100); + private final Map<File, String> mFileContents = new HashMap<File, String>(100); /** Read the contents of the given file, possibly cached */ private String getContents(File file) { @@ -1085,7 +1085,7 @@ public class Main extends LintClient { } } } - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(100); sb.append(warning.errorLine); sb.append('\n'); for (int i = 0; i < column; i++) { @@ -1099,7 +1099,7 @@ public class Main extends LintClient { int endColumn = endPosition.getColumn(); if (endLine == line && endColumn > column) { for (int i = column; i < endColumn; i++) { - sb.append("~"); + sb.append('~'); } displayCaret = false; } @@ -1150,8 +1150,9 @@ public class Main extends LintClient { return index; } + @NonNull @Override - public @NonNull String readFile(@NonNull File file) { + public String readFile(@NonNull File file) { try { return LintUtils.getEncodedString(this, file); } catch (IOException e) { @@ -1222,8 +1223,9 @@ public class Main extends LintClient { super(Main.this, null /*project*/, null /*parent*/, lintFile); } + @NonNull @Override - public @NonNull Severity getSeverity(@NonNull Issue issue) { + public Severity getSeverity(@NonNull Issue issue) { Severity severity = computeSeverity(issue); if (mAllErrors && severity != Severity.IGNORE) { @@ -1237,8 +1239,9 @@ public class Main extends LintClient { return severity; } + @NonNull @Override - protected @NonNull Severity getDefaultSeverity(@NonNull Issue issue) { + protected Severity getDefaultSeverity(@NonNull Issue issue) { if (mWarnAll) { return issue.getDefaultSeverity(); } @@ -1277,7 +1280,7 @@ public class Main extends LintClient { } } - private class ProgressPrinter implements LintListener { + private static class ProgressPrinter implements LintListener { @Override public void update( @NonNull LintDriver lint, @@ -1315,6 +1318,9 @@ public class Main extends LintClient { case COMPLETED: System.out.println(); break; + case STARTING: + // Ignored for now + break; } } } @@ -1383,7 +1389,7 @@ public class Main extends LintClient { chop++; } path = path.substring(chop); - if (path.length() == 0) { + if (path.isEmpty()) { path = file.getName(); } } else if (mFullPath) { diff --git a/lint/cli/src/main/java/com/android/tools/lint/MultiProjectHtmlReporter.java b/lint/cli/src/main/java/com/android/tools/lint/MultiProjectHtmlReporter.java index d039edc..6035c29 100644 --- a/lint/cli/src/main/java/com/android/tools/lint/MultiProjectHtmlReporter.java +++ b/lint/cli/src/main/java/com/android/tools/lint/MultiProjectHtmlReporter.java @@ -215,10 +215,10 @@ public class MultiProjectHtmlReporter extends HtmlReporter { } private static class ProjectEntry implements Comparable<ProjectEntry> { - public int errorCount; - public int warningCount; - public String fileName; - public String path; + public final int errorCount; + public final int warningCount; + public final String fileName; + public final String path; public ProjectEntry(String fileName, int errorCount, int warningCount, String path) { diff --git a/lint/cli/src/main/java/com/android/tools/lint/Reporter.java b/lint/cli/src/main/java/com/android/tools/lint/Reporter.java index fc3aaae..3086a7c 100644 --- a/lint/cli/src/main/java/com/android/tools/lint/Reporter.java +++ b/lint/cli/src/main/java/com/android/tools/lint/Reporter.java @@ -50,8 +50,8 @@ public abstract class Reporter { protected boolean mBundleResources; protected Map<String, String> mUrlMap; protected File mResources; - protected Map<File, String> mResourceUrl = new HashMap<File, String>(); - protected Map<String, File> mNameToFile = new HashMap<String, File>(); + protected final Map<File, String> mResourceUrl = new HashMap<File, String>(); + protected final Map<String, File> mNameToFile = new HashMap<String, File>(); /** * Write the given warnings into the report diff --git a/lint/cli/src/main/java/com/android/tools/lint/TextReporter.java b/lint/cli/src/main/java/com/android/tools/lint/TextReporter.java index 4f2c8b4..8e9f776 100644 --- a/lint/cli/src/main/java/com/android/tools/lint/TextReporter.java +++ b/lint/cli/src/main/java/com/android/tools/lint/TextReporter.java @@ -54,7 +54,7 @@ public class TextReporter extends Reporter { boolean abbreviate = mClient.getDriver().isAbbreviating(); StringBuilder output = new StringBuilder(issues.size() * 200); - if (issues.size() == 0) { + if (issues.isEmpty()) { mWriter.write('\n'); mWriter.write("No issues found."); mWriter.write('\n'); @@ -95,7 +95,7 @@ public class TextReporter extends Reporter { output.append('\n'); - if (warning.errorLine != null && warning.errorLine.length() > 0) { + if (warning.errorLine != null && !warning.errorLine.isEmpty()) { output.append(warning.errorLine); } @@ -103,7 +103,7 @@ public class TextReporter extends Reporter { Location location = warning.location.getSecondary(); while (location != null) { if (location.getMessage() != null - && location.getMessage().length() > 0) { + && !location.getMessage().isEmpty()) { output.append(" "); //$NON-NLS-1$ String path = mClient.getDisplayPath(warning.project, location.getFile()); @@ -119,7 +119,7 @@ public class TextReporter extends Reporter { } if (location.getMessage() != null - && location.getMessage().length() > 0) { + && !location.getMessage().isEmpty()) { output.append(':'); output.append(' '); output.append(location.getMessage()); @@ -133,12 +133,12 @@ public class TextReporter extends Reporter { if (!abbreviate) { location = warning.location.getSecondary(); - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(100); sb.append("Also affects: "); int begin = sb.length(); while (location != null) { if (location.getMessage() == null - || location.getMessage().length() > 0) { + || !location.getMessage().isEmpty()) { if (sb.length() > begin) { sb.append(", "); } diff --git a/lint/cli/src/main/java/com/android/tools/lint/XmlReporter.java b/lint/cli/src/main/java/com/android/tools/lint/XmlReporter.java index 04ac1d9..c0dca75 100644 --- a/lint/cli/src/main/java/com/android/tools/lint/XmlReporter.java +++ b/lint/cli/src/main/java/com/android/tools/lint/XmlReporter.java @@ -62,7 +62,7 @@ public class XmlReporter extends Reporter { } mWriter.write(">\n"); //$NON-NLS-1$ - if (issues.size() > 0) { + if (!issues.isEmpty()) { for (Warning warning : issues) { mWriter.write('\n'); indent(mWriter, 1); diff --git a/lint/cli/src/test/java/com/android/tools/lint/checks/AnnotationDetectorTest.java b/lint/cli/src/test/java/com/android/tools/lint/checks/AnnotationDetectorTest.java index becca80..7da1444 100644 --- a/lint/cli/src/test/java/com/android/tools/lint/checks/AnnotationDetectorTest.java +++ b/lint/cli/src/test/java/com/android/tools/lint/checks/AnnotationDetectorTest.java @@ -25,19 +25,19 @@ import java.util.List; public class AnnotationDetectorTest extends AbstractCheckTest { public void test() throws Exception { assertEquals( - "src/test/pkg/WrongAnnotation.java:9: Error: The @SuppresLint annotation cannot be used on a local variable with the lint check 'NewApi': move out to the surrounding method [LocalSuppress]\n" + + "src/test/pkg/WrongAnnotation.java:9: Error: The @SuppressLint annotation cannot be used on a local variable with the lint check 'NewApi': move out to the surrounding method [LocalSuppress]\n" + " public static void foobar(View view, @SuppressLint(\"NewApi\") int foo) { // Invalid: class-file check\n" + " ~~~~~~~~~~~~~~~~~~~~~~~\n" + - "src/test/pkg/WrongAnnotation.java:10: Error: The @SuppresLint annotation cannot be used on a local variable with the lint check 'NewApi': move out to the surrounding method [LocalSuppress]\n" + + "src/test/pkg/WrongAnnotation.java:10: Error: The @SuppressLint annotation cannot be used on a local variable with the lint check 'NewApi': move out to the surrounding method [LocalSuppress]\n" + " @SuppressLint(\"NewApi\") // Invalid\n" + " ~~~~~~~~~~~~~~~~~~~~~~~\n" + - "src/test/pkg/WrongAnnotation.java:12: Error: The @SuppresLint annotation cannot be used on a local variable with the lint check 'NewApi': move out to the surrounding method [LocalSuppress]\n" + + "src/test/pkg/WrongAnnotation.java:12: Error: The @SuppressLint annotation cannot be used on a local variable with the lint check 'NewApi': move out to the surrounding method [LocalSuppress]\n" + " @SuppressLint({\"SdCardPath\", \"NewApi\"}) // Invalid: class-file based check on local variable\n" + " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" + - "src/test/pkg/WrongAnnotation.java:14: Error: The @SuppresLint annotation cannot be used on a local variable with the lint check 'NewApi': move out to the surrounding method [LocalSuppress]\n" + + "src/test/pkg/WrongAnnotation.java:14: Error: The @SuppressLint annotation cannot be used on a local variable with the lint check 'NewApi': move out to the surrounding method [LocalSuppress]\n" + " @android.annotation.SuppressLint({\"SdCardPath\", \"NewApi\"}) // Invalid (FQN)\n" + " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" + - "src/test/pkg/WrongAnnotation.java:28: Error: The @SuppresLint annotation cannot be used on a local variable with the lint check 'NewApi': move out to the surrounding method [LocalSuppress]\n" + + "src/test/pkg/WrongAnnotation.java:28: Error: The @SuppressLint annotation cannot be used on a local variable with the lint check 'NewApi': move out to the surrounding method [LocalSuppress]\n" + " @SuppressLint(\"NewApi\")\n" + " ~~~~~~~~~~~~~~~~~~~~~~~\n" + "5 errors, 0 warnings\n", diff --git a/lint/cli/src/test/java/com/android/tools/lint/checks/NonInternationalizedSmsDetectorTest.java b/lint/cli/src/test/java/com/android/tools/lint/checks/NonInternationalizedSmsDetectorTest.java index 46e494e..f875fa1 100644 --- a/lint/cli/src/test/java/com/android/tools/lint/checks/NonInternationalizedSmsDetectorTest.java +++ b/lint/cli/src/test/java/com/android/tools/lint/checks/NonInternationalizedSmsDetectorTest.java @@ -27,7 +27,7 @@ public class NonInternationalizedSmsDetectorTest extends AbstractCheckTest { public void test() throws Exception { assertEquals( - "src/test/pkg/NonInternationalizedSmsDetectorTest.java:18: Warning: To make sure the SMS can be sent by all users, please start the SMS numberwith a + and a country code or restrict the code invocation to people in the country you are targeting. [UnlocalizedSms]\n" + + "src/test/pkg/NonInternationalizedSmsDetectorTest.java:18: Warning: To make sure the SMS can be sent by all users, please start the SMS number with a + and a country code or restrict the code invocation to people in the country you are targeting. [UnlocalizedSms]\n" + " sms.sendMultipartTextMessage(\"001234567890\", null, null, null, null);\n" + " ~~~~~~~~~~~~~~\n" + "0 errors, 1 warnings\n" + diff --git a/lint/cli/src/test/java/com/android/tools/lint/checks/TranslationDetectorTest.java b/lint/cli/src/test/java/com/android/tools/lint/checks/TranslationDetectorTest.java index 7a9830b..f13cff1 100644 --- a/lint/cli/src/test/java/com/android/tools/lint/checks/TranslationDetectorTest.java +++ b/lint/cli/src/test/java/com/android/tools/lint/checks/TranslationDetectorTest.java @@ -31,7 +31,7 @@ public class TranslationDetectorTest extends AbstractCheckTest { } public void testTranslation() throws Exception { - TranslationDetector.COMPLETE_REGIONS = false; + TranslationDetector.sCompleteRegions = false; assertEquals( // Sample files from the Home app "res/values/strings.xml:20: Error: \"show_all_apps\" is not translated in nl-rNL [MissingTranslation]\n" + @@ -66,7 +66,7 @@ public class TranslationDetectorTest extends AbstractCheckTest { } public void testTranslationWithCompleteRegions() throws Exception { - TranslationDetector.COMPLETE_REGIONS = true; + TranslationDetector.sCompleteRegions = true; assertEquals( // Sample files from the Home app "res/values/strings.xml:19: Error: \"home_title\" is not translated in es-rUS [MissingTranslation]\n" + @@ -112,7 +112,7 @@ public class TranslationDetectorTest extends AbstractCheckTest { } public void testTranslatedArrays() throws Exception { - TranslationDetector.COMPLETE_REGIONS = true; + TranslationDetector.sCompleteRegions = true; assertEquals( "No warnings.", @@ -122,7 +122,7 @@ public class TranslationDetectorTest extends AbstractCheckTest { } public void testTranslationSuppresss() throws Exception { - TranslationDetector.COMPLETE_REGIONS = false; + TranslationDetector.sCompleteRegions = false; assertEquals( "No warnings.", @@ -166,7 +166,7 @@ public class TranslationDetectorTest extends AbstractCheckTest { } public void testNonTranslatable1() throws Exception { - TranslationDetector.COMPLETE_REGIONS = true; + TranslationDetector.sCompleteRegions = true; assertEquals( "res/values-nb/nontranslatable.xml:3: Error: The resource string \"dummy\" has been marked as translatable=\"false\" [ExtraTranslation]\n" + " <string name=\"dummy\">Ignore Me</string>\n" + @@ -179,7 +179,7 @@ public class TranslationDetectorTest extends AbstractCheckTest { } public void testNonTranslatable2() throws Exception { - TranslationDetector.COMPLETE_REGIONS = true; + TranslationDetector.sCompleteRegions = true; assertEquals( "res/values-nb/nontranslatable.xml:3: Error: Non-translatable resources should only be defined in the base values/ folder [ExtraTranslation]\n" + " <string name=\"dummy\" translatable=\"false\">Ignore Me</string>\n" + @@ -191,7 +191,7 @@ public class TranslationDetectorTest extends AbstractCheckTest { } public void testSpecifiedLanguageOk() throws Exception { - TranslationDetector.COMPLETE_REGIONS = false; + TranslationDetector.sCompleteRegions = false; assertEquals( "No warnings.", @@ -201,7 +201,7 @@ public class TranslationDetectorTest extends AbstractCheckTest { } public void testSpecifiedLanguage() throws Exception { - TranslationDetector.COMPLETE_REGIONS = false; + TranslationDetector.sCompleteRegions = false; assertEquals( "No warnings.", |