title: Apache POI 4.0.0 compilation error on CellType
body: <p>Compilation fails with this error :</p>
  
  <pre><code>cannot find symbol
  case FORMULA:
  symbol: variable FORMULA
  </code></pre>
  
  <p>The same error occurs on next cases.</p>
  
  <p>I'm using Apache POI 4.0.0 with Java 8.</p>
  
  <p>My code is :</p>
  
  <pre><code>try (Workbook wb = WorkbookFactory.create(inputStream)) {
      Sheet sheet = wb.getSheetAt(0);
          for (Row row : sheet) {
              for (Cell cell : row) {
                  switch (cell.getCellType()) {
                      case FORMULA:
                          [code]
                          break;
                  }
              }
          }
  }
  </code></pre>
  
  <p>Note 1 : deployment to local GlassFish 4.1.2 from NetBeans 8.2 works, but build fails.</p>
  
  <p>Note 2 : If I replace "getCellType" with "getCellTypeEnum" (deprecated), build completes without error.</p>
  
  <p>Versions:</p>
  
  <ul>
  <li>Java 1.8u172 (i586) / then Java 1.8u181 (i586)</li>
  <li>poi-4.0.0</li>
  <li>poi-ooxml-4.0.0</li>
  <li>poi-ooxml-schemas-4.0.0</li>
  <li>xmlbeans-3.0.1</li>
  <li>commons-codec-1.11</li>
  <li>commons-collections4-4.2</li>
  <li>commons-logging-1.2</li>
  <li>commons-math3-3.6.1</li>
  <li>jsf-api-2.2.15</li>
  <li>jsf-impl-2.2.15</li>
  <li>primefaces-6.2.6 </li>
  </ul>
  
  <h1>Full code</h1>
  
  <h3>POIUtils.java</h3>
  
  <pre><code>package fr.mycompany.config.files;
  
  import fr.mycompany.config.exception.MyAppException;
  import java.io.IOException;
  import java.io.InputStream;
  import java.time.LocalDate;
  import java.time.ZoneId;
  import java.time.format.DateTimeFormatter;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Locale;
  import javax.faces.application.FacesMessage;
  import org.apache.poi.EncryptedDocumentException;
  import org.apache.poi.ss.usermodel.Cell;
  import org.apache.poi.ss.usermodel.DataFormatter;
  import org.apache.poi.ss.usermodel.DateUtil;
  import org.apache.poi.ss.usermodel.Row;
  import org.apache.poi.ss.usermodel.Sheet;
  import org.apache.poi.ss.usermodel.Workbook;
  import org.apache.poi.ss.usermodel.WorkbookFactory;
  import org.apache.poi.ss.usermodel.CellType;
  
  public class POIUtils {
  
      public static List&lt;List&lt;String&gt;&gt; parseExcelFile(InputStream is) throws MyAppException {
  
          List&lt;List&lt;String&gt;&gt; lines = new ArrayList&lt;&gt;();
  
          try (Workbook wb = WorkbookFactory.create(is)) {
              Sheet sheet = wb.getSheetAt(0);
              DataFormatter df = new DataFormatter(true);
              int numRow = 0;
              for (Row row : sheet) {
                  int numCol = 0;
                  List&lt;String&gt; currentLine = new ArrayList&lt;&gt;();
                  for (Cell cell : row) {
                      switch (cell.getCellType()) {
                          case FORMULA:
                              currentLine.add(numCol, "");
                              break;
                          case NUMERIC:
                              if (DateUtil.isCellDateFormatted(cell)) {
                                  LocalDate ld = cell.getDateCellValue().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
                                  String frLocalDate = ld.format(DateTimeFormatter.ofPattern("dd/MM/yyyy", Locale.FRANCE));
                                  currentLine.add(numCol, frLocalDate);
                              } else {
                                  String cellValue = df.formatCellValue(cell);
                                  currentLine.add(numCol, cellValue);
                              }
                              break;
                          default:
                              String cellValue = df.formatCellValue(cell);
                              currentLine.add(numCol, cellValue);
                              break;
                      }
                      numCol++;
                  }
                  while (row.getRowNum() &gt; numRow) {
                      lines.add(new ArrayList&lt;&gt;());
                      numRow++;
                  }
                  lines.add(row.getRowNum(), currentLine);
                  numRow++;
              }
              if (lines.isEmpty()) {
                  throw new MyAppException(FacesMessage.SEVERITY_WARN, "Le fichier est vide.");
              }
          } catch (IOException ex) {
              throw new MyAppException(FacesMessage.SEVERITY_FATAL, "Une erreur est survenue lors du traitement du fichier.", ex);
          } catch (EncryptedDocumentException ex) {
              throw new MyAppException(FacesMessage.SEVERITY_FATAL, "Le fichier est protégé par un mot de passe et n'a pas pu être lu.", ex);
          }
  
          return lines;
  
      }    
  
  }
  </code></pre>
  
  <h3>FileImportBean.java</h3>
  
  <pre><code>package fr.mycompany.coordination;
  
  import fr.mycompany.config.exception.MyAppException;
  import fr.mycompany.config.files.POIUtils;
  import java.io.Serializable;
  import java.io.IOException;
  import javax.faces.application.FacesMessage;
  import javax.inject.Named;
  import javax.faces.view.ViewScoped;
  import java.util.List;
  import java.util.ArrayList;
  import org.apache.poi.poifs.filesystem.FileMagic;
  import org.primefaces.event.FileUploadEvent;
  import org.primefaces.event.UploadedFile;
  
  @Named
  @ViewScoped
  public class FileImportBean implements Serializable {
  
      private transient UploadedFile file;
      private List&lt;List&lt;String&gt;&gt; parsedContent = new ArrayList&lt;&gt;();
  
      public void handleFileUpload (FileUploadEvent event) {
          try {
              file = event.getFile();
              if (null != file) {
                  switch (FileMagic.valueOf(FileMagic.prepareToCheckMagic(file.getInputstream()))) {
                      case OOXML:
                          parsedContent = POIUtils.parseExcelFile(file.getInputstream());
                          break;
                      default:
                          (new MyAppException(FacesMessage.SEVERITY_ERROR, "Type de fichier non géré.", ex)).doFacesMessage();
                          break;
                  }
              } else {
              }
          } catch (IOException ex) {
              (new MyAppException(FacesMessage.SEVERITY_FATAL, "Une erreur est survenue lors du traitement du fichier.", ex)).doFacesMessage();
          } catch (MyAppException ex) {
              ex.doFacesMessage();
          }
      }
  
  }
  </code></pre>
  
  <h3>fileImport.xhtml</h3>
  
  <pre><code>&lt;h:form enctype="multipart/form-data"&gt;
      &lt;p:messages showDetail="true" /&gt;
      &lt;p:fileUpload
          mode="advanced"
          skinSimple="true"
          auto="true"
          multiple="false"
          required="true"
          update="@form"
          fileUploadListener="#{fileImportBean.handleFileUpload}"
  &lt;/h:form&gt;
  </code></pre>