Skip to content

Commit 1ef880d

Browse files
committed
Review feedback
1 parent dcf9006 commit 1ef880d

File tree

12 files changed

+139
-50
lines changed

12 files changed

+139
-50
lines changed

gwt.iml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="CheckStyle-IDEA-Module" serialisationVersion="2">
4+
<option name="activeLocationsIds" />
5+
</component>
6+
<component name="NewModuleRootManager" inherit-compiler-output="true">
7+
<exclude-output />
8+
<content url="file://$MODULE_DIR$">
9+
<sourceFolder url="file://$MODULE_DIR$/build_tools/doctool/src" isTestSource="false" />
10+
<sourceFolder url="file://$MODULE_DIR$/dev/codeserver/java" isTestSource="false" />
11+
<sourceFolder url="file://$MODULE_DIR$/dev/core/src" isTestSource="false" />
12+
<sourceFolder url="file://$MODULE_DIR$/dev/core/super" isTestSource="false" />
13+
<sourceFolder url="file://$MODULE_DIR$/dev/core/test" isTestSource="true" />
14+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
15+
<sourceFolder url="file://$MODULE_DIR$/user/src" isTestSource="false" />
16+
<sourceFolder url="file://$MODULE_DIR$/user/test" isTestSource="true" />
17+
<sourceFolder url="file://$MODULE_DIR$/samples/dynatable/src" isTestSource="false" />
18+
<sourceFolder url="file://$MODULE_DIR$/tools/api-checker/src" isTestSource="false" />
19+
<sourceFolder url="file://$MODULE_DIR$/user/super/com/google/gwt/emul" isTestSource="false" />
20+
</content>
21+
<orderEntry type="inheritedJdk" />
22+
<orderEntry type="sourceFolder" forTests="false" />
23+
<orderEntry type="module-library">
24+
<library>
25+
<CLASSES>
26+
<root url="jar://$MODULE_DIR$/../tools/lib/htmlunit/htmlunit-4.11.1/htmlunit-4.11.1.jar!/" />
27+
</CLASSES>
28+
<JAVADOC />
29+
<SOURCES />
30+
</library>
31+
</orderEntry>
32+
<orderEntry type="module-library">
33+
<library>
34+
<CLASSES>
35+
<root url="jar://$MODULE_DIR$/../tools/lib/htmlunit/htmlunit-4.11.1/htmlunit-core-js-4.11.0-unicode.jar!/" />
36+
</CLASSES>
37+
<JAVADOC />
38+
<SOURCES />
39+
</library>
40+
</orderEntry>
41+
<orderEntry type="module-library">
42+
<library>
43+
<CLASSES>
44+
<root url="jar://$MODULE_DIR$/../tools/lib/htmlunit/htmlunit-4.11.1/htmlunit-core-js-4.11.0.jar!/" />
45+
</CLASSES>
46+
<JAVADOC />
47+
<SOURCES />
48+
</library>
49+
</orderEntry>
50+
<orderEntry type="module-library">
51+
<library>
52+
<CLASSES>
53+
<root url="jar://$MODULE_DIR$/../tools/lib/htmlunit/htmlunit-4.11.1/htmlunit-csp-4.11.0.jar!/" />
54+
</CLASSES>
55+
<JAVADOC />
56+
<SOURCES />
57+
</library>
58+
</orderEntry>
59+
<orderEntry type="module-library">
60+
<library>
61+
<CLASSES>
62+
<root url="jar://$MODULE_DIR$/../tools/lib/htmlunit/htmlunit-4.11.1/htmlunit-cssparser-4.11.0.jar!/" />
63+
</CLASSES>
64+
<JAVADOC />
65+
<SOURCES />
66+
</library>
67+
</orderEntry>
68+
<orderEntry type="module-library">
69+
<library>
70+
<CLASSES>
71+
<root url="jar://$MODULE_DIR$/../tools/lib/htmlunit/htmlunit-4.11.1/htmlunit-websocket-client-4.11.0.jar!/" />
72+
</CLASSES>
73+
<JAVADOC />
74+
<SOURCES />
75+
</library>
76+
</orderEntry>
77+
<orderEntry type="module-library">
78+
<library>
79+
<CLASSES>
80+
<root url="jar://$MODULE_DIR$/../tools/lib/htmlunit/htmlunit-4.11.1/htmlunit-xpath-4.11.0.jar!/" />
81+
</CLASSES>
82+
<JAVADOC />
83+
<SOURCES />
84+
</library>
85+
</orderEntry>
86+
<orderEntry type="module-library">
87+
<library>
88+
<CLASSES>
89+
<root url="jar://$MODULE_DIR$/../tools/lib/htmlunit/htmlunit-4.11.1/neko-htmlunit-4.11.0.jar!/" />
90+
</CLASSES>
91+
<JAVADOC />
92+
<SOURCES />
93+
</library>
94+
</orderEntry>
95+
<orderEntry type="library" name="ecj-3.33.0-sources" level="project" />
96+
</component>
97+
</module>

user/super/com/google/gwt/emul/java/lang/String.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,8 @@ public String stripIndent() {
854854
}
855855
// the last line affects minIndent even if blank
856856
minIndent = Math.min(minIndent, lines.get(lines.size() - 1).getLeadingWhitespaceLength());
857-
suffix = "\n";
858857
} else {
858+
suffix = "\n";
859859
minIndent = 0;
860860
}
861861
final int outdent = minIndent;

user/super/com/google/gwt/emul/java/util/stream/Collectors.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,15 @@ public static <T, A, R, RR> Collector<T, A, RR> collectingAndThen(
7474
}
7575

7676
public static <T,R1,R2,R> Collector<T,?,R> teeing(Collector<? super T,?,R1> downstream1,
77-
Collector<? super T,?,R2> downstream2,
78-
BiFunction<? super R1,? super R2,R> merger) {
77+
Collector<? super T,?,R2> downstream2, BiFunction<? super R1,? super R2,R> merger) {
7978
return teeing2(downstream1, downstream2, merger);
8079
}
8180

8281
private static <T,R1,R2,R,X,Y> Collector<T,?,R> teeing2(Collector<? super T,X,R1> downstream1,
83-
Collector<? super T,Y,R2> downstream2,
84-
BiFunction<? super R1,? super R2,R> merger) {
82+
Collector<? super T,Y,R2> downstream2, BiFunction<? super R1,? super R2,R> merger) {
8583
return Collector.of(
86-
() -> new AbstractMap.SimpleEntry<>(downstream1.supplier().get(), downstream2.supplier().get()),
84+
() -> new AbstractMap.SimpleEntry<>(downstream1.supplier().get(),
85+
downstream2.supplier().get()),
8786
(a,b) -> {
8887
downstream1.accumulator().accept(a.getKey(), b);
8988
downstream2.accumulator().accept(a.getValue(), b);
@@ -98,7 +97,6 @@ private static <T,R1,R2,R,X,Y> Collector<T,?,R> teeing2(Collector<? super T,X,R1
9897
);
9998
}
10099

101-
102100
public static <T> Collector<T,?,Long> counting() {
103101
// Using Long::sum here fails in JDT
104102
return reducing(0L, item -> 1L, (a, b) -> (Long) a.longValue() + b.longValue());

user/super/com/google/gwt/emul/java/util/stream/DoubleStream.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717

1818
import static javaemul.internal.InternalPreconditions.checkState;
1919

20-
import java.util.ArrayList;
2120
import java.util.Arrays;
2221
import java.util.DoubleSummaryStatistics;
23-
import java.util.List;
2422
import java.util.OptionalDouble;
2523
import java.util.PrimitiveIterator;
2624
import java.util.Spliterator;
@@ -330,9 +328,9 @@ public boolean tryAdvance(DoubleConsumer action) {
330328

331329
default DoubleStream mapMulti(DoubleStream.DoubleMapMultiConsumer mapper) {
332330
return flatMap(element -> {
333-
List<Double> buffer = new ArrayList<>();
334-
mapper.accept(element, (DoubleConsumer) buffer::add);
335-
return buffer.stream().mapToDouble(n -> n);
331+
Builder builder = builder();
332+
mapper.accept(element, (DoubleConsumer) builder::add);
333+
return builder.build();
336334
});
337335
}
338336

user/super/com/google/gwt/emul/java/util/stream/IntStream.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717

1818
import static javaemul.internal.InternalPreconditions.checkState;
1919

20-
import java.util.ArrayList;
2120
import java.util.Arrays;
2221
import java.util.Comparator;
2322
import java.util.IntSummaryStatistics;
24-
import java.util.List;
2523
import java.util.OptionalDouble;
2624
import java.util.OptionalInt;
2725
import java.util.PrimitiveIterator;
@@ -379,9 +377,9 @@ public boolean tryAdvance(IntConsumer action) {
379377

380378
default IntStream mapMulti(IntMapMultiConsumer mapper) {
381379
return flatMap(element -> {
382-
List<Integer> buffer = new ArrayList<>();
383-
mapper.accept(element, (IntConsumer) buffer::add);
384-
return buffer.stream().mapToInt(n -> n);
380+
Builder builder = builder();
381+
mapper.accept(element, (IntConsumer) builder::add);
382+
return builder.build();
385383
});
386384
}
387385

user/super/com/google/gwt/emul/java/util/stream/LongStream.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717

1818
import static javaemul.internal.InternalPreconditions.checkState;
1919

20-
import java.util.ArrayList;
2120
import java.util.Arrays;
2221
import java.util.Comparator;
23-
import java.util.List;
2422
import java.util.LongSummaryStatistics;
2523
import java.util.OptionalDouble;
2624
import java.util.OptionalLong;
@@ -377,9 +375,9 @@ public boolean tryAdvance(LongConsumer action) {
377375

378376
default LongStream mapMulti(LongStream.LongMapMultiConsumer mapper) {
379377
return flatMap(element -> {
380-
List<Long> buffer = new ArrayList<>();
381-
mapper.accept(element, (LongConsumer) buffer::add);
382-
return buffer.stream().mapToLong(n -> n);
378+
Builder builder = builder();
379+
mapper.accept(element, (LongConsumer) builder::add);
380+
return builder.build();
383381
});
384382
}
385383

user/test-super/com/google/gwt/emultest/super/com/google/gwt/emultest/java17/util/stream/DoubleStreamTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ public void testMapMulti() {
2727
callback.accept(num + num);
2828
};
2929
assertEquals(new double[0],
30-
hideFromCompiler(DoubleStream.of()).mapMulti(doubling).toArray());
30+
DoubleStream.of().mapMulti(doubling).toArray());
3131
assertEquals(new double[]{1.0, 2.0, 3.0, 6.0},
32-
hideFromCompiler(DoubleStream.of(1.0, 3.0)).mapMulti(doubling).toArray());
32+
DoubleStream.of(1.0, 3.0).mapMulti(doubling).toArray());
3333
assertEquals(new double[0],
34-
hideFromCompiler(DoubleStream.of(1.0, 2.0)).mapMulti((a, b) -> {
35-
}).toArray());
34+
DoubleStream.of(1.0, 2.0).mapMulti((a, b) -> {}).toArray());
3635
}
3736
}

user/test-super/com/google/gwt/emultest/super/com/google/gwt/emultest/java17/util/stream/IntStreamTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ public void testMapMulti() {
2828
callback.accept(num + num);
2929
};
3030
assertEquals(new int[0],
31-
hideFromCompiler(IntStream.of()).mapMulti(doubling).toArray());
31+
IntStream.of().mapMulti(doubling).toArray());
3232
assertEquals(new int[]{1, 2, 3, 6},
33-
hideFromCompiler(IntStream.of(1, 3)).mapMulti(doubling).toArray());
33+
IntStream.of(1, 3).mapMulti(doubling).toArray());
3434
assertEquals(new int[0],
35-
hideFromCompiler(IntStream.of(1, 3)).mapMulti((a, b) -> {
36-
}).toArray());
35+
IntStream.of(1, 3).mapMulti((a, b) -> {}).toArray());
3736
}
3837
}

user/test-super/com/google/gwt/emultest/super/com/google/gwt/emultest/java17/util/stream/LongStreamTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ public void testMapMulti() {
2727
callback.accept(num + num);
2828
};
2929
assertEquals(new long[0],
30-
hideFromCompiler(LongStream.of()).mapMulti(doubling).toArray());
30+
LongStream.of().mapMulti(doubling).toArray());
3131
assertEquals(new long[]{1L, 2L, 3L, 6L},
32-
hideFromCompiler(LongStream.of(1L, 3L)).mapMulti(doubling).toArray());
32+
LongStream.of(1L, 3L).mapMulti(doubling).toArray());
3333
assertEquals(new long[0],
34-
hideFromCompiler(LongStream.of(1L, 2L)).mapMulti((a, b) -> {
35-
}).toArray());
34+
LongStream.of(1L, 2L).mapMulti((a, b) -> {}).toArray());
3635
}
3736
}

user/test-super/com/google/gwt/emultest/super/com/google/gwt/emultest/java17/util/stream/StreamTest.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ public void testMapMulti() {
4040
callback.accept(str + str);
4141
};
4242
assertEquals(Arrays.asList(),
43-
this.<Stream<String>>hideFromCompiler(Stream.of()).<String>mapMulti(doubling).toList());
43+
Stream.<String>of().mapMulti(doubling).toList());
4444
assertEquals(Arrays.asList("a", "aa", "b", "bb"),
45-
hideFromCompiler(Stream.of("a", "b")).<String>mapMulti(doubling).toList());
45+
Stream.of("a", "b").<String>mapMulti(doubling).toList());
4646
assertEquals(Arrays.asList(),
47-
hideFromCompiler(Stream.of("a", "b")).mapMulti((a, b) -> {
48-
}).toList());
47+
Stream.of("a", "b").mapMulti((a, b) -> {}).toList());
4948
}
5049

5150
public void testMapMultiToInt() {
@@ -54,12 +53,11 @@ public void testMapMultiToInt() {
5453
callback.accept(str.length() * 2);
5554
};
5655
assertEquals(new int[]{1, 2, 3, 6},
57-
hideFromCompiler(Stream.of("a", "bbb")).mapMultiToInt(doubling).toArray());
56+
Stream.of("a", "bbb").mapMultiToInt(doubling).toArray());
5857
assertEquals(new int[0],
59-
hideFromCompiler(Stream.<String>of()).mapMultiToInt(doubling).toArray());
58+
Stream.<String>of().mapMultiToInt(doubling).toArray());
6059
assertEquals(new int[0],
61-
hideFromCompiler(Stream.of("a", "b")).mapMultiToInt((a, b) -> {
62-
}).toArray());
60+
Stream.of("a", "b").mapMultiToInt((a, b) -> {}).toArray());
6361
}
6462

6563
public void testMapMultiToLong() {
@@ -68,11 +66,11 @@ public void testMapMultiToLong() {
6866
callback.accept(str.length() * 2L);
6967
};
7068
assertEquals(new long[]{1L, 2L, 3L, 6L},
71-
hideFromCompiler(Stream.of("a", "bbb")).mapMultiToLong(doubling).toArray());
69+
Stream.of("a", "bbb").mapMultiToLong(doubling).toArray());
7270
assertEquals(new long[0],
73-
hideFromCompiler(Stream.<String>of()).mapMultiToLong(doubling).toArray());
71+
Stream.<String>of().mapMultiToLong(doubling).toArray());
7472
assertEquals(new long[0],
75-
hideFromCompiler(Stream.of("a", "b")).mapMultiToLong((a, b) -> {
73+
Stream.of("a", "b").mapMultiToLong((a, b) -> {
7674
}).toArray());
7775
}
7876

@@ -82,11 +80,10 @@ public void testMapMultiToDouble() {
8280
callback.accept(str.length() * 2);
8381
};
8482
assertEquals(new double[]{1.0, 2.0, 3.0, 6.0},
85-
hideFromCompiler(Stream.of("a", "bbb")).mapMultiToDouble(doubling).toArray());
83+
Stream.of("a", "bbb").mapMultiToDouble(doubling).toArray());
8684
assertEquals(new double[0],
87-
hideFromCompiler(Stream.<String>of()).mapMultiToDouble(doubling).toArray());
85+
Stream.<String>of().mapMultiToDouble(doubling).toArray());
8886
assertEquals(new double[0],
89-
hideFromCompiler(Stream.of("a", "b")).mapMultiToDouble((a, b) -> {
90-
}).toArray());
87+
Stream.of("a", "b").mapMultiToDouble((a, b) -> {}).toArray());
9188
}
9289
}

0 commit comments

Comments
 (0)