The following tests are added in DeduplicationTest demonstrate the problem:
// generates typeSwitch
group((Function<Object, Integer>) x -> switch (x) { case String s -> s.length(); default -> -1; },
(Function<Object, Integer>) x -> switch (x) { case String s -> s.length(); default -> -1; });
// local variable names are erroneously significant
group((Function<Object, Integer>) x -> {
int y1 = -1;
return y1;
},
(Function<Object, Integer>) x -> {
int y2 = -1;
return y2;
});
// consequently, instanceof that generates names with "tmp" + variableIndex++ + "$" demonstrate the problem again
group((Function<Object, Integer>) x -> x instanceof int i2 ? i2 : -1,
(Function<Object, Integer>) x -> x instanceof int i2 ? i2 : -1);
// generates typeSwitch
group((Function<Object, Integer>) x -> switch (x) { case String s -> s.length(); default -> -1; },
(Function<Object, Integer>) x -> switch (x) { case String s -> s.length(); default -> -1; });
// local variable names are erroneously significant
group((Function<Object, Integer>) x -> {
int y1 = -1;
return y1;
},
(Function<Object, Integer>) x -> {
int y2 = -1;
return y2;
});
// consequently, instanceof that generates names with "tmp" + variableIndex++ + "$" demonstrate the problem again
group((Function<Object, Integer>) x -> x instanceof int i2 ? i2 : -1,
(Function<Object, Integer>) x -> x instanceof int i2 ? i2 : -1);
- links to
-
Commit(master) openjdk/jdk/895a7b64
-
Review(master) openjdk/jdk/21687