Skip to content

Commit 506dd07

Browse files
scheglovCommit Bot
authored and
Commit Bot
committed
Remove unused portion of java_core.
Change-Id: If0b2b35ca01d5c4f77f22440da0bae3fea903282 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226340 Reviewed-by: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 7dd8732 commit 506dd07

File tree

3 files changed

+11
-193
lines changed

3 files changed

+11
-193
lines changed

pkg/analyzer/lib/src/generated/java_core.dart

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -39,137 +39,3 @@ String formatList(String pattern, List<Object?>? arguments) {
3939
return arguments[index].toString();
4040
});
4141
}
42-
43-
/// Very limited printf implementation, supports only %s and %d.
44-
String _printf(String fmt, List args) {
45-
StringBuffer sb = StringBuffer();
46-
bool markFound = false;
47-
int argIndex = 0;
48-
for (int i = 0; i < fmt.length; i++) {
49-
int c = fmt.codeUnitAt(i);
50-
if (c == 0x25) {
51-
if (markFound) {
52-
sb.writeCharCode(c);
53-
markFound = false;
54-
} else {
55-
markFound = true;
56-
}
57-
continue;
58-
}
59-
if (markFound) {
60-
markFound = false;
61-
// %d
62-
if (c == 0x64) {
63-
sb.write(args[argIndex++]);
64-
continue;
65-
}
66-
// %s
67-
if (c == 0x73) {
68-
sb.write(args[argIndex++]);
69-
continue;
70-
}
71-
// unknown
72-
throw ArgumentError('[$fmt][$i] = 0x${c.toRadixString(16)}');
73-
} else {
74-
sb.writeCharCode(c);
75-
}
76-
}
77-
return sb.toString();
78-
}
79-
80-
class Character {
81-
static const int MAX_VALUE = 0xffff;
82-
static const int MAX_CODE_POINT = 0x10ffff;
83-
static const int MIN_SUPPLEMENTARY_CODE_POINT = 0x010000;
84-
static const int MIN_LOW_SURROGATE = 0xDC00;
85-
static const int MIN_HIGH_SURROGATE = 0xD800;
86-
87-
static int digit(int codePoint, int radix) {
88-
if (radix != 16) {
89-
throw ArgumentError("only radix == 16 is supported");
90-
}
91-
if (0x30 <= codePoint && codePoint <= 0x39) {
92-
return codePoint - 0x30;
93-
}
94-
if (0x41 <= codePoint && codePoint <= 0x46) {
95-
return 0xA + (codePoint - 0x41);
96-
}
97-
if (0x61 <= codePoint && codePoint <= 0x66) {
98-
return 0xA + (codePoint - 0x61);
99-
}
100-
return -1;
101-
}
102-
103-
static bool isDigit(int c) => c >= 0x30 && c <= 0x39;
104-
105-
static bool isLetter(int c) =>
106-
c >= 0x41 && c <= 0x5A || c >= 0x61 && c <= 0x7A;
107-
108-
static bool isLetterOrDigit(int c) => isLetter(c) || isDigit(c);
109-
110-
static bool isWhitespace(int c) =>
111-
c == 0x09 || c == 0x20 || c == 0x0A || c == 0x0D;
112-
113-
static String toChars(int codePoint) {
114-
if (codePoint < 0 || codePoint > MAX_CODE_POINT) {
115-
throw ArgumentError();
116-
}
117-
if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) {
118-
return String.fromCharCode(codePoint);
119-
}
120-
int offset = codePoint - MIN_SUPPLEMENTARY_CODE_POINT;
121-
int c0 = ((offset & 0x7FFFFFFF) >> 10) + MIN_HIGH_SURROGATE;
122-
int c1 = (offset & 0x3ff) + MIN_LOW_SURROGATE;
123-
return String.fromCharCodes([c0, c1]);
124-
}
125-
}
126-
127-
@deprecated
128-
abstract class Enum<E extends Enum<E>> implements Comparable<E> {
129-
/// The name of this enum constant, as declared in the enum declaration.
130-
final String name;
131-
132-
/// The position in the enum declaration.
133-
final int ordinal;
134-
135-
const Enum(this.name, this.ordinal);
136-
137-
@override
138-
int get hashCode => ordinal;
139-
140-
@override
141-
int compareTo(E other) => ordinal - other.ordinal;
142-
143-
@override
144-
String toString() => name;
145-
}
146-
147-
@deprecated
148-
class PrintStringWriter extends PrintWriter {
149-
final StringBuffer _sb = StringBuffer();
150-
151-
@override
152-
void print(Object x) {
153-
_sb.write(x);
154-
}
155-
156-
@override
157-
String toString() => _sb.toString();
158-
}
159-
160-
abstract class PrintWriter {
161-
void newLine() {
162-
print('\n');
163-
}
164-
165-
void print(Object x);
166-
167-
void printf(String fmt, List args) {
168-
print(_printf(fmt, args));
169-
}
170-
171-
void println(String s) {
172-
print(s);
173-
newLine();
174-
}
175-
}

pkg/analyzer/lib/src/generated/utilities_collection.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'package:analyzer/src/generated/java_core.dart';
6-
75
/// Returns `true` if a and b contain equal elements in the same order.
86
bool listsEqual(List a, List b) {
97
// TODO(rnystrom): package:collection also implements this, and analyzer
@@ -34,11 +32,6 @@ class BooleanArray {
3432
return (array & (1 << index)) > 0;
3533
}
3634

37-
/// Return the value of the element at the given index.
38-
@deprecated
39-
static bool getEnum<E extends Enum<E>>(int array, Enum<E> index) =>
40-
get(array, index.ordinal);
41-
4235
/// Set the value of the element of the given [array] at the given [index] to
4336
/// the given [value].
4437
static int set(int array, int index, bool value) {
@@ -50,11 +43,6 @@ class BooleanArray {
5043
}
5144
}
5245

53-
/// Set the value of the element at the given index to the given value.
54-
@deprecated
55-
static int setEnum<E extends Enum<E>>(int array, Enum<E> index, bool value) =>
56-
set(array, index.ordinal, value);
57-
5846
/// Throw an exception if the index is not within the bounds allowed for an
5947
/// integer-encoded array of boolean values.
6048
static void _checkIndex(int index) {

pkg/analyzer/test/generated/java_core_test.dart

Lines changed: 11 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,17 @@ import 'package:analyzer/src/generated/java_core.dart';
66
import 'package:test/test.dart';
77

88
main() {
9-
group('Character', () {
10-
group('isLetter', () {
11-
test('digits', () {
12-
expect(Character.isLetter('0'.codeUnitAt(0)), isFalse);
13-
expect(Character.isLetter('1'.codeUnitAt(0)), isFalse);
14-
expect(Character.isLetter('9'.codeUnitAt(0)), isFalse);
15-
});
16-
17-
test('letters', () {
18-
expect(Character.isLetter('a'.codeUnitAt(0)), isTrue);
19-
expect(Character.isLetter('b'.codeUnitAt(0)), isTrue);
20-
expect(Character.isLetter('z'.codeUnitAt(0)), isTrue);
21-
expect(Character.isLetter('C'.codeUnitAt(0)), isTrue);
22-
expect(Character.isLetter('D'.codeUnitAt(0)), isTrue);
23-
expect(Character.isLetter('Y'.codeUnitAt(0)), isTrue);
24-
});
25-
26-
test('other', () {
27-
expect(Character.isLetter(' '.codeUnitAt(0)), isFalse);
28-
expect(Character.isLetter('.'.codeUnitAt(0)), isFalse);
29-
expect(Character.isLetter('-'.codeUnitAt(0)), isFalse);
30-
expect(Character.isLetter('+'.codeUnitAt(0)), isFalse);
31-
});
32-
});
33-
34-
group('isLetterOrDigit', () {
35-
test('digits', () {
36-
expect(Character.isLetterOrDigit('0'.codeUnitAt(0)), isTrue);
37-
expect(Character.isLetterOrDigit('1'.codeUnitAt(0)), isTrue);
38-
expect(Character.isLetterOrDigit('9'.codeUnitAt(0)), isTrue);
39-
});
40-
41-
test('letters', () {
42-
expect(Character.isLetterOrDigit('a'.codeUnitAt(0)), isTrue);
43-
expect(Character.isLetterOrDigit('b'.codeUnitAt(0)), isTrue);
44-
expect(Character.isLetterOrDigit('z'.codeUnitAt(0)), isTrue);
45-
expect(Character.isLetterOrDigit('C'.codeUnitAt(0)), isTrue);
46-
expect(Character.isLetterOrDigit('D'.codeUnitAt(0)), isTrue);
47-
expect(Character.isLetterOrDigit('Y'.codeUnitAt(0)), isTrue);
48-
});
9+
test('formatList', () {
10+
expect(
11+
format('Hello, {0} {1}!', 'John', 'Doe'),
12+
'Hello, John Doe!',
13+
);
14+
});
4915

50-
test('other', () {
51-
expect(Character.isLetterOrDigit(' '.codeUnitAt(0)), isFalse);
52-
expect(Character.isLetterOrDigit('.'.codeUnitAt(0)), isFalse);
53-
expect(Character.isLetterOrDigit('-'.codeUnitAt(0)), isFalse);
54-
expect(Character.isLetterOrDigit('+'.codeUnitAt(0)), isFalse);
55-
});
56-
});
16+
test('formatList', () {
17+
expect(
18+
formatList('Hello, {0} {1}!', ['John', 'Doe']),
19+
'Hello, John Doe!',
20+
);
5721
});
5822
}

0 commit comments

Comments
 (0)