gama-platform / gama.experimental

Home of experimental plugins for GAMA
13 stars 6 forks source link

Skill breaks model validation #44

Open lesquoyb opened 1 month ago

lesquoyb commented 1 month ago

I've added a new skill to the repository, everything compiles and the name of the skill is recognized in gaml, but as soon as I add it the validation of the model breaks: I have an xtext validation error window opening when I first open the file and here is the stack I have in eclipse:

java.lang.NullPointerException: Cannot invoke "gama.core.common.interfaces.ISkill.getDescription()" because the return value of "gama.gaml.expressions.IExpression.getConstValue()" is null
    at gama.gaml.descriptions.SpeciesDescription.setSkills(SpeciesDescription.java:229)
    at gama.gaml.descriptions.SpeciesDescription.<init>(SpeciesDescription.java:142)
    at gama.gaml.descriptions.SpeciesDescription.<init>(SpeciesDescription.java:111)
    at gama.gaml.factories.SpeciesFactory.buildDescription(SpeciesFactory.java:38)
    at gama.gaml.factories.SpeciesFactory.buildDescription(SpeciesFactory.java:1)
    at gama.gaml.factories.DescriptionFactory.create(DescriptionFactory.java:550)
    at gama.gaml.factories.ModelFactory.addMicroSpecies(ModelFactory.java:565)
    at gama.gaml.factories.ModelFactory.lambda$3(ModelFactory.java:258)
    at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:986)
    at gama.gaml.factories.ModelFactory.addSpeciesAndExperiments(ModelFactory.java:258)
    at gama.gaml.factories.ModelFactory.createModelDescription(ModelFactory.java:181)
    at gaml.compiler.gaml.resource.GamlResource.buildModelDescription(GamlResource.java:152)
    at gaml.compiler.gaml.resource.GamlResource.buildCompleteDescription(GamlResource.java:186)
    at gaml.compiler.gaml.resource.GamlResource.validate(GamlResource.java:214)
    at gaml.compiler.gaml.validation.GamlResourceValidator.lambda$0(GamlResourceValidator.java:91)
    at gama.dev.DEBUG.TIMER(DEBUG.java:136)
    at gaml.compiler.gaml.validation.GamlResourceValidator.validate(GamlResourceValidator.java:78)
    at gaml.compiler.ui.editor.GamlEditor$3.lambda$0(GamlEditor.java:537)
    at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:70)
    at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.internalReadOnly(XtextDocument.java:525)
    at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.readOnly(XtextDocument.java:497)
    at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:136)
    at gaml.compiler.ui.editor.GamlEditor$3.run(GamlEditor.java:535)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

You can try it out by loading the pmml plugin in gama and open the read_input_fields.gaml model in PMML Manipulation.

This is not the first time I have a similar issue when creating a skill, so it may just be something missing in the documentation.