Skip to content

getProgrammingLanguage() should not return a default value if progLang is unknown #477

Description

@MatthieuNICOLAS

ProgrammingLanguage.getProgrammingLanguage() allows to retrieve the instance of a programming language from its name.

Currently, this function returns the instance of the programming language if it is found, the instance of the default programming language otherwise.
This behavior is the cause of some issues, in particular when we are deserializing an exercise from its JSON: when we encounters an unknown programming language, we overrides the instance of SourceFile corresponding to the default programming language (generally Java) by the SourceFile corresponding to this unknown language (see code here).

We should edit ProgrammingLanguage.getProgrammingLanguage() to return a null value or to throw an error if the programming language is unknown and should update the code calling this function to deal with this case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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