Files
openide/java/java-tests/testData/inspection/optionalGet/AbstractEnum.java
Tagir Valeev 651a333e8e TypeConstraints: handle incorrect abstract final classes (final wins)
Before this if class is final we assumed that all its instances are exact instances; however if it's also abstract, we assumed that exact instances cannot be instantiated (which is technically correct). Thus we could not create TypeConstraint for such a type at all (which is also technically correct). However, clients may not expect the bottom constraint, so we decide now to ignore abstract modifier in such a case to be able to continue the analysis.

GitOrigin-RevId: 04c9eafd7574154ea6389028a82b24ce735d6a49
2020-03-27 10:01:15 +00:00

9 lines
227 B
Java

import java.util.Optional;
class AAA {
<error descr="Modifier 'abstract' not allowed here">abstract</error> enum X {A, B;}
public static void main(String[] args) {
Optional.of(args.length > 0 ? X.A : X.B).get();
}
}