mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-01 09:04:15 +07:00
IDEA-360860 fixed * split tests into individual methods, to make debugging easier * add javadoc for VariableAccessUtils#isVariableTypeChangeSafeForReference (cherry picked from commit f6b3468079959f7adec737e0b8ec3ad1d97e7ad2) IJ-MR-150176 GitOrigin-RevId: 4b430e49819c7cba1e08ecee47b881f05be570d4
21 lines
452 B
Java
21 lines
452 B
Java
import java.util.Optional;
|
|
|
|
class Super {
|
|
private int x;
|
|
|
|
public void foo(Optional<Sub> opt) {
|
|
if (opt == null) opt = Optional.empty();
|
|
if (opt.isPresent()) {
|
|
// Changing type of `obj` from Super to Sub will cause a compile-time error (field x is private). Hence, don't suggest fix.
|
|
Super obj = opt.get();
|
|
use(obj.x);
|
|
}
|
|
}
|
|
|
|
void use(Object obj) {
|
|
System.out.println("Object");
|
|
}
|
|
}
|
|
|
|
class Sub extends Super {}
|