Skip to content

Enable class invariants for all classes. #3584

@mattulbrich

Description

@mattulbrich

Invariants can only be extended for the local class or all final classes and there is no good reason for this restriction. Hence we suggest to lift this restriction.

Underlying problem

In reality, knowing about invariants should not be limited to final classes. The generated taclets are guarded by an exactInstance expression making the scenario sound.

The restriction seems rather arbitrary.

Estimated effort

Well, it seems the 3 lines below could easily be removed.

... We should just think about it to make sure it is sound and does not compromise automation.

Additional context

for (KeYJavaType kjt : services.getJavaInfo().getAllKeYJavaTypes()) {
if (kjt != selfKjt && !ji.isFinal(kjt)) {
continue; // only final classes
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions