BuggleInc / PLM

Programmer's Learning Machine
http://people.irisa.fr/Martin.Quinson/Teaching/PLM/
Other
63 stars 40 forks source link

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

Open MatthieuNICOLAS opened 7 years ago

MatthieuNICOLAS commented 7 years ago

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.