Skip to content

Commit

Permalink
Remove JavaSystem from java_core.
Browse files Browse the repository at this point in the history
It is not used internally at all.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2324893003 .
  • Loading branch information
scheglov committed Sep 9, 2016
1 parent cfb75bf commit 991afce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
15 changes: 0 additions & 15 deletions pkg/analyzer/lib/src/generated/java_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

library analyzer.src.generated.java_core;

final Stopwatch nanoTimeStopwatch = new Stopwatch();

/**
* Inserts the given arguments into [pattern].
*
Expand Down Expand Up @@ -202,19 +200,6 @@ class JavaString {
}
}

class JavaSystem {
static int currentTimeMillis() {
return (new DateTime.now()).millisecondsSinceEpoch;
}

static int nanoTime() {
if (!nanoTimeStopwatch.isRunning) {
nanoTimeStopwatch.start();
}
return nanoTimeStopwatch.elapsedMicroseconds * 1000;
}
}

class PrintStringWriter extends PrintWriter {
final StringBuffer _sb = new StringBuffer();

Expand Down
4 changes: 3 additions & 1 deletion pkg/analyzer/lib/src/generated/source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class ContentCache {
*/
HashMap<String, int> _stampMap = new HashMap<String, int>();

int _nextStamp = 0;

/**
* Visit all entries of this cache.
*/
Expand Down Expand Up @@ -82,7 +84,7 @@ class ContentCache {
_stampMap.remove(fullName);
return _contentMap.remove(fullName);
} else {
int newStamp = JavaSystem.currentTimeMillis();
int newStamp = _nextStamp++;
int oldStamp = _stampMap[fullName];
_stampMap[fullName] = newStamp;
// Occasionally, if this method is called in rapid succession, the
Expand Down
5 changes: 2 additions & 3 deletions pkg/analyzer/test/src/dart/element/element_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'package:analyzer/src/dart/element/handle.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/generated/engine.dart'
show AnalysisContext, AnalysisOptionsImpl;
import 'package:analyzer/src/generated/java_core.dart';
import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/generated/testing/ast_factory.dart';
import 'package:analyzer/src/generated/testing/element_factory.dart';
Expand Down Expand Up @@ -3942,10 +3941,10 @@ class LibraryElementImplTest extends EngineTestCase {
LibraryElement library = ElementFactory.library(context, "foo");
context.setContents(library.definingCompilationUnit.source, "sdfsdff");
// Assert that we are not up to date if the target has an old time stamp.
expect(library.isUpToDate(0), isFalse);
expect(library.isUpToDate(-1), isFalse);
// Assert that we are up to date with a target modification time in the
// future.
expect(library.isUpToDate(JavaSystem.currentTimeMillis() + 1000), isTrue);
expect(library.isUpToDate(1 << 33), isTrue);
}

void test_setImports() {
Expand Down

0 comments on commit 991afce

Please sign in to comment.