Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ef6162

Browse files
agoss94Andreas Goss
and
Andreas Goss
authored
Adjust generic parameters for PECS principle. (#214)
Spotless updateCo-authored-by: Andreas Goss <agoss@itemis.com>
1 parent5e1a9bd commit1ef6162

File tree

9 files changed

+66
-56
lines changed

9 files changed

+66
-56
lines changed

‎java-diff-utils-jgit/src/main/java/com/github/difflib/algorithm/jgit/HistogramDiff.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
publicclassHistogramDiff<T>implementsDiffAlgorithmI<T> {
3737

3838
@Override
39-
publicList<Change>computeDiff(List<T>source,List<T>target,DiffAlgorithmListenerprogress) {
39+
publicList<Change>computeDiff(
40+
List<?extendsT>source,List<?extendsT>target,DiffAlgorithmListenerprogress) {
4041
Objects.requireNonNull(source,"source list must not be null");
4142
Objects.requireNonNull(target,"target list must not be null");
4243
if (progress !=null) {
@@ -92,9 +93,9 @@ public int hash(DataList<T> s, int i) {
9293

9394
classDataList<T>extendsSequence {
9495

95-
finalList<T>data;
96+
finalList<?extendsT>data;
9697

97-
publicDataList(List<T>data) {
98+
publicDataList(List<?extendsT>data) {
9899
this.data =data;
99100
}
100101

‎java-diff-utils/src/main/java/com/github/difflib/DiffUtils.java‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ public static void withDefaultDiffAlgorithmFactory(DiffAlgorithmFactory factory)
5757
* @param progress a {@link DiffAlgorithmListener} representing the progress listener. Can be {@code null}.
5858
* @return The patch describing the difference between the original and revised sequences. Never {@code null}.
5959
*/
60-
publicstatic <T>Patch<T>diff(List<T>original,List<T>revised,DiffAlgorithmListenerprogress) {
60+
publicstatic <T>Patch<T>diff(
61+
List<?extendsT>original,List<?extendsT>revised,DiffAlgorithmListenerprogress) {
6162
returnDiffUtils.diff(original,revised,DEFAULT_DIFF.create(),progress);
6263
}
6364

@@ -69,7 +70,7 @@ public static <T> Patch<T> diff(List<T> original, List<T> revised, DiffAlgorithm
6970
* @param revised a {@link List} representing the revised sequence of elements. Must not be {@code null}.
7071
* @return The patch describing the difference between the original and revised sequences. Never {@code null}.
7172
*/
72-
publicstatic <T>Patch<T>diff(List<T>original,List<T>revised) {
73+
publicstatic <T>Patch<T>diff(List<?extendsT>original,List<?extendsT>revised) {
7374
returnDiffUtils.diff(original,revised,DEFAULT_DIFF.create(),null);
7475
}
7576

@@ -82,7 +83,7 @@ public static <T> Patch<T> diff(List<T> original, List<T> revised) {
8283
* @param includeEqualParts a {@link boolean} representing whether to include equal parts in the resulting patch.
8384
* @return The patch describing the difference between the original and revised sequences. Never {@code null}.
8485
*/
85-
publicstatic <T>Patch<T>diff(List<T>original,List<T>revised,booleanincludeEqualParts) {
86+
publicstatic <T>Patch<T>diff(List<?extendsT>original,List<?extendsT>revised,booleanincludeEqualParts) {
8687
returnDiffUtils.diff(original,revised,DEFAULT_DIFF.create(),null,includeEqualParts);
8788
}
8889

@@ -110,15 +111,19 @@ public static Patch<String> diff(String sourceText, String targetText, DiffAlgor
110111
* @return The patch describing the difference between the original and
111112
* revised sequences. Never {@code null}.
112113
*/
113-
publicstatic <T>Patch<T>diff(List<T>source,List<T>target,BiPredicate<T,T>equalizer) {
114+
publicstatic <T>Patch<T>diff(
115+
List<?extendsT>source,List<?extendsT>target,BiPredicate<?superT, ?superT>equalizer) {
114116
if (equalizer !=null) {
115117
returnDiffUtils.diff(source,target,DEFAULT_DIFF.create(equalizer));
116118
}
117119
returnDiffUtils.diff(source,target,newMyersDiff<>());
118120
}
119121

120122
publicstatic <T>Patch<T>diff(
121-
List<T>original,List<T>revised,DiffAlgorithmI<T>algorithm,DiffAlgorithmListenerprogress) {
123+
List<?extendsT>original,
124+
List<?extendsT>revised,
125+
DiffAlgorithmI<T>algorithm,
126+
DiffAlgorithmListenerprogress) {
122127
returndiff(original,revised,algorithm,progress,false);
123128
}
124129

@@ -135,8 +140,8 @@ public static <T> Patch<T> diff(
135140
* revised sequences. Never {@code null}.
136141
*/
137142
publicstatic <T>Patch<T>diff(
138-
List<T>original,
139-
List<T>revised,
143+
List<?extendsT>original,
144+
List<?extendsT>revised,
140145
DiffAlgorithmI<T>algorithm,
141146
DiffAlgorithmListenerprogress,
142147
booleanincludeEqualParts) {
@@ -157,7 +162,8 @@ public static <T> Patch<T> diff(
157162
* @return The patch describing the difference between the original and
158163
* revised sequences. Never {@code null}.
159164
*/
160-
publicstatic <T>Patch<T>diff(List<T>original,List<T>revised,DiffAlgorithmI<T>algorithm) {
165+
publicstatic <T>Patch<T>diff(
166+
List<?extendsT>original,List<?extendsT>revised,DiffAlgorithmI<T>algorithm) {
161167
returndiff(original,revised,algorithm,null);
162168
}
163169

@@ -196,7 +202,7 @@ public static Patch<String> diffInline(String original, String revised) {
196202
* @return the revised list.
197203
* @throws PatchFailedException if the patch cannot be applied.
198204
*/
199-
publicstatic <T>List<T>patch(List<T>original,Patch<T>patch)throwsPatchFailedException {
205+
publicstatic <T>List<T>patch(List<?extendsT>original,Patch<T>patch)throwsPatchFailedException {
200206
returnpatch.applyTo(original);
201207
}
202208

@@ -208,7 +214,7 @@ public static <T> List<T> patch(List<T> original, Patch<T> patch) throws PatchFa
208214
* @return the original list.
209215
* @throws PatchFailedException if the patch cannot be applied.
210216
*/
211-
publicstatic <T>List<T>unpatch(List<T>revised,Patch<T>patch) {
217+
publicstatic <T>List<T>unpatch(List<?extendsT>revised,Patch<T>patch) {
212218
returnpatch.restore(revised);
213219
}
214220

‎java-diff-utils/src/main/java/com/github/difflib/algorithm/DiffAlgorithmFactory.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
publicinterfaceDiffAlgorithmFactory {
2626
<T>DiffAlgorithmI<T>create();
2727

28-
<T>DiffAlgorithmI<T>create(BiPredicate<T,T>equalizer);
28+
<T>DiffAlgorithmI<T>create(BiPredicate<?superT, ?superT>equalizer);
2929
}

‎java-diff-utils/src/main/java/com/github/difflib/algorithm/DiffAlgorithmI.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public interface DiffAlgorithmI<T> {
3434
* @param progress progress listener
3535
* @return
3636
*/
37-
List<Change>computeDiff(List<T>source,List<T>target,DiffAlgorithmListenerprogress);
37+
List<Change>computeDiff(List<?extendsT>source,List<?extendsT>target,DiffAlgorithmListenerprogress);
3838

3939
/**
4040
* Simple extension to compute a changeset using arrays.

‎java-diff-utils/src/main/java/com/github/difflib/algorithm/myers/MyersDiff.java‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
*/
3232
publicfinalclassMyersDiff<T>implementsDiffAlgorithmI<T> {
3333

34-
privatefinalBiPredicate<T,T>equalizer;
34+
privatefinalBiPredicate<?superT, ?superT>equalizer;
3535

3636
publicMyersDiff() {
3737
equalizer =Object::equals;
3838
}
3939

40-
publicMyersDiff(finalBiPredicate<T,T>equalizer) {
40+
publicMyersDiff(finalBiPredicate<?superT, ?superT>equalizer) {
4141
Objects.requireNonNull(equalizer,"equalizer must not be null");
4242
this.equalizer =equalizer;
4343
}
@@ -48,7 +48,8 @@ public MyersDiff(final BiPredicate<T, T> equalizer) {
4848
* Return empty diff if get the error while procession the difference.
4949
*/
5050
@Override
51-
publicList<Change>computeDiff(finalList<T>source,finalList<T>target,DiffAlgorithmListenerprogress) {
51+
publicList<Change>computeDiff(
52+
finalList<?extendsT>source,finalList<?extendsT>target,DiffAlgorithmListenerprogress) {
5253
Objects.requireNonNull(source,"source list must not be null");
5354
Objects.requireNonNull(target,"target list must not be null");
5455

@@ -71,9 +72,10 @@ public List<Change> computeDiff(final List<T> source, final List<T> target, Diff
7172
* @param orig The original sequence.
7273
* @param rev The revised sequence.
7374
* @return A minimum {@link PathNode Path} accross the differences graph.
74-
* @throwsDifferentiationFailedException if a diff path could not be found.
75+
* @throwsIllegalStateException if a diff path could not be found.
7576
*/
76-
privatePathNodebuildPath(finalList<T>orig,finalList<T>rev,DiffAlgorithmListenerprogress) {
77+
privatePathNodebuildPath(
78+
finalList<?extendsT>orig,finalList<?extendsT>rev,DiffAlgorithmListenerprogress) {
7779
Objects.requireNonNull(orig,"original sequence is null");
7880
Objects.requireNonNull(rev,"revised sequence is null");
7981

@@ -140,10 +142,10 @@ private PathNode buildPath(final List<T> orig, final List<T> rev, DiffAlgorithmL
140142
* @param orig The original sequence.
141143
* @param rev The revised sequence.
142144
* @return A {@link Patch} script corresponding to the path.
143-
* @throwsDifferentiationFailedException if a {@link Patch} could not be
145+
* @throwsIllegalStateException if a {@link Patch} could not be
144146
* built from the given path.
145147
*/
146-
privateList<Change>buildRevision(PathNodeactualPath,List<T>orig,List<T>rev) {
148+
privateList<Change>buildRevision(PathNodeactualPath,List<?extendsT>orig,List<?extendsT>rev) {
147149
Objects.requireNonNull(actualPath,"path is null");
148150
Objects.requireNonNull(orig,"original sequence is null");
149151
Objects.requireNonNull(rev,"revised sequence is null");
@@ -190,7 +192,7 @@ public <T> DiffAlgorithmI<T> create() {
190192
}
191193

192194
@Override
193-
public <T>DiffAlgorithmI<T>create(BiPredicate<T,T>equalizer) {
195+
public <T>DiffAlgorithmI<T>create(BiPredicate<?superT, ?superT>equalizer) {
194196
returnnewMyersDiff<>(equalizer);
195197
}
196198
};

‎java-diff-utils/src/main/java/com/github/difflib/algorithm/myers/MyersDiffWithLinearSpace.java‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@
3232
*/
3333
publicclassMyersDiffWithLinearSpace<T>implementsDiffAlgorithmI<T> {
3434

35-
privatefinalBiPredicate<T,T>equalizer;
35+
privatefinalBiPredicate<?superT, ?superT>equalizer;
3636

3737
publicMyersDiffWithLinearSpace() {
3838
equalizer =Object::equals;
3939
}
4040

41-
publicMyersDiffWithLinearSpace(finalBiPredicate<T,T>equalizer) {
41+
publicMyersDiffWithLinearSpace(finalBiPredicate<?superT, ?superT>equalizer) {
4242
Objects.requireNonNull(equalizer,"equalizer must not be null");
4343
this.equalizer =equalizer;
4444
}
4545

4646
@Override
47-
publicList<Change>computeDiff(List<T>source,List<T>target,DiffAlgorithmListenerprogress) {
47+
publicList<Change>computeDiff(
48+
List<?extendsT>source,List<?extendsT>target,DiffAlgorithmListenerprogress) {
4849
Objects.requireNonNull(source,"source list must not be null");
4950
Objects.requireNonNull(target,"target list must not be null");
5051

@@ -200,10 +201,10 @@ private class DiffData {
200201
finalint[]vDown;
201202
finalint[]vUp;
202203
finalList<Change>script;
203-
finalList<T>source;
204-
finalList<T>target;
204+
finalList<?extendsT>source;
205+
finalList<?extendsT>target;
205206

206-
publicDiffData(List<T>source,List<T>target) {
207+
publicDiffData(List<?extendsT>source,List<?extendsT>target) {
207208
this.source =source;
208209
this.target =target;
209210
size =source.size() +target.size() +2;
@@ -237,7 +238,7 @@ public <T> DiffAlgorithmI<T> create() {
237238
}
238239

239240
@Override
240-
public <T>DiffAlgorithmI<T>create(BiPredicate<T,T>equalizer) {
241+
public <T>DiffAlgorithmI<T>create(BiPredicate<?superT, ?superT>equalizer) {
241242
returnnewMyersDiffWithLinearSpace<>(equalizer);
242243
}
243244
};

‎java-diff-utils/src/main/java/com/github/difflib/patch/EqualDelta.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
importjava.util.List;
1919

2020
/**
21-
* This delta contains equal lines of data. Therefore nothing is to do in applyTo and restore.
21+
* This delta contains equal lines of data. Therefore, nothing is to do in applyTo and restore.
2222
* @author tobens
2323
*/
2424
publicclassEqualDelta<T>extendsAbstractDelta<T> {
@@ -49,6 +49,6 @@ public String toString() {
4949

5050
@Override
5151
publicAbstractDelta<T>withChunks(Chunk<T>original,Chunk<T>revised) {
52-
returnnewEqualDelta<T>(original,revised);
52+
returnnewEqualDelta<>(original,revised);
5353
}
5454
}

‎java-diff-utils/src/main/java/com/github/difflib/patch/Patch.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public Patch(int estimatedPatchSize) {
5454
* @return A new list containing the applied patch.
5555
* @throws PatchFailedException if the patch cannot be applied
5656
*/
57-
publicList<T>applyTo(List<T>target)throwsPatchFailedException {
57+
publicList<T>applyTo(List<?extendsT>target)throwsPatchFailedException {
5858
List<T>result =newArrayList<>(target);
5959
applyToExisting(result);
6060
returnresult;
@@ -244,7 +244,7 @@ public Patch withConflictOutput(ConflictOutput<T> conflictOutput) {
244244
* @param target The list to copy and apply changes to.
245245
* @return A new list, containing the restored state.
246246
*/
247-
publicList<T>restore(List<T>target) {
247+
publicList<T>restore(List<?extendsT>target) {
248248
List<T>result =newArrayList<>(target);
249249
restoreToExisting(result);
250250
returnresult;
@@ -294,12 +294,12 @@ public static <T> Patch<T> generate(List<T> original, List<T> revised, List<Chan
294294
returngenerate(original,revised,changes,false);
295295
}
296296

297-
privatestatic <T>Chunk<T>buildChunk(intstart,intend,List<T>data) {
297+
privatestatic <T>Chunk<T>buildChunk(intstart,intend,List<?extendsT>data) {
298298
returnnewChunk<>(start,newArrayList<>(data.subList(start,end)));
299299
}
300300

301301
publicstatic <T>Patch<T>generate(
302-
List<T>original,List<T>revised,List<Change>_changes,booleanincludeEquals) {
302+
List<?extendsT>original,List<?extendsT>revised,List<Change>_changes,booleanincludeEquals) {
303303
Patch<T>patch =newPatch<>(_changes.size());
304304
intstartOriginal =0;
305305
intstartRevised =0;

‎pom.xml‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -132,28 +132,28 @@
132132
<sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
133133
<checkstyleRules>
134134
<modulename="Checker">
135-
<modulename="SuppressWarningsFilter"/>
135+
<modulename="SuppressWarningsFilter"/>
136136
<modulename="TreeWalker">
137-
<modulename="SuppressionCommentFilter"/>
138-
<modulename="AvoidNestedBlocks"/>
139-
<modulename="ConstantName"/>
140-
<modulename="EmptyCatchBlock"/>
141-
<modulename="EmptyStatement"/>
142-
<modulename="MissingOverride"/>
143-
<modulename="MultipleVariableDeclarations"/>
144-
<modulename="ParameterAssignment"/>
145-
<modulename="StringLiteralEquality"/>
146-
<modulename="RedundantImport"/>
147-
<modulename="UnusedImports"/>
137+
<modulename="SuppressionCommentFilter"/>
138+
<modulename="AvoidNestedBlocks"/>
139+
<modulename="ConstantName"/>
140+
<modulename="EmptyCatchBlock"/>
141+
<modulename="EmptyStatement"/>
142+
<modulename="MissingOverride"/>
143+
<modulename="MultipleVariableDeclarations"/>
144+
<modulename="ParameterAssignment"/>
145+
<modulename="StringLiteralEquality"/>
146+
<modulename="RedundantImport"/>
147+
<modulename="UnusedImports"/>
148148

149-
<modulename="WhitespaceAfter"/>
149+
<modulename="WhitespaceAfter"/>
150150

151-
<modulename="NeedBraces"/>
152-
<modulename="UnnecessaryParentheses"/>
153-
<modulename="LeftCurly"/>
154-
<modulename="RightCurly"/>
151+
<modulename="NeedBraces"/>
152+
<modulename="UnnecessaryParentheses"/>
153+
<modulename="LeftCurly"/>
154+
<modulename="RightCurly"/>
155155

156-
<modulename="SuppressWarningsHolder"/>
156+
<modulename="SuppressWarningsHolder"/>
157157
</module>
158158
</module>
159159
</checkstyleRules>
@@ -188,10 +188,10 @@
188188
<plugin>
189189
<groupId>com.diffplug.spotless</groupId>
190190
<artifactId>spotless-maven-plugin</artifactId>
191-
<version>2.30.0</version>
191+
<version>2.46.0</version>
192192
<configuration>
193193
<java>
194-
<palantirJavaFormat/>
194+
<palantirJavaFormat/>
195195
<indent>
196196
<tabs>true</tabs>
197197
<spacesPerTab>2</spacesPerTab>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp