Vaadin form raises inexistent syntax errors

I am trying to create a sample CRM for a student project. Currently, I am utilising springboot and vaadin in the STS4. I am using components from their cookbook and the vaading crm tutorial and the their bookstore sample projects from github as templates (i am kind of mixing up the elements of the two, perhaps my lack of understanding is what causes me this trouble). In the form for submission, the following errors are raised in lines 67 and 49: “Syntax error on token “;”, { expected after this token” and “Syntax error, insert “}” to complete Block”. I am adding my complete form for your inspection, hopefully, someone can explain to me, what is causing the error. Here is “my” code:

package com.vaadin.tutorial.crm.UI.views.list;

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.ComponentEvent;
import com.vaadin.flow.component.ComponentEventListener;
import com.vaadin.flow.component.HasValue;
import com.vaadin.flow.component.Key;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.checkbox.CheckboxGroup;
import com.vaadin.flow.component.checkbox.CheckboxGroupVariant;
import com.vaadin.flow.component.combobox.ComboBox;
import com.vaadin.flow.component.formlayout.FormLayout;
import com.vaadin.flow.component.select.Select;
import com.vaadin.flow.component.listbox.ListBox;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.KeyModifier;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.EmailField;
import com.vaadin.flow.component.textfield.NumberField;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.binder.BeanValidationBinder;
import com.vaadin.flow.data.binder.Binder;
import com.vaadin.flow.data.binder.Result;
import com.vaadin.flow.data.binder.ValidationException;
import com.vaadin.flow.data.binder.ValueContext;
import com.vaadin.flow.shared.Registration;
import com.vaadin.tutorial.crm.backend.entity.Disponibilite;
import com.vaadin.tutorial.crm.backend.entity.Livre;
import com.vaadin.tutorial.crm.backend.entity.Livre.Categorie;
import com.vaadin.tutorial.crm.backend.entity.Stock;
import com.vaadin.flow.data.converter.Converter;
import com.vaadin.flow.data.converter.StringToIntegerConverter;

import java.util.List;
import java.util.Set;

public class LivreForm extends FormLayout{
	private Livre livre;
	private final Select<Disponibilite> disponibilite;
	private final TextField stockCount;
	TextField titreLivre = new TextField("titreLivre");
	TextField description = new TextField("description");
	TextField auteur = new TextField("auteur");
	TextField refeni = new TextField("refeni");
	TextField isbn = new TextField("isbn");
	stockCount = new TextField("In stock");
	stockCount.addThemeVariants(TextFieldVariant.LUMO_ALIGN_RIGHT);
	stockCount.setValueChangeMode(ValueChangeMode.EAGER);
	disponibilite = new Select<>();
	disponibilite.setLabel("Disponibilite");
	disponibilite.setWidth("100%");
	disponibilite.setItems(Disponibilite.values());
	content.add(disponibilite);

	ComboBox<Livre.Categorie> categorie = new ComboBox<>("Categorie");
	ListBox<Stock> stock = new ListBox<Stock>();

	ComboBox<Livre.Campus> campus = new ComboBox<>("Campus");

	Button save = new Button("Save"); 
	Button delete = new Button("Delete");
	Button close = new Button("Cancel");
	Binder<Livre> binder = new BeanValidationBinder<>(Livre.class);


	public LivreForm(List<Stock> stocks) {
		addClassName("livre-form");
		binder.bindInstanceFields(this);
		stock.setItems(stocks);
		disponibilite.setItems(Disponibilite.values());
		categorie.setItems(Livre.Categorie.values());
		campus.setItems(Livre.Campus.values());;
		add(titreLivre,
			description,
			auteur,
			refeni,
			isbn,
			disponibilite,
			categorie,
			campus,
			stock,
			createButtonsLayout()); 
	  }

	public void setLivre(Livre livre) {
		this.livre = livre; 
		binder.readBean(livre); 
	}




	private Component createButtonsLayout() {
		save.addThemeVariants(ButtonVariant.LUMO_PRIMARY); 
		delete.addThemeVariants(ButtonVariant.LUMO_ERROR);
		close.addThemeVariants(ButtonVariant.LUMO_TERTIARY);

		save.addClickShortcut(Key.ENTER); 
		close.addClickShortcut(Key.ESCAPE);

		save.addClickListener(event -> validateAndSave()); 
		delete.addClickListener(event -> fireEvent(new DeleteEvent(this, livre))); 
		close.addClickListener(event -> fireEvent(new CloseEvent(this))); 

		binder.addStatusChangeListener(e -> save.setEnabled(binder.isValid()));

		return new HorizontalLayout(save, delete, close); 
	  }

	private void validateAndSave() {
		  try {
			binder.writeBean(livre); 
			fireEvent(new SaveEvent(this, livre)); 
		  } catch (ValidationException e) {
			e.printStackTrace();
		  }
		}

	public static abstract class LivreFormEvent extends ComponentEvent<LivreForm> {


		/**
		 * 
		 */
		private static final long serialVersionUID = -7236023661050023675L;
		private Livre livre;

		  protected LivreFormEvent(LivreForm source,Livre livre) { 
			super(source, false);
			this.livre = livre;
		  }

		  public Livre getLivre() {
			return livre;
		  }
		}

		public static class SaveEvent extends LivreFormEvent {
		  SaveEvent(LivreForm source, Livre livre) {
			super(source, livre);
		  }
		}

		public static class DeleteEvent extends LivreFormEvent {
		  DeleteEvent(LivreForm source, Livre livre) {
			super(source, livre);
		  }

		}

		public static class CloseEvent extends LivreFormEvent {
		  CloseEvent(LivreForm source) {
			super(source, null);
		  }
		}

		public <T extends ComponentEvent<?>> Registration addListener(Class<T> eventType,
			ComponentEventListener<T> listener) { 
		  return getEventBus().addListener(eventType, listener);
		}

		@SuppressWarnings("serial")
		private static class StockCountConverter extends StringToIntegerConverter {

			public StockCountConverter() {
				super(0, "Could not convert value to " + Integer.class.getName()
						+ ".");
			}



}
}

And this is a screenshot of the errors: ](http://)
18576516.png

Hi,

The code has syntax errors. You can’t call this:
stockCount = new TextField(“In stock”);

outside a method. You can call it in the constructor or in a method.

Thanks, that helps a lot