Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1794)

Unified Diff: Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/JsDocValidator.java

Issue 137553005: DevTools: [JsDocValidator] Refactor JsDoc annotation checkers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments from sergeyv Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/JsDocValidator.java
diff --git a/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/JsDocValidator.java b/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/JsDocValidator.java
index aefa5475a1a4115306763d4cfc7ff8906a888722..a1e6e0d9c130cbbf142d406754b320f9a9f604a7 100644
--- a/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/JsDocValidator.java
+++ b/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/JsDocValidator.java
@@ -16,8 +16,8 @@ import java.util.concurrent.Future;
public class JsDocValidator {
private void run(String[] args) {
- ExecutorService executor =
- Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
+ int threadCount = Math.min(args.length, Runtime.getRuntime().availableProcessors());
+ ExecutorService executor = Executors.newFixedThreadPool(threadCount);
try {
runWithExecutor(args, executor);
} finally {
@@ -38,10 +38,7 @@ public class JsDocValidator {
if (context != null) {
contexts.add(context);
}
- } catch (InterruptedException e) {
- System.err.println("ERROR - " + e.getMessage());
- e.printStackTrace(System.err);
- } catch (ExecutionException e) {
+ } catch (InterruptedException | ExecutionException e) {
System.err.println("ERROR - " + e.getMessage());
e.printStackTrace(System.err);
}
@@ -87,5 +84,39 @@ public class JsDocValidator {
}
return Integer.compare(record.position, other.record.position);
}
+
+ @Override
+ public int hashCode() {
+ return 17 + fileName.hashCode() * 3 + this.record.hashCode() * 5;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ LogEntry other = (LogEntry) obj;
+ if (fileName != other.fileName
+ && (fileName != null && !fileName.equals(other.fileName))) {
+ return false;
+ }
+
+ if (record == other.record) {
+ return true;
+ }
+ if (record != null) {
+ if (other.record == null) {
+ return false;
+ }
+ return record.position == other.record.position;
+ }
+ return false;
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698